예제 #1
0
 /**
  * Triggers event actions.
  */
 public function __construct()
 {
     new AmazonAutoLinks_Event_HTTPCacheRenewal();
     new AmazonAutoLinks_Event_Action_SimplePie_CacheRenewal('aal_action_simplepie_renew_cache');
     new AmazonAutoLinks_Event_Action_UnitPrefetch('aal_action_unit_prefetch');
     new AmazonAutoLinks_Event_Action_ProductAdvertisingAPICacheRenewal('aal_action_api_transient_renewal');
     new AmazonAutoLinks_Event_Action_API_SearchProduct('aal_action_api_get_product_info');
     new AmazonAutoLinks_Event_Action_CustomerReview('aal_action_api_get_customer_review');
     new AmazonAutoLinks_Event_Action_TemplateOptionConverter('aal_action_event_convert_template_options', 2);
     // This must be called after the above action hooks are added.
     $_oOption = AmazonAutoLinks_Option::getInstance();
     $_bIsIntenceCachingMode = 'intense' === $_oOption->get('cache', 'chaching_mode');
     // Force executing actions.
     new AmazonAutoLinks_Shadow($_bIsIntenceCachingMode ? array('aal_action_unit_prefetch', 'aal_action_simplepie_renew_cache', 'aal_action_api_transient_renewal', 'aal_action_api_get_product_info', 'aal_action_api_get_customer_review', 'aal_action_http_cache_renewal') : array('aal_action_unit_prefetch', 'aal_action_api_get_product_info', 'aal_action_api_get_customer_review', 'aal_action_http_cache_renewal'));
     if (!$_bIsIntenceCachingMode) {
         if (AmazonAutoLinks_Shadow::isBackground()) {
             exit;
         }
     }
     $this->_handleQueryURL();
 }
예제 #2
0
 public function __construct()
 {
     // For SimplePie cache renewal events
     add_action('aal_action_simplepie_renew_cache', array($this, '_replyToRenewSimplePieCaches'));
     // For API transient (cache) renewal events
     add_action('aal_action_api_transient_renewal', array($this, '_replyToRenewAPITransients'));
     // This must be called after the above action hooks are added.
     if ('intense' == $GLOBALS['oAmazonAutoLinks_Option']->arrOptions['aal_settings']['cache']['chaching_mode']) {
         new AmazonAutoLinks_Shadow(array('aal_action_simplepie_renew_cache', 'aal_action_api_transient_renewal'));
     } else {
         if (AmazonAutoLinks_Shadow::isBackground()) {
             exit;
         }
     }
     // User ads redirects
     if (isset($_GET['amazon_auto_links_link']) && $_GET['amazon_auto_links_link']) {
         $_oRedirect = new AmazonAutoLinks_Redirects();
         $_oRedirect->go($_GET['amazon_auto_links_link']);
         // will exit there.
     }
     // Draw cached image.
     if (isset($_GET['amazon_auto_links_image']) && $_GET['amazon_auto_links_image'] && is_user_logged_in()) {
         $_oImageLoader = new AmazonAutoLinks_ImageHandler(AmazonAutoLinks_Commons::TransientPrefix);
         $_oImageLoader->draw($_GET['amazon_auto_links_image']);
         exit;
     }
     // For the activation hook
     add_action('aal_action_setup_transients', array($this, '_replyToSetUpTransients'));
     // Load styles of templates
     if (isset($_GET['amazon_auto_links_style'])) {
         $GLOBALS['oAmazonAutoLinks_Templates']->loadStyle($_GET['amazon_auto_links_style']);
     }
     // URL Cloak
     $_sQueryKey = $GLOBALS['oAmazonAutoLinks_Option']->arrOptions['aal_settings']['query']['cloak'];
     if (isset($_GET[$_sQueryKey])) {
         $this->_redirect($_GET[$_sQueryKey]);
     }
 }