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


PHP Link::getCategoryLink方法代码示例

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


在下文中一共展示了Link::getCategoryLink方法的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: 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

示例3: _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

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

示例5: _getCategoryLink

    /**
     * Hydrate $link_sitemap with categories link
     *
     * @param array  $link_sitemap contain all the links for the Google Sitemap file to be generated
     * @param string $lang         language of link to add
     * @param int    $index        index of the current Google Sitemap file
     * @param int    $i            count of elements added to sitemap main array
     * @param int    $id_category  category object identifier
     *
     * @return bool
     */
    private function _getCategoryLink(&$link_sitemap, $lang, &$index, &$i, $id_category = 0)
    {
        $link = new Link();
        if (method_exists('ShopUrl', 'resetMainDomainCache')) {
            ShopUrl::resetMainDomainCache();
        }
        $categories_id = Db::getInstance()->ExecuteS('SELECT c.id_category FROM `' . _DB_PREFIX_ . 'category` c
				INNER JOIN `' . _DB_PREFIX_ . 'category_shop` cs ON c.`id_category` = cs.`id_category`
				WHERE c.`active` = 1 AND c.`id_category` != 1 AND c.id_parent > 0 AND c.`id_category` > 0 AND cs.`id_shop` = ' . (int) $this->context->shop->id . ' ORDER BY c.`id_category` ASC');
        foreach ($categories_id as $category_id) {
            $category = new Category((int) $category_id['id_category'], (int) $lang['id_lang']);
            $url = $link->getCategoryLink($category, urlencode($category->link_rewrite), (int) $lang['id_lang']);
            if ($category->id_image) {
                $image_link = $this->context->link->getCatImageLink($category->link_rewrite, (int) $category->id_image, 'category_default');
                $image_link = !in_array(rtrim(Context::getContext()->shop->virtual_uri, '/'), explode('/', $image_link)) ? str_replace(array('https', Context::getContext()->shop->domain . Context::getContext()->shop->physical_uri), array('http', Context::getContext()->shop->domain . Context::getContext()->shop->physical_uri . Context::getContext()->shop->virtual_uri), $image_link) : $image_link;
            }
            $file_headers = Configuration::get('GSITEMAP_CHECK_IMAGE_FILE') ? @get_headers($image_link) : true;
            $image_category = array();
            if (isset($image_link) && ($file_headers[0] != 'HTTP/1.1 404 Not Found' || $file_headers === true)) {
                $image_category = array('title_img' => htmlspecialchars(strip_tags($category->name)), 'link' => $image_link);
            }
            if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'category', 'page' => 'category', 'lastmod' => $category->date_upd, 'link' => $url, 'image' => $image_category), $lang['iso_code'], $index, $i, (int) $category_id['id_category'])) {
                return false;
            }
            unset($image_link);
        }
        return true;
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:39,代码来源:gsitemap.php

示例6: getFilterBlock


//.........这里部分代码省略.........
                    }
                    break;
            }
        }
        // All non indexable attribute and feature
        $nonIndexable = array();
        // Get all non indexable attribute groups
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT public_name
		FROM `' . _DB_PREFIX_ . 'attribute_group_lang` agl
		LEFT JOIN `' . _DB_PREFIX_ . 'layered_indexable_attribute_group` liag
		ON liag.id_attribute_group = agl.id_attribute_group
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['public_name']);
        }
        // Get all non indexable features
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT name
		FROM `' . _DB_PREFIX_ . 'feature_lang` fl
		LEFT JOIN  `' . _DB_PREFIX_ . 'layered_indexable_feature` lif
		ON lif.id_feature = fl.id_feature
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['name']);
        }
        //generate SEO link
        $paramSelected = '';
        $param_product_url = '';
        $optionCheckedArray = array();
        $paramGroupSelectedArray = array();
        $titleValues = array();
        $link = new Link();
        $linkBase = $link->getCategoryLink($id_parent, Category::getLinkRewrite($id_parent, (int) $cookie->id_lang), (int) $cookie->id_lang);
        $filterBlockList = array();
        //get filters checked by group
        foreach ($filterBlocks as $typeFilter) {
            $filterName = !empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name'];
            $paramGroupSelected = '';
            foreach ($typeFilter['values'] as $key => $value) {
                if (is_array($value) && array_key_exists('checked', $value)) {
                    $valueName = !empty($value['url_name']) ? $value['url_name'] : $value['name'];
                    $paramGroupSelected .= '-' . str_replace('-', '_', Tools::link_rewrite($valueName));
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = Tools::link_rewrite($valueName);
                    if (!isset($titleValues[$filterName])) {
                        $titleValues[$filterName] = array();
                    }
                    $titleValues[$filterName][] = $valueName;
                } else {
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = array();
                }
            }
            if (!empty($paramGroupSelected)) {
                $paramSelected .= '/' . str_replace('-', '_', Tools::link_rewrite($filterName)) . $paramGroupSelected;
                $optionCheckedArray[Tools::link_rewrite($filterName)] = $paramGroupSelected;
            }
            // select only attribute and group attribute to display an unique product combination link
            if (!empty($paramGroupSelected) && $typeFilter['type'] == 'id_attribute_group') {
                $param_product_url .= '/' . str_replace('-', '_', Tools::link_rewrite($filterName)) . $paramGroupSelected;
            }
        }
        if ($this->page > 1) {
            $paramSelected .= '/page-' . $this->page;
        }
        $blackList = array('weight', 'price');
        $nofollow = false;
开发者ID:greench,项目名称:prestashop,代码行数:67,代码来源:blocklayered.php

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

示例8: _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

示例9: getCategoryUrl

 /**
  * Builds a category page url for the language and shop.
  *
  * We created our own method due to the existing one in `LinkCore` behaving differently across PS versions.
  *
  * @param Category|CategoryCore $category the category model.
  * @param int|null $id_lang the language ID (falls back on current context if not set).
  * @param int|null $id_shop the shop ID (falls back on current context if not set).
  * @param array $params additional params to add to the url.
  * @return string the category page url.
  */
 public function getCategoryUrl($category, $id_lang = null, $id_shop = null, array $params = array())
 {
     if (is_null($id_lang)) {
         $id_lang = (int) Context::getContext()->language->id;
     }
     if (is_null($id_shop)) {
         $id_shop = (int) Context::getContext()->shop->id;
     }
     if (version_compare(_PS_VERSION_, '1.5.0.0') === -1 || version_compare(_PS_VERSION_, '1.5.5.0') >= 0) {
         /** @var LinkCore $link */
         $link = new Link();
         $url = $link->getCategoryLink($category, null, $id_lang, null, $id_shop);
     } else {
         // For PS versions 1.5.0.0 - 1.5.4.1 we always hard-code the urls to be in non-friendly format and fetch
         // the shops base url ourselves. This is a workaround to all the bugs related to url building in these
         // PS versions.
         $query_params = array('id_category' => (int) $category->id, 'controller' => 'category', 'id_lang' => $id_lang);
         $url = $this->getBaseUrl($id_shop) . 'index.php?' . http_build_query($query_params);
     }
     if ((int) Configuration::get('PS_REWRITING_SETTINGS') === 0) {
         $params['id_lang'] = $id_lang;
     }
     return NostoHttpRequest::replaceQueryParamsInUrl($params, $url);
 }
开发者ID:silbersaiten,项目名称:nostotagging,代码行数:35,代码来源:url.php

示例10: getFilterBlock


//.........这里部分代码省略.........
                        $filterBlocks[] = array('type_lite' => 'category', 'type' => 'category', 'id_key' => 0, 'name' => $this->l('Categories'), 'values' => $tmpArray);
                    }
                    break;
            }
        }
        // All non indexable attribute and feature
        $nonIndexable = array();
        // Get all non indexable attribute groups
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT public_name
		FROM `' . _DB_PREFIX_ . 'attribute_group_lang` agl
		LEFT JOIN `' . _DB_PREFIX_ . 'layered_indexable_attribute_group` liag
		ON liag.id_attribute_group = agl.id_attribute_group
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['public_name']);
        }
        // Get all non indexable features
        foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
		SELECT name
		FROM `' . _DB_PREFIX_ . 'feature_lang` fl
		LEFT JOIN  `' . _DB_PREFIX_ . 'layered_indexable_feature` lif
		ON lif.id_feature = fl.id_feature
		WHERE indexable IS NULL OR indexable = 0
		AND id_lang = ' . (int) $cookie->id_lang) as $attribute) {
            $nonIndexable[] = Tools::link_rewrite($attribute['name']);
        }
        //generate SEO link
        $paramSelected = '';
        $optionCheckedArray = array();
        $paramGroupSelectedArray = array();
        $titleValues = array();
        $link = new Link();
        $linkBase = $link->getCategoryLink($id_parent, Category::getLinkRewrite($id_parent, (int) $cookie->id_lang), (int) $cookie->id_lang);
        $filterBlockList = array();
        //get filters checked by group
        foreach ($filterBlocks as $typeFilter) {
            $filterName = !empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name'];
            $paramGroupSelected = '';
            foreach ($typeFilter['values'] as $key => $value) {
                if (is_array($value) && array_key_exists('checked', $value)) {
                    $valueName = !empty($value['url_name']) ? $value['url_name'] : $value['name'];
                    $paramGroupSelected .= '-' . str_replace('-', '_', Tools::link_rewrite($valueName));
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = Tools::link_rewrite($valueName);
                    if (!isset($titleValues[$filterName])) {
                        $titleValues[$filterName] = array();
                    }
                    $titleValues[$filterName][] = $valueName;
                } else {
                    $paramGroupSelectedArray[Tools::link_rewrite($filterName)][] = array();
                }
            }
            if (!empty($paramGroupSelected)) {
                $paramSelected .= '/' . str_replace('-', '_', Tools::link_rewrite($filterName)) . $paramGroupSelected;
                $optionCheckedArray[Tools::link_rewrite($filterName)] = $paramGroupSelected;
            }
        }
        $blackList = array('weight', 'price');
        $nofollow = false;
        foreach ($filterBlocks as &$typeFilter) {
            $filterName = !empty($typeFilter['url_name']) ? $typeFilter['url_name'] : $typeFilter['name'];
            if (count($typeFilter) > 0 && !in_array($typeFilter['type'], $blackList)) {
                foreach ($typeFilter['values'] as $key => $values) {
                    $nofollow = false;
                    $optionCheckedCloneArray = $optionCheckedArray;
                    //if not filters checked, add parameter
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:67,代码来源:blocklayered.php

示例11: updateCmsLinksDisplay

 /**
  * Mise à jour de l'objet cms pour remplacer les variables d'url des lien
  * @param string : contenu ou il faut remplacer les liens
  * @return string : contenu avec les liens remplacés
  */
 public static function updateCmsLinksDisplay($content = null)
 {
     //Inclusion de la classe des widgets
     include_once dirname(__FILE__) . '/classes/Widget.php';
     if ($content === null) {
         return;
     }
     //Dans prestashop 1.6 les caractères { et } sont encodés
     if (_PS_VERSION_ > '1.6') {
         $content = urldecode($content);
     }
     $link_model = new Link();
     //Mise à jour des liens vers les pages cms
     preg_match_all('#{{cms url=([0-9])}}#', $content, $cms_links);
     if (isset($cms_links[1]) && sizeof($cms_links[1])) {
         foreach ($cms_links[1] as $link) {
             $link_url = $link_model->getCMSLink($link);
             $content = preg_replace('#{{cms url=' . $link . '}}#', $link_url, $content);
         }
     }
     //Mise à jour des liens vers les pages categories
     preg_match_all('#{{category url=([0-9])}}#', $content, $category_links);
     if (isset($category_links[1]) && sizeof($category_links[1])) {
         foreach ($category_links[1] as $category_link) {
             $category_link_url = $link_model->getCategoryLink($category_link);
             $content = preg_replace('#{{category url=' . $category_link . '}}#', $category_link_url, $content);
         }
     }
     //Mise à jour des liens vers les pages produits
     preg_match_all('#{{product url=([0-9])}}#', $content, $product_links);
     if (isset($product_links[1]) && sizeof($product_links[1])) {
         foreach ($product_links[1] as $product_link) {
             $product_link_url = $link_model->getProductLink($product_link);
             $content = preg_replace('#{{product url=' . $product_link . '}}#', $product_link_url, $content);
         }
     }
     //Mise à jour des liens d'ajout au panier
     preg_match_all('#{{cart url=([0-9])}}#', $content, $product_links);
     if (isset($product_links[1]) && sizeof($product_links[1])) {
         foreach ($product_links[1] as $product_link) {
             $product_cart_url = sprintf('index.php?controller=cart&add=1&qty=1&id_product=%s&token=%s', $product_link, Tools::getToken());
             $content = preg_replace('#{{cart url=' . $product_link . '}}#', $product_cart_url, $content);
         }
     }
     //Gestion des widgets
     preg_match_all('#{{widget name="(.*)"(.*)}}#U', $content, $widgets);
     if (isset($widgets[1]) && sizeof($widgets[1])) {
         $i = 0;
         foreach ($widgets[1] as $widget) {
             $widget = trim($widget);
             if (is_file(dirname(__FILE__) . '/classes/' . $widget . '.php')) {
                 include_once dirname(__FILE__) . '/classes/' . $widget . '.php';
                 $widgetParams = $widgets[2][$i];
                 try {
                     $widgetObject = new $widget($widgetParams);
                     $widgetContent = $widgetObject->display();
                     $content = str_replace('{{widget name="' . $widget . '"' . $widgetParams . '}}', $widgetContent, $content);
                 } catch (PrestaShopExceptionCore $e) {
                     echo $e->getMessage();
                 }
             }
             $i++;
         }
     }
     return $content;
 }
开发者ID:nenes25,项目名称:prestashop_eicmslinks,代码行数:71,代码来源:eicmslinks.php

示例12: hookAjaxCall

 public function hookAjaxCall()
 {
     $all_categories = Category::getCategories($this->context->language->id, true, true, 'AND `c`.`hide_on_left` = \'0\'');
     $categories = blockcategories::createMenuCategories($all_categories, $_GET['id_category'], $_GET['level']);
     $link = new Link();
     foreach (array_keys($categories) as $index) {
         $categories[$index]['link'] = $link->getCategoryLink($categories[$index]['id_category']);
     }
     $this->context->smarty->assign('categories', $categories);
     $this->context->smarty->assign('level', $_GET['level']);
     return $this->display(__FILE__, 'blockcategories-ajax.tpl');
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:12,代码来源:blockcategories.php

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

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

示例15: postCategory

 public function postCategory($id, $title = '')
 {
     $mResult = false;
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         $link = Context::getContext()->link;
     } else {
         $link = new Link();
     }
     $category = new Category((int) $id, (int) $this->_configuration['FBWALLPOSTS_LANG_ID']);
     if ($category && Validate::isLoadedObject($category) && $category->active) {
         // Image
         $image_link = $link->getCatImageLink($category->link_rewrite, (int) $id);
         /* Before version 1.4 */
         if (strpos($image_link, 'http://') === FALSE && strpos($image_link, 'https://') === FALSE) {
             $image_link = 'http://' . $_SERVER['HTTP_HOST'] . $image_link;
         }
         // URL
         $cat_url = $link->getCategoryLink($category);
         $mResult = $this->createFBPost($title, $category->name, $cat_url, strip_tags($category->description), $image_link);
     }
     return $mResult;
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:22,代码来源:facebookpswallposts.php


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