/** * oledrion * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Hervé Thouzard (http://www.herve-thouzard.com/) * @version $Id: oledrion.php 12290 2014-02-07 11:05:17Z beckmi $ */ function b_sitemap_oledrion() { require '../oledrion/header.php'; global $sitemap_configs; $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); $table = $xoopsDB->prefix('oledrion_cat'); $id_name = 'cat_cid'; $pid_name = 'cat_pid'; $title_name = 'cat_title'; $url = 'category.php?cat_cid='; $order = 'cat_title'; include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; $mytree = new XoopsTree($table, $id_name, $pid_name); $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); $sitemap = array(); $myts = MyTextSanitizer::getInstance(); $i = 0; $sql = "SELECT `{$id_name}`,`{$title_name}` FROM `{$table}` WHERE `{$pid_name}`=0"; if ($order != '') { $sql .= " ORDER BY `{$order}`"; } $result = $xoopsDB->query($sql); while (list($catid, $name) = $xoopsDB->fetchRow($result)) { $sitemap['parent'][$i]['id'] = $catid; $sitemap['parent'][$i]['title'] = $myts->htmlSpecialChars($name); if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = 'category' . '-' . intval($catid) . oledrion_utils::makeSeoUrl($name) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = 'category.php?cat_cid=' . intval($catid); } $sitemap['parent'][$i]['url'] = $url; if (@$sitemap_configs["show_subcategoris"]) { $j = 0; $child_ary = $mytree->getChildTreeArray($catid, $order); foreach ($child_ary as $child) { $count = strlen($child['prefix']) + 1; $sitemap['parent'][$i]['child'][$j]['id'] = $child[$id_name]; $sitemap['parent'][$i]['child'][$j]['title'] = $myts->htmlSpecialChars($child[$title_name]); $sitemap['parent'][$i]['child'][$j]['image'] = $count > 3 ? 4 : $count; if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = 'category' . '-' . intval($child[$id_name]) . oledrion_utils::makeSeoUrl($child[$title_name]) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = 'category.php?cat_cid=' . intval($child[$id_name]); } $sitemap['parent'][$i]['child'][$j]['url'] = $url; $j++; } } $i++; } return $sitemap; }
/** * Retourne l'url à utiliser pour accéder à la page d'un fabricant * * @return string */ public function getLink() { $url = ''; if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = OLEDRION_URL . 'manufacturer-' . $this->getVar('manu_id') . oledrion_utils::makeSeoUrl($this->getVar('manu_commercialname', 'n') . ' ' . $this->getVar('manu_name')) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = OLEDRION_URL . 'manufacturer.php?manu_id=' . $this->getVar('manu_id'); } return $url; }
/** * Retourne l'url à utiliser pour accéder à la catégorie en tenant compte des préférences du module * * @return string L'url à utiliser */ public function getLink() { include_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $url = ''; if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = OLEDRION_URL . 'category-' . $this->getVar('cat_cid') . oledrion_utils::makeSeoUrl($this->getVar('cat_title', 'n')) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = OLEDRION_URL . 'category.php?cat_cid=' . $this->getVar('cat_cid'); } return $url; }
/** * Retourne l'url à utiliser pour accéder à la catégorie en tenant compte des préférences du module * * @return string L'url à utiliser */ function getLink() { $url = ''; if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting $url = OLEDRION_URL . 'category-' . $this->getVar('cat_cid') . oledrion_utils::makeSeoUrl($this->getVar('cat_title', 'n')) . '.html'; } else { // Pas d'utilisation de l'url rewriting $url = OLEDRION_URL . 'category.php?cat_cid=' . $this->getVar('cat_cid'); } return $url; }
/** * Retourne le lien du produit courant en tenant compte de l'URL Rewriting * * @param integer $product_id L'identifiant du produit * @param string $product_title Le titre du produit * @param boolean $shortVersion Indique si on veut la version avec l'url complpète ou la version avec juste la page et le paramètre * @return string */ public function getLink($product_id = 0, $product_title = '', $shortVersion = false) { $url = ''; if ($product_id == 0 && $product_title == '') { $product_id = $this->getVar('product_id'); $product_title = $this->getVar('product_title', 'n'); } if (oledrion_utils::getModuleOption('urlrewriting') == 1) { // On utilise l'url rewriting if (!$shortVersion) { $url = OLEDRION_URL . 'product-' . $product_id . oledrion_utils::makeSeoUrl($product_title) . '.html'; } else { $url = 'product-' . $product_id . oledrion_utils::makeSeoUrl($product_title) . '.html'; } } else { // Pas d'utilisation de l'url rewriting if (!$shortVersion) { $url = OLEDRION_URL . 'product.php?product_id=' . $product_id; } else { $url = 'product.php?product_id=' . $product_id; } } return $url; }