App::uses and usage replacements for String => CakeText.

This commit is contained in:
euromark 2015-01-05 01:00:57 +01:00
parent 63093e1d30
commit 52ecccb1a2
18 changed files with 51 additions and 51 deletions

View file

@ -122,7 +122,7 @@ class SchemaShell extends AppShell {
if ($this->params['force']) {
$options['models'] = false;
} elseif (!empty($this->params['models'])) {
$options['models'] = String::tokenize($this->params['models']);
$options['models'] = CakeText::tokenize($this->params['models']);
}
$snapshot = false;
@ -151,7 +151,7 @@ class SchemaShell extends AppShell {
Configure::write('Cache.disable', $cacheDisable);
if (!empty($this->params['exclude']) && !empty($content)) {
$excluded = String::tokenize($this->params['exclude']);
$excluded = CakeText::tokenize($this->params['exclude']);
foreach ($excluded as $table) {
unset($content['tables'][$table]);
}

View file

@ -340,7 +340,7 @@ class FixtureTask extends BakeTask {
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'])) {

View file

@ -18,7 +18,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');
/**
@ -212,7 +212,7 @@ class ProjectTask extends AppShell {
}
foreach ($Folder->messages() as $message) {
$this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE);
$this->out(CakeText::wrap(' * ' . $message), 1, Shell::VERBOSE);
}
return true;

View file

@ -14,7 +14,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
/**
* HelpFormatter formats help for console shells. Can format to either
@ -64,7 +64,7 @@ class HelpFormatter {
$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>');
@ -76,7 +76,7 @@ class HelpFormatter {
$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
@ -93,7 +93,7 @@ class HelpFormatter {
$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
@ -108,7 +108,7 @@ class HelpFormatter {
$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
@ -118,7 +118,7 @@ class HelpFormatter {
}
$epilog = $parser->epilog();
if (!empty($epilog)) {
$out[] = String::wrap($epilog, $width);
$out[] = CakeText::wrap($epilog, $width);
$out[] = '';
}
return implode("\n", $out);

View file

@ -584,11 +584,11 @@ class Shell extends Object {
* @param string $text Text the text to format.
* @param string|int|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);
}
/**

View file

@ -17,7 +17,7 @@
*/
App::uses('Component', 'Controller');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('Hash', 'Utility');
App::uses('Security', 'Utility');

View file

@ -103,10 +103,10 @@ class Configure {
self::$_values['Exception']
);
// Preload Debugger + String in case of E_STRICT errors when loading files.
// Preload Debugger + CakeText in case of E_STRICT errors when loading files.
if (self::$_values['debug'] > 0) {
class_exists('Debugger');
class_exists('String');
class_exists('CakeText');
}
}
}

View file

@ -140,7 +140,7 @@ class TranslateBehavior extends ModelBehavior {
unset($this->_joinTable, $this->_runtimeModel);
return $query;
} elseif (is_string($query['fields'])) {
$query['fields'] = String::tokenize($query['fields']);
$query['fields'] = CakeText::tokenize($query['fields']);
}
$fields = array_merge(

View file

@ -17,7 +17,7 @@
*/
App::uses('DboSource', 'Model/Datasource');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
/**
* DBO implementation for the SQLite3 DBMS.
@ -303,7 +303,7 @@ class Sqlite extends DboSource {
if (stripos($querystring, 'SELECT') === 0 && stripos($querystring, 'FROM') > 0) {
$selectpart = substr($querystring, 7);
$selects = array();
foreach (String::tokenize($selectpart, ',', '(', ')') as $part) {
foreach (CakeText::tokenize($selectpart, ',', '(', ')') as $part) {
$fromPos = stripos($part, ' FROM ');
if ($fromPos !== false) {
$selects[] = trim(substr($part, 0, $fromPos));

View file

@ -17,7 +17,7 @@
*/
App::uses('DataSource', 'Model/Datasource');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('View', 'View');
/**
@ -2513,7 +2513,7 @@ class DboSource extends DataSource {
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);
@ -2813,7 +2813,7 @@ class DboSource extends DataSource {
}
if ($bound) {
return String::insert($key . ' ' . trim($operator), $value);
return CakeText::insert($key . ' ' . trim($operator), $value);
}
if (!preg_match($operatorMatch, trim($operator))) {

View file

@ -20,7 +20,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');
@ -1915,9 +1915,9 @@ class Model extends Object implements CakeEventListener {
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->_isUUIDField($this->primaryKey)) {
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());
}
}
@ -2026,7 +2026,7 @@ class Model extends Object implements CakeEventListener {
$values = array($id, $row);
if ($isUUID && $primaryAdded) {
$values[] = String::uuid();
$values[] = CakeText::uuid();
}
$newValues[$row] = $values;
@ -3187,7 +3187,7 @@ class Model extends Object implements CakeEventListener {
$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) {

View file

@ -17,7 +17,7 @@
App::uses('Multibyte', 'I18n');
App::uses('AbstractTransport', 'Network/Email');
App::uses('File', 'Utility');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('View', 'View');
/**
@ -776,7 +776,7 @@ class CakeEmail {
}
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;
}

View file

@ -20,7 +20,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
@ -73,7 +73,7 @@ class TreeBehaviorUuidTest extends CakeTestCase {
'conditions' => array($modelClass . '.name' => '1.1')
));
$id = String::uuid();
$id = CakeText::uuid();
$this->Tree->create();
$result = $this->Tree->save(array($modelClass => array(
'id' => $id,

View file

@ -19,7 +19,7 @@
*/
App::uses('CakeLog', 'Log');
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
/**
* Provide custom logging and error handling.
@ -337,7 +337,7 @@ class Debugger {
$trace['path'] = self::trimPath($trace['file']);
$trace['reference'] = $reference;
unset($trace['object'], $trace['args']);
$back[] = String::insert($tpl, $trace, array('before' => '{:', 'after' => '}'));
$back[] = CakeText::insert($tpl, $trace, array('before' => '{:', 'after' => '}'));
}
}
@ -637,7 +637,7 @@ class Debugger {
*
* `Debugger::addFormat('custom', $data);`
*
* Where $data is an array of strings that use String::insert() variable
* Where $data is an array of strings that use CakeText::insert() variable
* replacement. The template vars should be in a `{:id}` style.
* An error formatter can have the following keys:
*
@ -775,7 +775,7 @@ class Debugger {
if (isset($tpl['links'])) {
foreach ($tpl['links'] as $key => $val) {
$links[$key] = String::insert($val, $data, $insertOpts);
$links[$key] = CakeText::insert($val, $data, $insertOpts);
}
}
@ -791,14 +791,14 @@ class Debugger {
if (is_array($value)) {
$value = implode("\n", $value);
}
$info .= String::insert($tpl[$key], array($key => $value) + $data, $insertOpts);
$info .= CakeText::insert($tpl[$key], array($key => $value) + $data, $insertOpts);
}
$links = implode(' ', $links);
if (isset($tpl['callback']) && is_callable($tpl['callback'])) {
return call_user_func($tpl['callback'], $data, compact('links', 'info'));
}
echo String::insert($tpl['error'], compact('links', 'info') + $data, $insertOpts);
echo CakeText::insert($tpl['error'], compact('links', 'info') + $data, $insertOpts);
}
/**

View file

@ -14,7 +14,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
/**
* Library of array functions for manipulating and extracting data
@ -112,7 +112,7 @@ class Hash {
if (strpos($path, '[') === false) {
$tokens = explode('.', $path);
} else {
$tokens = String::tokenize($path, '.', '[', ']');
$tokens = CakeText::tokenize($path, '.', '[', ']');
}
$_key = '__set_item__';
@ -258,7 +258,7 @@ class Hash {
if (strpos($path, '[') === false) {
$tokens = explode('.', $path);
} else {
$tokens = String::tokenize($path, '.', '[', ']');
$tokens = CakeText::tokenize($path, '.', '[', ']');
}
if (strpos($path, '{') === false && strpos($path, '[') === false) {
@ -341,7 +341,7 @@ class Hash {
if (strpos($path, '[') === false) {
$tokens = explode('.', $path);
} else {
$tokens = String::tokenize($path, '.', '[', ']');
$tokens = CakeText::tokenize($path, '.', '[', ']');
}
if (strpos($path, '{') === false && strpos($path, '[') === false) {

View file

@ -16,7 +16,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
/**
* Security Library contains utility methods related to security
@ -63,7 +63,7 @@ class Security {
* @return string Hash
*/
public static function generateAuthKey() {
return Security::hash(String::uuid());
return Security::hash(CakeText::uuid());
}
/**

View file

@ -16,7 +16,7 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('String', 'Utility');
App::uses('CakeText', 'Utility');
App::uses('Hash', 'Utility');
/**
@ -549,7 +549,7 @@ class Set {
return null;
}
if (is_string($path) && strpos($path, '{') !== false) {
$path = String::tokenize($path, '.', '{', '}');
$path = CakeText::tokenize($path, '.', '{', '}');
} elseif (is_string($path)) {
$path = explode('.', $path);
}

View file

@ -225,7 +225,7 @@ class TextHelper extends AppHelper {
* @param string $phrase The phrase that will be searched
* @param array $options An array of html attributes and options.
* @return string The highlighted text
* @see String::highlight()
* @see CakeText::highlight()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::highlight
*/
public function highlight($text, $phrase, $options = array()) {
@ -260,7 +260,7 @@ class TextHelper extends AppHelper {
*
* @param string $text Text
* @return string The text without links
* @see String::stripLinks()
* @see CakeText::stripLinks()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::stripLinks
*/
public function stripLinks($text) {
@ -283,7 +283,7 @@ class TextHelper extends AppHelper {
* @param int $length Length of returned string, including ellipsis.
* @param array $options An array of html attributes and options.
* @return string Trimmed string.
* @see String::truncate()
* @see CakeText::truncate()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::truncate
*/
public function truncate($text, $length = 100, $options = array()) {
@ -305,7 +305,7 @@ class TextHelper extends AppHelper {
* @param int $length Length of returned string, including ellipsis.
* @param array $options An array of html attributes and options.
* @return string Trimmed string.
* @see String::tail()
* @see CakeText::tail()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::tail
*/
public function tail($text, $length = 100, $options = array()) {
@ -321,7 +321,7 @@ class TextHelper extends AppHelper {
* @param int $radius The amount of characters that will be returned on each side of the founded phrase
* @param string $ending Ending that will be appended
* @return string Modified string
* @see String::excerpt()
* @see CakeText::excerpt()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt
*/
public function excerpt($text, $phrase, $radius = 100, $ending = '...') {
@ -335,7 +335,7 @@ class TextHelper extends AppHelper {
* @param string $and The word used to join the last and second last items together with. Defaults to 'and'.
* @param string $separator The separator used to join all the other items together. Defaults to ', '.
* @return string The glued together string.
* @see String::toList()
* @see CakeText::toList()
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::toList
*/
public function toList($list, $and = null, $separator = ', ') {