本文整理汇总了PHP中Zend_Gdata_YouTube::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::delete方法的具体用法?PHP Zend_Gdata_YouTube::delete怎么用?PHP Zend_Gdata_YouTube::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_object
/**
*
* @param string $object
* @param string $object_id
* @return Void
*/
public function delete_object($object, $object_id)
{
switch ($object) {
case self::ELEMENT_TYPE_VIDEO:
$this->_api->delete($this->_api->getFullVideoEntry($object_id));
break;
case self::CONTAINER_TYPE_PLAYLIST:
$this->get_PlaylistEntry_from_Id($object_id)->delete();
break;
default:
throw new Bridge_Exception_ObjectUnknown('Unknown object ' . $object);
break;
}
return;
}
示例2: delete
function delete($username, $password, $source, $videoId)
{
$httpClient = $this->clientLogin($username, $password, $source);
$httpClient->setHeaders('X-GData-Key', "key={$source}");
$yt = new Zend_Gdata_YouTube($httpClient);
try {
$videoEntryToDelete = $yt->getVideoEntry($videoId, null, true);
$result = $yt->delete($videoEntryToDelete);
return $result;
} catch (Zend_Gdata_App_HttpException $httpException) {
echo $httpException->getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
}
}
示例3: deleteVideo
/**
* Deletes a Video.
*
* @param string $videoId Id of the video to be deleted.
* @return void
*/
function deleteVideo($videoId)
{
$httpClient = getAuthSubHttpClient();
$youTubeService = new Zend_Gdata_YouTube($httpClient);
$feed = $youTubeService->getVideoFeed('http://gdata.youtube.com/feeds/users/default/uploads');
$videoEntryToDelete = null;
foreach ($feed as $entry) {
if ($entry->getVideoId() == $videoId) {
$videoEntryToDelete = $entry;
break;
}
}
// check if videoEntryToUpdate was found
if (!$videoEntryToDelete instanceof Zend_Gdata_YouTube_VideoEntry) {
print 'ERROR - Could not find a video entry with id ' . $videoId . '<br />';
return;
}
try {
$httpResponse = $youTubeService->delete($videoEntryToDelete);
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 video: ' . $e->getMessage();
return;
}
print 'Entry deleted succesfully.<br />' . $httpResponse->getBody() . '<br /><a href="#" onclick="' . 'ytVideoApp.presentFeed(\'search_owner\', 5, 0, \'none\');"' . '">(refresh your video listing)</a><br />' . printCacheWarning();
}
示例4: delAction
function delAction()
{
if ($_SESSION['role_id']!=0)
{
$this->_redirect($this->view->baseUrl().'/../admin');
}
else
{
$video = $this->mVideo->getVideoById($video_id);
if($this->role == "0" | ($this->user_login == $video['user_upload']))
{
$video_id = $this->_request->getParam('video_id');
$video_link = $video['video_link'];
$youtube_id = $video['youtube_id'];
$account = $this->mVideo->getAccountByYoutubeId($youtube_id);
$user = $account['youtube_username'];
$pass = $account['password'];
$this->mVideo->delVideo($video_id);
if($video_link != null)
{
try
{
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = $user,
$password = $pass,
$service = 'youtube',
$client = null,
$source = 'NIWApp',
$loginToken = null,
$loginCaptcha = null,
$authenticationURL
);
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube($httpClient, 'NIW-App-1.0', '661085061264.apps.googleusercontent.com', 'AI39si4UPUxw1FE5hqSi0Z-B-5z3PIVovbBWKmqiMI3cXJ7lhvjJcABV-eqimb2EeSiuedWK8N9OGOdB1namX1CqqYki8jEfSQ');
$video = $yt->getFullVideoEntry($video_link);
$yt->delete($video);
}
catch (Exception $ex) {
echo $ex->getMessage();
exit;
}
}
$this->_redirect($this->view->baseUrl().'/../admin/uploadvideo');
}
else
{
$_SESSION['result']='Bạn không có quyền xóa mục này !';
$this->_redirect($this->view->baseUrl().'/../admin/uploadvideo');
}
}
}
示例5: displayRemoveVideoSubmit
/**
* displayRemoveVideoSubmit
*
* Remove video doesn't actually physically delete the video from FCMS, it
* just sets the video to in-active in the DB, which removes it from view.
*
* We don't want to delete these entries from the db, because the cron importer
* will just continue to import them.
*
* @return void
*/
function displayRemoveVideoSubmit()
{
if (!isset($_POST['id']) || !isset($_POST['source_id'])) {
$this->displayHeader();
echo '<div class="error_alert">' . T_('Can\'t remove video. Missing video id.') . '</div>';
$this->displayFooter();
return;
}
$userId = (int) $_GET['u'];
$id = (int) $_POST['id'];
$sourceId = $_POST['source_id'];
$sql = "UPDATE `fcms_video`\n SET `active` = 0,\n `updated` = NOW(),\n `updated_id` = ?\n WHERE `id` = ?";
if (!$this->fcmsDatabase->update($sql, array($this->fcmsUser->id, $id))) {
$this->displayFooter();
$this->fcmsError->displayError();
$this->displayFooter();
return;
}
if (isset($_POST['delete_youtube'])) {
$sessionToken = $this->getSessionToken($this->fcmsUser->id);
$youtubeConfig = getYouTubeConfigData();
$httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $sessionToken);
if ($httpClient === false) {
// Error message was already displayed by getYouTubeAuthSubHttpClient()
$this->displayFooter();
return;
}
$youTubeService = new Zend_Gdata_YouTube($httpClient);
$videoEntry = $youTubeService->getVideoEntry($sourceId);
// Set message
$_SESSION['message'] = 'delete_video_youtube';
$youTubeService->delete($videoEntry);
}
// Set message
if (!isset($_SESSION['message'])) {
$_SESSION['message'] = 'remove_video';
}
// Send back to user's video listing
header("Location: video.php?u={$userId}");
}