BaseActions(); } function setCurrentItem(&$item) { $this->currentItem =& $item; } function setTemplate($template) { $this->template =& $template; } function getDefinedActions() { return array('image', 'media', 'popup', 'plugin'); } function parse_plugin($pluginName) { global $manager; // only continue when the plugin is really installed if (!$manager->pluginInstalled('NP_' . $pluginName)) { return; } $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) $params = array_merge(array(&$this->currentItem),$params); call_user_func_array(array(&$plugin,'doItemVar'), $params); } function parse_image() { // image/popup calls have arguments separated by | $args = func_get_args(); $args = explode('|',implode($args,', ')); call_user_func_array(array(&$this,'createImageCode'),$args); } function createImageCode($filename, $width, $height, $text = '') { global $CONF; // select private collection when no collection given if (!strstr($filename,'/')) { $filename = $this->currentItem->authorid . '/' . $filename; } $windowwidth = $width; $windowheight = $height; $vars['link'] = htmlspecialchars($CONF['MediaURL']. $filename ,ENT_QUOTES); $vars['text'] = htmlspecialchars($text ,ENT_QUOTES); $vars['image'] = '' . $vars['text'] . ''; $vars['width'] = $width; $vars['height'] = $height; $vars['media'] = '' . $vars['text'] . ''; echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);; } function parse_media() { // image/popup calls have arguments separated by | $args = func_get_args(); $args = explode('|',implode($args,', ')); call_user_func_array(array(&$this,'createMediaCode'),$args); } function createMediaCode($filename, $text = '') { global $CONF; // select private collection when no collection given if (!strstr($filename,'/')) { $filename = $this->currentItem->authorid . '/' . $filename; } $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename ,ENT_QUOTES); $vars['text'] = htmlspecialchars($text ,ENT_QUOTES); $vars['media'] = '' . $vars['text'] . ''; echo TEMPLATE::fill($this->template['MEDIA_CODE'],$vars);; } function parse_popup() { // image/popup calls have arguments separated by | $args = func_get_args(); $args = explode('|',implode($args,', ')); call_user_func_array(array(&$this,'createPopupCode'),$args); } function createPopupCode($filename, $width, $height, $text = '') { global $CONF; // select private collection when no collection given if (!strstr($filename,'/')) { $filename = $this->currentItem->authorid . '/' . $filename; } $windowwidth = $width; $windowheight = $height; $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename,ENT_QUOTES) . "&width=$width&height=$height&imagetext=" . urlencode(htmlspecialchars($text)); $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;"; $vars['popuptext'] = htmlspecialchars($text,ENT_QUOTES); $vars['popuplink'] = '' . $vars['popuptext'] . ''; $vars['width'] = $width; $vars['height'] = $height; $vars['text'] = $text; $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename ,ENT_QUOTES); $vars['media'] = '' . $vars['popuptext'] . ''; echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars); } } ?>