Example #1
0
 function init()
 {
     parent::init();
     if (function_exists('curl_init') || is_callable('curl_init')) {
         $this->implementation = new blcCurlHttp($this->module_id, $this->cached_header, $this->plugin_conf, $this->module_manager);
     } else {
         //Try to load Snoopy.
         if (!class_exists('Snoopy')) {
             $snoopy_file = ABSPATH . WPINC . '/class-snoopy.php';
             if (file_exists($snoopy_file)) {
                 include $snoopy_file;
             }
         }
         //If Snoopy is available, it will be used in place of CURL.
         if (class_exists('Snoopy')) {
             $this->implementation = new blcSnoopyHttp($this->module_id, $this->cached_header, $this->plugin_conf, $this->module_manager);
         }
     }
 }
Example #2
0
 function init()
 {
     parent::init();
     $conf = blc_get_configuration();
     $this->token_bucket_list = new blcTokenBucketList($conf->get('http_throttle_rate', 3), $conf->get('http_throttle_period', 15), $conf->get('http_throttle_min_interval', 2));
     if (function_exists('curl_init') || is_callable('curl_init')) {
         $this->implementation = new blcCurlHttp($this->module_id, $this->cached_header, $this->plugin_conf, $this->module_manager);
     } else {
         //Try to load Snoopy.
         if (!class_exists('Snoopy')) {
             $snoopy_file = ABSPATH . WPINC . '/class-snoopy.php';
             if (file_exists($snoopy_file)) {
                 include $snoopy_file;
             }
         }
         //If Snoopy is available, it will be used in place of CURL.
         if (class_exists('Snoopy')) {
             $this->implementation = new blcSnoopyHttp($this->module_id, $this->cached_header, $this->plugin_conf, $this->module_manager);
         }
     }
 }