SF.net SVN: phpwiki:[11009] trunk/lib

vargenau--- via phpwiki-checkins <[email protected]> Thu, 24 Mar 2022 13:32:26 +0000
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
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 = array();
         if (!$this->request->getSessionVar('captcha_ok')) {
@@ -87,27 +89,31 @@
                 'maxlength' => 256));
             $url = WikiURL("", array("action" => "captcha", "id" => time()));
             $el['CAPTCHA_IMAGE'] = HTML::img(array('src' => $url, 'alt' => 'captcha'));
-            $el['CAPTCHA_LABEL'] = HTML::label(array('for' => 'edit-captcha_input'),
-                _("Type word above:"));
+            $el['CAPTCHA_LABEL'] = HTML::label(
+                array('for' => 'edit-captcha_input'),
+                _("Type word above:")
+            );
         }
         return $el;
     }
 
-    function get_word()
+    public function get_word()
     {
-        if (defined('USE_CAPTCHA_RANDOM_WORD') and USE_CAPTCHA_RANDOM_WORD)
+        if (defined('USE_CAPTCHA_RANDOM_WORD') and USE_CAPTCHA_RANDOM_WORD) {
             return $this->get_dictionary_word();
-        else
-            return rand_ascii_readable($this->length); // lib/stdlib.php
+        } else {
+            return rand_ascii_readable($this->length);
+        } // lib/stdlib.php
     }
 
-    function get_dictionary_word()
+    public function get_dictionary_word()
     {
         // Load In the Word List
         $fp = fopen(findFile("lib/captcha/dictionary"), "r");
         $text = array();
-        while (!feof($fp))
+        while (!feof($fp)) {
             $text[] = trim(fgets($fp, 1024));
+        }
         fclose($fp);
 
         // Pick a Word
@@ -120,7 +126,7 @@
     }
 
     // Draw the Spiral
-    function spiral(&$im, $origin_x = 100, $origin_y = 100, $r = 0, $g = 0, $b = 0)
+    public function spiral(&$im, $origin_x = 100, $origin_y = 100, $r = 0, $g = 0, $b = 0)
     {
         $theta = 1;
         $thetac = 6;
@@ -142,7 +148,7 @@
         }
     }
 
-    function image($word)
+    public function image($word)
     {
         $width =& $this->width;
         $height =& $this->height;
@@ -164,16 +170,29 @@
         $angle = 0;
         for ($i = 0; $i < strlen($word); $i++) {
             $angle += rand(-5, 5);
-            if ($angle > 25) $angle = 15;
-            elseif ($angle < -25) $angle = -15;
+            if ($angle > 25) {
+                $angle = 15;
+            } elseif ($angle < -25) {
+                $angle = -15;
+            }
             $size = rand(14, 20);
             $y += rand(-10, 10);
-            if ($y < 10) $y = 11;
-            elseif ($y > $height - 10) $y = $height - 11;
+            if ($y < 10) {
+                $y = 11;
+            } elseif ($y > $height - 10) {
+                $y = $height - 11;
+            }
             $x += rand($size, $size * 2);
-            imagettftext($jpg, $size, $angle, $x, $y, $tx,
+            imagettftext(
+                $jpg,
+                $size,
+                $angle,
+                $x,
+                $y,
+                $tx,
                 realpath(findFile("lib/captcha/Vera.ttf")),
-                $word[$i]);
+                $word[$i]
+            );
         }
 
         $x = rand(0, $width + 30);
@@ -198,5 +217,4 @@
             trigger_error("missing GD bitmap support", E_USER_WARNING);
         }
     }
-
 }

Modified: trunk/lib/DbSession.php
===================================================================
--- trunk/lib/DbSession.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/DbSession.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -43,7 +43,7 @@
      * @param string $table
      * Name of SQL table containing session data.
      */
-    function __construct($dbh, $table = 'session')
+    public function __construct($dbh, $table = 'session')
     {
         // Check for existing DbSession handler
         $db_type = $dbh->getParam('dbtype');
@@ -58,22 +58,24 @@
             }
         }
         //Fixme: E_USER_WARNING ignored!
-        trigger_error(sprintf(_("Your WikiDB DB backend ā€œ%sā€ cannot be used for DbSession.") . " " .
+        trigger_error(sprintf(
+            _("Your WikiDB DB backend ā€œ%sā€ cannot be used for DbSession.") . " " .
                 _("Set USE_DB_SESSION to false."),
-            $db_type), E_USER_WARNING);
+            $db_type
+        ), E_USER_WARNING);
     }
 
-    function currentSessions()
+    public function currentSessions()
     {
         return $this->_backend->currentSessions();
     }
 
-    function query($sql)
+    public function query($sql)
     {
         return $this->_backend->query($sql);
     }
 
-    function quote($string)
+    public function quote($string)
     {
         return $string;
     }

Modified: trunk/lib/DbaDatabase.php
===================================================================
--- trunk/lib/DbaDatabase.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/DbaDatabase.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -26,10 +26,11 @@
 
 require_once 'lib/ErrorManager.php';
 
-if (isWindows())
+if (isWindows()) {
     define('DBA_DATABASE_DEFAULT_TIMEOUT', 60);
-else
+} else {
     define('DBA_DATABASE_DEFAULT_TIMEOUT', 5);
+}
 
 class DbaDatabase
 {
@@ -48,29 +49,34 @@
      * @param bool $mode
      * @param string $handler
      */
-    function __construct($filename, $mode = false, $handler = 'db4')
+    public function __construct($filename, $mode = false, $handler = 'db4')
     {
         $this->_file = $filename;
         $this->_handler = $handler;
         $this->_timeout = DBA_DATABASE_DEFAULT_TIMEOUT;
         $this->_dbh = false;
-        if (!in_array($handler, dba_handlers()))
+        if (!in_array($handler, dba_handlers())) {
             $this->_error(
                 sprintf(
                     _("The DBA handler %s is unsupported!") . "\n" .
                         _("Supported handlers are: %s"),
-                    $handler, join(",", dba_handlers())));
+                    $handler,
+                    join(",", dba_handlers())
+                )
+            );
+        }
         $this->readonly = false;
-        if ($mode)
+        if ($mode) {
             $this->open($mode);
+        }
     }
 
-    function set_timeout($timeout)
+    public function set_timeout($timeout)
     {
         $this->_timeout = $timeout;
     }
 
-    function open($mode = 'w')
+    public function open($mode = 'w')
     {
         /**
          * @var WikiRequest $request
@@ -77,8 +83,9 @@
          */
         global $request;
 
-        if ($this->_dbh)
-            return true; // already open.
+        if ($this->_dbh) {
+            return true;
+        } // already open.
 
         $watchdog = $this->_timeout;
 
@@ -101,8 +108,9 @@
             }
         }
         while (($dbh = dba_open($this->_file, $mode, $this->_handler)) < 1) {
-            if ($watchdog <= 0)
+            if ($watchdog <= 0) {
                 break;
+            }
             // "c" failed, try "w" instead.
             if ($mode == "w"
                 and file_exists($this->_file)
@@ -109,19 +117,23 @@
                     and (isWindows() or !is_writable($this->_file))
             ) {
                 // try to continue with read-only
-                if (!defined("ISREADONLY"))
+                if (!defined("ISREADONLY")) {
                     define("ISREADONLY", true);
+                }
                 $request->_dbi->readonly = true;
                 $this->readonly = true;
                 $mode = "r";
             }
-            if (substr($mode, 0, 1) == "c" and file_exists($this->_file) and !ISREADONLY)
+            if (substr($mode, 0, 1) == "c" and file_exists($this->_file) and !ISREADONLY) {
                 $mode = "w";
+            }
             // conflict: wait some random time to unlock (as with ethernet)
-            $secs = 0.5 + ((double)rand(1, 32767) / 32767);
+            $secs = 0.5 + ((float)rand(1, 32767) / 32767);
             sleep($secs);
             $watchdog -= $secs;
-            if (strlen($mode) == 2) $mode = substr($mode, 0, -1);
+            if (strlen($mode) == 2) {
+                $mode = substr($mode, 0, -1);
+            }
         }
         $ErrorManager->popErrorHandler();
 
@@ -132,8 +144,9 @@
                     . "\nmode: " . $mode
                     . "\nhandler: " . $this->_handler;
                 // try to continue with read-only
-                if (!defined("ISREADONLY"))
+                if (!defined("ISREADONLY")) {
                     define("ISREADONLY", true);
+                }
                 $request->_dbi->readonly = true;
                 $this->readonly = true;
                 if (!file_exists($this->_file)) {
@@ -148,19 +161,20 @@
         return !empty($dbh);
     }
 
-    function close()
+    public function close()
     {
-        if ($this->_dbh)
+        if ($this->_dbh) {
             dba_close($this->_dbh);
+        }
         $this->_dbh = false;
     }
 
-    function exists($key)
+    public function exists($key)
     {
         return dba_exists($key, $this->_dbh);
     }
 
-    function fetch($key)
+    public function fetch($key)
     {
         $val = dba_fetch($key, $this->_dbh);
         if ($val === false) {
@@ -169,70 +183,80 @@
         return $val;
     }
 
-    function insert($key, $val)
+    public function insert($key, $val)
     {
-        if (!dba_insert($key, $val, $this->_dbh))
+        if (!dba_insert($key, $val, $this->_dbh)) {
             $this->_error("insert($key)");
+        }
     }
 
-    function replace($key, $val)
+    public function replace($key, $val)
     {
-        if (!dba_replace($key, $val, $this->_dbh))
+        if (!dba_replace($key, $val, $this->_dbh)) {
             $this->_error("replace($key)");
+        }
     }
 
-    function firstkey()
+    public function firstkey()
     {
         return dba_firstkey($this->_dbh);
     }
 
-    function nextkey()
+    public function nextkey()
     {
         return dba_nextkey($this->_dbh);
     }
 
-    function delete($key)
+    public function delete($key)
     {
-        if ($this->readonly)
+        if ($this->readonly) {
             return;
-        if (!dba_delete($key, $this->_dbh))
+        }
+        if (!dba_delete($key, $this->_dbh)) {
             $this->_error("delete($key)");
+        }
     }
 
-    function get($key)
+    public function get($key)
     {
         return dba_fetch($key, $this->_dbh);
     }
 
-    function set($key, $val)
+    public function set($key, $val)
     {
         $dbh = &$this->_dbh;
-        if ($this->readonly)
+        if ($this->readonly) {
             return;
+        }
         if (dba_exists($key, $dbh)) {
             if ($val !== false) {
-                if (!dba_replace($key, $val, $dbh))
+                if (!dba_replace($key, $val, $dbh)) {
                     $this->_error("store[replace]($key)");
+                }
             } else {
-                if (!dba_delete($key, $dbh))
+                if (!dba_delete($key, $dbh)) {
                     $this->_error("store[delete]($key)");
+                }
             }
         } else {
-            if (!dba_insert($key, $val, $dbh))
+            if (!dba_insert($key, $val, $dbh)) {
                 $this->_error("store[insert]($key)");
+            }
         }
     }
 
-    function sync()
+    public function sync()
     {
-        if (!dba_sync($this->_dbh))
+        if (!dba_sync($this->_dbh)) {
             $this->_error("sync()");
+        }
     }
 
-    function optimize()
+    public function optimize()
     {
-        if (!dba_optimize($this->_dbh))
+        if (!dba_optimize($this->_dbh)) {
             $this->_error("optimize()");
+        }
         return 1;
     }
 
@@ -241,14 +265,15 @@
         trigger_error("$this->_file: dba error: $mes", E_USER_ERROR);
     }
 
-    function _dump()
+    public function _dump()
     {
         $dbh = &$this->_dbh;
-        for ($key = $this->firstkey(); $key; $key = $this->nextkey())
+        for ($key = $this->firstkey(); $key; $key = $this->nextkey()) {
             printf("%10s: %s\n", $key, $this->fetch($key));
+        }
     }
 
-    function _dba_open_error_handler($error)
+    public function _dba_open_error_handler($error)
     {
         $this->_dba_open_error = $error;
         return true;

Modified: trunk/lib/DbaPartition.php
===================================================================
--- trunk/lib/DbaPartition.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/DbaPartition.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -25,87 +25,89 @@
 
 class DbaPartition
 {
-    function __construct(&$dbm, $prefix)
+    public function __construct(&$dbm, $prefix)
     {
         $this->_h = &$dbm;
         $this->_p = $prefix;
     }
 
-    function open($mode = 'w')
+    public function open($mode = 'w')
     {
         $this->_h->open();
     }
 
-    function close()
+    public function close()
     {
         $this->_h->close();
     }
 
-    function firstkey()
+    public function firstkey()
     {
         $dbh = &$this->_h;
         $prefix = &$this->_p;
         $n = strlen($prefix);
         for ($key = $dbh->firstkey(); $key !== false; $key = $dbh->nextkey()) {
-            if (substr($key, 0, $n) == $prefix)
+            if (substr($key, 0, $n) == $prefix) {
                 return (string)substr($key, $n);
+            }
         }
         return false;
     }
 
-    function nextkey()
+    public function nextkey()
     {
         $dbh = &$this->_h;
         $prefix = &$this->_p;
         $n = strlen($prefix);
         for ($key = $dbh->nextkey(); $key !== false; $key = $dbh->nextkey()) {
-            if (substr($key, 0, $n) == $prefix)
+            if (substr($key, 0, $n) == $prefix) {
                 return (string)substr($key, $n);
+            }
         }
         return false;
     }
 
-    function exists($key)
+    public function exists($key)
     {
         return $this->_h->exists($this->_p . $key);
     }
 
-    function fetch($key)
+    public function fetch($key)
     {
         return $this->_h->fetch($this->_p . $key);
     }
 
-    function insert($key, $val)
+    public function insert($key, $val)
     {
         return $this->_h->insert($this->_p . $key, $val);
     }
 
-    function replace($key, $val)
+    public function replace($key, $val)
     {
         return $this->_h->replace($this->_p . $key, $val);
     }
 
-    function delete($key)
+    public function delete($key)
     {
         return $this->_h->delete($this->_p . $key);
     }
 
-    function get($key)
+    public function get($key)
     {
         return $this->_h->get($this->_p . $key);
     }
 
-    function set($key, $val)
+    public function set($key, $val)
     {
         return $this->_h->set($this->_p . $key, $val);
     }
 
-    function sync()
+    public function sync()
     {
         return $this->_h->sync();
     }
 
-    function optimize()
+    public function optimize()
     {
         return $this->_h->optimize();
     }

Modified: trunk/lib/ErrorManager.php
===================================================================
--- trunk/lib/ErrorManager.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/ErrorManager.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -24,11 +24,13 @@
  *
  */
 
-if (isset($GLOBALS['ErrorManager'])) return;
+if (isset($GLOBALS['ErrorManager'])) {
+    return;
+}
 
-define ('EM_FATAL_ERRORS', E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | ~2048 & (~E_DEPRECATED));
-define ('EM_WARNING_ERRORS', E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING | E_DEPRECATED);
-define ('EM_NOTICE_ERRORS', E_NOTICE | E_USER_NOTICE);
+define('EM_FATAL_ERRORS', E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | ~2048 & (~E_DEPRECATED));
+define('EM_WARNING_ERRORS', E_WARNING | E_CORE_WARNING | E_COMPILE_WARNING | E_USER_WARNING | E_DEPRECATED);
+define('EM_NOTICE_ERRORS', E_NOTICE | E_USER_NOTICE);
 
 /* It is recommended to leave assertions on.
    You can simply comment the two lines below to leave them on.
@@ -35,10 +37,11 @@
    Only where absolute speed is necessary you might want to turn
    them off.
 */
-if (defined('DEBUG') and DEBUG)
+if (defined('DEBUG') and DEBUG) {
     assert_options(ASSERT_ACTIVE, 1);
-else
+} else {
     assert_options(ASSERT_ACTIVE, 0);
+}
 assert_options(ASSERT_CALLBACK, 'wiki_assert_handler');
 
 function wiki_assert_handler($file, $line, $code)
@@ -59,7 +62,7 @@
     /**
      * As this is a singleton class, you should never call this.
      */
-    function __construct()
+    public function __construct()
     {
         $this->_handlers = array();
         $this->_fatal_handler = false;
@@ -91,10 +94,11 @@
     public function setPostponedErrorMask($newmask)
     {
         $this->_postpone_mask = $newmask;
-        if (function_exists('PrintXML'))
+        if (function_exists('PrintXML')) {
             PrintXML($this->_flush_errors($newmask));
-        else
+        } else {
             echo($this->_flush_errors($newmask));
+        }
     }
 
     /**
@@ -102,10 +106,11 @@
      */
     public function flushPostponedErrors()
     {
-        if (function_exists('PrintXML'))
+        if (function_exists('PrintXML')) {
             PrintXML($this->_flush_errors());
-        else
+        } else {
             echo $this->_flush_errors();
+        }
     }
 
     /**
@@ -124,13 +129,15 @@
      *
      * @return object HTML describing any queued errors (or false, if none).
      */
-    function getPostponedErrorsAsHTML()
+    public function getPostponedErrorsAsHTML()
     {
         $flushed = $this->_flush_errors();
-        if (!$flushed)
+        if (!$flushed) {
             return false;
-        if ($flushed->isEmpty())
+        }
+        if ($flushed->isEmpty()) {
             return false;
+        }
         // format it with the worst class (error, warning, notice)
         $worst_err = $flushed->_content[0];
         foreach ($flushed->_content as $err) {
@@ -138,12 +145,17 @@
                 $worst_err = $err;
             }
         }
-        if ($worst_err->isNotice())
+        if ($worst_err->isNotice()) {
             return $flushed;
+        }
         $class = $worst_err->getHtmlClass();
-        $html = HTML::div(array('class' => $class),
-            HTML::div(array('class' => 'errors'),
-                "PHP " . $worst_err->getDescription()));
+        $html = HTML::div(
+            array('class' => $class),
+            HTML::div(
+                array('class' => 'errors'),
+                "PHP " . $worst_err->getDescription()
+            )
+        );
         $html->pushContent($flushed);
         return $html;
     }
@@ -228,8 +240,10 @@
 
         if (!empty($in_handler)) {
             $msg = $error->_getDetail();
-            $msg->unshiftContent(HTML::h2(fmt("%s: error while handling error:",
-                "ErrorManager")));
+            $msg->unshiftContent(HTML::h2(fmt(
+                "%s: error while handling error:",
+                "ErrorManager"
+            )));
             $msg->printXML();
             return;
         }
@@ -243,7 +257,9 @@
         $in_handler = true;
 
         foreach ($this->_handlers as $handler) {
-            if (!$handler) continue;
+            if (!$handler) {
+                continue;
+            }
             $result = $handler->call($error);
             if (!$result) {
                 continue; // Handler did not handle error.
@@ -290,8 +306,9 @@
             if (($error->errno & $this->_postpone_mask) != 0) {
                 if (is_a($error, 'PhpErrorOnce')) {
                     $error->removeDoublettes($this->_postponed_errors);
-                    if ($error->_count < 2)
+                    if ($error->_count < 2) {
                         $this->_postponed_errors[] = $error;
+                    }
                 } else {
                     $this->_postponed_errors[] = $error;
                 }
@@ -308,7 +325,7 @@
         $in_handler = false;
     }
 
-    function warning($msg, $errno = E_USER_NOTICE)
+    public function warning($msg, $errno = E_USER_NOTICE)
     {
         $this->handleError(new PhpWikiError($errno, $msg, '?', '?'));
     }
@@ -318,8 +335,9 @@
         global $WikiTheme;
         $error->printXML();
         PrintXML($this->_flush_errors());
-        if ($this->_fatal_handler)
+        if ($this->_fatal_handler) {
             $this->_fatal_handler->call($error);
+        }
         if (!$WikiTheme->DUMP_MODE) {
             exit();
         }
@@ -328,7 +346,9 @@
     private function _flush_errors($keep_mask = 0)
     {
         $errors = &$this->_postponed_errors;
-        if (empty($errors)) return '';
+        if (empty($errors)) {
+            return '';
+        }
         $flushed = HTML();
         for ($i = 0; $i < count($errors); $i++) {
             $error =& $errors[$i];
@@ -335,8 +355,9 @@
             if (!is_object($error)) {
                 continue;
             }
-            if (($error->errno & $keep_mask) != 0)
+            if (($error->errno & $keep_mask) != 0) {
                 continue;
+            }
             unset($errors[$i]);
             $flushed->pushContent($error);
         }
@@ -343,7 +364,7 @@
         return $flushed;
     }
 
-    function _noCacheHeaders()
+    public function _noCacheHeaders()
     {
         global $request;
         static $already = false;
@@ -352,7 +373,9 @@
             $request->_validators->_tag = false;
             $request->_validators->_mtime = false;
         }
-        if ($already) return;
+        if ($already) {
+            return;
+        }
 
         // FIXME: Howto announce that to Request->cacheControl()?
         if (!headers_sent()) {
@@ -424,7 +447,7 @@
      * @param string $errfile
      * @param int $errline
      */
-    function __construct($errno, $errstr, $errfile, $errline)
+    public function __construct($errno, $errstr, $errfile, $errline)
     {
         $this->errno = $errno;
         $this->errstr = $errstr;
@@ -436,7 +459,7 @@
      * Determine whether this is a fatal error.
      * @return boolean True if this is a fatal error.
      */
-    function isFatal()
+    public function isFatal()
     {
         return ($this->errno & (2048 | EM_WARNING_ERRORS | EM_NOTICE_ERRORS)) == 0;
     }
@@ -445,7 +468,7 @@
      * Determine whether this is a warning level error.
      * @return boolean
      */
-    function isWarning()
+    public function isWarning()
     {
         return ($this->errno & EM_WARNING_ERRORS) != 0;
     }
@@ -454,12 +477,12 @@
      * Determine whether this is a notice level error.
      * @return boolean
      */
-    function isNotice()
+    public function isNotice()
     {
         return ($this->errno & EM_NOTICE_ERRORS) != 0;
     }
 
-    function getHtmlClass()
+    public function getHtmlClass()
     {
         if ($this->isNotice()) {
             return 'hint';
@@ -470,7 +493,7 @@
         }
     }
 
-    function getDescription()
+    public function getDescription()
     {
         if ($this->isNotice()) {
             return 'Notice';
@@ -485,7 +508,7 @@
      * Get a printable, HTML, message detailing this error.
      * @return object The detailed error message.
      */
-    function _getDetail()
+    public function _getDetail()
     {
         $dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR : substr(dirname(__FILE__), 0, -4);
         $dir .= '/';
@@ -492,10 +515,14 @@
         $errfile = preg_replace('|^' . preg_quote($dir, '|') . '|', '', $this->errfile);
         $lines = explode("\n", $this->errstr);
         if (DEBUG & _DEBUG_VERBOSE) {
-            $msg = sprintf("%s:%d %s[%d]: %s",
-                $errfile, $this->errline,
-                $this->getDescription(), $this->errno,
-                array_shift($lines));
+            $msg = sprintf(
+                "%s:%d %s[%d]: %s",
+                $errfile,
+                $this->errline,
+                $this->getDescription(),
+                $this->errno,
+                array_shift($lines)
+            );
         } /* elseif (! $this->isFatal()) {
           $msg = sprintf("%s:%d %s: \"%s\"",
                          $errfile, $this->errline,
@@ -502,10 +529,13 @@
                          $this->getDescription(),
                          array_shift($lines));
         }*/ else {
-            $msg = sprintf("%s:%d %s: \"%s\"",
-                $errfile, $this->errline,
+            $msg = sprintf(
+                "%s:%d %s: \"%s\"",
+                $errfile,
+                $this->errline,
                 $this->getDescription(),
-                array_shift($lines));
+                array_shift($lines)
+            );
         }
 
         $html = HTML::div(array('class' => $this->getHtmlClass()), HTML::p($msg));
@@ -513,8 +543,9 @@
         // $html = HTML::div(HTML::p($msg));
         if ($lines) {
             $list = HTML::ul();
-            foreach ($lines as $line)
+            foreach ($lines as $line) {
                 $list->pushContent(HTML::li($line));
+            }
             $html->pushContent($list);
         }
 
@@ -525,7 +556,7 @@
      * Print an HTMLified version of this error.
      * @see asXML()
      */
-    function printXML()
+    public function printXML()
     {
         PrintXML($this->_getDetail());
     }
@@ -533,7 +564,7 @@
     /**
      * Return an HTMLified version of this error.
      */
-    function asXML()
+    public function asXML()
     {
         return AsXML($this->_getDetail());
     }
@@ -541,12 +572,12 @@
     /**
      * Return a plain-text version of this error.
      */
-    function asString()
+    public function asString()
     {
         return AsString($this->_getDetail());
     }
 
-    function printSimpleTrace($bt)
+    public function printSimpleTrace($bt)
     {
         $nl = isset($_SERVER['REQUEST_METHOD']) ? "<br />" : "\n";
         echo $nl . "Traceback:" . $nl;
@@ -574,15 +605,17 @@
      * @param string $errfile
      * @param int $errline
      */
-    function __construct($errno, $errstr, $errfile, $errline)
+    public function __construct($errno, $errstr, $errfile, $errline)
     {
         parent::__construct($errno, $errstr, $errfile, $errline);
     }
 
-    function _getDetail()
+    public function _getDetail()
     {
-        return HTML::div(array('class' => $this->getHtmlClass()),
-            HTML::p($this->getDescription() . ": $this->errstr"));
+        return HTML::div(
+            array('class' => $this->getHtmlClass()),
+            HTML::p($this->getDescription() . ": $this->errstr")
+        );
     }
 }
 
@@ -594,15 +627,17 @@
  */
 class PhpErrorOnce extends PhpError
 {
-    function __construct($errno, $errstr, $errfile, $errline)
+    public function __construct($errno, $errstr, $errfile, $errline)
     {
         $this->_count = 1;
         parent::__construct($errno, $errstr, $errfile, $errline);
     }
 
-    function _sameError($error)
+    public function _sameError($error)
     {
-        if (!$error) return false;
+        if (!$error) {
+            return false;
+        }
         return ($this->errno == $error->errno and
             $this->errfile == $error->errfile and
                 $this->errline == $error->errline);
@@ -609,48 +644,60 @@
     }
 
     // count similar handlers, increase _count and remove the rest
-    function removeDoublettes(&$errors)
+    public function removeDoublettes(&$errors)
     {
         for ($i = 0; $i < count($errors); $i++) {
-            if (!isset($errors[$i])) continue;
+            if (!isset($errors[$i])) {
+                continue;
+            }
             if ($this->_sameError($errors[$i])) {
                 $errors[$i]->_count++;
                 $this->_count++;
-                if ($i) unset($errors[$i]);
+                if ($i) {
+                    unset($errors[$i]);
+                }
             }
         }
         return $this->_count;
     }
 
-    function _getDetail($count = 0)
+    public function _getDetail($count = 0)
     {
-        if (!$count) $count = $this->_count;
+        if (!$count) {
+            $count = $this->_count;
+        }
         $dir = defined('PHPWIKI_DIR') ? PHPWIKI_DIR : substr(dirname(__FILE__), 0, -4);
         $dir .= '/';
         $errfile = preg_replace('|^' . preg_quote($dir, '|') . '|', '', $this->errfile);
-        if (is_string($this->errstr))
+        if (is_string($this->errstr)) {
             $lines = explode("\n", $this->errstr);
-        elseif (is_object($this->errstr))
+        } elseif (is_object($this->errstr)) {
             $lines = array($this->errstr->asXML());
+        }
         $errtype = sprintf("%s", $this->getDescription());
         if ($this->isFatal()) {
-            $msg = sprintf("%s:%d %s: %s %s",
-                $errfile, $this->errline,
+            $msg = sprintf(
+                "%s:%d %s: %s %s",
+                $errfile,
+                $this->errline,
                 $errtype,
                 array_shift($lines),
                 $count > 1 ? sprintf(" (...repeated %d times)", $count) : ""
             );
         } else {
-            $msg = sprintf("%s: \"%s\" %s",
+            $msg = sprintf(
+                "%s: \"%s\" %s",
                 $errtype,
                 array_shift($lines),
-                $count > 1 ? sprintf(" (...repeated %d times)", $count) : "");
+                $count > 1 ? sprintf(" (...repeated %d times)", $count) : ""
+            );
         }
         $html = HTML::div(array('class' => $this->getHtmlClass()), HTML::p($msg));
         if ($lines) {
             $list = HTML::ul();
-            foreach ($lines as $line)
+            foreach ($lines as $line) {
                 $list->pushContent(HTML::li($line));
+            }
             $html->pushContent($list);
         }
 

Modified: trunk/lib/ExternalReferrer.php
===================================================================
--- trunk/lib/ExternalReferrer.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/ExternalReferrer.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -34,7 +34,9 @@
     {
         if ($referrer = $request->get('HTTP_REFERER')) {
             $home = SCRIPT_NAME; // was SERVER_URL, check sister wiki's: same host but other other script url
-            if (substr(strtolower($referrer), 0, strlen($home)) == strtolower($home)) return false;
+            if (substr(strtolower($referrer), 0, strlen($home)) == strtolower($home)) {
+                return false;
+            }
             require_once 'lib/ExternalReferrer.php';
             $se = new SearchEngines();
             return $se->parseSearchQuery($referrer);
@@ -45,7 +47,6 @@
 
 class SearchEngines
 {
-
     public $searchEngines =
         array(
             "search.sli.sympatico.ca/" => array("engine" => "Sympatico", "query1" => "query=", "query2" => "", "url" => "http://www1.sympatico.ca/"),
@@ -100,7 +101,7 @@
      * @returns array engine, engine_url, query
      * @public
      */
-    function parseSearchQuery($url)
+    public function parseSearchQuery($url)
     {
         // test local referrers
         if (DEBUG & _DEBUG_REMOTE) {
@@ -124,8 +125,9 @@
             return false;
         }
         $url = @parse_url(strtolower($url));
-        if (!empty($url["query"]))
+        if (!empty($url["query"])) {
             $url = $url["query"];
+        }
         if ($query1 and @stristr($url, $query1)) {
             $query = @explode($query1, $url);
         } elseif ($query2 and @stristr($url, $query2)) {

Modified: trunk/lib/FileFinder.php
===================================================================
--- trunk/lib/FileFinder.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/FileFinder.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -42,10 +42,11 @@
     /**
      * @param array $path A list of directories in which to search for files.
      */
-    function __construct($path = array())
+    public function __construct($path = array())
     {
-        if (!isset($this->_path) and $path === false)
+        if (!isset($this->_path) and $path === false) {
             $path = $this->_get_include_path();
+        }
         $this->_path = $path;
     }
 
@@ -59,8 +60,9 @@
     public function findFile($file, $missing_okay = false)
     {
         if ($this->_is_abs($file)) {
-            if (file_exists($file))
+            if (file_exists($file)) {
                 return $file;
+            }
         } elseif (($dir = $this->_search_path($file))) {
             return $dir . '/' . $file;
         }
@@ -78,10 +80,11 @@
         if (isWindows()) {
             $from = "\\";
             // PHP is stupid enough to use \\ instead of \
-            if (substr($path, 0, 2) != '\\\\')
+            if (substr($path, 0, 2) != '\\\\') {
                 $path = str_replace('\\\\', '\\', $path);
-            else // UNC paths
+            } else { // UNC paths
                 $path = '\\\\' . str_replace('\\\\', '\\', substr($path, 2));
+            }
             return strtr($path, $from, '/');
         } else {
             return $path;
@@ -115,8 +118,9 @@
      */
     public function _strip_last_pathchar(&$path)
     {
-        if (substr($path, -1) == '/' or substr($path, -1) == "\\")
+        if (substr($path, -1) == '/' or substr($path, -1) == "\\") {
             $path = substr($path, 0, -1);
+        }
         return $path;
     }
 
@@ -141,8 +145,9 @@
     private function _search_path($file)
     {
         foreach ($this->_path as $dir) {
-            if (@file_exists($dir . '/' . $file))
+            if (@file_exists($dir . '/' . $file)) {
                 return $dir;
+            }
         }
         return false;
     }
@@ -165,14 +170,17 @@
      */
     public function _get_include_path()
     {
-        if (defined("INCLUDE_PATH"))
+        if (defined("INCLUDE_PATH")) {
             $path = INCLUDE_PATH;
-        else {
+        } else {
             $path = @get_cfg_var('include_path'); // FIXME: report warning
-            if (empty($path)) $path = @ini_get('include_path');
+            if (empty($path)) {
+                $path = @ini_get('include_path');
+            }
         }
-        if (empty($path))
+        if (empty($path)) {
             $path = '.';
+        }
         return explode($this->_get_ini_separator(), $this->slashifyPath($path));
     }
 
@@ -232,13 +240,14 @@
      *
      * @param string $lang Locale string
      */
-    function locale_versions($lang)
+    public function locale_versions($lang)
     {
         // Try less specific versions of the locale
         $langs[] = $lang;
         foreach (array('@', '.', '_') as $sep) {
-            if (($tail = strchr($lang, $sep)))
+            if (($tail = strchr($lang, $sep))) {
                 $langs[] = substr($lang, 0, -strlen($tail));
+            }
         }
         return $langs;
     }
@@ -250,19 +259,22 @@
      */
     public static function _get_lang()
     {
-        if (!empty($GLOBALS['LANG']))
+        if (!empty($GLOBALS['LANG'])) {
             return $GLOBALS['LANG'];
+        }
 
         foreach (array('LC_ALL', 'LC_MESSAGES', 'LC_RESPONSES') as $var) {
             $lang = setlocale(constant($var), 0);
-            if (!empty($lang))
+            if (!empty($lang)) {
                 return $lang;
+            }
         }
 
         foreach (array('LC_ALL', 'LC_MESSAGES', 'LC_RESPONSES', 'LANG') as $var) {
             $lang = getenv($var);
-            if (!empty($lang))
+            if (!empty($lang)) {
                 return $lang;
+            }
         }
 
         return "C";
@@ -280,10 +292,9 @@
  * also search under various less specific variations like
  * "de_DE.iso8859-1", "de_DE" and "de".
  */
-class LocalizedFileFinder
-    extends FileFinder
+class LocalizedFileFinder extends FileFinder
 {
-    function __construct()
+    public function __construct()
     {
         $include_path = $this->_get_include_path();
         $path = array();
@@ -293,7 +304,9 @@
 
         if ($locales = $this->locale_versions($lang)) {
             foreach ($locales as $lang) {
-                if ($lang == 'C') $lang = 'en';
+                if ($lang == 'C') {
+                    $lang = 'en';
+                }
                 foreach ($include_path as $dir) {
                     $path[] = $this->slashifyPath($dir . "/locale/$lang");
                 }
@@ -314,10 +327,9 @@
  * also search under various less specific variations like
  * "de_DE.iso8859-1", "de_DE" and "de".
  */
-class LocalizedButtonFinder
-    extends FileFinder
+class LocalizedButtonFinder extends FileFinder
 {
-    function __construct()
+    public function __construct()
     {
         global $WikiTheme;
         $include_path = $this->_get_include_path();
@@ -330,7 +342,9 @@
         if (is_object($WikiTheme)) {
             $langs = $this->locale_versions($lang);
             foreach ($langs as $lang) {
-                if ($lang == 'C') $lang = 'en';
+                if ($lang == 'C') {
+                    $lang = 'en';
+                }
                 foreach ($include_path as $dir) {
                     $path[] = $this->slashifyPath($WikiTheme->file("buttons/$lang"));
                 }
@@ -353,12 +367,14 @@
         $finder->_append_to_include_path(dirname(__FILE__) . "/pear");
         $finder->_prepend_to_include_path($wikidir);
         // Don't override existing INCLUDE_PATH config.
-        if (!defined("INCLUDE_PATH"))
+        if (!defined("INCLUDE_PATH")) {
             define("INCLUDE_PATH", implode($finder->_get_ini_separator(), $finder->_path));
+        }
     }
     $s = $finder->findFile($file, $missing_okay);
-    if ($slashify)
+    if ($slashify) {
         $s = $finder->slashifyPath($s);
+    }
     return $s;
 }
 
@@ -367,8 +383,9 @@
 function findLocalizedFile($file, $missing_okay = false, $re_init = false)
 {
     static $finder;
-    if ($re_init or !isset($finder))
+    if ($re_init or !isset($finder)) {
         $finder = new LocalizedFileFinder();
+    }
     return $finder->findFile($file, $missing_okay);
 }
 
@@ -375,8 +392,9 @@
 function findLocalizedButtonFile($file, $missing_okay = false, $re_init = false)
 {
     static $buttonfinder;
-    if ($re_init or !isset($buttonfinder))
+    if ($re_init or !isset($buttonfinder)) {
         $buttonfinder = new LocalizedButtonFinder();
+    }
     return $buttonfinder->findFile($file, $missing_okay);
 }
 
@@ -396,11 +414,14 @@
         $finder = new FileFinder();
     }
     // remove "/lib" from dirname(__FILE__)
-    if ($finder->_is_abs($file))
+    if ($finder->_is_abs($file)) {
         return $finder->slashifyPath($file);
-    else {
-        if (defined("PHPWIKI_DIR")) $wikidir = PHPWIKI_DIR;
-        else $wikidir = preg_replace('/.lib$/', '', dirname(__FILE__));
+    } else {
+        if (defined("PHPWIKI_DIR")) {
+            $wikidir = PHPWIKI_DIR;
+        } else {
+            $wikidir = preg_replace('/.lib$/', '', dirname(__FILE__));
+        }
         $wikidir = $finder->_strip_last_pathchar($wikidir);
         $pathsep = '/';
         return $finder->slashifyPath($wikidir . $pathsep . $file);
@@ -419,10 +440,11 @@
     if (defined("DATA_PATH")) {
         $wikipath = DATA_PATH;
         $wikipath = $finder->_strip_last_pathchar($wikipath);
-        if (!$file)
+        if (!$file) {
             return $finder->slashifyPath($wikipath);
-        else
+        } else {
             return $finder->slashifyPath($wikipath . '/' . $file);
+        }
     } else {
         return $finder->slashifyPath($file);
     }
@@ -431,6 +453,8 @@
 function isWindows()
 {
     static $win;
-    if (isset($win)) return $win;
+    if (isset($win)) {
+        return $win;
+    }
     return (substr(PHP_OS, 0, 3) == 'WIN');
 }

Modified: trunk/lib/Google.php
===================================================================
--- trunk/lib/Google.php	2022-03-24 13:28:33 UTC (rev 11008)
+++ trunk/lib/Google.php	2022-03-24 13:32:25 UTC (rev 11009)
@@ -92,9 +92,10 @@
 class GoogleSearchResults
 {
     public $_fields = "documentFiltering,searchComments,estimatedTotalResultsCount,estimateIsExact,searchQuery,startIndex,endIndex,searchTips,directoryCategories,searchTime,resultElements";
-    public $resultElements, $results;
+    public $resultElements;
+    public $results;
 
-    function __construct($result)
+    public function __construct($result)
     {
         $this->fields = explode(',', $this->_fields);
         foreach ($this->fields as $f) {
@@ -150,7 +151,7 @@
 {
     public $_fields = "summary,URL,snippet,title,cachedSize,relatedInformationPresent,hostName,directoryCategory,directoryTitle";
 
-    function __construct($result)
+    public function __construct($result)
     {
         $this->fields = explode(',', $this->_fields);
         foreach ($this->fields as $f) {
@@ -162,22 +163,27 @@
 
 class Google
 {
-    function __construct($maxResults = 10, $license_key = false)
+    public function __construct($maxResults = 10, $license_key = false)
     {
-        if ($license_key)
+        if ($license_key) {
             $this->license_key = $license_key;
-        elseif (!defined('GOOGLE_LICENSE_KEY')) {
+        } elseif (!defined('GOOGLE_LICENSE_KEY')) {
             trigger_error("\nYou must first obtain a license key at https://www.google.com/apis/"
                 . "\nto be able to use the Google API." .
                 "\nIt's free however.", E_USER_WARNING);
             return false;
-        } else
+        } else {
             $this->license_key = GOOGLE_LICENSE_KEY;
+        }
 
         $this->soapclient = new soapclient(SERVER_URL . normalizeWebFileName("GoogleSearch.wsdl"), "wsdl");
         $this->proxy = $this->soapclient->getProxy();
-        if ($maxResults > 10) $maxResults = 10;
-        if ($maxResults < 1) $maxResults = 1;
+        if ($maxResults > 10) {
+            $maxResults = 10;
+        }
+        if ($maxResults < 1) {
+            $maxResults = 1;
+        }
         $this->maxResults = $maxResults;
         return $this;
     }
@@ -225,14 +231,24 @@
      * ignored. All requests to the APIs should be made with UTF-8
      * encoding.
      */
-    function doGoogleSearch($query, $startIndex = 1, $maxResults = 10, $filter = "false",
-                            $restrict = '', $safeSearch = 'false', $lr = '',
-                            $inputencoding = 'UTF-8', $outputencoding = 'UTF-8')
+    public function doGoogleSearch(
+        $query,
+        $startIndex = 1,
+        $maxResults = 10,
+        $filter = "false",
+        $restrict = '',
+        $safeSearch = 'false',
+        $lr = '',
+        $inputencoding = 'UTF-8',
+        $outputencoding = 'UTF-8'
+    )
     {
-        if (!$this->license_key)
+        if (!$this->license_key) {
             return false;
+        }
         // doGoogleSearch() gets created automatically!! (some eval'ed code from the soap request)
-        $result = $this->proxy->doGoogleSearch($this->license_key, // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
+        $result = $this->proxy->doGoogleSearch(
+            $this->license_key, // "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
             $query,
             $startIndex,
             $maxResults,
@@ -241,7 +257,8 @@
             $safeSearch,
             $lr,
             $inputencoding, // ignored by server, everything is UTF-8 now
-            $outputencoding);
+            $outputencoding
+        );
         return new GoogleSearchResults($result);
     }
 
@@ -260,15 +277,19 @@
      * @param string $url - full URL to the page to retrieve
      * @return string|bool full text of the cached page
      */
-    function doGetCachedPage($url)
+    public function doGetCachedPage($url)
     {
-        if (!$this->license_key)
+        if (!$this->license_key) {
             return false;
+        }
         // This method gets created automatically!! (some eval'ed code from the soap request)
-        $result = $this->proxy->doGetCachedPage($this->license_key,
-            $url);
-        if (!empty($result))
+        $result = $this->proxy->doGetCachedPage(
+            $this->license_key,
+            $url
+        );
+        if (!empty($result)) {
             return base64_decode($result);
+        }
         return false;
     }
 
@@ -278,12 +299,15 @@
      * @param  string $phrase   word or phrase to spell-check
      * @return string text of any suggested replacement, or None
      */
-    function doSpellingSuggestion($phrase)
+    public function doSpellingSuggestion($phrase)
     {
-        if (!$this->license_key)
+        if (!$this->license_key) {
             return false;
+        }
         // This method gets created automatically!! (some eval'ed code from the soap request)
-        return $this->proxy->doSpellingSuggestion($this->license_key,

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
phpwiki-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-checkins