Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getSort() {
return 239; // before 'acronym'
}

function syntax_plugin_explain() {
function __construct() {
// "static" not allowed in PHP4?!?
//if (isset($keys[0]) return; // evaluate at most once
$lines = @file(DOKU_CONF.'explain.conf');
Expand All @@ -50,7 +50,7 @@ function syntax_plugin_explain() {
if (empty($line)) continue;
if (substr($line, 0, 1) === '#') continue;
$parts = explode("\t", $line);
if ($i) $parts[0] = utf8_strtolower($parts[0]);
if ($i) $parts[0] = \dokuwiki\Utf8\PhpString::strtolower($parts[0]);
$this->map[$parts[0]] = array('desc' => $parts[1],
'target' => $this->link(array_slice($parts, 2)),
'i' => $i);
Expand All @@ -76,7 +76,9 @@ function _link($target) {
return $target;

/* Match an internal link. */
list($id, $hash) = explode('#', $target, 2);
$parts = explode('#', $target, 2);
$id = $parts[0];
$hash = isset($parts[1]) ? $parts[1] : '';
global $ID;

$_ret = '';
Expand All @@ -90,7 +92,7 @@ function _link($target) {
}

function connectTo($mode) {
if (count($this->map) === 0)
if (count((array)$this->map) === 0)
return;

$re = '(?<=^|\W)(?i:'.
Expand All @@ -105,7 +107,7 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
$data = array('content' => $match);
foreach (array_keys($this->map) as $rxmatch) {
if ($match === $rxmatch ||
($this->map[$rxmatch]['i'] && utf8_strtolower($match) === $rxmatch)) {
($this->map[$rxmatch]['i'] && \dokuwiki\Utf8\PhpString::strtolower($match) === $rxmatch)) {
$data += $this->map[$rxmatch];
/* Handle only the first occurrence. */
unset($this->map[$rxmatch]['desc']);
Expand All @@ -116,7 +118,7 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
}

public function render($format, Doku_Renderer $renderer, $data) {
if(is_null($data['desc'])) {
if(empty($data['desc'])) {
$renderer->doc .= hsc($data['content']);
return true;
}
Expand Down