Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Resource/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
26 changes: 12 additions & 14 deletions app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
}

}

14 changes: 7 additions & 7 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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){
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Report/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getItems()
}
}

if(sizeof($items)) {
if(count($items)) {
return $items;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function render(Varien_Object $row)
return '&nbsp;';
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function getItemsJson()
*/
public function getCount()
{
return sizeof($this->_items);
return count($this->_items);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Dashboard/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getItems()

public function getCount()
{
return sizeof($this->getItems());
return count($this->getItems());
}

public function getColumn($index)
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Helper/Dashboard/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getStores()
*/
public function countStores()
{
return sizeof($this->_stores->getItems());
return count($this->_stores->getItems());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function globalSearchAction()
->getResults();
$items = array_merge_recursive($items, $results);
}
$totalCount = sizeof($items);
$totalCount = count($items);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Resource/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Api/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ protected function _getUsers($id)
$resource = $role->getResource();
$users = $resource->getRoleUsers($role);

if (sizeof($users) == 0) {
if (!count($users)) {
$users = array();
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Catalog/Helper/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Catalog/Model/Resource/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Controller/Varien/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) : '');
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Core/Model/Resource/Email/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading