| 1409 | | ?> |
|---|
| | 1409 | /* |
|---|
| | 1410 | * strip_all_tags() - strip all html and php tags, improved version of strip_tags() |
|---|
| | 1411 | * |
|---|
| | 1412 | * will remove all tags, including <script> and <style> |
|---|
| | 1413 | * |
|---|
| | 1414 | * @param string $str The input string that needs stripping of tags |
|---|
| | 1415 | * @param string $keep Optional. Keep some tags. |
|---|
| | 1416 | * HTML comments (including the <!--more--> tag), <script>, <style> and php tags are always removed |
|---|
| | 1417 | */ |
|---|
| | 1418 | function strip_all_tags( $str, $keep = '' ) { |
|---|
| | 1419 | |
|---|
| | 1420 | if ( strpos( $str, '<script' ) ) |
|---|
| | 1421 | $str = preg_replace( '|<script[^>]*?>.*?</script>|si', '', $str ); |
|---|
| | 1422 | |
|---|
| | 1423 | if ( strpos( $str, '<style' ) ) |
|---|
| | 1424 | $str = preg_replace( '|<style[^>]*?>.*?</style>|si', '', $str ); |
|---|
| | 1425 | |
|---|
| | 1426 | return strip_tags( $str, $keep ); |
|---|
| | 1427 | } |
|---|
| | 1428 | |
|---|
| | 1429 | ?> |