<?php //include("sl-update.php"); move_upload_directories(); //$canwrite = $this->is_upgrade_directory_writable(); $canwrite = true; print "<div class='wrap'> <Table class='widefat' cellpadding='0px' cellspacing='0px'> <tr><td colspan='2'> <table width='100%'><thead><tr> <th>".__("Update Central", $text_domain)."</th></tr></thead> <tr><td> "; ?> <form class="form-table" name="dofollow" action="" method="post"> <p class="submit"> <strong><?php print __("Current Version", $text_domain).": $sl_version "; ?></strong><!-- <input type="submit" class="button-primary" <?php if (!$canwrite) echo(' disabled="disabled" ');?> name="sl_update" style='font-weight:bold' value="<?php _e('Upgrade to Newest Version', $text_domain)?> »" /> <br><?php _e("(This upgrader preserves added themes, addons, images, icons, & language files as requested. Remember to backup & check for upgrades often.)", $text_domain) ?>--> </form> </p> <p style='color:red'> <?php if (ereg('wordpress-store-locator-location-finder', $sl_dir)) { $icon_notification_msg="<div class='updated fade' style='color:red'>".__("<b>Note:</b> Your directory is <b>'wordpress-store-locator-location-finder'</b>. Please rename to <b>'store-locator'</b> to continue receiving notifications of future updates in your admin panel. After changing to <b>'store-locator'</b>, make sure to also update your icon URLs on the 'Map Designer' page.", $text_domain)."</div>"; } elseif ((ereg("wordpress-store-locator-location-finder", get_option('sl_map_home_icon')) && ereg("store-locator", $sl_dir)) || (ereg("wordpress-store-locator-location-finder", get_option('sl_map_end_icon')) && ereg("store-locator", $sl_dir))) { $icon_notification_msg="<div class='updated fade' style='color:red'>You have switched from <strong>'wordpress-store-locator-location-finder'</strong> to <strong>'store-locator'</strong> --- great! <br>Now, please re-select your <b>'Home Icon'</b> and <b>'Destination Icon'</b> on the <a href='".get_option('siteurl')."/wp-admin/admin.php?page=$sl_dir/map-designer.php'>Map Designer</a> page, so that they show up properly on your store locator map.</div>"; } else {$icon_notification_msg="";} print $icon_notification_msg; ?> </p>
<div class='wrap'> <?php if (!$_POST) {move_upload_directories();} if ($_POST) { $_POST[height]=ereg_replace("[^0-9]", "", $_POST[height]); $_POST[width]=ereg_replace("[^0-9]", "", $_POST[width]); update_option('sl_map_height', $_POST[height]); update_option('sl_map_width', $_POST[width]); update_option('sl_map_radii', $_POST[radii]); update_option('sl_map_height_units', $_POST[height_units]); update_option('sl_map_width_units', $_POST[width_units]); update_option('sl_map_home_icon', $_POST[icon]); update_option('sl_map_end_icon', $_POST[icon2]); update_option('sl_map_theme', $_POST[theme]); update_option('sl_search_label', $_POST[search_label]); update_option('sl_radius_label', $_POST[sl_radius_label]); update_option('sl_website_label', $_POST[sl_website_label]); update_option('sl_instruction_message', $_POST[sl_instruction_message]); update_option('sl_zoom_level', $_POST[zoom_level]); $_POST[sl_use_city_search]=($_POST[sl_use_city_search]=="")? 0 : $_POST[sl_use_city_search]; update_option('sl_use_city_search', $_POST[sl_use_city_search]); //$_POST[sl_use_name_search]=($_POST[sl_use_name_search]=="")? 0 : $_POST[sl_use_name_search]; //update_option('sl_use_name_search', $_POST[sl_use_name_search]); $_POST[sl_remove_credits]=($_POST[sl_remove_credits]=="")? 0 : $_POST[sl_remove_credits]; update_option('sl_remove_credits', $_POST[sl_remove_credits]); $_POST[sl_load_locations_default]=($_POST[sl_load_locations_default]=="")? 0 : $_POST[sl_load_locations_default]; update_option('sl_load_locations_default', $_POST[sl_load_locations_default]); update_option('sl_map_type', $_POST[sl_map_type]); update_option('sl_num_initial_displayed', $_POST[sl_num_initial_displayed]); update_option('sl_map_overview_control', $_POST[sl_map_overview_control]);
function head_scripts() { global $sl_dir, $sl_base, $sl_upload_base, $sl_path, $sl_upload_path, $wpdb, $sl_version, $pagename, $map_character_encoding; print "\n<!-- ========= Google Maps Store Locator for WordPress (v$sl_version) | http://www.viadat.com/store-locator/ ========== -->\n"; //print "<!-- ========= Learn More & Download Here: http://www.viadat.com/store-locator ========== -->\n"; //Check if currently on page with shortcode $on_sl_page=$wpdb->get_results("SELECT post_name FROM ".$wpdb->prefix."posts WHERE post_content LIKE '%[STORE-LOCATOR%' AND post_status IN ('publish', 'draft') AND (post_name='$pagename' OR ID='$_GET[p]' OR ID='$_GET[page_id]')", ARRAY_A); //Checking if code used in posts $sl_code_is_used_in_posts=$wpdb->get_results("SELECT post_name FROM ".$wpdb->prefix."posts WHERE post_content LIKE '%[STORE-LOCATOR%' AND post_type='post'"); //If shortcode used in posts, get post IDs, and put into array of numbers if ($sl_code_is_used_in_posts) { $sl_post_ids=$wpdb->get_results("SELECT ID FROM ".$wpdb->prefix."posts WHERE post_content LIKE '%[STORE-LOCATOR%' AND post_type='post'", ARRAY_A); foreach ($sl_post_ids as $val) { $post_ids_array[]=$val[ID];} } else { $post_ids_array=array(9999999999999999999999999999999999999); //post number that'll never be reached } //print_r($post_ids_array); //If on page with store locator shortcode, on an archive, search, or 404 page while shortcode has been used in a post, on the front page, or a specific post with shortcode, display code, otherwise, don't if ($on_sl_page || is_search() || ((is_archive() || is_404()) && $sl_code_is_used_in_posts) || is_front_page() || is_single($post_ids_array)) { $api_key=get_option('store_locator_api_key'); $google_map_domain=(get_option('sl_google_map_domain')!="")? get_option('sl_google_map_domain') : "maps.google.com"; print "<script src='http://$google_map_domain/maps?file=api&v=2&key=$api_key&sensor=false{$map_character_encoding}' type='text/javascript'></script>\n"; print "<script src='".$sl_base."/js/store-locator-js.php' type='text/javascript'></script> <script src='".$sl_base."/js/store-locator.js' type='text/javascript'></script> <script src='".$sl_base."/js/functions.js' type='text/javascript'></script>\n"; //print "<link href='".$sl_base."/base.css' type='text/css' rel='stylesheet'/>\n"; //merged into store-locator.css 12/31/09 (v1.2.37) //if store-locator.css exists in custom-css/ folder in uploads/ dir it takes precedence over, store-locator.css in store-locator plugin directory to allow for css customizations to be preserved after updates $has_custom_css=(file_exists($sl_upload_path."/custom-css/store-locator.css"))? $sl_upload_base."/custom-css" : $sl_base; print "<link href='".$has_custom_css."/store-locator.css' type='text/css' rel='stylesheet'/>"; $theme=get_option('sl_map_theme'); if ($theme!="") {print "\n<link href='".$sl_upload_base."/themes/$theme/style.css' rel='stylesheet' type='text/css'/>";} $zl=(trim(get_option('sl_zoom_level'))!="")? get_option('sl_zoom_level') : 4; //print "<style></style>"; move_upload_directories(); } else { $sl_page_ids=$wpdb->get_results("SELECT ID FROM ".$wpdb->prefix."posts WHERE post_content LIKE '%[STORE-LOCATOR%' AND post_status='publish'", ARRAY_A); print "<!-- No store locator on this page, so no unnecessary scripts for better site performance. ("; if ($sl_page_ids) { foreach ($sl_page_ids as $value) { print "$value[ID],";} } print ")-->"; } print "\n<!-- ========= End Google Maps Store Locator for WordPress ========== -->\n\n"; }