当前位置: 首页>>代码示例>>PHP>>正文


PHP CMSCategory::getUrlRewriteInformations方法代码示例

本文整理汇总了PHP中CMSCategory::getUrlRewriteInformations方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory::getUrlRewriteInformations方法的具体用法?PHP CMSCategory::getUrlRewriteInformations怎么用?PHP CMSCategory::getUrlRewriteInformations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CMSCategory的用法示例。


在下文中一共展示了CMSCategory::getUrlRewriteInformations方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareHook

 protected function _prepareHook($params)
 {
     $languages = Language::getLanguages(true, $this->context->shop->id);
     if (!count($languages)) {
         return false;
     }
     $link = new Link();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
             $rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         $this->smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
     return true;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:32,代码来源:blocklanguages.php

示例2: preProcess

 public function preProcess()
 {
     if ($id_cms = (int) Tools::getValue('id_cms')) {
         $this->cms = new CMS($id_cms, self::$cookie->id_lang);
     } elseif ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
         $this->cms_category = new CMSCategory($id_cms_category, self::$cookie->id_lang);
     }
     // Automatically redirect to the canonical URL if the current in is the right one
     // $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
     if ($this->cms and $canonicalURL = self::$link->getCMSLink($this->cms)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (defined(_PS_MODE_DEV_) and _PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     if ($this->cms_category and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
         if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
             header('HTTP/1.0 301 Moved');
             if (_PS_MODE_DEV_) {
                 die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
             }
             Tools::redirectLink($canonicalURL);
         }
     }
     parent::preProcess();
     /* assignCase (1 = CMS page, 2 = CMS category) */
     if (Validate::isLoadedObject($this->cms) and ($this->cms->active or Tools::getValue('adtoken') == Tools::encrypt('PreviewCMS' . $this->cms->id) and file_exists(dirname(__FILE__) . '/../' . Tools::getValue('ad') . '/ajax.php'))) {
         $this->assignCase = 1;
     } elseif (Validate::isLoadedObject($this->cms_category)) {
         $this->assignCase = 2;
     } else {
         Tools::redirect('404.php');
     }
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
         $default_rewrite = array();
         foreach ($rewrite_infos as $infos) {
             $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? self::$link->getCMSLink($id_cms, $infos['link_rewrite'], $this->ssl, $infos['id_lang']) : self::$link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
             $default_rewrite[$infos['id_lang']] = $arr_link;
         }
         self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:46,代码来源:CMSController.php

示例3: hookTop

 /**
  * Returns module content for header
  *
  * @param array $params Parameters
  * @return string Content
  */
 public function hookTop($params)
 {
     global $smarty;
     $languages = Language::getLanguages();
     if (!count($languages)) {
         return;
     }
     $link = new Link();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         $phpSelf = isset($_SERVER['PHP_SELF']) ? substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)) : '';
         if ($phpSelf == 'product.php' and $id_product = (int) Tools::getValue('id_product')) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if ($phpSelf == 'category.php' and $id_category = (int) Tools::getValue('id_category')) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if ($phpSelf == 'cms.php' and ($id_cms = (int) Tools::getValue('id_cms') or $id_cms_category = (int) Tools::getValue('id_cms_category'))) {
             $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], NULL, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         if (count($default_rewrite)) {
             $smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
     $smarty->assign('languages', $languages);
     return $this->display(__FILE__, 'blocklanguages.tpl');
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:43,代码来源:blocklanguages.php

示例4: frontGetModuleContents

 function frontGetModuleContents($module, $cacheKey = '')
 {
     if (!$this->isCached('pagelink.' . $module['layout'] . '.tpl', Tools::encrypt($cacheKey))) {
         $contents = array();
         $langId = $this->context->language->id;
         $shopId = $this->context->shop->id;
         $items = Db::getInstance()->executeS("Select r.*, rl.name, rl.link  \n\t\t\t\tFrom " . _DB_PREFIX_ . "pagelink_item AS r \n\t\t\t\tInner Join " . _DB_PREFIX_ . "pagelink_item_lang AS rl On r.id = rl.menuitem_id \n\t\t\t\tWhere r.parent_id = 0 AND r.module_id = " . $module['id'] . " AND r.status = 1 AND rl.id_lang = " . $langId . " Order By r.ordering");
         if ($items) {
             foreach ($items as &$item) {
                 $icon = $this->getImageSrc($item['icon'], true);
                 $item['icon_type'] = $icon->type;
                 $item['full_path'] = $icon->img;
                 if ($item['link_type'] == 'PAG-authentication') {
                     if ($this->context->customer->logged) {
                         $item['link'] = $this->context->link->getPageLink('index', true, NULL, "mylogout");
                         $item['name'] = $this->l('Sign out');
                         $item['custom_class'] = 'nav-logout';
                     } else {
                         $item['link'] = $this->frontGenerationUrl($item['link_type'], $item['link']);
                     }
                 } elseif ($item['link_type'] == 'PRODUCT-0') {
                     $item['link'] = $this->frontGenerationUrl('PRD-' . $item['product_id'], $item['link']);
                 } elseif ($item['link_type'] == 'CURRENCY-BOX') {
                     $item['currencies'] = array('name' => $this->context->currency->name, 'iso_code' => $this->context->currency->iso_code, 'sign' => $this->context->currency->sign);
                 } elseif ($item['link_type'] == 'LANGUAGE-BOX') {
                     $languages = Language::getLanguages(true, $this->context->shop->id);
                     if (count($languages) > 0) {
                         $link = new Link();
                         if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
                             $default_rewrite = array();
                             if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
                                 $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
                                 foreach ($rewrite_infos as $infos) {
                                     $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
                                 }
                             }
                             if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
                                 $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
                                 foreach ($rewrite_infos as $infos) {
                                     $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
                                 }
                             }
                             if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
                                 $rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
                                 foreach ($rewrite_infos as $infos) {
                                     $arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                                     $default_rewrite[$infos['id_lang']] = $arr_link;
                                 }
                             }
                             $this->smarty->assign(array('lang_rewrite_urls' => $default_rewrite, 'lang_name' => $this->context->language->name, 'lang_iso_code' => $this->context->language->iso_code));
                         }
                     }
                 } else {
                     $item['link'] = $this->frontGenerationUrl($item['link_type'], $item['link']);
                 }
                 $item['submenus'] = $this->frontGetSubMenus($module['id'], $item['id']);
             }
         }
         $this->context->smarty->assign(array('module_layout' => $module['layout'], 'display_name' => $module['display_name'], 'custom_class' => $module['custom_class'], 'name' => $module['name'], 'menuContents' => $items));
     }
     return $this->display(__FILE__, 'pagelink.' . $module['layout'] . '.tpl', Tools::encrypt($cacheKey));
 }
开发者ID:zangles,项目名称:lennyba,代码行数:62,代码来源:pagelink.php

示例5: hookTop

 public function hookTop($params)
 {
     if (!$this->active) {
         return;
     }
     $languages = Language::getLanguages();
     if (!count($languages)) {
         return;
     }
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         $phpSelf = isset($_SERVER['PHP_SELF']) ? substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)) : '';
         if ($phpSelf == 'product.php' and $id_product = (int) Tools::getValue('id_product')) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $this->context->link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if ($phpSelf == 'category.php' and $id_category = (int) Tools::getValue('id_category')) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $this->context->link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if ($phpSelf == 'cms.php' and ($id_cms = (int) Tools::getValue('id_cms') or $id_cms_category = (int) Tools::getValue('id_cms_category'))) {
             $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? $this->context->link->getCMSLink($id_cms, $infos['link_rewrite'], NULL, $infos['id_lang']) : $this->context->link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         if (count($default_rewrite)) {
             $this->context->smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
     $this->assignContentVars($params);
     $this->context->smarty->assign(array('cart' => $this->context->cart, 'cart_qties' => $this->context->cart->nbProducts(), 'logged' => $this->context->customer->isLogged(), 'customerName' => $this->context->cookie->logged ? $this->context->cookie->customer_firstname . ' ' . $this->context->cookie->customer_lastname : false, 'firstName' => $this->context->cookie->logged ? $this->context->cookie->customer_firstname : false, 'lastName' => $this->context->cookie->logged ? $this->context->cookie->customer_lastname : false, 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'languages' => $languages));
     return $this->display(__FILE__, 'responsivetopbar.tpl');
 }
开发者ID:arozanski,项目名称:simpleresponsivetheme,代码行数:39,代码来源:responsivetopbar.php


注:本文中的CMSCategory::getUrlRewriteInformations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。