本文整理汇总了PHP中Mage_Core_Model_Store::getBaseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Store::getBaseUrl方法的具体用法?PHP Mage_Core_Model_Store::getBaseUrl怎么用?PHP Mage_Core_Model_Store::getBaseUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Store
的用法示例。
在下文中一共展示了Mage_Core_Model_Store::getBaseUrl方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Called once at that the beginning of the export. Used this to perform any
* actions required (e.g. loading categories) to set up the process.
*
* @param Mage_Core_Model_Store $oStore The store context in which this export occurs
* @param Mage_Core_Model_Config_Element $oConfig The field mapping for this feed
* @return Aligent_Feeds_Model_Googleshopping_Formatter $this
*/
public function init(Mage_Core_Model_Store $oStore, Mage_Core_Model_Config_Element $oConfig)
{
$this->_oConfig = $oConfig;
$this->_oStore = $oStore;
$this->_vBaseUrl = $oStore->getBaseUrl();
$this->_vMediaBaseUrl = $oStore->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$this->_vProductMediaBaseUrl = $this->_vMediaBaseUrl . 'catalog/product';
return $this;
}
示例2: testGetBaseUrlInPub
public function testGetBaseUrlInPub()
{
$this->_model->load('default');
$_SERVER['SCRIPT_FILENAME'] = 'test/pub/index.php';
$this->assertEquals('http://localhost/js/', $this->_model->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS));
$this->assertEquals('http://localhost/media/', $this->_model->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA));
}
示例3: getBaseUrl
public function getBaseUrl($type = self::URL_TYPE_LINK, $secure = null)
{
$store_code = $this->getCode();
$url = parent::getBaseUrl($type, $secure);
if ($dev_host = @$_SERVER['SERVER_NAME']) {
$host = parse_url($url, PHP_URL_HOST);
$url = str_replace('://' . $host . '/', '://' . $dev_host . '/', $url);
}
return $url;
}
示例4: 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');
$this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, false);
$this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, $useStoreCode);
// emulate custom entry point
$_SERVER['SCRIPT_FILENAME'] = 'custom_entry.php';
if ($useCustomEntryPoint) {
Mage::register('custom_entry_point', true);
}
$actual = $this->_model->getBaseUrl($type);
$this->assertEquals($expected, $actual);
}
示例5: createWebstore
/**
* Create a Klevu Webstore using the API for the given Magento store.
*
* @param $customer_id
* @param Mage_Core_Model_Store $store
* @param bool $test_mode
*
* @return array An array with the following keys:
* success: boolean value indicating whether the operation was successful.
* webstore: (success only) Varien_Object containing Webstore information.
* message: message to be displayed to the user.
*/
public function createWebstore($customer_id, Mage_Core_Model_Store $store, $test_mode = false)
{
$name = sprintf("%s - %s - %s", $store->getWebsite()->getName(), $store->getName(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
$language = Mage::helper("klevu_search")->getStoreLanguage($store);
$timezone = $store->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
// Convert $test_mode to string
$test_mode = $test_mode ? "true" : "false";
$response = Mage::getModel("klevu_search/api_action_addwebstore")->execute(array("customerId" => $customer_id, "storeName" => $name, "language" => $language, "timezone" => $timezone, "testMode" => $test_mode));
if ($response->isSuccessful()) {
$webstore = new Varien_Object(array("store_name" => $name, "js_api_key" => $response->getJsApiKey(), "rest_api_key" => $response->getRestApiKey(), "test_account_enabled" => $test_mode));
return array("success" => true, "webstore" => $webstore, "message" => $response->getMessage());
} else {
return array("success" => false, "message" => $response->getMessage());
}
}
示例6: getBaseUrl
public function getBaseUrl($type = self::URL_TYPE_LINK, $secure = null)
{
$store_code = $this->getCode();
$url = parent::getBaseUrl($type, $secure);
$local_host = Mage::getConfig()->getNode('global/dev_url/url');
if ($local_host === false) {
// no override in app/etc/local.xml
return $url;
}
$db_host = parse_url($url, PHP_URL_HOST);
$local_url = parse_url((string) $local_host);
$new_host = $local_url['host'] . (isset($local_url['port']) ? ':' . $local_url['port'] : '');
$url = str_replace('://' . $db_host . '/', '://' . $new_host . '/', $url);
return $url;
}
示例7: createWebstore
/**
* Create a Klevu Webstore using the API for the given Magento store.
*
* @param $customer_id
* @param Mage_Core_Model_Store $store
* @param bool $test_mode
*
* @return array An array with the following keys:
* success: boolean value indicating whether the operation was successful.
* webstore: (success only) Varien_Object containing Webstore information.
* message: message to be displayed to the user.
*/
public function createWebstore($customer_id, Mage_Core_Model_Store $store, $test_mode = false)
{
$name = sprintf("%s - %s - %s - %s", $store->getWebsite()->getName(), $store->getCode(), $store->getName(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
$language = Mage::helper("klevu_search")->getStoreLanguage($store);
$timezone = $store->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
$country = $store->getConfig(Mage_Core_Helper_Data::XML_PATH_DEFAULT_COUNTRY);
$locale = $store->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
$version = $this->getVersion();
// Convert $test_mode to string
$test_mode = $test_mode ? "true" : "false";
$response = Mage::getModel("klevu_search/api_action_addwebstore")->execute(array("customerId" => $customer_id, "storeName" => $name, "language" => $language, "timezone" => $timezone, "version" => $version, "country" => $country, "locale" => $locale, "testMode" => $test_mode));
if ($response->isSuccessful()) {
$webstore = new Varien_Object(array("store_name" => $name, "js_api_key" => $response->getJsApiKey(), "rest_api_key" => $response->getRestApiKey(), "test_account_enabled" => $test_mode, "hosted_on" => $response->getHostedOn(), "cloud_search_url" => $response->getCloudSearchUrl(), "analytics_url" => $response->getAnalyticsUrl(), "js_url" => $response->getJsUrl(), "rest_hostname" => $response->getRestUrl()));
return array("success" => true, "webstore" => $webstore, "message" => $response->getMessage());
} else {
return array("success" => false, "message" => $response->getMessage());
}
}
示例8: getBaseUrl
public function getBaseUrl($type = self::URL_TYPE_LINK, $secure = null)
{
$cacheKey = $type . '/' . (is_null($secure) ? 'null' : ($secure ? 'true' : 'false'));
if (!isset($this->_baseUrlCache[$cacheKey])) {
if ($this->getConfig('cloudfront/general/active') && $this->getConfig('cloudfront/general/deployed') && !$this->isAdmin() && Mage::getDesign()->getArea() != 'adminhtml') {
$secure = is_null($secure) ? $this->isCurrentlySecure() : (bool) $secure;
if ($type == self::URL_TYPE_SKIN && $this->getConfig('cloudfront/skin/skin')) {
if ($secure) {
$url = $this->getConfig('cloudfront/secure/base_skin_url');
} else {
$url = $this->getConfig('cloudfront/unsecure/base_skin_url');
}
} elseif ($type == self::URL_TYPE_JS && $this->getConfig('cloudfront/js/js')) {
if ($secure) {
$url = $this->getConfig('cloudfront/secure/base_js_url');
} else {
$url = $this->getConfig('cloudfront/unsecure/base_js_url');
}
} elseif ($type == self::URL_TYPE_MEDIA && $this->getConfig('cloudfront/media/media')) {
if ($secure) {
$url = $this->getConfig('cloudfront/secure/base_media_url');
} else {
$url = $this->getConfig('cloudfront/unsecure/base_media_url');
}
} else {
return parent::getBaseUrl($type, $secure);
}
if (false !== strpos($url, '{{base_url}}')) {
$baseUrl = Mage::getConfig()->substDistroServerVars('{{base_url}}');
$url = str_replace('{{base_url}}', $baseUrl, $url);
}
$this->_baseUrlCache[$cacheKey] = rtrim($url, '/') . '/';
} else {
return parent::getBaseUrl($type, $secure);
}
}
return $this->_baseUrlCache[$cacheKey];
}
示例9: loadData
/**
* Loads the meta data for the given store.
*
* @param Mage_Core_Model_Store $store the store view to load the data for.
*/
public function loadData(Mage_Core_Model_Store $store)
{
/* @var Nosto_Tagging_Helper_Data $helper */
$helper = Mage::helper('nosto_tagging');
$this->_title = $helper->cleanUpAccountTitle($store->getWebsite()->getName() . ' - ' . $store->getGroup()->getName() . ' - ' . $store->getName());
$this->_name = substr(sha1(rand()), 0, 8);
if (!$helper->getUsePrettyProductUrls()) {
$this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
} else {
$this->_frontPageUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
}
$this->_currencyCode = $store->getBaseCurrencyCode();
$this->_languageCode = substr($store->getConfig('general/locale/code'), 0, 2);
$this->_ownerLanguageCode = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
/** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
$owner = Mage::getModel('nosto_tagging/meta_account_owner');
$owner->loadData();
$this->_owner = $owner;
/** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
$billing = Mage::getModel('nosto_tagging/meta_account_billing');
$billing->loadData($store);
$this->_billing = $billing;
$this->_useCurrencyExchangeRates = !$helper->multiCurrencyDisabled($store);
if (!$helper->multiCurrencyDisabled($store)) {
$this->_defaultPriceVariationId = $store->getBaseCurrencyCode();
} else {
$this->_defaultPriceVariationId = "";
}
$storeLocale = $store->getConfig('general/locale/code');
$currencyCodes = $store->getAvailableCurrencyCodes(true);
if (is_array($currencyCodes) && count($currencyCodes) > 0) {
/** @var Nosto_Tagging_Helper_Currency $currencyHelper */
$currencyHelper = Mage::helper('nosto_tagging/currency');
foreach ($currencyCodes as $currencyCode) {
$this->_currencies[$currencyCode] = $currencyHelper->getCurrencyObject($storeLocale, $currencyCode);
}
}
}
示例10: transformBaseUrl
/**
* Transform a given store into a new base url.
*
* @param \Mage_Core_Model_Store $store
* @param bool $secure
* @return string
* @throws \InvalidArgumentException when $secure is not a boolean
*/
public function transformBaseUrl(\Mage_Core_Model_Store $store, $secure = false)
{
if (!is_bool($secure)) {
throw new \InvalidArgumentException('Invalid value for $secure supplied. Expected a boolean. Got: ' . gettype($secure));
}
$currentUrl = $store->getBaseUrl($store::URL_TYPE_LINK, $secure);
$path = parse_url($currentUrl, PHP_URL_PATH);
// The executable somehow ends up in the admin store URL.
if ($store->isAdmin()) {
// Let's strip it out.
$path = preg_replace(sprintf('/^\\/%s/', preg_quote($this->getPharName())), '', $path);
}
$scheme = parse_url($currentUrl, PHP_URL_SCHEME);
$domain = $this->createDomain($store);
return "{$scheme}://{$domain}{$path}";
}
示例11: loadData
/**
* Loads the meta data for the given store.
*
* @param Mage_Core_Model_Store $store the store view to load the data for.
*/
public function loadData(Mage_Core_Model_Store $store)
{
$this->_title = $store->getWebsite()->getName() . ' - ' . $store->getGroup()->getName() . ' - ' . $store->getName();
$this->_name = substr(sha1(rand()), 0, 8);
$this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
$this->_currencyCode = $store->getBaseCurrencyCode();
$this->_languageCode = substr($store->getConfig('general/locale/code'), 0, 2);
$this->_ownerLanguageCode = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
/** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
$owner = Mage::getModel('nosto_tagging/meta_account_owner');
$owner->loadData($store);
$this->_owner = $owner;
/** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
$billing = Mage::getModel('nosto_tagging/meta_account_billing');
$billing->loadData($store);
$this->_billing = $billing;
}
示例12: getFrontPageUrlForStore
/**
* Returns the front page url configured for a store
*
* @param Mage_Core_Model_Store $store
* @return string
*/
public function getFrontPageUrlForStore(Mage_Core_Model_Store $store)
{
return $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
}