"Removing all shortcut function usage from the core"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6128 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-12-08 06:08:03 +00:00
parent 5adbf2d75b
commit 8a2b51c3ec
50 changed files with 252 additions and 252 deletions

View file

@ -359,7 +359,7 @@ class Dispatcher extends Object {
$url = $_GET;
}
if (isset($params['url'])) {
$params['url'] = am($params['url'], $url);
$params['url'] = array_merge($params['url'], $url);
} else {
$params['url'] = $url;
}
@ -479,10 +479,10 @@ class Dispatcher extends Object {
}
if (!$ctrlClass = $this->__loadController($params)) {
extract(Router::getArgs($params['action']));
$params = am($params, array('controller'=> $params['plugin'],
$params = array_merge($params, array('controller'=> $params['plugin'],
'action'=> $params['controller'],
'pass' => am($pass, $params['pass']),
'named' => am($named, $params['named'])
'pass' => array_merge($pass, $params['pass']),
'named' => array_merge($named, $params['named'])
)
);
if (!$ctrlClass = $this->__loadController($params)) {

View file

@ -350,7 +350,7 @@ class Cache extends Object {
if (empty($key)) {
return false;
}
$key = r(array(DS, '/', '.'), '_', strval($key));
$key = str_replace(array(DS, '/', '.'), '_', strval($key));
return $key;
}
}
@ -379,7 +379,7 @@ class CacheEngine extends Object {
* @access public
*/
function init($settings = array()) {
$this->settings = am(array('duration'=> 3600, 'probability'=> 100), $settings);
$this->settings = array_merge(array('duration'=> 3600, 'probability'=> 100), $settings);
return true;
}
/**

View file

@ -86,7 +86,7 @@ class FileEngine extends CacheEngine {
function init($settings = array()) {
parent::init($settings);
$defaults = array('path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false, 'serialize'=> true);
$this->settings = am($defaults, $this->settings, $settings);
$this->settings = array_merge($defaults, $this->settings, $settings);
if(!isset($this->__File)) {
$this->__File =& new File($this->settings['path'] . DS . 'cake');
}

View file

@ -64,7 +64,7 @@ class MemcacheEngine extends CacheEngine {
}
parent::init($settings);
$defaults = array('servers' => array('127.0.0.1'), 'compress'=> false);
$this->settings = am($this->settings, $defaults, $settings);
$this->settings = array_merge($this->settings, $defaults, $settings);
if ($this->settings['compress']) {
$this->settings['compress'] = MEMCACHE_COMPRESSED;

View file

@ -69,7 +69,7 @@ class ModelEngine extends CacheEngine {
function init($settings) {
parent::init($settings);
$defaults = array('className'=> 'CacheModel', 'fields'=> array('data', 'expires'));
$this->settings = am($this->settings, $defaults, $settings);
$this->settings = array_merge($this->settings, $defaults, $settings);
$className = $this->settings['className'];
$this->__fields = $this->settings['fields'];
if (App::import($className)) {

View file

@ -55,7 +55,7 @@ class XcacheEngine extends CacheEngine {
function init($settings) {
parent::init($settings);
$defaults = array('PHP_AUTH_USER' => 'cake', 'PHP_AUTH_PW' => 'cake');
$this->settings = am($this->settings, $defaults, $settings);
$this->settings = array_merge($this->settings, $defaults, $settings);
return function_exists('xcache_info');
}
/**

View file

@ -188,7 +188,7 @@ class Configure extends Object {
foreach ((array)$path as $dir) {
$items = $_this->__list($dir, $types[$type]['suffix'], $extension);
$objects = am($items, $objects);
$objects = array_merge($items, $objects);
}
if ($type !== 'file') {

View file

@ -225,11 +225,11 @@ class AuthComponent extends Object {
function initialize(&$controller) {
$this->params = $controller->params;
$crud = array('create', 'read', 'update', 'delete');
$this->actionMap = am($this->actionMap, array_combine($crud, $crud));
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
$admin = Configure::read('Routing.admin');
if (!empty($admin)) {
$this->actionMap = am($this->actionMap, array(
$this->actionMap = array_merge($this->actionMap, array(
$admin . '_index' => 'read',
$admin . '_add' => 'create',
$admin . '_edit' => 'update',
@ -262,7 +262,7 @@ class AuthComponent extends Object {
$this->authError = __('You are not authorized to access that location.', true);
}
if (low($controller->name) == 'app' || (low($controller->name) == 'tests' && Configure::read() > 0)) {
if (strtolower($controller->name) == 'app' || (strtolower($controller->name) == 'tests' && Configure::read() > 0)) {
return;
}
@ -495,7 +495,7 @@ class AuthComponent extends Object {
if (empty($args)) {
$this->allowedActions = array('*');
} else {
$this->allowedActions = am($this->allowedActions, $args);
$this->allowedActions = array_merge($this->allowedActions, $args);
}
}
/**
@ -654,7 +654,7 @@ class AuthComponent extends Object {
* @access public
*/
function action($action = ':controller/:action') {
return r(
return str_replace(
array(':controller', ':action'),
array(Inflector::camelize($this->params['controller']), $this->params['action']),
$this->actionPath . $action
@ -732,14 +732,14 @@ class AuthComponent extends Object {
return false;
}
$model =& $this->getModel();
$data = $model->find(am($find, $this->userScope), null, null, -1);
$data = $model->find(array_merge($find, $this->userScope), null, null, -1);
if (empty($data) || empty($data[$this->userModel])) {
return null;
}
} elseif (is_numeric($user)) {
// Assume it's a user's ID
$model =& $this->getModel();
$data = $model->find(am(array($model->escapeField() => $user), $this->userScope));
$data = $model->find(array_merge(array($model->escapeField() => $user), $this->userScope));
if (empty($data) || empty($data[$this->userModel])) {
return null;
@ -808,13 +808,13 @@ class AuthComponent extends Object {
$paths = Router::getPaths();
if (!empty($paths['base']) && stristr($url, $paths['base'])) {
$url = r($paths['base'], '', $url);
$url = str_replace($paths['base'], '', $url);
}
$url = '/' . $url . '/';
while (strpos($url, '//') !== false) {
$url = r('//', '/', $url);
$url = str_replace('//', '/', $url);
}
return $url;
}

View file

@ -293,7 +293,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
function isPost() {
return (low(env('REQUEST_METHOD')) == 'post');
return (strtolower(env('REQUEST_METHOD')) == 'post');
}
/**
* Returns true if the current call a PUT request
@ -302,7 +302,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
function isPut() {
return (low(env('REQUEST_METHOD')) == 'put');
return (strtolower(env('REQUEST_METHOD')) == 'put');
}
/**
* Returns true if the current call a GET request
@ -311,7 +311,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
function isGet() {
return (low(env('REQUEST_METHOD')) == 'get');
return (strtolower(env('REQUEST_METHOD')) == 'get');
}
/**
* Returns true if the current call a DELETE request
@ -320,7 +320,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
function isDelete() {
return (low(env('REQUEST_METHOD')) == 'delete');
return (strtolower(env('REQUEST_METHOD')) == 'delete');
}
/**
* Gets Prototype version if call is Ajax, otherwise empty string.
@ -348,7 +348,7 @@ class RequestHandlerComponent extends Object {
*/
function setContent($name, $type = null) {
if (is_array($name)) {
$this->__requestContent = am($this->__requestContent, $name);
$this->__requestContent = array_merge($this->__requestContent, $name);
return;
}
$this->__requestContent[$name] = $type;
@ -566,7 +566,7 @@ class RequestHandlerComponent extends Object {
if (!array_key_exists($type, $this->__requestContent) && strpos($type, '/') === false) {
return false;
}
$options = am(array('index' => 0, 'charset' => null, 'attachment' => false), $options);
$options = array_merge(array('index' => 0, 'charset' => null, 'attachment' => false), $options);
if (strpos($type, '/') === false && isset($this->__requestContent[$type])) {
$cType = null;

View file

@ -190,7 +190,7 @@ class SecurityComponent extends Object {
$this->requireLogin[] = $arg;
}
}
$this->loginOptions = am($base, $this->loginOptions);
$this->loginOptions = array_merge($base, $this->loginOptions);
if (empty($this->requireLogin)) {
$this->requireLogin = array('*');
@ -208,7 +208,7 @@ class SecurityComponent extends Object {
* @access public
*/
function loginCredentials($type = null) {
switch (low($type)) {
switch (strtolower($type)) {
case 'basic':
$login = array('username' => env('PHP_AUTH_USER'), 'password' => env('PHP_AUTH_PW'));
if (!empty($login['username'])) {
@ -246,12 +246,12 @@ class SecurityComponent extends Object {
* @access public
*/
function loginRequest($options = array()) {
$options = am($this->loginOptions, $options);
$options = array_merge($this->loginOptions, $options);
$this->__setLoginDefaults($options);
$auth = 'WWW-Authenticate: ' . ucfirst($options['type']);
$out = array('realm="' . $options['realm'] . '"');
if (low($options['type']) == 'digest') {
if (strtolower($options['type']) == 'digest') {
$out[] = 'qop="auth"';
$out[] = 'nonce="' . uniqid() . '"'; //str_replace('-', '', String::uuid())
$out[] = 'opaque="' . md5($options['realm']).'"';
@ -419,7 +419,7 @@ class SecurityComponent extends Object {
if (isset($this->loginOptions['login'])) {
$this->__callback($controller, $this->loginOptions['login'], array($login));
} else {
if (low($this->loginOptions['type']) == 'digest') {
if (strtolower($this->loginOptions['type']) == 'digest') {
// Do digest authentication
if ($login && isset($this->loginUsers[$login['username']])) {
if ($login['response'] == $this->generateDigestResponseHash($login)) {
@ -602,13 +602,13 @@ class SecurityComponent extends Object {
* @access private
*/
function __setLoginDefaults(&$options) {
$options = am(array(
$options = array_merge(array(
'type' => 'basic',
'realm' => env('SERVER_NAME'),
'qop' => 'auth',
'nonce' => String::uuid()
), array_filter($options));
$options = am(array('opaque' => md5($options['realm'])), $options);
$options = array_merge(array('opaque' => md5($options['realm'])), $options);
}
/**
* Calls a controller callback method

View file

@ -798,7 +798,7 @@ class Controller extends Object {
}
}
}
if ($bool != null && up($bool) != 'AND') {
if ($bool != null && strtoupper($bool) != 'AND') {
$cond = array($bool => $cond);
}
return $cond;
@ -812,7 +812,7 @@ class Controller extends Object {
*/
function __postConditionMatch($op, $value) {
if (is_string($op)) {
$op = up(trim($op));
$op = strtoupper(trim($op));
}
switch($op) {
@ -890,7 +890,7 @@ class Controller extends Object {
trigger_error(sprintf(__('Controller::paginate() - can\'t find model %1$s in controller %2$sController', true), $object, $this->name), E_USER_WARNING);
return array();
}
$options = am($this->params, $this->params['url'], $this->passedArgs);
$options = array_merge($this->params, $this->params['url'], $this->passedArgs);
if (isset($this->paginate[$object->alias])) {
$defaults = $this->paginate[$object->alias];
} else {
@ -935,9 +935,9 @@ class Controller extends Object {
$defaults['conditions'] = array();
}
extract($options = am(array('page' => 1, 'limit' => 20), $defaults, $options));
extract($options = array_merge(array('page' => 1, 'limit' => 20), $defaults, $options));
if (is_array($scope) && !empty($scope)) {
$conditions = am($conditions, $scope);
$conditions = array_merge($conditions, $scope);
} elseif (is_string($scope)) {
$conditions = array($conditions, $scope);
}
@ -966,7 +966,7 @@ class Controller extends Object {
'prevPage' => ($page > 1),
'nextPage' => ($count > ($page * $limit)),
'pageCount' => $pageCount,
'defaults' => am(array('limit' => 20, 'step' => 1), $defaults),
'defaults' => array_merge(array('limit' => 20, 'step' => 1), $defaults),
'options' => $options
);

View file

@ -209,7 +209,7 @@ class Debugger extends Object {
* @access protected
*/
function trace($options = array()) {
$options = am(array(
$options = array_merge(array(
'depth' => 999,
'format' => '',
'args' => false,
@ -224,7 +224,7 @@ class Debugger extends Object {
$back = array();
for ($i = $options['start']; $i < count($backtrace) && $i < $options['depth']; $i++) {
$trace = am(
$trace = array_merge(
array(
'file' => '[internal]',
'line' => '??'
@ -233,7 +233,7 @@ class Debugger extends Object {
);
if (isset($backtrace[$i + 1])) {
$next = am(
$next = array_merge(
array(
'line' => '??',
'file' => '[internal]',
@ -287,11 +287,11 @@ class Debugger extends Object {
}
if (strpos($path, CAKE_CORE_INCLUDE_PATH) === 0) {
$path = r(CAKE_CORE_INCLUDE_PATH, 'CORE', $path);
$path = str_replace(CAKE_CORE_INCLUDE_PATH, 'CORE', $path);
} elseif (strpos($path, APP) === 0) {
$path = r(APP, 'APP' . DS, $path);
$path = str_replace(APP, 'APP' . DS, $path);
} elseif (strpos($path, ROOT) === 0) {
$path = r(ROOT, 'ROOT', $path);
$path = str_replace(ROOT, 'ROOT', $path);
}
return $path;
}
@ -331,7 +331,7 @@ class Debugger extends Object {
* @access protected
*/
function exportVar($var, $recursion = 0) {
switch(low(gettype($var))) {
switch(strtolower(gettype($var))) {
case 'boolean':
return ife($var, 'true', 'false');
break;
@ -357,7 +357,7 @@ class Debugger extends Object {
}
break;
case 'resource':
return low(gettype($var));
return strtolower(gettype($var));
break;
case 'null':
return 'null';

View file

@ -592,7 +592,7 @@ class Folder extends Object{
$to = $options;
$options = array();
}
$options = am(array('to'=> $to, 'from'=> $this->path, 'mode'=> $this->mode, 'skip'=> array()), $options);
$options = array_merge(array('to'=> $to, 'from'=> $this->path, 'mode'=> $this->mode, 'skip'=> array()), $options);
$fromDir = $options['from'];
$toDir = $options['to'];
@ -612,7 +612,7 @@ class Folder extends Object{
return false;
}
$exceptions = am(array('.','..','.svn'), $options['skip']);
$exceptions = array_merge(array('.','..','.svn'), $options['skip']);
$handle = opendir($fromDir);
if ($handle) {
while (false !== ($item = readdir($handle))) {
@ -633,7 +633,7 @@ class Folder extends Object{
if (mkdir($to, intval($mode, 8))) {
chmod($to, intval($mode, 8));
$this->__messages[] = sprintf(__('%s created', true), $to);
$options = am($options, array('to'=> $to, 'from'=> $from));
$options = array_merge($options, array('to'=> $to, 'from'=> $from));
$this->copy($options);
} else {
$this->__errors[] = sprintf(__('%s not created', true), $to);
@ -662,8 +662,9 @@ class Folder extends Object{
$to = null;
if (is_string($options)) {
$to = $options;
$options = (array)$options;
}
$options = am(array('to'=> $to, 'from'=> $this->path, 'mode'=> $this->mode, 'skip'=> array()), $options);
$options = array_merge(array('to'=> $to, 'from'=> $this->path, 'mode'=> $this->mode, 'skip'=> array()), $options);
if ($this->copy($options)) {
if ($this->delete($options['from'])) {

View file

@ -200,7 +200,7 @@ class HttpSocket extends CakeSocket {
if (!empty($this->request['cookies'])) {
$cookies = $this->buildCookies($this->request['cookies']);
}
$this->request['header'] = am(array('Host' => $this->request['uri']['host']), $this->request['header']);
$this->request['header'] = array_merge(array('Host' => $this->request['uri']['host']), $this->request['header']);
}
if (is_array($this->request['body'])) {
@ -249,7 +249,7 @@ class HttpSocket extends CakeSocket {
$this->response = $this->parseResponse($response);
if (!empty($this->response['cookies'])) {
$this->config['request']['cookies'] = am($this->config['request']['cookies'], $this->response['cookies']);
$this->config['request']['cookies'] = array_merge($this->config['request']['cookies'], $this->response['cookies']);
}
return $this->response['body'];
}
@ -267,7 +267,7 @@ class HttpSocket extends CakeSocket {
if (!empty($query)) {
$uri =$this->parseUri($uri);
if (isset($uri['query'])) {
$uri['query'] = am($uri['query'], $query);
$uri['query'] = array_merge($uri['query'], $query);
} else {
$uri['query'] = $query;
}
@ -342,7 +342,7 @@ class HttpSocket extends CakeSocket {
return false;
}
$base = am($this->config['request']['uri'], array('scheme' => array('http', 'https'), 'port' => array(80, 443)));
$base = array_merge($this->config['request']['uri'], array('scheme' => array('http', 'https'), 'port' => array(80, 443)));
$url = $this->parseUri($url, $base);
if (empty($url)) {
$url = $this->config['request']['uri'];
@ -424,7 +424,7 @@ class HttpSocket extends CakeSocket {
if (empty($encoding)) {
return array('body' => $body, 'header' => false);
}
$decodeMethod = 'decode'.Inflector::camelize(r('-', '_', $encoding)).'Body';
$decodeMethod = 'decode'.Inflector::camelize(str_replace('-', '_', $encoding)).'Body';
if (!is_callable(array(&$this, $decodeMethod))) {
if (!$this->quirksMode) {
@ -598,7 +598,7 @@ class HttpSocket extends CakeSocket {
}
if (is_array($base) && !empty($base)) {
$uri = am($base, $uri);
$uri = array_merge($base, $uri);
}
if (isset($uri['scheme']) && is_array($uri['scheme'])) {
@ -710,7 +710,7 @@ class HttpSocket extends CakeSocket {
}
$request['uri'] = $this->parseUri($request['uri']);
$request = am(array('method' => 'GET'), $request);
$request = array_merge(array('method' => 'GET'), $request);
$request['uri'] = $this->buildUri($request['uri'], '/%path?%query');
if (!$this->quirksMode && $request['uri'] === '*' && !in_array($request['method'], $asteriskMethods)) {
@ -776,11 +776,11 @@ class HttpSocket extends CakeSocket {
if (is_array($header)) {
foreach ($header as $field => $value) {
unset($header[$field]);
$field = low($field);
$field = strtolower($field);
preg_match_all('/(?:^|(?<=-))[a-z]/U', $field, $offsets, PREG_OFFSET_CAPTURE);
foreach ($offsets[0] as $offset) {
$field = substr_replace($field, up($offset[0]), $offset[1], 1);
$field = substr_replace($field, strtoupper($offset[0]), $offset[1], 1);
}
$header[$field] = $value;
}
@ -800,16 +800,16 @@ class HttpSocket extends CakeSocket {
$field = $this->unescapeToken($field);
$field = low($field);
$field = strtolower($field);
preg_match_all('/(?:^|(?<=-))[a-z]/U', $field, $offsets, PREG_OFFSET_CAPTURE);
foreach ($offsets[0] as $offset) {
$field = substr_replace($field, up($offset[0]), $offset[1], 1);
$field = substr_replace($field, strtoupper($offset[0]), $offset[1], 1);
}
if (!isset($header[$field])) {
$header[$field] = $value;
} else {
$header[$field] = am($header[$field], $value);
$header[$field] = array_merge((array)$header[$field], (array)$value);
}
}
return $header;
@ -837,7 +837,7 @@ class HttpSocket extends CakeSocket {
if (is_null($value)) {
$value = true;
}
$key = low($key);
$key = strtolower($key);
if (!isset($cookies[$name][$key])) {
$cookies[$name][$key] = $value;
}

View file

@ -388,7 +388,7 @@ class L10n extends Object {
function __autoLanguage() {
$_detectableLanguages = split ('[,;]', env('HTTP_ACCEPT_LANGUAGE'));
foreach ($_detectableLanguages as $key => $langKey) {
$langKey = low($langKey);
$langKey = strtolower($langKey);
if (isset($this->__l10nCatalog[$langKey])) {
$this->language = $this->__l10nCatalog[$langKey]['language'];

View file

@ -52,7 +52,7 @@ class AclBehavior extends ModelBehavior {
if (is_string($config)) {
$config = array('type' => $config);
}
$this->settings[$model->alias] = am(array('type' => 'requester'), $config);
$this->settings[$model->alias] = array_merge(array('type' => 'requester'), $config);
$type = $this->__typeMaps[$this->settings[$model->alias]['type']];
if (!ClassRegistry::isKeySet($type)) {
@ -73,7 +73,7 @@ class AclBehavior extends ModelBehavior {
* @return array
*/
function node(&$model, $ref = null) {
$type = $this->__typeMaps[low($this->settings[$model->alias]['type'])];
$type = $this->__typeMaps[strtolower($this->settings[$model->alias]['type'])];
if (empty($ref)) {
$ref = array('model' => $model->alias, 'foreign_key' => $model->id);
}
@ -86,7 +86,7 @@ class AclBehavior extends ModelBehavior {
*/
function afterSave(&$model, $created) {
if ($created) {
$type = $this->__typeMaps[low($this->settings[$model->alias]['type'])];
$type = $this->__typeMaps[strtolower($this->settings[$model->alias]['type'])];
$parent = $model->parentNode();
if (!empty($parent)) {
$parent = $this->node($model, $parent);
@ -107,7 +107,7 @@ class AclBehavior extends ModelBehavior {
*
*/
function afterDelete(&$model) {
$type = $this->__typeMaps[low($this->settings[$model->alias]['type'])];
$type = $this->__typeMaps[strtolower($this->settings[$model->alias]['type'])];
$node = Set::extract($this->node($model), "0.{$type}.id");
if (!empty($node)) {
$model->{$type}->delete($node);

View file

@ -113,7 +113,7 @@ class TranslateBehavior extends ModelBehavior {
}
$autoFields = true;
}
$fields = am($this->settings[$model->alias], $this->runtime[$model->alias]['fields']);
$fields = array_merge($this->settings[$model->alias], $this->runtime[$model->alias]['fields']);
$addFields = array();
if (is_array($query['fields'])) {
foreach ($fields as $key => $value) {
@ -162,7 +162,7 @@ class TranslateBehavior extends ModelBehavior {
}
}
}
$query['fields'] = am($query['fields']);
$query['fields'] = array_merge($query['fields']);
$this->runtime[$model->alias]['beforeFind'] = $addFields;
return $query;
}
@ -211,7 +211,7 @@ class TranslateBehavior extends ModelBehavior {
if (empty($locale) || is_array($locale)) {
return true;
}
$fields = am($this->settings[$model->alias], $this->runtime[$model->alias]['fields']);
$fields = array_merge($this->settings[$model->alias], $this->runtime[$model->alias]['fields']);
$tempData = array();
foreach ($fields as $key => $value) {
@ -239,7 +239,7 @@ class TranslateBehavior extends ModelBehavior {
$RuntimeModel =& $this->translateModel($model);
if (empty($created)) {
$translations = $RuntimeModel->generateList(am($conditions, array($RuntimeModel->displayField => array_keys($tempData))));
$translations = $RuntimeModel->generateList(array_merge($conditions, array($RuntimeModel->displayField => array_keys($tempData))));
if ($translations) {
foreach ($translations as $id => $field) {
@ -252,7 +252,7 @@ class TranslateBehavior extends ModelBehavior {
if (!empty($tempData)) {
foreach ($tempData as $field => $value) {
$RuntimeModel->create(am($conditions, array($RuntimeModel->displayField => $field, 'content' => $value)));
$RuntimeModel->create(array_merge($conditions, array($RuntimeModel->displayField => $field, 'content' => $value)));
$RuntimeModel->save();
}
}
@ -355,14 +355,14 @@ class TranslateBehavior extends ModelBehavior {
unset($this->settings[$model->alias][$field]);
} elseif (in_array($field, $this->settings[$model->alias])) {
$this->settings[$model->alias] = am(array_diff_assoc($this->settings[$model->alias], array($field)));
$this->settings[$model->alias] = array_merge(array_diff_assoc($this->settings[$model->alias], array($field)));
}
if (array_key_exists($field, $this->runtime[$model->alias]['fields'])) {
unset($this->runtime[$model->alias]['fields'][$field]);
} elseif (in_array($field, $this->runtime[$model->alias]['fields'])) {
$this->runtime[$model->alias]['fields'] = am(array_diff_assoc($this->runtime[$model->alias]['fields'], array($field)));
$this->runtime[$model->alias]['fields'] = array_merge(array_diff_assoc($this->runtime[$model->alias]['fields'], array($field)));
}
if (is_null($association)) {
@ -385,7 +385,7 @@ class TranslateBehavior extends ModelBehavior {
return false;
}
}
$associations[$association] = am($default, array('conditions' => array(
$associations[$association] = array_merge($default, array('conditions' => array(
'model' => $model->alias,
$RuntimeModel->displayField => $field)));
}
@ -429,14 +429,14 @@ class TranslateBehavior extends ModelBehavior {
unset($this->settings[$model->alias][$field]);
} elseif (in_array($field, $this->settings[$model->alias])) {
$this->settings[$model->alias] = am(array_diff_assoc($this->settings[$model->alias], array($field)));
$this->settings[$model->alias] = array_merge(array_diff_assoc($this->settings[$model->alias], array($field)));
}
if (array_key_exists($field, $this->runtime[$model->alias]['fields'])) {
unset($this->runtime[$model->alias]['fields'][$field]);
} elseif (in_array($field, $this->runtime[$model->alias]['fields'])) {
$this->runtime[$model->alias]['fields'] = am(array_diff_assoc($this->runtime[$model->alias]['fields'], array($field)));
$this->runtime[$model->alias]['fields'] = array_merge(array_diff_assoc($this->runtime[$model->alias]['fields'], array($field)));
}
if (!is_null($association) && (isset($model->hasMany[$association]) || isset($model->__backAssociation['hasMany'][$association]))) {

View file

@ -37,7 +37,7 @@
class TreeBehavior extends ModelBehavior {
function setup(&$model, $config = array()) {
$settings = am(array(
$settings = array_merge(array(
'parent' => 'parent_id',
'left' => 'lft',
'right' => 'rght',
@ -45,7 +45,7 @@ class TreeBehavior extends ModelBehavior {
'enabled' => true,
'type' => 'nested',
'__parentChange' => false
), $config);
), (array)$config);
/*if (in_array($settings['scope'], $model->getAssociated('belongsTo'))) {
$data = $model->getAssociated($settings['scope']);
@ -718,7 +718,7 @@ class TreeBehavior extends ModelBehavior {
if (is_string($scope)) {
$conditions[]= $scope;
} else {
$conditions= am($conditions, $scope);
$conditions= array_merge($conditions, $scope);
}
}
$model->updateAll(array($field => $field . ' ' . $dir . ' ' . $shift), $conditions);

View file

@ -455,7 +455,7 @@ class DataSource extends Object {
if (empty($val) && $val !== '0') {
return false;
}
$query = r($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
$query = str_replace($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
}
}
return $query;

View file

@ -358,7 +358,7 @@ class DboAdodb extends DboSource {
$prepend = '';
if (strpos($fields[$i], 'DISTINCT') !== false) {
$prepend = 'DISTINCT ';
$fields[$i] = trim(r('DISTINCT', '', $fields[$i]));
$fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i]));
}
$dot = strrpos($fields[$i], '.');

View file

@ -477,7 +477,7 @@ class DboDb2 extends DboSource {
}
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit) = explode('(', $col);

View file

@ -263,9 +263,9 @@ class DboFirebird extends DboSource {
break;
default:
if (get_magic_quotes_gpc()) {
$data = stripslashes(r("'", "''", $data));
$data = stripslashes(str_replace("'", "''", $data));
} else {
$data = r("'", "''", $data);
$data = str_replace("'", "''", $data);
}
break;
}
@ -400,7 +400,7 @@ class DboFirebird extends DboSource {
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit)=explode('(', $col);

View file

@ -213,7 +213,7 @@ class DboMssql extends DboSource {
$fields[] = array(
'name' => $column[0]['Field'],
'type' => $this->column($column[0]['Type']),
'null' => (up($column[0]['Null']) == 'YES'),
'null' => (strtoupper($column[0]['Null']) == 'YES'),
'default' => $column[0]['Default']
);
}
@ -247,9 +247,9 @@ class DboMssql extends DboSource {
break;
default:
if (get_magic_quotes_gpc()) {
$data = stripslashes(r("'", "''", $data));
$data = stripslashes(str_replace("'", "''", $data));
} else {
$data = r("'", "''", $data);
$data = str_replace("'", "''", $data);
}
break;
}
@ -363,7 +363,7 @@ class DboMssql extends DboSource {
$error = mssql_get_last_message($this->connection);
if ($error) {
if (strpos(low($error), 'changed database') === false) {
if (strpos(strtolower($error), 'changed database') === false) {
return $error;
}
}
@ -439,7 +439,7 @@ class DboMssql extends DboSource {
}
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit) = explode('(', $col);

View file

@ -342,7 +342,7 @@ class DboMysql extends DboSource {
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = $this->length($real);
@list($col,$vals) = explode('(', $col);

View file

@ -328,7 +328,7 @@ class DboMysqli extends DboSource {
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = $this->length($real);
@list($col,$vals) = explode('(', $col);
@ -368,7 +368,7 @@ class DboMysqli extends DboSource {
* @return integer An integer representing the length of the column
*/
function length($real) {
$col = r(array(')', 'unsigned'), '', $real);
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;
if (strpos($col, '(') !== false) {

View file

@ -503,7 +503,7 @@ class DboOracle extends DboSource {
} else {
$real = strtolower($real);
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit) = explode('(', $col);

View file

@ -389,7 +389,7 @@ class DboPostgres extends DboSource {
$prepend = '';
if (strpos($fields[$i], 'DISTINCT') !== false) {
$prepend = 'DISTINCT ';
$fields[$i] = trim(r('DISTINCT', '', $fields[$i]));
$fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i]));
}
$dot = strrpos($fields[$i], '.');
@ -442,7 +442,7 @@ class DboPostgres extends DboSource {
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit) = explode('(', $col);
@ -482,7 +482,7 @@ class DboPostgres extends DboSource {
* @return int An integer representing the length of the column
*/
function length($real) {
$col = r(array(')', 'unsigned'), '', $real);
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;
if (strpos($col, '(') !== false) {
@ -551,7 +551,7 @@ class DboPostgres extends DboSource {
if ($data === true || $data === false) {
$result = $data;
} elseif (is_string($data) && !is_numeric($data)) {
if (strpos(low($data), 't') !== false) {
if (strpos(strtolower($data), 't') !== false) {
$result = true;
} else {
$result = false;

View file

@ -326,7 +326,7 @@ class DboSqlite extends DboSource {
return $col;
}
$col = low(r(')', '', $real));
$col = strtolower(str_replace(')', '', $real));
$limit = null;
@list($col, $limit) = explode('(', $col);
@ -436,7 +436,7 @@ class DboSqlite extends DboSource {
*/
function buildColumn($column) {
$name = $type = null;
$column = am(array('null' => true), $column);
$column = array_merge(array('null' => true), $column);
extract($column);
if (empty($name) || empty($type)) {

View file

@ -317,7 +317,7 @@ class DboSybase extends DboSource {
return $col;
}
$col = r(')', '', $real);
$col = str_replace(')', '', $real);
$limit = null;
@list($col, $limit) = explode('(', $col);

View file

@ -106,7 +106,7 @@ class DboSource extends DataSource {
function reconnect($config = null) {
$this->disconnect();
if ($config != null) {
$this->config = am($this->_baseConfig, $config);
$this->config = array_merge($this->_baseConfig, $config);
}
return $this->connect();
}
@ -184,7 +184,7 @@ class DboSource extends DataSource {
if (count($args) == 1) {
return $this->fetchAll($args[0]);
} elseif (count($args) > 1 && (strpos(low($args[0]), 'findby') === 0 || strpos(low($args[0]), 'findallby') === 0)) {
} elseif (count($args) > 1 && (strpos(strtolower($args[0]), 'findby') === 0 || strpos(strtolower($args[0]), 'findallby') === 0)) {
$params = $args[1];
if (strpos(strtolower($args[0]), 'findby') === 0) {
@ -621,7 +621,7 @@ class DboSource extends DataSource {
function __filterResults(&$results, &$model, $filtered = array()) {
$filtering = array();
$associations = am($model->belongsTo, $model->hasOne, $model->hasMany, $model->hasAndBelongsToMany);
$associations = array_merge($model->belongsTo, $model->hasOne, $model->hasMany, $model->hasAndBelongsToMany);
$count = count($results);
for ($i = 0; $i < $count; $i++) {
@ -687,7 +687,7 @@ class DboSource extends DataSource {
}
if (!empty($ins)) {
$query = r('{$__cakeID__$}', join(', ', $ins), $query);
$query = str_replace('{$__cakeID__$}', join(', ', $ins), $query);
$fetch = $this->fetchAll($query, $model->cacheQueries, $model->alias);
}
@ -719,9 +719,9 @@ class DboSource extends DataSource {
}
}
if (!empty($ins)) {
$query = r('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query);
$query = r('= (', 'IN (', $query);
$query = r(' WHERE 1 = 1', '', $query);
$query = str_replace('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query);
$query = str_replace('= (', 'IN (', $query);
$query = str_replace(' WHERE 1 = 1', '', $query);
}
$with = $model->hasAndBelongsToMany[$association]['with'];
@ -806,7 +806,7 @@ class DboSource extends DataSource {
foreach ($merge as $j => $data) {
if (isset($value[$model->alias]) && $value[$model->alias][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) {
if (count($data) > 1) {
$data = am($data[$association], $data);
$data = array_merge($data[$association], $data);
unset($data[$association]);
foreach ($data as $key => $name) {
if (is_numeric($key)) {
@ -939,7 +939,7 @@ class DboSource extends DataSource {
);
if (!empty($assocData['conditions'])) {
$self['joins'][0]['conditions'] = trim($this->conditions(am($self['joins'][0]['conditions'], $assocData['conditions']), true, false));
$self['joins'][0]['conditions'] = trim($this->conditions(array_merge($self['joins'][0]['conditions'], (array)$assocData['conditions']), true, false));
}
if (!empty($queryData['joins'])) {
@ -949,7 +949,7 @@ class DboSource extends DataSource {
}
if ($this->__bypass === false) {
$self['fields'] = am($self['fields'], $this->fields($linkModel, $alias, (isset($assocData['fields']) ? $assocData['fields'] : '')));
$self['fields'] = array_merge($self['fields'], $this->fields($linkModel, $alias, (isset($assocData['fields']) ? $assocData['fields'] : '')));
}
if (!in_array($self, $queryData['selfJoin'])) {
@ -970,10 +970,10 @@ class DboSource extends DataSource {
}
}
if (!empty($queryData['conditions'])) {
$result['conditions'] = trim($this->conditions(am($result['conditions'], $assocData['conditions']), true, false));
$result['conditions'] = trim($this->conditions(array_merge($result['conditions'], $assocData['conditions']), true, false));
}
if (!empty($queryData['fields'])) {
$result['fields'] = array_unique(am($result['fields'], $queryData['fields']));
$result['fields'] = array_unique(array_merge($result['fields'], $queryData['fields']));
}
$sql = $this->buildStatement($result, $model);
return $sql;
@ -1070,7 +1070,7 @@ class DboSource extends DataSource {
} elseif ($type == 'belongsTo') {
$conditions = $this->__mergeConditions($assocData['conditions'], array("{$alias}.{$linkModel->primaryKey}" => '{$__cakeForeignKey__$}'));
}
$query = am($assocData, array(
$query = array_merge($assocData, array(
'conditions' => $conditions,
'table' => $this->fullTableName($linkModel),
'fields' => $fields,
@ -1080,7 +1080,7 @@ class DboSource extends DataSource {
if ($type == 'belongsTo') {
// Dunno if we should be doing this for hasOne also...?
// Or maybe not doing it at all...?
$query = am($query, array('order' => $assocData['order'], 'limit' => $limit));
$query = array_merge($query, array('order' => $assocData['order'], 'limit' => $limit));
}
} else {
if ($type == 'hasOne') {
@ -1096,7 +1096,7 @@ class DboSource extends DataSource {
'conditions' => trim($this->conditions($conditions, true, false))
);
$queryData['fields'] = am($queryData['fields'], $fields);
$queryData['fields'] = array_merge($queryData['fields'], $fields);
if (!empty($assocData['order'])) {
$queryData['order'][] = $assocData['order'];
@ -1145,7 +1145,7 @@ class DboSource extends DataSource {
'limit' => $limit,
'table' => $this->fullTableName($linkModel),
'alias' => $alias,
'fields' => am($this->fields($linkModel, $alias, $assocData['fields']), $joinFields),
'fields' => array_merge($this->fields($linkModel, $alias, $assocData['fields']), $joinFields),
'order' => $assocData['order'],
'joins' => array(array(
'table' => $joinTbl,
@ -1165,7 +1165,7 @@ class DboSource extends DataSource {
}
function buildJoinStatement($join) {
$data = am(array(
$data = array_merge(array(
'type' => null,
'alias' => null,
'table' => 'join_table',
@ -1182,7 +1182,7 @@ class DboSource extends DataSource {
}
function buildStatement($query, $model) {
$query = am(array('offset' => null, 'joins' => array()), $query);
$query = array_merge(array('offset' => null, 'joins' => array()), $query);
if (!empty($query['joins'])) {
for ($i = 0; $i < count($query['joins']); $i++) {
if (is_array($query['joins'][$i])) {
@ -1448,7 +1448,7 @@ class DboSource extends DataSource {
if (strpos($fields[$i], 'DISTINCT') !== false) {
$prepend = 'DISTINCT ';
$fields[$i] = trim(r('DISTINCT', '', $fields[$i]));
$fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i]));
}
$dot = strpos($fields[$i], '.');
@ -1550,7 +1550,7 @@ class DboSource extends DataSource {
$join = ' ' . strtoupper($key) . ' ';
$value = $this->conditionKeysToString($value, $quoteValues);
if (strpos($join, 'NOT') !== false) {
if (up(trim($key)) == 'NOT') {
if (strtoupper(trim($key)) == 'NOT') {
$key = 'AND ' . $key;
}
$not = 'NOT ';
@ -1609,7 +1609,7 @@ class DboSource extends DataSource {
} elseif (!isset($match['2'])) {
$match['1'] = ' = ';
$match['2'] = $match['0'];
} elseif (low($mValue) == 'not') {
} elseif (strtolower($mValue) == 'not') {
$not = $this->conditionKeysToString(array($mValue => array($key => $match[2])), $quoteValues);
}
@ -1739,7 +1739,7 @@ class DboSource extends DataSource {
foreach ($keys as $key => $value) {
if (is_numeric($key)) {
$value = ltrim(r('ORDER BY ', '', $this->order($value)));
$value = ltrim(str_replace('ORDER BY ', '', $this->order($value)));
$key = $value;
if (!preg_match('/\\x20ASC|\\x20DESC/i', $key)) {
@ -1766,7 +1766,7 @@ class DboSource extends DataSource {
$order[] = $this->order($key . $value);
}
return ' ORDER BY ' . trim(r('ORDER BY', '', join(',', $order)));
return ' ORDER BY ' . trim(str_replace('ORDER BY', '', join(',', $order)));
} else {
$keys = preg_replace('/ORDER\\x20BY/i', '', $keys);
@ -1829,7 +1829,7 @@ class DboSource extends DataSource {
* @return integer An integer representing the length of the column
*/
function length($real) {
$col = r(array(')', 'unsigned'), '', $real);
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;
if (strpos($col, '(') !== false) {
@ -1933,7 +1933,7 @@ class DboSource extends DataSource {
$col = array('PRIMARY' => array('column'=> $primary, 'unique' => 1));
$index[] = $this->buildIndex($col);
}
$out .= "\t" . join(",\n\t", array_filter(am($cols, $index))) . "\n);\n\n";
$out .= "\t" . join(",\n\t", array_filter(array_merge($cols, $index))) . "\n);\n\n";
}
}
return $out;
@ -1978,7 +1978,7 @@ class DboSource extends DataSource {
*/
function buildColumn($column) {
$name = $type = null;
$column = am(array('null' => true), $column);
$column = array_merge(array('null' => true), $column);
extract($column);
if (empty($name) || empty($type)) {

View file

@ -315,7 +315,7 @@ class Model extends Overloadable {
parent::__construct();
if (is_array($id) && isset($id['name'])) {
$options = am(array('id' => false, 'table' => null, 'ds' => null, 'alias' => null), $id);
$options = array_merge(array('id' => false, 'table' => null, 'ds' => null, 'alias' => null), $id);
list($id, $table, $ds) = array($options['id'], $options['table'], $options['ds']);
$this->name = $options['name'];
}
@ -459,15 +459,15 @@ class Model extends Overloadable {
$count = count($call);
$pass = array(&$this);
if (!in_array(low($method), $methods)) {
if (!in_array(strtolower($method), $methods)) {
$pass[] = $method;
}
foreach ($params as $param) {
$pass[] = $param;
}
if (in_array(low($method), $methods)) {
$it = $map[low($method)];
if (in_array(strtolower($method), $methods)) {
$it = $map[strtolower($method)];
return call_user_func_array(array(&$this->behaviors[$it[1]], $it[0]), $pass);
}
@ -758,7 +758,7 @@ class Model extends Overloadable {
if ($db->isInterfaceSupported('listSources')) {
$sources = $db->listSources();
if (is_array($sources) && !in_array(low($this->tablePrefix . $tableName), array_map('low', $sources))) {
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
return $this->cakeError('missingTable', array(array(
'className' => $this->alias,
'table' => $this->tablePrefix . $tableName
@ -897,7 +897,7 @@ class Model extends Overloadable {
if (is_array($info)) {
$fields = array();
foreach($info as $field => $value) {
$fields[] = am(array('name'=> $field), $value);
$fields[] = array_merge(array('name'=> $field), $value);
}
unset($info);
return new Set($fields);
@ -1108,7 +1108,7 @@ class Model extends Overloadable {
foreach ($dateFields as $updateCol) {
if ($this->hasField($updateCol) && !in_array($updateCol, $fields)) {
$colType = am(array('formatter' => 'date'), $db->columns[$this->getColumnType($updateCol)]);
$colType = array_merge(array('formatter' => 'date'), $db->columns[$this->getColumnType($updateCol)]);
if (!array_key_exists('formatter', $colType) || !array_key_exists('format', $colType)) {
$time = strtotime('now');
} else {
@ -1369,7 +1369,7 @@ class Model extends Overloadable {
$savedAssociatons = $this->__backAssociation;
$this->__backAssociation = array();
}
foreach (am($this->hasMany, $this->hasOne) as $assoc => $data) {
foreach (array_merge($this->hasMany, $this->hasOne) as $assoc => $data) {
if ($data['dependent'] === true && $cascade === true) {
$model =& $this->{$assoc};
@ -1496,7 +1496,7 @@ class Model extends Overloadable {
function find($conditions = null, $fields = null, $order = null, $recursive = null) {
if (!is_string($conditions) || (is_string($conditions) && !array_key_exists($conditions, $this->__findMethods))) {
$type = 'first';
$query = am(compact('conditions', 'fields', 'order', 'recursive'), array('limit' => 1));
$query = array_merge(compact('conditions', 'fields', 'order', 'recursive'), array('limit' => 1));
} else {
$type = $conditions;
$query = $fields;
@ -1505,7 +1505,7 @@ class Model extends Overloadable {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$this->id = $this->getID();
$query = am(
$query = array_merge(
array(
'conditions' => null, 'fields' => null, 'joins' => array(),
'limit' => null, 'offset' => null, 'order' => null, 'page' => null
@ -1780,9 +1780,8 @@ class Model extends Overloadable {
* @access public
*/
function findNeighbours($conditions = null, $field, $value) {
if (!is_null($conditions)) {
$conditions = array($conditions);
}
$conditions = (array)$conditions;
if (is_array($field)) {
$fields = $field;
$field = $fields[0];
@ -1792,8 +1791,8 @@ class Model extends Overloadable {
$prev = $next = null;
@list($prev) = $this->findAll(array_filter(am($conditions, array($field => '< ' . $value))), $fields, $field . ' DESC', 1, null, 0);
@list($next) = $this->findAll(array_filter(am($conditions, array($field => '> ' . $value))), $fields, $field . ' ASC', 1, null, 0);
@list($prev) = $this->findAll(array_filter(array_merge($conditions, array($field => '< ' . $value))), $fields, $field . ' DESC', 1, null, 0);
@list($next) = $this->findAll(array_filter(array_merge($conditions, array($field => '> ' . $value))), $fields, $field . ' ASC', 1, null, 0);
return compact('prev', 'next');
}
@ -1883,7 +1882,7 @@ class Model extends Overloadable {
'on' => null
);
$validator = am($default, $validator);
$validator = array_merge($default, $validator);
if (isset($validator['message'])) {
$message = $validator['message'];
@ -1901,7 +1900,7 @@ class Model extends Overloadable {
if (is_array($validator['rule'])) {
$rule = $validator['rule'][0];
unset($validator['rule'][0]);
$ruleParams = am(array($data[$fieldName]), array_values($validator['rule']));
$ruleParams = array_merge(array($data[$fieldName]), array_values($validator['rule']));
} else {
$rule = $validator['rule'];
$ruleParams = array($data[$fieldName]);
@ -1910,7 +1909,7 @@ class Model extends Overloadable {
$valid = true;
$msg = null;
if (method_exists($this, $rule) || isset($this->__behaviorMethods[$rule]) || isset($this->__behaviorMethods[low($rule)])) {
if (method_exists($this, $rule) || isset($this->__behaviorMethods[$rule]) || isset($this->__behaviorMethods[strtolower($rule)])) {
$ruleParams[] = array_diff_key($validator, $default);
$valid = call_user_func_array(array(&$this, $rule), $ruleParams);
} elseif (method_exists($Validation, $rule)) {
@ -2091,7 +2090,7 @@ class Model extends Overloadable {
if (!empty($children)) {
if ($_this->name == $name) {
$r = am($r, $this->normalizeFindParams($type, $children, $altType, $r, $_this));
$r = array_merge($r, $this->normalizeFindParams($type, $children, $altType, $r, $_this));
} else {
if (!$_this->getAssociated($name)) {
$r[$altType][$name] = $children;
@ -2222,7 +2221,7 @@ class Model extends Overloadable {
}
return array_keys($this->{$type});
} else {
$assoc = am($this->hasOne, $this->hasMany, $this->belongsTo, $this->hasAndBelongsToMany);
$assoc = array_merge($this->hasOne, $this->hasMany, $this->belongsTo, $this->hasAndBelongsToMany);
if (array_key_exists($type, $assoc)) {
foreach ($this->__associations as $a) {
if (isset($this->{$a}[$type])) {

View file

@ -88,7 +88,7 @@ class CakeSchema extends Object {
if (empty($options['path'])) {
$this->path = CONFIGS . 'sql';
}
$options = am(get_object_vars($this), $options);
$options = array_merge(get_object_vars($this), $options);
$this->_build($options);
}
/**
@ -174,7 +174,7 @@ class CakeSchema extends Object {
* @access public
*/
function read($options = array()) {
extract(am(
extract(array_merge(
array(
'connection' => $this->connection,
'name' => $this->name,
@ -276,7 +276,7 @@ class CakeSchema extends Object {
unset($object);
}
extract(am(
extract(array_merge(
get_object_vars($this), $options
));
@ -392,7 +392,7 @@ class CakeSchema extends Object {
if (isset($old[$table][$field])) {
$diff = array_diff_assoc($value, $old[$table][$field]);
if (!empty($diff)) {
$tables[$table]['change'][$field] = am($old[$table][$field], $diff);
$tables[$table]['change'][$field] = array_merge($old[$table][$field], $diff);
}
}

View file

@ -204,7 +204,7 @@ class Router extends Object {
function connect($route, $default = array(), $params = array()) {
$_this =& Router::getInstance();
$admin = Configure::read('Routing.admin');
$default = am(array('plugin' => null, 'controller' => null, 'action' => null), $default);
$default = array_merge(array('plugin' => null, 'controller' => null, 'action' => null), $default);
if (!empty($default) && empty($default['action'])) {
$default['action'] = 'index';
@ -251,7 +251,7 @@ class Router extends Object {
*/
function mapResources($controller, $options = array()) {
$_this =& Router::getInstance();
$options = am(
$options = array_merge(
array('prefix' => '/'),
$options
);
@ -378,7 +378,7 @@ class Router extends Object {
break; //leave the default values;
} else {
extract($_this->getArgs($found));
$out['pass'] = am($out['pass'], $pass);
$out['pass'] = array_merge($out['pass'], $pass);
$out['named'] = $named;
}
}
@ -516,8 +516,8 @@ class Router extends Object {
function setRequestInfo($params) {
$_this =& Router::getInstance();
$defaults = array('plugin' => null, 'controller' => null, 'action' => null);
$params[0] = am($defaults, $params[0]);
$params[1] = am($defaults, $params[1]);
$params[0] = array_merge($defaults, (array)$params[0]);
$params[1] = array_merge($defaults, (array)$params[1]);
list($_this->__params[], $_this->__paths[]) = $params;
if (count($_this->__paths)) {
@ -684,7 +684,7 @@ class Router extends Object {
$plugin = $url['plugin'];
}
$url = am(array('controller' => $params['controller'], 'plugin' => $params['plugin']), Set::filter($url, true));
$url = array_merge(array('controller' => $params['controller'], 'plugin' => $params['plugin']), Set::filter($url, true));
if ($plugin !== false) {
$url['plugin'] = $plugin;
@ -858,7 +858,7 @@ class Router extends Object {
}
if (empty($params)) {
return Router::__mapRoute($route, am($url, compact('pass', 'named', 'prefix')));
return Router::__mapRoute($route, array_merge($url, compact('pass', 'named', 'prefix')));
} elseif (!empty($routeParams) && !empty($route[3])) {
if (!empty($required)) {
@ -874,7 +874,7 @@ class Router extends Object {
}
} else {
if (empty($required) && $defaults['plugin'] == $url['plugin'] && $defaults['controller'] == $url['controller'] && $defaults['action'] == $url['action']) {
return Router::__mapRoute($route, am($url, compact('pass', 'named', 'prefix')));
return Router::__mapRoute($route, array_merge($url, compact('pass', 'named', 'prefix')));
}
return false;
}
@ -886,7 +886,7 @@ class Router extends Object {
}
}
}
return Router::__mapRoute($route, am($filled, compact('pass', 'named', 'prefix')));
return Router::__mapRoute($route, array_merge($filled, compact('pass', 'named', 'prefix')));
}
/**
* Merges URL parameters into a route string
@ -1000,7 +1000,7 @@ class Router extends Object {
$out = '';
if (is_array($q)) {
$q = am($extra, $q);
$q = array_merge($extra, $q);
} else {
$out = $q;
$q = $extra;

View file

@ -186,7 +186,7 @@ class Sanitize {
$options = array();
}
$options = am(array(
$options = array_merge(array(
'connection' => 'default',
'odd_spaces' => true,
'encode' => true,

View file

@ -78,7 +78,7 @@ class Set extends Object {
if (is_a($this, 'set')) {
$backtrace = debug_backtrace();
$previousCall = low($backtrace[1]['class'].'::'.$backtrace[1]['function']);
$previousCall = strtolower($backtrace[1]['class'].'::'.$backtrace[1]['function']);
if ($previousCall != 'set::merge') {
$r =& $this->value;
array_unshift($args, null);

View file

@ -97,7 +97,7 @@ class CakeSocket extends Object {
$classVars = get_class_vars(__CLASS__);
$baseConfig = $classVars['_baseConfig'];
$this->config = am($baseConfig, $config);
$this->config = array_merge($baseConfig, $config);
if (!is_numeric($this->config['protocol'])) {
$this->config['protocol'] = getprotobyname($this->config['protocol']);

View file

@ -237,7 +237,7 @@ class Validation extends Object {
if (is_array($this->type)) {
foreach ($this->type as $key => $value) {
$card = low($value);
$card = strtolower($value);
$this->regex = $cards['all'][$card];
if ($this->_check()) {
@ -279,7 +279,7 @@ class Validation extends Object {
if (is_array($check1)) {
extract($check1, EXTR_OVERWRITE);
}
$operator = str_replace(array(" ", "\t", "\n", "\r", "\0", "\x0B"), "", low($operator));
$operator = str_replace(array(" ", "\t", "\n", "\r", "\0", "\x0B"), "", strtolower($operator));
switch($operator) {
case 'isgreater':

View file

@ -158,7 +158,7 @@ class Helper extends Overloadable {
if (file_exists(APP . 'config' . DS . $name .'.php')) {
require(APP . 'config' . DS . $name .'.php');
if (isset($tags)) {
$this->tags = am($this->tags, $tags);
$this->tags = array_merge($this->tags, $tags);
}
}
return $this->tags;
@ -259,11 +259,11 @@ class Helper extends Overloadable {
$default = array (
'escape' => true
);
$options = am($default, $options);
$options = array_merge($default, $options);
if (!is_array($exclude)) {
$exclude = array();
}
$exclude = am($exclude, array('escape'));
$exclude = array_merge($exclude, array('escape'));
$keys = array_diff(array_keys($options), $exclude);
$values = array_intersect_key(array_values($options), $keys);
$escape = $options['escape'];

View file

@ -301,7 +301,7 @@ class AjaxHelper extends AppHelper {
} else {
$action = $params;
}
$htmlOptions = am(
$htmlOptions = array_merge(
array(
'id' => 'form' . intval(rand()),
'action' => $action,
@ -310,7 +310,7 @@ class AjaxHelper extends AppHelper {
),
$this->__getHtmlOptions($options)
);
$options = am(
$options = array_merge(
array(
'url' => $htmlOptions['action'],
'model' => false,
@ -433,7 +433,7 @@ class AjaxHelper extends AppHelper {
}
if (!isset($options['id'])) {
$options['id'] = Inflector::camelize(r("/", "_", $field));
$options['id'] = Inflector::camelize(str_replace("/", "_", $field));
}
$divOptions = array('id' => $options['id'] . "_autoComplete", 'class' => isset($options['class']) ? $options['class'] : 'auto_complete');
@ -483,7 +483,7 @@ class AjaxHelper extends AppHelper {
return '';
}
}
$attr = $this->_parseAttributes(am($options, array('id' => $id)));
$attr = $this->_parseAttributes(array_merge($options, array('id' => $id)));
return $this->output(sprintf($this->Html->tags['blockstart'], $attr));
}
/**
@ -679,7 +679,7 @@ class AjaxHelper extends AppHelper {
unset($options['indicator']);
}
$jsOptions = am(
$jsOptions = array_merge(
array('asynchronous' => 'true', 'evalScripts' => 'true'),
$this->_buildCallbacks($options)
);

View file

@ -139,7 +139,7 @@ class FormHelper extends AppHelper {
$created = true;
$id = $this->data[$model][$data['key']];
}
$options = am(array(
$options = array_merge(array(
'type' => ($created && empty($options['action'])) ? 'put' : 'post',
'action' => null,
'url' => null,
@ -166,13 +166,13 @@ class FormHelper extends AppHelper {
if (!empty($options['action']) && !isset($options['id'])) {
$options['id'] = $model . Inflector::camelize($options['action']) . 'Form';
}
$options['action'] = am($actionDefaults, (array)$options['url']);
$options['action'] = array_merge($actionDefaults, (array)$options['url']);
} elseif (is_string($options['url'])) {
$options['action'] = $options['url'];
}
unset($options['url']);
switch (low($options['type'])) {
switch (strtolower($options['type'])) {
case 'get':
$htmlAttributes['method'] = 'get';
break;
@ -182,12 +182,12 @@ class FormHelper extends AppHelper {
case 'post':
case 'put':
case 'delete':
$append .= $this->hidden('_method', array('name' => '_method', 'value' => up($options['type']), 'id' => null));
$append .= $this->hidden('_method', array('name' => '_method', 'value' => strtoupper($options['type']), 'id' => null));
default:
$htmlAttributes['method'] = 'post';
break;
}
$this->requestType = low($options['type']);
$this->requestType = strtolower($options['type']);
$htmlAttributes['action'] = $this->url($options['action']);
unset($options['type'], $options['action']);
@ -200,7 +200,7 @@ class FormHelper extends AppHelper {
}
}
unset($options['default']);
$htmlAttributes = am($options, $htmlAttributes);
$htmlAttributes = array_merge($options, $htmlAttributes);
if (isset($this->params['_Token']) && !empty($this->params['_Token'])) {
$append .= '<p style="display: none;">';
@ -355,7 +355,7 @@ class FormHelper extends AppHelper {
*/
function error($field, $text = null, $options = array()) {
$this->setEntity($field);
$options = am(array('wrap' => true, 'class' => 'error-message', 'escape' => true), $options);
$options = array_merge(array('wrap' => true, 'class' => 'error-message', 'escape' => true), $options);
if ($error = $this->tagIsInvalid()) {
if (is_array($text) && is_numeric($error) && $error > 0) {
@ -487,7 +487,7 @@ class FormHelper extends AppHelper {
function input($fieldName, $options = array()) {
$view =& ClassRegistry::getObject('view');
$this->setEntity($fieldName);
$options = am(array('before' => null, 'between' => null, 'after' => null), $options);
$options = array_merge(array('before' => null, 'between' => null, 'after' => null), $options);
if (!isset($options['type'])) {
$options['type'] = 'text';
@ -559,7 +559,7 @@ class FormHelper extends AppHelper {
if (is_string($div)) {
$divOptions['class'] = $div;
} elseif (is_array($div)) {
$divOptions = am($divOptions, $div);
$divOptions = array_merge($divOptions, $div);
}
if (in_array($this->field(), $this->fieldset['validates'])) {
$divOptions = $this->addClass($divOptions, 'required');
@ -598,13 +598,13 @@ class FormHelper extends AppHelper {
$labelText = $label['text'];
unset($label['text']);
}
$labelAttributes = am($labelAttributes, $label);
$labelAttributes = array_merge($labelAttributes, $label);
} else {
$labelText = $label;
}
if (isset($options['id'])) {
$labelAttributes = am($labelAttributes, array('for' => $options['id']));
$labelAttributes = array_merge($labelAttributes, array('for' => $options['id']));
}
$out = $this->label(null, $labelText, $labelAttributes);
}
@ -667,7 +667,7 @@ class FormHelper extends AppHelper {
$out = $before . $out . $between . $this->file($fieldName, $options);
break;
case 'select':
$options = am(array('options' => array()), $options);
$options = array_merge(array('options' => array()), $options);
$list = $options['options'];
unset($options['options']);
$out = $before . $out . $between . $this->select($fieldName, $list, $selected, $options, $empty);
@ -683,7 +683,7 @@ class FormHelper extends AppHelper {
break;
case 'textarea':
default:
$out = $before . $out . $between . $this->textarea($fieldName, am(array('cols' => '30', 'rows' => '6'), $options));
$out = $before . $out . $between . $this->textarea($fieldName, array_merge(array('cols' => '30', 'rows' => '6'), $options));
break;
}
@ -807,7 +807,7 @@ class FormHelper extends AppHelper {
* @return string An HTML text input element
*/
function text($fieldName, $options = array()) {
$options = $this->__initInputField($fieldName, am(array('type' => 'text'), $options));
$options = $this->__initInputField($fieldName, array_merge(array('type' => 'text'), $options));
$this->__secure();
return $this->output(sprintf($this->Html->tags['input'], $options['name'], $this->_parseAttributes($options, array('name'), null, ' ')));
}
@ -948,7 +948,7 @@ class FormHelper extends AppHelper {
} elseif (is_string($div)) {
$divOptions['class'] = $div;
} elseif (is_array($div)) {
$divOptions = am(array('class' => 'submit'), $div);
$divOptions = array_merge(array('class' => 'submit'), $div);
}
$out = $secured . $this->output(sprintf($this->Html->tags['submit'], $this->_parseAttributes($options, null, '', ' ')));
@ -1043,7 +1043,7 @@ class FormHelper extends AppHelper {
$options[''] = $showEmpty;
$options = array_reverse($options, true);
}
$select = am($select, $this->__selectOptions(array_reverse($options, true), $selected, array(), $showParents, array('escape' => $escapeOptions, 'style' => $style)));
$select = array_merge($select, $this->__selectOptions(array_reverse($options, true), $selected, array(), $showParents, array('escape' => $escapeOptions, 'style' => $style)));
if ($style == 'checkbox') {
if (isset($this->Html->tags['checkboxmultipleend'])) {
@ -1306,7 +1306,7 @@ class FormHelper extends AppHelper {
}
}
$elements = array('Day','Month','Year','Hour','Minute','Meridian');
$attributes = am(array('minYear' => null, 'maxYear' => null, 'separator' => '-'), $attributes);
$attributes = array_merge(array('minYear' => null, 'maxYear' => null, 'separator' => '-'), $attributes);
$minYear = $attributes['minYear'];
$maxYear = $attributes['maxYear'];
$separator = $attributes['separator'];
@ -1414,7 +1414,7 @@ class FormHelper extends AppHelper {
function __selectOptions($elements = array(), $selected = null, $parents = array(), $showParents = null, $attributes = array()) {
$select = array();
$attributes = am(array('escape' => true, 'style' => null), $attributes);
$attributes = array_merge(array('escape' => true, 'style' => null), $attributes);
$selectedIsEmpty = ($selected === '' || $selected === null);
$selectedIsArray = is_array($selected);
@ -1425,7 +1425,7 @@ class FormHelper extends AppHelper {
$select[] = $this->Html->tags['optiongroupend'];
$parents[] = $name;
}
$select = am($select, $this->__selectOptions($title, $selected, $parents, $showParents, $attributes));
$select = array_merge($select, $this->__selectOptions($title, $selected, $parents, $showParents, $attributes));
if (!empty($name)) {
$select[] = sprintf($this->Html->tags['optiongroup'], $name, '');
}

View file

@ -72,7 +72,7 @@ class JavascriptHelper extends AppHelper {
}
$defaultOptions = array('allowCache' => true, 'safe' => true);
$options = am($defaultOptions, $options);
$options = array_merge($defaultOptions, $options);
foreach($defaultOptions as $option => $value) {
if (isset($$option) && $$option !== null) {
@ -165,8 +165,8 @@ class JavascriptHelper extends AppHelper {
* @return string escaped string
*/
function escapeScript($script) {
$script = r(array("\r\n", "\n", "\r"), '\n', $script);
$script = r(array('"', "'"), array('\"', "\\'"), $script);
$script = str_replace(array("\r\n", "\n", "\r"), '\n', $script);
$script = str_replace(array('"', "'"), array('\"', "\\'"), $script);
return $script;
}
/**
@ -184,7 +184,7 @@ class JavascriptHelper extends AppHelper {
*/
function escapeString($string) {
$escape = array("\r\n" => '\n', "\r" => '\n', "\n" => '\n', '"' => '\"', "'" => "\\'");
return r(array_keys($escape), array_values($escape), $string);
return str_replace(array_keys($escape), array_values($escape), $string);
}
/**
* Attach an event to an element. Used with the Prototype library.
@ -203,7 +203,7 @@ class JavascriptHelper extends AppHelper {
}
$defaultOptions = array('useCapture' => false);
$options = am($defaultOptions, $options);
$options = array_merge($defaultOptions, $options);
if ($options['useCapture'] == true) {
$options['useCapture'] = 'true';
@ -299,7 +299,7 @@ class JavascriptHelper extends AppHelper {
if ($this->_cacheToFile) {
$filename = md5($data);
if (!file_exists(JS . $filename . '.js')) {
cache(r(WWW_ROOT, '', JS) . $filename . '.js', $data, '+999 days', 'public');
cache(str_replace(WWW_ROOT, '', JS) . $filename . '.js', $data, '+999 days', 'public');
}
$out = $this->link($filename);
} else {
@ -362,7 +362,7 @@ class JavascriptHelper extends AppHelper {
}
$defaultOptions = array('block' => false, 'prefix' => '', 'postfix' => '', 'stringKeys' => array(), 'quoteKeys' => true, 'q' => '"');
$options = am($defaultOptions, $options);
$options = array_merge($defaultOptions, $options);
foreach($defaultOptions as $option => $value) {
if (isset($$option) && $$option !== null) {

View file

@ -185,7 +185,7 @@ class JsHelper extends Overloadable2 {
*/
function escape($string) {
$escape = array("\r\n" => '\n', "\r" => '\n', "\n" => '\n', '"' => '\"', "'" => "\\'");
return r(array_keys($escape), array_values($escape), $string);
return str_replace(array_keys($escape), array_values($escape), $string);
}
function get__($name) {
@ -333,8 +333,8 @@ class JsHelperObject {
function __call($name, $args) {
$data = '';
if (isset($this->__parent->effectMap[low($name)])) {
array_unshift($args, $this->__parent->effectMap[low($name)]);
if (isset($this->__parent->effectMap[strtolower($name)])) {
array_unshift($args, $this->__parent->effectMap[strtolower($name)]);
$name = 'effect';
}

View file

@ -97,7 +97,7 @@ class PaginatorHelper extends AppHelper {
if (!isset($this->params['paging'])) {
$this->params['paging'] = array();
}
$this->params['paging'] = am($this->params['paging'], $options['paging']);
$this->params['paging'] = array_merge($this->params['paging'], $options['paging']);
unset($options['paging']);
}
@ -106,10 +106,10 @@ class PaginatorHelper extends AppHelper {
if (!isset($this->params['paging'][$model])) {
$this->params['paging'][$model] = array();
}
$this->params['paging'][$model] = am($this->params['paging'][$model], $options[$model]);
$this->params['paging'][$model] = array_merge($this->params['paging'][$model], $options[$model]);
unset($options[$model]);
}
$this->options = array_filter(am($this->options, $options));
$this->options = array_filter(array_merge($this->options, $options));
}
/**
* Gets the current page of the recordset for the given model
@ -136,7 +136,7 @@ class PaginatorHelper extends AppHelper {
function sortKey($model = null, $options = array()) {
if (empty($options)) {
$params = $this->params($model);
$options = am($params['defaults'], $params['options']);
$options = array_merge($params['defaults'], $params['options']);
}
if (isset($options['sort']) && !empty($options['sort'])) {
@ -163,13 +163,13 @@ class PaginatorHelper extends AppHelper {
if (empty($options)) {
$params = $this->params($model);
$options = am($params['defaults'], $params['options']);
$options = array_merge($params['defaults'], $params['options']);
}
if (isset($options['direction'])) {
$dir = low($options['direction']);
$dir = strtolower($options['direction']);
} elseif (isset($options['order']) && is_array($options['order'])) {
$dir = low(current($options['order']));
$dir = strtolower(current($options['order']));
}
if ($dir == 'desc') {
@ -212,7 +212,7 @@ class PaginatorHelper extends AppHelper {
* key the returned link will sort by 'desc'.
*/
function sort($title, $key = null, $options = array()) {
$options = am(array('url' => array(), 'model' => null), $options);
$options = array_merge(array('url' => array(), 'model' => null), $options);
$url = $options['url'];
unset($options['url']);
@ -226,7 +226,7 @@ class PaginatorHelper extends AppHelper {
$dir = 'desc';
}
$url = am(array('sort' => $key, 'direction' => $dir), $url, array('order' => null));
$url = array_merge(array('sort' => $key, 'direction' => $dir), $url, array('order' => null));
return $this->link($title, $url, $options);
}
/**
@ -238,12 +238,12 @@ class PaginatorHelper extends AppHelper {
* @return string A link with pagination parameters.
*/
function link($title, $url = array(), $options = array()) {
$options = am(array('model' => null, 'escape' => true), $options);
$options = array_merge(array('model' => null, 'escape' => true), $options);
$model = $options['model'];
unset($options['model']);
if (!empty($this->options)) {
$options = am($this->options, $options);
$options = array_merge($this->options, $options);
}
$paging = $this->params($model);
@ -252,7 +252,7 @@ class PaginatorHelper extends AppHelper {
$urlOption = $options['url'];
unset($options['url']);
}
$url = am(array_filter(Set::diff(am($paging['defaults'], $paging['options']), $paging['defaults'])), $urlOption, $url);
$url = array_merge(array_filter(Set::diff(array_merge($paging['defaults'], $paging['options']), $paging['defaults'])), (array)$urlOption, (array)$url);
if (isset($url['order'])) {
$sort = $direction = null;
@ -260,11 +260,11 @@ class PaginatorHelper extends AppHelper {
list($sort, $direction) = array($this->sortKey($model, $url), current($url['order']));
}
unset($url['order']);
$url = am($url, compact('sort', 'direction'));
$url = array_merge($url, compact('sort', 'direction'));
}
$obj = isset($options['update']) ? 'Ajax' : 'Html';
$url = am(array('page' => $this->current($model)), $url);
$url = array_merge(array('page' => $this->current($model)), $url);
return $this->{$obj}->link($title, Set::filter($url, true), $options);
}
/**
@ -277,14 +277,14 @@ class PaginatorHelper extends AppHelper {
'url' => array(), 'step' => 1,
'escape' => true, 'model' => null
);
$options = am($_defaults, $options);
$options = array_merge($_defaults, $options);
$paging = $this->params($options['model']);
if (!$this->{$check}() && (!empty($disabledTitle) || !empty($disabledOptions))) {
if (!empty($disabledTitle) && $disabledTitle !== true) {
$title = $disabledTitle;
}
$options = am($options, $disabledOptions);
$options = array_merge($options, $disabledOptions);
} elseif (!$this->{$check}()) {
return null;
}
@ -293,10 +293,10 @@ class PaginatorHelper extends AppHelper {
${$key} = $options[$key];
unset($options[$key]);
}
$url = am(array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)), $url);
$url = array_merge(array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step)), $url);
if ($this->{$check}()) {
return $this->link($title, $url, am($options, array('escape' => $escape)));
return $this->link($title, $url, array_merge($options, array('escape' => $escape)));
} else {
return $this->Html->div(null, $title, $options, $escape);
}
@ -373,7 +373,7 @@ class PaginatorHelper extends AppHelper {
$options = array('format' => $options);
}
$options = am(
$options = array_merge(
array(
'model' => $this->defaultModel(),
'format' => 'pages',
@ -406,7 +406,7 @@ class PaginatorHelper extends AppHelper {
'%start%' => $start,
'%end%' => $end
);
$out = r(array_keys($replace), array_values($replace), $options['format']);
$out = str_replace(array_keys($replace), array_values($replace), $options['format']);
break;
}
return $this->output($out);
@ -419,7 +419,7 @@ class PaginatorHelper extends AppHelper {
* @return string numbers string.
*/
function numbers($options = array()) {
$options = am(
$options = array_merge(
array(
'before'=> null,
'after'=> null,
@ -427,9 +427,9 @@ class PaginatorHelper extends AppHelper {
'modulus' => '8',
'separator' => ' | '
),
$options);
(array)$options);
$params = am(array('page'=> 1), $this->params($options['model']));
$params = array_merge(array('page'=> 1), (array)$this->params($options['model']));
unset($options['model']);
if ($params['pageCount'] <= 1) {

View file

@ -112,7 +112,7 @@ class RssHelper extends XmlHelper {
$attrib['version'] = $this->version;
}
$attrib = array_reverse(am($this->__prepareNamespaces(), $attrib));
$attrib = array_reverse(array_merge($this->__prepareNamespaces(), $attrib));
return $this->elem('rss', $attrib, $content);
}
/**

View file

@ -110,7 +110,7 @@ class TextHelper extends AppHelper {
'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text);
return preg_replace_callback('#(?<!href="|">)(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])#i',
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . low($matches[0]),' . $options . ');'), $text);
create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text);
}
/**
* Adds email links (<a href="mailto:....) to a given text.
@ -200,7 +200,7 @@ class TextHelper extends AppHelper {
$radius = strlen($phrase);
}
$pos = strpos(low($text), low($phrase));
$pos = strpos(strtolower($text), strtolower($phrase));
$startPos = ife($pos <= $radius, 0, $pos - $radius);
$endPos = ife($pos + strlen($phrase) + $radius >= strlen($text), strlen($text), $pos + strlen($phrase) + $radius);
$excerpt = substr($text, $startPos, $endPos - $startPos);

View file

@ -88,7 +88,7 @@ class XmlHelper extends AppHelper {
* @return string XML header
*/
function header($attrib = array()) {
$attrib = am(array('version' => '1.0', 'encoding' => $this->encoding), $attrib);
$attrib = array_merge(array('version' => '1.0', 'encoding' => $this->encoding), $attrib);
return $this->output('<' . '?xml' . $this->__composeAttributes($attrib) . ' ?' . '>');
}
/**
@ -247,7 +247,7 @@ class XmlHelper extends AppHelper {
if (!class_exists('XML') && !class_exists('xml')) {
uses('xml');
}
$options = am(array('attributes' => false, 'format' => 'xml'), $options);
$options = array_merge(array('attributes' => false, 'format' => 'xml'), $options);
switch ($options['format']) {
case 'xml':

View file

@ -114,7 +114,7 @@ class ThemeView extends View {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$file = null;
foreach ($viewPaths as $path) {
@ -186,7 +186,7 @@ class ThemeView extends View {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$name = $this->viewPath . DS . $this->subDir . $type . $action;
foreach ($viewPaths as $path) {
@ -233,7 +233,7 @@ class ThemeView extends View {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$name = $this->subDir . $type . $this->layout;
foreach ($viewPaths as $path) {

View file

@ -371,7 +371,7 @@ class View extends Object {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$file = null;
foreach ($viewPaths as $path) {
@ -656,7 +656,7 @@ class View extends Object {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$name = $this->viewPath . DS . $this->subDir . $type . $action;
foreach ($viewPaths as $path) {
@ -700,7 +700,7 @@ class View extends Object {
}
$paths = Configure::getInstance();
$viewPaths = am($this->pluginPaths, $paths->viewPaths);
$viewPaths = array_merge($this->pluginPaths, $paths->viewPaths);
$name = $this->subDir . $type . $this->layout;
foreach ($viewPaths as $path) {

View file

@ -129,7 +129,7 @@ class XMLNode extends Object {
} else {
$name = get_class($object);
}
if ($name != low($name)) {
if ($name != strtolower($name)) {
$name = Inflector::underscore($name);
}
@ -559,7 +559,7 @@ class XML extends XMLNode {
* @see load()
*/
function parse() {
$this->header = trim(r(a('<'.'?', '?'.'>'), a('', ''), substr(trim($this->__rawData), 0, strpos($this->__rawData, "\n"))));
$this->header = trim(str_replace(a('<'.'?', '?'.'>'), a('', ''), substr(trim($this->__rawData), 0, strpos($this->__rawData, "\n"))));
xml_parse_into_struct($this->__parser, $this->__rawData, $vals);
$xml = new XMLNode();

View file

@ -222,7 +222,7 @@ class NumberTreeCase extends CakeTestCase {
$this->NumberTree->create();
$saveSuccess = $this->NumberTree->save(array('NumberTree' => array('name' => 'testAddMiddle', 'parent_id' => $data['NumberTree']['id'])));
$this->assertIdentical($saveSuccess, true);
$this->assertTrue(is_array($saveSuccess));
$laterCount = $this->NumberTree->findCount();