Skip to content

Commit

Permalink
Merge pull request joomla#1322 from realityking/jmenu
Browse files Browse the repository at this point in the history
Support applications without JMenu.
  • Loading branch information
chdemko committed Jun 28, 2012
2 parents c69230b + da45fdc commit f26b65d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
6 changes: 4 additions & 2 deletions libraries/joomla/application/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function __construct($options = array())
* @return JRouter A JRouter object.
*
* @since 11.1
* @throws Exception
* @throws RuntimeException
*/
public static function getInstance($client, $options = array())
{
Expand All @@ -127,6 +127,8 @@ public static function getInstance($client, $options = array())

if (!class_exists($classname))
{
JLog::add('Non-autoloadable JRouter subclasses are deprecated.', JLog::WARNING, 'deprecated');

// Load the router object
$info = JApplicationHelper::getClientInfo($client, true);

Expand All @@ -146,7 +148,7 @@ public static function getInstance($client, $options = array())
}
else
{
throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
throw new RuntimeException(JText::sprintf('JLIB_APPLICATION_ERROR_ROUTER_LOAD', $client), 500);
}
}

Expand Down
23 changes: 15 additions & 8 deletions libraries/legacy/application/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,12 @@ static public function getRouter($name = null, array $options = array())
}

jimport('joomla.application.router');
$router = JRouter::getInstance($name, $options);

if ($router instanceof Exception)
try
{
$router = JRouter::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
Expand Down Expand Up @@ -838,9 +841,11 @@ public function getPathway($name = null, $options = array())
$name = $this->_name;
}

$pathway = JPathway::getInstance($name, $options);

if ($pathway instanceof Exception)
try
{
$pathway = JPathway::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
Expand All @@ -865,9 +870,11 @@ public function getMenu($name = null, $options = array())
$name = $this->_name;
}

$menu = JMenu::getInstance($name, $options);

if ($menu instanceof Exception)
try
{
$menu = JMenu::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/legacy/menu/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public static function getInstance($client, $options = array())

if (!class_exists($classname))
{
JLog::add('Non-autoloadable JMenu subclasses are deprecated.', JLog::WARNING, 'deprecated');

// Load the menu object
$info = JApplicationHelper::getClientInfo($client, true);

Expand Down
5 changes: 4 additions & 1 deletion libraries/legacy/pathway/pathway.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function __construct($options = array())
* @return JPathway A JPathway object.
*
* @since 11.1
* @throws RuntimeException
*/
public static function getInstance($client, $options = array())
{
Expand All @@ -68,6 +69,8 @@ public static function getInstance($client, $options = array())

if (!class_exists($classname))
{
JLog::add('Non-autoloadable JPathway subclasses are deprecated.', JLog::WARNING, 'deprecated');

// Load the pathway object
$info = JApplicationHelper::getClientInfo($client, true);

Expand All @@ -87,7 +90,7 @@ public static function getInstance($client, $options = array())
}
else
{
throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client), 500);
throw new RuntimeException(JText::sprintf('JLIB_APPLICATION_ERROR_PATHWAY_LOAD', $client), 500);
}
}

Expand Down

0 comments on commit f26b65d

Please sign in to comment.