Пример #1
0
 public static function fb_social_stream_sc($atts, $content, $name)
 {
     $limit = FBSS_Registry::get('stream_msg_limit');
     $social = new FBSS_SocialStream();
     $stream_data = $social->get($limit);
     return $stream_data['html'];
 }
Пример #2
0
 public static function ajaxUpdateSocialStream()
 {
     self::$logger->log("ajaxUpdateSocialStream.", __LINE__);
     $update_interval = get_option('fbss_setting_update_interval', 30);
     # check last update and decide whether to run store or not
     $last_update_time = get_option('fbss_setting_last_data_update');
     if (!$last_update_time) {
         $last_update_time = time();
         add_option('fbss_setting_last_data_update', $last_update_time);
     }
     $diff_time = time() - $last_update_time;
     $diff_time_mins = $diff_time / 60;
     if ($diff_time_mins > $update_interval) {
         self::$logger->log("Update interval of '{$update_interval}' mins " . "reached ({$diff_time_mins}). Updating.", __LINE__);
         update_option('fbss_setting_last_data_update', time());
         $msg_limit = get_option('fbss_setting_msg_limit', 20);
         $social_stream = new FBSS_SocialStream();
         $social_stream->store($msg_limit, array(), false);
         # print updated social stream as ajax return value
         $stream_data = $social_stream->get(self::$stream_msg_limit);
         echo $stream_data['html'];
     } else {
         self::$logger->log("Update interval of '{$update_interval}' mins " . "not reached yet ({$diff_time_mins}). Nothing to do.", __LINE__);
         echo '';
     }
     wp_die();
     // as described in codex: this is required to terminate immediately
 }