Source for file image.php

Documentation is available at image.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Plugin
  4.  * @subpackage  Editors-xtd.image
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Editor Image buton
  14.  *
  15.  * @package     Joomla.Plugin
  16.  * @subpackage  Editors-xtd.image
  17.  * @since       1.5
  18.  */
  19. class PlgButtonImage extends JPlugin
  20. {
  21.     /**
  22.      * Load the language file on instantiation.
  23.      *
  24.      * @var    boolean 
  25.      * @since  3.1
  26.      */
  27.     protected $autoloadLanguage = true;
  28.  
  29.     /**
  30.      * Display the button
  31.      *
  32.      * @param   string  $name  The name of the button to display
  33.      * @param   string  $asset 
  34.      * @param   string  $author 
  35.      *
  36.      * @return array A two element array of (imageName, textToInsert)
  37.      */
  38.     public function onDisplay($name$asset$author)
  39.     {
  40.         $app JFactory::getApplication();
  41.         $user JFactory::getUser();
  42.         $extension $app->input->get('option');
  43.  
  44.         if ($asset == '')
  45.         {
  46.             $asset $extension;
  47.         }
  48.  
  49.         if (    $user->authorise('core.edit'$asset)
  50.             ||    $user->authorise('core.create'$asset)
  51.             ||    (count($user->getAuthorisedCategories($asset'core.create')) 0)
  52.             ||    ($user->authorise('core.edit.own'$asset&& $author == $user->id)
  53.             ||    (count($user->getAuthorisedCategories($extension'core.edit')) 0)
  54.             ||    (count($user->getAuthorisedCategories($extension'core.edit.own')) && $author == $user->id))
  55.         {
  56.             $link 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name=' $name '&amp;asset=' $asset '&amp;author=' $author;
  57.             JHtml::_('behavior.modal');
  58.             $button new JObject;
  59.             $button->modal true;
  60.             $button->class 'btn';
  61.             $button->link $link;
  62.             $button->text JText::_('PLG_IMAGE_BUTTON_IMAGE');
  63.             $button->name 'picture';
  64.             $button->options "{handler: 'iframe', size: {x: 800, y: 500}}";
  65.  
  66.             return $button;
  67.         }
  68.         else
  69.         {
  70.             return false;
  71.         }
  72.     }
  73. }

Documentation generated on Tue, 19 Nov 2013 15:05:13 +0100 by phpDocumentor 1.4.3