Пример #1
0
Файл: IO.php Проект: techart/tao
 /**
  * Возвращает объект класса IO.Stream.ResourceStream, соответствующий stdin.
  *
  * @return IO_Stream_ResourceStream
  */
 public static function stdin($stdin = null)
 {
     if ($stdin instanceof IO_Stream_AbstractStream) {
         self::$stdin = $stdin;
     }
     return self::$stdin ? self::$stdin : (self::$stdin = IO_Stream::ResourceStream(STDIN));
 }
Пример #2
0
 public static function initialize(array $options = array())
 {
     self::options($options);
     if (!class_exists('Google_Client') && set_include_path(get_include_path() . PATH_SEPARATOR . self::option('lib_path') . 'src/')) {
         if (!@(include_once 'Google_Client.php')) {
             throw new Service_Google_API_ClientLibraryModuleNotFoundException('src/Google_Client.php', self::option('lib_path'));
         }
     }
     self::$cache = Cache::connect(self::option('cache_path'), 0);
     self::$stdin = IO::stdin();
 }
Пример #3
0
 /**
  */
 protected function get_token()
 {
     $this->client->get_request_token();
     $this->client->save_token($k = 'request_token');
     $this->log->debug('Get and save request token: %s', var_export($this->store->get($k), true));
     printf("\nGo to:\n%s\nGet PIN and enter:\n", $this->client->get_auth_url(true));
     $verifier = trim(IO::stdin()->read());
     $this->log->debug('You enter PIN: %d', $verifier);
     $this->client->get_access_token($verifier);
     $this->client->save_token($k = 'access_token');
     $this->log->debug('Get and save access token: %s', var_export($this->store->get($k), true));
 }