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


PHP getAuthSubHttpClient函数代码示例

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


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

示例1: processPageLoad

/**
 * Processes loading of this sample code through a web browser.  Uses AuthSub
 * authentication and outputs a list of a user's calendars if succesfully 
 * authenticated.
 *
 * @return void
 */
function processPageLoad()
{
    global $_SESSION, $_GET;
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
        requestUserLogin('Please login to your Google Account.');
    } else {
        $client = getAuthSubHttpClient();
        outputCalendarList($client);
    }
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:17,代码来源:Calendar-expanded.php

示例2: processPageLoad

/**
 * Processes loading of this sample code through a web browser.  Uses AuthSub
 * authentication and outputs a list of a user's albums if succesfully
 * authenticated.
 *
 * @return void
 */
function processPageLoad()
{
    global $_SESSION, $_GET;
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
        requestUserLogin('Please login to your Google Account.');
    } else {
        $client = getAuthSubHttpClient();
        if (!empty($_REQUEST['command'])) {
            switch ($_REQUEST['command']) {
                case 'retrieveSelf':
                    outputUserFeed($client, "default");
                    break;
                case 'retrieveUser':
                    outputUserFeed($client, $_REQUEST['user']);
                    break;
                case 'retrieveAlbumFeed':
                    outputAlbumFeed($client, $_REQUEST['user'], $_REQUEST['album']);
                    break;
                case 'retrievePhotoFeed':
                    outputPhotoFeed($client, $_REQUEST['user'], $_REQUEST['album'], $_REQUEST['photo']);
                    break;
            }
        }
        // Now we handle the potentially destructive commands, which have to
        // be submitted by POST only.
        if (!empty($_POST['command'])) {
            switch ($_POST['command']) {
                case 'addPhoto':
                    addPhoto($client, $_POST['user'], $_POST['album'], $_FILES['photo']);
                    break;
                case 'deletePhoto':
                    deletePhoto($client, $_POST['user'], $_POST['album'], $_POST['photo']);
                    break;
                case 'addAlbum':
                    addAlbum($client, $_POST['user'], $_POST['name']);
                    break;
                case 'deleteAlbum':
                    deleteAlbum($client, $_POST['user'], $_POST['album']);
                    break;
                case 'addComment':
                    addComment($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['comment']);
                    break;
                case 'addTag':
                    addTag($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['tag']);
                    break;
                case 'deleteComment':
                    deleteComment($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['comment']);
                    break;
                case 'deleteTag':
                    deleteTag($client, $_POST['user'], $_POST['album'], $_POST['photo'], $_POST['tag']);
                    break;
                default:
                    break;
            }
        }
        // If a menu parameter is available, display a submenu.
        if (!empty($_REQUEST['menu'])) {
            switch ($_REQUEST['menu']) {
                case 'user':
                    displayUserMenu();
                    break;
                case 'photo':
                    displayPhotoMenu();
                    break;
                case 'album':
                    displayAlbumMenu();
                    break;
                case 'logout':
                    logout();
                    break;
                default:
                    header('HTTP/1.1 400 Bad Request');
                    echo "<h2>Invalid menu selection.</h2>\n";
                    echo "<p>Please check your request and try again.</p>";
            }
        }
        if (empty($_REQUEST['menu']) && empty($_REQUEST['command'])) {
            displayMenu();
        }
    }
}
开发者ID:jsnshrmn,项目名称:Suma,代码行数:88,代码来源:Photos.php

示例3: runWWWVersion

/**
 * Processes loading of this sample code through a web browser.
 */
function runWWWVersion()
{
    session_start();

    // Note that all calls to endHTML() below end script execution!

    global $_SESSION, $_GET;
    if (!isset($_SESSION['docsSampleSessionToken']) && !isset($_GET['token'])) {
        requestUserLogin('Please login to your Google Account.');
    } else {
        $client = getAuthSubHttpClient();
        $docs = new Zend_Gdata_Docs($client);

        // First we check for commands that can be submitted either though
        // POST or GET (they don't make any changes).
        if (!empty($_REQUEST['command'])) {
            switch ($_REQUEST['command']) {
                case 'retrieveAllDocuments':
                    startHTML();
                    retrieveAllDocuments($docs, true);
                    endHTML(true);
                case 'retrieveWPDocs':
                    startHTML();
                    retrieveWPDocs($docs, true);
                    endHTML(true);
                case 'retrieveSpreadsheets':
                    startHTML();
                    retrieveSpreadsheets($docs, true);
                    endHTML(true);
                case 'fullTextSearch':
                    startHTML();
                    fullTextSearch($docs, true, $_REQUEST['query']);
                    endHTML(true);
                    
            }
        }
    
        // Now we handle the potentially destructive commands, which have to
        // be submitted by POST only.
        if (!empty($_POST['command'])) {
            switch ($_POST['command']) {
                case 'uploadDocument':
                    startHTML();
                    uploadDocument($docs, true, 
                        $_FILES['uploadedFile']['name'], 
                        $_FILES['uploadedFile']['tmp_name']);
                    endHTML(true);
                case 'modifySubscription':
                    if ($_POST['mode'] == 'subscribe') {
                        startHTML();
                        endHTML(true);
                    } elseif ($_POST['mode'] == 'unsubscribe') {
                        startHTML();
                        endHTML(true);
                    } else {
                        header('HTTP/1.1 400 Bad Request');
                        startHTML();
                        echo "<h2>Invalid mode.</h2>\n";
                        echo "<p>Please check your request and try again.</p>";
                        endHTML(true);
                    }
            }
        }
    
        // Check for an invalid command. If so, display an error and exit.
        if (!empty($_REQUEST['command'])) {
            header('HTTP/1.1 400 Bad Request');
            startHTML();
            echo "<h2>Invalid command.</h2>\n";
            echo "<p>Please check your request and try again.</p>";
            endHTML(true);
        }
        // If a menu parameter is available, display a submenu.
    
        if (!empty($_REQUEST['menu'])) {
            switch ($_REQUEST['menu']) {
                case 'list':
                    startHTML();
                    displayListMenu();
                    endHTML();
                case 'query':
                    startHTML();
                    displayQueryMenu();
                    endHTML();
                case 'upload':
                    startHTML();
                    displayUploadMenu();
                    endHTML();
                case 'logout':
                    startHTML(false);
                    logout();
                    endHTML();
                default:
                    header('HTTP/1.1 400 Bad Request');
                    startHTML();
                    echo "<h2>Invalid menu selection.</h2>\n";
                    echo "<p>Please check your request and try again.</p>";
//.........这里部分代码省略.........
开发者ID:jorgenils,项目名称:zend-framework,代码行数:101,代码来源:Docs.php

示例4: updatePlaylist

/**
 * Delete a playlist
 *
 * @param string $newplaylistTitle New title for the playlist to be updated
 * @param string $newPlaylistDescription New description for the playlist to be updated
 * @param string $oldPlaylistTitle Title of the playlist to be updated
 * @return void
 */
function updatePlaylist($newPlaylistTitle, $newPlaylistDescription, $oldPlaylistTitle)
{
    $httpClient = getAuthSubHttpClient();
    $youTubeService = new Zend_Gdata_YouTube($httpClient);
    $feed = $youTubeService->getPlaylistListFeed('default');
    if (loggingEnabled()) {
        logMessage($httpClient->getLastRequest(), 'request');
        logMessage($httpClient->getLastResponse()->getBody(), 'response');
    }
    $playlistEntryToDelete = null;
    foreach ($feed as $playlistEntry) {
        if ($playlistEntry->getTitleValue() == $oldplaylistTitle) {
            $playlistEntryToDelete = $playlistEntry;
            break;
        }
    }
    if (!$playlistEntryToDelete instanceof Zend_Gdata_YouTube_PlaylistListEntry) {
        print 'ERROR - Could not retrieve playlist to be updated<br />' . printCacheWarning();
        return;
    }
    try {
        $response = $playlistEntryToDelete->delete();
        if (loggingEnabled()) {
            logMessage($httpClient->getLastRequest(), 'request');
            logMessage($httpClient->getLastResponse()->getBody(), 'response');
        }
    } catch (Zend_Gdata_App_HttpException $httpException) {
        print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />';
        return;
    } catch (Zend_Gdata_App_Exception $e) {
        print 'ERROR - Could not delete the playlist: ' . $e->getMessage();
        return;
    }
    print 'Playlist deleted succesfully.<br /><a href="#" onclick="' . 'ytVideoApp.retrievePlaylists();"' . '">(refresh your playlist listing)</a><br />' . printCacheWarning();
}
开发者ID:holdensmagicalunicorn,项目名称:copperFramework,代码行数:43,代码来源:operations.php

示例5: processPageLoad

/**
 * Processes loading of this sample code through a web browser.  Uses AuthSub
 * authentication and outputs a list of a user's base items if succesfully 
 * authenticated.
 *
 * @return void
 */
function processPageLoad()
{
    global $_SESSION, $_GET;
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
        requestUserLogin('Please login to your Google Account.');
    } else {
        startHTML();
        $client = getAuthSubHttpClient();
        $itemUrl = insertItem($client, false);
        updateItem($client, $itemUrl, false);
        listAllMyItems($client);
        deleteItem($client, $itemUrl, true);
        querySnippetFeed();
        endHTML();
    }
}
开发者ID:automatweb,项目名称:automatweb_dev,代码行数:23,代码来源:Gbase.php

示例6: header

    $album_download_directory = $_GET['album_download_directory'];
    $album_download_directory = '../' . $album_download_directory;
} else {
    header('location:../index.php');
}
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Photos');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
function getAuthSubHttpClient()
{
    if (isset($_SESSION['google_session_token'])) {
        $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['google_session_token']);
        return $client;
    }
}
$gp = new Zend_Gdata_Photos(getAuthSubHttpClient(), "Google-DevelopersGuide-1.0");
$entry = new Zend_Gdata_Photos_AlbumEntry();
function add_new_album($entry, $gp, $album_download_directory, $album_name)
{
    $new_album_name = str_replace(" ", "_", $album_name);
    $new_album_name = $new_album_name . '_' . uniqid();
    $entry->setTitle($gp->newTitle($new_album_name));
    $entry->setSummary($gp->newSummary("Album added by Facebook Album Challenge"));
    $gp->insertAlbumEntry($entry);
    $path = $album_download_directory . $album_name;
    if (file_exists($path)) {
        $photos = scandir($path);
        foreach ($photos as $photo) {
            if ($photo != "." && $photo != "..") {
                $photo_path = $path . '/' . $photo;
                add_new_photo_to_album($gp, $photo_path, $new_album_name);
开发者ID:vaibhav734,项目名称:Facebook-Album,代码行数:31,代码来源:move_to_picasa.php

示例7: getAuthSubHttpClient

<?php

//<form onsubmit="ytVideoApp.prepareSyndicatedUpload(this.videoTitle.value, this.videoDescription.value, this.videoCategory.value, this.videoTags.value); return false;" id="uploadForm">Enter video title:<br><input type="text" name="videoTitle" size="50"><br>Enter video description:<br><textarea name="videoDescription" cols="50"></textarea><br>Select a category: <select name="videoCategory"><option value="Autos">Autos &amp; Vehicles</option><option value="Music">Music</option><option value="Animals">Pets &amp; Animals</option><option value="Sports">Sports</option><option value="Travel">Travel &amp; Events</option><option value="Games">Gadgets &amp; Games</option><option value="Comedy">Comedy</option><option value="People">People &amp; Blogs</option><option value="News">News &amp; Politics</option><option value="Entertainment">Entertainment</option><option value="Education">Education</option><option value="Howto">Howto &amp; Style</option><option value="Nonprofit">Nonprofit &amp; Activism</option><option value="Tech">Science &amp; Technology</option></select><br>Enter some tags to describe your video <em>(separated by spaces)</em>:<br><input type="text" value="video" size="50" name="videoTags"><br><input type="submit" value="go"></form>
$videoTitle = null;
$videoDescription = null;
$videoCategory = null;
$videoTags = null;
$nextUrl = null;
$httpClient = getAuthSubHttpClient();
$youTubeService = new Zend_Gdata_YouTube($httpClient);
$newVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$newVideoEntry->setVideoTitle($videoTitle);
$newVideoEntry->setVideoDescription($videoDescription);
//make sure first character in category is capitalized
$videoCategory = strtoupper(substr($videoCategory, 0, 1)) . substr($videoCategory, 1);
$newVideoEntry->setVideoCategory($videoCategory);
// convert videoTags from whitespace separated into comma separated
$videoTagsArray = explode(' ', trim($videoTags));
$newVideoEntry->setVideoTags(implode(', ', $videoTagsArray));
$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
try {
    $tokenArray = $youTubeService->getFormUploadToken($newVideoEntry, $tokenHandlerUrl);
    if (loggingEnabled()) {
        logMessage($httpClient->getLastRequest(), 'request');
        logMessage($httpClient->getLastResponse()->getBody(), 'response');
    }
} catch (Zend_Gdata_App_HttpException $httpException) {
    print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />';
    return;
} catch (Zend_Gdata_App_Exception $e) {
    print 'ERROR - Could not retrieve token for syndicated upload. ' . $e->getMessage() . '<br /><a href="session_details.php">' . 'click here to view details of last request</a><br />';
开发者ID:schematical,项目名称:MJax2.0,代码行数:31,代码来源:youtubeUploader_iframe.php


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