PluginProbe
Maps Plugin using Google Maps for WordPress – WP Google Map / trunk
Maps Plugin using Google Maps for WordPress – WP Google Map vtrunk
1.9.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 All 96 releases
gmap-embed / includes / traits / SetupWizard.php

SetupWizard.php in Maps Plugin using Google Maps for WordPress – WP Google Map trunk, at includes/traits/SetupWizard.php

62 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WGMSRM\Traits;
4
5 /**
6 * Trait SetupWizard
7 */
8 trait SetupWizard
9 {
10
11 /**
12 * Setup Wizard view
13 *
14 * @since 1.7.5
15 */
16 public function wpgmap_setup_wizard()
17 {
18 require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_setup_wizard.php';
19 }
20
21 /**
22 * Save setup wizard information
23 *
24 * @since 1.7.5
25 */
26 public function wpgmap_save_setup_wizard()
27 {
28 check_ajax_referer('wpgmapembed_save_setup_wizard', 'nonce');
29
30 if (!current_user_can($this->capability)) {
31 echo wp_json_encode(['responseCode' => 403, 'message' => esc_html__('Unauthorized access.', 'gmap-embed')]);
32 die();
33 }
34 $api_key = isset($_POST['wgm_api_key']) ? sanitize_text_field(wp_unslash($_POST['wgm_api_key'])) : '';
35 $language = isset($_POST['wgm_language']) ? sanitize_text_field(wp_unslash($_POST['wgm_language'])) : '';
36 $regional_area = isset($_POST['wgm_regional_area']) ? sanitize_text_field(wp_unslash($_POST['wgm_regional_area'])) : '';
37 if (empty($api_key)) {
38 $response = array('responseCode' => 101);
39 echo wp_json_encode($response);
40 die();
41 }
42 if (empty($language)) {
43 $response = array('responseCode' => 102);
44 echo wp_json_encode($response);
45 die();
46 }
47 if (empty($regional_area)) {
48 $response = array('responseCode' => 103);
49 echo wp_json_encode($response);
50 die();
51 }
52 // Sanitize and validate before saving to DB
53 update_option('wpgmap_api_key', sanitize_text_field($api_key), 'yes');
54 update_option('srm_gmap_lng', sanitize_text_field($language), 'yes');
55 update_option('srm_gmap_region', sanitize_text_field($regional_area), 'yes');
56 update_option('wgm_is_quick_setup_done', 'Y', 'yes');
57 $response = array('responseCode' => 200);
58 echo wp_json_encode($response);
59 die();
60 }
61 }
62