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
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
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!
__________________
Follow my work on social media post-Graal:Updated august 2025.
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 11:02 PM.


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