本文整理汇总了PHP中Zend_Gdata::insertEntry方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::insertEntry方法的具体用法?PHP Zend_Gdata::insertEntry怎么用?PHP Zend_Gdata::insertEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata
的用法示例。
在下文中一共展示了Zend_Gdata::insertEntry方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertVolume
public function insertVolume($entry, $location = null)
{
if ($location == null) {
$uri = self::MY_LIBRARY_FEED_URI;
} else {
$uri = $location;
}
return parent::insertEntry($entry, $uri, 'Zend_Gdata_Books_VolumeEntry');
}
示例2: 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;
}
示例3: testMediaUpload
public function testMediaUpload()
{
// the standard sevice for Gdata testing is Blogger, due to the strong
// match to the standard Gdata/APP protocol. However, Blogger doesn't
// currently support media uploads, so we're using Picasa Web Albums
// for this test instead
$user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL');
$pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD');
$this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID');
$service = 'lh2';
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$gd = new Zend_Gdata($client);
// setup the photo content
$fs = $gd->newMediaFileSource('Zend/Gdata/_files/testImage.jpg');
$fs->setContentType('image/jpeg');
// create a new picasa album
$albumEntry = $gd->newEntry();
$albumEntry->setTitle($gd->newTitle('My New Test Album'));
$albumEntry->setCategory(array($gd->newCategory('http://schemas.google.com/photos/2007#album', 'http://schemas.google.com/g/2005#kind')));
$createdAlbumEntry = $gd->insertEntry($albumEntry, 'http://picasaweb.google.com/data/feed/api/user/default');
$this->assertEquals('My New Test Album', $createdAlbumEntry->title->text);
$albumUrl = $createdAlbumEntry->getLink('http://schemas.google.com/g/2005#feed')->href;
// post the photo to the new album, without any metadata
// other than the slug
// add a slug header to the media file source
$fs->setSlug('Going to the park');
$createdPhotoBinaryOnly = $gd->insertEntry($fs, $albumUrl);
$this->assertEquals('Going to the park', $createdPhotoBinaryOnly->title->text);
// post the photo to the new album along with the entry
// remove slug header from the media file source
$fs->setSlug(null);
// setup an entry with metadata
$mediaEntry = $gd->newMediaEntry();
$mediaEntry->setMediaSource($fs);
$mediaEntry->setTitle($gd->newTitle('My New Test Photo'));
$mediaEntry->setSummary($gd->newSummary('My New Test Photo Summary'));
$mediaEntry->setCategory(array($gd->newCategory('http://schemas.google.com/photos/2007#photo ', 'http://schemas.google.com/g/2005#kind')));
$createdPhotoMultipart = $gd->insertEntry($mediaEntry, $albumUrl);
$this->assertEquals('My New Test Photo', $createdPhotoMultipart->title->text);
// cleanup and remove the album
// first we wait 5 seconds
sleep(5);
try {
$albumEntry->delete();
} catch (Zend_Gdata_App_Exception $e) {
$this->fail('Tried to delete the test album, got exception: ' . $e->getMessage());
}
}
示例4:
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$username = 'user@example.com';
$password = 'password';
$service = 'blogger';
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$gdata = new Zend_Gdata($client);
$entry = $gdata->newEntry();
$category = $gdata->newCategory();
$category->setScheme('http://www.blogger.com/atom/ns#');
$category->setTerm('Test Label');
$entry->setCategory(array($category));
$content = $gdata->newContent();
$content->setText("Hello world");
$entry->setContent($content);
$gdata->insertEntry($entry, "http://www.blogger.com/feeds/8273578352962669317/posts/default");
示例5: urlencode
$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
$response = $dest_gdata->insertEntry( $xml, 'http://www.google.com/m8/feeds/contacts/default/full' );
// Make sure we had success
if ( empty( $response->id ) ) {
message( ' Failed to add "' . $entry->title . '" to the destination account.' );
continue;
}
// Does the user have a photo?
$image_url = false;
foreach ( $entry->link as $link ) {
// We're only after the photo link
if ( 'http://schemas.google.com/contacts/2008/rel#photo' !== $link->rel )
continue;