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 )
Esempio n. 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);
 }
Esempio n. 2
0
 public function onCompleted(ProxyEvent $event)
 {
     $this->youtube_url = $event['request']->getUrl();
     $response = $event['response'];
     $output = $response->getContent();
     // remove top banner that's full of ads
     $output = Html::remove("#header", $output);
     // do this on all youtube pages
     $output = preg_replace('@masthead-positioner">@', 'masthead-positioner" style="position:static;">', $output, 1);
     // replace future thumbnails with src=
     $output = preg_replace('#<img[^>]*data-thumb=#s', '<img alt="Thumbnail" src=', $output);
     $links = $this->get_youtube_links($output);
     // we must be on a video page
     if ($links) {
         // the only ones supported by flowplayer
         $flv_itags = array(5, 34, 35);
         // supported by html5 player
         $mp4_itags = array(18, 22, 37, 38, 82, 84);
         // not supported by any player at the moment
         $webm_itags = array(43, 44, 46, 100, 102);
         // find first available mp4 video
         $mp4_url = $this->find_first_available($links, $mp4_itags);
         //$mp4_itags);
         $player = vid_player($mp4_url, 640, 390, 'mp4');
         // this div blocks our player controls
         $output = Html::remove("#theater-background", $output);
         // replace youtube player div block with our own
         $output = Html::replace_inner("#player-api", $player, $output);
     }
     // causes too many problems...
     $output = Html::remove_scripts($output);
     $response->setContent($output);
 }