Exemplo n.º 1
0
 public function __construct()
 {
     // Objects
     $this->oBase64 = new FetchTweets_Base64();
     // For transient (cache) renewal events
     add_action('fetch_tweets_action_transient_renewal', array($this, '_replyToRenewTransients'));
     // For transient (cache) formatting events - adds oEmbed elements.
     add_action('fetch_tweets_action_transient_add_oembed_elements', array($this, '_replyToAddOEmbedElements'));
     // For SimplePie cache renewal events
     add_action('fetch_tweets_action_simplepie_renew_cache', array($this, '_replyToRenewSimplePieCaches'));
     // This must be called after the above action hooks are added.
     if ('intense' == $GLOBALS['oFetchTweets_Option']->aOptions['cache_settings']['caching_mode']) {
         new FetchTweets_Cron(apply_filters('fetch_tweets_filter_plugin_cron_actions', array('fetch_tweets_action_transient_renewal', 'fetch_tweets_action_transient_add_oembed_elements', 'fetch_tweets_action_simplepie_renew_cache')));
     } else {
         if (FetchTweets_Cron::isBackground()) {
             exit;
         }
     }
     // Redirects
     if (isset($_GET['fetch_tweets_link']) && $_GET['fetch_tweets_link']) {
         $_oRedirect = new FetchTweets_Redirects();
         $_oRedirect->go($_GET['fetch_tweets_link']);
         // will exit there.
     }
     // Draw the cached image.
     if (isset($_GET['fetch_tweets_image']) && $_GET['fetch_tweets_image'] && is_user_logged_in()) {
         $_oImageLoader = new FetchTweets_ImageHandler('FTWS');
         $_oImageLoader->draw($_GET['fetch_tweets_image']);
         exit;
     }
     // For the activation hook
     add_action('fetch_tweets_action_setup_transients', array($this, '_replyToSetUpTransients'));
 }
 public function __construct()
 {
     // if WP Cron is the one which loaded the page,
     if (isset($_GET['doing_wp_cron'])) {
         // For transient (cache) renewal events
         add_action('fetch_tweets_action_transient_renewal', array($this, 'renewTransients'));
         // For transient (cache) formatting events - adds oEmbed elements.
         add_action('fetch_tweets_action_transient_add_oembed_elements', array($this, 'addOEmbedElements'));
         // For SimplePie cache renewal events
         add_action('fetch_tweets_action_simplepie_renew_cache', array($this, 'renewSimplePieCaches'));
     }
     // Redirects
     if (isset($_GET['fetch_tweets_link']) && $_GET['fetch_tweets_link']) {
         $oRedirect = new FetchTweets_Redirects();
         $oRedirect->go($_GET['fetch_tweets_link']);
         // will exit there.
     }
     // Draw cached image.
     if (isset($_GET['fetch_tweets_image']) && $_GET['fetch_tweets_image']) {
         $oImageLoader = new FetchTweets_ImageHandler('FTWS');
         $oImageLoader->draw($_GET['fetch_tweets_image']);
         exit;
     }
     // For the activation hook
     add_action('fetch_tweets_action_setup_transients', array($this, 'setUpTransients'));
     // Load styles of templates
     add_action('wp_enqueue_scripts', array($GLOBALS['oFetchTweets_Templates'], 'enqueueActiveTemplateStyles'));
     if (isset($_GET['fetch_tweets_style'])) {
         $GLOBALS['oFetchTweets_Templates']->loadStyle($_GET['fetch_tweets_style']);
     }
     // add_action( 'admin_enqueue_scripts', array( $GLOBALS['oFetchTweets_Templates'], 'enqueueActiveTemplateStyles' ) );
 }