101 lines
3.0 KiB
PHP
101 lines
3.0 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 plgButtonTabulizer extends JPlugin
|
|
{
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct(& $subject, $config)
|
|
{
|
|
parent::__construct($subject, $config);
|
|
$this->loadLanguage();
|
|
}
|
|
|
|
public function onDisplay($name, $asset = null, $author = null)
|
|
{
|
|
$app = JFactory::getApplication();
|
|
|
|
$doc = JFactory::getDocument();
|
|
$template = $app->getTemplate();
|
|
|
|
$tabulizer_directive_add_comments = 0;
|
|
|
|
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=dialog&tmpl=component&use_comments='.$tabulizer_directive_add_comments;
|
|
|
|
$tinymce_warning_msg = JText::_('PLG_TABULIZER_INVALID_EDITOR');
|
|
|
|
$js = "
|
|
function tabulizerClickCallback( editor, result )
|
|
{
|
|
if( result ) {
|
|
jInsertEditorText( result, editor );
|
|
}
|
|
}
|
|
|
|
function tabulizerOpenDialog( 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,scrollbars=1,width=720,height=710,left=50,top=20' );
|
|
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 .Tabulizer { background: url(../{$plugin_dir}/images/tabulizer_button.png) 100% 0 no-repeat; } \n";
|
|
$css .= " .icon-Tabulizer { background: url(../{$plugin_dir}/images/tabulizer_button_j3.png) 100% 0 no-repeat; } \n";
|
|
|
|
$doc->addStyleDeclaration($css);
|
|
|
|
$button = new JObject();
|
|
$button->set('modal', false);
|
|
$button->set('onclick', 'tabulizerOpenDialog(\''.$name.'\'); return false;');
|
|
$button->set('text', JText::_('PLG_TABULIZER_BUTTON_LABEL'));
|
|
$button->set('name', 'Tabulizer');
|
|
$button->set('link', '#');
|
|
if(version_compare(JVERSION,'3.1.0','ge')) {
|
|
$button->set('class','btn');
|
|
}
|
|
|
|
return $button;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|