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


PHP Zend_Gdata_YouTube::getUserProfile方法代码示例

本文整理汇总了PHP中Zend_Gdata_YouTube::getUserProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::getUserProfile方法的具体用法?PHP Zend_Gdata_YouTube::getUserProfile怎么用?PHP Zend_Gdata_YouTube::getUserProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Gdata_YouTube的用法示例。


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

示例1: get_user_name

 /**
  *
  * @return string
  */
 public function get_user_name()
 {
     return $this->_api->getUserProfile('default')->getUsername();
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:8,代码来源:Youtube.php

示例2: addUsername

/**
 * Add a username to the DB using their single-use AuthSub token.
 *
 * @param string $token The single-use AuthSub token of the user to be added.
 * @return void
 */
function addUsername($token)
{
    $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
    $yt = new Zend_Gdata_YouTube($httpClient, 'YT-UeberActivityViewer', $GLOBALS['ueber-activity-viewer-php_config']['client_id'], $GLOBALS['ueber-activity-viewer-php_config']['dev_key']);
    $yt->setMajorProtocolVersion(2);
    try {
        $userProfile = $yt->getUserProfile('default');
    } catch (Zend_Gdata_Exception $e) {
        error_log("Error getting userProfile: " . $e->getMessage());
        return null;
    }
    unset($yt);
    if (!$userProfile) {
        error_log("UserProfile is null.");
        return null;
    }
    $username = $userProfile->getUsername();
    $userhash = null;
    // get hash
    if ($username) {
        $yt = getYouTubeService();
        try {
            $activitiesFeed = $yt->getFeed('http://gdata.youtube.com/feeds/api/users/' . $username . '/events');
        } catch (Exception $e) {
            echo "Error retrieving user events feed for {$username} | " . $e->getMessage();
            print_r($yt);
        }
        $updatesLink = $activitiesFeed->getLink('updates');
        $hashHref = $updatesLink->getHref();
        $userhash = substr($hashHref, strpos($hashHref, '#') + 1);
        unset($yt);
    } else {
        echo "Could not get user profile for token {$token}.";
        error_log("Could not get user profile for token {$token}.");
        header('Location: ' . "http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}");
    }
    $mysqli = new mysqli($GLOBALS['ueber-activity-viewer-php_config']['mysql_hostname'], $GLOBALS['ueber-activity-viewer-php_config']['mysql_username'], $GLOBALS['ueber-activity-viewer-php_config']['mysql_password'], $GLOBALS['ueber-activity-viewer-php_config']['mysql_database'], $GLOBALS['ueber-activity-viewer-php_config']['mysql_port'], $GLOBALS['ueber-activity-viewer-php_config']['mysql_socket']);
    if (mysqli_connect_errno()) {
        error_log("Connect failed: " . mysqli_connect_error());
        return null;
    }
    $username = $mysqli->real_escape_string($username);
    $userhash = $mysqli->real_escape_string($userhash);
    $statement = $mysqli->prepare("INSERT IGNORE INTO user (username, hash) VALUES (?,?)");
    $statement->bind_param('ss', $username, $userhash);
    $statement->execute();
    $statement->close();
    $mysqli->close();
    header('Location: ' . "http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}");
}
开发者ID:hamik112,项目名称:gdata-samples,代码行数:56,代码来源:get_activity.php

示例3:

                    $youtube = new Zend_Gdata_YouTube($httpClient, APPLICATION_ID, CLIENT_ID, DEVELOPER_KEY);

                    // Variabel $profile akan menyimpan semua informasi profile dari user yang terhubung
                    // dalam bentuk object class Zend_Gdata_YouTube_UserProfileEntry
                    $profile = $youtube->getUserProfile();
                </pre>

                Hasil yang didapat :

                <pre>
<?php 
    $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
    $httpClient->setHeaders('GData-Version', '2.0');
    $youtube = new Zend_Gdata_YouTube($httpClient, APP_ID, CLIENT_ID, DEV_KEY);
    // Variabel $profile akan menyimpan semua informasi profile dari user yang terhubung
    $profile = $youtube->getUserProfile('default');
    echo '// $profile->getUsername();<br/>';
    echo $profile->getUsername();
    echo '<br/><br/>';
    echo '// $profile->getFirstName();<br/>';
    echo $profile->getFirstName();
    echo '<br/><br/>';
    echo '// $profile->getLastName();<br/>';
    echo $profile->getLastName();
    ?>
                </pre>
            </p>
        <?php 
}
?>
    </div>
开发者ID:kevinmel2000,项目名称:Youtube-API-Sample,代码行数:31,代码来源:index.php

示例4: displayYouTubeUploadPage

 /**
  * displayYouTubeUploadPage
  * 
  * @return void
  */
 function displayYouTubeUploadPage()
 {
     $this->displayHeader();
     $this->checkUserAuthedYouTube();
     $youtubeConfig = getYouTubeConfigData();
     $httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key']);
     if ($httpClient === false) {
         // Error message was already displayed by getYouTubeAuthSubHttpClient()
         $this->displayFooter();
         die;
     }
     $youTubeService = new Zend_Gdata_YouTube($httpClient);
     $feed = $youTubeService->getUserProfile('default');
     if (!$feed instanceof Zend_Gdata_YouTube_UserProfileEntry) {
         print '
         <div class="error-alert">' . T_('Could not get YouTube data for user.') . '</div>';
         return;
     }
     $username = $feed->getUsername();
     echo '
     <form action="video.php?upload=youtube" method="post">
         <fieldset>
             <legend><span>' . T_('Upload YouTube Video') . '</span></legend>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('YouTube Account') . '</b></label></div>
                 <div class="field-widget">' . $username . '
                 </div>
             </div>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('Title') . '</b></label></div>
                 <div class="field-widget">
                     <input type="text" name="title" size="50"/>
                 </div>
             </div>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('Description') . '</b></label></div>
                 <div class="field-widget">
                     <textarea cols="50" name="description"></textarea>
                 </div>
             </div>
             <div class="field-row">
                 <div class="field-label"><label><b>' . T_('Category') . '</b></label></div>
                 <div class="field-widget">
                     <select name="category">
                         <option value="Autos">' . T_('Autos &amp; Vehicles') . '</option>
                         <option value="Music">' . T_('Music') . '</option>
                         <option value="Animals">' . T_('Pets &amp; Animals') . '</option>
                         <option value="Sports">' . T_('Sports') . '</option>
                         <option value="Travel">' . T_('Travel &amp; Events') . '</option>
                         <option value="Games">' . T_('Gadgets &amp; Games') . '</option>
                         <option value="Comedy">' . T_('Comedy') . '</option>
                         <option value="People">' . T_('People &amp; Blogs') . '</option>
                         <option value="News">' . T_('News &amp; Politics') . '</option>
                         <option value="Entertainment">' . T_('Entertainment') . '</option>
                         <option value="Education">' . T_('Education') . '</option>
                         <option value="Howto">' . T_('Howto &amp; Style') . '</option>
                         <option value="Nonprofit">' . T_('Nonprofit &amp; Activism') . '</option>
                         <option value="Tech">' . T_('Science &amp; Technology') . '</option>
                     </select>
                 </div>
             </div>
             <div class="field-row">
                 <div class="field-label"><label for="unlisted"><b>' . T_('Unlisted') . '</b></label></div>
                 <div class="field-widget">
                     <input type="checkbox" name="unlisted" id="unlisted_" value="yes" checked="checked"><br/>
                     <small>' . T_('"Unlisted" means that only people who know the link to the video can view it. The video will not appear in any of YouTube\'s public spaces, such as search results, your channel, or the Browse page, but the link can be shared with anyone.') . '</small>
                 </div>
             </div>
             <input class="sub1" type="submit" id="upload_data" name="upload_data" value="' . T_('Next') . '"/>
              &nbsp;' . T_('or') . ' &nbsp;
             <a href="video.php">' . T_('Cancel') . '</a>
         </fieldset>
     </form>';
     $this->displayFooter();
 }
开发者ID:sauravpratihar,项目名称:fcms,代码行数:80,代码来源:video.php

示例5: getAccountInfo

 /**
  * Retrieves a user's profile as an entry
  *
  * @param string $user The username of interest
  * @return Zend_Gdata_YouTube_UserProfileEntry The user profile entry
  */
 public function getAccountInfo($username)
 {
     return $this->yt->getUserProfile($username);
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:10,代码来源:Youtube.php

示例6: displayEditYouTube

 /**
  * displayEditYouTube 
  * 
  * @return void
  */
 function displayEditYouTube()
 {
     $this->displayHeader();
     $config = getYouTubeConfigData();
     $user = getYouTubeUserData($this->fcmsUser->id);
     // Setup url for callbacks
     $callbackUrl = getDomainAndDir();
     $callbackUrl .= 'settings.php?view=youtube';
     if (!empty($config['youtube_key'])) {
         if (!empty($user['youtube_session_token'])) {
             $httpClient = getYouTubeAuthSubHttpClient($config['youtube_key'], $user['youtube_session_token']);
             $youTubeService = new Zend_Gdata_YouTube($httpClient);
             $feed = $youTubeService->getUserProfile('default');
             if (!$feed instanceof Zend_Gdata_YouTube_UserProfileEntry) {
                 print '
         <div class="error-alert">' . T_('Could not get YouTube data for user.') . '</div>';
                 return;
             }
             $username = $feed->getUsername();
             $user = '<a href="http://www.youtube.com/user/' . $username . '">' . $username . '</a>';
             $status = sprintf(T_('Currently connected as: %s'), $user);
             $link = '<a class="disconnect" href="?revoke=youtube">' . T_('Disconnect') . '</a>';
         } else {
             $url = Zend_Gdata_AuthSub::getAuthSubTokenUri($callbackUrl, 'http://gdata.youtube.com', false, true);
             $status = T_('Not Connected');
             $link = '<a href="' . $url . '">' . T_('Connect') . '</a>';
         }
     }
     echo '
     <div class="social-media-connect">
         <img class="icon" src="ui/img/youtube.png" alt="YouTube"/>
         <h2>YouTube</h2>
         <p>' . T_('YouTube allows users to discover, watch and share videos.') . '</p>
         <div class="status">' . $status . '</div>
         <div class="action">' . $link . '</div>
     </div>';
     $this->displayFooter();
 }
开发者ID:sauravpratihar,项目名称:fcms,代码行数:43,代码来源:settings.php


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