Ejemplo n.º 1
0
 /**
  * Set configuration specific to a given class.
  * $config->setClassConfig('Google_Cache_File',
  *   array('directory' => '/tmp/cache'));
  * @param $class The class name for the configuration
  * @param $config string key or an array of configuration values
  * @param $value optional - if $config is a key, the value
  *
  */
 public function setClassConfig($class, $config, $value = null)
 {
     if (!is_string($class)) {
         $class = get_class($class);
     }
     return $this->config->setClassConfig($class, $config, $value);
 }
Ejemplo n.º 2
0
 /**
  * Construct the Google Client.
  *
  * @param $config Config or string for the ini file to load
  */
 public function __construct($config = null)
 {
     if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
         date_default_timezone_set('UTC');
     }
     if (is_string($config) && strlen($config)) {
         $config = new Google_Config($config);
     } else {
         if (!$config instanceof Google_Config) {
             $config = new Google_Config();
             if ($this->isAppEngine()) {
                 // Automatically use Memcache if we're in AppEngine.
                 $config->setCacheClass('Google_Cache_Memcache');
             }
             if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
                 // Automatically disable compress.zlib, as currently unsupported.
                 $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
             }
         }
     }
     if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
         if (function_exists('curl_version')) {
             $config->setIoClass("Google_Io_Curl");
         } else {
             $config->setIoClass("Google_Io_Stream");
         }
     }
     $this->config = $config;
 }