C:\xampp\htdocs\landing\wp-content\plugins\penci-smart-lists\lib\meta-box\inc\fields\map.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
/**
 * The Google Maps field.
 *
 * @package Meta Box
 */

/**
 * Map field class.
 */
class RWMB_Map_Field extends RWMB_Field {
    
/**
     * Enqueue scripts and styles.
     */
    
public static function admin_enqueue_scripts() {
        
/**
         * Since June 2016, Google Maps requires a valid API key.
         *
         * @link http://googlegeodevelopers.blogspot.com/2016/06/building-for-scale-updates-to-google.html
         * @link https://developers.google.com/maps/documentation/javascript/get-api-key
         */
        
$args func_get_args();
        
$field $args[0];
        
$google_maps_url add_query_arg'key'$field['api_key'], 'https://maps.google.com/maps/api/js' );

        
/**
         * Allows developers load more libraries via a filter.
         *
         * @link https://developers.google.com/maps/documentation/javascript/libraries
         */
        
$google_maps_url apply_filters'rwmb_google_maps_url'$google_maps_url );
        
wp_register_script'google-maps'esc_url_raw$google_maps_url ), array(), ''true );
        
wp_enqueue_style'rwmb-map'RWMB_CSS_URL 'map.css', array(), RWMB_VER );
        
wp_enqueue_script'rwmb-map'RWMB_JS_URL 'map.js', array( 'jquery-ui-autocomplete''google-maps' ), RWMB_VERtrue );
    }

    
/**
     * Get field HTML.
     *
     * @param mixed $meta  Meta value.
     * @param array $field Field parameters.
     *
     * @return string
     */
    
public static function html$meta$field ) {
        
$address is_array$field['address_field'] ) ? implode','$field['address_field'] ) : $field['address_field'];
        
$html sprintf(
            
'<div class="rwmb-map-field" data-address-field="%s">',
            
esc_attr$address )
        );

        
$html .= sprintf(
            
'<div class="rwmb-map-canvas" data-default-loc="%s" data-region="%s"></div>
            <input type="hidden" name="%s" class="rwmb-map-coordinate" value="%s">'
,
            
esc_attr$field['std'] ),
            
esc_attr$field['region'] ),
            
esc_attr$field['field_name'] ),
            
esc_attr$meta )
        );

        if ( 
$field['address_field'] ) {
            
$html .= sprintf(
                
'<button class="button rwmb-map-goto-address-button">%s</button>',
                
esc_html__'Find Address''meta-box' )
            );
        }

        
$html .= '</div>';

        return 
$html;
    }

    
/**
     * Normalize parameters for field.
     *
     * @param array $field Field parameters.
     *
     * @return array
     */
    
public static function normalize$field ) {
        
$field parent::normalize$field );
        
$field wp_parse_args$field, array(
            
'std'           => '',
            
'address_field' => '',
            
'region'        => '',

            
// Default API key, required by Google Maps since June 2016.
            // Users should overwrite this key with their own key.
            
'api_key'       => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ',
        ) );

        return 
$field;
    }

    
/**
     * Get the field value.
     * The difference between this function and 'meta' function is 'meta' function always returns the escaped value
     * of the field saved in the database, while this function returns more meaningful value of the field.
     *
     * @param  array    $field   Field parameters.
     * @param  array    $args    Not used for this field.
     * @param  int|null $post_id Post ID. null for current post. Optional.
     *
     * @return mixed Array(latitude, longitude, zoom)
     */
    
public static function get_value$field$args = array(), $post_id null ) {
        
$value parent::get_value$field$args$post_id );
        list( 
$latitude$longitude$zoom ) = explode','$value ',,' );
        return 
compact'latitude''longitude''zoom' );
    }

    
/**
     * Output the field value.
     * Display Google maps.
     *
     * @param  array    $field   Field parameters.
     * @param  array    $args    Additional arguments. Not used for these fields.
     * @param  int|null $post_id Post ID. null for current post. Optional.
     *
     * @return mixed Field value
     */
    
public static function the_value$field$args = array(), $post_id null ) {
        
$value self::get_value$field$args$post_id );
        if ( ! 
$value['latitude'] || ! $value['longitude'] ) {
            return 
'';
        }
        if ( ! 
$value['zoom'] ) {
            
$value['zoom'] = 14;
        }

        
$args wp_parse_args$args, array(
            
'latitude'     => $value['latitude'],
            
'longitude'    => $value['longitude'],
            
'width'        => '100%',
            
'height'       => '480px',
            
'marker'       => true// Display marker?
            
'marker_title' => ''// Marker title, when hover.
            
'info_window'  => ''// Content of info window (when click on marker). HTML allowed.
            
'js_options'   => array(),

            
// Default API key, required by Google Maps since June 2016.
            // Users should overwrite this key with their own key.
            
'api_key'       => 'AIzaSyC1mUh87SGFyf133tpZQJa-s96p0tgnraQ',
        ) );

        
/*
         * Enqueue scripts.
         * API key is get from $field (if found by RWMB_Helper::find_field()) or $args as a fallback.
         * Note: We still can enqueue script which outputs in the footer.
         */
        
$api_key = isset( $field['api_key'] ) ? $field['api_key'] : $args['api_key'];
        
$google_maps_url add_query_arg'key'$api_key'https://maps.google.com/maps/api/js' );

        
/*
         * Allows developers load more libraries via a filter.
         * @link https://developers.google.com/maps/documentation/javascript/libraries
         */
        
$google_maps_url apply_filters'rwmb_google_maps_url'$google_maps_url );
        
wp_register_script'google-maps'esc_url_raw$google_maps_url ), array(), ''true );
        
wp_enqueue_script'rwmb-map-frontend'RWMB_JS_URL 'map-frontend.js', array( 'google-maps' ), ''true );

        
/*
         * Google Maps options.
         * Option name is the same as specified in Google Maps documentation.
         * This array will be convert to Javascript Object and pass as map options.
         * @link https://developers.google.com/maps/documentation/javascript/reference
         */
        
$args['js_options'] = wp_parse_args$args['js_options'], array(
            
// Default to 'zoom' level set in admin, but can be overwritten.
            
'zoom'      => $value['zoom'],

            
// Map type, see https://developers.google.com/maps/documentation/javascript/reference#MapTypeId.
            
'mapTypeId' => 'ROADMAP',
        ) );

        
$output sprintf(
            
'<div class="rwmb-map-canvas" data-map_options="%s" style="width:%s;height:%s"></div>',
            
esc_attrwp_json_encode$args ) ),
            
esc_attr$args['width'] ),
            
esc_attr$args['height'] )
        );
        return 
$output;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586