API:stripTags

From MODx Wiki

Jump to: navigation, search
 API Function Definition: 
stripTags
Versions 
> 0.6.0 ?
Return Values
Success: stripped string
Fail: null
Data Type 
string
Object Hierarchy 
DocumentParser
string stripTags(string $html[, string $allowed]);


Removes all HTML tags, TVs, snippets, settings, placeholders, and chunks from the given string. Optionally save $allowed HTML tags.

Examples

Related Functions

Source Code

File: manager/includes/document.parser.class.inc.php
Line: 2209
  1. function stripTags($html, $allowed= "") {
  2. $t= strip_tags($html, $allowed);
  3. $t= preg_replace('~\[\*(.*?)\*\]~', "", $t); //tv
  4. $t= preg_replace('~\[\[(.*?)\]\]~', "", $t); //snippet
  5. $t= preg_replace('~\[\!(.*?)\!\]~', "", $t); //snippet
  6. $t= preg_replace('~\[\((.*?)\)\]~', "", $t); //settings
  7. $t= preg_replace('~\[\+(.*?)\+\]~', "", $t); //placeholders
  8. $t= preg_replace('~{{(.*?)}}~', "", $t); //chunks
  9. return $t;
  10. }

Notes

Personal tools