Beispiel #1
0
 /**
  * Display method
  *
  * @param   string  $tpl  The template name
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->translationTable = RedcoreHelpersTranslation::getTranslationTable();
     $this->contentElement = RTranslationHelper::getContentElement($this->translationTable->option, $this->translationTable->xml);
     $this->item = $this->get('Item');
     $editor = JFactory::getConfig()->get('editor');
     $this->editor = JEditor::getInstance($editor);
     $this->columns = array();
     $this->noTranslationColumns = array();
     $tableColumns = (array) $this->translationTable->columns;
     $this->fieldsXml = $this->contentElement->getTranslateFields();
     foreach ($this->fieldsXml as $field) {
         foreach ($tableColumns as $column) {
             if ($column == (string) $field['name']) {
                 $attributes = current($field->attributes());
                 $attributes['titleLabel'] = (string) $field;
                 $this->columns[$column] = $attributes;
                 break;
             }
         }
         if ((string) $field['translate'] == '0' && (string) $field['type'] != 'referenceid') {
             $attributes = current($field->attributes());
             $attributes['titleLabel'] = (string) $field;
             $this->noTranslationColumns[(string) $field['name']] = $attributes;
         }
     }
     // Check if option is enabled
     if (RBootstrap::getConfig('enable_translations', 0) == 0) {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_REDCORE_CONFIG_TRANSLATIONS_PLUGIN_LABEL_WARNING', '<a href="index.php?option=com_plugins&view=plugins&filter_search=redcore">' . JText::_('COM_REDCORE_CONFIGURE') . '</a>'), 'error');
     }
     parent::display($tpl);
 }
Beispiel #2
0
 public function __construct($editor = 'none')
 {
     $this->type = $editor;
     if (!$this->isCommunityEditor()) {
         parent::__construct($this->type);
     } else {
         $this->setEditor();
     }
 }
Beispiel #3
0
 /**
  * @param    string    The control name
  * @param    string    The contents of the text area
  * @param    string    The width of the text area (px or %)
  * @param    string    The height of the text area (px or %)
  * @param    boolean    True and the editor buttons will be displayed
  * @param    array    Associative array of editor parameters
  * @return string
  */
 public function display($name, $html, $width, $height, $buttons, $params)
 {
     if (SPRequest::cmd('format') != 'raw') {
         // public function display($name, $html, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array())
         $editor = JEditor::getInstance(JFactory::getConfig()->get('editor'));
         //			JFactory::getEditor()->display( $name, $html, $width, $height, '75', '20', $buttons, $params );
         return $editor->display($name, $html, $width, $height, 75, 20, $buttons, null, null, null, $params);
     }
 }
 public function init()
 {
     if (is_a($this['system']->document, 'JDocumentRAW')) {
         return;
     }
     $editor = JFactory::getConfig()->getValue('config.editor');
     if (in_array(strtolower($editor), array('tinymce', 'jce'))) {
         JEditor::getInstance($editor)->_loadEditor();
     }
 }
Beispiel #5
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db = JFactory::getDBO();
     $uri = JFactory::getURI();
     // Get data from the model
     $lists = $this->_model->_lists;
     $this->addToolbar($this->_model->_mode);
     $editor = JEditor::getInstance();
     $this->assignRef('editor', $editor);
     $this->assignRef('lists', $lists);
     require_once dirname(__FILE__) . '/tmpl/default' . ($tpl ? "_" . $tpl : "") . '.php';
 }
    /**
     * Method to get the field input markup.
     *
     * @return  string  The field input markup.
     */
    protected function getInput()
    {
        $editor = \JEditor::getInstance('codemirror');
        $params['linenumbers'] = 1;
        $params['tabmode'] = 'shift';
        $params['width'] = 400;
        $params['height'] = 300;
        $doc = \JFactory::getDocument();
        $doc->addStyleDeclaration(<<<CSS
.CodeMirror
{
\tw/idth: 700px;
\theight: 400px;
}
CSS
);
        $output = $editor->display($this->name, $this->value, '400px', '400px', 400, 400, false, null, null, null, $params);
        $output = "<fieldset class=\"adminform\"><div style=\"height: 400px; margin-bottom: 30px;\">{$output}</div></fieldset>";
        return $output;
    }
    /**
     * Method to get the field input markup.
     *
     * @return  string  The field input markup.
     */
    protected function getInput()
    {
        $plugin = JPluginHelper::isEnabled('system', 'ezset');
        if (!$plugin) {
            return print_r($plugin, 1) . '需要先啟動外掛!';
        }
        $this->loadScript();
        $editor = \JEditor::getInstance('codemirror');
        $client = \Windwalker\Helper\XmlHelper::get($this->element, 'client', 'site');
        $content = $this->getContent($client);
        $params['linenumbers'] = 1;
        $params['tabmode'] = 'shift';
        $params['width'] = 400;
        $params['height'] = 300;
        $params['syntax'] = 'css';
        $doc = \JFactory::getDocument();
        $doc->addStyleDeclaration(<<<CSS
.custom-css-field .CodeMirror
{
\tw/idth: 700px;
\theight: 400px;
}
CSS
);
        $save = JText::_('PLG_SYSTEM_EZSET_SAVE');
        $output = $editor->display($this->name, $content, '400px', '400px', 400, 400, false, null, null, null, $params);
        $output = <<<HTML
<fieldset class="adminform custom-css-field">
\t<div style="margin-bottom: 25px;" class="custom-css-toolbar">
\t\t<button class="btn btn-default" type="button" data-client="{$client}"
\t\t\tonclick="EzsetCustomCSS.save('#{$this->id}', '{$this->name}', this, event);"><i class="icon-save"></i> {$save}</button>
\t</div>
\t<div style="height: 400px; margin-bottom: 30px;">{$output}</div>
</fieldset>
HTML;
        return $output;
    }
Beispiel #8
0
 /**
  * Append JS code for form submit
  *
  * @param   array &$script       Scripts
  * @param   int   $listId        List id
  * @param   array $aWYSIWYGNames WYSIWYG editor names
  *
  * @since   3.1b
  * @return  void
  */
 protected function _addJavascriptSumbit(&$script, $listId, $aWYSIWYGNames)
 {
     $script[] = "\tfunction submit_form() {";
     if (!empty($aWYSIWYGNames)) {
         jimport('joomla.html.editor');
         $editor = JEditor::getInstance($this->config->get('editor'));
         $script[] = $editor->save('label');
         foreach ($aWYSIWYGNames as $parsedName) {
             $script[] = $editor->save($parsedName);
         }
     }
     $script[] = "\treturn false;";
     $script[] = "}";
     $script[] = "function submitbutton(button) {";
     $script[] = "\tif (button==\"cancel\") {";
     $script[] = "\t\tdocument.location = '" . JRoute::_('index.php?option=com_' . $this->package . '&task=viewTable&cid=' . $listId) . "';";
     $script[] = "\t}";
     $script[] = "\tif (button == \"cancelShowForm\") {";
     $script[] = "\t\treturn false;";
     $script[] = "\t}";
     $script[] = "}";
 }
Beispiel #9
0
 /**
  * Method to get a JEditor object based on the form field.
  *
  * @return  JEditor  The JEditor object.
  *
  * @since   1.6
  */
 protected function getEditor()
 {
     // Only create the editor if it is not already created.
     if (empty($this->editor)) {
         $editor = null;
         if ($this->editorType) {
             // Get the list of editor types.
             $types = $this->editorType;
             // Get the database object.
             $db = JFactory::getDbo();
             // Iterate over teh types looking for an existing editor.
             foreach ($types as $element) {
                 // Build the query.
                 $query = $db->getQuery(true)->select('element')->from('#__extensions')->where('element = ' . $db->quote($element))->where('folder = ' . $db->quote('editors'))->where('enabled = 1');
                 // Check of the editor exists.
                 $db->setQuery($query, 0, 1);
                 $editor = $db->loadResult();
                 // If an editor was found stop looking.
                 if ($editor) {
                     break;
                 }
             }
         }
         // Create the JEditor instance based on the given editor.
         if (is_null($editor)) {
             $conf = JFactory::getConfig();
             $editor = $conf->get('editor');
         }
         $this->editor = JEditor::getInstance($editor);
     }
     return $this->editor;
 }
Beispiel #10
0
 public function _loadEditor($config = array())
 {
     return parent::_loadEditor($config);
 }
Beispiel #11
0
						<input class="text_area" type="text" name="tx_id" id="tx_id" size="60" maxlength="255" value="<?php 
echo $this->obj->tx_id;
?>
" />
					</div>
				</div>
    			
								
				<div class="control-group">
					<label class="control-label" for="notes"><?php 
echo JText::_('COM_BOOKPRO_ORDER_NOTES');
?>
					</label>
					<div class="controls">
						<?php 
$editor = JEditor::getInstance();
echo $editor->display('notes', $this->obj->notes, '550', '200', '60', '20', false);
?>
					</div>
				</div>
        
    </div>
   
   	
	<input type="hidden" name="option" value="<?php 
echo OPTION;
?>
"/>
	<input type="hidden" name="controller" value="<?php 
echo CONTROLLER_ORDER;
?>
Beispiel #12
0
 /**
  * Prepare data hook.
  *
  * @return  void
  */
 protected function prepareData()
 {
     parent::prepareData();
     // Load content language
     $lang = JFactory::getLanguage();
     $lang->load('com_content', JPATH_BASE, null, true, true);
     $lang->load('com_menus', JPATH_BASE, null, true, true);
     $data = $this->data;
     $data->params = \Windwalker\System\ExtensionHelper::getParams('com_quickcontent');
     $data->formParams = $this->get('FormParams');
     $data->listParams = $this->buildParamsInput('list');
     $data->blogParams = $this->buildParamsInput('blog');
     $data->articleParams = $this->buildParamsInput('article');
     // Set Editor
     $editor = \JEditor::getInstance($data->params->get('editor', 'tinymce'));
     $params['mode'] = 2;
     $this->editor = $editor->display('jform[content]', $data->item->content, '650px', '500px', 650, 500, false, null, null, null, $params);
 }
Beispiel #13
0
 /**
  * Method to get the field input markup for Access Control Lists.
  * Optionally can be associated with a specific component and section.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  * @todo:   Add access check.
  */
 protected function getInput()
 {
     JHtml::_('bootstrap.tooltip');
     $conf = JFactory::getConfig();
     $editor = $conf->get('editor');
     $jeditor = JEditor::getInstance($editor);
     // Get the available user groups.
     $groups = $this->getEmailGroups();
     // Prepare output
     $html = array();
     // Description
     $html[] = '<p class="alert alert-info">' . JText::_('COM_DIGICOM_SETTINGS_SYSTEM_EMAIL_DESCRIPTION') . '</p>';
     // Begin tabs
     $html[] = '<div id="email_settings-sliders" class="tabbable tabs-left">';
     // Building tab nav
     $html[] = '<ul class="nav nav-pills">';
     foreach ($groups as $group) {
         // Initial Active Tab
         $active = "";
         if ($group->value == 'new_order') {
             $active = "active";
         }
         $html[] = '<li class="' . $active . '">';
         $html[] = '<a href="#email_setting-' . $group->value . '" data-toggle="tab">';
         $html[] = $group->text;
         $html[] = '</a>';
         $html[] = '</li>';
     }
     $html[] = '</ul>';
     $html[] = '<div class="tab-content">';
     // Start a row for each user group.
     foreach ($groups as $group) {
         // Initial Active Pane
         $active = "";
         if ($group->value == 'new_order') {
             $active = " active";
         }
         $html[] = '<div class="tab-pane' . $active . '" id="email_setting-' . $group->value . '">';
         $html[] = '<h3>' . $group->desc . '</h3>';
         //start control group
         $html[] = '<div class="control-group ">';
         $html[] = '<div class="control-label">';
         $html[] = '<label id="jform_subject-lbl" for="jform_subject" title="' . JText::_('COM_DIGICOM_SETTINGS_SYSTEM_EMAIL_SUBJECT_LABEL_DESC') . '">';
         $html[] = JText::_('COM_DIGICOM_SETTINGS_SYSTEM_EMAIL_SUBJECT_LABEL');
         $html[] = '</label>';
         $html[] = '</div>';
         $html[] = '<div class="controls">';
         $html[] = '<input type="text" class="input-xxlarge" value="' . $this->value[$group->value]['subject'] . '" name="' . $this->name . '[' . $group->value . '][subject]" size="60">';
         $html[] = '</div>';
         $html[] = '</div>';
         //end control group
         //start control group
         $html[] = '<div class="control-group ">';
         $html[] = '<div class="control-label">';
         $html[] = '<label id="jform_body-lbl" for="jform_body" title="' . JText::_('COM_DIGICOM_SETTINGS_SYSTEM_EMAIL_BODY_LABEL_DESC') . '">';
         $html[] = JText::_('COM_DIGICOM_SETTINGS_SYSTEM_EMAIL_BODY_LABEL');
         $html[] = '</label>';
         $html[] = '</div>';
         $html[] = '<div class="controls">';
         //$html[] =  '<textarea name="'.$this->name.'['. $group->value .'][body]"></textarea>';
         $bodyname = $this->name . '[' . $group->value . '][body]';
         $bodyvalue = $this->value[$group->value]['body'];
         $html[] = $this->getEditor($bodyname, $bodyvalue, $this->form);
         $html[] = '</div>';
         $html[] = '</div>';
         //end control group
         $html[] = '</div>';
     }
     $html[] = '</div>';
     //end tab content
     $html[] = '</div>';
     //end tab
     $html[] = '<div class="alert">';
     $html[] = JText::_('COM_DIGICOM_SETTINGS_EMAIL_BOTTOM_NOTICE');
     $html[] = '</div>';
     return implode("\n", $html);
 }
Beispiel #14
0
/**
 * Used by the frontend adminsitration to save editor field contents
 *
 * @param string $editor1 the name of the editor field no. 1
 * @param string $editor2 the name of the editor field no. 2
 */
function editorScript($editor1 = '', $editor2 = '')
{
    ?>
	 <script type="text/javascript">
	 function submitbutton(pressbutton) {
	 	var form = document.adminForm;
	 	if (pressbutton == 'cancel') {
	 		submitform( pressbutton );
	 		return;
	 	}
	 	<?php 
    if ($editor1 != '') {
        if (vmIsJoomla(1.5)) {
            jimport('joomla.html.editor');
            $editor = JEditor::getInstance($GLOBALS['mainframe']->getCfg('editor'));
            echo $editor->getContent('editor1');
        } else {
            getEditorContents('editor1', $editor1);
        }
    }
    if ($editor2 != '') {
        if (vmIsJoomla(1.5)) {
            jimport('joomla.html.editor');
            $editor = JEditor::getInstance($GLOBALS['mainframe']->getCfg('editor'));
            echo $editor->getContent('editor2');
        } else {
            getEditorContents('editor2', $editor2);
        }
    }
    ?>
	 	submitform( pressbutton );

	 }
	 </script><?php 
}
Beispiel #15
0
 /**
  * Get an editor object.
  *
  * @param   string  $editor  The editor to load, depends on the editor plugins that are installed
  *
  * @return  JEditor object
  *
  * @since   11.1
  */
 public static function getEditor($editor = null)
 {
     jimport('joomla.html.editor');
     // Get the editor configuration setting
     if (is_null($editor)) {
         $conf = self::getConfig();
         $editor = $conf->get('editor');
     }
     return JEditor::getInstance($editor);
 }
Beispiel #16
0
 /**
  * Get an editor object.
  *
  * @param string $editor The editor to load, depends on the editor plugins that are installed
  *
  * @return JEditor instance of JEditor
  *
  * @since   11.1
  * @deprecated 12.2 CMS developers should use JEditor directly.
  * @note There is no direct replacement in the Joomla Platform.
  */
 public static function getEditor($editor = null)
 {
     JLog::add(__METHOD__ . ' is deprecated. CMS developers should use JEditor directly.', JLog::WARNING, 'deprecated');
     if (!class_exists('JEditor')) {
         throw new BadMethodCallException('JEditor not found');
     }
     JLog::add(__METHOD__ . ' is deprecated. Use JEditor directly.', JLog::WARNING, 'deprecated');
     // Get the editor configuration setting
     if (is_null($editor)) {
         $conf = self::getConfig();
         $editor = $conf->get('editor');
     }
     return JEditor::getInstance($editor);
 }
Beispiel #17
0
    function getHTML()
    {
        JFactory::getApplication()->setUserState('editor.source.syntax', 'php');
        $editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');
        if (empty($editor_plugin)) {
            JFactory::getApplication()->enqueueMessage(JText::sprintf('SRC_ERROR_CODEMIRROR_DISABLED', '<a href="index.php?option=com_plugins&filter_folder=editors&filter_search=codemirror" target="_blank">', '</a>'), 'error');
            return;
        }
        $editor = JEditor::getInstance('codemirror');
        ob_start();
        ?>
		<div class="header">
			<h1 class="page-title">
				<span class="icon-nonumber icon-sourcerer"></span>
				<?php 
        echo JText::_('INSERT_CODE');
        ?>
			</h1>
		</div>

		<div class="subhead">
			<div class="container-fluid">
				<div class="btn-toolbar" id="toolbar">
					<div class="btn-group" id="toolbar-apply">
						<button href="#" onclick="nnSourcererPopup.insertText();window.parent.SqueezeBox.close();" class="btn btn-small btn-success">
							<span class="icon-apply icon-white"></span> <?php 
        echo JText::_('SRC_INSERT');
        ?>
						</button>
					</div>

					<div class="btn-group">
						<button class="btn btn-small hasTip" id="btn-sourcetags" onclick="nnSourcererPopup.toggleSourceTags();return false;" title="<?php 
        echo JText::_('SRC_TOGGLE_SOURCE_TAGS_DESC');
        ?>
">
							<span class="icon-nonumber icon-src-sourcetags"></span> <?php 
        echo JText::_('SRC_TOGGLE_SOURCE_TAGS');
        ?>
						</button>
					</div>

					<div class="btn-group">
						<button class="btn btn-small hasTip" id="btn-tagstyle" onclick="nnSourcererPopup.toggleTagStyle();return false;" title="<?php 
        echo JText::_('SRC_TOGGLE_TAG_STYLE_DESC');
        ?>
">
							<span class="icon-nonumber icon-src-tagstyle"></span> <?php 
        echo JText::_('SRC_TOGGLE_TAG_STYLE');
        ?>
						</button>
					</div>

					<div class="btn-group" id="toolbar-cancel">
						<button href="#" onclick="if(confirm('<?php 
        echo JText::_('NN_ARE_YOU_SURE');
        ?>
')){window.parent.SqueezeBox.close();}" class="btn btn-small">
							<span class="icon-cancel "></span> <?php 
        echo JText::_('JCANCEL');
        ?>
						</button>
					</div>

					<?php 
        if (JFactory::getApplication()->isAdmin() && JFactory::getUser()->authorise('core.admin', 1)) {
            ?>
						<div class="btn-wrapper" id="toolbar-options">
							<button onclick="window.open('index.php?option=com_plugins&filter_folder=system&filter_search=sourcerer');" class="btn btn-small">
								<span class="icon-options"></span> <?php 
            echo JText::_('JOPTIONS');
            ?>
							</button>
						</div>
					<?php 
        }
        ?>
				</div>
			</div>
		</div>

		<div class="container-fluid container-main">
			<form action="index.php" id="sourceForm" method="post">

				<div class="control-group form-inline">
				</div>

				<div class="well well-small src_editor">
					<?php 
        echo $editor->display('source', $this->params->code, '100%', '100%', 10, 10, 0, null, null, null, array('linenumbers' => 1, 'tabmode' => 'shift'));
        ?>
				</div>

				<script type="text/javascript">
					nnSourcererPopup.init();
				</script>
			</form>
		</div>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
Beispiel #18
0
 /**
  * Tests the getState method
  *
  * @return  void
  *
  * @since   3.0
  */
 public function testGetState()
 {
     // Preload the state to test it
     TestReflection::setValue($this->object, '_state', 'JEditor::getState()');
     $this->assertThat($this->object->getState(), $this->equalTo('JEditor::getState()'));
 }
Beispiel #19
0
 /**
  * @testdox Test an observer object is correctly stored in the JEditor class
  *
  * @since  3.4.4
  */
 public function testAttachWithClass()
 {
     $testObserver = new EditorObserver();
     $this->object->attach($testObserver);
     $this->assertAttributeSame(array($testObserver), '_observers', $this->object, 'Observer was not attached to the editor');
 }
Beispiel #20
0
 /**
  * Draws the html form element
  *
  * @param   array  $data           To pre-populate element with
  * @param   int    $repeatCounter  Repeat group counter
  *
  * @return  string	Elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     $name = $this->getHTMLName($repeatCounter);
     $id = $this->getHTMLId($repeatCounter);
     $element = $this->getElement();
     if ($element->hidden == '1') {
         return $this->getHiddenField($name, $this->getValue($data, $repeatCounter), $id);
     }
     $params = $this->getParams();
     $cols = $params->get('width', $element->width);
     $rows = $params->get('height', $element->height);
     $value = $this->getValue($data, $repeatCounter);
     $bits = array();
     $bits['class'] = "fabrikinput inputbox " . $params->get('bootstrap_class');
     $wysiwyg = $this->useWysiwyg();
     if (!$this->isEditable()) {
         if ($params->get('textarea-tagify') == true) {
             $value = $this->tagify($value);
         } else {
             if (!$wysiwyg) {
                 $value = nl2br($value);
             }
             if ($value !== '' && ((int) $params->get('textarea-truncate-where', 0) === 2 || (int) $params->get('textarea-truncate-where', 0) === 3)) {
                 $opts = $this->truncateOpts();
                 $value = fabrikString::truncate($value, $opts);
             }
         }
         return $value;
     }
     if ($params->get('textarea_placeholder', '') !== '') {
         $bits['placeholder'] = $params->get('textarea_placeholder');
     }
     if ($this->elementError != '') {
         $bits['class'] .= ' elementErrorHighlight';
     }
     $layoutData = new stdClass();
     $this->charsLeft($value, $layoutData);
     if ($wysiwyg) {
         $editor = JEditor::getInstance($this->config->get('editor'));
         $buttons = (bool) $params->get('wysiwyg_extra_buttons', true);
         $layoutData->editor = $editor->display($name, $value, $cols * 10, $rows * 15, $cols, $rows, $buttons, $id);
         $layout = $this->getLayout('wysiwyg');
     } else {
         if ($params->get('disable')) {
             $bits['class'] .= " disabled";
             $bits['disabled'] = 'disabled';
         }
         if ($params->get('textarea-showmax') && $params->get('textarea_limit_type', 'char') === 'char') {
             $bits['maxlength'] = $params->get('textarea-maxlength');
         }
         $bits['name'] = $name;
         $bits['id'] = $id;
         $bits['cols'] = $cols;
         $bits['rows'] = $rows;
         $layoutData->attributes = $bits;
         $layoutData->value = $value;
         $layout = $this->getLayout('form');
     }
     return $layout->render($layoutData);
 }
Beispiel #21
0
    /**
     * The function to handle all default page situations
     * not responsible for lists!
     */
    function FORMS_MENU_SAVE_CANCEL()
    {
        global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $VM_LANG, $page, $limitstart, $vmIcons;
        $no_menu = (int) $_REQUEST['no_menu'];
        $bar =& vmToolBar::getInstance('virtuemart');
        $is_iframe = vmGet($_REQUEST, 'is_iframe', 0);
        $product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0);
        $product_id = vmGet($_REQUEST, 'product_id');
        $script = '';
        if (is_array($product_id)) {
            $product_id = "";
        }
        // These editor arrays tell the toolbar to load correct "getEditorContents" script parts
        // This is necessary for WYSIWYG Editors like TinyMCE / mosCE / FCKEditor
        $editor1_array = array('product.product_form' => 'product_desc', 'shopper.shopper_group_form' => 'shopper_group_desc', 'product.product_category_form' => 'category_description', 'manufacturer.manufacturer_form' => 'mf_desc', 'store.store_form' => 'vendor_store_desc', 'product.product_type_parameter_form' => 'parameter_description', 'product.product_type_form' => 'product_type_description', 'vendor.vendor_form' => 'vendor_store_desc');
        $editor2_array = array('store.store_form' => 'vendor_terms_of_service', 'vendor.vendor_form' => 'vendor_terms_of_service');
        $editor1 = isset($editor1_array[$page]) ? $editor1_array[$page] : '';
        $editor2 = isset($editor2_array[$page]) ? $editor2_array[$page] : '';
        if ($no_menu) {
            vmCommonHTML::loadExtJS();
        }
        $script .= '
var submitbutton = function(pressbutton){
	
	var form = document.adminForm;
	if (pressbutton == \'cancel\') {
		submitform( pressbutton );
		return;
	}	
';
        if ($editor1 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor1);
                }
            } else {
                ob_start();
                getEditorContents('editor1', $editor1);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($editor2 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor2);
                }
            } else {
                ob_start();
                getEditorContents('editor2', $editor2);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($no_menu) {
            $admin = defined('_VM_IS_BACKEND') ? '/administrator' : '';
            $script .= "\r\n    // define some private variables\r\n    var dialog, showBtn;\r\n\r\n    var showDialog = function( content ) {\r\n    \tExt.Msg.show( { \r\n            \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\r\n            \t\tmsg: content,\r\n            \t\tautoCreate: true,\r\n                    width:400,\r\n                    height:180,\r\n                    modal: false,\r\n                    resizable: false,\r\n                    buttons: Ext.Msg.OK,\r\n                    shadow:true,\r\n                    animEl:Ext.get( 'vm-toolbar' )\r\n            });\r\n        " . (DEBUG ? "" : "setTimeout('Ext.Msg.hide()', 3000);") . "\r\n    };\r\n    \r\n    // return a public interface\r\n    var onSuccess = function(o,c) {\r\n\t\tshowDialog( o.responseText );\r\n\t};\r\n    var onFailure = function(o) {\r\n\t\tExt.Msg.alert( 'Error!', 'Save action failed: ' + o.statusText );\r\n\t};\r\n\tvar onCallback=function(o,s,r) {\r\n\t\t//if( s ) alert( 'Success' );\r\n\t\t//else alert( 'Failure' );\r\n\t}\r\n\t\r\n   \tExt.Ajax.request( { method: 'POST',\r\n   \t\t\t\t\t\turl: '{$_SERVER['PHP_SELF']}',\r\n   \t\t\t\t\t\tsuccess: onSuccess,\r\n   \t\t\t\t\t\tfailure: onFailure,\r\n   \t\t\t\t\t\tcallback: onCallback,\r\n   \t\t\t\t\t\tisUpload: true,\r\n   \t\t\t\t\t\tform: document.adminForm,\r\n   \t\t\t\t\t\tparams: { no_html:1 }\r\n   \t\t\t\t\t\t}\r\n   \t\t\t\t\t);\r\n\t";
        } else {
            $script .= "\n\t\t\tsubmitform( pressbutton );\n";
        }
        $script .= "\t\t}\n";
        $bar->buttons .= $script;
        if ($page == "product.product_form" && !empty($product_id)) {
            if (empty($product_parent_id)) {
                // add new attribute
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_attribute_form&product_id=" . $product_id . "&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
                $bar->customHref($href, 'new', $alt);
            } else {
                // back to parent product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_RETURN_LBL');
                $bar->customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt);
                // new child product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ADD_ANOTHER_ITEM_MNU');
                $bar->customHref($href, 'new', $alt);
            }
            // Go to Price list
            $href = $_SERVER['PHP_SELF'] . "?page=product.product_price_list&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&return_args=&option=com_virtuemart&no_menu={$no_menu}";
            $alt = $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
            $bar->customHref($href, 'new', $alt);
            // add product type
            $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_product_type_form&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&no_menu={$no_menu}";
            $alt = $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
            $bar->customHref($href, 'new', $alt);
            /*** Adding an item is only pssible, if the product has attributes ***/
            if (ps_product::product_has_attributes($product_id)) {
                // Add Item
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_id}&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL');
                $bar->customHref($href, 'new', $alt);
            }
            $bar->divider();
        } elseif ($page == "admin.country_form") {
            if (!empty($_REQUEST['country_id'])) {
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_ADD_STATE');
                $bar->customHref($href, 'new', $alt);
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = $VM_LANG->_('PHPSHOP_LIST_STATES');
                $bar->customHref($href, 'new', $alt);
                $bar->divider();
            }
        }
        $bar->save('save', $VM_LANG->_('CMN_SAVE'));
        //$bar->apply( 'apply', $VM_LANG->_('E_APPLY') );
        $bar->cancel();
    }
        ?>
</label></div></dt>
<dd><div class="controls btl-input"> 	
											<?php 
        switch ($el->type) {
            case 'date':
                if ($el->value == '' || $el->value == '0000-00-00') {
                    $el->value = null;
                }
                echo JHTML::_('calendar', $el->value, 'user_fields[' . $el->alias . ']', 'user_fields_' . $el->alias, '%Y-%m-%d ', $required);
                break;
            case 'string':
                echo '<input size="35" ' . $required . ' type="text" name="user_fields[' . $el->alias . ']" value="' . $el->value . '">';
                break;
            case 'text':
                $wysiwyg = JEditor::getInstance();
                echo $wysiwyg->display('user_fields[' . $el->alias . ']', strip_tags($el->value), '365', '140', '75', '20', false);
                break;
            case 'dropdown':
                $options = array();
                $options[] = JHtml::_('select.option', '', $el->default_values['label']);
                foreach ($el->default_values['value'] as $value) {
                    $options[] = JHtml::_('select.option', $value, $value);
                }
                echo JHtml::_('select.genericlist', $options, 'user_fields[' . $el->alias . '][]', $required, 'value', 'text', $el->value);
                break;
            case 'image':
                if ($el->value != '') {
                    $avatar = '<img src="' . JURI::root() . 'images/bt_socialconnect/avatar/' . $el->value . '"/>';
                    $html = '<div class=\'imageupload\'>';
                    $html .= '<span class="editlinktip hasTip" title="' . htmlspecialchars($avatar) . '">';
    function getHTML(&$params)
    {
        JFactory::getApplication()->setUserState('editor.source.syntax', 'php');
        $editor = JEditor::getInstance('codemirror');
        ob_start();
        ?>
		<div class="header">
			<div class="container-fluid">
				<h1 CLASS="page-title"><?php 
        echo JText::_('SRC_SOURCERER_CODE_HELPER');
        ?>
</h1>
			</div>
		</div>

		<div class="subhead">
			<div class="container-fluid">
					<div class="btn-toolbar" id="toolbar">
						<div class="btn-group" id="toolbar-apply">
							<button href="#" onclick="sourcerer_insertText();window.parent.SqueezeBox.close();" class="btn btn-small btn-success">
								<span class="icon-apply icon-white"></span> <?php 
        echo JText::_('SRC_INSERT');
        ?>
							</button>
						</div>
						<div class="btn-group">
							<button class="btn btn-small hasTip" id="btn-sourcetags" onclick="sourcerer_toggleSourceTags();return false;" title="<?php 
        echo JText::_('SRC_TOGGLE_SOURCE_TAGS_DESC');
        ?>
">
								<span class="icon-nonumber icon-src-sourcetags"></span> <?php 
        echo JText::_('SRC_TOGGLE_SOURCE_TAGS');
        ?>
							</button>
						</div>
						<div class="btn-group">
							<button class="btn btn-small hasTip" id="btn-tagstyle" onclick="sourcerer_toggleTagStyle();return false;" title="<?php 
        echo JText::_('SRC_TOGGLE_TAG_STYLE_DESC');
        ?>
">
								<span class="icon-nonumber icon-src-tagstyle"></span> <?php 
        echo JText::_('SRC_TOGGLE_TAG_STYLE');
        ?>
							</button>
						</div>
						<div class="btn-group" id="toolbar-cancel">
							<button href="#" onclick="if ( confirm( '<?php 
        echo JText::_('NN_ARE_YOU_SURE');
        ?>
' ) ) { window.parent.SqueezeBox.close(); }" class="btn btn-small">
								<span class="icon-cancel "></span> <?php 
        echo JText::_('JCANCEL');
        ?>
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="container-fluid container-main">
			<form action="index.php" id="sourceForm" method="post">

				<div class="control-group form-inline">
				</div>

				<div class="well well-small src_editor">
					<?php 
        echo $editor->display('source', $params->code, '100%', '100%', 10, 10, 0, null, null, null, array('linenumbers' => 1, 'tabmode' => 'shift'));
        ?>
				</div>

				<script type="text/javascript">
					sourcerer_init();
				</script>
			</form>
			<?php 
        if (JFactory::getApplication()->isAdmin()) {
            $user = JFactory::getUser();
            if ($user->authorise('core.admin', 1)) {
                echo '<em>' . str_replace('<a ', '<a target="_blank" ', html_entity_decode(JText::_('SRC_SETTINGS'))) . '</em>';
            }
        }
        ?>
		</div>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
    /**
     * The function to handle all default page situations
     * not responsible for lists!
     */
    function FORMS_MENU_SAVE_CANCEL()
    {
        global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $VM_LANG, $product_id, $page, $limitstart, $mosConfig_editor, $vmIcons;
        $bar =& JToolBar::getInstance('toolbar');
        $product_id = vmGet($_REQUEST, 'product_id', 0);
        $no_menu = vmGet($_REQUEST, 'no_menu', 0);
        $is_iframe = vmGet($_REQUEST, 'is_iframe', 0);
        $product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0);
        $script = '';
        $clone_product = vmRequest::getInt('clone_product', 0);
        if (is_array($product_id)) {
            $product_id = "";
        }
        // These editor arrays tell the toolbar to load correct "getEditorContents" script parts
        // This is necessary for WYSIWYG Editors like TinyMCE / mosCE / FCKEditor
        $editor1_array = array('product.product_form' => 'product_desc', 'shopper.shopper_group_form' => 'shopper_group_desc', 'product.product_category_form' => 'category_description', 'manufacturer.manufacturer_form' => 'mf_desc', 'store.store_form' => 'vendor_store_desc', 'product.product_type_parameter_form' => 'parameter_description', 'product.product_type_form' => 'product_type_description', 'vendor.vendor_form' => 'vendor_store_desc');
        $editor2_array = array('store.store_form' => 'vendor_terms_of_service', 'vendor.vendor_form' => 'vendor_terms_of_service');
        $editor1 = isset($editor1_array[$page]) ? $editor1_array[$page] : '';
        $editor2 = isset($editor2_array[$page]) ? $editor2_array[$page] : '';
        if ($no_menu) {
            vmCommonHTML::loadExtjs();
        }
        $script .= '<script type="text/javascript">
        	function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == \'cancel\') {
				submitform( pressbutton );
				return;
			}
			';
        if ($editor1 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor1);
                }
            } else {
                ob_start();
                getEditorContents('editor1', $editor1);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($editor2 != '') {
            if (vmIsJoomla(1.5)) {
                jimport('joomla.html.editor');
                $editor_type = $GLOBALS['mainframe']->getCfg('editor');
                if ($editor_type != 'none') {
                    $editor = JEditor::getInstance();
                    $script .= $editor->getContent($editor2);
                }
            } else {
                ob_start();
                getEditorContents('editor2', $editor2);
                $script .= ob_get_contents();
                ob_end_clean();
            }
        }
        if ($no_menu) {
            $admin = defined('_VM_IS_BACKEND') ? '/administrator' : '';
            $script .= "\n\t\t\t\n    // define some private variables\n    var dialog, showBtn;\n\n   // the second argument is true to indicate file upload.\n   YAHOO.util.Connect.setForm(form, true);\n   \n    var showDialog = function( content ) {\n    \tExt.MessageBox.show( { \n            \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\n            \t\tmsg: content,\n            \t\tautoCreate: true,\n                    width:400,\n                    height:180,\n                    modal: false,\n                    resizable: false,\n                    buttons: Ext.MessageBox.OK,\n                    shadow:true,\n                    animEl:Ext.get( 'vm-toolbar' )\n            });\n        setTimeout('Ext.MessageBox.hide()', 3000);\n    };\n    \n    // return a public interface\n    var callback = {\n    \tsuccess: function(o) {\n    \t\t//Ext.DomHelper.insertHtml( document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n    \t},\n    \tfailure: function(o) {\n    \t\tExt.DomHelper.append( document.body, { tag: 'div', id: 'vmLogResult', html: 'Save action failed: ' + o.statusText } );\n    \t\tshowDialog( o.responseText );\n    \t},\n        upload : function(o){\n            //Ext.DomHelper.insertHtml( 'beforeEnd', document.body, o.responseText );\n    \t\tshowDialog( o.responseText );\n        }\n    };\n    \n   \tvar cObj = YAHOO.util.Connect.asyncRequest('POST', '{$_SERVER['PHP_SELF']}', callback);\n\t\n\t\t\t\n";
        } else {
            $script .= "\n\t\t\tsubmitform( pressbutton );\n";
        }
        $script .= "\t\t}\n\t\t</script>";
        $bar->appendButton('Custom', $script);
        vmMenuBar::startTable();
        if ($page == "product.product_form" && !empty($product_id) && $clone_product != 1) {
            if (empty($product_parent_id)) {
                // add new attribute
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_attribute_form&product_id=" . $product_id . "&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            } else {
                // back to parent product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_RETURN_LBL');
                vmMenuBar::customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt);
                vmMenuBar::spacer();
                // new child product
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ADD_ANOTHER_ITEM_MNU');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            // Go to Price list
            $href = $_SERVER['PHP_SELF'] . "?page=product.product_price_list&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&return_args=&option=com_virtuemart&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            // add product type
            $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_product_type_form&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&no_menu={$no_menu}";
            $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
            vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
            vmMenuBar::spacer();
            /*** Adding an item is only pssible, if the product has attributes ***/
            if (ps_product::product_has_attributes($product_id)) {
                // Add Item
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_id}&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
            }
            vmMenuBar::divider();
        } elseif ($page == "admin.country_form") {
            if (!empty($_REQUEST['country_id'])) {
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_ADD_STATE');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}";
                $alt = "&nbsp;" . $VM_LANG->_('PHPSHOP_LIST_STATES');
                vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt);
                vmMenuBar::spacer();
                vmMenuBar::divider();
            }
        }
        vmMenuBar::spacer();
        vmMenuBar::save('save', $VM_LANG->_('CMN_SAVE'));
        if ($no_menu == 0) {
            vmMenuBar::spacer();
            vmMenuBar::apply('apply', $VM_LANG->_('E_APPLY'));
        }
        if ((strstr(@$_SERVER['HTTP_REFERER'], $page) || strstr(@$_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) && $no_menu && !$is_iframe) {
            // offer a back button
            vmMenuBar::spacer();
            vmMenuBar::back();
        }
        vmMenuBar::spacer();
        vmMenuBar::cancel();
        vmMenuBar::spacer();
        vmMenuBar::endTable();
    }
 public function onAfterDispatch()
 {
     //Inline editing is only enabled for frontend editing
     if ($this->app->isAdmin()) {
         $this->isEnabled = false;
         return;
     }
     $user = JFactory::getUser();
     //if user is guest lets bail
     if ($user->get('guest')) {
         $this->isEnabled = false;
         return;
     }
     if (!$user->authorise('core.create', 'com_content') && !$user->authorise('core.edit', 'com_content')) {
         $this->isEnabled = false;
         return;
     }
     if (!JComponentHelper::isEnabled('com_arkeditor')) {
         $this->isEnabled = false;
         return;
     }
     $cParams = JComponentHelper::getParams('com_arkeditor');
     if (!$cParams->get('enable_inline', true)) {
         $this->isEnabled = false;
         return;
     }
     if (!JPluginHelper::isEnabled('editors', 'arkeditor')) {
         $this->isEnabled = false;
         return;
     }
     $plugin = JPluginHelper::getPlugin('editors', 'arkeditor');
     $view = $this->app->input->get('view');
     $option = $this->app->input->get('option');
     if ($option == 'com_ajax') {
         // bail out
         return;
     }
     if ($option == 'com_content' && $this->app->input->get('tmpl', false)) {
         //bailout if in a modal or print view
         return;
     }
     if (isset($plugin->inlineMode) && $plugin->inlineMode == ArkInlineMode::REPLACE) {
         return;
     }
     if ($view && in_array($view, $this->inline_allowed_views)) {
         $plugin->inlineMode = ArkInlineMode::INLINE;
     }
     //Use reflection to get loaded method for JModuleHelper
     if ($this->app->input->get('Itemid', 0)) {
         jimport('joomla.filesystem.folder');
         if (JFolder::exists(JPATH_ROOT . '/modules/mod_inlinecustom')) {
             $method = '_load';
             if (method_exists('JModuleHelper', 'load')) {
                 $method = 'load';
             }
             $invokeLoad = new ReflectionMethod('JModuleHelper', $method);
             $invokeLoad->setAccessible(true);
             $modules = $invokeLoad->invoke(null);
             for ($i = 0; $i < count($modules); $i++) {
                 if ($modules[$i]->module == "mod_custom") {
                     if (!isset($plugin->inlineMode) || isset($plugin->inlineMode) && $plugin->inlineMode != ArkInlineMode::INLINE) {
                         $plugin->inlineMode = ArkInlineMode::INLINE;
                     }
                     $modules[$i]->module = "mod_inlinecustom";
                 }
             }
         }
     }
     if (!isset($plugin->inlineMode) || isset($plugin->inlineMode) && $plugin->inlineMode != ArkInlineMode::INLINE) {
         $this->isEnabled = false;
     }
     if (isset($plugin->inlineMode) && $plugin->inlineMode == ArkInlineMode::INLINE) {
         $editor = JEditor::getInstance('arkeditor');
         $return = $editor->display('', false, '', '', '', '');
         $document = JFactory::getDocument();
         $document->addCustomTag($return);
         $this->isEnabled = true;
     }
 }
Beispiel #26
0
 /**
  * Method to get a JEditor object based on the form field.
  *
  * @return  JEditor  The JEditor object.
  *
  * @since   11.1
  */
 protected function getEditor()
 {
     // Only create the editor if it is not already created.
     if (empty($this->editor)) {
         // Initialize variables.
         $editor = null;
         // Get the editor type attribute. Can be in the form of: editor="desired|alternative".
         $type = trim((string) $this->element['editor']);
         if ($type) {
             // Get the list of editor types.
             $types = explode('|', $type);
             // Get the database object.
             $db = JFactory::getDBO();
             // Iterate over teh types looking for an existing editor.
             foreach ($types as $element) {
                 // Build the query.
                 $query = $db->getQuery(true);
                 $query->select('element');
                 $query->from('#__extensions');
                 $query->where('element = ' . $db->quote($element));
                 $query->where('folder = ' . $db->quote('editors'));
                 $query->where('enabled = 1');
                 // Check of the editor exists.
                 $db->setQuery($query, 0, 1);
                 $editor = $db->loadResult();
                 // If an editor was found stop looking.
                 if ($editor) {
                     break;
                 }
             }
         }
         // Create the JEditor instance based on the given editor.
         if (is_null($editor)) {
             $conf = JFactory::getConfig();
             $editor = $conf->get('editor');
         }
         $this->editor = JEditor::getInstance($editor);
     }
     return $this->editor;
 }
Beispiel #27
0
 /**
  * Get an editor object
  *
  * @access public
  * @param string $editor The editor to load, depends on the editor plugins that are installed
  * @return object JEditor
  */
 function &getEditor($editor = null)
 {
     jimport('joomla.html.editor');
     //get the editor configuration setting
     if (is_null($editor)) {
         $conf =& JFactory::getConfig();
         $editor = $conf->getValue('config.editor');
     }
     $instance =& JEditor::getInstance($editor);
     return $instance;
 }
Beispiel #28
0
 /**
  * Get an editor object.
  *
  * @param   string  $editor  The editor to load, depends on the editor plugins that are installed
  *
  * @return  JEditor object
  *
  * @since   11.1
  */
 public static function getEditor($editor = null)
 {
     if (class_exists('\\App')) {
         $e = \App::get('editor');
         if ($editor && $editor != $e->getName()) {
             $e = new \Hubzero\Html\Editor($editor);
         }
         return $e;
     }
     jimport('joomla.html.editor');
     //get the editor configuration setting
     if (is_null($editor)) {
         $conf = self::getConfig();
         $editor = $conf->get('editor');
     }
     return JEditor::getInstance($editor);
 }
Beispiel #29
0
 public function display($tpl = null)
 {
     $editor = JFactory::getConfig()->get('editor');
     $this->editor = JEditor::getInstance($editor);
     parent::display($tpl);
 }
Beispiel #30
0
 public function getEditor($name, $content = '', $width = null, $height = null)
 {
     $conf = \JFactory::getConfig();
     $editor = \JEditor::getInstance($conf->get('editor'));
     if (!$height) {
         $height = 250;
     }
     return $editor->display($name, $content, $width, $height, 50, 8, false, null, null, null, ['html_height' => $height]);
 }