Пример #1
0
 public function __construct($config = array())
 {
     parent::__construct($config);
     // Create a cURL handle
     $this->ch = curl_init();
     // Set global cURL options
     curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, TRUE);
 }
Пример #2
0
 /**
  * Return a static instance of fURI.
  * 
  * @return  object
  */
 public static function instance($config = array())
 {
     $config = Kohana::config('furi');
     // Check for 'auto' driver and adjust configuration
     if (strtolower($config->driver == 'auto')) {
         if (function_exists('curl_init')) {
             $config->driver = 'cURL';
         } else {
             $config->driver = 'Stream';
         }
     }
     $driver = 'Furi_Driver_' . $config->driver;
     if (!is_object(self::$instance)) {
         if (!Kohana::auto_load($driver)) {
             throw new Kohana_Exception('core.driver_not_found', $config['driver'], get_class($this));
         }
         self::$instance = new $driver($config->as_array());
     }
     return self::$instance;
 }