本文整理汇总了PHP中Tools::getShopDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::getShopDomain方法的具体用法?PHP Tools::getShopDomain怎么用?PHP Tools::getShopDomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::getShopDomain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->domain = Tools::getShopDomain(true);
$this->virtual_uri = '';
$this->base_uri = '';
}
示例2: hookHeader
function hookHeader($params)
{
global $smarty, $cookie;
$id_category = (int) Tools::getValue('id_category');
if (!$id_category) {
if (isset($_SERVER['HTTP_REFERER']) and preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) and !strstr($_SERVER['HTTP_REFERER'], '.html')) {
if (isset($regs[2]) and is_numeric($regs[2])) {
$id_category = (int) $regs[2];
} elseif (isset($regs[5]) and is_numeric($regs[5])) {
$id_category = (int) $regs[5];
}
} elseif ($id_product = (int) Tools::getValue('id_product')) {
$product = new Product($id_product);
$id_category = $product->id_category_default;
}
}
$category = new Category($id_category);
$orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$orderWayValues = array(0 => 'ASC', 1 => 'DESC');
$orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[(int) Configuration::get('PS_PRODUCTS_ORDER_BY')]));
$orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[(int) Configuration::get('PS_PRODUCTS_ORDER_WAY')]));
if (!in_array($orderBy, $orderByValues)) {
$orderBy = $orderByValues[0];
}
if (!in_array($orderWay, $orderWayValues)) {
$orderWay = $orderWayValues[0];
}
$smarty->assign(array('feedUrl' => Tools::getShopDomain(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/rss.php?id_category=' . $id_category . '&orderby=' . $orderBy . '&orderway=' . $orderWay));
return $this->display(__FILE__, 'feederHeader.tpl');
}
示例3: getJobForm
public static function getJobForm($title = 'New cron task', $update = false)
{
$form = array(array('form' => array('legend' => array('title' => self::$module->l($title), 'icon' => 'icon-plus'), 'input' => array(), 'submit' => array('title' => self::$module->l('Save', 'CronJobsForms'), 'type' => 'submit', 'class' => 'btn btn-default pull-right'))));
$id_shop = (int) Context::getContext()->shop->id;
$id_shop_group = (int) Context::getContext()->shop->id_shop_group;
$currencies_cron_url = Tools::getShopDomain(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_);
$currencies_cron_url .= '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
if ($update == true && Tools::isSubmit('id_cronjob')) {
$id_cronjob = (int) Tools::getValue('id_cronjob');
$id_module = (int) Db::getInstance()->getValue('SELECT `id_module` FROM `' . _DB_PREFIX_ . self::$module->name . '`
WHERE `id_cronjob` = \'' . (int) $id_cronjob . '\'
AND `id_shop` = \'' . $id_shop . '\' AND `id_shop_group` = \'' . $id_shop_group . '\'');
if ((bool) $id_module == true) {
$form[0]['form']['input'][] = array('type' => 'free', 'name' => 'description', 'label' => self::$module->l('Task description', 'CronJobsForms'), 'placeholder' => self::$module->l('Update my currencies', 'CronJobsForms'));
$form[0]['form']['input'][] = array('type' => 'free', 'name' => 'task', 'label' => self::$module->l('Target link', 'CronJobsForms'));
} else {
$form[0]['form']['input'][] = array('type' => 'text', 'name' => 'description', 'label' => self::$module->l('Task description', 'CronJobsForms'), 'desc' => self::$module->l('Enter a description for this task.', 'CronJobsForms'), 'placeholder' => self::$module->l('Update my currencies', 'CronJobsForms'));
$form[0]['form']['input'][] = array('type' => 'text', 'name' => 'task', 'label' => self::$module->l('Target link', 'CronJobsForms'), 'desc' => self::$module->l('Set the link of your cron task.', 'CronJobsForms'), 'placeholder' => $currencies_cron_url);
}
} else {
$form[0]['form']['input'][] = array('type' => 'text', 'name' => 'description', 'label' => self::$module->l('Task description', 'CronJobsForms'), 'desc' => self::$module->l('Enter a description for this task.', 'CronJobsForms'), 'placeholder' => self::$module->l('Update my currencies', 'CronJobsForms'));
$form[0]['form']['input'][] = array('type' => 'text', 'name' => 'task', 'label' => self::$module->l('Target link', 'CronJobsForms'), 'desc' => self::$module->l('Do not forget to use an absolute URL to make it valid! The link also has to be on the same domain as the shop.', 'CronJobsForms'), 'placeholder' => $currencies_cron_url);
}
$form[0]['form']['input'][] = array('type' => 'select', 'name' => 'hour', 'label' => self::$module->l('Task frequency', 'CronJobsForms'), 'desc' => self::$module->l('At what time should this task be executed?', 'CronJobsForms'), 'options' => array('query' => self::getHoursFormOptions(), 'id' => 'id', 'name' => 'name'));
$form[0]['form']['input'][] = array('type' => 'select', 'name' => 'day', 'desc' => self::$module->l('On which day of the month should this task be executed?', 'CronJobsForms'), 'options' => array('query' => self::getDaysFormOptions(), 'id' => 'id', 'name' => 'name'));
$form[0]['form']['input'][] = array('type' => 'select', 'name' => 'month', 'desc' => self::$module->l('On what month should this task be executed?', 'CronJobsForms'), 'options' => array('query' => self::getMonthsFormOptions(), 'id' => 'id', 'name' => 'name'));
$form[0]['form']['input'][] = array('type' => 'select', 'name' => 'day_of_week', 'desc' => self::$module->l('On which day of the week should this task be executed?', 'CronJobsForms'), 'options' => array('query' => self::getDaysofWeekFormOptions(), 'id' => 'id', 'name' => 'name'));
return $form;
}
示例4: upgrade_module_0_6_5
/**
*
* @param piwikanalyticsjs $module
* @return boolean
*/
function upgrade_module_0_6_5($module)
{
Configuration::updateValue('PIWIK_COOKIE_DOMAIN', '*.' . str_replace('www.', '', Tools::getShopDomain()));
Configuration::updateValue('PIWIK_SET_DOMAINS', Tools::getShopDomain());
Configuration::updateValue('PIWIK_DNT', 1);
Configuration::updateValue('PIWIK_PROXY_SCRIPT', str_replace("http://", '', piwikanalyticsjs::getModuleLink($module->name, 'piwik')));
return true;
}
示例5: _getShopURL
private function _getShopURL()
{
$host = ((Configuration::get('PS_SSL_ENABLED') or !empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) != 'off') ? Tools::getShopDomainSsl() : Tools::getShopDomain()) . __PS_BASE_URI__;
if (substr($host, 0, 4) != 'http') {
$host = (Configuration::get('PS_SSL_ENABLED') or !empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' . $host : 'http://' . $host;
}
return $host;
}
示例6: init
public function init()
{
parent::init();
$this->fields_list = array('id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Currency')), 'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 80), 'iso_code_num' => array('title' => $this->l('ISO code number'), 'align' => 'center', 'width' => 120), 'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false), 'conversion_rate' => array('title' => $this->l('Conversion rate'), 'type' => 'float', 'align' => 'center', 'width' => 130, 'search' => false), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')), 'enableSelection' => array('text' => $this->l('Enable selection')), 'disableSelection' => array('text' => $this->l('Disable selection')));
$this->fields_options = array('change' => array('title' => $this->l('Currency rates'), 'image' => '../img/admin/exchangesrate.gif', 'description' => $this->l('Use PrestaShop\'s webservice to update your currency exchange rates. Please use caution, rates are provided as-is.'), 'submit' => array('title' => $this->l('Update currency rates'), 'class' => 'button', 'name' => 'SubmitExchangesRates')), 'cron' => array('title' => $this->l('Automatically update currency rates'), 'image' => '../img/admin/tab-tools.gif', 'info' => $this->l('Use PrestaShop\'s webservice to update your currency exchange rates. Please use caution, rates are provided as-is. Place this URL in crontab or access it manually daily') . ':<br />
<b>' . Tools::getShopDomain(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME')) . '</b></p>'));
}
示例7: init
/**
* Initialize the page
*/
public function init()
{
if (!defined('_PS_BASE_URL_')) {
define('_PS_BASE_URL_', Tools::getShopDomain(true));
}
if (!defined('_PS_BASE_URL_SSL_')) {
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
}
}
示例8: getContent
public function getContent()
{
/* display the module name */
$this->_html = '<h2>' . $this->displayName . '</h2><br />';
$this->_html .= $this->l('Url for example:') . '<br />';
$orderBy = Tools::getProductsOrder('by');
$orderWay = Tools::getProductsOrder('way');
$this->_html .= Tools::getShopDomain(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/rss.php?id_category=<span style="color:red;">{id_category}</span>&orderby=' . $orderBy . '&orderway=' . $orderWay;
$this->_html .= '<br /><br />' . $this->l('Replace') . ' <span style="color:red;">{id_category}</span> ' . $this->l('by the id category current or "0"');
return $this->_html;
}
示例9: initContent
public function initContent()
{
if (!Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) {
// You can uncomment these lines if you want to force https even from localhost and automatically redirect
// header('HTTP/1.1 301 Moved Permanently');
// header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
// exit();
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'), explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
// If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
if ($clientIsMaintenanceOrLocal) {
$warningSslMessage = Tools::displayError('SSL is activated. However, your IP is allowed to enter unsecure mode for maintenance or local IP issues.');
} else {
$url = 'https://' . Tools::safeOutput(Tools::getServerName()) . Tools::safeOutput($_SERVER['REQUEST_URI']);
$warningSslMessage = sprintf(Translate::ppTags(Tools::displayError('SSL is activated. Please connect using the following link to [1]log into secure mode (https://)[/1]', false), array('<a href="%s">')), $url);
}
$this->context->smarty->assign('warningSslMessage', $warningSslMessage);
}
if (file_exists(_PS_ADMIN_DIR_ . '/../install')) {
$this->context->smarty->assign('wrong_install_name', true);
}
if (basename(_PS_ADMIN_DIR_) == 'admin' && file_exists(_PS_ADMIN_DIR_ . '/../admin/')) {
$rand = 'admin' . sprintf('%03d', rand(0, 999)) . Tools::strtolower(Tools::passwdGen(6)) . '/';
if (@rename(_PS_ADMIN_DIR_ . '/../admin/', _PS_ADMIN_DIR_ . '/../' . $rand)) {
Tools::redirectAdmin('../' . $rand);
} else {
$this->context->smarty->assign(array('wrong_folder_name' => true));
}
} else {
$rand = basename(_PS_ADMIN_DIR_) . '/';
}
$this->context->smarty->assign(array('randomNb' => $rand, 'adminUrl' => Tools::getCurrentUrlProtocolPrefix() . Tools::getShopDomain() . __PS_BASE_URI__ . $rand));
// Redirect to admin panel
if (Tools::isSubmit('redirect') && Validate::isControllerName(Tools::getValue('redirect'))) {
$this->context->smarty->assign('redirect', Tools::getValue('redirect'));
} else {
$tab = new Tab((int) $this->context->employee->default_tab);
$this->context->smarty->assign('redirect', $this->context->link->getAdminLink($tab->class_name));
}
if ($nb_errors = count($this->errors)) {
$this->context->smarty->assign(array('errors' => $this->errors, 'nbErrors' => $nb_errors, 'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')), 'disableDefaultErrorOutPut' => true));
}
if ($email = Tools::getValue('email')) {
$this->context->smarty->assign('email', $email);
}
if ($password = Tools::getValue('password')) {
$this->context->smarty->assign('password', $password);
}
$this->setMedia();
$this->initHeader();
parent::initContent();
$this->initFooter();
//force to disable modals
$this->context->smarty->assign('modals', null);
}
示例10: getShopDomain
public static function getShopDomain()
{
// use built-in method if found
if (method_exists('Tools', 'getShopDomain')) {
return Tools::getShopDomain(true);
}
// discover the domain ourselves
if (!($domain = Configuration::get('PS_SHOP_DOMAIN'))) {
$domain = Tools::getHttpHost();
}
return 'http://' . $domain;
}
示例11: ajaxProcessInfoQuery
public function ajaxProcessInfoQuery()
{
$this->content_only = true;
$result = array('status' => false);
if (time() > (int) Configuration::get('PP_INFO_CHECK_TIME')) {
$protocol = Tools::getCurrentUrlProtocolPrefix();
$iso_lang = Context::getContext()->language->iso_code;
$iso_country = Context::getContext()->country->iso_code;
$stream_context = @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 3)));
$old_content = $this->getInfo();
$msg = $old_content === false ? 0 : $old_content[0];
$shop_url = ShopUrl::getShopUrls($this->context->shop->id)->where('main', '=', 1)->getFirst();
$shop = $shop_url ? $shop_url->getURL() : Tools::getShopDomain();
$date = Db::getInstance()->getValue('SELECT `date_add` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PSM_ID_' . Tools::strtoupper($this->module->name) . '\'');
$psm_date = $date ? urlencode(date('Y-m-d H:i:s', strtotime($date))) : '';
$plugins_string = '';
$plugins = $this->module->plugins();
foreach ($plugins as $name => $api_version) {
if (Module::isInstalled($name)) {
$plugins_string .= '&' . $name . '=' . $this->moduleVersion($name);
}
}
$url = $protocol . 'store.psandmore.com/query/?key=' . $this->module->name . '&ver=' . $this->module->version . '&psm=' . PSM::getPSMId($this->module) . '&psm_date=' . $psm_date . $plugins_string . '&msg=' . $msg . '&iso_country=' . $iso_country . '&iso_lang=' . $iso_lang . '&shop=' . urlencode($shop);
$contents = Tools::file_get_contents($url, false, $stream_context);
$check_info_offset = 3600;
if ($contents !== false) {
$content = explode('|', $contents);
if (is_numeric($content[0])) {
if (!$this->infoIgnore(false, $content[0])) {
if (Validate::isCleanHtml($content[1])) {
$this->putInfo($contents);
$check_info_offset = 86400;
}
}
} else {
if ($content[0] == 'hide') {
Configuration::deleteByName('PP_INFO_CONTENT');
}
}
}
Configuration::updateValue('PP_INFO_CHECK_TIME', time() + $check_info_offset);
}
$content = $this->getInfo();
if ($content !== false) {
if (!$this->infoIgnore($content)) {
if (Validate::isCleanHtml($content[1])) {
$result['status'] = 'success';
$result['content'] = $content[1];
}
}
}
$this->content = Tools::jsonEncode($result);
}
示例12: init
/**
* Initialize the page
*/
public function init()
{
if (_PS_MODE_DEV_ && $this->controller_type == 'admin') {
set_error_handler(array(__CLASS__, 'myErrorHandler'));
}
if (!defined('_PS_BASE_URL_')) {
define('_PS_BASE_URL_', Tools::getShopDomain(true));
}
if (!defined('_PS_BASE_URL_SSL_')) {
define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
}
}
示例13: __construct
public function __construct()
{
$this->bootstrap = true;
$this->table = 'currency';
$this->className = 'Currency';
$this->lang = false;
$this->fields_list = array('id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Currency')), 'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'iso_code_num' => array('title' => $this->l('ISO code number'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false, 'class' => 'fixed-width-xs'), 'conversion_rate' => array('title' => $this->l('Exchange rate'), 'type' => 'float', 'align' => 'center', 'width' => 130, 'search' => false, 'filter_key' => 'currency_shop!conversion_rate'), 'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'class' => 'fixed-width-sm'));
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->fields_options = array('change' => array('title' => $this->l('Currency rates'), 'image' => '../img/admin/exchangesrate.gif', 'description' => $this->l('Use PrestaShop\'s webservice to update your currency\'s exchange rates. However, please use caution: rates are provided as-is.'), 'submit' => array('title' => $this->l('Update currency rates'), 'name' => 'SubmitExchangesRates')), 'cron' => array('title' => $this->l('Automatically update currency rates'), 'image' => '../img/admin/tab-tools.gif', 'info' => '<div class="alert alert-block"><p>' . $this->l('Use PrestaShop\'s webservice to update your currency exchange rates. However, please use caution: rates are provided as-is.') . '<br/>' . $this->l('You can place the following URL in your crontab file, or you can click it yourself regularly:') . '</p>
<p><strong><a href="' . Tools::getShopDomain(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME')) . '" onclick="return !window.open($(this).attr(\'href\'));">' . Tools::getShopDomain(true, true) . __PS_BASE_URI__ . basename(_PS_ADMIN_DIR_) . '/cron_currency_rates.php?secure_key=' . md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME')) . '</a></strong></p></div>'));
parent::__construct();
$this->_select .= 'currency_shop.conversion_rate conversion_rate';
$this->_join .= Shop::addSqlAssociation('currency', 'a');
$this->_group .= 'GROUP BY a.id_currency';
}
示例14: getApplication
/**
* Get Jirafe application information, including app_id and token
* @return array Jirafe application information
*/
public function getApplication()
{
// First, get the application info from Prestashop
$data = array('name' => Configuration::get('PS_SHOP_NAME'), 'url' => Tools::getShopDomain(true));
// Next, get the Jirafe-specific application info stored in Prestashop
$token = $this->get('token');
if (!empty($token)) {
$data['token'] = $token;
}
$appId = $this->get('app_id');
if (!empty($appId)) {
$data['app_id'] = $appId;
}
return $data;
}
示例15: hookHeader
function hookHeader($params)
{
if (!($id_category = (int) Tools::getValue('id_category'))) {
if (isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], Tools::getHttpHost()) && preg_match('!^(.*)\\/([0-9]+)\\-(.*[^\\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs)) {
if (isset($regs[2]) && is_numeric($regs[2])) {
$id_category = (int) $regs[2];
} elseif (isset($regs[5]) && is_numeric($regs[5])) {
$id_category = (int) $regs[5];
}
} elseif ($id_post = (int) Tools::getValue('id_post')) {
$id_category = $this->getPostcat($id_post);
}
}
$this->smarty->assign(array('feedUrl' => Tools::getShopDomain(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/rss.php?id_category=' . $id_category));
return $this->display(__FILE__, 'views/templates/front/blogfeedheader.tpl');
}