Source for file site.php

Documentation is available at site.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  Pathway
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Class to manage the site application pathway.
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  Pathway
  17.  * @since       1.5
  18.  */
  19. class JPathwaySite extends JPathway
  20. {
  21.     /**
  22.      * Class constructor.
  23.      *
  24.      * @param   array  $options  The class options.
  25.      *
  26.      * @since   1.5
  27.      */
  28.     public function __construct($options array())
  29.     {
  30.         $this->_pathway = array();
  31.  
  32.         $app  JApplication::getInstance('site');
  33.         $menu $app->getMenu();
  34.  
  35.         if ($item $menu->getActive())
  36.         {
  37.             $menus $menu->getMenu();
  38.             $home  $menu->getDefault();
  39.  
  40.             if (is_object($home&& ($item->id != $home->id))
  41.             {
  42.                 foreach ($item->tree as $menupath)
  43.                 {
  44.                     $url '';
  45.                     $link $menu->getItem($menupath);
  46.  
  47.                     switch ($link->type)
  48.                     {
  49.                         case 'separator':
  50.                         case 'heading':
  51.                             $url null;
  52.                             break;
  53.  
  54.                         case 'url':
  55.                             if ((strpos($link->link'index.php?'=== 0&& (strpos($link->link'Itemid='=== false))
  56.                             {
  57.                                 // If this is an internal Joomla link, ensure the Itemid is set.
  58.                                 $url $link->link '&Itemid=' $link->id;
  59.                             }
  60.                             else
  61.                             {
  62.                                 $url $link->link;
  63.                             }
  64.                             break;
  65.  
  66.                         case 'alias':
  67.                             // If this is an alias use the item id stored in the parameters to make the link.
  68.                             $url 'index.php?Itemid=' $link->params->get('aliasoptions');
  69.                             break;
  70.  
  71.                         default:
  72.                             $router $app::getRouter();
  73.                             if ($router->getMode(== JROUTER_MODE_SEF)
  74.                             {
  75.                                 $url 'index.php?Itemid=' $link->id;
  76.                             }
  77.                             else
  78.                             {
  79.                                 $url .= $link->link '&Itemid=' $link->id;
  80.                             }
  81.                             break;
  82.                     }
  83.  
  84.                     $this->addItem($menus[$menupath]->title$url);
  85.                 }
  86.             }
  87.         }
  88.     }
  89. }

Documentation generated on Tue, 19 Nov 2013 15:13:56 +0100 by phpDocumentor 1.4.3