Files
2024-12-17 17:34:10 +01:00

99 lines
2.9 KiB
PHP

<?php
/**
* @version 6.2.6 tabulizer $
* @package tabulizer
* @copyright Copyright © 2011 - All rights reserved.
* @license GNU/GPL
* @author Dimitrios Mourloukos
* @author mail info@alterora.gr
* @website www.tabulizer.com
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport( 'joomla.plugin.plugin' );
if(!defined('DS')){define('DS',DIRECTORY_SEPARATOR);}
class plgButtonTabulizerds extends JPlugin
{
/**
* Constructor
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
}
public function onDisplay($name)
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$template = $app->getTemplate();
require_once(JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_tabulizer'.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.'common'.DIRECTORY_SEPARATOR.'helper.php');
$no_use_permissions = (TabulizerPermissions::isAllowed('ruleset-use'))?0:1;
$no_use_permissions_warning_msg = TabulizerString::makeHTMLSafe(JText::_('PLG_TABULIZER_RULESET_USE_PERMISSION_INVALID'));
$popup_url = JURI::base() . 'index.php?option=com_tabulizer&task=dsselect&tmpl=component';
$tinymce_warning_msg = JText::_('PLG_TABULIZER_INVALID_EDITOR');
$js = "
function tabulizerdsClickCallback( editor, result )
{
if( result ) {
jInsertEditorText( result, editor );
}
}
function tabulizerdsOpenDialog( editor )
{
if ($no_use_permissions) {
alert('{$no_use_permissions_warning_msg}');
return;
}
var durl = '{$popup_url}&clb_name=' + editor;
var wnd = window.open( durl, '_blank', 'status=no,resizable=yes,width=520,height=180,left=50,top=50' );
wnd.focus();
return wnd;
}
";
$doc->addScriptDeclaration($js);
if(version_compare(JVERSION,'1.6.0','ge')) {
// Joomla! 1.6 code here
$plugin_dir = 'plugins/editors-xtd/tabulizer/tabulizer';
} else {
// Joomla! 1.5 code here
$plugin_dir = 'plugins/editors-xtd/tabulizer';
}
$css = " .button2-left .Tabulizerds { background: url(../{$plugin_dir}/images/tabulizerds_button.png) 100% 0 no-repeat; } \n";
$css .= " .icon-Tabulizerds { background: url(../{$plugin_dir}/images/tabulizerds_button_j3.png) 100% 0 no-repeat; } \n";
$doc->addStyleDeclaration($css);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'tabulizerdsOpenDialog(\''.$name.'\'); return false;');
$button->set('text', JText::_('PLG_TABULIZERDS_BUTTON_LABEL'));
$button->set('name', 'Tabulizerds');
$button->set('link', '#');
if(version_compare(JVERSION,'3.1.0','ge')) {
$button->set('class','btn');
}
return $button;
}
}
?>