diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2015-05-28 17:11:42 +0100 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2015-05-28 17:11:42 +0100 |
commit | 4b8290f563ad5ac84dd92fb8ca97ba5970c472b3 (patch) | |
tree | 7dca7c98013775628c2b4d1596e0be41d8d4bda2 /inc/parser | |
parent | 9a734b7aaba1445e06c1ccb95e59f54e01688d45 (diff) | |
parent | 4286c64e98499b93056c09498c10709f8909befd (diff) | |
download | rpg-4b8290f563ad5ac84dd92fb8ca97ba5970c472b3.tar.gz rpg-4b8290f563ad5ac84dd92fb8ca97ba5970c472b3.tar.bz2 |
Merge branch 'master' into ioreplaceinfile
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/handler.php | 48 | ||||
-rw-r--r-- | inc/parser/lexer.php | 8 | ||||
-rw-r--r-- | inc/parser/parser.php | 32 |
3 files changed, 47 insertions, 41 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index b8e2de82a..815ac39c5 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -17,7 +17,7 @@ class Doku_Handler { var $rewriteBlocks = true; - function Doku_Handler() { + function __construct() { $this->CallWriter = new Doku_Handler_CallWriter($this); } @@ -295,7 +295,7 @@ class Doku_Handler { switch ( $state ) { case DOKU_LEXER_ENTER: $ReWriter = new Doku_Handler_Preformatted($this->CallWriter); - $this->CallWriter = & $ReWriter; + $this->CallWriter = $ReWriter; $this->_addCall('preformatted_start',array(), $pos); break; case DOKU_LEXER_EXIT: @@ -715,15 +715,21 @@ function Doku_Handler_Parse_Media($match) { } //------------------------------------------------------------------------ -class Doku_Handler_CallWriter { +interface Doku_Handler_CallWriter_Interface { + public function writeCall($call); + public function writeCalls($calls); + public function finalise(); +} + +class Doku_Handler_CallWriter implements Doku_Handler_CallWriter_Interface { var $Handler; /** * @param Doku_Handler $Handler */ - function Doku_Handler_CallWriter(& $Handler) { - $this->Handler = & $Handler; + function __construct(Doku_Handler $Handler) { + $this->Handler = $Handler; } function writeCall($call) { @@ -748,7 +754,7 @@ class Doku_Handler_CallWriter { * * @author Chris Smith <chris@jalakai.co.uk> */ -class Doku_Handler_Nest { +class Doku_Handler_Nest implements Doku_Handler_CallWriter_Interface { var $CallWriter; var $calls = array(); @@ -762,8 +768,8 @@ class Doku_Handler_Nest { * @param string $close closing instruction name, this is required to properly terminate the * syntax mode if the document ends without a closing pattern */ - function Doku_Handler_Nest(& $CallWriter, $close="nest_close") { - $this->CallWriter = & $CallWriter; + function __construct(Doku_Handler_CallWriter_Interface $CallWriter, $close="nest_close") { + $this->CallWriter = $CallWriter; $this->closingInstruction = $close; } @@ -808,7 +814,7 @@ class Doku_Handler_Nest { } } -class Doku_Handler_List { +class Doku_Handler_List implements Doku_Handler_CallWriter_Interface { var $CallWriter; @@ -818,8 +824,8 @@ class Doku_Handler_List { const NODE = 1; - function Doku_Handler_List(& $CallWriter) { - $this->CallWriter = & $CallWriter; + function __construct(Doku_Handler_CallWriter_Interface $CallWriter) { + $this->CallWriter = $CallWriter; } function writeCall($call) { @@ -1018,7 +1024,7 @@ class Doku_Handler_List { } //------------------------------------------------------------------------ -class Doku_Handler_Preformatted { +class Doku_Handler_Preformatted implements Doku_Handler_CallWriter_Interface { var $CallWriter; @@ -1028,8 +1034,8 @@ class Doku_Handler_Preformatted { - function Doku_Handler_Preformatted(& $CallWriter) { - $this->CallWriter = & $CallWriter; + function __construct(Doku_Handler_CallWriter_Interface $CallWriter) { + $this->CallWriter = $CallWriter; } function writeCall($call) { @@ -1078,7 +1084,7 @@ class Doku_Handler_Preformatted { } //------------------------------------------------------------------------ -class Doku_Handler_Quote { +class Doku_Handler_Quote implements Doku_Handler_CallWriter_Interface { var $CallWriter; @@ -1086,8 +1092,8 @@ class Doku_Handler_Quote { var $quoteCalls = array(); - function Doku_Handler_Quote(& $CallWriter) { - $this->CallWriter = & $CallWriter; + function __construct(Doku_Handler_CallWriter_Interface $CallWriter) { + $this->CallWriter = $CallWriter; } function writeCall($call) { @@ -1170,7 +1176,7 @@ class Doku_Handler_Quote { } //------------------------------------------------------------------------ -class Doku_Handler_Table { +class Doku_Handler_Table implements Doku_Handler_CallWriter_Interface { var $CallWriter; @@ -1185,8 +1191,8 @@ class Doku_Handler_Table { var $currentRow = array('tableheader' => 0, 'tablecell' => 0); var $countTableHeadRows = 0; - function Doku_Handler_Table(& $CallWriter) { - $this->CallWriter = & $CallWriter; + function __construct(Doku_Handler_CallWriter_Interface $CallWriter) { + $this->CallWriter = $CallWriter; } function writeCall($call) { @@ -1551,7 +1557,7 @@ class Doku_Handler_Block { * * @author Andreas Gohr <andi@splitbrain.org> */ - function Doku_Handler_Block(){ + function __construct(){ global $DOKU_PLUGINS; //check if syntax plugins were loaded if(empty($DOKU_PLUGINS['syntax'])) return; diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index b46a5f505..17aa6c170 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -46,7 +46,7 @@ class Doku_LexerParallelRegex { * for insensitive. * @access public */ - function Doku_LexerParallelRegex($case) { + function __construct($case) { $this->_case = $case; $this->_patterns = array(); $this->_labels = array(); @@ -232,7 +232,7 @@ class Doku_LexerStateStack { * @param string $start Starting state name. * @access public */ - function Doku_LexerStateStack($start) { + function __construct($start) { $this->_stack = array($start); } @@ -296,11 +296,11 @@ class Doku_Lexer { * @param boolean $case True for case sensitive. * @access public */ - function Doku_Lexer(&$parser, $start = "accept", $case = false) { + function __construct($parser, $start = "accept", $case = false) { $this->_case = $case; /** @var Doku_LexerParallelRegex[] _regexes */ $this->_regexes = array(); - $this->_parser = &$parser; + $this->_parser = $parser; $this->_mode = new Doku_LexerStateStack($start); $this->_mode_handlers = array(); } diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 5f86cf5c4..7814e94f6 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -64,24 +64,24 @@ class Doku_Parser { /** * @param Doku_Parser_Mode_base $BaseMode */ - function addBaseMode(& $BaseMode) { - $this->modes['base'] =& $BaseMode; + function addBaseMode($BaseMode) { + $this->modes['base'] = $BaseMode; if ( !$this->Lexer ) { $this->Lexer = new Doku_Lexer($this->Handler,'base', true); } - $this->modes['base']->Lexer =& $this->Lexer; + $this->modes['base']->Lexer = $this->Lexer; } /** * PHP preserves order of associative elements * Mode sequence is important */ - function addMode($name, & $Mode) { + function addMode($name, Doku_Parser_Mode_Interface $Mode) { if ( !isset($this->modes['base']) ) { $this->addBaseMode(new Doku_Parser_Mode_base()); } - $Mode->Lexer = & $this->Lexer; - $this->modes[$name] =& $Mode; + $Mode->Lexer = $this->Lexer; + $this->modes[$name] = $Mode; } function connectModes() { @@ -226,7 +226,7 @@ class Doku_Parser_Mode_Plugin extends DokuWiki_Plugin implements Doku_Parser_Mod //------------------------------------------------------------------- class Doku_Parser_Mode_base extends Doku_Parser_Mode { - function Doku_Parser_Mode_base() { + function __construct() { global $PARSER_MODES; $this->allowedModes = array_merge ( @@ -248,7 +248,7 @@ class Doku_Parser_Mode_base extends Doku_Parser_Mode { //------------------------------------------------------------------- class Doku_Parser_Mode_footnote extends Doku_Parser_Mode { - function Doku_Parser_Mode_footnote() { + function __construct() { global $PARSER_MODES; $this->allowedModes = array_merge ( @@ -416,7 +416,7 @@ class Doku_Parser_Mode_formatting extends Doku_Parser_Mode { /** * @param string $type */ - function Doku_Parser_Mode_formatting($type) { + function __construct($type) { global $PARSER_MODES; if ( !array_key_exists($type, $this->formatting) ) { @@ -470,7 +470,7 @@ class Doku_Parser_Mode_formatting extends Doku_Parser_Mode { //------------------------------------------------------------------- class Doku_Parser_Mode_listblock extends Doku_Parser_Mode { - function Doku_Parser_Mode_listblock() { + function __construct() { global $PARSER_MODES; $this->allowedModes = array_merge ( @@ -504,7 +504,7 @@ class Doku_Parser_Mode_listblock extends Doku_Parser_Mode { //------------------------------------------------------------------- class Doku_Parser_Mode_table extends Doku_Parser_Mode { - function Doku_Parser_Mode_table() { + function __construct() { global $PARSER_MODES; $this->allowedModes = array_merge ( @@ -648,7 +648,7 @@ class Doku_Parser_Mode_file extends Doku_Parser_Mode { //------------------------------------------------------------------- class Doku_Parser_Mode_quote extends Doku_Parser_Mode { - function Doku_Parser_Mode_quote() { + function __construct() { global $PARSER_MODES; $this->allowedModes = array_merge ( @@ -682,7 +682,7 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { var $acronyms = array(); var $pattern = ''; - function Doku_Parser_Mode_acronym($acronyms) { + function __construct($acronyms) { usort($acronyms,array($this,'_compare')); $this->acronyms = $acronyms; } @@ -729,7 +729,7 @@ class Doku_Parser_Mode_smiley extends Doku_Parser_Mode { var $smileys = array(); var $pattern = ''; - function Doku_Parser_Mode_smiley($smileys) { + function __construct($smileys) { $this->smileys = $smileys; } @@ -762,7 +762,7 @@ class Doku_Parser_Mode_wordblock extends Doku_Parser_Mode { var $badwords = array(); var $pattern = ''; - function Doku_Parser_Mode_wordblock($badwords) { + function __construct($badwords) { $this->badwords = $badwords; } @@ -797,7 +797,7 @@ class Doku_Parser_Mode_entity extends Doku_Parser_Mode { var $entities = array(); var $pattern = ''; - function Doku_Parser_Mode_entity($entities) { + function __construct($entities) { $this->entities = $entities; } |