@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | - public function google_maps_shortcode( $atts ) { |
|
| 40 | + public function google_maps_shortcode($atts) { |
|
| 41 | 41 | |
| 42 | 42 | $atts = shortcode_atts( |
| 43 | 43 | array( |
@@ -48,26 +48,26 @@ discard block |
||
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | //gather data for this shortcode |
| 51 | - $post = get_post( $atts['id'] ); |
|
| 52 | - $all_meta = get_post_custom( $atts['id'] ); |
|
| 51 | + $post = get_post($atts['id']); |
|
| 52 | + $all_meta = get_post_custom($atts['id']); |
|
| 53 | 53 | |
| 54 | - $visual_info = maybe_unserialize( $all_meta['gmb_width_height'][0] ); |
|
| 55 | - $lat_lng = maybe_unserialize( $all_meta['gmb_lat_lng'][0] ); |
|
| 54 | + $visual_info = maybe_unserialize($all_meta['gmb_width_height'][0]); |
|
| 55 | + $lat_lng = maybe_unserialize($all_meta['gmb_lat_lng'][0]); |
|
| 56 | 56 | |
| 57 | 57 | //Put markers into an array for JS usage |
| 58 | 58 | $map_marker_array = array(); |
| 59 | - $markers_repeatable = isset( $all_meta['gmb_markers_group'][0] ) ? maybe_unserialize( $all_meta['gmb_markers_group'][0] ) : ''; |
|
| 59 | + $markers_repeatable = isset($all_meta['gmb_markers_group'][0]) ? maybe_unserialize($all_meta['gmb_markers_group'][0]) : ''; |
|
| 60 | 60 | |
| 61 | - if ( is_array( $markers_repeatable ) ) { |
|
| 62 | - foreach ( $markers_repeatable as $marker ) { |
|
| 63 | - array_push( $map_marker_array, $marker ); |
|
| 61 | + if (is_array($markers_repeatable)) { |
|
| 62 | + foreach ($markers_repeatable as $marker) { |
|
| 63 | + array_push($map_marker_array, $marker); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //Send data for AJAX usage |
| 68 | 68 | //Add params to AJAX for Shortcode Usage |
| 69 | 69 | //@see: http://benjaminrojas.net/using-wp_localize_script-dynamically/ |
| 70 | - $localized_data = apply_filters( 'gmb_localized_data', array( |
|
| 70 | + $localized_data = apply_filters('gmb_localized_data', array( |
|
| 71 | 71 | $post->ID => array( |
| 72 | 72 | 'id' => $atts['id'], |
| 73 | 73 | 'map_params' => array( |
@@ -76,42 +76,42 @@ discard block |
||
| 76 | 76 | 'height' => $visual_info['height'], |
| 77 | 77 | 'latitude' => $lat_lng['latitude'], |
| 78 | 78 | 'longitude' => $lat_lng['longitude'], |
| 79 | - 'zoom' => ! empty( $all_meta['gmb_zoom'][0] ) ? $all_meta['gmb_zoom'][0] : '15', |
|
| 80 | - 'default_marker' => apply_filters( 'gmb_default_marker', GMB_PLUGIN_URL . 'assets/img/spotlight-poi.png' ), |
|
| 79 | + 'zoom' => ! empty($all_meta['gmb_zoom'][0]) ? $all_meta['gmb_zoom'][0] : '15', |
|
| 80 | + 'default_marker' => apply_filters('gmb_default_marker', GMB_PLUGIN_URL.'assets/img/spotlight-poi.png'), |
|
| 81 | 81 | ), |
| 82 | 82 | 'map_controls' => array( |
| 83 | - 'zoom_control' => ! empty( $all_meta['gmb_zoom_control'][0] ) ? strtoupper( $all_meta['gmb_zoom_control'][0] ) : 'STANDARD', |
|
| 84 | - 'pan_control' => ! empty( $all_meta['gmb_pan'][0] ) ? $all_meta['gmb_pan'][0] : 'none', |
|
| 85 | - 'map_type_control' => ! empty( $all_meta['gmb_map_type_control'][0] ) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
| 86 | - 'draggable' => ! empty( $all_meta['gmb_draggable'][0] ) ? $all_meta['gmb_draggable'][0] : 'none', |
|
| 87 | - 'double_click_zoom' => ! empty( $all_meta['gmb_double_click'][0] ) ? $all_meta['gmb_double_click'][0] : 'none', |
|
| 88 | - 'wheel_zoom' => ! empty( $all_meta['gmb_wheel_zoom'][0] ) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
| 89 | - 'street_view' => ! empty( $all_meta['gmb_street_view'][0] ) ? $all_meta['gmb_street_view'][0] : 'none', |
|
| 83 | + 'zoom_control' => ! empty($all_meta['gmb_zoom_control'][0]) ? strtoupper($all_meta['gmb_zoom_control'][0]) : 'STANDARD', |
|
| 84 | + 'pan_control' => ! empty($all_meta['gmb_pan'][0]) ? $all_meta['gmb_pan'][0] : 'none', |
|
| 85 | + 'map_type_control' => ! empty($all_meta['gmb_map_type_control'][0]) ? $all_meta['gmb_map_type_control'][0] : 'none', |
|
| 86 | + 'draggable' => ! empty($all_meta['gmb_draggable'][0]) ? $all_meta['gmb_draggable'][0] : 'none', |
|
| 87 | + 'double_click_zoom' => ! empty($all_meta['gmb_double_click'][0]) ? $all_meta['gmb_double_click'][0] : 'none', |
|
| 88 | + 'wheel_zoom' => ! empty($all_meta['gmb_wheel_zoom'][0]) ? $all_meta['gmb_wheel_zoom'][0] : 'none', |
|
| 89 | + 'street_view' => ! empty($all_meta['gmb_street_view'][0]) ? $all_meta['gmb_street_view'][0] : 'none', |
|
| 90 | 90 | ), |
| 91 | 91 | 'map_theme' => array( |
| 92 | - 'map_type' => ! empty( $all_meta['gmb_type'][0] ) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
| 93 | - 'map_theme_json' => ! empty( $all_meta['gmb_theme_json'][0] ) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
| 92 | + 'map_type' => ! empty($all_meta['gmb_type'][0]) ? $all_meta['gmb_type'][0] : 'RoadMap', |
|
| 93 | + 'map_theme_json' => ! empty($all_meta['gmb_theme_json'][0]) ? $all_meta['gmb_theme_json'][0] : 'none', |
|
| 94 | 94 | |
| 95 | 95 | ), |
| 96 | 96 | 'map_markers' => $map_marker_array, |
| 97 | 97 | 'plugin_url' => GMB_PLUGIN_URL, |
| 98 | 98 | 'places_api' => array( |
| 99 | - 'show_places' => ! empty( $all_meta['gmb_show_places'][0] ) ? $all_meta['gmb_show_places'][0] : 'no', |
|
| 100 | - 'search_radius' => ! empty( $all_meta['gmb_search_radius'][0] ) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
| 101 | - 'search_places' => ! empty( $all_meta['gmb_places_search_multicheckbox'][0] ) ? maybe_unserialize( $all_meta['gmb_places_search_multicheckbox'][0] ) : '', |
|
| 99 | + 'show_places' => ! empty($all_meta['gmb_show_places'][0]) ? $all_meta['gmb_show_places'][0] : 'no', |
|
| 100 | + 'search_radius' => ! empty($all_meta['gmb_search_radius'][0]) ? $all_meta['gmb_search_radius'][0] : '3000', |
|
| 101 | + 'search_places' => ! empty($all_meta['gmb_places_search_multicheckbox'][0]) ? maybe_unserialize($all_meta['gmb_places_search_multicheckbox'][0]) : '', |
|
| 102 | 102 | ), |
| 103 | - 'map_markers_icon' => ! empty( $all_meta['gmb_map_marker'] ) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
| 103 | + 'map_markers_icon' => ! empty($all_meta['gmb_map_marker']) ? $all_meta['gmb_map_marker'][0] : 'none', |
|
| 104 | 104 | 'current_post' => get_the_ID(), |
| 105 | 105 | ) |
| 106 | - ) ); |
|
| 106 | + )); |
|
| 107 | 107 | |
| 108 | - $this->array_push_localized_script( $localized_data ); |
|
| 108 | + $this->array_push_localized_script($localized_data); |
|
| 109 | 109 | |
| 110 | 110 | ob_start(); |
| 111 | 111 | |
| 112 | - include $this->get_google_maps_template( 'public.php' ); |
|
| 112 | + include $this->get_google_maps_template('public.php'); |
|
| 113 | 113 | |
| 114 | - return apply_filters( 'gmb_shortcode_output', ob_get_clean() ); |
|
| 114 | + return apply_filters('gmb_shortcode_output', ob_get_clean()); |
|
| 115 | 115 | |
| 116 | 116 | } |
| 117 | 117 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | // If this file is called directly, abort. |
| 18 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 18 | +if ( ! defined('ABSPATH')) { |
|
| 19 | 19 | exit; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -23,34 +23,34 @@ discard block |
||
| 23 | 23 | * Define Constants |
| 24 | 24 | */ |
| 25 | 25 | // Plugin Folder Path |
| 26 | -if ( ! defined( 'GMB_PLUGIN_PATH' ) ) { |
|
| 27 | - define( 'GMB_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
|
| 26 | +if ( ! defined('GMB_PLUGIN_PATH')) { |
|
| 27 | + define('GMB_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
|
| 28 | 28 | } |
| 29 | 29 | // Plugin Folder URL |
| 30 | -if ( ! defined( 'GMB_PLUGIN_URL' ) ) { |
|
| 31 | - define( 'GMB_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 30 | +if ( ! defined('GMB_PLUGIN_URL')) { |
|
| 31 | + define('GMB_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
| 32 | 32 | } |
| 33 | 33 | // Plugin base |
| 34 | -if ( ! defined( 'GMB_PLUGIN_BASE' ) ) { |
|
| 35 | - define( 'GMB_PLUGIN_BASE', plugin_basename( __FILE__ ) ); |
|
| 34 | +if ( ! defined('GMB_PLUGIN_BASE')) { |
|
| 35 | + define('GMB_PLUGIN_BASE', plugin_basename(__FILE__)); |
|
| 36 | 36 | } |
| 37 | 37 | // Plugin version |
| 38 | -if ( ! defined( 'GMB_VERSION' ) ) { |
|
| 39 | - define( 'GMB_VERSION', '2.1.1' ); |
|
| 38 | +if ( ! defined('GMB_VERSION')) { |
|
| 39 | + define('GMB_VERSION', '2.1.1'); |
|
| 40 | 40 | } |
| 41 | 41 | // Plugin Root File |
| 42 | -if ( ! defined( 'GMB_PLUGIN_FILE' ) ) { |
|
| 43 | - define( 'GMB_PLUGIN_FILE', __FILE__ ); |
|
| 42 | +if ( ! defined('GMB_PLUGIN_FILE')) { |
|
| 43 | + define('GMB_PLUGIN_FILE', __FILE__); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | -if ( ! class_exists( 'Google_Maps_Builder' ) ) : |
|
| 47 | +if ( ! class_exists('Google_Maps_Builder')) : |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * Load plugin if core lib is present |
| 51 | 51 | */ |
| 52 | - if ( ! file_exists( GMB_PLUGIN_PATH . 'vendor/wordimpress/maps-builder-core/core.php' ) ) { |
|
| 53 | - add_action( 'admin_notices', 'gmb_no_core_lib' ); |
|
| 52 | + if ( ! file_exists(GMB_PLUGIN_PATH.'vendor/wordimpress/maps-builder-core/core.php')) { |
|
| 53 | + add_action('admin_notices', 'gmb_no_core_lib'); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Print admin notice if no dependencies |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | * @uses "admin_notice" hook |
| 59 | 59 | */ |
| 60 | 60 | function gmb_no_core_lib() { |
| 61 | - printf( '<div class="notice notice-error"><p>%s</p></div>', esc_html__( 'Your install of Maps Builder is missing its Composer dependencies and can not load.', 'maps-builder-pro' ) ); |
|
| 61 | + printf('<div class="notice notice-error"><p>%s</p></div>', esc_html__('Your install of Maps Builder is missing its Composer dependencies and can not load.', 'maps-builder-pro')); |
|
| 62 | 62 | } |
| 63 | 63 | } else { |
| 64 | - require_once GMB_PLUGIN_PATH . 'vendor/wordimpress/maps-builder-core/core.php'; |
|
| 64 | + require_once GMB_PLUGIN_PATH.'vendor/wordimpress/maps-builder-core/core.php'; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Main Maps Builder Class |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | * @return Google_Maps_Builder |
| 110 | 110 | */ |
| 111 | 111 | public static function instance() { |
| 112 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Google_Maps_Builder ) ) { |
|
| 112 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Google_Maps_Builder)) { |
|
| 113 | 113 | |
| 114 | 114 | self::$instance = new Google_Maps_Builder(); |
| 115 | 115 | |
| 116 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
| 116 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
| 117 | 117 | |
| 118 | 118 | self::$instance->includes(); |
| 119 | 119 | self::$instance->activate = new Google_Maps_Builder_Activate(); |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Read plugin meta |
| 126 | 126 | // Check that function get_plugin_data exists |
| 127 | - if ( ! function_exists( 'get_plugin_data' ) ) { |
|
| 128 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
| 127 | + if ( ! function_exists('get_plugin_data')) { |
|
| 128 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
| 129 | 129 | } |
| 130 | - self::$instance->meta = get_plugin_data( GMB_PLUGIN_FILE, false ); |
|
| 130 | + self::$instance->meta = get_plugin_data(GMB_PLUGIN_FILE, false); |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $this->cmb2_load(); |
| 150 | 150 | $this->load_files(); |
| 151 | - require_once GMB_PLUGIN_PATH . 'includes/class-gmb-scripts.php'; |
|
| 152 | - require_once GMB_PLUGIN_PATH . 'includes/class-gmb-html-elements.php'; |
|
| 151 | + require_once GMB_PLUGIN_PATH.'includes/class-gmb-scripts.php'; |
|
| 152 | + require_once GMB_PLUGIN_PATH.'includes/class-gmb-html-elements.php'; |
|
| 153 | 153 | |
| 154 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
| 154 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
| 155 | 155 | |
| 156 | 156 | $this->load_admin(); |
| 157 | 157 | //Admin |