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


PHP Link::getCMSLink方法代码示例

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


在下文中一共展示了Link::getCMSLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getLinks

    public static function getLinks($id_lang, $selection = null)
    {
        $result = Db::getInstance()->ExecuteS('
		SELECT c.id_cms, cl.link_rewrite, cl.meta_title
		FROM ' . _DB_PREFIX_ . 'cms c
		LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (c.id_cms = cl.id_cms AND cl.id_lang = ' . intval($id_lang) . ')
		' . ($selection !== null ? 'WHERE c.id_cms IN (' . implode(',', array_map('intval', $selection)) . ')' : ''));
        $link = new Link();
        $links = array();
        if ($result) {
            foreach ($result as $row) {
                $row['link'] = $link->getCMSLink($row['id_cms'], $row['link_rewrite']);
                $links[] = $row;
            }
        }
        return $links;
    }
开发者ID:sealence,项目名称:local,代码行数:17,代码来源:CMS.php

示例3: widgetShow

 public function widgetShow($params)
 {
     global $smarty, $cookie;
     $linkTpl = '
     <a href="%1$s" class="widgetctooltip%4$s" rel="cms_%3$d">%2$s</a>';
     $additionalParams = '';
     foreach (self::$_additionalParams as $prefix => $param) {
         if (isset($params[$param])) {
             $additionalParams .= ' ' . $prefix . $params[$param];
         }
     }
     $cms = self::getShortCMSInfo($params['id'], $cookie->id_lang);
     if (!Tools::isEmpty($cms['meta_title'])) {
         $widgetPath = $this->widgetUri();
         $this->setCss($widgetPath . 'css/style.css');
         $this->setJs($widgetPath . 'js/tooltip.js');
         $link = new Link();
         return sprintf($linkTpl, $link->getCMSLink($params['id'], $cms['link_rewrite']), $cms['meta_title'], $params['id'], $additionalParams);
     }
 }
开发者ID:pedalracer,项目名称:free_modules_1.5,代码行数:20,代码来源:widgetcmstooltip.php

示例4: 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

示例5: _postProcess

    private function _postProcess()
    {
        Configuration::updateValue('GSITEMAP_ALL_CMS', (int) Tools::getValue('GSITEMAP_ALL_CMS'));
        Configuration::updateValue('GSITEMAP_ALL_PRODUCTS', (int) Tools::getValue('GSITEMAP_ALL_PRODUCTS'));
        $link = new Link();
        $langs = Language::getLanguages();
        $xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
</urlset>
XML;
        $xml = new SimpleXMLElement($xmlString);
        if (Configuration::get('PS_REWRITING_SETTINGS') and sizeof($langs) > 1) {
            foreach ($langs as $lang) {
                $this->_addSitemapNode($xml, Tools::getShopDomain(true, true) . __PS_BASE_URI__ . $lang['iso_code'] . '/', '1.00', 'daily', date('Y-m-d'));
            }
        } else {
            $this->_addSitemapNode($xml, Tools::getShopDomain(true, true) . __PS_BASE_URI__, '1.00', 'daily', date('Y-m-d'));
        }
        /* CMS Generator */
        if (Configuration::get('GSITEMAP_ALL_CMS') or !Module::isInstalled('blockcms')) {
            $sql_cms = '
			SELECT DISTINCT ' . (Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms') . ' FROM ' . _DB_PREFIX_ . 'cms_lang cl
			LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (cl.id_lang = l.id_lang)
			WHERE l.`active` = 1
			ORDER BY cl.id_cms, cl.id_lang ASC';
        } elseif (Module::isInstalled('blockcms')) {
            $sql_cms = '
			SELECT DISTINCT ' . (Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms') . ' FROM ' . _DB_PREFIX_ . 'cms_block_page b
			LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (b.id_cms = cl.id_cms)
			LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (cl.id_lang = l.id_lang)
			WHERE l.`active` = 1
			ORDER BY cl.id_cms, cl.id_lang ASC';
        }
        $cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql_cms);
        foreach ($cmss as $cms) {
            $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $link->getCMSLink((int) $cms['id_cms'], $cms['link_rewrite'], false, (int) $cms['id_lang']) : $link->getCMSLink((int) $cms['id_cms']);
            $this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily');
        }
        /* Categories Generator */
        if (Configuration::get('PS_REWRITING_SETTINGS')) {
            $categories = Db::getInstance()->ExecuteS('
			SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang
			FROM ' . _DB_PREFIX_ . 'category c
			LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON c.id_category = cl.id_category
			LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON cl.id_lang = l.id_lang
			WHERE l.`active` = 1 AND c.`active` = 1 AND c.id_category != 1
			ORDER BY cl.id_category, cl.id_lang ASC');
        } else {
            $categories = Db::getInstance()->ExecuteS('SELECT c.id_category, c.level_depth, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd
			FROM ' . _DB_PREFIX_ . 'category c 
			ORDER BY c.id_category ASC');
        }
        foreach ($categories as $category) {
            if (($priority = 0.9 - $category['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $link->getCategoryLink((int) $category['id_category'], $category['link_rewrite'], (int) $category['id_lang']) : $link->getCategoryLink((int) $category['id_category']);
            $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($category['date_upd'], 0, 10));
        }
        $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT p.id_product, pl.link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') date_upd, pl.id_lang, cl.`link_rewrite` category, ean13, i.id_image, il.legend legend_image, (
			SELECT MIN(level_depth)
			FROM ' . _DB_PREFIX_ . 'product p2
			LEFT JOIN ' . _DB_PREFIX_ . 'category_product cp2 ON p2.id_product = cp2.id_product
			LEFT JOIN ' . _DB_PREFIX_ . 'category c2 ON cp2.id_category = c2.id_category
			WHERE p2.id_product = p.id_product AND p2.`active` = 1 AND c2.`active` = 1) AS level_depth
		FROM ' . _DB_PREFIX_ . 'product p
		LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (p.id_product = pl.id_product)
		LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND pl.`id_lang` = cl.`id_lang`)
		LEFT JOIN ' . _DB_PREFIX_ . 'image i ON p.id_product = i.id_product
		LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (i.`id_image` = il.`id_image` AND pl.`id_lang` = il.`id_lang`)
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (pl.id_lang = l.id_lang)
		WHERE l.`active` = 1 AND p.`active` = 1
		' . (Configuration::get('GSITEMAP_ALL_PRODUCTS') ? '' : 'HAVING level_depth IS NOT NULL') . '
		ORDER BY pl.id_product, pl.id_lang ASC');
        $tmp = null;
        $res = null;
        foreach ($products as $product) {
            if ($tmp == $product['id_product']) {
                $res[$tmp]['images'][] = array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
            } else {
                $tmp = $product['id_product'];
                $res[$tmp] = $product;
                unset($res[$tmp]['id_image'], $res[$tmp]['legend_image']);
                $res[$tmp]['images'][] = array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
            }
        }
        foreach ($res as $product) {
            if (($priority = 0.7 - $product['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $tmpLink = $link->getProductLink((int) $product['id_product'], $product['link_rewrite'], $product['category'], $product['ean13'], (int) $product['id_lang']);
            $sitemap = $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($product['date_upd'], 0, 10));
            $sitemap = $this->_addSitemapNodeImage($sitemap, $product);
        }
        /* Add classic pages (contact, best sales, new products...) */
        $pages = array('authentication' => true, 'best-sales' => false, 'contact-form' => true, 'discount' => false, 'index' => false, 'manufacturer' => false, 'new-products' => false, 'prices-drop' => false, 'supplier' => false, 'store' => false);
        // Don't show suppliers and manufacturers if they are disallowed
//.........这里部分代码省略.........
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:101,代码来源:gsitemap.php

示例6: hookActionObjectUpdateAfter

 public function hookActionObjectUpdateAfter($params)
 {
     if (isset($params['object']) && !empty($params['object'])) {
         $object = $params['object'];
         $type = get_class($object);
         if (!in_array($type, array('Product', 'Manufacturer', 'Supplier', 'Category', 'CMS', 'CMSCategory'))) {
             // Ok not our job
             return;
         }
         $shops = $this->getShopsIds();
         $link = new Link();
         $redirect_list = array();
         // Incremental way, it's a bugfix, for supplier for example
         $shop_urls = array();
         $shop_urls[] = 'https:';
         $shop_urls[] = 'http:';
         foreach ($shops as $id_shop) {
             $shop = new ShopUrl($id_shop);
             $shop_urls[] = str_replace(array('http://', 'https://'), '', $shop->getURL(true));
             $shop_urls[] = str_replace(array('http://', 'https://'), '', $shop->getURL(false));
         }
         $shop_urls = array_unique($shop_urls);
         foreach ($shops as $id_shop) {
             // foreach langs, foreach shops ...
             $langs = Language::getLanguages(false, $id_shop, true);
             foreach ($langs as $id_lang) {
                 switch ($type) {
                     case 'Manufacturer':
                         $old_link = $link->getManufacturerLink($object, null, null, null, $id_lang, $id_shop);
                         break;
                     case 'Supplier':
                         $old_link = $link->getSupplierLink($object, null, null, null, $id_lang, $id_shop);
                         break;
                     case 'CMS':
                         $old_link = $link->getCMSLink($object, null, null, $id_lang, $id_shop);
                         break;
                     case 'Product':
                         $old_link = $link->getProductLink($object, null, null, null, $id_lang, $id_shop);
                         break;
                     case 'Category':
                         $old_link = $link->getCategoryLink($object, null, $id_lang, null, $id_shop);
                         break;
                     case 'CMSCategory':
                         $old_link = $link->getCMSCategoryLink($object, null, $id_lang, $id_shop);
                         break;
                     default:
                         // UFO
                         break;
                 }
                 // Escape shops urls, it's a multishop relative approach
                 $old = str_replace($shop_urls, '', $old_link);
                 $old = '/' . ltrim($old, '/');
                 // Avoid duplicates, simplify complex mapings
                 $md5 = md5($old);
                 if (!isset($redirect_list[$md5])) {
                     $redirect_list[$md5]['old'] = $old;
                     $redirect_list[$md5]['shops'][] = $id_shop;
                 } elseif (!in_array($id_shop, $redirect_list[$md5]['shops'])) {
                     $redirect_list[$md5]['shops'][] = $id_shop;
                 }
             }
         }
         if (!empty($redirect_list)) {
             foreach ($redirect_list as $redirect) {
                 foreach ($redirect['shops'] as $id_shop) {
                     $this->checkConflict($redirect['old'], $id_shop);
                 }
             }
         }
     }
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:71,代码来源:magicredirect.php

示例7: hookProductTabContent

 public function hookProductTabContent($params)
 {
     $tab_type = Configuration::get('LG_CONSULTAS_TAB_CONTENT');
     $icon_display = Configuration::get('LG_CONSULTAS_ICON_DISPLAY');
     $icon_color = Configuration::get('LG_CONSULTAS_ICON_COLOR');
     $defaultdisplay = Configuration::get('LG_CONSULTAS_DEFAULT');
     $extradisplay = Configuration::get('LG_CONSULTAS_EXTRA');
     $link = new Link();
     $cmspage = $link->getCMSLink(Configuration::get('LG_CONSULTAS_CMS'));
     $question = Db::getInstance()->executeS('SELECT * ' . 'FROM ' . _DB_PREFIX_ . 'lgconsultas ' . 'WHERE id_producto = ' . (int) Tools::getValue('id_product', 0) . ' AND validado = 1');
     $question_number = count($question);
     //1 show as responsive block
     //2 separate tab content
     if ((int) $tab_type == 2) {
         $consultas = $this->getConsultasProducto((int) Tools::getValue('id_product', 0));
         $this->smarty->assign(array('id_product' => (int) Tools::getValue('id_product', 0), 'consultas' => $consultas));
     }
     $this->context->smarty->assign(array('question_number' => $question_number, 'tab_type' => $tab_type, 'icon_display' => $icon_display, 'icon_color' => $icon_color, 'defaultdisplay' => $defaultdisplay, 'extradisplay' => $extradisplay, 'cmspage' => $cmspage));
     return $this->display(__FILE__, '/views/templates/front/tab_faq_15.tpl');
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:20,代码来源:lgconsultas.php

示例8: _getCmsLink

    /**
     * return the link elements for the CMS object
     *
     * @param array  $link_sitemap contain all the links for the Google Sitemap file to be generated
     * @param string $lang         the language of link to add
     * @param int    $index        the index of the current Google Sitemap file
     * @param int    $i            the count of elements added to sitemap main array
     * @param int    $id_cms       the CMS object identifier
     *
     * @return bool
     */
    private function _getCmsLink(&$link_sitemap, $lang, &$index, &$i, $id_cms = 0)
    {
        $link = new Link();
        if (method_exists('ShopUrl', 'resetMainDomainCache')) {
            ShopUrl::resetMainDomainCache();
        }
        $cmss_id = Db::getInstance()->ExecuteS('SELECT c.`id_cms` FROM `' . _DB_PREFIX_ . 'cms` c INNER JOIN `' . _DB_PREFIX_ . 'cms_lang` cl ON c.`id_cms` = cl.`id_cms` ' . ($this->tableColumnExists(_DB_PREFIX_ . 'supplier_shop') ? 'INNER JOIN `' . _DB_PREFIX_ . 'cms_shop` cs ON c.`id_cms` = cs.`id_cms` ' : '') . 'INNER JOIN `' . _DB_PREFIX_ . 'cms_category` cc ON c.id_cms_category = cc.id_cms_category AND cc.active = 1
				WHERE c.`active` =1 AND c.`id_cms` > ' . (int) $id_cms . ($this->tableColumnExists(_DB_PREFIX_ . 'supplier_shop') ? ' AND cs.id_shop = ' . (int) $this->context->shop->id : '') . ' AND cl.`id_lang` = ' . (int) $lang['id_lang'] . ' ORDER BY c.`id_cms` ASC');
        foreach ($cmss_id as $cms_id) {
            $cms = new CMS((int) $cms_id['id_cms'], $lang['id_lang']);
            $cms->link_rewrite = urlencode(is_array($cms->link_rewrite) ? $cms->link_rewrite[(int) $lang['id_lang']] : $cms->link_rewrite);
            $url = $link->getCMSLink($cms, null, null, $lang['id_lang']);
            if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'cms', 'page' => 'cms', 'link' => $url, 'image' => false), $lang['iso_code'], $index, $i, $cms_id['id_cms'])) {
                return false;
            }
        }
        return true;
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:29,代码来源:gsitemap.php

示例9: getLink

 public function getLink($menu)
 {
     if ($this->edit_string) {
         return '#';
     }
     $link = new Link();
     $id_lang = Context::getContext()->language->id;
     $value = (int) $menu['item'];
     $result = '';
     switch ($menu['type']) {
         case 'product':
             if (Validate::isLoadedObject($obj_pro = new Product($value, true, $id_lang))) {
                 $result = $link->getProductLink((int) $obj_pro->id, $obj_pro->link_rewrite, null, null, $id_lang);
             }
             break;
         case 'category':
             if (Validate::isLoadedObject($obj_cate = new Category($value, $id_lang))) {
                 $result = $link->getCategoryLink((int) $obj_cate->id, $obj_cate->link_rewrite, $id_lang);
             }
             break;
         case 'cms':
             if (Validate::isLoadedObject($obj_cms = new CMS($value, $id_lang))) {
                 $result = $link->getCMSLink((int) $obj_cms->id, $obj_cms->link_rewrite, $id_lang);
             }
             break;
         case 'url':
             $value = $menu['url'];
             if ($value == 'index' || $value == 'index.php') {
                 $result = $link->getPageLink('index.php', false, $id_lang);
                 break;
             }
             $regex = '((https?|ftp)\\:\\/\\/)?';
             // SCHEME
             $regex .= '([a-z0-9+!*(),;?&=\\$_.-]+(\\:[a-z0-9+!*(),;?&=\\$_.-]+)?@)?';
             // User and Pass
             $regex .= '([a-z0-9-.]*)\\.([a-z]{2,3})';
             // Host or IP
             $regex .= '(\\:[0-9]{2,5})?';
             // Port
             $regex .= '(\\/([a-z0-9+\\$_-]\\.?)+)*\\/?';
             // Path
             $regex .= '(\\?[a-z+&\\$_.-][a-z0-9;:@&%=+\\/\\$_.-]*)?';
             // GET Query
             $regex .= '(#[a-z_.-][a-z0-9+\\$_.-]*)?';
             // Anchor
             if ($value == '#' || preg_match("/^{$regex}\$/", $value)) {
                 $result = $value;
                 break;
             }
             $result = $link->getPageLink($value, false, $id_lang);
             break;
         case 'manufacture':
             if (Validate::isLoadedObject($obj_manu = new Manufacturer($value, $id_lang))) {
                 $result = $link->getManufacturerLink((int) $obj_manu->id, $obj_manu->link_rewrite, $id_lang);
             }
             break;
         case 'supplier':
             if (Validate::isLoadedObject($obj_supp = new Supplier($value, $id_lang))) {
                 $result = $link->getSupplierLink((int) $obj_supp->id, $obj_supp->link_rewrite, $id_lang);
             }
             break;
         default:
             $result = '#';
             break;
     }
     return $result;
 }
开发者ID:ahmedonee,项目名称:morinella,代码行数:67,代码来源:Sbmegamenu.php

示例10: getLinks

    public static function getLinks($id_lang, $selection = NULL, $active = true)
    {
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT c.id_cms, cl.link_rewrite, cl.meta_title
		FROM ' . _DB_PREFIX_ . 'cms c
		LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (c.id_cms = cl.id_cms AND cl.id_lang = ' . (int) $id_lang . ')
		WHERE 1
		' . ($selection !== NULL ? ' AND c.id_cms IN (' . implode(',', array_map('intval', $selection)) . ')' : '') . ($active ? ' AND c.`active` = 1 ' : '') . 'ORDER BY c.`position`');
        $link = new Link();
        $links = array();
        if ($result) {
            foreach ($result as $row) {
                $row['link'] = $link->getCMSLink((int) $row['id_cms'], $row['link_rewrite']);
                $links[] = $row;
            }
        }
        return $links;
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:18,代码来源:CMS.php

示例11: getLinks

    public static function getLinks($id_lang, $selection = null, $active = true, $ssl = false)
    {
        $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT c.id_cms, cl.link_rewrite, cl.meta_title
		FROM ' . _DB_PREFIX_ . 'cms c
		LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (c.id_cms = cl.id_cms AND cl.id_lang = ' . (int) $id_lang . ')
		WHERE 1
		' . (!empty($selection) ? ' AND c.id_cms IN (' . implode(',', array_map('intval', $selection)) . ')' : '') . ($active ? ' AND c.`active` = 1 ' : '') . 'ORDER BY c.`position`');
        if ($results) {
            $link = new Link();
            foreach ($results as &$row) {
                $row['link'] = $link->getCMSLink((int) $row['id_cms'], $row['link_rewrite'], (bool) $ssl, (int) $id_lang);
            }
        }
        return $results;
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:16,代码来源:CMS.php

示例12: _postProcess

    private function _postProcess()
    {
        $link = new Link();
        $defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
        $ruBackup = $_SERVER['REQUEST_URI'];
        $snBackup = $_SERVER['SCRIPT_NAME'];
        $getBackup = $_GET;
        $xml = new SimpleXMLElement('<urlset
			xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
			http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
		</urlset>');
        $sitemap = $xml->addChild('url');
        $sitemap->addChild('loc', 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__);
        $sitemap->addChild('priority', '1.00');
        $sitemap->addChild('lastmod', date("Y-m-d"));
        $sitemap->addChild('changefreq', 'daily');
        $cmss = Db::getInstance()->ExecuteS('
		SELECT DISTINCT b.id_cms, cl.link_rewrite, cl.id_lang
		FROM ' . _DB_PREFIX_ . 'block_cms b
		LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (b.id_cms = cl.id_cms)
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (cl.id_lang = l.id_lang)
		WHERE l.`active` = 1
		ORDER BY cl.id_cms, cl.id_lang ASC');
        foreach ($cmss as $cms) {
            $sitemap = $xml->addChild('url');
            $tmpLink = $link->getCMSLink($cms['id_cms'], $cms['link_rewrite']);
            $_GET = array('id_cms' => $cms['id_cms']);
            if ($cms['id_lang'] != $defaultLanguage) {
                $_SERVER['REQUEST_URI'] = substr($tmpLink, strpos($tmpLink, __PS_BASE_URI__));
                $_SERVER['SCRIPT_NAME'] = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
                $link = new Link();
                $tmpLink = $link->getLanguageLink(intval($cms['id_lang']));
                $tmpLink = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $tmpLink;
            }
            $sitemap->addChild('loc', htmlspecialchars($tmpLink));
            $sitemap->addChild('priority', '0.8');
            $sitemap->addChild('changefreq', 'monthly');
        }
        $categories = Db::getInstance()->ExecuteS('
		SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang
		FROM ' . _DB_PREFIX_ . 'category c
		LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON c.id_category = cl.id_category
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON cl.id_lang = l.id_lang
		WHERE l.`active` = 1 AND c.`active` = 1 AND c.id_category != 1
		ORDER BY cl.id_category, cl.id_lang ASC');
        foreach ($categories as $category) {
            if (($priority = 0.9 - $category['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $sitemap = $xml->addChild('url');
            $tmpLink = $link->getCategoryLink($category['id_category'], $category['link_rewrite']);
            $_GET = array('id_category' => $category['id_category']);
            if ($category['id_lang'] != $defaultLanguage) {
                $_SERVER['REQUEST_URI'] = substr($tmpLink, strpos($tmpLink, __PS_BASE_URI__));
                $_SERVER['SCRIPT_NAME'] = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
                $link = new Link();
                $tmpLink = $link->getLanguageLink(intval($category['id_lang']));
                $tmpLink = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $tmpLink;
            }
            $sitemap->addChild('loc', htmlspecialchars($tmpLink));
            $sitemap->addChild('priority', $priority);
            $sitemap->addChild('lastmod', substr($category['date_upd'], 0, 10));
            $sitemap->addChild('changefreq', 'weekly');
        }
        $products = Db::getInstance()->ExecuteS('
		SELECT p.id_product, pl.link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, pl.id_lang, cl.`link_rewrite` AS category, ean13, (
			SELECT MIN(level_depth)
			FROM ' . _DB_PREFIX_ . 'product p2
			LEFT JOIN ' . _DB_PREFIX_ . 'category_product cp2 ON p2.id_product = cp2.id_product
			LEFT JOIN ' . _DB_PREFIX_ . 'category c2 ON cp2.id_category = c2.id_category
			WHERE p2.id_product = p.id_product AND p2.`active` = 1 AND c2.`active` = 1) AS level_depth
		FROM ' . _DB_PREFIX_ . 'product p
		LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON p.id_product = pl.id_product
		LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND pl.`id_lang` = cl.`id_lang`)
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON pl.id_lang = l.id_lang
		WHERE l.`active` = 1 AND p.`active` = 1
		ORDER BY pl.id_product, pl.id_lang ASC');
        foreach ($products as $product) {
            if (($priority = 0.7 - $product['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $sitemap = $xml->addChild('url');
            $tmpLink = $link->getProductLink($product['id_product'], $product['link_rewrite'], $product['category'], $product['ean13']);
            $_GET = array('id_product' => $product['id_product']);
            if ($product['id_lang'] != $defaultLanguage) {
                $_SERVER['REQUEST_URI'] = substr($tmpLink, strpos($tmpLink, __PS_BASE_URI__));
                $_SERVER['SCRIPT_NAME'] = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
                $link = new Link();
                $tmpLink = $link->getLanguageLink(intval($product['id_lang']));
                $tmpLink = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $tmpLink;
            }
            $sitemap->addChild('loc', htmlspecialchars($tmpLink));
            $sitemap->addChild('priority', $priority);
            $sitemap->addChild('lastmod', substr($product['date_upd'], 0, 10));
            $sitemap->addChild('changefreq', 'weekly');
        }
        $images = Db::getInstance()->ExecuteS('
		SELECT *
//.........这里部分代码省略.........
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:101,代码来源:gsitemap.php

示例13: getRecurseCategory

    public static function getRecurseCategory($id_lang = _USER_ID_LANG_, $current = 1, $active = 1, $links = 0)
    {
        $category = Db::getInstance()->getRow('
		SELECT c.`id_cms_category`, c.`id_parent`, c.`level_depth`, cl.`name`, cl.`link_rewrite`
		FROM `' . _DB_PREFIX_ . 'cms_category` c
		JOIN `' . _DB_PREFIX_ . 'cms_category_lang` cl ON c.`id_cms_category` = cl.`id_cms_category`
		WHERE c.`id_cms_category` = ' . (int) $current . '
		AND `id_lang` = ' . (int) $id_lang);
        $result = Db::getInstance()->ExecuteS('
		SELECT c.`id_cms_category`
		FROM `' . _DB_PREFIX_ . 'cms_category` c
		WHERE c.`id_parent` = ' . (int) $current . ($active ? ' AND c.`active` = 1' : ''));
        foreach ($result as $row) {
            $category['children'][] = self::getRecurseCategory($id_lang, $row['id_cms_category'], $active, $links);
        }
        $category['cms'] = Db::getInstance()->ExecuteS('
		SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
		FROM `' . _DB_PREFIX_ . 'cms` c
		JOIN `' . _DB_PREFIX_ . 'cms_lang` cl ON c.`id_cms` = cl.`id_cms`
		WHERE `id_cms_category` = ' . (int) $current . '
		AND cl.`id_lang` = ' . (int) $id_lang . ($active ? ' AND c.`active` = 1' : '') . '
		ORDER BY c.`position`');
        if ($links == 1) {
            $link = new Link();
            $category['link'] = $link->getCMSCategoryLink($current, $category['link_rewrite']);
            foreach ($category['cms'] as $key => $cms) {
                $category['cms'][$key]['link'] = $link->getCMSLink($cms['id_cms'], $cms['link_rewrite']);
            }
        }
        return $category;
    }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:31,代码来源:CMSCategory.php

示例14: getCMStitles

    public static function getCMStitles($location)
    {
        global $cookie;
        $cmsCategories = Db::getInstance()->ExecuteS('
		SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name
		FROM `' . _DB_PREFIX_ . 'cms_block` bc
		INNER JOIN `' . _DB_PREFIX_ . 'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`)
		INNER JOIN `' . _DB_PREFIX_ . 'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`)
		WHERE bc.`location` = ' . (int) $location . ' AND ccl.`id_lang` = ' . (int) $cookie->id_lang . ' AND bcl.`id_lang` = ' . (int) $cookie->id_lang . '
		ORDER BY `position`');
        $content = array();
        $link = new Link();
        if (is_array($cmsCategories) and sizeof($cmsCategories)) {
            foreach ($cmsCategories as $cmsCategory) {
                $key = (int) $cmsCategory['id_cms_block'];
                $content[$key]['display_store'] = $cmsCategory['display_store'];
                $content[$key]['cms'] = Db::getInstance()->ExecuteS('
				SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
				FROM `' . _DB_PREFIX_ . 'cms_block_page` bcp 
				INNER JOIN `' . _DB_PREFIX_ . 'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`)
				INNER JOIN `' . _DB_PREFIX_ . 'cms` c ON (bcp.`id_cms` = c.`id_cms`)
				WHERE bcp.`id_cms_block` = ' . (int) $cmsCategory['id_cms_block'] . ' AND cl.`id_lang` = ' . (int) $cookie->id_lang . ' AND bcp.`is_category` = 0 AND c.`active` = 1
				ORDER BY `position`');
                $links = array();
                if (sizeof($content[$key]['cms'])) {
                    foreach ($content[$key]['cms'] as $row) {
                        $row['link'] = $link->getCMSLink((int) $row['id_cms'], $row['link_rewrite']);
                        $links[] = $row;
                    }
                }
                $content[$key]['cms'] = $links;
                $content[$key]['categories'] = Db::getInstance()->ExecuteS('
				SELECT bcp.`id_cms`, cl.`name`, cl.`link_rewrite`
				FROM `' . _DB_PREFIX_ . 'cms_block_page` bcp 
				INNER JOIN `' . _DB_PREFIX_ . 'cms_category_lang` cl ON (bcp.`id_cms` = cl.`id_cms_category`)
				WHERE bcp.`id_cms_block` = ' . (int) $cmsCategory['id_cms_block'] . '
				AND cl.`id_lang` = ' . (int) $cookie->id_lang . '
				AND bcp.`is_category` = 1');
                $links = array();
                if (sizeof($content[$key]['categories'])) {
                    foreach ($content[$key]['categories'] as $row) {
                        $row['link'] = $link->getCMSCategoryLink((int) $row['id_cms'], $row['link_rewrite']);
                        $links[] = $row;
                    }
                }
                $content[$key]['categories'] = $links;
                $content[$key]['name'] = $cmsCategory['block_name'];
                $content[$key]['category_link'] = $link->getCMSCategoryLink((int) $cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']);
                $content[$key]['category_name'] = $cmsCategory['category_name'];
            }
        }
        return $content;
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:53,代码来源:blockcms.php

示例15: _postProcess

    private function _postProcess()
    {
        Configuration::updateValue('GSITEMAP_ALL_CMS', intval(Tools::getValue('GSITEMAP_ALL_CMS')));
        Configuration::updateValue('GSITEMAP_ALL_PRODUCTS', intval(Tools::getValue('GSITEMAP_ALL_PRODUCTS')));
        $link = new Link();
        $xmlString = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</urlset>
XML;
        $xml = new SimpleXMLElement($xmlString);
        $this->_addSitemapNode($xml, 'http://' . Tools::getHttpHost(false, true) . __PS_BASE_URI__, '1.00', 'daily', date('Y-m-d'));
        if (Configuration::get('GSITEMAP_ALL_CMS')) {
            $sql_cms = '
			SELECT DISTINCT cl.id_cms, cl.link_rewrite, cl.id_lang
			FROM ' . _DB_PREFIX_ . 'cms_lang cl
			LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (cl.id_lang = l.id_lang)
			WHERE l.`active` = 1
			ORDER BY cl.id_cms, cl.id_lang ASC';
        } else {
            $sql_cms = '
			SELECT DISTINCT b.id_cms, cl.link_rewrite, cl.id_lang
			FROM ' . _DB_PREFIX_ . 'block_cms b
			LEFT JOIN ' . _DB_PREFIX_ . 'cms_lang cl ON (b.id_cms = cl.id_cms)
			LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON (cl.id_lang = l.id_lang)
			WHERE l.`active` = 1
			ORDER BY cl.id_cms, cl.id_lang ASC';
        }
        $cmss = Db::getInstance()->ExecuteS($sql_cms);
        foreach ($cmss as $cms) {
            $this->_addSitemapNode($xml, $link->getCMSLink(intval($cms['id_cms']), $cms['link_rewrite'], intval($cms['id_lang'])), '0.8', 'daily');
        }
        $categories = Db::getInstance()->ExecuteS('
		SELECT c.id_category, c.level_depth, link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, cl.id_lang
		FROM ' . _DB_PREFIX_ . 'category c
		LEFT JOIN ' . _DB_PREFIX_ . 'category_lang cl ON c.id_category = cl.id_category
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON cl.id_lang = l.id_lang
		WHERE l.`active` = 1 AND c.`active` = 1 AND c.id_category != 1
		ORDER BY cl.id_category, cl.id_lang ASC');
        foreach ($categories as $category) {
            if (($priority = 0.9 - $category['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $tmpLink = $link->getCategoryLink(intval($category['id_category']), $category['link_rewrite'], intval($category['id_lang']));
            $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($category['date_upd'], 0, 10));
        }
        $products = Db::getInstance()->ExecuteS('
		SELECT p.id_product, pl.link_rewrite, DATE_FORMAT(IF(date_upd,date_upd,date_add), \'%Y-%m-%d\') AS date_upd, pl.id_lang, cl.`link_rewrite` AS category, ean13, (
			SELECT MIN(level_depth)
			FROM ' . _DB_PREFIX_ . 'product p2
			LEFT JOIN ' . _DB_PREFIX_ . 'category_product cp2 ON p2.id_product = cp2.id_product
			LEFT JOIN ' . _DB_PREFIX_ . 'category c2 ON cp2.id_category = c2.id_category
			WHERE p2.id_product = p.id_product AND p2.`active` = 1 AND c2.`active` = 1) AS level_depth
		FROM ' . _DB_PREFIX_ . 'product p
		LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON p.id_product = pl.id_product
		LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND pl.`id_lang` = cl.`id_lang`)
		LEFT JOIN ' . _DB_PREFIX_ . 'lang l ON pl.id_lang = l.id_lang
		WHERE l.`active` = 1 AND p.`active` = 1
		' . (Configuration::get('GSITEMAP_ALL_PRODUCTS') ? '' : 'HAVING level_depth IS NOT NULL') . '
		ORDER BY pl.id_product, pl.id_lang ASC');
        foreach ($products as $product) {
            if (($priority = 0.7 - $product['level_depth'] / 10) < 0.1) {
                $priority = 0.1;
            }
            $tmpLink = $link->getProductLink(intval($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], intval($product['id_lang']));
            $this->_addSitemapNode($xml, htmlspecialchars($tmpLink), $priority, 'weekly', substr($product['date_upd'], 0, 10));
        }
        /* Add classic pages (contact, best sales, new products...) */
        $pages = array('authentication', 'best-sales', 'category', 'contact-form', 'discount', 'index', 'manufacturer', 'new-products', 'prices-drop', 'search', 'supplier');
        foreach ($pages as $page) {
            $this->_addSitemapNode($xml, htmlspecialchars('http://' . Tools::getHttpHost(false, true) . __PS_BASE_URI__ . $page . '.php'), '0.5', 'monthly');
        }
        $xmlString = $xml->asXML();
        $fp = fopen(GSITEMAP_FILE, 'w');
        fwrite($fp, $xmlString);
        fclose($fp);
        $res = file_exists(GSITEMAP_FILE);
        $this->_html .= '<h3 class="' . ($res ? 'conf confirm' : 'alert error') . '" style="margin-bottom: 20px">';
        $this->_html .= $res ? $this->l('Sitemap file successfully generated') : $this->l('Error while creating sitemap file');
        $this->_html .= '</h3>';
    }
开发者ID:vincent,项目名称:theinvertebrates,代码行数:81,代码来源:gsitemap.php


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