From df9e1e0bd1a1445e3854c41f5af6d1f2a7679476 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Thu, 19 Nov 2009 20:13:35 -0200 Subject: [PATCH] Replace function join (alias) by implode. Signed-off-by: Mark Story --- cake/basics.php | 4 +- cake/console/libs/console.php | 2 +- cake/console/libs/tasks/controller.php | 6 +-- cake/console/libs/tasks/extract.php | 14 +++---- cake/console/libs/tasks/model.php | 12 +++--- .../skel/controllers/pages_controller.php | 2 +- cake/libs/controller/components/security.php | 2 +- cake/libs/controller/pages_controller.php | 2 +- cake/libs/debugger.php | 8 ++-- cake/libs/flay.php | 2 +- cake/libs/http_socket.php | 8 ++-- cake/libs/inflector.php | 8 ++-- cake/libs/model/behaviors/containable.php | 2 +- cake/libs/model/datasources/dbo/dbo_mssql.php | 4 +- cake/libs/model/datasources/dbo/dbo_mysql.php | 8 ++-- .../libs/model/datasources/dbo/dbo_oracle.php | 8 ++-- .../model/datasources/dbo/dbo_postgres.php | 10 ++--- .../libs/model/datasources/dbo/dbo_sqlite.php | 4 +- cake/libs/model/datasources/dbo_source.php | 38 +++++++++---------- cake/libs/model/model.php | 4 +- cake/libs/model/schema.php | 10 ++--- cake/libs/router.php | 8 ++-- cake/libs/set.php | 2 +- cake/libs/view/helper.php | 4 +- cake/libs/view/helpers/ajax.php | 8 ++-- cake/libs/view/helpers/form.php | 6 +-- cake/libs/view/helpers/html.php | 12 +++--- cake/libs/view/helpers/javascript.php | 4 +- cake/libs/view/helpers/js.php | 8 ++-- cake/libs/view/helpers/rss.php | 4 +- cake/libs/view/view.php | 2 +- cake/tests/lib/cake_test_case.php | 4 +- cake/tests/lib/test_manager.php | 2 +- 33 files changed, 111 insertions(+), 111 deletions(-) diff --git a/cake/basics.php b/cake/basics.php index 8a9c7b527..0659d28ec 100644 --- a/cake/basics.php +++ b/cake/basics.php @@ -423,7 +423,7 @@ if (!function_exists('file_put_contents')) { /** * Writes data into file. * - * If file exists, it will be overwritten. If data is an array, it will be join()ed with an empty string. + * If file exists, it will be overwritten. If data is an array, it will be implode()ed with an empty string. * * @param string $fileName File name. * @param mixed $data String or array. @@ -431,7 +431,7 @@ if (!function_exists('file_put_contents')) { */ function file_put_contents($fileName, $data) { if (is_array($data)) { - $data = join('', $data); + $data = implode('', $data); } $res = @fopen($fileName, 'w+b'); diff --git a/cake/console/libs/console.php b/cake/console/libs/console.php index 19b075092..189da32e8 100644 --- a/cake/console/libs/console.php +++ b/cake/console/libs/console.php @@ -286,7 +286,7 @@ class ConsoleShell extends Shell { break; case (preg_match("/^routes\s+show/i", $command, $tmp) == true): $router =& Router::getInstance(); - $this->out(join("\n", Set::extract($router->routes, '{n}.0'))); + $this->out(implode("\n", Set::extract($router->routes, '{n}.0'))); break; case (preg_match("/^route\s+(.*)/i", $command, $tmp) == true): $this->out(var_export(Router::parse($tmp[1]), true)); diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index c49735ed8..428cdcebe 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -126,7 +126,7 @@ class ControllerTask extends Shell { if (file_exists($this->path . $controllerFile .'_controller.php')) { $question[] = sprintf(__("Warning: Choosing no will overwrite the %sController.", true), $controllerName); } - $doItInteractive = $this->in(join("\n", $question), array('y','n'), 'y'); + $doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y'); if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes') { $this->interactive = true; @@ -313,7 +313,7 @@ class ControllerTask extends Shell { } } if (!empty($compact)) { - $actions .= "\t\t\$this->set(compact(" . join(', ', $compact) . "));\n"; + $actions .= "\t\t\$this->set(compact(" . implode(', ', $compact) . "));\n"; } $actions .= "\t}\n"; $actions .= "\n"; @@ -365,7 +365,7 @@ class ControllerTask extends Shell { } } if (!empty($compact)) { - $actions .= "\t\t\$this->set(compact(" . join(',', $compact) . "));\n"; + $actions .= "\t\t\$this->set(compact(" . implode(',', $compact) . "));\n"; } $actions .= "\t}\n"; $actions .= "\n"; diff --git a/cake/console/libs/tasks/extract.php b/cake/console/libs/tasks/extract.php index 7918e8cd7..1e4f75e9e 100644 --- a/cake/console/libs/tasks/extract.php +++ b/cake/console/libs/tasks/extract.php @@ -414,13 +414,13 @@ class ExtractTask extends Shell{ if ($this->__oneFile === true) { foreach ($fileInfo as $file => $lines) { - $occured[] = "$file:" . join(';', $lines); + $occured[] = "$file:" . implode(';', $lines); if (isset($this->__fileVersions[$file])) { $fileList[] = $this->__fileVersions[$file]; } } - $occurances = join("\n#: ", $occured); + $occurances = implode("\n#: ", $occured); $occurances = str_replace($this->path, '', $occurances); $output = "#: $occurances\n"; $filename = $this->__filename; @@ -439,12 +439,12 @@ class ExtractTask extends Shell{ } else { foreach ($fileInfo as $file => $lines) { $filename = $str; - $occured = array("$str:" . join(';', $lines)); + $occured = array("$str:" . implode(';', $lines)); if (isset($this->__fileVersions[$str])) { $fileList[] = $this->__fileVersions[$str]; } - $occurances = join("\n#: ", $occured); + $occurances = implode("\n#: ", $occured); $occurances = str_replace($this->path, '', $occurances); $output .= "#: $occurances\n"; @@ -511,9 +511,9 @@ class ExtractTask extends Shell{ $fileList = str_replace(array($this->path), '', $fileList); if (count($fileList) > 1) { - $fileList = "Generated from files:\n# " . join("\n# ", $fileList); + $fileList = "Generated from files:\n# " . implode("\n# ", $fileList); } elseif (count($fileList) == 1) { - $fileList = 'Generated from file: ' . join('', $fileList); + $fileList = 'Generated from file: ' . implode('', $fileList); } else { $fileList = 'No version information was available in the source files.'; } @@ -535,7 +535,7 @@ class ExtractTask extends Shell{ } } $fp = fopen($this->__output . $file, 'w'); - fwrite($fp, str_replace('--VERSIONS--', $fileList, join('', $content))); + fwrite($fp, str_replace('--VERSIONS--', $fileList, implode('', $content))); fclose($fp); } } diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 0292f74ae..654911932 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -700,7 +700,7 @@ class ModelTask extends Shell { } } } - $fixture = join(", ", $fixture); + $fixture = implode(", ", $fixture); $import = $className; if (isset($this->plugin)) { @@ -904,24 +904,24 @@ class ModelTask extends Shell { } $records[] = "\t\t'$field' => $insert"; unset($value['type']); - $col .= join(', ', $schema->__values($value)); + $col .= implode(', ', $schema->__values($value)); } else { $col = "\t\t'indexes' => array("; $props = array(); foreach ((array)$value as $key => $index) { - $props[] = "'{$key}' => array(" . join(', ', $schema->__values($index)) . ")"; + $props[] = "'{$key}' => array(" . implode(', ', $schema->__values($index)) . ")"; } - $col .= join(', ', $props); + $col .= implode(', ', $props); } $col .= ")"; $cols[] = $col; } - $out .= join(",\n", $cols); + $out .= implode(",\n", $cols); } $out .= "\n\t);\n"; } } - $records = join(",\n", $records); + $records = implode(",\n", $records); $out .= "\tvar \$records = array(array(\n$records\n\t));\n"; $out .= "}\n"; $path = TESTS . DS . 'fixtures' . DS; diff --git a/cake/console/libs/templates/skel/controllers/pages_controller.php b/cake/console/libs/templates/skel/controllers/pages_controller.php index 8196616ba..7013b6e17 100644 --- a/cake/console/libs/templates/skel/controllers/pages_controller.php +++ b/cake/console/libs/templates/skel/controllers/pages_controller.php @@ -79,7 +79,7 @@ class PagesController extends AppController { $title = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title')); - $this->render(join('/', $path)); + $this->render(implode('/', $path)); } } diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index 64e0af936..2e44f45e6 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -327,7 +327,7 @@ class SecurityComponent extends Object { $out[] = 'opaque="' . md5($options['realm']).'"'; } - return $auth . ' ' . join(',', $out); + return $auth . ' ' . implode(',', $out); } /** * Parses an HTTP digest authentication response, and returns an array of the data, or null on failure. diff --git a/cake/libs/controller/pages_controller.php b/cake/libs/controller/pages_controller.php index 8196616ba..7013b6e17 100644 --- a/cake/libs/controller/pages_controller.php +++ b/cake/libs/controller/pages_controller.php @@ -79,7 +79,7 @@ class PagesController extends AppController { $title = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title')); - $this->render(join('/', $path)); + $this->render(implode('/', $path)); } } diff --git a/cake/libs/debugger.php b/cake/libs/debugger.php index b5693da97..42d47916c 100644 --- a/cake/libs/debugger.php +++ b/cake/libs/debugger.php @@ -275,7 +275,7 @@ class Debugger extends Object { foreach ($next['args'] as $arg) { $args[] = Debugger::exportVar($arg); } - $function .= join(', ', $args); + $function .= implode(', ', $args); } $function .= ')'; } @@ -297,7 +297,7 @@ class Debugger extends Object { if ($options['format'] == 'array' || $options['format'] == 'points') { return $back; } - return join("\n", $back); + return implode("\n", $back); } /** * Shortens file paths by replacing the application base path with 'APP', and the CakePHP core @@ -406,7 +406,7 @@ class Debugger extends Object { if (count($vars) > 0) { $n = "\n"; } - return $out . join(",", $vars) . "{$n})"; + return $out . implode(",", $vars) . "{$n})"; break; case 'resource': return strtolower(gettype($var)); @@ -444,7 +444,7 @@ class Debugger extends Object { $out[] = "$className::$$key = " . $value; } } - return join("\n", $out); + return implode("\n", $out); } /** * Handles object conversion to debug string. diff --git a/cake/libs/flay.php b/cake/libs/flay.php index ed23cf7f4..7d33b4a5e 100644 --- a/cake/libs/flay.php +++ b/cake/libs/flay.php @@ -217,7 +217,7 @@ class Flay extends Object{ if (count($snips) > $max_snippets) { $snips = array_slice($snips, 0, $max_snippets); } - $joined = join(' ... ', $snips); + $joined = implode(' ... ', $snips); $snips = $joined ? "... {$joined} ..." : substr($string, 0, 80) . '...'; return $this->colorMark($words, $snips); } diff --git a/cake/libs/http_socket.php b/cake/libs/http_socket.php index 97d2e080b..d0bf021df 100644 --- a/cake/libs/http_socket.php +++ b/cake/libs/http_socket.php @@ -738,7 +738,7 @@ class HttpSocket extends CakeSocket { $request['uri'] = $this->buildUri($request['uri'], '/%path?%query'); if (!$this->quirksMode && $request['uri'] === '*' && !in_array($request['method'], $asteriskMethods)) { - trigger_error(sprintf(__('HttpSocket::buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), join(',', $asteriskMethods)), E_USER_WARNING); + trigger_error(sprintf(__('HttpSocket::buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), implode(',', $asteriskMethods)), E_USER_WARNING); return false; } return $request['method'].' '.$request['uri'].' '.$versionToken.$this->lineBreak; @@ -776,7 +776,7 @@ class HttpSocket extends CakeSocket { $returnHeader = ''; foreach ($header as $field => $contents) { if (is_array($contents) && $mode == 'standard') { - $contents = join(',', $contents); + $contents = implode(',', $contents); } foreach ((array)$contents as $content) { $contents = preg_replace("/\r\n(?![\t ])/", "\r\n ", $content); @@ -921,7 +921,7 @@ class HttpSocket extends CakeSocket { * @todo Test $chars parameter */ function unescapeToken($token, $chars = null) { - $regex = '/"(['.join('', $this->__tokenEscapeChars(true, $chars)).'])"/'; + $regex = '/"(['.implode('', $this->__tokenEscapeChars(true, $chars)).'])"/'; $token = preg_replace($regex, '\\1', $token); return $token; } @@ -934,7 +934,7 @@ class HttpSocket extends CakeSocket { * @todo Test $chars parameter */ function escapeToken($token, $chars = null) { - $regex = '/(['.join('', $this->__tokenEscapeChars(true, $chars)).'])/'; + $regex = '/(['.implode('', $this->__tokenEscapeChars(true, $chars)).'])/'; $token = preg_replace($regex, '"\\1"', $token); return $token; } diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 863072dfd..66a9f10bd 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -243,8 +243,8 @@ class Inflector extends Object { extract($_this->pluralRules); if (!isset($regexUninflected) || !isset($regexIrregular)) { - $regexUninflected = __enclose(join( '|', $uninflected)); - $regexIrregular = __enclose(join( '|', array_keys($irregular))); + $regexUninflected = __enclose(implode( '|', $uninflected)); + $regexIrregular = __enclose(implode( '|', array_keys($irregular))); $_this->pluralRules['regexUninflected'] = $regexUninflected; $_this->pluralRules['regexIrregular'] = $regexIrregular; } @@ -383,8 +383,8 @@ class Inflector extends Object { extract($_this->singularRules); if (!isset($regexUninflected) || !isset($regexIrregular)) { - $regexUninflected = __enclose(join( '|', $uninflected)); - $regexIrregular = __enclose(join( '|', array_keys($irregular))); + $regexUninflected = __enclose(implode( '|', $uninflected)); + $regexIrregular = __enclose(implode( '|', array_keys($irregular))); $_this->singularRules['regexUninflected'] = $regexUninflected; $_this->singularRules['regexIrregular'] = $regexIrregular; } diff --git a/cake/libs/model/behaviors/containable.php b/cake/libs/model/behaviors/containable.php index 9bec011a2..b5e8eadf9 100644 --- a/cake/libs/model/behaviors/containable.php +++ b/cake/libs/model/behaviors/containable.php @@ -283,7 +283,7 @@ class ContainableBehavior extends ModelBehavior { if (strpos($name, '.') !== false) { $chain = explode('.', $name); $name = array_shift($chain); - $children = array(join('.', $chain) => $children); + $children = array(implode('.', $chain) => $children); } $children = (array)$children; diff --git a/cake/libs/model/datasources/dbo/dbo_mssql.php b/cake/libs/model/datasources/dbo/dbo_mssql.php index 9e5cad49a..09e9d1ab7 100644 --- a/cake/libs/model/datasources/dbo/dbo_mssql.php +++ b/cake/libs/model/datasources/dbo/dbo_mssql.php @@ -591,7 +591,7 @@ class DboMssql extends DboSource { foreach (array('columns', 'indexes') as $var) { if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); + ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); } } return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}"; @@ -719,7 +719,7 @@ class DboMssql extends DboSource { $out = "ALTER TABLE {$table} ADD CONSTRAINT {$name} UNIQUE"; if (is_array($value['column'])) { - $value['column'] = join(', ', array_map(array(&$this, 'name'), $value['column'])); + $value['column'] = implode(', ', array_map(array(&$this, 'name'), $value['column'])); } else { $value['column'] = $this->name($value['column']); } diff --git a/cake/libs/model/datasources/dbo/dbo_mysql.php b/cake/libs/model/datasources/dbo/dbo_mysql.php index ef61cb675..395d2a78f 100644 --- a/cake/libs/model/datasources/dbo/dbo_mysql.php +++ b/cake/libs/model/datasources/dbo/dbo_mysql.php @@ -141,7 +141,7 @@ class DboMysqlBase extends DboSource { $alias = $joins = false; $fields = $this->_prepareUpdateFields($model, $combined, empty($conditions), !empty($conditions)); - $fields = join(', ', $fields); + $fields = implode(', ', $fields); $table = $this->fullTableName($model); if (!empty($conditions)) { @@ -281,7 +281,7 @@ class DboMysqlBase extends DboSource { } } $colList = array_merge($colList, $this->_alterIndexes($curTable, $indexes)); - $out .= "\t" . join(",\n\t", $colList) . ";\n\n"; + $out .= "\t" . implode(",\n\t", $colList) . ";\n\n"; } } return $out; @@ -339,7 +339,7 @@ class DboMysqlBase extends DboSource { } } if (is_array($value['column'])) { - $out .= 'KEY '. $name .' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; + $out .= 'KEY '. $name .' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; } else { $out .= 'KEY '. $name .' (' . $this->name($value['column']) . ')'; } @@ -358,7 +358,7 @@ class DboMysqlBase extends DboSource { function insertMulti($table, $fields, $values) { $table = $this->fullTableName($table); if (is_array($fields)) { - $fields = join(', ', array_map(array(&$this, 'name'), $fields)); + $fields = implode(', ', array_map(array(&$this, 'name'), $fields)); } $values = implode(', ', $values); $this->query("INSERT INTO {$table} ({$fields}) VALUES {$values}"); diff --git a/cake/libs/model/datasources/dbo/dbo_oracle.php b/cake/libs/model/datasources/dbo/dbo_oracle.php index a71a4b1e2..92c81e897 100644 --- a/cake/libs/model/datasources/dbo/dbo_oracle.php +++ b/cake/libs/model/datasources/dbo/dbo_oracle.php @@ -704,7 +704,7 @@ class DboOracle extends DboSource { break; } } - $out .= "\t" . join(",\n\t", $colList) . ";\n\n"; + $out .= "\t" . implode(",\n\t", $colList) . ";\n\n"; } } return $out; @@ -925,7 +925,7 @@ class DboOracle extends DboSource { case 'schema': foreach (array('columns', 'indexes') as $var) { if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); + ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); } } if (trim($indexes) != '') { @@ -977,7 +977,7 @@ class DboOracle extends DboSource { $fetch = array(); $ins = array_chunk($ins, 1000); foreach ($ins as $i) { - $q = str_replace('{$__cakeID__$}', join(', ', $i), $query); + $q = str_replace('{$__cakeID__$}', implode(', ', $i), $query); $q = str_replace('= (', 'IN (', $q); $res = $this->fetchAll($q, $model->cacheQueries, $model->alias); $fetch = array_merge($fetch, $res); @@ -1021,7 +1021,7 @@ class DboOracle extends DboSource { $fetch = array(); $ins = array_chunk($ins, 1000); foreach ($ins as $i) { - $q = str_replace('{$__cakeID__$}', '(' .join(', ', $i) .')', $query); + $q = str_replace('{$__cakeID__$}', '(' .implode(', ', $i) .')', $query); $q = str_replace('= (', 'IN (', $q); $q = str_replace(' WHERE 1 = 1', '', $q); diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index 3ea5d8fa0..9dc21da27 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -539,11 +539,11 @@ class DboPostgres extends DboSource { } if (!empty($colList)) { - $out .= "\t" . join(",\n\t", $colList) . ";\n\n"; + $out .= "\t" . implode(",\n\t", $colList) . ";\n\n"; } else { $out = ''; } - $out .= join(";\n\t", $this->_alterIndexes($curTable, $indexes)) . ";"; + $out .= implode(";\n\t", $this->_alterIndexes($curTable, $indexes)) . ";"; } } return $out; @@ -580,7 +580,7 @@ class DboPostgres extends DboSource { $out .= 'INDEX '; } if (is_array($value['column'])) { - $out .= $name . ' ON ' . $table . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; + $out .= $name . ' ON ' . $table . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; } else { $out .= $name . ' ON ' . $table . ' (' . $this->name($value['column']) . ')'; } @@ -829,7 +829,7 @@ class DboPostgres extends DboSource { $out .= 'UNIQUE '; } if (is_array($value['column'])) { - $value['column'] = join(', ', array_map(array(&$this, 'name'), $value['column'])); + $value['column'] = implode(', ', array_map(array(&$this, 'name'), $value['column'])); } else { $value['column'] = $this->name($value['column']); } @@ -862,7 +862,7 @@ class DboPostgres extends DboSource { foreach (array('columns', 'indexes') as $var) { if (is_array(${$var})) { - ${$var} = join($join[$var], array_filter(${$var})); + ${$var} = implode($join[$var], array_filter(${$var})); } } return "CREATE TABLE {$table} (\n\t{$columns}\n);\n{$indexes}"; diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index 005ffc6fe..1423aadcf 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php @@ -529,7 +529,7 @@ class DboSqlite extends DboSource { $out .= 'UNIQUE '; } if (is_array($value['column'])) { - $value['column'] = join(', ', array_map(array(&$this, 'name'), $value['column'])); + $value['column'] = implode(', ', array_map(array(&$this, 'name'), $value['column'])); } else { $value['column'] = $this->name($value['column']); } @@ -589,7 +589,7 @@ class DboSqlite extends DboSource { foreach (array('columns', 'indexes') as $var) { if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); + ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); } } return "CREATE TABLE {$table} (\n{$columns});\n{$indexes}"; diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index ec154f25e..a48a3c6a2 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -580,8 +580,8 @@ class DboSource extends DataSource { } $query = array( 'table' => $this->fullTableName($model), - 'fields' => join(', ', $fieldInsert), - 'values' => join(', ', $valueInsert) + 'fields' => implode(', ', $fieldInsert), + 'values' => implode(', ', $valueInsert) ); if ($this->execute($this->renderStatement('create', $query))) { @@ -796,7 +796,7 @@ class DboSource extends DataSource { } if (!empty($ins)) { if (count($ins) > 1) { - $query = str_replace('{$__cakeID__$}', '(' .join(', ', $ins) .')', $query); + $query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query); $query = str_replace('= (', 'IN (', $query); $query = str_replace('= (', 'IN (', $query); } else { @@ -895,7 +895,7 @@ class DboSource extends DataSource { * @return array Association results */ function fetchAssociated($model, $query, $ids) { - $query = str_replace('{$__cakeID__$}', join(', ', $ids), $query); + $query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query); if (count($ids) > 1) { $query = str_replace('= (', 'IN (', $query); $query = str_replace('= (', 'IN (', $query); @@ -1272,12 +1272,12 @@ class DboSource extends DataSource { } return $this->renderStatement('select', array( 'conditions' => $this->conditions($query['conditions'], true, true, $model), - 'fields' => join(', ', $query['fields']), + 'fields' => implode(', ', $query['fields']), 'table' => $query['table'], 'alias' => $this->alias . $this->name($query['alias']), 'order' => $this->order($query['order']), 'limit' => $this->limit($query['limit'], $query['offset']), - 'joins' => join(' ', $query['joins']), + 'joins' => implode(' ', $query['joins']), 'group' => $this->group($query['group']) )); } @@ -1324,7 +1324,7 @@ class DboSource extends DataSource { case 'schema': foreach (array('columns', 'indexes') as $var) { if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); + ${$var} = "\t" . implode(",\n\t", array_filter(${$var})); } } if (trim($indexes) != '') { @@ -1378,7 +1378,7 @@ class DboSource extends DataSource { } else { $combined = array_combine($fields, $values); } - $fields = join(', ', $this->_prepareUpdateFields($model, $combined, empty($conditions))); + $fields = implode(', ', $this->_prepareUpdateFields($model, $combined, empty($conditions))); $alias = $joins = null; $table = $this->fullTableName($model); @@ -1728,7 +1728,7 @@ class DboSource extends DataSource { } else { $field[0] = explode('.', $field[1]); if (!Set::numeric($field[0])) { - $field[0] = join('.', array_map(array($this, 'name'), $field[0])); + $field[0] = implode('.', array_map(array($this, 'name'), $field[0])); $fields[$i] = preg_replace('/\(' . $field[1] . '\)/', '(' . $field[0] . ')', $fields[$i], 1); } } @@ -1760,7 +1760,7 @@ class DboSource extends DataSource { if (empty($out)) { return $clause . ' 1 = 1'; } - return $clause . join(' AND ', $out); + return $clause . implode(' AND ', $out); } if (empty($conditions) || trim($conditions) == '' || $conditions === true) { @@ -1829,7 +1829,7 @@ class DboSource extends DataSource { $out[] = $value[0] ; } } else { - $out[] = '(' . $not . '(' . join(') ' . strtoupper($key) . ' (', $value) . '))'; + $out[] = '(' . $not . '(' . implode(') ' . strtoupper($key) . ' (', $value) . '))'; } } else { @@ -1856,13 +1856,13 @@ class DboSource extends DataSource { if (is_object($model)) { $columnType = $model->getColumnType($key); } - $data .= join(', ', $this->value($value, $columnType)); + $data .= implode(', ', $this->value($value, $columnType)); } $data .= ')'; } else { $ret = $this->conditionKeysToString($value, $quoteValues, $model); if (count($ret) > 1) { - $data = '(' . join(') AND (', $ret) . ')'; + $data = '(' . implode(') AND (', $ret) . ')'; } elseif (isset($ret[0])) { $data = $ret[0]; } @@ -1896,7 +1896,7 @@ class DboSource extends DataSource { * @access private */ function __parseKey($model, $key, $value) { - $operatorMatch = '/^((' . join(')|(', $this->__sqlOps); + $operatorMatch = '/^((' . implode(')|(', $this->__sqlOps); $operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is'; $bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false)); @@ -1942,7 +1942,7 @@ class DboSource extends DataSource { $operator = trim($operator); if (is_array($value)) { - $value = join(', ', $value); + $value = implode(', ', $value); switch ($operator) { case '=': @@ -2069,7 +2069,7 @@ class DboSource extends DataSource { } $order[] = $this->order($key . $value); } - return ' ORDER BY ' . trim(str_replace('ORDER BY', '', join(',', $order))); + return ' ORDER BY ' . trim(str_replace('ORDER BY', '', implode(',', $order))); } $keys = preg_replace('/ORDER\\x20BY/i', '', $keys); @@ -2100,7 +2100,7 @@ class DboSource extends DataSource { function group($group) { if ($group) { if (is_array($group)) { - $group = join(', ', $group); + $group = implode(', ', $group); } return ' GROUP BY ' . $this->__quoteFields($group); } @@ -2224,7 +2224,7 @@ class DboSource extends DataSource { function insertMulti($table, $fields, $values) { $table = $this->fullTableName($table); if (is_array($fields)) { - $fields = join(', ', array_map(array(&$this, 'name'), $fields)); + $fields = implode(', ', array_map(array(&$this, 'name'), $fields)); } $count = count($values); for ($x = 0; $x < $count; $x++) { @@ -2396,7 +2396,7 @@ class DboSource extends DataSource { $name = $this->startQuote . $name . $this->endQuote; } if (is_array($value['column'])) { - $out .= 'KEY ' . $name . ' (' . join(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; + $out .= 'KEY ' . $name . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; } else { $out .= 'KEY ' . $name . ' (' . $this->name($value['column']) . ')'; } diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index 4f1934def..bfc24f4ba 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1340,7 +1340,7 @@ class Model extends Overloadable { if ($isUUID && $primaryAdded) { $values[] = $db->value(String::uuid()); } - $values = join(',', $values); + $values = implode(',', $values); $newValues[] = "({$values})"; unset($values); } elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) { @@ -1368,7 +1368,7 @@ class Model extends Overloadable { } if (!empty($newValues)) { - $fields = join(',', $fields); + $fields = implode(',', $fields); $db->insertMulti($this->{$join}, $fields, $newValues); } } diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php index d03689926..d607dbf57 100644 --- a/cake/libs/model/schema.php +++ b/cake/libs/model/schema.php @@ -334,19 +334,19 @@ class CakeSchema extends Object { } $col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', "; unset($value['type']); - $col .= join(', ', $this->__values($value)); + $col .= implode(', ', $this->__values($value)); } else { $col = "\t\t'indexes' => array("; $props = array(); foreach ((array)$value as $key => $index) { - $props[] = "'{$key}' => array(" . join(', ', $this->__values($index)) . ")"; + $props[] = "'{$key}' => array(" . implode(', ', $this->__values($index)) . ")"; } - $col .= join(', ', $props); + $col .= implode(', ', $props); } $col .= ")"; $cols[] = $col; } - $out .= join(",\n", $cols); + $out .= implode(",\n", $cols); } $out .= "\n\t);\n"; } @@ -447,7 +447,7 @@ class CakeSchema extends Object { if (is_array($values)) { foreach ($values as $key => $val) { if (is_array($val)) { - $vals[] = "'{$key}' => array('" . join("', '", $val) . "')"; + $vals[] = "'{$key}' => array('" . implode("', '", $val) . "')"; } else if (!is_numeric($key)) { $val = var_export($val, true); $vals[] = "'{$key}' => {$val}"; diff --git a/cake/libs/router.php b/cake/libs/router.php index 6bb72b440..083787c69 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -378,7 +378,7 @@ class Router extends Object { $parsed[] = '/' . $element; } } - return array('#^' . join('', $parsed) . '[\/]*$#', $names); + return array('#^' . implode('', $parsed) . '[\/]*$#', $names); } /** * Returns the list of prefixes used in connected routes @@ -880,11 +880,11 @@ class Router extends Object { if ($_this->__admin && isset($url[$_this->__admin])) { array_unshift($urlOut, $_this->__admin); } - $output = join('/', $urlOut) . '/'; + $output = implode('/', $urlOut) . '/'; } if (!empty($args)) { - $args = join('/', $args); + $args = implode('/', $args); if ($output{strlen($output) - 1} != '/') { $args = '/'. $args; } @@ -1066,7 +1066,7 @@ class Router extends Object { for ($i = 0; $i < $count; $i++) { $named[] = $keys[$i] . $this->named['separator'] . $params['named'][$keys[$i]]; } - $params['named'] = join('/', $named); + $params['named'] = implode('/', $named); } $params['pass'] = str_replace('//', '/', $params['pass'] . '/' . $params['named']); } diff --git a/cake/libs/set.php b/cake/libs/set.php index 230e22fad..11382e4dc 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -413,7 +413,7 @@ class Set extends Object { if (count($context['trace']) == 1) { $context['trace'][] = $context['key']; } - $parent = join('/', $context['trace']) . '/.'; + $parent = implode('/', $context['trace']) . '/.'; $context['item'] = Set::extract($parent, $data); $context['key'] = array_pop($context['trace']); if (isset($context['trace'][1]) && $context['trace'][1] > 0) { diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index 076622c73..3cdec2c2f 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -313,7 +313,7 @@ class Helper extends Overloadable { if ($setScope) { $view->modelScope = false; - } elseif (join('.', $view->entity()) == $entity) { + } elseif (implode('.', $view->entity()) == $entity) { return; } @@ -530,7 +530,7 @@ class Helper extends Overloadable { $name = $field; break; default: - $name = 'data[' . join('][', $view->entity()) . ']'; + $name = 'data[' . implode('][', $view->entity()) . ']'; break; } diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index ed0de9782..d2eda08db 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -251,7 +251,7 @@ class AjaxHelper extends AppHelper { $options['requestHeaders'] = array(); } if (is_array($options['update'])) { - $options['update'] = join(' ', $options['update']); + $options['update'] = implode(' ', $options['update']); } $options['requestHeaders']['X-Update'] = $options['update']; } else { @@ -799,7 +799,7 @@ class AjaxHelper extends AppHelper { $keys[] = "'" . $key . "'"; $keys[] = "'" . $val . "'"; } - $jsOptions['requestHeaders'] = '[' . join(', ', $keys) . ']'; + $jsOptions['requestHeaders'] = '[' . implode(', ', $keys) . ']'; break; } } @@ -846,7 +846,7 @@ class AjaxHelper extends AppHelper { } } - $out = join(', ', $out); + $out = implode(', ', $out); $out = '{' . $out . '}'; return $out; } else { @@ -965,7 +965,7 @@ class AjaxHelper extends AppHelper { $data[] = $key . ':"' . rawurlencode($val) . '"'; } } - $out = 'var __ajaxUpdater__ = {' . join(", \n", $data) . '};' . "\n"; + $out = 'var __ajaxUpdater__ = {' . implode(", \n", $data) . '};' . "\n"; $out .= 'for (n in __ajaxUpdater__) { if (typeof __ajaxUpdater__[n] == "string"'; $out .= ' && $(n)) Element.update($(n), unescape(decodeURIComponent('; $out .= '__ajaxUpdater__[n]))); }'; diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index e1f3c4422..6e47d44cf 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -355,7 +355,7 @@ class FormHelper extends AppHelper { } } } - $field = join('.', $field); + $field = implode('.', $field); if (!in_array($field, $this->fields)) { if ($value !== null) { return $this->fields[$field] = $value; @@ -585,7 +585,7 @@ class FormHelper extends AppHelper { function input($fieldName, $options = array()) { $view =& ClassRegistry::getObject('view'); $this->setEntity($fieldName); - $entity = join('.', $view->entity()); + $entity = implode('.', $view->entity()); $defaults = array('before' => null, 'between' => null, 'after' => null); $options = array_merge($defaults, $options); @@ -952,7 +952,7 @@ class FormHelper extends AppHelper { 'id' => $attributes['id'] . '_', 'value' => '', 'name' => $attributes['name'] )); } - $out = $hidden . join($inbetween, $out); + $out = $hidden . implode($inbetween, $out); if ($legend) { $out = sprintf( diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 8ef8406ec..b5be53a74 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -398,9 +398,9 @@ class HtmlHelper extends AppHelper { $out[] = $key.':'.$value.';'; } if ($inline) { - return join(' ', $out); + return implode(' ', $out); } - return join("\n", $out); + return implode("\n", $out); } /** * Returns the breadcrumb trail as a sequence of »-separated links. @@ -423,7 +423,7 @@ class HtmlHelper extends AppHelper { $out[] = $crumb[0]; } } - return $this->output(join($separator, $out)); + return $this->output(implode($separator, $out)); } else { return null; } @@ -481,7 +481,7 @@ class HtmlHelper extends AppHelper { foreach ($names as $arg) { $out[] = sprintf($this->tags['tableheader'], $this->_parseAttributes($thOptions), $arg); } - $data = sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out)); + $data = sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), implode(' ', $out)); return $this->output($data); } /** @@ -531,9 +531,9 @@ class HtmlHelper extends AppHelper { $cellsOut[] = sprintf($this->tags['tablecell'], $this->_parseAttributes($cellOptions), $cell); } $options = $this->_parseAttributes($count % 2 ? $oddTrOptions : $evenTrOptions); - $out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cellsOut)); + $out[] = sprintf($this->tags['tablerow'], $options, implode(' ', $cellsOut)); } - return $this->output(join("\n", $out)); + return $this->output(implode("\n", $out)); } /** * Returns a formatted block tag, i.e DIV, SPAN, P. diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index aa8d7577f..ec68f6580 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -649,9 +649,9 @@ class JavascriptHelper extends AppHelper { } if (!$numeric) { - $rt = '{' . join(',', $out) . '}'; + $rt = '{' . implode(',', $out) . '}'; } else { - $rt = '[' . join(',', $out) . ']'; + $rt = '[' . implode(',', $out) . ']'; } } $rt = $options['prefix'] . $rt . $options['postfix']; diff --git a/cake/libs/view/helpers/js.php b/cake/libs/view/helpers/js.php index 15e25099f..b13bc9c33 100644 --- a/cake/libs/view/helpers/js.php +++ b/cake/libs/view/helpers/js.php @@ -128,7 +128,7 @@ class JsHelper extends Overloadable2 { $options['requestHeaders'] = array(); } if (is_array($options['update'])) { - $options['update'] = join(' ', $options['update']); + $options['update'] = implode(' ', $options['update']); } $options['requestHeaders']['X-Update'] = $options['update']; } else { @@ -257,9 +257,9 @@ class JsHelper extends Overloadable2 { } if (!$numeric) { - $rt = '{' . join(', ', $out) . '}'; + $rt = '{' . implode(', ', $out) . '}'; } else { - $rt = '[' . join(', ', $out) . ']'; + $rt = '[' . implode(', ', $out) . ']'; } $rt = $prefix . $rt . $postfix; @@ -445,7 +445,7 @@ class JsHelperObject { } $options[] = $key . ':' . $val; } - return join(', ', $options); + return implode(', ', $options); } } ?> \ No newline at end of file diff --git a/cake/libs/view/helpers/rss.php b/cake/libs/view/helpers/rss.php index a7889a2e0..5b8cb8362 100644 --- a/cake/libs/view/helpers/rss.php +++ b/cake/libs/view/helpers/rss.php @@ -209,7 +209,7 @@ class RssHelper extends XmlHelper { } $categories[] = $this->elem($key, $attrib, $category); } - $elements[$key] = join('', $categories); + $elements[$key] = implode('', $categories); continue 2; } else if (is_array($val) && isset($val['domain'])) { $attrib['domain'] = $val['domain']; @@ -259,7 +259,7 @@ class RssHelper extends XmlHelper { $elements[$key] = $this->elem($key, $attrib, $val); } if (!empty($elements)) { - $content = join('', $elements); + $content = implode('', $elements); } return $this->output($this->elem('item', $att, $content, !($content === null))); } diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 199359f9f..655e6d266 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -437,7 +437,7 @@ class View extends Object { $data_for_layout = array_merge($this->viewVars, array( 'title_for_layout' => $pageTitle, 'content_for_layout' => $content_for_layout, - 'scripts_for_layout' => join("\n\t", $this->__scripts), + 'scripts_for_layout' => implode("\n\t", $this->__scripts), 'cakeDebug' => $debug )); diff --git a/cake/tests/lib/cake_test_case.php b/cake/tests/lib/cake_test_case.php index f642e36a1..c0d0bc451 100644 --- a/cake/tests/lib/cake_test_case.php +++ b/cake/tests/lib/cake_test_case.php @@ -634,10 +634,10 @@ class CakeTestCase extends UnitTestCase { $permutations = $this->__array_permute($attrs); $permutationTokens = array(); foreach ($permutations as $permutation) { - $permutationTokens[] = join('', $permutation); + $permutationTokens[] = implode('', $permutation); } $regex[] = array( - sprintf('%s', join(', ', $explanations)), + sprintf('%s', implode(', ', $explanations)), $permutationTokens, $i, ); diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index d614ed6d0..00e540571 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -575,7 +575,7 @@ class HtmlTestManager extends TestManager { foreach ($testCases as $testCaseFile => $testCase) { $title = explode(strpos($testCase, '\\') ? '\\' : '/', str_replace('.test.php', '', $testCase)); $title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]); - $title = join(' / ', $title); + $title = implode(' / ', $title); $buffer .= "
  • " . $title . "
  • \n"; }