/** * Generate the album info * * @param int $total */ protected function compileAlbumInfo($total) { $metaData = $this->facebookAlbum->getMetaData(); // There is no information total number of images // or there are no extra images in the album if (empty($metaData) || !$metaData['count'] || $total >= $metaData['count']) { return; } $this->Template->info = sprintf($GLOBALS['TL_LANG']['MSC']['facebook_album.info'], $total, $metaData['count']); // Add the link if ($metaData['link']) { $this->Template->link = ['title' => specialchars($GLOBALS['TL_LANG']['MSC']['facebook_album.link']), 'href' => ampersand($metaData['link'])]; } }
/** * Update the Facebook albums */ public function updateAlbums() { $contentModels = \ContentModel::findBy('type', 'facebook_album'); if ($contentModels === null) { return; } $count = 0; /** @var \ContentModel $contentModel */ foreach ($contentModels as $contentModel) { $accountModel = AccountModel::findByPk($contentModel->accountModel); if ($accountModel === null) { continue; } $facebookAlbum = new FacebookAlbum($accountModel); $facebookAlbum->setAlbumId($contentModel->facebook_album); if ($facebookAlbum->isOutdated()) { $facebookAlbum->fetchImages(); $count++; } } if ($count > 0) { \System::log(sprintf('Facebook albums: %s have been updated', $count), __METHOD__, TL_CRON); } }