MDL-51784 general: Adding missing php4 style constructors
authorDavid Monllao <davidm@moodle.com>
Fri, 11 Dec 2015 05:52:17 +0000 (13:52 +0800)
committerDavid Monllao <davidm@moodle.com>
Fri, 11 Dec 2015 06:02:42 +0000 (14:02 +0800)
Adding them to warn people calling the php4 constructor.

18 files changed:
backup/cc/cc_lib/gral_lib/cssparser.php
filter/tex/latex.php
grade/export/lib.php
grade/lib.php
lib/adminlib.php
lib/componentlib.class.php
lib/editor/tinymce/plugins/spellchecker/classes/SpellChecker.php
lib/editor/tinymce/plugins/spellchecker/classes/utils/JSON.php
lib/editor/tinymce/plugins/spellchecker/classes/utils/Logger.php
lib/environmentlib.php
lib/evalmath/evalmath.class.php
lib/evalmath/readme_moodle.txt
lib/graphlib.php
lib/lexer.php
lib/mathslib.php
lib/searchlib.php
mod/wiki/diff/difflib.php
question/category_class.php

index 2092268..fc2e304 100644 (file)
@@ -25,6 +25,16 @@ class cssparser {
     $this->Clear();
   }
 
+  /**
+   * Old syntax of class constructor. Deprecated in PHP7.
+   *
+   * @deprecated since Moodle 3.1
+   */
+  public function cssparser($html = true) {
+      debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+      self::__construct($html);
+  }
+
   function finalize() {
     unset($this->css);
   }
index c2dc1e2..7eb522e 100644 (file)
             make_temp_directory('latex');
         }
 
+        /**
+         * Old syntax of class constructor. Deprecated in PHP7.
+         *
+         * @deprecated since Moodle 3.1
+         */
+        public function latex() {
+            debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+            self::__construct();
+        }
+
         /**
          * Accessor function for support_platform field.
          * @return boolean value of supported_platform
index b008666..bf7b981 100644 (file)
@@ -630,6 +630,16 @@ class grade_export_update_buffer {
         $this->export_time = time();
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function grade_export_update_buffer() {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct();
+    }
+
     public function flush($buffersize) {
         global $CFG, $DB;
 
index 095d751..2696dca 100644 (file)
@@ -1102,6 +1102,16 @@ class grade_plugin_return {
         }
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function grade_plugin_return($params = null) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($params);
+    }
+
     /**
      * Returns return parameters as options array suitable for buttons.
      * @return array options
@@ -2049,6 +2059,16 @@ class grade_seq extends grade_structure {
         }
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function grade_seq($courseid, $category_grade_last=false, $nooutcomes=false) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($courseid, $category_grade_last, $nooutcomes);
+    }
+
     /**
      * Static recursive helper - makes the grade_item for category the last children
      *
@@ -2229,6 +2249,17 @@ class grade_tree extends grade_structure {
 
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function grade_tree($courseid, $fillers=true, $category_grade_last=false,
+                               $collapsed=null, $nooutcomes=false) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($courseid, $fillers, $category_grade_last, $collapsed, $nooutcomes);
+    }
+
     /**
      * Static recursive helper - removes items from collapsed categories
      *
index 5e98cdd..81c95d0 100644 (file)
@@ -4941,6 +4941,16 @@ class admin_setting_special_gradelimiting extends admin_setting_configcheckbox {
             get_string('unlimitedgrades_help', 'grades'), '0', '1', '0');
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function admin_setting_special_gradelimiting() {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct();
+    }
+
     /**
      * Force site regrading
      */
index d01e7c8..0d07797 100644 (file)
@@ -206,6 +206,16 @@ class component_installer {
         $this->check_requisites();
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function component_installer($sourcebase, $zippath, $zipfilename, $md5filename='', $destpath='') {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($sourcebase, $zippath, $zipfilename, $md5filename, $destpath);
+    }
+
     /**
      * This function will check if everything is properly set to begin
      * one installation. Also, it will check for required settings
index 0c2d84b..142e510 100644 (file)
@@ -17,6 +17,16 @@ class SpellChecker {
                $this->_config = $config;\r
        }\r
 \r
+    /**\r
+     * Old syntax of class constructor. Deprecated in PHP7.\r
+     *\r
+     * @deprecated since Moodle 3.1\r
+     */\r
+    public function SpellChecker(&$config) {\r
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);\r
+        self::__construct($config);\r
+    }\r
+\r
        /**\r
         * Simple loopback function everything that gets in will be send back.\r
         *\r
index 28f0d23..a2ceb81 100644 (file)
@@ -38,6 +38,16 @@ class Moxiecode_JSONReader {
                $this->_needProp = false;
        }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function Moxiecode_JSONReader($data) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($data);
+    }
+
        function getToken() {
                return $this->_token;
        }
@@ -363,6 +373,16 @@ class Moxiecode_JSON {
        public function __construct() {
        }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function Moxiecode_JSON() {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct();
+    }
+
        function decode($input) {
                $reader = new Moxiecode_JSONReader($input);
 
index c8bde24..c48fb42 100644 (file)
@@ -40,6 +40,16 @@ class Moxiecode_Logger {
                $this->_format = "[{time}] [{level}] {message}";\r
        }\r
 \r
+    /**\r
+     * Old syntax of class constructor. Deprecated in PHP7.\r
+     *\r
+     * @deprecated since Moodle 3.1\r
+     */\r
+    public function Moxiecode_Logger() {\r
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);\r
+        self::__construct();\r
+    }\r
+\r
        /**\r
         * Sets the current log level, use the MC_LOGGER constants.\r
         *\r
index efbcd1f..13de804 100644 (file)
@@ -1273,6 +1273,16 @@ class environment_results {
         $this->restrict_str='';
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function environment_results($part) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($part);
+    }
+
     /**
      * Set the status
      *
index bf27d61..af8a77d 100644 (file)
@@ -125,6 +125,16 @@ class EvalMath {
         $this->allowimplicitmultiplication = $allowimplicitmultiplication;
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function EvalMath($allowconstants = false, $allowimplicitmultiplication = false) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($allowconstants, $allowimplicitmultiplication);
+    }
+
     function e($expr) {
         return $this->evaluate($expr);
     }
index bb01ba7..e9b1a80 100644 (file)
@@ -11,9 +11,10 @@ Our changes:
 * made a function to test a string to see if it is a valid func or var name.
 * localized strings
 * added round, ceil and floor functions.
-* EvalMath::EvalMath() changed to EvalMath::__construct()
+* EvalMath::EvalMath() changed to EvalMath::__construct() and there is a new EvalMath::EvalMath
+  function to maintain backwards compatibility
 
 To see all changes diff against version 1.1, available from:
 http://www.phpclasses.org/browse/package/2695.html
 
-skodak, Tim Hunt
\ No newline at end of file
+skodak, Tim Hunt
index 555f1a6..64db34a 100644 (file)
@@ -1190,6 +1190,16 @@ class graph {
       //ImageColorTransparent($this->image, $this->colour['white']); // colour for transparency
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function graph() {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct();
+    }
+
     /**
      * Prepare label's text for GD output.
      *
index 341f54d..cca3b85 100644 (file)
             $this->_labels = array();
             $this->_regex = null;
         }
-        
+
+        /**
+         * Old syntax of class constructor. Deprecated in PHP7.
+         *
+         * @deprecated since Moodle 3.1
+         */
+        public function ParallelRegex($case) {
+            debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+            self::__construct($case);
+        }
+
         /**
          *    Adds a pattern with an optional label.
          *    @param string $pattern      Perl style regex, but ( and )
         public function __construct($start) {
             $this->_stack = array($start);
         }
-        
+
+        /**
+         * Old syntax of class constructor. Deprecated in PHP7.
+         *
+         * @deprecated since Moodle 3.1
+         */
+        public function StateStack($start) {
+            debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+            self::__construct($start);
+        }
+
         /**
          *    Accessor for current state.
          *    @return string State as string.
index 067f660..aa2e866 100644 (file)
@@ -70,6 +70,16 @@ class calc_formula {
         }
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function calc_formula($formula, $params=false) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($formula, $params);
+    }
+
     /**
      * Raplace parameters used in existing formula,
      * parameter names must contain only lowercase [a-z] letters, no other characters are allowed!
index bb17c45..1393cd4 100644 (file)
@@ -56,6 +56,16 @@ class search_token {
 
   }
 
+  /**
+   * Old syntax of class constructor. Deprecated in PHP7.
+   *
+   * @deprecated since Moodle 3.1
+   */
+  public function search_token($type, $value) {
+    debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+    self::__construct($type, $value);
+  }
+
   // Try to clean up user input to avoid potential security issues.
   // Need to think about this some more.
 
@@ -193,6 +203,17 @@ class search_lexer extends Lexer{
     $this->addExitPattern("\s","plainstring");
 
   }
+
+  /**
+   * Old syntax of class constructor. Deprecated in PHP7.
+   *
+   * @deprecated since Moodle 3.1
+   */
+  public function search_lexer(&$parser) {
+    debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+    self::__construct($parser);
+  }
+
 }
 
 
index bc6a598..7e3e965 100644 (file)
@@ -319,7 +319,17 @@ class ouwiki_line {
             }
         }
     }
-    
+
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function ouwiki_line($data, $linepos) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($data, $linepos);
+    }
+
     /**
      * @return string Normalised string representation of this line object
      */
@@ -372,6 +382,16 @@ class ouwiki_word {
         $this->word=$word;
         $this->start=$start;
     }
+
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function ouwiki_word($word, $start) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($word, $start);
+    }
 }
 
 /**
@@ -511,6 +531,16 @@ class ouwiki_changes {
         }
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function ouwiki_changes($diff, $count2) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($diff, $count2);
+    }
+
     /**
      * Find deleted lines. These are lines in file1 that
      * cannot be present even in modified form in file2
index c822a3f..1cb06af 100644 (file)
@@ -194,6 +194,16 @@ class question_category_object {
         $this->initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts);
     }
 
+    /**
+     * Old syntax of class constructor. Deprecated in PHP7.
+     *
+     * @deprecated since Moodle 3.1
+     */
+    public function question_category_object($page, $pageurl, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts) {
+        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
+        self::__construct($page, $pageurl, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts);
+    }
+
     /**
      * Initializes this classes general category-related variables
      */