Skip to content

Commit

Permalink
PHPCBF automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paulschreiber committed Sep 28, 2018
1 parent 3304f5c commit c518452
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 69 deletions.
12 changes: 8 additions & 4 deletions classes/class-wpcom-liveblog-amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public static function build_single_entry( $entries, $request, $post_id ) {
}

$rendered = self::get_template(
'entry', array(
'entry',
array(
'single' => true,
'id' => $entry->id,
'content' => $entry->content,
Expand Down Expand Up @@ -315,7 +316,8 @@ public static function get_entry( $id, $post_id, $entries = false ) {
*/
public static function build_entries_feed( $entries, $request, $post_id ) {
$rendered = self::get_template(
'feed', array(
'feed',
array(
'entries' => self::filter_entries( $entries['entries'], $post_id ),
'post_id' => $post_id,
'page' => $entries['page'],
Expand Down Expand Up @@ -420,7 +422,8 @@ public static function build_paged_permalink( $permalink, $page, $last ) {
array(
'liveblog_page' => $page,
'liveblog_last' => $last,
), $permalink
),
$permalink
);
}

Expand All @@ -435,7 +438,8 @@ public static function build_single_entry_permalink( $permalink, $id ) {
return add_query_arg(
array(
'liveblog_id' => $id,
), $permalink
),
$permalink
);
}

Expand Down
6 changes: 4 additions & 2 deletions classes/class-wpcom-liveblog-entry-extend-feature-authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function load() {
// generated author html back to the
// raw input format (e.g @author).
$this->revert_regex = implode(
'', array(
'',
array(
preg_quote( '<a href="', '~' ),
'[^"]+',
preg_quote( '" class="liveblog-author ', '~' ),
Expand Down Expand Up @@ -87,7 +88,8 @@ public function get_config( $config ) {
// config, after first allowing other plugins,
// themes, etc. to modify it as required
$config[] = apply_filters(
'liveblog_author_config', array(
'liveblog_author_config',
array(
'type' => 'ajax',
'cache' => 1000 * 60 * 30,
'url' => esc_url( $endpoint_url ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public function load() {
// generated author html back to the
// raw input format (e.g /key).
$this->revert_regex = implode(
'', array(
'',
array(
preg_quote( '<span class="liveblog-command ', '~' ),
preg_quote( $this->class_prefix_local, '~' ),
'([^"]+)',
Expand Down Expand Up @@ -103,7 +104,8 @@ public function get_config( $config ) {
// config, after first allowing other plugins,
// themes, etc. to modify it as required
$config[] = apply_filters(
'liveblog_command_config', array(
'liveblog_command_config',
array(
'trigger' => '/',
'data' => $this->get_commands(),
'displayKey' => false,
Expand Down
9 changes: 6 additions & 3 deletions classes/class-wpcom-liveblog-entry-extend-feature-emojis.php
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,8 @@ public function load() {
// generated emoji html back to the
// raw input format (e.g :poop:).
$this->revert_regex = implode(
'', array(
'',
array(
preg_quote( '<img src="', '~' ),
preg_quote( $this->emoji_cdn, '~' ),
'[^"]+',
Expand Down Expand Up @@ -952,7 +953,8 @@ public function get_config( $config ) {
// config, after first allowing other plugins,
// themes, etc. to modify it as required
$config[] = apply_filters(
'liveblog_emoji_config', array(
'liveblog_emoji_config',
array(
'type' => 'static',
'data' => $emojis,
'search' => 'key',
Expand Down Expand Up @@ -984,7 +986,8 @@ public function map_emoji( $val, $key ) {
// Then pass it into a filter to allow plugins,
// themes, etc. to customise the output.
return apply_filters(
'liveblog_emoji_map', array(
'liveblog_emoji_map',
array(
'key' => $key,
'name' => $key,
'image' => strtolower( $val ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public function load() {
// generated hashtag html back to the
// raw input format (e.g #hashtag).
$this->revert_regex = implode(
'', array(
'',
array(
preg_quote( '<span class="liveblog-hash ', '~' ),
preg_quote( $this->class_prefix, '~' ),
'([^"]+)',
Expand Down Expand Up @@ -87,7 +88,8 @@ public function get_config( $config ) {
// config, after first allowing other plugins,
// themes, etc. to modify it as required
$config[] = apply_filters(
'liveblog_hashtag_config', array(
'liveblog_hashtag_config',
array(
'type' => 'ajax',
'cache' => 1000 * 60,
'regex' => '#([\w\d\-]*)$',
Expand Down
9 changes: 6 additions & 3 deletions classes/class-wpcom-liveblog-entry-key-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ public static function add_admin_options( $extra_fields, $post_id ) {

// Add the custom template fields to the editor.
$extra_fields[] = WPCOM_Liveblog::get_template_part(
'liveblog-key-admin.php', array(
'liveblog-key-admin.php',
array(
'current_key_template' => get_post_meta( $post_id, self::META_KEY_TEMPLATE, true ),
'current_key_format' => get_post_meta( $post_id, self::META_KEY_FORMAT, true ),
'current_key_limit' => get_post_meta( $post_id, self::META_KEY_LIMIT, true ),
Expand Down Expand Up @@ -350,7 +351,8 @@ public static function shortcode( $atts ) {
$atts = shortcode_atts(
array(
'title' => 'Key Events',
), $atts
),
$atts
);

// The args to pass into the entry query.
Expand Down Expand Up @@ -378,7 +380,8 @@ public static function shortcode( $atts ) {

// Render the actual template.
return WPCOM_Liveblog::get_template_part(
'liveblog-key-events.php', array(
'liveblog-key-events.php',
array(
'entries' => $entries,
'title' => $atts['title'],
'template' => $template[0],
Expand Down
3 changes: 2 additions & 1 deletion classes/class-wpcom-liveblog-entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ private static function get_contributors_for_json( $comment_id ) {
function( $contributor ) {
$user_object = self::get_userdata_with_filter( $contributor );
return self::get_user_data_for_json( $user_object );
}, $contributors
},
$contributors
);
}

Expand Down
3 changes: 2 additions & 1 deletion classes/class-wpcom-liveblog-lazyloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public static function admin_notices() {

echo wp_kses_post(
WPCOM_Liveblog::get_template_part(
'lazyload-notice.php', array(
'lazyload-notice.php',
array(
'plugin' => 'Lazyload Liveblog Entries',
)
)
Expand Down
33 changes: 22 additions & 11 deletions classes/class-wpcom-liveblog-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/entries/(?P<start_time>\d+)/(?P<end_time>\d+)([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/entries/(?P<start_time>\d+)/(?P<end_time>\d+)([/]*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_entries' ),
Expand All @@ -89,7 +90,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/crud([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/crud([/]*)',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( __CLASS__, 'crud_entry' ),
Expand Down Expand Up @@ -121,7 +123,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/lazyload/(?P<max_time>\d+)/(?P<min_time>\d+)([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/lazyload/(?P<max_time>\d+)/(?P<min_time>\d+)([/]*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_lazyload_entries' ),
Expand All @@ -146,7 +149,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/entry/(?P<entry_id>\d+)([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/entry/(?P<entry_id>\d+)([/]*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_single_entry' ),
Expand All @@ -168,7 +172,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/preview([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/preview([/]*)',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( __CLASS__, 'format_preview_entry' ),
Expand All @@ -191,7 +196,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/authors([/]*)(?P<term>.*)',
self::$api_namespace,
'/authors([/]*)(?P<term>.*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_authors' ),
Expand All @@ -214,7 +220,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/hashtags([/]*)(?P<term>.*)',
self::$api_namespace,
'/hashtags([/]*)(?P<term>.*)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_hashtag_terms' ),
Expand All @@ -233,7 +240,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/post_state([/]*)',
self::$api_namespace,
'/(?P<post_id>\d+)/post_state([/]*)',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( __CLASS__, 'update_post_state' ),
Expand Down Expand Up @@ -265,7 +273,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/get-entries/(?P<page>\d+)/(?P<last_known_entry>[^\/]+)',
self::$api_namespace,
'/(?P<post_id>\d+)/get-entries/(?P<page>\d+)/(?P<last_known_entry>[^\/]+)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_entries_paged' ),
Expand All @@ -290,7 +299,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/get-key-events/(?P<last_known_entry>[^\/]+)',
self::$api_namespace,
'/(?P<post_id>\d+)/get-key-events/(?P<last_known_entry>[^\/]+)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'get_key_events' ),
Expand All @@ -309,7 +319,8 @@ public static function register_routes() {
*
*/
register_rest_route(
self::$api_namespace, '/(?P<post_id>\d+)/jump-to-key-event/(?P<id>\d+)/(?P<last_known_entry>[^\/]+)',
self::$api_namespace,
'/(?P<post_id>\d+)/jump-to-key-event/(?P<id>\d+)/(?P<last_known_entry>[^\/]+)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( __CLASS__, 'jump_to_key_event' ),
Expand Down
3 changes: 2 additions & 1 deletion classes/class-wpcom-liveblog-socketio.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public static function enqueue_scripts() {
);

wp_localize_script(
$handle, 'liveblog_socketio_settings',
$handle,
'liveblog_socketio_settings',
apply_filters(
'liveblog_socketio_settings',
array(
Expand Down
16 changes: 11 additions & 5 deletions classes/class-wpcom-liveblog-wp-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ public function fix_archive( $args, $assoc_args ) {
INNER JOIN $wpdb->comments
ON $wpdb->comments.comment_id = $wpdb->commentmeta.comment_id
WHERE comment_post_id = %d )
ORDER BY comment_id ASC", $post_id, $post_id
ORDER BY comment_id ASC",
$post_id,
$post_id
)
);
$correct_ids = wp_list_pluck( $correct_ids_array, 'comment_id' );
Expand Down Expand Up @@ -103,7 +105,8 @@ public function fix_archive( $args, $assoc_args ) {
if ( false === $is_dryrun ) {
$wpdb->update( // phpcs:ignore
$wpdb->commentmeta,
array( 'meta_value' => $correct_ids[ $i ] ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
array( 'meta_value' => $correct_ids[ $i ] ),
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
array( 'comment_id' => $entry_id )
);
}
Expand All @@ -121,7 +124,8 @@ public function fix_archive( $args, $assoc_args ) {
WHERE comment_post_id = %d
GROUP BY comment_content
HAVING count(comment_content) = 2
ORDER BY comment_id ASC", $post_id
ORDER BY comment_id ASC",
$post_id
)
);

Expand All @@ -133,7 +137,8 @@ public function fix_archive( $args, $assoc_args ) {
INNER JOIN $wpdb->comments
ON $wpdb->comments.comment_id = $wpdb->commentmeta.comment_id
WHERE comment_post_id = %d
ORDER BY meta_value ASC", $post_id
ORDER BY meta_value ASC",
$post_id
)
);

Expand Down Expand Up @@ -210,7 +215,8 @@ function( $matches ) {
array_map(
function( $username ) {
return "[$username](http://profiles.wordpress.org/$username)";
}, preg_split( '/\s*,\s*/', $matches[1] )
},
preg_split( '/\s*,\s*/', $matches[1] )
)
);
return 'Contributors: ' . implode( ', ', $links );
Expand Down
Loading

0 comments on commit c518452

Please sign in to comment.