Skip to content
Snippets Groups Projects
Commit 26e22ab8 authored by Christopher Smith's avatar Christopher Smith
Browse files

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
parent 11aaacbe
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,7 @@ class TestOfLexerStateStack extends DokuWikiTest {
}
class TestParser {
function TestParser() {
function __construct() {
}
function accept() {
}
......@@ -364,7 +364,7 @@ class TestOfLexerHandlers extends DokuWikiTest {
class TestParserByteIndex {
function TestParserByteIndex() {}
function __construct() {}
function ignore() {}
......
......@@ -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)';
}
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -37,7 +37,7 @@ if (!class_exists('configuration')) {
*
* @param string $datafile path to config metadata file
*/
public function configuration($datafile) {
public function __construct($datafile) {
global $conf, $config_cascade;
if (!file_exists($datafile)) {
......@@ -434,7 +434,7 @@ if (!class_exists('setting')) {
* @param string $key
* @param array|null $params array with metadata of setting
*/
public function setting($key, $params=null) {
public function __construct($key, $params=null) {
$this->_key = $key;
if (is_array($params)) {
......
......@@ -20,7 +20,7 @@ if (!class_exists('setting_sepchar')) {
for ($i=0;$i<strlen($str);$i++) $this->_choices[] = $str{$i};
// call foundation class constructor
$this->setting($key,$param);
parent::__construct($key,$param);
}
}
}
......
......@@ -15,7 +15,7 @@ class action_plugin_popularity extends Dokuwiki_Action_Plugin {
*/
var $helper;
function action_plugin_popularity(){
function __construct(){
$this->helper = $this->loadHelper('popularity', false);
}
......
......@@ -20,7 +20,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin {
var $helper;
var $sentStatus = null;
function admin_plugin_popularity(){
function __construct(){
$this->helper = $this->loadHelper('popularity', false);
}
......
......@@ -30,7 +30,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin {
var $popularityLastSubmitFile;
function helper_plugin_popularity(){
function __construct(){
global $conf;
$this->autosubmitFile = $conf['cachedir'].'/autosubmit.txt';
$this->autosubmitErrorFile = $conf['cachedir'].'/autosubmitError.txt';
......
......@@ -36,7 +36,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
/**
* Constructor
*/
public function admin_plugin_usermanager(){
public function __construct(){
/** @var DokuWiki_Auth_Plugin $auth */
global $auth;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment