Your IP : 216.73.216.95


Current Path : /var/www/foundation/wp-content/plugins/gmap-embed/includes/Traits/
Upload File :
Current File : /var/www/foundation/wp-content/plugins/gmap-embed/includes/Traits/SetupWizard.php

<?php

namespace WGMSRM\Traits;
/**
 * Trait SetupWizard
 */
trait SetupWizard
{
    /**
     * Setup Wizard view
     * @since 1.7.5
     */
    public function wpgmap_setup_wizard()
    {
        require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_setup_wizard.php';
    }

    /**
     * Save setup wizard information
     * @since 1.7.5
     */
    public function wpgmap_save_setup_wizard()
    {
        $api_key = isset($_POST['wgm_api_key']) ? sanitize_text_field(esc_html($_POST['wgm_api_key'])) : '';
        $language = isset($_POST['wgm_language']) ? sanitize_text_field(esc_html($_POST['wgm_language'])) : '';
        $regional_area = isset($_POST['wgm_regional_area']) ? sanitize_text_field(esc_html($_POST['wgm_regional_area'])) : '';
        if (empty($api_key)) {
            $response = array('responseCode' => 101);
            echo json_encode($response);
            die();
        }
        if (empty($language)) {
            $response = array('responseCode' => 102);
            echo json_encode($response);
            die();
        }
        if (empty($regional_area)) {
            $response = array('responseCode' => 103);
            echo json_encode($response);
            die();
        }
        update_option('wpgmap_api_key', $api_key, 'yes');
        update_option('srm_gmap_lng', $language, 'yes');
        update_option('srm_gmap_region', $regional_area, 'yes');
        update_option('wgm_is_quick_setup_done', 'Y', 'yes');
        $response = array('responseCode' => 200);
        echo json_encode($response);
        die();
    }
}