21
ghia
Re: xoopsCodeDecode
  • 2008/11/24 11:48

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


You have to reorder them as I said before from specific to general like
$patterns[] = "//sU"

before
$patterns[] = "//sU";


22
Anonymous
Re: xoopsCodeDecode
  • 2008/11/24 12:06

  • Anonymous

  • Posts: 0

  • Since:


Thank you ... it is working now after reorder it

http://www.arabxoops.com/uploads/latestnews.txt


23
Anonymous
Re: xoopsCodeDecode
  • 2008/12/2 0:47

  • Anonymous

  • Posts: 0

  • Since:


Now I'm trying to clean the content from HTML and BBcode tags for get plain text without any formating. I added this lines:

$tags = array('/<\?((?!\?>).)*\?>/s');
$text = strip_tags(preg_replace($tags, '', $text),''); // cleaning XHTML in content

Only img and anchor tags are allowed to display inside the contenet.

But after
xdhtml editor installed, there are bbcode tags appear in the content:

Resized Image

What is the perfect solution ? am I need to make other strip_tags for bbcode and what the right array to use ?


24
psindia
Re: xoopsCodeDecode
  • 2008/12/2 10:47

  • psindia

  • Not too shy to talk

  • Posts: 171

  • Since: 2005/3/31


I which file are u trying to edit this

$tags = array('/).)*?>/s');
$text strip_tags(preg_replace($tags''$text),''); // cleaning XHTML


Plese ellaborate the situation with a demo link

25
Anonymous
Re: xoopsCodeDecode
  • 2008/12/2 12:26

  • Anonymous

  • Posts: 0

  • Since:


I'm using this code in latestnews/blocks/latesnews.php and you can see the whole code here:
http://www.arabxoops.com/uploads/latestnews.txt

Demo: http://www.saudigear.com/emag/modules/dummy/

26
Anonymous
Re: xoopsCodeDecode
  • 2009/1/7 1:13

  • Anonymous

  • Posts: 0

  • Since:


Thanks to psindia for his solution ( sent by email ), I include it with my code:

$tags = array('/).)*?>/s');

$imgtag '';

if(
$options[8] ==1) { $imgtag ""; } // hide/show article images 

$cleantext strip_tags(preg_replace($tags''$news['text']), '

Now what is the reverse function of strip_tags ? I mean how to remove all except img tag ?

27
ghia
Re: xoopsCodeDecode
  • 2009/1/7 10:42

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Grr, the code window is still misrepresenting code!!!
?>).)*?>
should be
Quote:
<\?((?!\?>).)*\?>

The strip_tags removes all html tags except

28
Anonymous
Re: xoopsCodeDecode
  • 2009/1/7 14:14

  • Anonymous

  • Posts: 0

  • Since:


The file updated now, it was for old version. $option[8] is for hide/show images in the articles.

Now I need to add new option which hide everything except images. so what is the php function can remove all except image or can I use strip_tags for that ?

29
jimmyx
Re: xoopsCodeDecode
  • 2009/1/7 14:37

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


can someone report this to the sf bug tracker..Quote:

ghia wrote:
Grr, the code window is still misrepresenting code!!!

30
ghia
Re: xoopsCodeDecode
  • 2009/1/7 15:32

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
Now I need to add new option which hide everything except images. so what is the php function can remove all except image or can I use strip_tags for that ?

Yes:
$imgtag '';
$othertag '';

if(
$options[8] ==1) { $imgtag ""; } // hide/show article images 
if($options[99] ==1) { $othertag "


Login

Who's Online

354 user(s) are online (241 user(s) are browsing Support Forums)


Members: 0


Guests: 354


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