Files
@ 51a566e6db62
Branch filter:
Location: hot67beta/libraries/joomla/application/pathway.php - annotation
51a566e6db62
4.4 KiB
text/x-php
header kill
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 | <?php
/**
* @version $Id: pathway.php 10707 2008-08-21 09:52:47Z eddieajau $
* @package Joomla.Framework
* @subpackage Application
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* Class to maintain a pathway.
*
* Main example of use so far is the mod_breadcrumbs module that keeps track of
* the user's navigated path within the Joomla application.
*
* @abstract
* @package Joomla.Framework
* @subpackage Application
* @since 1.5
*/
class JPathway extends JObject
{
/**
* Array to hold the pathway item objects
* @access private
*/
var $_pathway = null;
/**
* Integer number of items in the pathway
* @access private
*/
var $_count = 0;
/**
* Class constructor
*/
function __construct($options = array())
{
//Initialise the array
$this->_pathway = array();
}
/**
* Returns a reference a JPathway object
*
* This method must be invoked as:
* <pre> $menu = &JPathway::getInstance();</pre>
*
* @access public
* @param string $client The name of the client
* @param array $options An associative array of options
* @return JPathway A pathway object.
* @since 1.5
*/
function &getInstance($client, $options = array())
{
static $instances;
if (!isset( $instances )) {
$instances = array();
}
if (empty($instances[$client]))
{
//Load the router object
$info =& JApplicationHelper::getClientInfo($client, true);
$path = $info->path.DS.'includes'.DS.'pathway.php';
if(file_exists($path))
{
require_once $path;
// Create a JPathway object
$classname = 'JPathway'.ucfirst($client);
$instance = new $classname($options);
}
else
{
$error = JError::raiseError( 500, 'Unable to load pathway: '.$client);
return $error;
}
$instances[$client] = & $instance;
}
return $instances[$client];
}
/**
* Return the JPathWay items array
*
* @access public
* @return array Array of pathway items
* @since 1.5
*/
function getPathway()
{
$pw = $this->_pathway;
// Use array_values to reset the array keys numerically
return array_values($pw);
}
/**
* Set the JPathway items array.
*
* @access public
* @param array $pathway An array of pathway objects.
* @return array The previous pathway data.
* @since 1.5
*/
function setPathway($pathway)
{
$oldPathway = $this->_pathway;
$pathway = (array) $pathway;
// Set the new pathway.
$this->_pathway = array_values($pathway);
return array_values($oldPathway);
}
/**
* Create and return an array of the pathway names.
*
* @access public
* @return array Array of names of pathway items
* @since 1.5
*/
function getPathwayNames()
{
// Initialize variables
$names = array (null);
// Build the names array using just the names of each pathway item
foreach ($this->_pathway as $item) {
$names[] = $item->name;
}
//Use array_values to reset the array keys numerically
return array_values($names);
}
/**
* Create and add an item to the pathway.
*
* @access public
* @param string $name
* @param string $link
* @return boolean True on success
* @since 1.5
*/
function addItem($name, $link='')
{
// Initalize variables
$ret = false;
if ($this->_pathway[] = $this->_makeItem($name, $link)) {
$ret = true;
$this->_count++;
}
return $ret;
}
/**
* Set item name.
*
* @access public
* @param integer $id
* @param string $name
* @return boolean True on success
* @since 1.5
*/
function setItemName($id, $name)
{
// Initalize variables
$ret = false;
if (isset($this->_pathway[$id])) {
$this->_pathway[$id]->name = $name;
$ret = true;
}
return $ret;
}
/**
* Create and return a new pathway object.
*
* @access private
* @param string $name Name of the item
* @param string $link Link to the item
* @return object Pathway item object
* @since 1.5
*/
function _makeItem($name, $link)
{
$item = new stdClass();
$item->name = html_entity_decode($name);
$item->link = $link;
return $item;
}
}
|