本文整理汇总了PHP中JEditor类的典型用法代码示例。如果您正苦于以下问题:PHP JEditor类的具体用法?PHP JEditor怎么用?PHP JEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JEditor类的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: _addJavascriptSumbit
/**
* 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[] = "}";
}
示例8: getEditor
/**
* 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;
}
示例9:
<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;
?>
示例10: 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);
}
示例11: getInput
/**
* 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);
}
示例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)
{
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: getEditor
/**
* 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);
}
示例15: getHTML
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();
//.........这里部分代码省略.........