本文整理汇总了PHP中Zend_Gdata_ClientLogin类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_ClientLogin类的具体用法?PHP Zend_Gdata_ClientLogin怎么用?PHP Zend_Gdata_ClientLogin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Gdata_ClientLogin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auth
public static function auth()
{
$news = new Zend_Gdata_Photos();
$svc = Zend_Gdata_Photos::AUTH_SERVICE_NAME;
static::$client = Zend_Gdata_ClientLogin::getHttpClient(static::$gUser, static::$gPass, $svc);
static::$service = new Zend_Gdata_Photos(static::$client, "ANO");
}
示例2: gdata_insert_row
public function gdata_insert_row()
{
ProjectConfiguration::registerZend();
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_Docs');
$username = "sindvig.dentista";
$password = "@bcd1234";
//Chave do arquivo
$key = "0Ak_oCZQf3sTidEJnZGQ4MHdhS0R1NUlSeG1ORkpnalE";
//Carregando o serviço do arquivo
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$spreadSheetService = new Zend_Gdata_Spreadsheets($client);
//Pegando as planilhas do arquivo
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);
//Escolhendo a planilha correta
foreach ($feed->entries as $entry) {
if ($entry->getTitle() == 'Disponiveis') {
$worksheetId = basename($entry->getId());
}
}
//Configura variaveis da nova linha na planilha
$assoc = $this->getAssociado();
$matricula = $this->isTitular() ? $assoc->getMatricula() : $assoc->getTitular()->getMatricula();
$dependenteId = $this->isDependente() ? $assoc->getId() : '0';
//Monta array para o serviço do arquivo
$rowData = array("data" => $this->getDateTimeObject('created_at')->format('Y-m-d'), "matricula" => $matricula, "nome" => $assoc->getNome(), "dependenteid" => $dependenteId, "encaminhaid" => $this->getId());
//Insere na Planilha
$insertedListEntry = $spreadSheetService->insertRow($rowData, $key, $worksheetId);
}
示例3: _initService
/**
* Initialize Google Client service
* use ClientLogin to authenticate to Google
*
* @return void
*/
protected function _initService()
{
$username = $this->_config['gcal_username'];
$password = $this->_config['gcal_password'];
$serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$appName = 'CORE';
$loginToken = isset($_GET['token']) ? $_GET['token'] : null;
$loginAnswer = isset($_GET['answer']) ? $_GET['answer'] : null;
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $serviceName, null, $appName, $loginToken, $loginAnswer);
} catch (Zend_Gdata_App_CaptchaRequiredException $e) {
echo 'Google requires you to enter this CAPTCHA image <br />';
echo '<img src="' . $e->getCaptchaUrl() . '" /><br />';
echo '<form action="/core/session/captcha" method="GET">';
echo 'Answer : <input type="text" name="answer" size="10" />';
echo '<input type="hidden" name="token" value="' . $e->getCaptchaToken() . '" />';
echo '<input type="submit" />';
echo '</form>';
exit;
} catch (Zend_Gdata_App_AuthException $e) {
throw new Exception($e);
}
$this->_service = new Zend_Gdata_Calendar($client);
$this->_setFeedUrl();
}
示例4: getWebmastertoolsSitesAction
public function getWebmastertoolsSitesAction()
{
$credentials = $this->getWebmastertoolsCredentials();
if ($credentials) {
$username = $credentials["username"];
$password = $credentials["password"];
}
if ($this->_getParam("username") && $this->_getParam("password")) {
$username = $this->_getParam("username");
$password = $this->_getParam("password");
}
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, "sitemaps", Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"));
$service = new Zend_Gdata($client);
$data = $service->getFeed("https://www.google.com/webmasters/tools/feeds/sites/");
foreach ($data->getEntry() as $e) {
$verification = "";
// get verification filename
foreach ($e->getExtensionElements() as $d) {
$a = $d->getExtensionAttributes();
if ($a["type"]["value"] == "htmlpage") {
$verification = $d->getText();
break;
}
}
$sites[] = array("profile" => (string) $e->getTitle(), "verification" => $verification);
}
$this->_helper->json(array("data" => $sites));
} catch (Exception $e) {
$this->_helper->json(false);
}
}
示例5: beforeFilter
function beforeFilter()
{
$this->disableCache();
if (!$this->_loadConfig()) {
$this->configured = false;
return;
}
$this->gdata_login = Configure::read('Gdata.login');
ini_set('include_path', get_include_path() . PATH_SEPARATOR . VENDORS . 'zend_framework' . DS . 'library' . PATH_SEPARATOR . APP . DS . 'vendors' . DS . 'zend_framework' . DS . 'library');
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_App_AuthException');
Zend_Loader::loadClass('Zend_Http_Client');
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($this->gdata_login['email'], $this->gdata_login['password'], Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME);
$this->gdata_client = $client;
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
$this->gdata_capthaUrl = $cre->getCaptchaUrl();
$this->gdata_token = $cre->getCaptchaToken();
var_dump($this->gdata_capthaUrl, $this->gdata_token);
} catch (Zend_Gdata_App_AuthException $ae) {
$this->Session->setFlash(__('Failed Authentication', true) . ':' . $ae->exception());
$this->auth_failed = true;
}
}
示例6: setPlanning
public function setPlanning($startDate, $endDate, $title, $content)
{
// Parameters for ClientAuth authentication
ProjectConfiguration::registerZend();
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = sfConfig::get('app_gmail_user');
$pass = sfConfig::get('app_gmail_pwd');
// Create an authenticated HTTP client
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
// Create an instance of the Calendar service
$service = new Zend_Gdata_Calendar($client);
// Create a new entry using the calendar service's magic factory method
$event = $service->newEventEntry();
// Populate the event with the desired information
// Note that each attribute is crated as an instance of a matching class
$event->title = $service->newTitle($title);
$event->where = array($service->newWhere("Paris, France"));
$event->content = $service->newContent($content);
// Set the date using RFC 3339 format.
$tzOffset = "+02";
$when = $service->newWhen();
//$when->startTime = "{$start_date}.000{$tzOffset}:00";
//$when->endTime = "{$end_date}.000{$tzOffset}:00";
$when->startTime = "{$startDate}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}:00.000{$tzOffset}:00";
$event->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$newEvent = $service->insertEvent($event);
}
示例7: addEvent
function addEvent($title = 'Новый заказ', $desc = 'Описание заказа', $where = 'интернет-магазин', $startDate, $endDate, $sms_reminder)
{
try {
set_include_path('.' . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/modules/gcalendar/' . PATH_SEPARATOR . get_include_path());
include_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_HttpClient');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$client = Zend_Gdata_ClientLogin::getHttpClient($this->_user, $this->_pass, "cl");
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($title);
$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent($desc);
$when = $gdataCal->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
if (intval($sms_reminder)) {
$reminder = $gdataCal->newReminder();
$reminder->method = "sms";
$reminder->minutes = "0";
$when->reminders = array($reminder);
}
$newEvent->when = array($when);
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
} catch (Exception $ex) {
// Report the exception to the user
}
}
示例8: connectToGoogleViaZend
private function connectToGoogleViaZend()
{
set_include_path($this->root_directory . "modules/Calendar4You/");
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
if ($this->user_login != "" && $this->user_password != "") {
try {
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$this->gClient = Zend_Gdata_ClientLogin::getHttpClient($this->user_login, $this->user_password, $service);
$this->status = $this->mod_strings["LBL_OK"];
$this->is_logged = true;
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
$this->status = $this->mod_strings["LBL_URL_CAPTCHA_IMAGE"] . ': ' . $cre->getCaptchaUrl() . ', ' . $this->mod_strings["LBL_TOKEN_ID"] . ': ' . $cre->getCaptchaToken();
} catch (Zend_Gdata_App_AuthException $ae) {
$this->status = $this->mod_strings["LBL_AUTH_PROBLEM"] . ': ' . $ae->exception() . "\n";
}
} else {
$this->status = $this->mod_strings["LBL_MISSING_AUTH_DATA"];
}
if ($this->is_logged) {
$this->gService = new Zend_Gdata_Calendar($this->gClient);
try {
$this->gListFeed = $this->gService->getCalendarListFeed();
} catch (Zend_Gdata_App_Exception $e) {
$this->gListFeed = array();
}
}
set_include_path($this->root_directory);
}
示例9: testUserCRUDOperations
public function testUserCRUDOperations()
{
// Create a new user
$user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH);
$this->autoDelete($user);
// Verify that returned values are correct
$this->assertEquals($this->id, $user->login->username);
$this->assertEquals(self::GIVEN_NAME, $user->name->givenName);
$this->assertEquals(self::FAMILY_NAME, $user->name->familyName);
// Since we can't retrieve the password or hash function via the
// API, let's see if a ClientLogin auth request succeeds
try {
Zend_Gdata_ClientLogin::getHTTPClient($this->id . '@' . $this->domain, self::PASSWORD, 'xapi');
} catch (Zend_Gdata_App_AuthException $e) {
$this->fail("Unable to authenticate new user via ClientLogin.");
}
// Check to make sure there are no extension elements/attributes
// in the retrieved user
$this->assertTrue(count($user->extensionElements) == 0);
$this->assertTrue(count($user->extensionAttributes) == 0);
// Try searching for the same user and make sure that they're returned
$user2 = $this->gdata->retrieveUser($this->id);
$this->assertEquals($user->saveXML(), $user2->saveXML());
// Delete user (uses builtin delete method, convenience delete
// method tested further down)
$user->delete();
// Ensure that user was deleted
$deletedUser = $this->gdata->retrieveUser($this->id);
$this->assertNull($deletedUser);
}
示例10: main
function main()
{
$user = 'CHANGEME@gmail.com';
$pass = 'CHANGEME';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
// Delete service if ?reset=true query parameter is present
if (isset($_GET['reset']) && $_GET['reset'] == 'true') {
echo "<p><strong>Deleting existing service object!</strong></p>";
unset($_SESSION['gdata_service']);
}
// Prepare client
if (!isset($_SESSION['gdata_service'])) {
echo "<p><strong>Creating new service object.</strong></p>";
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$s = new Zend_Gdata_Calendar($client);
$_SESSION['gdata_service'] = $s;
} else {
echo "<p><strong>Reusing existing service object.</strong></p>";
}
$s = $_SESSION['gdata_service'];
// Retrieve all calendars
$eventFeed = $s->getCalendarEventFeed();
echo "<ul>\n";
foreach ($eventFeed as $event) {
echo "\t<li>" . $event->title->text . " (" . $event->id->text . ")\n";
echo "\t\t<ul>\n";
foreach ($event->when as $when) {
echo "\t\t\t<li>Starts: " . $when->startTime . "</li>\n";
}
echo "\t\t</ul>\n";
echo "\t</li>\n";
}
echo "</ul>\n";
}
示例11: FetchContacts
public function FetchContacts($credential = null)
{
if (!$credential) {
$credential = $this->_credential;
} else {
$this->_credential = $credential;
}
$user = $credential['username'];
$pass = $credential['password'];
try {
// perform login and set protocol version to 3.0
$client = \Zend_Gdata_ClientLogin::getHttpClient($user, $pass, 'cp');
$gdata = new \Zend_Gdata($client);
$gdata->setMajorProtocolVersion(3);
// perform query and get result feed
$query = new \Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full');
$query->setParam("max-results", 10000);
$feed = $gdata->getFeed($query);
// parse feed and extract contact information
// into simpler objects
$results = array();
foreach ($feed as $entry) {
$xml = simplexml_load_string($entry->getXML());
$obj = $this->DatatoContact($entry, $xml);
$results[] = $obj;
}
} catch (Exception $e) {
var_dump($e->getMessage());
return;
}
return $results;
}
示例12: __construct
public function __construct($gmailAccount, $password, $spreadsheetId, $worksheet = "default")
{
$client = Zend_Gdata_ClientLogin::getHttpClient($gmailAccount, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME);
$this->spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$this->spreadsheetId = $spreadsheetId;
$this->worksheet = $worksheet;
}
示例13: clientLogin
function clientLogin($username, $password, $source)
{
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password, 'youtube', null, $source, null, null, $authenticationURL);
return $httpClient;
}
示例14: getService
protected function getService()
{
$credentials = $this->getAnalyticsCredentials();
$client = Zend_Gdata_ClientLogin::getHttpClient($credentials["username"], $credentials["password"], Zend_Gdata_Analytics::AUTH_SERVICE_NAME, Pimcore_Tool::getHttpClient("Zend_Gdata_HttpClient"));
$service = new Zend_Gdata_Analytics($client, "pimcore-open-source-CMS-framework");
return $service;
}
示例15: indexAction
public function indexAction()
{
$content = new Content();
$slug = $this->_getParam('slug');
if ($slug == '\\d+') {
$content = new Content();
$this->view->contents = $content->getFrontContent('treports');
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($this->_config->webservice->google->username, $this->_config->webservice->google->password, $service);
$docs = new Zend_Gdata_Docs($client);
$docsQuery = new Zend_Gdata_Docs_Query();
$docsQuery->setQuery('title:Treasure Annual Report');
$feed = $docs->getDocumentListFeed($docsQuery);
$documents = array();
foreach ($feed->entries as $entry) {
$title = $entry->title;
foreach ($entry->link as $link) {
if ($link->getRel() === 'alternate') {
$altlink = $link->getHref();
}
}
$documents[] = array('title' => $title, 'altlink' => $altlink, 'updated' => $entry->updated, 'type' => $entry->content->type, 'published' => $entry->published);
}
$this->view->documents = $documents;
} else {
$this->view->contents = $content->getContent('treports', $this->_getParam('slug'));
}
}