PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/editors-xtd/image/image.php

https://github.com/joebushi/joomla
PHP | 63 lines | 27 code | 10 blank | 26 comment | 1 complexity | fa30592deed3f2fec68eaf757150f6d4 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package Joomla
  5. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  6. * @license GNU General Public License version 2 or later; see LICENSE.txt
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. jimport('joomla.plugin.plugin');
  11. /**
  12. * Editor Image buton
  13. *
  14. * @package Editors-xtd
  15. * @since 1.5
  16. */
  17. class plgButtonImage extends JPlugin
  18. {
  19. /**
  20. * Display the button
  21. *
  22. * @return array A two element array of (imageName, textToInsert)
  23. */
  24. function onDisplay($name)
  25. {
  26. $app = &JFactory::getApplication();
  27. $params = &JComponentHelper::getParams('com_media');
  28. $ranks = array('publisher', 'editor', 'author', 'registered');
  29. $acl = & JFactory::getACL();
  30. // TODO: Fix this ACL call
  31. //for($i = 0; $i < $params->get('allowed_media_usergroup', 3); $i++)
  32. //{
  33. // $acl->addACL('com_media', 'popup', 'users', $ranks[$i]);
  34. //}
  35. // TODO: Fix this ACL call
  36. //Make sure the user is authorized to view this page
  37. $user = & JFactory::getUser();
  38. if (!$user->authorize('com_media.popup')) {
  39. //return;
  40. }
  41. $doc = &JFactory::getDocument();
  42. $template = $app->getTemplate();
  43. $link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name='.$name;
  44. JHtml::_('behavior.modal');
  45. $button = new JObject;
  46. $button->set('modal', true);
  47. $button->set('link', $link);
  48. $button->set('text', JText::_('Image'));
  49. $button->set('name', 'image');
  50. $button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
  51. return $button;
  52. }
  53. }