Skip to content

Commit 36baa35

Browse files
committed
Make recommended fixes from Plugin Check
1 parent 783c7a4 commit 36baa35

7 files changed

+41
-49
lines changed

includes/class-location-plugins.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public static function array_get( $array, $key, $default = array(), $index = tru
3636
}
3737

3838
/**
39-
*
40-
*
39+
* Adds location properties to webmention returns.
4140
*/
4241
public static function webmention_handler_mf2_set_properties( $meta, $handler ) {
4342
$item = $handler->get_webmention_item();

includes/functions.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,22 +631,22 @@ function sloc_get_attachment_datetime( $attachment, $field = 'created' ) {
631631
}
632632

633633
function sloc_file_exists( $file ) {
634-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' );
635-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php' );
634+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
635+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
636636
$wpfile = new WP_Filesystem_Direct( false );
637637
return $wpfile->exists( $file );
638638
}
639639

640640
function sloc_get_contents( $file ) {
641-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' );
642-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php' );
641+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
642+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
643643
$wpfile = new WP_Filesystem_Direct( false );
644644
return $wpfile->get_contents( $file );
645645
}
646646

647647
function sloc_get_contents_array( $file ) {
648-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' );
649-
require_once ( ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php' );
648+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
649+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
650650
$wpfile = new WP_Filesystem_Direct( false );
651651
return $wpfile->get_contents_array( $file );
652652
}

includes/weather/class-weather-provider-aeris.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private function code_map( $id ) {
273273
case 'L': // Drizzle.
274274
return 301;
275275
case 'R': // Rain.
276-
500;
276+
return 500;
277277
case 'RW': // Rain showers.
278278
return 521;
279279
case 'RS': // Rain/snow mix.

includes/weather/class-weather-provider-meteostat.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ function ( $a, $b ) {
106106
return $return;
107107
}
108108
return self::get_fallback_conditions( $time );
109-
110-
$conditions = $this->get_cache();
111-
if ( $conditions ) {
112-
return $conditions;
113-
}
114-
return array();
115109
}
116110

117111
/**

includes/weather/class-weather-provider-metoffice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function ( $a, $b ) {
143143
}
144144

145145
/**
146-
* converts code into weather description.
146+
* Converts code into weather description.
147147
*
148148
* @param int $type code.
149149
* @return string description.

includes/weather/class-weather-provider-nwsus.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,15 @@ private function phenomenon_code_map( $weather ) {
277277

278278
switch ( $condition ) {
279279
case 'thunderstorms':
280-
if ( ! isset( $weather['intensity'] ) ) {
281-
return 211;
282-
}
283-
if ( 'light' === $weather['intensity'] ) {
284-
return 210;
285-
}
286-
if ( 'heavy' === $weather['intensity'] ) {
287-
return 212;
280+
if ( array_key_exists( 'intensity', $weather ) ) {
281+
if ( 'light' === $weather['intensity'] ) {
282+
return 210;
283+
}
284+
if ( 'heavy' === $weather['intensity'] ) {
285+
return 212;
286+
}
288287
}
288+
return 211;
289289
case 'fog':
290290
case 'fog_mist':
291291
return 741;
@@ -294,15 +294,15 @@ private function phenomenon_code_map( $weather ) {
294294
case 'dust_whirls':
295295
return 761;
296296
case 'drizzle':
297-
if ( ! isset( $weather['intensity'] ) ) {
298-
return 301;
299-
}
300-
if ( 'light' === $weather['intensity'] ) {
301-
return 300;
302-
}
303-
if ( 'heavy' === $weather['intensity'] ) {
304-
return 302;
297+
if ( array_key_exists( 'intensity', $weather ) ) {
298+
if ( 'light' === $weather['intensity'] ) {
299+
return 300;
300+
}
301+
if ( 'heavy' === $weather['intensity'] ) {
302+
return 302;
303+
}
305304
}
305+
return 301;
306306
case 'smoke':
307307
return 711;
308308
case 'hail':
@@ -315,29 +315,29 @@ private function phenomenon_code_map( $weather ) {
315315
case 'ice_pellets':
316316
case 'spray':
317317
case 'rain':
318-
if ( ! isset( $weather['intensity'] ) ) {
319-
return 521;
320-
}
321-
if ( 'light' === $weather['intensity'] ) {
322-
return 520;
323-
}
324-
if ( 'heavy' === $weather['intensity'] ) {
325-
return 522;
318+
if ( array_key_exists( 'intensity', $weather ) ) {
319+
if ( 'light' === $weather['intensity'] ) {
320+
return 520;
321+
}
322+
if ( 'heavy' === $weather['intensity'] ) {
323+
return 522;
324+
}
326325
}
326+
return 521;
327327
case 'sand':
328328
case 'sand_storm':
329329
return 751;
330330
case 'snow_grains':
331331
case 'snow':
332-
if ( ! isset( $weather['intensity'] ) ) {
333-
return 601;
334-
}
335-
if ( 'light' === $weather['intensity'] ) {
336-
return 600;
337-
}
338-
if ( 'heavy' === $weather['intensity'] ) {
339-
return 602;
332+
if ( array_key_exists( 'intensity', $weather ) ) {
333+
if ( 'light' === $weather['intensity'] ) {
334+
return 600;
335+
}
336+
if ( 'heavy' === $weather['intensity'] ) {
337+
return 602;
338+
}
340339
}
340+
return 601;
341341
case 'squalls':
342342
return 771;
343343
case 'volcanic_ash':

includes/weather/class-weather-provider-station.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ function ( $a, $b ) {
243243
public function get_station_data() {
244244
$return = array();
245245
$stations = get_option( 'sloc_stations' );
246-
$endpoint = null;
247246
foreach ( $stations as $key => $station ) {
248247
if ( trim( $station['id'] === $this->station_id ) ) {
249248
$return = $this->fetch_json( $station['url'], array() );

0 commit comments

Comments
 (0)