Plugin Directory

Changeset 3096423


Ignore:
Timestamp:
06/02/2024 10:09:42 PM (22 months ago)
Author:
gsarig
Message:

Update to version .2.8.2 from GitHub

Location:
ootb-openstreetmap
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ootb-openstreetmap/tags/.2.8.2/includes/classes/Query.php

    r3092806 r3096423  
    179179                    continue;
    180180                }
     181
    181182                $markers[][] = (object) [
    182183                    'lat'  => $latitude,
    183184                    'lng'  => $longitude,
    184                     'text' => $address,
     185                    'text' => wp_kses_post( apply_filters( 'ootb_cf_modal_content', $address, $post_id ) ),
    185186                    'id'   => $post_id,
     187                    'icon' => self::get_cf_marker_icon( $post_id ),
    186188                ];
    187189            } else {
     
    342344        ];
    343345    }
     346
     347    /**
     348     * Gets the marker icon and allows the user to override it with a hook.
     349     *
     350     * @param int $post_id The post ID.
     351     *
     352     * @return array|null
     353     */
     354    private static function get_cf_marker_icon( int $post_id = 0 ): ?array {
     355        if ( empty( $post_id ) ) {
     356            return null;
     357        }
     358        $icon_url = apply_filters( 'ootb_cf_marker_icon', '', $post_id );
     359        $icon     = null;
     360        if ( ! empty( $icon_url ) && filter_var( $icon_url, FILTER_VALIDATE_URL ) ) {
     361            $icon = [
     362                'url' => esc_url( $icon_url ),
     363            ];
     364        }
     365
     366        return $icon;
     367    }
    344368}
  • ootb-openstreetmap/tags/.2.8.2/ootb-openstreetmap.php

    r3092809 r3096423  
    66 * Requires at least: 5.8.6
    77 * Requires PHP:      7.4
    8  * Version:           2.8.1
     8 * Version:           2.8.2
    99 * Author:            Giorgos Sarigiannidis
    1010 * Author URI:        https://www.gsarigiannidis.gr
     
    2222
    2323const OOTB_BLOCK_NAME     = 'ootb/openstreetmap';
    24 const OOTB_VERSION        = '2.8.1';
     24const OOTB_VERSION        = '2.8.2';
    2525const OOTB_SCRIPT_VERSION = [
    2626    'leaflet'                  => '1.9.4',
  • ootb-openstreetmap/tags/.2.8.2/readme.txt

    r3092809 r3096423  
    66Tested up to: 6.5
    77Requires PHP: 7.4
    8 Stable tag: 2.8.1
     8Stable tag: 2.8.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323* [Release history](https://github.com/gsarig/ootb-openstreetmap/releases)
    2424* [Roadmap](https://github.com/users/gsarig/projects/1)
     25* [Hooks🪝](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#hooks)
     26* [Shortcodes](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#shortcodes)
    2527
    2628= Features =
     
    8789
    8890= How can I use the shortcode? =
    89 The shortcode `[ootb_query]` allows you to display a dynamic map, which retrieves markers from other posts or post types. Just add it to a post or page and you're good to go. By default, it will fetch the markers from the 100 most recent posts. The shortcode supports the following attributes:
    90 * source: (Optional) The source of the data. Can be either `geodata`, if you want to retrieve the posts based on their Location custom meta field, or `block`, to retrieve posts containing map blocks in their content. The default option, which will be used if the attribute is omitted, is `block`.
    91 * post_type: (Optional) The type of post to query. By default, it is set to `post`.
    92 * posts_per_page: (Optional) The number of posts to be displayed on page. Default value is `100`.
    93 * post_ids: (Optional) Comma-separated IDs of the posts to include in the query.
    94 * height: (Optional) The desired height for the map. Default value is empty, which falls back to `400px`.
    95 * provider: (Optional) Specifies the map provider. Options are: `openstreetmap`, `mapbox` and `stamen`. The default value is an empty string which falls back to `openstreetmap`.
    96 * maptype: (Optional) Specifies the type of map. Options are: `markers`, `polygon` and `polyline`. The default value is an empty string, which will fall back to `markers`.
    97 * touchzoom: (Optional) If set, touch zoom will be enabled on the map. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    98 * scrollwheelzoom: (Optional) If set, enables zooming on the map with mouse scroll wheel. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    99 * dragging: (Optional) If set, dragging is enabled on the map. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    100 * doubleclickzoom: (Optional) If set, allows zooming in on the map with a double click. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    101 * marker: (Optional) Specifies the marker for the map. This should correspond to the URL of the image that you want to use as the marker's icon (example: `https://www.example.com/my-custom-icon.png`). The default value is an empty string, which retrieves the default marker.
    102 
    103 Here's an example of how you can use it:
    104 ```
    105 [ootb_query post_type="post" post_ids="1,2,3,4" height="400px" provider="mapbox" maptype="polygon" touchzoom="true" scrollwheelzoom="true" dragging="true" doubleclickzoom="true" marker="https://www.example.com/my-custom-icon.png"]
    106 ```
     91To see the available shortcodes and the parameters that you can pass, [go here](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#shortcodes).
    10792
    10893= I want more control. Are there any hooks that I could use? =
    109 Glad you asked! There are a few hooks that you can use to further customize the plugin's behavior. Here they are:
    110 * `ootb_query_post_type`: Allows you to change the post type that the plugin will query for markers. By default, it is set to `post`. You can pass multiple post types as an array. Example:
    111 ```
    112 add_filter( 'ootb_query_post_type', function() { return array( 'post', 'page' ); } );
    113 ```
    114 * `ootb_query_posts_per_page`: Allows you to change the number of posts that the plugin will query for markers. By default, it is set to `100`. Example:
    115 ```
    116 add_filter( 'ootb_query_posts_per_page', function() { return 500; } );
    117 ```
    118 * `ootb_query_extra_args`: Allows you to add extra arguments to the query that the plugin will use to retrieve markers. By default, it is set to an empty array. Example:
    119 ```
    120   add_filter(
    121      'ootb_query_extra_args',
    122      function() {
    123         return [
    124            'tax_query' => [
    125            [
    126               'taxonomy' => 'people',
    127               'field' => 'slug',
    128               'terms' => 'bob'
    129            ]
    130         ];
    131      }
    132   );
    133 ```
    134 Keep in mind that the extra args will be merged with the default ones, so you don't have to worry about overriding them. In fact, the args that are required for the query to work, cannot be overridden.
     94Glad you asked! There are a few hooks that you can use to further customize the plugin's behavior. [You can find them here](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#hooks).
    13595
    13696== Screenshots ==
     
    177137
    178138== Changelog ==
     139= 2.8.2 =
     140* [NEW] Adds the `ootb_cf_modal_content` and `ootb_cf_marker_icon` hooks, which allow you to change the content of the modal that appears when you query posts based on their "Location" custom fields, as well as the marker icon. For more info, check the plugin's FAQ section.
     141
    179142= 2.8.0 =
    180143* [NEW] Adds an option to enable a location custom field, which can be used to store a post's or post type's location, following the [Geodata guidelines](https://codex.wordpress.org/Geodata).
  • ootb-openstreetmap/trunk/includes/classes/Query.php

    r3092806 r3096423  
    179179                    continue;
    180180                }
     181
    181182                $markers[][] = (object) [
    182183                    'lat'  => $latitude,
    183184                    'lng'  => $longitude,
    184                     'text' => $address,
     185                    'text' => wp_kses_post( apply_filters( 'ootb_cf_modal_content', $address, $post_id ) ),
    185186                    'id'   => $post_id,
     187                    'icon' => self::get_cf_marker_icon( $post_id ),
    186188                ];
    187189            } else {
     
    342344        ];
    343345    }
     346
     347    /**
     348     * Gets the marker icon and allows the user to override it with a hook.
     349     *
     350     * @param int $post_id The post ID.
     351     *
     352     * @return array|null
     353     */
     354    private static function get_cf_marker_icon( int $post_id = 0 ): ?array {
     355        if ( empty( $post_id ) ) {
     356            return null;
     357        }
     358        $icon_url = apply_filters( 'ootb_cf_marker_icon', '', $post_id );
     359        $icon     = null;
     360        if ( ! empty( $icon_url ) && filter_var( $icon_url, FILTER_VALIDATE_URL ) ) {
     361            $icon = [
     362                'url' => esc_url( $icon_url ),
     363            ];
     364        }
     365
     366        return $icon;
     367    }
    344368}
  • ootb-openstreetmap/trunk/ootb-openstreetmap.php

    r3092809 r3096423  
    66 * Requires at least: 5.8.6
    77 * Requires PHP:      7.4
    8  * Version:           2.8.1
     8 * Version:           2.8.2
    99 * Author:            Giorgos Sarigiannidis
    1010 * Author URI:        https://www.gsarigiannidis.gr
     
    2222
    2323const OOTB_BLOCK_NAME     = 'ootb/openstreetmap';
    24 const OOTB_VERSION        = '2.8.1';
     24const OOTB_VERSION        = '2.8.2';
    2525const OOTB_SCRIPT_VERSION = [
    2626    'leaflet'                  => '1.9.4',
  • ootb-openstreetmap/trunk/readme.txt

    r3092809 r3096423  
    66Tested up to: 6.5
    77Requires PHP: 7.4
    8 Stable tag: 2.8.1
     8Stable tag: 2.8.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2323* [Release history](https://github.com/gsarig/ootb-openstreetmap/releases)
    2424* [Roadmap](https://github.com/users/gsarig/projects/1)
     25* [Hooks🪝](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#hooks)
     26* [Shortcodes](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#shortcodes)
    2527
    2628= Features =
     
    8789
    8890= How can I use the shortcode? =
    89 The shortcode `[ootb_query]` allows you to display a dynamic map, which retrieves markers from other posts or post types. Just add it to a post or page and you're good to go. By default, it will fetch the markers from the 100 most recent posts. The shortcode supports the following attributes:
    90 * source: (Optional) The source of the data. Can be either `geodata`, if you want to retrieve the posts based on their Location custom meta field, or `block`, to retrieve posts containing map blocks in their content. The default option, which will be used if the attribute is omitted, is `block`.
    91 * post_type: (Optional) The type of post to query. By default, it is set to `post`.
    92 * posts_per_page: (Optional) The number of posts to be displayed on page. Default value is `100`.
    93 * post_ids: (Optional) Comma-separated IDs of the posts to include in the query.
    94 * height: (Optional) The desired height for the map. Default value is empty, which falls back to `400px`.
    95 * provider: (Optional) Specifies the map provider. Options are: `openstreetmap`, `mapbox` and `stamen`. The default value is an empty string which falls back to `openstreetmap`.
    96 * maptype: (Optional) Specifies the type of map. Options are: `markers`, `polygon` and `polyline`. The default value is an empty string, which will fall back to `markers`.
    97 * touchzoom: (Optional) If set, touch zoom will be enabled on the map. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    98 * scrollwheelzoom: (Optional) If set, enables zooming on the map with mouse scroll wheel. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    99 * dragging: (Optional) If set, dragging is enabled on the map. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    100 * doubleclickzoom: (Optional) If set, allows zooming in on the map with a double click. It can be either `true` or `false`. The default value is an empty string, which falls back to `true`.
    101 * marker: (Optional) Specifies the marker for the map. This should correspond to the URL of the image that you want to use as the marker's icon (example: `https://www.example.com/my-custom-icon.png`). The default value is an empty string, which retrieves the default marker.
    102 
    103 Here's an example of how you can use it:
    104 ```
    105 [ootb_query post_type="post" post_ids="1,2,3,4" height="400px" provider="mapbox" maptype="polygon" touchzoom="true" scrollwheelzoom="true" dragging="true" doubleclickzoom="true" marker="https://www.example.com/my-custom-icon.png"]
    106 ```
     91To see the available shortcodes and the parameters that you can pass, [go here](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#shortcodes).
    10792
    10893= I want more control. Are there any hooks that I could use? =
    109 Glad you asked! There are a few hooks that you can use to further customize the plugin's behavior. Here they are:
    110 * `ootb_query_post_type`: Allows you to change the post type that the plugin will query for markers. By default, it is set to `post`. You can pass multiple post types as an array. Example:
    111 ```
    112 add_filter( 'ootb_query_post_type', function() { return array( 'post', 'page' ); } );
    113 ```
    114 * `ootb_query_posts_per_page`: Allows you to change the number of posts that the plugin will query for markers. By default, it is set to `100`. Example:
    115 ```
    116 add_filter( 'ootb_query_posts_per_page', function() { return 500; } );
    117 ```
    118 * `ootb_query_extra_args`: Allows you to add extra arguments to the query that the plugin will use to retrieve markers. By default, it is set to an empty array. Example:
    119 ```
    120   add_filter(
    121      'ootb_query_extra_args',
    122      function() {
    123         return [
    124            'tax_query' => [
    125            [
    126               'taxonomy' => 'people',
    127               'field' => 'slug',
    128               'terms' => 'bob'
    129            ]
    130         ];
    131      }
    132   );
    133 ```
    134 Keep in mind that the extra args will be merged with the default ones, so you don't have to worry about overriding them. In fact, the args that are required for the query to work, cannot be overridden.
     94Glad you asked! There are a few hooks that you can use to further customize the plugin's behavior. [You can find them here](https://github.com/gsarig/ootb-openstreetmap?tab=readme-ov-file#hooks).
    13595
    13696== Screenshots ==
     
    177137
    178138== Changelog ==
     139= 2.8.2 =
     140* [NEW] Adds the `ootb_cf_modal_content` and `ootb_cf_marker_icon` hooks, which allow you to change the content of the modal that appears when you query posts based on their "Location" custom fields, as well as the marker icon. For more info, check the plugin's FAQ section.
     141
    179142= 2.8.0 =
    180143* [NEW] Adds an option to enable a location custom field, which can be used to store a post's or post type's location, following the [Geodata guidelines](https://codex.wordpress.org/Geodata).
Note: See TracChangeset for help on using the changeset viewer.