Skip to content

Commit

Permalink
Added loadHelper() to DokuWiki_Syntax_Plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Klap-in committed Jan 26, 2013
1 parent fdf855d commit fec2acc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/plugins/syntax.php
Expand Up @@ -277,6 +277,26 @@ function readDefaultSettings() {
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){
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
*
Expand Down

0 comments on commit fec2acc

Please sign in to comment.