Skip to content

Commit

Permalink
Automated phpcs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske committed Oct 3, 2023
1 parent 857538a commit ceb7c8c
Show file tree
Hide file tree
Showing 65 changed files with 448 additions and 526 deletions.
1 change: 0 additions & 1 deletion includes/apis/trait-sloc-api-bing.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ public static function init() {
);
}
}

}
1 change: 0 additions & 1 deletion includes/apis/trait-sloc-api-geoapify.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,4 @@ public static function init() {
);
}
}

}
1 change: 0 additions & 1 deletion includes/apis/trait-sloc-api-geonames.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ public static function admin_init() {
public static function init() {
self::register_settings_api( __( 'GeoNames', 'simple-location' ), 'sloc_geonames_user', __( 'User', 'simple-location' ) );
}

}
1 change: 0 additions & 1 deletion includes/apis/trait-sloc-api-google.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ public static function init() {
);
}
}

}
1 change: 0 additions & 1 deletion includes/apis/trait-sloc-api-locationiq.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public static function admin_init() {
public static function init() {
self::register_settings_api( __( 'LocationIQ', 'simple-location' ), 'sloc_locationiq_api' );
}

}
1 change: 0 additions & 1 deletion includes/class-airport-location.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,5 @@ public static function get_airline( $search, $field = 'iata_code' ) {
return $airline;
}
}

}
} // End Class
118 changes: 58 additions & 60 deletions includes/class-astronomical-calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@
class Astronomical_Calculator {


/**
* Zenith. Adjusted based on elevation.
*
* @since 4.0.0
* @var float
*/
/**
* Zenith. Adjusted based on elevation.
*
* @since 4.0.0
* @var float
*/
protected $zenith;

/**
* Latitude.
*
* @since 4.0.0
* @var float
*/
/**
* Latitude.
*
* @since 4.0.0
* @var float
*/
protected $latitude;

/**
* Longitude.
*
* @since 4.0.0
* @var float
*/
/**
* Longitude.
*
* @since 4.0.0
* @var float
*/
protected $longitude;

/**
* Elevation in meters.
*
* @since 4.0.0
* @var float
*/
/**
* Elevation in meters.
*
* @since 4.0.0
* @var float
*/
protected $elevation;

/**
* Timezone.
*
* @since 4.0.0
* @var DateTimeZone
*/
/**
* Timezone.
*
* @since 4.0.0
* @var DateTimeZone
*/
protected $timezone;


Expand Down Expand Up @@ -125,7 +125,7 @@ public function get_timestamp( $timestamp, $type = 'sunrise' ) {
default:
$function = 'date_sunrise';
}
return call_user_func( $function, $timestamp, SUNFUNCS_RET_TIMESTAMP, $this->latitude, $this->longitude, self::get_zenith( $this->elevation ) );
return call_user_func( $function, $timestamp, SUNFUNCS_RET_TIMESTAMP, $this->latitude, $this->longitude, self::get_zenith( $this->elevation ) );
}


Expand Down Expand Up @@ -406,41 +406,41 @@ public function get_moon_data( $timestamp = null ) {
'icon' => 'wi-moon-alt-new',
);
} elseif ( 0 < $moon['phase'] && 0.25 > $moon['phase'] ) {
$return = array(
'name' => 'waxing-crescent-moon',
'text' => __( 'Waxing Crescent', 'simple-location' ),
'icon' => 'wi-moon-alt-waxing-crescent-6',
);
$return = array(
'name' => 'waxing-crescent-moon',
'text' => __( 'Waxing Crescent', 'simple-location' ),
'icon' => 'wi-moon-alt-waxing-crescent-6',
);
} elseif ( 0.25 < $moon['phase'] && 0.5 > $moon['phase'] ) {
$return = array(
'name' => 'first-quarter-moon',
'text' => __( 'First Quarter', 'simple-location' ),
'icon' => 'wi-moon-alt-first-quarter',
);
} elseif ( 0.5 === $moon['phase'] ) {
$return = array(
'name' => 'full-moon',
'text' => __( 'Full Moon', 'simple-location' ),
'icon' => 'wi-moon-alt-full',
);
$return = array(
'name' => 'full-moon',
'text' => __( 'Full Moon', 'simple-location' ),
'icon' => 'wi-moon-alt-full',
);
} elseif ( 0.5 < $moon['phase'] && 0.75 > $moon['phase'] ) {
$return = array(
'name' => 'waning-gibbous-moon',
'text' => __( 'Waning Gibbous', 'simple-location' ),
'icon' => 'wi-moon-alt-waning-gibbous-1',
);
$return = array(
'name' => 'waning-gibbous-moon',
'text' => __( 'Waning Gibbous', 'simple-location' ),
'icon' => 'wi-moon-alt-waning-gibbous-1',
);
} elseif ( 0.75 === $moon['phase'] ) {
$return = array(
'name' => 'third-quarter-moon',
'text' => __( 'Third Quarter', 'simple-location' ),
'icon' => 'wi-moon-alt-third-quarter',
);
$return = array(
'name' => 'third-quarter-moon',
'text' => __( 'Third Quarter', 'simple-location' ),
'icon' => 'wi-moon-alt-third-quarter',
);
} elseif ( 0.75 < $moon['phase'] && 1 > $moon['phase'] ) {
$return = array(
'name' => 'waning-crescent-moon',
'text' => __( 'Waning Crescent', 'simple-location' ),
'icon' => 'wi-moon-alt-waning-crescent-1',
);
$return = array(
'name' => 'waning-crescent-moon',
'text' => __( 'Waning Crescent', 'simple-location' ),
'icon' => 'wi-moon-alt-waning-crescent-1',
);
}
return array_merge( $moon, $return );
}
Expand Down Expand Up @@ -562,10 +562,10 @@ public function get_moon_times( $timestamp = null ) {
$x1 = $xe - $dx;
$x2 = $xe + $dx;
if ( abs( $x1 ) <= 1 ) {
$roots++;
++$roots;
}
if ( abs( $x2 ) <= 1 ) {
$roots++;
++$roots;
}
if ( $x1 < -1 ) {
$x1 = $x2;
Expand Down Expand Up @@ -696,7 +696,5 @@ public function cloudiness( $wm2, $humidity ) {
return 20;
}
}

}

}
36 changes: 14 additions & 22 deletions includes/class-geo-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public static function init() {
add_filter( sprintf( 'manage_%1$s_posts_columns', $post_type ), array( __CLASS__, 'add_location_admin_column' ) );
add_action( sprintf( 'manage_%1$s_posts_custom_column', $post_type ), array( __CLASS__, 'manage_location_admin_column' ), 10, 2 );
}

}

public static function admin_init() {
Expand Down Expand Up @@ -193,20 +192,20 @@ public static function enqueue( $hook_suffix ) {
if ( in_array( $screen->id, $screens, true ) || in_array( $hook_suffix, $hooks, true ) ) {
wp_enqueue_style(
'sloc_admin',
plugins_url( 'css/location-admin.min.css', dirname( __FILE__ ) ),
plugins_url( 'css/location-admin.min.css', __DIR__ ),
array(),
Simple_Location_Plugin::$version
);
wp_enqueue_script(
'sloc_location',
plugins_url( 'js/location.js', dirname( __FILE__ ) ),
plugins_url( 'js/location.js', __DIR__ ),
array( 'jquery' ),
Simple_Location_Plugin::$version,
true
);
wp_enqueue_script(
'moment-timezone',
plugins_url( 'js/luxon.min.js', dirname( __FILE__ ) ),
plugins_url( 'js/luxon.min.js', __DIR__ ),
array(),
Simple_Location_Plugin::$version,
true
Expand Down Expand Up @@ -440,7 +439,6 @@ public static function geo_public_select( $public, $echo = false ) {
return $return;
}
echo wp_kses( $return, self::kses_option() );

}


Expand Down Expand Up @@ -717,7 +715,6 @@ public static function rest_location() {
),
)
);

}

/**
Expand Down Expand Up @@ -882,14 +879,14 @@ public static function rest_prepare_user( $response, $user, $request ) {
return $response;
}

/*
Sets Location custom capabilities.
/*
Sets Location custom capabilities.
*
* @param string[] $caps Array of the users capabilities.
* @param string $cap Capability name.
* @param int $user_id The user ID.
* @param string $cap Capability name.
* @param int $user_id The user ID.
* @param array $args Adds the context to the cap. Typically the object ID.
*/
*/
public static function map_meta_cap( $caps, $cap, $user_id, $args ) {
$id = 0;
if ( isset( $args[0] ) ) {
Expand Down Expand Up @@ -954,7 +951,7 @@ public static function map_meta_cap( $caps, $cap, $user_id, $args ) {
}

/*
Current User Can Read with Object for Private Location.
Current User Can Read with Object for Private Location.
*
* @param mixed $object The object.
* @return boolean True if current user can.
Expand Down Expand Up @@ -982,7 +979,7 @@ public static function current_user_can_read( $object ) {
}

/*
Current User Can Read with Object for Private Location.
Current User Can Read with Object for Private Location.
*
* @param mixed $object The object.
* @return boolean True if current user can.
Expand Down Expand Up @@ -1119,10 +1116,8 @@ public static function save_post_meta( $post_id ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}
} else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
} elseif ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}
if ( has_term( '', 'venue' ) ) {
return;
Expand All @@ -1134,12 +1129,10 @@ public static function save_post_meta( $post_id ) {
} else {
delete_post_meta( $post_id, 'venue_id' );
}
} else {
if ( isset( $_POST['venue_radius'] ) && is_numeric( $_POST['venue_radius'] ) ) {
} elseif ( isset( $_POST['venue_radius'] ) && is_numeric( $_POST['venue_radius'] ) ) {
update_post_meta( $post_id, 'venue_radius', intval( $_POST['venue_radius'] ) );
} else {
delete_post_meta( $post_id, 'venue_radius' );
}
} else {
delete_post_meta( $post_id, 'venue_radius' );
}
self::save_meta( 'post', $post_id );
}
Expand Down Expand Up @@ -1179,5 +1172,4 @@ public static function save_user_meta( $user_id ) {
}
self::save_meta( 'user', $user_id );
}

}
1 change: 0 additions & 1 deletion includes/class-geo-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1089,5 +1089,4 @@ public static function get_location( $type, $id, $args = array() ) {
$return = implode( PHP_EOL, $c );
return sprintf( '<%1s class="%2$s">%3$s</%1$s>', $args['wrapper-type'], implode( ' ', $class ), $return );
}

}
Loading

0 comments on commit ceb7c8c

Please sign in to comment.