summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-03-27 09:43:48 +0000
committerlsces <lester@lsces.co.uk>2026-03-27 09:43:48 +0000
commitcf748477dfc490e5cc8a936816d747d24a4f720b (patch)
treeb2118ca64b7db9e5cc954ef2cf4d41774acb32c3
parent0e137f1000258671ce385dbc55830aefc554a1ea (diff)
downloadutil-cf748477dfc490e5cc8a936816d747d24a4f720b.tar.gz
util-cf748477dfc490e5cc8a936816d747d24a4f720b.tar.bz2
util-cf748477dfc490e5cc8a936816d747d24a4f720b.zip
Legacy code tweaks to Text?Wiki library
-rw-r--r--includes/pear/Text/Wiki/Parse/Default/Smiley.php6
-rw-r--r--includes/pear/Text/Wiki/Parse/Default/Wikilink.php29
-rw-r--r--includes/pear/Text/Wiki/Render.php2
-rw-r--r--includes/pear/Text/Wiki/Render/Xhtml/Colortext.php2
-rw-r--r--includes/pear/Text/Wiki/Render/Xhtml/Url.php2
5 files changed, 20 insertions, 21 deletions
diff --git a/includes/pear/Text/Wiki/Parse/Default/Smiley.php b/includes/pear/Text/Wiki/Parse/Default/Smiley.php
index 358af6c..c136532 100644
--- a/includes/pear/Text/Wiki/Parse/Default/Smiley.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Smiley.php
@@ -111,15 +111,15 @@ class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
$cur = $smiley;
}
$len = strlen($cur);
- if (($cur{0} == ':') && ($len > 2) && ($cur{$len - 1} == ':')) {
+ if (($cur[0] == ':') && ($len > 2) && ($cur[$len - 1] == ':')) {
$reg1 .= $sep1 . preg_quote(substr($cur, 1, -1), '#');
$sep1 = '|';
continue;
}
if ($autoNose && ($len === 2)) {
- $variante = $cur{0} . '-' . $cur{1};
+ $variante = $cur[0] . '-' . $cur[1];
$this->_smileys[$variante] = &$this->_smileys[$smiley];
- $cur = preg_quote($cur{0}, '#') . '-?' . preg_quote($cur{1}, '#');
+ $cur = preg_quote($cur[0], '#') . '-?' . preg_quote($cur[1], '#');
} else {
$cur = preg_quote($cur, '#');
}
diff --git a/includes/pear/Text/Wiki/Parse/Default/Wikilink.php b/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
index c3d81c3..2eb079e 100644
--- a/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
+++ b/includes/pear/Text/Wiki/Parse/Default/Wikilink.php
@@ -135,7 +135,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
$tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/".($this->getConf('utf-8') ? 'u' : '');
$this->wiki->source = preg_replace_callback(
$tmp_regex,
- array(&$this, 'process'),
+ [&$this, 'process' ],
$this->wiki->source
);
}
@@ -149,7 +149,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
*
* @param array &$matches The array of matches from parse().
*
- * @return A delimited token to be used as a placeholder in
+ * @return string A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
@@ -157,11 +157,11 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
function processDescr(&$matches)
{
// set the options
- $options = array(
- 'page' => $matches[1],
- 'text' => $matches[5],
- 'anchor' => $matches[3]
- );
+ $options = [
+ 'page' => $matches[1],
+ 'text' => $matches[5],
+ 'anchor' => $matches[3],
+ ];
// create and return the replacement token and preceding text
return $this->wiki->addToken($this->rule, $options); // . $matches[7];
@@ -177,7 +177,7 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
*
* @param array &$matches The array of matches from parse().
*
- * @return A delimited token to be used as a placeholder in
+ * @return string A delimited token to be used as a placeholder in
* the source text, plus any text prior to the match.
*
*/
@@ -186,19 +186,18 @@ class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
{
// when prefixed with !, it's explicitly not a wiki link.
// return everything as it was.
- if ($matches[2]{0} == '!') {
+ if ($matches[2][0] == '!') {
return $matches[1] . substr($matches[2], 1) . $matches[3];
}
// set the options
- $options = array(
- 'page' => $matches[2],
- 'text' => $matches[2] . $matches[3],
- 'anchor' => $matches[3]
- );
+ $options = [
+ 'page' => $matches[2],
+ 'text' => $matches[2] . $matches[3],
+ 'anchor' => $matches[3],
+ ];
// create and return the replacement token and preceding text
return $matches[1] . $this->wiki->addToken($this->rule, $options);
}
}
-?>
diff --git a/includes/pear/Text/Wiki/Render.php b/includes/pear/Text/Wiki/Render.php
index 5bc26f7..85fd58a 100644
--- a/includes/pear/Text/Wiki/Render.php
+++ b/includes/pear/Text/Wiki/Render.php
@@ -206,7 +206,7 @@ class Text_Wiki_Render {
*
* @access public
* @param string $text the text to render
- * @return rendered text
+ * @return string rendered text
*
*/
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php b/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
index d8d8c7f..5d3e8e1 100644
--- a/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Colortext.php
@@ -63,7 +63,7 @@ class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
$type = $options['type'];
$color = $options['color'];
- if (! in_array($color, $this->colors) && $color{0} != '#') {
+ if (! in_array($color, $this->colors) && $color[0] != '#') {
$color = '#' . $color;
}
diff --git a/includes/pear/Text/Wiki/Render/Xhtml/Url.php b/includes/pear/Text/Wiki/Render/Xhtml/Url.php
index 9139be7..5c06177 100644
--- a/includes/pear/Text/Wiki/Render/Xhtml/Url.php
+++ b/includes/pear/Text/Wiki/Render/Xhtml/Url.php
@@ -79,7 +79,7 @@ class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
} else {
// should we build a target clause?
- if ($href{0} == '#' ||
+ if ($href[0] == '#' ||
strtolower(substr($href, 0, 7)) == 'mailto:') {
// targets not allowed for on-page anchors
// and mailto: links.