- md5
- b893c2e2111a88e40d18aac2439c7b03
- sha1
- 10fcb61ea8c3eb49466c96df5c4619b471f39b15
- sha256
- 97a8422955254e22ac1b906e18f88ddc2fa74c62f87f792a7f29bc9887d1e8da
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.pagebreak
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Object\CMSObject;
/**
* Editor Pagebreak buton
*
* @since 1.5
*/
class PlgButtonPagebreak extends CMSPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Display the button
*
* @param string $name The name of the button to add
*
* @return CMSObject The button options as JObject
*
* @since 1.5
*/
public function onDisplay($name)
{
$user = Factory::getUser();
// Can create in any category (component permission) or at least in one category
$canCreateRecords = $user->authorise('core.create', 'com_content')
|| count($user->getAuthorisedCategories('com_content', 'core.create')) > 0;
// Instead of checking edit on all records, we can use **same** check as the form editing view
$values = (array) Factory::getApplication()->getUserState('com_content.edit.article.id');
$isEditingRecords = count($values);
// This ACL check is probably a double-check (form view already performed checks)
$hasAccess = $canCreateRecords || $isEditingRecords;
if (!$hasAccess)
{
return;
}
Factory::getDocument()->addScriptOptions('xtd-pagebreak', array('editor' => $name));
$link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name;
$button = new CMSObject;
$button->modal = true;
$button->link = $link;
$button->text = Text::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK');
$button->name = 'copy';
$button->options = [
'height' => '200px',
'width' => '400px',
'bodyHeight' => '70',
'modalWidth' => '80',
];
return $button;
}
}
No other release has this exact content. See every version of this file.