From 0aa7148b74de44edaa7b1149ee2cfff63e211e9b Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 23 Jan 2008 16:06:33 -0500 Subject: [PATCH] Changing our coding standards slightly: - foreach($a AS $b) goes to foreach($a as $b) - ($a AND $b) goes to ($a && $b) - ($a OR $b) goes to ($a || $b) --- Api.php | 20 ++++++------ App.php | 6 ++-- Functions.php | 20 ++++++------ Input.php | 10 +++--- Installer.php | 2 +- Mail.php | 4 +-- Pagination.php | 2 +- PrinterBaseElement.php | 4 +-- PrinterElement.php | 4 +-- PrinterRootElementForm.php | 2 +- PrinterRootElementPage.php | 14 ++++---- PrinterRootElementTable.php | 4 +-- PrinterTableElement.php | 10 +++--- Template.php | 16 ++++----- UnitTest/ApiTest.php | 2 +- UnitTest/InputTest.php | 4 +-- docs/makepo.sh.php | 8 ++--- docs/tools/create_schema.php | 16 ++++----- docs/tools/function_finder.php | 60 +++++++++++++++++----------------- docs/tools/wordrunner.php | 8 ++--- 20 files changed, 108 insertions(+), 108 deletions(-) diff --git a/Api.php b/Api.php index 20f8488..27d6ad7 100644 --- a/Api.php +++ b/Api.php @@ -196,7 +196,7 @@ abstract class BSApi $this->setfields["$field"] = $field; - if ($dovalidate AND method_exists($this, "validate_$field")) + if ($dovalidate && method_exists($this, "validate_$field")) { $this->{"validate_$field"}($field); } @@ -211,11 +211,11 @@ abstract class BSApi */ public function setCondition($condition = null) { - if (is_array($condition) AND sizeof($condition) > 0) + if (is_array($condition) && sizeof($condition) > 0) { $this->condition = ''; - foreach ($condition AS $field) + foreach ($condition as $field) { if (!$this->values["$field"]) { @@ -232,7 +232,7 @@ abstract class BSApi } else { - foreach ($this->fields AS $name => $options) + foreach ($this->fields as $name => $options) { if ($options[F_REQ] == REQ_AUTO) { @@ -301,7 +301,7 @@ abstract class BSApi $this->_runActionMethod('pre_insert', $doPre); $fields = $values = array(); - foreach ($this->setfields AS $field) + foreach ($this->setfields as $field) { $fields[] = $field; $values[] = $this->_prepareFieldForSql($field); @@ -311,7 +311,7 @@ abstract class BSApi if (BSApp::$db instanceof BSDbPostgreSql) { - foreach ($this->fields AS $field => $info) + foreach ($this->fields as $field => $info) { if ($info[F_REQ] == REQ_AUTO) { @@ -348,7 +348,7 @@ abstract class BSApi $this->_runActionMethod('pre_update', $doPre); - foreach ($this->setfields AS $field) + foreach ($this->setfields as $field) { $updates[] = "$field = " . $this->_prepareFieldForSql($field); } @@ -388,7 +388,7 @@ abstract class BSApi */ private function _verifyRequired() { - foreach ($this->fields AS $name => $options) + foreach ($this->fields as $name => $options) { if ($options[F_REQ] == REQ_YES) { @@ -413,7 +413,7 @@ abstract class BSApi */ private function _runActionMethod($method, $doRun) { - if (!$doRun OR !method_exists($this, $method)) + if (!$doRun || !method_exists($this, $method)) { return; } @@ -434,7 +434,7 @@ abstract class BSApi { $type = $this->fields["$name"][F_TYPE]; - if ($type == TYPE_NONE OR $type == TYPE_STR OR $type == TYPE_STRUN) + if ($type == TYPE_NONE || $type == TYPE_STR || $type == TYPE_STRUN) { return "'" . BSApp::$db->escapeString($this->values["$name"]) . "'"; } diff --git a/App.php b/App.php index d894a7b..bfbfb25 100644 --- a/App.php +++ b/App.php @@ -36,11 +36,11 @@ if (!function_exists('array_fill_keys')) if ((bool)ini_get('register_globals') === true) { $superglobals = array('_GET', '_COOKIE', '_FILES', '_POST', '_SERVER', '_ENV'); - foreach ($superglobals AS $global) + foreach ($superglobals as $global) { if (is_array(${$global})) { - foreach (${$global} AS $_key => $_val) + foreach (${$global} as $_key => $_val) { if (isset(${$_key})) { @@ -132,7 +132,7 @@ class BSApp public static function get_debug_list() { $output = 'type == 'text' OR $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />'; + return 'type == 'text' || $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />'; break; case 'hidden': @@ -223,7 +223,7 @@ class BSPrinterBaseElement extends BSPrinterElement break; case 'textarea': - if (!isset($this->style['height']) OR !isset($this->style['width'])) + if (!isset($this->style['height']) || !isset($this->style['width'])) { throw new Exception('BSPrinterBaseElement of type "textarea" require a "height" and "width" style attribute'); } diff --git a/PrinterElement.php b/PrinterElement.php index ab229ca..38c9d7c 100644 --- a/PrinterElement.php +++ b/PrinterElement.php @@ -96,7 +96,7 @@ abstract class BSPrinterElement */ protected function _prepareStyle() { - if (empty($this->style) AND empty($this->cssClass)) + if (empty($this->style) && empty($this->cssClass)) { return; } @@ -113,7 +113,7 @@ abstract class BSPrinterElement $attrs = array(); - foreach ($this->style AS $prop => $value) + foreach ($this->style as $prop => $value) { $attrs[] = $prop . ': ' . $value; } diff --git a/PrinterRootElementForm.php b/PrinterRootElementForm.php index f818d1b..d059585 100644 --- a/PrinterRootElementForm.php +++ b/PrinterRootElementForm.php @@ -125,7 +125,7 @@ class BSPrinterRootElementForm extends BSPrinterRootElement { $builder = ''; - foreach ($this->children AS $child) + foreach ($this->children as $child) { $builder .= "\n" . $child->paint(); } diff --git a/PrinterRootElementPage.php b/PrinterRootElementPage.php index 3130c3e..33c29ab 100644 --- a/PrinterRootElementPage.php +++ b/PrinterRootElementPage.php @@ -143,7 +143,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement { $vars = new BSPrinterRootElementForm($controller, $action, 'postvars'); - foreach ($postvars AS $key => $value) + foreach ($postvars as $key => $value) { $vars->addChild(new BSPrinterBaseElement('hidden', $key, $value)); } @@ -216,7 +216,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement $page = new BSPrinterRootElementPage(_('Confirm')); $form = new BSPrinterRootElementForm($controller, $action); - foreach ($params AS $key => $value) + foreach ($params as $key => $value) { $form->addChild(new BSPrinterBaseElement('hidden', $key, $value)); } @@ -271,7 +271,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement { $builder = ''; - foreach ($this->children AS $child) + foreach ($this->children as $child) { $builder .= "\n" . $child->paint() . "\n"; } @@ -294,14 +294,14 @@ class BSPrinterRootElementPage extends BSPrinterRootElement echo "\n\t"; echo "\n\n\n"; - if ($this->navigator AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) + if ($this->navigator && (!defined('ISSO_PRINTER_NO_NAVIGATION') || !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo $this->navigator->constructHeaderHtml(); } echo $this->_paintChildren(); - if ($this->navigator AND (!defined('ISSO_PRINTER_NO_NAVIGATION') OR !constant('ISSO_PRINTER_NO_NAVIGATION'))) + if ($this->navigator && (!defined('ISSO_PRINTER_NO_NAVIGATION') || !constant('ISSO_PRINTER_NO_NAVIGATION'))) { echo $this->navigator->constructFooterHtml(); } @@ -316,7 +316,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement if (BSApp::get_debug()) { - if (defined('SVN') AND preg_match('#^\$Id:?#', constant('SVN'))) + if (defined('SVN') && preg_match('#^\$Id:?#', constant('SVN'))) { echo preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', "\n
\n" . '
\1 — r\2
', constant('SVN')); } @@ -338,7 +338,7 @@ class BSPrinterRootElementPage extends BSPrinterRootElement $head->setCssClass('thead'); $table->addHeadingChild($head); - foreach ($queries AS $query) + foreach ($queries as $query) { $tr = new BSPrinterTableElement(); $tr->addChild(new BSPrinterLabelElement("\n\t\t\t" . $query['query'] . "\n\n\t\t\t
(" . $query['time'] . ")
\n\n\t\t")); diff --git a/PrinterRootElementTable.php b/PrinterRootElementTable.php index d1aedbc..c8e96da 100644 --- a/PrinterRootElementTable.php +++ b/PrinterRootElementTable.php @@ -133,7 +133,7 @@ class BSPrinterRootElementTable extends BSPrinterRootElement */ private function _calculateColumnCount() { - foreach ($this->children AS $child) + foreach ($this->children as $child) { if ($child->numberOfColumns() > $this->colspan) { @@ -157,7 +157,7 @@ class BSPrinterRootElementTable extends BSPrinterRootElement $this->_calculateColumnCount(); - foreach ($this->children AS $child) + foreach ($this->children as $child) { $child->setColumnNumber($this->colspan); $builder .= "\n" . $child->paint(); diff --git a/PrinterTableElement.php b/PrinterTableElement.php index 0f09eed..c7515cb 100644 --- a/PrinterTableElement.php +++ b/PrinterTableElement.php @@ -135,7 +135,7 @@ class BSPrinterTableElement extends BSPrinterElement $build = ''; if (sizeof($children) > 0) { - foreach ($children AS $child) + foreach ($children as $child) { $build .= "\n\t\t\t" . $child->paint(); } @@ -178,7 +178,7 @@ class BSPrinterTableElement extends BSPrinterElement public static function row_list($label, $name, Array $options) { $build = ''; - foreach ($options AS $option) + foreach ($options as $option) { if ($option->getType() == 'option') { @@ -211,7 +211,7 @@ class BSPrinterTableElement extends BSPrinterElement public static function row_checkbox($label, $name, Array $boxes) { $build = ''; - foreach ($boxes AS $boxLabel => $box) + foreach ($boxes as $boxLabel => $box) { if ($box->getType() == 'checkbox') { @@ -372,10 +372,10 @@ class BSPrinterTableElement extends BSPrinterElement } $i = 0; - foreach ($this->children AS $child) + foreach ($this->children as $child) { $i++; - $colspan = (($i == $numCols AND !$even) ? $cols + 1 : $cols); + $colspan = (($i == $numCols && !$even) ? $cols + 1 : $cols); $builder .= "\n\t\t 1 ? ' colspan="' . $colspan . '"' : '') . ">" . $child->paint() . ""; } diff --git a/Template.php b/Template.php index 6fb6314..b15d749 100644 --- a/Template.php +++ b/Template.php @@ -177,7 +177,7 @@ class BSTemplate $dbCache["$tpl[filename]"] = $template; } } - foreach ($namearray AS $name) + foreach ($namearray as $name) { if ($this->dbCacheTable) { @@ -255,7 +255,7 @@ class BSTemplate if (sizeof($this->uncached) > 0) { - foreach ($this->uncached AS $name => $count) + foreach ($this->uncached as $name => $count) { $tpls[] = $name . "($count)"; } @@ -268,7 +268,7 @@ class BSTemplate $debugBlock .= "
\n" . '' . "\n\t" . ''; - foreach ($queries AS $query) + foreach ($queries as $query) { $debugBlock .= "\n\t"; $debugBlock .= "\n\t\t\r\t\r\t\r\r"; } -- 2.43.5
Query Debug
"; @@ -295,7 +295,7 @@ class BSTemplate protected function _loadTemplate($name) { $path = $this->templateDir . $name . '.' . $this->extension; - if (is_file($path) AND is_readable($path)) + if (is_file($path) && is_readable($path)) { return @file_get_contents($path); } @@ -346,7 +346,7 @@ class BSTemplate for ($i = 0; $i < strlen($template); $i++) { // we've run through the template and there's nothing in the stack--done - if ($i == strlen($template) - 1 AND sizeof($stack) == 0) + if ($i == strlen($template) - 1 && sizeof($stack) == 0) { return $template; } @@ -398,7 +398,7 @@ class BSTemplate $token = substr($token, 1, strlen($token) - 2); // language token - if ($token[0] == '@' AND $token[1] == '\\' AND $token[2] == '"') + if ($token[0] == '@' && $token[1] == '\\' && $token[2] == '"') { return '" . ' . $this->langcall . '(\'' . str_replace(array('\\\"', "'"), array('"', "\'"), substr($token, 3, strlen($token) - 5)) . '\')' . ' . "'; } @@ -475,7 +475,7 @@ class BSTemplate throw new Exception('Invalid language variable index "' . $capture . '"'); } } - else if ($template[$i] == '>' AND $template[$i - 1] == '"') + else if ($template[$i] == '>' && $template[$i - 1] == '"') { // the final variable substitution $varMap[intval($varNum)] = BSFunctions::substring($template, $capturePos + 3, $i - 2); @@ -568,7 +568,7 @@ class BSTemplate // locate else tags else if (substr($template, $i, strlen($tag_else)) == $tag_else) { - if (sizeof($stack) == 0 AND !isset($tag_full['else'])) + if (sizeof($stack) == 0 && !isset($tag_full['else'])) { $tag_full['else'] = $i; } diff --git a/UnitTest/ApiTest.php b/UnitTest/ApiTest.php index 2caa68b..034ca11 100644 --- a/UnitTest/ApiTest.php +++ b/UnitTest/ApiTest.php @@ -55,7 +55,7 @@ class ApiTest extends PHPUnit_Framework_TestCase catch (ApiException $e) { $i = 0; - foreach ($e->getExceptions() AS $exc) + foreach ($e->getExceptions() as $exc) { if ($exc instanceof FieldException) { diff --git a/UnitTest/InputTest.php b/UnitTest/InputTest.php index a94d74f..4c7c174 100644 --- a/UnitTest/InputTest.php +++ b/UnitTest/InputTest.php @@ -37,9 +37,9 @@ class InputTest extends PHPUnit_Framework_TestCase ); // simulate magic quotes GPC - /*foreach (array($_GET, $_COOKIE) AS $array) + /*foreach (array($_GET, $_COOKIE) as $array) { - foreach ($array AS $var => $value) + foreach ($array as $var => $value) { $array["$var"] = addslashes($value); } diff --git a/docs/makepo.sh.php b/docs/makepo.sh.php index 29b7024..8e29d13 100755 --- a/docs/makepo.sh.php +++ b/docs/makepo.sh.php @@ -27,14 +27,14 @@ require_once('/Server/htdocs/ISSO/Functions.php'); $filelist = BSFunctions::ScanDirectory('.'); -foreach ($filelist AS $file) +foreach ($filelist as $file) { $ext = BSFunctions::FetchExtension($file); if ($ext == 'php') { $files[dirname($file)] = BSFunctions::FetchSourcePath(dirname($file)) . '*.php'; } - else if ($ext == 'xml' OR $ext == 'tpl' OR $ext == 'html' OR $ext == 'htm') + else if ($ext == 'xml' || $ext == 'tpl' || $ext == 'html' || $ext == 'htm') { $files[dirname($file)] = BSFunctions::FetchSourcePath(dirname($file)) . '*.php'; $templates[] = array( @@ -52,7 +52,7 @@ function process_template_text($text) return ''; } -foreach ($templates AS $paths) +foreach ($templates as $paths) { $template = file_get_contents($paths['orig']); @@ -75,7 +75,7 @@ exec('xgettext ' . implode(' ', $arguments) . ' ' . implode(' ', $files)); // ################################################################### // remove all the files we no longer need -foreach ($removelater AS $path) +foreach ($removelater as $path) { unlink($path); } diff --git a/docs/tools/create_schema.php b/docs/tools/create_schema.php index d49ffd6..d5f78f8 100644 --- a/docs/tools/create_schema.php +++ b/docs/tools/create_schema.php @@ -54,7 +54,7 @@ else { array_walk($index, 'trim'); - if ($index['Sub_part'] AND $input->in['engine'] == 'postgresql') + if ($index['Sub_part'] && $input->in['engine'] == 'postgresql') { $subpart = " ($index[Sub_part])"; } @@ -67,11 +67,11 @@ else { $keys['fulltext']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; } - else if ($index['Index_type'] == 'BTREE' AND $index['Non_unique'] == 0) + else if ($index['Index_type'] == 'BTREE' && $index['Non_unique'] == 0) { $keys['unique']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; } - else if ($index['Index_type'] == 'BTREE' AND $index['Non_unique'] == 1) + else if ($index['Index_type'] == 'BTREE' && $index['Non_unique'] == 1) { $keys['std']["$index[Key_name]"][] = "$t$index[Column_name]$t$subpart"; } @@ -107,7 +107,7 @@ else $field['Type'] = 'int'; } - if ($input->in['engine'] == 'mysql' AND $field['Type'] != 'bool') + if ($input->in['engine'] == 'mysql' && $field['Type'] != 'bool') { $field['Type'] .= $matches[3]; } @@ -153,21 +153,21 @@ else } if ($keys['fulltext']) { - foreach ($keys['fulltext'] AS $name => $columns) + foreach ($keys['fulltext'] as $name => $columns) { $build .= ",\n\tFULLTEXT KEY $t$name$t (" . implode(', ', $columns) . ")"; } } if ($keys['unique']) { - foreach ($keys['unique'] AS $name => $columns) + foreach ($keys['unique'] as $name => $columns) { $build .= ",\n\tUNIQUE KEY $t$name$t (" . implode(', ', $columns) . ")"; } } if ($keys['std']) { - foreach ($keys['std'] AS $name => $columns) + foreach ($keys['std'] as $name => $columns) { $build .= ",\n\tKEY $t$name$t (" . implode(', ', $columns) . ")"; } @@ -180,7 +180,7 @@ else if ($input->in['variable'] != '') { - foreach ($queries AS $table => $query) + foreach ($queries as $table => $query) { $output[] = "\${$input->in['variable']}['$table'] = \"\n$query\";"; } diff --git a/docs/tools/function_finder.php b/docs/tools/function_finder.php index 620b957..4378e27 100755 --- a/docs/tools/function_finder.php +++ b/docs/tools/function_finder.php @@ -22,7 +22,7 @@ $path = '/Server/htdocs/sportal/'; $filelist = fetch_flat_listing($path); -foreach ($filelist AS $filename) +foreach ($filelist as $filename) { $fpath = $path . $filename; $file = file_get_contents($fpath); @@ -35,20 +35,20 @@ foreach ($filelist AS $filename) $perfile["$fpath"] = $templist['methods']; } -foreach ($elements['methods']['functions'] AS $name) +foreach ($elements['methods']['functions'] as $name) { $count['functions']["$name"] = 0; } -foreach ($elements['methods']['classes'] AS $name => $methods) +foreach ($elements['methods']['classes'] as $name => $methods) { - foreach ($methods AS $method) + foreach ($methods as $method) { $count['classes']["$name"]["$method"] = 0; } } -foreach ($filelist AS $filename) +foreach ($filelist as $filename) { $fpath = $path . $filename; @@ -80,7 +80,7 @@ function fetch_listing($path, $basepath = '', $unset = 1) { while (($file = readdir($handle)) !== false) { - if (substr($file, 0, 1) != '.' AND $file != 'CVS') + if (substr($file, 0, 1) != '.' && $file != 'CVS') { if (is_dir($path . $file)) { @@ -104,11 +104,11 @@ function fetch_flat_listing($path) { $filelist = fetch_listing($path); - foreach ($filelist AS $basepath => $files) + foreach ($filelist as $basepath => $files) { - foreach ($files AS $file) + foreach ($files as $file) { - if (substr($file, (strlen($file) - 1), 1) != '/' AND preg_match('#\.php$#', $file) AND !strpos($basepath, '3rdparty') AND !strpos($basepath, 'phpdoc') AND !strpos($basepath, 'jpgraph')) + if (substr($file, (strlen($file) - 1), 1) != '/' && preg_match('#\.php$#', $file) && !strpos($basepath, '3rdparty') && !strpos($basepath, 'phpdoc') && !strpos($basepath, 'jpgraph')) { $flatlist[] = "./$basepath$file"; } @@ -145,7 +145,7 @@ function fetch_calls($file, $methodlist, $limiters, $count) // remove invalid tokens $i = 0; - foreach ($tokens AS $id => $bit) + foreach ($tokens as $id => $bit) { unset($tokens["$id"]); if (is_array($bit)) @@ -164,7 +164,7 @@ function fetch_calls($file, $methodlist, $limiters, $count) { $gt["$i"][0] = '-1'; $gt["$i"][1] = $bit; - if ($bit == '(' OR $bit == ')') + if ($bit == '(' || $bit == ')') { $gt["$i"][2] = 'P_' . ($bit == '(' ? 'OPEN' : 'CLOSE'); } @@ -180,7 +180,7 @@ function fetch_calls($file, $methodlist, $limiters, $count) // get what we're looking for $triggers = array('new' => array(), 'popen' => array()); - foreach ($methodlist['classes'] AS $name => $methods) + foreach ($methodlist['classes'] as $name => $methods) { $triggers['new'][] = $name; $triggers['popen'] = array_merge($triggers['popen'], $methods); @@ -188,21 +188,21 @@ function fetch_calls($file, $methodlist, $limiters, $count) $triggers['popen'] = array_merge($triggers['popen'], $methodlist['functions']); // find a list of all the defined objects - foreach ($gt AS $id => $bit) + foreach ($gt as $id => $bit) { $prevbit = $gt[ $id - 1 ]; $nextbit = $gt[ $id + 1 ]; if ($bit[2] == 'T_NEW') { - if ($prevbit[2] == 'T_VARIABLE' AND $nextbit[2] == 'T_STRING' AND in_array($nextbit[1], $triggers['new'])) + if ($prevbit[2] == 'T_VARIABLE' && $nextbit[2] == 'T_STRING' && in_array($nextbit[1], $triggers['new'])) { $objects["$prevbit[1]"] = $nextbit[1]; } } if ($bit[2] == 'T_EXTENDS') { - if ($prevbit[2] == 'T_STRING' AND $nextbit[2] == 'T_STRING' AND in_array($prevbit[1], $triggers['new']) AND in_array($prevbit[1], $triggers['new'])) + if ($prevbit[2] == 'T_STRING' && $nextbit[2] == 'T_STRING' && in_array($prevbit[1], $triggers['new']) && in_array($prevbit[1], $triggers['new'])) { $extends["$prevbit[1]"] = $nextbit[1]; } @@ -214,14 +214,14 @@ function fetch_calls($file, $methodlist, $limiters, $count) $root = 0; $stack = array(); $functlist = array(); - foreach ($gt AS $id => $bit) + foreach ($gt as $id => $bit) { $token = $bit[2]; $prevbit = $gt[ $id - 1 ]; $nextbit = $gt[ $id + 1 ]; // handle object calls - if ($token == 'T_DOUBLE_COLON' OR $token == 'T_PAAMAYIM_NEKUDOTAYIM' OR $token == 'T_OBJECT_OPERATOR') + if ($token == 'T_DOUBLE_COLON' || $token == 'T_PAAMAYIM_NEKUDOTAYIM' || $token == 'T_OBJECT_OPERATOR') { $classname = null; @@ -238,9 +238,9 @@ function fetch_calls($file, $methodlist, $limiters, $count) else if ($prevbit[1] == 'parent') { // find a class that the call could be in - foreach ($limiters AS $class => $limits) + foreach ($limiters as $class => $limits) { - if ($bit[3] > $limits[0] AND $bit[3] < $limits[1]) + if ($bit[3] > $limits[0] && $bit[3] < $limits[1]) { $refclass = $class; } @@ -260,9 +260,9 @@ function fetch_calls($file, $methodlist, $limiters, $count) else if ($prevbit[1] == '$this') { // find a class that the call could be in - foreach ($limiters AS $class => $limits) + foreach ($limiters as $class => $limits) { - if ($bit[3] > $limits[0] AND $bit[3] < $limits[1]) + if ($bit[3] > $limits[0] && $bit[3] < $limits[1]) { $refclass = $class; } @@ -285,19 +285,19 @@ function fetch_calls($file, $methodlist, $limiters, $count) } } // initial - else if ($token == 'T_STRING' AND $nextbit[2] == 'P_OPEN' AND $prevbit[2] != 'T_FUNCTION' AND $prevbit[2] != 'T_DOUBLE_COLON' AND $prevbit[2] != 'T_PAAMAYIM_NEKUDOTAYIM' AND $prevbit[2] != 'T_OBJECT_OPERATOR' AND !in_array($bit[1], $triggers['new'])) + else if ($token == 'T_STRING' && $nextbit[2] == 'P_OPEN' && $prevbit[2] != 'T_FUNCTION' && $prevbit[2] != 'T_DOUBLE_COLON' && $prevbit[2] != 'T_PAAMAYIM_NEKUDOTAYIM' && $prevbit[2] != 'T_OBJECT_OPERATOR' && !in_array($bit[1], $triggers['new'])) { $incall = true; $root = $id; $functlist["$id"] = $bit[1]; } // parens in call - else if ($token == 'P_OPEN' AND $incall) + else if ($token == 'P_OPEN' && $incall) { array_push($stack, $id); } // close parens in call - else if ($token == 'P_CLOSE' AND $incall) + else if ($token == 'P_CLOSE' && $incall) { // find the most recent function $end = array_pop($stack) - 1; @@ -309,7 +309,7 @@ function fetch_calls($file, $methodlist, $limiters, $count) } // we're done with all functions and the semi colon is next - if (count($stack) == 0 AND $nextbit[2] == 'SC') + if (count($stack) == 0 && $nextbit[2] == 'SC') { $incall = false; } @@ -347,7 +347,7 @@ function fetch_methods($file) // remove invalid tokens $i = 0; - foreach ($tokens AS $id => $bit) + foreach ($tokens as $id => $bit) { unset($tokens["$id"]); if (is_array($bit)) @@ -389,7 +389,7 @@ function fetch_methods($file) $infunction = false; $class = ''; $stack = array(); - foreach ($gt AS $id => $bit) + foreach ($gt as $id => $bit) { $token = $bit[2]; $nextbit = $gt[ $id + 1 ]; @@ -425,7 +425,7 @@ function fetch_methods($file) array_pop($stack); // breaking out of a method - if ($inclass AND $infunction) + if ($inclass && $infunction) { if (count($stack) < 2) { @@ -433,7 +433,7 @@ function fetch_methods($file) } } // breaking out of a class - else if ($inclass AND !$infunction) + else if ($inclass && !$infunction) { if (count($stack) < 1) { @@ -442,7 +442,7 @@ function fetch_methods($file) } } // breaking out of a function - else if (!$inclass AND $infunction) + else if (!$inclass && $infunction) { if (count($stack) == 0) { diff --git a/docs/tools/wordrunner.php b/docs/tools/wordrunner.php index 02bc8b6..bdc2eeb 100755 --- a/docs/tools/wordrunner.php +++ b/docs/tools/wordrunner.php @@ -46,9 +46,9 @@ else $punctstrip = str_replace(array('"', '"', '\'', '&', '/', '.', ',', '!', '@', ';', ':', '[', ']', '(', ')'), '', $wordrunner_text); $wordarray = preg_split('#[\s]+#', $punctstrip); - foreach ($wordarray AS $word) + foreach ($wordarray as $word) { - if (!is_int($word) AND trim($word)) + if (!is_int($word) && trim($word)) { $outputlist[ ucwords(strtolower($word)) ]++; } @@ -56,9 +56,9 @@ else arsort($outputlist); - foreach ($outputlist AS $word => $count) + foreach ($outputlist as $word => $count) { - if (($_POST['ignoresmalls'] AND $count > 3) OR !$_POST['ignoresmalls']) + if (($_POST['ignoresmalls'] && $count > 3) || !$_POST['ignoresmalls']) { echo "
$word$count