|
From: <var...@us...> - 2022-03-24 13:32:28
|
Revision: 11009
http://sourceforge.net/p/phpwiki/code/11009
Author: vargenau
Date: 2022-03-24 13:32:25 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
run php-cs-fixer
Modified Paths:
--------------
trunk/lib/AtomParser.php
trunk/lib/BlockParser.php
trunk/lib/CachedMarkup.php
trunk/lib/Captcha.php
trunk/lib/DbSession.php
trunk/lib/DbaDatabase.php
trunk/lib/DbaPartition.php
trunk/lib/ErrorManager.php
trunk/lib/ExternalReferrer.php
trunk/lib/FileFinder.php
trunk/lib/Google.php
trunk/lib/HtmlElement.php
trunk/lib/HtmlParser.php
trunk/lib/HttpClient.php
trunk/lib/IniConfig.php
trunk/lib/InlineParser.php
trunk/lib/MailNotify.php
trunk/lib/PageList.php
trunk/lib/PagePerm.php
trunk/lib/PageType.php
trunk/lib/PhpWikiXmlParser.php
trunk/lib/Request.php
trunk/lib/RssParser.php
trunk/lib/RssWriter.php
trunk/lib/RssWriter091.php
trunk/lib/RssWriter2.php
trunk/lib/SemanticWeb.php
trunk/lib/SpamBlocklist.php
trunk/lib/Template.php
trunk/lib/TextSearchQuery.php
trunk/lib/Units.php
trunk/lib/WikiCallback.php
trunk/lib/WikiDB.php
trunk/lib/WikiGroup.php
trunk/lib/WikiPlugin.php
trunk/lib/WikiPluginCached.php
trunk/lib/WikiTheme.php
trunk/lib/WikiUser.php
trunk/lib/WysiwygEdit.php
trunk/lib/XmlElement.php
trunk/lib/XmlRpcClient.php
trunk/lib/XmlRpcServer.php
trunk/lib/config.php
trunk/lib/diff.php
trunk/lib/diff3.php
trunk/lib/difflib.php
trunk/lib/display.php
trunk/lib/editpage.php
trunk/lib/fortune.php
trunk/lib/imagecache.php
trunk/lib/install.php
trunk/lib/loadsave.php
trunk/lib/main.php
trunk/lib/mimelib.php
trunk/lib/pdf.php
trunk/lib/prepend.php
trunk/lib/purgepage.php
trunk/lib/removepage.php
trunk/lib/spam_babycart.php
trunk/lib/stdlib.php
trunk/lib/upgrade.php
Modified: trunk/lib/AtomParser.php
===================================================================
--- trunk/lib/AtomParser.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/AtomParser.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -30,8 +30,7 @@
*/
require_once 'lib/PhpWikiXmlParser.php';
-class AtomParser
- extends PhpWikiXmlParser
+class AtomParser extends PhpWikiXmlParser
{
// Feed
public $feed = array();
@@ -70,7 +69,7 @@
public $inside_content = false;
public $content = '';
- function tag_open($parser, $name, $attrs = '')
+ public function tag_open($parser, $name, $attrs = '')
{
global $current_tag, $current_attrs;
@@ -86,7 +85,7 @@
}
}
- function tag_close($parser, $name, $attrs = '')
+ public function tag_close($parser, $name, $attrs = '')
{
if ($name == "AUTHOR") {
$an_author = $this->trim_data(array(
@@ -167,7 +166,7 @@
}
}
- function cdata($parser, $data)
+ public function cdata($parser, $data)
{
global $current_tag, $current_attrs;
@@ -176,10 +175,11 @@
} else {
switch ($current_tag) {
case "ID":
- if ($this->inside_entry)
+ if ($this->inside_entry) {
$this->id .= $data;
- else
+ } else {
$this->feed_id .= $data;
+ }
break;
case "LINK":
$a_link = array();
@@ -198,17 +198,19 @@
case "EMAIL":
$this->email .= $data;
break;
- case "TITLE" :
- if ($this->inside_entry)
+ case "TITLE":
+ if ($this->inside_entry) {
$this->title .= $data;
- else
+ } else {
$this->feed_title .= $data;
+ }
break;
case "UPDATED":
- if ($this->inside_entry)
+ if ($this->inside_entry) {
$this->updated .= $data;
- else
+ } else {
$this->feed_updated .= $data;
+ }
break;
case "SUBTITLE":
$this->feed_subtitle .= $data;
@@ -238,12 +240,12 @@
}
}
- function trim_data($array)
+ public function trim_data($array)
{
return array_map(array("self", "trim_element"), $array);
}
- function trim_element($element)
+ public function trim_element($element)
{
if (is_array($element)) {
return $this->trim_data($element);
@@ -253,7 +255,7 @@
return false;
}
- function serialize_tag($tag_name, $attributes)
+ public function serialize_tag($tag_name, $attributes)
{
$tag = "<" . $tag_name;
foreach ($attributes as $k => $v) {
Modified: trunk/lib/BlockParser.php
===================================================================
--- trunk/lib/BlockParser.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/BlockParser.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -83,7 +83,7 @@
* "(...)". (Anonymous groups, like "(?:...)", as well as
* look-ahead and look-behind assertions are fine.)
*/
- function __construct($regexps)
+ public function __construct($regexps)
{
$this->_regexps = $regexps;
$this->_re = "/((" . join(")|(", $regexps) . "))/Ax";
@@ -96,10 +96,11 @@
*
* @return AnchoredRegexpSet_match|bool An AnchoredRegexpSet_match object, or false if no match.
*/
- function match($text)
+ public function match($text)
{
- if (!is_string($text))
+ if (!is_string($text)) {
return false;
+ }
if (!preg_match($this->_re, $text, $m)) {
return false;
}
@@ -129,7 +130,7 @@
*
* @return AnchoredRegexpSet_match|bool An AnchoredRegexpSet_match object, or false if no match.
*/
- function nextMatch($text, $prevMatch)
+ public function nextMatch($text, $prevMatch)
{
// Try to find match at same position.
$regexps = array_slice($this->_regexps, $prevMatch->regexp_ind + 1);
@@ -154,8 +155,7 @@
class BlockParser_Input
{
-
- function __construct($text)
+ public function __construct($text)
{
// Expand leading tabs.
// FIXME: do this better.
@@ -169,12 +169,13 @@
$this->_pos = 0;
// Strip leading blank lines.
- while ($this->_lines and !$this->_lines[0])
+ while ($this->_lines and !$this->_lines[0]) {
array_shift($this->_lines);
+ }
$this->_atSpace = false;
}
- function skipSpace()
+ public function skipSpace()
{
$nlines = count($this->_lines);
while (1) {
@@ -182,8 +183,9 @@
$this->_atSpace = false;
break;
}
- if ($this->_lines[$this->_pos] != '')
+ if ($this->_lines[$this->_pos] != '') {
break;
+ }
$this->_pos++;
$this->_atSpace = true;
}
@@ -190,7 +192,7 @@
return $this->_atSpace;
}
- function currentLine()
+ public function currentLine()
{
if ($this->_pos >= count($this->_lines)) {
return false;
@@ -198,7 +200,7 @@
return $this->_lines[$this->_pos];
}
- function nextLine()
+ public function nextLine()
{
$this->_atSpace = $this->_lines[$this->_pos++] === '';
if ($this->_pos >= count($this->_lines)) {
@@ -207,48 +209,51 @@
return $this->_lines[$this->_pos];
}
- function advance()
+ public function advance()
{
$this->_atSpace = ($this->_lines[$this->_pos] === '');
$this->_pos++;
}
- function getPos()
+ public function getPos()
{
return array($this->_pos, $this->_atSpace);
}
- function setPos($pos)
+ public function setPos($pos)
{
list($this->_pos, $this->_atSpace) = $pos;
}
- function getPrefix()
+ public function getPrefix()
{
return '';
}
- function getDepth()
+ public function getDepth()
{
return 0;
}
- function where()
+ public function where()
{
- if ($this->_pos < count($this->_lines))
+ if ($this->_pos < count($this->_lines)) {
return $this->_lines[$this->_pos];
- else
+ } else {
return "<EOF>";
+ }
}
- function _debug($tab, $msg)
+ public function _debug($tab, $msg)
{
//return ;
$where = $this->where();
$tab = str_repeat('____', $this->getDepth()) . $tab;
- PrintXML(HTML::div("$tab $msg: at: '",
+ PrintXML(HTML::div(
+ "$tab $msg: at: '",
HTML::samp($where),
- "'"));
+ "'"
+ ));
flush();
}
}
@@ -260,15 +265,15 @@
* @param string $prefix_re
* @param string $initial_prefix
*/
- function __construct(&$input, $prefix_re, $initial_prefix = '')
+ public function __construct(&$input, $prefix_re, $initial_prefix = '')
{
$this->_input = &$input;
$this->_prefix_pat = "/$prefix_re|\\s*\$/Ax";
$this->_atSpace = false;
- if (($line = $input->currentLine()) === false)
+ if (($line = $input->currentLine()) === false) {
$this->_line = false;
- elseif ($initial_prefix) {
+ } elseif ($initial_prefix) {
assert(substr($line, 0, strlen($initial_prefix)) == $initial_prefix);
$this->_line = (string)substr($line, strlen($initial_prefix));
$this->_atBlank = !ltrim($line);
@@ -275,57 +280,62 @@
} elseif (preg_match($this->_prefix_pat, $line, $m)) {
$this->_line = (string)substr($line, strlen($m[0]));
$this->_atBlank = !ltrim($line);
- } else
+ } else {
$this->_line = false;
+ }
}
- function skipSpace()
+ public function skipSpace()
{
// In contrast to the case for top-level blocks,
// for sub-blocks, there never appears to be any trailing space.
// (The last block in the sub-block should always be of class tight-bottom.)
- while ($this->_line === '')
+ while ($this->_line === '') {
$this->advance();
+ }
- if ($this->_line === false)
+ if ($this->_line === false) {
return $this->_atSpace == 'strong_space';
- else
+ } else {
return $this->_atSpace;
+ }
}
- function currentLine()
+ public function currentLine()
{
return $this->_line;
}
- function nextLine()
+ public function nextLine()
{
- if ($this->_line === '')
+ if ($this->_line === '') {
$this->_atSpace = $this->_atBlank ? 'weak_space' : 'strong_space';
- else
+ } else {
$this->_atSpace = false;
+ }
$line = $this->_input->nextLine();
if ($line !== false && preg_match($this->_prefix_pat, $line, $m)) {
$this->_line = (string)substr($line, strlen($m[0]));
$this->_atBlank = !ltrim($line);
- } else
+ } else {
$this->_line = false;
+ }
return $this->_line;
}
- function advance()
+ public function advance()
{
$this->nextLine();
}
- function getPos()
+ public function getPos()
{
return array($this->_line, $this->_atSpace, $this->_input->getPos());
}
- function setPos($pos)
+ public function setPos($pos)
{
$this->_line = $pos[0];
$this->_atSpace = $pos[1];
@@ -332,7 +342,7 @@
$this->_input->setPos($pos[2]);
}
- function getPrefix()
+ public function getPrefix()
{
assert($this->_line !== false);
$line = $this->_input->currentLine();
@@ -340,12 +350,12 @@
return substr($line, 0, strlen($line) - strlen($this->_line));
}
- function getDepth()
+ public function getDepth()
{
return $this->_input->getDepth() + 1;
}
- function where()
+ public function where()
{
return $this->_input->where();
}
@@ -353,12 +363,12 @@
class Block_HtmlElement extends HtmlElement
{
- function __construct($tag /*, ... */)
+ public function __construct($tag /*, ... */)
{
$this->_init(func_get_args());
}
- function setTightness($top, $bottom)
+ public function setTightness($top, $bottom)
{
}
}
@@ -370,7 +380,7 @@
private $_regexpset;
private $_atSpace;
- function __construct(&$input, $tag = 'div', $attr = array())
+ public function __construct(&$input, $tag = 'div', $attr = array())
{
parent::__construct($tag, $attr);
$this->initBlockTypes();
@@ -403,8 +413,7 @@
if (!is_object($_regexpset)) {
// nowiki_wikicreole must be before template_plugin
- $Block_types = array
- ('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl',
+ $Block_types = array('nowiki_wikicreole', 'template_plugin', 'placeholder', 'oldlists', 'list', 'dl',
'table_dl', 'table_wikicreole', 'table_mediawiki',
'blockquote', 'heading', 'heading_wikicreole', 'hr', 'pre',
'email_blockquote', 'wikicreole_indented',
@@ -417,7 +426,7 @@
}
foreach ($Block_types as $type) {
$class = "Block_$type";
- $proto = new $class;
+ $proto = new $class();
$this->_block_types[] = $proto;
$this->_regexps[] = $proto->_re;
}
@@ -444,22 +453,26 @@
//FIXME: php5 fails to advance here!
for ($m = $re_set->match($line); $m; $m = $re_set->nextMatch($line, $m)) {
$block = clone($this->_block_types[$m->regexp_ind]);
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('>', get_class($block));
+ }
if ($block->_match($input, $m)) {
//$block->_text = $line;
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('<', get_class($block));
+ }
$tight_bottom = !$input->skipSpace();
$block->_setTightness($tight_top, $tight_bottom);
return $block;
}
- if (DEBUG & _DEBUG_PARSER)
+ if (DEBUG & _DEBUG_PARSER) {
$input->_debug('[', "_match failed");
+ }
}
- if ($line === false or $line === '') // allow $line === '0'
+ if ($line === false or $line === '') { // allow $line === '0'
return false;
+ }
trigger_error("Couldn't match block: '$line'");
return false;
@@ -468,7 +481,7 @@
class WikiText extends ParsedBlock
{
- function __construct($text)
+ public function __construct($text)
{
$input = new BlockParser_Input($text);
parent::__construct($input);
@@ -477,8 +490,13 @@
class SubBlock extends ParsedBlock
{
- function __construct(&$input, $indent_re, $initial_indent = false,
- $tag = 'div', $attr = array())
+ public function __construct(
+ &$input,
+ $indent_re,
+ $initial_indent = false,
+ $tag = 'div',
+ $attr = array()
+ )
{
$subinput = new BlockParser_InputSubBlock($input, $indent_re, $initial_indent);
parent::__construct($subinput, $tag, $attr);
@@ -497,8 +515,13 @@
*/
class TightSubBlock extends SubBlock
{
- function __construct(&$input, $indent_re, $initial_indent = false,
- $tag = 'div', $attr = array())
+ public function __construct(
+ &$input,
+ $indent_re,
+ $initial_indent = false,
+ $tag = 'div',
+ $attr = array()
+ )
{
parent::__construct($input, $indent_re, $initial_indent, $tag, $attr);
@@ -517,18 +540,18 @@
public $_re;
protected $_element;
- abstract function _match(&$input, $match);
+ abstract public function _match(&$input, $match);
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
}
- function merge($followingBlock)
+ public function merge($followingBlock)
{
return false;
}
- function finish()
+ public function finish()
{
return $this->_element;
}
@@ -540,22 +563,27 @@
public $_re = '\ +(?=\S)';
protected $_element;
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$this->_depth = strlen($m->match);
$indent = sprintf("\\ {%d}", $this->_depth);
- $this->_element = new SubBlock($input, $indent, $m->match,
- 'blockquote');
+ $this->_element = new SubBlock(
+ $input,
+ $indent,
+ $m->match,
+ 'blockquote'
+ );
return true;
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
if (get_class($nextBlock) == get_class($this)) {
assert($nextBlock->_depth < $this->_depth);
$nextBlock->_element->unshiftContent($this->_element);
- if (!empty($this->_tight_top))
+ if (!empty($this->_tight_top)) {
$nextBlock->_tight_top = $this->_tight_top;
+ }
return $nextBlock;
}
return false;
@@ -574,7 +602,7 @@
public $_content = array();
public $_tag; //'ol' or 'ul'
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// A list as the first content in a list is not allowed.
// E.g.:
@@ -595,23 +623,27 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$li = &$this->_content[0];
$li->setTightness($top, $bot);
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
if (is_a($nextBlock, 'Block_list') and $this->_tag == $nextBlock->_tag) {
- array_splice($this->_content, count($this->_content), 0,
- $nextBlock->_content);
+ array_splice(
+ $this->_content,
+ count($this->_content),
+ 0,
+ $nextBlock->_content
+ );
return $this;
}
return false;
}
- function finish()
+ public function finish()
{
return new Block_HtmlElement($this->_tag, false, $this->_content);
}
@@ -622,16 +654,17 @@
public $_tag = 'dl';
private $_tight_defn;
- function __construct()
+ public function __construct()
{
$this->_re = '\ {0,4}\S.*(?<!' . ESCAPE_CHAR . '):\s*$';
}
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
- if (!($p = $this->_do_match($input, $m)))
+ if (!($p = $this->_do_match($input, $m))) {
return false;
- list ($term, $defn, $loose) = $p;
+ }
+ list($term, $defn, $loose) = $p;
$this->_content[] = new Block_HtmlElement('dt', false, $term);
$this->_content[] = $defn;
@@ -639,7 +672,7 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$dt = &$this->_content[0];
$dd = &$this->_content[1];
@@ -648,7 +681,7 @@
$dd->setTightness($this->_tight_defn, $bot);
}
- function _do_match(&$input, $m)
+ public function _do_match(&$input, $m)
{
$pos = $input->getPos();
@@ -679,11 +712,12 @@
private $_tight_top;
private $_tight_bot;
- function __construct($term, $defn)
+ public function __construct($term, $defn)
{
parent::__construct();
- if (!is_array($defn))
+ if (!is_array($defn)) {
$defn = $defn->getContent();
+ }
$this->_next_tight_top = false; // value irrelevant - gets fixed later
$this->_ncols = $this->ComputeNcols($defn);
@@ -690,20 +724,22 @@
$this->_nrows = 0;
foreach ($defn as $item) {
- if ($this->IsASubtable($item))
+ if ($this->IsASubtable($item)) {
$this->addSubtable($item);
- else
+ } else {
$this->addToRow($item);
+ }
}
$this->flushRow();
$th = HTML::th($term);
- if ($this->_nrows > 1)
+ if ($this->_nrows > 1) {
$th->setAttr('rowspan', $this->_nrows);
+ }
$this->_setTerm($th);
}
- function setTightness($tight_top, $tight_bot)
+ public function setTightness($tight_top, $tight_bot)
{
$this->_tight_top = $tight_top;
$this->_tight_bot = $tight_bot;
@@ -713,8 +749,9 @@
{
if (empty($this->_accum)) {
$this->_accum = HTML::td();
- if ($this->_ncols > 2)
+ if ($this->_ncols > 2) {
$this->_accum->setAttr('colspan', $this->_ncols - 1);
+ }
}
$this->_accum->pushContent($item);
}
@@ -735,8 +772,9 @@
private function addSubtable($table)
{
- if (!($table_rows = $table->getContent()))
+ if (!($table_rows = $table->getContent())) {
return;
+ }
$this->flushRow($table_rows[0]->_tight_top);
@@ -750,10 +788,11 @@
private function _setTerm($th)
{
$first_row = &$this->_content[0];
- if (is_a($first_row, 'Block_table_dl_defn'))
+ if (is_a($first_row, 'Block_table_dl_defn')) {
$first_row->_setTerm($th);
- else
+ } else {
$first_row->unshiftContent($th);
+ }
}
private function ComputeNcols($defn)
@@ -781,47 +820,51 @@
return $defs[0];
}
- function ncols()
+ public function ncols()
{
return $this->_ncols;
}
- function nrows()
+ public function nrows()
{
return $this->_nrows;
}
- function & firstTR()
+ public function & firstTR()
{
$first = &$this->_content[0];
- if (is_a($first, 'Block_table_dl_defn'))
+ if (is_a($first, 'Block_table_dl_defn')) {
return $first->firstTR();
+ }
return $first;
}
- function & lastTR()
+ public function & lastTR()
{
$last = &$this->_content[$this->_nrows - 1];
- if (is_a($last, 'Block_table_dl_defn'))
+ if (is_a($last, 'Block_table_dl_defn')) {
return $last->lastTR();
+ }
return $last;
}
- function setWidth($ncols)
+ public function setWidth($ncols)
{
assert($ncols >= $this->_ncols);
- if ($ncols <= $this->_ncols)
+ if ($ncols <= $this->_ncols) {
return;
+ }
$rows = &$this->_content;
for ($i = 0; $i < count($rows); $i++) {
$row = &$rows[$i];
- if (is_a($row, 'Block_table_dl_defn'))
+ if (is_a($row, 'Block_table_dl_defn')) {
$row->setWidth($ncols - 1);
- else {
+ } else {
$n = count($row->_content);
$lastcol = &$row->_content[$n - 1];
- if (!empty($lastcol))
+ if (!empty($lastcol)) {
$lastcol->setAttr('colspan', $ncols - 1);
+ }
}
}
}
@@ -831,36 +874,39 @@
{
public $_tag = 'dl-table'; // phony.
- function __construct()
+ public function __construct()
{
$this->_re = '\ {0,4} (?:\S.*)? (?<!' . ESCAPE_CHAR . ') \| \s* $';
}
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
- if (!($p = $this->_do_match($input, $m)))
+ if (!($p = $this->_do_match($input, $m))) {
return false;
- list ($term, $defn, $loose) = $p;
+ }
+ list($term, $defn, $loose) = $p;
$this->_content[] = new Block_table_dl_defn($term, $defn);
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$this->_content[0]->setTightness($top, $bot);
}
- function finish()
+ public function finish()
{
$defs = &$this->_content;
$ncols = 0;
- foreach ($defs as $defn)
+ foreach ($defs as $defn) {
$ncols = max($ncols, $defn->ncols());
+ }
- foreach ($defs as $key => $defn)
+ foreach ($defs as $key => $defn) {
$defs[$key]->setWidth($ncols);
+ }
return HTML::table(array('class' => 'wiki-dl-table'), $defs);
}
@@ -874,7 +920,7 @@
| ; .*? :
) .*? (?=\S)';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// FIXME:
if (!preg_match('/[*#;]*$/A', $input->getPrefix())) {
@@ -895,11 +941,15 @@
$itemtag = 'li';
} else {
$this->_tag = 'dl';
- list ($term,) = explode(':', substr($prefix, 1), 2);
+ list($term, ) = explode(':', substr($prefix, 1), 2);
$term = trim($term);
- if ($term)
- $this->_content[] = new Block_HtmlElement('dt', false,
- TransformInline($term));
+ if ($term) {
+ $this->_content[] = new Block_HtmlElement(
+ 'dt',
+ false,
+ TransformInline($term)
+ );
+ }
$itemtag = 'dd';
}
@@ -907,7 +957,7 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
if (count($this->_content) == 1) {
$li = &$this->_content[0];
@@ -925,7 +975,7 @@
{
public $_re = '<(?:pre|verbatim|nowiki|noinclude|includeonly)>';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '</' . substr($m->match, 1);
$text = array();
@@ -946,10 +996,11 @@
return true;
}
- if ($m->match == '<nowiki>')
+ if ($m->match == '<nowiki>') {
$text = join("<br>\n", $text);
- else
+ } else {
$text = join("\n", $text);
+ }
if ($m->match == '<noinclude>') {
$text = TransformText($text);
@@ -970,7 +1021,7 @@
{
public $_re = '<<<';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '>>>';
$text = array();
@@ -997,7 +1048,7 @@
{
public $_re = '{{{';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$endtag = '}}}';
$text = array();
@@ -1031,7 +1082,7 @@
*
* should all work.
*/
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->match . $m->postmatch;
@@ -1054,7 +1105,7 @@
// public $_re = '<<(?!\S)';
public $_re = '<<';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->postmatch;
@@ -1082,7 +1133,7 @@
{
public $_re = '\s*\|';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = "|" . $m->postmatch;
@@ -1123,7 +1174,7 @@
{
public $_re = '{\|';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$pos = $input->getPos();
$pi = $m->postmatch;
@@ -1158,7 +1209,7 @@
{
public $_re = '{{';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
// If we find "}}", this is an inline template.
if (strpos($m->postmatch, "}}") !== false) {
@@ -1228,10 +1279,11 @@
$pi = str_replace("?version=", "\" rev=\"", $pi);
}
- if ($vars)
+ if ($vars) {
$pi = '<' . '?plugin Template page="' . $pi . '" ' . $vars . ' ?>';
- else
+ } else {
$pi = '<' . '?plugin Template page="' . $pi . '" ?>';
+ }
$this->_element = new Cached_PluginInvocation($pi);
return true;
}
@@ -1242,7 +1294,7 @@
public $_attr = array('class' => 'mail-style-quote');
public $_re = '>\ ?';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
//$indent = str_replace(' ', '\\ ', $m->match) . '|>$';
$indent = $this->_re;
@@ -1256,11 +1308,16 @@
public $_attr = array('style' => 'margin-left:2em');
public $_re = ':\ ?';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$indent = $this->_re;
- $this->_element = new SubBlock($input, $indent, $m->match,
- 'div', $this->_attr);
+ $this->_element = new SubBlock(
+ $input,
+ $indent,
+ $m->match,
+ 'div',
+ $this->_attr
+ );
return true;
}
}
@@ -1269,7 +1326,7 @@
{
public $_re = '-{4,}\s*$';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$input->advance();
$this->_element = new Block_HtmlElement('hr');
@@ -1281,7 +1338,7 @@
{
public $_re = '!{1,3}';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$tag = "h" . (5 - strlen($m->match));
$text = TransformInline(trim($m->postmatch));
@@ -1297,7 +1354,7 @@
{
public $_re = '={2,6}';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$tag = "h" . strlen($m->match);
// Remove spaces
@@ -1321,7 +1378,7 @@
private $_tight_bot;
private $_tight_top;
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
$this->_text = $m->match;
$input->advance();
@@ -1328,13 +1385,13 @@
return true;
}
- function _setTightness($top, $bot)
+ public function _setTightness($top, $bot)
{
$this->_tight_top = $top;
$this->_tight_bot = $bot;
}
- function merge($nextBlock)
+ public function merge($nextBlock)
{
$class = get_class($nextBlock);
if (strtolower($class) == 'block_p' and $this->_tight_bot) {
@@ -1345,7 +1402,7 @@
return false;
}
- function finish()
+ public function finish()
{
$content = TransformInline(trim($this->_text));
$p = new Block_HtmlElement('p', false, $content);
@@ -1358,7 +1415,7 @@
{
public $_re = '<(?im)(?: div|span)(?:[^>]*)?>';
- function _match(&$input, $m)
+ public function _match(&$input, $m)
{
if (substr($m->match, 1, 4) == 'span') {
$tag = 'span';
@@ -1370,25 +1427,29 @@
$pos = $input->getPos();
$pi = $content = $m->postmatch;
while (!preg_match('/^(.*)\<\/' . $tag . '\>(.*)$/i', $pi, $me)) {
- if ($pi != $content)
+ if ($pi != $content) {
$content .= "\n$pi";
+ }
if (($pi = $input->nextLine()) === false) {
$input->setPos($pos);
return false;
}
}
- if ($pi != $content)
- $content .= $me[1]; // prematch
- else
+ if ($pi != $content) {
+ $content .= $me[1];
+ } // prematch
+ else {
$content = $me[1];
+ }
$input->advance();
- if (strstr($content, "\n"))
+ if (strstr($content, "\n")) {
$content = TransformText($content);
- else
+ } else {
$content = TransformInline($content);
- if (!$argstr)
+ }
+ if (!$argstr) {
$args = false;
- else {
+ } else {
$args = array();
while (preg_match("/(\w+)=(.+)/", $argstr, $m)) {
$k = $m[1];
@@ -1401,7 +1462,9 @@
$v = $m[1];
$argstr = $m[2];
}
- if (trim($k) and trim($v)) $args[$k] = $v;
+ if (trim($k) and trim($v)) {
+ $args[$k] = $v;
+ }
}
}
$this->_element = new Block_HtmlElement($tag, $args, $content);
Modified: trunk/lib/CachedMarkup.php
===================================================================
--- trunk/lib/CachedMarkup.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/CachedMarkup.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -28,18 +28,19 @@
class CacheableMarkup extends XmlContent
{
- function __construct($content, $basepage)
+ public function __construct($content, $basepage)
{
$this->_basepage = $basepage;
$this->_buf = '';
$this->_content = array();
$this->_append($content);
- if ($this->_buf != '')
+ if ($this->_buf != '') {
$this->_content[] = $this->_buf;
+ }
unset($this->_buf);
}
- function pack()
+ public function pack()
{
// FusionForge hack
// This causes a strange bug when a comment containing
@@ -54,10 +55,11 @@
return gzcompress(serialize($this), 9);
}
- static function unpack($packed)
+ public static function unpack($packed)
{
- if (!$packed)
+ if (!$packed) {
return false;
+ }
// ZLIB format has a five bit checksum in its header.
// Let's check for sanity.
@@ -64,8 +66,7 @@
if (((ord($packed[0]) * 256 + ord($packed[1])) % 31 == 0)
and (substr($packed, 0, 2) == "\037\213")
or (substr($packed, 0, 2) == "x\332")
- ) // 120, 218
- {
+ ) { // 120, 218
// Looks like ZLIB.
$data = gzuncompress($packed);
return unserialize($data);
@@ -74,11 +75,14 @@
// Looks like a serialized object
return unserialize($packed);
}
- if (preg_match("/^\w+$/", $packed))
+ if (preg_match("/^\w+$/", $packed)) {
return $packed;
+ }
// happened with DebugBackendInfo problem also.
- trigger_error("Can't unpack bad cached markup. Probably php_zlib extension not loaded.",
- E_USER_WARNING);
+ trigger_error(
+ "Can't unpack bad cached markup. Probably php_zlib extension not loaded.",
+ E_USER_WARNING
+ );
return false;
}
@@ -86,14 +90,16 @@
*
* @return array of hashes { linkto=>pagename, relation=>pagename }
*/
- function getWikiPageLinks()
+ public function getWikiPageLinks()
{
$links = array();
foreach ($this->_content as $item) {
- if (!is_a($item, 'Cached_DynamicContent'))
+ if (!is_a($item, 'Cached_DynamicContent')) {
continue;
- if (!($item_links = $item->getWikiPageLinks($this->_basepage)))
+ }
+ if (!($item_links = $item->getWikiPageLinks($this->_basepage))) {
continue;
+ }
$links = array_merge($links, $item_links);
}
// array_unique has a bug with hashes!
@@ -109,12 +115,13 @@
* @return array
* Returns an array of hashes.
*/
- function getLinkInfo()
+ public function getLinkInfo()
{
$links = array();
foreach ($this->_content as $link) {
- if (!is_a($link, 'Cached_Link'))
+ if (!is_a($link, 'Cached_Link')) {
continue;
+ }
$info = $link->getLinkInfo($this->_basepage);
$links[$info->href] = $info;
}
@@ -121,11 +128,12 @@
return array_values($links);
}
- function _append($item)
+ public function _append($item)
{
if (is_array($item)) {
- foreach ($item as $subitem)
+ foreach ($item as $subitem) {
$this->_append($subitem);
+ }
} elseif (!is_object($item)) {
$this->_buf .= $this->_quote((string)$item);
} elseif (is_a($item, 'Cached_DynamicContent')) {
@@ -139,8 +147,9 @@
$this->_buf .= $item->emptyTag();
} else {
$this->_buf .= $item->startTag();
- foreach ($item->getContent() as $subitem)
+ foreach ($item->getContent() as $subitem) {
$this->_append($subitem);
+ }
$this->_buf .= "</$item->_tag>";
if (!$this->getDescription() and $item->getTag() == 'p') {
@@ -148,11 +157,13 @@
$this->_glean_description($item->asString());
}
}
- if (!$item->isInlineElement())
+ if (!$item->isInlineElement()) {
$this->_buf .= "\n";
+ }
} elseif (is_a($item, 'XmlContent')) {
- foreach ($item->getContent() as $item)
+ foreach ($item->getContent() as $item) {
$this->_append($item);
+ }
} elseif (method_exists($item, 'asXML')) {
$this->_buf .= $item->asXML();
} elseif (method_exists($item, 'asString')) {
@@ -162,7 +173,7 @@
}
}
- function _glean_description($text)
+ public function _glean_description($text)
{
static $two_sentences;
if (!$two_sentences) {
@@ -171,8 +182,9 @@
. "[.?!][\")]*\s*[\"(]*([[:upper:])]|$)";
}
- if (!isset($this->_description) and preg_match("/$two_sentences/sx", $text))
+ if (!isset($this->_description) and preg_match("/$two_sentences/sx", $text)) {
$this->_description = preg_replace("/\s*\n\s*/", " ", trim($text));
+ }
}
/**
@@ -190,12 +202,12 @@
*
* @return string
*/
- function getDescription()
+ public function getDescription()
{
return isset($this->_description) ? $this->_description : '';
}
- function asXML()
+ public function asXML()
{
$xml = '';
$basepage = $this->_basepage;
@@ -214,7 +226,7 @@
return $xml;
}
- function printXML()
+ public function printXML()
{
$basepage = $this->_basepage;
// _content might be changed from a plugin (CreateToc)
@@ -244,14 +256,14 @@
*/
abstract class Cached_DynamicContent
{
- function cache(&$cache)
+ public function cache(&$cache)
{
$cache[] = $this;
}
- abstract function expand($basepage, &$markup);
+ abstract public function expand($basepage, &$markup);
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
return array();
}
@@ -259,7 +271,7 @@
class XmlRpc_LinkInfo
{
- function __construct($page, $type, $href, $relation = '')
+ public function __construct($page, $type, $href, $relation = '')
{
$this->page = $page;
$this->type = $type;
@@ -274,7 +286,7 @@
public $_url;
public $_relation;
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
@@ -284,15 +296,17 @@
* This is here to support the XML-RPC listLinks method.
* (See http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=WikiRPCInterface)
*/
- function getLinkInfo($basepage)
+ public function getLinkInfo($basepage)
{
- return new XmlRpc_LinkInfo($this->_getName($basepage),
+ return new XmlRpc_LinkInfo(
+ $this->_getName($basepage),
$this->_getType(),
$this->_getURL($basepage),
- $this->_getRelation($basepage));
+ $this->_getRelation($basepage)
+ );
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return $this->_url;
}
@@ -307,18 +321,18 @@
public $_url;
public $_basepage;
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return $this->_url;
}
// TODO: fix interwiki inline links in case of static dumps
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$this->_basepage = $basepage;
@@ -335,13 +349,12 @@
class Cached_WikiLink extends Cached_Link
{
-
/**
* @param string $page
* @param string $label
* @param string $anchor
*/
- function __construct($page, $label = '', $anchor = '')
+ public function __construct($page, $label = '', $anchor = '')
{
$this->_page = $page;
/* ":DontStoreLink" */
@@ -349,28 +362,31 @@
$this->_page = substr($this->_page, 1);
$this->_nolink = true;
}
- if ($anchor)
+ if ($anchor) {
$this->_anchor = $anchor;
- if ($label and $label != $page)
+ }
+ if ($label and $label != $page) {
$this->_label = $label;
+ }
$this->_basepage = false;
}
- function _getType()
+ public function _getType()
{
return 'internal';
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
$page = new WikiPageName($this->_page, $basepage);
- if ($page->isValid())
+ if ($page->isValid()) {
return $page->name;
- else
+ } else {
return false;
+ }
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
if ($basepage == '') {
return array();
@@ -385,17 +401,17 @@
}
}
- function _getName($basepage)
+ public function _getName($basepage)
{
return $this->getPagename($basepage);
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
return WikiURL($this->getPagename($basepage));
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$this->_basepage = $basepage;
@@ -403,14 +419,18 @@
$anchor = isset($this->_anchor) ? (string)$this->_anchor : '';
$page = new WikiPageName($this->_page, $basepage, $anchor);
if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
- if ($page->isValid()) return WikiLink($page, 'auto', $label);
- else return HTML($label);
+ if ($page->isValid()) {
+ return WikiLink($page, 'auto', $label);
+ } else {
+ return HTML($label);
+ }
}
- function asXML()
+ public function asXML()
{
global $WikiTheme;
$label = isset($this->_label) ? $this->_label : false;
@@ -418,17 +438,19 @@
//TODO: need basepage for subpages like /Remove (within CreateTOC)
$page = new WikiPageName($this->_page, $this->_basepage, $anchor);
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return $label ? $label : $page->getName();
+ }
}
$link = WikiLink($page, 'auto', $label);
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_page;
}
}
@@ -435,17 +457,18 @@
class Cached_WikiLinkIfKnown extends Cached_WikiLink
{
- function __construct($moniker)
+ public function __construct($moniker)
{
$this->_page = $moniker;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
return WikiLink($this->_page, 'if_known');
}
@@ -453,18 +476,20 @@
class Cached_SpellCheck extends Cached_WikiLink
{
- function __construct($word, $suggestions)
+ public function __construct($word, $suggestions)
{
$this->_page = $word;
$this->suggestions = $suggestions;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
- return HTML::a(array('class' => 'spell-wrong',
+ return HTML::a(
+ array('class' => 'spell-wrong',
'title' => 'SpellCheck: ' . join(', ', $this->suggestions),
'name' => $this->_page),
- $this->_page);
+ $this->_page
+ );
}
}
@@ -472,30 +497,32 @@
{
public $_page;
- function __construct($url, $label)
+ public function __construct($url, $label)
{
$this->_url = $url;
- if ($label)
+ if ($label) {
$this->_label = $label;
+ }
}
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$label = isset($this->_label) ? $this->_label : false;
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (!in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $page->getName());
+ }
}
return LinkPhpwikiURL($this->_url, $label, $basepage);
}
- function asXML()
+ public function asXML()
{
$label = isset($this->_label) ? $this->_label : false;
$link = LinkPhpwikiURL($this->_url, $label);
@@ -502,10 +529,11 @@
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -526,31 +554,37 @@
public $_attribute_base;
public $_unit;
- function __construct($url, $label = false)
+ public function __construct($url, $label = false)
{
$this->_url = $url;
- if ($label && $label != $url)
+ if ($label && $label != $url) {
$this->_label = $label;
+ }
$this->_expandurl($this->_url);
}
- function isInlineElement()
+ public function isInlineElement()
{
return true;
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
- if (!isset($this->_page)) return false;
+ if (!isset($this->_page)) {
+ return false;
+ }
$page = new WikiPageName($this->_page, $basepage);
- if ($page->isValid()) return $page->name;
- else return false;
+ if ($page->isValid()) {
+ return $page->name;
+ } else {
+ return false;
+ }
}
/* Add relation to the link table.
* attributes have the _relation, but not the _page set.
*/
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
/**
* @var WikiRequest $request
@@ -575,7 +609,7 @@
}
}
- function _expandurl($url)
+ public function _expandurl($url)
{
$m = array();
if (!preg_match('/^ ([^:]+) (:[:=]) (.+) $/x', $url, $m)) {
@@ -598,7 +632,7 @@
return $m;
}
- function _expand($url, $label = false)
+ public function _expand($url, $label = false)
{
global $WikiTheme;
$m = $this->_expandurl($url);
@@ -605,51 +639,59 @@
// do not link to the attribute value, but to the attribute
$is_attribute = ($m[2] == ':=');
if ($WikiTheme->DUMP_MODE and $WikiTheme->VALID_LINKS) {
- if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS))
+ if (isset($this->_page) and !in_array($this->_page, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : ($is_attribute ? $this->_relation : $this->_page));
+ }
}
- if ($is_attribute)
+ if ($is_attribute) {
$title = isset($this->_attribute_base)
? sprintf(_("Attribute %s, base value: %s"), $this->_relation, $this->_attribute_base)
: sprintf(_("Attribute %s, value: %s"), $this->_relation, $this->_attribute);
+ }
if ($label) {
return HTML::span(
- HTML::a(array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page),
+ HTML::a(
+ array('href' => WikiURL($is_attribute ? $this->_relation : $this->_page),
'class' => "wiki " . ($is_attribute ? "attribute" : "relation"),
'title' => $is_attribute
? $title
: sprintf(_("Relation %s to page %s"), $this->_relation, $this->_page)),
- $label)
+ $label
+ )
);
} elseif ($is_attribute) {
- return HTML::span
- (
- HTML::a(array('href' => WikiURL($this->_relation),
+ return HTML::span(
+ HTML::a(
+ array('href' => WikiURL($this->_relation),
'class' => "wiki attribute",
'title' => $title),
- $url)
+ $url
+ )
);
} else {
- return HTML::span
- (
- HTML::a(array('href' => WikiURL($this->_relation),
+ return HTML::span(
+ HTML::a(
+ array('href' => WikiURL($this->_relation),
'class' => "wiki relation"),
- $this->_relation),
+ $this->_relation
+ ),
HTML::span(array('class' => 'relation-symbol'), $m[2]),
- HTML::a(array('href' => WikiURL($this->_page),
+ HTML::a(
+ array('href' => WikiURL($this->_page),
'class' => "wiki"),
- $this->_page)
+ $this->_page
+ )
);
}
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
$label = isset($this->_label) ? $this->_label : false;
return $this->_expand($this->_url, $label);
}
- function asXML()
+ public function asXML()
{
$label = isset($this->_label) ? $this->_label : false;
$link = $this->_expand($this->_url, $label);
@@ -656,10 +698,11 @@
return $link->asXML();
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -669,42 +712,44 @@
*/
class Cached_SearchHighlight extends Cached_DynamicContent
{
- function __construct($word, $engine)
+ public function __construct($word, $engine)
{
$this->_word = $word;
$this->engine = $engine;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
- return HTML::span(array('class' => 'search-term',
+ return HTML::span(
+ array('class' => 'search-term',
'title' => _("Found by ") . $this->engine),
- $this->_word);
+ $this->_word
+ );
}
}
class Cached_ExternalLink extends Cached_Link
{
-
- function __construct($url, $label = false)
+ public function __construct($url, $label = false)
{
$this->_url = $url;
- if ($label && $label != $url)
+ if ($label && $label != $url) {
$this->_label = $label;
+ }
}
- function _getType()
+ public function _getType()
{
return 'external';
}
- function _getName($basepage)
+ public function _getName($basepage)
{
$label = isset($this->_label) ? $this->_label : false;
return ($label and is_string($label)) ? $label : $this->_url;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $request;
@@ -715,16 +760,18 @@
// Ignores nofollow when the user who saved the page was authenticated.
$page = $request->getPage($basepage);
$current = $page->getCurrentRevision(false);
- if (!$current->get('author_id'))
+ if (!$current->get('author_id')) {
$link->setAttr('rel', 'nofollow');
+ }
}
return $link;
}
- function asString()
+ public function asString()
{
- if (isset($this->_label) and is_string($this->_label))
+ if (isset($this->_label) and is_string($this->_label)) {
return $this->_label;
+ }
return $this->_url;
}
}
@@ -731,17 +778,17 @@
class Cached_InterwikiLink extends Cached_ExternalLink
{
-
- function __construct($link, $label = false)
+ public function __construct($link, $label = false)
{
$this->_link = $link;
- if ($label)
+ if ($label) {
$this->_label = $label;
+ }
}
- function getPagename($basepage)
+ public function getPagename($basepage)
{
- list ($moniker, $page) = explode(":", $this->_link, 2);
+ list($moniker, $page) = explode(":", $this->_link, 2);
$page = new WikiPageName($page, $basepage);
if ($page->isValid()) {
return $page->name;
@@ -750,7 +797,7 @@
}
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
/**
* @var WikiRequest $request
@@ -757,9 +804,13 @@
*/
global $request;
- if ($basepage == '') return false;
+ if ($basepage == '') {
+ return false;
+ }
/* ":DontStoreLink" */
- if (substr($this->_link, 0, 1) == ':') return false;
+ if (substr($this->_link, 0, 1) == ':') {
+ return false;
+ }
/* store only links to valid pagenames */
$dbi = $request->getDbh();
if ($link = $this->getPagename($basepage) and $dbi->isWikiPage($link)) {
@@ -769,7 +820,7 @@
}
}
- function _getName($basepage)
+ public function _getName($basepage)
{
$label = isset($this->_label) ? $this->_label : false;
return ($label and is_string($label)) ? $label : $this->_link;
@@ -776,18 +827,18 @@
}
/* there may be internal interwiki links also */
- function _getType()
+ public function _getType()
{
return $this->getPagename(false) ? 'internal' : 'external';
}
- function _getURL($basepage)
+ public function _getURL($basepage)
{
$link = $this->expand($basepage, $this);
return $link->getAttr('href');
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
global $WikiTheme;
$intermap = getInterwikiMap();
@@ -794,16 +845,18 @@
$label = isset($this->_label) ? $this->_label : false;
//FIXME: check Upload: inlined images
if ($WikiTheme->DUMP_MODE and !empty($WikiTheme->VALID_LINKS)) {
- if (!in_array($this->_link, $WikiTheme->VALID_LINKS))
+ if (!in_array($this->_link, $WikiTheme->VALID_LINKS)) {
return HTML($label ? $label : $this->_link);
+ }
}
return $intermap->link($this->_link, $label);
}
- function asString()
+ public function asString()
{
- if (isset($this->_label))
+ if (isset($this->_label)) {
return $this->_label;
+ }
return $this->_link;
}
}
@@ -813,7 +866,7 @@
// Fixed since 1.3.8, prev. versions had no userpages in backlinks
class Cached_UserLink extends Cached_WikiLink
{
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
$label = isset($this->_label) ? $this->_label : false;
$anchor = isset($this->_anchor) ? (string)$this->_anchor : '';
@@ -833,8 +886,7 @@
*/
class Cached_PluginInvocation extends Cached_DynamicContent
{
-
- function __construct($pi)
+ public function __construct($pi)
{
$this->_pi = $pi;
$loader = $this->_getLoader();
@@ -845,12 +897,12 @@
}
}
- function isInlineElement()
+ public function isInlineElement()
{
return false;
}
- function expand($basepage, &$markup)
+ public function expand($basepage, &$markup)
{
/**
* @var WikiRequest $request
@@ -861,12 +913,12 @@
return $loader->expandPI($this->_pi, $request, $markup, $basepage);
}
- function asString()
+ public function asString()
{
return $this->_pi;
}
- function getWikiPageLinks($basepage)
+ public function getWikiPageLinks($basepage)
{
$loader = $this->_getLoader();
@@ -873,7 +925,7 @@
return $loader->getWikiPageLinks($this->_pi, $basepage);
}
- function & _getLoader()
+ public function & _getLoader()
{
static $loader = false;
Modified: trunk/lib/Captcha.php
===================================================================
--- trunk/lib/Captcha.php 2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/Captcha.php 2022-03-24 13:32:25 UTC (rev 11009)
@@ -36,7 +36,7 @@
*/
public $request;
- function __construct($meta = array(), $width = 250, $height = 80)
+ public function __construct($meta = array(), $width = 250, $height = 80)
{
/**
* @var WikiRequest $request
@@ -51,7 +51,7 @@
$this->request =& $request;
}
- function captchaword()
+ public function captchaword()
{
if (!$this->request->getSessionVar('captchaword')) {
$this->request->setSessionVar('captchaword', $this->get_word());
@@ -59,22 +59,24 @@
return $this->request->getSessionVar('captchaword');
}
- function Failed()
+ public function Failed()
{
- if ($this->request->getSessionVar('captcha_ok') == true)
+ if ($this->request->getSessionVar('captcha_ok') == true) {
return false;
+ }
if (!array_key_exists('captcha_input', $this->meta)
or ($this->request->getSessionVar('captchaword')
and ($this->request->getSessionVar('captchaword') != $this->meta['captcha_input']))
- )
+ ) {
return true;
+ }
$this->request->setSessionVar('captcha_ok', true);
return false;
}
- function getFormElements()
+ public function getFormElements()
{
$el = arr...
[truncated message content] |