@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | 23 | function init_gmb_forms_widget() { |
| 24 | - register_widget( 'Google_Maps_Builder_Widget' ); |
|
| 24 | + register_widget('Google_Maps_Builder_Widget'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | -add_action( 'widgets_init', 'init_gmb_forms_widget' ); |
|
| 27 | +add_action('widgets_init', 'init_gmb_forms_widget'); |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Google Places Reviews |
@@ -56,36 +56,36 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | parent::__construct( |
| 58 | 58 | 'gmb_maps_widget', // Base ID |
| 59 | - __( 'Maps Builder Widget', $this->plugin_slug ), // Name |
|
| 59 | + __('Maps Builder Widget', $this->plugin_slug), // Name |
|
| 60 | 60 | array( |
| 61 | 61 | 'classname' => 'gmb-maps-widget', |
| 62 | - 'description' => __( 'Display a Google Map in your theme\'s widget powered sidebar.', $this->plugin_slug ) |
|
| 62 | + 'description' => __('Display a Google Map in your theme\'s widget powered sidebar.', $this->plugin_slug) |
|
| 63 | 63 | ) //Args |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | //Actions |
| 67 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
| 67 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | //Load Widget JS Script ONLY on Widget page |
| 73 | - public function admin_widget_scripts( $hook ) { |
|
| 73 | + public function admin_widget_scripts($hook) { |
|
| 74 | 74 | |
| 75 | 75 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 76 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 76 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 77 | 77 | |
| 78 | 78 | //Widget Script |
| 79 | - if ( $hook == 'widgets.php' ) { |
|
| 79 | + if ($hook == 'widgets.php') { |
|
| 80 | 80 | |
| 81 | - wp_register_style( $this->plugin_slug . '-admin-styles', GMB_PLUGIN_URL . 'assets/css/gmb-admin' . $suffix . '.css', array(), GMB_VERSION ); |
|
| 82 | - wp_enqueue_style( $this->plugin_slug . '-admin-styles' ); |
|
| 81 | + wp_register_style($this->plugin_slug.'-admin-styles', GMB_PLUGIN_URL.'assets/css/gmb-admin'.$suffix.'.css', array(), GMB_VERSION); |
|
| 82 | + wp_enqueue_style($this->plugin_slug.'-admin-styles'); |
|
| 83 | 83 | |
| 84 | - wp_register_script( 'gmb-qtip', GMB_PLUGIN_URL . 'assets/js/plugins/jquery.qtip' . $suffix . '.js', array( 'jquery' ), GMB_VERSION ); |
|
| 85 | - wp_enqueue_script( 'gmb-qtip' ); |
|
| 84 | + wp_register_script('gmb-qtip', GMB_PLUGIN_URL.'assets/js/plugins/jquery.qtip'.$suffix.'.js', array('jquery'), GMB_VERSION); |
|
| 85 | + wp_enqueue_script('gmb-qtip'); |
|
| 86 | 86 | |
| 87 | - wp_register_script( 'gmb-admin-widgets-scripts', GMB_PLUGIN_URL . 'assets/js/admin/admin-widget' . $suffix . '.js', array( 'jquery' ), GMB_VERSION, false ); |
|
| 88 | - wp_enqueue_script( 'gmb-admin-widgets-scripts' ); |
|
| 87 | + wp_register_script('gmb-admin-widgets-scripts', GMB_PLUGIN_URL.'assets/js/admin/admin-widget'.$suffix.'.js', array('jquery'), GMB_VERSION, false); |
|
| 88 | + wp_enqueue_script('gmb-admin-widgets-scripts'); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -100,35 +100,35 @@ discard block |
||
| 100 | 100 | * @return null |
| 101 | 101 | * @see WP_Widget::form() |
| 102 | 102 | */ |
| 103 | - public function form( $instance ) { |
|
| 103 | + public function form($instance) { |
|
| 104 | 104 | |
| 105 | - $instance = wp_parse_args( (array) $instance, $this->widget_defaults ); ?> |
|
| 105 | + $instance = wp_parse_args((array) $instance, $this->widget_defaults); ?> |
|
| 106 | 106 | |
| 107 | 107 | <!-- Title --> |
| 108 | 108 | <p> |
| 109 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Widget Title', 'gpr' ); ?></label> |
|
| 110 | - <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" |
|
| 111 | - name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
| 109 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'gpr'); ?></label> |
|
| 110 | + <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
|
| 111 | + name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" /> |
|
| 112 | 112 | </p> |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | <?php |
| 116 | 116 | //Query Give Forms |
| 117 | - $args = array( |
|
| 117 | + $args = array( |
|
| 118 | 118 | 'post_type' => 'google_maps', |
| 119 | 119 | 'posts_per_page' => - 1, |
| 120 | 120 | 'post_status' => 'publish', |
| 121 | 121 | ); |
| 122 | - $gmb_forms = get_posts( $args ); |
|
| 122 | + $gmb_forms = get_posts($args); |
|
| 123 | 123 | ?> |
| 124 | 124 | <p> |
| 125 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php _e( 'Select a Map:', $this->plugin_slug ); ?> |
|
| 126 | - <span class="dashicons gmb-tooltip-icon" data-tooltip="<?php _e( 'Select a map that you would like to embed in this widget area.', $this->plugin_slug ); ?>"></span> |
|
| 125 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php _e('Select a Map:', $this->plugin_slug); ?> |
|
| 126 | + <span class="dashicons gmb-tooltip-icon" data-tooltip="<?php _e('Select a map that you would like to embed in this widget area.', $this->plugin_slug); ?>"></span> |
|
| 127 | 127 | </label> |
| 128 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
| 129 | - <option value="current"><?php _e( 'Please select...', $this->plugin_slug ); ?></option> |
|
| 130 | - <?php foreach ( $gmb_forms as $gmb_form ) { ?> |
|
| 131 | - <option <?php selected( absint( $instance['id'] ), $gmb_form->ID ); ?> value="<?php echo esc_attr( $gmb_form->ID ); ?>"><?php echo $gmb_form->post_title; ?></option> |
|
| 128 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
| 129 | + <option value="current"><?php _e('Please select...', $this->plugin_slug); ?></option> |
|
| 130 | + <?php foreach ($gmb_forms as $gmb_form) { ?> |
|
| 131 | + <option <?php selected(absint($instance['id']), $gmb_form->ID); ?> value="<?php echo esc_attr($gmb_form->ID); ?>"><?php echo $gmb_form->post_title; ?></option> |
|
| 132 | 132 | <?php } ?> |
| 133 | 133 | </select> |
| 134 | 134 | </p> |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | <div class="gmb-widget-upgrade clear"> |
| 138 | 138 | <span class="powered-by"></span> |
| 139 | - <a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=WIDGET&utm_campaign=MBF%20Widgets" target="_blank" class="button button-small"><?php _e( 'Upgrade to Pro', $this->plugin_slug ); ?> |
|
| 139 | + <a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=WIDGET&utm_campaign=MBF%20Widgets" target="_blank" class="button button-small"><?php _e('Upgrade to Pro', $this->plugin_slug); ?> |
|
| 140 | 140 | <span class="new-window"></span></a> |
| 141 | 141 | </div> |
| 142 | 142 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | * @param array $args Widget arguments. |
| 153 | 153 | * @param array $instance Saved values from database. |
| 154 | 154 | */ |
| 155 | - public function widget( $args, $instance ) { |
|
| 155 | + public function widget($args, $instance) { |
|
| 156 | 156 | |
| 157 | 157 | echo $args['before_widget']; |
| 158 | 158 | |
| 159 | - do_action( 'gmb_before_forms_widget' ); |
|
| 159 | + do_action('gmb_before_forms_widget'); |
|
| 160 | 160 | |
| 161 | - if ( ! empty( $instance['title'] ) ) { |
|
| 162 | - echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; |
|
| 161 | + if ( ! empty($instance['title'])) { |
|
| 162 | + echo $args['before_title'].apply_filters('widget_title', $instance['title']).$args['after_title']; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $atts = array( |
@@ -167,14 +167,14 @@ discard block |
||
| 167 | 167 | ); |
| 168 | 168 | |
| 169 | 169 | //Ensure a map has been set |
| 170 | - if ( $instance['id'] !== 'current' ) { |
|
| 171 | - echo Google_Maps_Builder()->engine->google_maps_shortcode( $atts ); |
|
| 170 | + if ($instance['id'] !== 'current') { |
|
| 171 | + echo Google_Maps_Builder()->engine->google_maps_shortcode($atts); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | echo $args['after_widget']; |
| 176 | 176 | |
| 177 | - do_action( 'gmb_after_forms_widget' ); |
|
| 177 | + do_action('gmb_after_forms_widget'); |
|
| 178 | 178 | |
| 179 | 179 | } |
| 180 | 180 | |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @DESC: Saves the widget options |
| 186 | 186 | * @SEE WP_Widget::update |
| 187 | 187 | */ |
| 188 | - function update( $new_instance, $old_instance ) { |
|
| 188 | + function update($new_instance, $old_instance) { |
|
| 189 | 189 | $instance = $old_instance; |
| 190 | 190 | //loop through options array and save to new instance |
| 191 | - foreach ( $this->widget_defaults as $field => $value ) { |
|
| 192 | - $instance[ $field ] = strip_tags( stripslashes( $new_instance[ $field ] ) ); |
|
| 191 | + foreach ($this->widget_defaults as $field => $value) { |
|
| 192 | + $instance[$field] = strip_tags(stripslashes($new_instance[$field])); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | return $instance; |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | global $current_user; |
| 21 | 21 | $user_id = $current_user->ID; |
| 22 | 22 | // Check that the user hasn't already clicked to ignore the welcome message and that they have appropriate permissions |
| 23 | - if ( ! get_user_meta( $user_id, 'gmb_hide_welcome' ) && current_user_can( 'install_plugins' ) ) { |
|
| 23 | + if ( ! get_user_meta($user_id, 'gmb_hide_welcome') && current_user_can('install_plugins')) { |
|
| 24 | 24 | ?> |
| 25 | 25 | <div class="gmb-container welcome-header clear"> |
| 26 | 26 | <div class="row"> |
| 27 | 27 | |
| 28 | 28 | <div class="gmb-col-md-9"> |
| 29 | - <h1 class="main-heading"><?php _e( 'Welcome to Maps Builder', $this->plugin_slug ); ?> - <?php echo Google_Maps_Builder()->meta['Version']; ?></h1> |
|
| 29 | + <h1 class="main-heading"><?php _e('Welcome to Maps Builder', $this->plugin_slug); ?> - <?php echo Google_Maps_Builder()->meta['Version']; ?></h1> |
|
| 30 | 30 | |
| 31 | - <p class="main-subheading"><?php _e( 'Thanks for using Maps Builder', $this->plugin_slug ); ?> <?php echo Google_Maps_Builder()->meta['Version']; ?>. <?php echo sprintf( __( 'To get started, read over the %1$sdocumentation%2$s, take a gander at the settings, and build yourself some maps! If you enjoy this plugin please consider telling a friend, rating it %3$s5-stars%2$s, or purchasing the %4$sPro%2$s edition.', $this->plugin_slug ), '<a href="https://wordimpress.com/documentation/maps-builder-pro/" target="_blank">', '</a>', '<a href="https://wordpress.org/support/view/plugin-reviews/google-maps-builder?filter=5#postform" target="_blank">', '<a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SETTINGS&utm_campaign=MBF%20Settings" target="_blank">' ); ?></p> |
|
| 32 | - <?php include( 'social-media.php' ); ?> |
|
| 31 | + <p class="main-subheading"><?php _e('Thanks for using Maps Builder', $this->plugin_slug); ?> <?php echo Google_Maps_Builder()->meta['Version']; ?>. <?php echo sprintf(__('To get started, read over the %1$sdocumentation%2$s, take a gander at the settings, and build yourself some maps! If you enjoy this plugin please consider telling a friend, rating it %3$s5-stars%2$s, or purchasing the %4$sPro%2$s edition.', $this->plugin_slug), '<a href="https://wordimpress.com/documentation/maps-builder-pro/" target="_blank">', '</a>', '<a href="https://wordpress.org/support/view/plugin-reviews/google-maps-builder?filter=5#postform" target="_blank">', '<a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SETTINGS&utm_campaign=MBF%20Settings" target="_blank">'); ?></p> |
|
| 32 | + <?php include('social-media.php'); ?> |
|
| 33 | 33 | |
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | <div class="gmb-col-md-3"> |
| 37 | 37 | <div class="logo-svg"> |
| 38 | - <?php include( 'mascot-svg.php' ); ?> |
|
| 38 | + <?php include('mascot-svg.php'); ?> |
|
| 39 | 39 | </div> |
| 40 | 40 | </div> |
| 41 | 41 | </div> |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | <?php } ?> |
| 45 | 45 | |
| 46 | - <div class="logo-svg logo-svg-small pull-right" <?php echo( ! get_user_meta( $user_id, 'gmb_hide_welcome' ) ? |
|
| 47 | - 'style="display:none;"' : '' ); ?>> |
|
| 48 | - <div class="gmb-plugin-heading"><?php _e( 'Maps Builder - Free Edition', $this->plugin_slug ); ?></div> |
|
| 49 | - <?php include( 'logo-svg.php' ); ?> |
|
| 50 | - <a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SETTINGS&utm_campaign=MBF%20Settings" target="_blank" class="button button-primary gmb-orange-btn gmb-settings-header-btn"><?php _e( 'Upgrade to Pro', $this->plugin_slug ); ?></a> |
|
| 46 | + <div class="logo-svg logo-svg-small pull-right" <?php echo( ! get_user_meta($user_id, 'gmb_hide_welcome') ? |
|
| 47 | + 'style="display:none;"' : ''); ?>> |
|
| 48 | + <div class="gmb-plugin-heading"><?php _e('Maps Builder - Free Edition', $this->plugin_slug); ?></div> |
|
| 49 | + <?php include('logo-svg.php'); ?> |
|
| 50 | + <a href="https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=SETTINGS&utm_campaign=MBF%20Settings" target="_blank" class="button button-primary gmb-orange-btn gmb-settings-header-btn"><?php _e('Upgrade to Pro', $this->plugin_slug); ?></a> |
|
| 51 | 51 | </div> |
| 52 | 52 | |
| 53 | 53 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @see: http://code.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-5-tabbed-navigation-for-your-settings-page--wp-24971 |
| 61 | 61 | */ |
| 62 | - $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'map_options'; |
|
| 62 | + $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'map_options'; |
|
| 63 | 63 | ?> |
| 64 | 64 | <h1 class="nav-tab-wrapper"> |
| 65 | - <a href="?post_type=google_maps&page=<?php echo self::$key; ?>" class="nav-tab <?php echo $active_tab == 'map_options' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Map Options', $this->plugin_slug ); ?></a> |
|
| 66 | - <a href="?post_type=google_maps&page=<?php echo self::$key; ?>&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'General Options', $this->plugin_slug ); ?></a> |
|
| 67 | - <a href="?post_type=google_maps&page=<?php echo self::$key; ?>&tab=system_info" class="nav-tab <?php echo $active_tab == 'system_info' ? 'nav-tab-active' : ''; ?>"><?php _e( 'System Info', $this->plugin_slug ); ?></a> |
|
| 65 | + <a href="?post_type=google_maps&page=<?php echo self::$key; ?>" class="nav-tab <?php echo $active_tab == 'map_options' ? 'nav-tab-active' : ''; ?>"><?php _e('Map Options', $this->plugin_slug); ?></a> |
|
| 66 | + <a href="?post_type=google_maps&page=<?php echo self::$key; ?>&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php _e('General Options', $this->plugin_slug); ?></a> |
|
| 67 | + <a href="?post_type=google_maps&page=<?php echo self::$key; ?>&tab=system_info" class="nav-tab <?php echo $active_tab == 'system_info' ? 'nav-tab-active' : ''; ?>"><?php _e('System Info', $this->plugin_slug); ?></a> |
|
| 68 | 68 | </h1> |
| 69 | 69 | |
| 70 | 70 | |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * Get the appropriate tab |
| 74 | 74 | */ |
| 75 | - switch ( $active_tab ) { |
|
| 75 | + switch ($active_tab) { |
|
| 76 | 76 | case 'map_options': |
| 77 | - include( 'tab-map-options.php' ); |
|
| 77 | + include('tab-map-options.php'); |
|
| 78 | 78 | break; |
| 79 | 79 | case 'general_settings': |
| 80 | - include( 'tab-general-settings.php' ); |
|
| 80 | + include('tab-general-settings.php'); |
|
| 81 | 81 | break; |
| 82 | 82 | case 'system_info': |
| 83 | - include( 'tab-system-info.php' ); |
|
| 83 | + include('tab-system-info.php'); |
|
| 84 | 84 | break; |
| 85 | 85 | default : |
| 86 | - include( 'tab-map-options.php' ); |
|
| 86 | + include('tab-map-options.php'); |
|
| 87 | 87 | break; |
| 88 | 88 | } |
| 89 | 89 | ?> |