Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-16-2013, 12:38 AM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
HTML Filter

I wrote a function that removes all HTML from a string.

PHP Code:
function onCreated()
  
filterHTML("Hi my name is definitely not <b>dylan</b> and I <a href=http//google.com/>may or may</a> not be slightly insane.<br>");

function 
filterHTML(temp.text)
{
  echo(
"Unfiltered:" SPC temp.text);
  
  do {
    
temp.htmlStart temp.text.pos("<");
    
temp.htmlEnd   temp.text.pos(">");
    
    
temp.text  temp.text.substring(0temp.htmlStart) @ temp.text.substring(temp.htmlEnd 1);
  } while (
temp.text.pos("<") > -1);
  
  echo(
"Filtered:" SPC temp.text);

  return 
temp.text;

PHP Code:
UnfilteredHi my name is definitely not <b>dylan</b> and <a href=http//google.com/>may or may</a> not be slightly insane.<br>
FilteredHi my name is definitely not dylan and I may or may not be slightly insane
Enjoy!
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.