/** * Returns a list of JomSocial albums and photos * * @access public * @param null * @return null */ public function listFlickrItems() { $ajax = EasyBlogHelper::getHelper('Ajax'); $cfg = EasyBlogHelper::getConfig(); $my = JFactory::getUser(); $profile = EasyBlogHelper::getTable('Profile'); $profile->load($my->id); // Show an error message if someone tries to force their way in. if (!$cfg->get('layout_media_flickr')) { return $ajax->fail(JText::_('COM_EASYBLOG_THIS_FEATURED_IS_DISABLED')); } // @rule: Test if the user is really logged in or not. if ($my->id <= 0) { return $ajax->fail(JText::_('COM_EASYBLOG_THIS_FEATURED_IS_DISABLED')); } // @rule: Test if the user is already associated with Flickr $oauth = EasyBlogHelper::getTable('Oauth'); $associated = $oauth->loadByUser($my->id, EBLOG_OAUTH_FLICKR); if (!$associated) { return $ajax->fail(JText::_('Please associate your account with Flickr first.')); } $path = str_ireplace(array('/', '\\'), '', JRequest::getVar('path')); // If fromPath is passed in the query, we know that the user is querying an item instead. if (!empty($path)) { $media = new EasyBlogMediaManager(EBLOG_MEDIA_SOURCE_FLICKR); $item = $media->getItem($path, '')->toArray(); return $ajax->success($item); } $media = new EasyBlogMediaManager(EBLOG_MEDIA_SOURCE_FLICKR); $items = $media->getItems('', '')->toArray(); return $ajax->success($items); }
/** * Retrieves a list of system variations for the image type. */ public function getSystemVariations() { $variations = array('thumbnail', 'icon'); $fileName = $this->getTitle(); $result = array(); $uri = dirname($this->getURI()); // @task: Get all new 3.5 image items that has a prefix of EBLOG_SYSTEM_VARIATION_PREFIX foreach ($variations as $variation) { $systemVariationFile = dirname($this->file) . DIRECTORY_SEPARATOR . EBLOG_SYSTEM_VARIATION_PREFIX . '_' . $variation . '_' . $fileName; // @Legacy: Prior to 3.5 !IMPORTANT! // @task: Check if there are any missing items like thumbnail or icon. If it's missing, we need to fix this. if (!JFile::exists($systemVariationFile)) { $systemVariationFile = dirname($this->file) . DIRECTORY_SEPARATOR . 'thumb_' . $fileName; // If the legacy thumb item still doesn't exist, we just fall back to the original image :( // Otherwise we have nothing to show to the user. if (!JFile::exists($systemVariationFile)) { $systemVariationFile = $this->file; } } // @task: Get more information about the image variation. if (!$this->includeDimension) { $width = 0; $height = 0; } else { $info = @getimagesize($systemVariationFile); $width = $info[0]; $height = $info[1]; } $media = new EasyBlogMediaManager(); $data = $media->getItem($systemVariationFile, $uri, $this->relativePath, false, $this->place, false, false, true)->toObject(); $variationObj = $this->getVariationObject($data, $variation, $width, $height, false, $variation == 'thumbnail'); $result[] = $variationObj; } // @task: The original file is also treated as a variation if (!$this->includeDimension) { $width = 0; $height = 0; } else { $info = @getimagesize($this->file); $width = $info[0]; $height = $info[1]; } $media = new EasyBlogMediaManager(); $data = $media->getItem($this->file, dirname($this->getURI()), $this->relativePath, false, $this->place, false, false, true)->toObject(); $result[] = $this->getVariationObject($data, 'original', $width, $height, false, false); return $result; }