Exemplo n.º 1
0
function wpgmaps_init()
{
    global $wpgmza_pro_version;
    global $wpgmza_version;
    wp_enqueue_script("jquery");
    $plugin_dir = basename(dirname(__FILE__)) . "/languages/";
    load_plugin_textdomain('wp-google-maps', false, $plugin_dir);
    if (get_option("wpgmza_xml_location") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_location", '{uploads_dir}/wp-google-maps/');
    }
    if (get_option("wpgmza_xml_url") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_url", '{uploads_url}/wp-google-maps/');
    }
    $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
    if ($wpgmza_settings['wpgmza_settings_marker_pull'] == "") {
        $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME");
        if (!$wpgmza_first_time) {
            /* first time, set marker pull to DB */
            $wpgmza_settings['wpgmza_settings_marker_pull'] = "0";
            update_option("WPGMZA_OTHER_SETTINGS", $wpgmza_settings);
        } else {
            /* previous users - set it to XML (what they were using originally) */
            $wpgmza_settings['wpgmza_settings_marker_pull'] = "1";
            update_option("WPGMZA_OTHER_SETTINGS", $wpgmza_settings);
        }
    }
    if (function_exists("wpgmza_register_pro_version")) {
        global $wpgmza_pro_version;
        if (floatval($wpgmza_pro_version) < 5.41) {
            /* user has pro and is prior to version 5.41 so therefore do not save the shortcode in the URL, rather process it and then save it */
            update_option("wpgmza_xml_url", wpgmza_return_marker_url());
            update_option("wpgmza_xml_location", wpgmza_return_marker_path());
        } else {
        }
    }
    wpgmaps_handle_directory();
    /* handle first time users and updates */
    if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
        /* check if their using APC object cache, if yes, do nothing with the welcome page as it causes issues when caching the DB options */
        if (class_exists("APC_Object_Cache")) {
            /* do nothing here as this caches the "first time" option and the welcome page just loads over and over again. quite annoying really... */
        } else {
            if (isset($_GET['override']) && $_GET['override'] == "1") {
                $wpgmza_first_time = $wpgmza_version;
                update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
            } else {
                $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME");
                if (!$wpgmza_first_time) {
                    /* show welcome screen */
                    $wpgmza_first_time = $wpgmza_version;
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
                    wp_redirect(get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page");
                    exit;
                    //echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page\"</script>";
                }
                if ($wpgmza_first_time != $wpgmza_version) {
                    // user has updated - will build update page
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_version);
                }
            }
        }
    }
    /* check if version is outdated or plugin is being automatically updated */
    $current_version = get_option("wpgmaps_current_version");
    if (!isset($current_version) || $current_version != $wpgmza_version) {
        wpgmaps_handle_db();
        wpgmaps_handle_directory();
        wpgmaps_update_all_xml_file();
        update_option("wpgmaps_current_version", $wpgmza_version);
    }
    if ($wpgmza_pro_version == '5.13' || $wpgmza_pro_version == '5.12' || $wpgmza_pro_version == '5.11' || $wpgmza_pro_version == '5.10') {
        if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
            echo "<div id='message' class='updated' style='padding:10px; '><span style='font-weight:bold; color:red;'>Please update your WP Google Maps Pro to version 5.16 or higher. You can do this by going to 'Dashboard'->'Updates' and updating the plugin.</div>";
        }
    }
}
Exemplo n.º 2
0
/**
 * Init functionality 
 *
 * Checks if default settings have in fact been set
 * Checks if the XML directory exists
 * Handles first time users and redirects them to the welcome page
 * Handles version checks and subsequent changes if the plugin has been updated
 * 
 * @return void
 */
function wpgmaps_init()
{
    global $wpgmza_pro_version;
    global $wpgmza_version;
    wp_enqueue_script("jquery");
    $plugin_dir = basename(dirname(__FILE__)) . "/languages/";
    load_plugin_textdomain('wp-google-maps', false, $plugin_dir);
    if (get_option("wpgmza_xml_location") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_location", '{uploads_dir}/wp-google-maps/');
    }
    if (get_option("wpgmza_xml_url") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_url", '{uploads_url}/wp-google-maps/');
    }
    $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
    if (!isset($wpgmza_settings['wpgmza_settings_marker_pull']) || $wpgmza_settings['wpgmza_settings_marker_pull'] == "") {
        $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME");
        if (!$wpgmza_first_time) {
            /* first time, set marker pull to DB */
            $wpgmza_settings['wpgmza_settings_marker_pull'] = "0";
            update_option("WPGMZA_OTHER_SETTINGS", $wpgmza_settings);
        } else {
            /* previous users - set it to XML (what they were using originally) */
            $wpgmza_settings['wpgmza_settings_marker_pull'] = "1";
            update_option("WPGMZA_OTHER_SETTINGS", $wpgmza_settings);
        }
    }
    if (function_exists("wpgmza_register_pro_version")) {
        global $wpgmza_pro_version;
        if (floatval($wpgmza_pro_version) < 5.41) {
            /* user has pro and is prior to version 5.41 so therefore do not save the shortcode in the URL, rather process it and then save it */
            update_option("wpgmza_xml_url", wpgmza_return_marker_url());
            update_option("wpgmza_xml_location", wpgmza_return_marker_path());
        } else {
        }
    }
    //    delete_option("WPGMZA_FIRST_TIME");
    wpgmaps_handle_directory();
    /* handle first time users and updates */
    if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
        /* check if their using APC object cache, if yes, do nothing with the welcome page as it causes issues when caching the DB options */
        if (class_exists("APC_Object_Cache")) {
            /* do nothing here as this caches the "first time" option and the welcome page just loads over and over again. quite annoying really... */
        } else {
            if (isset($_GET['override']) && $_GET['override'] == "1") {
                $wpgmza_first_time = $wpgmza_version;
                update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
            } else {
                $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME");
                if (!$wpgmza_first_time) {
                    /* show welcome screen */
                    $wpgmza_first_time = $wpgmza_version;
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
                    wp_redirect(get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page");
                    exit;
                }
                if ($wpgmza_first_time != $wpgmza_version) {
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_version);
                }
            }
        }
    }
    /* check if version is outdated or plugin is being automatically updated */
    $current_version = get_option("wpgmaps_current_version");
    if (!isset($current_version) || $current_version != $wpgmza_version) {
        $wpgmza_settings = get_option("WPGMZA_OTHER_SETTINGS");
        if (isset($wpgmza_settings['wpgmza_api_version']) && ($wpgmza_settings['wpgmza_api_version'] == "3.14" || $wpgmza_settings['wpgmza_api_version'] == "3.15" || $wpgmza_settings['wpgmza_api_version'] == "3.23" || $wpgmza_settings['wpgmza_api_version'] == "3.24")) {
            $wpgmza_settings['wpgmza_api_version'] = "3.26";
        }
        update_option("WPGMZA_OTHER_SETTINGS", $wpgmza_settings);
        wpgmaps_handle_db();
        wpgmaps_handle_directory();
        wpgmaps_update_all_xml_file();
        update_option("wpgmaps_current_version", $wpgmza_version);
    }
}
function wpgmaps_init()
{
    global $wpgmza_pro_version;
    global $wpgmza_version;
    wp_enqueue_script("jquery");
    $plugin_dir = basename(dirname(__FILE__)) . "/languages/";
    load_plugin_textdomain('wp-google-maps', false, $plugin_dir);
    if (get_option("wpgmza_xml_location") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_location", $upload_dir['basedir'] . '/wp-google-maps/');
    }
    if (get_option("wpgmza_xml_url") == "") {
        $upload_dir = wp_upload_dir();
        add_option("wpgmza_xml_url", $upload_dir['baseurl'] . '/wp-google-maps/');
    }
    wpgmaps_handle_directory();
    /* handle first time users and updates */
    if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
        /* check if their using APC object cache, if yes, do nothing with the welcome page as it causes issues when caching the DB options */
        if (class_exists("APC_Object_Cache")) {
            /* do nothing here as this caches the "first time" option and the welcome page just loads over and over again. quite annoying really... */
        } else {
            if (isset($_GET['override']) && $_GET['override'] == "1") {
                $wpgmza_first_time = $wpgmza_version;
                update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
            } else {
                $wpgmza_first_time = get_option("WPGMZA_FIRST_TIME");
                if (!$wpgmza_first_time) {
                    /* show welcome screen */
                    $wpgmza_first_time = $wpgmza_version;
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_first_time);
                    wp_redirect(get_option('siteurl') . "/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page");
                    exit;
                    //echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu&action=welcome_page\"</script>";
                }
                if ($wpgmza_first_time != $wpgmza_version) {
                    // user has updated - will build update page
                    update_option("WPGMZA_FIRST_TIME", $wpgmza_version);
                }
            }
        }
    }
    /* check if version is outdated or plugin is being automatically updated */
    $current_version = get_option("wpgmaps_current_version");
    if (!isset($current_version) || $current_version != $wpgmza_version) {
        wpgmaps_handle_db();
        wpgmaps_handle_directory();
        wpgmaps_update_all_xml_file();
        update_option("wpgmaps_current_version", $wpgmza_version);
    }
    if ($wpgmza_pro_version == '5.13' || $wpgmza_pro_version == '5.12' || $wpgmza_pro_version == '5.11' || $wpgmza_pro_version == '5.10') {
        if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
            echo "<div id='message' class='updated' style='padding:10px; '><span style='font-weight:bold; color:red;'>Please update your WP Google Maps Pro to version 5.16 or higher. You can do this by going to 'Dashboard'->'Updates' and updating the plugin.</div>";
        }
    }
}
Exemplo n.º 4
0
 if ($_GET['action'] == "add_poly" && isset($_GET['map_id'])) {
     wpgmza_pro_add_poly($_GET['map_id']);
 } else {
     if ($_GET['action'] == "edit_poly" && isset($_GET['map_id'])) {
         wpgmza_pro_edit_poly($_GET['map_id']);
     } else {
         if ($_GET['action'] == "add_polyline" && isset($_GET['map_id'])) {
             wpgmza_pro_add_polyline($_GET['map_id']);
         } else {
Exemplo n.º 5
0
function wpgmaps_update_db_check()
{
    wpgmaps_debugger("update_db_start");
    global $wpgmza_version;
    if (get_option('wpgmza_db_version') != $wpgmza_version) {
        wpgmaps_handle_db();
    }
    // create all XML files
    wpgmaps_update_all_xml_file();
    wpgmaps_debugger("update_db_end");
}