Changeset 2476886
- Timestamp:
- 02/18/2021 09:20:18 AM (5 years ago)
- Location:
- novo-map
- Files:
-
- 14 edited
- 1 copied
-
tags/1.1.0 (copied) (copied from novo-map/trunk)
-
tags/1.1.0/README.txt (modified) (6 diffs)
-
tags/1.1.0/admin/class-novo-map-admin.php (modified) (6 diffs)
-
tags/1.1.0/includes/class-novo-map-gmap.php (modified) (8 diffs)
-
tags/1.1.0/includes/class-novo-map-infobox-style.php (modified) (2 diffs)
-
tags/1.1.0/includes/class-novo-map-marker-logo.php (modified) (1 diff)
-
tags/1.1.0/includes/class-novo-map.php (modified) (3 diffs)
-
tags/1.1.0/novo-map.php (modified) (3 diffs)
-
trunk/README.txt (modified) (6 diffs)
-
trunk/admin/class-novo-map-admin.php (modified) (6 diffs)
-
trunk/includes/class-novo-map-gmap.php (modified) (8 diffs)
-
trunk/includes/class-novo-map-infobox-style.php (modified) (2 diffs)
-
trunk/includes/class-novo-map-marker-logo.php (modified) (1 diff)
-
trunk/includes/class-novo-map.php (modified) (3 diffs)
-
trunk/novo-map.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
novo-map/tags/1.1.0/README.txt
r2262554 r2476886 4 4 Tags: google maps, maps, map, map markers, google map, google maps plugin, google map widget, google map shortcode, map with posts, post map, wp google maps, wp google map, map plugin, google map 5 5 Requires at least: 4.0 6 Tested up to: 5. 3.27 Stable tag: 1. 0.106 Tested up to: 5.6.1 7 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 With Novo-Map you can : 17 17 18 * Add an **unlimited number of google maps** anywhere on your site using ** shortcodes** or **widgets**.18 * Add an **unlimited number of google maps** anywhere on your site using **blocks**, **shortcodes** or **widgets**. 19 19 * Easily geolocate your **posts or pages** and display them (and link to them) on the maps. 20 20 * **Filter** the posts you want to display on a map with **categories or tags**. … … 25 25 * And **all the above features are available for free** and always will be. 26 26 27 If you want to see the plugin in action, you can see some examples on my **[travel blog](https://www.novo-monde.com )** or check **[the plugin demo page](https://www.novo-monde.com/novo-map-wordpress-plugin-demos/)**.28 If you want detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/ novo-map-user-guide/)**.27 If you want to see the plugin in action, you can see some examples on my **[travel blog](https://www.novo-monde.com/en/)** or check **[the plugin demo page](https://www.novo-monde.com/en/novo-map-wordpress-plugin-demos/)**. 28 If you want detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/en/novo-map-user-guide/)**. 29 29 30 30 Pour les utilisateurs francophones, si vous voulez voir le plugin en action, passez jeter un oeil à mon **[blog de voyage](https://www.novo-monde.com)** ou à la **[page des exemples](https://www.novo-monde.com/novo-map-wordpress-plugin-examples/)** du plugin. … … 53 53 1. Just click on the map to add a latitude and a longitude to your post. Title, image and description should be prefilled with your post title, featured image and post excerpt if they exists. Then just click on the 'Add Marker' button 54 54 1. Go back on the main novo-map menu and chose the map you just created from the drop down menu. You should see the pin you just created in the preview. 55 1. You can now either use the provided Shortcode or the novo-map widget from the widget menu to display this novo-map anywhere on your website.55 1. You can now either use the provided novo-map block, shortcode or the novo-map widget from the widget menu to display this novo-map anywhere on your website. 56 56 57 57 If you need more detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/novo-map-user-guide/)**. … … 61 61 = Generate a Google Map API Key = 62 62 63 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered . It really takes 1 minute! Then save the generated key in the novo-map menu.63 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered (you will need to add your billing credentials but you will have [28'000 map downloads/months for free](https://cloud.google.com/maps-platform/pricing/sheet/)). It really takes 1 minute! Then save the generated key in the novo-map menu. 64 64 65 65 = Display the same map with different parameters ? = … … 102 102 103 103 == Changelog == 104 105 = 1.1.0 = 106 * upgrade to gmap api 3.43 107 * New Novo-map block to display map from the Gutenberg block editor (Finally!!!). Still need to update the post meta_box menu the Gutenberg way though... 108 * small bug fixes 104 109 105 110 = 1.0.10 = -
novo-map/tags/1.1.0/admin/class-novo-map-admin.php
r2262554 r2476886 101 101 */ 102 102 public function enqueue_post_admin_script() { 103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 104 104 } 105 105 … … 108 108 */ 109 109 public function enqueue_main_admin_script() { 110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 111 111 wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) ); 112 112 wp_enqueue_script( $this->plugin_name.'-markerclusterer', plugins_url( $this->plugin_name) .'/public/assets/js/markerclusterer.js', array( $this->plugin_name.'-gmap-api' ) ); … … 229 229 230 230 //get the map to render in main menu 231 add_action( 'admin_footer', array($gmap, ' generate_script_admin'), 15 );231 add_action( 'admin_footer', array($gmap, 'echo_script_css_admin'), 15 ); 232 232 233 233 //get a default map to render a small map in the additional marker section … … 237 237 $gmap_small_map->set_name('gmapmainmenusmall'); 238 238 239 add_action( 'admin_footer', array($gmap_small_map, ' generate_script_admin'), 16 );239 add_action( 'admin_footer', array($gmap_small_map, 'echo_script_css_admin'), 16 ); 240 240 241 241 //get clustered marker to generate image in the form and additional marker … … 392 392 __( 'Novo Map', $this->plugin_name ), 393 393 array($this, 'post_admin_menu_callback'), 394 $screen 394 $screen, 395 'normal' 395 396 ); 396 397 } … … 442 443 $gmap = new Gmap($default_gmap); 443 444 $gmap->set_name('postmenumap'); 444 add_action( 'admin_footer', array($gmap, ' generate_script_admin'), 15 );445 add_action( 'admin_footer', array($gmap, 'echo_script_css_admin'), 15 ); 445 446 446 447 //if there is no marker, get the default class value -
novo-map/tags/1.1.0/includes/class-novo-map-gmap.php
r2262554 r2476886 12 12 * @subpackage Novo_Map/includes 13 13 */ 14 class Gmap {14 class Gmap implements \JsonSerializable { 15 15 16 16 /** … … 367 367 368 368 /** 369 * Allows to send private properties with json through the API 370 * 371 * @since 1.1.0 372 * @return array|mixed 373 */ 374 public function jsonSerialize(){ 375 $vars = get_object_vars($this); 376 return $vars; 377 } 378 379 /** 369 380 * All getters and setters for the Gmap class 370 381 * … … 693 704 public function enqueue_map($plugin_name) { 694 705 // enqueue necessary stuff 695 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true );706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true ); 696 707 wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) ); 697 708 if($this->pin_clustering()) { … … 700 711 701 712 // generate and enqueue map script 702 add_action( 'wp_print_footer_scripts', array( $this, ' generate_script'), 15 );703 } 704 705 /** 706 * function that generate the gmap specific part of the script707 * 708 * @since 1.0.0 709 */ 710 public function generate_script() {713 add_action( 'wp_print_footer_scripts', array( $this, 'echo_script_css'), 15 ); 714 } 715 716 /** 717 * echo map script and css for the front end 718 * 719 * @since 1.0.0 720 */ 721 public function echo_script_css() { 711 722 //get the necessary classes 712 723 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; … … 764 775 //add custom styles for necessary infoboxes 765 776 foreach ($infobox_style_list as $infobox_style) { 766 $infobox_style-> add_css($gmap_name);777 $infobox_style->echo_css($gmap_name); 767 778 } 768 779 … … 777 788 778 789 /** 779 * generate map scriptfor the admin side (post menu and gmap menu)780 * 781 * @since 1.0.0 782 */ 783 public function generate_script_admin() {790 * echo map script and css for the admin side (post menu and gmap menu) 791 * 792 * @since 1.0.0 793 */ 794 public function echo_script_css_admin() { 784 795 //get the necessary classes 785 796 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; … … 843 854 //add custom styles for necessary infoboxes 844 855 foreach ($infobox_style_list as $infobox_style) { 845 $infobox_style-> add_css($gmap_name);856 $infobox_style->echo_css($gmap_name); 846 857 } 847 858 … … 854 865 echo fn_minify_js($gmap_script); 855 866 } 867 868 /** 869 * Generate and return the gmap script for use in the API for exemple 870 * 871 * @since 1.0.0 872 */ 873 public function generate_script_css($container_id) { 874 //get the necessary classes 875 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; 876 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-manager.php'; 877 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-logo.php'; 878 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-logo-manager.php'; 879 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-infobox-style.php'; 880 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-infobox-style-manager.php'; 881 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/helpers/php-html-css-js-minifier.php'; 882 global $wpdb; 883 $marker_logo_manager = new Marker_Logo_Manager($wpdb); 884 $marker_manager = new Marker_Manager($wpdb); 885 $infobox_style_manager = new Infobox_Style_Manager($wpdb); 886 $gmap_name = 'novomap'.$container_id; 887 $script_css = array ( 888 'script' => '', 889 'css' => [] 890 ); 891 892 //get all markers to display 893 $category = $this->category(); 894 $tag = $this->tag(); 895 if(empty($category) and empty($tag)) { 896 $marker_list = $marker_manager->get_list(); 897 } 898 elseif (! empty($category)) { 899 $marker_list = $marker_manager->get_list_category($this->category()); 900 } 901 elseif (! empty($tag)) { 902 $marker_list = $marker_manager->get_list_tag($this->tag()); 903 } 904 905 //get additional marker if defined 906 if($this->additional_marker()) { 907 $additional_marker_array = array( 908 'latitude' => $this->additional_marker_latitude(), 909 'longitude' => $this->additional_marker_longitude(), 910 'title' => $this->additional_marker_title(), 911 'marker_logo_id' => $this->additional_marker_logo_id(), 912 'infobox_style' => '', 913 ); 914 $additional_marker = new Marker($additional_marker_array); 915 } 916 917 //get only the necessary marker logo for this map 918 $marker_logo_id_list = get_marker_logo_ids_from_map_marker($this, $marker_list); 919 $marker_logo_list = $marker_logo_manager->get_list_from_ids_list($marker_logo_id_list); 920 921 //get the necessary infobox styles for this map 922 if ($this->infobox_style()!=='no') { 923 $infobox_style_list[$this->infobox_style()] = $infobox_style_manager->get($this->infobox_style()); 924 } 925 else { 926 $infobox_style_list = $infobox_style_manager->get_infobox_styles_from_marker($marker_list); 927 } 928 929 //add custom styles for necessary infoboxes 930 foreach ($infobox_style_list as $infobox_style) { 931 array_push($script_css['css'], $infobox_style->add_css($gmap_name)); 932 } 933 934 //generate the script from template 935 ob_start(); 936 include( plugin_dir_path(dirname( __FILE__ )) .'admin/partials/gmap-script-api.php' ); 937 $gmap_script = ob_get_contents(); 938 ob_end_clean(); 939 //echo a minified version of the js 940 $script_css['script'] = fn_minify_js($gmap_script); 941 942 return $script_css; 943 } 856 944 } -
novo-map/tags/1.1.0/includes/class-novo-map-infobox-style.php
r1773144 r2476886 270 270 271 271 /** 272 * enqueue unique css for the infoboxes of a ma è272 * enqueue unique css for the infoboxes of a map 273 273 * 274 274 * @param $gmap_name 275 275 * @since 1.0.0 276 */ 277 public function echo_css($gmap_name) { 278 //generate the css from template 279 ob_start(); 280 include( plugin_dir_path(dirname( __FILE__ )) .'public/partials/infobox-styles/'.$this->css_template() ); 281 $infobox_css = ob_get_contents(); 282 ob_end_clean(); 283 echo fn_minify_css($infobox_css); 284 } 285 286 /** 287 * returns unique css for the infoboxes of a map 288 * 289 * @param $gmap_name 290 * @since 1.1.0 276 291 */ 277 292 public function add_css($gmap_name) { … … 281 296 $infobox_css = ob_get_contents(); 282 297 ob_end_clean(); 283 echofn_minify_css($infobox_css);298 return fn_minify_css($infobox_css); 284 299 } 285 300 } -
novo-map/tags/1.1.0/includes/class-novo-map-marker-logo.php
r1949383 r2476886 129 129 $parsed['scheme'] = 'http'; 130 130 } 131 return $parsed['scheme'].'://'.$parsed['host'].$parsed['path']; 131 if(isset($parsed['port'])) { 132 return $parsed['scheme'].'://'.$parsed['host'].':'.$parsed['port'].'/'.$parsed['path']; 133 } 134 else { 135 return $parsed['scheme'].'://'.$parsed['host'].$parsed['path']; 136 } 132 137 } 133 138 else{ -
novo-map/tags/1.1.0/includes/class-novo-map.php
r1993784 r2476886 79 79 $this->define_admin_hooks(); 80 80 $this->define_public_hooks(); 81 $this->define_gutenberg_hooks(); 81 82 82 83 } … … 122 123 */ 123 124 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-novo-map-public.php'; 125 126 /** 127 * The class responsible for defining all actions that occur in the Gutenberg editor 128 */ 129 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'gutenberg/class-novo-map-gutenberg.php'; 130 131 /** 132 * The class responsible for defining all api endpoints 133 */ 134 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-api.php'; 124 135 125 136 $this->loader = new Novo_Map_Loader(); … … 201 212 } 202 213 214 /** 215 * Register all of the hooks related to Gutenberg 216 * 217 * @since 1.1.0 218 * @access private 219 */ 220 private function define_gutenberg_hooks() { 221 222 $plugin_gutenberg = new Novo_Map_Gutenberg( $this->get_plugin_name(), $this->get_version() ); 223 $api = new Novo_Map_Api( $this->get_plugin_name() ); 224 225 $this->loader->add_action( 'init', $plugin_gutenberg, 'register_scripts' ); 226 $this->loader->add_action( 'init', $plugin_gutenberg, 'register_styles' ); 227 $this->loader->add_action( 'enqueue_block_editor_assets', $plugin_gutenberg, 'enqueue_block_editor_assets' ); 228 229 $plugin_gutenberg->blocks_register_block_type('novo-map', 230 array( 231 'render_callback' => [ $plugin_gutenberg, 'render_block_novo_map' ], 232 ) 233 ); 234 235 $api->run(); 236 237 } 238 203 239 /** 204 240 * Run the loader to execute all of the hooks with WordPress. -
novo-map/tags/1.1.0/novo-map.php
r2262554 r2476886 9 9 * that starts the plugin. 10 10 * 11 * @link www.novo-media.ch11 * @link https://novo-media.ch 12 12 * @since 1.0.0 13 13 * @package Novo_Map … … 17 17 * Plugin URI: https://wordpress.org/plugins/novo-map/ 18 18 * Description: Display all your posts and pages on custom google maps 19 * Version: 1. 0.1019 * Version: 1.1.0 20 20 * Author: novo-media 21 * Author URI: www.novo-media.ch21 * Author URI: https://novo-media.ch 22 22 * License: GPL-2.0+ 23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 31 31 } 32 32 33 define( 'NOVO_MAP_VERSION', '1. 0.10' );33 define( 'NOVO_MAP_VERSION', '1.1.0' ); 34 34 35 35 /** -
novo-map/trunk/README.txt
r2262554 r2476886 4 4 Tags: google maps, maps, map, map markers, google map, google maps plugin, google map widget, google map shortcode, map with posts, post map, wp google maps, wp google map, map plugin, google map 5 5 Requires at least: 4.0 6 Tested up to: 5. 3.27 Stable tag: 1. 0.106 Tested up to: 5.6.1 7 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 16 16 With Novo-Map you can : 17 17 18 * Add an **unlimited number of google maps** anywhere on your site using ** shortcodes** or **widgets**.18 * Add an **unlimited number of google maps** anywhere on your site using **blocks**, **shortcodes** or **widgets**. 19 19 * Easily geolocate your **posts or pages** and display them (and link to them) on the maps. 20 20 * **Filter** the posts you want to display on a map with **categories or tags**. … … 25 25 * And **all the above features are available for free** and always will be. 26 26 27 If you want to see the plugin in action, you can see some examples on my **[travel blog](https://www.novo-monde.com )** or check **[the plugin demo page](https://www.novo-monde.com/novo-map-wordpress-plugin-demos/)**.28 If you want detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/ novo-map-user-guide/)**.27 If you want to see the plugin in action, you can see some examples on my **[travel blog](https://www.novo-monde.com/en/)** or check **[the plugin demo page](https://www.novo-monde.com/en/novo-map-wordpress-plugin-demos/)**. 28 If you want detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/en/novo-map-user-guide/)**. 29 29 30 30 Pour les utilisateurs francophones, si vous voulez voir le plugin en action, passez jeter un oeil à mon **[blog de voyage](https://www.novo-monde.com)** ou à la **[page des exemples](https://www.novo-monde.com/novo-map-wordpress-plugin-examples/)** du plugin. … … 53 53 1. Just click on the map to add a latitude and a longitude to your post. Title, image and description should be prefilled with your post title, featured image and post excerpt if they exists. Then just click on the 'Add Marker' button 54 54 1. Go back on the main novo-map menu and chose the map you just created from the drop down menu. You should see the pin you just created in the preview. 55 1. You can now either use the provided Shortcode or the novo-map widget from the widget menu to display this novo-map anywhere on your website.55 1. You can now either use the provided novo-map block, shortcode or the novo-map widget from the widget menu to display this novo-map anywhere on your website. 56 56 57 57 If you need more detailed informations about the plugin, have a look at the **[user guide](https://www.novo-monde.com/novo-map-user-guide/)**. … … 61 61 = Generate a Google Map API Key = 62 62 63 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered . It really takes 1 minute! Then save the generated key in the novo-map menu.63 Generate a google map API key can be frustrating but it is required by google and it is the same for every google map plugin. But don't worry it's really not that complicated. Just click on the 'Get API key' button on [This Page](https://developers.google.com/maps/documentation/javascript/get-api-key) and follows the few steps requiered (you will need to add your billing credentials but you will have [28'000 map downloads/months for free](https://cloud.google.com/maps-platform/pricing/sheet/)). It really takes 1 minute! Then save the generated key in the novo-map menu. 64 64 65 65 = Display the same map with different parameters ? = … … 102 102 103 103 == Changelog == 104 105 = 1.1.0 = 106 * upgrade to gmap api 3.43 107 * New Novo-map block to display map from the Gutenberg block editor (Finally!!!). Still need to update the post meta_box menu the Gutenberg way though... 108 * small bug fixes 104 109 105 110 = 1.0.10 = -
novo-map/trunk/admin/class-novo-map-admin.php
r2262554 r2476886 101 101 */ 102 102 public function enqueue_post_admin_script() { 103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );103 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 104 104 } 105 105 … … 108 108 */ 109 109 public function enqueue_main_admin_script() { 110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false );110 wp_enqueue_script( $this->plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($this->plugin_name.'_gmap_api_key')) . '', array(), null, false ); 111 111 wp_enqueue_script( $this->plugin_name.'-infobox', plugins_url( $this->plugin_name) .'/public/assets/js/infobox.js', array( $this->plugin_name.'-gmap-api' ) ); 112 112 wp_enqueue_script( $this->plugin_name.'-markerclusterer', plugins_url( $this->plugin_name) .'/public/assets/js/markerclusterer.js', array( $this->plugin_name.'-gmap-api' ) ); … … 229 229 230 230 //get the map to render in main menu 231 add_action( 'admin_footer', array($gmap, ' generate_script_admin'), 15 );231 add_action( 'admin_footer', array($gmap, 'echo_script_css_admin'), 15 ); 232 232 233 233 //get a default map to render a small map in the additional marker section … … 237 237 $gmap_small_map->set_name('gmapmainmenusmall'); 238 238 239 add_action( 'admin_footer', array($gmap_small_map, ' generate_script_admin'), 16 );239 add_action( 'admin_footer', array($gmap_small_map, 'echo_script_css_admin'), 16 ); 240 240 241 241 //get clustered marker to generate image in the form and additional marker … … 392 392 __( 'Novo Map', $this->plugin_name ), 393 393 array($this, 'post_admin_menu_callback'), 394 $screen 394 $screen, 395 'normal' 395 396 ); 396 397 } … … 442 443 $gmap = new Gmap($default_gmap); 443 444 $gmap->set_name('postmenumap'); 444 add_action( 'admin_footer', array($gmap, ' generate_script_admin'), 15 );445 add_action( 'admin_footer', array($gmap, 'echo_script_css_admin'), 15 ); 445 446 446 447 //if there is no marker, get the default class value -
novo-map/trunk/includes/class-novo-map-gmap.php
r2262554 r2476886 12 12 * @subpackage Novo_Map/includes 13 13 */ 14 class Gmap {14 class Gmap implements \JsonSerializable { 15 15 16 16 /** … … 367 367 368 368 /** 369 * Allows to send private properties with json through the API 370 * 371 * @since 1.1.0 372 * @return array|mixed 373 */ 374 public function jsonSerialize(){ 375 $vars = get_object_vars($this); 376 return $vars; 377 } 378 379 /** 369 380 * All getters and setters for the Gmap class 370 381 * … … 693 704 public function enqueue_map($plugin_name) { 694 705 // enqueue necessary stuff 695 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.4 0&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true );706 wp_enqueue_script( $plugin_name.'-gmap-api', 'https://maps.googleapis.com/maps/api/js?v=3.43&key=' . esc_attr(get_option($plugin_name.'_gmap_api_key')) . '', array(), null, true ); 696 707 wp_enqueue_script( $plugin_name.'-infobox', plugins_url( $plugin_name) .'/public/assets/js/infobox.js', array( $plugin_name.'-gmap-api' ) ); 697 708 if($this->pin_clustering()) { … … 700 711 701 712 // generate and enqueue map script 702 add_action( 'wp_print_footer_scripts', array( $this, ' generate_script'), 15 );703 } 704 705 /** 706 * function that generate the gmap specific part of the script707 * 708 * @since 1.0.0 709 */ 710 public function generate_script() {713 add_action( 'wp_print_footer_scripts', array( $this, 'echo_script_css'), 15 ); 714 } 715 716 /** 717 * echo map script and css for the front end 718 * 719 * @since 1.0.0 720 */ 721 public function echo_script_css() { 711 722 //get the necessary classes 712 723 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; … … 764 775 //add custom styles for necessary infoboxes 765 776 foreach ($infobox_style_list as $infobox_style) { 766 $infobox_style-> add_css($gmap_name);777 $infobox_style->echo_css($gmap_name); 767 778 } 768 779 … … 777 788 778 789 /** 779 * generate map scriptfor the admin side (post menu and gmap menu)780 * 781 * @since 1.0.0 782 */ 783 public function generate_script_admin() {790 * echo map script and css for the admin side (post menu and gmap menu) 791 * 792 * @since 1.0.0 793 */ 794 public function echo_script_css_admin() { 784 795 //get the necessary classes 785 796 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; … … 843 854 //add custom styles for necessary infoboxes 844 855 foreach ($infobox_style_list as $infobox_style) { 845 $infobox_style-> add_css($gmap_name);856 $infobox_style->echo_css($gmap_name); 846 857 } 847 858 … … 854 865 echo fn_minify_js($gmap_script); 855 866 } 867 868 /** 869 * Generate and return the gmap script for use in the API for exemple 870 * 871 * @since 1.0.0 872 */ 873 public function generate_script_css($container_id) { 874 //get the necessary classes 875 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker.php'; 876 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-manager.php'; 877 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-logo.php'; 878 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-marker-logo-manager.php'; 879 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-infobox-style.php'; 880 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-infobox-style-manager.php'; 881 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/helpers/php-html-css-js-minifier.php'; 882 global $wpdb; 883 $marker_logo_manager = new Marker_Logo_Manager($wpdb); 884 $marker_manager = new Marker_Manager($wpdb); 885 $infobox_style_manager = new Infobox_Style_Manager($wpdb); 886 $gmap_name = 'novomap'.$container_id; 887 $script_css = array ( 888 'script' => '', 889 'css' => [] 890 ); 891 892 //get all markers to display 893 $category = $this->category(); 894 $tag = $this->tag(); 895 if(empty($category) and empty($tag)) { 896 $marker_list = $marker_manager->get_list(); 897 } 898 elseif (! empty($category)) { 899 $marker_list = $marker_manager->get_list_category($this->category()); 900 } 901 elseif (! empty($tag)) { 902 $marker_list = $marker_manager->get_list_tag($this->tag()); 903 } 904 905 //get additional marker if defined 906 if($this->additional_marker()) { 907 $additional_marker_array = array( 908 'latitude' => $this->additional_marker_latitude(), 909 'longitude' => $this->additional_marker_longitude(), 910 'title' => $this->additional_marker_title(), 911 'marker_logo_id' => $this->additional_marker_logo_id(), 912 'infobox_style' => '', 913 ); 914 $additional_marker = new Marker($additional_marker_array); 915 } 916 917 //get only the necessary marker logo for this map 918 $marker_logo_id_list = get_marker_logo_ids_from_map_marker($this, $marker_list); 919 $marker_logo_list = $marker_logo_manager->get_list_from_ids_list($marker_logo_id_list); 920 921 //get the necessary infobox styles for this map 922 if ($this->infobox_style()!=='no') { 923 $infobox_style_list[$this->infobox_style()] = $infobox_style_manager->get($this->infobox_style()); 924 } 925 else { 926 $infobox_style_list = $infobox_style_manager->get_infobox_styles_from_marker($marker_list); 927 } 928 929 //add custom styles for necessary infoboxes 930 foreach ($infobox_style_list as $infobox_style) { 931 array_push($script_css['css'], $infobox_style->add_css($gmap_name)); 932 } 933 934 //generate the script from template 935 ob_start(); 936 include( plugin_dir_path(dirname( __FILE__ )) .'admin/partials/gmap-script-api.php' ); 937 $gmap_script = ob_get_contents(); 938 ob_end_clean(); 939 //echo a minified version of the js 940 $script_css['script'] = fn_minify_js($gmap_script); 941 942 return $script_css; 943 } 856 944 } -
novo-map/trunk/includes/class-novo-map-infobox-style.php
r1773144 r2476886 270 270 271 271 /** 272 * enqueue unique css for the infoboxes of a ma è272 * enqueue unique css for the infoboxes of a map 273 273 * 274 274 * @param $gmap_name 275 275 * @since 1.0.0 276 */ 277 public function echo_css($gmap_name) { 278 //generate the css from template 279 ob_start(); 280 include( plugin_dir_path(dirname( __FILE__ )) .'public/partials/infobox-styles/'.$this->css_template() ); 281 $infobox_css = ob_get_contents(); 282 ob_end_clean(); 283 echo fn_minify_css($infobox_css); 284 } 285 286 /** 287 * returns unique css for the infoboxes of a map 288 * 289 * @param $gmap_name 290 * @since 1.1.0 276 291 */ 277 292 public function add_css($gmap_name) { … … 281 296 $infobox_css = ob_get_contents(); 282 297 ob_end_clean(); 283 echofn_minify_css($infobox_css);298 return fn_minify_css($infobox_css); 284 299 } 285 300 } -
novo-map/trunk/includes/class-novo-map-marker-logo.php
r1949383 r2476886 129 129 $parsed['scheme'] = 'http'; 130 130 } 131 return $parsed['scheme'].'://'.$parsed['host'].$parsed['path']; 131 if(isset($parsed['port'])) { 132 return $parsed['scheme'].'://'.$parsed['host'].':'.$parsed['port'].'/'.$parsed['path']; 133 } 134 else { 135 return $parsed['scheme'].'://'.$parsed['host'].$parsed['path']; 136 } 132 137 } 133 138 else{ -
novo-map/trunk/includes/class-novo-map.php
r1993784 r2476886 79 79 $this->define_admin_hooks(); 80 80 $this->define_public_hooks(); 81 $this->define_gutenberg_hooks(); 81 82 82 83 } … … 122 123 */ 123 124 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-novo-map-public.php'; 125 126 /** 127 * The class responsible for defining all actions that occur in the Gutenberg editor 128 */ 129 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'gutenberg/class-novo-map-gutenberg.php'; 130 131 /** 132 * The class responsible for defining all api endpoints 133 */ 134 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-novo-map-api.php'; 124 135 125 136 $this->loader = new Novo_Map_Loader(); … … 201 212 } 202 213 214 /** 215 * Register all of the hooks related to Gutenberg 216 * 217 * @since 1.1.0 218 * @access private 219 */ 220 private function define_gutenberg_hooks() { 221 222 $plugin_gutenberg = new Novo_Map_Gutenberg( $this->get_plugin_name(), $this->get_version() ); 223 $api = new Novo_Map_Api( $this->get_plugin_name() ); 224 225 $this->loader->add_action( 'init', $plugin_gutenberg, 'register_scripts' ); 226 $this->loader->add_action( 'init', $plugin_gutenberg, 'register_styles' ); 227 $this->loader->add_action( 'enqueue_block_editor_assets', $plugin_gutenberg, 'enqueue_block_editor_assets' ); 228 229 $plugin_gutenberg->blocks_register_block_type('novo-map', 230 array( 231 'render_callback' => [ $plugin_gutenberg, 'render_block_novo_map' ], 232 ) 233 ); 234 235 $api->run(); 236 237 } 238 203 239 /** 204 240 * Run the loader to execute all of the hooks with WordPress. -
novo-map/trunk/novo-map.php
r2262554 r2476886 9 9 * that starts the plugin. 10 10 * 11 * @link www.novo-media.ch11 * @link https://novo-media.ch 12 12 * @since 1.0.0 13 13 * @package Novo_Map … … 17 17 * Plugin URI: https://wordpress.org/plugins/novo-map/ 18 18 * Description: Display all your posts and pages on custom google maps 19 * Version: 1. 0.1019 * Version: 1.1.0 20 20 * Author: novo-media 21 * Author URI: www.novo-media.ch21 * Author URI: https://novo-media.ch 22 22 * License: GPL-2.0+ 23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 31 31 } 32 32 33 define( 'NOVO_MAP_VERSION', '1. 0.10' );33 define( 'NOVO_MAP_VERSION', '1.1.0' ); 34 34 35 35 /**
Note: See TracChangeset
for help on using the changeset viewer.