Permalink
Browse files

work in progress - start adding support for Google+ albums URLs when …

…syncing
  • Loading branch information...
1 parent 87f90af commit cbeb7cc5706c0cee36e39ce1df88c88604d16470 @toppa committed Apr 7, 2012
Showing with 18 additions and 9 deletions.
  1. +2 −2 Admin/Display/toolsAlbums.php
  2. +1 −1 Admin/ShashinContainer.php
  3. +15 −6 Admin/ShashinMenuActionHandlerAlbums.php
@@ -118,8 +118,8 @@
<dd>Example: http://api.flickr.com/services/feeds/photos_public.gne?id=65384822@N00&amp;lang=en-us&amp;format=rss_200</dd>
-->
</dl>
-<p><strong><?php _e("RSS URL:", 'shashin'); ?></strong>
-<?php echo ToppaHtmlFormField::quickBuild('rssUrl', $refData['dataUrl']); ?><br />
+<p><strong><?php _e("URL:", 'shashin'); ?></strong>
+<?php echo ToppaHtmlFormField::quickBuild('userUrl', $refData['dataUrl']); ?><br />
<?php _e("Include album's photos in random photo displays?", 'shashin'); ?>
<?php echo ToppaHtmlFormField::quickBuild('includeInRandom', $refData['includeInRandom'], "Y"); ?></p>
@@ -159,7 +159,7 @@ public function getSynchronizerTwitpic(array $request = null) {
private function setupSynchronizer($synchronizer, $type, $request = null) {
if ($request) {
- $synchronizer->setRssUrl($request['rssUrl']);
+ $synchronizer->setRssUrl($request['userUrl']);
$synchronizer->setIncludeInRandom($request['includeInRandom']);
}
@@ -43,7 +43,7 @@ public function run() {
switch ($this->request['shashinAction']) {
case 'addAlbums':
$this->functionsFacade->checkAdminNonceFields('shashinNonceAdd', 'shashinNonceAdd');
- $message = $this->runSynchronizerBasedOnRssUrl();
+ $message = $this->runSynchronizerBasedOnUrl();
break;
case 'syncAlbum':
$this->functionsFacade->checkAdminNonceFields('shashinNonceSync_' . $this->request['id']);
@@ -70,30 +70,39 @@ public function run() {
return $this->menuDisplayer->run($message);
}
- public function runSynchronizerBasedOnRssUrl() {
+ // user albums: https://plus.google.com/100291303544453276374/photos
+ // an album's photos: https://plus.google.com/photos/100291303544453276374/albums/5725071897625277617
+ public function runSynchronizerBasedOnUrl() {
+ // if a non-RSS url, convert to the appropriate RSS url
+
+ // Google Plus - an individual album
+ if (strpos($this->request['userUrl'], 'plus.google.com/photos') !== false) {
+
+ }
+
// all of a Picasa user's albums
- if (strpos($this->request['rssUrl'], 'kind=album') !== false) {
+ if (strpos($this->request['userUrl'], 'kind=album') !== false) {
$synchronizer = $this->adminContainer->getSynchronizerPicasa($this->request);
$albumCount = $synchronizer->addMultipleAlbumsFromRssUrl();
return __('Added', 'shashin') . " $albumCount " . __('Picasa albums', 'shashin');
}
// a single Picasa album
- elseif (strpos($this->request['rssUrl'], 'kind=photo') !== false) {
+ elseif (strpos($this->request['userUrl'], 'kind=photo') !== false) {
$synchronizer = $this->adminContainer->getSynchronizerPicasa($this->request);
$syncedAlbum = $synchronizer->addSingleAlbumFromRssUrl();
return __('Added Picasa album', 'shashin') . ' "' . $syncedAlbum->title . '"';
}
// a YouTube feed
- elseif (strpos($this->request['rssUrl'], 'gdata.youtube.com') !== false) {
+ elseif (strpos($this->request['userUrl'], 'gdata.youtube.com') !== false) {
$synchronizer = $this->adminContainer->getSynchronizerYoutube($this->request);
$syncedAlbum = $synchronizer->addSingleAlbumFromRssUrl();
return __('Added YouTube videos', 'shashin') . ' "' . $syncedAlbum->title . '"';
}
// a Twitpic feed
- elseif (strpos($this->request['rssUrl'], 'twitpic.com/photos') !== false) {
+ elseif (strpos($this->request['userUrl'], 'twitpic.com/photos') !== false) {
$synchronizer = $this->adminContainer->getSynchronizerTwitpic($this->request);
$syncedAlbum = $synchronizer->addSingleAlbumFromRssUrl();
return __('Added Twitpic photos', 'shashin') . ' "' . $syncedAlbum->title . '"';

0 comments on commit cbeb7cc

Please sign in to comment.