OSDN Git Service

Merge branch 'skinnable-master'
[nucleus-jp/nucleus-next.git] / nucleus / libs / ITEMACTIONS.php
index 8109137..7db9281 100644 (file)
@@ -1,95 +1,99 @@
-<?php\r
-/*\r
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\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
- * as published by the Free Software Foundation; either version 2\r
- * of the License, or (at your option) any later version.\r
- * (see nucleus/documentation/index.html#license for more info)\r
- */\r
-/**\r
- * This class is used to parse item templates\r
- *\r
- * @license http://nucleuscms.org/license.txt GNU General Public License\r
- * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
- * @version $Id: ITEMACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $\r
- */\r
-class ItemActions extends BaseActions\r
-{\r
-       /**\r
-        * ItemActions::$currentItem\r
-        * item currently being handled (mysql result object, see Blog::showUsingQuery)\r
-        */\r
-       public $currentItem;\r
-       \r
-       /**\r
-        * ItemActions::$linkparams\r
-        * contains an assoc array with parameters that need to be included when\r
-        * generating links to items/archives/... (e.g. catid)\r
-        */\r
-       public $linkparams;\r
-       \r
-       /**\r
-        * ItemActions::$allowEditAll\r
-        * true when the current user is a blog admin (and thus allowed to edit all items) \r
-        */\r
-       private $allowEditAll;\r
-       \r
-       /**\r
-        * ItemActions::$lastVisit\r
-        * timestamp of last visit\r
-        */\r
-       private $lastVisit;\r
-       \r
-       /**\r
-        * ItemActions::$blog\r
-        * reference to the blog currently being displayed\r
-        */\r
+<?php
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2009 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * This class is used to parse item templates
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group
+<<<<<<< HEAD
+ * @version $Id: ITEMACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $
+=======
+ * @version $Id: ITEMACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
+>>>>>>> skinnable-master
+ */
+class ItemActions extends BaseActions
+{
+       /**
+        * ItemActions::$currentItem
+        * item currently being handled (mysql result object, see Blog::showUsingQuery)
+        */
+       public $currentItem;
+       
+       /**
+        * ItemActions::$linkparams
+        * contains an assoc array with parameters that need to be included when
+        * generating links to items/archives/... (e.g. catid)
+        */
+       public $linkparams;
+       
+       /**
+        * ItemActions::$allowEditAll
+        * true when the current user is a blog admin (and thus allowed to edit all items) 
+        */
+       private $allowEditAll;
+       
+       /**
+        * ItemActions::$lastVisit
+        * timestamp of last visit
+        */
+       private $lastVisit;
+       
+       /**
+        * ItemActions::$blog
+        * reference to the blog currently being displayed
+        */
        public $blog;
-       \r
-       /**\r
-        * ItemActions::$template\r
-        * associative array with template info (part name => contents)\r
-        */\r
-       private $template;\r
-       \r
-       /**\r
-        * ItemActions::$showComments\r
-        * true when comments need to be displayed\r
-        */\r
-       private $showComments;\r
-       \r
-       /**\r
-        * ItemActions::$defined_actions\r
-        * defined actions in this class\r
-        */\r
-       static private $defined_actions = array(\r
+       
+       /**
+        * ItemActions::$template
+        * associative array with template info (part name => contents)
+        */
+       private $template;
+       
+       /**
+        * ItemActions::$showComments
+        * true when comments need to be displayed
+        */
+       private $showComments;
+       
+       /**
+        * ItemActions::$defined_actions
+        * defined actions in this class
+        */
+       static private $defined_actions = array(
                'author',
                'authorid',
                'authorlink',
-               'blogid',\r
+               'blogid',
                'blogurl',
-               'body',\r
-               'category',\r
-               'categorylink',\r
-               'catid',\r
+               'body',
+               'category',
+               'categorylink',
+               'catid',
                'closed',
                'comments',
-               'date',\r
+               'date',
                'daylink',
                'edit',
                'editlink',
                'editpopupcode',
                'itemid',
-               'itemlink',\r
+               'itemlink',
                'karma',
                'karmaneglink',
-               'karmaposlink',\r
+               'karmaposlink',
                'more',
                'morelink',
-               'new',\r
+               'new',
                'plugin',
                'query',
                'relevance',
@@ -99,1045 +103,1087 @@ class ItemActions extends BaseActions
                'time',
                'title',
        /* actions defined in BodyAction class */
-               'image',\r
+               'image',
                'media',
-               'popup',\r
-       );\r
-       \r
-       /**\r
-        * ItemActions::__construct\r
-        * Enter description here ...\r
-        * @param unknown_type $blog\r
-        */\r
-       public function __construct(&$blog)\r
-       {\r
-               global $catid, $member;\r
-               // call constructor of superclass first\r
+<<<<<<< HEAD
+               'popup',
+=======
+               'popup'
+>>>>>>> skinnable-master
+               );
+       
+       /**
+        * ItemActions::__construct
+        * Enter description here ...
+        * @param unknown_type $blog
+        */
+       public function __construct(&$blog)
+       {
+               global $catid, $member;
+               
+               // call constructor of superclass first
                parent::__construct();
-               \r
-               // extra parameters for created links\r
-               if ( $catid )\r
-               {\r
-                       $this->linkparams = array('catid' => $catid);\r
-               }\r
-               \r
-               // check if member is blog admin (and thus allowed to edit all items)\r
-               $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));\r
-               $this->setBlog($blog);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::getDefinedActions()\r
-        * Returns an array with the actions that are defined\r
-        * in the ItemActions class\r
-        * \r
-        * @static
-        * @param       void\r
-        * @return      void\r
-        */\r
-       static public function getDefinedActions()
-       {\r
-               return array_merge(self::$defined_actions, parent::getDefinedActions());
-       }\r
-       \r
-       /**\r
-        * ItemActions::setLastVisit()\r
-        * \r
-        * @param       timestamp       $lastVisit      timestamp of latest visit\r
-        * @return      void\r
-        */\r
-       public function setLastVisit($lastVisit)\r
-       {\r
-               $this->lastVisit = $lastVisit;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::setParser()\r
-        * \r
-        * @param       object  &$parser        instance of Parser class\r
-        * @return      void\r
-        */\r
-       public function setParser(&$parser)\r
-       {\r
-               $this->parser =& $parser;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::setCurrentItem()\r
-        * \r
-        * @param       object  $item   instance of Item class\r
-        * @return      void\r
-        */\r
-       public function setCurrentItem(&$item)\r
-       {\r
-               global $currentitemid;\r
-               $this->currentItem =& $item;\r
-               $currentitemid = $this->currentItem->itemid;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::setBlog()\r
-        * \r
-        * @param       object  &$blog  instance of Blog class\r
-        * @return      void\r
-        */\r
-       public function setBlog(&$blog)\r
-       {\r
-               $this->blog =& $blog;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::setTemplate()\r
-        * \r
-        * @param       array   $template       array including templates\r
-        * @return      void\r
-        */\r
-       public function setTemplate($template)\r
-       {\r
-               $this->template =& $template;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::setShowComments()\r
-        * \r
-        * @param       boolean $val    need to be displayed or not\r
-        * @return      void\r
-        */\r
-       public function setShowComments($val)\r
-       {\r
-               $this->showComments = (boolean) $val;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_blogid()\r
-        * Parse templatevar blogid\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_blogid()\r
-       {\r
-               echo $this->blog->getID();\r
-       }\r
-\r
-       /**\r
-        * ItemActions::parse_body()\r
-        * Parse templatevar body\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_body()\r
-       {\r
-               $this->highlightAndParse($this->currentItem->body);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_more()\r
-        * Parse templatevar more\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_more()\r
-       {\r
-               $this->highlightAndParse($this->currentItem->more);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_itemid()\r
-        * Parse templatevar itemid\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_itemid()\r
-       {\r
-               echo $this->currentItem->itemid;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_category()\r
-        * Parse templatevar category\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_category()\r
-       {\r
-               echo $this->currentItem->category;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_categorylink()\r
-        * Parse templatevar categorylink\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_categorylink()\r
-       {\r
-               echo Link::create_link('category', array('catid' => $this->currentItem->catid, 'name' => $this->currentItem->category));\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_catid()\r
-        * Parse templatevar catid\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_catid()\r
-       {\r
-               echo $this->currentItem->catid;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_authorid()\r
-        * Parse templatevar authorid\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_authorid()\r
-       {\r
-               echo $this->currentItem->authorid;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_authorlink()\r
-        * Parse templatevar authorlink\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_authorlink()\r
-       {\r
-               $data = array(\r
-                               'memberid' => $this->currentItem->authorid,\r
-                               'name' => $this->currentItem->author,\r
-                               'extra' => $this->linkparams\r
-                       );\r
-               \r
-               echo Link::create_link('member', $data);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_query()\r
-        * Parse templatevar query\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_query()\r
-       {\r
-               echo $this->strHighlight;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_itemlink()\r
-        * Parse templatevar itemlink\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_itemlink()\r
-       {\r
-               $data = array(\r
-                       'itemid'        => $this->currentItem->itemid,\r
-                       'title'         => $this->currentItem->title,\r
-                       'timestamp'     => $this->currentItem->timestamp,\r
-                       'extra'         => $this->linkparams\r
-               );\r
-               \r
-               echo Link::create_link('item', $data);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_blogurl()\r
-        * Parse templatevar blogurl\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_blogurl()\r
-       {\r
-               echo $this->blog->getURL();\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_closed()\r
-        * Parse templatevar closed\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_closed()\r
-       {\r
-               echo $this->currentItem->closed;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_relevance()\r
-        * Parse templatevar relevance\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_relevance()\r
-       {\r
-               echo round($this->currentItem->score,2);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_title()\r
-        * Parse templatevar title\r
-        *\r
-        * @param       string  $format defines in which format the title is shown\r
-        * @return      void\r
-        */\r
-       public function parse_title($format = '')\r
-       {\r
-               if ( is_array($this->currentItem) )\r
-               {\r
-                       $itemtitle = $this->currentItem['title'];\r
-               }\r
-               elseif ( is_object($this->currentItem) )\r
-               {\r
-                       $itemtitle = $this->currentItem->title;\r
-               }\r
-               switch ( $format )\r
-               {\r
-                       case 'xml':\r
-                               echo Entity::hen($itemtitle);\r
-                               break;\r
-                       case 'attribute':\r
-                               echo Entity::hsc($itemtitle);\r
-                               break;\r
-                       case 'raw':\r
-                               echo $itemtitle;\r
-                               break;\r
-                       default:\r
-                               $this->highlightAndParse($itemtitle);\r
-                               break;\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_karma()\r
-        * Parse templatevar karma\r
-        * \r
-        * @param       string  $type   type of data for karma\r
-        * @return      void\r
-        */\r
-       public function parse_karma($type = 'totalscore')\r
-       {\r
-               global $manager;\r
-               \r
-               // get karma object\r
-               $karma =& $manager->getKarma($this->currentItem->itemid);\r
-               \r
-               switch ( $type )\r
-               {\r
-                       case 'pos':\r
-                               echo $karma->getNbPosVotes();\r
-                               break;\r
-                       case 'neg':\r
-                               echo $karma->getNbNegVotes();\r
-                               break;\r
-                       case 'votes':\r
-                               echo $karma->getNbOfVotes();\r
-                               break;\r
-                       case 'posp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';\r
-                               break;\r
-                       case 'negp':\r
-                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;\r
-                               echo number_format($percentage,2), '%';\r
-                               break;\r
-                       case 'totalscore':\r
-                       default:\r
-                               echo $karma->getTotalScore();\r
-                               break;\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_author()\r
-        * Parse templatevar author\r
-        * \r
-        * @param       string  $which  key of data for author\r
-        * @return      void\r
-        */\r
-       public function parse_author($which = '')\r
-       {\r
-               switch ( $which )\r
-               {\r
-                       case 'realname':\r
-                               echo $this->currentItem->authorname;\r
-                               break;\r
-                       case 'id':\r
-                               echo $this->currentItem->authorid;\r
-                               break;\r
-                       case 'email':\r
-                               echo $this->currentItem->authormail;\r
-                               break;\r
-                       case 'url':\r
-                               echo $this->currentItem->authorurl;\r
-                               break;\r
-                       case 'name':\r
-                       default:\r
-                               echo $this->currentItem->author;\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_smartbody()\r
-        * Parse templatevar smartbody\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_smartbody()\r
-       {\r
-               if ( !$this->currentItem->more )\r
-               {\r
-                       $this->highlightAndParse($this->currentItem->body);\r
-               }\r
-               else\r
-               {\r
-                       $this->highlightAndParse($this->currentItem->more);\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_morelink()\r
-        * Parse templatevar morelink\r
-        */\r
-       public function parse_morelink()\r
-       {\r
-               if ( $this->currentItem->more )\r
-               {\r
-                       $this->parser->parse($this->template['MORELINK']);\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_date()\r
-        * Parse templatevar date\r
-        *\r
-        * @param       string  $format format optional strftime format\r
-        * @return      void\r
-        */\r
-       public function parse_date($format = '')\r
-       {\r
-               if ( $format !== '' )\r
-               {\r
-                       /* do nothing */\r
-                       ;\r
-               }\r
-               else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )\r
-               {\r
-                       /* depends on the PHP's current locale */\r
-                       $format = '%X';\r
-               }\r
-               else\r
-               {\r
-                       $format = $this->template['FORMAT_DATE'];\r
-               }\r
-               \r
-               $offset = 0;\r
-               if ( $this->blog )\r
-               {\r
-                       $offset = $this->blog->getTimeOffset() * 3600;\r
-               }\r
-               \r
-               echo i18n::formatted_datetime($format, $this->currentItem->timestamp, $offset);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_time()\r
-        * Parse templatevar time\r
-        *\r
-        * @param       string  $format format optional strftime format\r
-        * @return      void\r
-        */\r
-       public function parse_time($format = '')\r
-       {\r
-               if ( $format !== '' )\r
-               {\r
-                       /* do nothing */\r
-                       ;\r
-               }\r
-               else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )\r
-               {\r
-                       /* depends on the PHP's current locale */\r
-                       $format = '%x';\r
-               }\r
-               else\r
-               {\r
-                       $format = $this->template['FORMAT_TIME'];\r
-               }\r
-               echo i18n::formatted_datetime($format, $this->currentItem->timestamp);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_syndicate_title()\r
-        * Parse templatevar syndicate_title\r
-        *\r
-        * @param       string  $maxLength      maxLength optional maximum length\r
-        * @return      string  syndicated      title\r
-        */\r
-       public function parse_syndicate_title($maxLength = 100) {\r
-               $syndicated = strip_tags($this->currentItem->title);\r
-               echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_syndicate_description()\r
-        * Parse templatevar syndicate_description\r
-        *\r
-        * @param       stromg  $maxLength              maxlength optional maximum length\r
-        * @param       string  $addHighlight   highlighted string\r
-        * @return      void\r
-        */\r
-       public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)\r
-       {\r
-               $syndicated = strip_tags($this->currentItem->body);\r
-               if ( $addHighlight )\r
-               {\r
-                       $tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
-                       echo $this->highlightAndParse($tmp_highlight);\r
-               }\r
-               else\r
-               {\r
-                       echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_karmaposlink()\r
-        * Parse templatevar karmaposlink\r
-        *\r
-        * @param       string  $text   text element for anchor element\r
-        * @return      void\r
-        */\r
-       public function parse_karmaposlink($text = '')\r
-       {\r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votepositive&amp;itemid=' . $this->currentItem->itemid;\r
-               if ( !$text )\r
-               {\r
-                       echo '<a href="'.$link.'">' . $text . '</a>';\r
-               }\r
-               else\r
-               {\r
-                       echo $link;\r
-               }\r
-               \r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_karmaneglink()\r
-        * Parse templatevar karmaneglink\r
-        *\r
-        * @param       string $text    text element for anchor element\r
-        * @return      void\r
-        */\r
-       public function parse_karmaneglink($text = '')\r
-       {\r
-               global $CONF;\r
-               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem->itemid;\r
-               \r
-               if ( !$text )\r
-               {\r
-                       echo '<a href="'.$link.'">' . $text . '</a>';\r
-               }\r
-               else\r
-               {\r
-                       echo $link;\r
-               }\r
-               \r
-               return;\r
-       }\r
-\r
-       /**\r
-        * ItemActions::parse_new()\r
-        * Parse templatevar new\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_new()\r
-       {\r
-               if ( ($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit) )\r
-               {\r
-                       echo $this->template['NEW'];\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_daylink()\r
-        * Parse templatevar daylink\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_daylink()\r
-       {\r
-               echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem->timestamp), $this->linkparams);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_comments(\r
-        * Parse templatevar comments\r
-        * \r
-        * @param       integer $maxToShow      maximum number of comments in a display\r
-        * @return      void\r
-        */\r
-       public function parse_comments($maxToShow = 0)\r
-       {\r
-               if ( $maxToShow == 0 )\r
-               {\r
-                       $maxToShow = $this->blog->getMaxComments();\r
-               }\r
-               \r
-               // add comments\r
-               if ( $this->showComments && $this->blog->commentsEnabled() )\r
-               {\r
-                       $comments = new Comments($this->currentItem->itemid);\r
-                       $comments->setItemActions($this);\r
-                       $comments->showComments($this->template, $maxToShow, $this->currentItem->closed ? 0 : 1, $this->strHighlight);\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-               $plugin =& $manager->getPlugin("NP_{$pluginName}");\r
-               if ( !$plugin )\r
-               {\r
-                       return;\r
-               }\r
-               \r
-               // get arguments\r
-               $params = func_get_args();\r
-               \r
-               // remove plugin name\r
-               array_shift($params);\r
-               \r
-               // add item reference (array_unshift didn't work)\r
-               $params = array_merge(array(&$this->currentItem),$params);\r
-               \r
-               call_user_func_array(array(&$plugin,'doTemplateVar'), $params);\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_edit()\r
-        * Parse templatevar edit\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_edit()\r
-       {\r
-               global $member, $CONF;\r
-               if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) )\r
-               {\r
-                       $this->parser->parse($this->template['EDITLINK']);\r
-               }\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_editlink()\r
-        * Parse templatevar editlink\r
-        */\r
-       public function parse_editlink()\r
-       {\r
-               global $CONF;\r
-               echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&amp;itemid=' . $this->currentItem->itemid;\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::parse_editpopupcode()\r
-        * Parse templatevar editpopupcode\r
-        * \r
-        * @param       void\r
-        * @return      void\r
-        */\r
-       public function parse_editpopupcode()\r
-       {\r
-               echo "if (event &amp;&amp; event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=550,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::highlightAndParse()\r
-        * Parses highlighted text, with limited actions only (to prevent not fully trusted team members\r
-        * from hacking your weblog.\r
-        * 'plugin variables in items' implementation by Andy\r
-        * \r
-        * @param       array   $data   \r
-        * @return      void\r
-        */\r
-       public function highlightAndParse(&$data)\r
-       {\r
-               $actions = new BodyActions($this->blog);\r
-               $parser = new Parser($actions->getDefinedActions(), $actions);\r
-               $actions->setTemplate($this->template);\r
-               $actions->setHighlight($this->strHighlight);\r
-               $actions->setCurrentItem($this->currentItem);\r
-               $parser->parse($actions->highlight($data));\r
-               return;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-        * @return      boolean\r
-        */\r
-       protected function checkCondition($field, $name='', $value = '')\r
-       {\r
-               global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;\r
-               \r
-               $condition = 0;\r
-               switch ( $field )\r
-               {\r
-                       case 'category':\r
-                               $condition = ($blog && $this->ifCategory($name,$value));\r
-                               break;\r
-                       case 'itemcategory':\r
-                               $condition = ($this->ifItemCategory($name,$value));\r
-                               break;\r
-                       case 'blogsetting':\r
-                               $condition = ($blog && ($blog->getSetting($name) == $value));\r
-                               break;\r
-                       case 'itemblogsetting':\r
-                               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
-                               $condition = ($b && ($b->getSetting($name) == $value));\r
-                               break;\r
-                       case 'loggedin':\r
-                               $condition = $member->isLoggedIn();\r
-                               break;\r
-                       case 'onteam':\r
-                               $condition = $member->isLoggedIn() && $this->ifOnTeam($name);\r
-                               break;\r
-                       case 'admin':\r
-                               $condition = $member->isLoggedIn() && $this->ifAdmin($name);\r
-                               break;\r
-                       case 'author':\r
-                               $condition = ($this->ifAuthor($name,$value));\r
-                               break;\r
-                       case 'hasplugin':\r
-                               $condition = $this->ifHasPlugin($name, $value);\r
-                               break;\r
-                       default:\r
-                               $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);\r
-                               break;\r
-               }\r
-               return $condition;\r
-       }       \r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifCategory($key = '', $value = '')\r
-       {\r
-               global $blog, $catid;\r
-               \r
-               // when no parameter is defined, just check if a category is selected\r
-               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
-               {\r
-                       return (boolean) $blog->isValidCategory($catid);\r
-               }\r
-               \r
-               // check category name\r
-               if ( $key == 'catname' )\r
-               {\r
-                       $value = $blog->getCategoryIdFromName($value);\r
-                       if ( $value == $catid )\r
-                       {\r
-                               return (boolean) $blog->isValidCategory($catid);\r
-                       }\r
-               }\r
-               \r
-               // check category id\r
-               if ( ($key == 'catid') && ($value == $catid) )\r
-               {\r
-                       return (boolean) $blog->isValidCategory($catid);\r
-               }\r
-               return FALSE;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifAuthor($key = '', $value = '')\r
-       {\r
-               global $member, $manager;\r
-               \r
-               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
-               \r
-               // when no parameter is defined, just check if author is current visitor\r
-               if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )\r
-               {\r
-                       return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem->authorid);\r
-               }\r
-               \r
-               // check author name\r
-               if ( $key == 'name' )\r
-               {\r
-                       $value = strtolower($value);\r
-                       if ( $value == strtolower($this->currentItem->author) )\r
-                       {\r
-                               return TRUE;\r
-                       }\r
-               }\r
-               \r
-               // check if author is admin\r
-               if ( ($key == 'isadmin') )\r
-               {\r
-                       $aid = intval($this->currentItem->authorid);\r
-                       $blogid = intval($b->getID());                  \r
-                       $amember =& $manager->getMember($aid);\r
-                       if ( $amember->isAdmin() )\r
-                       {\r
-                               return TRUE;\r
-                       }\r
-                       return (boolean) $amember->isBlogAdmin($blogid);\r
-               }\r
-               \r
-               return FALSE;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifItemCategory($key = '', $value='')\r
-       {\r
-               global $catid, $manager;\r
-               \r
-               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
-               \r
-               // when no parameter is defined, just check if a category is selected\r
-               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )\r
-               {\r
-                       return (boolean) $b->isValidCategory($catid);\r
-               }\r
-               \r
-               $icatid = $this->currentItem->catid;\r
-               \r
-               // check category name\r
-               if ( $key == 'catname' )\r
-               {\r
-                       $value = $b->getCategoryIdFromName($value);\r
-                       if ( $value == $icatid )\r
-                       {\r
-                               return (boolean) $b->isValidCategory($icatid);\r
-                       }\r
-               }\r
-               \r
-               // check category id\r
-               if ( ($key == 'catid') && ($value == $icatid) )\r
-               {\r
-                       return (boolean) $b->isValidCategory($icatid);\r
-               }\r
-               return FALSE;\r
-       }\r
-\r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifOnTeam($blogName = '')\r
-       {\r
-               global $blog, $member, $manager;\r
-               \r
-               // when no blog found\r
-               if ( ($blogName == '') && (!is_object($blog)) )\r
-               {\r
-                       return 0;\r
-               }\r
-               \r
-               // explicit blog selection\r
-               if ( $blogName != '' )\r
-               {\r
-                       $blogid = getBlogIDFromName($blogName);\r
-               }\r
-               \r
-               // use current blog\r
-               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
-               {\r
-                       $blogid = $blog->getID();\r
-               }\r
-               return (boolean) $member->teamRights($blogid);\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifAdmin($blogName = '')\r
-       {\r
-               global $blog, $member, $manager;\r
-               \r
-               // when no blog found\r
-               if ( ($blogName == '') && (!is_object($blog)) )\r
-               {\r
-                       return 0;\r
-               }\r
-               \r
-               // explicit blog selection\r
-               if ( $blogName != '' )\r
-               {\r
-                       $blogid = getBlogIDFromName($blogName);\r
-               }\r
-               \r
-               // use current blog\r
-               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )\r
-               {\r
-                       $blogid = $blog->getID();\r
-               }\r
-               return (boolean) $member->isBlogAdmin($blogid);\r
-       }\r
-       \r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifHasPlugin($name, $value)\r
-       {\r
-               global $manager;\r
-               $condition = FALSE;\r
-               // (pluginInstalled method won't write a message in the actionlog on failure)\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
-                               }\r
-                               else\r
-                               {\r
-                                       list($name2, $value2) = preg_split('#=#', $value, 2);\r
-                                       if ( $value2 == "" && $plugin->getOption($name2) != 'no' )\r
-                                       {\r
-                                               $condition = TRUE;\r
-                                       }\r
-                                       else if ( $plugin->getOption($name2) == $value2 )\r
-                                       {\r
-                                               $condition = TRUE;\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-               return (boolean) $condition;\r
-       }\r
-       \r
-       /**\r
-        * ItemActions::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
-       private function ifPlugin($name, $key = '', $value = '')\r
-       {\r
-               global $manager;\r
-               \r
-               $plugin =& $manager->getPlugin("NP_{$name}");\r
-               if ( !$plugin )\r
-               {\r
-                       return;\r
-               }\r
-               $params = func_get_args();\r
-               array_shift($params);\r
-               \r
-               return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);\r
-       }\r
-}
\ No newline at end of file
+               
+               // extra parameters for created links
+               if ( $catid )
+               {
+                       $this->linkparams = array('catid' => $catid);
+               }
+               
+               // check if member is blog admin (and thus allowed to edit all items)
+               $this->allowEditAll = ($member->isLoggedIn() && $member->blogAdminRights($blog->getID()));
+               $this->setBlog($blog);
+               return;
+       }
+       
+       /**
+        * ItemActions::getAvailableActions()
+        * Returns an array with the actions that are defined
+        * in the ItemActions class
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function getAvailableActions()
+       {
+               return array_merge(self::$defined_actions, parent::getAvailableActions());
+       }
+       
+       /**
+        * ItemActions::setLastVisit()
+        * 
+        * @param       timestamp       $lastVisit      timestamp of latest visit
+        * @return      void
+        */
+       public function setLastVisit($lastVisit)
+       {
+               $this->lastVisit = $lastVisit;
+               return;
+       }
+       
+       /**
+        * ItemActions::setCurrentItem()
+        * 
+        * @param       object  $item   instance of Item class
+        * @return      void
+        */
+       public function setCurrentItem(&$item)
+       {
+               global $currentitemid;
+               $this->currentItem =& $item;
+               $currentitemid = $this->currentItem['itemid'];
+               return;
+       }
+       
+       /**
+        * ItemActions::setBlog()
+        * 
+        * @param       object  &$blog  instance of Blog class
+        * @return      void
+        */
+       public function setBlog(&$blog)
+       {
+               $this->blog =& $blog;
+               return;
+       }
+       
+       /**
+        * ItemActions::setTemplate()
+        * 
+        * @param       array   $template       array including templates
+        * @return      void
+        */
+       public function setTemplate($template)
+       {
+               $this->template =& $template;
+               return;
+       }
+       
+       /**
+        * ItemActions::setShowComments()
+        * 
+        * @param       boolean $val    need to be displayed or not
+        * @return      void
+        */
+       public function setShowComments($val)
+       {
+               $this->showComments = (boolean) $val;
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_blogid()
+        * Parse templatevar blogid
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_blogid()
+       {
+               echo $this->blog->getID();
+       }
+
+       /**
+        * ItemActions::parse_body()
+        * Parse templatevar body
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_body()
+       {
+               $this->highlightAndParse($this->currentItem['body']);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_more()
+        * Parse templatevar more
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_more()
+       {
+               $this->highlightAndParse($this->currentItem['more']);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_itemid()
+        * Parse templatevar itemid
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_itemid()
+       {
+               echo $this->currentItem['itemid'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_category()
+        * Parse templatevar category
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_category()
+       {
+               echo $this->currentItem['category'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_categorylink()
+        * Parse templatevar categorylink
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_categorylink()
+       {
+               echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_catid()
+        * Parse templatevar catid
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_catid()
+       {
+               echo $this->currentItem['catid'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_authorid()
+        * Parse templatevar authorid
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_authorid()
+       {
+               echo $this->currentItem['authorid'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_authorlink()
+        * Parse templatevar authorlink
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_authorlink()
+       {
+               $data = array(
+                               'memberid' => $this->currentItem['authorid'],
+                               'name' => $this->currentItem['author'],
+                               'extra' => $this->linkparams
+                       );
+               
+               echo Link::create_link('member', $data);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_query()
+        * Parse templatevar query
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_query()
+       {
+               echo $this->strHighlight;
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_itemlink()
+        * Parse templatevar itemlink
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_itemlink()
+       {
+               $data = array(
+                       'itemid'        => $this->currentItem['itemid'],
+                       'title'         => $this->currentItem['title'],
+                       'timestamp'     => $this->currentItem['timestamp'],
+                       'extra'         => $this->linkparams
+               );
+               
+               echo Link::create_link('item', $data);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_blogurl()
+        * Parse templatevar blogurl
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_blogurl()
+       {
+               echo $this->blog->getURL();
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_closed()
+        * Parse templatevar closed
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_closed()
+       {
+               echo $this->currentItem['closed'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_relevance()
+        * Parse templatevar relevance
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_relevance()
+       {
+               echo round($this->currentItem['score'], 2);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_title()
+        * Parse templatevar title
+        *
+        * @param       string  $format defines in which format the title is shown
+        * @return      void
+        */
+       public function parse_title($format = '')
+       {
+               if ( is_array($this->currentItem) )
+               {
+                       $itemtitle = $this->currentItem['title'];
+               }
+               switch ( $format )
+               {
+                       case 'xml':
+                               echo Entity::hen($itemtitle);
+                               break;
+                       case 'attribute':
+                               echo Entity::hsc($itemtitle);
+                               break;
+                       case 'raw':
+                               echo $itemtitle;
+                               break;
+                       default:
+                               $this->highlightAndParse($itemtitle);
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_karma()
+        * Parse templatevar karma
+        * 
+        * @param       string  $type   type of data for karma
+        * @return      void
+        */
+       public function parse_karma($type = 'totalscore')
+       {
+               global $manager;
+               
+               // get karma object
+               $karma =& $manager->getKarma($this->currentItem['itemid']);
+               
+               switch ( $type )
+               {
+                       case 'pos':
+                               echo $karma->getNbPosVotes();
+                               break;
+                       case 'neg':
+                               echo $karma->getNbNegVotes();
+                               break;
+                       case 'votes':
+                               echo $karma->getNbOfVotes();
+                               break;
+                       case 'posp':
+                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbPosVotes() / $karma->getNbOfVotes()) : 50;
+                               echo number_format($percentage,2), '%';
+                               break;
+                       case 'negp':
+                               $percentage = $karma->getNbOfVotes() ? 100 * ($karma->getNbNegVotes() / $karma->getNbOfVotes()) : 50;
+                               echo number_format($percentage,2), '%';
+                               break;
+                       case 'totalscore':
+                       default:
+                               echo $karma->getTotalScore();
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_author()
+        * Parse templatevar author
+        * 
+        * @param       string  $which  key of data for author
+        * @return      void
+        */
+       public function parse_author($which = '')
+       {
+               switch ( $which )
+               {
+                       case 'realname':
+                               echo $this->currentItem['authorname'];
+                               break;
+                       case 'id':
+                               echo $this->currentItem['authorid'];
+                               break;
+                       case 'email':
+                               echo $this->currentItem['authormail'];
+                               break;
+                       case 'url':
+                               echo $this->currentItem['authorurl'];
+                               break;
+                       case 'name':
+                       default:
+                               echo $this->currentItem['author'];
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_smartbody()
+        * Parse templatevar smartbody
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_smartbody()
+       {
+               if ( !$this->currentItem['more'] )
+               {
+                       $this->highlightAndParse($this->currentItem['body']);
+               }
+               else
+               {
+                       $this->highlightAndParse($this->currentItem['more']);
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_morelink()
+        * Parse templatevar morelink
+        */
+       public function parse_morelink()
+       {
+               if ( $this->currentItem['more'] )
+               {
+                       $this->parser->parse($this->template['MORELINK']);
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_date()
+        * Parse templatevar date
+        *
+        * @param       string  $format format optional strftime format
+        * @return      void
+        */
+       public function parse_date($format = '')
+       {
+               if ( $format !== '' )
+               {
+                       /* do nothing */
+                       ;
+               }
+               else if ( !array_key_exists('FORMAT_DATE', $this->template) || $this->template['FORMAT_DATE'] === '' )
+               {
+                       /* depends on the PHP's current locale */
+                       $format = '%X';
+               }
+               else
+               {
+                       $format = $this->template['FORMAT_DATE'];
+               }
+               
+               $offset = 0;
+               if ( $this->blog )
+               {
+                       $offset = $this->blog->getTimeOffset() * 3600;
+               }
+               
+               echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_time()
+        * Parse templatevar time
+        *
+        * @param       string  $format format optional strftime format
+        * @return      void
+        */
+       public function parse_time($format = '')
+       {
+               if ( $format !== '' )
+               {
+                       /* do nothing */
+                       ;
+               }
+               else if ( !array_key_exists('FORMAT_TIME', $this->template) || $this->template['FORMAT_TIME'] === '' )
+               {
+                       /* depends on the PHP's current locale */
+                       $format = '%x';
+               }
+               else
+               {
+                       $format = $this->template['FORMAT_TIME'];
+               }
+               echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_syndicate_title()
+        * Parse templatevar syndicate_title
+        *
+        * @param       string  $maxLength      maxLength optional maximum length
+        * @return      string  syndicated      title
+        */
+       public function parse_syndicate_title($maxLength = 100) {
+               $syndicated = strip_tags($this->currentItem['title']);
+               echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+       }
+       
+       /**
+        * ItemActions::parse_syndicate_description()
+        * Parse templatevar syndicate_description
+        *
+        * @param       stromg  $maxLength              maxlength optional maximum length
+        * @param       string  $addHighlight   highlighted string
+        * @return      void
+        */
+       public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)
+       {
+               $syndicated = strip_tags($this->currentItem['body']);
+               if ( $addHighlight )
+               {
+                       $tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+                       echo $this->highlightAndParse($tmp_highlight);
+               }
+               else
+               {
+                       echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_karmaposlink()
+        * Parse templatevar karmaposlink
+        *
+        * @param       string  $text   text element for anchor element
+        * @return      void
+        */
+       public function parse_karmaposlink($text = '')
+       {
+               global $CONF;
+               $link = $CONF['ActionURL'] . '?action=votepositive&amp;itemid=' . $this->currentItem['itemid'];
+               if ( !$text )
+               {
+                       echo '<a href="'.$link.'">' . $text . '</a>';
+               }
+               else
+               {
+                       echo $link;
+               }
+               
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_karmaneglink()
+        * Parse templatevar karmaneglink
+        *
+        * @param       string $text    text element for anchor element
+        * @return      void
+        */
+       public function parse_karmaneglink($text = '')
+       {
+               global $CONF;
+               $link = $CONF['ActionURL'] . '?action=votenegative&amp;itemid='.$this->currentItem['itemid'];
+               
+               if ( !$text )
+               {
+                       echo '<a href="'.$link.'">' . $text . '</a>';
+               }
+               else
+               {
+                       echo $link;
+               }
+               
+               return;
+       }
+
+       /**
+        * ItemActions::parse_new()
+        * Parse templatevar new
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_new()
+       {
+               if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )
+               {
+                       echo $this->template['NEW'];
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_daylink()
+        * Parse templatevar daylink
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_daylink()
+       {
+               echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_comments(
+        * Parse templatevar comments
+        * 
+        * @param       integer $maxToShow      maximum number of comments in a display
+        * @return      void
+        */
+       public function parse_comments($maxToShow = 0)
+       {
+               if ( $maxToShow == 0 )
+               {
+                       $maxToShow = $this->blog->getMaxComments();
+               }
+               
+               // add comments
+               if ( $this->showComments && $this->blog->commentsEnabled() )
+               {
+                       $comments = new Comments($this->currentItem['itemid']);
+                       $comments->setItemActions($this);
+                       $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_plugin()
+        * Executes a plugin templatevar
+        *
+        * @param       string  $pluginName     name of plugin (without the NP_)
+        * @param       extra parameters can be added
+        * @return      void
+        */
+       public function parse_plugin($pluginName)
+       {
+               global $manager;
+               
+               $plugin =& $manager->getPlugin("NP_{$pluginName}");
+               if ( !$plugin )
+               {
+                       return;
+               }
+               
+               // get arguments
+               $params = func_get_args();
+               
+               // remove plugin name
+               array_shift($params);
+               
+               // add item reference (array_unshift didn't work)
+<<<<<<< HEAD
+               $params = array_merge(array(&$this->currentItem),$params);
+               
+               call_user_func_array(array(&$plugin,'doTemplateVar'), $params);
+=======
+               $target = array(&$this->currentItem);
+               $params = array_merge($target,$params);
+               
+               call_user_func_array(array($plugin,'doTemplateVar'), $params);
+>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_edit()
+        * Parse templatevar edit
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_edit()
+       {
+               global $member, $CONF;
+               if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )
+               {
+                       $this->parser->parse($this->template['EDITLINK']);
+               }
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_editlink()
+        * Parse templatevar editlink
+        */
+       public function parse_editlink()
+       {
+               global $CONF;
+               echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&amp;itemid=' . $this->currentItem['itemid'];
+               return;
+       }
+       
+       /**
+        * ItemActions::parse_editpopupcode()
+        * Parse templatevar editpopupcode
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function parse_editpopupcode()
+       {
+               echo "if (event &amp;&amp; event.preventDefault) event.preventDefault();winbm=window.open(this.href,'nucleusbm','scrollbars=yes,width=600,height=550,left=10,top=10,status=yes,resizable=yes');winbm.focus();return false;";
+               return;
+       }
+       
+       /**
+        * ItemActions::highlightAndParse()
+        * Parses highlighted text, with limited actions only (to prevent not fully trusted team members
+        * from hacking your weblog.
+        * 'plugin variables in items' implementation by Andy
+        * 
+        * @param       array   $data   
+        * @return      void
+        */
+       public function highlightAndParse(&$data)
+       {
+               $handler = new BodyActions($this->blog);
+               $handler->setTemplate($this->template);
+               $handler->setHighlight($this->strHighlight);
+               $handler->setCurrentItem($this->currentItem);
+               
+               $parser = new Parser($handler);
+<<<<<<< HEAD
+               $parser->parse($handler->highlight($data));
+=======
+               $highlight = $handler->highlight($data);
+               $parser->parse($highlight);
+>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
+        * ItemActions::checkCondition()
+        * Checks conditions for if statements
+        *
+        * @param       string  $field  type of <%if%>
+        * @param       string  $name   property of field
+        * @param       string  $value  value of property
+        * @return      boolean
+        */
+       protected function checkCondition($field, $name='', $value = '')
+       {
+               global $catid, $blog, $member, $itemidnext, $itemidprev, $manager, $archiveprevexists, $archivenextexists;
+               
+               $condition = 0;
+               switch ( $field )
+               {
+                       case 'category':
+                               $condition = ($blog && $this->ifCategory($name,$value));
+                               break;
+                       case 'itemcategory':
+                               $condition = ($this->ifItemCategory($name,$value));
+                               break;
+                       case 'blogsetting':
+                               $condition = ($blog && ($blog->getSetting($name) == $value));
+                               break;
+                       case 'itemblogsetting':
+<<<<<<< HEAD
+                               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
+                               $condition = ($b && ($b->getSetting($name) == $value));
+=======
+                               $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);
+                               $t_blog =& $manager->getBlog($item['blogid']);
+                               $condition = ($t_blog && ($t_blog->getSetting($name) == $value));
+>>>>>>> skinnable-master
+                               break;
+                       case 'loggedin':
+                               $condition = $member->isLoggedIn();
+                               break;
+                       case 'onteam':
+                               $condition = $member->isLoggedIn() && $this->ifOnTeam($name);
+                               break;
+                       case 'admin':
+                               $condition = $member->isLoggedIn() && $this->ifAdmin($name);
+                               break;
+                       case 'author':
+                               $condition = ($this->ifAuthor($name,$value));
+                               break;
+                       case 'hasplugin':
+                               $condition = $this->ifHasPlugin($name, $value);
+                               break;
+                       default:
+                               $condition = $manager->pluginInstalled('NP_' . $field) && $this->ifPlugin($field, $name, $value);
+                               break;
+               }
+               return $condition;
+       }       
+       
+       /**
+        * ItemActions::ifCategory()
+        *  Different checks for a category
+        *  
+        * @param       string  $key    key of category
+        * @param       string  $value  value for key of category
+        * @return      boolean
+        */
+       private function ifCategory($key = '', $value = '')
+       {
+               global $blog, $catid;
+               
+               // when no parameter is defined, just check if a category is selected
+               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+               {
+                       return (boolean) $blog->isValidCategory($catid);
+               }
+               
+               // check category name
+               if ( $key == 'catname' )
+               {
+                       $value = $blog->getCategoryIdFromName($value);
+                       if ( $value == $catid )
+                       {
+                               return (boolean) $blog->isValidCategory($catid);
+                       }
+               }
+               
+               // check category id
+               if ( ($key == 'catid') && ($value == $catid) )
+               {
+                       return (boolean) $blog->isValidCategory($catid);
+               }
+               return FALSE;
+       }
+       
+       /**
+        * ItemActions::ifAuthor()
+        * Different checks for an author
+        * 
+        * @param       string  $key    key of data for author
+        * @param       string  $value  value of data for author
+        * @return      boolean correct or not
+        */
+       private function ifAuthor($key = '', $value = '')
+       {
+               global $member, $manager;
+               
+<<<<<<< HEAD
+               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
+               
+=======
+>>>>>>> skinnable-master
+               // when no parameter is defined, just check if author is current visitor
+               if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
+               {
+                       return (boolean) ((integer) $member->getID() > 0 && (integer) $member->getID() == (integer) $this->currentItem['authorid']);
+               }
+               
+               // check author name
+               if ( $key == 'name' )
+               {
+                       $value = strtolower($value);
+                       if ( $value == strtolower($this->currentItem['author']) )
+                       {
+                               return TRUE;
+                       }
+               }
+               
+               // check if author is admin
+               if ( ($key == 'isadmin') )
+               {
+<<<<<<< HEAD
+                       $aid = intval($this->currentItem['authorid']);
+                       $blogid = intval($b->getID());                  
+                       $amember =& $manager->getMember($aid);
+                       if ( $amember->isAdmin() )
+                       {
+                               return TRUE;
+                       }
+                       return (boolean) $amember->isBlogAdmin($blogid);
+=======
+                       $i_author =& $manager->getMember($this->currentItem['authorid']);
+                       if ( $i_author->isAdmin() )
+                       {
+                               return TRUE;
+                       }
+                       return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);
+>>>>>>> skinnable-master
+               }
+               
+               return FALSE;
+       }
+       
+       /**
+        * ItemActions::ifItemCategory()
+        * Different checks for a category
+        * 
+        * @param       string  $key    key of data for category to which item belongs
+        * @param       string  $value  value of data for category to which item belongs
+        * @return boolean      correct or not
+        */
+       private function ifItemCategory($key = '', $value='')
+       {
+               global $catid, $manager;
+               
+<<<<<<< HEAD
+               $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
+=======
+               $blog =& $manager->getBlog($this->currentItem['blogid']);
+>>>>>>> skinnable-master
+               
+               // when no parameter is defined, just check if a category is selected
+               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+               {
+<<<<<<< HEAD
+                       return (boolean) $b->isValidCategory($catid);
+=======
+                       return (boolean) $blog->isValidCategory($catid);
+>>>>>>> skinnable-master
+               }
+               
+               $icatid = $this->currentItem['catid'];
+               
+               // check category name
+               if ( $key == 'catname' )
+               {
+<<<<<<< HEAD
+                       $value = $b->getCategoryIdFromName($value);
+                       if ( $value == $icatid )
+                       {
+                               return (boolean) $b->isValidCategory($icatid);
+=======
+                       $value = $blog->getCategoryIdFromName($value);
+                       if ( $value == $icatid )
+                       {
+                               return (boolean) $blog->isValidCategory($icatid);
+>>>>>>> skinnable-master
+                       }
+               }
+               
+               // check category id
+               if ( ($key == 'catid') && ($value == $icatid) )
+               {
+<<<<<<< HEAD
+                       return (boolean) $b->isValidCategory($icatid);
+=======
+                       return (boolean) $blog->isValidCategory($icatid);
+>>>>>>> skinnable-master
+               }
+               return FALSE;
+       }
+
+       
+       /**
+        * ItemActions::ifOnTeam()
+        * Checks if a member is on the team of a blog and return his rights
+        * 
+        * @param       string  $blogName       name of weblog
+        * @return      boolean correct or not
+        */
+       private function ifOnTeam($blogName = '')
+       {
+               global $blog, $member, $manager;
+               
+               // when no blog found
+               if ( ($blogName == '') && (!is_object($blog)) )
+               {
+                       return 0;
+               }
+               
+               // explicit blog selection
+               if ( $blogName != '' )
+               {
+                       $blogid = getBlogIDFromName($blogName);
+               }
+               
+               // use current blog
+               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+               {
+                       $blogid = $blog->getID();
+               }
+               return (boolean) $member->teamRights($blogid);
+       }
+       
+       /**
+        * ItemActions::ifAdmin()
+        * Checks if a member is admin of a blog
+        * 
+        * @param       string  $blogName       name of weblog
+        * @return      boolean correct or not
+        */
+       private function ifAdmin($blogName = '')
+       {
+               global $blog, $member, $manager;
+               
+               // when no blog found
+               if ( ($blogName == '') && (!is_object($blog)) )
+               {
+                       return 0;
+               }
+               
+               // explicit blog selection
+               if ( $blogName != '' )
+               {
+                       $blogid = getBlogIDFromName($blogName);
+               }
+               
+               // use current blog
+               if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
+               {
+                       $blogid = $blog->getID();
+               }
+               return (boolean) $member->isBlogAdmin($blogid);
+       }
+       
+       
+       /**
+        * ItemActions::ifHasPlugin()
+        *      hasplugin,PlugName
+        *         -> checks if plugin exists
+        *      hasplugin,PlugName,OptionName
+        *         -> checks if the option OptionName from plugin PlugName is not set to 'no'
+        *      hasplugin,PlugName,OptionName=value
+        *         -> checks if the option OptionName from plugin PlugName is set to value
+        *
+        * @param       string  $name   name of plugin
+        * @param       string  $value  key (and value) of plugin option
+        * @return      boolean correct or not
+        */
+       private function ifHasPlugin($name, $value)
+       {
+               global $manager;
+               $condition = FALSE;
+               // (pluginInstalled method won't write a message in the actionlog on failure)
+               if ( $manager->pluginInstalled("NP_{$name}"))
+               {
+                       $plugin =& $manager->getPlugin('NP_' . $name);
+                       if ( $plugin != NULL )
+                       {
+                               if ( $value == "" )
+                               {
+                                       $condition = TRUE;
+                               }
+                               else
+                               {
+                                       list($name2, $value2) = preg_split('#=#', $value, 2);
+                                       if ( $value2 == "" && $plugin->getOption($name2) != 'no' )
+                                       {
+                                               $condition = TRUE;
+                                       }
+                                       else if ( $plugin->getOption($name2) == $value2 )
+                                       {
+                                               $condition = TRUE;
+                                       }
+                               }
+                       }
+               }
+               return (boolean) $condition;
+       }
+       
+       /**
+        * ItemActions::ifPlugin()
+        * Checks if a plugin exists and call its doIf function
+        * 
+        * @param       string  $name   name of plugin
+        * @param       string  $key    key of plugin option
+        * @param       string  $value  value of plugin option
+        * @return      boolean callback output from plugin
+        */
+       private function ifPlugin($name, $key = '', $value = '')
+       {
+               global $manager;
+               
+               $plugin =& $manager->getPlugin("NP_{$name}");
+               if ( !$plugin )
+               {
+                       return;
+               }
+               $params = func_get_args();
+               array_shift($params);
+               
+<<<<<<< HEAD
+               return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);
+=======
+               return (boolean) call_user_func_array(array($plugin, 'doIf'), $params);
+>>>>>>> skinnable-master
+       }
+}