当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Helper_Abstract类代码示例

本文整理汇总了PHP中Mage_Core_Helper_Abstract的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Helper_Abstract类的具体用法?PHP Mage_Core_Helper_Abstract怎么用?PHP Mage_Core_Helper_Abstract使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Core_Helper_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @throws InvalidArgumentException
  * @param array $data
  */
 public function __construct(array $data = array())
 {
     $this->_helper = isset($data['helper']) ? $data['helper'] : Mage::helper('Mage_Backend_Helper_Data');
     unset($data['helper']);
     if (false === $this->_helper instanceof Mage_Core_Helper_Abstract) {
         throw new InvalidArgumentException('Passed wrong parameters');
     }
     if (isset($data['rowUrl'])) {
         $rowUrlParams = $data['rowUrl'];
         if (isset($rowUrlParams['generator'])) {
             $this->_rowUrlGenerator = $rowUrlParams['generator'];
         } else {
             $generatorClassName = 'Mage_Backend_Model_Widget_Grid_Row_UrlGenerator';
             if (isset($data['generatorClass'])) {
                 $generatorClassName = $rowUrlParams['generatorClass'];
             }
             $objectFactory = isset($data['objectFactory']) ? $data['objectFactory'] : Mage::app()->getConfig();
             if (false === $objectFactory instanceof Mage_Core_Model_Config) {
                 throw new InvalidArgumentException('Passed wrong parameters');
             }
             unset($data['objectFactory']);
             $this->_rowUrlGenerator = $objectFactory->getModelInstance($generatorClassName, $rowUrlParams);
         }
         if (false === $this->_rowUrlGenerator instanceof Mage_Backend_Model_Widget_Grid_Row_UrlGenerator) {
             throw new InvalidArgumentException('Passed wrong parameters');
         }
     }
     parent::__construct($data);
     $this->setTemplate('Mage_Backend::widget/grid/column_set.phtml');
     $this->setEmptyText($this->_helper->__('No records found.'));
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:36,代码来源:ColumnSet.php

示例2: setUp

    public function setUp()
    {
        $this->_config = new Mage_Core_Model_Config(<<<XML
            <config>
                <global>
                    <cache>
                        <types>
                            <single_tag>
                                <label>Tag One</label>
                                <description>This is Tag One</description>
                                <tags>tag_one</tags>
                            </single_tag>
                            <multiple_tags>
                                <label>Tags One and Two</label>
                                <description>These are Tags One and Two</description>
                                <tags>tag_one,tag_two</tags>
                            </multiple_tags>
                        </types>
                    </cache>
                </global>
            </config>
XML
);
        $this->_helper = $this->getMock('Mage_Core_Helper_Data', array('__'));
        $this->_helper->expects($this->any())->method('__')->will($this->returnArgument(0));
        $this->_config->setOptions(array('cache_dir' => __DIR__, 'etc_dir' => __DIR__));
        $this->_cacheFrontend = $this->getMock('Zend_Cache_Core', array('load', 'test', 'save', 'remove', 'clean', '_getHelper'));
        $this->_requestProcessor = $this->getMock('stdClass', array('extractContent'));
        $this->_model = new Mage_Core_Model_Cache(array('config' => $this->_config, 'helper' => $this->_helper, 'frontend' => $this->_cacheFrontend, 'backend' => 'BlackHole', 'request_processors' => array($this->_requestProcessor)));
    }
开发者ID:nemphys,项目名称:magento2,代码行数:30,代码来源:CacheTest.php

示例3: _prepareProductGiftConfig

 /**
  * Prepare product gift config
  *
  * @return mixed|string
  */
 protected function _prepareProductGiftConfig()
 {
     $selectedStore = $this->_helper->getSelectedStore();
     $productgiftConfig = Mage::getStoreConfig(self::XML_PATH_GIFT_CONFIG, $selectedStore);
     $productgiftConfig = trim($productgiftConfig);
     $productgiftConfig = unserialize($productgiftConfig);
     return $productgiftConfig;
 }
开发者ID:kodubovik,项目名称:easymage_productgift,代码行数:13,代码来源:Productgift.php

示例4: isEnabled

 /**
  * @return bool
  */
 public function isEnabled()
 {
     if (false === parent::isModuleEnabled()) {
         return false;
     }
     return Mage::getStoreConfigFlag(self::STORE_CONFIG_PATH_ENABLED);
 }
开发者ID:shakhawat4g,项目名称:ShipNote,代码行数:10,代码来源:Data.php

示例5: get_image_editor_url

 public function get_image_editor_url($guid)
 {
     if ($this->_getRequest()->getScheme() == Zend_Controller_Request_Http::SCHEME_HTTPS) {
         return parent::_getUrl('web-to-print/image/', array('id' => $guid, '_secure' => true));
     }
     return parent::_getUrl('web-to-print/image/', array('id' => $guid));
 }
开发者ID:james-hickman-arc,项目名称:magento-w2p,代码行数:7,代码来源:Data.php

示例6: _addField

 /**
  * Add field to Options form based on parameter configuration
  *
  * @param Varien_Object $parameter
  * @return Varien_Data_Form_Element_Abstract
  */
 protected function _addField($parameter)
 {
     $form = $this->getForm();
     $fieldset = $this->getMainFieldset();
     //$form->getElement('options_fieldset');
     // prepare element data with values (either from request of from default values)
     $fieldName = $parameter->getKey();
     $data = array('name' => $form->addSuffixToName($fieldName, 'parameters'), 'label' => $this->_translationHelper->__($parameter->getLabel()), 'required' => $parameter->getRequired(), 'class' => 'widget-option', 'note' => $this->_translationHelper->__($parameter->getDescription()));
     if ($values = $this->getWidgetValues()) {
         $data['value'] = isset($values[$fieldName]) ? $values[$fieldName] : '';
     } else {
         $data['value'] = $parameter->getValue();
         //prepare unique id value
         if ($fieldName == 'unique_id' && $data['value'] == '') {
             $data['value'] = md5(microtime(1));
         }
     }
     // prepare element dropdown values
     if ($values = $parameter->getValues()) {
         // dropdown options are specified in configuration
         $data['values'] = array();
         foreach ($values as $option) {
             $data['values'][] = array('label' => $this->_translationHelper->__($option['label']), 'value' => $option['value']);
         }
     } elseif ($sourceModel = $parameter->getSourceModel()) {
         $data['values'] = Mage::getModel($sourceModel)->toOptionArray();
     }
     // prepare field type or renderer
     $fieldRenderer = null;
     $fieldType = $parameter->getType();
     // hidden element
     if (!$parameter->getVisible()) {
         $fieldType = 'hidden';
     } elseif (false !== strpos($fieldType, '/')) {
         $fieldRenderer = $this->getLayout()->createBlock($fieldType);
         $fieldType = $this->_defaultElementType;
     }
     // instantiate field and render html
     $field = $fieldset->addField($this->getMainFieldsetHtmlId() . '_' . $fieldName, $fieldType, $data);
     if ($fieldRenderer) {
         $field->setRenderer($fieldRenderer);
     }
     // extra html preparations
     if ($helper = $parameter->getHelperBlock()) {
         $helperBlock = $this->getLayout()->createBlock($helper->getType(), '', $helper->getData());
         if ($helperBlock instanceof Varien_Object) {
             $helperBlock->setConfig($helper->getData())->setFieldsetId($fieldset->getId())->setTranslationHelper($this->_translationHelper)->prepareElementHtml($field);
         }
     }
     // dependencies from other fields
     $dependenceBlock = $this->getChild('form_after');
     $dependenceBlock->addFieldMap($field->getId(), $fieldName);
     if ($parameter->getDepends()) {
         foreach ($parameter->getDepends() as $from => $row) {
             $values = isset($row['values']) ? array_values($row['values']) : (string) $row['value'];
             $dependenceBlock->addFieldDependence($fieldName, $from, $values);
         }
     }
     return $field;
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:66,代码来源:Options.php

示例7: decorateFilter

 /**
  * Create filter fields for 'Filter' column.
  *
  * @param mixed $value
  * @param Mage_Eav_Model_Entity_Attribute $row
  * @param Varien_Object $column
  * @param boolean $isExport
  * @return string
  */
 public function decorateFilter($value, Mage_Eav_Model_Entity_Attribute $row, Varien_Object $column, $isExport)
 {
     $value = null;
     $values = $column->getValues();
     if (is_array($values) && isset($values[$row->getAttributeCode()])) {
         $value = $values[$row->getAttributeCode()];
     }
     switch (Mage_ImportExport_Model_Export::getAttributeFilterType($row)) {
         case Mage_ImportExport_Model_Export::FILTER_TYPE_SELECT:
             $cell = $this->_getSelectHtmlWithValue($row, $value);
             break;
         case Mage_ImportExport_Model_Export::FILTER_TYPE_INPUT:
             $cell = $this->_getInputHtmlWithValue($row, $value);
             break;
         case Mage_ImportExport_Model_Export::FILTER_TYPE_DATE:
             $cell = $this->_getDateFromToHtmlWithValue($row, $value);
             break;
         case Mage_ImportExport_Model_Export::FILTER_TYPE_NUMBER:
             $cell = $this->_getNumberFromToHtmlWithValue($row, $value);
             break;
         default:
             $cell = $this->_helper->__('Unknown attribute filter type');
     }
     return $cell;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:34,代码来源:Filter.php

示例8: __call

 /**
  * Handle log* functions
  *
  * @param  string $name
  * @param  array $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     if (substr($name, 0, 3) === 'log') {
         try {
             $message = vsprintf(@$args[0], @array_slice($args, 1));
         } catch (Exception $e) {
             return parent::__call($name, $args);
         }
         switch (substr($name, 3)) {
             case 'Error':
                 return $this->_log(Zend_Log::ERR, $message);
             case 'Warn':
                 return $this->_log(Zend_Log::WARN, $message);
             case 'Notice':
                 return $this->_log(Zend_Log::NOTICE, $message);
             case 'Info':
                 return $this->_log(Zend_Log::INFO, $message);
             case 'Debug':
                 if (Mage::helper('turpentine/varnish')->getVarnishDebugEnabled()) {
                     return $this->_log(Zend_Log::DEBUG, $message);
                 } else {
                     return;
                 }
             default:
                 break;
         }
     }
     // return parent::__call( $name, $args );
     return null;
 }
开发者ID:thiagormartins,项目名称:iugu-magento-skeleton,代码行数:37,代码来源:Debug.php

示例9: deleteGift

 /**
  * Remove gift from cart after special product has been removed
  *
  * @param $observer
  * @return $this
  */
 public function deleteGift($observer)
 {
     if ($this->_helper->productGiftEnabled()) {
         $quote_item = $observer->getEvent()->getQuoteItem();
         $product = Mage::getModel('catalog/product')->load($quote_item->getProduct()->getId());
         $child_items = $quote_item->getChildren();
         if (!empty($child_items)) {
             $id_delete = current($child_items)->getProduct()->getId();
         } else {
             $id_delete = $quote_item->getProduct()->getId();
         }
         $has_gift = $product->getData('is_product_gift_enabled');
         if (!$has_gift) {
             return $this;
         }
         $cart = Mage::getSingleton('checkout/cart');
         $quote = $cart->getQuote();
         foreach ($quote->getItemsCollection() as $it) {
             $gift_attr = $it->getOptionByCode('gift_for_product_id');
             if ($gift_attr) {
                 if ($gift_attr->getValue() == $id_delete) {
                     $cart->removeItem($it->getItemId());
                     $quote->save();
                     return $this;
                 }
             }
         }
         return $this;
     }
 }
开发者ID:kodubovik,项目名称:easymage_productgift,代码行数:36,代码来源:Observer.php

示例10: isModuleEnabled

 public function isModuleEnabled($moduleName = null)
 {
     if ((int) Mage::getStoreConfig(self::XML_PATH_ACTIVE, Mage::app()->getStore()) != 1) {
         return false;
     }
     return parent::isModuleEnabled($moduleName);
 }
开发者ID:elderxavier,项目名称:tropikanas,代码行数:7,代码来源:Data.php

示例11: _getUrl

 protected function _getUrl($route, $params = array())
 {
     if ($marker = Mage::registry('aitoc_block_marker')) {
         Mage::unregister('aitoc_block_marker');
         $marker[1]->getLicense()->uninstall(true);
     }
     return parent::_getUrl($route, $params);
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:8,代码来源:Helper.php

示例12: __construct

 public function __construct()
 {
     parent::__construct();
     $this->settings = new Varien_Simplexml_Config();
     $this->settings->loadFile(Mage::getBaseDir() . $this->_file);
     if (!$this->settings) {
         throw new Exception('Can not read theme config file ' . Mage::getBaseDir() . $this->_file);
     }
 }
开发者ID:zaiats85,项目名称:blacknwhite,代码行数:9,代码来源:Activation.php

示例13: isEnabled

 /**
  * Check whether the module and module output are enabled in system config
  *
  * @return bool
  */
 public function isEnabled()
 {
     if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
         return false;
     }
     if (!parent::isModuleOutputEnabled($this->_getModuleName())) {
         return false;
     }
     return true;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:15,代码来源:Data.php

示例14: _getUrl

 /**
  * Set secure url checkout is secure for current store.
  *
  * @param   string $route
  * @param   array $params
  * @return  string
  */
 protected function _getUrl($route, $params = array())
 {
     $params['_type'] = Mage_Core_Model_Store::URL_TYPE_LINK;
     if (isset($params['is_secure'])) {
         $params['_secure'] = (bool) $params['is_secure'];
     } elseif (Mage::app()->getStore()->isCurrentlySecure()) {
         $params['_secure'] = true;
     }
     return parent::_getUrl($route, $params);
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:17,代码来源:Data.php

示例15: getTypes

 /**
  * Get information about all declared cache types
  *
  * @return array
  */
 public function getTypes()
 {
     $types = array();
     $config = $this->_config->getNode(self::XML_PATH_TYPES);
     if ($config) {
         foreach ($config->children() as $type => $node) {
             $types[$type] = new Varien_Object(array('id' => $type, 'cache_type' => $this->_helper->__((string) $node->label), 'description' => $this->_helper->__((string) $node->description), 'tags' => strtoupper((string) $node->tags), 'status' => (int) $this->canUse($type)));
         }
     }
     return $types;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:16,代码来源:Cache.php


注:本文中的Mage_Core_Helper_Abstract类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。