Пример #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 ajaxForceUpdateSocialStream()
 {
     self::$logger->log("ajaxForceUpdateSocialStream.", __LINE__);
     $timestamp = time();
     $msg_limit = get_option('fbss_setting_msg_limit', 20);
     update_option('fbss_setting_last_data_update', $timestamp);
     $social_stream = new FBSS_SocialStream();
     $social_stream->store($msg_limit, array(), true);
     $stream_update_timestamp = FBSS_TemplateStringUtils::getLocalTimestamp($timestamp);
     $stream_update_date_format = __('Y-m-d h:i:s a', 'wp-fb-social-stream');
     $stream_update_date = date($stream_update_date_format, $stream_update_timestamp);
     echo $stream_update_date;
     wp_die();
     // as described in codex: this is required to terminate immediately
 }
Пример #3
0
 public function onSettingsSave()
 {
     $this->logger->log("onSettingsSave.", __LINE__);
     if (isset($_GET['settings-updated']) && $_GET['settings-updated']) {
         $this->logger->log("Saving social stream data.", __LINE__);
         // store stream only if page-name or access-token changed or max-messages increased
         if (get_option('fbss_admin_update_social_stream')) {
             update_option('fbss_admin_update_social_stream', 0);
             update_option('fbss_setting_last_data_update', time());
             $msg_limit = get_option('fbss_setting_msg_limit', 20);
             $social_stream = new FBSS_SocialStream();
             $result = $social_stream->store($msg_limit, array(), true);
             if ($result === true) {
                 $this->logger->log("Saved data.", __LINE__);
                 add_settings_error('wp_fb_social_stream_setting_store', esc_attr('social_stream_updated'), __('Retrieved and updated Facebook data.', 'wp-fb-social-stream'), 'updated');
             } else {
                 $this->logger->log("Save data ERROR!", __LINE__);
                 add_settings_error('wp_fb_social_stream_setting_store', esc_attr('social_stream_updated'), __('Could not retrieve Facebook data. Please check your settings.', 'wp-fb-social-stream'), 'error');
             }
         }
     }
 }