aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc/parser
diff options
context:
space:
mode:
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php10
-rw-r--r--inc/parser/metadata.php2
-rw-r--r--inc/parser/parser.php44
-rw-r--r--inc/parser/renderer.php4
-rw-r--r--inc/parser/xhtml.php4
5 files changed, 56 insertions, 8 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 19c2aafe8..e5f7c4ed5 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -44,11 +44,17 @@ class Doku_Handler {
* @param mixed $args arguments for this call
* @param int $pos byte position in the original source file
*/
- protected function addCall($handler, $args, $pos) {
+ public function addCall($handler, $args, $pos) {
$call = array($handler,$args, $pos);
$this->callWriter->writeCall($call);
}
+ /** @deprecated 2019-10-31 use addCall() instead */
+ public function _addCall($handler, $args, $pos) {
+ dbg_deprecated('addCall');
+ $this->addCall($handler, $args, $pos);
+ }
+
/**
* Similar to addCall, but adds a plugin call
*
@@ -58,7 +64,7 @@ class Doku_Handler {
* @param int $pos byte position in the original source file
* @param string $match matched syntax
*/
- protected function addPluginCall($plugin, $args, $state, $pos, $match) {
+ public function addPluginCall($plugin, $args, $state, $pos, $match) {
$call = array('plugin',array($plugin, $args, $state, $match), $pos);
$this->callWriter->writeCall($call);
}
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index fa64ae2ec..849fffe8d 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -64,7 +64,7 @@ class Doku_Renderer_metadata extends Doku_Renderer
$this->headers = array();
// external pages are missing create date
- if (!$this->persistent['date']['created']) {
+ if (!isset($this->persistent['date']['created']) || !$this->persistent['date']['created']) {
$this->persistent['date']['created'] = filectime(wikiFN($ID));
}
if (!isset($this->persistent['user'])) {
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index d9fc5fb8f..aee82f01d 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -1,5 +1,7 @@
<?php
+use dokuwiki\Debug\PropertyDeprecationHelper;
+
/**
* Define various types of modes used by the parser - they are used to
* populate the list of modes another mode accepts
@@ -48,10 +50,50 @@ $PARSER_MODES = array(
* @deprecated 2018-05-04
*/
class Doku_Parser extends \dokuwiki\Parsing\Parser {
+ use PropertyDeprecationHelper {
+ __set as protected deprecationHelperMagicSet;
+ __get as protected deprecationHelperMagicGet;
+ }
/** @inheritdoc */
- public function __construct(Doku_Handler $handler) {
+ public function __construct(Doku_Handler $handler = null) {
dbg_deprecated(\dokuwiki\Parsing\Parser::class);
+ $this->deprecatePublicProperty('modes', __CLASS__);
+ $this->deprecatePublicProperty('connected', __CLASS__);
+
+ if ($handler === null) {
+ $handler = new Doku_Handler();
+ }
+
parent::__construct($handler);
}
+
+ public function __set($name, $value)
+ {
+
+ if ($name === 'Handler') {
+ $this->handler = $value;
+ return;
+ }
+
+ if ($name === 'Lexer') {
+ $this->lexer = $value;
+ return;
+ }
+
+ $this->deprecationHelperMagicSet($name, $value);
+ }
+
+ public function __get($name)
+ {
+ if ($name === 'Handler') {
+ return $this->handler;
+ }
+
+ if ($name === 'Lexer') {
+ return $this->lexer;
+ }
+
+ return $this->deprecationHelperMagicGet($name);
+ }
}
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php
index 9720cfd90..a03b84c8e 100644
--- a/inc/parser/renderer.php
+++ b/inc/parser/renderer.php
@@ -866,7 +866,7 @@ abstract class Doku_Renderer extends Plugin {
//use placeholders
$url = str_replace('{URL}', rawurlencode($reference), $url);
//wiki names will be cleaned next, otherwise urlencode unsafe chars
- $url = str_replace('{NAME}', ($url{0} === ':') ? $reference :
+ $url = str_replace('{NAME}', ($url[0] === ':') ? $reference :
preg_replace_callback('/[[\\\\\]^`{|}#%]/', function($match) {
return rawurlencode($match[0]);
}, $reference), $url);
@@ -889,7 +889,7 @@ abstract class Doku_Renderer extends Plugin {
$url = $url.rawurlencode($reference);
}
//handle as wiki links
- if($url{0} === ':') {
+ if($url[0] === ':') {
$urlparam = null;
$id = $url;
if (strpos($url, '?') !== false) {
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index b1931d6f0..169f4f9f4 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -680,7 +680,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$this->doc .= '</a></dt>'.DOKU_LF.'<dd>';
}
- if($text{0} == "\n") {
+ if($text[0] == "\n") {
$text = substr($text, 1);
}
if(substr($text, -1) == "\n") {
@@ -917,7 +917,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['pre'] = '';
$link['suf'] = '';
// highlight link to current page
- if($id == $INFO['id']) {
+ if(isset($INFO) && $id == $INFO['id']) {
$link['pre'] = '<span class="curid">';
$link['suf'] = '</span>';
}