diff --git a/e107_core/shortcodes/batch/bbcode_shortcodes.php b/e107_core/shortcodes/batch/bbcode_shortcodes.php index 74778802c..a3bf00d63 100644 --- a/e107_core/shortcodes/batch/bbcode_shortcodes.php +++ b/e107_core/shortcodes/batch/bbcode_shortcodes.php @@ -131,8 +131,17 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - - $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert a Youtube video via Media Manager : ".$this->var['template']."' id='{$id}' href='".e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=video' >"; + + if (ADMIN) + { + $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert a Youtube video via Media Manager : " . $this->var['template'] . "' id='{$id}' href='" . e_HTTP . e_ADMIN . "image.php?mode=main&action=dialog&for=" . $this->var['template'] . "&tagid=" . $tag . "&iframe=1&bbcode=video' >"; + } + else + { + $data = "[youtube=tiny | small | medium | big | huge | width,height]6kYjxJmk0wc[/youtube]"; + $event = $this->getEvent('addtext',$data,LANHELP_48); + $text = "<a {$event} class='btn btn-default' id='{$id}' data-function='insert' href='#{$this->var['tagid']}' data-bbcode='{$data}' title='".$this->br2nl(LANHELP_48)."'>"; + } $text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48); $text .= "</a>"; @@ -152,7 +161,7 @@ class bbcode_shortcodes extends e_shortcode } - $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert a Glyphicon via Media Manager : ".$this->var['template']."' id='{$id}' href='".e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=glyph' >"; + $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert a Glyphicon via Media Manager : ".$this->var['template']."' id='{$id}' href='".e_HTTP.e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=glyph' >"; $text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48); $text .= "</a>"; @@ -211,7 +220,7 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert an Image from the Media Manager : ".$this->var['template']."' id='{$id}' href='".e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=img' >"; + $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' title='Insert an Image from the Media Manager : ".$this->var['template']."' id='{$id}' href='".e_HTTP.e_ADMIN."image.php?mode=main&action=dialog&for=".$this->var['template']."&tagid=".$tag."&iframe=1&bbcode=img' >"; $text .= $this->button(e_IMAGE_ABS."bbcode/preimage.png",'picture-o'); // $text .= "<img class='btn btn-small bbcode bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/preimage.png' title='".LANHELP_45."' alt='' />"; @@ -229,7 +238,7 @@ class bbcode_shortcodes extends e_shortcode { list($tag,$tmp) = explode("--",$this->var['tagid']); // works with $frm->bbarea to detect textarea from first half of tag. } - $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' id='{$id}' title='Insert a file from the Media-Manager' href='".e_ADMIN."image.php?mode=main&action=dialog&for=_common_file&tagid=".$tag."&iframe=1&bbcode=file' >"; + $text = "<a class='e-modal btn btn-primary' data-modal-caption='Media Manager' data-target='#uiModal' id='{$id}' title='Insert a file from the Media-Manager' href='".e_HTTP.e_ADMIN."image.php?mode=main&action=dialog&for=_common_file&tagid=".$tag."&iframe=1&bbcode=file' >"; $text .= $this->button(e_IMAGE_ABS."bbcode/prefile.png", 'file'); // $text .= "<img class='btn btn-small bbcode bbcode_buttons e-pointer' src='".e_IMAGE_ABS."bbcode/prefile.png' title='".LANHELP_39."' alt='' />"; diff --git a/e107_handlers/bbcode_handler.php b/e107_handlers/bbcode_handler.php index 199f82a9d..033f4b391 100644 --- a/e107_handlers/bbcode_handler.php +++ b/e107_handlers/bbcode_handler.php @@ -574,7 +574,21 @@ class e_bbcode $temp['maintenance']= $BBCODE_TEMPLATE_ADMIN; $temp['comment'] = $BBCODE_TEMPLATE_COMMENT; $temp['signature'] = $BBCODE_TEMPLATE_SIGNATURE; - + + if(!isset($temp[$template])) + { + // if template not yet defined, assume that $template is the name of a plugin + // and load the specific bbcode template from the plugin + // see forum plugin "templates/bbcode_template.php" for an example of the definition + $tpl = e107::getTemplate($template, 'bbcode', $template); + if (!empty($tpl)) + { + // If the plugin has a template defined for bbcode, add it to the list + $temp[$template] = $tpl; + } + unset($tpl); + } + if(isset($temp[$template])) { $BBCODE_TEMPLATE = $temp[$template]; @@ -584,7 +598,7 @@ class e_bbcode $BBCODE_TEMPLATE = $template; $template = 'comment'; } - elseif(ADMIN_AREA) + elseif(deftrue('ADMIN_AREA')) { $BBCODE_TEMPLATE = $BBCODE_TEMPLATE_ADMIN; } diff --git a/e107_plugins/forum/templates/bbcode_template.php b/e107_plugins/forum/templates/bbcode_template.php new file mode 100644 index 000000000..53f9b2ac9 --- /dev/null +++ b/e107_plugins/forum/templates/bbcode_template.php @@ -0,0 +1,19 @@ +<?php +/* + * e107 website system + * + * Copyright (C) 2008-2013 e107 Inc (e107.org) + * Released under the terms and conditions of the + * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) + * + * BBCODE template - to be used by the bbcode editor + * + */ + + +$BBCODE_TEMPLATE['forum'] = " + <div class='field-spacer'><!-- --></div> + {BB=link}{BB=b}{BB=i}{BB=u}{BB=img}{BB=format}{BB=left}{BB=center}{BB=right}{BB=justify} + {BB=list}{BB=fontcol}{BB=fontsize}{BB=emotes}{BB=youtube} + <div class='field-spacer'><!-- --></div> +";