1
Nakaka
uppercase BBcode doens't work?
  • 2007/5/8 1:27

  • Nakaka

  • Just popping in

  • Posts: 4

  • Since: 2007/5/7 3


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.

2
JMorris
Re: uppercase BBcode doens't work?
  • 2007/5/8 2:02

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


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.

3
Nakaka
Re: uppercase BBcode doenst work?
  • 2007/5/8 2:08

  • Nakaka

  • Just popping in

  • Posts: 4

  • Since: 2007/5/7 3


In most forums you can use uppercase, and it makes it very hard to copy and paste long tutorials.

4
JMorris
Re: uppercase BBcode doenst work?
  • 2007/5/8 2:17

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


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.

5
3lr0n
Re: uppercase BBcode doenst work?
  • 2007/5/8 5:57

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


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

6
iHackCode
Re: uppercase BBcode doenst work?

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

(ノ◕ヮ◕)ノ*:・゚✧

7
zyspec
Re: uppercase BBcode doenst work?
  • 2007/5/8 15:54

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


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

Login

Who's Online

121 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 121


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits