Changeset 951843
- Timestamp:
- 07/20/2014 02:42:10 PM (12 years ago)
- Location:
- foursquare-venue
- Files:
-
- 2 deleted
- 2 edited
- 6 copied
-
tags/3.0.2 (copied) (copied from foursquare-venue/trunk)
-
tags/3.0.2/css (copied) (copied from foursquare-venue/trunk/css)
-
tags/3.0.2/foursquare-venue.php (copied) (copied from foursquare-venue/trunk/foursquare-venue.php) (5 diffs)
-
tags/3.0.2/js (copied) (copied from foursquare-venue/trunk/js)
-
tags/3.0.2/php (copied) (copied from foursquare-venue/trunk/php)
-
tags/3.0.2/readme.txt (copied) (copied from foursquare-venue/trunk/readme.txt) (2 diffs)
-
tags/3.0.2/screenshot-1.png (deleted)
-
tags/3.0.2/screenshot-2.png (deleted)
-
trunk/foursquare-venue.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
foursquare-venue/tags/3.0.2/foursquare-venue.php
r946538 r951843 6 6 Author: Sutherland Boswell 7 7 Author URI: http://sutherlandboswell.com 8 Version: 3.0. 18 Version: 3.0.2 9 9 License: GPL2 10 10 */ … … 27 27 // Define 28 28 define( 'FOURSQUARE_VENUE_PATH', dirname(__FILE__) ); 29 define( 'FOURSQUARE_VENUE_VERSION', '3.0. 1' );29 define( 'FOURSQUARE_VENUE_VERSION', '3.0.2' ); 30 30 31 31 // Includes … … 196 196 function get_replacements( $venue ) { 197 197 $replacements = array( 198 'id' => $venue->id,199 'name' => $venue->name,200 'phone' => $venue->contact->phone,201 'formatted_phone' => $venue->contact->formattedPhone,202 'twitter' => $venue->contact->twitter,203 'address' => $venue->location->address,204 'cross_street' => $venue->location->crossStreet,205 'lat' => $venue->location->lat,206 'lng' => $venue->location->lng,207 'postal_code' => $venue->location->postalCode,208 'cc' => $venue->location->cc,209 'city' => $venue->location->city,210 'state' => $venue->location->state,211 'country' => $venue->location->country,212 'foursquare_url' => $venue->canonicalUrl,213 'short_url' => $venue->shortUrl,214 'website_url' => $venue->url,215 'checkins_count' => $venue->stats->checkinsCount,216 'users_count' => $venue->stats->usersCount,217 'tip_count' => $venue->stats->tipCount,218 'likes_count' => $venue->likes->count,219 'likes_summary' => $venue->likes->summary,220 'rating' => $venue->rating,221 'rating_signals' => $venue->ratingSignals,222 'here_now_count' => $venue->hereNow->count,223 'here_now_summary' => $venue->hereNow->summary,224 'description' => $venue->description,225 'mayor_count' => $venue->mayor->count,226 'mayor_id' => $venue->mayor->user->id,227 'mayor_url' => 'https://foursquare.com/user/' . $venue->mayor->user->id,228 'mayor_first_name' => $venue->mayor->user->firstName,229 'mayor_last_name' => $venue->mayor->user->lastName,230 'mayor_gender' => $venue->mayor->user->gender,231 'mayor_photo' => $venue->mayor->user->photo->prefix . '100x100'. $venue->mayor->user->photo->suffix198 'id' => ( isset( $venue->id ) ? $venue->id : '' ), 199 'name' => ( isset( $venue->name ) ? $venue->name : '' ), 200 'phone' => ( isset( $venue->contact->phone ) ? $venue->contact->phone : '' ), 201 'formatted_phone' => ( isset( $venue->contact->formattedPhone ) ? $venue->contact->formattedPhone : '' ), 202 'twitter' => ( isset( $venue->contact->twitter ) ? $venue->contact->twitter : '' ), 203 'address' => ( isset( $venue->location->address ) ? $venue->location->address : '' ), 204 'cross_street' => ( isset( $venue->location->crossStreet ) ? $venue->location->crossStreet : '' ), 205 'lat' => ( isset( $venue->location->lat ) ? $venue->location->lat : '' ), 206 'lng' => ( isset( $venue->location->lng ) ? $venue->location->lng : '' ), 207 'postal_code' => ( isset( $venue->location->postalCode ) ? $venue->location->postalCode : '' ), 208 'cc' => ( isset( $venue->location->cc ) ? $venue->location->cc : '' ), 209 'city' => ( isset( $venue->location->city ) ? $venue->location->city : '' ), 210 'state' => ( isset( $venue->location->state ) ? $venue->location->state : '' ), 211 'country' => ( isset( $venue->location->country ) ? $venue->location->country : '' ), 212 'foursquare_url' => ( isset( $venue->canonicalUrl ) ? $venue->canonicalUrl : '' ), 213 'short_url' => ( isset( $venue->shortUrl ) ? $venue->shortUrl : '' ), 214 'website_url' => ( isset( $venue->url ) ? $venue->url : '' ), 215 'checkins_count' => ( isset( $venue->stats->checkinsCount ) ? $venue->stats->checkinsCount : '' ), 216 'users_count' => ( isset( $venue->stats->usersCount ) ? $venue->stats->usersCount : '' ), 217 'tip_count' => ( isset( $venue->stats->tipCount ) ? $venue->stats->tipCount : '' ), 218 'likes_count' => ( isset( $venue->likes->count ) ? $venue->likes->count : '' ), 219 'likes_summary' => ( isset( $venue->likes->summary ) ? $venue->likes->summary : '' ), 220 'rating' => ( isset( $venue->rating ) ? $venue->rating : '' ), 221 'rating_signals' => ( isset( $venue->ratingSignals ) ? $venue->ratingSignals : '' ), 222 'here_now_count' => ( isset( $venue->hereNow->count ) ? $venue->hereNow->count : '' ), 223 'here_now_summary' => ( isset( $venue->hereNow->summary ) ? $venue->hereNow->summary : '' ), 224 'description' => ( isset( $venue->description ) ? $venue->description : '' ), 225 'mayor_count' => ( isset( $venue->mayor->count ) ? $venue->mayor->count : '' ), 226 'mayor_id' => ( isset( $venue->mayor->user->id ) ? $venue->mayor->user->id : '' ), 227 'mayor_url' => ( isset( $venue->mayor->user->id ) ? 'https://foursquare.com/user/' . $venue->mayor->user->id : '' ), 228 'mayor_first_name' => ( isset( $venue->mayor->user->firstName ) ? $venue->mayor->user->firstName : '' ), 229 'mayor_last_name' => ( isset( $venue->mayor->user->lastName ) ? $venue->mayor->user->lastName : '' ), 230 'mayor_gender' => ( isset( $venue->mayor->user->gender ) ? $venue->mayor->user->gender : '' ), 231 'mayor_photo' => ( isset( $venue->mayor->user->photo->prefix ) ? $venue->mayor->user->photo->prefix . '100x100'. $venue->mayor->user->photo->suffix : '' ) 232 232 ); 233 233 return apply_filters( 'foursquare_venue/replacements', $replacements, $venue ); 234 } 235 236 /** 237 * Cache the venue data using WP transients 238 * @param string $id The Foursquare venue ID 239 * @param object $data The venue data 240 * @return boolean True if data was saved, false otherwise 241 */ 242 function save_venue_cache( $id, $data ) { 243 // The name our transient will be stored as 244 $transient_name = 'foursquare_venue_' . $id; 245 // Serialize the data, then base 64 encode it to handle emoji and other characters 246 $data = base64_encode( serialize( $data ) ); 247 // The number of seconds to store the transient 248 $expiration = 15 * 60; 249 // Save it 250 return set_transient( $transient_name, $data, $expiration ); 251 } 252 253 /** 254 * Get the venue data from cache if available 255 * @param string $id The Foursquare Venue ID 256 * @return mixed A Foursquare data object or false if no cache 257 */ 258 function get_venue_cache( $id ) { 259 // The name our transient is stored as 260 $transient_name = 'foursquare_venue_' . $id; 261 // Pull the data 262 $data = get_transient( $transient_name ); 263 // If we have data, and it isn't already an object, decode and unserialize it 264 if ( $data && !is_object( $data ) ) { 265 $data = unserialize( base64_decode( $data ) ); 266 } 267 // Give the data 268 return $data; 234 269 } 235 270 … … 241 276 function get_venue( $id ) { 242 277 // Check for cached data 243 $transient_name = 'foursquare_venue_' . $id; 244 $data = get_transient( $transient_name ); 278 $data = $this->get_venue_cache( $id ); 245 279 // If we don't have data, make an API request 246 280 if ( $data === false ) { … … 255 289 } else { 256 290 $data = $data->response->venue; 257 set_transient( $transient_name, $data, 15 * 60);291 $this->save_venue_cache( $id, $data ); 258 292 } 259 293 } -
foursquare-venue/tags/3.0.2/readme.txt
r946538 r951843 5 5 Requires at least: 3.5 6 6 Tested up to: 3.9.1 7 Stable tag: 3.0. 17 Stable tag: 3.0.2 8 8 9 9 Foursquare Venue is a simple but powerful plugin for displaying any venue's Foursquare stats. … … 44 44 45 45 == Changelog == 46 47 = 3.0.2 = 48 * Fixed bug caused by emojis in Foursquare data 49 * Fixed warnings shown when WordPress is in debugging mode 46 50 47 51 = 3.0.1 = -
foursquare-venue/trunk/foursquare-venue.php
r946538 r951843 6 6 Author: Sutherland Boswell 7 7 Author URI: http://sutherlandboswell.com 8 Version: 3.0. 18 Version: 3.0.2 9 9 License: GPL2 10 10 */ … … 27 27 // Define 28 28 define( 'FOURSQUARE_VENUE_PATH', dirname(__FILE__) ); 29 define( 'FOURSQUARE_VENUE_VERSION', '3.0. 1' );29 define( 'FOURSQUARE_VENUE_VERSION', '3.0.2' ); 30 30 31 31 // Includes … … 196 196 function get_replacements( $venue ) { 197 197 $replacements = array( 198 'id' => $venue->id,199 'name' => $venue->name,200 'phone' => $venue->contact->phone,201 'formatted_phone' => $venue->contact->formattedPhone,202 'twitter' => $venue->contact->twitter,203 'address' => $venue->location->address,204 'cross_street' => $venue->location->crossStreet,205 'lat' => $venue->location->lat,206 'lng' => $venue->location->lng,207 'postal_code' => $venue->location->postalCode,208 'cc' => $venue->location->cc,209 'city' => $venue->location->city,210 'state' => $venue->location->state,211 'country' => $venue->location->country,212 'foursquare_url' => $venue->canonicalUrl,213 'short_url' => $venue->shortUrl,214 'website_url' => $venue->url,215 'checkins_count' => $venue->stats->checkinsCount,216 'users_count' => $venue->stats->usersCount,217 'tip_count' => $venue->stats->tipCount,218 'likes_count' => $venue->likes->count,219 'likes_summary' => $venue->likes->summary,220 'rating' => $venue->rating,221 'rating_signals' => $venue->ratingSignals,222 'here_now_count' => $venue->hereNow->count,223 'here_now_summary' => $venue->hereNow->summary,224 'description' => $venue->description,225 'mayor_count' => $venue->mayor->count,226 'mayor_id' => $venue->mayor->user->id,227 'mayor_url' => 'https://foursquare.com/user/' . $venue->mayor->user->id,228 'mayor_first_name' => $venue->mayor->user->firstName,229 'mayor_last_name' => $venue->mayor->user->lastName,230 'mayor_gender' => $venue->mayor->user->gender,231 'mayor_photo' => $venue->mayor->user->photo->prefix . '100x100'. $venue->mayor->user->photo->suffix198 'id' => ( isset( $venue->id ) ? $venue->id : '' ), 199 'name' => ( isset( $venue->name ) ? $venue->name : '' ), 200 'phone' => ( isset( $venue->contact->phone ) ? $venue->contact->phone : '' ), 201 'formatted_phone' => ( isset( $venue->contact->formattedPhone ) ? $venue->contact->formattedPhone : '' ), 202 'twitter' => ( isset( $venue->contact->twitter ) ? $venue->contact->twitter : '' ), 203 'address' => ( isset( $venue->location->address ) ? $venue->location->address : '' ), 204 'cross_street' => ( isset( $venue->location->crossStreet ) ? $venue->location->crossStreet : '' ), 205 'lat' => ( isset( $venue->location->lat ) ? $venue->location->lat : '' ), 206 'lng' => ( isset( $venue->location->lng ) ? $venue->location->lng : '' ), 207 'postal_code' => ( isset( $venue->location->postalCode ) ? $venue->location->postalCode : '' ), 208 'cc' => ( isset( $venue->location->cc ) ? $venue->location->cc : '' ), 209 'city' => ( isset( $venue->location->city ) ? $venue->location->city : '' ), 210 'state' => ( isset( $venue->location->state ) ? $venue->location->state : '' ), 211 'country' => ( isset( $venue->location->country ) ? $venue->location->country : '' ), 212 'foursquare_url' => ( isset( $venue->canonicalUrl ) ? $venue->canonicalUrl : '' ), 213 'short_url' => ( isset( $venue->shortUrl ) ? $venue->shortUrl : '' ), 214 'website_url' => ( isset( $venue->url ) ? $venue->url : '' ), 215 'checkins_count' => ( isset( $venue->stats->checkinsCount ) ? $venue->stats->checkinsCount : '' ), 216 'users_count' => ( isset( $venue->stats->usersCount ) ? $venue->stats->usersCount : '' ), 217 'tip_count' => ( isset( $venue->stats->tipCount ) ? $venue->stats->tipCount : '' ), 218 'likes_count' => ( isset( $venue->likes->count ) ? $venue->likes->count : '' ), 219 'likes_summary' => ( isset( $venue->likes->summary ) ? $venue->likes->summary : '' ), 220 'rating' => ( isset( $venue->rating ) ? $venue->rating : '' ), 221 'rating_signals' => ( isset( $venue->ratingSignals ) ? $venue->ratingSignals : '' ), 222 'here_now_count' => ( isset( $venue->hereNow->count ) ? $venue->hereNow->count : '' ), 223 'here_now_summary' => ( isset( $venue->hereNow->summary ) ? $venue->hereNow->summary : '' ), 224 'description' => ( isset( $venue->description ) ? $venue->description : '' ), 225 'mayor_count' => ( isset( $venue->mayor->count ) ? $venue->mayor->count : '' ), 226 'mayor_id' => ( isset( $venue->mayor->user->id ) ? $venue->mayor->user->id : '' ), 227 'mayor_url' => ( isset( $venue->mayor->user->id ) ? 'https://foursquare.com/user/' . $venue->mayor->user->id : '' ), 228 'mayor_first_name' => ( isset( $venue->mayor->user->firstName ) ? $venue->mayor->user->firstName : '' ), 229 'mayor_last_name' => ( isset( $venue->mayor->user->lastName ) ? $venue->mayor->user->lastName : '' ), 230 'mayor_gender' => ( isset( $venue->mayor->user->gender ) ? $venue->mayor->user->gender : '' ), 231 'mayor_photo' => ( isset( $venue->mayor->user->photo->prefix ) ? $venue->mayor->user->photo->prefix . '100x100'. $venue->mayor->user->photo->suffix : '' ) 232 232 ); 233 233 return apply_filters( 'foursquare_venue/replacements', $replacements, $venue ); 234 } 235 236 /** 237 * Cache the venue data using WP transients 238 * @param string $id The Foursquare venue ID 239 * @param object $data The venue data 240 * @return boolean True if data was saved, false otherwise 241 */ 242 function save_venue_cache( $id, $data ) { 243 // The name our transient will be stored as 244 $transient_name = 'foursquare_venue_' . $id; 245 // Serialize the data, then base 64 encode it to handle emoji and other characters 246 $data = base64_encode( serialize( $data ) ); 247 // The number of seconds to store the transient 248 $expiration = 15 * 60; 249 // Save it 250 return set_transient( $transient_name, $data, $expiration ); 251 } 252 253 /** 254 * Get the venue data from cache if available 255 * @param string $id The Foursquare Venue ID 256 * @return mixed A Foursquare data object or false if no cache 257 */ 258 function get_venue_cache( $id ) { 259 // The name our transient is stored as 260 $transient_name = 'foursquare_venue_' . $id; 261 // Pull the data 262 $data = get_transient( $transient_name ); 263 // If we have data, and it isn't already an object, decode and unserialize it 264 if ( $data && !is_object( $data ) ) { 265 $data = unserialize( base64_decode( $data ) ); 266 } 267 // Give the data 268 return $data; 234 269 } 235 270 … … 241 276 function get_venue( $id ) { 242 277 // Check for cached data 243 $transient_name = 'foursquare_venue_' . $id; 244 $data = get_transient( $transient_name ); 278 $data = $this->get_venue_cache( $id ); 245 279 // If we don't have data, make an API request 246 280 if ( $data === false ) { … … 255 289 } else { 256 290 $data = $data->response->venue; 257 set_transient( $transient_name, $data, 15 * 60);291 $this->save_venue_cache( $id, $data ); 258 292 } 259 293 } -
foursquare-venue/trunk/readme.txt
r946538 r951843 5 5 Requires at least: 3.5 6 6 Tested up to: 3.9.1 7 Stable tag: 3.0. 17 Stable tag: 3.0.2 8 8 9 9 Foursquare Venue is a simple but powerful plugin for displaying any venue's Foursquare stats. … … 44 44 45 45 == Changelog == 46 47 = 3.0.2 = 48 * Fixed bug caused by emojis in Foursquare data 49 * Fixed warnings shown when WordPress is in debugging mode 46 50 47 51 = 3.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.