Changeset 748098
- Timestamp:
- 07/30/2013 01:59:04 AM (13 years ago)
- Location:
- facebook-albums/trunk
- Files:
-
- 3 edited
-
fbalbum.php (modified) (6 diffs)
-
inc/options-facebookalbum.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
facebook-albums/trunk/fbalbum.php
r737404 r748098 4 4 Plugin URI: http://glamanate.com/wordpress/facebook-album/?utm_source=fbalbum_pluginspage&utm_medium=website&utm_campaign=fbalbum 5 5 Description: Facebook Albums allows you to display Facebook Albums on your WordPress site. Brought to you by <a href="http://dooleyandassociates.com/?utm_source=fbalbum&utm_medium=referral&utm_campaign=Facebook%2BAlbum">Dooley & Associates</a> 6 Version: 2.0. 36 Version: 2.0.2 7 7 Author: Matt Glaman 8 8 Author URI: http://glamanate.com … … 130 130 return 'Facebook API came back with a faulty result. You may be accessing an album you do not have permissions to access.'; 131 131 self::_enqueue_resources(); 132 132 133 133 $html = '<div class="facebook-album-container">'; 134 134 if(self::$options['title']) $html .= '<h2><a href="' . self::_clean_url(self::_get_album_url()) . '" target="_blank"">' . $fb['name'] . '</a></h2>'; … … 140 140 foreach ($fb['photos']['data'] as $img) { 141 141 $photo_title = (isset(self::$options['photo_title'])) ? $img['name'] : ''; 142 //Quick workaround to fix thumbnail resolution without causing issues on current saved data. 143 $thumb_size = self::$options['size'] - 1; 142 144 143 145 $html .= '<div class="facebook-album-wrapper" style="float: left;margin: 2px;">'; 144 146 $html .= '<a href="'. self::_clean_url($img['source']) . '" title="'. $photo_title .'" rel="lightbox" class="fbalbum cboxElement">'; 145 $html .= '<div class="image size-'. self::$options['size'] .'" style="background-image: url(' . self::_clean_url($img['images'][ self::$options['size']]['source']) . ')"> </div>';147 $html .= '<div class="image size-'. self::$options['size'] .'" style="background-image: url(' . self::_clean_url($img['images'][$thumb_size]['source']) . ')"> </div>'; 146 148 $html .= '</a>'; 147 149 $html .= '</div>'; … … 197 199 'secret' => self::$options['app_secret'], 198 200 )); 199 if(!empty(self::$options['access_token'])) { 201 if(self::$facebook_sdk->getUser()) { 202 try{ 203 204 } 205 catch (FacebookApiException $e) { 206 echo "<!--DEBUG: ".$e." :END-->"; 207 error_log($e); 208 } 209 } 210 211 if(!empty(self::$options['access_token'])) 200 212 self::$facebook_sdk->setAccessToken(self::$options['access_token']); 201 213 self::$facebook_sdk->setExtendedAccessToken(); 202 214 self::$options['access_token'] = FB_Album::$facebook_sdk->getAccessToken(); 203 215 update_option('facebookalbum', self::$options); 204 }205 216 } 206 217 … … 215 226 */ 216 227 public static function _get_graph_results($limit) { 217 if(!empty(self::$facebook_sdk)) { 218 try { 219 $api_call = '/'.self::_get_album_id()."?fields=id,name,photos.limit({$limit}).fields(source,link,images,name)"; 220 $album = self::$facebook_sdk->api($api_call); 221 } catch (FacebookApiException $e) { 222 error_log($e); 223 $album = null; 224 } 228 229 if(self::get_api_cache()) 230 return self::get_api_cache(); 231 if(!empty(self::$facebook_sdk)) { 232 try { 233 $api_call = '/'.self::_get_album_id()."?fields=id,name,photos.limit({$limit}).fields(source,link,images,name)"; 234 $album = self::$facebook_sdk->api($api_call); 235 //We're good to go, let's cache the JSON 236 self::set_api_cache($album); 237 } catch (FacebookApiException $e) { 238 error_log($e); 239 $album = null; 240 } 225 241 return $album; 226 242 } else { 227 243 //Just in case the user did not set API access through a Facebook application 228 244 $facebook_graph_url = str_replace(array('{ALBUM_ID}', '{LIMIT}'), array(self::_get_album_id(), $limit), self::$graph_url); 245 //We're good to go, let's cache the JSON 246 self::set_api_cache($album); 229 247 return self::decap_do_curl($facebook_graph_url); 230 248 } … … 291 309 self::_set_album_id( $facebook_album_id ); 292 310 } 311 312 /** 313 * Sets WordPress transient to cache API response 314 */ 315 protected function set_api_cache($json) { 316 //Just in case 317 if(!self::$album_id) 318 return; 319 $cahce_lifetime = (isset(self::$options['cache'])) ? self::$options['cache'] * DAY_IN_SECONDS : DAY_IN_SECONDS; 320 321 set_transient("fbalbum_".self::$album_id, $json, DAY_IN_SECONDS); //caching for 24 hours 322 } 323 324 /** 325 * Gets WordPress transient of cached JSON response 326 **/ 327 protected function get_api_cache() { 328 return get_transient("fbalbum_".self::$album_id); 329 } 293 330 294 331 /** -
facebook-albums/trunk/inc/options-facebookalbum.php
r737404 r748098 49 49 <option value="3" <?php selected($options['size'], 3) ?>>Bigger</option> 50 50 <option value="2" <?php selected($options['size'], 2) ?>>Large</option> 51 </select> 52 </p> 53 <p><label for="fbalbum_cache">Cache Lifetime (Days)</label>: 54 <select name="facebookalbum[cache]" id="fbalbum_cache" value="" class="regular-text"> 55 <option value="1" <?php selected($options['cache'], 1) ?>>1 day</option> 56 <option value="2" <?php selected($options['cache'], 2) ?>>2 days</option> 57 <option value="3" <?php selected($options['cache'], 3) ?>>3 days</option> 58 <option value="4" <?php selected($options['cache'], 4) ?>>4 days</option> 59 <option value="5" <?php selected($options['cache'], 5) ?>>5 days</option> 60 <option value="6" <?php selected($options['cache'], 6) ?>>6 days</option> 61 <option value="7" <?php selected($options['cache'], 7) ?>>7 days</option> 51 62 </select> 52 63 </p> -
facebook-albums/trunk/readme.txt
r737404 r748098 5 5 Requires at least: 3.4 6 6 Tested up to: 3.5.1 7 Stable tag: 2.0. 37 Stable tag: 2.0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 18 18 Through Settings -> Facebook Album you can adjust the thumbnail sizes of your album's photos when they are displayed, along with enabling or disabling the album's title or the photo's description display. 19 19 20 This plugin comes bundled with Colorbox, which can be disabled. Certain colorbox options are configurable, more will be soon. Priority was integrating Facebook app's. 21 20 22 = Please consult developer if having issues integrating plugin with Facebook App for personal photo album use! = 21 22 This plugin comes bundled with Colorbox, which can be disabled. Certain colorbox options are configurable, more will be soon. Priority was integrating Facebook app's.23 23 24 24 = Shortcode Example: = … … 51 51 52 52 == Changelog == 53 54 = 2.0.3 = 55 * Add WordPress transients to cache Facebook response to increase performance 56 * Adjusted thumbnail resolution 53 57 54 58 = 2.0.1/2.0.2 =
Note: See TracChangeset
for help on using the changeset viewer.