1
0
mirror of https://github.com/e107inc/e107.git synced 2025-06-05 18:35:01 +02:00
This commit is contained in:
Cameron 2018-07-28 13:41:44 -07:00
parent 37017652cc
commit e5af746153
4 changed files with 40 additions and 37 deletions

View File

@ -3628,7 +3628,7 @@ class e107
/**
* Set or Retrieve WYSIWYG active status. (replaces constant e_WYSIWYG)
* @param bool $val if null, return current value, otherwise set value to registry
* @return bool|mixed|void
* @return bool|mixed
*/
public static function wysiwyg($val=null)
{
@ -3638,27 +3638,6 @@ class e107
return false;
}
if (defined('e_CURRENT_PLUGIN') && e_CURRENT_PLUGIN != '')
{
$editor = e107::getPlugPref(e_CURRENT_PLUGIN, 'editor', 'default');
if ($editor != 'default' && $editor != 'bbcode' && !e107::isInstalled($editor))
{
$editor = 'default';
}
switch ($editor)
{
case 'bbcode':
return false;
case 'tinymce4':
return true;
default:
break;
}
}
if(is_null($val))
{
return self::getRegistry('core/e107/wysiwyg');

View File

@ -2302,12 +2302,15 @@ class e_form
/**
* Bbcode Area. Name, value, template, media-Cat, size, options array eg. counter
* IMPORTANT: $$mediaCat is also used is the media-manager category identifier
* @param $name
* @param $value
* @param $template
* @param $mediaCat _common
* @param $size : small | medium | large
* @param $options array();
* @param string $name
* @param mixed $value
* @param string $template
* @param string $mediaCat _common
* @param string $size : small | medium | large
* @param array $options array();
* @param bool $options['wysiwyg'] when set to false will disable wysiwyg if active.
* @param string $options['class'] override class.
* @param string $options['id']
*/
function bbarea($name, $value, $template = '', $mediaCat='_common', $size = 'large', $options = array())
{
@ -2349,8 +2352,22 @@ class e_form
}
// auto-height support
$options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight form-control';
$bbbar = '';
$wysiwyg = null;
$wysiwygClass = ' e-wysiwyg';
if(isset($options['wysiwyg']))
{
$wysiwyg = $options['wysiwyg'];
}
if($wysiwyg === false)
{
$wysiwygClass = '';
}
$options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').$wysiwygClass.' e-autoheight form-control';
if (isset($options['id']) && !empty($options['id']))
@ -2363,7 +2380,7 @@ class e_form
}
if(e107::wysiwyg(true) === false) // bbarea loaded, so activate wysiwyg (if enabled in preferences)
if(e107::wysiwyg(true) === false || $wysiwyg === false) // bbarea loaded, so activate wysiwyg (if enabled in preferences)
{
$options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);' {$height}";
}
@ -2372,14 +2389,14 @@ class e_form
$options['other'] = " ".$height;
}
$counter = vartrue($options['counter'],false);
$ret = "<div class='bbarea {$size}'>
<div class='field-spacer'><!-- --></div>\n";
if(e107::wysiwyg() === true)
if(e107::wysiwyg() === true && $wysiwyg !== false)
{
$eParseList = e107::getConfig()->get('e_parse_list');

View File

@ -229,16 +229,19 @@ if(!deftrue('OLD_FORUMADMIN'))
$this->checkOrder();
$this->prefs['editor']['writeParms']['optArray']['default'] = 'System editor';
$this->prefs['editor']['writeParms']['optArray']['default'] = 'System default'; //todo LAN
$this->prefs['editor']['writeParms']['optArray']['bbcode'] = 'BBCode';
//@ global pref should override plugins due to security considerations and allowance of posting html.
/*
if (e107::isInstalled('tinymce4'))
{
$this->prefs['editor']['writeParms']['optArray']['tinymce4'] = 'TinyMCE';
}
}*/
$this->prefs['quickreply']['writeParms']['optArray'] = array(
'default' => 'Textarea',
'wysiwyg' => 'Editor'
'default' => 'Textarea', //todo LAN
'wysiwyg' => 'Rich Text Editor' //TODO LAN
);
if(e107::isInstalled('poll') == false)

View File

@ -177,7 +177,11 @@ class plugin_forum_post_shortcodes extends e_shortcode
$text = '';
}
return e107::getForm()->bbarea('post',$text,'forum');
$editor = $this->forum->prefs->get('editor');
$wysiwyg = ($editor === 'bbcode') ? false : null;
return e107::getForm()->bbarea('post',$text,'forum','_common','large', array('wysiwyg' => $wysiwyg));
}