diff --git a/app/code/core/Mage/Admin/Model/Resource/Roles.php b/app/code/core/Mage/Admin/Model/Resource/Roles.php index 3c578b97b36..d86d1bcad8f 100644 --- a/app/code/core/Mage/Admin/Model/Resource/Roles.php +++ b/app/code/core/Mage/Admin/Model/Resource/Roles.php @@ -169,7 +169,7 @@ private function _updateRoleUsersAcl(Mage_Admin_Model_Roles $role) $users = $this->getRoleUsers($role); $rowsCount = 0; - if (sizeof($users) > 0) { + if (count($users)) { $bind = array('reload_acl_flag' => 1); $where = array('user_id IN(?)' => $users); $rowsCount = $write->update($this->_usersTable, $bind, $where); diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index 2ee9b879451..536c3ac9497 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -327,7 +327,7 @@ public function add(Mage_Core_Model_Abstract $user) $dbh = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); - if (sizeof($aRoles) > 0) { + if (count($aRoles)) { foreach ($aRoles as $idx => $data) { $conditions = array( 'role_id = ?' => $data['role_id'], diff --git a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php index d23525d5499..7cc4333765f 100644 --- a/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php @@ -53,14 +53,12 @@ protected function _addColumnFilterToCollection($column) } if ($column->getFilter()->getValue()) { $this->getCollection()->addFieldToFilter('user_id', array('in'=>$inRoleIds)); - } - else { - if($inRoleIds) { + } else { + if ($inRoleIds) { $this->getCollection()->addFieldToFilter('user_id', array('nin'=>$inRoleIds)); } } - } - else { + } else { parent::_addColumnFilterToCollection($column); } return $this; @@ -154,29 +152,29 @@ public function getGridUrl() return $this->getUrl('*/*/editrolegrid', array('rid' => $roleId)); } - protected function _getUsers($json=false) + protected function _getUsers($json = false) { - if ( $this->getRequest()->getParam('in_role_user') != "" ) { + if ($this->getRequest()->getParam('in_role_user') != "") { return (int)$this->getRequest()->getParam('in_role_user'); } $roleId = ( $this->getRequest()->getParam('rid') > 0 ) ? $this->getRequest()->getParam('rid') : Mage::registry('RID'); $users = Mage::getModel('api/roles')->setId($roleId)->getRoleUsers(); - if (sizeof($users) > 0) { - if ( $json ) { - $jsonUsers = Array(); - foreach($users as $usrid) $jsonUsers[$usrid] = 0; + if (count($users)) { + if ($json) { + $jsonUsers = array(); + foreach ($users as $usrid) { + $jsonUsers[$usrid] = 0; + } return Mage::helper('core')->jsonEncode((object)$jsonUsers); } else { return array_values($users); } } else { - if ( $json ) { + if ($json) { return '{}'; } else { return array(); } } } - } - diff --git a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php index f4aab047633..8672db23994 100644 --- a/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php +++ b/app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php @@ -276,7 +276,7 @@ public function getChartUrl($directUrl = true) // process each string in the array, and find the max length foreach ($this->getAllSeries() as $index => $serie) { - $localmaxlength[$index] = sizeof($serie); + $localmaxlength[$index] = count($serie); $localmaxvalue[$index] = max($serie); $localminvalue[$index] = min($serie); } @@ -318,7 +318,7 @@ public function getChartUrl($directUrl = true) foreach ($this->getAllSeries() as $index => $serie) { $thisdataarray = $serie; - for ($j = 0; $j < sizeof($thisdataarray); $j++) { + for ($j = 0; $j < count($thisdataarray); $j++) { $currentvalue = $thisdataarray[$j]; if (is_numeric($currentvalue)) { $ylocation = $yorigin + $currentvalue; @@ -341,7 +341,7 @@ public function getChartUrl($directUrl = true) $valueBuffer = array(); $rangeBuffer = ""; - if (sizeof($this->_axisLabels) > 0) { + if (count($this->_axisLabels)) { $params['chxt'] = implode(',', array_keys($this->_axisLabels)); $indexid = 0; foreach ($this->_axisLabels as $idx=>$labels){ @@ -380,15 +380,15 @@ public function getChartUrl($directUrl = true) $tmpstring = implode('|', $this->_axisLabels[$idx]); $valueBuffer[] = $indexid . ":|" . $tmpstring; - if (sizeof($this->_axisLabels[$idx]) > 1) { - $deltaX = 100/(sizeof($this->_axisLabels[$idx])-1); + if (count($this->_axisLabels[$idx]) > 1) { + $deltaX = 100/(count($this->_axisLabels[$idx])-1); } else { $deltaX = 100; } } else if ($idx == 'y') { $valueBuffer[] = $indexid . ":|" . implode('|', $yLabels); - if (sizeof($yLabels)-1) { - $deltaY = 100/(sizeof($yLabels)-1); + if (count($yLabels)-1) { + $deltaY = 100/(count($yLabels)-1); } else { $deltaY = 100; } diff --git a/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php b/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php index 82edff86be0..5482f4284f2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php +++ b/app/code/core/Mage/Adminhtml/Block/Permissions/Role/Grid/User.php @@ -161,7 +161,7 @@ protected function _getUsers($json=false) } $roleId = ( $this->getRequest()->getParam('rid') > 0 ) ? $this->getRequest()->getParam('rid') : Mage::registry('RID'); $users = Mage::getModel('admin/roles')->setId($roleId)->getRoleUsers(); - if (sizeof($users) > 0) { + if (count($users)) { if ( $json ) { $jsonUsers = Array(); foreach($users as $usrid) $jsonUsers[$usrid] = 0; diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php index 92309019b27..438aff6cad9 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php @@ -128,7 +128,7 @@ protected function _prepareCollection() $this->_setFilterValues($data); } else if ($filter && is_array($filter)) { $this->_setFilterValues($filter); - } else if(0 !== sizeof($this->_defaultFilter)) { + } else if(count($this->_defaultFilter)) { $this->_setFilterValues($this->_defaultFilter); } /** @var $collection Mage_Reports_Model_Resource_Report_Collection */ diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php index 7e760380062..32b6e6ac20d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Giftmessage.php @@ -68,7 +68,7 @@ public function getItems() } } - if(sizeof($items)) { + if(count($items)) { return $items; } diff --git a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php index c6334b2212c..d1cb36306c8 100644 --- a/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php +++ b/app/code/core/Mage/Adminhtml/Block/System/Currency/Rate/Matrix.php @@ -84,7 +84,7 @@ protected function _prepareRates($array) foreach ($array as $key => $rate) { foreach ($rate as $code => $value) { $parts = explode('.', $value); - if( sizeof($parts) == 2 ) { + if( count($parts) === 2 ) { $parts[1] = str_pad(rtrim($parts[1], 0), 4, '0', STR_PAD_RIGHT); $array[$key][$code] = join('.', $parts); } elseif( $value > 0 ) { diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php index cb2a420a149..3e217812f12 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php @@ -536,7 +536,7 @@ protected function _prepareCollection() else if ($filter && is_array($filter)) { $this->_setFilterValues($filter); } - else if(0 !== sizeof($this->_defaultFilter)) { + else if(count($this->_defaultFilter)) { $this->_setFilterValues($this->_defaultFilter); } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php index 84e6ba6b710..5b7eb6cd46c 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Action.php @@ -48,7 +48,7 @@ public function render(Varien_Object $row) return ' '; } - if(sizeof($actions)==1 && !$this->getColumn()->getNoLink()) { + if(count($actions) === 1 && !$this->getColumn()->getNoLink()) { foreach ($actions as $action) { if ( is_array($action) ) { return $this->_toLinkHtml($action, $row); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php index da8dfbcd32a..9c2febd8834 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Massaction/Abstract.php @@ -129,7 +129,7 @@ public function getItemsJson() */ public function getCount() { - return sizeof($this->_items); + return count($this->_items); } /** diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php index 759b77079f5..43cb0c9da8a 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php +++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php @@ -70,7 +70,7 @@ public function getItems() public function getCount() { - return sizeof($this->getItems()); + return count($this->getItems()); } public function getColumn($index) diff --git a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php index 63744d13b20..93a059b05b3 100644 --- a/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php +++ b/app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php @@ -58,7 +58,7 @@ public function getStores() */ public function countStores() { - return sizeof($this->_stores->getItems()); + return count($this->_stores->getItems()); } /** diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php index 2c6cba314fc..977931919b3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Api/UserController.php @@ -156,11 +156,11 @@ public function saveAction() if ( $uRoles = $this->getRequest()->getParam('roles', false) ) { /*parse_str($uRoles, $uRoles); $uRoles = array_keys($uRoles);*/ - if ( 1 == sizeof($uRoles) ) { + if (count($uRoles) === 1) { $model->setRoleIds($uRoles) ->setRoleUserId($model->getUserId()) ->saveRelations(); - } else if ( sizeof($uRoles) > 1 ) { + } else if (count($uRoles) > 1) { //@FIXME: stupid fix of previous multi-roles logic. //@TODO: make proper DB upgrade in the future revisions. $rs = array(); diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php index bd0f175b3f5..dc55a6fdae9 100644 --- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php +++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php @@ -144,7 +144,7 @@ public function globalSearchAction() ->getResults(); $items = array_merge_recursive($items, $results); } - $totalCount = sizeof($items); + $totalCount = count($items); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php index d223971966b..9ad6ea70e6c 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Permissions/UserController.php @@ -158,11 +158,11 @@ public function saveAction() if ( $uRoles = $this->getRequest()->getParam('roles', false) ) { /*parse_str($uRoles, $uRoles); $uRoles = array_keys($uRoles);*/ - if ( 1 == sizeof($uRoles) ) { + if (count($uRoles) === 1) { $model->setRoleIds($uRoles) ->setRoleUserId($model->getUserId()) ->saveRelations(); - } else if ( sizeof($uRoles) > 1 ) { + } else if (count($uRoles) > 1) { //@FIXME: stupid fix of previous multi-roles logic. //@TODO: make proper DB upgrade in the future revisions. $rs = array(); diff --git a/app/code/core/Mage/Adminhtml/controllers/PollController.php b/app/code/core/Mage/Adminhtml/controllers/PollController.php index 52998ceff48..393ed7bbd1e 100644 --- a/app/code/core/Mage/Adminhtml/controllers/PollController.php +++ b/app/code/core/Mage/Adminhtml/controllers/PollController.php @@ -162,7 +162,7 @@ public function validateAction() $answers = $this->getRequest()->getParam('answer'); - if( !is_array($answers) || sizeof($answers) == 0 ) { + if( !is_array($answers) || !count($answers) ) { Mage::throwException(Mage::helper('adminhtml')->__('Please, add some answers to this poll first.')); } diff --git a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php b/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php index f5aa69e9674..ecd09a747aa 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php @@ -78,7 +78,7 @@ public function fetchRatesAction() } $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); - if( sizeof($errors) > 0 ) { + if(count($errors)) { foreach ($errors as $error) { Mage::getSingleton('adminhtml/session')->addWarning($error); } diff --git a/app/code/core/Mage/Api/Model/Resource/Roles.php b/app/code/core/Mage/Api/Model/Resource/Roles.php index dc5f130b2a8..46b0009ed21 100644 --- a/app/code/core/Mage/Api/Model/Resource/Roles.php +++ b/app/code/core/Mage/Api/Model/Resource/Roles.php @@ -140,7 +140,7 @@ private function _updateRoleUsersAcl(Mage_Api_Model_Roles $role) { $users = $this->getRoleUsers($role); $rowsCount = 0; - if (sizeof($users) > 0) { + if (count($users)) { $rowsCount = $this->_getWriteAdapter()->update( $this->_usersTable, array('reload_acl_flag' => 1), diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index 7430970ab1d..5bb73b84118 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -346,7 +346,7 @@ public function add(Mage_Core_Model_Abstract $user) { $adapter = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); - if (sizeof($aRoles) > 0) { + if (count($aRoles)) { foreach ($aRoles as $idx => $data) { $adapter->delete( $this->getTable('api/role'), diff --git a/app/code/core/Mage/Api2/controllers/Adminhtml/Api2/RoleController.php b/app/code/core/Mage/Api2/controllers/Adminhtml/Api2/RoleController.php index b03c50032c6..4178291e00d 100644 --- a/app/code/core/Mage/Api2/controllers/Adminhtml/Api2/RoleController.php +++ b/app/code/core/Mage/Api2/controllers/Adminhtml/Api2/RoleController.php @@ -330,7 +330,7 @@ protected function _getUsers($id) $resource = $role->getResource(); $users = $resource->getRoleUsers($role); - if (sizeof($users) == 0) { + if (!count($users)) { $users = array(); } diff --git a/app/code/core/Mage/Catalog/Helper/Image.php b/app/code/core/Mage/Catalog/Helper/Image.php index c193308dd42..57a7251cc66 100644 --- a/app/code/core/Mage/Catalog/Helper/Image.php +++ b/app/code/core/Mage/Catalog/Helper/Image.php @@ -573,7 +573,7 @@ protected function getImageFile() protected function parseSize($string) { $size = explode('x', strtolower($string)); - if (sizeof($size) == 2) { + if (count($size) === 2) { return array( 'width' => ($size[0] > 0) ? $size[0] : null, 'heigth' => ($size[1] > 0) ? $size[1] : null, diff --git a/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php b/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php index a4a06dc731f..7121c7fc351 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Parser/Product.php @@ -388,7 +388,7 @@ public function parse() } // set importinted to adaptor - if (sizeof($inventoryFields) > 0) { + if (count($inventoryFields)) { Mage::register('current_imported_inventory', $inventoryFields); //$this->setInventoryItems($inventoryFields); } // end setting imported to adaptor diff --git a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php index 3112eea043f..12a401e1c5f 100644 --- a/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php +++ b/app/code/core/Mage/Catalog/Model/Entity/Product/Attribute/Design/Options/Container.php @@ -49,7 +49,7 @@ public function __construct() public function getOptionText($value) { $options = $this->getAllOptions(); - if (sizeof($options) > 0) { + if (count($options)) { foreach ($options as $option) { if (isset($option['value']) && $option['value'] == $value) { return $option['label']; diff --git a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php index efa924ea60d..3ce1b421a23 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php @@ -592,7 +592,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) if (!is_array($attribute)) { $attribute = array($attribute); - } elseif (sizeof($attribute) > 1) { + } elseif (count($attribute) > 1) { $returnArray = true; } @@ -685,7 +685,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) } } - if (sizeof($attributesData) == 1 && !$returnArray) { + if (count($attributesData) === 1 && !$returnArray) { $_data = reset($attributesData); $attributesData = $_data; } diff --git a/app/code/core/Mage/Core/Block/Abstract.php b/app/code/core/Mage/Core/Block/Abstract.php index 0ac1ca6d3f1..e11e5b702ae 100644 --- a/app/code/core/Mage/Core/Block/Abstract.php +++ b/app/code/core/Mage/Core/Block/Abstract.php @@ -446,7 +446,7 @@ public function setChild($alias, $block) if ($block->getIsAnonymous()) { $suffix = $block->getAnonSuffix(); if (empty($suffix)) { - $suffix = 'child' . sizeof($this->_children); + $suffix = 'child' . count($this->_children); } $blockName = $this->getNameInLayout() . '.' . $suffix; diff --git a/app/code/core/Mage/Core/Controller/Varien/Action.php b/app/code/core/Mage/Core/Controller/Varien/Action.php index d2be6b6b1cd..7c6e1b8c760 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Action.php +++ b/app/code/core/Mage/Core/Controller/Varien/Action.php @@ -869,13 +869,13 @@ protected function _rewrite() if (!($rewrite->actions && $rewrite->actions->$action) || $rewrite->is('override_actions')) { $t = explode('/', (string)$rewrite->to); - if (sizeof($t)!==2 || empty($t[0]) || empty($t[1])) { + if (count($t)!==2 || empty($t[0]) || empty($t[1])) { return false; } $t[2] = $action; } else { $t = explode('/', (string)$rewrite->actions->$action->to); - if (sizeof($t)!==3 || empty($t[0]) || empty($t[1]) || empty($t[2])) { + if (count($t)!==3 || empty($t[0]) || empty($t[1]) || empty($t[2])) { return false; } } diff --git a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php index eee5d90f58b..ec1f028e9a9 100644 --- a/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php +++ b/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php @@ -245,7 +245,7 @@ public function match(Zend_Controller_Request_Http $request) $request->setControllerModule($realModule); // set parameters from pathinfo - for ($i = 3, $l = sizeof($p); $i < $l; $i += 2) { + for ($i = 3, $l = count($p); $i < $l; $i += 2) { $request->setParam($p[$i], isset($p[$i+1]) ? urldecode($p[$i+1]) : ''); } diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php index ca2dc6fc8bc..ca726021cf0 100644 --- a/app/code/core/Mage/Core/Model/Layout.php +++ b/app/code/core/Mage/Core/Model/Layout.php @@ -445,7 +445,7 @@ public function createBlock($type, $name='', array $attributes = array()) if (!empty($name)) { $block->setAnonSuffix(substr($name, 1)); } - $name = 'ANONYMOUS_'.sizeof($this->_blocks); + $name = 'ANONYMOUS_'.count($this->_blocks); } elseif (isset($this->_blocks[$name]) && Mage::getIsDeveloperMode()) { //Mage::throwException(Mage::helper('core')->__('Block with name "%s" already exists', $name)); } diff --git a/app/code/core/Mage/Core/Model/Resource/Email/Queue.php b/app/code/core/Mage/Core/Model/Resource/Email/Queue.php index ea0533d58c0..857827661c6 100644 --- a/app/code/core/Mage/Core/Model/Resource/Email/Queue.php +++ b/app/code/core/Mage/Core/Model/Resource/Email/Queue.php @@ -101,7 +101,7 @@ public function wasEmailQueued(Mage_Core_Model_Email_Queue $queue) $newEmails[$email] = array($email, $name, $type); } $diff = array_diff_key($newEmails, $oldEmails); - if (sizeof($diff) > 0) { + if (count($diff)) { $queue->clearRecipients(); foreach ($diff as $recipient) { list($email, $name, $type) = $recipient; diff --git a/app/code/core/Mage/Cron/Model/Schedule.php b/app/code/core/Mage/Cron/Model/Schedule.php index c0d9915235d..484fd79370a 100644 --- a/app/code/core/Mage/Cron/Model/Schedule.php +++ b/app/code/core/Mage/Cron/Model/Schedule.php @@ -73,7 +73,7 @@ public function _construct() public function setCronExpr($expr) { $e = preg_split('#\s+#', $expr, null, PREG_SPLIT_NO_EMPTY); - if (sizeof($e) < 5 || sizeof($e) > 6) { + if (count($e) < 5 || count($e) > 6) { throw Mage::exception('Mage_Cron', 'Invalid cron expression: '.$expr); } @@ -144,7 +144,7 @@ public function matchCronExpression($expr, $num) // handle modulus if (strpos($expr, '/')!==false) { $e = explode('/', $expr); - if (sizeof($e)!==2) { + if (count($e)!==2) { throw Mage::exception('Mage_Cron', "Invalid cron expression, expecting 'match/modulus': ".$expr); } if (!is_numeric($e[1])) { @@ -163,7 +163,7 @@ public function matchCronExpression($expr, $num) } // handle range elseif (strpos($expr, '-')!==false) { $e = explode('-', $expr); - if (sizeof($e)!==2) { + if (count($e)!==2) { throw Mage::exception('Mage_Cron', "Invalid cron expression, expecting 'from-to' structure: ".$expr); } diff --git a/app/code/core/Mage/Customer/Block/Account/Navigation.php b/app/code/core/Mage/Customer/Block/Account/Navigation.php index 3da3a39f8b2..7d9cdb53797 100644 --- a/app/code/core/Mage/Customer/Block/Account/Navigation.php +++ b/app/code/core/Mage/Customer/Block/Account/Navigation.php @@ -116,7 +116,7 @@ public function isActive($link) protected function _completePath($path) { $path = rtrim($path, '/'); - switch (sizeof(explode('/', $path))) { + switch (count(explode('/', $path))) { case 1: $path .= '/index'; // no break diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php index 68d365aa116..9bf94ccbc7e 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Collection.php @@ -51,7 +51,7 @@ public function addItem($name, Mage_Dataflow_Model_Convert_Container_Interface $ if ($item->getName()) { $name = $item->getName(); } else { - $name = sizeof($this->_items); + $name = count($this->_items); } } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php index cc9a66e013f..861fc74d661 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php @@ -164,7 +164,7 @@ public function parse() public function parseRow($i, $line) { - if (sizeof($line) == 1) return false; + if (count($line) === 1) return false; if (0==$i) { if ($this->getVar('fieldnames')) { diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php index 06bc73b91b8..eb235637695 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php @@ -225,7 +225,7 @@ public function parse() } } $data[$wsName] = $wsData; - $this->addException('Found worksheet "'.$wsName.'" with '.sizeof($wsData).' row(s)'); + $this->addException('Found worksheet "'.$wsName.'" with '.count($wsData).' row(s)'); } if ($wsName = $this->getVar('single_sheet')) { if (isset($data[$wsName])) { diff --git a/app/code/core/Mage/Dataflow/Model/Profile.php b/app/code/core/Mage/Dataflow/Model/Profile.php index 81afe0709bb..7470919204d 100644 --- a/app/code/core/Mage/Dataflow/Model/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Profile.php @@ -393,7 +393,7 @@ public function _parseGuiData() } $mapXml .= '' . $nl; $map = $p['map'][$this->getEntityType()]; - if (sizeof($map['db']) > 0) { + if (count($map['db'])) { $from = $map[$import?'file':'db']; $to = $map[$import?'db':'file']; $mapXml .= ' ' . $nl; diff --git a/app/code/core/Mage/Directory/Model/Observer.php b/app/code/core/Mage/Directory/Model/Observer.php index 5cb507396cc..a9700bba5b7 100644 --- a/app/code/core/Mage/Directory/Model/Observer.php +++ b/app/code/core/Mage/Directory/Model/Observer.php @@ -65,13 +65,13 @@ public function scheduledUpdateCurrencyRates($schedule) $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); - if (sizeof($errors) > 0) { + if (count($errors)) { foreach ($errors as $error) { $importWarnings[] = Mage::helper('directory')->__('WARNING:') . ' ' . $error; } } - if (sizeof($importWarnings) == 0) { + if (!count($importWarnings)) { Mage::getModel('directory/currency')->saveRates($rates); } else { $translate = Mage::getSingleton('core/translate'); diff --git a/app/code/core/Mage/Directory/Model/Resource/Currency.php b/app/code/core/Mage/Directory/Model/Resource/Currency.php index 2879592039c..15507d8cfe7 100644 --- a/app/code/core/Mage/Directory/Model/Resource/Currency.php +++ b/app/code/core/Mage/Directory/Model/Resource/Currency.php @@ -149,7 +149,7 @@ public function getAnyRate($currencyFrom, $currencyTo) */ public function saveRates($rates) { - if (is_array($rates) && sizeof($rates) > 0) { + if (is_array($rates) && count($rates)) { $adapter = $this->_getWriteAdapter(); $data = array(); foreach ($rates as $currencyCode => $rate) { diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php index 95d0bd32431..a624a58d4a1 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php @@ -613,7 +613,7 @@ protected function _isApplicableAttribute($object, $attribute) public function walkAttributes($partMethod, array $args = array()) { $methodArr = explode('/', $partMethod); - switch (sizeof($methodArr)) { + switch (count($methodArr)) { case 1: $part = 'attribute'; $method = $methodArr[0]; diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php index ac681826327..3ed8d5542ce 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Source/Abstract.php @@ -81,7 +81,7 @@ public function getOptionText($value) { $options = $this->getAllOptions(); // Fixed for tax_class_id and custom_design - if (sizeof($options) > 0) foreach($options as $option) { + if (count($options)) foreach($options as $option) { if (isset($option['value']) && $option['value'] == $value) { return isset($option['label']) ? $option['label'] : $option['value']; } diff --git a/app/code/core/Mage/Media/Model/Image.php b/app/code/core/Mage/Media/Model/Image.php index 09c1f9c542d..8f6e1ee89cb 100644 --- a/app/code/core/Mage/Media/Model/Image.php +++ b/app/code/core/Mage/Media/Model/Image.php @@ -157,7 +157,7 @@ public function getExtension() */ public function getFilePath($useParams = false) { - if ($useParams && sizeof($this->getParams())) { + if ($useParams && count($this->getParams())) { $changes = '.' . $this->getParamsSum(); } else { $changes = ''; @@ -173,7 +173,7 @@ public function getFilePath($useParams = false) */ public function getFileUrl($useParams = false) { - if ($useParams && sizeof($this->getParams())) { + if ($useParams && count($this->getParams())) { $changes = '.' . $this->getParamsSum(); } else { $changes = ''; diff --git a/app/code/core/Mage/Page/Block/Html/Pager.php b/app/code/core/Mage/Page/Block/Html/Pager.php index 76f5a9e4183..a7433df754a 100644 --- a/app/code/core/Mage/Page/Block/Html/Pager.php +++ b/app/code/core/Mage/Page/Block/Html/Pager.php @@ -175,7 +175,7 @@ public function setShowPerPage($varName) public function getShowPerPage() { - if(sizeof($this->getAvailableLimit())<=1) { + if(count($this->getAvailableLimit())<=1) { return false; } return $this->_showPerPage; diff --git a/app/code/core/Mage/Review/Model/Review.php b/app/code/core/Mage/Review/Model/Review.php index 37e45a005e0..ca6865cf5d3 100644 --- a/app/code/core/Mage/Review/Model/Review.php +++ b/app/code/core/Mage/Review/Model/Review.php @@ -161,7 +161,7 @@ public function appendSummary($collection) $entityIds[] = $_item->getId(); } - if (sizeof($entityIds) == 0) { + if (!count($entityIds)) { return $this; } diff --git a/app/code/core/Mage/Rss/Block/Catalog/Special.php b/app/code/core/Mage/Rss/Block/Catalog/Special.php index efc623a3e9f..301bfb32a22 100644 --- a/app/code/core/Mage/Rss/Block/Catalog/Special.php +++ b/app/code/core/Mage/Rss/Block/Catalog/Special.php @@ -102,7 +102,7 @@ protected function _toHtml() array('rssObj'=> $rssObj, 'results'=> &$results) ); - if (sizeof($results)>0) { + if (count($results)) { foreach($results as $result){ // render a row for RSS feed $product->setData($result); diff --git a/app/code/core/Mage/Rule/Model/Abstract.php b/app/code/core/Mage/Rule/Model/Abstract.php index 42d63557d67..702b1379131 100644 --- a/app/code/core/Mage/Rule/Model/Abstract.php +++ b/app/code/core/Mage/Rule/Model/Abstract.php @@ -312,7 +312,7 @@ protected function _convertFlatToRecursive(array $data) foreach ($value as $id=>$data) { $path = explode('--', $id); $node =& $arr; - for ($i=0, $l=sizeof($path); $i<$l; $i++) { + for ($i=0, $l=count($path); $i<$l; $i++) { if (!isset($node[$key][$path[$i]])) { $node[$key][$path[$i]] = array(); } diff --git a/app/code/core/Mage/Rule/Model/Action/Collection.php b/app/code/core/Mage/Rule/Model/Action/Collection.php index 715a9a72fa4..04afe222008 100644 --- a/app/code/core/Mage/Rule/Model/Action/Collection.php +++ b/app/code/core/Mage/Rule/Model/Action/Collection.php @@ -78,7 +78,7 @@ public function addAction(Mage_Rule_Model_Action_Interface $action) $actions[] = $action; if (!$action->getId()) { - $action->setId($this->getId().'.'.sizeof($actions)); + $action->setId($this->getId().'.'.count($actions)); } $this->setActions($actions); diff --git a/app/code/core/Mage/Rule/Model/Condition/Combine.php b/app/code/core/Mage/Rule/Model/Condition/Combine.php index 8d4780ef488..0ad90519c01 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Combine.php +++ b/app/code/core/Mage/Rule/Model/Condition/Combine.php @@ -161,7 +161,7 @@ public function addCondition($condition) $conditions[] = $condition; if (!$condition->getId()) { - $condition->setId($this->getId().'--'.sizeof($conditions)); + $condition->setId($this->getId().'--'.count($conditions)); } $this->setData($this->getPrefix(), $conditions); diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php index e0ae811abca..863ab1bf597 100644 --- a/app/code/core/Mage/Sales/Model/Quote.php +++ b/app/code/core/Mage/Sales/Model/Quote.php @@ -869,7 +869,7 @@ public function getAllVisibleItems() */ public function hasItems() { - return sizeof($this->getAllItems())>0; + return count($this->getAllItems())>0; } /** diff --git a/app/code/core/Mage/Sales/Model/Quote/Address.php b/app/code/core/Mage/Sales/Model/Quote/Address.php index c14a3ebd8e8..afe743c0557 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address.php @@ -700,7 +700,7 @@ public function getItemQty($itemId = 0) */ public function hasItems() { - return sizeof($this->getAllItems())>0; + return count($this->getAllItems()) > 0; } /** diff --git a/app/code/core/Mage/Tag/Block/Customer/View.php b/app/code/core/Mage/Tag/Block/Customer/View.php index a1e7cf27dcd..a7ef49305d1 100644 --- a/app/code/core/Mage/Tag/Block/Customer/View.php +++ b/app/code/core/Mage/Tag/Block/Customer/View.php @@ -92,7 +92,7 @@ public function getMyProducts() */ public function getCount() { - return sizeof($this->getMyProducts()); + return count($this->getMyProducts()); } /** diff --git a/app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php b/app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php index ff1f95de45a..241ec94b622 100644 --- a/app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php +++ b/app/code/core/Mage/Tag/Model/Resource/Customer/Collection.php @@ -289,7 +289,7 @@ public function addProductName() $productsId = array_unique($productsId); /* small fix */ - if (sizeof($productsId) == 0) { + if (!count($productsId)) { return $this; } diff --git a/app/code/core/Mage/Tag/Model/Resource/Product/Collection.php b/app/code/core/Mage/Tag/Model/Resource/Product/Collection.php index c5d6f97b4b3..4d2f59fc67a 100644 --- a/app/code/core/Mage/Tag/Model/Resource/Product/Collection.php +++ b/app/code/core/Mage/Tag/Model/Resource/Product/Collection.php @@ -144,7 +144,7 @@ protected function _addStoresVisibility() } $tagsStores = array(); - if (sizeof($tagIds) > 0) { + if (count($tagIds)) { $select = $this->getConnection()->select() ->from($this->getTable('tag/relation'), array('store_id', 'tag_id')) ->where('tag_id IN(?)', $tagIds); @@ -313,7 +313,7 @@ public function addPopularityFilter($condition) $prodIds[] = $item['product_id']; } - if (sizeof($prodIds) > 0) { + if (count($prodIds)) { $this->getSelect()->where('e.entity_id IN(?)', $prodIds); } else { $this->getSelect()->where('e.entity_id IN(0)'); diff --git a/app/code/core/Mage/Tag/Model/Resource/Tag/Collection.php b/app/code/core/Mage/Tag/Model/Resource/Tag/Collection.php index 113507c176d..539bc524895 100644 --- a/app/code/core/Mage/Tag/Model/Resource/Tag/Collection.php +++ b/app/code/core/Mage/Tag/Model/Resource/Tag/Collection.php @@ -231,7 +231,7 @@ protected function _addStoresVisibility() $tagIds = $this->getColumnValues('tag_id'); $tagsStores = array(); - if (sizeof($tagIds) > 0) { + if (count($tagIds)) { $select = $this->getConnection()->select() ->from($this->getTable('tag/summary'), array('store_id', 'tag_id')) ->where('tag_id IN(?)', $tagIds); diff --git a/app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php b/app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php index 2ff752af575..fffcc4ad721 100644 --- a/app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php +++ b/app/code/core/Mage/XmlConnect/Block/Adminhtml/Connect/Dashboard/GraphDataAbstract.php @@ -140,7 +140,7 @@ public function getChartData() $valueBuffer = array(); $params = array(); - if (sizeof($this->_axisLabels) > 0) { + if (count($this->_axisLabels)) { $indexId = 0; foreach ($this->_axisLabels as $idx => $labels) { if ($idx == self::AXIS_X) { diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Category.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Category.php index d76628584dd..02255ec867d 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Category.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Category.php @@ -72,7 +72,7 @@ protected function _toHtml() $categoryCollection = $this->getCurrentChildCategories(); // subcategories are exists - if (sizeof($categoryCollection)) { + if (count($categoryCollection)) { $itemsXmlObj = $categoryXmlObj->addChild('items'); $categoryImageSize = Mage::getModel('xmlconnect/images')->getImageLimitParam('content/category'); foreach ($categoryCollection as $item) { diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php index b5f3dfbc31d..ef27b1f479c 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Filters.php @@ -47,7 +47,7 @@ protected function _toHtml() $filtersXmlObj = $categoryXmlObj->addChild('filters'); foreach ($filtersCollection->getItems() as $item) { - if (!sizeof($item->getValues())) { + if (!count($item->getValues())) { continue; } $itemXmlObj = $filtersXmlObj->addChild('item'); diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Product.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Product.php index 4f113ec1c2e..74530881436 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Product.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Product.php @@ -76,7 +76,7 @@ public function productToXmlObject(Mage_Catalog_Model_Product $product, $itemNod */ $hasGallery = 1; if ($product->getMediaGalleryImages()) { - $hasGallery = sizeof($product->getMediaGalleryImages()) > 0 ? 1 : 0; + $hasGallery = count($product->getMediaGalleryImages()) ? 1 : 0; } $item->addChild('has_gallery', $hasGallery); /** diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php index 078ed4e037a..987b69c2ce4 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options.php @@ -83,7 +83,7 @@ public function getProductCustomOptionsXmlObject(Mage_Catalog_Model_Product $pro return $xmlModel; } $xmlModel->addAttribute('id', $product->getId()); - if (!$product->isSaleable() || !sizeof($product->getOptions())) { + if (!$product->isSaleable() || !count($product->getOptions())) { return $xmlModel; } diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php index 278e766f7dc..e47e12466ca 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Bundle.php @@ -62,7 +62,7 @@ public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObj $product->getTypeInstance(true)->getOptionsIds($product), $product ); $bundleOptions = $optionCollection->appendSelections($selectionCollection, false, false); - if (!sizeof($bundleOptions)) { + if (!count($bundleOptions)) { return $isObject ? $xmlModel : $xmlModel->asNiceXml(); } diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php index 585fc842bc4..5c0c69aebac 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Configurable.php @@ -58,7 +58,7 @@ public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObj * Configurable attributes */ $productAttributes = $product->getTypeInstance(true)->getConfigurableAttributes($product); - if (!sizeof($productAttributes)) { + if (!count($productAttributes)) { return $isObject ? $xmlModel : $xmlModel->asNiceXml(); } @@ -122,7 +122,7 @@ public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObj } } - if (sizeof($info['options']) > 0) { + if (count($info['options'])) { $attributes[$attributeId] = $info; } } @@ -146,7 +146,7 @@ public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObj $valueNode->addAttribute('price', $option['price']); $valueNode->addAttribute('formated_price', $option['formated_price']); } - if (sizeof($productAttributes) > 1) { + if (count($productAttributes) > 1) { $this->_prepareRecursivelyRelatedValues($valueNode, $productAttributes, $option['products'], 1); } if ($product->hasPreconfiguredValues()) { diff --git a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php index 8c0a156b7d9..0800182e8bb 100644 --- a/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php +++ b/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Options/Grouped.php @@ -56,7 +56,7 @@ public function getProductOptionsXml(Mage_Catalog_Model_Product $product, $isObj * Grouped (associated) products */ $associatedProducts = $product->getTypeInstance(true)->getAssociatedProducts($product); - if (!sizeof($associatedProducts)) { + if (!count($associatedProducts)) { return $isObject ? $xmlModel : $xmlModel->asNiceXml(); } diff --git a/app/code/core/Mage/XmlConnect/Block/Home.php b/app/code/core/Mage/XmlConnect/Block/Home.php index e66391cf366..e1b2043d13e 100644 --- a/app/code/core/Mage/XmlConnect/Block/Home.php +++ b/app/code/core/Mage/XmlConnect/Block/Home.php @@ -61,7 +61,7 @@ protected function _toHtml() } } - if (sizeof($categoryCollection)) { + if (count($categoryCollection)) { $itemsXmlObj = $homeXmlObj->addChild('categories'); } diff --git a/app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php b/app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php index 8f0e33b712b..0a83b40eebb 100644 --- a/app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php +++ b/app/code/core/Mage/XmlConnect/Model/Simplexml/Element.php @@ -41,7 +41,7 @@ class Mage_XmlConnect_Model_Simplexml_Element extends Varien_Simplexml_Element */ public function appendChild($source) { - if (sizeof($source->children())) { + if (count($source->children())) { $name = $source->getName(); $child = $this->addChild($name); } else {