1
MS-2001
Function to remove XOOPS-Code
  • 2005/7/1 15:45

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Is there allready a function to remove xoops-code from a string before showing it?

e.g.:

[color=FF6600]blabla[/color ] in database
blabla on the website

i dont want the "blabla" to be orange, just remove the tag

2
MS-2001
Re: Function to remove XOOPS-Code
  • 2005/7/3 11:15

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


No idea?

3
Dave_L
Re: Function to remove XOOPS-Code
  • 2005/7/3 12:41

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


From class/module.textsanitizer.php:

/**
 * Filters textarea form data in DB for display
 *
 * @param   string  $text
 * @param   bool    $html   allow html?
 * @param   bool    $smiley allow smileys?
 * @param   bool    $xcode  allow xoopscode?
 * @param   bool    $image  allow inline images?
 * @param   bool    $br     convert linebreaks?
 * @return  string
**/
function &displayTarea(&$text$html 0$smiley 1$xcode 1$image 1$br 1)


Try this:

$myts myTextSanitizer::getInstance();
$newtext $myts->displayTarea($text00000);

4
MS-2001
Re: Function to remove XOOPS-Code
  • 2005/7/3 15:12

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Doesnt work. The tags still remain.

5
MS-2001
Re: Function to remove XOOPS-Code
  • 2005/7/6 11:17

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Any other idea?

6
Dave_L
Re: Function to remove XOOPS-Code
  • 2005/7/6 11:54

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Try:

$myts myTextSanitizer::getInstance();
$newtext strip_tags($myts->displayTarea($text00100));

7
phppp
Re: Function to remove XOOPS-Code
  • 2005/7/6 12:42

  • phppp

  • XOOPS Contributor

  • Posts: 2857

  • Since: 2004/1/25


in class/module.textsanitizer.php

$patterns[] = "/[color=(['"]?)([a-zA-Z0-9]*)\1](.*)[/color]/sU";
        
$replacements[] = 'color#\2;">\3';


change to
$patterns[] = "/[color=(['"]?)([a-zA-Z0-9]*)\1](.*)[/color]/sU";
        
$replacements[] = '\3';


I did not test by myself

8
MS-2001
Re: Function to remove XOOPS-Code
  • 2005/7/6 14:34

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Well I'd need a new function then because i still want to use the XOOPS-Codes expect for one module-page

9
MS-2001
Re: Function to remove XOOPS-Code
  • 2005/7/9 16:48

  • MS-2001

  • Quite a regular

  • Posts: 204

  • Since: 2004/7/27


Quote:

Dave_L wrote:
Try:

$myts myTextSanitizer::getInstance();
$newtext strip_tags($myts->displayTarea($text00100));


Thanks a lot. That's it

Login

Who's Online

457 user(s) are online (396 user(s) are browsing Support Forums)


Members: 0


Guests: 457


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