| [ Index ] |
PHP Cross Reference of Nucleus CMS 3.32 |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 5 * Copyright (C) 2002-2007 The Nucleus Group 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * (see nucleus/documentation/index.html#license for more info) 12 */ 13 /** 14 * A class to parses plugin calls inside items 15 * 16 * @license http://nucleuscms.org/license.txt GNU General Public License 17 * @copyright Copyright (C) 2002-2007 The Nucleus Group 18 * @version $Id: BODYACTIONS.php 1147 2007-05-11 08:26:02Z kimitake $ 19 */ 20 21 class BODYACTIONS extends BaseActions { 22 23 var $currentItem; 24 25 var $template; 26 27 function BODYACTIONS () { 28 $this->BaseActions(); 29 } 30 31 function setCurrentItem(&$item) { 32 $this->currentItem =& $item; 33 } 34 35 function setTemplate($template) { 36 $this->template =& $template; 37 } 38 39 function getDefinedActions() { 40 return array('image', 'media', 'popup', 'plugin'); 41 } 42 43 function parse_plugin($pluginName) { 44 global $manager; 45 46 // only continue when the plugin is really installed 47 if (!$manager->pluginInstalled('NP_' . $pluginName)) { 48 return; 49 } 50 51 $plugin =& $manager->getPlugin('NP_' . $pluginName); 52 if (!$plugin) return; 53 54 // get arguments 55 $params = func_get_args(); 56 57 // remove plugin name 58 array_shift($params); 59 60 // add item reference (array_unshift didn't work) 61 $params = array_merge(array(&$this->currentItem),$params); 62 63 call_user_func_array(array(&$plugin,'doItemVar'), $params); 64 } 65 66 function parse_image() { 67 // image/popup calls have arguments separated by | 68 $args = func_get_args(); 69 $args = explode('|',implode($args,', ')); 70 call_user_func_array(array(&$this,'createImageCode'),$args); 71 } 72 73 function createImageCode($filename, $width, $height, $text = '') { 74 global $CONF; 75 76 // select private collection when no collection given 77 if (!strstr($filename,'/')) { 78 $filename = $this->currentItem->authorid . '/' . $filename; 79 } 80 81 $windowwidth = $width; 82 $windowheight = $height; 83 84 $vars['link'] = htmlspecialchars($CONF['MediaURL']. $filename ,ENT_QUOTES); 85 $vars['text'] = htmlspecialchars($text ,ENT_QUOTES); 86 $vars['image'] = '<img src="' . $vars['link'] . '" width="' . $width . '" height="' . $height . '" alt="' . $vars['text'] . '" title="' . $vars['text'] . '" />'; 87 $vars['width'] = $width; 88 $vars['height'] = $height; 89 $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>'; 90 91 92 echo TEMPLATE::fill($this->template['IMAGE_CODE'],$vars);; 93 94 } 95 96 function parse_media() { 97 // image/popup calls have arguments separated by | 98 $args = func_get_args(); 99 $args = explode('|',implode($args,', ')); 100 call_user_func_array(array(&$this,'createMediaCode'),$args); 101 } 102 103 function createMediaCode($filename, $text = '') { 104 global $CONF; 105 106 // select private collection when no collection given 107 if (!strstr($filename,'/')) { 108 $filename = $this->currentItem->authorid . '/' . $filename; 109 } 110 111 $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename ,ENT_QUOTES); 112 $vars['text'] = htmlspecialchars($text ,ENT_QUOTES); 113 $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['text'] . '</a>'; 114 115 echo TEMPLATE::fill($this->template['MEDIA_CODE'],$vars);; 116 } 117 118 119 function parse_popup() { 120 // image/popup calls have arguments separated by | 121 $args = func_get_args(); 122 $args = explode('|',implode($args,', ')); 123 call_user_func_array(array(&$this,'createPopupCode'),$args); 124 } 125 126 function createPopupCode($filename, $width, $height, $text = '') { 127 global $CONF; 128 129 // select private collection when no collection given 130 if (!strstr($filename,'/')) { 131 $filename = $this->currentItem->authorid . '/' . $filename; 132 } 133 134 $windowwidth = $width; 135 $windowheight = $height; 136 137 $vars['rawpopuplink'] = $CONF['Self'] . "?imagepopup=" . htmlspecialchars($filename,ENT_QUOTES) . "&width=$width&height=$height&imagetext=" . urlencode(htmlspecialchars($text)); 138 $vars['popupcode'] = "window.open(this.href,'imagepopup','status=no,toolbar=no,scrollbars=no,resizable=yes,width=$windowwidth,height=$windowheight');return false;"; 139 $vars['popuptext'] = htmlspecialchars($text,ENT_QUOTES); 140 $vars['popuplink'] = '<a href="' . $vars['rawpopuplink']. '" onclick="'. $vars['popupcode'].'" >' . $vars['popuptext'] . '</a>'; 141 $vars['width'] = $width; 142 $vars['height'] = $height; 143 $vars['text'] = $text; 144 $vars['link'] = htmlspecialchars($CONF['MediaURL'] . $filename ,ENT_QUOTES); 145 $vars['media'] = '<a href="' . $vars['link'] . '">' . $vars['popuptext'] . '</a>'; 146 147 echo TEMPLATE::fill($this->template['POPUP_CODE'],$vars); 148 } 149 150 } 151 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Feb 12 15:34:36 2008 | Cross-referenced by PHPXref 0.7 |