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


PHP Link::getManufacturerLink方法代码示例

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


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

示例1: hookDisplayLeftColumn

 /**
  * Display the module content on the left column. Prepares the data and then calls
  * views/templates/hook/blockmanufacturers.tpl
  *
  * @param $params
  * @return mixed
  */
 public function hookDisplayLeftColumn($params)
 {
     $current_manufacturer_id = 0;
     if (Tools::getValue('id_product')) {
         $product = new ProductCore(Tools::getValue('id_product'));
         $current_manufacturer_id = $product->id_manufacturer;
     }
     if (Tools::getValue('id_manufacturer')) {
         $current_manufacturer_id = Tools::getValue('id_manufacturer');
     }
     $manufacturers = ManufacturerCore::getManufacturers();
     // assigning to each manufacturer his own shop url link
     if (isset($manufacturers)) {
         $link = new Link();
         foreach ($manufacturers as $key => $manufacturer) {
             $manufacturer = new ManufacturerCore($manufacturer['id_manufacturer']);
             $manufacturers[$key]['link'] = $link->getManufacturerLink($manufacturer);
         }
     }
     $this->context->smarty->assign(array('manufacturers' => $manufacturers, 'current_manufacturer_id' => $current_manufacturer_id));
     return $this->display(__FILE__, 'blockmanufacturers.tpl');
 }
开发者ID:angelomaragna,项目名称:prestashop-blockmanufacturers,代码行数:29,代码来源:blockmanufacturers.php

示例2: makeMenu

 protected function makeMenu()
 {
     $menu_items = $this->getMenuItems();
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     foreach ($menu_items as $item) {
         if (!$item) {
             continue;
         }
         preg_match($this->pattern, $item, $value);
         $id = (int) substr($item, strlen($value[1]), strlen($item));
         switch (substr($item, 0, strlen($value[1]))) {
             case 'CAT':
                 $this->_menu .= $this->generateCategoriesMenu(Category::getNestedCategories($id, $id_lang, false, $this->user_groups));
                 break;
             case 'PRD':
                 $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
                 $product = new Product((int) $id, true, (int) $id_lang);
                 if (!is_null($product->id)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . Tools::HtmlEntitiesUTF8($product->getLink()) . '" title="' . $product->name . '">' . $product->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="sfHover"' : '';
                 $cms = CMS::getLinks((int) $id_lang, array($id));
                 if (count($cms)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . Tools::HtmlEntitiesUTF8($cms[0]['link']) . '" title="' . Tools::safeOutput($cms[0]['meta_title']) . '">' . Tools::safeOutput($cms[0]['meta_title']) . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'CMS_CAT':
                 $category = new CMSCategory((int) $id, (int) $id_lang);
                 if (count($category)) {
                     $this->_menu .= '<li><a href="' . Tools::HtmlEntitiesUTF8($category->getLink()) . '" title="' . $category->name . '">' . $category->name . '</a>';
                     $this->getCMSMenuItems($category->id);
                     $this->_menu .= '</li>' . PHP_EOL;
                 }
                 break;
                 // Case to handle the option to show all Manufacturers
             // Case to handle the option to show all Manufacturers
             case 'ALLMAN':
                 $link = new Link();
                 $this->_menu .= '<li><a href="' . $link->getPageLink('manufacturer') . '" title="' . $this->l('All manufacturers') . '">' . $this->l('All manufacturers') . '</a><ul>' . PHP_EOL;
                 $manufacturers = Manufacturer::getManufacturers();
                 foreach ($manufacturers as $key => $manufacturer) {
                     $this->_menu .= '<li><a href="' . $link->getManufacturerLink((int) $manufacturer['id_manufacturer'], $manufacturer['link_rewrite']) . '" title="' . Tools::safeOutput($manufacturer['name']) . '">' . Tools::safeOutput($manufacturer['name']) . '</a></li>' . PHP_EOL;
                 }
                 $this->_menu .= '</ul>';
                 break;
             case 'MAN':
                 $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
                 $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . Tools::HtmlEntitiesUTF8($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '" title="' . Tools::safeOutput($manufacturer->name) . '">' . Tools::safeOutput($manufacturer->name) . '</a></li>' . PHP_EOL;
                 }
                 break;
                 // Case to handle the option to show all Suppliers
             // Case to handle the option to show all Suppliers
             case 'ALLSUP':
                 $link = new Link();
                 $this->_menu .= '<li><a href="' . $link->getPageLink('supplier') . '" title="' . $this->l('All suppliers') . '">' . $this->l('All suppliers') . '</a><ul>' . PHP_EOL;
                 $suppliers = Supplier::getSuppliers();
                 foreach ($suppliers as $key => $supplier) {
                     $this->_menu .= '<li><a href="' . $link->getSupplierLink((int) $supplier['id_supplier'], $supplier['link_rewrite']) . '" title="' . Tools::safeOutput($supplier['name']) . '">' . Tools::safeOutput($supplier['name']) . '</a></li>' . PHP_EOL;
                 }
                 $this->_menu .= '</ul>';
                 break;
             case 'SUP':
                 $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
                 $supplier = new Supplier((int) $id, (int) $id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . Tools::HtmlEntitiesUTF8($link->getSupplierLink((int) $id, $supplier->link_rewrite)) . '" title="' . $supplier->name . '">' . $supplier->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'SHOP':
                 $selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
                 $shop = new Shop((int) $id);
                 if (Validate::isLoadedObject($shop)) {
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . Tools::HtmlEntitiesUTF8($shop->getBaseURL()) . '" title="' . $shop->name . '">' . $shop->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = MenuTopLinks::get((int) $id, (int) $id_lang, (int) $id_shop);
                 if (count($link)) {
                     if (!isset($link[0]['label']) || $link[0]['label'] == '') {
                         $default_language = Configuration::get('PS_LANG_DEFAULT');
                         $link = MenuTopLinks::get($link[0]['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
                     }
                     $this->_menu .= '<li><a href="' . Tools::HtmlEntitiesUTF8($link[0]['link']) . '"' . ($link[0]['new_window'] ? ' onclick="return !window.open(this.href);"' : '') . ' title="' . Tools::safeOutput($link[0]['label']) . '">' . Tools::safeOutput($link[0]['label']) . '</a></li>' . PHP_EOL;
                 }
                 break;
         }
     }
//.........这里部分代码省略.........
开发者ID:prestashop,项目名称:blocktopmenu,代码行数:101,代码来源:blocktopmenu.php

示例3: makeMenu

 private function makeMenu()
 {
     $menu = '';
     $menu_items = $this->getMenuItems();
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     $head = $this->_itemHead;
     $tail = $this->_itemTail;
     foreach ($menu_items as $item) {
         if (!$item) {
             continue;
         }
         preg_match($this->pattern, $item, $value);
         $id = (int) substr($item, strlen($value[1]), strlen($item));
         switch (substr($item, 0, strlen($value[1]))) {
             case 'CAT':
                 $this->getCategory($menu, (int) $id);
                 break;
             case 'PRD':
                 $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' active' : '';
                 $product = new Product((int) $id, true, (int) $id_lang);
                 if (!is_null($product->id)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $product->getLink() . '"><span>' . $product->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' active' : '';
                 $cms = CMS::getLinks((int) $id_lang, array($id));
                 if (count($cms)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $cms[0]['link'] . '"><span>' . $cms[0]['meta_title'] . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'CMS_CAT':
                 $category = new CMSCategory((int) $id, (int) $id_lang);
                 if (count($category)) {
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $category->getLink() . '"><span>' . $category->name . '</span></a>';
                     $this->getCMSMenuItems($menu, $category->id);
                     $menu .= '</li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'MAN':
                 $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' active' : '';
                 $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link->getManufacturerLink((int) $id, $manufacturer->link_rewrite) . '"><span>' . $manufacturer->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'SUP':
                 $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' active' : '';
                 $supplier = new Supplier((int) $id, (int) $id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link->getSupplierLink((int) $id, $supplier->link_rewrite) . '"><span>' . $supplier->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'SHOP':
                 $selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' active' : '';
                 $shop = new Shop((int) $id);
                 if (Validate::isLoadedObject($shop)) {
                     $link = new Link();
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $shop->getBaseURL() . '"><span>' . $shop->name . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = MenuTopLinks_mod::get((int) $id, (int) $id_lang, (int) $id_shop);
                 if (count($link)) {
                     if (!isset($link[0]['label']) || $link[0]['label'] == '') {
                         $default_language = Configuration::get('PS_LANG_DEFAULT');
                         $link = MenuTopLinks_mod::get($link[0]['id_linksmenutop'], $default_language, (int) Shop::getContextShopID());
                     }
                     $menu .= $head . '<li class="' . $this->_itemClass . $selected . '"><a href="' . $link[0]['link'] . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</span></a></li>' . $tail . PHP_EOL;
                 }
                 break;
         }
     }
     return $menu;
 }
开发者ID:tmdhosting,项目名称:TMDHosting-PrestaShop-Technology-Theme,代码行数:83,代码来源:blocktopmenu_mod.php

示例4: _getManufacturerLink

    /**
     * return the link elements for the manufacturer object
     *
     * @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_manufacturer manufacturer object identifier
     *
     * @return bool
     */
    private function _getManufacturerLink(&$link_sitemap, $lang, &$index, &$i, $id_manufacturer = 0)
    {
        $link = new Link();
        if (method_exists('ShopUrl', 'resetMainDomainCache')) {
            ShopUrl::resetMainDomainCache();
        }
        $manufacturers_id = Db::getInstance()->ExecuteS('SELECT m.`id_manufacturer` FROM `' . _DB_PREFIX_ . 'manufacturer` m
			INNER JOIN `' . _DB_PREFIX_ . 'manufacturer_lang` ml on m.`id_manufacturer` = ml.`id_manufacturer`' . ($this->tableColumnExists(_DB_PREFIX_ . 'manufacturer_shop') ? ' INNER JOIN `' . _DB_PREFIX_ . 'manufacturer_shop` ms ON m.`id_manufacturer` = ms.`id_manufacturer` ' : '') . ' WHERE m.`active` = 1  AND m.`id_manufacturer` > ' . (int) $id_manufacturer . ($this->tableColumnExists(_DB_PREFIX_ . 'manufacturer_shop') ? ' AND ms.`id_shop` = ' . (int) $this->context->shop->id : '') . ' AND ml.`id_lang` = ' . (int) $lang['id_lang'] . ' ORDER BY m.`id_manufacturer` ASC');
        foreach ($manufacturers_id as $manufacturer_id) {
            $manufacturer = new Manufacturer((int) $manufacturer_id['id_manufacturer'], $lang['id_lang']);
            $url = $link->getManufacturerLink($manufacturer, $manufacturer->link_rewrite, $lang['id_lang']);
            $image_link = 'http://' . Tools::getMediaServer(_THEME_MANU_DIR_) . _THEME_MANU_DIR_ . (!file_exists(_PS_MANU_IMG_DIR_ . '/' . (int) $manufacturer->id . '-medium_default.jpg') ? $lang['iso_code'] . '-default' : (int) $manufacturer->id) . '-medium_default.jpg';
            $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;
            $manifacturer_image = array();
            if ($file_headers[0] != 'HTTP/1.1 404 Not Found' || $file_headers === true) {
                $manifacturer_image = array('title_img' => htmlspecialchars(strip_tags($manufacturer->name)), 'caption' => htmlspecialchars(strip_tags($manufacturer->short_description)), 'link' => $image_link);
            }
            if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'manufacturer', 'page' => 'manufacturer', 'lastmod' => $manufacturer->date_upd, 'link' => $url, 'image' => $manifacturer_image), $lang['iso_code'], $index, $i, $manufacturer_id['id_manufacturer'])) {
                return false;
            }
        }
        return true;
    }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:35,代码来源:gsitemap.php

示例5: makeMenu

 private function makeMenu()
 {
     global $cookie, $page_name;
     foreach ($this->getMenuItems() as $item) {
         $id = (int) substr($item, 3, strlen($item));
         switch (substr($item, 0, 3)) {
             case 'CAT':
                 $this->getCategory($id, $cookie->id_lang);
                 break;
             case 'PRD':
                 $selected = $page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
                 $product = new Product($id, true, $cookie->id_lang);
                 if (!is_null($product->id)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . $product->getLink() . '">' . $product->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="sfHover"' : '';
                 $cms = CMS::getLinks($cookie->id_lang, array($id));
                 if (count($cms)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . $cms[0]['link'] . '">' . $cms[0]['meta_title'] . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'MAN':
                 $selected = $page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
                 $manufacturer = new Manufacturer($id, $cookie->id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . $link->getManufacturerLink($id, $manufacturer->link_rewrite) . '">' . $manufacturer->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'SUP':
                 $selected = $page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
                 $supplier = new Supplier($id, $cookie->id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . $link->getSupplierLink($id, $supplier->link_rewrite) . '">' . $supplier->name . '</a></li>' . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = MenuTopLinks::get($id, $cookie->id_lang);
                 if (count($link)) {
                     $this->_menu .= '<li><a href="' . $link[0]['link'] . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '>' . $link[0]['label'] . '</a></li>' . PHP_EOL;
                 }
                 break;
         }
     }
 }
开发者ID:greench,项目名称:prestashop,代码行数:53,代码来源:blocktopmenu.php

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

示例7: makeMobileMenu

 private function makeMobileMenu($item)
 {
     $listofthisfrontmenu = '';
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     preg_match($this->pattern, $item, $values);
     $id = (int) substr($item, strlen($values[1]), strlen($item));
     switch (substr($item, 0, strlen($values[1]))) {
         case 'CAT':
             $this->_mmenu .= $this->getCatMobileOption((int) $id);
             break;
         case 'PRD':
             $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
             $product = new Product((int) $id, true, (int) $id_lang);
             if (!is_null($product->id)) {
                 $this->_mmenu .= '<option value="' . $product->getLink() . '">' . $product->name . '</option>' . PHP_EOL;
             }
             break;
         case 'CMS':
             $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? '' : '';
             $cms = CMS::getLinks((int) $id_lang, array($id));
             if (count($cms)) {
                 $this->_mmenu .= '<option value="' . $cms[0]['link'] . '">' . $cms[0]['meta_title'] . '</option>' . PHP_EOL;
             }
             break;
         case 'CMS_CAT':
             $category = new CMSCategory((int) $id, (int) $id_lang);
             if (count($category)) {
                 $this->_mmenu .= '<option value="' . $category->getLink() . '"><span class="errow"></span><span>' . $category->name . '</option>';
                 $this->getCMSMenuItems($category->id);
             }
             break;
         case 'MAN':
             $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
             $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
             if (!is_null($manufacturer->id)) {
                 if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                     $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
                 } else {
                     $manufacturer->link_rewrite = 0;
                 }
                 $link = new Link();
                 $this->_mmenu .= '<option value="' . htmlentities($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '">' . $manufacturer->name . '</option>' . PHP_EOL;
             }
             break;
         case 'SUP':
             $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
             $supplier = new Supplier((int) $id, (int) $id_lang);
             if (!is_null($supplier->id)) {
                 $link = new Link();
                 $this->_mmenu .= '<option value="' . $link->getSupplierLink((int) $id, $supplier->link_rewrite) . '">' . $supplier->name . '</option>' . PHP_EOL;
             }
             break;
         case 'LNK':
             $link = TdMegaMenu::getCustomLinksByid((int) $id, (int) $id_lang, (int) $id_shop);
             if (count($link)) {
                 if (!isset($link[0]['label']) || $link[0]['label'] == '') {
                     $default_language = Configuration::get('PS_LANG_DEFAULT');
                     $link = TdMegaMenu::getCustomLinksByid($link[0]['id_tdmegamenu'], (int) $default_language, (int) Shop::getContextShopID());
                 }
                 $listofthisfrontmenu .= '<option value="' . $link[0]['menu_link'] . '">' . $link[0]['menu_title'] . '</option>' . PHP_EOL;
                 if ($link[0]['custome_type'] == 'cus_html') {
                     $this->_mmenu .= html_entity_decode($link[0]['description']);
                 }
             }
             break;
         case 'SHOP':
             $selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
             $shop = new Shop((int) $id);
             if (Validate::isLoadedObject($shop)) {
                 $link = new Link();
                 $this->_mmenu .= '<option value="' . $shop->getBaseURL() . '">' . $shop->name . '</option>' . PHP_EOL;
             }
             break;
     }
     return $listofthisfrontmenu;
 }
开发者ID:reshman,项目名称:swkart-presta,代码行数:77,代码来源:tdmegamenu.php

示例8: makeMenu

 private function makeMenu()
 {
     global $cookie, $page_name;
     $curr_level = 1;
     foreach ($this->getMenuItems() as $key => $item) {
         extract($item);
         if ($depth > $curr_level) {
             $this->_menu .= '<ul>';
         }
         if ($depth == $curr_level && $key != 0) {
             $this->_menu .= '</li>';
         }
         if ($depth < $curr_level) {
             $this->_menu .= str_repeat('</li></ul>', $curr_level - $depth) . '</li>';
         }
         $curr_level = $depth;
         switch ($type) {
             case 'CAT':
                 $this->getCategory($id_ref, $cookie->id_lang);
                 break;
             case 'PRD':
                 $selected = $page_name == 'product' && Tools::getValue('id_product') == $id_ref ? ' class="sfHover"' : '';
                 $product = new Product($id_ref, true, $cookie->id_lang);
                 if (!is_null($product->id)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . $product->getLink() . '"><span>' . $product->name . '</span></a>' . PHP_EOL;
                 }
                 break;
             case 'CCS':
                 $selected = $page_name == 'cms' && Tools::getValue('id_cms_category') == $id_ref ? ' class="sfHover"' : '';
                 $_this_cat = new CMSCategory($id_ref, $cookie->id_lang);
                 $link = new Link();
                 $this->_menu .= '<li' . $selected . '><a href="' . $link->getCMSCategoryLink($_this_cat->id, $_this_cat->link_rewrite) . '"><span>' . htmlentities($_this_cat->name) . '
       </span></a>' . PHP_EOL;
                 break;
             case 'CMS':
                 $selected = $page_name == 'cms' && Tools::getValue('id_cms') == $id_ref ? ' class="sfHover"' : '';
                 $cms = CMS::getLinks($cookie->id_lang, array($id_ref));
                 if (count($cms)) {
                     $this->_menu .= '<li' . $selected . '><a href="' . $cms[0]['link'] . '"><span>' . htmlentities($cms[0]['meta_title']) . '</span></a>' . PHP_EOL;
                 }
                 break;
             case 'MAN':
                 $selected = $page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id_ref ? ' class="sfHover"' : '';
                 $manufacturer = new Manufacturer($id_ref, $cookie->id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name, false);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . $link->getManufacturerLink($id_ref, $manufacturer->link_rewrite) . '">' . $manufacturer->name . '</a>' . PHP_EOL;
                 }
                 break;
             case 'SUP':
                 $selected = $page_name == 'supplier' && Tools::getValue('id_supplier') == $id_ref ? ' class="sfHover"' : '';
                 $supplier = new Supplier($id_ref, $cookie->id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $this->_menu .= '<li' . $selected . '><a href="' . $link->getSupplierLink($id_ref, $supplier->link_rewrite) . '"><span>' . $supplier->name . '</span></a>' . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = WPMenuTopLinks::get($id_ref, $cookie->id_lang);
                 if (count($link)) {
                     $this->_menu .= '<li><a href="' . $link[0]['link'] . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</span></a>' . PHP_EOL;
                 }
                 break;
         }
     }
     $this->_menu .= str_repeat('</li></ul>', $curr_level - 1) . '</li>';
 }
开发者ID:prayasjain,项目名称:MyCollegeStore,代码行数:72,代码来源:blank_blocktopmenu.php

示例9: getManufacturers

 public static function getManufacturers()
 {
     global $cookie;
     $results = array();
     $manufacturers = Manufacturer::getManufacturers(false, $cookie->id_lang);
     foreach ($manufacturers as $_manufacturer) {
         $manufacturer = new Manufacturer(intVal($_manufacturer['id_manufacturer']));
         $title = $manufacturer->name;
         if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
             $manufacturer->link_rewrite = Tools::link_rewrite($title, false);
         } else {
             $manufacturer->link_rewrite = 0;
         }
         $_link = new Link();
         $link = $_link->getManufacturerLink($manufacturer->id, $manufacturer->link_rewrite);
         $results[] = array('id' => $manufacturer->id, 'type' => 'manufacturer', 'title' => $title, 'link' => $link, 'childrens' => array());
     }
     return $results;
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:19,代码来源:menu.class.php

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

示例11: getMenuCustomerLink

 public function getMenuCustomerLink($lang_id = NULL)
 {
     $menu_items = $this->getMenuItems();
     $id_lang = (int) $this->context->language->id;
     $id_shop = (int) Shop::getContextShopID();
     foreach ($menu_items as $item) {
         if (!$item) {
             continue;
         }
         preg_match($this->pattern, $item, $value);
         $id = (int) substr($item, strlen($value[1]), strlen($item));
         switch (substr($item, 0, strlen($value[1]))) {
             case 'CAT':
                 $this->_menuLink .= $this->drawCustomMenuItem($id, 0, false, 0, $lang_id);
                 break;
             case 'PRD':
                 $selected = $this->page_name == 'product' && Tools::getValue('id_product') == $id ? ' class="sfHover"' : '';
                 $product = new Product((int) $id, true, (int) $id_lang);
                 if (!is_null($product->id)) {
                     $this->_menuLink .= '<div id ="pt_menu_product" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($product->getLink()) . '"><span>' . $product->name . '</span></a></div></div>' . PHP_EOL;
                 }
                 break;
             case 'CMS':
                 $selected = $this->page_name == 'cms' && Tools::getValue('id_cms') == $id ? ' class="sfHover"' : '';
                 $cms = CMS::getLinks((int) $id_lang, array($id));
                 if (count($cms)) {
                     $this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($cms[0]['link']) . '"><span>' . $cms[0]['meta_title'] . '</span></a></div></div>' . PHP_EOL;
                 }
                 break;
             case 'CMS_CAT':
                 $category = new CMSCategory((int) $id, (int) $id_lang);
                 if (Validate::isLoadedObject($category)) {
                     $this->_menuLink .= '<div id ="pt_menu_cms" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($category->getLink()) . '"><span>' . $category->name . '</span></a>';
                 }
                 $this->_menuLink .= '</div>' . PHP_EOL;
                 $this->_menuLink .= $this->getCMSMenuItems($category->id);
                 // Case to handle the option to show all Manufacturers
             // Case to handle the option to show all Manufacturers
             case 'ALLMAN':
                 $link = new Link();
                 $this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('manufacturer') . '" ><span>' . $this->l('All manufacturers') . '</span></a></div>' . PHP_EOL;
                 $manufacturers = Manufacturer::getManufacturers();
                 $this->_menuLink .= '<div class ="popup" style ="display:none">';
                 foreach ($manufacturers as $key => $manufacturer) {
                     $this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getManufacturerLink((int) $manufacturer['id_manufacturer'], $manufacturer['link_rewrite']) . '">' . $manufacturer['name'] . '</a></div></div></div>' . PHP_EOL;
                 }
                 $this->_menuLink .= '</div></div>';
                 break;
             case 'MAN':
                 $selected = $this->page_name == 'manufacturer' && Tools::getValue('id_manufacturer') == $id ? ' class="sfHover"' : '';
                 $manufacturer = new Manufacturer((int) $id, (int) $id_lang);
                 if (!is_null($manufacturer->id)) {
                     if (intval(Configuration::get('PS_REWRITING_SETTINGS'))) {
                         $manufacturer->link_rewrite = Tools::link_rewrite($manufacturer->name);
                     } else {
                         $manufacturer->link_rewrite = 0;
                     }
                     $link = new Link();
                     $this->_menuLink .= '<div id ="pt_menu_man" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getManufacturerLink((int) $id, $manufacturer->link_rewrite)) . '"><span>' . $manufacturer->name . '</span></a></div></div>' . PHP_EOL;
                 }
                 break;
                 // Case to handle the option to show all Suppliers
             // Case to handle the option to show all Suppliers
             case 'ALLSUP':
                 $link = new Link();
                 $this->_menuLink .= '<div id ="pt_menu_allsub" class ="pt_menu"><div class="parentMenu" ><a href="' . $link->getPageLink('supplier') . '" ><span>' . $this->l('All suppliers') . '</span></a></div>' . PHP_EOL;
                 $suppliers = Supplier::getSuppliers();
                 $this->_menuLink .= '<div class ="popup" style ="display:none">';
                 foreach ($suppliers as $key => $supplier) {
                     $this->_menuLink .= '<div class ="block1"><div class="column col1"><div class="itemSubMenu level3"><a href="' . $link->getSupplierLink((int) $supplier['id_supplier'], $supplier['link_rewrite']) . '">' . $supplier['name'] . '</a></div></div></div>' . PHP_EOL;
                 }
                 $this->_menuLink .= '</div></div>';
                 break;
             case 'SUP':
                 $selected = $this->page_name == 'supplier' && Tools::getValue('id_supplier') == $id ? ' class="sfHover"' : '';
                 $supplier = new Supplier((int) $id, (int) $id_lang);
                 if (!is_null($supplier->id)) {
                     $link = new Link();
                     $this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link->getSupplierLink((int) $id, $supplier->link_rewrite)) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
                 }
                 break;
             case 'SHOP':
                 $selected = $this->page_name == 'index' && $this->context->shop->id == $id ? ' class="sfHover"' : '';
                 $shop = new Shop((int) $id);
                 if (Validate::isLoadedObject($shop)) {
                     $link = new Link();
                     $this->_menuLink .= '<div id ="pt_menu_sub" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($shop->getBaseURL()) . '"><span>' . $supplier->name . '</span></a></div></div>' . PHP_EOL;
                 }
                 break;
             case 'LNK':
                 $link = VegaTopLinks::get((int) $id, (int) $id_lang, (int) $id_shop);
                 if (count($link)) {
                     if (!isset($link[0]['label']) || $link[0]['label'] == '') {
                         $default_language = Configuration::get('PS_LANG_DEFAULT');
                         $link = VegaTopLinks::get($link[0]['id_linksvegatop'], $default_language, (int) Shop::getContextShopID());
                     }
                     $this->_menuLink .= '<div id ="pt_ver_menu_link" class ="pt_menu"><div class="parentMenu" ><a href="' . Tools::HtmlEntitiesUTF8($link[0]['link']) . '"' . ($link[0]['new_window'] ? ' target="_blank"' : '') . '><span>' . $link[0]['label'] . '</a></span></div></div>' . PHP_EOL;
                 }
                 break;
         }
//.........这里部分代码省略.........
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:101,代码来源:posvegamenu.php

示例12: postManufacturer

 public function postManufacturer($id, $title = '')
 {
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         $link = Context::getContext()->link;
     } else {
         $link = new Link();
     }
     $manufacturer = new Manufacturer((int) $id, (int) $this->_configuration['FBWALLPOSTS_LANG_ID']);
     if ($manufacturer && Validate::isLoadedObject($manufacturer) && $manufacturer->active) {
         // Image
         $image_link = file_exists(_PS_MANU_IMG_DIR_ . $manufacturer->id . '.jpg') ? _THEME_MANU_DIR_ . $manufacturer->id . '.jpg' : Language::getIsoById((int) self::$cookie->id_lang) . '-default';
         /* Before version 1.4 */
         if (strpos($image_link, 'http://') === FALSE && strpos($image_link, 'https://') === FALSE) {
             $image_link = 'http://' . $_SERVER['HTTP_HOST'] . $image_link;
         }
         $man_description = strip_tags($manufacturer->short_description . ' ' . $manufacturer->description);
         // URL
         $man_url = $link->getManufacturerLink($manufacturer);
         return $this->createFBPost($title, $manufacturer->name, $man_url, $man_description, $image_link);
     }
 }
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:21,代码来源:facebookpswallposts.php

示例13: _getManufacturerLink

 private function _getManufacturerLink(&$link_sitemap, $lang, &$index, &$i, $id_manufacturer = 0)
 {
     $link = new Link();
     $manufacturers_id = Db::getInstance()->ExecuteS('SELECT `id_manufacturer` FROM `' . _DB_PREFIX_ . 'manufacturer` WHERE `active` = 1  AND `id_manufacturer` > ' . (int) $id_manufacturer . ' ORDER BY `id_manufacturer` ASC');
     foreach ($manufacturers_id as $manufacturer_id) {
         $manufacturer = new Manufacturer((int) $manufacturer_id['id_manufacturer'], $lang['id_lang']);
         $url = $link->getManufacturerLink($manufacturer, $manufacturer->link_rewrite, $lang['id_lang']);
         $image_link = 'http' . (Configuration::get('PS_SSL_ENABLED') ? 's' : '') . '://' . Tools::getMediaServer(_THEME_MANU_DIR_) . _THEME_MANU_DIR_ . (!file_exists(_PS_MANU_IMG_DIR_ . '/' . (int) $manufacturer->id . '-medium_default.jpg') ? $lang['iso_code'] . '-default' : (int) $manufacturer->id) . '-medium_default.jpg';
         $file_headers = @get_headers($image_link);
         if ($file_headers[0] != 'HTTP/1.1 404 Not Found') {
             if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'manufacturer', 'page' => 'manufacturer', 'link' => $image_link, 'image' => array('title_img' => $manufacturer->name, 'caption' => $manufacturer->short_description)), $lang['iso_code'], $index, $i, $manufacturer_id['id_manufacturer'])) {
                 return false;
             }
         }
         if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'manufacturer', 'page' => 'manufacturer', 'link' => $url, 'image' => false), $lang['iso_code'], $index, $i, $manufacturer_id['id_manufacturer'])) {
             return false;
         }
     }
     return true;
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:20,代码来源:gsitemap.php


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