2015-07-30 15:08:21 +02:00

77 lines
2.5 KiB
PHP

<?php
class Link extends LinkCore
{
public static $urls_products = array();
public static $urls_categories = array();
public static $urls_manufacturers = array();
public static $urls_cms = array();
// CMS
public static $urls_categories_cms = array();
public static $urls_posts_cms = array();
public static $urls_editos_cms = array();
public function getCategoryCmsLink($id_category_cms, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_categories_cms[$id_category_cms])) {
$link = ManageSeoUrl::getByType($id_category_cms, ManageSeoUrl::TYPE_CATEGORY_CMS, FALSE, $id_lang, $id_shop);
self::$urls_categories_cms[$id_category_cms] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_categories_cms[$id_category_cms];
}
}
public function getPostCmsLink($id_post_cms, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_posts_cms[$id_post_cms])) {
$link = ManageSeoUrl::getByType($id_post_cms, ManageSeoUrl::TYPE_POST_CMS, FALSE, $id_lang, $id_shop);
self::$urls_posts_cms[$id_post_cms] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_posts_cms[$id_post_cms];
}
}
public function getPostEditoLink($id_post_edito, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_editos_cms[$id_post_edito])) {
$link = ManageSeoUrl::getByType($id_post_edito, ManageSeoUrl::TYPE_POST_EDITO, FALSE, $id_lang, $id_shop);
self::$urls_editos_cms[$id_post_edito] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_editos_cms[$id_post_edito];
}
}
}