Skip to content
Snippets Groups Projects
Commit c66db032 authored by Maximilian Giller's avatar Maximilian Giller
Browse files

Hardcoded default empty space

parent 882a7022
No related branches found
No related tags found
No related merge requests found
Pipeline #50712 passed
<?php <?php
$EMPTY_SPACE_FILE = __DIR__."/empty-space.json"; $EMPTY_SPACE = '{"links":[],"nodes":[]}';
$SPACES_DIR = __DIR__."/spaces/"; $SPACES_DIR = __DIR__."/spaces/";
add_action("wp_ajax_get_space", "kg_get_space"); // Fires only for logged-in-users add_action("wp_ajax_get_space", "kg_get_space"); // Fires only for logged-in-users
...@@ -91,10 +91,9 @@ function kg_create_empty_space($file_path) { ...@@ -91,10 +91,9 @@ function kg_create_empty_space($file_path) {
return; return;
} }
// Read and copy default empty graph from default file // Write empty space to file
global $EMPTY_SPACE_FILE; global $EMPTY_SPACE;
$empty_graph = file_get_contents($EMPTY_SPACE_FILE); file_put_contents($file_path, $EMPTY_SPACE);
file_put_contents($file_path, $empty_graph);
} }
function endsWith( $haystack, $needle ) { function endsWith( $haystack, $needle ) {
......
{"links":[],"nodes":[]}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment