Example #1
0
 /**
  * @dataProvider get_scripts_data
  */
 public function test__get_scripts($source, $expected)
 {
     $embed = new AMP_Instagram_Embed_Handler();
     $embed->register_embed();
     apply_filters('the_content', $source);
     $scripts = $embed->get_scripts();
     $this->assertEquals($expected, $scripts);
 }
Example #2
0
 public function transform()
 {
     $content = $this->original_content;
     $twitter_embed = new AMP_Twitter_Embed_Handler();
     $youtube_embed = new AMP_YouTube_Embed_Handler();
     $gallery_embed = new AMP_Gallery_Embed_Handler();
     $instagram_embed = new AMP_Instagram_Embed_Handler();
     $content = apply_filters('the_content', $content);
     $this->add_scripts($twitter_embed->get_scripts());
     $this->add_scripts($youtube_embed->get_scripts());
     $this->add_scripts($gallery_embed->get_scripts());
     $this->add_scripts($instagram_embed->get_scripts());
     $dom = AMP_DOM_Utils::get_dom_from_content($content);
     $this->sanitize(new AMP_Blacklist_Sanitizer($dom, $this->args));
     $this->sanitize(new AMP_Img_Sanitizer($dom, $this->args));
     $this->sanitize(new AMP_Video_Sanitizer($dom, $this->args));
     $this->sanitize(new AMP_Iframe_Sanitizer($dom, $this->args));
     $this->sanitize(new AMP_Audio_Sanitizer($dom, $this->args));
     $content = AMP_DOM_Utils::get_content_from_dom($dom);
     return $content;
 }