uses PHP 5 constructors

This commit is contained in:
David Grudl 2015-08-15 17:04:21 +02:00 committed by Jakub Vrana
parent d1aa3542ae
commit a6ebd4a3e0
25 changed files with 36 additions and 36 deletions

View file

@ -81,7 +81,7 @@ if (isset($_GET["elastic"])) {
class Min_Result { class Min_Result {
var $num_rows, $_rows; var $num_rows, $_rows;
function Min_Result($rows) { function __construct($rows) {
$this->num_rows = count($this->_rows); $this->num_rows = count($this->_rows);
$this->_rows = $rows; $this->_rows = $rows;
reset($this->_rows); reset($this->_rows);

View file

@ -81,7 +81,7 @@ if (isset($_GET["firebird"])) {
class Min_Result { class Min_Result {
var $num_rows, $_result, $_offset = 0; var $num_rows, $_result, $_offset = 0;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
// $this->num_rows = ibase_num_rows($result); // $this->num_rows = ibase_num_rows($result);
} }

View file

@ -52,7 +52,7 @@ if (isset($_GET["mongo"])) {
class Min_Result { class Min_Result {
var $num_rows, $_rows = array(), $_offset = 0, $_charset = array(); var $num_rows, $_rows = array(), $_offset = 0, $_charset = array();
function Min_Result($result) { function __construct($result) {
foreach ($result as $item) { foreach ($result as $item) {
$row = array(); $row = array();
foreach ($item as $key => $val) { foreach ($item as $key => $val) {

View file

@ -93,7 +93,7 @@ if (isset($_GET["mssql"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 0, $_fields, $num_rows; var $_result, $_offset = 0, $_fields, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
// $this->num_rows = sqlsrv_num_rows($result); // available only in scrollable results // $this->num_rows = sqlsrv_num_rows($result); // available only in scrollable results
} }
@ -201,7 +201,7 @@ if (isset($_GET["mssql"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 0, $_fields, $num_rows; var $_result, $_offset = 0, $_fields, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
$this->num_rows = mssql_num_rows($result); $this->num_rows = mssql_num_rows($result);
} }

View file

@ -9,7 +9,7 @@ if (!defined("DRIVER")) {
class Min_DB extends MySQLi { class Min_DB extends MySQLi {
var $extension = "MySQLi"; var $extension = "MySQLi";
function Min_DB() { function __construct() {
parent::init(); parent::init();
} }
@ -181,7 +181,7 @@ if (!defined("DRIVER")) {
/** Constructor /** Constructor
* @param resource * @param resource
*/ */
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
$this->num_rows = mysql_num_rows($result); $this->num_rows = mysql_num_rows($result);
} }

View file

@ -80,7 +80,7 @@ if (isset($_GET["oracle"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 1, $num_rows; var $_result, $_offset = 1, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
} }

View file

@ -94,7 +94,7 @@ if (isset($_GET["pgsql"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 0, $num_rows; var $_result, $_offset = 0, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
$this->num_rows = pg_num_rows($result); $this->num_rows = pg_num_rows($result);
} }

View file

@ -56,7 +56,7 @@ if (isset($_GET["simpledb"])) {
class Min_Result { class Min_Result {
var $num_rows, $_rows = array(), $_offset = 0; var $num_rows, $_rows = array(), $_offset = 0;
function Min_Result($result) { function __construct($result) {
foreach ($result as $item) { foreach ($result as $item) {
$row = array(); $row = array();
if ($item->Name != '') { // SELECT COUNT(*) if ($item->Name != '') { // SELECT COUNT(*)

View file

@ -11,7 +11,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
class Min_SQLite { class Min_SQLite {
var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link; var $extension = "SQLite3", $server_info, $affected_rows, $errno, $error, $_link;
function Min_SQLite($filename) { function __construct($filename) {
$this->_link = new SQLite3($filename); $this->_link = new SQLite3($filename);
$version = $this->_link->version(); $version = $this->_link->version();
$this->server_info = $version["versionString"]; $this->server_info = $version["versionString"];
@ -55,7 +55,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 0, $num_rows; var $_result, $_offset = 0, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
} }
@ -87,7 +87,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
class Min_SQLite { class Min_SQLite {
var $extension = "SQLite", $server_info, $affected_rows, $error, $_link; var $extension = "SQLite", $server_info, $affected_rows, $error, $_link;
function Min_SQLite($filename) { function __construct($filename) {
$this->server_info = sqlite_libversion(); $this->server_info = sqlite_libversion();
$this->_link = new SQLiteDatabase($filename); $this->_link = new SQLiteDatabase($filename);
} }
@ -127,7 +127,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
class Min_Result { class Min_Result {
var $_result, $_offset = 0, $num_rows; var $_result, $_offset = 0, $num_rows;
function Min_Result($result) { function __construct($result) {
$this->_result = $result; $this->_result = $result;
if (method_exists($result, 'numRows')) { // not available in unbuffered query if (method_exists($result, 'numRows')) { // not available in unbuffered query
$this->num_rows = $result->numRows(); $this->num_rows = $result->numRows();
@ -172,7 +172,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
class Min_SQLite extends Min_PDO { class Min_SQLite extends Min_PDO {
var $extension = "PDO_SQLite"; var $extension = "PDO_SQLite";
function Min_SQLite($filename) { function __construct($filename) {
$this->dsn(DRIVER . ":$filename", "", ""); $this->dsn(DRIVER . ":$filename", "", "");
} }
} }
@ -182,13 +182,13 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
if (class_exists("Min_SQLite")) { if (class_exists("Min_SQLite")) {
class Min_DB extends Min_SQLite { class Min_DB extends Min_SQLite {
function Min_DB() { function __construct() {
$this->Min_SQLite(":memory:"); parent::__construct(":memory:");
} }
function select_db($filename) { function select_db($filename) {
if (is_readable($filename) && $this->query("ATTACH " . $this->quote(preg_match("~(^[/\\\\]|:)~", $filename) ? $filename : dirname($_SERVER["SCRIPT_FILENAME"]) . "/$filename") . " AS a")) { // is_readable - SQLite 3 if (is_readable($filename) && $this->query("ATTACH " . $this->quote(preg_match("~(^[/\\\\]|:)~", $filename) ? $filename : dirname($_SERVER["SCRIPT_FILENAME"]) . "/$filename") . " AS a")) { // is_readable - SQLite 3
$this->Min_SQLite($filename); parent::__construct($filename);
return true; return true;
} }
return false; return false;
@ -440,7 +440,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function drop_databases($databases) { function drop_databases($databases) {
global $connection; global $connection;
$connection->Min_SQLite(":memory:"); // to unlock file, doesn't work in PDO on Windows $connection->__construct(":memory:"); // to unlock file, doesn't work in PDO on Windows
foreach ($databases as $db) { foreach ($databases as $db) {
if (!@unlink($db)) { if (!@unlink($db)) {
$connection->error = lang('File exists.'); $connection->error = lang('File exists.');
@ -455,7 +455,7 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
if (!check_sqlite_name($name)) { if (!check_sqlite_name($name)) {
return false; return false;
} }
$connection->Min_SQLite(":memory:"); $connection->__construct(":memory:");
$connection->error = lang('File exists.'); $connection->error = lang('File exists.');
return @rename(DB, $name); return @rename(DB, $name);
} }

View file

@ -6,7 +6,7 @@
/** Create object for performing database operations /** Create object for performing database operations
* @param Min_DB * @param Min_DB
*/ */
function Min_SQL($connection) { function __construct($connection) {
$this->_conn = $connection; $this->_conn = $connection;
} }

View file

@ -4,7 +4,7 @@ class TmpFile {
var $handler; var $handler;
var $size; var $size;
function TmpFile() { function __construct() {
$this->handler = tmpfile(); $this->handler = tmpfile();
} }

View file

@ -12,7 +12,7 @@ class AdminerDatabaseHide {
/** /**
* @param array case insensitive database names in values * @param array case insensitive database names in values
*/ */
function AdminerDatabaseHide($disabled) { function __construct($disabled) {
$this->disabled = array_map('strtolower', $disabled); $this->disabled = array_map('strtolower', $disabled);
} }

View file

@ -16,7 +16,7 @@ class AdminerEditCalendar {
* @param string text to append before first calendar usage * @param string text to append before first calendar usage
* @param string path to language file, %s stands for language code * @param string path to language file, %s stands for language code
*/ */
function AdminerEditCalendar($prepend = "<script type='text/javascript' src='jquery-ui/jquery.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n", $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") { function __construct($prepend = "<script type='text/javascript' src='jquery-ui/jquery.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui.js'></script>\n<script type='text/javascript' src='jquery-ui/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' type='text/css' href='jquery-ui/jquery-ui.css'>\n", $langPath = "jquery-ui/i18n/jquery.ui.datepicker-%s.js") {
$this->prepend = $prepend; $this->prepend = $prepend;
$this->langPath = $langPath; $this->langPath = $langPath;
} }

View file

@ -9,7 +9,7 @@
class AdminerEditForeign { class AdminerEditForeign {
var $_limit; var $_limit;
function AdminerEditForeign($limit = 0) { function __construct($limit = 0) {
$this->_limit = $limit; $this->_limit = $limit;
} }

View file

@ -17,7 +17,7 @@ class AdminerEmailTable {
* @param string quoted column name * @param string quoted column name
* @param string quoted column name * @param string quoted column name
*/ */
function AdminerEmailTable($table = "email", $id = "id", $title = "subject", $subject = "subject", $message = "message") { function __construct($table = "email", $id = "id", $title = "subject", $subject = "subject", $message = "message") {
$this->table = $table; $this->table = $table;
$this->id = $id; $this->id = $id;
$this->title = $title; $this->title = $title;

View file

@ -16,7 +16,7 @@ class AdminerFileUpload {
* @param string prefix for displaying data, null stands for $uploadPath * @param string prefix for displaying data, null stands for $uploadPath
* @param string regular expression with allowed file extensions * @param string regular expression with allowed file extensions
*/ */
function AdminerFileUpload($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") { function __construct($uploadPath = "../static/data/", $displayPath = null, $extensions = "[a-zA-Z0-9]+") {
$this->uploadPath = $uploadPath; $this->uploadPath = $uploadPath;
$this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath); $this->displayPath = ($displayPath !== null ? $displayPath : $uploadPath);
$this->extensions = $extensions; $this->extensions = $extensions;

View file

@ -13,7 +13,7 @@ class AdminerFrames {
/** /**
* @param bool allow running from the same origin only * @param bool allow running from the same origin only
*/ */
function AdminerFrames($sameOrigin = false) { function __construct($sameOrigin = false) {
$this->sameOrigin = $sameOrigin; $this->sameOrigin = $sameOrigin;
} }

View file

@ -14,7 +14,7 @@ class AdminerLoginServers {
* @param array array($domain) or array($domain => $description) or array($category => array()) * @param array array($domain) or array($domain => $description) or array($category => array())
* @param string * @param string
*/ */
function AdminerLoginServers($servers, $driver = "server") { function __construct($servers, $driver = "server") {
$this->servers = $servers; $this->servers = $servers;
$this->driver = $driver; $this->driver = $driver;
} }

View file

@ -22,7 +22,7 @@ class AdminerLoginTable {
/** Set database of login table /** Set database of login table
* @param string * @param string
*/ */
function AdminerLoginTable($database) { function __construct($database) {
$this->database = $database; $this->database = $database;
} }

View file

@ -12,7 +12,7 @@ class AdminerMasterSlave {
/** /**
* @param array ($slave => $master) * @param array ($slave => $master)
*/ */
function AdminerMasterSlave($masters) { function __construct($masters) {
$this->masters = $masters; $this->masters = $masters;
} }

View file

@ -20,7 +20,7 @@ class AdminerPlugin extends Adminer {
/** Register plugins /** Register plugins
* @param array object instances or null to register all classes starting by 'Adminer' * @param array object instances or null to register all classes starting by 'Adminer'
*/ */
function AdminerPlugin($plugins) { function __construct($plugins) {
if ($plugins === null) { if ($plugins === null) {
$plugins = array(); $plugins = array();
foreach (get_declared_classes() as $class) { foreach (get_declared_classes() as $class) {

View file

@ -14,7 +14,7 @@ class AdminerSlugify {
* @param string find these characters ... * @param string find these characters ...
* @param string ... and replace them by these * @param string ... and replace them by these
*/ */
function AdminerSlugify($from = 'áčďéěíňóřšťúůýž', $to = 'acdeeinorstuuyz') { function __construct($from = 'áčďéěíňóřšťúůýž', $to = 'acdeeinorstuuyz') {
$this->from = $from; $this->from = $from;
$this->to = $to; $this->to = $to;
} }

View file

@ -13,7 +13,7 @@ class AdminerSqlLog {
/** /**
* @param string defaults to "$database.sql" * @param string defaults to "$database.sql"
*/ */
function AdminerSqlLog($filename = "") { function __construct($filename = "") {
$this->filename = $filename; $this->filename = $filename;
} }

View file

@ -14,7 +14,7 @@ class AdminerTinymce {
/** /**
* @param string * @param string
*/ */
function AdminerTinymce($path = "tiny_mce/tiny_mce.js") { function __construct($path = "tiny_mce/tiny_mce.js") {
$this->path = $path; $this->path = $path;
} }

View file

@ -15,7 +15,7 @@ class AdminerWymeditor {
* @param array * @param array
* @param string in format "skin: 'custom', preInit: function () { }" * @param string in format "skin: 'custom', preInit: function () { }"
*/ */
function AdminerWymeditor($scripts = array("jquery/jquery.js", "wymeditor/jquery.wymeditor.min.js"), $options = "") { function __construct($scripts = array("jquery/jquery.js", "wymeditor/jquery.wymeditor.min.js"), $options = "") {
$this->scripts = $scripts; $this->scripts = $scripts;
$this->options = $options; $this->options = $options;
} }