| Current Path : /home/megadansyp/www/components/com_eventgallery/library/folder/ |
| Current File : /home/megadansyp/www/components/com_eventgallery/library/folder/flickr.php |
<?php
/**
* @package Sven.Bluege
* @subpackage com_eventgallery
*
* @copyright Copyright (C) 2005 - 2019 Sven Bluege All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
use \Joomla\Component\Eventgallery\Site\Library\Connector\Flickr;
class EventgalleryLibraryFolderFlickr extends EventgalleryLibraryFolder
{
const ID = 2;
/**
* @var bool defines if we already updated this album during the request.
*/
private $_photoSet_updated = false;
/**
* @param int $limitstart
* @param int $limit
* @param int $imagesForEvents if true load the main images at the first position
* @return array
*/
public function getFiles($limitstart = 0, $limit = 0, $imagesForEvents = 0, $sortAttribute='', $sortDirection='ASC') {
$this->updatePhotoSet();
$result = parent::getFiles($limitstart, $limit, $imagesForEvents, $sortAttribute, $sortDirection);
if (EVENTGALLERY_EXTENDED || defined ('COM_EVENTGALLERY_I_USE_FLICKR_SINCE_A_LONG_TIME')) {
return $result;
} else {
return array_slice($result, 0, 30);
}
}
/**
* returns the photoset id
*
* @return string
*/
public function getPhotoSetId() {
return $this->_foldername;
}
/**
* Updates the photoset;
*
*/
public function updatePhotoSet() {
if ($this->_photoSet_updated === false) {
$this->_photoSet_updated = true;
$db = JFactory::getDbo();
$cachelifetime = $this->config->getGeneral()->getFlickrCacheLifetime();
$legacy_api_key = $this->config->getGeneral()->getFlickrAPIKey();
$account = $this->getFlickrAccount();
Flickr::updatePhotoSet($account, $cachelifetime, $db, $this->getPhotoSetId(), $legacy_api_key);
}
}
public function getFlickrAccountId() {
return $this->_folder->flickraccountid;
}
public function getFlickrTitle() {
return $this->_folder->flickrtitle;
}
public function getFlickrAccount() {
/**
* @var EventgalleryLibraryFactoryFlickraccount $accountFactory
*
*/
$accountFactory = EventgalleryLibraryFactoryFlickraccount::getInstance();
return $accountFactory->getAccountById($this->getFlickrAccountId());
}
public static function syncFolder($foldername, $use_htacces_to_protect_original_files) {
return ['status' => EventgalleryLibraryManagerFolder::$SYNC_STATUS_NOSYNC];
}
public static function findNewFolders() {
return Array();
}
public static function getFileFactory() {
return EventgalleryLibraryFactoryFileFlickr::getInstance();
}
public function isSortable() {
return false;
}
public function supportsFileUpload() {
return false;
}
public function supportsFileDeletion() {
return false;
}
public function supportsImageDataEditing() {
return false;
}
}