public function execute() { $params = $this->extractRequestParams(); $this->requireOnlyOneParameter($params, 'url', 'list'); $flickrBlacklist = new UploadWizardFlickrBlacklist(UploadWizardConfig::getConfig(), $this->getContext()); if ($params['list']) { $list = $flickrBlacklist->getBlacklist(); $this->getResult()->setIndexedTagName($list, 'item'); $this->getResult()->addValue('flickrblacklist', 'list', $list); } if (!is_null($params['url'])) { if ($flickrBlacklist->isBlacklisted($params['url'])) { $this->getResult()->addValue('flickrblacklist', 'result', 'bad'); } else { $this->getResult()->addValue('flickrblacklist', 'result', 'ok'); } } }
/** * Hook to blacklist flickr images by intercepting upload from url */ public static function onIsUploadAllowedFromUrl($url, &$allowed) { if ($allowed) { $flickrBlacklist = new UploadWizardFlickrBlacklist(UploadWizardConfig::getConfig(), RequestContext::getMain()); if ($flickrBlacklist->isBlacklisted($url)) { $allowed = false; } } return true; }