'plugin',
'query',
'relevance',
- 'smartbody',
- 'syndicate_description',
- 'syndicate_title',
- 'time',
- 'title',
- /* actions defined in BodyAction class */
+ 'smartbody',\r
+ 'syndicate_description',\r
+ 'syndicate_title',\r
+ 'time',\r
+ 'title',\r
+ /* actions defined in BodyAction class */\r
'image',\r
- 'media',
- 'popup',\r
+ 'media',\r
+ 'popup'\r
);\r
\r
/**\r
public function __construct(&$blog)\r
{\r
global $catid, $member;\r
+ \r
// call constructor of superclass first\r
parent::__construct();
\r
}\r
\r
/**\r
- * ItemActions::getDefinedActions()\r
+ * ItemActions::getAvailableActions()\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()
+ public function getAvailableActions()\r
{\r
- return array_merge(self::$defined_actions, parent::getDefinedActions());
+ return array_merge(self::$defined_actions, parent::getAvailableActions());\r
}\r
\r
/**\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
{\r
global $currentitemid;\r
$this->currentItem =& $item;\r
- $currentitemid = $this->currentItem->itemid;\r
+ $currentitemid = $this->currentItem['itemid'];\r
return;\r
}\r
\r
*/\r
public function parse_body()\r
{\r
- $this->highlightAndParse($this->currentItem->body);\r
+ $this->highlightAndParse($this->currentItem['body']);\r
return;\r
}\r
\r
*/\r
public function parse_more()\r
{\r
- $this->highlightAndParse($this->currentItem->more);\r
+ $this->highlightAndParse($this->currentItem['more']);\r
return;\r
}\r
\r
*/\r
public function parse_itemid()\r
{\r
- echo $this->currentItem->itemid;\r
+ echo $this->currentItem['itemid'];\r
return;\r
}\r
\r
*/\r
public function parse_category()\r
{\r
- echo $this->currentItem->category;\r
+ echo $this->currentItem['category'];\r
return;\r
}\r
\r
*/\r
public function parse_categorylink()\r
{\r
- echo Link::create_link('category', array('catid' => $this->currentItem->catid, 'name' => $this->currentItem->category));\r
+ echo Link::create_link('category', array('catid' => $this->currentItem['catid'], 'name' => $this->currentItem['category']));\r
return;\r
}\r
\r
*/\r
public function parse_catid()\r
{\r
- echo $this->currentItem->catid;\r
+ echo $this->currentItem['catid'];\r
return;\r
}\r
\r
*/\r
public function parse_authorid()\r
{\r
- echo $this->currentItem->authorid;\r
+ echo $this->currentItem['authorid'];\r
return;\r
}\r
\r
public function parse_authorlink()\r
{\r
$data = array(\r
- 'memberid' => $this->currentItem->authorid,\r
- 'name' => $this->currentItem->author,\r
+ 'memberid' => $this->currentItem['authorid'],\r
+ 'name' => $this->currentItem['author'],\r
'extra' => $this->linkparams\r
);\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
+ 'itemid' => $this->currentItem['itemid'],\r
+ 'title' => $this->currentItem['title'],\r
+ 'timestamp' => $this->currentItem['timestamp'],\r
'extra' => $this->linkparams\r
);\r
\r
*/\r
public function parse_closed()\r
{\r
- echo $this->currentItem->closed;\r
+ echo $this->currentItem['closed'];\r
return;\r
}\r
\r
*/\r
public function parse_relevance()\r
{\r
- echo round($this->currentItem->score,2);\r
+ echo round($this->currentItem['score'], 2);\r
return;\r
}\r
\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
global $manager;\r
\r
// get karma object\r
- $karma =& $manager->getKarma($this->currentItem->itemid);\r
+ $karma =& $manager->getKarma($this->currentItem['itemid']);\r
\r
switch ( $type )\r
{\r
switch ( $which )\r
{\r
case 'realname':\r
- echo $this->currentItem->authorname;\r
+ echo $this->currentItem['authorname'];\r
break;\r
case 'id':\r
- echo $this->currentItem->authorid;\r
+ echo $this->currentItem['authorid'];\r
break;\r
case 'email':\r
- echo $this->currentItem->authormail;\r
+ echo $this->currentItem['authormail'];\r
break;\r
case 'url':\r
- echo $this->currentItem->authorurl;\r
+ echo $this->currentItem['authorurl'];\r
break;\r
case 'name':\r
default:\r
- echo $this->currentItem->author;\r
+ echo $this->currentItem['author'];\r
}\r
return;\r
}\r
*/\r
public function parse_smartbody()\r
{\r
- if ( !$this->currentItem->more )\r
+ if ( !$this->currentItem['more'] )\r
{\r
- $this->highlightAndParse($this->currentItem->body);\r
+ $this->highlightAndParse($this->currentItem['body']);\r
}\r
else\r
{\r
- $this->highlightAndParse($this->currentItem->more);\r
+ $this->highlightAndParse($this->currentItem['more']);\r
}\r
return;\r
}\r
*/\r
public function parse_morelink()\r
{\r
- if ( $this->currentItem->more )\r
+ if ( $this->currentItem['more'] )\r
{\r
$this->parser->parse($this->template['MORELINK']);\r
}\r
$offset = $this->blog->getTimeOffset() * 3600;\r
}\r
\r
- echo i18n::formatted_datetime($format, $this->currentItem->timestamp, $offset);\r
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp'], $offset);\r
return;\r
}\r
\r
{\r
$format = $this->template['FORMAT_TIME'];\r
}\r
- echo i18n::formatted_datetime($format, $this->currentItem->timestamp);\r
+ echo i18n::formatted_datetime($format, $this->currentItem['timestamp']);\r
return;\r
}\r
\r
* @return string syndicated title\r
*/\r
public function parse_syndicate_title($maxLength = 100) {\r
- $syndicated = strip_tags($this->currentItem->title);\r
+ $syndicated = strip_tags($this->currentItem['title']);\r
echo Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
}\r
\r
*/\r
public function parse_syndicate_description($maxLength = 250, $addHighlight = 0)\r
{\r
- $syndicated = strip_tags($this->currentItem->body);\r
+ $syndicated = strip_tags($this->currentItem['body']);\r
if ( $addHighlight )\r
{\r
$tmp_highlight = Entity::hsc(Entity::shorten($syndicated,$maxLength,'...'));\r
public function parse_karmaposlink($text = '')\r
{\r
global $CONF;\r
- $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem->itemid;\r
+ $link = $CONF['ActionURL'] . '?action=votepositive&itemid=' . $this->currentItem['itemid'];\r
if ( !$text )\r
{\r
echo '<a href="'.$link.'">' . $text . '</a>';\r
public function parse_karmaneglink($text = '')\r
{\r
global $CONF;\r
- $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem->itemid;\r
+ $link = $CONF['ActionURL'] . '?action=votenegative&itemid='.$this->currentItem['itemid'];\r
\r
if ( !$text )\r
{\r
*/\r
public function parse_new()\r
{\r
- if ( ($this->lastVisit != 0) && ($this->currentItem->timestamp > $this->lastVisit) )\r
+ if ( ($this->lastVisit != 0) && ($this->currentItem['timestamp'] > $this->lastVisit) )\r
{\r
echo $this->template['NEW'];\r
}\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
+ echo Link::create_archive_link($this->blog->getID(), i18n::formatted_datetime('%Y-%m-%d', $this->currentItem['timestamp']), $this->linkparams);\r
return;\r
}\r
\r
// add comments\r
if ( $this->showComments && $this->blog->commentsEnabled() )\r
{\r
- $comments = new Comments($this->currentItem->itemid);\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
+ $comments->showComments($this->template, $maxToShow, $this->currentItem['closed'] ? 0 : 1, $this->strHighlight);\r
}\r
return;\r
}\r
public function parse_edit()\r
{\r
global $member, $CONF;\r
- if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem->authorid)) )\r
+ if ( $this->allowEditAll || ($member->isLoggedIn() && ($member->getID() == $this->currentItem['authorid'])) )\r
{\r
$this->parser->parse($this->template['EDITLINK']);\r
}\r
public function parse_editlink()\r
{\r
global $CONF;\r
- echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem->itemid;\r
+ echo $CONF['AdminURL'] . 'bookmarklet.php?action=edit&itemid=' . $this->currentItem['itemid'];\r
return;\r
}\r
\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
+ $handler = new BodyActions($this->blog);
+ $handler->setTemplate($this->template);
+ $handler->setHighlight($this->strHighlight);
+ $handler->setCurrentItem($this->currentItem);
+ \r
+ $parser = new Parser($handler);\r
+ $parser->parse($handler->highlight($data));
return;\r
}\r
\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
+ $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);\r
+ $t_blog =& $manager->getBlog($item['blogid']);\r
+ $condition = ($t_blog && ($t_blog->getSetting($name) == $value));\r
break;\r
case 'loggedin':\r
$condition = $member->isLoggedIn();\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
+ 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
+ if ( $value == strtolower($this->currentItem['author']) )\r
{\r
return TRUE;\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
+ $i_author =& $manager->getMember($this->currentItem['authorid']);\r
+ if ( $i_author->isAdmin() )\r
{\r
return TRUE;\r
}\r
- return (boolean) $amember->isBlogAdmin($blogid);\r
+ return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);\r
}\r
\r
return FALSE;\r
{\r
global $catid, $manager;\r
\r
- $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem->itemid));\r
+ $blog =& $manager->getBlog($this->currentItem['blogid']);\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
+ return (boolean) $blog->isValidCategory($catid);\r
}\r
\r
- $icatid = $this->currentItem->catid;\r
+ $icatid = $this->currentItem['catid'];\r
\r
// check category name\r
if ( $key == 'catname' )\r
{\r
- $value = $b->getCategoryIdFromName($value);\r
+ $value = $blog->getCategoryIdFromName($value);\r
if ( $value == $icatid )\r
{\r
- return (boolean) $b->isValidCategory($icatid);\r
+ return (boolean) $blog->isValidCategory($icatid);\r
}\r
}\r
\r
// check category id\r
if ( ($key == 'catid') && ($value == $icatid) )\r
{\r
- return (boolean) $b->isValidCategory($icatid);\r
+ return (boolean) $blog->isValidCategory($icatid);\r
}\r
return FALSE;\r
}\r