Changeset 1586685
- Timestamp:
- 02/01/2017 06:05:36 PM (9 years ago)
- Location:
- scale-lite-tools/trunk
- Files:
-
- 4 edited
-
assets/js/admin.sl-maps.js (modified) (2 diffs)
-
inc/sl-google-maps/class-slt-gmap-markers-meta-fields.php (modified) (5 diffs)
-
inc/sl-google-maps/class-slt-gmap-meta-fields.php (modified) (14 diffs)
-
inc/sl-google-maps/render-cpt.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
scale-lite-tools/trunk/assets/js/admin.sl-maps.js
r1586656 r1586685 16 16 } 17 17 function codeAddress(callback) { 18 var address = document.getElementById('slt -gmap-center-map-location').value;18 var address = document.getElementById('slt_meta-center-map-location').value; 19 19 (function(){ 20 20 geocoder.geocode( { 'address': address}, function(results, status) { … … 25 25 position: results[0].geometry.location 26 26 }); 27 document.getElementById("slt -gmap-latitude").value = results[0].geometry.location.lng();28 document.getElementById("slt -gmap-longitude").value = results[0].geometry.location.lat();27 document.getElementById("slt_meta-latitude").value = results[0].geometry.location.lng(); 28 document.getElementById("slt_meta-longitude").value = results[0].geometry.location.lat(); 29 29 callback(results[0].geometry.location,map); 30 30 } else { -
scale-lite-tools/trunk/inc/sl-google-maps/class-slt-gmap-markers-meta-fields.php
r1586608 r1586685 14 14 private $fields = array( 15 15 array( 16 'id' => 'slt -gmarker-location-address',16 'id' => 'slt_meta-location-address', 17 17 'label' => 'Location address', 18 18 'type' => 'textarea', 19 19 ), 20 20 array( 21 'id' => 'slt -gmarker-title',21 'id' => 'slt_meta-title', 22 22 'label' => 'Info window title', 23 23 'type' => 'text', 24 24 ), 25 25 array( 26 'id' => 'slt -gmarker-description',26 'id' => 'slt_meta-description', 27 27 'label' => 'Info window description', 28 28 'type' => 'textarea', 29 29 ), 30 30 array( 31 'id' => 'slt -gmarker-icon',31 'id' => 'slt_meta-icon', 32 32 'label' => 'Icon', 33 33 'type' => 'url', … … 66 66 */ 67 67 public function add_meta_box_callback( $post ) { 68 wp_nonce_field( 'slt_gma p_options_data', 'slt_gmap_options_nonce' );68 wp_nonce_field( 'slt_gmarker_data', 'slt_gmarker_nonce' ); 69 69 $this->generate_fields( $post ); 70 70 } … … 77 77 foreach ( $this->fields as $field ) { 78 78 $label = '<label for="' . $field['id'] . '">' . $field['label'] . '</label>'; 79 $db_value = get_post_meta( $post->ID, 'slt_gma p_options_' . $field['id'], true );79 $db_value = get_post_meta( $post->ID, 'slt_gmarker_' . $field['id'], true ); 80 80 switch ( $field['type'] ) { 81 81 case 'select': … … 133 133 */ 134 134 public function save_post( $post_id ) { 135 if ( ! isset( $_POST['slt_gma p_options_nonce'] ) )135 if ( ! isset( $_POST['slt_gmarker_nonce'] ) ) 136 136 return $post_id; 137 137 138 $nonce = $_POST['slt_gma p_options_nonce'];139 if ( !wp_verify_nonce( $nonce, 'slt_gma p_options_data' ) )138 $nonce = $_POST['slt_gmarker_nonce']; 139 if ( !wp_verify_nonce( $nonce, 'slt_gmarker_data' ) ) 140 140 return $post_id; 141 141 … … 153 153 break; 154 154 } 155 update_post_meta( $post_id, 'slt_gma p_options_' . $field['id'], $_POST[ $field['id'] ] );155 update_post_meta( $post_id, 'slt_gmarker_' . $field['id'], $_POST[ $field['id'] ] ); 156 156 } else if ( $field['type'] === 'checkbox' ) { 157 update_post_meta( $post_id, 'slt_gma p_options_' . $field['id'], '0' );157 update_post_meta( $post_id, 'slt_gmarker_' . $field['id'], '0' ); 158 158 } 159 159 } -
scale-lite-tools/trunk/inc/sl-google-maps/class-slt-gmap-meta-fields.php
r1586656 r1586685 14 14 private $fields = array( 15 15 array( 16 'id' => 'slt -gmap-center-map-location',16 'id' => 'slt_meta-center-map-location', 17 17 'label' => 'Center map location', 18 18 'type' => 'textarea', 19 19 ), 20 20 array( 21 'id' => 'slt -gmap-latitude',21 'id' => 'slt_meta-latitude', 22 22 'label' => 'Latitude', 23 23 'type' => 'text', 24 24 ), 25 25 array( 26 'id' => 'slt -gmap-longitude',26 'id' => 'slt_meta-longitude', 27 27 'label' => 'Longitude', 28 28 'type' => 'text', 29 29 ), 30 30 array( 31 'id' => 'slt -gmap-markers',31 'id' => 'slt_meta-markers', 32 32 'label' => 'Add markers to map', 33 33 'placeholder' => 'id1,id2,id3', … … 35 35 ), 36 36 array( 37 'id' => 'slt -gmap-html-id',37 'id' => 'slt_meta-html-id', 38 38 'label' => 'HTML ID', 39 39 'type' => 'text', 40 40 ), 41 41 array( 42 'id' => 'slt -gmap-width',42 'id' => 'slt_meta-width', 43 43 'label' => 'Width of map', 44 44 'type' => 'number', 45 45 ), 46 46 array( 47 'id' => 'slt -gmap-height',47 'id' => 'slt_meta-height', 48 48 'label' => 'Height of map', 49 49 'type' => 'number', 50 50 ), 51 51 array( 52 'id' => 'slt -gmap-map-type',52 'id' => 'slt_meta-map-type', 53 53 'label' => 'Map type', 54 54 'type' => 'select', … … 61 61 ), 62 62 array( 63 'id' => 'slt -gmap-zoom',63 'id' => 'slt_meta-zoom', 64 64 'label' => 'Zoom', 65 65 'type' => 'number', 66 66 ), 67 67 array( 68 'id' => 'slt -gmap-show-marker-info-box',68 'id' => 'slt_meta-show-marker-info-box', 69 69 'label' => 'Show marker info box', 70 70 'type' => 'checkbox', 71 ) ,71 ) 72 72 ); 73 73 … … 104 104 public function add_meta_box_callback( $post ) { 105 105 echo '<div id="preview_map_container" class="preview_map_container"></div>'; 106 wp_nonce_field( 'slt_gmap_ options_data', 'slt_gmap_options_nonce' );106 wp_nonce_field( 'slt_gmap_data', 'slt_gmap_nonce' ); 107 107 $this->generate_fields( $post ); 108 108 } … … 115 115 foreach ( $this->fields as $field ) { 116 116 $label = '<label for="' . $field['id'] . '">' . $field['label'] . '</label>'; 117 $db_value = get_post_meta( $post->ID, 'slt_gmap_ options_' . $field['id'], true );117 $db_value = get_post_meta( $post->ID, 'slt_gmap_' . $field['id'], true ); 118 118 switch ( $field['type'] ) { 119 119 case 'select': … … 136 136 case 'textarea': 137 137 switch ( $field['id'] ) { 138 case 'slt -gmap-center-map-location':138 case 'slt_meta-center-map-location': 139 139 if(empty($db_value)) { 140 140 $db_value = '350 5th Ave, New York, NY 10118, USA'; … … 156 156 ); 157 157 break; 158 case ' map-markers':158 case 'slt_slt_meta-markers': 159 159 ($field['placeholder']) ? $field['placeholder']:''; 160 160 $input = sprintf( … … 186 186 default: 187 187 switch ( $field['id'] ) { 188 case 'slt -gmap-html-id':188 case 'slt_slt_meta-html-id': 189 189 $input = sprintf( 190 190 '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Unique HTML ID for the map.</p>', … … 196 196 ); 197 197 break; 198 case 'slt -gmap-width':198 case 'slt_slt_meta-width': 199 199 $input = sprintf( 200 200 '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Width of the map in pixels. e.g. 350. If empty, it defaults to 100%%.</p>', … … 206 206 ); 207 207 break; 208 case 'slt -gmap-height':208 case 'slt_slt_meta-height': 209 209 $input = sprintf( 210 210 '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Height of the map in pixels. e.g. 520</p>', … … 216 216 ); 217 217 break; 218 case 'slt -gmap-map-latitude':218 case 'slt_slt_meta-latitude': 219 219 $input = sprintf( 220 220 '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Latitude coordinate of where your map will be centered</p>', … … 226 226 ); 227 227 break; 228 case 'slt -gmap-map-longitude':228 case 'slt_slt_meta-longitude': 229 229 $input = sprintf( 230 230 '<input %s id="%s" name="%s" type="%s" value="%s"><p class="description">Longitude coordinate of where your map will be centered</p>', … … 266 266 */ 267 267 public function save_post( $post_id ) { 268 if ( ! isset( $_POST['slt_gmap_ options_nonce'] ) )268 if ( ! isset( $_POST['slt_gmap_nonce'] ) ) 269 269 return $post_id; 270 270 271 $nonce = $_POST['slt_gmap_ options_nonce'];272 if ( !wp_verify_nonce( $nonce, 'slt_gmap_ options_data' ) )271 $nonce = $_POST['slt_gmap_nonce']; 272 if ( !wp_verify_nonce( $nonce, 'slt_gmap_data' ) ) 273 273 return $post_id; 274 274 … … 286 286 break; 287 287 } 288 update_post_meta( $post_id, 'slt_gmap_ options_' . $field['id'], $_POST[ $field['id'] ] );288 update_post_meta( $post_id, 'slt_gmap_' . $field['id'], $_POST[ $field['id'] ] ); 289 289 } else if ( $field['type'] === 'checkbox' ) { 290 update_post_meta( $post_id, 'slt_gmap_ options_' . $field['id'], '0' );290 update_post_meta( $post_id, 'slt_gmap_' . $field['id'], '0' ); 291 291 } 292 292 } -
scale-lite-tools/trunk/inc/sl-google-maps/render-cpt.php
r1586656 r1586685 109 109 if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); 110 110 // post meta 111 $map_latitude = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-latitude',true);112 $map_longitude = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-longitude',true);113 $map_markers = explode(',', get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-markers',true));114 $html_id = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-html-id',true);115 $width = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-width',true);116 $height = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-height',true);117 $map_type = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-map-type',true);118 $zoom = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-zoom',true);119 $show_info_titles = get_post_meta(get_the_ID(),'slt_gmap_ options_slt-gmap-show-marker-info-box',true);111 $map_latitude = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-latitude',true); 112 $map_longitude = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-longitude',true); 113 $map_markers = explode(',', get_post_meta(get_the_ID(),'slt_gmap_slt_meta-markers',true)); 114 $html_id = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-html-id',true); 115 $width = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-width',true); 116 $height = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-height',true); 117 $map_type = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-map-type',true); 118 $zoom = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-zoom',true); 119 $show_info_titles = get_post_meta(get_the_ID(),'slt_gmap_slt_meta-show-marker-info-box',true); 120 120 121 121 global $mapsArray;
Note: See TracChangeset
for help on using the changeset viewer.