/plugins/editors-xtd/image/image.php
PHP | 63 lines | 27 code | 10 blank | 26 comment | 1 complexity | fa30592deed3f2fec68eaf757150f6d4 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
- <?php
- /**
- * @version $Id$
- * @package Joomla
- * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
- // no direct access
- defined('_JEXEC') or die;
- jimport('joomla.plugin.plugin');
- /**
- * Editor Image buton
- *
- * @package Editors-xtd
- * @since 1.5
- */
- class plgButtonImage extends JPlugin
- {
- /**
- * Display the button
- *
- * @return array A two element array of (imageName, textToInsert)
- */
- function onDisplay($name)
- {
- $app = &JFactory::getApplication();
- $params = &JComponentHelper::getParams('com_media');
- $ranks = array('publisher', 'editor', 'author', 'registered');
- $acl = & JFactory::getACL();
- // TODO: Fix this ACL call
- //for($i = 0; $i < $params->get('allowed_media_usergroup', 3); $i++)
- //{
- // $acl->addACL('com_media', 'popup', 'users', $ranks[$i]);
- //}
- // TODO: Fix this ACL call
- //Make sure the user is authorized to view this page
- $user = & JFactory::getUser();
- if (!$user->authorize('com_media.popup')) {
- //return;
- }
- $doc = &JFactory::getDocument();
- $template = $app->getTemplate();
- $link = 'index.php?option=com_media&view=images&tmpl=component&e_name='.$name;
- JHtml::_('behavior.modal');
- $button = new JObject;
- $button->set('modal', true);
- $button->set('link', $link);
- $button->set('text', JText::_('Image'));
- $button->set('name', 'image');
- $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
- return $button;
- }
- }