wproUtilities

Availability: >= 3.0 

Type: PHP Class Object

Description: This class contains useful functions for post-processing HTML generated by the editor.

File to include: wysiwygPro/wproUtilities.class.php

The functions available through the wproUtilities class can be used to validate the HTML code generated by WysiwygPro.

Example:

The following example retrieves the code from an editor named 'myEditor' and then removes unwanted tags, attributes and encodes email addresses to hide them from spam bots:


include_once('wysiwygPro/wproUtilities.class.php');

$code $_POST['myEditor'];

// encode email addresses:
$code wproUtilities::emailEncode($code);

// remove unwanted tags
$code wproUtilities::removeTags ($code, array(
    
'object' => true,
    
'embed' => true,
    
'applet' => true,
    
'script' => true
));
  
// remove unwanted attributes
$code wproUtilities::removeAttributes($code, array("on[A-Z]+"));
   
// now you can safely save the code to your database....

?>
 


For more sophisticated validation of HTML code you might like to investigate PHP's Tidy extension: http://www.php.net/tidy

closeTags
closeTags Availability: >= 3.0 Type: Object Method Description: Closes any
cutHTML
cutHTML Availability: >= 3.0 Type: Object Method Description: Cuts an
emailEncode
emailEncode Availability: >= 3.0 Type: Object Method Description: Encodes email
longWordBreak
longWordBreak Availability: >= 3.0 Type: Object Method Description: If users
removeAttributes
removeAttributes Availability: >= 3.0 Type: Object Method Description: Removes unwanted
removeTags
removeTags Availability: >= 3.0 Type: Object Method Description: If users