| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: image.php 21069 2011-04-03 22:58:48Z dextercowley $ 4 * @package Joomla 5 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 6 * @license GNU/GPL, see LICENSE.php 7 * Joomla! is free software. This version may have been modified pursuant 8 * to the GNU General Public License, and as distributed it includes or 9 * is derivative of works licensed under the GNU General Public License or 10 * other free or open source software licenses. 11 * See COPYRIGHT.php for copyright notices and details. 12 */ 13 14 // no direct access 15 defined( '_JEXEC' ) or die( 'Restricted access' ); 16 17 jimport( 'joomla.plugin.plugin' ); 18 19 /** 20 * Editor Image buton 21 * 22 * @package Editors-xtd 23 * @since 1.5 24 */ 25 class plgButtonImage extends JPlugin 26 { 27 /** 28 * Constructor 29 * 30 * For php4 compatability we must not use the __constructor as a constructor for plugins 31 * because func_get_args ( void ) returns a copy of all passed arguments NOT references. 32 * This causes problems with cross-referencing necessary for the observer design pattern. 33 * 34 * @param object $subject The object to observe 35 * @param array $config An array that holds the plugin configuration 36 * @since 1.5 37 */ 38 function plgButtonImage(& $subject, $config) 39 { 40 parent::__construct($subject, $config); 41 } 42 43 /** 44 * Display the button 45 * 46 * @return array A two element array of ( imageName, textToInsert ) 47 */ 48 function onDisplay($name) 49 { 50 global $mainframe; 51 $params =& JComponentHelper::getParams('com_media'); 52 //Find out who has permission to upload and change the acl to let them. 53 $acl = & JFactory::getACL(); 54 switch ($params->get('allowed_media_usergroup')) 55 { 56 case '1': 57 $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); 58 break; 59 case '2': 60 $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); 61 $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); 62 break; 63 case '3': 64 $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); 65 $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); 66 $acl->addACL( 'com_media', 'upload', 'users', 'author' ); 67 break; 68 case '4': 69 $acl->addACL( 'com_media', 'upload', 'users', 'publisher' ); 70 $acl->addACL( 'com_media', 'upload', 'users', 'editor' ); 71 $acl->addACL( 'com_media', 'upload', 'users', 'author' ); 72 $acl->addACL( 'com_media', 'upload', 'users', 'registered' ); 73 break; 74 } 75 76 //Make sure the user is authorized to view this page 77 $user = & JFactory::getUser(); 78 if (!$user->authorize( 'com_media', 'popup' )) { 79 return; 80 } 81 $doc =& JFactory::getDocument(); 82 $template = $mainframe->getTemplate(); 83 84 $link = 'index.php?option=com_media&view=images&layout=default&tmpl=component&e_name='.$name; 85 86 JHTML::_('behavior.modal'); 87 88 $button = new JObject(); 89 $button->set('modal', true); 90 $button->set('link', $link); 91 $button->set('text', JText::_('Image')); 92 $button->set('name', 'image'); 93 $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}"); 94 95 return $button; 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |