Nakaka Nakaka
  • Just popping in
  • Just popping in
  • Joined: 2007/5/6 23:00
  • Group: Registered Users
  • Posts: 4
  • Posted on: 2007/5/7 21:27
uppercase BBcode doens't work? #1
Like the title says, why doesn't uppercase bbcode work and lowercase does? Is there any way I can fix this? I'm using newbb.
JMorris JMorris
  • XOOPS is my life!
  • XOOPS is my life!
  • Joined: 2004/4/11 13:55
  • From 127.0.0.1
  • Group: BANNED Users
  • Posts: 2722
  • Posted on: 2007/5/7 22:02
Re: uppercase BBcode doens't work? #2
BBCode is CaSe SeNsiTiVe. Unless you rewrite the class, you will need to use lowercase characters.
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.
Nakaka Nakaka
  • Just popping in
  • Just popping in
  • Joined: 2007/5/6 23:00
  • Group: Registered Users
  • Posts: 4
  • Posted on: 2007/5/7 22:08
Re: uppercase BBcode doenst work? #3
In most forums you can use uppercase, and it makes it very hard to copy and paste long tutorials.
JMorris JMorris
  • XOOPS is my life!
  • XOOPS is my life!
  • Joined: 2004/4/11 13:55
  • From 127.0.0.1
  • Group: BANNED Users
  • Posts: 2722
  • Posted on: 2007/5/7 22:17
Re: uppercase BBcode doenst work? #4
You can place a Feature Request at SF.net.

If you, or someone else has the skill to rewrite the class, you can submit your code at the Core Development Forums at SF.net for Core Dev review.
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.
3lr0n 3lr0n
  • Not too shy to talk
  • Not too shy to talk
  • Joined: 2004/3/13 13:38
  • Group: Registered Users
  • Posts: 167
  • Posted on: 2007/5/8 1:57
Re: uppercase BBcode doenst work? #5
Its easier than it sounds..

you only have to open ../class/module.textsanitizer.php and add bbcodes, for example:

$patterns[] = "/[url=(['"]?)(http[s]?://[^"'<>]*)\1](.*)[/url]/sU";
        
$replacements[] = '<a href="\2" target="_blank">\3</a>';


just add after (or whereever you want)

$patterns[] = "/[URL=(['"]?)(http[s]?://[^"'<>]*)\1](.*)[/URL]/sU";
        
$replacements[] = '<a href="\2" target="_blank">\3</a>';


This made a new bbcode called URL in uppercases.

Works for all, just change to uppercase

If you want to add new bbcodes you can do it same way (dinamic sigs, etc..)
Spanish Overclocking Community xoops based site : www.overclocking.es
iHackCode iHackCode
  • Module Developer
  • Module Developer
  • Joined: 2004/6/28 20:11
  • From Greater Seattle Area
  • Group: Registered Users Wiki Group
  • Posts: 1016
  • Posted on: 2007/5/8 2:15
Re: uppercase BBcode doenst work? #6
here is something from my site . its basically does the same as above. but the example shown is the img tag.

Using Case Insensitive BBcodes In XooPS
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧
zyspec zyspec
  • Module Developer
  • Module Developer
  • Joined: 2004/9/21 9:28
  • From USA
  • Group: Registered Users
  • Posts: 980
  • Posted on: 2007/5/8 11:54
Re: uppercase BBcode doenst work? #7
Here's some mods I've been using... Just replace the &xoopsCodeDecode function with this one in /class/module.textsanitizer.php
function &xoopsCodeDecode(&$text$allowimage 1)
{
    
// - added sub, sup, hr, ol (with list-style-type support), ul and made all bbcodes case insensitive
    // - changed [b],[i],[u] to use html styles instead of <b>,<i>,<u> respectively
    //   Notes:
    //     1) Default 2.0.16 theme style sheet defines <ul> and <li> list-styles which effect bullet types
    //     2) Supported <ol> list-style-type(s) vary by browser (e.g. IE supports lower-alpha, Firefox supports lower-latin)

    
$patterns = array();
    
$replacements = array();
    
//$patterns[] = "/[code](.*)[/code]/esU";
    //$replacements[] = "'<div class="xoopsCode"><code><pre>'.wordwrap(MyTextSanitizer::htmlSpecialChars('\1'), 100).'</pre></code></div>'";
    // RMV: added new markup for intrasite url (allows easier site moves)
    // TODO: automatically convert other URLs to this format if XOOPS_URL matches??
    
$patterns[] = "/[siteurl=(['"]?)([^"'<>]*)\1](.*)[/siteurl]/sUi";
    
$replacements[] = '<a href="'.XOOPS_URL.'/\2">\3</a>';
    
$patterns[] = "/[url=(['"]?)(http[s]?://[^"'<>]*)\1](.*)[/url]/sUi";
    
$replacements[] = '<a href="\2" target="_blank">\3</a>';
    
$patterns[] = "/[url=(['"]?)([Ff][Tt][Pp]?://[^"'<>]*)\1](.*)[/url]/sUi";
    
$replacements[] = '<a href="\2" target="_blank">\3</a>';
    
$patterns[] = "/[url=(['"]?)([^"'<>]*)\1](.*)[/url]/sU";
    
$replacements[] = '<a href="http://\2" target="_blank">\3</a>';
    
$patterns[] = "/[color=(['"]?)([a-zA-Z0-9]*)\1](.*)[/color]/sUi";
    
$replacements[] = '<span style="color#\2;">\3</span>';
    
$patterns[] = "/[size=(['"]?)([a-z0-9-]*)\1](.*)[/size]/sUi";
    
$replacements[] = '<span style="font-size\2;">\3</span>';
    
$patterns[] = "/[font=(['"]?)([^;<>*()"']*)\1](.*)[/font]/sUi";
    
$replacements[] = '<span style="font-family\2;">\3</span>';
    
$patterns[] = "/[email]([^;<>*()"']*)[/email]/sU";
    
$replacements[] = '<a href="mailto:\1">\1</a>';
    
$patterns[] = "/[[Bb]](.*)[/[Bb]]/sU";
    
$replacements[] = '<span style="font-weight: bold;">\1</span>';
    
$patterns[] = "/[[Ii]](.*)[/[Ii]]/sU";
    
$replacements[] = '<span style="font-style: italic;">\1</span>';
    
$patterns[] = "/[[Uu]](.*)[/[Uu]]/sU";
    
$replacements[] = '<span style="text-decoration: underline;">\1</span>';
    
$patterns[] = "/[[Dd]](.*)[/[Dd]]/sU";
    
$replacements[] = '<del>\1</del>';

    
$patterns[] = "/[sub](.*)[/sub]/sUi";
    
$replacements[] = '<sub>\1</sub>';
    
$patterns[] = "/[sup](.*)[/sup]/sUi";
    
$replacements[] = '<sup>\1</sup>';
    
$patterns[] = "/[hr]/sUi";
    
$replacements[] = '<hr />';
    
$patterns[] = "/[hr=([0-9]+)(.*)]/sUi";
    
$replacements[] = '<hr style="width: \1\2;" />';
    
$patterns[] = "/[list](.*)[/list]/sUi";
    
$replacements[] = '<ul>\1</ul>';
    
$patterns[] = "/[list=(.*)](.*)[/list]/sUi";
    
$replacements[] = '<ol style="list-style-type: \1;">\2</ol>';
    
$patterns[] = "/[li](.*)[/li]/sUi";
    
$replacements[] = '<li>\1</li>';

    
//$patterns[] = "/[li](.*)[/li]/sU";
    //$replacements[] = '<li>\1</li>';
    
$patterns[] = "/[[Ii][Mm][Gg] [Aa][Ll][Ii][Gg][Nn]=(['"]?)([Ll][Ee][Ff][Tt]|[Cc][Ee][Nn][Tt][Ee][Rr]|[Rr][Ii][Gg][Hh][Tt])\1]([^"()?&'<>]*)[/[Ii][Mm][Gg]]/sU";
    
$patterns[] = "/[[Ii][Mm][Gg]]([^"()?&'<>]*)[/[Ii][Mm][Gg]]/sU";
    $patterns[] = "/[[Ii][Mm][Gg] [Aa][Ll][Ii][Gg][Nn]=(['"]?)([Ll][Ee][Ff][Tt]|[Cc][Ee][Nn][Tt][Ee][Rr]|[Rr][Ii][Gg][Hh][Tt])\1 [Ii][Dd]=(['"
]?)([0-9]*)\3]([^"()?&'<>]*)[/[Ii][Mm][Gg]]/sU";
    
$patterns[] = "/[[Ii][Mm][Gg] [Ii][Dd]=(['"]?)([0-9]*)\1]([^"()?&'<>]*)[/[Ii][Mm][Gg]]/sU";
    if (
$allowimage != 1) {
        
$replacements[] = '<a href="\3" target="_blank">\3</a>';
        
$replacements[] = '<a href="\1" target="_blank">\1</a>';
        
$replacements[] = '<a href="'.XOOPS_URL.'/image.php?id=\4" target="_blank">\4</a>';
        
$replacements[] = '<a href="'.XOOPS_URL.'/image.php?id=\2" target="_blank">\3</a>';
    } else {
        
$replacements[] = '<img src="\3" align="\2" alt="" />';
        
$replacements[] = '<img src="\1" alt="" />';
        
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\4" align="\2" alt="\4" />';
        
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\2" alt="\3" />';
    }
// REMOVE THE SPACE BEFORE the word quote in the next line...
    
$patterns[] = "/[ quote]/sUi";
    
$replacements[] = _QUOTEC.'<div class="xoopsQuote"><blockquote>';
    
//$replacements[] = 'Quote: <div class="xoopsQuote"><blockquote>';
    
$patterns[] = "/[/quote]/sUi";
    
$replacements[] = '</blockquote></div>';
    
$text str_replace"x00"""$text );
    
$c "[x01-x1f]*";
    
$patterns[] = "/j{$c}a{$c}v{$c}a{$c}s{$c}c{$c}r{$c}i{$c}p{$c}t{$c}:/si";
    
$replacements[] = "(script removed)";
    
$patterns[] = "/a{$c}b{$c}o{$c}u{$c}t{$c}:/si";
    
$replacements[] = "about :";
    
$text preg_replace($patterns$replacements$text);
    return 
$text;
}

NOTE: You must delete a space (x020) in the code above (about 1/3 of the way up from the bottom of the code) before you 'cut-n-paste' this into the file. I had to do this so it would show okay in the forum

You'll note I've also added support for:
- [sub] & [sup]
- [hr] & [hr=xx] (where xx is width - can use either % or px)
- [list] (unordered lists)
- [list=xyz] (ordered list with list-style-type support)
- changed [b],[i],[u] to use html styles
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team