Coding standards fixes

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8260 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2009-07-28 20:01:42 +00:00
parent 47cd941b53
commit f88cc56cfe
32 changed files with 106 additions and 111 deletions

View file

@ -199,7 +199,7 @@ class SchemaShell extends Shell {
} }
} }
$db =& ConnectionManager::getDataSource($this->Schema->connection); $db =& ConnectionManager::getDataSource($this->Schema->connection);
$contents = "#". $Schema->name ." sql generated on: " . date('Y-m-d H:i:s') . " : ". time()."\n\n"; $contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema); $contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
if ($write) { if ($write) {
if (strpos($write, '.sql') === false) { if (strpos($write, '.sql') === false) {

View file

@ -297,7 +297,7 @@ class Shell extends Object {
} }
if (!isset($this->{$taskName})) { if (!isset($this->{$taskName})) {
$this->err("Task '".$taskName."' could not be loaded"); $this->err("Task '" . $taskName . "' could not be loaded");
$this->_stop(); $this->_stop();
} }
} }

View file

@ -273,7 +273,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\$this->flash(__('Invalid {$singularHumanName}', true), array('action'=>'index'));\n"; $actions .= "\t\t\t\$this->flash(__('Invalid {$singularHumanName}', true), array('action'=>'index'));\n";
} }
$actions .= "\t\t}\n"; $actions .= "\t\t}\n";
$actions .= "\t\t\$this->set('".$singularName."', \$this->{$currentModelName}->read(null, \$id));\n"; $actions .= "\t\t\$this->set('" . $singularName . "', \$this->{$currentModelName}->read(null, \$id));\n";
$actions .= "\t}\n"; $actions .= "\t}\n";
$actions .= "\n"; $actions .= "\n";
@ -284,7 +284,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\t\$this->{$currentModelName}->create();\n"; $actions .= "\t\t\t\$this->{$currentModelName}->create();\n";
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n"; $actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\t\$this->Session->setFlash(__('The ".$singularHumanName." has been saved', true));\n"; $actions .= "\t\t\t\t\$this->Session->setFlash(__('The " . $singularHumanName . " has been saved', true));\n";
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\t\$this->flash(__('{$currentModelName} saved.', true), array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->flash(__('{$currentModelName} saved.', true), array('action'=>'index'));\n";
@ -313,7 +313,7 @@ class ControllerTask extends Shell {
} }
} }
if (!empty($compact)) { if (!empty($compact)) {
$actions .= "\t\t\$this->set(compact(".join(', ', $compact)."));\n"; $actions .= "\t\t\$this->set(compact(" . join(', ', $compact) . "));\n";
} }
$actions .= "\t}\n"; $actions .= "\t}\n";
$actions .= "\n"; $actions .= "\n";
@ -332,10 +332,10 @@ class ControllerTask extends Shell {
$actions .= "\t\tif (!empty(\$this->data)) {\n"; $actions .= "\t\tif (!empty(\$this->data)) {\n";
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n"; $actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\t\$this->Session->setFlash(__('The ".$singularHumanName." has been saved', true));\n"; $actions .= "\t\t\t\t\$this->Session->setFlash(__('The " . $singularHumanName . " has been saved', true));\n";
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\t\$this->flash(__('The ".$singularHumanName." has been saved.', true), array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->flash(__('The " . $singularHumanName . " has been saved.', true), array('action'=>'index'));\n";
} }
$actions .= "\t\t\t} else {\n"; $actions .= "\t\t\t} else {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
@ -365,7 +365,7 @@ class ControllerTask extends Shell {
} }
} }
if (!empty($compact)) { if (!empty($compact)) {
$actions .= "\t\t\$this->set(compact(".join(',', $compact)."));\n"; $actions .= "\t\t\$this->set(compact(" . join(',', $compact) . "));\n";
} }
$actions .= "\t}\n"; $actions .= "\t}\n";
$actions .= "\n"; $actions .= "\n";
@ -484,7 +484,7 @@ class ControllerTask extends Shell {
$this->out("\nBaking unit test for $className..."); $this->out("\nBaking unit test for $className...");
$header = '$Id'; $header = '$Id';
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $className ."Controller Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>"; $content = "<?php \n/* SVN FILE: $header$ */\n/* " . $className . "Controller Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>";
return $this->createFile($path . $filename, $content); return $this->createFile($path . $filename, $content);
} }
/** /**

View file

@ -733,7 +733,7 @@ class ModelTask extends Shell {
$this->out("\nBaking unit test for $className..."); $this->out("\nBaking unit test for $className...");
$header = '$Id'; $header = '$Id';
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $className ." Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>"; $content = "<?php \n/* SVN FILE: $header$ */\n/* " . $className . " Test cases generated on: " . date('Y-m-d H:i:s') . " : " . time() . "*/\n{$out}?>";
return $this->createFile($path . $filename, $content); return $this->createFile($path . $filename, $content);
} }
return false; return false;
@ -905,7 +905,7 @@ class ModelTask extends Shell {
$col = "\t\t'indexes' => array("; $col = "\t\t'indexes' => array(";
$props = array(); $props = array();
foreach ((array)$value as $key => $index) { foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(".join(', ', $schema->__values($index)).")"; $props[] = "'{$key}' => array(" . join(', ', $schema->__values($index)) . ")";
} }
$col .= join(', ', $props); $col .= join(', ', $props);
} }
@ -925,9 +925,9 @@ class ModelTask extends Shell {
$pluginPath = 'plugins' . DS . Inflector::underscore($this->plugin) . DS; $pluginPath = 'plugins' . DS . Inflector::underscore($this->plugin) . DS;
$path = APP . $pluginPath . 'tests' . DS . 'fixtures' . DS; $path = APP . $pluginPath . 'tests' . DS . 'fixtures' . DS;
} }
$filename = Inflector::underscore($model).'_fixture.php'; $filename = Inflector::underscore($model) . '_fixture.php';
$header = '$Id'; $header = '$Id';
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $model ." Fixture generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>"; $content = "<?php \n/* SVN FILE: $header$ */\n/* " . $model . " Fixture generated on: " . date('Y-m-d H:i:s') . " : " . time() . "*/\n{$out}?>";
$this->out("\nBaking test fixture for $model..."); $this->out("\nBaking test fixture for $model...");
if ($this->createFile($path . $filename, $content)) { if ($this->createFile($path . $filename, $content)) {
return str_replace("\t\t", "\t\t\t", $records); return str_replace("\t\t", "\t\t\t", $records);

View file

@ -153,7 +153,7 @@ class ProjectTask extends Shell {
$this->out(sprintf(__("Created: %s in %s", true), $app, $path)); $this->out(sprintf(__("Created: %s in %s", true), $app, $path));
$this->hr(); $this->hr();
} else { } else {
$this->err(" '".$app."' could not be created properly"); $this->err(" '" . $app . "' could not be created properly");
return false; return false;
} }
@ -219,7 +219,7 @@ class ProjectTask extends Shell {
$File =& new File($path . 'webroot' . DS . 'index.php'); $File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '".CAKE_CORE_INCLUDE_PATH."');", $contents); $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
if (!$File->write($result)) { if (!$File->write($result)) {
return false; return false;
} }
@ -230,7 +230,7 @@ class ProjectTask extends Shell {
$File =& new File($path . 'webroot' . DS . 'test.php'); $File =& new File($path . 'webroot' . DS . 'test.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) { if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '".CAKE_CORE_INCLUDE_PATH."');", $contents); $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
if (!$File->write($result)) { if (!$File->write($result)) {
return false; return false;
} }

View file

@ -181,7 +181,7 @@ class TestTask extends Shell {
} }
$header = '$Id'; $header = '$Id';
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $name ." Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>"; $content = "<?php \n/* SVN FILE: $header$ */\n/* " . $name . " Test cases generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>";
return $this->createFile($this->filePath . Inflector::underscore($name) . '.test.php', $content); return $this->createFile($this->filePath . Inflector::underscore($name) . '.test.php', $content);
} }
/** /**

View file

@ -25,7 +25,7 @@
<div class="<?php echo $pluralVar;?> form"> <div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?> <?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<fieldset> <fieldset>
<legend><?php echo "<?php __('".Inflector::humanize($action)." {$singularHumanName}');?>";?></legend> <legend><?php echo "<?php __('" . Inflector::humanize($action) . " {$singularHumanName}');?>";?></legend>
<?php <?php
echo "\t<?php\n"; echo "\t<?php\n";
foreach ($fields as $field) { foreach ($fields as $field) {
@ -58,8 +58,8 @@
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }

View file

@ -1,5 +1,5 @@
<?php <?php
$output = "<h2>Sweet, \"".Inflector::humanize($app)."\" got Baked by CakePHP!</h2>\n"; $output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
$output .=" $output .="
<?php <?php
if (Configure::read() > 0): if (Configure::read() > 0):

View file

@ -88,8 +88,8 @@ echo "<?php endforeach; ?>\n";
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }

View file

@ -32,14 +32,14 @@ foreach ($fields as $field) {
foreach ($associations['belongsTo'] as $alias => $details) { foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) { if ($field === $details['foreignKey']) {
$isKey = true; $isKey = true;
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize(Inflector::underscore($alias))."'); ?></dt>\n"; echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n"; echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break; break;
} }
} }
} }
if ($isKey !== true) { if ($isKey !== true) {
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize($field)."'); ?></dt>\n"; echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n"; echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
} }
} }
@ -58,8 +58,8 @@ foreach ($fields as $field) {
foreach ($associations as $type => $data) { foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) { foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) { if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(__('List ".Inflector::humanize($details['controller'])."', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n"; echo "\t\t<li><?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller']; $done[] = $details['controller'];
} }
} }
@ -71,12 +71,12 @@ foreach ($fields as $field) {
if (!empty($associations['hasOne'])) : if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $alias => $details): ?> foreach ($associations['hasOne'] as $alias => $details): ?>
<div class="related"> <div class="related">
<h3><?php echo "<?php __('Related ".Inflector::humanize($details['controller'])."');?>";?></h3> <h3><?php echo "<?php __('Related " . Inflector::humanize($details['controller']) . "');?>";?></h3>
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?> <?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
<dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?> <dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php <?php
foreach ($details['fields'] as $field) { foreach ($details['fields'] as $field) {
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('".Inflector::humanize($field)."');?></dt>\n"; echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "');?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}'];?>\n&nbsp;</dd>\n"; echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}'];?>\n&nbsp;</dd>\n";
} }
?> ?>
@ -84,7 +84,7 @@ if (!empty($associations['hasOne'])) :
<?php echo "<?php endif; ?>\n";?> <?php echo "<?php endif; ?>\n";?>
<div class="actions"> <div class="actions">
<ul> <ul>
<li><?php echo "<?php echo \$html->link(__('Edit ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?> <li><?php echo "<?php echo \$html->link(__('Edit " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
</ul> </ul>
</div> </div>
</div> </div>
@ -110,7 +110,7 @@ foreach ($relations as $alias => $details):
<tr> <tr>
<?php <?php
foreach ($details['fields'] as $field) { foreach ($details['fields'] as $field) {
echo "\t\t<th><?php __('".Inflector::humanize($field)."'); ?></th>\n"; echo "\t\t<th><?php __('" . Inflector::humanize($field) . "'); ?></th>\n";
} }
?> ?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th> <th class="actions"><?php echo "<?php __('Actions');?>";?></th>
@ -143,7 +143,7 @@ echo "\t<?php endforeach; ?>\n";
<?php echo "<?php endif; ?>\n\n";?> <?php echo "<?php endif; ?>\n\n";?>
<div class="actions"> <div class="actions">
<ul> <ul>
<li><?php echo "<?php echo \$html->link(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li> <li><?php echo "<?php echo \$html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
</ul> </ul>
</div> </div>
</div> </div>

View file

@ -203,10 +203,10 @@ class CookieComponent extends Object {
if (count($name) > 1) { if (count($name) > 1) {
$this->__values[$name[0]][$name[1]] = $value; $this->__values[$name[0]][$name[1]] = $value;
$this->__write("[".$name[0]."][".$name[1]."]", $value); $this->__write("[" . $name[0] . "][" . $name[1] . "]", $value);
} else { } else {
$this->__values[$name[0]] = $value; $this->__values[$name[0]] = $value;
$this->__write("[".$name[0]."]", $value); $this->__write("[" . $name[0] . "]", $value);
} }
} else { } else {
foreach ($key as $names => $value) { foreach ($key as $names => $value) {
@ -214,10 +214,10 @@ class CookieComponent extends Object {
if (count($name) > 1) { if (count($name) > 1) {
$this->__values[$name[0]][$name[1]] = $value; $this->__values[$name[0]][$name[1]] = $value;
$this->__write("[".$name[0]."][".$name[1]."]", $value); $this->__write("[" . $name[0] . "][" . $name[1] . "]", $value);
} else { } else {
$this->__values[$name[0]] = $value; $this->__values[$name[0]] = $value;
$this->__write("[".$name[0]."]", $value); $this->__write("[" . $name[0] . "]", $value);
} }
} }
} }
@ -278,17 +278,17 @@ class CookieComponent extends Object {
$name = $this->__cookieVarNames($key); $name = $this->__cookieVarNames($key);
if (count($name) > 1) { if (count($name) > 1) {
if (isset($this->__values[$name[0]])) { if (isset($this->__values[$name[0]])) {
$this->__delete("[".$name[0]."][".$name[1]."]"); $this->__delete("[" . $name[0] . "][" . $name[1] . "]");
unset($this->__values[$name[0]][$name[1]]); unset($this->__values[$name[0]][$name[1]]);
} }
} else { } else {
if (isset($this->__values[$name[0]])) { if (isset($this->__values[$name[0]])) {
if (is_array($this->__values[$name[0]])) { if (is_array($this->__values[$name[0]])) {
foreach ($this->__values[$name[0]] as $key => $value) { foreach ($this->__values[$name[0]] as $key => $value) {
$this->__delete("[".$name[0]."][".$key."]"); $this->__delete("[" . $name[0] . "][" . $key . "]");
} }
} }
$this->__delete("[".$name[0]."]"); $this->__delete("[" . $name[0] . "]");
unset($this->__values[$name[0]]); unset($this->__values[$name[0]]);
} }
} }

View file

@ -202,10 +202,10 @@ class HttpSocket extends CakeSocket {
} }
if (isset($this->request['auth']['user']) && isset($this->request['auth']['pass'])) { if (isset($this->request['auth']['user']) && isset($this->request['auth']['pass'])) {
$this->request['header']['Authorization'] = $this->request['auth']['method'] ." ". base64_encode($this->request['auth']['user'] .":".$this->request['auth']['pass']); $this->request['header']['Authorization'] = $this->request['auth']['method'] . " " . base64_encode($this->request['auth']['user'] . ":" . $this->request['auth']['pass']);
} }
if (isset($this->request['uri']['user']) && isset($this->request['uri']['pass'])) { if (isset($this->request['uri']['user']) && isset($this->request['uri']['pass'])) {
$this->request['header']['Authorization'] = $this->request['auth']['method'] ." ". base64_encode($this->request['uri']['user'] .":".$this->request['uri']['pass']); $this->request['header']['Authorization'] = $this->request['auth']['method'] . " " . base64_encode($this->request['uri']['user'] . ":" . $this->request['uri']['pass']);
} }
if (is_array($this->request['body'])) { if (is_array($this->request['body'])) {
@ -812,7 +812,7 @@ class HttpSocket extends CakeSocket {
return false; return false;
} }
preg_match_all("/(.+):(.+)(?:(?<![\t ])".$this->lineBreak."|\$)/Uis", $header, $matches, PREG_SET_ORDER); preg_match_all("/(.+):(.+)(?:(?<![\t ])" . $this->lineBreak . "|\$)/Uis", $header, $matches, PREG_SET_ORDER);
$header = array(); $header = array();
foreach ($matches as $match) { foreach ($matches as $match) {

View file

@ -105,9 +105,8 @@ class DboMysqli extends DboMysqlBase {
function _execute($sql) { function _execute($sql) {
if (preg_match('/^\s*call/i', $sql)) { if (preg_match('/^\s*call/i', $sql)) {
return $this->_executeProcedure($sql); return $this->_executeProcedure($sql);
} else {
return mysqli_query($this->connection, $sql);
} }
return mysqli_query($this->connection, $sql);
} }
/** /**
* Executes given SQL statement (procedure call). * Executes given SQL statement (procedure call).
@ -140,15 +139,15 @@ class DboMysqli extends DboMysqlBase {
if (!$result) { if (!$result) {
return array(); return array();
} else {
$tables = array();
while ($line = mysqli_fetch_array($result)) {
$tables[] = $line[0];
}
parent::listSources($tables);
return $tables;
} }
$tables = array();
while ($line = mysqli_fetch_array($result)) {
$tables[] = $line[0];
}
parent::listSources($tables);
return $tables;
} }
/** /**
* Returns an array of the fields in given table name. * Returns an array of the fields in given table name.
@ -201,14 +200,15 @@ class DboMysqli extends DboMysqlBase {
if ($parent != null) { if ($parent != null) {
return $parent; return $parent;
} }
if ($data === null || (is_array($data) && empty($data))) {
if ($data === null) {
return 'NULL'; return 'NULL';
} }
if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') { if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') {
return "''"; return "''";
} }
if (empty($column)) {
$column = $this->introspectType($data);
}
switch ($column) { switch ($column) {
case 'boolean': case 'boolean':
@ -217,9 +217,6 @@ class DboMysqli extends DboMysqlBase {
case 'integer' : case 'integer' :
case 'float' : case 'float' :
case null : case null :
if ($data === '') {
return 'NULL';
}
if ((is_int($data) || is_float($data) || $data === '0') || ( if ((is_int($data) || is_float($data) || $data === '0') || (
is_numeric($data) && strpos($data, ',') === false && is_numeric($data) && strpos($data, ',') === false &&
$data[0] != '0' && strpos($data, 'e') === false)) { $data[0] != '0' && strpos($data, 'e') === false)) {
@ -278,7 +275,6 @@ class DboMysqli extends DboMysqlBase {
if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0]['insertID'])) { if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0]['insertID'])) {
return $id[0]['insertID']; return $id[0]['insertID'];
} }
return null; return null;
} }
/** /**
@ -389,9 +385,8 @@ class DboMysqli extends DboMysqlBase {
$i++; $i++;
} }
return $resultRow; return $resultRow;
} else {
return false;
} }
return false;
} }
/** /**
* Gets the database encoding * Gets the database encoding

View file

@ -338,7 +338,7 @@ class CakeSchema extends Object {
$col = "\t\t'indexes' => array("; $col = "\t\t'indexes' => array(";
$props = array(); $props = array();
foreach ((array)$value as $key => $index) { foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(".join(', ', $this->__values($index)).")"; $props[] = "'{$key}' => array(" . join(', ', $this->__values($index)) . ")";
} }
$col .= join(', ', $props); $col .= join(', ', $props);
} }
@ -446,7 +446,7 @@ class CakeSchema extends Object {
if (is_array($values)) { if (is_array($values)) {
foreach ($values as $key => $val) { foreach ($values as $key => $val) {
if (is_array($val)) { if (is_array($val)) {
$vals[] = "'{$key}' => array('".join("', '", $val)."')"; $vals[] = "'{$key}' => array('" . join("', '", $val) . "')";
} else if (!is_numeric($key)) { } else if (!is_numeric($key)) {
$val = var_export($val, true); $val = var_export($val, true);
$vals[] = "'{$key}' => {$val}"; $vals[] = "'{$key}' => {$val}";

View file

@ -25,11 +25,11 @@
<h2><?php echo sprintf(__('Missing Method in %s', true), $controller);?></h2> <h2><?php echo sprintf(__('Missing Method in %s', true), $controller);?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error') ?>: </strong> <strong><?php __('Error') ?>: </strong>
<?php echo sprintf(__('The action %1$s is not defined in controller %2$s', true), "<em>".$action."</em>", "<em>".$controller."</em>");?> <?php echo sprintf(__('The action %1$s is not defined in controller %2$s', true), "<em>" . $action . "</em>", "<em>" . $controller . "</em>");?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error') ?>: </strong> <strong><?php __('Error') ?>: </strong>
<?php echo sprintf(__('Create %1$s%2$s in file: %3$s.', true), "<em>".$controller."::</em>", "<em>".$action."()</em>", APP_DIR.DS."controllers".DS.Inflector::underscore($controller).".php");?> <?php echo sprintf(__('Create %1$s%2$s in file: %3$s.', true), "<em>" . $controller . "::</em>", "<em>" . $action . "()</em>", APP_DIR . DS . "controllers" . DS . Inflector::underscore($controller) . ".php");?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -47,5 +47,5 @@ class <?php echo $controller;?> extends AppController {
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice') ?>: </strong> <strong><?php __('Notice') ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s.', true), APP_DIR.DS."views".DS."errors".DS."missing_action.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s.', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_action.ctp");?>
</p> </p>

View file

@ -25,11 +25,11 @@
<h2><?php __('Missing Component Class'); ?></h2> <h2><?php __('Missing Component Class'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Component class %1$s in %2$s was not found.', true), "<em>". $component ."Component</em>", "<em>". $controller ."Controller</em>");?> <?php echo sprintf(__('Component class %1$s in %2$s was not found.', true), "<em>" . $component . "Component</em>", "<em>" . $controller . "Controller</em>");?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class %s in file: %s', true), "<em>". $component ."Component</em>", APP_DIR.DS."controllers".DS."components".DS.$file);?> <?php echo sprintf(__('Create the class %s in file: %s', true), "<em>" . $component . "Component</em>", APP_DIR . DS . "controllers" . DS . "components" . DS . $file);?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -40,5 +40,5 @@ class <?php echo $component;?>Component extends Object {<br />
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_component_class.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_component_class.ctp");?>
</p> </p>

View file

@ -29,7 +29,7 @@
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class %s in file: %s', true), "<em>". $component ."Component</em>", APP_DIR.DS."controllers".DS."components".DS.$file);?> <?php echo sprintf(__('Create the class %s in file: %s', true), "<em>" . $component . "Component</em>", APP_DIR . DS . "controllers" . DS . "components" . DS . $file);?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -40,5 +40,5 @@ class <?php echo $component;?>Component extends Object {<br />
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_component_file.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_component_file.ctp");?>
</p> </p>

View file

@ -25,11 +25,11 @@
<h2><?php __('Missing Controller'); ?></h2> <h2><?php __('Missing Controller'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('%s could not be found.', true), "<em>".$controller."</em>");?> <?php echo sprintf(__('%s could not be found.', true), "<em>" . $controller . "</em>");?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class %s below in file: %s', true), "<em>".$controller."</em>", APP_DIR.DS."controllers".DS.Inflector::underscore($controller).".php");?> <?php echo sprintf(__('Create the class %s below in file: %s', true), "<em>" . $controller . "</em>", APP_DIR . DS . "controllers" . DS . Inflector::underscore($controller) . ".php");?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -41,5 +41,5 @@ class <?php echo $controller;?> extends AppController {
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_controller.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_controller.ctp");?>
</p> </p>

View file

@ -29,7 +29,7 @@
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class below in file: %s', true), APP_DIR.DS."views".DS."helpers".DS.$file);?> <?php echo sprintf(__('Create the class below in file: %s', true), APP_DIR . DS . "views" . DS . "helpers" . DS . $file);?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -40,5 +40,5 @@ class <?php echo $helperClass;?> extends AppHelper {
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_helper_class.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_helper_class.ctp");?>
</p> </p>

View file

@ -25,11 +25,11 @@
<h2><?php __('Missing Helper File'); ?></h2> <h2><?php __('Missing Helper File'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__("The helper file %s can not be found or does not exist.", true), APP_DIR.DS."views".DS."helpers".DS.$file);?> <?php echo sprintf(__("The helper file %s can not be found or does not exist.", true), APP_DIR . DS . "views" . DS . "helpers" . DS . $file);?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class below in file: %s', true), APP_DIR.DS."views".DS."helpers".DS.$file);?> <?php echo sprintf(__('Create the class below in file: %s', true), APP_DIR . DS . "views" . DS . "helpers" . DS . $file);?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -40,5 +40,5 @@ class <?php echo $helperClass;?> extends AppHelper {
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_helper_file.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_helper_file.ctp");?>
</p> </p>

View file

@ -25,13 +25,13 @@
<h2><?php __('Missing Layout'); ?></h2> <h2><?php __('Missing Layout'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__("The layout file %s can not be found or does not exist.", true), "<em>". $file ."</em>");?> <?php echo sprintf(__("The layout file %s can not be found or does not exist.", true), "<em>" . $file . "</em>");?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Confirm you have created the file: %s', true), "<em>". $file ."</em>");?> <?php echo sprintf(__('Confirm you have created the file: %s', true), "<em>" . $file . "</em>");?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_layout.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_layout.ctp");?>
</p> </p>

View file

@ -29,7 +29,7 @@
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Create the class %s in file: %s', true), "<em>". $model . "</em>", APP_DIR.DS."models".DS.Inflector::underscore($model).".php");?> <?php echo sprintf(__('Create the class %s in file: %s', true), "<em>" . $model . "</em>", APP_DIR . DS . "models" . DS . Inflector::underscore($model) . ".php");?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
@ -42,5 +42,5 @@ class <?php echo $model;?> extends AppModel {
</pre> </pre>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_model.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_model.ctp");?>
</p> </p>

View file

@ -29,9 +29,9 @@
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Confirm you have created the file: %s', true), APP_DIR.DS."config".DS."database.php");?> <?php echo sprintf(__('Confirm you have created the file: %s', true), APP_DIR . DS . "config" . DS . "database.php");?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_scaffolddb.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_scaffolddb.ctp");?>
</p> </p>

View file

@ -25,9 +25,9 @@
<h2><?php __('Missing Database Table'); ?></h2> <h2><?php __('Missing Database Table'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('Database table %1$s for model %2$s was not found.', true),"<em>". $table ."</em>", "<em>". $model ."</em>");?> <?php echo sprintf(__('Database table %1$s for model %2$s was not found.', true),"<em>" . $table . "</em>", "<em>" . $model . "</em>");?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_table.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_table.ctp");?>
</p> </p>

View file

@ -25,7 +25,7 @@
<h2><?php __('Missing View'); ?></h2> <h2><?php __('Missing View'); ?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__('The view for %1$s%2$s was not found.', true), "<em>". $controller."Controller::</em>", "<em>". $action ."()</em>");?> <?php echo sprintf(__('The view for %1$s%2$s was not found.', true), "<em>" . $controller . "Controller::</em>", "<em>". $action . "()</em>");?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
@ -33,5 +33,5 @@
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."missing_view.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "missing_view.ctp");?>
</p> </p>

View file

@ -25,9 +25,9 @@
<h2><?php echo sprintf(__('Private Method in %s', true), $controller);?></h2> <h2><?php echo sprintf(__('Private Method in %s', true), $controller);?></h2>
<p class="error"> <p class="error">
<strong><?php __('Error'); ?>: </strong> <strong><?php __('Error'); ?>: </strong>
<?php echo sprintf(__("%s%s cannot be accessed directly.", true), "<em>". $controller ."::</em>", "<em>". $action ."()</em>");?> <?php echo sprintf(__("%s%s cannot be accessed directly.", true), "<em>" . $controller . "::</em>", "<em>" . $action . "()</em>");?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."private_action.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "private_action.ctp");?>
</p> </p>

View file

@ -29,7 +29,7 @@
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php __('Notice'); ?>: </strong> <strong><?php __('Notice'); ?>: </strong>
<?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR.DS."views".DS."errors".DS."scaffold_error.ctp");?> <?php echo sprintf(__('If you want to customize this error message, create %s', true), APP_DIR . DS . "views" . DS . "errors" . DS . "scaffold_error.ctp");?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php

View file

@ -40,8 +40,8 @@
foreach ($associations as $_type => $_data) { foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) { foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' =>'index'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' =>'index')) . "</li>\n";
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' =>'add'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' =>'add')) . "</li>\n";
$done[] = $_details['controller']; $done[] = $_details['controller'];
} }
} }

View file

@ -86,8 +86,8 @@ echo "\n";
foreach ($associations as $_type => $_data) { foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) { foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
$done[] = $_details['controller']; $done[] = $_details['controller'];
} }
} }

View file

@ -37,14 +37,14 @@ foreach ($scaffoldFields as $_field) {
foreach ($associations['belongsTo'] as $_alias => $_details) { foreach ($associations['belongsTo'] as $_alias => $_details) {
if ($_field === $_details['foreignKey']) { if ($_field === $_details['foreignKey']) {
$isKey = true; $isKey = true;
echo "\t\t<dt{$class}>".Inflector::humanize($_alias)."</dt>\n"; echo "\t\t<dt{$class}>" . Inflector::humanize($_alias) . "</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t&nbsp;</dd>\n"; echo "\t\t<dd{$class}>\n\t\t\t" . $html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t&nbsp;</dd>\n";
break; break;
} }
} }
} }
if ($isKey !== true) { if ($isKey !== true) {
echo "\t\t<dt{$class}>".Inflector::humanize($_field)."</dt>\n"; echo "\t\t<dt{$class}>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd{$class}>\n\t\t\t{${$singularVar}[$modelClass][$_field]}\n&nbsp;\t\t</dd>\n"; echo "\t\t<dd{$class}>\n\t\t\t{${$singularVar}[$modelClass][$_field]}\n&nbsp;\t\t</dd>\n";
} }
} }
@ -63,8 +63,8 @@ foreach ($scaffoldFields as $_field) {
foreach ($associations as $_type => $_data) { foreach ($associations as $_type => $_data) {
foreach ($_data as $_alias => $_details) { foreach ($_data as $_alias => $_details) {
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
echo "\t\t<li>".$html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('List %s', true), Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
echo "\t\t<li>".$html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add'))."</li>\n"; echo "\t\t<li>" . $html->link(sprintf(__('New %s', true), Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
$done[] = $_details['controller']; $done[] = $_details['controller'];
} }
} }
@ -87,8 +87,8 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
if ($i++ % 2 == 0) { if ($i++ % 2 == 0) {
$class = ' class="altrow"'; $class = ' class="altrow"';
} }
echo "\t\t<dt{$class}>".Inflector::humanize($_field)."</dt>\n"; echo "\t\t<dt{$class}>" . Inflector::humanize($_field) . "</dt>\n";
echo "\t\t<dd{$class}>\n\t" .${$singularVar}[$_alias][$_field] ."\n&nbsp;</dd>\n"; echo "\t\t<dd{$class}>\n\t" . ${$singularVar}[$_alias][$_field] . "\n&nbsp;</dd>\n";
} }
?> ?>
</dl> </dl>
@ -122,7 +122,7 @@ $otherSingularVar = Inflector::variable($_alias);
<?php <?php
$otherFields = array_keys(${$singularVar}[$_alias][0]); $otherFields = array_keys(${$singularVar}[$_alias][0]);
foreach ($otherFields as $_field) { foreach ($otherFields as $_field) {
echo "\t\t<th>".Inflector::humanize($_field)."</th>\n"; echo "\t\t<th>" . Inflector::humanize($_field) . "</th>\n";
} }
?> ?>
<th class="actions">Actions</th> <th class="actions">Actions</th>
@ -137,7 +137,7 @@ $otherSingularVar = Inflector::variable($_alias);
echo "\t\t<tr{$class}>\n"; echo "\t\t<tr{$class}>\n";
foreach ($otherFields as $_field) { foreach ($otherFields as $_field) {
echo "\t\t\t<td>".${$otherSingularVar}[$_field]."</td>\n"; echo "\t\t\t<td>" . ${$otherSingularVar}[$_field] . "</td>\n";
} }
echo "\t\t\t<td class=\"actions\">\n"; echo "\t\t\t<td class=\"actions\">\n";

View file

@ -399,12 +399,12 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->setReturnValue('read', false); $this->Socket->setReturnValue('read', false);
$this->Socket->_mock->_call_counts['read'] = 0; $this->Socket->_mock->_call_counts['read'] = 0;
$number = mt_rand(0, 9999999); $number = mt_rand(0, 9999999);
$serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>Hello, your lucky number is ".$number."</h1>"; $serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>Hello, your lucky number is " . $number . "</h1>";
$this->Socket->setReturnValueAt(0, 'read', $serverResponse); $this->Socket->setReturnValueAt(0, 'read', $serverResponse);
$this->Socket->expect('write', array("GET / HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\n\r\n")); $this->Socket->expect('write', array("GET / HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\n\r\n"));
$this->Socket->expectCallCount('read', 2); $this->Socket->expectCallCount('read', 2);
$response = $this->Socket->request($request); $response = $this->Socket->request($request);
$this->assertIdentical($response, "<h1>Hello, your lucky number is ".$number."</h1>"); $this->assertIdentical($response, "<h1>Hello, your lucky number is " . $number . "</h1>");
$this->Socket->reset(); $this->Socket->reset();
$serverResponse = "HTTP/1.x 200 OK\r\nSet-Cookie: foo=bar\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>This is a cookie test!</h1>"; $serverResponse = "HTTP/1.x 200 OK\r\nSet-Cookie: foo=bar\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>This is a cookie test!</h1>";

View file

@ -298,8 +298,8 @@ class SanitizeTest extends CakeTestCase {
$result = Sanitize::stripScripts($string); $result = Sanitize::stripScripts($string);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />'."\n".'<link rel="icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />'; $string = '<link href="/css/styles.css" media="screen" rel="stylesheet" />' . "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
$expected = "\n".'<link rel="icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />'; $expected = "\n" . '<link rel="icon" href="/favicon.ico" type="image/x-icon" />' . "\n" . '<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />'."\n".'<link rel="alternate" href="/feed.xml" title="RSS Feed" type="application/rss+xml" />';
$result = Sanitize::stripScripts($string); $result = Sanitize::stripScripts($string);
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);