summaryrefslogtreecommitdiff
path: root/lib/plugins/syntax.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-02-03 22:57:45 +0100
committerAndreas Gohr <andi@splitbrain.org>2013-02-03 22:57:45 +0100
commit3da7921f08ecdda929466921ecc50698f1adf99e (patch)
tree0e179e504399e874bfd785d0a95eec44b76d5952 /lib/plugins/syntax.php
parent6cf2bbfa12b776cf47cb69ae40fb8862f715ad01 (diff)
parentcc4bb766fdac23358d7b586aa3830b9650eed7a8 (diff)
downloadrpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.gz
rpg-3da7921f08ecdda929466921ecc50698f1adf99e.tar.bz2
Merge branch 'master' into future
* master: (162 commits) fixed revision JS for images upgraded SimplePie to 1.3.1 FS#2708 removed obsolete browser plugin (migrate does it) adjust spacing to match standard 1.4em grid added comment on use of whitelist vs blacklist Updated idfilter() function for IIS use var and remove suggestions when needed Use variable for maximum number of suggestions for quicksearch. And hide suggestions when search field is emptied, or when no suggestion are found. added 'home' class to first link in hierarchical breadcrumbs reduced required max width to go into tablet mode re-added linear gradients for firefox added missing styling for disabled form elements (FS#2705) fixed acronyms in italics (FS#2684) improved print styles (includes fixes for FS#2645 and FS#2707) basic styles improvements Greek language update Use list in acl help text, for more structure Galician language update touch the config on save, even if no changes were made unwind the width narrowing commit put some whitespace between form submit button and fieldset bottom border ... Conflicts: lib/plugins/config/admin.php lib/plugins/config/settings/config.class.php
Diffstat (limited to 'lib/plugins/syntax.php')
-rw-r--r--lib/plugins/syntax.php120
1 files changed, 70 insertions, 50 deletions
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php
index 8b94493e4..b7839b2b2 100644
--- a/lib/plugins/syntax.php
+++ b/lib/plugins/syntax.php
@@ -84,13 +84,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
*
* Usually you should only need the $match param.
*
- * @param $match string The text matched by the patterns
- * @param $state int The lexer state for the match
- * @param $pos int The character position of the matched text
- * @param $handler Doku_Handler Reference to the Doku_Handler object
- * @return array Return an array with all data you want to use in render
+ * @param string $match The text matched by the patterns
+ * @param int $state The lexer state for the match
+ * @param int $pos The character position of the matched text
+ * @param Doku_Handler $handler Reference to the Doku_Handler object
+ * @return array Return an array with all data you want to use in render
*/
- function handle($match, $state, $pos, &$handler){
+ function handle($match, $state, $pos, Doku_Handler &$handler){
trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING);
}
@@ -117,7 +117,7 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
* @param $data array data created by handler()
* @return boolean rendered correctly?
*/
- function render($format, &$renderer, $data) {
+ function render($format, Doku_Renderer &$renderer, $data) {
trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING);
}
@@ -226,56 +226,76 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode {
$this->localised = true;
}
- // configuration methods
- /**
- * getConf($setting)
- *
- * use this function to access plugin configuration variables
- */
- function getConf($setting){
-
- if (!$this->configloaded){ $this->loadConfig(); }
-
- return $this->conf[$setting];
- }
-
- /**
- * loadConfig()
- * merges the plugin's default settings with any local settings
- * this function is automatically called through getConf()
- */
- function loadConfig(){
- global $conf;
-
- $defaults = $this->readDefaultSettings();
- $plugin = $this->getPluginName();
-
- foreach ($defaults as $key => $value) {
- if (isset($conf['plugin'][$plugin][$key])) continue;
- $conf['plugin'][$plugin][$key] = $value;
+ // configuration methods
+ /**
+ * getConf($setting)
+ *
+ * use this function to access plugin configuration variables
+ */
+ function getConf($setting) {
+
+ if(!$this->configloaded) { $this->loadConfig(); }
+
+ return $this->conf[$setting];
+ }
+
+ /**
+ * loadConfig()
+ * merges the plugin's default settings with any local settings
+ * this function is automatically called through getConf()
+ */
+ function loadConfig() {
+ global $conf;
+
+ $defaults = $this->readDefaultSettings();
+ $plugin = $this->getPluginName();
+
+ foreach($defaults as $key => $value) {
+ if(isset($conf['plugin'][$plugin][$key])) continue;
+ $conf['plugin'][$plugin][$key] = $value;
+ }
+
+ $this->configloaded = true;
+ $this->conf =& $conf['plugin'][$plugin];
}
- $this->configloaded = true;
- $this->conf =& $conf['plugin'][$plugin];
- }
+ /**
+ * read the plugin's default configuration settings from conf/default.php
+ * this function is automatically called through getConf()
+ *
+ * @return array setting => value
+ */
+ function readDefaultSettings() {
- /**
- * read the plugin's default configuration settings from conf/default.php
- * this function is automatically called through getConf()
- *
- * @return array setting => value
- */
- function readDefaultSettings() {
+ $path = DOKU_PLUGIN.$this->getPluginName().'/conf/';
+ $conf = array();
- $path = DOKU_PLUGIN.$this->getPluginName().'/conf/';
- $conf = array();
+ if(@file_exists($path.'default.php')) {
+ include($path.'default.php');
+ }
- if (@file_exists($path.'default.php')) {
- include($path.'default.php');
+ return $conf;
}
- return $conf;
- }
+ /**
+ * Loads a given helper plugin (if enabled)
+ *
+ * @author Esther Brunner <wikidesign@gmail.com>
+ *
+ * @param string $name name of plugin to load
+ * @param bool $msg if a message should be displayed in case the plugin is not available
+ *
+ * @return object helper plugin object
+ */
+ function loadHelper($name, $msg = true) {
+ if(!plugin_isdisabled($name)) {
+ $obj = plugin_load('helper', $name);
+ } else {
+ $obj = null;
+ }
+ if(is_null($obj) && $msg) msg("Helper plugin $name is not available or invalid.", -1);
+ return $obj;
+ }
/**
* Allow the plugin to prevent DokuWiki from reusing an instance