Changeset 1461134
- Timestamp:
- 07/27/2016 04:43:09 AM (10 years ago)
- Location:
- ank-google-map/trunk
- Files:
-
- 7 edited
-
ank-google-map.php (modified) (2 diffs)
-
css/option-page.css (modified) (1 diff)
-
inc/class-admin.php (modified) (3 diffs)
-
inc/class-frontend.php (modified) (6 diffs)
-
js/option-page.js (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
views/options_page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ank-google-map/trunk/ank-google-map.php
r1410765 r1461134 6 6 Plugin URI: https://github.com/ank91/ank-google-map 7 7 Description: Simple, light weight, and non-bloated WordPress Google Map Plugin. Written in pure javascript, no jQuery at all, responsive, configurable, no ads and 100% Free of cost. Short code : <code>[ank_google_map]</code> 8 Version: 1.7. 78 Version: 1.7.8 9 9 Author: Ankur Kumar 10 10 Author URI: http://ank91.github.io/ … … 17 17 if (!defined('ABSPATH')) die; 18 18 19 define('AGM_PLUGIN_VERSION', '1.7. 7');19 define('AGM_PLUGIN_VERSION', '1.7.8'); 20 20 define('AGM_BASE_FILE', __FILE__); 21 21 -
ank-google-map/trunk/css/option-page.css
r1367321 r1461134 32 32 #agm_auto_holder { 33 33 position: relative; 34 } 35 36 #agm_autocomplete{ 37 background: #fff!important; 34 38 } 35 39 -
ank-google-map/trunk/inc/class-admin.php
r1410765 r1461134 88 88 'disable_mouse_wheel' => '0', 89 89 'disable_drag_mobile' => '1', 90 'api_key' => '' 90 91 ); 91 92 … … 159 160 $out['marker_color'] = intval($in['marker_color']); 160 161 162 $out['api_key'] = sanitize_text_field($in['api_key']); 161 163 162 164 $choices_array = array('disable_mouse_wheel', 'disable_drag_mobile', 'map_control_2', 'map_control_3', 'map_control_4', 'marker_on', 'info_on', 'info_state'); … … 254 256 { 255 257 $is_min = (defined('WP_DEBUG') && WP_DEBUG == true) ? '' : '.min'; 256 258 $db = get_option('ank_google_map'); 257 259 wp_enqueue_style('agm-admin-css', plugins_url('css/option-page' . $is_min . '.css', AGM_BASE_FILE), array(), AGM_PLUGIN_VERSION, 'all'); 258 wp_enqueue_script('agm-google-map', 'https://maps.googleapis.com/maps/api/js?v=3.24&libraries=places', array(), null, true); 260 261 $api_key = empty($db['api_key']) ? '' : '&key=' . esc_js($db['api_key']); 262 wp_enqueue_script('agm-google-map', 'https://maps.googleapis.com/maps/api/js?v=3.24&libraries=places' . $api_key, array(), null, true); 259 263 wp_enqueue_script('agm-admin-js', plugins_url("/js/option-page" . $is_min . ".js", AGM_BASE_FILE), array('jquery', 'agm-google-map'), AGM_PLUGIN_VERSION, true); 260 264 //wp inbuilt hack to print js options object just before this script -
ank-google-map/trunk/inc/class-frontend.php
r1410765 r1461134 8 8 { 9 9 10 private $db _options= array();10 private $db = array(); 11 11 12 12 function __construct() … … 16 16 add_shortcode('ank_google_map', array($this, 'process_shortcode')); 17 17 /* Store database options for later use */ 18 $this->db _options= get_option('ank_google_map');18 $this->db = get_option('ank_google_map'); 19 19 } 20 20 … … 26 26 private function get_js_options() 27 27 { 28 $ options = $this->db_options;28 $db = $this->db; 29 29 30 30 $map_type_array = array( … … 43 43 $return_array = array( 44 44 'map' => array( 45 'lat' => $ options['map_Lat'],46 'lng' => $ options['map_Lng'],47 'zoom' => $ options['map_zoom'],48 'type' => $map_type_array[$ options['map_type']],45 'lat' => $db['map_Lat'], 46 'lng' => $db['map_Lng'], 47 'zoom' => $db['map_zoom'], 48 'type' => $map_type_array[$db['map_type']], 49 49 ), 50 50 'marker' => array( 51 'enabled' => absint($ options['marker_on']),52 'animation' => esc_js($marker_anim_array[$ options['marker_anim']]),53 'title' => esc_js($ options['marker_title']),54 'color' => $this->get_marker_url($ options['marker_color']),51 'enabled' => absint($db['marker_on']), 52 'animation' => esc_js($marker_anim_array[$db['marker_anim']]), 53 'title' => esc_js($db['marker_title']), 54 'color' => $this->get_marker_url($db['marker_color']), 55 55 ), 56 56 'info_window' => array( 57 'enabled' => absint($ options['info_on']),58 'text' => wp_unslash($ options['info_text']),59 'state' => absint($ options['info_state']),57 'enabled' => absint($db['info_on']), 58 'text' => wp_unslash($db['info_text']), 59 'state' => absint($db['info_state']), 60 60 ), 61 61 //disabled controls, 1=disabled 62 62 'controls' => array( 63 'zoomControl' => absint($ options['map_control_2']),64 'mapTypeControl' => absint($ options['map_control_3']),65 'streetViewControl' => absint($ options['map_control_4']),63 'zoomControl' => absint($db['map_control_2']), 64 'mapTypeControl' => absint($db['map_control_3']), 65 'streetViewControl' => absint($db['map_control_4']), 66 66 ), 67 67 'mobile' => array( 68 'scrollwheel' => absint($ options['disable_mouse_wheel']),69 'draggable' => absint($ options['disable_drag_mobile']),68 'scrollwheel' => absint($db['disable_mouse_wheel']), 69 'draggable' => absint($db['disable_drag_mobile']), 70 70 ) 71 71 ); … … 84 84 85 85 ob_start();// ob_start is here for a reason 86 $ options = $this->db_options;86 $db = $this->db; 87 87 88 88 //Write canvas html always 89 $w_unit = ($ options["div_width_unit"] === 1) ? 'px' : '%';90 $b_color = ($ options["div_border_color"] === '') ? '' : 'border:1px solid ' . esc_attr($options["div_border_color"]);91 echo '<div class="agm_map_canvas" id="agm_map_canvas" style="margin: 0 auto;width:' . esc_attr($ options["div_width"]) . $w_unit . ';height:' . esc_attr($options["div_height"]) . 'px;' . $b_color . '"></div>';89 $w_unit = ($db["div_width_unit"] === 1) ? 'px' : '%'; 90 $b_color = ($db["div_border_color"] === '') ? '' : 'border:1px solid ' . esc_attr($db["div_border_color"]); 91 echo '<div class="agm_map_canvas" id="agm_map_canvas" style="margin: 0 auto;width:' . esc_attr($db["div_width"]) . $w_unit . ';height:' . esc_attr($db["div_height"]) . 'px;' . $b_color . '"></div>'; 92 92 93 93 94 94 //Decide language code 95 $lang_code = (esc_attr($ options['map_lang_code']) === '') ? '' : '&language=' . esc_attr($options['map_lang_code']);95 $lang_code = (esc_attr($db['map_lang_code']) === '') ? '' : '&language=' . esc_attr($db['map_lang_code']); 96 96 //Decide API key 97 $api_key = $this->getAPIKey() ? '&key=' . $this->getAPIKey() : '';97 $api_key = empty($db['api_key']) ? '' : '&key=' . esc_js($db['api_key']); 98 98 // Enqueue google map api 99 99 wp_enqueue_script('agm-google-map-api', "https://maps.googleapis.com/maps/api/js?v=3.24" . $lang_code . $api_key, array(), null, true); … … 136 136 } 137 137 138 /**139 * Check if user has defined the constant or not and return the constant value140 * @return bool|string141 */142 private function getAPIKey()143 {144 if (defined('AGM_API_KEY')) {145 return trim(AGM_API_KEY);146 }147 return false;148 }149 150 151 138 } -
ank-google-map/trunk/js/option-page.js
r1410765 r1461134 96 96 * Prevent form submission when user press enter key in auto-complete 97 97 */ 98 $("#agm_autocomplete"). keydown(function (e) {98 $("#agm_autocomplete").on('keydown', function (e) { 99 99 if (e.keyCode == 13 || e.which == 13) { 100 100 e.preventDefault(); … … 107 107 * Info window needs marker to enabled first 108 108 */ 109 $("#agm_info_on"). click(function () {109 $("#agm_info_on").on('click', function () { 110 110 if ($(this).is(":checked")) 111 111 $(this).next('label').find('i:not(:visible)').fadeIn(0); -
ank-google-map/trunk/readme.txt
r1410765 r1461134 2 2 Tags: google map, responsive, light weight, ank, free, easy map 3 3 Requires at least: 3.8.0 4 Tested up to: 4.5. 15 Stable tag: 1.7. 74 Tested up to: 4.5.3 5 Stable tag: 1.7.8 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 107 107 = Did you test it with old version of WordPress ? = 108 108 109 No, tested with v4. 0+ (latest as of now) only. So i recommend you to upgrade to latest WordPress today.109 No, tested with v4.5.3+ (latest as of now) only. So i recommend you to upgrade to latest WordPress today. 110 110 111 111 = Do you hate jQuery ? = 112 112 113 113 No, I love it as like you. But I prefer faster websites. 114 115 116 = Is Google Map API is free. =117 118 Until we break its terms and conditions.119 Google Map API V3 does not need an API Key, however Google has started showing a warning in console if you are not using an API Key.120 114 121 115 … … 132 126 = How do i insert the API key ? = 133 127 * Obtain a browser key, see steps [here](https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key) 134 * Add this line of code to your `functions.php` 135 136 ` 137 define('AGM_API_KEY', 'PASTE_YOUR_API_KEY_HERE'); 138 ` 128 * Insert your key on option page and you are good to go 129 139 130 140 131 = Future Plans ? = … … 154 145 155 146 == Changelog == 147 148 = 1.7.8 = 149 * Option to add API key 156 150 157 151 = 1.7.7 = -
ank-google-map/trunk/views/options_page.php
r1410765 r1461134 222 222 </tr> 223 223 <tr> 224 <td>API Key:</td> 225 <td> 226 <input type="text" style="width: 40%" placeholder="Paste your key here" name="ank_google_map[api_key]" 227 value="<?php echo esc_attr($options['api_key']); ?>"> 228 </td> 229 </tr> 230 <tr> 224 231 <td colspan="2"> 225 232 <?php submit_button() ?>
Note: See TracChangeset
for help on using the changeset viewer.