| changeset 807 | 877f952ae2bd |
| parent 207 | 621fa6caec0c |
| child 1230 | 68c69c656a2c |
| 805:5e7a0fedabdf | 807:877f952ae2bd |
|---|---|
14 * to license@zend.com so we can send you a copy immediately. |
14 * to license@zend.com so we can send you a copy immediately. |
15 * |
15 * |
16 * @category Zend |
16 * @category Zend |
17 * @package Zend_Gdata |
17 * @package Zend_Gdata |
18 * @subpackage YouTube |
18 * @subpackage YouTube |
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
21 * @version $Id: YouTube.php 20096 2010-01-06 02:05:09Z bkarwin $ |
21 * @version $Id: YouTube.php 24796 2012-05-12 03:34:26Z adamlundrigan $ |
22 */ |
22 */ |
23 |
23 |
24 /** |
24 /** |
25 * @see Zend_Gdata_Media |
25 * @see Zend_Gdata_Media |
26 */ |
26 */ |
77 * @link http://code.google.com/apis/youtube/ |
77 * @link http://code.google.com/apis/youtube/ |
78 * |
78 * |
79 * @category Zend |
79 * @category Zend |
80 * @package Zend_Gdata |
80 * @package Zend_Gdata |
81 * @subpackage YouTube |
81 * @subpackage YouTube |
82 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
82 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
83 * @license http://framework.zend.com/license/new-bsd New BSD License |
83 * @license http://framework.zend.com/license/new-bsd New BSD License |
84 */ |
84 */ |
85 class Zend_Gdata_YouTube extends Zend_Gdata_Media |
85 class Zend_Gdata_YouTube extends Zend_Gdata_Media |
86 { |
86 { |
87 |
87 |
88 const AUTH_SERVICE_NAME = 'youtube'; |
88 const AUTH_SERVICE_NAME = 'youtube'; |
89 const CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'; |
89 const CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'; |
90 |
90 |
91 const STANDARD_TOP_RATED_URI = 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated'; |
91 const STANDARD_TOP_RATED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'; |
92 const STANDARD_MOST_VIEWED_URI = 'http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'; |
92 const STANDARD_MOST_VIEWED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'; |
93 const STANDARD_RECENTLY_FEATURED_URI = 'http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'; |
93 const STANDARD_RECENTLY_FEATURED_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'; |
94 const STANDARD_WATCH_ON_MOBILE_URI = 'http://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'; |
94 const STANDARD_WATCH_ON_MOBILE_URI = 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'; |
95 |
95 |
96 const STANDARD_TOP_RATED_URI_V2 = |
96 const STANDARD_TOP_RATED_URI_V2 = |
97 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated'; |
97 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated'; |
98 const STANDARD_MOST_VIEWED_URI_V2 = |
98 const STANDARD_MOST_VIEWED_URI_V2 = |
99 'http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'; |
99 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'; |
100 const STANDARD_RECENTLY_FEATURED_URI_V2 = |
100 const STANDARD_RECENTLY_FEATURED_URI_V2 = |
101 'http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'; |
101 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'; |
102 const STANDARD_WATCH_ON_MOBILE_URI_V2 = |
102 const STANDARD_WATCH_ON_MOBILE_URI_V2 = |
103 'http://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'; |
103 'https://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'; |
104 |
104 |
105 const USER_URI = 'http://gdata.youtube.com/feeds/api/users'; |
105 const USER_URI = 'https://gdata.youtube.com/feeds/api/users'; |
106 const VIDEO_URI = 'http://gdata.youtube.com/feeds/api/videos'; |
106 const VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos'; |
107 const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'; |
107 const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'; |
108 const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'; |
108 const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'; |
109 const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'; |
109 const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'; |
110 const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'; |
110 const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'; |
111 const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'; |
111 const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'; |
112 const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'; |
112 const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'; |
113 const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'; |
113 const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'; |
114 const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'; |
114 const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'; |
115 const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'; |
115 const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'; |
116 const ACTIVITY_FEED_URI = 'http://gdata.youtube.com/feeds/api/events'; |
116 const ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/events'; |
117 const FRIEND_ACTIVITY_FEED_URI = |
117 const FRIEND_ACTIVITY_FEED_URI = |
118 'http://gdata.youtube.com/feeds/api/users/default/friendsactivity'; |
118 'https://gdata.youtube.com/feeds/api/users/default/friendsactivity'; |
119 |
119 |
120 /** |
120 /** |
121 * The URI of the in-reply-to schema for comments in reply to |
121 * The URI of the in-reply-to schema for comments in reply to |
122 * other comments. |
122 * other comments. |
123 * |
123 * |
130 * The URI of the inbox feed for the currently authenticated user. |
130 * The URI of the inbox feed for the currently authenticated user. |
131 * |
131 * |
132 * @var string |
132 * @var string |
133 */ |
133 */ |
134 const INBOX_FEED_URI = |
134 const INBOX_FEED_URI = |
135 'http://gdata.youtube.com/feeds/api/users/default/inbox'; |
135 'https://gdata.youtube.com/feeds/api/users/default/inbox'; |
136 |
136 |
137 /** |
137 /** |
138 * The maximum number of users for which activity can be requested for, |
138 * The maximum number of users for which activity can be requested for, |
139 * as enforced by the API. |
139 * as enforced by the API. |
140 * |
140 * |
254 public function getVideoFeed($location = null) |
254 public function getVideoFeed($location = null) |
255 { |
255 { |
256 if ($location == null) { |
256 if ($location == null) { |
257 $uri = self::VIDEO_URI; |
257 $uri = self::VIDEO_URI; |
258 } else if ($location instanceof Zend_Gdata_Query) { |
258 } else if ($location instanceof Zend_Gdata_Query) { |
259 $uri = $location->getQueryUrl(); |
259 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
260 } else { |
260 } else { |
261 $uri = $location; |
261 $uri = $location; |
262 } |
262 } |
263 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
263 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
264 } |
264 } |
284 return $this->getFullVideoEntry($videoId); |
284 return $this->getFullVideoEntry($videoId); |
285 } else { |
285 } else { |
286 $uri = self::VIDEO_URI . "/" . $videoId; |
286 $uri = self::VIDEO_URI . "/" . $videoId; |
287 } |
287 } |
288 } else if ($location instanceof Zend_Gdata_Query) { |
288 } else if ($location instanceof Zend_Gdata_Query) { |
289 $uri = $location->getQueryUrl(); |
289 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
290 } else { |
290 } else { |
291 $uri = $location; |
291 $uri = $location; |
292 } |
292 } |
293 return parent::getEntry($uri, 'Zend_Gdata_YouTube_VideoEntry'); |
293 return parent::getEntry($uri, 'Zend_Gdata_YouTube_VideoEntry'); |
294 } |
294 } |
322 { |
322 { |
323 if ($videoId !== null) { |
323 if ($videoId !== null) { |
324 $uri = self::VIDEO_URI . "/" . $videoId . "/" . |
324 $uri = self::VIDEO_URI . "/" . $videoId . "/" . |
325 self::RELATED_URI_SUFFIX; |
325 self::RELATED_URI_SUFFIX; |
326 } else if ($location instanceof Zend_Gdata_Query) { |
326 } else if ($location instanceof Zend_Gdata_Query) { |
327 $uri = $location->getQueryUrl(); |
327 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
328 } else { |
328 } else { |
329 $uri = $location; |
329 $uri = $location; |
330 } |
330 } |
331 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
331 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
332 } |
332 } |
344 { |
344 { |
345 if ($videoId !== null) { |
345 if ($videoId !== null) { |
346 $uri = self::VIDEO_URI . "/" . $videoId . "/" . |
346 $uri = self::VIDEO_URI . "/" . $videoId . "/" . |
347 self::RESPONSES_URI_SUFFIX; |
347 self::RESPONSES_URI_SUFFIX; |
348 } else if ($location instanceof Zend_Gdata_Query) { |
348 } else if ($location instanceof Zend_Gdata_Query) { |
349 $uri = $location->getQueryUrl(); |
349 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
350 } else { |
350 } else { |
351 $uri = $location; |
351 $uri = $location; |
352 } |
352 } |
353 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
353 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
354 } |
354 } |
365 public function getVideoCommentFeed($videoId = null, $location = null) |
365 public function getVideoCommentFeed($videoId = null, $location = null) |
366 { |
366 { |
367 if ($videoId !== null) { |
367 if ($videoId !== null) { |
368 $uri = self::VIDEO_URI . "/" . $videoId . "/comments"; |
368 $uri = self::VIDEO_URI . "/" . $videoId . "/comments"; |
369 } else if ($location instanceof Zend_Gdata_Query) { |
369 } else if ($location instanceof Zend_Gdata_Query) { |
370 $uri = $location->getQueryUrl(); |
370 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
371 } else { |
371 } else { |
372 $uri = $location; |
372 $uri = $location; |
373 } |
373 } |
374 return parent::getFeed($uri, 'Zend_Gdata_YouTube_CommentFeed'); |
374 return parent::getFeed($uri, 'Zend_Gdata_YouTube_CommentFeed'); |
375 } |
375 } |
396 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
396 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
397 if (!isset($location->url)) { |
397 if (!isset($location->url)) { |
398 $location->setFeedType('top rated'); |
398 $location->setFeedType('top rated'); |
399 } |
399 } |
400 } |
400 } |
401 $uri = $location->getQueryUrl(); |
401 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
402 } else { |
402 } else { |
403 $uri = $location; |
403 $uri = $location; |
404 } |
404 } |
405 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
405 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
406 } |
406 } |
428 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
428 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
429 if (!isset($location->url)) { |
429 if (!isset($location->url)) { |
430 $location->setFeedType('most viewed'); |
430 $location->setFeedType('most viewed'); |
431 } |
431 } |
432 } |
432 } |
433 $uri = $location->getQueryUrl(); |
433 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
434 } else { |
434 } else { |
435 $uri = $location; |
435 $uri = $location; |
436 } |
436 } |
437 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
437 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
438 } |
438 } |
459 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
459 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
460 if (!isset($location->url)) { |
460 if (!isset($location->url)) { |
461 $location->setFeedType('recently featured'); |
461 $location->setFeedType('recently featured'); |
462 } |
462 } |
463 } |
463 } |
464 $uri = $location->getQueryUrl(); |
464 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
465 } else { |
465 } else { |
466 $uri = $location; |
466 $uri = $location; |
467 } |
467 } |
468 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
468 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
469 } |
469 } |
491 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
491 if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { |
492 if (!isset($location->url)) { |
492 if (!isset($location->url)) { |
493 $location->setFeedType('watch on mobile'); |
493 $location->setFeedType('watch on mobile'); |
494 } |
494 } |
495 } |
495 } |
496 $uri = $location->getQueryUrl(); |
496 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
497 } else { |
497 } else { |
498 $uri = $location; |
498 $uri = $location; |
499 } |
499 } |
500 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
500 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
501 } |
501 } |
511 public function getPlaylistListFeed($user = null, $location = null) |
511 public function getPlaylistListFeed($user = null, $location = null) |
512 { |
512 { |
513 if ($user !== null) { |
513 if ($user !== null) { |
514 $uri = self::USER_URI . '/' . $user . '/playlists'; |
514 $uri = self::USER_URI . '/' . $user . '/playlists'; |
515 } else if ($location instanceof Zend_Gdata_Query) { |
515 } else if ($location instanceof Zend_Gdata_Query) { |
516 $uri = $location->getQueryUrl(); |
516 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
517 } else { |
517 } else { |
518 $uri = $location; |
518 $uri = $location; |
519 } |
519 } |
520 return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistListFeed'); |
520 return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistListFeed'); |
521 } |
521 } |
529 * the specified URL. |
529 * the specified URL. |
530 */ |
530 */ |
531 public function getPlaylistVideoFeed($location) |
531 public function getPlaylistVideoFeed($location) |
532 { |
532 { |
533 if ($location instanceof Zend_Gdata_Query) { |
533 if ($location instanceof Zend_Gdata_Query) { |
534 $uri = $location->getQueryUrl(); |
534 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
535 } else { |
535 } else { |
536 $uri = $location; |
536 $uri = $location; |
537 } |
537 } |
538 return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistVideoFeed'); |
538 return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistVideoFeed'); |
539 } |
539 } |
549 public function getSubscriptionFeed($user = null, $location = null) |
549 public function getSubscriptionFeed($user = null, $location = null) |
550 { |
550 { |
551 if ($user !== null) { |
551 if ($user !== null) { |
552 $uri = self::USER_URI . '/' . $user . '/subscriptions'; |
552 $uri = self::USER_URI . '/' . $user . '/subscriptions'; |
553 } else if ($location instanceof Zend_Gdata_Query) { |
553 } else if ($location instanceof Zend_Gdata_Query) { |
554 $uri = $location->getQueryUrl(); |
554 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
555 } else { |
555 } else { |
556 $uri = $location; |
556 $uri = $location; |
557 } |
557 } |
558 return parent::getFeed($uri, 'Zend_Gdata_YouTube_SubscriptionFeed'); |
558 return parent::getFeed($uri, 'Zend_Gdata_YouTube_SubscriptionFeed'); |
559 } |
559 } |
569 public function getContactFeed($user = null, $location = null) |
569 public function getContactFeed($user = null, $location = null) |
570 { |
570 { |
571 if ($user !== null) { |
571 if ($user !== null) { |
572 $uri = self::USER_URI . '/' . $user . '/contacts'; |
572 $uri = self::USER_URI . '/' . $user . '/contacts'; |
573 } else if ($location instanceof Zend_Gdata_Query) { |
573 } else if ($location instanceof Zend_Gdata_Query) { |
574 $uri = $location->getQueryUrl(); |
574 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
575 } else { |
575 } else { |
576 $uri = $location; |
576 $uri = $location; |
577 } |
577 } |
578 return parent::getFeed($uri, 'Zend_Gdata_YouTube_ContactFeed'); |
578 return parent::getFeed($uri, 'Zend_Gdata_YouTube_ContactFeed'); |
579 } |
579 } |
590 { |
590 { |
591 if ($user !== null) { |
591 if ($user !== null) { |
592 $uri = self::USER_URI . '/' . $user . '/' . |
592 $uri = self::USER_URI . '/' . $user . '/' . |
593 self::UPLOADS_URI_SUFFIX; |
593 self::UPLOADS_URI_SUFFIX; |
594 } else if ($location instanceof Zend_Gdata_Query) { |
594 } else if ($location instanceof Zend_Gdata_Query) { |
595 $uri = $location->getQueryUrl(); |
595 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
596 } else { |
596 } else { |
597 $uri = $location; |
597 $uri = $location; |
598 } |
598 } |
599 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
599 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
600 } |
600 } |
611 { |
611 { |
612 if ($user !== null) { |
612 if ($user !== null) { |
613 $uri = self::USER_URI . '/' . $user . '/' . |
613 $uri = self::USER_URI . '/' . $user . '/' . |
614 self::FAVORITES_URI_SUFFIX; |
614 self::FAVORITES_URI_SUFFIX; |
615 } else if ($location instanceof Zend_Gdata_Query) { |
615 } else if ($location instanceof Zend_Gdata_Query) { |
616 $uri = $location->getQueryUrl(); |
616 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
617 } else { |
617 } else { |
618 $uri = $location; |
618 $uri = $location; |
619 } |
619 } |
620 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
620 return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); |
621 } |
621 } |
631 public function getUserProfile($user = null, $location = null) |
631 public function getUserProfile($user = null, $location = null) |
632 { |
632 { |
633 if ($user !== null) { |
633 if ($user !== null) { |
634 $uri = self::USER_URI . '/' . $user; |
634 $uri = self::USER_URI . '/' . $user; |
635 } else if ($location instanceof Zend_Gdata_Query) { |
635 } else if ($location instanceof Zend_Gdata_Query) { |
636 $uri = $location->getQueryUrl(); |
636 $uri = $location->getQueryUrl($this->getMajorProtocolVersion()); |
637 } else { |
637 } else { |
638 $uri = $location; |
638 $uri = $location; |
639 } |
639 } |
640 return parent::getEntry($uri, 'Zend_Gdata_YouTube_UserProfileEntry'); |
640 return parent::getEntry($uri, 'Zend_Gdata_YouTube_UserProfileEntry'); |
641 } |
641 } |
695 * @param string $url The location as a string URL |
695 * @param string $url The location as a string URL |
696 * @throws Zend_Gdata_App_Exception |
696 * @throws Zend_Gdata_App_Exception |
697 * @return array An array containing a token and URL |
697 * @return array An array containing a token and URL |
698 */ |
698 */ |
699 public function getFormUploadToken($videoEntry, |
699 public function getFormUploadToken($videoEntry, |
700 $url='http://gdata.youtube.com/action/GetUploadToken') |
700 $url='https://gdata.youtube.com/action/GetUploadToken') |
701 { |
701 { |
702 if ($url != null && is_string($url)) { |
702 if ($url != null && is_string($url)) { |
703 // $response is a Zend_Http_response object |
703 // $response is a Zend_Http_response object |
704 $response = $this->post($videoEntry, $url); |
704 $response = $this->post($videoEntry, $url); |
705 return self::parseFormUploadTokenResponse($response->getBody()); |
705 return self::parseFormUploadTokenResponse($response->getBody()); |
727 'are not available in API version 1.'); |
727 'are not available in API version 1.'); |
728 } |
728 } |
729 |
729 |
730 $uri = null; |
730 $uri = null; |
731 if ($username instanceof Zend_Gdata_Query) { |
731 if ($username instanceof Zend_Gdata_Query) { |
732 $uri = $username->getQueryUrl(); |
732 $uri = $username->getQueryUrl($this->getMajorProtocolVersion()); |
733 } else { |
733 } else { |
734 if (count(explode(',', $username)) > |
734 if (count(explode(',', $username)) > |
735 self::ACTIVITY_FEED_MAX_USERS) { |
735 self::ACTIVITY_FEED_MAX_USERS) { |
736 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; |
736 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; |
737 throw new Zend_Gdata_App_InvalidArgumentException( |
737 throw new Zend_Gdata_App_InvalidArgumentException( |
832 } |
832 } |
833 $messageEntry->setId($this->newId($videoId)); |
833 $messageEntry->setId($this->newId($videoId)); |
834 $messageEntry->setSummary($this->newSummary($body)); |
834 $messageEntry->setSummary($this->newSummary($body)); |
835 } |
835 } |
836 |
836 |
837 $insertUrl = 'http://gdata.youtube.com/feeds/api/users/' . |
837 $insertUrl = 'https://gdata.youtube.com/feeds/api/users/' . |
838 $recipientUserName . '/inbox'; |
838 $recipientUserName . '/inbox'; |
839 $response = $this->insertEntry($messageEntry, $insertUrl, |
839 $response = $this->insertEntry($messageEntry, $insertUrl, |
840 'Zend_Gdata_YouTube_InboxEntry'); |
840 'Zend_Gdata_YouTube_InboxEntry'); |
841 return $response; |
841 return $response; |
842 } |
842 } |
843 |
843 |
844 /** |
844 /** |
845 * Post a comment in reply to an existing comment |
845 * Post a comment in reply to an existing comment |
846 * |
846 * |
847 * @param $commentEntry Zend_Gdata_YouTube_CommentEntry The comment entry |
847 * @param Zend_Gdata_YouTube_CommentEntry $commentEntry The comment entry |
848 * to reply to |
848 * to reply to |
849 * @param $commentText string The text of the comment to post |
849 * @param string $commentText The text of the |
850 * @return A Zend_Gdata_YouTube_CommentEntry representing the posted |
850 * comment to post |
851 * comment |
851 * @return Zend_Gdata_YouTube_CommentEntry the posted comment |
852 */ |
852 */ |
853 public function replyToCommentEntry($commentEntry, $commentText) |
853 public function replyToCommentEntry($commentEntry, $commentText) |
854 { |
854 { |
855 $newComment = $this->newCommentEntry(); |
855 $newComment = $this->newCommentEntry(); |
856 $newComment->content = $this->newContent()->setText($commentText); |
856 $newComment->content = $this->newContent()->setText($commentText); |