OSDN Git Service

MERGE: リビジョン1781。Skinクラスのevalをcall_user_fun()に変更。
authorsakamocchi <o-takashi@sakamocchi.jp>
Sat, 21 Apr 2012 14:24:57 +0000 (23:24 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Sat, 21 Apr 2012 14:24:57 +0000 (23:24 +0900)
れいんさんの提案を実装。
http://sourceforge.jp/projects/nucleus-jp/lists/archive/developers/2012-April/000897.html

Revision 1781:
CHANGE: use call_user_func() instead of eval() to call static method of
other class
changing processing in these two methods:
Skin::getAllowedActionsForType()
Skin::getFriendlyNames()
http://nucleuscms.svn.sourceforge.net/viewvc/nucleuscms?view=revision&revision=1781

nucleus/libs/SKIN.php

index 0099162..7618688 100644 (file)
@@ -577,13 +577,7 @@ class Skin
         */
        public function getAllowedActionsForType($type)
        {
-               /**
-                * NOTE: static method with variable class name is supported since PHP 5.3
-                *  So now we utilize eval function.
-                */
-               $page_action_names = array();
-               eval("\$defined_actions = {$this->action_class}::getDefinedActions('{$type}');");
-               return $defined_actions;
+               return call_user_func(array($this->action_class, 'getDefinedActions'), $type);
        }
        
        /**
@@ -591,17 +585,11 @@ class Skin
         * Get an array with the names of possible skin parts
         * Used to show all possible parts of a skin in the administration backend
         * 
-        * @static
-        * @param       string  $action_class   name of action class (optional)
-        * @param       array   type of the skin
+        * @param       string  void
+        * @return      array   type of the skin
         */
-       public function getFriendlyNames($action_class='Actions')
+       public function getFriendlyNames()
        {
-               /**
-                * NOTE: static method with variable class name is supported since PHP 5.3
-                *  So now we utilize eval function.
-                */
-               eval("\$friendly_names = {$action_class}::getSkinTypeFriendlyNames();");
-               return $friendly_names;
+               return call_user_func(array($this->action_class, 'getSkinTypeFriendlyNames'));
        }
 }