summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2015-05-15 19:03:34 +0200
committerChristopher Smith <chris@jalakai.co.uk>2015-05-15 19:03:34 +0200
commit26e22ab837dcabe137a0912fcd2f96d0c35f48c8 (patch)
tree656deee59b1c046f4ac1cebb4ed2bf7d82d72d48 /inc
parent11aaacbee50790c2d5a2c10e97307da213d6320d (diff)
downloadrpg-26e22ab837dcabe137a0912fcd2f96d0c35f48c8.tar.gz
rpg-26e22ab837dcabe137a0912fcd2f96d0c35f48c8.tar.bz2
Changes for PHP 7 Compatibility
- replace PHP4 style class constructor function names (based on class name) with php 5 __construct() Also remove some '&' reference operators used with objects And add some object type hints
Diffstat (limited to 'inc')
-rw-r--r--inc/IXR_Library.php20
-rw-r--r--inc/events.php4
-rw-r--r--inc/form.php2
-rw-r--r--inc/parser/handler.php48
-rw-r--r--inc/parser/lexer.php6
-rw-r--r--inc/parser/parser.php20
6 files changed, 53 insertions, 47 deletions
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php
index 839298680..301a8d9e1 100644
--- a/inc/IXR_Library.php
+++ b/inc/IXR_Library.php
@@ -52,7 +52,7 @@ class IXR_Value {
* @param mixed $data
* @param bool $type
*/
- function IXR_Value($data, $type = false) {
+ function __construct($data, $type = false) {
$this->data = $data;
if(!$type) {
$type = $this->calculateType();
@@ -201,7 +201,7 @@ class IXR_Message {
/**
* @param string $message
*/
- function IXR_Message($message) {
+ function __construct($message) {
$this->message =& $message;
}
@@ -388,7 +388,7 @@ class IXR_Server {
* @param bool $data
* @param bool $wait
*/
- function IXR_Server($callbacks = false, $data = false, $wait = false) {
+ function __construct($callbacks = false, $data = false, $wait = false) {
$this->setCapabilities();
if($callbacks) {
$this->callbacks = $callbacks;
@@ -621,7 +621,7 @@ class IXR_Request {
* @param string $method
* @param array $args
*/
- function IXR_Request($method, $args) {
+ function __construct($method, $args) {
$this->method = $method;
$this->args = $args;
$this->xml = <<<EOD
@@ -684,7 +684,7 @@ class IXR_Client extends DokuHTTPClient {
* @param int $port
* @param int $timeout
*/
- function IXR_Client($server, $path = false, $port = 80, $timeout = 15) {
+ function __construct($server, $path = false, $port = 80, $timeout = 15) {
parent::__construct();
if(!$path) {
// Assume we have been given a URL instead
@@ -779,7 +779,7 @@ class IXR_Error {
* @param int $code
* @param string $message
*/
- function IXR_Error($code, $message) {
+ function __construct($code, $message) {
$this->code = $code;
$this->message = htmlspecialchars($message);
}
@@ -829,7 +829,7 @@ class IXR_Date {
/**
* @param int|string $time
*/
- function IXR_Date($time) {
+ function __construct($time) {
// $time can be a PHP timestamp or an ISO one
if(is_numeric($time)) {
$this->parseTimestamp($time);
@@ -899,7 +899,7 @@ class IXR_Base64 {
/**
* @param string $data
*/
- function IXR_Base64($data) {
+ function __construct($data) {
$this->data = $data;
}
@@ -923,7 +923,7 @@ class IXR_IntrospectionServer extends IXR_Server {
/** @var string[] */
var $help;
- function IXR_IntrospectionServer() {
+ function __construct() {
$this->setCallbacks();
$this->setCapabilities();
$this->capabilities['introspection'] = array(
@@ -1106,7 +1106,7 @@ class IXR_ClientMulticall extends IXR_Client {
* @param string|bool $path
* @param int $port
*/
- function IXR_ClientMulticall($server, $path = false, $port = 80) {
+ function __construct($server, $path = false, $port = 80) {
parent::IXR_Client($server, $path, $port);
//$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
}
diff --git a/inc/events.php b/inc/events.php
index 256fb561e..35d55d0e3 100644
--- a/inc/events.php
+++ b/inc/events.php
@@ -31,7 +31,7 @@ class Doku_Event {
* @param string $name
* @param mixed $data
*/
- function Doku_Event($name, &$data) {
+ function __construct($name, &$data) {
$this->name = $name;
$this->data =& $data;
@@ -153,7 +153,7 @@ class Doku_Event_Handler {
* constructor, loads all action plugins and calls their register() method giving them
* an opportunity to register any hooks they require
*/
- function Doku_Event_Handler() {
+ function __construct() {
// load action plugins
/** @var DokuWiki_Action_Plugin $plugin */
diff --git a/inc/form.php b/inc/form.php
index 00eea9b3a..748983281 100644
--- a/inc/form.php
+++ b/inc/form.php
@@ -55,7 +55,7 @@ class Doku_Form {
*
* @author Tom N Harris <tnharris@whoopdedo.org>
*/
- function Doku_Form($params, $action=false, $method=false, $enctype=false) {
+ function __construct($params, $action=false, $method=false, $enctype=false) {
if(!is_array($params)) {
$this->params = array('id' => $params);
if ($action !== false) $this->params['action'] = $action;
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index b8e2de82a..815ac39c5 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -17,7 +17,7 @@ class Doku_Handler {
var $rewriteBlocks = true;
- function Doku_Handler() {
+ function __construct() {
$this->CallWriter = new Doku_Handler_CallWriter($this);
}
@@ -295,7 +295,7 @@ class Doku_Handler {
switch ( $state ) {
case DOKU_LEXER_ENTER:
$ReWriter = new Doku_Handler_Preformatted($this->CallWriter);
- $this->CallWriter = & $ReWriter;
+ $this->CallWriter = $ReWriter;
$this->_addCall('preformatted_start',array(), $pos);
break;
case DOKU_LEXER_EXIT:
@@ -715,15 +715,21 @@ function Doku_Handler_Parse_Media($match) {
}
//------------------------------------------------------------------------
-class Doku_Handler_CallWriter {
+interface Doku_Handler_CallWriter_Interface {
+ public function writeCall($call);
+ public function writeCalls($calls);
+ public function finalise();
+}
+
+class Doku_Handler_CallWriter implements Doku_Handler_CallWriter_Interface {
var $Handler;
/**
* @param Doku_Handler $Handler
*/
- function Doku_Handler_CallWriter(& $Handler) {
- $this->Handler = & $Handler;
+ function __construct(Doku_Handler $Handler) {
+ $this->Handler = $Handler;
}
function writeCall($call) {
@@ -748,7 +754,7 @@ class Doku_Handler_CallWriter {
*
* @author Chris Smith <chris@jalakai.co.uk>
*/
-class Doku_Handler_Nest {
+class Doku_Handler_Nest implements Doku_Handler_CallWriter_Interface {
var $CallWriter;
var $calls = array();
@@ -762,8 +768,8 @@ class Doku_Handler_Nest {
* @param string $close closing instruction name, this is required to properly terminate the
* syntax mode if the document ends without a closing pattern
*/
- function Doku_Handler_Nest(& $CallWriter, $close="nest_close") {
- $this->CallWriter = & $CallWriter;
+ function __construct(Doku_Handler_CallWriter_Interface $CallWriter, $close="nest_close") {
+ $this->CallWriter = $CallWriter;
$this->closingInstruction = $close;
}
@@ -808,7 +814,7 @@ class Doku_Handler_Nest {
}
}
-class Doku_Handler_List {
+class Doku_Handler_List implements Doku_Handler_CallWriter_Interface {
var $CallWriter;
@@ -818,8 +824,8 @@ class Doku_Handler_List {
const NODE = 1;
- function Doku_Handler_List(& $CallWriter) {
- $this->CallWriter = & $CallWriter;
+ function __construct(Doku_Handler_CallWriter_Interface $CallWriter) {
+ $this->CallWriter = $CallWriter;
}
function writeCall($call) {
@@ -1018,7 +1024,7 @@ class Doku_Handler_List {
}
//------------------------------------------------------------------------
-class Doku_Handler_Preformatted {
+class Doku_Handler_Preformatted implements Doku_Handler_CallWriter_Interface {
var $CallWriter;
@@ -1028,8 +1034,8 @@ class Doku_Handler_Preformatted {
- function Doku_Handler_Preformatted(& $CallWriter) {
- $this->CallWriter = & $CallWriter;
+ function __construct(Doku_Handler_CallWriter_Interface $CallWriter) {
+ $this->CallWriter = $CallWriter;
}
function writeCall($call) {
@@ -1078,7 +1084,7 @@ class Doku_Handler_Preformatted {
}
//------------------------------------------------------------------------
-class Doku_Handler_Quote {
+class Doku_Handler_Quote implements Doku_Handler_CallWriter_Interface {
var $CallWriter;
@@ -1086,8 +1092,8 @@ class Doku_Handler_Quote {
var $quoteCalls = array();
- function Doku_Handler_Quote(& $CallWriter) {
- $this->CallWriter = & $CallWriter;
+ function __construct(Doku_Handler_CallWriter_Interface $CallWriter) {
+ $this->CallWriter = $CallWriter;
}
function writeCall($call) {
@@ -1170,7 +1176,7 @@ class Doku_Handler_Quote {
}
//------------------------------------------------------------------------
-class Doku_Handler_Table {
+class Doku_Handler_Table implements Doku_Handler_CallWriter_Interface {
var $CallWriter;
@@ -1185,8 +1191,8 @@ class Doku_Handler_Table {
var $currentRow = array('tableheader' => 0, 'tablecell' => 0);
var $countTableHeadRows = 0;
- function Doku_Handler_Table(& $CallWriter) {
- $this->CallWriter = & $CallWriter;
+ function __construct(Doku_Handler_CallWriter_Interface $CallWriter) {
+ $this->CallWriter = $CallWriter;
}
function writeCall($call) {
@@ -1551,7 +1557,7 @@ class Doku_Handler_Block {
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function Doku_Handler_Block(){
+ function __construct(){
global $DOKU_PLUGINS;
//check if syntax plugins were loaded
if(empty($DOKU_PLUGINS['syntax'])) return;
diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php
index b46a5f505..5afcc520a 100644
--- a/inc/parser/lexer.php
+++ b/inc/parser/lexer.php
@@ -46,7 +46,7 @@ class Doku_LexerParallelRegex {
* for insensitive.
* @access public
*/
- function Doku_LexerParallelRegex($case) {
+ function __construct($case) {
$this->_case = $case;
$this->_patterns = array();
$this->_labels = array();
@@ -232,7 +232,7 @@ class Doku_LexerStateStack {
* @param string $start Starting state name.
* @access public
*/
- function Doku_LexerStateStack($start) {
+ function __construct($start) {
$this->_stack = array($start);
}
@@ -296,7 +296,7 @@ class Doku_Lexer {
* @param boolean $case True for case sensitive.
* @access public
*/
- function Doku_Lexer(&$parser, $start = "accept", $case = false) {
+ function __construct(&$parser, $start = "accept", $case = false) {
$this->_case = $case;
/** @var Doku_LexerParallelRegex[] _regexes */
$this->_regexes = array();
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 5f86cf5c4..65510071e 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -226,7 +226,7 @@ class Doku_Parser_Mode_Plugin extends DokuWiki_Plugin implements Doku_Parser_Mod
//-------------------------------------------------------------------
class Doku_Parser_Mode_base extends Doku_Parser_Mode {
- function Doku_Parser_Mode_base() {
+ function __construct() {
global $PARSER_MODES;
$this->allowedModes = array_merge (
@@ -248,7 +248,7 @@ class Doku_Parser_Mode_base extends Doku_Parser_Mode {
//-------------------------------------------------------------------
class Doku_Parser_Mode_footnote extends Doku_Parser_Mode {
- function Doku_Parser_Mode_footnote() {
+ function __construct() {
global $PARSER_MODES;
$this->allowedModes = array_merge (
@@ -416,7 +416,7 @@ class Doku_Parser_Mode_formatting extends Doku_Parser_Mode {
/**
* @param string $type
*/
- function Doku_Parser_Mode_formatting($type) {
+ function __construct($type) {
global $PARSER_MODES;
if ( !array_key_exists($type, $this->formatting) ) {
@@ -470,7 +470,7 @@ class Doku_Parser_Mode_formatting extends Doku_Parser_Mode {
//-------------------------------------------------------------------
class Doku_Parser_Mode_listblock extends Doku_Parser_Mode {
- function Doku_Parser_Mode_listblock() {
+ function __construct() {
global $PARSER_MODES;
$this->allowedModes = array_merge (
@@ -504,7 +504,7 @@ class Doku_Parser_Mode_listblock extends Doku_Parser_Mode {
//-------------------------------------------------------------------
class Doku_Parser_Mode_table extends Doku_Parser_Mode {
- function Doku_Parser_Mode_table() {
+ function __construct() {
global $PARSER_MODES;
$this->allowedModes = array_merge (
@@ -648,7 +648,7 @@ class Doku_Parser_Mode_file extends Doku_Parser_Mode {
//-------------------------------------------------------------------
class Doku_Parser_Mode_quote extends Doku_Parser_Mode {
- function Doku_Parser_Mode_quote() {
+ function __construct() {
global $PARSER_MODES;
$this->allowedModes = array_merge (
@@ -682,7 +682,7 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode {
var $acronyms = array();
var $pattern = '';
- function Doku_Parser_Mode_acronym($acronyms) {
+ function __construct($acronyms) {
usort($acronyms,array($this,'_compare'));
$this->acronyms = $acronyms;
}
@@ -729,7 +729,7 @@ class Doku_Parser_Mode_smiley extends Doku_Parser_Mode {
var $smileys = array();
var $pattern = '';
- function Doku_Parser_Mode_smiley($smileys) {
+ function __construct($smileys) {
$this->smileys = $smileys;
}
@@ -762,7 +762,7 @@ class Doku_Parser_Mode_wordblock extends Doku_Parser_Mode {
var $badwords = array();
var $pattern = '';
- function Doku_Parser_Mode_wordblock($badwords) {
+ function __construct($badwords) {
$this->badwords = $badwords;
}
@@ -797,7 +797,7 @@ class Doku_Parser_Mode_entity extends Doku_Parser_Mode {
var $entities = array();
var $pattern = '';
- function Doku_Parser_Mode_entity($entities) {
+ function __construct($entities) {
$this->entities = $entities;
}