OSDN Git Service

Merge branch 'skinnable-master' of ssh://shizuki@git.sourceforge.jp/gitroot/nucleus...
[nucleus-jp/nucleus-next.git] / nucleus / libs / COMMENTACTIONS.php
index 252db77..dd469f0 100644 (file)
@@ -1,7 +1,7 @@
 <?php\r
 /*\r
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
- * Copyright (C) 2002-2012 The Nucleus Group\r
+ * Copyright (C) 2002-2009 The Nucleus Group\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
  * This class is used when parsing comment templates\r
  *\r
  * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
  * @version $Id: CommentActions.php 1626 2012-01-09 15:46:54Z sakamocchi $\r
  */\r
 \r
 class CommentActions extends BaseActions\r
 {\r
-\r
-       // ref to COMMENTS object which is using this object to handle\r
-       // its templatevars\r
-       var $commentsObj;\r
-\r
-       // template to use to parse the comments\r
-       var $template;\r
-\r
-       // comment currenlty being handled (mysql result assoc array; see Comments::showComments())\r
-       var $currentComment;\r
-\r
-       function __construct(&$comments) {\r
+       /**\r
+        * CommentsActions::$commentsObj\r
+        * ref to COMMENTS object which is using this object to handle its templatevars\r
+        */\r
+       private $commentsObj;\r
+       \r
+       /**\r
+        * CommentsActions::$template\r
+        * template to use to parse the comments\r
+        */\r
+       private $template;\r
+       \r
+       /**\r
+        * CommentsActions::$currentComment\r
+        * comment currenlty being handled (mysql result assoc array; see Comments::showComments())\r
+        */\r
+       private $currentComment;\r
+       \r
+       /**\r
+        * CommentsActions::$defined_actions\r
+        * defined actions in this class\r
+        */\r
+       static private $defined_actions = array(\r
+               'authtext',
+               'blogid',
+               'blogurl',\r
+               'body',
+               'commentcount',\r
+               'commentid',
+               'commentword',\r
+               'date',
+               'email',\r
+               'excerpt',
+               'host',
+               'ip',
+               'itemid',
+               'itemlink',\r
+               'itemtitle',\r
+               'memberid',
+               'plugin',
+               'short',
+               'time',\r
+               'timestamp',\r
+               'user',\r
+               'useremail',
+               'userid',\r
+               'userlink',
+               'userlinkraw',\r
+               'userwebsite',\r
+               'userwebsitelink'
+       );\r
+       \r
+       /**\r
+        * CommentActions::__construct()\r
+        * \r
+        * @param       object  $comments       instance of Comments class\r
+        * @return      void\r
+        */\r
+       public function __construct(&$comments)\r
+       {\r
                // call constructor of superclass first\r
-               $this->BaseActions();\r
-\r
+               parent::__construct();
+               \r
                // reference to the comments object\r
                $this->setCommentsObj($comments);\r
+               return;\r
        }\r
-\r
-       function getDefinedActions() {\r
-               return array(\r
-                       'blogurl',\r
-                       'commentcount',\r
-                       'commentword',\r
-                       'email',\r
-                       'itemlink',\r
-                       'itemid',\r
-                       'itemtitle',\r
-                       'date',\r
-                       'time',\r
-                       'commentid',\r
-                       'body',\r
-                       'memberid',\r
-                       'timestamp',\r
-                       'host',\r
-                       'ip',\r
-                       'blogid',\r
-                       'authtext',\r
-                       'user',\r
-                       'userid',\r
-                       'userlinkraw',\r
-                       'userlink',\r
-                       'useremail',\r
-                       'userwebsite',\r
-                       'userwebsitelink',\r
-                       'excerpt',\r
-                       'short',\r
-                       'skinfile',\r
-                       'set',\r
-                       'plugin',\r
-                       'include',\r
-                       'phpinclude',\r
-                       'parsedinclude',\r
-                       'if',\r
-                       'else',\r
-                       'endif',\r
-                       'elseif',\r
-                       'ifnot',\r
-                       'elseifnot'\r
-               );\r
-       }\r
-\r
-       function setParser(&$parser) {\r
-               $this->parser =& $parser;\r
+       \r
+       /**\r
+        * CommentActions::getAvailableActions()\r
+        * \r
+        * @param       void\r
+        * @return array        actions array\r
+        */\r
+       public function getAvailableActions()\r
+       {\r
+               return array_merge(self::$defined_actions, parent::getAvailableActions());\r
        }\r
-\r
-       function setCommentsObj(&$commentsObj) {\r
+       \r
+       /**\r
+        * \r
+        * CommentActions::setCommentsObj()\r
+        * \r
+        * @param       object  $commentsObj    instance of Comments class\r
+        * @return      void\r
+        */\r
+       public function setCommentsObj(&$commentsObj)\r
+       {\r
                $this->commentsObj =& $commentsObj;\r
+               return;\r
        }\r
-\r
-       function setTemplate($template) {\r
+       \r
+       /**\r
+        * CommentActions::setTemplate()\r
+        * \r
+        * @param       array   $template       array includes templates\r
+        * @return      void\r
+        */\r
+       public function setTemplate($template)\r
+       {\r
                $this->template =& $template;\r
+               return;\r
        }\r
        \r
        /**\r
         * CommentActions::setCurrentComment()\r
         * Set $currentcommentid and $currentcommentarray\r
         * \r
-        * @param       Array   $comment        array with comment elements\r
+        * @param       array   $comment        associated array includes comment information\r
         * @return      void\r
-        * \r
         */\r
-       function setCurrentComment(&$comment)\r
+       public function setCurrentComment(&$comment)\r
        {\r
                global $currentcommentid, $currentcommentarray, $manager;\r
                \r
@@ -128,14 +157,13 @@ class CommentActions extends BaseActions
                                $comment['userid'] = $mem->getEmail();\r
                        }\r
                        \r
-                       $comment['userlinkraw'] = Link::create_link(\r
-                                                                               'member',\r
-                                                                               array(\r
-                                                                                       'memberid' => $comment['memberid'],\r
-                                                                                       'name' => $mem->getDisplayName(),\r
-                                                                                       'extra' => $this->commentsObj->itemActions->linkparams\r
-                                                                               )\r
-                                                                       );\r
+                       $data = array(\r
+                               'memberid'      => $comment['memberid'],\r
+                               'name'          => $mem->getDisplayName(),\r
+                               'extra'         => $this->commentsObj->itemActions->linkparams\r
+                       );\r
+                       \r
+                       $comment['userlinkraw'] = Link::create_link('member', $data);\r
                }\r
                else\r
                {\r
@@ -166,61 +194,106 @@ class CommentActions extends BaseActions
                $currentcommentarray = $comment;\r
                return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_authtext()\r
         * Parse templatevar authtext\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_authtext() {\r
-               if ($this->currentComment['memberid'] != 0)\r
+       public function parse_authtext()\r
+       {\r
+               if ( $this->currentComment['memberid'] != 0 )\r
+               {\r
                        $this->parser->parse($this->template['COMMENTS_AUTH']);\r
+               }\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_blogid()\r
         * Parse templatevar blogid\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_blogid() {\r
+       public function parse_blogid() {\r
                echo $this->currentComment['blogid'];\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_blogurl()\r
         * Parse templatevar blogurl\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_blogurl() {\r
+       public function parse_blogurl()\r
+       {\r
                global $manager;\r
                $blogid = getBlogIDFromItemID($this->commentsObj->itemid);\r
                $blog =& $manager->getBlog($blogid);\r
                echo $blog->getURL();\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_body()\r
         * Parse templatevar body\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_body() {\r
+       public function parse_body() {\r
                echo $this->highlight($this->currentComment['body']);\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_commentcount()\r
         * Parse templatevar commentcount\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_commentcount() {\r
-                       echo $this->commentsObj->commentcount;\r
+       public function parse_commentcount()\r
+       {\r
+               echo $this->commentsObj->commentcount;\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_commentid()\r
         * Parse templatevar commentid\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_commentid() {\r
+       public function parse_commentid()\r
+       {\r
                echo $this->currentComment['commentid'];\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_commentword()\r
         * Parse templatevar commentword\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_commentword() {\r
-               if ($this->commentsObj->commentcount == 1)\r
+       public function parse_commentword()\r
+       {\r
+               if ( $this->commentsObj->commentcount == 1 )\r
+               {\r
                        echo $this->template['COMMENTS_ONE'];\r
+               }\r
                else\r
+               {\r
                        echo $this->template['COMMENTS_MANY'];\r
+               }\r
+               return;\r
        }\r
        \r
        /**\r
@@ -229,9 +302,8 @@ class CommentActions extends BaseActions
         * \r
         * @format      String  $format Date format according to PHP\r
         * @return      void\r
-        * \r
         */\r
-       function parse_date($format = '')\r
+       public function parse_date($format = '')\r
        {\r
                if ( $format !== '' )\r
                {\r
@@ -254,95 +326,143 @@ class CommentActions extends BaseActions
        }\r
        \r
        /**\r
+        * CommentActions::parse_excerpt()\r
         * Parse templatevar email\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_email() {\r
+       public function parse_email()\r
+       {\r
                $email = $this->currentComment['email'];\r
                $email = str_replace('@', ' (at) ', $email);\r
                $email = str_replace('.', ' (dot) ', $email);\r
                echo $email;\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
         * CommentActions::parse_excerpt()\r
         * Parse templatevar excerpt\r
         * \r
-        * @param       Void\r
-        * @return      String  templatevar excerpt\r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_excerpt()\r
+       public function parse_excerpt()\r
        {\r
                echo Entity::hen(Entity::shorten($this->currentComment['body'], 60, '...'));\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_host()\r
         * Parse templatevar host\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_host() {\r
+       public function parse_host()\r
+       {\r
                echo $this->currentComment['host'];\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_ip()\r
         * Parse templatevar ip\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_ip() {\r
+       public function parse_ip()\r
+       {\r
                echo $this->currentComment['ip'];\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_itemid()\r
         * Parse templatevar itemid\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_itemid() {\r
+       public function parse_itemid()\r
+       {\r
                echo $this->commentsObj->itemid;\r
+               return;\r
        }\r
        \r
        /**\r
         * CommentActions::parse_itemlink()\r
         * Parse templatevar itemlink\r
         * \r
-        * @param       Void\r
-        * @return      Void\r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_itemlink()\r
+       public function parse_itemlink()\r
        {\r
-               echo Link::create_link(\r
-                       'item',\r
-                       array(\r
-                               'itemid' => $this->commentsObj->itemid,\r
-                               'timestamp' => $this->commentsObj->itemActions->currentItem->timestamp,\r
-                               'title' => $this->commentsObj->itemActions->currentItem->title,\r
-                               'extra' => $this->commentsObj->itemActions->linkparams\r
-                       )\r
+               $data = array(\r
+                       'itemid'        => $this->commentsObj->itemid,\r
+                       'timestamp'     => $this->commentsObj->itemActions->currentItem['timestamp'],\r
+                       'title'         => $this->commentsObj->itemActions->currentItem['title'],\r
+                       'extra'         => $this->commentsObj->itemActions->linkparams\r
                );\r
+               \r
+               echo Link::create_link('item', $data);\r
                return;\r
        }\r
        \r
        /**\r
+        * CommentActions::parse_itemtitle()\r
         * Parse templatevar itemtitle\r
+        * \r
+        * @param       integer $maxLength      maximum length for item title\r
+        * @return      void\r
         */\r
-       function parse_itemtitle($maxLength = 0) {\r
-               if ($maxLength == 0)\r
+       public function parse_itemtitle($maxLength = 0)\r
+       {\r
+               if ( $maxLength == 0 )\r
+               {\r
                        $this->commentsObj->itemActions->parse_title();\r
+               }\r
                else\r
+               {\r
                        $this->commentsObj->itemActions->parse_syndicate_title($maxLength);\r
+               }\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_memberid()\r
         * Parse templatevar memberid\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_memberid() {\r
+       public function parse_memberid()\r
+       {\r
                echo $this->currentComment['memberid'];\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_short()\r
         * Parse templatevar short\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_short() {\r
-               $tmp = strtok($this->currentComment['body'],"\n");\r
-               $tmp = str_replace('<br />','',$tmp);\r
+       public function parse_short()\r
+       {\r
+               $tmp = strtok($this->currentComment['body'], "\n");\r
+               $tmp = str_replace('<br />', '', $tmp);\r
                echo $tmp;\r
-               if ($tmp != $this->currentComment['body'])\r
+               if ( $tmp != $this->currentComment['body'] )\r
+               {\r
                        $this->parser->parse($this->template['COMMENTS_CONTINUED']);\r
+               }\r
+               return;\r
        }\r
        \r
        /**\r
@@ -351,11 +471,10 @@ class CommentActions extends BaseActions
         * \r
         * @param       string  $format datetime format referring to strftime() in PHP's built-in function\r
         * @return      void\r
-        * \r
         */\r
-       function parse_time($format = '')\r
+       public function parse_time($format = '')\r
        {\r
-               if ( $format === '' )\r
+               if ( $format !== '' )
                {\r
                        /* do nothing */\r
                        ;\r
@@ -374,50 +493,68 @@ class CommentActions extends BaseActions
        }\r
        \r
        /**\r
+        * CommentActions::parse_timestamp()\r
         * Parse templatevar timestamp\r
+        * \r
+        * @param       void\r
+        * @return      void\r
+        * \r
         */\r
-       function parse_timestamp() {\r
+       public function parse_timestamp()\r
+       {\r
                echo $this->currentComment['timestamp'];\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
-         * Executes a plugin templatevar\r
-         *\r
-         * @param pluginName name of plugin (without the NP_)\r
-         *\r
-         * extra parameters can be added\r
-         */\r
-       function parse_plugin($pluginName) {\r
+        * CommentActions::parse_plugin()\r
+        * Executes a plugin templatevar\r
+        *\r
+        * @param       string  $pluginName     name of plugin (without the NP_)\r
+        * @param       extra parameters can be added\r
+        * @return      void\r
+        */\r
+       public function parse_plugin($pluginName)\r
+       {\r
                global $manager;\r
-\r
+               \r
                // only continue when the plugin is really installed\r
-               if (!$manager->pluginInstalled('NP_' . $pluginName))\r
+               if ( !$manager->pluginInstalled("NP_{$pluginName}") )\r
+               {\r
                        return;\r
-\r
-               $plugin =& $manager->getPlugin('NP_' . $pluginName);\r
-               if (!$plugin) return;\r
-\r
+               }\r
+               \r
+               $plugin =& $manager->getPlugin("NP_{$pluginName}");\r
+               if ( !$plugin )\r
+               {\r
+                       return;\r
+               }\r
+               \r
                // get arguments\r
                $params = func_get_args();\r
-\r
+               \r
                // remove plugin name\r
                array_shift($params);\r
-\r
+               \r
                // pass info on current item and current comment as well\r
-               $params = array_merge(array(&$this->currentComment),$params);\r
-               $params = array_merge(array(&$this->commentsObj->itemActions->currentItem),$params);\r
-\r
+               $params = array_merge(array(&$this->currentComment), $params);\r
+               $params = array_merge(array(&$this->commentsObj->itemActions->currentItem), $params);\r
+               \r
                call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_user()\r
         * Parse templatevar user\r
-        * @param string $mode\r
+        * \r
+        * @param       string  $mode   realname or else\r
+        * @return      void\r
         */\r
-       function parse_user($mode = '')\r
+       public function parse_user($mode = '')\r
        {\r
                global $manager;\r
-\r
+               \r
                if ( $mode == 'realname' && $this->currentComment['memberid'] > 0 )\r
                {\r
                        $member =& $manager->getMember($this->currentComment['memberid']);\r
@@ -427,8 +564,9 @@ class CommentActions extends BaseActions
                {\r
                        echo Entity::hsc($this->currentComment['user']);\r
                }\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
         * CommentActions::parse_useremail()\r
         * Output mail address\r
@@ -436,7 +574,7 @@ class CommentActions extends BaseActions
         * @param       void\r
         * @return      void\r
         */\r
-       function parse_useremail() {\r
+       public function parse_useremail() {\r
                global $manager;\r
                if ( $this->currentComment['memberid'] > 0 )\r
                {\r
@@ -462,69 +600,106 @@ class CommentActions extends BaseActions
        }\r
        \r
        /**\r
+        * CommentActions::parse_userid()\r
         * Parse templatevar userid\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_userid() {\r
-                       echo $this->currentComment['userid'];\r
+       public function parse_userid()\r
+       {\r
+               echo $this->currentComment['userid'];\r
+               return;\r
        }\r
-\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_userlink()\r
         * Parse templatevar userlink\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_userlink() {\r
-               if ($this->currentComment['userlinkraw']) {\r
+       public function parse_userlink()\r
+       {\r
+               if ( $this->currentComment['userlinkraw'] )\r
+               {\r
                        echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';\r
-               } else {\r
+               }\r
+               else\r
+               {\r
                        echo $this->currentComment['user'];\r
                }\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_userlinkraw()\r
         * Parse templatevar userlinkraw\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_userlinkraw() {\r
-               echo $this->currentComment['userlinkraw'];\r
+       public function parse_userlinkraw()\r
+       {\r
+               echo (array_key_exists('userlinkraw', $this->currentComment) && !empty($this->currentComment['userlinkraw'])) ? $this->currentComment['userlinkraw'] : '';\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_userwebsite()\r
         * Parse templatevar userwebsite\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_userwebsite() {\r
-               if (!(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false))\r
+       public function parse_userwebsite()\r
+       {\r
+               if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )\r
+               {\r
                        echo $this->currentComment['userlinkraw'];\r
+               }\r
+               return;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::parse_userwebsitelink()\r
         * Parse templatevar userwebsitelink\r
+        * \r
+        * @param       void\r
+        * @return      void\r
         */\r
-       function parse_userwebsitelink() {\r
-               if (!(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false)) {\r
+       public function parse_userwebsitelink()\r
+       {\r
+               if ( !(i18n::strpos($this->currentComment['userlinkraw'], 'http://') === false) )\r
+               {\r
                        echo '<a href="'.$this->currentComment['userlinkraw'].'" rel="nofollow">'.$this->currentComment['user'].'</a>';\r
-               } else {\r
+               }\r
+               else\r
+               {\r
                        echo $this->currentComment['user'];\r
                }\r
+               return;\r
        }\r
-\r
-       // function to enable if-else-elseif-elseifnot-ifnot-endif to comment template fields\r
-\r
+       \r
        /**\r
+        * CommentActions::checkCondition()\r
         * Checks conditions for if statements\r
         *\r
-        * @param string $field type of <%if%>\r
-        * @param string $name property of field\r
-        * @param string $value value of property\r
+        * @param       string  $field  type of <%if%>\r
+        * @param       string  $name   property of field\r
+        * @param       string  $value  value of property\r
+        * @return      boolean\r
         */\r
-       function checkCondition($field, $name='', $value = '') {\r
+       protected function checkCondition($field, $name='', $value = '') {\r
                global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
-\r
                $condition = 0;\r
-               switch($field) {\r
+               switch ( $field )\r
+               {\r
                        case 'category':\r
-                               $condition = ($blog && $this->_ifCategory($name,$value));\r
+                               $condition = ($blog && $this->ifCategory($name,$value));\r
                                break;\r
                        case 'itemcategory':\r
-                               $condition = ($this->_ifItemCategory($name,$value));\r
+                               $condition = ($this->ifItemCategory($name,$value));\r
                                break;\r
                        case 'blogsetting':\r
                                $condition = ($blog && ($blog->getSetting($name) == $value));\r
@@ -537,210 +712,268 @@ class CommentActions extends BaseActions
                                $condition = $member->isLoggedIn();\r
                                break;\r
                        case 'onteam':\r
-                               $condition = $member->isLoggedIn() && $this->_ifOnTeam($name);\r
+                               $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
                                break;\r
                        case 'admin':\r
-                               $condition = $member->isLoggedIn() && $this->_ifAdmin($name);\r
+                               $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
                                break;\r
                        case 'author':\r
-                               $condition = ($this->_ifAuthor($name,$value));\r
-                               break;\r
-/*                     case 'nextitem':\r
-                               $condition = ($itemidnext != '');\r
-                               break;\r
-                       case 'previtem':\r
-                               $condition = ($itemidprev != '');\r
-                               break;\r
-                       case 'archiveprevexists':\r
-                               $condition = ($archiveprevexists == true);\r
+                               $condition = ($this->ifAuthor($name,$value));\r
                                break;\r
-                       case 'archivenextexists':\r
-                               $condition = ($archivenextexists == true);\r
-                               break;\r
-                       case 'skintype':\r
-                               $condition = ($name == $this->skintype);\r
-                               break; */\r
                        case 'hasplugin':\r
-                               $condition = $this->_ifHasPlugin($name, $value);\r
+                               $condition = $this->ifHasPlugin($name, $value);\r
                                break;\r
                        default:\r
-                               $condition = $manager->pluginInstalled('NP_' . $field) && $this->_ifPlugin($field, $name, $value);\r
-                               break;\r
+                               $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);\r
+                       break;\r
                }\r
                return $condition;\r
        }\r
-\r
+       \r
        /**\r
-        *  Different checks for a category\r
+        * CommentActions::ifCategory()\r
+        * Different checks for a category\r
+        * \r
+        * @param       string  $key    key of category\r
+        * @param       string  $value  value for key of category\r
+        * @return      boolean\r
         */\r
-       function _ifCategory($name = '', $value='') {\r
+       private function ifCategory($key = '', $value = '')\r
+       {\r
                global $blog, $catid;\r
-\r
+               \r
                // when no parameter is defined, just check if a category is selected\r
-               if (($name != 'catname' && $name != 'catid') || ($value == ''))\r
+               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
+               {\r
                        return $blog->isValidCategory($catid);\r
-\r
+               }\r
+               \r
                // check category name\r
-               if ($name == 'catname') {\r
+               if ( $key == 'catname' )\r
+               {\r
                        $value = $blog->getCategoryIdFromName($value);\r
                        if ($value == $catid)\r
-                               return $blog->isValidCategory($catid);\r
+                       return $blog->isValidCategory($catid);\r
                }\r
-\r
+               \r
                // check category id\r
-               if (($name == 'catid') && ($value == $catid))\r
+               if ( ($key == 'catid') && ($value == $catid) )\r
+               {\r
                        return $blog->isValidCategory($catid);\r
-\r
-               return false;\r
+               }\r
+               return FALSE;\r
        }\r
-\r
-\r
+       \r
        /**\r
-        *  Different checks for an author\r
+        * CommentActions::ifAuthor()\r
+        * Different checks for an author\r
+        *\r
+        * @param       string  $key    key of data for author\r
+        * @param       string  $value  value of data for author\r
+        * @return      boolean correct or not\r
         */\r
-       function _ifAuthor($name = '', $value='') {\r
+       private function ifAuthor($key = '', $value = '')\r
+       {\r
                global $member, $manager;\r
-\r
-               if ($this->currentComment['memberid'] == 0) return false;\r
-\r
+               \r
+               if ( $this->currentComment['memberid'] == 0 )\r
+               {\r
+                       return FALSE;\r
+               }\r
+               \r
                $mem =& $manager->getMember($this->currentComment['memberid']);\r
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));\r
-               $citem =& $manager->getItem($this->currentComment['itemid'],1,1);\r
-\r
+               $citem =& $manager->getItem($this->currentComment['itemid'], 1, 1);\r
+               \r
                // when no parameter is defined, just check if item author is current visitor\r
-               if (($name != 'isadmin' && $name != 'name' && $name != 'isauthor' && $name != 'isonteam')) {\r
+               if (($key != 'isadmin' && $key != 'name' && $key != 'isauthor' && $key != 'isonteam')) {\r
                        return (intval($member->getID()) > 0 && intval($member->getID()) == intval($citem['authorid']));\r
                }\r
-\r
+               \r
                // check comment author name\r
-               if ($name == 'name') {\r
+               if ( $key == 'name' )\r
+               {\r
                        $value = trim(strtolower($value));\r
-                       if ($value == '')\r
-                               return false;\r
-                       if ($value == strtolower($mem->getDisplayName()))\r
-                               return true;\r
+                       if ( $value == '' )\r
+                       {\r
+                               return FALSE;\r
+                       }\r
+                       if ( $value == strtolower($mem->getDisplayName()) )\r
+                       {\r
+                               return TRUE;\r
+                       }\r
                }\r
-\r
+               \r
                // check if comment author is admin\r
-               if ($name == 'isadmin') {\r
+               if ( $key == 'isadmin' )\r
+               {\r
                        $blogid = intval($b->getID());\r
-                       if ($mem->isAdmin())\r
-                               return true;\r
-\r
+                       if ( $mem->isAdmin() )\r
+                       {\r
+                               return TRUE;\r
+                       }\r
                        return $mem->isBlogAdmin($blogid);\r
                }\r
-\r
+               \r
                // check if comment author is item author\r
-               if ($name == 'isauthor') {\r
+               if ( $key == 'isauthor' )\r
+               {\r
                        return (intval($citem['authorid']) == intval($this->currentComment['memberid']));\r
                }\r
-\r
+               \r
                // check if comment author is on team\r
-               if ($name == 'isonteam') {\r
+               if ( $key == 'isonteam' )\r
+               {\r
                        return $mem->teamRights(intval($b->getID()));\r
                }\r
-\r
-               return false;\r
+               return FALSE;\r
        }\r
-\r
+       \r
        /**\r
-        *  Different checks for a category\r
+        * CommentActions::ifItemCategory()\r
+        * Different checks for a category\r
+        *\r
+        * @param       string  $key    key of data for category to which item belongs\r
+        * @param       string  $value  value of data for category to which item belongs\r
+        * @return boolean      correct or not\r
         */\r
-       function _ifItemCategory($name = '', $value='') {\r
+       private function ifItemCategory($key = '', $value = '')\r
+       {\r
                global $catid, $manager;\r
-\r
+       \r
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));\r
                $citem =& $manager->getItem($this->currentComment['itemid'],1,1);\r
                $icatid = $citem['catid'];\r
-\r
+       \r
                // when no parameter is defined, just check if a category is selected\r
-               if (($name != 'catname' && $name != 'catid') || ($value == ''))\r
+               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
+               {\r
                        return $b->isValidCategory($icatid);\r
-\r
+               }\r
+       \r
                // check category name\r
-               if ($name == 'catname') {\r
+               if ( $key == 'catname' )\r
+               {\r
                        $value = $b->getCategoryIdFromName($value);\r
-                       if ($value == $icatid)\r
+                       if ( $value == $icatid )\r
+                       {\r
                                return $b->isValidCategory($icatid);\r
+                       }\r
                }\r
-\r
+       \r
                // check category id\r
-               if (($name == 'catid') && ($value == $icatid))\r
+               if ( ($key == 'catid') && ($value == $icatid) )\r
+               {\r
                        return $b->isValidCategory($icatid);\r
-\r
-               return false;\r
+               }\r
+               return FALSE;\r
        }\r
-\r
-\r
+       \r
        /**\r
-        *  Checks if a member is on the team of a blog and return his rights\r
+        * CommentActions::ifOnTeam()\r
+        * Checks if a member is on the team of a blog and return his rights\r
+        * \r
+        * @param       string  $blogName       name of weblog\r
+        * @return      boolean correct or not\r
         */\r
-       function _ifOnTeam($blogName = '') {\r
+       private function ifOnTeam($blogName = '')\r
+       {\r
                global $blog, $member, $manager;\r
-\r
+               \r
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));\r
-\r
+               \r
                // when no blog found\r
-               if (($blogName == '') && (!is_object($b)))\r
+               if ( ($blogName == '') && (!is_object($b)) )\r
+               {\r
                        return 0;\r
-\r
+               }\r
+               \r
                // explicit blog selection\r
-               if ($blogName != '')\r
+               if ( $blogName != '' )\r
+               {\r
                        $blogid = getBlogIDFromName($blogName);\r
-\r
-               if (($blogName == '') || !$manager->existsBlogID($blogid))\r
-                       // use current blog\r
+               }\r
+               \r
+               // use current blog\r
+               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
+               {\r
                        $blogid = $b->getID();\r
-\r
+               }\r
+               \r
                return $member->teamRights($blogid);\r
        }\r
-\r
+       \r
        /**\r
-        *  Checks if a member is admin of a blog\r
+        * CommentActions::ifAdmin()\r
+        * Checks if a member is admin of a blog\r
+        * \r
+        * @param       string  $blogName       name of weblog\r
+        * @return      boolean correct or not\r
         */\r
-       function _ifAdmin($blogName = '') {\r
+       private function ifAdmin($blogName = '')\r
+       {\r
                global $blog, $member, $manager;\r
-\r
+               \r
                $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));\r
-\r
+               \r
                // when no blog found\r
-               if (($blogName == '') && (!is_object($b)))\r
+               if ( ($blogName == '') && (!is_object($b)) )\r
+               {\r
                        return 0;\r
-\r
+               }\r
+               \r
                // explicit blog selection\r
-               if ($blogName != '')\r
+               if ( $blogName != '' )\r
+               {\r
                        $blogid = getBlogIDFromName($blogName);\r
-\r
-               if (($blogName == '') || !$manager->existsBlogID($blogid))\r
-                       // use current blog\r
+               }\r
+               \r
+               // use current blog\r
+               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
+               {\r
                        $blogid = $b->getID();\r
-\r
+               }\r
+               \r
                return $member->isBlogAdmin($blogid);\r
        }\r
-\r
-\r
+       \r
        /**\r
+        * CommentActions::ifHasPlugin()\r
         *      hasplugin,PlugName\r
         *         -> checks if plugin exists\r
         *      hasplugin,PlugName,OptionName\r
         *         -> checks if the option OptionName from plugin PlugName is not set to 'no'\r
         *      hasplugin,PlugName,OptionName=value\r
         *         -> checks if the option OptionName from plugin PlugName is set to value\r
+        *\r
+        * @param       string  $name   name of plugin\r
+        * @param       string  $value  key (and value) of plugin option\r
+        * @return      boolean correct or not\r
         */\r
-       function _ifHasPlugin($name, $value) {\r
+       private function ifHasPlugin($name, $value)\r
+       {\r
                global $manager;\r
-               $condition = false;\r
+               $condition = FALSE;\r
+               \r
                // (pluginInstalled method won't write a message in the actionlog on failure)\r
-               if ($manager->pluginInstalled('NP_'.$name)) {\r
-                       $plugin =& $manager->getPlugin('NP_' . $name);\r
-                       if ($plugin != NULL) {\r
-                               if ($value == "") {\r
+               if ( $manager->pluginInstalled('NP_'.$name) )\r
+               {\r
+                       $plugin =& $manager->getPlugin("NP_{$name}");\r
+                       if ( $plugin != NULL )\r
+                       {\r
+                               if ( $value == "" )\r
+                               {\r
                                        $condition = true;\r
-                               } else {\r
+                               }\r
+                               else\r
+                               {\r
                                        list($name2, $value2) = preg_split('#=#', $value, 2);\r
-                                       if ($value2 == "" && $plugin->getOption($name2) != 'no') {\r
+                                       if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
+                                       {\r
                                                $condition = true;\r
-                                       } else if ($plugin->getOption($name2) == $value2) {\r
+                                       }\r
+                                       else if ( $plugin->getOption($name2) == $value2 )\r
+                                       {\r
                                                $condition = true;\r
                                        }\r
                                }\r
@@ -748,20 +981,29 @@ class CommentActions extends BaseActions
                }\r
                return $condition;\r
        }\r
-\r
+       \r
        /**\r
+        * CommentActions::ifPlugin()\r
         * Checks if a plugin exists and call its doIf function\r
+        * \r
+        * @param       string  $name   name of plugin\r
+        * @param       string  $key    key of plugin option\r
+        * @param       string  $value  value of plugin option\r
+        * @return      boolean callback output from plugin\r
         */\r
-       function _ifPlugin($name, $key = '', $value = '') {\r
+       private function ifPlugin($name, $key = '', $value = '')\r
+       {\r
                global $manager;\r
-\r
-               $plugin =& $manager->getPlugin('NP_' . $name);\r
-               if (!$plugin) return;\r
-\r
+               \r
+               $plugin =& $manager->getPlugin("NP_{$name}");\r
+               if ( !$plugin )\r
+               {\r
+                       return;\r
+               }\r
+               \r
                $params = func_get_args();\r
                array_shift($params);\r
-\r
+               \r
                return call_user_func_array(array(&$plugin, 'doIf'), $params);\r
        }\r
-\r
 }\r