本文整理汇总了PHP中Zend_Gdata::getFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::getFeed方法的具体用法?PHP Zend_Gdata::getFeed怎么用?PHP Zend_Gdata::getFeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata
的用法示例。
在下文中一共展示了Zend_Gdata::getFeed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHealthProfileFeed
public function getHealthProfileFeed($query = null)
{
if ($this->_httpClient->getClientLoginToken() !== null && $this->getProfileID() == null) {
require_once 'Zend/Gdata/App/AuthException.php';
throw new Zend_Gdata_App_AuthException('Profile ID must not be null. Did you call setProfileID()?');
}
if ($query instanceof Zend_Gdata_Query) {
$uri = $query->getQueryUrl();
} else {
if ($this->_httpClient->getClientLoginToken() !== null && $query == null) {
$uri = self::CLIENTLOGIN_PROFILE_FEED_URI . '/' . $this->getProfileID();
} else {
if ($query === null) {
$uri = self::AUTHSUB_PROFILE_FEED_URI;
} else {
$uri = $query;
}
}
}
// use correct feed for /h9 or /health
if ($this->_useH9Sandbox) {
$uri = preg_replace('/\\/health\\//', '/h9/', $uri);
}
return parent::getFeed($uri, 'Zend_Gdata_Health_ProfileFeed');
}
示例2: 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;
}
示例3: 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);
}
}
示例4: userAction
public function userAction()
{
$gologin = Mage::getModel('sociallogin/gologin');
$oauth_data = array('oauth_token' => $this->getRequest()->getParam('oauth_token'), 'oauth_verifier' => $this->getRequest()->getParam('oauth_verifier'));
$requestToken = Mage::getSingleton('core/session')->getRequestToken();
$accessToken = $gologin->getAccessToken($oauth_data, unserialize($requestToken));
$oauthOptions = $gologin->getOptions();
$httpClient = $accessToken->getHttpClient($oauthOptions);
$client = new Zend_Gdata($httpClient);
$feed = $client->getFeed('https://www.google.com/m8/feeds/contacts/default/full');
$userInfo = $feed->getDom();
$user = array();
$tempName = $userInfo->getElementsByTagName("name");
$name = $tempName->item(0)->nodeValue;
//full name
$arrName = explode(' ', $name, 2);
$user['firstname'] = $arrName[0];
$user['lastname'] = $arrName[1];
$tempEmail = $userInfo->getElementsByTagName("email");
$email = $tempEmail->item(0)->nodeValue;
$user['email'] = $email;
$customer = Mage::helper('sociallogin')->getCustomerByEmail($user['email']);
if (!$customer || !$customer->getId()) {
$customer = Mage::helper('sociallogin')->createCustomer($user);
}
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
die("<script type=\"text/javascript\">try{window.opener.location.reload(true);}catch(e){window.opener.location.href=\"" . Mage::getBaseUrl() . "\"} window.close();</script>");
//$this->_redirectUrl(Mage::helper('customer')->getDashboardUrl());
}
示例5: getContactListFeed
/**
* Retrieve feed object
*
* @return Zend_Gdata_Calendar_ListFeed
*/
public function getContactListFeed()
{
$query = new Zend_Gdata_Query(self::CONTACT_FEED_URI);
$query->maxResults = $this->maxResults;
$query->startIndex = $this->startIndex;
return parent::getFeed($query, 'Zend_Gdata_Contacts_ListFeed');
}
示例6: getCodeSearchFeed
/**
* Retreive feed object
*
* @return Zend_Feed
*/
public function getCodeSearchFeed($uri = null)
{
if ($uri == null) {
$uri = self::CODESEARCH_FEED_URI;
}
$uri .= $this->getQueryString();
return parent::getFeed($uri);
}
示例7: getUserAnnotationFeed
public function getUserAnnotationFeed($location = null)
{
if ($location == null) {
$uri = self::MY_ANNOTATION_FEED_URI;
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
}
示例8: userAction
public function userAction()
{
$gologin = Mage::getModel('sociallogin/gologin');
$oauth_data = array('oauth_token' => $this->getRequest()->getParam('oauth_token'), 'oauth_verifier' => $this->getRequest()->getParam('oauth_verifier'));
$requestToken = Mage::getSingleton('core/session')->getRequestToken();
// Fixed by Hai Ta
try {
$accessToken = $gologin->getAccessToken($oauth_data, unserialize($requestToken));
} catch (Exception $e) {
Mage::getSingleton('core/session')->addError('Login failed as you have not granted access.');
die("<script type=\"text/javascript\">try{window.opener.location.reload(true);}catch(e){window.opener.location.href=\"" . Mage::getBaseUrl() . "\"} window.close();</script>");
}
// end fixed
$oauthOptions = $gologin->getOptions();
$httpClient = $accessToken->getHttpClient($oauthOptions);
$client = new Zend_Gdata($httpClient);
$feed = $client->getFeed('https://www.google.com/m8/feeds/contacts/default/full');
$userInfo = $feed->getDom();
$user = array();
$tempName = $userInfo->getElementsByTagName("name");
$name = $tempName->item(0)->nodeValue;
//full name
$arrName = explode(' ', $name, 2);
$user['firstname'] = $arrName[0];
$user['lastname'] = $arrName[1];
$tempEmail = $userInfo->getElementsByTagName("email");
$email = $tempEmail->item(0)->nodeValue;
$user['email'] = $email;
//get website_id and sote_id of each stores
$store_id = Mage::app()->getStore()->getStoreId();
//add
$website_id = Mage::app()->getStore()->getWebsiteId();
//add
$customer = Mage::helper('sociallogin')->getCustomerByEmail($user['email'], $website_id);
//add edition
if (!$customer || !$customer->getId()) {
//Login multisite
$customer = Mage::helper('sociallogin')->createCustomerMultiWebsite($user, $website_id, $store_id);
if (Mage::getStoreConfig('sociallogin/gologin/is_send_password_to_customer')) {
$customer->sendPasswordReminderEmail();
}
}
// fix confirmation
if ($customer->getConfirmation()) {
try {
$customer->setConfirmation(null);
$customer->save();
} catch (Exception $e) {
}
}
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
die("<script type=\"text/javascript\">try{window.opener.location.href=\"" . $this->_loginPostRedirect() . "\";}catch(e){window.opener.location.reload(true);} window.close();</script>");
//$this->_redirectUrl(Mage::helper('customer')->getDashboardUrl());
}
示例9: getDataFeed
/**
* Retrieve data feed object
*
* @param mixed $location
* @return Zend_Gdata_Analytics_DataFeed
*/
public function getDataFeed($location)
{
if ($location == null) {
$uri = self::ANALYTICS_FEED_URI;
} elseif ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
return parent::getFeed($uri, 'Zend_Gdata_Analytics_DataFeed');
}
示例10: getContactListFeed
public function getContactListFeed($location = null)
{
if ($location == null) {
$uri = self::CONTACTS_FEED_URI . '/default/full';
} else {
if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
}
return parent::getFeed($uri, 'Zend_Gdata_Contacts_ListFeed');
}
示例11: getGbaseSnippetFeed
public function getGbaseSnippetFeed($location = null)
{
if ($location === null) {
$uri = self::GBASE_SNIPPET_FEED_URI;
} else {
if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
}
return parent::getFeed($uri, 'Zend_Gdata_Gbase_SnippetFeed');
}
示例12: getDocumentListFeed
public function getDocumentListFeed($location = null)
{
if ($location === null) {
$uri = self::DOCUMENTS_LIST_FEED_URI;
} else {
if ($location instanceof Zend_Gdata_Query) {
$uri = $location->getQueryUrl();
} else {
$uri = $location;
}
}
return parent::getFeed($uri, 'Zend_Gdata_Docs_DocumentListFeed');
}
示例13: testGetFeedExceptionInvalidLocationType
public function testGetFeedExceptionInvalidLocationType()
{
$gdata = new Zend_Gdata();
try {
// give it neither a string nor a Zend_Gdata_Query object,
// and see if it throws an exception.
$feed = $gdata->getFeed(new stdClass());
$this->fail('Expecting to catch Zend_Gdata_App_InvalidArgumentException');
} catch (Zend_Exception $e) {
$this->assertType('Zend_Gdata_App_InvalidArgumentException', $e, 'Expecting Zend_Gdata_App_InvalidArgumentException, got ' . get_class($e));
$this->assertEquals('You must specify the location as either a string URI or a child of Zend_Gdata_Query', $e->getMessage());
}
}
示例14: post
public function post($param)
{
$asin = $xml->Items->Item->ASIN;
$title = $param['title'];
$content = $param['content'];
$keyword = $param['keyword'];
/* Post to Blogger */
$client = Zend_Gdata_ClientLogin::getHttpClient($param['email'], $param['password'], 'blogger', null, Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null, Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('http://www.blogger.com/feeds/default/blogs');
$feed = $gdClient->getFeed($query);
$uri = 'http://www.blogger.com/feeds/' . $param['blog_id'] . '/posts/default';
$entry = $gdClient->newEntry();
$entry->title = $gdClient->newTitle($title);
$entry->content = $gdClient->newContent($content);
$entry->content->setType('text');
$createdPost = $gdClient->insertEntry($entry, $uri);
$idText = split('-', $createdPost->id->text);
$url = $createdPost->link[4]->href;
$newPostID = $idText[2];
return $newPostID;
}
示例15: getContacts
/**
* get Contacts list to show
*
* @return array
*/
public function getContacts()
{
$list = array();
$request = $this->getRequest();
if (!$request->getParam('oauth_token') && !$request->getParam('oauth_verifier')) {
return $list;
}
$google = Mage::getSingleton('affiliateplusreferfriend/refer_gmail');
$oauthData = array('oauth_token' => $request->getParam('oauth_token'), 'oauth_verifier' => $request->getParam('oauth_verifier'));
$accessToken = $google->getAccessToken($oauthData, unserialize($google->getGmailRequestToken()));
$oauthOptions = $google->getOptions();
$httpClient = $accessToken->getHttpClient($oauthOptions);
$gdata = new Zend_Gdata($httpClient);
$query = new Zend_Gdata_Query('https://www.google.com/m8/feeds/contacts/default/full');
$query->setMaxResults(10000);
$feed = array();
try {
$feed = $gdata->getFeed($query);
} catch (Exception $e) {
}
foreach ($feed as $entry) {
$_contact = array();
$xml = simplexml_load_string($entry->getXML());
$_contact['name'] = $entry->title;
foreach ($xml->email as $e) {
$email = '';
if (isset($e['address'])) {
$email = (string) $e['address'];
}
if ($email) {
$_contact['email'] = $email;
$list[] = $_contact;
}
}
}
return $list;
}