Changeset 802207
- Timestamp:
- 11/10/2013 11:54:34 PM (12 years ago)
- File:
-
- 1 edited
-
facebook-albums/trunk/fbalbum.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
facebook-albums/trunk/fbalbum.php
r802182 r802207 43 43 register_activation_hook(__FILE__, array('FB_Album', 'activate')); 44 44 add_action('init', array('FB_Album', 'set_facebook_sdk'), 0); 45 add_action( 'save_post', array('FB_Album', 'save_post') ); 45 46 class FB_Album { 46 47 … … 141 142 } 142 143 144 public static function save_post($post_id) { 145 if ( wp_is_post_revision( $post_id ) ) 146 return; 147 148 $post = get_post($post_id); 149 if(strpos($post->post_content, '[fbalbum ') !== FALSE) { 150 preg_match("/[fbalbum [^>]*url=(.+) /", $post->post_content, $output); 151 $facebook_album_url = str_replace('"', '', $output[1]); 152 error_log($facebook_album_url); 153 FB_Album::_set_album_url($facebook_album_url); 154 $album_id = FB_Album::_get_album_id(); 155 FB_Album::clear_cache($album_id); 156 } 157 } 158 143 159 /** 144 160 * Builds HTML string to output album photos … … 355 371 $cahce_lifetime = (isset(self::$options['cache'])) ? self::$options['cache'] * DAY_IN_SECONDS : DAY_IN_SECONDS; 356 372 357 set_transient("fbalbum_".self::$album_id, $json, DAY_IN_SECONDS); //caching for 24hours373 set_transient("fbalbum_".self::$album_id, $json, 12 * HOUR_IN_SECONDS); //caching for 12 hours 358 374 } 359 375
Note: See TracChangeset
for help on using the changeset viewer.