diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2019-10-10 09:55:14 +0200 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2019-10-10 09:55:14 +0200 |
commit | 31a58aba4c24b34c34ad5764d1a35b7c398c3a2c (patch) | |
tree | 7f4d1546fbb69863a7d366fc1ff647f784853b68 /inc/parser/code.php | |
parent | af7ba5aa0bd10fc0ad9ef983006305b4c5a8ed42 (diff) | |
parent | c0c77cd20b23921c9e893bb70b99f38be153875a (diff) | |
download | dokuwiki-31a58aba4c24b34c34ad5764d1a35b7c398c3a2c.tar.gz dokuwiki-31a58aba4c24b34c34ad5764d1a35b7c398c3a2c.zip |
Merge branch 'psr2'
* psr2: (160 commits)
fixed merge error
Moved parts of the Asian word handling to its own class
ignore snake_case error of substr_replace
fixed some line length errors
ignore PSR2 in the old form class
fix PSR2 error in switch statement
replaced deprecated utf8 functions
formatting cleanup
mark old utf8 functions deprecated
some more PSR2 cleanup
Some cleanup for the UTF-8 stuff
Moved all utf8 methods to their own namespaced classes
Create separate table files for UTF-8 handling
Ignore mixed concerns in loader
Use type safe comparisons in loader
Remove obsolete include
adjust phpcs exclude patterns for new plugin classes
🚚 Move Subscription class to deprecated.php
♻️ Split up ChangesSubscriptionSender into multiple classes
Minor optimizations in PluginController
...
Diffstat (limited to 'inc/parser/code.php')
-rw-r--r-- | inc/parser/code.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/inc/parser/code.php b/inc/parser/code.php index f91f1d228..cded87d6d 100644 --- a/inc/parser/code.php +++ b/inc/parser/code.php @@ -4,10 +4,8 @@ * * @author Andreas Gohr <andi@splitbrain.org> */ -if(!defined('DOKU_INC')) die('meh.'); - class Doku_Renderer_code extends Doku_Renderer { - var $_codeblock = 0; + protected $_codeblock = 0; /** * Send the wanted code block to the browser @@ -18,13 +16,13 @@ class Doku_Renderer_code extends Doku_Renderer { * @param string $language * @param string $filename */ - function code($text, $language = null, $filename = '') { + public function code($text, $language = null, $filename = '') { global $INPUT; if(!$language) $language = 'txt'; $language = preg_replace(PREG_PATTERN_VALID_LANGUAGE, '', $language); if(!$filename) $filename = 'snippet.'.$language; - $filename = utf8_basename($filename); - $filename = utf8_stripspecials($filename, '_'); + $filename = \dokuwiki\Utf8\PhpString::basename($filename); + $filename = \dokuwiki\Utf8\Clean::stripspecials($filename, '_'); // send CRLF to Windows clients if(strpos($INPUT->server->str('HTTP_USER_AGENT'), 'Windows') !== false) { @@ -49,14 +47,14 @@ class Doku_Renderer_code extends Doku_Renderer { * @param string $language * @param string $filename */ - function file($text, $language = null, $filename = '') { + public function file($text, $language = null, $filename = '') { $this->code($text, $language, $filename); } /** * This should never be reached, if it is send a 404 */ - function document_end() { + public function document_end() { http_status(404); echo '404 - Not found'; exit; @@ -67,7 +65,7 @@ class Doku_Renderer_code extends Doku_Renderer { * * @returns string 'code' */ - function getFormat() { + public function getFormat() { return 'code'; } } |