Changeset 616905
- Timestamp:
- 10/24/2012 03:57:37 PM (13 years ago)
- Location:
- wpgeocode/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
wpgeocode.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpgeocode/trunk/readme.txt
r616171 r616905 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GDQD948MQ3G3G 5 5 Tags: geocode, geocode filter, geotag, geomarketing, geomarking, geolocation, geofilter, location, local marketing, keywords 6 Version: 1.0. 56 Version: 1.0.7 7 7 Requires at least: 3.0 8 8 Tested up to: 3.0.1 … … 88 88 == Change Log == 89 89 90 = 1.0.7 = 91 * Added support for postal code shortcodes [wpgc_postal_code],[wpgc_is_postal_code],[wpgc_is_not_postal_code postal_code="12342"],[wpgc_is_postal_code postal_code="12322"],[wpgc_is_not_postal_codes postal_codes="19232,12323"] 92 90 93 = 1.0.6 = 91 94 * Fix conditional shortcode wpgc_is_not_country_codes … … 130 133 = 1.0.6 = 131 134 * Fixed conditional shortcode for is_not_country_codes 135 136 = 1.0.7 = 137 * Upgrade for postal_code support -
wpgeocode/trunk/wpgeocode.php
r616171 r616905 5 5 Tags: geocode, geotagging, geolocation, geotags, latitude, longitude, city, state, geomarketing, geolocation marketing 6 6 Description: Use WPGeocode to customize the content of your blog based on the location of your readers. 7 Version: 1.0. 67 Version: 1.0.7 8 8 Author: Michael Lynn 9 9 Author URI: http://www.mlynn.org/ … … 52 52 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'city')); 53 53 } 54 function wpgc_shortcode_postal_code($atts, $content="") { 55 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'postal_code')); 56 } 54 57 function wpgc_shortcode_longitude($atts, $content="") { 55 58 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'longitude')); … … 98 101 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_state_code')); 99 102 } 103 function wpgc_is_not_postal_codes($atts, $content="") { 104 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_postal_codes')); 105 } 106 function wpgc_is_not_postal_code($atts, $content="") { 107 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_postal_code')); 108 } 100 109 function wpgc_is_not_city($atts, $content="") { 101 110 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_city')); … … 130 139 function wpgc_is_state_code($atts, $content="") { 131 140 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_state_code')); 141 } 142 function wpgc_is_postal_codes($atts, $content="") { 143 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_postal_codes')); 144 } 145 function wpgc_is_postal_code($atts, $content="") { 146 return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_postal_code')); 132 147 } 133 148 function wpgc_is_city($atts, $content="") { … … 165 180 'state_code' => '', 166 181 'state_codes' => '', 182 'postal_code' => '', 183 'postal_codes' => '', 167 184 'cities' => '', 168 185 'city' => '', … … 176 193 $user_longitude = ''; 177 194 $user_state_code = ''; 195 $user_postal_code = ''; 178 196 $user_city = ''; 179 197 $user_country_name = ''; … … 183 201 $user_longitude = $loc_arr['longitude']; 184 202 $user_state_code = $loc_arr['state_code']; 203 $user_postal_code = $loc_arr['postal_code']; 185 204 $user_city = $loc_arr['city_name']; 186 205 $user_country_name = $loc_arr['country_name']; … … 220 239 case 'state_code' : 221 240 return wpgc_case_convert($user_state_code,$options['rdo_case'],$options['txt_filter_cls']); 241 break; 242 case 'postal_code' : 243 return wpgc_case_convert($user_postal_code,$options['rdo_case'],$options['txt_filter_cls']); 222 244 break; 223 245 case 'distance_miles': … … 339 361 return $content; 340 362 } 363 case 'is_not_postal_code': 364 if ($postal_code!=$loc_arr['postal_code']) { 365 return $content; 366 } 367 break; 368 case 'is_not_postal_codes': 369 $found=wpgc_csv_find($postals,$loc_arr['postal_code']); 370 if ($found==false) { 371 return $content; 372 } 341 373 break; 342 374 case 'is_not_country_name': … … 383 415 } 384 416 break; 385 case 'is_state_code ':417 case 'is_state_codes': 386 418 $found=wpgc_csv_find($state_codes,$loc_arr['state_code']); 387 419 if ($state_code==$loc_arr['state_code']) { 420 return $content; 421 } 422 case 'is_postal_code': 423 if ($postal_code==$loc_arr['state_code']) { 424 return $content; 425 } 426 break; 427 case 'is_postal_codes': 428 $found=wpgc_csv_find($postal_codes,$loc_arr['postal_code']); 429 if ($postal_code==$loc_arr['postal_code']) { 388 430 return $content; 389 431 } … … 445 487 add_shortcode("wpgc_latitude", "wpgc_shortcode_latitude"); 446 488 add_shortcode("wpgc_city", "wpgc_shortcode_city"); 489 add_shortcode("wpgc_postal_code", "wpgc_shortcode_postal_code"); 447 490 add_shortcode("wpgc_ip", "wpgc_shortcode_ip"); 448 491 add_shortcode("wpgc_country_name", "wpgc_shortcode_country_name"); … … 468 511 add_shortcode("wpgc_is_state_code", "wpgc_is_state_code"); 469 512 add_shortcode("wpgc_is_state_codes", "wpgc_is_state_codes"); 513 add_shortcode("wpgc_is_postal_code", "wpgc_is_postal_code"); 514 add_shortcode("wpgc_is_postal_codes", "wpgc_is_postal_codes"); 515 add_shortcode("wpgc_is_not_postal_code", "wpgc_is_not_postal_code"); 516 add_shortcode("wpgc_is_not_postal_codes", "wpgc_is_not_postal_codes"); 470 517 add_shortcode("wpgc_is_not_country_name", "wpgc_is_not_country_name"); 471 518 add_shortcode("wpgc_is_not_country_names", "wpgc_is_not_country_names"); … … 555 602 <li> [wpgc_ip] - IP Address of the reader</li> 556 603 <li> [wpgc_city] - City of the reader 604 <li> [wpgc_postal_code] - Postal Code (zip) of the reader 557 605 <li> [wpgc_state_code] - Two letter State code of the reader 558 606 <li> [wpgc_country_name] - Country name of the reader … … 566 614 <ul STYLE="list-style-type: square; list-style-position: inside"> 567 615 <li> [wpgc_is_city_and_state city="Yardley" state_code="PA"] 616 <li> [wpgc_is_postal_code postal_code="90120"] 617 <li> [wpgc_is_postal_codes postal_code="90120,19067"] 618 <li> [wpgc_is_not_postal_code postal_codes="90120"] 619 <li> [wpgc_is_not_postal_codes postal_codes="90120,19067"] 568 620 <li> [wpgc_is_ip ip="xx.xx.xx.xx"] 569 621 <li> [wpgc_is_ips ip="xx.xx.xx.xx"] … … 661 713 <label><input name="wpgc_options[txt_def_state_code]" value="<?php echo $options['txt_def_state'];?>"> 662 714 <span style="color:#666666;margin-left:2px;">Use this phrase for the state code if we can't geolocate the reader (shortcode [wpgc_state_code])</span><br /> 715 </td> 716 </tr> 717 <tr> 718 <th scope="row">Default Postal Code Phrase</th> 719 <td> 720 <label><input name="wpgc_options[txt_def_postal_code]" value="<?php echo $options['txt_def_postal'];?>"> 721 <span style="color:#666666;margin-left:2px;">Use this phrase for the postal code if we can't geolocate the reader (shortcode [wpgc_postal_code])</span><br /> 663 722 </td> 664 723 </tr> … … 891 950 $location_info['city_name'] = (isset($record->city)) ? $record->city : '~'; 892 951 $location_info['state_code'] = (isset($record->region)) ? strtoupper($record->region) : '~'; 952 $location_info['postal_code'] = (isset($record->postal_code)) ? strtoupper($record->postal_code) : '~'; 893 953 $location_info['country_name'] = (isset($record->country_name)) ? $record->country_name : '~'; 894 954 $location_info['country_code'] = (isset($record->country_code)) ? strtoupper($record->country_code) : '~';
Note: See TracChangeset
for help on using the changeset viewer.