Plugin Directory

Changeset 1461134


Ignore:
Timestamp:
07/27/2016 04:43:09 AM (10 years ago)
Author:
ank91
Message:

trunk 1.7.8

Location:
ank-google-map/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ank-google-map/trunk/ank-google-map.php

    r1410765 r1461134  
    66Plugin URI: https://github.com/ank91/ank-google-map
    77Description: 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.7
     8Version: 1.7.8
    99Author: Ankur Kumar
    1010Author URI: http://ank91.github.io/
     
    1717if (!defined('ABSPATH')) die;
    1818
    19 define('AGM_PLUGIN_VERSION', '1.7.7');
     19define('AGM_PLUGIN_VERSION', '1.7.8');
    2020define('AGM_BASE_FILE', __FILE__);
    2121
  • ank-google-map/trunk/css/option-page.css

    r1367321 r1461134  
    3232#agm_auto_holder {
    3333    position: relative;
     34}
     35
     36#agm_autocomplete{
     37    background: #fff!important;
    3438}
    3539
  • ank-google-map/trunk/inc/class-admin.php

    r1410765 r1461134  
    8888            'disable_mouse_wheel' => '0',
    8989            'disable_drag_mobile' => '1',
     90            'api_key' => ''
    9091        );
    9192
     
    159160        $out['marker_color'] = intval($in['marker_color']);
    160161
     162        $out['api_key'] = sanitize_text_field($in['api_key']);
    161163
    162164        $choices_array = array('disable_mouse_wheel', 'disable_drag_mobile', 'map_control_2', 'map_control_3', 'map_control_4', 'marker_on', 'info_on', 'info_state');
     
    254256    {
    255257        $is_min = (defined('WP_DEBUG') && WP_DEBUG == true) ? '' : '.min';
    256 
     258        $db = get_option('ank_google_map');
    257259        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);
    259263        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);
    260264        //wp inbuilt hack to print js options object just before this script
  • ank-google-map/trunk/inc/class-frontend.php

    r1410765 r1461134  
    88{
    99
    10     private $db_options = array();
     10    private $db = array();
    1111
    1212    function __construct()
     
    1616        add_shortcode('ank_google_map', array($this, 'process_shortcode'));
    1717        /* Store database options for later use */
    18         $this->db_options = get_option('ank_google_map');
     18        $this->db = get_option('ank_google_map');
    1919    }
    2020
     
    2626    private function get_js_options()
    2727    {
    28         $options = $this->db_options;
     28        $db = $this->db;
    2929
    3030        $map_type_array = array(
     
    4343        $return_array = array(
    4444            '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']],
    4949            ),
    5050            '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']),
    5555            ),
    5656            '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']),
    6060            ),
    6161            //disabled controls, 1=disabled
    6262            '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']),
    6666            ),
    6767            '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']),
    7070            )
    7171        );
     
    8484
    8585        ob_start();// ob_start is here for a reason
    86         $options = $this->db_options;
     86        $db = $this->db;
    8787
    8888        //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>';
    9292
    9393
    9494        //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']);
    9696        //Decide API key
    97         $api_key = $this->getAPIKey() ? '&key=' . $this->getAPIKey() : '';
     97        $api_key = empty($db['api_key']) ? '' : '&key=' . esc_js($db['api_key']);
    9898        // Enqueue google map api
    9999        wp_enqueue_script('agm-google-map-api', "https://maps.googleapis.com/maps/api/js?v=3.24" . $lang_code . $api_key, array(), null, true);
     
    136136    }
    137137
    138     /**
    139      * Check if user has defined the constant or not and return the constant value
    140      * @return bool|string
    141      */
    142     private function getAPIKey()
    143     {
    144         if (defined('AGM_API_KEY')) {
    145             return trim(AGM_API_KEY);
    146         }
    147         return false;
    148     }
    149 
    150 
    151138}
  • ank-google-map/trunk/js/option-page.js

    r1410765 r1461134  
    9696     * Prevent form submission when user press enter key in auto-complete
    9797     */
    98     $("#agm_autocomplete").keydown(function (e) {
     98    $("#agm_autocomplete").on('keydown', function (e) {
    9999        if (e.keyCode == 13 || e.which == 13) {
    100100            e.preventDefault();
     
    107107     * Info window needs marker to enabled first
    108108     */
    109     $("#agm_info_on").click(function () {
     109    $("#agm_info_on").on('click', function () {
    110110        if ($(this).is(":checked"))
    111111            $(this).next('label').find('i:not(:visible)').fadeIn(0);
  • ank-google-map/trunk/readme.txt

    r1410765 r1461134  
    22Tags: google map, responsive, light weight, ank, free, easy map
    33Requires at least: 3.8.0
    4 Tested up to: 4.5.1
    5 Stable tag: 1.7.7
     4Tested up to: 4.5.3
     5Stable tag: 1.7.8
    66License: GPLv2 or later
    77License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    107107= Did you test it with old version of WordPress ? =
    108108
    109 No, tested with v4.0+ (latest as of now) only. So i recommend you to upgrade to latest WordPress today.
     109No, tested with v4.5.3+ (latest as of now) only. So i recommend you to upgrade to latest WordPress today.
    110110
    111111= Do you hate jQuery ? =
    112112
    113113No, 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.
    120114
    121115
     
    132126= How do i insert the API key ? =
    133127* 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
    139130
    140131= Future Plans ? =
     
    154145
    155146== Changelog ==
     147
     148= 1.7.8 =
     149* Option to add API key
    156150
    157151= 1.7.7 =
  • ank-google-map/trunk/views/options_page.php

    r1410765 r1461134  
    222222                    </tr>
    223223                    <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>
    224231                        <td colspan="2">
    225232                            <?php submit_button() ?>
Note: See TracChangeset for help on using the changeset viewer.