本文整理汇总了PHP中ShopUrl::getMainShopDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP ShopUrl::getMainShopDomain方法的具体用法?PHP ShopUrl::getMainShopDomain怎么用?PHP ShopUrl::getMainShopDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShopUrl
的用法示例。
在下文中一共展示了ShopUrl::getMainShopDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShopDomain
/**
* getShopDomain returns domain name according to configuration and ignoring ssl
*
* @param boolean $http if true, return domain name with protocol
* @param boolean $entities if true,
*
* @return string domain
*/
public static function getShopDomain($http = false, $entities = false)
{
if (!($domain = ShopUrl::getMainShopDomain())) {
$domain = Tools::getHttpHost();
}
if ($entities) {
$domain = htmlspecialchars($domain, ENT_COMPAT, 'UTF-8');
}
if ($http) {
$domain = 'http://' . $domain;
}
return $domain;
}
示例2: getPreviewUrl
public function getPreviewUrl(SmartBlogPost $smart_blog_post)
{
$id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, Context::getContext()->shop->id);
if (!ShopUrl::getMainShopDomain()) {
return false;
}
$is_rewrite_active = (bool) Configuration::get('PS_REWRITING_SETTINGS');
$blog_url = $preview_url = smartblog::GetSmartBlogLink('smartblog_post', array('id_post' => $smart_blog_post->id, 'slug' => $smart_blog_post->link_rewrite[$id_lang]));
if (!$smart_blog_post->active) {
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
$preview_url .= (strpos($preview_url, '?') === false ? '?' : '&') . 'adtoken=' . $this->token . '&ad=' . $admin_dir . '&id_employee=' . (int) $this->context->employee->id;
}
return $preview_url;
}
示例3: ajaxProcessCronjobLiveExchangeRate
public function ajaxProcessCronjobLiveExchangeRate()
{
$moduleManagerBuilder = ModuleManagerBuilder::getInstance();
$moduleManager = $moduleManagerBuilder->build();
if (!$moduleManager->isInstalled('cronjobs')) {
die(json_encode(array()));
}
$enable = (int) Tools::getValue('enable');
$config = Configuration::get('PS_ACTIVE_CRONJOB_EXCHANGE_RATE', null, null, $this->context->shop->id);
$cronJobUrl = 'http://' . ShopUrl::getMainShopDomain($this->context->shop->id) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
if ($config && $enable == 0) {
Configuration::updateValue('PS_ACTIVE_CRONJOB_EXCHANGE_RATE', 0, false, null, $this->context->shop->id);
Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'cronjobs WHERE `id_cronjob` = \'' . (int) $config . '\'');
}
//The cronjob is not defined, create it
if ($enable == 1 && (!$config || $config == 0)) {
$cronJobs = new CronJobs();
$cronJobs->addOneShotTask($cronJobUrl, sprintf($this->l('Live exchange Rate for %s'), Configuration::get('PS_SHOP_NAME')));
Configuration::updateValue('PS_ACTIVE_CRONJOB_EXCHANGE_RATE', Db::getInstance()->Insert_ID(), false, null, $this->context->shop->id);
} else {
$cronJob = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'cronjobs WHERE `id_cronjob` = \'' . (int) $config . '\'');
//if cronjob do not exsit anymore OR cronjob dis disabled => disable conf
if (!$cronJob || $cronJob[0]['active'] == 0) {
Configuration::updateValue('PS_ACTIVE_CRONJOB_EXCHANGE_RATE', 0, false, null, $this->context->shop->id);
}
}
die(json_encode(array()));
}