<?php
/**
* $Id: config.php 72 2009-06-03 18:13:26Z happynoodleboy $
* @package      JCE
* @copyright    Copyright (C) 2005 - 2009 Ryan Demmer. All rights reserved.
* @author		Ryan Demmer
* @license      GNU/GPL
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
class AdvcodeConfig 
{
	function getConfig(&$vars) {
		$document 	=& JFactory::getDocument();
		$jce 		=& JContentEditor::getInstance();
		
		$toggle 	= $jce->getEditorParam('editor_toggle', 1);
		$state 		= $jce->getEditorParam('editor_state', 1);
		$text		= htmlspecialchars($jce->getEditorParam('editor_toggle_text', '[show/hide]'));
		
		// legacy issue?
		if ($state == 1 || strpos($state, 'mceEditor') !== false) {
			$state = 1;
		} else {
			$state = 0;
		}

		$document->addScript(JURI::root(true) . '/plugins/editors/jce/tiny_mce/plugins/advcode/js/toggle.js?version='. $jce->getVersion());
		$vars['onpageload'] = "function(){AdvCode.init('". $text ."', ".$state .", ". $toggle .");}";
	}
}
?>