aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason <jasonmm.github@gmail.com>2022-06-21 18:18:32 -0500
committerJason <jasonmm.github@gmail.com>2022-06-21 18:18:37 -0500
commitb43300fbcf92008ac1adc87c4b03776a9a4fb4e8 (patch)
tree21978beea7c1c044bb24bdc11f1cdc12393e2f3a
parent856e975127fff8f82b14f2886bb4ffb239541555 (diff)
downloadsemanticscuttle-b43300fbcf92008ac1adc87c4b03776a9a4fb4e8.tar.gz
semanticscuttle-b43300fbcf92008ac1adc87c4b03776a9a4fb4e8.tar.bz2
Use Rector to upgrade constructors.
Modern PHP versions do not recognize methods with the same name as the class as being constructors. This commit upgrades the code so that constructors are named `__construct`. The upgrade was done automatically using Rector.
-rw-r--r--src/SemanticScuttle/db/db2.php4
-rw-r--r--src/SemanticScuttle/db/mssql-odbc.php6
-rw-r--r--src/SemanticScuttle/db/mssql.php8
-rw-r--r--src/SemanticScuttle/db/mysql.php12
-rw-r--r--src/SemanticScuttle/db/mysql4.php12
-rw-r--r--src/SemanticScuttle/db/mysqli.php14
-rw-r--r--src/SemanticScuttle/db/oracle.php4
-rw-r--r--src/SemanticScuttle/db/postgres.php10
-rw-r--r--src/SemanticScuttle/db/sqlite.php4
-rw-r--r--src/php-gettext/gettext.php2
-rw-r--r--src/php-gettext/streams.php9
11 files changed, 42 insertions, 43 deletions
diff --git a/src/SemanticScuttle/db/db2.php b/src/SemanticScuttle/db/db2.php
index b1abf1a..117ecae 100644
--- a/src/SemanticScuttle/db/db2.php
+++ b/src/SemanticScuttle/db/db2.php
@@ -36,7 +36,7 @@ class sql_db
//
// Constructor
//
- function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
+ function __construct($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -414,4 +414,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/mssql-odbc.php b/src/SemanticScuttle/db/mssql-odbc.php
index a2d3d02..f8b7db3 100644
--- a/src/SemanticScuttle/db/mssql-odbc.php
+++ b/src/SemanticScuttle/db/mssql-odbc.php
@@ -184,7 +184,7 @@ class sql_db
function _odbc_execute_query($query)
{
$result = false;
-
+
if (eregi("^SELECT ", $query))
{
$result = @odbc_exec($this->db_connect_id, $query);
@@ -459,7 +459,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -573,4 +573,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/mssql.php b/src/SemanticScuttle/db/mssql.php
index 2b17b9e..8358d27 100644
--- a/src/SemanticScuttle/db/mssql.php
+++ b/src/SemanticScuttle/db/mssql.php
@@ -134,7 +134,7 @@ class sql_db
if (!$this->query_result)
{
$this->num_queries++;
-
+
if (($this->query_result = @mssql_query($query, $this->db_connect_id)) === false)
{
$this->sql_error($query);
@@ -285,7 +285,7 @@ class sql_db
}
$row = @mssql_fetch_array($query_id, MSSQL_ASSOC);
-
+
if ($row)
{
foreach ($row as $key => $value)
@@ -431,7 +431,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -548,4 +548,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/mysql.php b/src/SemanticScuttle/db/mysql.php
index a646e0d..88b59d8 100644
--- a/src/SemanticScuttle/db/mysql.php
+++ b/src/SemanticScuttle/db/mysql.php
@@ -94,7 +94,7 @@ class sql_db
case 'commit':
$result = @mysql_query('COMMIT', $this->db_connect_id);
$this->transaction = false;
-
+
if (!$result)
{
@mysql_query('ROLLBACK', $this->db_connect_id);
@@ -291,7 +291,7 @@ class sql_db
}
return $result;
}
-
+
return false;
}
@@ -372,7 +372,7 @@ class sql_db
return mysql_escape_string($msg);
}
}
-
+
function sql_error($sql = '')
{
if (!$this->return_on_error)
@@ -386,7 +386,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -463,7 +463,7 @@ class sql_db
{
$html_table = TRUE;
$html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-
+
foreach (array_keys($row) as $val)
{
$html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -549,4 +549,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/mysql4.php b/src/SemanticScuttle/db/mysql4.php
index 0639518..c13bcbd 100644
--- a/src/SemanticScuttle/db/mysql4.php
+++ b/src/SemanticScuttle/db/mysql4.php
@@ -94,7 +94,7 @@ class sql_db
case 'commit':
$result = @mysql_query('COMMIT', $this->db_connect_id);
$this->transaction = false;
-
+
if (!$result)
{
@mysql_query('ROLLBACK', $this->db_connect_id);
@@ -291,7 +291,7 @@ class sql_db
}
return $result;
}
-
+
return false;
}
@@ -372,7 +372,7 @@ class sql_db
return mysql_escape_string($msg);
}
}
-
+
function sql_error($sql = '')
{
if (!$this->return_on_error)
@@ -386,7 +386,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -463,7 +463,7 @@ class sql_db
{
$html_table = TRUE;
$html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-
+
foreach (array_keys($row) as $val)
{
$html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -549,4 +549,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/mysqli.php b/src/SemanticScuttle/db/mysqli.php
index 9a2709a..fcff848 100644
--- a/src/SemanticScuttle/db/mysqli.php
+++ b/src/SemanticScuttle/db/mysqli.php
@@ -129,7 +129,7 @@ class sql_db
}
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
-
+
if (!$this->query_result)
{
$this->num_queries++;
@@ -286,7 +286,7 @@ class sql_db
unset($this->rowset[$cur_index]);
unset($this->row[$cur_index]);
-
+
$result = array();
while ($this->rowset[$cur_index] = $this->sql_fetchrow($query_id))
{
@@ -316,7 +316,7 @@ class sql_db
else
{
$cur_index = (is_object($query_id)) ? $query_id->cur_index : $query_id;
-
+
if (empty($this->row[$cur_index]) && empty($this->rowset[$cur_index]))
{
if ($this->row[$cur_index] = $this->sql_fetchrow($query_id))
@@ -382,7 +382,7 @@ class sql_db
function sql_escape($msg) {
return mysqli_real_escape_string($this->db_connect_id, $msg);
}
-
+
function sql_error($sql = '')
{
if (!$this->return_on_error)
@@ -396,7 +396,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -473,7 +473,7 @@ class sql_db
{
$html_table = TRUE;
$html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
-
+
foreach (array_keys($row) as $val)
{
$html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
@@ -559,4 +559,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/oracle.php b/src/SemanticScuttle/db/oracle.php
index 7ef10e5..8b983d3 100644
--- a/src/SemanticScuttle/db/oracle.php
+++ b/src/SemanticScuttle/db/oracle.php
@@ -34,7 +34,7 @@ class sql_db
//
// Constructor
//
- function sql_db($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
+ function __construct($sqlserver, $sqluser, $sqlpassword, $database="", $persistency = true)
{
$this->persistency = $persistency;
$this->user = $sqluser;
@@ -465,4 +465,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/postgres.php b/src/SemanticScuttle/db/postgres.php
index b5bad20..2085359 100644
--- a/src/SemanticScuttle/db/postgres.php
+++ b/src/SemanticScuttle/db/postgres.php
@@ -58,7 +58,7 @@ class sql_db
{
$this->connect_string .= "host=$sqlserver ";
}
-
+
if ($port)
{
$this->connect_string .= "port=$port ";
@@ -152,7 +152,7 @@ class sql_db
}
$this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false;
-
+
if (!$this->query_result)
{
$this->num_queries++;
@@ -308,7 +308,7 @@ class sql_db
}
$result = @pg_fetch_array($query_id, NULL, PGSQL_ASSOC);
-
+
if ($result)
{
$this->rownum[$query_id]++;
@@ -477,7 +477,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -594,4 +594,4 @@ class sql_db
} // if ... defined
-?> \ No newline at end of file
+?>
diff --git a/src/SemanticScuttle/db/sqlite.php b/src/SemanticScuttle/db/sqlite.php
index 1591396..64d4371 100644
--- a/src/SemanticScuttle/db/sqlite.php
+++ b/src/SemanticScuttle/db/sqlite.php
@@ -368,7 +368,7 @@ class sql_db
{
$this->sql_transaction('rollback');
}
-
+
trigger_error($message, E_USER_ERROR);
}
@@ -384,4 +384,4 @@ class sql_db
} // if ... define
-?> \ No newline at end of file
+?>
diff --git a/src/php-gettext/gettext.php b/src/php-gettext/gettext.php
index a121f9c..5b3886e 100644
--- a/src/php-gettext/gettext.php
+++ b/src/php-gettext/gettext.php
@@ -98,7 +98,7 @@ class gettext_reader {
* @param object Reader the StreamReader object
* @param boolean enable_cache Enable or disable caching of strings (default on)
*/
- function gettext_reader($Reader, $enable_cache = true) {
+ function __construct($Reader, $enable_cache = true) {
// If there isn't a StreamReader, turn on short circuit mode.
if (! $Reader || isset($Reader->error) ) {
$this->short_circuit = true;
diff --git a/src/php-gettext/streams.php b/src/php-gettext/streams.php
index 3cdc158..de59a9a 100644
--- a/src/php-gettext/streams.php
+++ b/src/php-gettext/streams.php
@@ -46,12 +46,11 @@ class StreamReader {
};
class StringReader {
- var $_pos;
+ var $_pos = 0;
var $_str;
- function StringReader($str='') {
+ function __construct($str='') {
$this->_str = $str;
- $this->_pos = 0;
}
function read($bytes) {
@@ -86,7 +85,7 @@ class FileReader {
var $_fd;
var $_length;
- function FileReader($filename) {
+ function __construct($filename) {
if (file_exists($filename)) {
$this->_length=filesize($filename);
@@ -143,7 +142,7 @@ class FileReader {
// Preloads entire file in memory first, then creates a StringReader
// over it (it assumes knowledge of StringReader internals)
class CachedFileReader extends StringReader {
- function CachedFileReader($filename) {
+ function __construct($filename) {
if (file_exists($filename)) {
$length=filesize($filename);