diff --git a/dokuwiki/common.php b/dokuwiki/common.php new file mode 100644 index 0000000..7d474fb --- /dev/null +++ b/dokuwiki/common.php @@ -0,0 +1,47 @@ + + */ + + // must be run within DokuWiki +if(!defined('DOKU_INC')) die(); + +function hackerbase_spaceapi_html_snippet($spaceapi_status_json) { + $str = file_get_contents($spaceapi_status_json); + /** @var Doku_Renderer_xhtml $renderer */ + $status = "UNKNOWN"; + if ($str == FALSE) { + $status = "ERROR:FILE"; + } else { + $json = json_decode($str, true); + if ($json == NULL) { + $status = "ERROR:JSON"; + } else { + $opened = $json['state']['open']; + $lastchange = $json['state']['lastchange']; + $myfile = __FILE__; + $mydir = dirname($myfile); + $mydirname = basename($mydir); + $assetsdir = DOKU_BASE . "lib/plugins/" . $mydirname . "/assets"; + if ($opened == TRUE) { + $status = + '
Last changed: ' . $str_date . '
'; + } + } + } + return $status; +}