From 40e0b44409037978b0bce4b451b1569c3bc3ee19 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 15 Feb 2014 10:58:33 +0100 Subject: use http_sendfile correct --- inc/actions.php | 2 +- inc/fetch.functions.php | 2 +- inc/httputils.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/actions.php b/inc/actions.php index 50cbe369f..4dbad1a32 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -697,7 +697,7 @@ function act_sitemap($act) { // Send file //use x-sendfile header to pass the delivery to compatible webservers - if (http_sendfile($sitemap)) exit; + http_sendfile($sitemap); readfile($sitemap); exit; diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 3eacaa2fe..c61c54503 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -77,7 +77,7 @@ function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) { } //use x-sendfile header to pass the delivery to compatible webservers - if(http_sendfile($file)) exit; + http_sendfile($file); // send file contents $fp = @fopen($file, "rb"); diff --git a/inc/httputils.php b/inc/httputils.php index ca60ed509..fdf453a8c 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -64,12 +64,13 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith + * @param string $file absolute path of file to send * @returns void or exits with previously header() commands executed */ function http_sendfile($file) { global $conf; - //use x-sendfile header to pass the delivery to compatible webservers + //use x-sendfile header to pass the delivery to compatible web servers if($conf['xsendfile'] == 1){ header("X-LIGHTTPD-send-file: $file"); ob_end_clean(); @@ -83,8 +84,6 @@ function http_sendfile($file) { ob_end_clean(); exit; } - - return false; } /** @@ -223,7 +222,8 @@ function http_cached($cache, $cache_ok) { header('Content-Encoding: gzip'); readfile($cache.".gz"); } else { - if (!http_sendfile($cache)) readfile($cache); + http_sendfile($cache); + readfile($cache); } exit; } -- cgit v1.2.3 From 446b5b5934799f1f906ea8903b1e96c981f1c1b2 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann Date: Sat, 15 Feb 2014 10:59:18 +0100 Subject: FS#2388 give relative path to sendfile on nginx --- inc/httputils.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc') diff --git a/inc/httputils.php b/inc/httputils.php index fdf453a8c..d6532720f 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -80,6 +80,8 @@ function http_sendfile($file) { ob_end_clean(); exit; }elseif($conf['xsendfile'] == 3){ + // FS#2388 nginx just needs the relative path. + $file = DOKU_REL.substr($file, strlen(fullpath(DOKU_INC)) + 1); header("X-Accel-Redirect: $file"); ob_end_clean(); exit; -- cgit v1.2.3 From a7e8b43e07d1665d3fdff8bde3a9850c0228efaf Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 15 Feb 2014 15:47:24 +0100 Subject: Add FULLTEXT_PHRASE_MATCH event for allowing plugins to match phrases Our index doesn't support phrase searches so we are searching for the pages that contain all words of the phrase and then search again in the content of the pages. As plugins can also add additional text to the index this event allows plugins to do phrase matching in their content. --- inc/fulltext.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/fulltext.php b/inc/fulltext.php index bd8e6b866..cc6742e5d 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -72,8 +72,20 @@ function _ft_pageSearch(&$data) { $pages = end($stack); $pages_matched = array(); foreach(array_keys($pages) as $id){ - $text = utf8_strtolower(rawWiki($id)); - if (strpos($text, $phrase) !== false) { + $evdata = array( + 'id' => $id, + 'phrase' => $phrase, + 'text' => rawWiki($id) + ); + $evt = new Doku_Event('FULLTEXT_PHRASE_MATCH',$evdata); + if ($evt->advise_before() && $evt->result !== true) { + $text = utf8_strtolower($evdata['text']); + if (strpos($text, $phrase) !== false) { + $evt->result = true; + } + } + $evt->advise_after(); + if ($evt->result === true) { $pages_matched[$id] = 0; // phrase: always 0 hit } } -- cgit v1.2.3 From d7fd4c3e04fcbbf463c35763e008527d3c9ad59f Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 19:12:41 +0100 Subject: Add dynamic declared _time attribute to cache object --- inc/cache.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/cache.php b/inc/cache.php index 5eac94934..8453fe3e9 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -16,6 +16,7 @@ class cache { // used by _useCache to determine cache validity var $_event = ''; // event to be triggered during useCache + var $_time; function cache($key,$ext) { $this->key = $key; -- cgit v1.2.3 From c59b3e001d1e8258b1d118909257b70516c8a6b1 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 23:16:59 +0100 Subject: add visibility keywords and PHPDocs for cache --- inc/cache.php | 87 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 25 deletions(-) (limited to 'inc') diff --git a/inc/cache.php b/inc/cache.php index 8453fe3e9..8c23bd09b 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -9,16 +9,20 @@ if(!defined('DOKU_INC')) die('meh.'); class cache { - var $key = ''; // primary identifier for this item - var $ext = ''; // file ext for cache data, secondary identifier for this item - var $cache = ''; // cache file name - var $depends = array(); // array containing cache dependency information, + public $key = ''; // primary identifier for this item + public $ext = ''; // file ext for cache data, secondary identifier for this item + public $cache = ''; // cache file name + public $depends = array(); // array containing cache dependency information, // used by _useCache to determine cache validity var $_event = ''; // event to be triggered during useCache var $_time; - function cache($key,$ext) { + /** + * @param string $key primary identifier + * @param string $ext file extension + */ + public function cache($key,$ext) { $this->key = $key; $this->ext = $ext; $this->cache = getCacheName($key,$ext); @@ -37,7 +41,7 @@ class cache { * * @return bool true if cache can be used, false otherwise */ - function useCache($depends=array()) { + public function useCache($depends=array()) { $this->depends = $depends; $this->_addDependencies(); @@ -60,7 +64,7 @@ class cache { * * @return bool see useCache() */ - function _useCache() { + protected function _useCache() { if (!empty($this->depends['purge'])) return false; // purge requested? if (!($this->_time = @filemtime($this->cache))) return false; // cache exists? @@ -84,7 +88,7 @@ class cache { * it should not remove any existing dependencies and * it should only overwrite a dependency when the new value is more stringent than the old */ - function _addDependencies() { + protected function _addDependencies() { global $INPUT; if ($INPUT->has('purge')) $this->depends['purge'] = true; // purge requested } @@ -95,7 +99,7 @@ class cache { * @param bool $clean true to clean line endings, false to leave line endings alone * @return string cache contents */ - function retrieveCache($clean=true) { + public function retrieveCache($clean=true) { return io_readFile($this->cache, $clean); } @@ -105,14 +109,14 @@ class cache { * @param string $data the data to be cached * @return bool true on success, false otherwise */ - function storeCache($data) { + public function storeCache($data) { return io_savefile($this->cache, $data); } /** * remove any cached data associated with this cache instance */ - function removeCache() { + public function removeCache() { @unlink($this->cache); } @@ -123,7 +127,7 @@ class cache { * @param bool $success result of this cache use attempt * @return bool pass-thru $success value */ - function _stats($success) { + protected function _stats($success) { global $conf; static $stats = null; static $file; @@ -160,12 +164,18 @@ class cache { class cache_parser extends cache { - var $file = ''; // source file for cache - var $mode = ''; // input mode (represents the processing the input file will undergo) + public $file = ''; // source file for cache + public $mode = ''; // input mode (represents the processing the input file will undergo) var $_event = 'PARSER_CACHE_USE'; - function cache_parser($id, $file, $mode) { + /** + * + * @param string $id page id + * @param string $file source file for cache + * @param string $mode input mode + */ + public function cache_parser($id, $file, $mode) { if ($id) $this->page = $id; $this->file = $file; $this->mode = $mode; @@ -173,24 +183,29 @@ class cache_parser extends cache { parent::cache($file.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.'.$mode); } - function _useCache() { + /** + * method contains cache use decision logic + * + * @return bool see useCache() + */ + protected function _useCache() { if (!@file_exists($this->file)) return false; // source exists? return parent::_useCache(); } - function _addDependencies() { - global $conf, $config_cascade; + protected function _addDependencies() { + global $conf; $this->depends['age'] = isset($this->depends['age']) ? min($this->depends['age'],$conf['cachetime']) : $conf['cachetime']; // parser cache file dependencies ... - $files = array($this->file, // ... source + $files = array($this->file, // ... source DOKU_INC.'inc/parser/parser.php', // ... parser DOKU_INC.'inc/parser/handler.php', // ... handler ); - $files = array_merge($files, getConfigFiles('main')); // ... wiki settings + $files = array_merge($files, getConfigFiles('main')); // ... wiki settings $this->depends['files'] = !empty($this->depends['files']) ? array_merge($files, $this->depends['files']) : $files; parent::_addDependencies(); @@ -199,7 +214,13 @@ class cache_parser extends cache { } class cache_renderer extends cache_parser { - function _useCache() { + + /** + * method contains cache use decision logic + * + * @return bool see useCache() + */ + protected function _useCache() { global $conf; if (!parent::_useCache()) return false; @@ -232,7 +253,7 @@ class cache_renderer extends cache_parser { return true; } - function _addDependencies() { + protected function _addDependencies() { // renderer cache file dependencies ... $files = array( @@ -256,16 +277,32 @@ class cache_renderer extends cache_parser { class cache_instructions extends cache_parser { - function cache_instructions($id, $file) { + /** + * @param string $id page id + * @param string $file source file for cache + */ + public function cache_instructions($id, $file) { parent::cache_parser($id, $file, 'i'); } - function retrieveCache($clean=true) { + /** + * retrieve the cached data + * + * @param bool $clean true to clean line endings, false to leave line endings alone + * @return string cache contents + */ + public function retrieveCache($clean=true) { $contents = io_readFile($this->cache, false); return !empty($contents) ? unserialize($contents) : array(); } - function storeCache($instructions) { + /** + * cache $instructions + * + * @param string $instructions the instruction to be cached + * @return bool true on success, false otherwise + */ + public function storeCache($instructions) { return io_savefile($this->cache,serialize($instructions)); } } -- cgit v1.2.3 From 53204f807bcd990bb9a2463237076054da0fec49 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 23:42:58 +0100 Subject: cleanup PHPDocs: DokuWiki_Syntax_Plugin is a DokuWiki_Plugin as well --- inc/pluginutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 894bbefb6..911c4e5c0 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -37,7 +37,7 @@ function plugin_list($type='',$all=false) { * @param $name string name of the plugin to load * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance * @param $disabled bool true to load even disabled plugins - * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null the plugin object or null on failure + * @return DokuWiki_Plugin|null the plugin object or null on failure */ function plugin_load($type,$name,$new=false,$disabled=false) { /** @var $plugin_controller Doku_Plugin_Controller */ -- cgit v1.2.3 From 5965f64b985361323931454deffb806ec6c8695b Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 17 Feb 2014 23:43:34 +0100 Subject: PHPDocs for Doku_Event and handler --- inc/events.php | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) (limited to 'inc') diff --git a/inc/events.php b/inc/events.php index 58ba4d5e4..7f9824f60 100644 --- a/inc/events.php +++ b/inc/events.php @@ -8,6 +8,9 @@ if(!defined('DOKU_INC')) die('meh.'); +/** + * The event + */ class Doku_Event { // public properties @@ -32,6 +35,9 @@ class Doku_Event { } + /** + * @return string + */ function __toString() { return $this->name; } @@ -51,7 +57,8 @@ class Doku_Event { * $evt->advise_after(); * unset($evt); * - * @return results of processing the event, usually $this->_default + * @param bool $enablePreventDefault + * @return bool results of processing the event, usually $this->_default */ function advise_before($enablePreventDefault=true) { global $EVENT_HANDLER; @@ -77,7 +84,9 @@ class Doku_Event { * $this->_default, all of which may have been modified by the event handlers. * - advise all registered (_AFTER) handlers that the event has taken place * - * @return $event->results + * @param null|callable $action + * @param bool $enablePrevent + * @return mixed $event->results * the value set by any _before or handlers if the default action is prevented * or the results of the default action (as modified by _after handlers) * or NULL no action took place and no handler modified the value @@ -116,6 +125,9 @@ class Doku_Event { function preventDefault() { $this->_default = false; } } +/** + * Controls the registration and execution of all events, + */ class Doku_Event_Handler { // public properties: none @@ -132,6 +144,7 @@ class Doku_Event_Handler { function Doku_Event_Handler() { // load action plugins + /** @var DokuWiki_Action_Plugin $plugin */ $plugin = null; $pluginlist = plugin_list('action'); @@ -147,12 +160,13 @@ class Doku_Event_Handler { * * register a hook for an event * - * @param $event (string) name used by the event, (incl '_before' or '_after' for triggers) - * @param $obj (obj) object in whose scope method is to be executed, + * @param $event string name used by the event, (incl '_before' or '_after' for triggers) + * @param $advise string + * @param $obj object object in whose scope method is to be executed, * if NULL, method is assumed to be a globally available function - * @param $method (function) event handler function - * @param $param (mixed) data passed to the event handler - * @param $seq (int) sequence number for ordering hook execution (ascending) + * @param $method string event handler function + * @param $param mixed data passed to the event handler + * @param $seq int sequence number for ordering hook execution (ascending) */ function register_hook($event, $advise, $obj, $method, $param=null, $seq=0) { $seq = (int)$seq; @@ -164,6 +178,12 @@ class Doku_Event_Handler { } } + /** + * process the before/after event + * + * @param Doku_Event $event + * @param string $advise BEFORE or AFTER + */ function process_event($event,$advise='') { $evt_name = $event->name . ($advise ? '_'.$advise : '_BEFORE'); @@ -191,12 +211,12 @@ class Doku_Event_Handler { * * function wrapper to process (create, trigger and destroy) an event * - * @param $name (string) name for the event - * @param $data (mixed) event data - * @param $action (callback) (optional, default=NULL) default action, a php callback function - * @param $canPreventDefault (bool) (optional, default=true) can hooks prevent the default action + * @param $name string name for the event + * @param $data mixed event data + * @param $action callback (optional, default=NULL) default action, a php callback function + * @param $canPreventDefault bool (optional, default=true) can hooks prevent the default action * - * @return (mixed) the event results value after all event processing is complete + * @return mixed the event results value after all event processing is complete * by default this is the return value of the default action however * it can be set or modified by event handler hooks */ -- cgit v1.2.3 From cefd14cbc4f6dabfb2fb7b7ffb6b68d4501afd4f Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 18 Feb 2014 00:54:21 +0100 Subject: PHPDocs of cache classes --- inc/cache.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'inc') diff --git a/inc/cache.php b/inc/cache.php index 8c23bd09b..5f54a34a9 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -8,6 +8,9 @@ if(!defined('DOKU_INC')) die('meh.'); +/** + * Generic handling of caching + */ class cache { public $key = ''; // primary identifier for this item public $ext = ''; // file ext for cache data, secondary identifier for this item @@ -162,6 +165,9 @@ class cache { } } +/** + * Parser caching + */ class cache_parser extends cache { public $file = ''; // source file for cache @@ -213,6 +219,9 @@ class cache_parser extends cache { } +/** + * Caching of data of renderer + */ class cache_renderer extends cache_parser { /** @@ -275,6 +284,9 @@ class cache_renderer extends cache_parser { } } +/** + * Caching of parser instructions + */ class cache_instructions extends cache_parser { /** -- cgit v1.2.3 From dbf714f723aaf3a4e63a0ac2f07746c41fa3e98d Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 18 Feb 2014 13:34:22 +0100 Subject: Improve PHPDocs pageutils --- inc/pageutils.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'inc') diff --git a/inc/pageutils.php b/inc/pageutils.php index c8d3cf4bb..9c2794387 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -94,6 +94,7 @@ function getID($param='id',$clean=true){ * @author Andreas Gohr * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII + * @return string cleaned id */ function cleanID($raw_id,$ascii=false){ global $conf; @@ -244,6 +245,7 @@ function page_exists($id,$rev='',$clean=true) { * @param $rev string page revision, empty string for current * @param $clean bool flag indicating that $raw_id should be cleaned. Only set to false * when $id is guaranteed to have been cleaned already. + * @return string full path * * @author Andreas Gohr */ @@ -361,6 +363,7 @@ function mediaFN($id, $rev=''){ * * @param string $id The id of the local file * @param string $ext The file extension (usually txt) + * @return string full filepath to localized file * @author Andreas Gohr */ function localeFN($id,$ext='txt'){ @@ -543,6 +546,11 @@ function isHiddenPage($id){ return $data['hidden']; } +/** + * callback checks if page is hidden + * + * @param array $data event data see isHiddenPage() + */ function _isHiddenPage(&$data) { global $conf; global $ACT; -- cgit v1.2.3 From 5f0071ebcd0bb2a2cb0f64834014be73f6690806 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 18 Feb 2014 13:41:13 +0100 Subject: PHPDocs form --- inc/form.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'inc') diff --git a/inc/form.php b/inc/form.php index 312c42b60..610f50200 100644 --- a/inc/form.php +++ b/inc/form.php @@ -47,15 +47,11 @@ class Doku_Form { * with up to four parameters is deprecated, instead the first parameter * should be an array with parameters. * - * @param mixed $params Parameters for the HTML form element; Using the - * deprecated calling convention this is the ID - * attribute of the form - * @param string $action (optional, deprecated) submit URL, defaults to - * current page - * @param string $method (optional, deprecated) 'POST' or 'GET', default - * is POST - * @param string $enctype (optional, deprecated) Encoding type of the - * data + * @param mixed $params Parameters for the HTML form element; Using the deprecated + * calling convention this is the ID attribute of the form + * @param bool|string $action (optional, deprecated) submit URL, defaults to current page + * @param bool|string $method (optional, deprecated) 'POST' or 'GET', default is POST + * @param bool|string $enctype (optional, deprecated) Encoding type of the data * @author Tom N Harris */ function Doku_Form($params, $action=false, $method=false, $enctype=false) { @@ -230,7 +226,7 @@ class Doku_Form { * first (underflow) or last (overflow) element. * * @param int $pos 0-based index - * @return arrayreference pseudo-element + * @return array reference pseudo-element * @author Tom N Harris */ function &getElementAt($pos) { -- cgit v1.2.3 From c9ec6231967652cf58f7840063ed94a26e6d8b37 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Tue, 18 Feb 2014 20:05:33 +0100 Subject: Fix PHPDocs emailadressvalidator --- inc/EmailAddressValidator.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'inc') diff --git a/inc/EmailAddressValidator.php b/inc/EmailAddressValidator.php index bb4ef0ca9..fd6f3275b 100644 --- a/inc/EmailAddressValidator.php +++ b/inc/EmailAddressValidator.php @@ -15,8 +15,8 @@ class EmailAddressValidator { /** * Check email address validity - * @param strEmailAddress Email address to be checked - * @return True if email is valid, false if not + * @param string $strEmailAddress Email address to be checked + * @return bool True if email is valid, false if not */ public function check_email_address($strEmailAddress) { @@ -82,8 +82,8 @@ class EmailAddressValidator { /** * Checks email section before "@" symbol for validity - * @param strLocalPortion Text to be checked - * @return True if local portion is valid, false if not + * @param string $strLocalPortion Text to be checked + * @return bool True if local portion is valid, false if not */ protected function check_local_portion($strLocalPortion) { // Local portion can only be from 1 to 64 characters, inclusive. @@ -113,8 +113,8 @@ class EmailAddressValidator { /** * Checks email section after "@" symbol for validity - * @param strDomainPortion Text to be checked - * @return True if domain portion is valid, false if not + * @param string $strDomainPortion Text to be checked + * @return bool True if domain portion is valid, false if not */ protected function check_domain_portion($strDomainPortion) { // Total domain can only be from 1 to 255 characters, inclusive @@ -172,10 +172,10 @@ class EmailAddressValidator { /** * Check given text length is between defined bounds - * @param strText Text to be checked - * @param intMinimum Minimum acceptable length - * @param intMaximum Maximum acceptable length - * @return True if string is within bounds (inclusive), false if not + * @param string $strText Text to be checked + * @param int $intMinimum Minimum acceptable length + * @param int $intMaximum Maximum acceptable length + * @return bool True if string is within bounds (inclusive), false if not */ protected function check_text_length($strText, $intMinimum, $intMaximum) { // Minimum and maximum are both inclusive -- cgit v1.2.3 From 74160ca1dea24b237ff3e956d19a420a1593b957 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Thu, 20 Feb 2014 14:10:24 +0100 Subject: PHPDocs missing breaks, removed unused var in common.php --- inc/common.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/common.php b/inc/common.php index 32771285b..4682bedf9 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1140,7 +1140,6 @@ function saveWikiText($id, $text, $summary, $minor = false) { * @author Andreas Gohr */ function saveOldRevision($id) { - global $conf; $oldf = wikiFN($id); if(!@file_exists($oldf)) return ''; $date = filemtime($oldf); @@ -1230,8 +1229,9 @@ function getGoogleQuery() { /** * Return the human readable size of a file * - * @param int $size A file size - * @param int $dec A number of decimal places + * @param int $size A file size + * @param int $dec A number of decimal places + * @return string human readable size * @author Martin Benjamin * @author Aidan Lister * @version 1.0.0 @@ -1362,12 +1362,16 @@ function php_to_byte($v) { $l = substr($v, -1); $ret = substr($v, 0, -1); switch(strtoupper($l)) { + /** @noinspection PhpMissingBreakStatementInspection */ case 'P': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'T': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'G': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'M': $ret *= 1024; case 'K': -- cgit v1.2.3 From 4d51938bb0516f7cc033d8c93131f56af7525da0 Mon Sep 17 00:00:00 2001 From: Rene Date: Sun, 23 Feb 2014 22:56:02 +0100 Subject: translation update --- inc/lang/nl/lang.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/lang/nl/lang.php b/inc/lang/nl/lang.php index e5e3e3c76..e22aa9fff 100644 --- a/inc/lang/nl/lang.php +++ b/inc/lang/nl/lang.php @@ -22,6 +22,7 @@ * @author Klap-in * @author Remon * @author gicalle + * @author Rene */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; -- cgit v1.2.3 From 11ac6abdb90a812687d7db7df99aa02f843dd12a Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 02:58:58 +0000 Subject: if configured renderer is not found, try to fallback to a bundled renderer --- inc/parserutils.php | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 4df273f11..2fb523d0c 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -631,27 +631,43 @@ function & p_get_renderer($mode) { return $Renderer; } - // try default renderer first: - $file = DOKU_INC."inc/parser/$rname.php"; - if(@file_exists($file)){ - require_once $file; - - if ( !class_exists($rclass) ) { - trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); - msg("Renderer '$rname' for $mode not valid",-1); - return null; - } - $Renderer = new $rclass(); - }else{ - // Maybe a plugin/component is available? + // assuming the configured renderer is bundled, construct its file name + $default = DOKU_INC."inc/parser/$rname.php"; + if (!file_exists($default)) { + // not bundled, see if its an enabled plugin for rendering $mode $Renderer = $plugin_controller->load('renderer',$rname); + if (is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { + return $Renderer; + } - if(!isset($Renderer) || is_null($Renderer)){ + // there is a configuration error! + // not bundled, not an enabled plugin, try to fallback to a bundled renderer + $fallback = DOKU_INC."inc/parser/$mode.php"; + if (!file_exists($fallback)) { msg("No renderer '$rname' found for mode '$mode'",-1); return null; + } else { + $default = $fallback; + $rclass = "Doku_Renderer_$mode"; + + // viewers should see renderered output, so restrict the warning to admins only + $msg = "No renderer '$rname' found for mode '$mode', check your plugins"; + if ($mode == 'xhtml') { + $msg .= " and the 'renderer_xhtml' config setting"; + } + $msg .= ".
Attempting to fallback to the bundled renderer."; + msg($msg,-1,'','',MSG_ADMIN_ONLY); } } + require_once $default; + if ( !class_exists($rclass) ) { + trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); + msg("Renderer '$rname' for $mode not valid",-1); + return null; + } + $Renderer = new $rclass(); + return $Renderer; } -- cgit v1.2.3 From 252398f08d0752fd17b25e4afab70a6d0b6455a7 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 03:00:46 +0000 Subject: remove reference operator from p_get_renderer() declaration, not required for php5 --- inc/parserutils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 2fb523d0c..9420931eb 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -588,7 +588,7 @@ function p_sort_modes($a, $b){ function p_render($mode,$instructions,&$info){ if(is_null($instructions)) return ''; - $Renderer =& p_get_renderer($mode); + $Renderer = p_get_renderer($mode); if (is_null($Renderer)) return null; $Renderer->reset(); @@ -619,7 +619,7 @@ function p_render($mode,$instructions,&$info){ * @param $mode string Mode of the renderer to get * @return null|Doku_Renderer The renderer */ -function & p_get_renderer($mode) { +function p_get_renderer($mode) { /** @var Doku_Plugin_Controller $plugin_controller */ global $conf, $plugin_controller; -- cgit v1.2.3 From 2ada8709d3a0cea872f117823b244b400fac5f87 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 20:32:56 +0000 Subject: add renderers to autolader --- inc/load.php | 6 ++++++ inc/parser/code.php | 1 - inc/parser/metadata.php | 2 -- inc/parser/renderer.php | 1 - inc/parser/xhtml.php | 3 --- inc/parser/xhtmlsummary.php | 1 - inc/parserutils.php | 2 -- 7 files changed, 6 insertions(+), 10 deletions(-) (limited to 'inc') diff --git a/inc/load.php b/inc/load.php index 497dd6921..f1deffe19 100644 --- a/inc/load.php +++ b/inc/load.php @@ -96,6 +96,12 @@ function load_autoload($name){ 'DokuWiki_Remote_Plugin' => DOKU_PLUGIN.'remote.php', 'DokuWiki_Auth_Plugin' => DOKU_PLUGIN.'auth.php', + 'Doku_Renderer' => DOKU_INC.'inc/parser/renderer.php', + 'Doku_Renderer_xhtml' => DOKU_INC.'inc/parser/xhtml.php', + 'Doku_Renderer_code' => DOKU_INC.'inc/parser/code.php', + 'Doku_Renderer_xhtmlsummary' => DOKU_INC.'inc/parser/xhtmlsummary.php', + 'Doku_Renderer_metadata' => DOKU_INC.'inc/parser/metadata.php', + ); if(isset($classes[$name])){ diff --git a/inc/parser/code.php b/inc/parser/code.php index 0b8e3ee02..d77ffd1aa 100644 --- a/inc/parser/code.php +++ b/inc/parser/code.php @@ -5,7 +5,6 @@ * @author Andreas Gohr */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/parser/renderer.php'; class Doku_Renderer_code extends Doku_Renderer { var $_codeblock=0; diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 8ba159d62..73bae190f 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -16,8 +16,6 @@ if ( !defined('DOKU_TAB') ) { define ('DOKU_TAB',"\t"); } -require_once DOKU_INC . 'inc/parser/renderer.php'; - /** * The Renderer */ diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index e3401fd48..6b6a1770b 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -6,7 +6,6 @@ * @author Andreas Gohr */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/plugin.php'; require_once DOKU_INC . 'inc/pluginutils.php'; /** diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 315b4d640..184e62fe3 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -17,9 +17,6 @@ if ( !defined('DOKU_TAB') ) { define ('DOKU_TAB',"\t"); } -require_once DOKU_INC . 'inc/parser/renderer.php'; -require_once DOKU_INC . 'inc/html.php'; - /** * The Renderer */ diff --git a/inc/parser/xhtmlsummary.php b/inc/parser/xhtmlsummary.php index 95f86cbef..867b71f6a 100644 --- a/inc/parser/xhtmlsummary.php +++ b/inc/parser/xhtmlsummary.php @@ -1,6 +1,5 @@ advise_before()) { - require_once DOKU_INC."inc/parser/metadata.php"; - // get instructions $instructions = p_cached_instructions(wikiFN($id),false,$id); if(is_null($instructions)){ -- cgit v1.2.3 From 548d801fe28808c85529c4e396ccc563550d4634 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 20:33:37 +0000 Subject: rework p_get_renderer() for use with autoloading bundled renderers --- inc/parserutils.php | 60 ++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 11f044146..7a85b64e3 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -614,8 +614,13 @@ function p_render($mode,$instructions,&$info){ } /** + * Figure out the correct renderer class to use for $mode, + * instantiate and return it + * * @param $mode string Mode of the renderer to get * @return null|Doku_Renderer The renderer + * + * @author Christopher Smith */ function p_get_renderer($mode) { /** @var Doku_Plugin_Controller $plugin_controller */ @@ -624,49 +629,44 @@ function p_get_renderer($mode) { $rname = !empty($conf['renderer_'.$mode]) ? $conf['renderer_'.$mode] : $mode; $rclass = "Doku_Renderer_$rname"; + // if requested earlier or a bundled renderer if( class_exists($rclass) ) { $Renderer = new $rclass(); return $Renderer; } - // assuming the configured renderer is bundled, construct its file name - $default = DOKU_INC."inc/parser/$rname.php"; - if (!file_exists($default)) { - // not bundled, see if its an enabled plugin for rendering $mode - $Renderer = $plugin_controller->load('renderer',$rname); + // not bundled, see if its an enabled plugin for rendering $mode + $Renderer = $plugin_controller->load('renderer',$rname); + if ($Renderer) { if (is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { return $Renderer; - } - - // there is a configuration error! - // not bundled, not an enabled plugin, try to fallback to a bundled renderer - $fallback = DOKU_INC."inc/parser/$mode.php"; - if (!file_exists($fallback)) { - msg("No renderer '$rname' found for mode '$mode'",-1); - return null; } else { - $default = $fallback; - $rclass = "Doku_Renderer_$mode"; - - // viewers should see renderered output, so restrict the warning to admins only - $msg = "No renderer '$rname' found for mode '$mode', check your plugins"; - if ($mode == 'xhtml') { - $msg .= " and the 'renderer_xhtml' config setting"; - } - $msg .= ".
Attempting to fallback to the bundled renderer."; - msg($msg,-1,'','',MSG_ADMIN_ONLY); + // plugin found, but not a renderer or not the right renderer for this $mode + msg("Renderer plugin '$rname' not valid for $mode",-1,'','',MSG_ADMINS_ONLY); } } - require_once $default; - if ( !class_exists($rclass) ) { - trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); - msg("Renderer '$rname' for $mode not valid",-1); - return null; + // there is a configuration error! + // not bundled, not a valid enabled plugin, use $mode to try to fallback to a bundled renderer + $rclass = "Doku_Renderer_$mode"; + if ( class_exists($rclass) ) { + // viewers should see renderered output, so restrict the warning to admins only + $msg = "No renderer '$rname' found for mode '$mode', check your plugins"; + if ($mode == 'xhtml') { + $msg .= " and the 'renderer_xhtml' config setting"; + } + $msg .= ".
Attempting to fallback to the bundled renderer."; + msg($msg,-1,'','',MSG_ADMINS_ONLY); + + $Renderer = new $rclass; + $Renderer->nocache(); // fallback only (and may include admin alerts), don't cache + return $Renderer; } - $Renderer = new $rclass(); - return $Renderer; + // fallback failed, alert the world + trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); + msg("No renderer '$rname' found for mode '$mode'",-1); + return null; } /** -- cgit v1.2.3 From 5b76ad9103ca8e25d29c5ce018859be6679b7b1c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 20:34:20 +0000 Subject: code cleaning - add some braces --- inc/parserutils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 7a85b64e3..c12732e88 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -430,8 +430,9 @@ function p_render_metadata($id, $orig){ global $ID, $METADATA_RENDERERS; // avoid recursive rendering processes for the same id - if (isset($METADATA_RENDERERS[$id])) + if (isset($METADATA_RENDERERS[$id])) { return $orig; + } // store the original metadata in the global $METADATA_RENDERERS so p_set_metadata can use it $METADATA_RENDERERS[$id] =& $orig; -- cgit v1.2.3 From f3283f02766b2a2730b81c5a5a0b0a6240af054c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Tue, 25 Feb 2014 21:15:43 +0000 Subject: change to an Exception and expect it --- inc/parserutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index c12732e88..1c628a766 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -665,7 +665,7 @@ function p_get_renderer($mode) { } // fallback failed, alert the world - trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); + throw new Exception("Unable to resolve render class $rclass",E_USER_WARNING); msg("No renderer '$rname' found for mode '$mode'",-1); return null; } -- cgit v1.2.3 From a049856df3f316114a9d936d830d5b6d419b11e6 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 26 Feb 2014 01:12:33 +0000 Subject: revert back to trigger error --- inc/parserutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index 1c628a766..c12732e88 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -665,7 +665,7 @@ function p_get_renderer($mode) { } // fallback failed, alert the world - throw new Exception("Unable to resolve render class $rclass",E_USER_WARNING); + trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); msg("No renderer '$rname' found for mode '$mode'",-1); return null; } -- cgit v1.2.3 From e30b0f289638b91494ea96d307fd82e1458d6dcf Mon Sep 17 00:00:00 2001 From: Wild Date: Sat, 22 Feb 2014 12:47:47 +0100 Subject: translation update --- inc/lang/fr/denied.txt | 2 +- inc/lang/fr/lang.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/lang/fr/denied.txt b/inc/lang/fr/denied.txt index 20d4d6755..56c59a7c2 100644 --- a/inc/lang/fr/denied.txt +++ b/inc/lang/fr/denied.txt @@ -1,3 +1,3 @@ ====== Autorisation refusée ====== -Désolé, vous n'avez pas les droits pour continuer. Peut-être avez-vous oublié de vous identifier ? +Désolé, vous n'avez pas suffisement d'autorisations pour poursuivre votre demande. Peut-être avez-vous oublié de vous identifier ? diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index 49f617323..32e3055f7 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -29,6 +29,7 @@ * @author Bruno Veilleux * @author Emmanuel * @author Jérôme Brandt + * @author Wild */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -51,10 +52,10 @@ $lang['btn_revs'] = 'Anciennes révisions'; $lang['btn_recent'] = 'Derniers changements'; $lang['btn_upload'] = 'Envoyer'; $lang['btn_cancel'] = 'Annuler'; -$lang['btn_index'] = 'Index'; +$lang['btn_index'] = 'Plan du site'; $lang['btn_secedit'] = 'Modifier'; -$lang['btn_login'] = 'Connexion'; -$lang['btn_logout'] = 'Déconnexion'; +$lang['btn_login'] = 'S\'identifier'; +$lang['btn_logout'] = 'Se déconnecter'; $lang['btn_admin'] = 'Administrer'; $lang['btn_update'] = 'Mettre à jour'; $lang['btn_delete'] = 'Effacer'; @@ -69,7 +70,7 @@ $lang['btn_draft'] = 'Modifier le brouillon'; $lang['btn_recover'] = 'Récupérer le brouillon'; $lang['btn_draftdel'] = 'Effacer le brouillon'; $lang['btn_revert'] = 'Restaurer'; -$lang['btn_register'] = 'S\'enregistrer'; +$lang['btn_register'] = 'Créer un compte'; $lang['btn_apply'] = 'Appliquer'; $lang['btn_media'] = 'Gestionnaire de médias'; $lang['btn_deleteuser'] = 'Supprimer mon compte'; -- cgit v1.2.3 From 5ee37844b9e6f852bf16da41e5c07f056ec376d1 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 28 Feb 2014 16:55:57 +0000 Subject: remove rendundant msg --- inc/parserutils.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index c12732e88..b41e2d473 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -638,13 +638,8 @@ function p_get_renderer($mode) { // not bundled, see if its an enabled plugin for rendering $mode $Renderer = $plugin_controller->load('renderer',$rname); - if ($Renderer) { - if (is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { - return $Renderer; - } else { - // plugin found, but not a renderer or not the right renderer for this $mode - msg("Renderer plugin '$rname' not valid for $mode",-1,'','',MSG_ADMINS_ONLY); - } + if (is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { + return $Renderer; } // there is a configuration error! -- cgit v1.2.3 From 489dcad6f038c54dda1f29c0887fa43f5b3f7fcb Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 28 Feb 2014 16:56:29 +0000 Subject: remove require handled by autoloader --- inc/parser/renderer.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc') diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 6b6a1770b..1f9ad00a2 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -6,7 +6,6 @@ * @author Andreas Gohr */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/pluginutils.php'; /** * An empty renderer, produces no output -- cgit v1.2.3 From 0e6682672bb6ed779e4d8585c07cdc0ed57d81e5 Mon Sep 17 00:00:00 2001 From: "Khan M. B. Asad" Date: Sun, 2 Mar 2014 01:25:21 +0100 Subject: translation update --- inc/lang/bn/lang.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'inc') diff --git a/inc/lang/bn/lang.php b/inc/lang/bn/lang.php index 94a3fbb12..230f3ef80 100644 --- a/inc/lang/bn/lang.php +++ b/inc/lang/bn/lang.php @@ -5,6 +5,7 @@ * * @author Foysol * @author ninetailz + * @author Khan M. B. Asad */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'itr'; @@ -127,3 +128,33 @@ $lang['js']['medialeft'] = 'বাম দিকে ইমেজ সার $lang['js']['mediaright'] = 'ডান দিকে ইমেজ সারিবদ্ধ কর'; $lang['js']['mediacenter'] = 'মাঝখানে ইমেজ সারিবদ্ধ কর'; $lang['js']['medianoalign'] = 'কোনো সারিবদ্ধ করা প্রয়োজন নেই'; +$lang['js']['nosmblinks'] = 'উইন্ডোস শেয়ার এর সাথে সংযোগ সাধন কেবল মাইক্রোসফ্ট ইন্টারনেট এক্সপ্লোরারেই সম্ভব।\nতবে আপনি লিংকটি কপি পেস্ট করতেই পারেন।'; +$lang['js']['linkwiz'] = 'লিংক উইজার্ড'; +$lang['js']['linkto'] = 'সংযোগের লক্ষ্য:'; +$lang['js']['del_confirm'] = 'নির্বাচিত আইটেম(গুলো) আসলেই মুছে ফেলতে চান?'; +$lang['js']['restore_confirm'] = 'এই সংস্করণ সত্যিই পূর্বাবস্থায় ফিরিয়ে আনতে চান?'; +$lang['js']['media_diff'] = 'পার্থক্যগুলো দেখুন:'; +$lang['js']['media_diff_both'] = 'পাশাপাশি'; +$lang['js']['media_diff_opacity'] = 'শাইন-থ্রু'; +$lang['js']['media_diff_portions'] = 'ঝেঁটিয়ে বিদায়'; +$lang['js']['media_select'] = 'ফাইল নির্বাচন...'; +$lang['js']['media_upload_btn'] = 'আপলোড'; +$lang['js']['media_done_btn'] = 'সাধিত'; +$lang['js']['media_drop'] = 'আপলোডের জন্য এখানে ফাইল ফেলুন'; +$lang['js']['media_cancel'] = 'অপসারণ'; +$lang['js']['media_overwrt'] = 'বর্তমান ফাইল ওভাররাইট করুন'; +$lang['rssfailed'] = 'ফিডটি জোগাড় করতে গিয়ে একটি ত্রুটি ঘটেছে:'; +$lang['nothingfound'] = 'কিছু পাওয়া যায়নি।'; +$lang['mediaselect'] = 'মিডিয়া ফাইল'; +$lang['fileupload'] = 'মিডিয়া ফাইল আপলোড'; +$lang['uploadsucc'] = 'আপলোড সফল'; +$lang['uploadfail'] = 'আপলোড ব্যর্থ। অনুমতি জনিত ত্রুটি কী?'; +$lang['uploadwrong'] = 'আপলোড প্রত্যাখ্যাত। এই ফাইল এক্সটেনশন অননুমোদিত।'; +$lang['uploadexist'] = 'ফাইল ইতিমধ্যেই বিরাজমান। কিছু করা হয়নি।'; +$lang['uploadbadcontent'] = 'আপলোডকৃত সামগ্রী %s ফাইল এক্সটেনশন এর সাথে মিলেনি।'; +$lang['uploadspam'] = 'স্প্যাম ব্ল্যাকলিস্ট আপলোড আটকে দিয়েছে।'; +$lang['uploadxss'] = 'সামগ্রীটি ক্ষতিকর ভেবে আপলোড আটকে দেয়া হয়েছে।'; +$lang['uploadsize'] = 'আপলোডকৃত ফাইলটি বেশি বড়ো। (সর্বোচ্চ %s)'; +$lang['deletesucc'] = '"%s" ফাইলটি মুছে ফেলা হয়েছে।'; +$lang['deletefail'] = '"%s" ডিলিট করা যায়নি - অনুমতি আছে কি না দেখুন।'; +$lang['mediainuse'] = '"%s" ফাইলটি মোছা হয়নি - এটি এখনো ব্যবহৃত হচ্ছে।'; -- cgit v1.2.3 From 709fd92548efedbd4b4e5693097165d1dff072e4 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 2 Mar 2014 20:46:26 +0000 Subject: resolve scrutinizer issue, is_a type hint doesn't allow null --- inc/parserutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/parserutils.php b/inc/parserutils.php index b41e2d473..06bd6dbb8 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -638,7 +638,7 @@ function p_get_renderer($mode) { // not bundled, see if its an enabled plugin for rendering $mode $Renderer = $plugin_controller->load('renderer',$rname); - if (is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { + if ($Renderer && is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { return $Renderer; } -- cgit v1.2.3