Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
Rainbow BBcode?
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
Rainbow BBcode?
PostPosted: 06/01/2007 4:13 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 9:04 PM
greatbrE.gif
I see there is one here and I found a Simple BBcode mod yesterday. Is this the same thing?

Code:
##############################################################
## MOD Title: Basic BBcodes
## MOD Author: 0racle < > (N/A) http://qbnz.com/phpBB
## MOD Description: Adds several basic BBCodes to the default installation: [br], [hr], [h1] - [h6], [rainbow], [sub], [sup], [serif], [sans], [mono], [md5] and [reverse].
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 1 Minute
## Files To Edit: includes/bbcode.php
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## This mod is easy to install, and adds some good bbcodes for "official"
## posts, like rules etc.
##
##############################################################
## MOD History:
##
##   2004-08-18 - Version 1.0.0
##      - Initial Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------
#

includes/bbcode.php

#
#-----[ FIND ]------------------------------------------
#

   // [i] and [/i] for italicizing text.
   $text = str_replace("[i:$uid]", $bbcode_tpl['i_open'], $text);
   $text = str_replace("[/i:$uid]", $bbcode_tpl['i_close'], $text);

#
#-----[ AFTER, ADD ]------------------------------------------
#

   //
   // BEGIN Basic codes mod
   //
  
   // [br] for adding line breaks
   $text = str_replace("[br:$uid]", '<br /><span style="display: none;">&nbsp;</span>', $text);
  
   // [hr] for adding a horizontal rule
   $text = str_replace("[hr:$uid]", '<hr />', $text);

   // [hX] for adding headers
   $text = str_replace("[h1:$uid]", '<span style="font-size: 24px; font-weight: bold;">', $text);
   $text = str_replace("[h2:$uid]", '<span style="font-size: 22px; font-weight: bold;">', $text);
   $text = str_replace("[h3:$uid]", '<span style="font-size: 20px; font-weight: bold;">', $text);
   $text = str_replace("[h4:$uid]", '<span style="font-size: 18px; font-weight: bold;">', $text);
   $text = str_replace("[h5:$uid]", '<span style="font-size: 16px; font-weight: bold;">', $text);
   $text = str_replace("[h6:$uid]", '<span style="font-size: 14px; font-weight: bold;">', $text);
  
   $text = preg_replace("#\[/h[1-6]:$uid\]#si", '</span>', $text);
  
   // [sub] for subscript text
   $text = str_replace("[sub:$uid]", '<sub>', $text);
   $text = str_replace("[/sub:$uid]", '</sub>', $text);

   // [sup] for superscript text
   $text = str_replace("[sup:$uid]", '<sup>', $text);
   $text = str_replace("[/sup:$uid]", '</sup>', $text);

   // [serif] for serif text
   $text = str_replace("[serif:$uid]", '<span style="font-family: serif;">', $text);
   $text = str_replace("[/serif:$uid]", '</span>', $text);

   // [sans] for sans-serif text
   $text = str_replace("[sans:$uid]", '<span style="font-family: sans-serif;">', $text);
   $text = str_replace("[/sans:$uid]", '</span>', $text);

   // [mono] for monospace text
   $text = str_replace("[mono:$uid]", '<span style="font-family: monospace;">', $text);
   $text = str_replace("[/mono:$uid]", '</span>', $text);

   // [md5] for md5 hashes
   $text = preg_replace("#\[md5:$uid\](.*?)\[/md5:$uid\]#sie", "md5('\\1')", $text);
  
   // [reverse] for reversing text
   $text = preg_replace("#\[reverse:$uid\](.*?)\[/reverse:$uid\]#sie", "strrev('\\1')", $text);

   // [rainbow] for rainbow-highlighting text
   $text = preg_replace("#\[rainbow:$uid\](.*?)\[/rainbow:$uid\]#sie", "rainbow('\\1')", $text);
  
   //
   // END Basic codes mod
   //

#
#-----[ FIND ]------------------------------------------
#

   // [i] and [/i] for italicizing text.
   $text = preg_replace("#\[i\](.*?)\[/i\]#si", "[i:$uid]\\1[/i:$uid]", $text);

#
#-----[ AFTER, ADD ]------------------------------------------
#

   //
   // BEGIN Basic codes mod
   //

   // [br] for adding a line break
   $text = preg_replace("#\[br\]#si", "[br:$uid]", $text);

   // [hr] for adding a horizontal rule
   $text = preg_replace("#\[hr\]#si", "[hr:$uid]", $text);

   // [hX] for adding titles
   $text = preg_replace("#\[h1\](.*?)\[/h1\]#si", "[h1:$uid]\\1[/h1:$uid]", $text);
   $text = preg_replace("#\[h2\](.*?)\[/h2\]#si", "[h2:$uid]\\1[/h2:$uid]", $text);
   $text = preg_replace("#\[h3\](.*?)\[/h3\]#si", "[h3:$uid]\\1[/h3:$uid]", $text);
   $text = preg_replace("#\[h4\](.*?)\[/h4\]#si", "[h4:$uid]\\1[/h4:$uid]", $text);
   $text = preg_replace("#\[h5\](.*?)\[/h5\]#si", "[h5:$uid]\\1[/h5:$uid]", $text);
   $text = preg_replace("#\[h6\](.*?)\[/h6\]#si", "[h6:$uid]\\1[/h6:$uid]", $text);

   // [sub] for subscript text
   $text = preg_replace("#\[sub\](.*?)\[/sub\]#si", "[sub:$uid]\\1[/sub:$uid]", $text);

   // [sup] for superscript text
   $text = preg_replace("#\[sup\](.*?)\[/sup\]#si", "[sup:$uid]\\1[/sup:$uid]", $text);

   // [serif] for serif text
   $text = preg_replace("#\[serif\](.*?)\[/serif\]#si", "[serif:$uid]\\1[/serif:$uid]", $text);

   // [sans] for sans text
   $text = preg_replace("#\[sans\](.*?)\[/sans\]#si", "[sans:$uid]\\1[/sans:$uid]", $text);

   // [mono] for monospace text
   $text = preg_replace("#\[mono\](.*?)\[/mono\]#si", "[mono:$uid]\\1[/mono:$uid]", $text);

   // [md5] for md5 hashes
   $text = preg_replace("#\[md5\](.*?)\[/md5\]#si", "[md5:$uid]\\1[/md5:$uid]", $text);

   // [reverse] for reverse text
   $text = preg_replace("#\[reverse\](.*?)\[/reverse\]#si", "[reverse:$uid]\\1[/reverse:$uid]", $text);

   // [rainbow] for rainbow-highlighting text
   $text = preg_replace("#\[rainbow\](.*?)\[/rainbow\]#si", "[rainbow:$uid]\\1[/rainbow:$uid]", $text);
   
   //
   // END Basic codes mod
   //

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//
// BEGIN Basic codes mod
//
function rainbow($text)
{
   //
   // Returns text highlighted in rainbow colours
   //
   
   if ( !defined('RAINBOW_COLORS_LOADED') )
   {
      $colors = load_rainbow_colors ();
   }
   $text = trim(stripslashes($text));
   $length = strlen($text);
   $result = '';
   $color_counter = 0;
   $TAG_OPEN = false;
   for ( $i = 0; $i < $length; $i++ )
   {
      $char = substr($text, $i, 1);
      if ( !$TAG_OPEN )
      {
         if ( $char == '<' )
         {
            $TAG_OPEN = true;
            $result .= $char;
         }
         elseif ( preg_match("#\S#i", $char) )
         {
            $color_counter++;
            $result .= '<span style="color: ' . $colors[$color_counter] . ';">' . $char . '</span>';
            $color_counter = ( $color_counter == 7 ) ? 0 : $color_counter;
         }
         else
         {
            $result .= $char;
         }
      }
      else
      {
         if ( $char == '>' )
         {
            $TAG_OPEN = false;
         }
         $result .= $char;
      }
   }
   return $result;
}

function load_rainbow_colors ()
{
   return array(
      1 => 'red',
      2 => 'orange',
      3 => 'yellow',
      4 => 'green',
      5 => 'blue',
      6 => 'indigo',
      7 => 'violet'
      );
}

//
// END Basic codes mod
//

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Rainbow BBcode?
PostPosted: 06/01/2007 4:44 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 5:04 PM
Location: St Pete, FL
peace.gif
Yep, that adds a lot of BBCode functionality but fails to add the BBCode buttons to the BBCode panel like what we have here.  To add the buttons, you follow the instructions I mentioned earlier tonight...

headbang
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Rainbow BBcode?
PostPosted: 06/01/2007 5:08 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 9:04 PM
greatbrE.gif
I have that already saved in my personal notes  headbang  hysterical2
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Rainbow BBcode?
PostPosted: 06/02/2007 5:50 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 5:04 PM
Location: St Pete, FL
peace.gif
If you run into any trouble adding the buttons, I will be happy to help you with that.  It's all pretty simple.  The hard part is figuring out a good way to layout the buttons so the panel looks nice.  I try to place the buttons with the longest text on the same column and the narrowest on another.  I think what I ended up with here isn't too bad...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Rainbow BBcode?
PostPosted: 06/03/2007 3:23 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 9:04 PM
greatbrE.gif
Great thanks NR  headbang The only thing with my Diddle template is that they are graphic buttons, I can't remember off hand for my GirlTalk2 template (thats for my new install, I'm having a choice for members)
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Rainbow BBcode?
PostPosted: 06/03/2007 5:35 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 5:04 PM
Location: St Pete, FL
peace.gif
The BBCode panel buttons on your Posting Body page are not graphic though, so you can add the buttons just like on any other forum...

headbang
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Rainbow BBcode?
PostPosted: 06/04/2007 7:21 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 9:04 PM
greatbrE.gif
Doh course they are! I don't knwo why I was thinking header buttons  Rolling Eyes  Embarassed

headbang
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: Rainbow BBcode?
PostPosted: 06/04/2007 5:33 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 5:04 PM
Location: St Pete, FL
peace.gif
Not a problem.  No harm done...

Dancing
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.0805s (PHP: 71% - SQL: 29%) - SQL queries: 51 - GZIP disabled - Debug on