Changing our coding standards slightly:
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 23 Jan 2008 21:06:33 +0000 (16:06 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 23 Jan 2008 21:06:33 +0000 (16:06 -0500)
- foreach($a AS $b) goes to foreach($a as $b)
- ($a AND $b) goes to ($a && $b)
- ($a OR $b) goes to ($a || $b)

20 files changed:
Api.php
App.php
Functions.php
Input.php
Installer.php
Mail.php
Pagination.php
PrinterBaseElement.php
PrinterElement.php
PrinterRootElementForm.php
PrinterRootElementPage.php
PrinterRootElementTable.php
PrinterTableElement.php
Template.php
UnitTest/ApiTest.php
UnitTest/InputTest.php
docs/makepo.sh.php
docs/tools/create_schema.php
docs/tools/function_finder.php
docs/tools/wordrunner.php

diff --git a/Api.php b/Api.php
index 20f8488539ec99e825dd9dca7cc0a87e7e31d032..27d6ad728c401f22ef2ed25ee8b256a3ab6914eb 100644 (file)
--- 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 d894a7b7e480fa475b232bbe96a8d583f0630c99..bfbfb25f8e002df6158d4a1f21ebd78a3f954ff1 100644 (file)
--- 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 = '<select><option>Debug Notices (' . sizeof(self::$debugInfo) . ')</option>';
-               foreach (self::$debugInfo AS $notice)
+               foreach (self::$debugInfo as $notice)
                {
                        $output .= "<option>--- $notice</option>";
                }
index 89d1c22e3a27be3d0e53fb817a99f77361354752..8fb154ccb847f48c813e2f636d20be3e8052321e 100644 (file)
@@ -197,7 +197,7 @@ class BSFunctions
        */
        public static function download_file($file, $name, $exit = true)
        {
-               if (self::is_browser('ie') OR self::is_browser('opera') OR self::is_browser('safari'))
+               if (self::is_browser('ie') || self::is_browser('opera') || self::is_browser('safari'))
                {
                        $mime = 'application/octetstream';
                }
@@ -284,7 +284,7 @@ class BSFunctions
                // -------------------------------------------------------------------
                # Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1; .NET CLR 1.0.2914)
                # Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
-               if (preg_match('#msie ([0-9\.]+)#', $useragent, $matches) !== false AND !isset($browser['opera']))
+               if (preg_match('#msie ([0-9\.]+)#', $useragent, $matches) !== false && !isset($browser['opera']))
                {
                        if (isset($matches[1]))
                        {
@@ -322,7 +322,7 @@ class BSFunctions
                // -------------------------------------------------------------------
                # Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101
                # Mozilla/5.001 (Macintosh; N; PPC; ja) Gecko/25250101 MegaCorpBrowser/1.0 (MegaCorp, Inc.)
-               if (preg_match('#gecko/([0-9]+)#', $useragent, $matches) !== false AND !isset($browser['safari']))
+               if (preg_match('#gecko/([0-9]+)#', $useragent, $matches) !== false && !isset($browser['safari']))
                {
                        if (isset($matches[1]))
                        {
@@ -556,15 +556,15 @@ class BSFunctions
                $path = self::fetch_source_path($path);
                
                $dir = new DirectoryIterator($path);
-               foreach ($dir AS $file)
+               foreach ($dir as $file)
                {
                        $name = $file->getFilename();
-                       if (($file->isDot() OR $name[0] == '.') AND $ignoreDot)
+                       if (($file->isDot() || $name[0] == '.') && $ignoreDot)
                        {
                                continue;
                        }
                        
-                       if ($file->isDir() AND $recurse)
+                       if ($file->isDir() && $recurse)
                        {
                                $filelist = array_merge($filelist, self::_help_scan_directory($path . $name, $recurse, $ignoreDot, $pathAdd . BSFunctions::fetch_source_path(str_replace($path, '', $file->getPathname()))));
                                continue;
@@ -604,13 +604,13 @@ class BSFunctions
        */
        public static function array_strip_empty($array)
        {
-               foreach ($array AS $key => $value)
+               foreach ($array as $key => $value)
                {
                        if (is_array($array["$key"]))
                        {
                                $array["$key"] = self::array_strip_empty($array["$key"]);
                        }
-                       else if (empty($value) OR is_null($value))
+                       else if (empty($value) || is_null($value))
                        {
                                unset($array["$key"]);
                        }
@@ -642,7 +642,7 @@ class BSFunctions
 
                // Iterate backtrace
                $calls = array();
-               foreach ($backtrace AS $i => $call)
+               foreach ($backtrace as $i => $call)
                {
                        if (!isset($call['file']))
                        {
@@ -659,7 +659,7 @@ class BSFunctions
                        if (isset($call['args']))
                        {
                                $args = array();
-                               foreach ($call['args'] AS $arg)
+                               foreach ($call['args'] as $arg)
                                {
                                        if (is_array($arg))
                                        {
index bc8d107fb567b20940bc8fc322efdf28c4cb6d37..e34c28f2649e19164a3986561d525ffaf2503fdd 100644 (file)
--- a/Input.php
+++ b/Input.php
@@ -120,7 +120,7 @@ class BSInput
        */
        private function _sanitizeDataRecursive($data)
        {
-               foreach ($data AS $key => $value)
+               foreach ($data as $key => $value)
                {
                        if (is_array($value))
                        {
@@ -201,7 +201,7 @@ class BSInput
        public function escape($str, $force = true)
        {
                $db = BSApp::$db;
-               if ($this->magicquotes AND !$force)
+               if ($this->magicquotes && !$force)
                {
                        if ($db)
                        {
@@ -239,7 +239,7 @@ class BSInput
        */
        public function inputCleanArray($vars)
        {
-               foreach ($vars AS $varname => $type)
+               foreach ($vars as $varname => $type)
                {
                        $this->inputClean($varname, $type);
                }
@@ -367,7 +367,7 @@ class BSInput
        */
        private function _cleanArray($array, $type)
        {
-               foreach ($array AS $key => $value)
+               foreach ($array as $key => $value)
                {
                        $array["$key"] = $this->clean($value, $type);
                }
@@ -401,7 +401,7 @@ class BSInput
                {
                        $host = ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
                        
-                       if ($host AND $_SERVER['HTTP_REFERER'])
+                       if ($host && $_SERVER['HTTP_REFERER'])
                        {
                                $parts = parse_url($_SERVER['HTTP_REFERER']);
                                $ourhost = $parts['host'] . (isset($parts['port']) ? ":$parts[port]" : '');
index 56ed91765045160e551866cf06a55981c844b15e..4c587b711258cc737c035e4fd1c399eae1eaecc8 100644 (file)
@@ -66,7 +66,7 @@ abstract class BSInstaller
                }
                
                $methods = get_class_methods($this);
-               foreach ($methods AS $name)
+               foreach ($methods as $name)
                {
                        if (preg_match('/step([0-9]+)/', $name))
                        {
index ce4392e2fd432aa5024155dd72860ce7a37dcd09..a8afc2e0001a19afd41a9157d3b1482e28bcf126 100644 (file)
--- a/Mail.php
+++ b/Mail.php
@@ -242,13 +242,13 @@ class BSMail
                
                // attach additional headers
                $headers = BSFunctions::convert_line_breaks($this->headers, $this->delim);
-               $headers .= ((!preg_match("#{$this->delim}$#", $headers) AND $headers != '') ? "\n" : '') . "From: \"{$fromName}\" <{$from}>" . $this->delim;
+               $headers .= ((!preg_match("#{$this->delim}$#", $headers) && $headers != '') ? "\n" : '') . "From: \"{$fromName}\" <{$from}>" . $this->delim;
                $headers .= "Return-Path: {$from}" . $this->delim;
                $headers .= "X-Mailer: ISSO Mail Framework" . $this->delim;
                $headers .= "MIME-Version: 1.0" . $this->delim;
                
                // see if we need to use mime/multipart
-               if ($sendhtml AND !empty($bodyhtml) == true)
+               if ($sendhtml && !empty($bodyhtml) == true)
                {
                        $boundary = 'ISSO-MULTIPART-' . BSFunctions::Rand(10);
                        $headers .= "Content-Type: multipart/alternative; boundary=\"$boundary\"" . $this->delim;
index 6e3951cd989932f05568b782e23cedfeacf19d36..946556a12fb81d3b6b40aad5cbd7374864bd0984 100644 (file)
@@ -345,7 +345,7 @@ class BSPagination
                        {
                                $baselink .= '?';
                        }
-                       else if (!preg_match('#\?$#', $baselink) AND !preg_match('#(&|&amp;)$#', $baselink))
+                       else if (!preg_match('#\?$#', $baselink) && !preg_match('#(&|&amp;)$#', $baselink))
                        {
                                $baselink .= '&amp;';
                        }
index 99e22fb666f6f206c810f231c706beb4a9c39546..438d709691ca2a4ef90bdfe04e5d361212782bc0 100644 (file)
@@ -198,7 +198,7 @@ class BSPrinterBaseElement extends BSPrinterElement
                        case 'button':
                        case 'submit':
                        case 'reset':
-                               return '<input type="' . $this->type . '"' . $attrs . (($this->type == 'text' OR $this->type == 'password') ? ' size="35" maxlength="255"' : ''). $this->_prepareStyle() . ' />';
+                               return '<input type="' . $this->type . '"' . $attrs . (($this->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');
                                }
index ab229ca49fc38513047c237cc23ec6c3a4388b77..38c9d7c37b97280c67d4d6cd4807823cfa399995 100644 (file)
@@ -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;
                }
index f818d1bef10dd20ce64a2395a0f6bfe496e6d9a9..d059585cfc1b63725dc728145c94271be18688da 100644 (file)
@@ -125,7 +125,7 @@ class BSPrinterRootElementForm extends BSPrinterRootElement
        {
                $builder = '';
                
-               foreach ($this->children AS $child)
+               foreach ($this->children as $child)
                {
                        $builder .= "\n" . $child->paint();
                }
index 3130c3e8444ceadc159cd716b30f59a3600e6b77..33c29ab5f8ae36e3c64b364dec7f2a49c111d9b0 100644 (file)
@@ -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<link rel=\"stylesheet\" href=\"" . BSPrinter::get_stylesheet() . "\" />";
                echo "\n</head>\n<body>\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<br />\n" . '<div align="center"><strong>\1</strong> &mdash; r\2</div>', 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<div class=\"smallfont\">(" . $query['time'] . ")</div>\n<!--\n" . $query['trace'] . "\n-->\n\t\t"));
index d1aedbcbdd6c19cb502b856dc5a84c63b716c292..c8e96da0aab8a67d26567fdd0f7b87719d2fba16 100644 (file)
@@ -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();
index 0f09eed62be58330ff2a0ae3edf821d757b4e457..c7515cbb8a71ff7b3b271766005e92a5b5925beb 100644 (file)
@@ -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<td" . ($colspan > 1 ? ' colspan="' . $colspan . '"' : '') . ">" . $child->paint() . "</td>";
                }
                
index 6fb6314ce750f4e57b9879f9c267862b577846a3..b15d749219200d6852f286a8ebaa896e92f6ae94 100644 (file)
@@ -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 .= "<br />\n" . '<table cellpadding="4" cellspacing="1" border="0" align="center" width="30%" style="background-color: rgb(60, 60, 60); color: white">' . "\n\t" . '<tr><td><strong>Query Debug</strong></td></tr>';
                                
-                               foreach ($queries AS $query)
+                               foreach ($queries as $query)
                                {
                                        $debugBlock .= "\n\t<tr style=\"background-color: rgb(230, 230, 230); color: black\">";
                                        $debugBlock .= "\n\t\t<td>";
@@ -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;
                                        }
index 2caa68bef0235f91f06c1c2818e23a7245a0f661..034ca1108fac55a1e68d423dce57c7b506b9b9a2 100644 (file)
@@ -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)
                                {
index a94d74f46dc5a95a33751da1c75227cc384694c6..4c7c174664d01738261226de5dff44da71176886 100644 (file)
@@ -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);
                        }
index 29b7024004015fb36f20a7c514694980bcb0e15a..8e29d137fd14177a8305535b1bdd40b3679e7ef0 100755 (executable)
@@ -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 '<?php gettext("' . $text . '"); ?>';
 }
 
-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);
 }
index d49ffd6324123a9bbbf7e8e044a79ad825e281e5..d5f78f8722b81e559554df10015e32449fa4e039 100644 (file)
@@ -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\";";
                }
index 620b95703f1815acf10ea3dfdfc7271075acac68..4378e271f17254cd276ab41e522425094a874a4e 100755 (executable)
@@ -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)
                                {
index 02bc8b69667ba28cd48fec99b2fdc2945702048f..bdc2eebdb1fac7e3fcce1b14c330bd51ba6bfea6 100755 (executable)
@@ -46,9 +46,9 @@ else
        $punctstrip = str_replace(array('&quot;', '"', '\'', '&', '/', '.', ',', '!', '@', ';', ':', '[', ']', '(', ')'), '', $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 "<tr>\r\t<td>$word</td>\r\t<td>$count</td>\r</tr>\r";
                }