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

Extracted spaces to extra directory

parent 34d668c8
No related branches found
No related tags found
No related merge requests found
Pipeline #50669 passed
<?php
$EMPTY_SPACE_FILE = kg_get_space_file_path("default").".hidden";
$EMPTY_SPACE_FILE = __DIR__."/empty-space.json";
$SPACES_DIR = __DIR__."/spaces/";
add_action("wp_ajax_get_space", "kg_get_space"); // Fires only for logged-in-users
add_action("wp_ajax_nopriv_get_space", 'kg_get_space' ); // Fires for everyone
......@@ -56,11 +57,18 @@ function kg_store_new_graph($graph, $space_id) {
}
function kg_get_space_file_path($space_id) {
return __DIR__."/".$space_id.".json";
// Cleaning up the space id
$space_id = str_replace("/", "-", $space_id);
$space_id = str_replace("\\", "-", $space_id);
$space_id = str_replace(".", "-", $space_id);
global $SPACES_DIR;
return $SPACES_DIR.$space_id.".json";
}
function kg_get_list_of_spaces() {
$all_files = scandir(__DIR__);
global $SPACES_DIR;
$all_files = scandir($SPACES_DIR);
if ($all_files == false) {
return [];
......
File moved
File moved
File moved
{"links":[{"source":"tNp3gydg","target":"flL8y4fI"},{"source":"flL8y4fI","target":"HL2mJfY7"},{"source":"HL2mJfY7","target":"c2kVhY7g"},{"source":"c2kVhY7g","target":"flL8y4fI"},{"source":"flL8y4fI","target":"6PDvcacV"}],"nodes":[{"id":"flL8y4fI","name":"Musik","type":"Beispiel"},{"id":"6PDvcacV","name":"Comics","type":"Beispiel"},{"id":"HL2mJfY7","name":"Peter Fox","type":"Beispiel"},{"id":"c2kVhY7g","name":"Haus Am See","type":"Vorlesung"},{"id":"tNp3gydg","name":"Filme","type":"Übung"}]}
\ No newline at end of file
File moved
File moved
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