当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_Query类代码示例

本文整理汇总了PHP中Zend_Gdata_Query的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Query类的具体用法?PHP Zend_Gdata_Query怎么用?PHP Zend_Gdata_Query使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Gdata_Query类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:openbizx,项目名称:openbizx-cubix,代码行数:32,代码来源:ContactService.php

示例2: testSetAndGetStartIndex

 public function testSetAndGetStartIndex()
 {
     $query = new Zend_Gdata_Query();
     $query->setStartIndex(12);
     $this->assertEquals(12, $query->getStartIndex());
     $this->assertTrue(strpos($query->getQueryUrl(), 'start-index=12') !== false);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:QueryTest.php

示例3: getVideos

 /**
  * Retrieve user's uploaded videos.
  *
  * @param $maxResults int
  *       	 Maximum number of YoutubeVideo to return.
  * @return array(YoutubeVideo) Videos retrieved.
  */
 public function getVideos($maxResults)
 {
     try {
         set_include_path(get_include_path() . PATH_SEPARATOR . dirname(WSW_Main::$plugin_dir) . '/lib/Youtube');
         if (!class_exists('Zend_Loader')) {
             require_once 'Zend/Loader.php';
         }
         Zend_Loader::loadClass('Zend_Gdata_Query');
         Zend_Loader::loadClass('Zend_Gdata_YouTube');
         // If the keyword is compoused, divide each word
         $key_phrase = $this->keyword;
         $key_phrase_arr = explode(' ', $key_phrase);
         $query_url = Zend_Gdata_YouTube::VIDEO_URI . "/-/";
         foreach ($key_phrase_arr as $key_phrase_item) {
             if (trim($key_phrase_item) != '') {
                 $query_url .= trim($key_phrase_item) . '/';
             }
         }
         //$query_url .= '?v=2';
         $query = new Zend_Gdata_Query($query_url);
         $query->setMaxResults($maxResults);
         $query->setParam('orderby', 'viewCount');
         $yt = new Zend_Gdata_YouTube();
         $yt->setMajorProtocolVersion(2);
         $videoFeed = $yt->getFeed($query, 'Zend_Gdata_YouTube_VideoFeed');
         // TODO See how this initialization must be done, I mean if is really neccesary
         $keyVideos = array();
         foreach ($videoFeed as $videoEntry) {
             $keyVideos[] = new WSW_YoutubeVideo($videoEntry);
         }
         return $keyVideos;
     } catch (Exception $e) {
         // Store to log
         $msg_to_log = 'Error while getVideos from Youtube, Url: ' . $query_url . ', Exception Msg: ' . $e->getMessage();
         return array();
     }
 }
开发者ID:Kishor900,项目名称:scrapboard,代码行数:44,代码来源:YoutubeInterface.php

示例4: 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;
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:42,代码来源:Gmail.php

示例5: getVolumeEntry

 /**
  * Retrieves a specific volume entry.
  *
  * @param string|null $volumeId The volumeId of interest.
  * @param Zend_Gdata_Query|string|null $location (optional) The URL to
  *        query or a Zend_Gdata_Query object from which a URL can be
  *        determined.
  * @return Zend_Gdata_Books_VolumeEntry The feed of volumes found at the
  *         specified URL.
  */
 public function getVolumeEntry($volumeId = null, $location = null)
 {
     if ($volumeId !== null) {
         $uri = self::VOLUME_FEED_URI . "/" . $volumeId;
     } else {
         if ($location instanceof Zend_Gdata_Query) {
             $uri = $location->getQueryUrl();
         } else {
             $uri = $location;
         }
     }
     return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry');
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:23,代码来源:Books.php

示例6: testSetAndGetStartIndex

 public function testSetAndGetStartIndex()
 {
     $query = new Zend_Gdata_Query();
     $query->setStartIndex(12);
     $this->assertEquals(12, $query->getStartIndex());
     $this->assertContains('start-index=12', $query->getQueryUrl());
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:7,代码来源:QueryTest.php

示例7: get_user_object_list_feed

 /**
  *
  * @param  string $object
  * @param  int    $offset_start
  * @param  int    $quantity
  * @return string
  */
 protected function get_user_object_list_feed($object, $offset_start, $quantity)
 {
     $feed = null;
     switch ($object) {
         case self::ELEMENT_TYPE_VIDEO:
             $uri = Zend_Gdata_YouTube::USER_URI . '/default/' . Zend_Gdata_YouTube::UPLOADS_URI_SUFFIX;
             $query = new Zend_Gdata_Query($uri);
             if ($quantity !== 0) {
                 $query->setMaxResults($quantity);
             }
             $query->setStartIndex($offset_start);
             $feed = $this->_api->getUserUploads(null, $query);
             break;
         case self::CONTAINER_TYPE_PLAYLIST:
             $uri = Zend_Gdata_YouTube::USER_URI . '/default/playlists';
             $query = new Zend_Gdata_Query($uri);
             if ($quantity !== 0) {
                 $query->setMaxResults($quantity);
             }
             $query->setStartIndex($offset_start);
             $feed = $this->_api->getPlaylistListFeed(null, $query);
             break;
         default:
             throw new Bridge_Exception_ObjectUnknown('Unknown object ' . $object);
             break;
     }
     return $feed;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:35,代码来源:Youtube.php

示例8: printPostsInDateRange

  /**
   * This function uses query parameters to retrieve and print all posts 
   * within a specified date range.
   *
   * @param string $startDate Beginning date, inclusive. Preferred format is 
   *                          a RFC-3339 date, though other formats are
   *                          accepted. 
   * @param string $endDate End date, exclusive.  
   */
  public function printPostsInDateRange($startDate, $endDate)
  {
      $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/' . $this->blogID . '/posts/default'); 
      $query->setParam('published-min', $startDate);
      $query->setParam('published-max', $endDate); 
 
      $feed = $this->gdClient->getFeed($query); 
      $this->printFeed($feed); 
  }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:18,代码来源:Blogger.php

示例9: storeGmailEmailsTemprorily

 /**
  * retrieves email ids for all the contacts from Gmail and stores in Ofuz DB temprorily.
  *
  * @return void
  * @see Gdata
  */
 function storeGmailEmailsTemprorily()
 {
     global $_SESSION, $_GET;
     $client = $this->client;
     $useremailid = urlencode($_SESSION["uEmail"]);
     // Create a Gdata object using the authenticated Http Client
     $gdata = new Zend_Gdata($client);
     //$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/'.$_SESSION["uEmail"].'%40gmail.com/full');
     $query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/' . $useremailid . '/full');
     $query->setMaxResults(1000);
     try {
         $feed = $gdata->getFeed($query);
         if ($feed) {
             $q_email = new sqlQuery($this->getDbCon());
             foreach ($feed as $entry) {
                 // retrieving emails
                 $extensionElements = $entry->getExtensionElements();
                 foreach ($extensionElements as $extensionElement) {
                     //emails
                     if ($extensionElement->rootNamespaceURI == "http://schemas.google.com/g/2005" && $extensionElement->rootElement == "email") {
                         $attributes = $extensionElement->getExtensionAttributes();
                         if (array_key_exists('address', $attributes)) {
                             if ($attributes['rel']['value'] == "http://schemas.google.com/g/2005#home") {
                                 //$data['em_home'] = $attributes['address']['value'];
                                 $sql_email_ins = "INSERT INTO \n                                                              temp_gmail_emails(email_address)\n                                                              VALUES('" . $attributes['address']['value'] . "')\n                                                            ";
                                 $q_email->query($sql_email_ins);
                             }
                             if ($attributes['rel']['value'] == "http://schemas.google.com/g/2005#work") {
                                 $sql_email_ins = "INSERT INTO \n                                                              temp_gmail_emails(email_address)\n                                                              VALUES('" . $attributes['address']['value'] . "')\n                                                            ";
                                 $q_email->query($sql_email_ins);
                             }
                             if ($attributes['rel']['value'] == "http://schemas.google.com/g/2005#other") {
                                 $sql_email_ins = "INSERT INTO \n                                                              temp_gmail_emails(email_address)\n                                                              VALUES('" . $attributes['address']['value'] . "')\n                                                            ";
                                 $q_email->query($sql_email_ins);
                             }
                         }
                     }
                 }
             }
             $q_email->free();
         }
     } catch (Exception $e) {
         $status_code = $gdata->getHttpClient()->getLastResponse()->getStatus();
         $this->status_code_desc = $this->getStatusDescription($status_code);
     }
 }
开发者ID:jacquesbagui,项目名称:ofuz,代码行数:52,代码来源:GoogleContactImport.class.php

示例10: GetMessageList

 function GetMessageList($folderid, $cutoffdate)
 {
     debugLog('GContacts::GetMessageList(' . $folderid . ')');
     $messages = array();
     try {
         // perform query and get feed of all results
         $query = new Zend_Gdata_Query(GCONTACTS_URL);
         $query->maxResults = 999999;
         //$query->group = "My Contacts";
         $query->setParam('orderby', 'lastmodified');
         $query->setParam('sortorder', 'descending');
         $feed = $this->service->getFeed($query);
     } catch (Exception $e) {
         debugLog('Gcontacts::GetMessageList - Error while opening feed (' . $e->exception() . ')');
         return false;
     }
     debugLog('GContacts::GetMessageList(' . $folderid . ')' . ' -' . $feed->title . ' ' . $feed->totalResults);
     // parse feed and extract contact information
     // into simpler objects
     $results = array();
     try {
         foreach ($feed as $entry) {
             $obj = new stdClass();
             $obj->edit = $entry->getEditLink()->href;
             $xmldata = $entry->getXML();
             //filter out real contact id without other garbage
             preg_match("/[_a-z0-9]+\$/", $entry->id, $matches);
             $contactid = $matches[0];
             $xml = simplexml_load_string($xmldata);
             $e["id"] = (string) $contactid;
             $e["flags"] = "1";
             $e["mod"] = strtotime((string) $entry->getUpdated());
             $results[] = $e;
             //debugLog((string)$entry->getUpdated());
         }
     } catch (Exception $e) {
         debugLog('Gcontacts::GetMessageList - Problem retrieving data (' . $e->exception() . ')');
         return false;
     }
     return $results;
 }
开发者ID:netconstructor,项目名称:activesync,代码行数:41,代码来源:gcontacts.php

示例11: GoogleContactPhoto

 function GoogleContactPhoto($GoogleContactsClient)
 {
     $data = array();
     $lnkPhotoGet = 'http://google.com/m8/feeds/contacts/jayanth.bagare%40gmail.com/full';
     $gdata = new Zend_Gdata($GoogleContactsClient);
     $query = new Zend_Gdata_Query($lnkPhotoGet);
     $query->setMaxResults(10000);
     $feed = $gdata->getFeed($query);
     foreach ($feed as $entry) {
         array_push($data, $entry);
     }
     $contacts[] = $data;
     foreach ($contacts as $entry) {
         if ($entry['link_photo']) {
             Zend_Loader::loadClass('Zend_Http_Response');
             $http_response = $gdata->get($entry['link_photo']);
             $rawImage = $http_response->getBody();
             $headers = $http_response->getHeaders();
             $contentType = $headers["Content-type"];
             header("Content-type: " . $contentType);
             var_dump($rawImage);
         }
     }
 }
开发者ID:sarapsg,项目名称:prayuj,代码行数:24,代码来源:GContacts.php

示例12: message

	foreach ( $dest_feed as $entry ) {

		if ( !$editlink = $entry->getEditLink() )
			continue;

		$entry = $dest_gdata->getEntry( $editlink->getHref() );
		$dest_gdata->delete( $entry );

		message( '  Deleted ' . $entry->title );
	}
	message( 'Existing "My Contacts" cleared from destination account.' );
}

// Fetch all source contacts
message( 'Fetching all "My Contacts" from source account...' );
$source_query = new Zend_Gdata_Query( 'http://www.google.com/m8/feeds/contacts/default/full' );
$source_query->maxResults = 99999;
$source_query->setParam( 'group', 'http://www.google.com/m8/feeds/groups/' . urlencode($source_user) . '/base/6' ); // "My Contacts" only
$source_feed = $source_gdata->getFeed( $source_query );
message( $source_feed->totalResults . ' contacts found.' );

// Add contacts from source account to the destination account
message( 'Creating contacts in destination account...' );
foreach ( $source_feed as $entry ) {
	//if ( 'Test Contact' != $entry->title ) continue;

	// Tweak the entry slightly
	$xml = $entry->getXML();
	$xml = str_replace( urlencode( $source_user ), urlencode( $dest_user ), $xml );

	// Insert the entry into the destination acccount
开发者ID:ninnypants,项目名称:Gmail-Contact-Sync,代码行数:31,代码来源:sync.php

示例13: getRelatedVideos

 /**
  *
  * @param $maxResults int
  *       	 Maximum number of YoutubeVideo to return.
  * @return array(YoutubeVideo) Videos retrieved.
  */
 public function getRelatedVideos($maxResults)
 {
     try {
         if (!class_exists('Zend_Loader')) {
             require_once WPPostsRateKeys::$plugin_dir . 'classes/YoutubeWordpress/Zend/Loader.php';
         }
         Zend_Loader::loadClass('Zend_Gdata_Query');
         Zend_Loader::loadClass('Zend_Gdata_YouTube');
         $query = new Zend_Gdata_Query(Zend_Gdata_YouTube::VIDEO_URI . "/{$this->videoEntry->getVideoId()}/" . Zend_Gdata_YouTube::RELATED_URI_SUFFIX);
         $query->setMaxResults($maxResults);
         $yt = new Zend_Gdata_YouTube();
         $yt->setMajorProtocolVersion(2);
         $relatedVideosFeed = $yt->getFeed($query, 'Zend_Gdata_YouTube_VideoFeed');
         // TODO See how this initialization must be done, I mean if is really neccesary.
         $relatedVideos = array();
         foreach ($relatedVideosFeed as $relatedVideoEntry) {
             $relatedVideos[] = new YoutubeVideo($relatedVideoEntry);
         }
         return $relatedVideos;
     } catch (Exception $e) {
         // Store to log
         $msg_to_log = 'Error while getRelatedVideos from Youtube' . ', Exception Msg: ' . $e->getMessage();
         // Add log
         WPPostsRateKeys_Logs::add_error('362', $msg_to_log);
         return array();
     }
 }
开发者ID:Kishor900,项目名称:scrapboard,代码行数:33,代码来源:YoutubeVideo.php

示例14: Zend_Gdata

<?php

/**
 *
 * File is under copyright of Bouke Haarsma and can
 * only be used with written permission of the author.
 *
 * @author Bouke Haarsma <bouke@webatoom.nl>
 * @copyright 2010, Bouke Haarsma
 */
require "config.php";
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, "cp");
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query("http://www.google.com/m8/feeds/contacts/{$email}/full");
$query->setParam("group", $group);
$feed = $gdata->getFeed($query);
$xml = new SimpleXMLElement($feed->getXML(), null, null, "http://www.w3.org/2005/Atom");
$xml->registerXPathNamespace("default", "http://schemas.google.com/g/2005");
$entries = $xml->xpath("//atom:entry/default:phoneNumber[@rel != 'http://schemas.google.com/g/2005#work_fax']");
$phonebook = array();
foreach ($entries as $phone) {
    $name = $phone->xpath("../atom:title");
    $phone = preg_replace("/([^\\+^0-9])/", "", $phone[0]);
    $phone = preg_replace("/^(\\+31|0031)/", "0", $phone);
    $phonebook[] = sprintf("n=%s;p=%s", $name[0], $phone);
}
// field names vary between spa models
// get all field names from directory
// (thanks to Lennart van der Hoorn)
$spaDir = file_get_contents('http://{$ip}/pdir.htm');
preg_match_all('/name="([0-9]{5})"/', $spaDir, $fields);
开发者ID:Bouke,项目名称:SPA941-Google-Contact-Sync,代码行数:31,代码来源:sync.php

示例15: GoogleContactPhoto

 function GoogleContactPhoto($GoogleContactsClient, $ContactEmail)
 {
     $lnkPhotoGet = 'http://google.com/m8/feeds/photos/media/';
     $gdata = new Zend_Gdata($GoogleContactsClient);
     $query = new Zend_Gdata_Query($lnkPhotoGet . $ContactEmail . '/c9012de');
     $query->setMaxResults(10000);
     $feed = $gdata->retrieveAllEntriesForFeed($gdata->getFeed($query));
 }
开发者ID:sarapsg,项目名称:prayuj,代码行数:8,代码来源:GContactsInterface.php


注:本文中的Zend_Gdata_Query类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。