diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-01-08 13:48:20 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-01-08 13:48:20 +0100 |
commit | 2b74984974b8363aa2bf197fb1d3950f7425a878 (patch) | |
tree | 9f9df8ab781a7b19fe8d499d130128c1182ddc91 /ratatoeskr/sys/plugin_api.php | |
parent | 39321547c697cb95c8259595426f74ff0ac551ba (diff) | |
download | ratatoeskr-cms-2b74984974b8363aa2bf197fb1d3950f7425a878.tar.gz ratatoeskr-cms-2b74984974b8363aa2bf197fb1d3950f7425a878.tar.bz2 ratatoeskr-cms-2b74984974b8363aa2bf197fb1d3950f7425a878.zip |
Improved Plugin API.
Diffstat (limited to 'ratatoeskr/sys/plugin_api.php')
-rw-r--r-- | ratatoeskr/sys/plugin_api.php | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/ratatoeskr/sys/plugin_api.php b/ratatoeskr/sys/plugin_api.php index e8f1a2c..797f42d 100644 --- a/ratatoeskr/sys/plugin_api.php +++ b/ratatoeskr/sys/plugin_api.php @@ -15,15 +15,15 @@ require_once(dirname(__FILE__) . "/../frontend.php"); /* * Constant: APIVERSION - * The current API version (3). + * The current API version (4). */ -define("APIVERSION", 3); +define("APIVERSION", 4); /* * Array: $api_compat * Array of API versions, this version is compatible to (including itself). */ -$api_compat = array(3); +$api_compat = array(3, 4); $url_handlers = array(); /* @@ -158,6 +158,8 @@ abstract class RatatoeskrPlugin * * Your $fx should output output the result of a STE template, which should load "/systemtemplates/master.html" and overwrite the "content" section. * + * If you need a URL to your pluginpage, you can use <get_backend_pluginpage_url> and the STE variable $rel_path_to_pluginpage. + * * See also: * <prepare_backend_pluginpage> */ @@ -167,7 +169,28 @@ abstract class RatatoeskrPlugin $this->ste->vars["pluginpages"][$this->id] = $label; sort($this->ste->vars["pluginpages"]); - $pluginpages_handlers["p{$this->id}"] = $fx; + $pluginid = $this->id; + $pluginpages_handlers["p{$this->id}"] = function(&$data, $url_now, &$url_next) use($pluginid, $fx) + { + global $ste, $rel_path_to_root; + $ste->vars["rel_path_to_pluginpage"] = "$rel_path_to_root/backend/pluginpages/p$pluginid"; + $rv = $fx($data, $url_now, $url_next); + unset($ste->vars["rel_path_to_pluginpage"]); + return $rv; + }; + } + + /* + * Function: get_backend_pluginpage_url + * Get the URL to your backend plugin page. + * + * Returns: + * The URL to your backend plugin page. + */ + final protected function get_backend_pluginpage_url() + { + global $rel_path_to_root; + return "$rel_path_to_root/backend/pluginpages/p{$this->id}"; } /* |