mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 11:50:30 +02:00
Better bbcode styling and table bbcodes added
This commit is contained in:
@@ -1 +1,4 @@
|
||||
return "<strong class='bbcode bold'>$code_text</strong>";
|
||||
//<?php
|
||||
|
||||
$class = e107::getBB()->getClass('b');
|
||||
return "<strong class='bbcode bold {$class}'>$code_text</strong>";
|
||||
|
@@ -50,8 +50,7 @@ class bb_block extends e_bb_base
|
||||
if($parm && !strpos($parm, '=')) $parm = 'class='.$parm;
|
||||
$parms = eHelper::scParams($parm);
|
||||
|
||||
$class = varsettrue($parms['class']) ? ' class="'.eHelper::secureClassAttr($parms['class']).'"' : '';
|
||||
if(!$class) $class = ' class="bbcode"';
|
||||
$class = " ".e107::getBB()->getClass('block');
|
||||
|
||||
$id = varsettrue($parms['id']) ? ' id='.eHelper::secureIdAttr($parms['id']) : '';
|
||||
$style = varsettrue($parms['style']) ? ' style="'.eHelper::secureStyleAttr($parms['style']).'"' : '';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
v<?php
|
||||
/**
|
||||
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id$
|
||||
@@ -68,8 +68,7 @@ class bb_h extends e_bb_base
|
||||
$parms = $bparms[2];
|
||||
unset($bparms);
|
||||
|
||||
$class = varsettrue($parms['class']) ? ' class="'.eHelper::secureClassAttr($parms['class']).'"' : '';
|
||||
if(!$class) $class = ' class="bbcode"';
|
||||
$class = " ".e107::getBB()->getClass('h2'); // consistent classes across all themes.
|
||||
|
||||
$id = varsettrue($parms['id']) ? ' id='.eHelper::secureIdAttr($parms['id']) : '';
|
||||
$style = varsettrue($parms['style']) ? ' style="'.eHelper::secureStyleAttr($parms['style']).'"' : '';
|
||||
|
@@ -60,8 +60,7 @@ class bb_p extends e_bb_base
|
||||
|
||||
$parms = eHelper::scParams($parm);
|
||||
|
||||
$class = varsettrue($parms['class']) ? ' class="'.eHelper::secureClassAttr($parms['class']).'"' : '';
|
||||
if(!$class) $class = ' class="bbcode"';
|
||||
$class = " ".e107::getBB()->getClass('p'); // consistent classes across all themes.
|
||||
|
||||
$id = varsettrue($parms['id']) ? ' id="'.eHelper::secureIdAttr($parms['id']).'"' : '';
|
||||
$style = varsettrue($parms['style']) ? ' style="'.eHelper::secureStyleAttr($parms['style']).'"' : '';
|
||||
|
@@ -342,18 +342,20 @@ class bb_youtube extends e_bb_base
|
||||
$url .= "&autoplay=".intval($params['autoplay']);
|
||||
}
|
||||
|
||||
$class = "bbcode ".e107::getBB()->getClass('youtube'); // consistent classes across all themes.
|
||||
|
||||
$ret = '
|
||||
|
||||
<!-- Start YouTube -->
|
||||
|
||||
<object class="bbcode" width="'.$params['w'].'" height="'.$params['h'].'" >
|
||||
<object class="'.$class.'" width="'.$params['w'].'" height="'.$params['h'].'" >
|
||||
<param name="movie" value="'.$url.'"></param>
|
||||
<param name="allowFullScreen" value="'.$fscr.'"></param>
|
||||
<param name="allowscriptaccess" value="always"></param>
|
||||
<param name="wmode" value="transparent"></param>
|
||||
';
|
||||
// Not XHTML - but needed for compatibility.
|
||||
$ret .= '<embed class="bbcode" src="'.$url.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="'.$fscr.'" wmode="transparent" width="'.$params['w'].'" height="'.$params['h'].'"></embed>';
|
||||
$ret .= '<embed class="'.$class.'" src="'.$url.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="'.$fscr.'" wmode="transparent" width="'.$params['w'].'" height="'.$params['h'].'"></embed>';
|
||||
$ret .= '</object>';
|
||||
$ret .= '
|
||||
<!-- End YouTube -->
|
||||
|
@@ -1 +1,3 @@
|
||||
return "<div class='indent'>{$code_text}</div>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('blockquote');
|
||||
return "<div class='indent {$class}'>{$code_text}</div>";
|
@@ -1 +1,5 @@
|
||||
return "<div style='text-align:center'>$code_text</div>";
|
||||
//<?
|
||||
|
||||
$class = e107::getBB()->getClass('center');
|
||||
|
||||
return "<div class='{$class}' style='text-align:center'>$code_text</div>";
|
@@ -1,3 +1,6 @@
|
||||
//<?php
|
||||
$class = e107::getBB()->getClass('code');
|
||||
|
||||
global $pref, $e107cache, $tp;
|
||||
|
||||
if($pref['smiley_activate'])
|
||||
@@ -31,14 +34,14 @@ if(isset($pref['useGeshi']) && $pref['useGeshi'] && file_exists(e_PLUGIN."geshi/
|
||||
$CodeCache = $geshi->parse_code();
|
||||
$e107cache->set('GeshiParsed_'.$code_md5, $CodeCache);
|
||||
}
|
||||
$ret = "<div class='code_highlight code-box' style='unicode-bidi: embed; direction: ltr'>".str_replace("&", "&", $CodeCache)."</div>";
|
||||
$ret = "<div class='code_highlight code-box {$class}' style='unicode-bidi: embed; direction: ltr'>".str_replace("&", "&", $CodeCache)."</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$code_text = html_entity_decode($code_text, ENT_QUOTES, 'utf-8');
|
||||
$highlighted_text = highlight_string($code_text, TRUE);
|
||||
$divClass = ($parm) ? $parm : 'code_highlight';
|
||||
$ret = "<div class='".$tp -> toAttribute($divClass)." code-box' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</div>";
|
||||
$ret = "<div class='".$tp -> toAttribute($divClass)." code-box{$class}' style='unicode-bidi: embed; direction: ltr'>{$highlighted_text}</div>";
|
||||
}
|
||||
$ret = str_replace("[", "[", $ret);
|
||||
return $ret;
|
@@ -1,3 +1,6 @@
|
||||
//<?php
|
||||
$class = e107::getBB()->getClass('color');
|
||||
|
||||
$aColors = array(
|
||||
"black" => "#000000",
|
||||
"blue" => "#0000FF",
|
||||
@@ -26,13 +29,13 @@ $aColors = array(
|
||||
|
||||
if(array_key_exists($parm, $aColors))
|
||||
{
|
||||
return "<span style='color:{$aColors[$parm]}'>$code_text</span>";
|
||||
return "<span class='{$class}' style='color:{$aColors[$parm]}'>$code_text</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(preg_match("/(#[a-fA-F0-9]{3,6})/", $parm, $matches))
|
||||
{
|
||||
return "<span style='color:{$matches[1]}'>$code_text</span>";
|
||||
return "<span class='{$class}' style='color:{$matches[1]}'>$code_text</span>";
|
||||
|
||||
}
|
||||
}
|
@@ -1,3 +1,5 @@
|
||||
//<?php
|
||||
$class = e107::getBB()->getClass('email');
|
||||
|
||||
global $pref;
|
||||
|
||||
@@ -21,7 +23,7 @@ if($pref['make_clickable'])
|
||||
}
|
||||
// Old method that attracts SPAM.
|
||||
if ($parm) {
|
||||
return "<a href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
|
||||
return "<a class='{$class}' href='mailto:".$tp -> toAttribute($parm)."'>".$code_text."</a>";
|
||||
} else {
|
||||
return "<a href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
|
||||
return "<a class='{$class}' href='mailto:".$tp -> toAttribute($code_text)."'>".$code_text."</a>";
|
||||
}
|
@@ -1,3 +1,6 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('file');
|
||||
|
||||
global $pref, $fromadmin;
|
||||
|
||||
if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref['forum_attach'] && FILE_UPLOADS || ADMIN || $fromadmin))
|
||||
@@ -35,5 +38,5 @@ if ((e_PAGE == 'page.php') || (array_key_exists('forum_attach', $pref) && $pref[
|
||||
{
|
||||
$fname = str_replace('{e_BASE}', SITEURL, $fname); // Translate into an absolute URL
|
||||
}
|
||||
return "<a href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
|
||||
return "<a class='{$class}' href='".$tp -> toAttribute($fname)."'><img src='".$image."' alt='' style='border:0; vertical-align:middle' /></a> <a href='".$tp -> toAttribute($fname)."'>".$code_text."</a>";
|
||||
}
|
||||
|
@@ -1,3 +1,6 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('flash');
|
||||
|
||||
// USAGE: [flash=width,height,param_name=value¶m_name=value]http://www.example.com/file.swf[/flash]
|
||||
|
||||
$movie_path = $tp->toAttribute($code_text);
|
||||
@@ -7,7 +10,7 @@ $width = preg_replace('#[^0-9%]#', '', varsettrue($parm_array[0], 50));
|
||||
$height= preg_replace('#[^0-9%]#', '', varsettrue($parm_array[1], 50));
|
||||
|
||||
$text = "
|
||||
<object type='application/x-shockwave-flash' data='{$movie_path}' width='{$width}' height='{$height}'>
|
||||
<object class='{$class}' type='application/x-shockwave-flash' data='{$movie_path}' width='{$width}' height='{$height}'>
|
||||
<param name='movie' value='{$movie_path}' />
|
||||
<param name='quality' value='high' />
|
||||
<param name='allowscriptaccess' value='samedomain' />
|
||||
|
@@ -1 +1,4 @@
|
||||
return "<em class='bbcode italic'>$code_text</em>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('i');
|
||||
|
||||
return "<em class='bbcode italic {$class}'>$code_text</em>";
|
@@ -1,3 +1,5 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('img');
|
||||
// $Id$
|
||||
|
||||
// General purpose image bbcode. As well as the obvious insertion of a picture:
|
||||
@@ -21,7 +23,7 @@ $replace = array(''', e_IMAGE_ABS, e_FILE_ABS, e_IMAGE_ABS, e_FILE_ABS);
|
||||
$replaceInt = array(''', e_IMAGE, e_FILE, e_IMAGE, e_FILE);
|
||||
$intName = str_replace($search, $replaceInt, $code_text); // Server-relative file names
|
||||
unset($imgParms);
|
||||
$imgParms['class']="bbcode floatnone"; // This will be overridden if a new class is specified
|
||||
$imgParms['class']="bbcode {$class}"; // This will be overridden if a new class is specified
|
||||
|
||||
$imgParms['alt']='';
|
||||
|
||||
|
@@ -1 +1,4 @@
|
||||
return "<div style='text-align:justify'>$code_text</div>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('justify');
|
||||
|
||||
return "<div class='{$justify}' style='text-align:justify'>$code_text</div>";
|
@@ -1 +1,3 @@
|
||||
return "<div style='text-align:left'>$code_text</div>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('left');
|
||||
return "<div class='{$class}' style='text-align:left'>$code_text</div>";
|
||||
|
@@ -1,5 +1,8 @@
|
||||
// $Id$
|
||||
//<?
|
||||
|
||||
|
||||
$class = "bbcode ".e107::getBB()->getClass('link');
|
||||
global $pref;
|
||||
|
||||
/**
|
||||
@@ -67,5 +70,5 @@ global $pref;
|
||||
$insert = ($pref['links_new_window'] && strpos($link,"{e_")===FALSE && substr($link,0,1) != "#" && substr($link,0,1) != "/" && strpos($extras,"rel=internal")===FALSE) ? "rel='external' " : "";
|
||||
}
|
||||
if (strtolower(substr($link,0,11)) == 'javascript:') return '';
|
||||
return "<a class='bbcode' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";
|
||||
return "<a class='{$class}' href='".$tp -> toAttribute($link)."' ".$insert.">".$code_text."</a>";
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
upper-alpha A, B, C
|
||||
*/
|
||||
|
||||
$class = e107::getBB()->getClass('list');
|
||||
|
||||
if (strpos($code_text,"[*]") !== FALSE)
|
||||
{
|
||||
$listitems = explode("[*]", $code_text);
|
||||
@@ -38,7 +40,7 @@ foreach($listitems as $item)
|
||||
{
|
||||
if($item && $item != E_NL)
|
||||
{
|
||||
$listtext .= "<li class='bbcode ".$type."'>$item</li>";
|
||||
$listtext .= "<li class='bbcode ".$type." {$class}'>$item</li>";
|
||||
}
|
||||
}
|
||||
return $listtext.$trailer;
|
||||
|
@@ -1,2 +1,5 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('quote');
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_parser_functions.php");
|
||||
return "<div class='indent'><em>$parm ".LAN_WROTE."</em> ...<br />$code_text</div>";
|
||||
|
||||
return "<div class='indent {$class}'><em>$parm ".LAN_WROTE."</em> ...<br />$code_text</div>";
|
||||
|
@@ -1 +1,4 @@
|
||||
return "<div style='text-align:right'>$code_text</div>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('right');
|
||||
|
||||
return "<div class='{$class}' style='text-align:right'>$code_text</div>";
|
||||
|
@@ -1,6 +1,9 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('size');
|
||||
|
||||
if(is_numeric($parm) && $parm > 0 && $parm < 38)
|
||||
{
|
||||
return "<span style='font-size:{$parm}px'>$code_text</span>";
|
||||
return "<span class='{$class}' style='font-size:{$parm}px'>$code_text</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,2 +1,5 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('spoiler');
|
||||
|
||||
$spoiler_color = (defined("SPOILER_COLOR") ? SPOILER_COLOR : "#ff00ff");
|
||||
return "<span style='color:{$spoiler_color};background-color:{$spoiler_color}'>$code_text</span>";
|
||||
return "<span class='{$class}' style='color:{$spoiler_color};background-color:{$spoiler_color}'>$code_text</span>";
|
||||
|
@@ -1,3 +1,5 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('stream');
|
||||
unset($stream_parms);
|
||||
|
||||
if($parm)
|
||||
@@ -37,7 +39,7 @@ foreach($stream_parms as $k => $v)
|
||||
}
|
||||
|
||||
$ret = "
|
||||
<object id='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Microsoft<66> Windows<77> Media Player components...' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='".$tp -> toAttribute($width)."' height='".$tp -> toAttribute($height)."'>\n";
|
||||
<object class='{$class}' id='MediaPlayer' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95' standby='Loading Microsoft<66> Windows<77> Media Player components...' type='application/x-oleobject' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' width='".$tp -> toAttribute($width)."' height='".$tp -> toAttribute($height)."'>\n";
|
||||
$ret .= "<param name='filename' value='".$tp -> toAttribute($code_text)."'>\n";
|
||||
$ret .= $MozparmStr;
|
||||
$ret .= "<embed src='".$tp -> toAttribute($code_text)."' width='".$tp -> toAttribute($width)."' height='".$tp -> toAttribute($height)."' id='mediaPlayer' name='mediaPlayer' {$IEparmStr}>
|
||||
|
4
e107_core/bbcodes/table.bb
Normal file
4
e107_core/bbcodes/table.bb
Normal file
@@ -0,0 +1,4 @@
|
||||
//<?
|
||||
|
||||
$class = e107::getBB()->getClass('table');
|
||||
return "<table class='{$class}'>".$code_text."</table>";
|
4
e107_core/bbcodes/tbody.bb
Normal file
4
e107_core/bbcodes/tbody.bb
Normal file
@@ -0,0 +1,4 @@
|
||||
//<?php
|
||||
|
||||
$class = e107::getBB()->getClass('tbody');
|
||||
return "<tbody class='{$class}'>".$code_text."</tbody>\n";
|
4
e107_core/bbcodes/td.bb
Normal file
4
e107_core/bbcodes/td.bb
Normal file
@@ -0,0 +1,4 @@
|
||||
//<?php
|
||||
|
||||
$class = e107::getBB()->getClass('td');
|
||||
return "<td class='{$class}'>".$code_text."</td>";
|
@@ -1,5 +1,8 @@
|
||||
//<?
|
||||
|
||||
/* Tag: [textarea name=name&style=style&row=rows&whatever=whatever]value[/textarea] */
|
||||
|
||||
$class = e107::getBB()->getClass('textarea');
|
||||
$tastr = "";
|
||||
parse_str($parm, $tmp);
|
||||
|
||||
@@ -7,4 +10,4 @@ foreach($tmp as $key => $p)
|
||||
{
|
||||
$tastr .= $tp -> toAttribute($key)." = '".$tp -> toAttribute($p)."' ";
|
||||
}
|
||||
return "<textarea $tastr>$code_text</textarea>";
|
||||
return "<textarea class='{$class}' $tastr>$code_text</textarea>";
|
||||
|
@@ -1,2 +1,6 @@
|
||||
//<?
|
||||
|
||||
$class = e107::getBB()->getClass('time');
|
||||
|
||||
include_once(e_HANDLER."date_handler.php");
|
||||
return convert::convert_date($code_text, $parm);
|
||||
return "<span class='{$class}'>".convert::convert_date($code_text, $parm)."</span>";
|
||||
|
3
e107_core/bbcodes/tr.bb
Normal file
3
e107_core/bbcodes/tr.bb
Normal file
@@ -0,0 +1,3 @@
|
||||
//<?php
|
||||
$class = e107::getBB()->getClass('tr');
|
||||
return "<tr class='{$class}'>".$code_text."</tr>";
|
@@ -1 +1,3 @@
|
||||
return "<span class='bbcode underline' style='text-decoration:underline'>$code_text</span>";
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('u');
|
||||
return "<span class='bbcode underline {$class}' style='text-decoration:underline'>$code_text</span>";
|
@@ -1,3 +1,5 @@
|
||||
//<?
|
||||
$class = e107::getBB()->getClass('url');
|
||||
global $pref;
|
||||
|
||||
$parm = trim($parm);
|
||||
@@ -8,12 +10,12 @@ if ($parm && $parm != 'external' && strpos($parm, ' ') === FALSE)
|
||||
$parm = preg_replace('#^external.#is', '', $parm);
|
||||
if (strtolower(substr($parm, 0, 11)) == 'javascript:')
|
||||
return '';
|
||||
return '<a href="'.$tp->toAttribute($parm).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
|
||||
return '<a href="'.$tp->toAttribute($parm).'" class="bbcode '.$class.'"'.$external.'>'.$code_text.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strtolower(substr($code_text, 0, 11)) == 'javascript:')
|
||||
return '';
|
||||
return '<a href="'.$tp->toAttribute($code_text).'" class="bbcode"'.$external.'>'.$code_text.'</a>';
|
||||
return '<a href="'.$tp->toAttribute($code_text).'" class="bbcode '.$class.'"'.$external.'>'.$code_text.'</a>';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user