@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | $this->plugin_slug = Google_Maps_Builder()->get_plugin_slug(); |
34 | 34 | |
35 | 35 | //Create Settings submenu |
36 | - add_action( 'admin_init', array( $this, 'mninit' ) ); |
|
37 | - add_action( 'admin_menu', array( $this, 'add_page' ) ); |
|
36 | + add_action('admin_init', array($this, 'mninit')); |
|
37 | + add_action('admin_menu', array($this, 'add_page')); |
|
38 | 38 | |
39 | 39 | // Load admin style sheet and JavaScript. |
40 | - add_action( 'wp_ajax_hide_welcome', array( $this, 'hide_welcome_callback' ) ); |
|
41 | - add_action( 'cmb2_render_lat_lng_default', array( $this, 'cmb2_render_lat_lng_default' ), 10, 2 ); |
|
40 | + add_action('wp_ajax_hide_welcome', array($this, 'hide_welcome_callback')); |
|
41 | + add_action('cmb2_render_lat_lng_default', array($this, 'cmb2_render_lat_lng_default'), 10, 2); |
|
42 | 42 | |
43 | 43 | //Add links/information to plugin row meta |
44 | - add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 ); |
|
45 | - add_filter( 'plugin_action_links', array( $this, 'add_plugin_page_links' ), 10, 2 ); |
|
46 | - add_filter( 'cmb2_get_metabox_form_format', array( $this, 'gmb_modify_cmb2_form_output' ), 10, 3 ); |
|
44 | + add_filter('plugin_row_meta', array($this, 'add_plugin_meta_links'), 10, 2); |
|
45 | + add_filter('plugin_action_links', array($this, 'add_plugin_page_links'), 10, 2); |
|
46 | + add_filter('cmb2_get_metabox_form_format', array($this, 'gmb_modify_cmb2_form_output'), 10, 3); |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function mninit() { |
55 | 55 | |
56 | - register_setting( self::$key, self::$key ); |
|
56 | + register_setting(self::$key, self::$key); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | |
65 | 65 | $this->options_page = add_submenu_page( |
66 | 66 | 'edit.php?post_type=google_maps', |
67 | - __( 'Google Maps Builder Settings', $this->plugin_slug ), |
|
68 | - __( 'Settings', $this->plugin_slug ), |
|
67 | + __('Google Maps Builder Settings', $this->plugin_slug), |
|
68 | + __('Settings', $this->plugin_slug), |
|
69 | 69 | 'manage_options', |
70 | 70 | self::$key, |
71 | - array( $this, 'admin_page_display' ) |
|
71 | + array($this, 'admin_page_display') |
|
72 | 72 | ); |
73 | 73 | |
74 | 74 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function hide_welcome_callback() { |
83 | 83 | global $current_user; |
84 | 84 | $user_id = $current_user->ID; |
85 | - add_user_meta( $user_id, 'gmb_hide_welcome', 'true', true ); |
|
85 | + add_user_meta($user_id, 'gmb_hide_welcome', 'true', true); |
|
86 | 86 | wp_die(); // ajax call must die to avoid trailing 0 in your response |
87 | 87 | } |
88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function admin_page_display() { |
95 | 95 | |
96 | - include( 'views/settings-page.php' ); |
|
96 | + include('views/settings-page.php'); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | public function general_option_fields() { |
107 | 107 | |
108 | 108 | // Only need to initiate the array once per page-load |
109 | - if ( ! empty( self::$plugin_options ) ) { |
|
109 | + if ( ! empty(self::$plugin_options)) { |
|
110 | 110 | return self::$plugin_options; |
111 | 111 | } |
112 | 112 | |
@@ -114,41 +114,41 @@ discard block |
||
114 | 114 | |
115 | 115 | self::$plugin_options = array( |
116 | 116 | 'id' => 'plugin_options', |
117 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( self::$key, ), ), |
|
117 | + 'show_on' => array('key' => 'options-page', 'value' => array(self::$key,),), |
|
118 | 118 | 'show_names' => true, |
119 | 119 | 'fields' => array( |
120 | 120 | array( |
121 | - 'name' => __( 'Post Type Slug', $this->plugin_slug ), |
|
122 | - 'desc' => sprintf( __( 'Customize the default slug for the Maps Builder post type. %1$sResave (flush) permalinks%2$s after customizing.', $this->plugin_slug ), '<a href="' . esc_url( '/wp-admin/options-permalink.php' ) . '">"', '</a>' ), |
|
121 | + 'name' => __('Post Type Slug', $this->plugin_slug), |
|
122 | + 'desc' => sprintf(__('Customize the default slug for the Maps Builder post type. %1$sResave (flush) permalinks%2$s after customizing.', $this->plugin_slug), '<a href="'.esc_url('/wp-admin/options-permalink.php').'">"', '</a>'), |
|
123 | 123 | 'default' => 'google-maps', |
124 | - 'id' => $prefix . 'custom_slug', |
|
124 | + 'id' => $prefix.'custom_slug', |
|
125 | 125 | 'type' => 'text_small' |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => __( 'Menu Position', $this->plugin_slug ), |
|
129 | - 'desc' => sprintf( __( 'Set the menu position for Google Maps Builder. See the %1$smenu_position arg%2$s.', $this->plugin_slug ), '<a href="' . esc_url( 'http://codex.wordpress.org/Function_Reference/register_post_type#menu_position' ) . '" class="new-window" target="_blank">', '</a>' ), |
|
128 | + 'name' => __('Menu Position', $this->plugin_slug), |
|
129 | + 'desc' => sprintf(__('Set the menu position for Google Maps Builder. See the %1$smenu_position arg%2$s.', $this->plugin_slug), '<a href="'.esc_url('http://codex.wordpress.org/Function_Reference/register_post_type#menu_position').'" class="new-window" target="_blank">', '</a>'), |
|
130 | 130 | 'default' => '21.3', |
131 | - 'id' => $prefix . 'menu_position', |
|
131 | + 'id' => $prefix.'menu_position', |
|
132 | 132 | 'type' => 'text_small' |
133 | 133 | ), |
134 | 134 | array( |
135 | - 'name' => __( 'Has Archive', $this->plugin_slug ), |
|
136 | - 'id' => $prefix . 'has_archive', |
|
137 | - 'desc' => sprintf( __( 'Controls the post type archive page. See %1s$Resave (flush) permalinks%2s$ after customizing.', $this->plugin_slug ), '<a href="' . esc_url( '/wp-admin/options-permalink.php' ) . '">"', '</a>' ), |
|
135 | + 'name' => __('Has Archive', $this->plugin_slug), |
|
136 | + 'id' => $prefix.'has_archive', |
|
137 | + 'desc' => sprintf(__('Controls the post type archive page. See %1s$Resave (flush) permalinks%2s$ after customizing.', $this->plugin_slug), '<a href="'.esc_url('/wp-admin/options-permalink.php').'">"', '</a>'), |
|
138 | 138 | 'type' => 'radio_inline', |
139 | 139 | 'options' => array( |
140 | - 'true' => __( 'Yes', 'cmb' ), |
|
141 | - 'false' => __( 'No', 'cmb' ), |
|
140 | + 'true' => __('Yes', 'cmb'), |
|
141 | + 'false' => __('No', 'cmb'), |
|
142 | 142 | ), |
143 | 143 | ), |
144 | 144 | array( |
145 | - 'name' => __( 'Opening Map Builder', $this->plugin_slug ), |
|
146 | - 'id' => $prefix . 'open_builder', |
|
147 | - 'desc' => __( 'Do you want the Map Builder customizer to open by default when editing maps?', $this->plugin_slug ), |
|
145 | + 'name' => __('Opening Map Builder', $this->plugin_slug), |
|
146 | + 'id' => $prefix.'open_builder', |
|
147 | + 'desc' => __('Do you want the Map Builder customizer to open by default when editing maps?', $this->plugin_slug), |
|
148 | 148 | 'type' => 'radio_inline', |
149 | 149 | 'options' => array( |
150 | - 'true' => __( 'Yes', 'cmb' ), |
|
151 | - 'false' => __( 'No', 'cmb' ), |
|
150 | + 'true' => __('Yes', 'cmb'), |
|
151 | + 'false' => __('No', 'cmb'), |
|
152 | 152 | ), |
153 | 153 | ), |
154 | 154 | ), |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function map_option_fields() { |
168 | 168 | |
169 | 169 | // Only need to initiate the array once per page-load |
170 | - if ( ! empty( self::$plugin_options ) ) { |
|
170 | + if ( ! empty(self::$plugin_options)) { |
|
171 | 171 | return self::$plugin_options; |
172 | 172 | } |
173 | 173 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | |
176 | 176 | self::$plugin_options = array( |
177 | 177 | 'id' => 'plugin_options', |
178 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( self::$key, ), ), |
|
178 | + 'show_on' => array('key' => 'options-page', 'value' => array(self::$key,),), |
|
179 | 179 | 'show_names' => true, |
180 | 180 | 'fields' => array( |
181 | 181 | array( |
182 | - 'name' => __( 'Google Maps API Key', $this->plugin_slug ), |
|
183 | - 'desc' => sprintf( __( 'The Google Maps JavaScript API v3 does not require an API key to function correctly. However, Google strongly encourages you to load the Maps API using an APIs Console key which allows you to monitor your Maps API usage. %1$sLearn how to obtain an API key%2$s.', $this->plugin_slug ), '<a href="' . esc_url( 'https://developers.google.com/maps/documentation/javascript/tutorial#api_key' ) . '" target="_blank" class="new-window">', '</a>' ), |
|
184 | - 'id' => $prefix . 'maps_api_key', |
|
182 | + 'name' => __('Google Maps API Key', $this->plugin_slug), |
|
183 | + 'desc' => sprintf(__('The Google Maps JavaScript API v3 does not require an API key to function correctly. However, Google strongly encourages you to load the Maps API using an APIs Console key which allows you to monitor your Maps API usage. %1$sLearn how to obtain an API key%2$s.', $this->plugin_slug), '<a href="'.esc_url('https://developers.google.com/maps/documentation/javascript/tutorial#api_key').'" target="_blank" class="new-window">', '</a>'), |
|
184 | + 'id' => $prefix.'maps_api_key', |
|
185 | 185 | 'type' => 'text', |
186 | 186 | ), |
187 | 187 | array( |
188 | - 'name' => __( 'Map Size', $this->plugin_slug ), |
|
189 | - 'id' => $prefix . 'width_height', |
|
188 | + 'name' => __('Map Size', $this->plugin_slug), |
|
189 | + 'id' => $prefix.'width_height', |
|
190 | 190 | 'type' => 'width_height', |
191 | 191 | 'width_std' => '100', |
192 | 192 | 'width_unit_std' => '%', |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | 'desc' => '', |
197 | 197 | ), |
198 | 198 | array( |
199 | - 'name' => __( 'Map Location', $this->plugin_slug ), |
|
200 | - 'id' => $prefix . 'lat_lng', |
|
199 | + 'name' => __('Map Location', $this->plugin_slug), |
|
200 | + 'id' => $prefix.'lat_lng', |
|
201 | 201 | 'type' => 'lat_lng_default', |
202 | 202 | 'lat_std' => '32.7153292', |
203 | 203 | 'lng_std' => '-117.15725509', |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param $field |
219 | 219 | * @param $meta |
220 | 220 | */ |
221 | - function cmb2_render_lat_lng_default( $field, $meta ) { |
|
221 | + function cmb2_render_lat_lng_default($field, $meta) { |
|
222 | 222 | |
223 | 223 | $meta = wp_parse_args( |
224 | 224 | $meta, array( |
@@ -230,25 +230,25 @@ discard block |
||
230 | 230 | |
231 | 231 | //Geolocate |
232 | 232 | $output = '<div id="geolocate-wrap" class="clear">'; |
233 | - $output .= '<label class="geocode-label size-label">' . __( 'Geolocate Position', $this->plugin_slug ) . ':</label>'; |
|
233 | + $output .= '<label class="geocode-label size-label">'.__('Geolocate Position', $this->plugin_slug).':</label>'; |
|
234 | 234 | $output .= '<div class="geolocate-radio-wrap size-labels-wrap">'; |
235 | - $output .= '<label class="yes-label label-left"><input id="geolocate_map_yes" type="radio" name="' . $field->args['id'] . '[geolocate_map]" class="geolocate_map_radio radio-left" value="yes" ' . ( $meta['geolocate_map'] === 'yes' ? 'checked="checked"' : '' ) . '>' . __( 'Yes', $this->plugin_slug ) . '</label>'; |
|
235 | + $output .= '<label class="yes-label label-left"><input id="geolocate_map_yes" type="radio" name="'.$field->args['id'].'[geolocate_map]" class="geolocate_map_radio radio-left" value="yes" '.($meta['geolocate_map'] === 'yes' ? 'checked="checked"' : '').'>'.__('Yes', $this->plugin_slug).'</label>'; |
|
236 | 236 | |
237 | - $output .= '<label class="no-label label-left"><input id="geolocate_map_no" type="radio" name="' . $field->args['id'] . '[geolocate_map]" class="geolocate_map_radio radio-left" value="no" ' . ( $meta['geolocate_map'] === 'no' ? 'checked="checked"' : '' ) . ' >' . __( 'No', $this->plugin_slug ) . '</label>'; |
|
237 | + $output .= '<label class="no-label label-left"><input id="geolocate_map_no" type="radio" name="'.$field->args['id'].'[geolocate_map]" class="geolocate_map_radio radio-left" value="no" '.($meta['geolocate_map'] === 'no' ? 'checked="checked"' : '').' >'.__('No', $this->plugin_slug).'</label>'; |
|
238 | 238 | $output .= '</div>'; |
239 | 239 | $output .= '</div>'; |
240 | 240 | |
241 | 241 | //lat_lng |
242 | 242 | $output .= '<div id="lat-lng-wrap"><div class="coordinates-wrap clear">'; |
243 | - $output .= '<div class="lat-lng-wrap lat-wrap clear"><span>' . __( 'Latitude', $this->plugin_slug ) . ': </span> |
|
244 | - <input type="text" class="regular-text latitude" name="' . $field->args['id'] . '[latitude]" id="' . $field->args['id'] . '-latitude" value="' . ( $meta['latitude'] ? $meta['latitude'] : $field->args['lat_std'] ) . '" /></div><div class="lat-lng-wrap lng-wrap clear"><span>' . __( 'Longitude', $this->plugin_slug ) . ': </span> |
|
245 | - <input type="text" class="regular-text longitude" name="' . $field->args['id'] . '[longitude]" id="' . $field->args['id'] . '-longitude" value="' . ( $meta['longitude'] ? $meta['longitude'] : $field->args['lng_std'] ) . '" /> |
|
243 | + $output .= '<div class="lat-lng-wrap lat-wrap clear"><span>'.__('Latitude', $this->plugin_slug).': </span> |
|
244 | + <input type="text" class="regular-text latitude" name="' . $field->args['id'].'[latitude]" id="'.$field->args['id'].'-latitude" value="'.($meta['latitude'] ? $meta['latitude'] : $field->args['lat_std']).'" /></div><div class="lat-lng-wrap lng-wrap clear"><span>'.__('Longitude', $this->plugin_slug).': </span> |
|
245 | + <input type="text" class="regular-text longitude" name="' . $field->args['id'].'[longitude]" id="'.$field->args['id'].'-longitude" value="'.($meta['longitude'] ? $meta['longitude'] : $field->args['lng_std']).'" /> |
|
246 | 246 | </div>'; |
247 | - $output .= '<p class="small-desc">' . sprintf( __( 'For quick lat/lng lookup use <a href="%s" class="new-window" target="_blank">this service</a>', $this->plugin_slug ), esc_url( 'http://www.latlong.net/' ) ) . '</p>'; |
|
247 | + $output .= '<p class="small-desc">'.sprintf(__('For quick lat/lng lookup use <a href="%s" class="new-window" target="_blank">this service</a>', $this->plugin_slug), esc_url('http://www.latlong.net/')).'</p>'; |
|
248 | 248 | $output .= '</div><!-- /.search-coordinates-wrap -->'; |
249 | 249 | |
250 | 250 | $output .= '</div>'; //end #geolocate-wrap |
251 | - $output .= '<p class="cmb2-metabox-description">' . __( 'When creating a new map the plugin will use your current longitude and latitude for the base location. Note: Google now requires that your site be using HTTPS/SSL in order to use this feature. If you see a blank space instead of the map, this is most likely because you have either an insecure website or have denied permission for location sharing. You may also specify a default longitude and latitude by turning off this option.', $this->plugin_slug ) . '</p>'; |
|
251 | + $output .= '<p class="cmb2-metabox-description">'.__('When creating a new map the plugin will use your current longitude and latitude for the base location. Note: Google now requires that your site be using HTTPS/SSL in order to use this feature. If you see a blank space instead of the map, this is most likely because you have either an insecure website or have denied permission for location sharing. You may also specify a default longitude and latitude by turning off this option.', $this->plugin_slug).'</p>'; |
|
252 | 252 | |
253 | 253 | |
254 | 254 | echo $output; |
@@ -274,27 +274,27 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return mixed |
276 | 276 | */ |
277 | - function add_plugin_page_links( $links, $file ) { |
|
277 | + function add_plugin_page_links($links, $file) { |
|
278 | 278 | |
279 | - if ( $file == GMB_PLUGIN_BASE ) { |
|
279 | + if ($file == GMB_PLUGIN_BASE) { |
|
280 | 280 | |
281 | 281 | // Add Widget Page link to our plugin |
282 | - $settings_link = '<a href="edit.php?post_type=google_maps&page=' . self::$key . '" title="' . __( 'Visit the Google Maps Builder plugin settings page', $this->plugin_slug ) . '">' . __( 'Settings', $this->plugin_slug ) . '</a>'; |
|
282 | + $settings_link = '<a href="edit.php?post_type=google_maps&page='.self::$key.'" title="'.__('Visit the Google Maps Builder plugin settings page', $this->plugin_slug).'">'.__('Settings', $this->plugin_slug).'</a>'; |
|
283 | 283 | $go_pro_link = '<a href=" |
284 | -https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=LISTING&utm_campaign=MBF%20LISTING" title="' . __( 'Upgrade to Maps Builder Pro', $this->plugin_slug ) . '" target="_blank">' . __( 'Upgrade to Pro', $this->plugin_slug ) . '</a>'; |
|
285 | - array_unshift( $links, $settings_link ); |
|
286 | - array_push( $links, $go_pro_link ); |
|
284 | +https://wordimpress.com/plugins/maps-builder-pro?utm_source=MBF&utm_medium=BANNER&utm_content=LISTING&utm_campaign=MBF%20LISTING" title="' . __('Upgrade to Maps Builder Pro', $this->plugin_slug).'" target="_blank">'.__('Upgrade to Pro', $this->plugin_slug).'</a>'; |
|
285 | + array_unshift($links, $settings_link); |
|
286 | + array_push($links, $go_pro_link); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | return $links; |
290 | 290 | } |
291 | 291 | |
292 | - function add_plugin_meta_links( $meta, $file ) { |
|
292 | + function add_plugin_meta_links($meta, $file) { |
|
293 | 293 | |
294 | - if ( $file == GMB_PLUGIN_BASE ) { |
|
295 | - $meta[] = "<a href='http://wordpress.org/support/view/plugin-reviews/google-maps-builder' target='_blank' title='" . __( 'Rate Google Maps Builder on WordPress.org', $this->plugin_slug ) . "'>" . __( 'Rate Plugin', $this->plugin_slug ) . "</a>"; |
|
296 | - $meta[] = '<a href="http://wordpress.org/support/plugin/google-maps-builder/" target="_blank" title="' . __( 'Get plugin support via the WordPress community', $this->plugin_slug ) . '">' . __( 'Support', $this->plugin_slug ) . '</a>'; |
|
297 | - $meta[] = __( 'Thank you for using Maps Builder', $this->plugin_slug ); |
|
294 | + if ($file == GMB_PLUGIN_BASE) { |
|
295 | + $meta[] = "<a href='http://wordpress.org/support/view/plugin-reviews/google-maps-builder' target='_blank' title='".__('Rate Google Maps Builder on WordPress.org', $this->plugin_slug)."'>".__('Rate Plugin', $this->plugin_slug)."</a>"; |
|
296 | + $meta[] = '<a href="http://wordpress.org/support/plugin/google-maps-builder/" target="_blank" title="'.__('Get plugin support via the WordPress community', $this->plugin_slug).'">'.__('Support', $this->plugin_slug).'</a>'; |
|
297 | + $meta[] = __('Thank you for using Maps Builder', $this->plugin_slug); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $meta; |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return string |
315 | 315 | */ |
316 | - function gmb_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
316 | + function gmb_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
317 | 317 | |
318 | 318 | //only modify the give settings form |
319 | - if ( 'gmb_settings' == $object_id && 'plugin_options' == $cmb->cmb_id ) { |
|
319 | + if ('gmb_settings' == $object_id && 'plugin_options' == $cmb->cmb_id) { |
|
320 | 320 | |
321 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="gmb-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
321 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="gmb-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | return $form_format; |
@@ -336,6 +336,6 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @return mixed Option value |
338 | 338 | */ |
339 | -function gmb_get_option( $key = '' ) { |
|
340 | - return cmb2_get_option( Google_Maps_Builder_Settings::key(), $key ); |
|
339 | +function gmb_get_option($key = '') { |
|
340 | + return cmb2_get_option(Google_Maps_Builder_Settings::key(), $key); |
|
341 | 341 | } |