Skip to content

Commit

Permalink
Merge pull request #3365 from SimSync/fix_3317
Browse files Browse the repository at this point in the history
fixes #3317 added bbcode template "forum"
  • Loading branch information
CaMer0n authored Aug 10, 2018
2 parents 1bfd05b + c1bec2b commit 7403d9f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
19 changes: 14 additions & 5 deletions e107_core/shortcodes/batch/bbcode_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,17 @@ function bb_youtube($id)
{
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&amp;action=dialog&amp;for=".$this->var['template']."&amp;tagid=".$tag."&amp;iframe=1&amp;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&amp;action=dialog&amp;for=" . $this->var['template'] . "&amp;tagid=" . $tag . "&amp;iframe=1&amp;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>";
Expand All @@ -152,7 +161,7 @@ function bb_glyph($id)
}


$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&amp;action=dialog&amp;for=".$this->var['template']."&amp;tagid=".$tag."&amp;iframe=1&amp;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&amp;action=dialog&amp;for=".$this->var['template']."&amp;tagid=".$tag."&amp;iframe=1&amp;bbcode=glyph' >";
$text .= $this->button(e_IMAGE_ABS."bbcode/youtube.png", 'youtube', LANHELP_48);

$text .= "</a>";
Expand Down Expand Up @@ -211,7 +220,7 @@ function bb_preimage($id)
{
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&amp;action=dialog&amp;for=".$this->var['template']."&amp;tagid=".$tag."&amp;iframe=1&amp;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&amp;action=dialog&amp;for=".$this->var['template']."&amp;tagid=".$tag."&amp;iframe=1&amp;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='' />";
Expand All @@ -229,7 +238,7 @@ function bb_prefile($id)
{
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&amp;action=dialog&amp;for=_common_file&amp;tagid=".$tag."&amp;iframe=1&amp;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&amp;action=dialog&amp;for=_common_file&amp;tagid=".$tag."&amp;iframe=1&amp;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='' />";
Expand Down
18 changes: 16 additions & 2 deletions e107_handlers/bbcode_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,21 @@ function renderButtons($template='', $id='', $options=array())
$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];
Expand All @@ -584,7 +598,7 @@ function renderButtons($template='', $id='', $options=array())
$BBCODE_TEMPLATE = $template;
$template = 'comment';
}
elseif(ADMIN_AREA)
elseif(deftrue('ADMIN_AREA'))
{
$BBCODE_TEMPLATE = $BBCODE_TEMPLATE_ADMIN;
}
Expand Down
19 changes: 19 additions & 0 deletions e107_plugins/forum/templates/bbcode_template.php
Original file line number Diff line number Diff line change
@@ -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>
";

0 comments on commit 7403d9f

Please sign in to comment.