Proxy\Html::remove_scripts PHP Method

remove_scripts() public static method

* $outputSource = preg_replace("/><\/(area|base|br|col|command|embed|hr|img|input|link|meta|param|source)>/", " />", $outputSource); $html = mb_eregi_replace("", '', $html); remove white space before closing tags $html = mb_eregi_replace("'\s+>", "'>", $html); $html = mb_eregi_replace('"\s+>', '">', $html);
public static remove_scripts ( $html )
    public static function remove_scripts($html)
    {
        $html = mb_eregi_replace("<\\s*script[^>]*[^/]>(.*?)<\\s*/\\s*script\\s*>", '', $html);
        $html = mb_eregi_replace("<\\s*script\\s*>(.*?)<\\s*/\\s*script\\s*>", '', $html);
        return $html;
    }

Usage Example

コード例 #1
0
 public function onCompleted(ProxyEvent $event)
 {
     // there is some problem with content-length when submitting form...
     $response = $event['response'];
     $content = $response->getContent();
     // remove all javascript
     $content = Html::remove_scripts($content);
     $response->setContent($content);
 }
All Usage Examples Of Proxy\Html::remove_scripts