Пример #1
0
 private function build_content()
 {
     $amp = new AMP_Content($this->post->post_content);
     $content = $amp->transform();
     $this->scripts = $amp->get_scripts();
     return $content;
 }
Пример #2
0
 function __construct($post_id)
 {
     $this->ID = $post_id;
     $this->post = get_post($post_id);
     $this->author = apply_filters('amp_post_author', get_userdata($this->post->post_author));
     $this->content_max_width = apply_filters('amp_content_max_width', isset($GLOBALS['content_width']) ? absint($GLOBALS['content_width']) : 600);
     $amp_content = new AMP_Content($this->post->post_content, array('content_max_width' => $this->content_max_width));
     $this->content = apply_filters('amp_post_content', $amp_content->transform(), $this->post);
     $this->scripts = apply_filters('amp_post_scripts', $amp_content->get_scripts(), $this->post);
     $this->metadata = apply_filters('amp_post_metadata', $this->build_metadata(), $this->post);
 }
Пример #3
0
 function __construct($post_id)
 {
     $this->ID = $post_id;
     $this->post = get_post($post_id);
     $this->author = apply_filters('amp_post_author', get_userdata($this->post->post_author), $this->post);
     $content_width = isset($GLOBALS['content_width']) ? absint($GLOBALS['content_width']) : 600;
     $this->content_max_width = apply_filters('amp_content_max_width', $content_width, $this->post);
     $amp_content = new AMP_Content($this->post->post_content, apply_filters('amp_content_embed_handlers', array('AMP_Twitter_Embed_Handler' => array(), 'AMP_YouTube_Embed_Handler' => array(), 'AMP_Gallery_Embed_Handler' => array(), 'AMP_Instagram_Embed_Handler' => array(), 'AMP_Vine_Embed_Handler' => array()), $this->post), apply_filters('amp_content_sanitizers', array('AMP_Blacklist_Sanitizer' => array(), 'AMP_Img_Sanitizer' => array(), 'AMP_Video_Sanitizer' => array(), 'AMP_Audio_Sanitizer' => array(), 'AMP_Iframe_Sanitizer' => array('add_placeholder' => true)), $this->post), array('content_max_width' => $this->content_max_width));
     $this->content = apply_filters('amp_post_content', $amp_content->transform(), $this->post);
     $this->scripts = apply_filters('amp_post_scripts', $amp_content->get_scripts(), $this->post);
     $this->metadata = apply_filters('amp_post_metadata', $this->build_metadata(), $this->post);
 }
Пример #4
0
 private function build_post_content()
 {
     $amp_content = new AMP_Content($this->post->post_content, apply_filters('amp_content_embed_handlers', array('AMP_Twitter_Embed_Handler' => array(), 'AMP_YouTube_Embed_Handler' => array(), 'AMP_Instagram_Embed_Handler' => array(), 'AMP_Vine_Embed_Handler' => array(), 'AMP_Facebook_Embed_Handler' => array(), 'AMP_Gallery_Embed_Handler' => array()), $this->post), apply_filters('amp_content_sanitizers', array('AMP_Style_Sanitizer' => array(), 'AMP_Blacklist_Sanitizer' => array(), 'AMP_Img_Sanitizer' => array(), 'AMP_Video_Sanitizer' => array(), 'AMP_Audio_Sanitizer' => array(), 'AMP_Iframe_Sanitizer' => array('add_placeholder' => true)), $this->post), array('content_max_width' => $this->get('content_max_width')));
     $this->add_data_by_key('post_amp_content', $amp_content->get_amp_content());
     $this->merge_data_for_key('amp_component_scripts', $amp_content->get_amp_scripts());
     $this->add_data_by_key('post_amp_styles', $amp_content->get_amp_styles());
 }
Пример #5
0
 private function build_content()
 {
     $content = new AMP_Content($this->post->post_content);
     return $content->transform();
 }