mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
38 lines
843 B
PHP
38 lines
843 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2012 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Border\Checker;
|
|
|
|
use Alchemy\Phrasea\Border\File;
|
|
use Doctrine\ORM\EntityManager;
|
|
|
|
class Extension implements Checker
|
|
{
|
|
protected $extensions;
|
|
|
|
public function __construct(array $extensions)
|
|
{
|
|
$this->extensions = array_map('strtolower', $extensions);
|
|
}
|
|
|
|
public function check(EntityManager $em, File $file)
|
|
{
|
|
$boolean = in_array(strtolower($file->getFile()->getExtension()), $this->extensions);
|
|
|
|
return new Response($boolean, $this);
|
|
}
|
|
|
|
public static function getMessage()
|
|
{
|
|
return _('The file does not match available extensions');
|
|
}
|
|
}
|