Skip to content

Commit

Permalink
Merge pull request #1814 from mbabker/menuConsolidate
Browse files Browse the repository at this point in the history
Move Menu, Pathway, and Router classes to CMS tree
  • Loading branch information
elinw committed Aug 24, 2013
2 parents 7f1bd1d + 692dd08 commit 65f653b
Show file tree
Hide file tree
Showing 19 changed files with 934 additions and 174 deletions.
7 changes: 7 additions & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public function deleteUnexistingFiles()
'/media/plg_quickicon_extensionupdate/extensionupdatecheck.js',
'/media/plg_quickicon_joomlaupdate/jupdatecheck.js',
// Joomla! 3.1
'/libraries/joomla/application/router.php',
'/libraries/joomla/form/rules/boolean.php',
'/libraries/joomla/form/rules/color.php',
'/libraries/joomla/form/rules/email.php',
Expand Down Expand Up @@ -592,6 +593,10 @@ public function deleteUnexistingFiles()
'/libraries/legacy/html/contentlanguage.php',
'/libraries/legacy/html/index.html',
'/libraries/legacy/html/menu.php',
'/libraries/legacy/menu/index.html',
'/libraries/legacy/menu/menu.php',
'/libraries/legacy/pathway/index.html',
'/libraries/legacy/pathway/pathway.php',
'/media/system/css/mooRainbow.css',
'/media/system/js/mooRainbow-uncompressed.js',
'/media/system/js/mooRainbow.js',
Expand Down Expand Up @@ -650,6 +655,8 @@ public function deleteUnexistingFiles()
'/libraries/joomla/installer',
'/libraries/joomla/pagination',
'/libraries/legacy/html',
'/libraries/legacy/menu',
'/libraries/legacy/pathway',
'/media/system/swf/',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ public static function getContentPath($url)
// Only get the router once.
if (!($router instanceof JRouter))
{
jimport('joomla.application.router');
include_once JPATH_SITE . '/includes/application.php';

// Get and configure the site router.
Expand Down
2 changes: 0 additions & 2 deletions installation/application/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

defined('_JEXEC') or die;

jimport('joomla.application.router');

/**
* Class to create and parse routes
*
Expand Down
52 changes: 31 additions & 21 deletions libraries/legacy/menu/menu.php → libraries/cms/menu/menu.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* @package Joomla.Legacy
* @package Joomla.Libraries
* @subpackage Menu
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
Expand All @@ -12,39 +12,42 @@
/**
* JMenu class
*
* @package Joomla.Legacy
* @package Joomla.Libraries
* @subpackage Menu
* @since 11.1
* @since 1.5
*/
class JMenu
{
/**
* Array to hold the menu items
*
* @var array
* @since 11.1
* @since 1.5
* @deprecated 4.0 Will convert to $items
*/
protected $_items = array();

/**
* Identifier of the default menu item
*
* @var integer
* @since 11.1
* @since 1.5
* @deprecated 4.0 Will convert to $default
*/
protected $_default = array();

/**
* Identifier of the active menu item
*
* @var integer
* @since 11.1
* @since 1.5
* @deprecated 4.0 Will convert to $active
*/
protected $_active = 0;

/**
* @var array JMenu instances container.
* @since 11.3
* @since 1.7
*/
protected static $instances = array();

Expand All @@ -53,7 +56,7 @@ class JMenu
*
* @param array $options An array of configuration options.
*
* @since 11.1
* @since 1.5
*/
public function __construct($options = array())
{
Expand Down Expand Up @@ -82,7 +85,8 @@ public function __construct($options = array())
*
* @return JMenu A menu object.
*
* @since 11.1
* @since 1.5
* @throws Exception
*/
public static function getInstance($client, $options = array())
{
Expand All @@ -93,16 +97,17 @@ public static function getInstance($client, $options = array())

if (!class_exists($classname))
{
// @deprecated 13.3 Everything in this block is deprecated but the warning is only logged after the file_exists
// @deprecated 4.0 Everything in this block is deprecated but the warning is only logged after the file_exists
// Load the menu object
$info = JApplicationHelper::getClientInfo($client, true);

if (is_object($info))
{
$path = $info->path . '/includes/menu.php';

if (file_exists($path))
{
JLog::add('Non-autoloadable JMenu subclasses are deprecated.', JLog::WARNING, 'deprecated');
JLog::add('Non-autoloadable JMenu subclasses are deprecated, support will be removed in 4.0.', JLog::WARNING, 'deprecated');
include_once $path;
}
}
Expand All @@ -128,11 +133,12 @@ public static function getInstance($client, $options = array())
*
* @return mixed The item object, or null if not found
*
* @since 11.1
* @since 1.5
*/
public function getItem($id)
{
$result = null;

if (isset($this->_items[$id]))
{
$result = &$this->_items[$id];
Expand All @@ -149,13 +155,14 @@ public function getItem($id)
*
* @return boolean True, if successful
*
* @since 11.1
* @since 1.5
*/
public function setDefault($id, $language = '')
{
if (isset($this->_items[$id]))
{
$this->_default[$language] = $id;

return true;
}

Expand All @@ -169,7 +176,7 @@ public function setDefault($id, $language = '')
*
* @return object The item object
*
* @since 11.1
* @since 1.5
*/
public function getDefault($language = '*')
{
Expand All @@ -194,14 +201,15 @@ public function getDefault($language = '*')
*
* @return mixed If successful the active item, otherwise null
*
* @since 11.1
* @since 1.5
*/
public function setActive($id)
{
if (isset($this->_items[$id]))
{
$this->_active = $id;
$result = &$this->_items[$id];

return $result;
}

Expand All @@ -213,13 +221,14 @@ public function setActive($id)
*
* @return object The item object.
*
* @since 11.1
* @since 1.5
*/
public function getActive()
{
if ($this->_active)
{
$item = &$this->_items[$this->_active];

return $item;
}

Expand All @@ -236,7 +245,7 @@ public function getActive()
*
* @return array
*
* @since 11.1
* @since 1.5
*/
public function getItems($attributes, $values, $firstonly = false)
{
Expand All @@ -252,6 +261,7 @@ public function getItems($attributes, $values, $firstonly = false)
}

$test = true;

for ($i = 0, $count = count($attributes); $i < $count; $i++)
{
if (is_array($values[$i]))
Expand Down Expand Up @@ -293,7 +303,7 @@ public function getItems($attributes, $values, $firstonly = false)
*
* @return JRegistry A JRegistry object
*
* @since 11.1
* @since 1.5
*/
public function getParams($id)
{
Expand All @@ -312,7 +322,7 @@ public function getParams($id)
*
* @return array
*
* @since 11.1
* @since 1.5
*/
public function getMenu()
{
Expand All @@ -327,7 +337,7 @@ public function getMenu()
*
* @return boolean True if authorised
*
* @since 11.1
* @since 1.5
*/
public function authorise($id)
{
Expand All @@ -349,7 +359,7 @@ public function authorise($id)
*
* @return array
*
* @since 11.1
* @since 1.5
*/
public function load()
{
Expand Down
12 changes: 8 additions & 4 deletions libraries/cms/menu/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class JMenuSite extends JMenu
* Loads the entire menu table into memory.
*
* @return array
*
* @since 1.5
*/
public function load()
{
Expand Down Expand Up @@ -54,6 +56,7 @@ public function load()
{
// Get parent information.
$parent_tree = array();

if (isset($this->_items[$item->parent_id]))
{
$parent_tree = $this->_items[$item->parent_id]->tree;
Expand All @@ -79,12 +82,14 @@ public function load()
* @param boolean $firstonly If true, only returns the first item found
*
* @return array
*
* @since 1.6
*/
public function getItems($attributes, $values, $firstonly = false)
{
$attributes = (array) $attributes;
$values = (array) $values;
$app = JApplication::getInstance('site');
$values = (array) $values;
$app = JApplication::getInstance('site');

if ($app->isSite())
{
Expand Down Expand Up @@ -130,7 +135,7 @@ public function getItems($attributes, $values, $firstonly = false)
*
* @return object The item object
*
* @since 1.5
* @since 1.6
*/
public function getDefault($language = '*')
{
Expand All @@ -147,5 +152,4 @@ public function getDefault($language = '*')
return 0;
}
}

}
Loading

0 comments on commit 65f653b

Please sign in to comment.