Plugin Directory

Changeset 733966


Ignore:
Timestamp:
06/29/2013 09:45:28 AM (13 years ago)
Author:
mikelynn
Message:

fixed state_name tag

Location:
wpgeocode
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • wpgeocode/trunk/readme.txt

    r617698 r733966  
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GDQD948MQ3G3G
    55Tags: geocode, geocode filter, geotag, geomarketing, geomarking, geolocation, geofilter, location, local marketing, keywords
    6 Version: 1.0.8
     6Version: 1.0.9
    77Requires at least: 3.0
    88Tested up to: 3.2.4
     
    8888== Change Log ==
    8989
     90= 1.0.9 =
     91* state_name never worked... problem with maxmind database.  I've corrected via code in this plugin.
     92
    9093= 1.0.8 =
    9194* Minor fixes for country_code support.
     
    142145= 1.0.8 =
    143146* Minor fixes
     147
     148= 1.0.9 =
     149* Corrected wpgc_state_name to correctly show state name
  • wpgeocode/trunk/wpgeocode.php

    r617698 r733966  
    55Tags: geocode, geotagging, geolocation, geotags, latitude, longitude, city, state, geomarketing, geolocation marketing
    66Description: Use WPGeocode to customize the content of your blog based on the location of your readers.
    7 Version: 1.0.8
     7Version: 1.0.9
    88Author: Michael Lynn
    99Author URI: http://www.mlynn.org/
    1010*/
     11
     12
    1113if ( ! defined( 'ABSPATH' ) )
    1214        die( "Can't load this file directly" );
     
    7375    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'state_code'));
    7476}
     77function wpgc_shortcode_state_name($atts, $content="") {
     78    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'state_name'));
     79}
    7580function wpgc_options_nearby_range($atts, $content="") {
    7681        $options = get_option('wpgc_options');
     
    101106    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_state_code'));
    102107}
     108function wpgc_is_not_state_name($atts, $content="") {
     109    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_state_name'));
     110}
    103111function wpgc_is_not_postal_codes($atts, $content="") {
    104112    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_not_postal_codes'));
     
    139147function wpgc_is_state_code($atts, $content="") {
    140148    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_state_code'));
     149}
     150function wpgc_is_state_name($atts, $content="") {
     151    return do_shortcode(wpgc_conditional_shortcode($atts, $content, 'is_state_name'));
    141152}
    142153function wpgc_is_postal_codes($atts, $content="") {
     
    178189                'country_code' => '',
    179190                'country_codes' => '',
     191                'state_name' => '',
    180192                'state_code' => '',
    181193                'state_codes' => '',
     
    193205                $user_longitude = '';
    194206                $user_state_code = '';
     207                $user_state_name = '';
    195208                $user_postal_code = '';
    196209                $user_city = '';
     
    201214                $user_longitude = $loc_arr['longitude'];
    202215                $user_state_code = $loc_arr['state_code'];
     216                $user_state_name = $loc_arr['state_name'];
    203217                $user_postal_code = $loc_arr['postal_code'];
    204218                $user_city = $loc_arr['city_name'];
     
    239253        case 'state_code' :
    240254            return wpgc_case_convert($user_state_code,$options['rdo_case'],$options['txt_filter_cls']);
     255            break;             
     256        case 'state_name' :
     257            return wpgc_case_convert($user_state_name,$options['rdo_case'],$options['txt_filter_cls']);
    241258            break;
    242259        case 'postal_code' :
     
    356373            }
    357374            break;
     375        case 'is_not_state_name':
     376            if ($state_code!=$loc_arr['state_name']) {
     377                return $content;
     378            }
     379            break;
    358380        case 'is_not_state_codes':
    359381            $found=wpgc_csv_find($states,$loc_arr['state_code']);
     
    491513add_shortcode("wpgc_country_name", "wpgc_shortcode_country_name");
    492514add_shortcode("wpgc_country_code", "wpgc_shortcode_country_code");
     515add_shortcode("wpgc_state_name", "wpgc_shortcode_state_name");
    493516add_shortcode("wpgc_state_code", "wpgc_shortcode_state_code");
    494517add_shortcode("wpgc_options_nearby_range", "wpgc_options_nearby_range");
     
    932955
    933956function wpgc_get_location_info($user_ip) {
     957$state_list= array( 'AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming',);
    934958    $tmp = get_option('wpgc_options');
    935959    $wpgc_path = WP_PLUGIN_DIR . '/wpgeocode/';
     
    950974    $location_info['city_name']    = (isset($record->city)) ? $record->city : '~';
    951975    $location_info['state_code']   = (isset($record->region)) ? strtoupper($record->region) : '~';
     976    $location_info['state_name']   = (isset($record->region)) ? $state_list[$record->region] : '~' ;
    952977    $location_info['postal_code']   = (isset($record->postal_code)) ? strtoupper($record->postal_code) : '~';
    953978    $location_info['country_name'] = (isset($record->country_name)) ? $record->country_name : '~';
Note: See TracChangeset for help on using the changeset viewer.