From 02d9dd60e70c6953b0d95b35cd003842aca5318e Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 16 Jun 2009 10:40:39 +0000 Subject: [PATCH] MINOR ajshort: Updated CMSMenu to use Object::get_static() to get configuration information. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@79361 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMenu.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/code/CMSMenu.php b/code/CMSMenu.php index 35dd650a..bd725990 100644 --- a/code/CMSMenu.php +++ b/code/CMSMenu.php @@ -32,18 +32,17 @@ class CMSMenu extends Object implements Iterator, i18nEntityProvider * when the item is removed. Functionality needed in {@link Director}. */ public static function add_controller($controllerClass) { - // Get static bits - $urlBase = eval("return $controllerClass::\$url_base;"); - $urlSegment = eval("return $controllerClass::\$url_segment;"); - $urlRule = eval("return $controllerClass::\$url_rule;"); - $urlPriority = eval("return $controllerClass::\$url_priority;"); - $menuPriority = eval("return $controllerClass::\$menu_priority;"); - + $urlBase = Object::get_static($controllerClass, 'url_base'); + $urlSegment = Object::get_static($controllerClass, 'url_segment'); + $urlRule = Object::get_static($controllerClass, 'url_rule'); + $urlPriority = Object::get_static($controllerClass, 'url_priority'); + $menuPriority = Object::get_static($controllerClass, 'menu_priority'); + // Don't add menu items defined the old way if($urlSegment === null) return; - - $link = Controller::join_links($urlBase,$urlSegment) . '/'; - + + $link = Controller::join_links($urlBase, $urlSegment) . '/'; + // Make director rule if($urlRule[0] == '/') $urlRule = substr($urlRule,1); $rule = $link . '/' . $urlRule; // the / will combine with the / on the end of $link to make a //