Skip to content

Commit

Permalink
PHPCS Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske committed Feb 3, 2024
1 parent b1b8944 commit 589d432
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 61 deletions.
6 changes: 2 additions & 4 deletions includes/class-geo-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public static function init() {
add_action( 'restrict_manage_posts', array( __CLASS__, 'geo_posts_dropdown' ), 12, 2 );
add_action( 'restrict_manage_comments', array( __CLASS__, 'geo_comments_dropdown' ), 12 );


add_filter( 'bulk_actions-edit-post', array( __CLASS__, 'register_bulk_edit_location' ), 10 );
add_filter( 'handle_bulk_actions-edit-post', array( __CLASS__, 'handle_bulk_edit_location' ), 10, 3 );
add_action( 'admin_notices', array( __CLASS__, 'bulk_action_admin_notices' ) );
Expand Down Expand Up @@ -458,7 +457,7 @@ public static function geo_posts_dropdown( $post_type, $which ) {
if ( ! post_type_supports( $post_type, 'geo-location' ) ) {
return;
}
$type = get_post_type_object( $post_type );
$type = get_post_type_object( $post_type );
$selected = 'none';
if ( isset( $_REQUEST['geo'] ) ) {
$selected = sanitize_text_field( $_REQUEST['geo'] );
Expand Down Expand Up @@ -1131,7 +1130,7 @@ public static function save_post_meta( $post_id ) {
} else {
delete_post_meta( $post_id, 'venue_id' );
}
} else {
} else {
if ( isset( $_POST['venue_radius'] ) && is_numeric( $_POST['venue_radius'] ) ) {
update_post_meta( $post_id, 'venue_radius', intval( $_POST['venue_radius'] ) );
} else {
Expand All @@ -1142,7 +1141,6 @@ public static function save_post_meta( $post_id ) {
} else {
delete_post_meta( $post_id, 'venue_url' );
}

}
self::save_meta( 'post', $post_id );
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-geo-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ public static function get_location( $type, $id, $args = array() ) {
if ( $term ) {
Location_Taxonomy::set_location( $id, $term );
}
}
}
} else {
$term = false;
$venue = false;
Expand Down
1 change: 0 additions & 1 deletion includes/class-location-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ public static function micropub_set_location( $input, $args ) {
}
}


if ( isset( $properties['location'] ) && ! wp_is_numeric_array( $properties['location'] ) ) {
$location = $properties['location']['properties'];
if ( isset( $properties['checkin'] ) && ! wp_is_numeric_array( $properties['checkin'] ) ) {
Expand Down
19 changes: 9 additions & 10 deletions includes/class-location-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ public static function location_dropdown( $post_type, $which ) {
if ( ! post_type_supports( $post_type, 'geo-location' ) ) {
return;
}
$type = get_post_type_object( $post_type );
$type = get_post_type_object( $post_type );
$selected = '';
if ( isset( $_REQUEST['location'] ) ) {
$selected = sanitize_text_field( $_REQUEST['location'] );
}
wp_dropdown_categories(
wp_dropdown_categories(
array(
'name' => 'location',
'id' => 'location',
'show_option_none' => $type->labels->all_items,
'name' => 'location',
'id' => 'location',
'show_option_none' => $type->labels->all_items,
'option_none_value' => '',
'hierarchical' => true,
'taxonomy' => 'location',
'value_field' => 'slug',
'selected' => $selected
'hierarchical' => true,
'taxonomy' => 'location',
'value_field' => 'slug',
'selected' => $selected,
)
);
}
Expand Down Expand Up @@ -920,7 +920,6 @@ public static function get_post_location_link( $post_id = null ) {
* Wrapper around wp_list_categories for now that outputs a list of the locations.
* May be customized further in future.
*/

public static function list_locations() {
$defaults = array(
'taxonomy' => 'location',
Expand Down
2 changes: 1 addition & 1 deletion includes/class-post-venue.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public static function venue_types_dropdown( $post_type, $which ) {
*
* @param float $lat Latitude.
* @param float $lng Longitude.
* @param int $radius Radius to Search In. Optional.
* @param int $radius Radius to Search In. Optional.
* @return array Return the IDs of all nearby venues
*/
public static function nearby( $lat, $lng, $radius = 100 ) {
Expand Down
28 changes: 14 additions & 14 deletions includes/class-rest-geo.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ public function register_routes() {
'provider' => array(
'sanitize_callback' => 'sanitize_text_field',
),
'select' => array(
'sanitize_callback' => 'sanitize_text_field'
)
'select' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'permission_callback' => function ( $request ) {
return current_user_can( 'publish_posts' );
Expand Down Expand Up @@ -448,31 +448,31 @@ public static function user( $request ) {
public static function venue( $request ) {
// We dont need to check the nonce like with admin-ajax.
$params = $request->get_params();
$select = empty( $params['select'] ) ? null : $params['select'];
$select = empty( $params['select'] ) ? null : $params['select'];
$provider = empty( $params['provider'] ) ? null : $params['provider'];
$location = empty( $params['location'] ) ? null : $params['location'];
if ( $select ) {
$venue_args = array(
'name' => 'venue_id',
'id' => 'venue_id',
'show_option_none' => __( 'No Venue', 'simple-location' ),
'name' => 'venue_id',
'id' => 'venue_id',
'show_option_none' => __( 'No Venue', 'simple-location' ),
'option_none_value' => '0',
'hierarchical' => true,
'post_type' => 'venue',
'echo' => false,
'hierarchical' => true,
'post_type' => 'venue',
'echo' => false,
);
if ( is_numeric( $location ) && $location > 0 ) {
$venue_args['tax_query'] = array(
array(
'taxonomy' => 'location',
'terms' => $location,
)
'terms' => $location,
),
);
}
$response = wp_dropdown_pages( $venue_args );
$response = wp_dropdown_pages( $venue_args );
if ( $response ) {
return array(
'venue_select' => $response
'venue_select' => $response,
);
} else {
return $venue_args;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-sloc-media-metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public static function attachment( $meta, $post_id ) {
$reverse->set( $data['location']['latitude'], $data['location']['longitude'] );
$reverse_adr = $reverse->reverse_lookup();
if ( ! is_wp_error( $reverse_adr ) ) {
$term = Location_Taxonomy::get_location( $reverse_adr, true );
$term = Location_Taxonomy::get_location( $reverse_adr, true );
Location_Taxonomy::set_location( $post_id, $term );
if ( isset( $reverse_adr['display-name'] ) ) {
$update['geo_address'] = $reverse_adr['display-name'];
Expand Down
1 change: 0 additions & 1 deletion includes/data-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
* @package Simple_Location
*/

function set_post_geodata( $post, $key, $geodata ) {
$post = get_post( $post );
if ( ! $post ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/geo/class-geo-provider-here.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private function address_to_mf2( $json ) {
'houseNumber',
)
);
$street = self::ifnot(
$street = self::ifnot(
$location,
array(
'street',
Expand Down
4 changes: 2 additions & 2 deletions includes/widgets/class-sloc-airport-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct() {
'Sloc_Airport_Widget',
__( 'Airport Weather Station', 'simple-location' ),
array(
'description' => __( 'Adds current weather conditions at an airport', 'simple-location' ),
'show_instance_in_rest' => true
'description' => __( 'Adds current weather conditions at an airport', 'simple-location' ),
'show_instance_in_rest' => true,
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions includes/widgets/class-sloc-lastseen-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct() {
'Sloc_Lastseen_Widget',
__( 'User Last Seen', 'simple-location' ),
array(
'description' => __( 'Displays the location, time, or map of a users location.', 'simple-location' ),
'show_instance_in_rest' => true
'description' => __( 'Displays the location, time, or map of a users location.', 'simple-location' ),
'show_instance_in_rest' => true,
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions includes/widgets/class-sloc-station-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct() {
'Sloc_Station_Widget',
__( 'Weather Station', 'simple-location' ),
array(
'description' => __( 'Adds current weather conditions', 'simple-location' ),
'show_instance_in_rest' => true
'description' => __( 'Adds current weather conditions', 'simple-location' ),
'show_instance_in_rest' => true,
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions includes/widgets/class-sloc-weather-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct() {
'Sloc_Weather_Widget',
__( 'Weather', 'simple-location' ),
array(
'description' => __( 'Adds current weather conditions', 'simple-location' ),
'show_instance_in_rest' => true
'description' => __( 'Adds current weather conditions', 'simple-location' ),
'show_instance_in_rest' => true,
)
);
}
Expand Down
34 changes: 17 additions & 17 deletions templates/loc-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
$geodata = get_post_geodata();
if ( 'venue' === $type ) {
$geodata['venue_radius'] = get_post_meta( get_the_ID(), 'venue_radius', true );
$geodata['venue_url'] = get_post_meta( get_the_ID(), 'venue_url', true );
$geodata['venue_url'] = get_post_meta( get_the_ID(), 'venue_url', true );
} else {
$geodata['venue_id'] = get_post_meta( get_the_ID(), 'venue_id', true );
}
}


$location = wp_get_object_terms( get_the_ID(), 'location', array( 'fields' => 'ids' ) );
$location = count( $location ) >= 1 ? $location[0] : '';
$location = wp_get_object_terms( get_the_ID(), 'location', array( 'fields' => 'ids' ) );
$location = count( $location ) >= 1 ? $location[0] : '';
if ( is_array( $geodata ) && array_key_exists( 'venue_id', $geodata ) && $geodata['venue_id'] ) {
$display_name = get_the_title( $geodata['venue_id'] );
} else {
Expand Down Expand Up @@ -90,25 +90,25 @@
<label for="venue_id" class="quarter">
<?php esc_html_e( 'Venue:', 'simple-location' ); ?>
<!-- <input class="widefat" type="number" name="venue_id" id="venue_id" step="1" min="1" value="<?php echo esc_attr( ifset( $geodata['venue_id'], '' ) ); ?>" /> -->
<?php
<?php
$venue_args = array(
'name' => 'venue_id',
'id' => 'venue_id',
'show_option_none' => __( 'No Venue', 'simple-location' ),
'option_none_value' => '',
'hierarchical' => true,
'post_type' => 'venue',
'selected' => ifset( $geodata['venue_id'] )
'name' => 'venue_id',
'id' => 'venue_id',
'show_option_none' => __( 'No Venue', 'simple-location' ),
'option_none_value' => '',
'hierarchical' => true,
'post_type' => 'venue',
'selected' => ifset( $geodata['venue_id'] ),
);
if ( $location ) {
$venue_args['tax_query'] = array(
array(
'taxonomy' => 'location',
'terms' => $location
)
);
array(
'taxonomy' => 'location',
'terms' => $location,
),
);
}
wp_dropdown_pages( $venue_args );
wp_dropdown_pages( $venue_args );
?>

</label>
Expand Down
4 changes: 2 additions & 2 deletions templates/map-archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
'icon' => false,
'object_link' => true,
'altitude' => false,
'text' => true,
'description' => get_the_time( $date_format, get_the_ID() )
'text' => true,
'description' => get_the_time( $date_format, get_the_ID() ),
)
);
}
Expand Down

0 comments on commit 589d432

Please sign in to comment.