當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Store::getBaseUrl方法代碼示例

本文整理匯總了PHP中Magento\Store\Model\Store::getBaseUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Store::getBaseUrl方法的具體用法?PHP Store::getBaseUrl怎麽用?PHP Store::getBaseUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Store\Model\Store的用法示例。


在下文中一共展示了Store::getBaseUrl方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getBaseUrl

 /**
  * {@inheritdoc}
  */
 public function getBaseUrl($type = 'link', $secure = null)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getBaseUrl');
     if (!$pluginInfo) {
         return parent::getBaseUrl($type, $secure);
     } else {
         return $this->___callPlugins('getBaseUrl', func_get_args(), $pluginInfo);
     }
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:12,代碼來源:Interceptor.php

示例2: getBaseUrl

 public function getBaseUrl($type = UrlInterface::URL_TYPE_LINK, $secure = null)
 {
     $cacheKey = $type . '/' . (is_null($secure) ? 'null' : ($secure ? 'true' : 'false'));
     if (!isset($this->_baseUrlCache[$cacheKey])) {
         if ($this->isDeveloper) {
             $dbBaseUrl = $this->_config->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
             $baseUrl = parent::getBaseUrl($type, $secure);
             $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : parse_url(trim($dbBaseUrl), PHP_URL_HOST);
             $url = str_replace($dbBaseUrl, "http://{$host}/", $baseUrl);
             $this->_baseUrlCache[$cacheKey] = $url;
         }
     }
     return parent::getBaseUrl($type, $secure);
 }
開發者ID:outeredge,項目名稱:edge-magento-module-base,代碼行數:14,代碼來源:Store.php

示例3: testGetBaseUrlForCustomEntryPoint

 /**
  * Isolation is enabled, as we pollute config with rewrite values
  *
  * @param string $type
  * @param bool $useCustomEntryPoint
  * @param bool $useStoreCode
  * @param string $expected
  * @dataProvider getBaseUrlForCustomEntryPointDataProvider
  * @magentoAppIsolation enabled
  */
 public function testGetBaseUrlForCustomEntryPoint($type, $useCustomEntryPoint, $useStoreCode, $expected)
 {
     /* config operations require store to be loaded */
     $this->model->load('default');
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue(Store::XML_PATH_USE_REWRITES, false, ScopeInterface::SCOPE_STORE);
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\Config\\MutableScopeConfigInterface')->setValue(Store::XML_PATH_STORE_IN_URL, $useStoreCode, ScopeInterface::SCOPE_STORE);
     // emulate custom entry point
     $_SERVER['SCRIPT_FILENAME'] = 'custom_entry.php';
     if ($useCustomEntryPoint) {
         $property = new \ReflectionProperty($this->model, '_isCustomEntryPoint');
         $property->setAccessible(true);
         $property->setValue($this->model, $useCustomEntryPoint);
     }
     $actual = $this->model->getBaseUrl($type);
     $this->assertEquals($expected, $actual);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:26,代碼來源:StoreTest.php

示例4: getStoreConfig

 /**
  * @param \Magento\Store\Model\Store $store
  * @return \Magento\Store\Api\Data\StoreConfigInterface
  */
 protected function getStoreConfig($store)
 {
     /** @var \Magento\Store\Model\Data\StoreConfig $storeConfig */
     $storeConfig = $this->storeConfigFactory->create();
     $storeConfig->setId($store->getId())->setCode($store->getCode())->setWebsiteId($store->getWebsiteId());
     foreach ($this->configPaths as $methodName => $configPath) {
         $configValue = $this->scopeConfig->getValue($configPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode());
         $storeConfig->{$methodName}($configValue);
     }
     $storeConfig->setBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, false));
     $storeConfig->setSecureBaseUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB, true));
     $storeConfig->setBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, false));
     $storeConfig->setSecureBaseLinkUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, true));
     $storeConfig->setBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, false));
     $storeConfig->setSecureBaseStaticUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_STATIC, true));
     $storeConfig->setBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, false));
     $storeConfig->setSecureBaseMediaUrl($store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA, true));
     return $storeConfig;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:23,代碼來源:StoreConfigManager.php

示例5: build

 /**
  * @param Store $store
  * @return \NostoAccount
  */
 public function build(Store $store)
 {
     $metaData = new \NostoAccount();
     try {
         $metaData->setTitle(implode(' - ', [$store->getWebsite()->getName(), $store->getGroup()->getName(), $store->getName()]));
         $metaData->setName(substr(sha1(rand()), 0, 8));
         $metaData->setFrontPageUrl(\NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(UrlInterface::URL_TYPE_WEB)));
         $metaData->setCurrency(new \NostoCurrencyCode($store->getBaseCurrencyCode()));
         $lang = substr($store->getConfig('general/locale/code'), 0, 2);
         $metaData->setLanguage(new \NostoLanguageCode($lang));
         $lang = substr($this->_localeResolver->getLocale(), 0, 2);
         $metaData->setOwnerLanguage(new \NostoLanguageCode($lang));
         $owner = $this->_accountOwnerMetaBuilder->build();
         $metaData->setOwner($owner);
         $billing = $this->_accountBillingMetaBuilder->build($store);
         $metaData->setBilling($billing);
     } catch (\NostoException $e) {
         $this->_logger->error($e, ['exception' => $e]);
     }
     return $metaData;
 }
開發者ID:Nosto,項目名稱:nosto-magento2,代碼行數:25,代碼來源:Builder.php


注:本文中的Magento\Store\Model\Store::getBaseUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。