Skip to content

Commit

Permalink
Coding standards fixes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8260 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
DarkAngelBGE committed Jul 28, 2009
1 parent 47cd941 commit f88cc56
Show file tree
Hide file tree
Showing 32 changed files with 105 additions and 110 deletions.
2 changes: 1 addition & 1 deletion cake/console/libs/schema.php
Expand Up @@ -199,7 +199,7 @@ function dump() {
}
}
$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);
if ($write) {
if (strpos($write, '.sql') === false) {
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/shell.php
Expand Up @@ -297,7 +297,7 @@ function loadTasks() {
}

if (!isset($this->{$taskName})) {
$this->err("Task '".$taskName."' could not be loaded");
$this->err("Task '" . $taskName . "' could not be loaded");
$this->_stop();
}
}
Expand Down
14 changes: 7 additions & 7 deletions cake/console/libs/tasks/controller.php
Expand Up @@ -273,7 +273,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$actions .= "\t\t\t\$this->flash(__('Invalid {$singularHumanName}', true), array('action'=>'index'));\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 .= "\n";

Expand All @@ -284,7 +284,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$actions .= "\t\t\t\$this->{$currentModelName}->create();\n";
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
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";
} else {
$actions .= "\t\t\t\t\$this->flash(__('{$currentModelName} saved.', true), array('action'=>'index'));\n";
Expand Down Expand Up @@ -313,7 +313,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
}
}
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 .= "\n";
Expand All @@ -332,10 +332,10 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$actions .= "\t\tif (!empty(\$this->data)) {\n";
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
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";
} 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";
if ($wannaUseSession) {
Expand Down Expand Up @@ -365,7 +365,7 @@ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
}
}
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 .= "\n";
Expand Down Expand Up @@ -484,7 +484,7 @@ function bakeTest($className) {
$this->out("\nBaking unit test for $className...");

$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);
}
/**
Expand Down
8 changes: 4 additions & 4 deletions cake/console/libs/tasks/model.php
Expand Up @@ -733,7 +733,7 @@ function bakeTest($className, $useTable = null, $associations = array()) {
$this->out("\nBaking unit test for $className...");

$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 false;
Expand Down Expand Up @@ -905,7 +905,7 @@ function fixture($model, $useTable = null) {
$col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(".join(', ', $schema->__values($index)).")";
$props[] = "'{$key}' => array(" . join(', ', $schema->__values($index)) . ")";
}
$col .= join(', ', $props);
}
Expand All @@ -925,9 +925,9 @@ function fixture($model, $useTable = null) {
$pluginPath = 'plugins' . DS . Inflector::underscore($this->plugin) . DS;
$path = APP . $pluginPath . 'tests' . DS . 'fixtures' . DS;
}
$filename = Inflector::underscore($model).'_fixture.php';
$filename = Inflector::underscore($model) . '_fixture.php';
$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...");
if ($this->createFile($path . $filename, $content)) {
return str_replace("\t\t", "\t\t\t", $records);
Expand Down
6 changes: 3 additions & 3 deletions cake/console/libs/tasks/project.php
Expand Up @@ -153,7 +153,7 @@ function bake($path, $skel = null, $skip = array('empty')) {
$this->out(sprintf(__("Created: %s in %s", true), $app, $path));
$this->hr();
} else {
$this->err(" '".$app."' could not be created properly");
$this->err(" '" . $app . "' could not be created properly");
return false;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read();
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)) {
return false;
}
Expand All @@ -230,7 +230,7 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'test.php');
$contents = $File->read();
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)) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/tasks/test.php
Expand Up @@ -181,7 +181,7 @@ function bake($class, $name = null, $cases = array()) {
}

$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);
}
/**
Expand Down
6 changes: 3 additions & 3 deletions cake/console/libs/templates/views/form.ctp
Expand Up @@ -25,7 +25,7 @@
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo "<?php __('".Inflector::humanize($action)." {$singularHumanName}');?>";?></legend>
<legend><?php echo "<?php __('" . Inflector::humanize($action) . " {$singularHumanName}');?>";?></legend>
<?php
echo "\t<?php\n";
foreach ($fields as $field) {
Expand Down Expand Up @@ -58,8 +58,8 @@
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
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(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </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";
$done[] = $details['controller'];
}
}
Expand Down
2 changes: 1 addition & 1 deletion cake/console/libs/templates/views/home.ctp
@@ -1,5 +1,5 @@
<?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 .="
<?php
if (Configure::read() > 0):
Expand Down
4 changes: 2 additions & 2 deletions cake/console/libs/templates/views/index.ctp
Expand Up @@ -88,8 +88,8 @@ echo "<?php endforeach; ?>\n";
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
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(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </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";
$done[] = $details['controller'];
}
}
Expand Down
18 changes: 9 additions & 9 deletions cake/console/libs/templates/views/view.ctp
Expand Up @@ -32,14 +32,14 @@ foreach ($fields as $field) {
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$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";
break;
}
}
}
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";
}
}
Expand All @@ -58,8 +58,8 @@ foreach ($fields as $field) {
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
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(__('New ".Inflector::humanize(Inflector::underscore($alias))."', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </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";
$done[] = $details['controller'];
}
}
Expand All @@ -71,20 +71,20 @@ foreach ($fields as $field) {
if (!empty($associations['hasOne'])) :
foreach ($associations['hasOne'] as $alias => $details): ?>
<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";?>
<dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
<?php
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";
}
?>
</dl>
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<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>
</div>
</div>
Expand All @@ -110,7 +110,7 @@ foreach ($relations as $alias => $details):
<tr>
<?php
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>
Expand Down Expand Up @@ -143,7 +143,7 @@ echo "\t<?php endforeach; ?>\n";
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<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>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions cake/libs/controller/components/cookie.php
Expand Up @@ -203,21 +203,21 @@ function write($key, $value = null, $encrypt = true, $expires = null) {

if (count($name) > 1) {
$this->__values[$name[0]][$name[1]] = $value;
$this->__write("[".$name[0]."][".$name[1]."]", $value);
$this->__write("[" . $name[0] . "][" . $name[1] . "]", $value);
} else {
$this->__values[$name[0]] = $value;
$this->__write("[".$name[0]."]", $value);
$this->__write("[" . $name[0] . "]", $value);
}
} else {
foreach ($key as $names => $value) {
$name = $this->__cookieVarNames($names);

if (count($name) > 1) {
$this->__values[$name[0]][$name[1]] = $value;
$this->__write("[".$name[0]."][".$name[1]."]", $value);
$this->__write("[" . $name[0] . "][" . $name[1] . "]", $value);
} else {
$this->__values[$name[0]] = $value;
$this->__write("[".$name[0]."]", $value);
$this->__write("[" . $name[0] . "]", $value);
}
}
}
Expand Down Expand Up @@ -278,17 +278,17 @@ function del($key) {
$name = $this->__cookieVarNames($key);
if (count($name) > 1) {
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]]);
}
} else {
if (isset($this->__values[$name[0]])) {
if (is_array($this->__values[$name[0]])) {
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]]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions cake/libs/http_socket.php
Expand Up @@ -202,10 +202,10 @@ function request($request = array()) {
}

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'])) {
$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'])) {
Expand Down Expand Up @@ -812,7 +812,7 @@ function parseHeader($header) {
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();
foreach ($matches as $match) {
Expand Down

0 comments on commit f88cc56

Please sign in to comment.