Permalink
Browse files

Merge pull request #1322 from realityking/jmenu

Support applications without JMenu.
  • Loading branch information...
2 parents c69230b + da45fdc commit f26b65de7c97ecaa9a297d40632e28cc0b61180b @chdemko chdemko committed Jun 28, 2012
@@ -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())
{
@@ -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);
@@ -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);
}
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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);
@@ -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())
{
@@ -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);
@@ -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);
}
}

0 comments on commit f26b65d

Please sign in to comment.