Code:This hack will add a new flash bbcode to your forums.
The bbcode will look like this [swf width=# height=#]url[/swf]
The bbcode will not work if width or height is left out.
This also adds buttons to your posting page so users can add flash easily.
These instructions are based on a fresh install of phpBB 2.0.1 with no other bbcode hacks installed.
If you have other bbcode hacks installed follow the directions very carefully.
Make sure you backup your files before installing this hack.
This hack was created by Curtis Sanderson. ( sanderson_250@yahoo.com )
Support for this and other hacks can be found at http://phpbbhacks.com/forums/
---- Open /includes/bbcode.php -----
----- Find: -----
$bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']);
----- After add: -----
$bbcode_tpl['swf'] = str_replace('{WIDTH}', '\\1', $bbcode_tpl['swf']);
$bbcode_tpl['swf'] = str_replace('{HEIGHT}', '\\2', $bbcode_tpl['swf']);
$bbcode_tpl['swf'] = str_replace('{URL}', '\\3', $bbcode_tpl['swf']);
----- Find: -----
// [email]user@domain.tld[/email] code..
$patterns[5] = "#\[email\]([a-z0-9\-_.]+?@[\w\-]+\.([\w\-\.]+\.)?[\w]+)\[/email\]#si";
$replacements[5] = $bbcode_tpl['email'];
----- After add: ----- Careful if you've installed other bbcode hacks. The [7] may need to be changed.
// [swf width=# height=#]filename[/swf]
$patterns[7] = "#\[swf width=([0-9]?[0-9]?[0-9]) height=([0-9]?[0-9]?[0-9]):$uid\](.*?)\[/swf:$uid\]#si";
$replacements[7] = $bbcode_tpl[swf];
----- Find: -----
// [img]image_url_here[/img] code..
$text = preg_replace("#\[img\](([a-z]+?)://([^ \n\r]+?))\[/img\]#si", "[img:$uid]\\1[/img:$uid]", $text);
----- After add: -----
// [swf width=# height=#]url[/swf]
$text = preg_replace("#\[swf width=([0-9]?[0-9]?[0-9]) height=([0-9]?[0-9]?[0-9])\](([a-z]+?)://([^, \n\r]+))\[\/swf\]#si","[swf width=\\1 height=\\2:$uid\]\\3[/swf:$uid]", $text);
----- Save, close, and upload -----
----- Open /posting.php -----
----- Find: -----
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],
----- After add: ----- If you've installed other bbcode hacks you may already have a 'L_BBCODE_R_HELP' defined. In that case pick a letter that hasn't been used and use it instead of r in this hack. If you changed the letter in this step make sure you change it in all steps.
'L_BBCODE_R_HELP' => $lang['bbcode_r_help'],
----- Save, close, and upload -----
----- Open /language/lang_english/lang_main.php -----
----- Find: -----
$lang['bbcode_f_help'] = 'Font size: [size=x-small]small text[/size]';
----- After add: -----
$lang['bbcode_r_help'] = 'Flash: [swf width=# height=#]http://swf_url[/swf]';
----- Save, close, and upload -----
----- Open /templates/subSilver/bbcode.tpl -----
----- Find: -----
<!-- BEGIN email --><a href="mailto:{EMAIL}">{EMAIL}</A><!-- END email -->
----- After add: -----
<!-- BEGIN swf -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width={WIDTH} height={HEIGHT}>
<param name=movie value={URL}>
<param name=quality value="best">
<param name=menu value=false>
<param name=wmode value=transparent>
<embed src="{URL}" quality=best wmode=transparent width={WIDTH} height={HEIGHT} type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</object>
<!-- END swf -->
----- Save, close, and upload -----
----- Open /templates/subSilver/posting_body.tpl -----
----- Find: -----
f_help = "{L_BBCODE_F_HELP}";
----- After add: -----
r_help = "{L_BBCODE_R_HELP}";
----- Find: ----- In the rest of these steps pay close attention to the numbers if you've installed other bbcode hacks. The numbers should increase by 2 for each bbcode.
<td><span class="genmed">
<input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
</span></td>
----- After add: -----
<td><span class="genmed">
<input type="button" class="button" accesskey="r" name="addbbcode18" value="Flash" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('r')" />
</span></td>
----- Find: ----- If you have other bbcode hacks installed do not replace but add ,'[swf width= height=]','[/swf] onto the end so it looks like ,'[swf width= height=]','[/swf]');
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
----- Replace with: -----
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[swf width= height=]','[/swf]');
----- Find: -----
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
----- Replace with: -----
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]')" onMouseOver="helpline('s')">
----- Find: -----
</select> {L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
----- Replace with: -----
</select> {L_FONT_SIZE}:<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">
----- Save, close and upload. -----
That's it. You should now have a working flash bbcode.
|