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/Adminhtml/Block/Api/Tab/Rolesedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct() {
&& $item->getApiPermission() == 'allow')
{
$resources[$item->getResource_id()]['checked'] = true;
array_push($selrids, $item->getResource_id());
$selrids[] = $item->getResource_id();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* Catalog product form gallery content
*
Expand All @@ -47,6 +46,9 @@ public function __construct()
$this->setTemplate('catalog/product/helper/gallery.phtml');
}

/**
* @inheritDoc
*/
protected function _prepareLayout()
{
$this->setChild('uploader',
Expand All @@ -57,16 +59,16 @@ protected function _prepareLayout()
->setFileParameterName('image')
->setTarget(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl(
'*/catalog_product_gallery/upload',
array('_query' => false)
['_query' => false]
));

$browseConfig = $this->getUploader()->getButtonConfig();
$browseConfig
->setAttributes(array(
->setAttributes([
'accept' => $browseConfig->getMimeTypesByExtensions('gif, png, jpeg, jpg')
));
]);

Mage::dispatchEvent('catalog_product_gallery_prepare_layout', array('block' => $this));
Mage::dispatchEvent('catalog_product_gallery_prepare_layout', ['block' => $this]);

return parent::_prepareLayout();
}
Expand All @@ -91,11 +93,17 @@ public function getUploaderHtml()
return $this->getChildHtml('uploader');
}

/**
* @return string
*/
public function getJsObjectName()
{
return $this->getHtmlId() . 'JsObject';
}

/**
* @return string
*/
public function getAddImagesButton()
{
return $this->getButtonHtml(
Expand All @@ -106,6 +114,9 @@ public function getAddImagesButton()
);
}

/**
* @return string
*/
public function getImagesJson()
{
if(is_array($this->getElement()->getValue())) {
Expand All @@ -121,14 +132,16 @@ public function getImagesJson()
return '[]';
}

/**
* @return string
*/
public function getImagesValuesJson()
{
$values = array();
$values = [];
foreach ($this->getMediaAttributes() as $attribute) {
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
$values[$attribute->getAttributeCode()] = $this->getElement()->getDataObject()->getData(
$attribute->getAttributeCode()
);
/* @var Mage_Eav_Model_Entity_Attribute $attribute */
$attributeCode = $attribute->getAttributeCode();
$values[$attributeCode] = $this->getElement()->getDataObject()->getData($attributeCode);
}
return Mage::helper('core')->jsonEncode($values);
}
Expand All @@ -140,18 +153,21 @@ public function getImagesValuesJson()
*/
public function getImageTypes()
{
$imageTypes = array();
$imageTypes = [];
foreach ($this->getMediaAttributes() as $attribute) {
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
$imageTypes[$attribute->getAttributeCode()] = array(
/* @var Mage_Eav_Model_Entity_Attribute $attribute */
$imageTypes[$attribute->getAttributeCode()] = [
'label' => $attribute->getFrontend()->getLabel() . ' '
. Mage::helper('catalog')->__($this->getElement()->getScopeLabel($attribute)),
'field' => $this->getElement()->getAttributeFieldName($attribute)
);
];
}
return $imageTypes;
}

/**
* @return bool
*/
public function hasUseDefault()
{
foreach ($this->getMediaAttributes() as $attribute) {
Expand All @@ -173,6 +189,9 @@ public function getMediaAttributes()
return $this->getElement()->getDataObject()->getMediaAttributes();
}

/**
* @return string
*/
public function getImageTypesJson()
{
return Mage::helper('core')->jsonEncode($this->getImageTypes());
Expand Down
6 changes: 3 additions & 3 deletions app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ public function getChartUrl($directUrl = true)
$currentvalue = $thisdataarray[$j];
if (is_numeric($currentvalue)) {
$ylocation = $yorigin + $currentvalue;
array_push($chartdata, $ylocation . $dataDelimiter);
$chartdata[] = $ylocation . $dataDelimiter;
} else {
array_push($chartdata, $dataMissing . $dataDelimiter);
$chartdata[] = $dataMissing . $dataDelimiter;
}
}
array_push($chartdata, $dataSetdelimiter);
$chartdata[] = $dataSetdelimiter;
}
$buffer = implode('', $chartdata);

Expand Down
4 changes: 1 addition & 3 deletions app/code/core/Mage/Adminhtml/Block/Newsletter/Queue/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ public function getIsTextType()
*/
public function getCanResume()
{
return in_array($this->getQueue()->getQueueStatus(), array(
Mage_Newsletter_Model_Queue::STATUS_PAUSE
));
return $this->getQueue()->getQueueStatus() == Mage_Newsletter_Model_Queue::STATUS_PAUSE;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __construct()
if (array_key_exists(strtolower($itemResourceId), $resources)) {
if ($item->isAllowed()) {
$resources[$itemResourceId]['checked'] = true;
array_push($selrids, $itemResourceId);
$selrids[] = $itemResourceId;
}
}
}
Expand All @@ -119,7 +119,7 @@ public function __construct()
$undefinedResourceId
) == Mage_Admin_Model_Rules::RULE_PERMISSION_ALLOWED
) {
array_push($selrids, $undefinedResourceId);
$selrids[] = $undefinedResourceId;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,41 +53,43 @@ public function getConfigDataJson()
{
$shipmentId = $this->getShipment()->getId();
$orderId = $this->getRequest()->getParam('order_id');
$urlParams = array();
$urlParams = [];

$itemsQty = array();
$itemsPrice = array();
$itemsName = array();
$itemsWeight = array();
$itemsProductId = array();
$itemsQty = [];
$itemsPrice = [];
$itemsName = [];
$itemsWeight = [];
$itemsProductId = [];

if ($shipmentId) {
$urlParams['shipment_id'] = $shipmentId;
$createLabelUrl = $this->getUrl('*/sales_order_shipment/createLabel', $urlParams);
$itemsGridUrl = $this->getUrl('*/sales_order_shipment/getShippingItemsGrid', $urlParams);
foreach ($this->getShipment()->getAllItems() as $item) {
$itemsQty[$item->getId()] = $item->getQty();
$itemsPrice[$item->getId()] = $item->getPrice();
$itemsName[$item->getId()] = $item->getName();
$itemsWeight[$item->getId()] = $item->getWeight();
$itemsProductId[$item->getId()] = $item->getProductId();
$itemsOrderItemId[$item->getId()] = $item->getOrderItemId();
$itemId = $item->getId();
$itemsQty[$itemId] = $item->getQty();
$itemsPrice[$itemId] = $item->getPrice();
$itemsName[$itemId] = $item->getName();
$itemsWeight[$itemId] = $item->getWeight();
$itemsProductId[$itemId] = $item->getProductId();
$itemsOrderItemId[$itemId] = $item->getOrderItemId();
}
} else if ($orderId) {
$urlParams['order_id'] = $orderId;
$createLabelUrl = $this->getUrl('*/sales_order_shipment/save', $urlParams);
$itemsGridUrl = $this->getUrl('*/sales_order_shipment/getShippingItemsGrid', $urlParams);

foreach ($this->getShipment()->getAllItems() as $item) {
$itemsQty[$item->getOrderItemId()] = $item->getQty()*1;
$itemsPrice[$item->getOrderItemId()] = $item->getPrice();
$itemsName[$item->getOrderItemId()] = $item->getName();
$itemsWeight[$item->getOrderItemId()] = $item->getWeight();
$itemsProductId[$item->getOrderItemId()] = $item->getProductId();
$itemsOrderItemId[$item->getOrderItemId()] = $item->getOrderItemId();
$orderItemId = $item->getOrderItemId();
$itemsQty[$orderItemId] = $item->getQty()*1;
$itemsPrice[$orderItemId] = $item->getPrice();
$itemsName[$orderItemId] = $item->getName();
$itemsWeight[$orderItemId] = $item->getWeight();
$itemsProductId[$orderItemId] = $item->getProductId();
$itemsOrderItemId[$orderItemId] = $orderItemId;
}
}
$data = array(
$data = [
'createLabelUrl' => $createLabelUrl,
'itemsGridUrl' => $itemsGridUrl,
'errorQtyOverLimit' => Mage::helper('sales')->__('The quantity you want to add exceeds the total shipped quantity for some of selected Product(s)'),
Expand All @@ -100,7 +102,7 @@ public function getConfigDataJson()
'shipmentItemsProductId' => $itemsProductId,
'shipmentItemsOrderItemId' => $itemsOrderItemId,
'customizable' => $this->_getCustomizableContainers(),
);
];
return Mage::helper('core')->jsonEncode($data);
}

Expand All @@ -117,14 +119,14 @@ public function getContainers()
$carrier = $order->getShippingCarrier();
$countryShipper = Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $storeId);
if ($carrier) {
$params = new Varien_Object(array(
$params = new Varien_Object([
'method' => $order->getShippingMethod(true)->getMethod(),
'country_shipper' => $countryShipper,
'country_recipient' => $address->getCountryId(),
));
]);
return $carrier->getContainerTypes($params);
}
return array();
return [];
}

/**
Expand All @@ -138,7 +140,7 @@ protected function _getCustomizableContainers()
if ($carrier) {
return $carrier->getCustomizableContainerTypes();
}
return array();
return [];
}

/**
Expand Down Expand Up @@ -169,7 +171,7 @@ public function getDeliveryConfirmationTypeByCode($code)
$countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId();
$carrier = $this->getShipment()->getOrder()->getShippingCarrier();
if ($carrier) {
$params = new Varien_Object(array('country_recipient' => $countryId));
$params = new Varien_Object(['country_recipient' => $countryId]);
$confirmationTypes = $carrier->getDeliveryConfirmationTypes($params);
$confirmationType = !empty($confirmationTypes[$code]) ? $confirmationTypes[$code] : '';
return $confirmationType;
Expand Down Expand Up @@ -203,7 +205,7 @@ public function getPackages()
if ($packages) {
$packages = unserialize($packages, ['allowed_classes' => false]);
} else {
$packages = array();
$packages = [];
}
return $packages;
}
Expand Down Expand Up @@ -258,11 +260,11 @@ public function getDeliveryConfirmationTypes()
{
$countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId();
$carrier = $this->getShipment()->getOrder()->getShippingCarrier();
$params = new Varien_Object(array('country_recipient' => $countryId));
$params = new Varien_Object(['country_recipient' => $countryId]);
if ($carrier && is_array($carrier->getDeliveryConfirmationTypes($params))) {
return $carrier->getDeliveryConfirmationTypes($params);
}
return array();
return [];
}

/**
Expand All @@ -276,10 +278,10 @@ public function getPrintButton()
$url = $this->getUrl('*/sales_order_shipment/printPackage', $data);
return $this->getLayout()
->createBlock('adminhtml/widget_button')
->setData(array(
->setData([
'label' => Mage::helper('sales')->__('Print'),
'onclick' => 'setLocation(\'' . $url . '\')'
))
])
->toHtml();
}

Expand Down Expand Up @@ -310,14 +312,14 @@ public function getContentTypes()
$carrier = $order->getShippingCarrier();
$countryShipper = Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $storeId);
if ($carrier) {
$params = new Varien_Object(array(
$params = new Varien_Object([
'method' => $order->getShippingMethod(true)->getMethod(),
'country_shipper' => $countryShipper,
'country_recipient' => $address->getCountryId(),
));
]);
return $carrier->getContentTypes($params);
}
return array();
return [];
}

/**
Expand Down
Loading