Your IP : 216.73.217.53


Current Path : /home/bonneesp/www/plugins/editors-xtd/tabulizer/
Upload File :
Current File : /home/bonneesp/www/plugins/editors-xtd/tabulizer/tabulizer.php

<?php
/**
 * @version		6.5.0 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();

        $name = (empty($name))?'jform_articletext':$name;
				
		$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 ) {
				if (typeof jInsertEditorText === 'function') {
				    // Joomla 3
					jInsertEditorText(result, editor);
				} else {
					// Joomla 4
					Joomla.editors.instances.{$name}.replaceSelection(result);
				}
			  }
			}
			
			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 !important; margin-right: 3px !important; } \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;
	}
	
}

?>