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[] = '\3';


just add after (or whereever you want)

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


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 : http://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 ,, respectively
    //   Notes:
    //     1) Default 2.0.16 theme style sheet defines 
     and 
  •  list-styles which effect bullet types
        //     2) Supported 
       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[] = "'
      '.wordwrap(MyTextSanitizer::htmlSpecialChars('\1'), 100).'
'";
    // 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[] = '.XOOPS_URL.'/\2">\3';
    
$patterns[] = "/[url=(['"]?)(http[s]?://[^"'<>]*)\1](.*)[/url]/sUi";
    
$replacements[] = '\3';
    
$patterns[] = "/[url=(['"]?)([Ff][Tt][Pp]?://[^"'<>]*)\1](.*)[/url]/sUi";
    
$replacements[] = '\3';
    
$patterns[] = "/[url=(['"]?)([^"'<>]*)\1](.*)[/url]/sU";
    
$replacements[] = '\3';
    
$patterns[] = "/[color=(['"]?)([a-zA-Z0-9]*)\1](.*)[/color]/sUi";
    
$replacements[] = 'color#\2;">\3';
    
$patterns[] = "/[size=(['"]?)([a-z0-9-]*)\1](.*)[/size]/sUi";
    
$replacements[] = 'font-size\2;">\3';
    
$patterns[] = "/[font=(['"]?)([^;<>*()"']*)\1](.*)[/font]/sUi";
    
$replacements[] = 'font-family\2;">\3';
    
$patterns[] = "/[email]([^;<>*()"']*)[/email]/sU";
    
$replacements[] = '\1';
    
$patterns[] = "/[[Bb]](.*)[/[Bb]]/sU";
    
$replacements[] = '\1'
;
    
$patterns[] = "/[[Ii]](.*)[/[Ii]]/sU";
    
$replacements[] = '\1';
    
$patterns[] = "/[[Uu]](.*)[/[Uu]]/sU";
    
$replacements[] = '\1';
    
$patterns[] = "/[[Dd]](.*)[/[Dd]]/sU";
    
$replacements[] = '\1';

    
$patterns[] = "/[sub](.*)[/sub]/sUi";
    
$replacements[] = '\1';
    
$patterns[] = "/[sup](.*)[/sup]/sUi";
    
$replacements[] = '\1';
    
$patterns[] = "/[hr]/sUi";
    
$replacements[] = '';
    
$patterns[] = "/[hr=([0-9]+)(.*)]/sUi";
    
$replacements[] = '';
    
$patterns[] = "/[list](.*)[/list]/sUi";
    
$replacements[] = '
    \1
'
;
    
$patterns[] = "/[list=(.*)](.*)[/list]/sUi";
    
$replacements[] = '\2';
    
$patterns[] = "/[li](.*)[/li]/sUi";
    
$replacements[] = '
  • \1
  • '
    ;

        
    //$patterns[] = "/[li](.*)[/li]/sU";
        //$replacements[] = '
  • \1
  • ';
        
    $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[] = '\3';
            
    $replacements[] = '\1';
            
    $replacements[] = '.XOOPS_URL.'/image.php?id=\4" target="_blank">\4';
            
    $replacements[] = '.XOOPS_URL.'/image.php?id=\2" target="_blank">\3';
        } else {
            
    $replacements[] = '';
            
    $replacements[] = '';
            
    $replacements[] = '.XOOPS_URL.'/image.php?id=\4" align="\2" alt="\4" />';
            
    $replacements[] = '.XOOPS_URL.'/image.php?id=\2" alt="\3" />';
        }
    // REMOVE THE SPACE BEFORE the word quote in the next line...
        
    $patterns[] = "/[ quote]/sUi";
        
    $replacements[] = _QUOTEC.'
    ';
        
    //$replacements[] = 'Quote: 
    ';
        $patterns[] = "/[/quote]/sUi";
        
    $replacements[] = '
    ';
        
    $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

    337 user(s) are online (239 user(s) are browsing Support Forums)


    Members: 0


    Guests: 337


    more...

    Donat-O-Meter

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

    Latest GitHub Commits