• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Core_Model_App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

 protected function setUp()
 {
     /** Init all dependencies for SUT. */
     $this->_storeMock = $this->getMockBuilder('Mage_Core_Model_Store')->disableOriginalConstructor()->getMock();
     $this->_applicationMock = $this->getMockBuilder('Mage_Core_Model_App')->disableOriginalConstructor()->getMock();
     $this->_applicationMock->expects($this->any())->method('getStore')->will($this->returnValue($this->_storeMock));
     $this->_requestMock = $this->getMockBuilder('Mage_Webapi_Controller_Request_Soap')->disableOriginalConstructor()->getMock();
     $this->_domDocumentFactory = $this->getMockBuilder('Magento_DomDocument_Factory')->disableOriginalConstructor()->getMock();
     parent::setUp();
 }
开发者ID:,项目名称:,代码行数:10,代码来源:


示例2: addStoreFilter

 /**
  * @param Mage_Core_Model_App|integer $store
  *
  * @return AW_Followupemail_Model_Mysql4_Unsubscribe_Collection
  */
 public function addStoreFilter($store)
 {
     if ($store instanceof Mage_Core_Model_Store) {
         $storeId = $store->getId();
     } elseif (is_numeric($store)) {
         $storeId = $store;
     } else {
         return $this;
     }
     $this->addFieldToFilter('store_id', $storeId);
     return $this;
 }
开发者ID:ngagestudios,项目名称:emailreminders,代码行数:17,代码来源:Collection.php


示例3: isInstalled

 /**
  * Shortcut for the application "is installed" getter
  *
  * @return bool
  * @throws Magento_Exception
  *
  * @todo Remove in favour of Mage_Core_Model_App::isInstalled() as soon as dependencies on application are injected
  */
 public static function isInstalled()
 {
     if (!self::$_app) {
         throw new Magento_Exception('Application instance has not been initialized yet.');
     }
     return self::$_app->isInstalled();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:15,代码来源:Mage.php


示例4: run

 /**
  * Front end main entry point
  *
  * @param string $code
  * @param string $type
  * @param string|array $options
  */
 public static function run($code = '', $type = 'store', $options = array())
 {
     try {
         Magento_Profiler::start('mage');
         self::setRoot();
         if (isset($options['edition'])) {
             self::$_currentEdition = $options['edition'];
         }
         self::$_app = new Mage_Core_Model_App();
         if (isset($options['request'])) {
             self::$_app->setRequest($options['request']);
         }
         if (isset($options['response'])) {
             self::$_app->setResponse($options['response']);
         }
         self::$_events = new Varien_Event_Collection();
         self::_setIsInstalled($options);
         self::_setConfigModel($options);
         self::$_app->run(array('scope_code' => $code, 'scope_type' => $type, 'options' => $options));
         Magento_Profiler::stop('mage');
     } catch (Mage_Core_Model_Session_Exception $e) {
         header('Location: ' . self::getBaseUrl());
     } catch (Mage_Core_Model_Store_Exception $e) {
         require_once self::getBaseDir() . '/pub/errors/404.php';
     } catch (Exception $e) {
         self::printException($e);
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:35,代码来源:Mage.php


示例5: run

 /**
  * Front end main entry point
  *
  * @param string $code
  * @param string $type
  * @param string|array $options
  */
 public static function run($code = '', $type = 'store', $options = array())
 {
     try {
         Varien_Profiler::start('mage');
         self::setRoot();
         self::$_app = new Mage_Core_Model_App();
         self::$_events = new Varien_Event_Collection();
         self::$_config = new Mage_Core_Model_Config($options);
         self::$_app->run(array('scope_code' => $code, 'scope_type' => $type, 'options' => $options));
         Varien_Profiler::stop('mage');
     } catch (Mage_Core_Model_Session_Exception $e) {
         header('Location: ' . self::getBaseUrl());
         die;
     } catch (Mage_Core_Model_Store_Exception $e) {
         require_once self::getBaseDir() . DS . 'errors' . DS . '404.php';
         die;
     } catch (Exception $e) {
         if (self::isInstalled() || self::$_isDownloader) {
             self::printException($e);
             exit;
         }
         try {
             self::dispatchEvent('mage_run_exception', array('exception' => $e));
             if (!headers_sent()) {
                 header('Location:' . self::getUrl('install'));
             } else {
                 self::printException($e);
             }
         } catch (Exception $ne) {
             self::printException($ne, $e->getMessage());
         }
     }
 }
开发者ID:redesignMob,项目名称:extensii,代码行数:40,代码来源:Mage.php


示例6: testLoadDiConfiguration

 /**
  * @magentoConfigFixture global/di/preferences/Mage_Core_Model_Url Mage_Backend_Model_Url
  * @magentoConfigFixture frontend/di/preferences/Mage_Core_Model_Url Mage_DesignEditor_Model_Url_NavigationMode
  */
 public function testLoadDiConfiguration()
 {
     $objectManager = Mage::getObjectManager();
     $this->_model = $objectManager->get('Mage_Core_Model_App');
     $this->_model->loadDiConfiguration('frontend');
     $testInstance = $objectManager->create('Mage_Backend_Block_Widget_Grid_ColumnSet');
     $this->assertAttributeInstanceOf('Mage_DesignEditor_Model_Url_NavigationMode', '_urlBuilder', $testInstance);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:12,代码来源:AppTest.php


示例7: _restoreInitialLocale

 /**
  * Restore locale of the initial store
  *
  * @param string $initialLocaleCode
  * @param string $initialArea
  *
  * @return Mage_Core_Model_App_Emulation
  */
 protected function _restoreInitialLocale($initialLocaleCode, $initialArea = Mage_Core_Model_App_Area::AREA_ADMINHTML)
 {
     $currentLocaleCode = $this->_app->getLocale()->getLocaleCode();
     if ($currentLocaleCode != $initialLocaleCode) {
         $this->_app->getLocale()->setLocaleCode($initialLocaleCode);
         $this->_factory->getSingleton('core/translate')->setLocale($initialLocaleCode)->init($initialArea, true);
     }
     return $this;
 }
开发者ID:okite11,项目名称:frames21,代码行数:17,代码来源:Emulation.php


示例8: dispatchEvent

 /**
  * @see Mage_Core_Model_App::dispatchEvent($eventName, $args)
  */
 public function dispatchEvent($eventName, $args)
 {
     $event = new Varien_Event($args);
     $event->setName($eventName);
     $observer = new Varien_Event_Observer();
     $observer->setData(array('event' => $event));
     $observer->addData($args);
     $this->_bar->update($observer->getEvent());
     return parent::dispatchEvent($eventName, $args);
 }
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:13,代码来源:App.php


示例9: getDependencies

 /**
  * Retrieve field dependencies
  *
  * @param array $dependencies
  * @param string $storeCode
  * @param string $fieldPrefix
  * @return array
  */
 public function getDependencies($dependencies, $storeCode, $fieldPrefix = '')
 {
     $output = array();
     foreach ($dependencies as $depend) {
         /* @var array $depend */
         $fieldId = $fieldPrefix . array_pop($depend['dependPath']);
         $depend['dependPath'][] = $fieldId;
         $dependentId = implode('_', $depend['dependPath']);
         $shouldAddDependency = true;
         $dependentValue = $depend['value'];
         if (isset($depend['separator'])) {
             $dependentValue = explode($depend['separator'], $dependentValue);
         }
         /** @var Mage_Backend_Model_Config_Structure_Element_Field $dependentField  */
         $dependentField = $this->_fieldLocator->getElement($depend['id']);
         /*
          * If dependent field can't be shown in current scope and real dependent config value
          * is not equal to preferred one, then hide dependence fields by adding dependence
          * based on not shown field (not rendered field)
          */
         if (false == $dependentField->isVisible()) {
             $valueInStore = $this->_application->getStore($storeCode)->getConfig($dependentField->getPath($fieldPrefix));
             if (is_array($dependentValue)) {
                 $shouldAddDependency = !in_array($valueInStore, $dependentValue);
             } else {
                 $shouldAddDependency = $dependentValue != $valueInStore;
             }
         }
         if ($shouldAddDependency) {
             $output[$dependentId] = $dependentValue;
         }
     }
     return $output;
 }
开发者ID:,项目名称:,代码行数:42,代码来源:


示例10: _buildContainer

 /**
  * @return Container
  */
 private function _buildContainer()
 {
     $this->_generatorConfig->addCompilerPass($this->_storeConfigCompilerPass);
     $this->_generatorConfig->addCompilerPass($this->_injectableCompilerPass);
     $this->_mageApp->dispatchEvent('symfony_container_before_container_generator', ['generator_config' => $this->_generatorConfig]);
     $generator = new ContainerGenerator($this->_generatorConfig);
     return $this->_container = $generator->getContainer();
 }
开发者ID:inviqa,项目名称:magento-symfony-container,代码行数:11,代码来源:ContainerProvider.php


示例11: build

 /**
  * @return Configuration
  */
 public function build()
 {
     $servicesFormat = 'xml';
     $cachedContainer = $this->_baseDir . '/' . self::CACHED_CONTAINER;
     $configuration = Configuration::fromParameters($cachedContainer, $this->_collectConfigFolders(), !$this->_mageApp->useCache(self::MODEL_ALIAS), $servicesFormat);
     $configuration->setTestEnvironment($this->_isTestEnvironment());
     return $configuration;
 }
开发者ID:inviqa,项目名称:magento-symfony-container,代码行数:11,代码来源:ConfigurationBuilder.php


示例12: processTag

 /**
  * @param array $tag
  * @param Definition $definition
  */
 private function processTag($tag, Definition $definition)
 {
     foreach ($tag as $attribute) {
         if (isset($attribute['key'])) {
             $configValue = $this->_mageApp->getStore()->getConfig($attribute['key']);
             $definition->addArgument($configValue);
         }
     }
 }
开发者ID:qrz-io,项目名称:magento-symfony-container,代码行数:13,代码来源:StoreConfigCompilerPass.php


示例13: testAfterToHtml

 /**
  * @covers Mage_Sales_Block_Adminhtml_Report_Filter_Form_Coupon::_afterToHtml
  */
 public function testAfterToHtml()
 {
     /** @var $block Mage_Sales_Block_Adminhtml_Report_Filter_Form_Coupon */
     $block = $this->_application->getLayout()->createBlock('Mage_Sales_Block_Adminhtml_Report_Filter_Form_Coupon');
     $block->setFilterData(new Varien_Object());
     $html = $block->toHtml();
     $expectedStrings = array('FormElementDependenceController', 'sales_report_rules_list', 'sales_report_price_rule_type');
     foreach ($expectedStrings as $expectedString) {
         $this->assertContains($expectedString, $html);
     }
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例14: allowAddressValidation

 /**
  * Set the passed in address object to ignore validation only when
  * we are currently saving an order and ROM Address validation is not
  * needed.
  *
  * @param  Mage_Customer_Model_Address_Abstract
  * @return self
  */
 public function allowAddressValidation(Mage_Customer_Model_Address_Abstract $address)
 {
     /** @var Mage_Core_Controller_Request_Http */
     $request = $this->app->getRequest();
     /** @var bool */
     $needValidation = $this->validator->shouldValidateAddress($address);
     // We only want to ignore address validation when we are actually creating an order.
     // The assumption is if we get to this point, then, validating the address is
     // unnecessary if it is already valid in ROM.
     if (!$needValidation && $request->getActionName() === 'saveOrder') {
         $address->setShouldIgnoreValidation(true);
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:22,代码来源:Validation.php


示例15: addStoresToCollection

 /**
  * Add stores to collection
  *
  * @return Mage_Rating_Model_Resource_Rating_Collection
  */
 public function addStoresToCollection()
 {
     if ($this->_app->isSingleStoreMode()) {
         return $this;
     }
     if (!$this->_isCollectionLoaded) {
         return $this;
     }
     $ratingIds = array();
     foreach ($this as $item) {
         $ratingIds[] = $item->getId();
         $item->setStores(array());
     }
     if (!$ratingIds) {
         return $this;
     }
     $adapter = $this->getConnection();
     $inCond = $adapter->prepareSqlCondition('rating_id', array('in' => $ratingIds));
     $this->_select = $adapter->select()->from($this->getTable('rating_store'))->where($inCond);
     $data = $adapter->fetchAll($this->_select);
     if (is_array($data) && count($data) > 0) {
         foreach ($data as $row) {
             $item = $this->getItemById($row['rating_id']);
             $item->setStores(array_merge($item->getStores(), array($row['store_id'])));
         }
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:33,代码来源:Collection.php


示例16: _toHtml

 /**
  * @return string
  */
 protected function _toHtml()
 {
     if (!$this->_application->isSingleStoreMode()) {
         return parent::_toHtml();
     }
     return '';
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:10,代码来源:Switcher.php


示例17: _processRedirectOptions

 /**
  * Process redirect (R) and permanent redirect (RP)
  *
  * @return Mage_Core_Model_Url_Rewrite_Request
  */
 protected function _processRedirectOptions()
 {
     $isPermanentRedirectOption = $this->_rewrite->hasOption('RP');
     $external = substr($this->_rewrite->getTargetPath(), 0, 6);
     if ($external === 'http:/' || $external === 'https:') {
         $destinationStoreCode = $this->_app->getStore($this->_rewrite->getStoreId())->getCode();
         $this->_setStoreCodeCookie($destinationStoreCode);
         $this->_sendRedirectHeaders($this->_rewrite->getTargetPath(), $isPermanentRedirectOption);
     }
     $targetUrl = $this->_request->getBaseUrl() . '/' . $this->_rewrite->getTargetPath();
     $storeCode = $this->_app->getStore()->getCode();
     if (Mage::getStoreConfig('web/url/use_store') && !empty($storeCode)) {
         $targetUrl = $this->_request->getBaseUrl() . '/' . $storeCode . '/' . $this->_rewrite->getTargetPath();
     }
     if ($this->_rewrite->hasOption('R') || $isPermanentRedirectOption) {
         $this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption);
     }
     $queryString = $this->_getQueryString();
     if ($queryString) {
         $targetUrl .= '?' . $queryString;
     }
     $this->_request->setRequestUri($targetUrl);
     $this->_request->setPathInfo($this->_rewrite->getTargetPath());
     return $this;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:30,代码来源:Request.php


示例18: _initStores

 /**
  * Initialize stores data
  *
  * @param bool $withDefault
  * @return Mage_ImportExport_Model_Import_Entity_EavAbstract
  */
 protected function _initStores($withDefault = false)
 {
     /** @var $store Mage_Core_Model_Store */
     foreach ($this->_storeManager->getStores($withDefault) as $store) {
         $this->_storeCodeToId[$store->getCode()] = $store->getId();
     }
     return $this;
 }
开发者ID:,项目名称:,代码行数:14,代码来源:


示例19: execute

 /**
  * Execute specified task
  *
  * @param array $task
  * @return bool
  */
 public function execute($task)
 {
     $taskDetails = Zend_Json::decode($task['data']);
     if (isset($taskDetails['task_name'])) {
         try {
             $this->_config->loadEventObservers('workers');
             $this->_app->addEventArea('workers');
             $this->getReporter()->reportTaskProcessing($task['task_id']);
             $this->_dispatchEvent($taskDetails['task_name'], $taskDetails['params']);
             $this->getReporter()->reportTaskCompleted($task['task_id']);
         } catch (Exception $e) {
             $this->getReporter()->reportTaskFailed($task['task_id']);
             $this->_logger->logException($e);
         }
     }
     return true;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:23,代码来源:Worker.php


示例20: _prepareAffectedProduct

 /**
  * Prepare affected product
  */
 protected function _prepareAffectedProduct()
 {
     /** @var $modelCondition Mage_Catalog_Model_Product_Condition */
     $modelCondition = $this->_factory->getModel('catalog/product_condition');
     $productCondition = $modelCondition->setTable($this->_resource->getTable('catalogrule/affected_product'))->setPkFieldName('product_id');
     $this->_app->dispatchEvent('catalogrule_after_apply', array('product' => $this->_getProduct(), 'product_condition' => $productCondition));
     $this->_connection->delete($this->_resource->getTable('catalogrule/affected_product'));
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:11,代码来源:Refresh.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Core_Model_Config类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Core_Model_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap