Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making projects work in latest PHP version #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/Config/cms_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function _pluginBuilder($plugin){
$pluginName = Inflector::camelize($plugin);
if (!file_exists(APP . 'Plugin' . DS . $pluginName)) {
CakeLog::write(LOG_ERR, 'Plugin not found during bootstrap: ' . $pluginName);
continue;
}
$bootstrapFile = APP . 'Plugin' . DS . $pluginName . DS . 'Config' . DS . 'bootstrap.php';
$bootstrap = file_exists($bootstrapFile);
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Command/CmsShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function data()
$connection = 'default';
$records = array();
App::import('Model', 'CakeSchema', false);
$schema = &new CakeSchema(array(
$schema = new CakeSchema(array(
'name' => 'app',
'file' => $this->args['1'] . '_schema.php',
));
Expand All @@ -61,7 +61,7 @@ public function data()
// get records
$modelAlias = Inflector::camelize(Inflector::singularize($table));
App::import('Model', 'Model', false);
$model = &new Model(array(
$model = new Model(array(
'name' => $modelAlias,
'table' => $table,
'ds' => $connection
Expand Down
2 changes: 1 addition & 1 deletion app/Model/Behavior/BayesianAverageableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function &__getExtraModel($modelName)
trigger_error("BayesianAverage Error: no such model: '{$modelName}'", E_USER_NOTICE);
}
}
$this->__extraModels[$modelName] = &new $modelName();
$this->__extraModels[$modelName] = new $modelName();
}
return $this->__extraModels[$modelName];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function admin_delete($alias = null)
APP . 'View' . DS . 'Themed' . DS . $alias . DS,
);
$error = 0;
$folder = &new Folder;
$folder = new Folder;
foreach($paths as $path) {
if (is_dir($path)) {
if (!$folder->delete($path)) {
Expand Down
6 changes: 3 additions & 3 deletions app/Plugin/Install/Controller/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function data()
if ($db->config['datasource'] == 'Database/Postgres') {
$schema_file = 'postgres';
}
$schema = &new CakeSchema(array(
$schema = new CakeSchema(array(
'name' => 'app',
'file' => $schema_file . '_schema.php',
));
Expand All @@ -287,7 +287,7 @@ public function data()
$table = $classVars['table'];
$records = $classVars['records'];
App::import('Model', 'Model', false);
$modelObject = &new Model(array(
$modelObject = new Model(array(
'name' => $modelAlias,
'table' => $table,
'ds' => 'default',
Expand Down Expand Up @@ -320,7 +320,7 @@ public function configuration()
$this->set('title_for_layout', __l('Installation: Settings Configuration'));
if (!empty($this->request->data)) {
App::import('Model', 'Model', false);
$modelObject = &new Model(array(
$modelObject = new Model(array(
'name' => 'Setting',
'table' => 'settings',
'ds' => 'default',
Expand Down
2 changes: 1 addition & 1 deletion app/Plugin/Items/Controller/ItemsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ public function add($request = null, $request_id = null)
$check_price = true;
$check_price_type = true;
if(isset($custom_price_pre_night['id']) && !isset($custom_price_pre_night['start_date'])) {
continue;

}
if (!empty($this->request->data['Item']['is_have_definite_time']) && (!empty($this->request->data['Item']['is_people_can_book_my_time']) || !empty($this->request->data['Item']['is_sell_ticket']))) {
if (!empty($this->request->data['Item']['is_sell_ticket']) && !empty($this->request->data['CustomPricePerNight']['SellTicket'])) {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Cake/Console/Command/Task/FixtureTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected function _generateRecords($tableInfo, $recordCount = 1) {
isset($fieldInfo['length']) && $fieldInfo['length'] == 36
);
if ($isPrimaryUuid) {
$insert = String::uuid();
$insert = CakeText::uuid();
} else {
$insert = "Lorem ipsum dolor sit amet";
if (!empty($fieldInfo['length'])) {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Cake/Console/Command/Task/ProjectTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
App::uses('AppShell', 'Console/Command');
App::uses('File', 'Utility');
App::uses('Folder', 'Utility');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('Security', 'Utility');

/**
Expand Down Expand Up @@ -207,7 +207,7 @@ public function bake($path, $skel = null, $skip = array('empty')) {
}

foreach ($Folder->messages() as $message) {
$this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
$this->out(CakeText::wrap(' * ' . $message), 1, Shell::VERBOSE);
}

return true;
Expand Down
12 changes: 6 additions & 6 deletions core/lib/Cake/Console/HelpFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @link http://cakephp.org CakePHP(tm) Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');

/**
* HelpFormatter formats help for console shells. Can format to either
Expand Down Expand Up @@ -64,7 +64,7 @@ public function text($width = 72) {
$out = array();
$description = $parser->description();
if (!empty($description)) {
$out[] = String::wrap($description, $width);
$out[] = CakeText::wrap($description, $width);
$out[] = '';
}
$out[] = __d('cake_console', '<info>Usage:</info>');
Expand All @@ -76,7 +76,7 @@ public function text($width = 72) {
$out[] = '';
$max = $this->_getMaxLength($subcommands) + 2;
foreach ($subcommands as $command) {
$out[] = String::wrap($command->help($max), array(
$out[] = CakeText::wrap($command->help($max), array(
'width' => $width,
'indent' => str_repeat(' ', $max),
'indentAt' => 1
Expand All @@ -93,7 +93,7 @@ public function text($width = 72) {
$out[] = __d('cake_console', '<info>Options:</info>');
$out[] = '';
foreach ($options as $option) {
$out[] = String::wrap($option->help($max), array(
$out[] = CakeText::wrap($option->help($max), array(
'width' => $width,
'indent' => str_repeat(' ', $max),
'indentAt' => 1
Expand All @@ -108,7 +108,7 @@ public function text($width = 72) {
$out[] = __d('cake_console', '<info>Arguments:</info>');
$out[] = '';
foreach ($arguments as $argument) {
$out[] = String::wrap($argument->help($max), array(
$out[] = CakeText::wrap($argument->help($max), array(
'width' => $width,
'indent' => str_repeat(' ', $max),
'indentAt' => 1
Expand All @@ -118,7 +118,7 @@ public function text($width = 72) {
}
$epilog = $parser->epilog();
if (!empty($epilog)) {
$out[] = String::wrap($epilog, $width);
$out[] = CakeText::wrap($epilog, $width);
$out[] = '';
}
return implode("\n", $out);
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Cake/Console/Shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,11 @@ protected function _getInput($prompt, $options, $default) {
* @param string $text Text the text to format.
* @param string|integer|array $options Array of options to use, or an integer to wrap the text to.
* @return string Wrapped / indented text
* @see String::wrap()
* @see CakeText::wrap()
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::wrapText
*/
public function wrapText($text, $options = array()) {
return String::wrap($text, $options);
return CakeText::wrap($text, $options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Cake/Controller/Component/SecurityComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

App::uses('Component', 'Controller');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('Hash', 'Utility');
App::uses('Security', 'Utility');

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Cake/Error/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class ErrorHandler {
* @return void
* @see http://php.net/manual/en/function.set-exception-handler.php
*/
public static function handleException(Exception $exception) {
public static function handleException($exception) {
$config = Configure::read('Exception');
if (!empty($config['log'])) {
$message = sprintf("[%s] %s\n%s",
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Cake/Error/ExceptionRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ExceptionRenderer {
*
* @param Exception $exception Exception
*/
public function __construct(Exception $exception) {
public function __construct($exception) {
$this->controller = $this->_getController($exception);

if (method_exists($this->controller, 'apperror')) {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Cake/Model/Datasource/Database/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

App::uses('DboSource', 'Model/Datasource');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');

/**
* DBO implementation for the SQLite3 DBMS.
Expand Down Expand Up @@ -283,7 +283,7 @@ public function resultSet($results) {
$last = strripos($querystring, 'FROM');
if ($last !== false) {
$selectpart = substr($querystring, 7, $last - 8);
$selects = String::tokenize($selectpart, ',', '(', ')');
$selects = CakeText::tokenize($selectpart, ',', '(', ')');
}
} elseif (strpos($querystring, 'PRAGMA table_info') === 0) {
$selects = array('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk');
Expand Down
6 changes: 3 additions & 3 deletions core/lib/Cake/Model/Datasource/DboSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

App::uses('DataSource', 'Model/Datasource');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('View', 'View');

/**
Expand Down Expand Up @@ -2303,7 +2303,7 @@ public function fields(Model $model, $alias = null, $fields = array(), $quote =
if ($allFields) {
$fields = array_keys($model->schema());
} elseif (!is_array($fields)) {
$fields = String::tokenize($fields);
$fields = CakeText::tokenize($fields);
}
$fields = array_values(array_filter($fields));
$allFields = $allFields || in_array('*', $fields) || in_array($model->alias . '.*', $fields);
Expand Down Expand Up @@ -2589,7 +2589,7 @@ protected function _parseKey($model, $key, $value) {
}

if ($bound) {
return String::insert($key . ' ' . trim($operator), $value);
return CakeText::insert($key . ' ' . trim($operator), $value);
}

if (!preg_match($operatorMatch, trim($operator))) {
Expand Down
10 changes: 5 additions & 5 deletions core/lib/Cake/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

App::uses('ClassRegistry', 'Utility');
App::uses('Validation', 'Utility');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('Hash', 'Utility');
App::uses('BehaviorCollection', 'Model');
App::uses('ModelBehavior', 'Model');
Expand Down Expand Up @@ -1748,9 +1748,9 @@ public function save($data = null, $validate = true, $fieldList = array()) {
if (empty($this->data[$this->alias][$this->primaryKey]) && $isUUID) {
if (array_key_exists($this->primaryKey, $this->data[$this->alias])) {
$j = array_search($this->primaryKey, $fields);
$values[$j] = String::uuid();
$values[$j] = CakeText::uuid();
} else {
list($fields[], $values[]) = array($this->primaryKey, String::uuid());
list($fields[], $values[]) = array($this->primaryKey, CakeText::uuid());
}
}

Expand Down Expand Up @@ -1842,7 +1842,7 @@ protected function _saveMulti($joined, $id, $db) {
$newJoins[] = $row;
$values = array($id, $row);
if ($isUUID && $primaryAdded) {
$values[] = String::uuid();
$values[] = CakeText::uuid();
}
$newValues[$row] = $values;
unset($values);
Expand Down Expand Up @@ -2909,7 +2909,7 @@ protected function _findList($state, $query, $results = array()) {
$list = array("{n}.{$this->alias}.{$this->primaryKey}", "{n}.{$this->alias}.{$this->displayField}", null);
} else {
if (!is_array($query['fields'])) {
$query['fields'] = String::tokenize($query['fields']);
$query['fields'] = CakeText::tokenize($query['fields']);
}

if (count($query['fields']) === 1) {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Cake/Network/Email/CakeEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
App::uses('Validation', 'Utility');
App::uses('Multibyte', 'I18n');
App::uses('AbstractTransport', 'Network/Email');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('View', 'View');
App::import('I18n', 'Multibyte');

Expand Down Expand Up @@ -711,7 +711,7 @@ public function getHeaders($include = array()) {
}
if ($this->_messageId !== false) {
if ($this->_messageId === true) {
$headers['Message-ID'] = '<' . str_replace('-', '', String::UUID()) . '@' . $this->_domain . '>';
$headers['Message-ID'] = '<' . str_replace('-', '', CakeText::UUID()) . '@' . $this->_domain . '>';
} else {
$headers['Message-ID'] = $this->_messageId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @package Cake.Utility
*/
class String {
class CakeText {

/**
* Generate a random UUID
Expand Down Expand Up @@ -181,7 +181,7 @@ public static function tokenize($data, $separator = ',', $leftBound = '(', $righ
/**
* Replaces variable placeholders inside a $str with any given $data. Each key in the $data array
* corresponds to a variable placeholder name in $str.
* Example: `String::insert(':name is :age years old.', array('name' => 'Bob', '65'));`
* Example: `CakeText::insert(':name is :age years old.', array('name' => 'Bob', '65'));`
* Returns: Bob is 65 years old.
*
* Available $options are:
Expand All @@ -191,7 +191,7 @@ public static function tokenize($data, $separator = ',', $leftBound = '(', $righ
* - escape: The character or string used to escape the before character / string (Defaults to `\`)
* - format: A regex to use for matching variable placeholders. Default is: `/(?<!\\)\:%s/`
* (Overwrites before, after, breaks escape / clean)
* - clean: A boolean or array with instructions for String::cleanInsert
* - clean: A boolean or array with instructions for CakeText::cleanInsert
*
* @param string $str A string containing variable placeholders
* @param string $data A key => val array where each key stands for a placeholder variable name
Expand All @@ -207,7 +207,7 @@ public static function insert($str, $data, $options = array()) {
$format = $options['format'];
$data = (array)$data;
if (empty($data)) {
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
return ($options['clean']) ? CakeText::cleanInsert($str, $options) : $str;
}

if (!isset($format)) {
Expand All @@ -226,7 +226,7 @@ public static function insert($str, $data, $options = array()) {
$offset = $pos + strlen($val);
$str = substr_replace($str, $val, $pos, 1);
}
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
return ($options['clean']) ? CakeText::cleanInsert($str, $options) : $str;
} else {
asort($data);

Expand All @@ -251,19 +251,19 @@ public static function insert($str, $data, $options = array()) {
if (!isset($options['format']) && isset($options['before'])) {
$str = str_replace($options['escape'] . $options['before'], $options['before'], $str);
}
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
return ($options['clean']) ? CakeText::cleanInsert($str, $options) : $str;
}

/**
* Cleans up a String::insert() formatted string with given $options depending on the 'clean' key in
* Cleans up a CakeText::insert() formatted string with given $options depending on the 'clean' key in
* $options. The default method used is text but html is also available. The goal of this function
* is to replace all whitespace and unneeded markup around placeholders that did not get replaced
* by String::insert().
* by CakeText::insert().
*
* @param string $str
* @param string $options
* @return string
* @see String::insert()
* @see CakeText::insert()
*/
public static function cleanInsert($str, $options) {
$clean = $options['clean'];
Expand Down Expand Up @@ -292,7 +292,7 @@ public static function cleanInsert($str, $options) {
$str = preg_replace($kleenex, $clean['replacement'], $str);
if ($clean['andText']) {
$options['clean'] = array('method' => 'text');
$str = String::cleanInsert($str, $options);
$str = CakeText::cleanInsert($str, $options);
}
break;
case 'text':
Expand Down
Loading