Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit ac2acce

Browse files
committed
Automatic PHPCBF fixes
1 parent fdb4cce commit ac2acce

File tree

6 files changed

+281
-204
lines changed

6 files changed

+281
-204
lines changed

includes/class-linkbacks-handler.php

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function init() {
4848
* @return array the filtered array
4949
*/
5050
public static function filter_comment_args( $args ) {
51-
$args['walker'] = new Semantic_Linkbacks_Walker_Comment;
51+
$args['walker'] = new Semantic_Linkbacks_Walker_Comment();
5252
return $args;
5353
}
5454

@@ -69,35 +69,35 @@ public static function show_mentions() {
6969
public static function register_meta() {
7070
$args = array(
7171
'sanitize_callback' => 'esc_url_raw',
72-
'type' => 'string',
73-
'description' => 'Author URL',
74-
'single' => true,
75-
'show_in_rest' => true,
72+
'type' => 'string',
73+
'description' => 'Author URL',
74+
'single' => true,
75+
'show_in_rest' => true,
7676
);
7777
register_meta( 'comment', 'semantic_linkbacks_author_url', $args );
7878

7979
$args = array(
8080
'sanitize_callback' => 'esc_url_raw',
81-
'type' => 'string',
82-
'description' => 'Avatar URL',
83-
'single' => true,
84-
'show_in_rest' => true,
81+
'type' => 'string',
82+
'description' => 'Avatar URL',
83+
'single' => true,
84+
'show_in_rest' => true,
8585
);
8686
register_meta( 'comment', 'semantic_linkbacks_avatar', $args );
8787

8888
$args = array(
8989
'sanitize_callback' => 'esc_url_raw',
90-
'type' => 'string',
91-
'description' => 'Canonical URL',
92-
'single' => true,
93-
'show_in_rest' => true,
90+
'type' => 'string',
91+
'description' => 'Canonical URL',
92+
'single' => true,
93+
'show_in_rest' => true,
9494
);
9595
register_meta( 'comment', 'semantic_linkbacks_canonical', $args );
9696

9797
$args = array(
98-
'type' => 'string',
99-
'description' => 'Linkbacks Type',
100-
'single' => true,
98+
'type' => 'string',
99+
'description' => 'Linkbacks Type',
100+
'single' => true,
101101
'show_in_rest' => true,
102102
);
103103
register_meta( 'comment', 'semantic_linkbacks_type', $args );
@@ -156,11 +156,11 @@ public static function enhance( $commentdata, $comment = array(), $commentarr =
156156
public static function retrieve( $url ) {
157157
global $wp_version;
158158
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) );
159-
$args = array(
160-
'timeout' => 100,
159+
$args = array(
160+
'timeout' => 100,
161161
'limit_response_size' => 1048576,
162-
'redirection' => 20,
163-
'user-agent' => "$user_agent; verifying linkback",
162+
'redirection' => 20,
163+
'user-agent' => "$user_agent; verifying linkback",
164164
);
165165
return wp_safe_remote_get( $url, $args );
166166
}
@@ -189,19 +189,19 @@ public static function update_meta( $comment_id, $commentdata ) {
189189
public static function get_comment_type_excerpts() {
190190
$strings = array(
191191
// special case. any value that evals to false will be considered standard
192-
'mention' => __( '%1$s mentioned %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
193-
194-
'reply' => __( '%1$s replied to %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
195-
'repost' => __( '%1$s reposted %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
196-
'like' => __( '%1$s liked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
197-
'favorite' => __( '%1$s favorited %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
198-
'tag' => __( '%1$s tagged %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
199-
'bookmark' => __( '%1$s bookmarked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
200-
'rsvp:yes' => __( '%1$s is <strong>attending</strong>.', 'semantic-linkbacks' ),
201-
'rsvp:no' => __( '%1$s is <strong>not attending</strong>.', 'semantic-linkbacks' ),
202-
'rsvp:maybe' => __( 'Maybe %1$s will be <strong>attending</strong>.', 'semantic-linkbacks' ),
203-
'rsvp:invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
204-
'rsvp:tracking' => __( '%1$s <strong>tracks</strong> this event.', 'semantic-linkbacks' ),
192+
'mention' => __( '%1$s mentioned %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
193+
194+
'reply' => __( '%1$s replied to %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
195+
'repost' => __( '%1$s reposted %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
196+
'like' => __( '%1$s liked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
197+
'favorite' => __( '%1$s favorited %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
198+
'tag' => __( '%1$s tagged %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
199+
'bookmark' => __( '%1$s bookmarked %2$s on <a href="%3$s">%4$s</a>.', 'semantic-linkbacks' ),
200+
'rsvp:yes' => __( '%1$s is <strong>attending</strong>.', 'semantic-linkbacks' ),
201+
'rsvp:no' => __( '%1$s is <strong>not attending</strong>.', 'semantic-linkbacks' ),
202+
'rsvp:maybe' => __( 'Maybe %1$s will be <strong>attending</strong>.', 'semantic-linkbacks' ),
203+
'rsvp:invited' => __( '%1$s is <strong>invited</strong>.', 'semantic-linkbacks' ),
204+
'rsvp:tracking' => __( '%1$s <strong>tracks</strong> this event.', 'semantic-linkbacks' ),
205205
);
206206

207207
return $strings;
@@ -215,19 +215,19 @@ public static function get_comment_type_excerpts() {
215215
public static function get_comment_type_strings() {
216216
$strings = array(
217217
// Special case. any value that evals to false will be considered standard
218-
'mention' => __( 'Mention', 'semantic-linkbacks' ),
219-
220-
'reply' => __( 'Reply', 'semantic-linkbacks' ),
221-
'repost' => __( 'Repost', 'semantic-linkbacks' ),
222-
'like' => __( 'Like', 'semantic-linkbacks' ),
223-
'favorite' => __( 'Favorite', 'semantic-linkbacks' ),
224-
'tag' => __( 'Tag', 'semantic-linkbacks' ),
225-
'bookmark' => __( 'Bookmark', 'semantic-linkbacks' ),
226-
'rsvp:yes' => __( 'RSVP', 'semantic-linkbacks' ),
227-
'rsvp:no' => __( 'RSVP', 'semantic-linkbacks' ),
228-
'rsvp:invited' => __( 'RSVP', 'semantic-linkbacks' ),
229-
'rsvp:maybe' => __( 'RSVP', 'semantic-linkbacks' ),
230-
'rsvp:tracking' => __( 'RSVP', 'semantic-linkbacks' ),
218+
'mention' => __( 'Mention', 'semantic-linkbacks' ),
219+
220+
'reply' => __( 'Reply', 'semantic-linkbacks' ),
221+
'repost' => __( 'Repost', 'semantic-linkbacks' ),
222+
'like' => __( 'Like', 'semantic-linkbacks' ),
223+
'favorite' => __( 'Favorite', 'semantic-linkbacks' ),
224+
'tag' => __( 'Tag', 'semantic-linkbacks' ),
225+
'bookmark' => __( 'Bookmark', 'semantic-linkbacks' ),
226+
'rsvp:yes' => __( 'RSVP', 'semantic-linkbacks' ),
227+
'rsvp:no' => __( 'RSVP', 'semantic-linkbacks' ),
228+
'rsvp:invited' => __( 'RSVP', 'semantic-linkbacks' ),
229+
'rsvp:maybe' => __( 'RSVP', 'semantic-linkbacks' ),
230+
'rsvp:tracking' => __( 'RSVP', 'semantic-linkbacks' ),
231231
);
232232

233233
return $strings;
@@ -241,17 +241,17 @@ public static function get_comment_type_strings() {
241241
public static function get_post_format_strings() {
242242
$strings = array(
243243
// Special case. any value that evals to false will be considered standard
244-
'standard' => __( 'this Article', 'semantic-linkbacks' ),
245-
246-
'aside' => __( 'this Aside', 'semantic-linkbacks' ),
247-
'chat' => __( 'this Chat', 'semantic-linkbacks' ),
248-
'gallery' => __( 'this Gallery', 'semantic-linkbacks' ),
249-
'link' => __( 'this Link', 'semantic-linkbacks' ),
250-
'image' => __( 'this Image', 'semantic-linkbacks' ),
251-
'quote' => __( 'this Quote', 'semantic-linkbacks' ),
252-
'status' => __( 'this Status', 'semantic-linkbacks' ),
253-
'video' => __( 'this Video', 'semantic-linkbacks' ),
254-
'audio' => __( 'this Audio', 'semantic-linkbacks' ),
244+
'standard' => __( 'this Article', 'semantic-linkbacks' ),
245+
246+
'aside' => __( 'this Aside', 'semantic-linkbacks' ),
247+
'chat' => __( 'this Chat', 'semantic-linkbacks' ),
248+
'gallery' => __( 'this Gallery', 'semantic-linkbacks' ),
249+
'link' => __( 'this Link', 'semantic-linkbacks' ),
250+
'image' => __( 'this Image', 'semantic-linkbacks' ),
251+
'quote' => __( 'this Quote', 'semantic-linkbacks' ),
252+
'status' => __( 'this Status', 'semantic-linkbacks' ),
253+
'video' => __( 'this Video', 'semantic-linkbacks' ),
254+
'audio' => __( 'this Audio', 'semantic-linkbacks' ),
255255
);
256256

257257
return $strings;
@@ -353,7 +353,7 @@ public static function comment_text_add_cite( $text, $comment = null, $args = ar
353353
return $text;
354354
}
355355

356-
$url = self::get_url( $comment );
356+
$url = self::get_url( $comment );
357357
$host = parse_url( $url, PHP_URL_HOST );
358358

359359
// strip leading www, if any
@@ -410,7 +410,7 @@ public static function comment_text_excerpt( $text, $comment = null, $args = arr
410410

411411
// get post type
412412
$post_formatstrings = self::get_post_format_strings();
413-
$post_type = $post_formatstrings[ $post_format ];
413+
$post_type = $post_formatstrings[ $post_format ];
414414

415415
$post_type = apply_filters( 'semantic_linkbacks_post_type', $post_type, $comment->comment_post_ID );
416416

@@ -425,7 +425,7 @@ public static function comment_text_excerpt( $text, $comment = null, $args = arr
425425
$host = preg_replace( '/^www\./', '', $host );
426426

427427
// generate output. use full content if it's small enough, otherwise use excerpt.
428-
$text_len = mb_strlen(html_entity_decode($text, ENT_QUOTES));
428+
$text_len = mb_strlen( html_entity_decode( $text, ENT_QUOTES ) );
429429
if ( ! ( 'mention' == $semantic_linkbacks_type && $text_len <= MAX_INLINE_MENTION_LENGTH ) ) {
430430
$text = sprintf( $comment_type_excerpts[ $semantic_linkbacks_type ], get_comment_author_link( $comment->comment_ID ), $post_type, $url, $host );
431431
}
@@ -483,9 +483,9 @@ public static function pre_get_avatar_data( $args, $id_or_email ) {
483483
$args['class'] = array( 'u-photo' );
484484
} else {
485485
$args['class'][] = 'u-photo';
486-
$args['class'] = array_unique( $args['class'] );
486+
$args['class'] = array_unique( $args['class'] );
487487
}
488-
$args['url'] = $avatar;
488+
$args['url'] = $avatar;
489489
$args['class'][] = 'avatar-semantic-linkbacks';
490490
}
491491

@@ -541,19 +541,19 @@ public static function comment_class( $classes, $class, $comment_id, $post_id )
541541

542542
// "comment type to class" mapper
543543
$class_mapping = array(
544-
'mention' => array( 'h-as-mention' ),
545-
546-
'reply' => array( 'h-as-reply' ),
547-
'repost' => array( 'h-as-repost', 'p-repost' ),
548-
'like' => array( 'h-as-like', 'p-like' ),
549-
'favorite' => array( 'h-as-favorite', 'p-favorite' ),
550-
'tag' => array( 'h-as-tag', 'p-tag' ),
551-
'bookmark' => array( 'h-as-bookmark', 'p-bookmark' ),
552-
'rsvp:yes' => array( 'h-as-rsvp' ),
553-
'rsvp:no' => array( 'h-as-rsvp' ),
554-
'rsvp:maybe' => array( 'h-as-rsvp' ),
555-
'rsvp:invited' => array( 'h-as-rsvp' ),
556-
'rsvp:tracking' => array( 'h-as-rsvp' ),
544+
'mention' => array( 'h-as-mention' ),
545+
546+
'reply' => array( 'h-as-reply' ),
547+
'repost' => array( 'h-as-repost', 'p-repost' ),
548+
'like' => array( 'h-as-like', 'p-like' ),
549+
'favorite' => array( 'h-as-favorite', 'p-favorite' ),
550+
'tag' => array( 'h-as-tag', 'p-tag' ),
551+
'bookmark' => array( 'h-as-bookmark', 'p-bookmark' ),
552+
'rsvp:yes' => array( 'h-as-rsvp' ),
553+
'rsvp:no' => array( 'h-as-rsvp' ),
554+
'rsvp:maybe' => array( 'h-as-rsvp' ),
555+
'rsvp:invited' => array( 'h-as-rsvp' ),
556+
'rsvp:tracking' => array( 'h-as-rsvp' ),
557557
);
558558

559559
$semantic_linkbacks_type = self::get_type( $comment );

includes/class-linkbacks-mf2-handler.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,35 @@ public static function get_class_mapper() {
2828
* @link http://indiewebcamp.com/replies
2929
*/
3030
$class_mapper['in-reply-to'] = 'reply';
31-
$class_mapper['reply'] = 'reply';
32-
$class_mapper['reply-of'] = 'reply';
31+
$class_mapper['reply'] = 'reply';
32+
$class_mapper['reply-of'] = 'reply';
3333

3434
/*
3535
* repost
3636
* @link http://indiewebcamp.com/repost
3737
*/
38-
$class_mapper['repost'] = 'repost';
38+
$class_mapper['repost'] = 'repost';
3939
$class_mapper['repost-of'] = 'repost';
4040

4141
/*
4242
* likes
4343
* @link http://indiewebcamp.com/likes
4444
*/
45-
$class_mapper['like'] = 'like';
45+
$class_mapper['like'] = 'like';
4646
$class_mapper['like-of'] = 'like';
4747

4848
/*
4949
* favorite
5050
* @link http://indiewebcamp.com/favorite
5151
*/
52-
$class_mapper['favorite'] = 'favorite';
52+
$class_mapper['favorite'] = 'favorite';
5353
$class_mapper['favorite-of'] = 'favorite';
5454

5555
/*
5656
* bookmark
5757
* @link http://indiewebcamp.com/bookmark
5858
*/
59-
$class_mapper['bookmark'] = 'bookmark';
59+
$class_mapper['bookmark'] = 'bookmark';
6060
$class_mapper['bookmark-of'] = 'bookmark';
6161

6262
/*
@@ -87,7 +87,7 @@ public static function get_rel_mapper() {
8787
* @link http://indiewebcamp.com/in-reply-to
8888
*/
8989
$rel_mapper['in-reply-to'] = 'reply';
90-
$rel_mapper['reply-of'] = 'reply';
90+
$rel_mapper['reply-of'] = 'reply';
9191

9292
return apply_filters( 'semantic_linkbacks_microformats_rel_mapper', $rel_mapper );
9393
}
@@ -109,7 +109,7 @@ public static function generate_commentdata( $commentdata ) {
109109
}
110110

111111
// parse source html
112-
$parser = new Parser( $commentdata['remote_source_original'], $source );
112+
$parser = new Parser( $commentdata['remote_source_original'], $source );
113113
$mf_array = $parser->parse( true );
114114

115115
// get all 'relevant' entries
@@ -126,9 +126,9 @@ public static function generate_commentdata( $commentdata ) {
126126
return array();
127127
}
128128

129-
$commentdata['remote_source_mf2'] = $entry;
129+
$commentdata['remote_source_mf2'] = $entry;
130130
$commentdata['remote_source_properties'] = $properties = array_filter( self::flatten_microformats( $entry ) );
131-
$commentdata['remote_source_rels'] = $rels = $mf_array['rels'];
131+
$commentdata['remote_source_rels'] = $rels = $mf_array['rels'];
132132

133133
// try to find some content
134134
// @link http://indiewebcamp.com/comments-presentation
@@ -165,8 +165,8 @@ public static function generate_commentdata( $commentdata ) {
165165
if ( self::is_url( $author ) ) {
166166
$response = Linkbacks_Handler::retrieve( $author );
167167
if ( ! is_wp_error( $response ) ) {
168-
$parser = new Parser( wp_remote_retrieve_body( $response ), $author );
169-
$author_array = $parser->parse( true );
168+
$parser = new Parser( wp_remote_retrieve_body( $response ), $author );
169+
$author_array = $parser->parse( true );
170170
$properties['author'] = $author = self::flatten_microformats( self::get_representative_author( $author_array, $author ) );
171171
}
172172
} else {
@@ -225,10 +225,10 @@ public static function generate_commentdata( $commentdata ) {
225225
}
226226
} else {
227227
if ( substr( $location, 0, 4 ) == 'geo:' ) {
228-
$geo = explode( ':', substr( urldecode( $location ), 4 ) );
229-
$geo = explode( ';', $geo[0] );
228+
$geo = explode( ':', substr( urldecode( $location ), 4 ) );
229+
$geo = explode( ';', $geo[0] );
230230
$coords = explode( ',', $geo[0] );
231-
$commentdata['comment_meta']['geo_latitude'] = trim( $coords[0] );
231+
$commentdata['comment_meta']['geo_latitude'] = trim( $coords[0] );
232232
$commentdata['comment_meta']['geo_longitude'] = trim( $coords[1] );
233233
} else {
234234
$commentdata['comment_meta']['geo_address'] = $location;
@@ -496,7 +496,7 @@ public static function get_representative_entry( $entries, $target ) {
496496
preg_match_all( '/<a[^>]+?' . preg_quote( $target, '/' ) . '[^>]*>([^>]+?)<\/a>/i', $values[0]['html'], $context ) ) {
497497
return $entry;
498498
} elseif ( 'summary' == $key &&
499-
preg_match_all( '/<a[^>]+?' . preg_quote( $target, '/' ) . '[^>]*>([^>]+?)<\/a>/i', $values[0], $context ) ) {
499+
preg_match_all( '/<a[^>]+?' . preg_quote( $target, '/' ) . '[^>]*>([^>]+?)<\/a>/i', $values[0], $context ) ) {
500500
return $entry;
501501
}
502502
}

0 commit comments

Comments
 (0)