Skip to content

Commit e5dc952

Browse files
committed
Merge branch 'release/1.9.1'
2 parents ddfb1c6 + eb05841 commit e5dc952

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+14105
-428
lines changed

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,7 @@ matrix:
2424
env:
2525
- SNIFF=1
2626
- WP_VERSION=latest
27-
# aliased to a recent hhvm version
28-
- php: 'hhvm'
29-
env: WP_VERSION=latest
3027

31-
allow_failures:
32-
- php: 'hhvm'
3328

3429
before_script:
3530
# Set up CodeSniffer

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 1.9.1
4+
5+
* Multiple coding standards fixes
6+
* Removes unused debug code
7+
* Fix rendering embeds upon entry updates
8+
* Avoid null dereference in `get_user_data_for_json()`
9+
* Improvements to code review process
10+
11+
props, [cain](https://github.com/cain), [GaryJones](https://github.com/GaryJones), [maevelander](https://github.com/maevelander), [paulschreiber](https://github.com/paulschreiber), [philipjohn](https://github.com/philipjohn), [rgllm](https://github.com/rgllm), [rogertheriault](https://github.com/rogertheriault)
12+
313
## 1.9
414

515
* Round out polling timestamp for improved performance (#496)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Requires at least: 4.4
77
* Requires PHP: 5.6
88
* Tested up to: 4.9.8
9-
* Stable tag: 1.9
9+
* Stable tag: 1.9.1
1010
* License: GPLv2 or later
1111
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
1212

assets/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

classes/class-wpcom-liveblog-amp-template.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class WPCOM_Liveblog_AMP_Template {
3333
*
3434
* @return void
3535
*/
36-
public function __contrust() {
36+
public function __construct() {
3737
$this->theme_template_path = apply_filters( 'liveblog_amp_theme_template_path', $this->theme_template_path );
3838
$this->plugin_template_path = apply_filters( 'liveblog_amp_plugin_template_path', $this->plugin_template_path );
3939
}
@@ -75,14 +75,14 @@ public function render( $name, $variables = array() ) {
7575
$path = $plugin;
7676
}
7777

78-
if ( $path === false ) {
78+
if ( false === $path ) {
7979
return 'Template Not Found: ' . $name;
8080
}
8181

8282
$this->data = $variables;
8383

8484
ob_start();
85-
include $path;
85+
include $path; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.IncludingFile
8686
return ob_get_clean();
8787
}
8888

@@ -94,6 +94,6 @@ public function render( $name, $variables = array() ) {
9494
* @return void
9595
*/
9696
public function load_part( $name, $variables = array() ) {
97-
echo WPCOM_Liveblog_AMP::get_template( $name, $variables );
97+
echo WPCOM_Liveblog_AMP::get_template( $name, $variables ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
9898
}
9999
}

classes/class-wpcom-liveblog-amp.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

classes/class-wpcom-liveblog-cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function execute_auto_archive_housekeeping() {
4444
array(
4545
'order' => 'ASC',
4646
'orderby' => 'ID',
47-
'meta_key' => 'liveblog',
47+
'meta_key' => 'liveblog', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
4848
)
4949
);
5050

classes/class-wpcom-liveblog-entry-embed-sdks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function enqueue() {
3939
}
4040

4141
foreach ( self::$sdks as $name => $url ) {
42-
wp_enqueue_script( $name, esc_url( $url ), false );
42+
wp_enqueue_script( $name, esc_url( $url ), array(), WPCOM_Liveblog::VERSION, false );
4343
}
4444
}
4545

classes/class-wpcom-liveblog-entry-embed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public function shortcode( $attr, $url = '', $comment = null ) {
7777
$handlers = array_replace_recursive( $GLOBALS['wp_embed']->handlers, $this->handlers );
7878
}
7979
ksort( $handlers );
80-
foreach ( $handlers as $priority => $handlers ) {
81-
foreach ( $handlers as $id => $handler ) {
80+
foreach ( $handlers as $handlers ) {
81+
foreach ( $handlers as $handler ) {
8282
if ( preg_match( $handler['regex'], $url, $matches ) && is_callable( $handler['callback'] ) ) {
8383
$return = call_user_func( $handler['callback'], $matches, $attr, $url, $rawattr );
8484
if ( false !== $return ) {

classes/class-wpcom-liveblog-entry-extend-feature-authors.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function load() {
4545
// generated author html back to the
4646
// raw input format (e.g @author).
4747
$this->revert_regex = implode(
48-
'', array(
48+
'',
49+
array(
4950
preg_quote( '<a href="', '~' ),
5051
'[^"]+',
5152
preg_quote( '" class="liveblog-author ', '~' ),
@@ -87,7 +88,8 @@ public function get_config( $config ) {
8788
// config, after first allowing other plugins,
8889
// themes, etc. to modify it as required
8990
$config[] = apply_filters(
90-
'liveblog_author_config', array(
91+
'liveblog_author_config',
92+
array(
9193
'type' => 'ajax',
9294
'cache' => 1000 * 60 * 30,
9395
'url' => esc_url( $endpoint_url ),
@@ -198,7 +200,7 @@ public function add_author_class_to_entry( $classes, $class, $comment_id ) {
198200
if ( WPCOM_Liveblog::KEY === $comment->comment_type ) {
199201

200202
// Grab all the prefixed classes applied.
201-
preg_match_all( '/(?<!\w)' . preg_quote( $this->class_prefix ) . '\w+/', $comment->comment_content, $authors );
203+
preg_match_all( '/(?<!\w)' . preg_quote( $this->class_prefix, '/' ) . '\w+/', $comment->comment_content, $authors );
202204

203205
// Append the first class to the classes array.
204206
$classes = array_merge( $classes, $authors[0] );

0 commit comments

Comments
 (0)