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


PHP Language::countActiveLanguages方法代碼示例

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


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

示例1: generateHtaccess

 public static function generateHtaccess($path, $rewrite_settings, $cache_control, $specific = '', $disableMuliviews = false)
 {
     $tab = array('ErrorDocument' => array(), 'RewriteEngine' => array(), 'RewriteRule' => array());
     $multilang = Language::countActiveLanguages() > 1;
     // ErrorDocument
     $tab['ErrorDocument']['comment'] = '# Catch 404 errors';
     $tab['ErrorDocument']['content'] = '404 ' . __PS_BASE_URI__ . '404.php';
     // RewriteEngine
     $tab['RewriteEngine']['comment'] = '# URL rewriting module activation';
     // RewriteRules
     $tab['RewriteRule']['comment'] = '# URL rewriting rules';
     // Compatibility with the old image filesystem
     if (Configuration::get('PS_LEGACY_IMAGES')) {
         $tab['RewriteRule']['content']['^([a-z0-9]+)\\-([a-z0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1-$2$3.jpg [L]';
         $tab['RewriteRule']['content']['^([0-9]+)\\-([0-9]+)/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1-$2.jpg [L]';
     }
     // Rewriting for product image id < 100 millions
     $tab['RewriteRule']['content']['^([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$1$2.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$1$2$3.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$1$2$3$4.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$1$2$3$4$5.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\\.jpg$'] = _PS_PROD_IMG_ . '$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg [L]';
     $tab['RewriteRule']['content']['^c/([0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = 'img/c/$1$2.jpg [L]';
     $tab['RewriteRule']['content']['^c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\\.jpg$'] = 'img/c/$1.jpg [L]';
     if ($multilang) {
         $tab['RewriteRule']['content']['^([a-z]{2})/[a-zA-Z0-9-]*/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$2&isolang=$1&noredirect=1 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$2&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/content/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms=$2 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/content/category/([0-9]+)\\-[a-zA-Z0-9-]*'] = 'cms.php?isolang=$1&id_cms_category=$2 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)__[a-zA-Z0-9-]*'] = 'supplier.php?isolang=$1&id_supplier=$2 [QSA,L]';
         $tab['RewriteRule']['content']['^([a-z]{2})/([0-9]+)_[a-zA-Z0-9-]*'] = 'manufacturer.php?isolang=$1&id_manufacturer=$2 [QSA,L]';
     }
     // PS BASE URI automaticaly prepend the string, do not use PS defines for the image directories
     $tab['RewriteRule']['content']['^([0-9]+)(\\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\\.jpg$'] = 'img/c/$1$2.jpg [L]';
     $tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$1 [QSA,L]';
     $tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)\\-[a-zA-Z0-9-]*\\.html'] = 'product.php?id_product=$1 [QSA,L]';
     // Notice : the id_category rule has to be after product rules.
     // If not, category with number in their name will result a bug
     $tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+'] = 'category.php?id_category=$1&noredirect=1 [QSA,L]';
     $tab['RewriteRule']['content']['^([0-9]+)\\-[a-zA-Z0-9-]*'] = 'category.php?id_category=$1 [QSA,L]';
     $tab['RewriteRule']['content']['^([0-9]+)__([a-zA-Z0-9-]*)'] = 'supplier.php?id_supplier=$1 [QSA,L]';
     $tab['RewriteRule']['content']['^([0-9]+)_([a-zA-Z0-9-]*)'] = 'manufacturer.php?id_manufacturer=$1 [QSA,L]';
     $tab['RewriteRule']['content']['^content/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms=$1 [QSA,L]';
     $tab['RewriteRule']['content']['^content/category/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]';
     // Compatibility with the old URLs
     if (!Configuration::get('PS_INSTALL_VERSION') or version_compare(Configuration::get('PS_INSTALL_VERSION'), '1.4.0.7') == -1) {
         // This is a nasty copy/paste of the previous links, but with "lang-en" instead of "en"
         // Do not update it when you add something in the one at the top, it's only for the old links
         $tab['RewriteRule']['content']['^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\\-([a-zA-Z0-9-]*)\\.html'] = 'product.php?id_product=$3&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^lang-([a-z]{2})/([0-9]+)\\-([a-zA-Z0-9-]*)\\.html'] = 'product.php?id_product=$2&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^lang-([a-z]{2})/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'category.php?id_category=$2&isolang=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^content/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms=$1 [QSA,L]';
         $tab['RewriteRule']['content']['^content/category/([0-9]+)\\-([a-zA-Z0-9-]*)'] = 'cms.php?id_cms_category=$1 [QSA,L]';
     }
     Language::loadLanguages();
     $default_meta = Meta::getMetasByIdLang((int) Configuration::get('PS_LANG_DEFAULT'));
     if ($multilang) {
         foreach (Language::getLanguages() as $language) {
             foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) {
                 if (!empty($meta['url_rewrite']) and Validate::isLinkRewrite($meta['url_rewrite'])) {
                     $tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $meta['url_rewrite'] . '$'] = $meta['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]';
                 } elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') {
                     $tab['RewriteRule']['content']['^' . $language['iso_code'] . '/' . $default_meta[$key]['url_rewrite'] . '$'] = $default_meta[$key]['page'] . '.php?isolang=' . $language['iso_code'] . ' [QSA,L]';
                 }
             }
             $tab['RewriteRule']['content']['^' . $language['iso_code'] . '$'] = $language['iso_code'] . '/ [QSA,L]';
             $tab['RewriteRule']['content']['^' . $language['iso_code'] . '/([^?&]*)$'] = '$1?isolang=' . $language['iso_code'] . ' [QSA,L]';
         }
     } else {
         foreach ($default_meta as $key => $meta) {
             if (!empty($meta['url_rewrite'])) {
                 $tab['RewriteRule']['content']['^' . $meta['url_rewrite'] . '$'] = $meta['page'] . '.php [QSA,L]';
             } elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') {
                 $tab['RewriteRule']['content']['^' . $default_meta[$key]['url_rewrite'] . '$'] = $default_meta[$key]['page'] . '.php [QSA,L]';
             }
         }
     }
     if (!($writeFd = @fopen($path, 'w'))) {
         return false;
     }
     // PS Comments
     fwrite($writeFd, "# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution\n");
     fwrite($writeFd, "# WARNING: PLEASE DO NOT MODIFY THIS FILE MANUALLY. IF NECESSARY, ADD YOUR SPECIFIC CONFIGURATION WITH THE HTACCESS GENERATOR IN BACK OFFICE\n");
     fwrite($writeFd, "# http://www.prestashop.com - http://www.prestashop.com/forums\n\n");
     if (!empty($specific)) {
         fwrite($writeFd, $specific);
     }
     // RewriteEngine
     fwrite($writeFd, "\n<IfModule mod_rewrite.c>\n");
     if ($disableMuliviews) {
         fwrite($writeFd, "\n# Disable Multiviews\nOptions -Multiviews\n\n");
     }
     fwrite($writeFd, $tab['RewriteEngine']['comment'] . "\nRewriteEngine on\n\n");
     fwrite($writeFd, $tab['RewriteRule']['comment'] . "\n");
     // Webservice
//.........這裏部分代碼省略.........
開發者ID:nicolasjeol,項目名稱:hec-ecommerce,代碼行數:101,代碼來源:Tools14.php

示例2: displayAjaxGetKpi


//.........這裏部分代碼省略.........
                break;
            case 'pending_messages':
                $value = (int) AdminStatsController::getPendingMessages();
                ConfigurationKPI::updateValue('PENDING_MESSAGES', $value);
                ConfigurationKPI::updateValue('PENDING_MESSAGES_EXPIRE', strtotime('+5 min'));
                break;
            case 'avg_msg_response_time':
                $value = sprintf($this->l('%.1f hours', null, null, false), AdminStatsController::getAverageMessageResponseTime(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))));
                ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME', $value);
                ConfigurationKPI::updateValue('AVG_MSG_RESPONSE_TIME_EXPIRE', strtotime('+4 hour'));
                break;
            case 'messages_per_thread':
                $value = round(AdminStatsController::getMessagesPerThread(date('Y-m-d', strtotime('-31 day')), date('Y-m-d', strtotime('-1 day'))), 1);
                ConfigurationKPI::updateValue('MESSAGES_PER_THREAD', $value);
                ConfigurationKPI::updateValue('MESSAGES_PER_THREAD_EXPIRE', strtotime('+12 hour'));
                break;
            case 'newsletter_registrations':
                $value = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
				SELECT COUNT(*)
				FROM `' . _DB_PREFIX_ . 'customer`
				WHERE newsletter = 1
				' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
                if (Module::isInstalled('blocknewsletter')) {
                    $value += Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
					SELECT COUNT(*)
					FROM `' . _DB_PREFIX_ . 'newsletter`
					WHERE active = 1
					' . Shop::addSqlRestriction(Shop::SHARE_ORDER));
                }
                ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS', $value);
                ConfigurationKPI::updateValue('NEWSLETTER_REGISTRATIONS_EXPIRE', strtotime('+6 hour'));
                break;
            case 'enabled_languages':
                $value = Language::countActiveLanguages();
                ConfigurationKPI::updateValue('ENABLED_LANGUAGES', $value);
                ConfigurationKPI::updateValue('ENABLED_LANGUAGES_EXPIRE', strtotime('+1 min'));
                break;
            case 'frontoffice_translations':
                $themes = Theme::getThemes();
                $languages = Language::getLanguages();
                $total = $translated = 0;
                foreach ($themes as $theme) {
                    foreach ($languages as $language) {
                        $kpi_key = substr(strtoupper($theme->name . '_' . $language['iso_code']), 0, 16);
                        $total += ConfigurationKPI::get('TRANSLATE_TOTAL_' . $kpi_key);
                        $translated += ConfigurationKPI::get('TRANSLATE_DONE_' . $kpi_key);
                    }
                }
                $value = 0;
                if ($translated) {
                    $value = round(100 * $translated / $total, 1);
                }
                $value .= '%';
                ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS', $value);
                ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', strtotime('+2 min'));
                break;
            case 'main_country':
                if (!($row = AdminStatsController::getMainCountry(date('Y-m-d', strtotime('-30 day')), date('Y-m-d')))) {
                    $value = $this->l('No orders', null, null, false);
                } else {
                    $country = new Country($row['id_country'], $this->context->language->id);
                    $value = sprintf($this->l('%d%% %s', null, null, false), $row['orders'], $country->name);
                }
                ConfigurationKPI::updateValue('MAIN_COUNTRY', array($this->context->language->id => $value));
                ConfigurationKPI::updateValue('MAIN_COUNTRY_EXPIRE', array($this->context->language->id => strtotime('+1 day')));
                break;
開發者ID:gks-stage,項目名稱:prestashop,代碼行數:67,代碼來源:AdminStatsController.php

示例3: isMultiLanguageActivated

 /**
  * Check if more on than one language is activated
  *
  * @since 1.5.0
  * @return bool
  */
 public static function isMultiLanguageActivated()
 {
     return Language::countActiveLanguages() > 1;
 }
開發者ID:rrameshsat,項目名稱:Prestashop,代碼行數:10,代碼來源:Language.php

示例4: isMultiLanguageActivated

 /**
  * Check if more on than one language is activated
  *
  * @since 1.5.0
  * @return bool
  */
 public static function isMultiLanguageActivated($id_shop = null)
 {
     return Language::countActiveLanguages($id_shop) > 1;
 }
開發者ID:ekachandrasetiawan,項目名稱:BeltcareCom,代碼行數:10,代碼來源:Language.php

示例5: getSeoPageUrlByKeys

    public static function getSeoPageUrlByKeys($seoKeys, $idLang)
    {
        $seoPageListTmp = Db::getInstance()->ExecuteS('
			SELECT s.`seo_key`, s.`id_seo`, sl.`seo_url`
			FROM `' . _DB_PREFIX_ . 'pm_advancedsearch_seo` s
			JOIN `' . _DB_PREFIX_ . 'pm_advancedsearch_seo_lang` sl ON (s.`id_seo`=sl.`id_seo` AND sl.`id_lang`=' . (int) $idLang . ')
			WHERE s.`seo_key` IN ("' . implode('","', $seoKeys) . '")
			AND s.`deleted`=0');
        $seoPageList = array();
        if (is_array($seoPageListTmp)) {
            if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && Shop::isFeatureActive()) {
                $baseUri = Context::getContext()->shop->getBaseURL() . (Language::countActiveLanguages() > 1 ? Language::getIsoById($idLang) . '/' : '');
            } else {
                $baseUri = Tools::getShopDomain(true) . __PS_BASE_URI__ . (Language::countActiveLanguages() > 1 ? Language::getIsoById($idLang) . '/' : '');
            }
            foreach ($seoPageListTmp as $seoPage) {
                $seoPageList[$seoPage['seo_key']] = array('id_seo' => (int) $seoPage['id_seo'], 'seo_page_url' => $baseUri . 's/' . $seoPage['id_seo'] . '/' . $seoPage['seo_url']);
            }
        }
        return $seoPageList;
    }
開發者ID:acreno,項目名稱:pm-ps,代碼行數:21,代碼來源:AdvancedSearchSeoClass.php

示例6: getLangLink

 protected function getLangLink($id_lang = NULL)
 {
     if (!$this->allow or Language::countActiveLanguages() <= 1) {
         return '';
     }
     global $cookie;
     if (!$id_lang) {
         $id_lang = (int) $cookie->id_lang;
     }
     return Language::getIsoById((int) $id_lang) . '/';
 }
開發者ID:hecbuma,項目名稱:quali-fisioterapia,代碼行數:11,代碼來源:Link.php

示例7: getLinkOutputValue


//.........這裏部分代碼省略.........
         }
         if (version_compare(_PS_VERSION_, '1.4.0.0', '<')) {
             $name = self::hideCategoryPosition($name);
         }
         if ($withExtra && trim($row['have_icon'])) {
             $icone .= $this->_path . $type . '_icons/' . $row['id_' . $type] . '.' . ($row['image_type'] ? $row['image_type'] : 'jpg');
         }
         $url .= $link->getCategoryLink(intval($row['id_category']), $row['category_link_rewrite']);
     } elseif ($row['type'] == 4) {
         if (trim($row['name'])) {
             $name .= htmlentities($row['name'], ENT_COMPAT, 'UTF-8');
         } else {
             $name .= htmlentities($row['manufacturer_name'], ENT_COMPAT, 'UTF-8') . '';
         }
         if ($withExtra && trim($row['have_icon'])) {
             $icone .= $this->_path . $type . '_icons/' . $row['id_' . $type] . '.' . ($row['image_type'] ? $row['image_type'] : 'jpg');
         }
         $url .= $link->getManufacturerLink(intval($row['id_manufacturer']), version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Tools::link_rewrite($row['manufacturer_name']) : Tools::link_rewrite($row['manufacturer_name'], false));
     } elseif ($row['type'] == 5) {
         if (trim($row['name'])) {
             $name .= htmlentities($row['name'], ENT_COMPAT, 'UTF-8');
         } else {
             $name .= htmlentities($row['supplier_name'], ENT_COMPAT, 'UTF-8') . '';
         }
         if ($withExtra && trim($row['have_icon'])) {
             $icone .= $this->_path . $type . '_icons/' . $row['id_' . $type] . '.' . ($row['image_type'] ? $row['image_type'] : 'jpg');
         }
         $url .= $link->getSupplierLink(intval($row['id_supplier']), version_compare(_PS_VERSION_, '1.5.0.0', '>=') ? Tools::link_rewrite($row['supplier_name']) : Tools::link_rewrite($row['supplier_name'], false));
     } elseif ($row['type'] == 6) {
         $this->_smarty->assign(array('atm_form_action_link' => version_compare(_PS_VERSION_, '1.4.0.0', '<') ? __PS_BASE_URI__ . 'search.php' : $link->getPageLink('search.php'), 'atm_search_id' => 'search_query_atm_' . $type . '_' . $row['id_' . $type], 'atm_have_icon' => trim($row['have_icon']), 'atm_withExtra' => $withExtra, 'atm_icon_image_source' => $this->_path . $type . '_icons/' . $row['id_' . $type] . '.' . ($row['image_type'] ? $row['image_type'] : 'jpg'), 'atm_search_value' => trim(htmlentities($row['name'], ENT_COMPAT, 'UTF-8')), 'atm_is_autocomplete_search' => Configuration::get('ATM_AUTOCOMPLET_SEARCH'), 'atm_cookie_id_lang' => $this->_cookie->id_lang, 'atm_pagelink_search' => version_compare(_PS_VERSION_, '1.4.0.0', '<') ? __PS_BASE_URI__ . 'search.php' : $link->getPageLink('search.php')));
         return $this->display(__FILE__, 'pm_advancedtopmenu_search.tpl');
     } elseif ($row['type'] == 7) {
         $name = '';
         if ($withExtra && trim($row['have_icon'])) {
             $icone .= $this->_path . $type . '_icons/' . $row['id_' . $type] . '.' . ($row['image_type'] ? $row['image_type'] : 'jpg');
         }
         if (trim($row['link'])) {
             $url .= htmlentities($row['link'], ENT_COMPAT, 'UTF-8');
         } else {
             $linkNotClickable = true;
         }
     }
     $urlIsActive = false;
     if (!$this->activeAllreadySet && Configuration::get('ATM_MENU_GLOBAL_ACTIF')) {
         if ($id_product = Tools::getValue('id_product')) {
             //Check if url be cached
             if (!$this->current_category_product_url) {
                 //Get product default category URL
                 $product = new Product($id_product, false, $this->_cookie->id_lang);
                 //Put on cache
                 if (isset($product->category) && !empty($product->category)) {
                     $this->current_category_product_url = $link->getCategoryLink($product->id_category_default, $product->category);
                 }
             }
             $curUrl = $this->current_category_product_url;
         }
         if (!isset($curUrl) || !$curUrl) {
             $curUrl = explode('?', $_SERVER['REQUEST_URI']);
             $curUrl = $curUrl[0] . $this->getKeepVar();
         }
         $destUrl = explode('?', $url);
         $destUrl = $destUrl[0] . (isset($destUrl[1]) ? $this->getKeepVar($destUrl[1]) : '');
         //Url de destination
         $destUrl = preg_replace('#https?://' . preg_quote($_SERVER['HTTP_HOST'], '#') . '#i', '', $destUrl);
         //If PS_CANONICAL_REDIRECT add _iso_lang
         if (version_compare(_PS_VERSION_, '1.4.0.0', '>=') && $destUrl == __PS_BASE_URI__ && Configuration::get('PS_REWRITING_SETTINGS') && Configuration::get('PS_CANONICAL_REDIRECT') && Language::countActiveLanguages() > 1) {
             $destUrl .= Language::getIsoById($this->_cookie->id_lang) . '/';
         }
         //Url courante
         $curUrl = preg_replace('#https?://' . preg_quote($_SERVER['HTTP_HOST'], '#') . '#i', '', $curUrl);
         $pregCurUrl = preg_quote($curUrl, '#');
         $pregDestUrl = preg_quote($destUrl, '#');
         $urlIsActive = strlen($curUrl) <= strlen($destUrl) ? preg_match('#' . $pregDestUrl . '#i', $curUrl) : false;
     }
     ///prestashop_1\.4\.1\.0/cms\.php\?id_cms\=1
     ///prestashop_1\.4\.1\.0/cms\.php\?id_cms\=1
     if ($url && $urlIsActive) {
         $idActif = 'advtm_menu_actif_' . uniqid();
     }
     $return .= '<a href="' . ($linkNotClickable ? '#' : $url) . '" title="' . $name . '" ' . ($row['target'] ? 'target="' . htmlentities($row['target'], ENT_COMPAT, 'UTF-8') . '"' : '') . ' class="' . ($linkNotClickable ? 'adtm_unclickable' : '') . (strpos($name, "\n") !== false ? ' a-multiline' : '') . ($first_level ? ' a-niveau1' : '') . ($url && $urlIsActive ? ' advtm_menu_actif ' . $idActif : '') . '">';
     if ($type == 'menu') {
         $return .= '<span class="advtm_menu_span advtm_menu_span_' . intval($row['id_menu']) . '">';
     }
     if ($icone) {
         $return .= '<img src="' . $icone . '" alt="' . $name . '" title="' . $name . '" class="adtm_menu_icon" />';
     }
     $return .= nl2br($name);
     if ($type == 'menu') {
         $return .= '</span>';
     }
     if ($haveSub) {
         $return .= '<!--[if gte IE 7]><!-->';
     }
     $return .= '</a>';
     if ($url && $urlIsActive) {
         $return .= '<script type="text/javascript">activateParentMenu(".' . $idActif . '","' . $type . '");</script>';
         $this->activeAllreadySet = true;
     }
     return $return;
 }
開發者ID:TheTypoMaster,項目名稱:neonflexible,代碼行數:101,代碼來源:pm_advancedtopmenu.php

示例8: hookHeader

 public function hookHeader($params)
 {
     // Better way to check which file / controller name is loaded
     if (!($file = basename(Tools::getValue('controller')))) {
         $file = str_replace(array('.php', '-'), '', basename($_SERVER['SCRIPT_NAME']));
     }
     // Otherwise, create Google Analytics stats
     $ganalytics_id = Configuration::get('GANALYTICS_ID');
     $multilang = method_exists('Language', 'isMultiLanguageActivated') ? Language::isMultiLanguageActivated() : Language::countActiveLanguages() > 1;
     $defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
     $order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
     $pageTrack = preg_match('#(^' . __PS_BASE_URI__ . 'order.php)|(^' . __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'] . '[^-])#', $_SERVER['REQUEST_URI']) ? '/order/step' . (int) Tools::getValue('step') . '.html' : $file;
     $this->context->smarty->assign('ganalytics_id', $ganalytics_id);
     $this->context->smarty->assign('pageTrack', $pageTrack);
     $this->context->smarty->assign('isOrder', false);
     return $this->display(__FILE__, 'header.tpl');
 }
開發者ID:Evil1991,項目名稱:PrestaShop-1.4,代碼行數:17,代碼來源:ganalytics.php

示例9: hookHeader

 function hookHeader($params)
 {
     if (method_exists('Language', 'isMultiLanguageActivated') && Language::isMultiLanguageActivated() || Language::countActiveLanguages() > 1) {
         $multilang = (string) Tools::getValue('isolang') . '/';
     } else {
         $multilang = '';
     }
     $defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
     if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . $multilang . $defaultMetaOrder['url_rewrite']) === 0) {
         $this->context->smarty->assign('pageTrack', '/order/step' . (int) Tools::getValue('step') . '.html');
     }
     $this->context->smarty->assign('ganalytics_id', Configuration::get('GANALYTICS_ID'));
     $this->context->smarty->assign('isOrder', false);
     return $this->display(__FILE__, 'header.tpl');
 }
開發者ID:rtajmahal,項目名稱:PrestaShop-modules,代碼行數:15,代碼來源:ganalytics.php

示例10: process

 public function process()
 {
     $seo_url = Tools::getValue('seo_url', false);
     if ($seo_url == 'products-comparison') {
         ob_end_clean();
         header("Status: 301 Moved Permanently", false, 301);
         Tools::redirect('products-comparison.php?ajax=' . (int) Tools::getValue('ajax') . '&action=' . Tools::getValue('action') . '&id_product=' . (int) Tools::getValue('id_product'));
         die;
     }
     if ($seo_url && $this->id_seo && !Tools::getValue('getShareBlock')) {
         $resultSeoUrl = AdvancedSearchSeoClass::getSeoSearchByIdSeo((int) $this->id_seo, (int) $this->context->cookie->id_lang);
         if (!$resultSeoUrl) {
             Tools::redirect('404.php');
             die;
         }
         if ($resultSeoUrl[0]['deleted']) {
             header("Status: 301 Moved Permanently", false, 301);
             Tools::redirect('index.php');
             die;
         }
         $currentUri = explode('?', $_SERVER['REQUEST_URI']);
         $currentUri = $currentUri[0];
         $this->realURI = __PS_BASE_URI__ . (Language::countActiveLanguages() > 1 ? Language::getIsoById($this->context->cookie->id_lang) . '/' : '') . 's/' . $resultSeoUrl[0]['id_seo'] . '/' . $resultSeoUrl[0]['seo_url'];
         if (!preg_match('#([a-z]{2})?/?s/([0-9]+)/([a-zA-Z0-9/_-]*)#', $_SERVER['REQUEST_URI'])) {
             header("Status: 301 Moved Permanently", false, 301);
             header("Location: " . $this->realURI . ((int) Tools::getValue('p') > 1 ? '?p=' . (int) Tools::getValue('p') : ''));
             die;
         }
         if (!Tools::getValue('id_seo_id_search') && ($resultSeoUrl[0]['seo_url'] != $seo_url || $currentUri != $this->realURI)) {
             header("Status: 301 Moved Permanently", false, 301);
             header("Location: " . $this->realURI);
             die;
         }
         $this->id_search = $resultSeoUrl[0]['id_search'];
         $AdvancedSearchClass = new AdvancedSearchClass((int) $this->id_search, (int) $this->context->cookie->id_lang);
         if (!$AdvancedSearchClass->active) {
             header("Status: 302 Moved Temporarily", false, 302);
             Tools::redirect('index.php');
             die;
         }
         $criteria = unserialize($resultSeoUrl[0]['criteria']);
         if (is_array($criteria) && sizeof($criteria)) {
             $this->criterions = PM_AdvancedSearch4::getArrayCriteriaFromSeoArrayCriteria($criteria);
         }
         $_GET['id_seo_id_search'] = (int) $this->id_search;
         $_GET['as4c'] = $this->criterions;
         $this->hookName = AdvancedSearchClass::getHookName($AdvancedSearchClass->id_hook);
         $hasPriceCriterionGroup = false;
         if (is_array($this->criterions) && sizeof($this->criterions)) {
             $selected_criteria_groups_type = AdvancedSearchClass::getCriterionGroupsTypeAndDisplay((int) $this->id_search, array_keys($this->criterions));
             if (is_array($selected_criteria_groups_type) && sizeof($selected_criteria_groups_type)) {
                 foreach ($selected_criteria_groups_type as $criterionGroup) {
                     if ($criterionGroup['criterion_group_type'] == 'price') {
                         $hasPriceCriterionGroup = true;
                         break;
                     }
                 }
             }
         }
         if ($hasPriceCriterionGroup && $resultSeoUrl[0]['id_currency'] && $this->context->cookie->id_currency != (int) $resultSeoUrl[0]['id_currency']) {
             $this->context->cookie->id_currency = $resultSeoUrl[0]['id_currency'];
             header('Refresh: 1; URL=' . $_SERVER['REQUEST_URI']);
             die;
         }
         $this->context->smarty->assign('as_cross_links', AdvancedSearchSeoClass::getCrossLinksSeo($this->context->cookie->id_lang, $resultSeoUrl[0]['id_seo']));
     } else {
         if (Tools::getValue('setCollapseGroup')) {
             ob_end_clean();
             $this->id_search = (int) Tools::getValue('id_search');
             $id_criterion_group = (int) Tools::getValue('id_criterion_group');
             $state = (int) Tools::getValue('state');
             $id_criterion_group = $this->id_search . '_' . $id_criterion_group;
             $criterion_state = array($id_criterion_group => $state);
             $previous_criterion = array();
             if (isset($this->context->cookie->criterion_group_state)) {
                 $previous_criterion = unserialize($this->context->cookie->criterion_group_state);
                 if (is_array($previous_criterion) && sizeof($previous_criterion)) {
                     foreach ($previous_criterion as $k => $v) {
                         if ($k == $id_criterion_group) {
                             $criterion_state[$k] = (int) $state;
                         } else {
                             $criterion_state[$k] = (int) $v;
                         }
                     }
                     $this->context->cookie->criterion_group_state = serialize($criterion_state);
                     die;
                 } else {
                     $this->context->cookie->criterion_group_state = serialize($criterion_state);
                 }
                 die;
             } else {
                 $this->context->cookie->criterion_group_state = serialize($criterion_state);
             }
             die;
         } elseif (Tools::getValue('setHideCriterionStatus')) {
             ob_end_clean();
             $this->id_search = (int) Tools::getValue('id_search');
             $state = (int) Tools::getValue('state');
             if (isset($this->context->cookie->hidden_criteria_state)) {
                 $hidden_criteria_state = unserialize($this->context->cookie->hidden_criteria_state);
//.........這裏部分代碼省略.........
開發者ID:acreno,項目名稱:pm-ps,代碼行數:101,代碼來源:advancedsearch4.php

示例11: hookHeader

 function hookHeader($params)
 {
     // Better way to check which file / controller name is loaded
     if (!($file = basename(Tools::getValue('controller')))) {
         $file = str_replace(array('.php', '-'), '', basename($_SERVER['SCRIPT_NAME']));
     }
     #PNM-30 - Order confirmation wasn't tracked
     // If other controller / file name need to be done, add it to the array
     // if (in_array(v, array('orderconfirmation')))
     // return '';
     // Otherwise, create Google Analytics stats
     $ganalytics_id = Configuration::get('GANALYTICS_ID');
     $multilang = method_exists('Language', 'isMultiLanguageActivated') ? Language::isMultiLanguageActivated() : Language::countActiveLanguages() > 1;
     $defaultMetaOrder = Meta::getMetaByPage('order', $this->context->language->id);
     $order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
     $pageTrack = strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite']) === 0 ? '/order/step' . (int) Tools::getValue('step') . '.html' : $file;
     $this->context->smarty->assign('ganalytics_id', $ganalytics_id);
     $this->context->smarty->assign('pageTrack', $pageTrack);
     $this->context->smarty->assign('isOrder', false);
     return $this->display(__FILE__, 'header.tpl');
 }
開發者ID:nicolasjeol,項目名稱:hec-ecommerce,代碼行數:21,代碼來源:ganalytics.php

示例12: hookHeader

 function hookHeader($params)
 {
     global $smarty, $cookie;
     // hookOrderConfirmation() already send the sats bypass this step
     if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order-confirmation.php') === 0) {
         return '';
     }
     // Otherwise, create Google Analytics stats
     $ganalytics_id = Configuration::get('GANALYTICS_ID');
     $multilang = Language::countActiveLanguages() > 1;
     $defaultMetaOrder = Meta::getMetaByPage('order', (int) $cookie->id_lang);
     $order = ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite'];
     $pageTrack = strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . 'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__ . ($multilang ? (string) Tools::getValue('isolang') . '/' : '') . $defaultMetaOrder['url_rewrite']) === 0 ? '/order/step' . (int) Tools::getValue('step') . '.html' : '';
     $smarty->assign('ganalytics_id', $ganalytics_id);
     $smarty->assign('pageTrack', $pageTrack);
     $smarty->assign('isOrder', false);
     return $this->display(__FILE__, 'header.tpl');
 }
開發者ID:priyankajsr19,項目名稱:indusdiva2,代碼行數:18,代碼來源:ganalytics.php

示例13: countActiveLanguages

 public static function countActiveLanguages()
 {
     if (!self::$countActiveLanguages) {
         self::$countActiveLanguages = Db::getInstance()->getValue('SELECT COUNT(*) FROM `' . _DB_PREFIX_ . 'Language` WHERE `Active` = 1');
     }
     return self::$countActiveLanguages;
 }
開發者ID:khuyennd,項目名稱:dev-tasagent,代碼行數:7,代碼來源:Language.php

示例14: getContextShopUrl

 /**
  * Returns the current shop's url from the context and language.
  *
  * @param Context $context the context.
  * @param Language $language the language.
  * @return string the absolute url.
  */
 protected function getContextShopUrl($context, $language)
 {
     $shop = $context->shop;
     $ssl = Configuration::get('PS_SSL_ENABLED');
     $rewrite = (int) Configuration::get('PS_REWRITING_SETTINGS', null, null, $shop->id);
     $multi_lang = Language::countActiveLanguages($shop->id) > 1;
     // Backward compatibility
     if (_PS_VERSION_ < '1.5') {
         $base = ($ssl ? _PS_BASE_URL_SSL_ : _PS_BASE_URL_) . __PS_BASE_URI__;
     } else {
         $base = ($ssl ? 'https://' . $shop->domain_ssl : 'http://' . $shop->domain) . $shop->getBaseURI();
     }
     $lang = '';
     if ($multi_lang) {
         if ($rewrite) {
             $lang = $language->iso_code . '/';
         } else {
             $lang = '?id_lang=' . $language->id;
         }
     }
     return $base . $lang;
 }
開發者ID:silbersaiten,項目名稱:nostotagging,代碼行數:29,代碼來源:account.php

示例15: displaySeoUrlList

 protected function displaySeoUrlList()
 {
     $id_search = Tools::getValue('id_search');
     $this->_startForm(array('id' => 'SEOURLListForm'));
     $this->_displayTitle($this->l('SEO URL list'));
     $this->_showInfo($this->l('You will find here the list of all the SEO URLs pages you have created for this search engine. You have to add them in your menu, slideshow, footer, blocks, or anywhere you want in your website for Google crawling'));
     $seoSearchs = AdvancedSearchSeoClass::getSeoSearchs($this->_cookie->id_lang, false, $id_search);
     if ($seoSearchs && self::_isFilledArray($seoSearchs)) {
         $new_SeoSearch = array();
         foreach ($seoSearchs as $row) {
             $resultTotalProducts = $this->countProductFromSeoCriteria($id_search, unserialize($row['criteria']), $row['id_currency']);
             $ObjAdvancedSearchSeoClass = new AdvancedSearchSeoClass($row['id_seo'], null);
             if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && Shop::isFeatureActive()) {
                 $shopUrl = new Shop($this->_context->shop->id);
                 $base_url = $shopUrl->getBaseURL();
             } else {
                 $base_url = Tools::getShopDomain(true) . __PS_BASE_URI__;
             }
             if (version_compare(_PS_VERSION_, '1.5.0.0', '>=') && Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) {
                 $base_url = 'https://' . ltrim($base_url, 'http://');
             }
             foreach ($this->_languages as $language) {
                 $url = $base_url . (Language::countActiveLanguages() > 1 ? $language['iso_code'] . '/' : '') . 's/' . (int) $ObjAdvancedSearchSeoClass->id . '/' . $ObjAdvancedSearchSeoClass->seo_url[$language['id_lang']];
                 $title = htmlentities($ObjAdvancedSearchSeoClass->title[$language['id_lang']], ENT_COMPAT, 'UTF-8');
                 $new_SeoSearch[$language['id_lang']][$ObjAdvancedSearchSeoClass->id]['url'] = $url;
                 $new_SeoSearch[$language['id_lang']][$ObjAdvancedSearchSeoClass->id]['title'] = $title;
             }
         }
         $seoSearchs = $new_SeoSearch;
         unset($new_SeoSearch);
         if ($seoSearchs && self::_isFilledArray($seoSearchs)) {
             $this->_html .= '<p>' . $this->l('Please select the language :') . '<p>';
             $this->displayPMFlags();
             $this->_html .= '<div class="clear"></div>';
             foreach ($seoSearchs as $id_lang => $seo_urls) {
                 $this->_html .= '<div id="langseo_url_' . $id_lang . '" class="pmFlag pmFlagLang_' . $id_lang . '" style="display: ' . ($id_lang == $this->_default_language ? 'block' : 'none') . '; float: left;">';
                 $this->_html .= '<h3>' . $this->l('HTML version:') . '</h3>';
                 $this->_html .= '<textarea cols="110" rows="10">';
                 $this->_html .= htmlentities('<ul>', ENT_COMPAT, 'UTF-8') . "\n";
                 foreach ($seo_urls as $seo_url) {
                     $this->_html .= htmlentities('<li><a href="' . $seo_url['url'] . '" title="' . $seo_url['title'] . '">' . $seo_url['title'] . '</a></li>', ENT_COMPAT, 'UTF-8') . "\n";
                 }
                 $this->_html .= htmlentities('</ul>', ENT_COMPAT, 'UTF-8') . "\n";
                 $this->_html .= '</textarea>';
                 $this->_html .= '<h3>' . $this->l('CSV version:') . '</h3>';
                 $this->_html .= '<textarea cols="110" rows="10">';
                 foreach ($seo_urls as $seo_url) {
                     $this->_html .= '"' . $seo_url['title'] . '";"' . $seo_url['url'] . '"' . "\n";
                 }
                 $this->_html .= '</textarea>';
                 $this->_html .= '</div>';
             }
         }
     } else {
         $this->_showInfo($this->l('No seo page at this time please add one'));
     }
     $this->_endForm(array('id' => 'SEOURLListForm'));
 }
開發者ID:acreno,項目名稱:pm-ps,代碼行數:58,代碼來源:pm_advancedsearch4.php


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