diff options
author | Guy Brand <gb@unistra.fr> | 2015-08-10 10:03:27 +0200 |
---|---|---|
committer | Guy Brand <gb@unistra.fr> | 2015-08-10 10:03:27 +0200 |
commit | 53a57d16b9c741bb44099fd93bf79efa06796341 (patch) | |
tree | 24a90a50afe9325926c8ebaa2ed90f9fa093e5b9 /inc/plugin.php | |
parent | cf6e6645c31a9f185cef3fb9452fb188882ede47 (diff) | |
parent | a060d9973e7c1d5051f2cc426937881826e4972e (diff) | |
download | rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.gz rpg-53a57d16b9c741bb44099fd93bf79efa06796341.tar.bz2 |
Merge branch master into stable
Diffstat (limited to 'inc/plugin.php')
-rw-r--r-- | inc/plugin.php | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/inc/plugin.php b/inc/plugin.php index 80689e389..f2ad95e2e 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -33,7 +33,7 @@ class DokuWiki_Plugin { public function getInfo(){ $parts = explode('_', get_class($this)); $info = DOKU_PLUGIN . '/' . $parts[2] . '/plugin.info.txt'; - if(@file_exists($info)) return confToHash($info); + if(file_exists($info)) return confToHash($info); msg( 'getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found.<br />' . @@ -48,14 +48,25 @@ class DokuWiki_Plugin { // plugin introspection methods // extract from class name, format = <plugin type>_plugin_<name>[_<component name>] + /** + * @return string plugin type + */ public function getPluginType() { list($t) = explode('_', get_class($this), 2); return $t; } + + /** + * @return string plugin name + */ public function getPluginName() { list(/* $t */, /* $p */, $n) = explode('_', get_class($this), 4); return $n; } + + /** + * @return string component name + */ public function getPluginComponent() { list(/* $t */, /* $p */, /* $n */, $c) = explode('_', get_class($this), 4); return (isset($c)?$c:''); @@ -91,17 +102,19 @@ class DokuWiki_Plugin { } /** - * localFN($id) - * prepends appropriate path for a language dependent filename + * Prepends appropriate path for a language dependent filename * plugin equivalent of localFN() + * + * @param string $id id of localization file + * @return string wiki text */ public function localFN($id) { global $conf; $plugin = $this->getPluginName(); $file = DOKU_CONF.'plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; - if (!@file_exists($file)){ + if (!file_exists($file)){ $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; - if(!@file_exists($file)){ + if(!file_exists($file)){ //fall back to english $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; } @@ -110,9 +123,8 @@ class DokuWiki_Plugin { } /** - * setupLocale() - * reads all the plugins language dependent strings into $this->lang - * this function is automatically called by getLang() + * Reads all the plugins language dependent strings into $this->lang + * this function is automatically called by getLang() */ function setupLocale() { if($this->localised) return; @@ -125,7 +137,7 @@ class DokuWiki_Plugin { // don't include once, in case several plugin components require the same language file @include($path . 'en/lang.php'); foreach($config_cascade['lang']['plugin'] as $config_file) { - if(@file_exists($config_file . $this->getPluginName() . '/en/lang.php')) { + if(file_exists($config_file . $this->getPluginName() . '/en/lang.php')) { include($config_file . $this->getPluginName() . '/en/lang.php'); } } @@ -133,7 +145,7 @@ class DokuWiki_Plugin { if($conf['lang'] != 'en') { @include($path . $conf['lang'] . '/lang.php'); foreach($config_cascade['lang']['plugin'] as $config_file) { - if(@file_exists($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php')) { + if(file_exists($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php')) { include($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php'); } } @@ -195,7 +207,7 @@ class DokuWiki_Plugin { $path = DOKU_PLUGIN.$this->getPluginName().'/conf/'; $conf = array(); - if (@file_exists($path.'default.php')) { + if (file_exists($path.'default.php')) { include($path.'default.php'); } @@ -209,8 +221,7 @@ class DokuWiki_Plugin { * * @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 + * @return DokuWiki_Plugin|null helper plugin object */ public function loadHelper($name, $msg = true){ $obj = plugin_load('helper',$name); @@ -224,6 +235,12 @@ class DokuWiki_Plugin { /** * email * standardised function to generate an email link according to obfuscation settings + * + * @param string $email + * @param string $name + * @param string $class + * @param string $more + * @return string html */ public function email($email, $name='', $class='', $more='') { if (!$email) return $name; @@ -236,6 +253,13 @@ class DokuWiki_Plugin { /** * external_link * standardised function to generate an external link according to conf settings + * + * @param string $link + * @param string $title + * @param string $class + * @param string $target + * @param string $more + * @return string */ public function external_link($link, $title='', $class='', $target='', $more='') { global $conf; @@ -260,8 +284,9 @@ class DokuWiki_Plugin { * Instead use render_text() * * @deprecated 2014-01-22 - * @param $name - * @param $arguments + * + * @param string $name + * @param array $arguments * @return null|string */ public function __call($name, $arguments) { @@ -278,7 +303,7 @@ class DokuWiki_Plugin { * output text string through the parser, allows dokuwiki markup to be used * very ineffecient for small pieces of data - try not to use * - * @param string $text wiki markup to parse + * @param string $text wiki markup to parse * @param string $format output format * @return null|string */ |