Proxy\Plugin\XHamsterPlugin::onCompleted PHP Method

onCompleted() public method

public onCompleted ( Proxy\Event\ProxyEvent $event )
$event Proxy\Event\ProxyEvent
    public function onCompleted(ProxyEvent $event)
    {
        $response = $event['response'];
        $content = $response->getContent();
        // remove ts_popunder stuff
        $content = preg_replace('/<script[^>]*no-popunder[^>]*><\\/script>/m', '', $content);
        $content = preg_replace_callback('/<img[^>]*sprite=\'(.*?)\'/im', array($this, 'img_sprite'), $content);
        // are we on a video page?
        $file = $this->find_video($content);
        if ($file) {
            $player = vid_player($file, 638, 504);
            $content = Html::replace_inner("#playerSwf", $player, $content);
        }
        $response->setContent($content);
    }