@@ -127,8 +127,10 @@ public static function generate_commentdata( $commentdata ) {
127127 }
128128
129129 $ commentdata ['remote_source_mf2 ' ] = $ entry ;
130- $ commentdata ['remote_source_properties ' ] = $ properties = array_filter ( self ::flatten_microformats ( $ entry ) );
131- $ commentdata ['remote_source_rels ' ] = $ rels = $ mf_array ['rels ' ];
130+ $ properties = array_filter ( self ::flatten_microformats ( $ entry ) );
131+ $ commentdata ['remote_source_properties ' ] = $ properties ;
132+ $ rels = $ mf_array ['rels ' ];
133+ $ commentdata ['remote_source_rels ' ] = $ rels ;
132134
133135 // try to find some content
134136 // @link http://indiewebcamp.com/comments-presentation
@@ -167,7 +169,8 @@ public static function generate_commentdata( $commentdata ) {
167169 if ( ! is_wp_error ( $ response ) ) {
168170 $ parser = new Parser ( wp_remote_retrieve_body ( $ response ), $ author );
169171 $ author_array = $ parser ->parse ( true );
170- $ properties ['author ' ] = $ author = self ::flatten_microformats ( self ::get_representative_author ( $ author_array , $ author ) );
172+ $ author = self ::flatten_microformats ( self ::get_representative_author ( $ author_array , $ author ) );
173+ $ properties ['author ' ] = $ author ;
171174 }
172175 } else {
173176 $ commentdata ['comment_author ' ] = wp_slash ( $ author );
@@ -177,7 +180,8 @@ public static function generate_commentdata( $commentdata ) {
177180 if ( is_array ( $ author ) ) {
178181 if ( ! isset ( $ author ['me ' ] ) ) {
179182 if ( isset ( $ mf_array ['rels ' ]['me ' ] ) ) {
180- $ properties ['author ' ]['me ' ] = $ author ['me ' ] = $ mf_array ['rels ' ]['me ' ];
183+ $ author ['me ' ] = $ mf_array ['rels ' ]['me ' ];
184+ $ properties ['author ' ]['me ' ] = $ author ['me ' ];
181185 }
182186 }
183187 if ( isset ( $ author ['name ' ] ) ) {
@@ -224,7 +228,7 @@ public static function generate_commentdata( $commentdata ) {
224228 $ commentdata ['comment_meta ' ]['geo_address ' ] = self ::first ( $ location ['name ' ] );
225229 }
226230 } else {
227- if ( substr ( $ location , 0 , 4 ) == 'geo: ' ) {
231+ if ( substr ( $ location , 0 , 4 ) === 'geo: ' ) {
228232 $ geo = explode ( ': ' , substr ( urldecode ( $ location ), 4 ) );
229233 $ geo = explode ( '; ' , $ geo [0 ] );
230234 $ coords = explode ( ', ' , $ geo [0 ] );
@@ -259,7 +263,7 @@ public static function generate_commentdata( $commentdata ) {
259263 $ whitelist = array_merge ( $ whitelist , array_keys ( self ::get_class_mapper () ) );
260264 $ whitelist = apply_filters ( 'semantic_linkbacks_mf2_props_whitelist ' , $ whitelist );
261265 foreach ( $ properties as $ key => $ value ) {
262- if ( in_array ( $ key , $ whitelist ) ) {
266+ if ( in_array ( $ key , $ whitelist, true ) ) {
263267 if ( self ::is_url ( $ value ) ) {
264268 $ value = esc_url_raw ( $ value );
265269 }
@@ -288,7 +292,7 @@ public static function get_property( $key, $properties ) {
288292 if ( is_array ( $ properties [ $ key ] ) ) {
289293 $ properties [ $ key ] = array_unique ( $ properties [ $ key ] );
290294 }
291- if ( 1 == count ( $ properties [ $ key ] ) ) {
295+ if ( 1 === count ( $ properties [ $ key ] ) ) {
292296 return $ properties [ $ key ][0 ];
293297 }
294298 return $ properties [ $ key ];
@@ -326,7 +330,7 @@ public static function is_url( $string ) {
326330
327331 // Accepted h types
328332 public static function is_h ( $ string ) {
329- return in_array ( $ string , array ( 'h-cite ' , 'h-entry ' , 'h-feed ' , 'h-product ' , 'h-event ' , 'h-review ' , 'h-recipe ' ) );
333+ return in_array ( $ string , array ( 'h-cite ' , 'h-entry ' , 'h-feed ' , 'h-product ' , 'h-event ' , 'h-review ' , 'h-recipe ' ), true );
330334 }
331335
332336 public static function flatten_microformats ( $ item ) {
@@ -393,7 +397,7 @@ public static function get_entries( $mf_array ) {
393397 if ( ! isset ( $ mf_array ['items ' ] ) ) {
394398 return $ entries ;
395399 }
396- if ( 0 == count ( $ mf_array ['items ' ] ) ) {
400+ if ( 0 === count ( $ mf_array ['items ' ] ) ) {
397401 return $ entries ;
398402 }
399403
@@ -402,14 +406,14 @@ public static function get_entries( $mf_array ) {
402406
403407 // check if it is an h-feed
404408 if ( isset ( $ first_item ['type ' ] ) &&
405- in_array ( 'h-feed ' , $ first_item ['type ' ] ) &&
409+ in_array ( 'h-feed ' , $ first_item ['type ' ], true ) &&
406410 isset ( $ first_item ['children ' ] ) ) {
407411 $ mf_array ['items ' ] = $ first_item ['children ' ];
408412 }
409413
410414 // iterate array
411415 foreach ( $ mf_array ['items ' ] as $ mf ) {
412- if ( isset ( $ mf ['type ' ] ) && in_array ( 'h-entry ' , $ mf ['type ' ] ) ) {
416+ if ( isset ( $ mf ['type ' ] ) && in_array ( 'h-entry ' , $ mf ['type ' ], true ) ) {
413417 $ entries [] = $ mf ;
414418 }
415419 }
@@ -429,16 +433,15 @@ public static function get_entries( $mf_array ) {
429433 public static function get_representative_author ( $ mf_array , $ source ) {
430434 foreach ( $ mf_array ['items ' ] as $ mf ) {
431435 if ( isset ( $ mf ['type ' ] ) ) {
432- if ( in_array ( 'h-card ' , $ mf ['type ' ] ) ) {
436+ if ( in_array ( 'h-card ' , $ mf ['type ' ], true ) ) {
433437 // check domain
434438 if ( isset ( $ mf ['properties ' ] ) && isset ( $ mf ['properties ' ]['url ' ] ) ) {
435439 foreach ( $ mf ['properties ' ]['url ' ] as $ url ) {
436- if ( wp_parse_url ( $ url , PHP_URL_HOST ) == wp_parse_url ( $ source , PHP_URL_HOST ) ) {
440+ if ( wp_parse_url ( $ url , PHP_URL_HOST ) === wp_parse_url ( $ source , PHP_URL_HOST ) ) {
437441 if ( isset ( $ mf_array ['rels ' ]['me ' ] ) ) {
438442 $ mf ['properties ' ]['me ' ] = $ mf_array ['rels ' ]['me ' ];
439443 }
440444 return $ mf ;
441- break ;
442445 }
443446 }
444447 }
@@ -492,10 +495,10 @@ public static function get_representative_entry( $entries, $target ) {
492495 // check properties if target urls was mentioned
493496 foreach ( $ entry ['properties ' ] as $ key => $ values ) {
494497 // check content for the link
495- if ( 'content ' == $ key &&
498+ if ( 'content ' === $ key &&
496499 preg_match_all ( '/<a[^>]+? ' . preg_quote ( $ target , '/ ' ) . '[^>]*>([^>]+?)<\/a>/i ' , $ values [0 ]['html ' ], $ context ) ) {
497500 return $ entry ;
498- } elseif ( 'summary ' == $ key &&
501+ } elseif ( 'summary ' === $ key &&
499502 preg_match_all ( '/<a[^>]+? ' . preg_quote ( $ target , '/ ' ) . '[^>]*>([^>]+?)<\/a>/i ' , $ values [0 ], $ context ) ) {
500503 return $ entry ;
501504 }
@@ -522,7 +525,7 @@ public static function get_entry_type( $target, $entry, $mf_array = array() ) {
522525 // check properties for target-url
523526 foreach ( $ entry ['properties ' ] as $ key => $ values ) {
524527 // check u-* params
525- if ( in_array ( $ key , array_keys ( $ classes ) ) ) {
528+ if ( in_array ( $ key , array_keys ( $ classes ), true ) ) {
526529 // check "normal" links
527530 if ( self ::compare_urls ( $ target , $ values ) ) {
528531 return $ classes [ $ key ];
@@ -554,9 +557,9 @@ public static function get_entry_type( $target, $entry, $mf_array = array() ) {
554557 // check rels for target-url
555558 foreach ( $ mf_array ['rels ' ] as $ key => $ values ) {
556559 // check rel params
557- if ( in_array ( $ key , array_keys ( $ rels ) ) ) {
560+ if ( in_array ( $ key , array_keys ( $ rels ), true ) ) {
558561 foreach ( $ values as $ value ) {
559- if ( $ value == $ target ) {
562+ if ( $ value === $ target ) {
560563 return $ rels [ $ key ];
561564 }
562565 }
0 commit comments