本文整理汇总了PHP中JEditor::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JEditor::getInstance方法的具体用法?PHP JEditor::getInstance怎么用?PHP JEditor::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEditor
的用法示例。
在下文中一共展示了JEditor::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* 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);
}
示例2: display
/**
* @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);
}
}
示例3: init
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();
}
}
示例4: display
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';
}
示例5: getInput
/**
* 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;
}
示例6: getInput
/**
* 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;
}
示例7:
<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;
?>
示例8: prepareData
/**
* 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);
}
示例9: FORMS_MENU_SAVE_CANCEL
/**
* 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 = " " . $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 = " " . $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 = " " . $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 = " " . $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 = " " . $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
//.........这里部分代码省略.........
示例10: getEditor
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]);
}
示例11: switch
?>
</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) . '">';
示例12: editorScript
/**
* 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
}
示例13: getEditor
/**
* 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')) {
return \App::get('editor');
}
jimport('joomla.html.editor');
//get the editor configuration setting
if (is_null($editor)) {
$conf = self::getConfig();
$editor = $conf->get('editor');
}
return JEditor::getInstance($editor);
}
示例14: testGetInstance
/**
* Tests the getInstance method
*
* @return void
*
* @since 3.0
*/
public function testGetInstance()
{
$this->assertThat(JEditor::getInstance('none'), $this->isInstanceOf('JEditor'));
}
示例15: testGetInstance
/**
* Tests the getInstance method
*
* @return void
*
* @since 3.0
* @covers JEditor::getInstance
*/
public function testGetInstance()
{
$this->assertInstanceOf('JEditor', JEditor::getInstance('none'));
}