當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Gdata_AuthSub類代碼示例

本文整理匯總了PHP中Zend_Gdata_AuthSub的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Gdata_AuthSub類的具體用法?PHP Zend_Gdata_AuthSub怎麽用?PHP Zend_Gdata_AuthSub使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Gdata_AuthSub類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setupDocsClient

function setupDocsClient($token = null)
{
    global $authSubURL;
    $docsClient = null;
    // Fetch a new AuthSub token?
    if (!$token && !isset($_SESSION['sessionToken'])) {
        $next = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        $scope = 'http://docs.google.com/feeds/ https://docs.google.com/feeds/';
        $secure = 0;
        $session = 1;
        $permission = 1;
        // 1 - allows posting notices && allows reading profile data
        $authSubURL = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
    } else {
        if (isset($_SESSION['sessionToken'])) {
            $httpClient = new Zend_Gdata_HttpClient();
            $httpClient->setAuthSubToken($_SESSION['sessionToken']);
            $docsClient = new Zend_Gdata_Docs($httpClient, 'google-OCRPHPDemo-v0.1');
        } else {
            $httpClient = new Zend_Gdata_HttpClient();
            $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken(trim($token), $httpClient);
            $httpClient->setAuthSubToken($_SESSION['sessionToken']);
            $docsClient = new Zend_Gdata_Docs($httpClient, 'google-OCRPHPDemo-v0.1');
        }
    }
    return $docsClient;
}
開發者ID:eva-chaunm,項目名稱:paraflow,代碼行數:27,代碼來源:ocr.php

示例2: getAuthSubHttpClient

function getAuthSubHttpClient()
{
    if (isset($_SESSION['google_session_token'])) {
        $client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['google_session_token']);
        return $client;
    }
}
開發者ID:vaibhav734,項目名稱:Facebook-Album,代碼行數:7,代碼來源:move_to_picasa.php

示例3: getAuthSubUrl

function getAuthSubUrl()
{
    $next = getCurrentUrl();
    $scope = 'http://picasaweb.google.com/data';
    $secure = 0;
    $session = 1;
    return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}
開發者ID:sidramaraddy,項目名稱:facebook-albums-challenge,代碼行數:8,代碼來源:google_login.php

示例4: testGetAuthSubTokenUriModifiedBase

 public function testGetAuthSubTokenUriModifiedBase()
 {
     $uri = Zend_Gdata_AuthSub::getAuthSubTokenUri('http://www.example.com/foo.php', 'http://www.google.com/calendar/feeds', 0, 1, 'http://www.otherauthservice.com/accounts/AuthSubRequest');
     // Note: the scope here is not encoded.  It should be encoded,
     // but the method getAuthSubTokenUri calls urldecode($scope).
     // This currently works (no reported bugs) as web browsers will
     // handle the encoding in most cases.
     $this->assertEquals('http://www.otherauthservice.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.example.com%2Ffoo.php&scope=http://www.google.com/calendar/feeds&secure=0&session=1', $uri);
 }
開發者ID:ntemple,項目名稱:intelli-plancake,代碼行數:9,代碼來源:AuthSubTest.php

示例5: getAuthSubUrl

 /**
  * Logs in via AuthSub. AuthSub is simiar to OAuth, but was developed
  * before OAuth became the "standard". AuthSub acts in a similar way as
  * OAuth. You login through Google, granting access to the site. You are
  * then returned to the site with an access token to authorize with.
  *
  * @param String $redirectUrl - URL that you want to redirect to
  *                              once a token is assigned
  * @return String - URL to follow to log into Google Calendar
  */
 function getAuthSubUrl($redirectUrl)
 {
     // indicates the app will only access Google Calendar feeds
     $scope = 'http://www.google.com/calendar/feeds';
     $secure = false;
     // if you are registered with SubAuth, then this can be true
     $session = true;
     return Zend_Gdata_AuthSub::getAuthSubTokenUri($redirectUrl, $scope, $secure, $session);
 }
開發者ID:abdullahbutt,項目名稱:Codeigniter-Gcal,代碼行數:19,代碼來源:Gcal.php

示例6: includes

 public function includes()
 {
     set_include_path(PLUGIN_DIR . "wildfire.media.youtube/ZendGdata/library/");
     require_once PLUGIN_DIR . 'wildfire.media.youtube/ZendGdata/library/Zend/Loader.php';
     Zend_Loader::loadClass('Zend_Gdata_YouTube');
     Zend_Loader::loadClass('Zend_Gdata_AuthSub');
     Zend_Loader::loadClass('Zend_Gdata_App_Exception');
     $httpClient = Zend_Gdata_AuthSub::getHttpClient(Config::get('youtube/token'));
     return new Zend_Gdata_YouTube($httpClient, 0, 0, Config::get('youtube/developer_key'));
 }
開發者ID:phpwax,項目名稱:wildfire.media.youtube,代碼行數:10,代碼來源:WildfireYoutubeFile.php

示例7: updateAuthSubToken

/**
 * Upgrade the single-use token to a session token.
 *
 * @param string $singleUseToken A valid single use token that is upgradable to a session token.
 * @return void
 */
function updateAuthSubToken($singleUseToken)
{
    try {
        $sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($singleUseToken);
    } catch (Zend_Gdata_App_Exception $e) {
        print 'ERROR - Token upgrade for ' . $singleUseToken . ' failed : ' . $e->getMessage();
        return;
    }
    $_SESSION['sessionToken'] = $sessionToken;
    header('Location: ' . HOME_URL);
}
開發者ID:kevinmel2000,項目名稱:Youtube-API-Sample,代碼行數:17,代碼來源:function.php

示例8: generateAuthSubURL

function generateAuthSubURL()
{
    $next = 'http://localhost/test1.php';
    $scope = 'https://www.google.com/h9/feeds';
    $authSubHandler = 'https://www.google.com/h9/authsub';
    $secure = 0;
    $session = 1;
    $authSubURL = Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session, $authSubHandler);
    // 1 - allows posting notices && allows reading profile data
    $permission = 1;
    $authSubURL .= '&permission=' . $permission;
    return '<a href="' . $authSubURL . '">Click here to link your H9 Account</a>';
}
開發者ID:ravikiran438,項目名稱:GoogleHealthApp,代碼行數:13,代碼來源:ghmytake1.php

示例9: getAuthSubHttpClient

 /**
  * Returns a HTTP client object with the appropriate headers for communicating
  * with Google using AuthSub authentication.
  *
  * Uses the $_SESSION['sessionToken'] to store the AuthSub session token after
  * it is obtained.  The single use token supplied in the URL when redirected
  * after the user succesfully authenticated to Google is retrieved from the
  * $_GET['token'] variable.
  *
  * @return Zend_Http_Client
  */
 function getAuthSubHttpClient()
 {
     global $_SESSION, $_GET;
     $client = new Zend_Gdata_HttpClient();
     if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
         $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], $client);
     }
     if (empty($_SESSION['sessionToken'])) {
         return null;
     }
     $client->setAuthSubToken($_SESSION['sessionToken']);
     return $client;
 }
開發者ID:andreassetiawanhartanto,項目名稱:PDKKI,代碼行數:24,代碼來源:import.php

示例10: getAuthSubHttpClient

 function getAuthSubHttpClient($mmm_id, $username)
 {
     if (!isset($_SESSION['sessionToken']) && !isset($_GET['token'])) {
         $this->redirect('/yts/index/');
         exit;
         return false;
     } else {
         if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
             $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
             $sessionToken = $_SESSION['sessionToken'];
             $this->time = time();
             $this->record['Yt']['mmm_id'] = $mmm_id;
             $this->record['Yt']['sessionToken'] = $sessionToken;
             $this->record['Yt']['status'] = '1';
             $this->record['Yt']['etime'] = $this->time;
             /*$qry="insert into yt_login(mmm_id , user_id ,sessionToken , status) values
             	 ('$mmm_id', '$username' , '$sessionToken', '1')";
             	 $result = mysql_query($qry);
             	 */
         }
     }
     $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
     return $httpClient;
 }
開發者ID:hilkeros,項目名稱:MMM-php-cake,代碼行數:24,代碼來源:yts_controller.php

示例11: getAuthSubHttpClient

/**
 * Returns a HTTP client object with the appropriate headers for communicating
 * with Google using AuthSub authentication.
 *
 * Uses the $_SESSION['sessionToken'] to store the AuthSub session token after
 * it is obtained.  The single use token supplied in the URL when redirected
 * after the user succesfully authenticated to Google is retrieved from the
 * $_GET['token'] variable.
 *
 * @return Zend_Http_Client
 */
function getAuthSubHttpClient()
{
    global $_SESSION, $_GET, $_authSubKeyFile, $_authSubKeyFilePassphrase;
    $client = new Zend_Gdata_HttpClient();
    if ($_authSubKeyFile != null) {
        // set the AuthSub key
        $client->setAuthSubPrivateKeyFile($_authSubKeyFile, $_authSubKeyFilePassphrase, true);
    }
    if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
        $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], $client);
    }
    $client->setAuthSubToken($_SESSION['sessionToken']);
    return $client;
}
開發者ID:natureday1,項目名稱:Life,代碼行數:25,代碼來源:Calendar.php

示例12: str_repeat

        } else {
            if (preg_match('/^<\\/.+>$/', $el)) {
                $indent -= $level;
                // closing tag, decrease indent
            }
            if ($indent < 0) {
                $indent += $level;
            }
            $pretty[] = str_repeat(' ', $indent) . $el;
        }
    }
    $xml = implode("\n", $pretty);
    return $html_output ? htmlentities($xml) : $xml;
}
$sessionToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
$client = Zend_Gdata_AuthSub::getHttpClient($sessionToken);
$useH9Sandbox = true;
$healthService = new Zend_Gdata_Health($client, 'MyGHAppNamev1.0', $useH9Sandbox);
$query = new Zend_Gdata_Health_Query();
$query->setDigest("true");
$profileFeed = $healthService->getHealthProfileFeed($query);
$entry = $profileFeed->entry[0];
//To print ccr
$ccr = $entry->getCcr();
$xmlStr = $ccr->saveXML($ccr);
echo '<p>' . xmlpp($xmlStr, true) . '</p>';
// digest=true was set so we only have 1 entry
$allergies = $entry->getCcr()->getAllergies();
$conditions = $entry->getCcr()->getConditions();
$immunizations = $entry->getCcr()->getImmunizations();
$lab_results = $entry->getCcr()->getLabResults();
開發者ID:ravikiran438,項目名稱:GoogleHealthApp,代碼行數:31,代碼來源:test1.php

示例13: getAuthSubHttpClient

/**
 * Convenience method to obtain an authenticted Zend_Http_Client object.
 *
 * @return Zend_Http_Client An authenticated client.
 */
function getAuthSubHttpClient()
{
    try {
        $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
    } catch (Zend_Gdata_App_Exception $e) {
        print 'ERROR - Could not obtain authenticated Http client object. ' . $e->getMessage();
        return;
    }
    $httpClient->setHeaders('X-GData-Key', 'key=' . $_SESSION['developerKey']);
    return $httpClient;
}
開發者ID:holdensmagicalunicorn,項目名稱:copperFramework,代碼行數:16,代碼來源:operations.php

示例14: revokeToken

function revokeToken($client)
{
    $sessionToken = $client->getAuthSubToken();
    return Zend_Gdata_AuthSub::AuthSubRevokeToken($sessionToken, $client);
}
開發者ID:SustainableCoastlines,項目名稱:loveyourwater,代碼行數:5,代碼來源:Health.php

示例15: getAuthSubHttpClient

    public function getAuthSubHttpClient() {
        // Security check
        $this->throwForbiddenUnless(SecurityUtil::checkPermission('IWagendas::', '::', ACCESS_READ));

        //global $_SESSION, $_GET, $_authSubKeyFile, $_authSubKeyFilePassphrase;
        $client = new Zend_Gdata_HttpClient();
        if ($_authSubKeyFile != null) {
            // set the AuthSub key
            $client->setAuthSubPrivateKeyFile($_authSubKeyFile, $_authSubKeyFilePassphrase, true);
        }
        if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
            $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token'], $client);
        }
        $client->setAuthSubToken($_SESSION['sessionToken']);
        return $client;
    }
開發者ID:projectesIF,項目名稱:Sirius,代碼行數:16,代碼來源:User.php


注:本文中的Zend_Gdata_AuthSub類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。