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


PHP Mage_Core_Model_App类代码示例

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


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

示例8: _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

示例9: 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

示例10: 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

示例11: 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,代码来源:

示例12: 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

示例13: 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

示例14: _toHtml

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

示例15: _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


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