@@ -31,8 +31,6 @@ public static function load() {
3131
3232 /**
3333 * AMP Setup by removing and adding new hooks.
34- *
35- * @return void
3634 */
3735 public static function setup () {
3836 // If we're not on an AMP page then bail.
@@ -103,7 +101,7 @@ public static function add_social_share_options() {
103101 * @return void
104102 */
105103 public static function print_styles () {
106- include dirname ( __DIR__ ) . '/assets/amp.css ' ;
104+ echo esc_html ( file_get_contents ( dirname ( __DIR__ ) . '/assets/amp.css ' ) ) ;
107105 }
108106
109107 /**
@@ -112,7 +110,7 @@ public static function print_styles() {
112110 * @return void
113111 */
114112 public static function enqueue_styles () {
115- wp_enqueue_style ( 'liveblog ' , plugin_dir_url ( __DIR__ ) . 'assets/amp.css ' );
113+ wp_enqueue_style ( 'liveblog ' , plugin_dir_url ( __DIR__ ) . 'assets/amp.css ' , array (), WPCOM_Liveblog:: VERSION );
116114 }
117115
118116
@@ -138,7 +136,7 @@ public static function social_meta_tags() {
138136
139137 $ entry = self ::get_entry ( $ request ->id , $ post ->ID );
140138 $ title = WPCOM_Liveblog_Entry::get_entry_title ( $ entry );
141- $ description = strip_tags ( $ entry ->content );
139+ $ description = wp_strip_all_tags ( $ entry ->content );
142140 $ url = self ::build_single_entry_permalink ( amp_get_permalink ( $ post ->ID ), $ entry ->id );
143141 $ image = self ::get_entry_image ( $ entry );
144142
@@ -191,7 +189,7 @@ public static function append_liveblog_to_metadata( $metadata, $post ) {
191189 /**
192190 * This filter is documented in liveblog.php
193191 */
194- $ metadata = WPCOM_Liveblog::get_liveblog_metadata ();
192+ $ metadata = WPCOM_Liveblog::get_liveblog_metadata ( $ metadata , $ post );
195193 }
196194
197195 return $ metadata ;
@@ -262,7 +260,8 @@ public static function build_single_entry( $entries, $request, $post_id ) {
262260 }
263261
264262 $ rendered = self ::get_template (
265- 'entry ' , array (
263+ 'entry ' ,
264+ array (
266265 'single ' => true ,
267266 'id ' => $ entry ->id ,
268267 'content ' => $ entry ->content ,
@@ -315,7 +314,8 @@ public static function get_entry( $id, $post_id, $entries = false ) {
315314 */
316315 public static function build_entries_feed ( $ entries , $ request , $ post_id ) {
317316 $ rendered = self ::get_template (
318- 'feed ' , array (
317+ 'feed ' ,
318+ array (
319319 'entries ' => self ::filter_entries ( $ entries ['entries ' ], $ post_id ),
320320 'post_id ' => $ post_id ,
321321 'page ' => $ entries ['page ' ],
@@ -395,7 +395,7 @@ public static function get_pagination_links( $request, $pages, $post_id ) {
395395
396396 $ links ['prev ' ] = false ;
397397 if ( $ request ->page > 1 ) {
398- $ keep_postion = ( (int ) $ request ->page === 2 ) ? false : $ request ->last ;
398+ $ keep_postion = ( 2 === (int ) $ request ->page ) ? false : $ request ->last ;
399399 $ links ['prev ' ] = self ::build_paged_permalink ( $ permalink , $ request ->page - 1 , $ keep_postion );
400400 }
401401
@@ -420,7 +420,8 @@ public static function build_paged_permalink( $permalink, $page, $last ) {
420420 array (
421421 'liveblog_page ' => $ page ,
422422 'liveblog_last ' => $ last ,
423- ), $ permalink
423+ ),
424+ $ permalink
424425 );
425426 }
426427
@@ -435,7 +436,8 @@ public static function build_single_entry_permalink( $permalink, $id ) {
435436 return add_query_arg (
436437 array (
437438 'liveblog_id ' => $ id ,
438- ), $ permalink
439+ ),
440+ $ permalink
439441 );
440442 }
441443
@@ -458,6 +460,6 @@ public static function get_template( $name, $variables = array() ) {
458460 */
459461 public static function is_amp_polling () {
460462 // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
461- return isset ( $ _GET [ self ::AMP_UPDATE_QUERY_VAR ] );
463+ return isset ( $ _GET [ self ::AMP_UPDATE_QUERY_VAR ] ); // phpcs:ignore WordPress.VIP.SuperGlobalInputUsage.AccessDetected
462464 }
463465}
0 commit comments