mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Use short array declaration
This commit is contained in:
@@ -49,7 +49,7 @@ class databox_cgu
|
||||
|
||||
private static function getUnvalidated(Application $app, $home = false)
|
||||
{
|
||||
$terms = array();
|
||||
$terms = [];
|
||||
|
||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
try {
|
||||
@@ -71,7 +71,7 @@ class databox_cgu
|
||||
}
|
||||
|
||||
if ($userValidation)
|
||||
$terms[$name] = array('sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update);
|
||||
$terms[$name] = ['sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update];
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
@@ -20,14 +20,14 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $elements = array();
|
||||
protected $elements = [];
|
||||
|
||||
/**
|
||||
* Cache array for the get element by name function
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $cache_name_id = array();
|
||||
protected $cache_name_id = [];
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -116,7 +116,7 @@ class databox_field implements cache_cacheableInterface
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $labels = array();
|
||||
protected $labels = [];
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -138,7 +138,7 @@ class databox_field implements cache_cacheableInterface
|
||||
* @var int
|
||||
*/
|
||||
protected $sbas_id;
|
||||
protected static $_instance = array();
|
||||
protected static $_instance = [];
|
||||
protected $dces_element;
|
||||
protected $Vocabulary;
|
||||
protected $VocabularyType;
|
||||
@@ -192,7 +192,7 @@ class databox_field implements cache_cacheableInterface
|
||||
FROM metadatas_structure WHERE id=:id";
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute(array(':id' => $id));
|
||||
$stmt->execute([':id' => $id]);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -209,7 +209,7 @@ class databox_field implements cache_cacheableInterface
|
||||
$this->on_error = true;
|
||||
}
|
||||
|
||||
foreach (array('en', 'fr', 'de', 'nl') as $code) {
|
||||
foreach (['en', 'fr', 'de', 'nl'] as $code) {
|
||||
$this->labels[$code] = $row['label_' . $code];
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ class databox_field implements cache_cacheableInterface
|
||||
$connbas = $this->get_connection();
|
||||
$sql = 'DELETE FROM metadatas_structure WHERE id = :id';
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute(array(':id' => $this->get_id()));
|
||||
$stmt->execute([':id' => $this->get_id()]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$dom_struct = $this->databox->get_dom_structure();
|
||||
@@ -389,7 +389,7 @@ class databox_field implements cache_cacheableInterface
|
||||
`label_nl` = :label_nl
|
||||
WHERE id = :id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':name' => $this->name,
|
||||
':source' => $this->tag->getTagname(),
|
||||
':indexable' => $this->indexable ? '1' : '0',
|
||||
@@ -410,7 +410,7 @@ class databox_field implements cache_cacheableInterface
|
||||
':label_fr' => isset($this->labels['fr']) ? $this->labels['fr'] : null,
|
||||
':label_de' => isset($this->labels['de']) ? $this->labels['de'] : null,
|
||||
':label_nl' => isset($this->labels['nl']) ? $this->labels['nl'] : null
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -611,9 +611,9 @@ class databox_field implements cache_cacheableInterface
|
||||
SET dces_element = null WHERE dces_element = :dces_element';
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute(array(
|
||||
$stmt->execute([
|
||||
':dces_element' => $DCES_element->get_label()
|
||||
));
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
@@ -621,10 +621,10 @@ class databox_field implements cache_cacheableInterface
|
||||
SET dces_element = :dces_element WHERE id = :id';
|
||||
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute(array(
|
||||
$stmt->execute([
|
||||
':dces_element' => $DCES_element ? $DCES_element->get_label() : null
|
||||
, ':id' => $this->id
|
||||
));
|
||||
]);
|
||||
$stmt->closeCursor();
|
||||
$this->dces_element = $DCES_element;
|
||||
|
||||
@@ -925,7 +925,7 @@ class databox_field implements cache_cacheableInterface
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'sbas-id' => $this->sbas_id,
|
||||
'labels' => $this->labels,
|
||||
@@ -945,7 +945,7 @@ class databox_field implements cache_cacheableInterface
|
||||
'dces-element' => $this->dces_element ? $this->dces_element->get_label() : null,
|
||||
'vocabulary-type' => $this->Vocabulary ? $this->Vocabulary->getType() : null,
|
||||
'vocabulary-restricted' => $this->VocabularyRestriction,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -990,7 +990,7 @@ class databox_field implements cache_cacheableInterface
|
||||
$multi = $multi ? 1 : 0;
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':name' => $name, ':sorter' => $sorter, ':multi' => $multi));
|
||||
$stmt->execute([':name' => $name, ':sorter' => $sorter, ':multi' => $multi]);
|
||||
$id = $databox->get_connection()->lastInsertId();
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -1014,9 +1014,9 @@ class databox_field implements cache_cacheableInterface
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
$vars = array();
|
||||
$vars = [];
|
||||
foreach ($this as $key => $value) {
|
||||
if (in_array($key, array('databox', 'app', 'Vocabulary')))
|
||||
if (in_array($key, ['databox', 'app', 'Vocabulary']))
|
||||
continue;
|
||||
$vars[] = $key;
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ class databox_status
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private static $_status = array();
|
||||
private static $_status = [];
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -38,7 +38,7 @@ class databox_status
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private $status = array();
|
||||
private $status = [];
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -59,7 +59,7 @@ class databox_status
|
||||
*/
|
||||
private function __construct(Application $app, $sbas_id)
|
||||
{
|
||||
$this->status = array();
|
||||
$this->status = [];
|
||||
|
||||
$path = $url = false;
|
||||
|
||||
@@ -138,7 +138,7 @@ class databox_status
|
||||
|
||||
$sbas_ids = $app['acl']->get($app['authentication']->getUser())->get_granted_sbas();
|
||||
|
||||
$statuses = array();
|
||||
$statuses = [];
|
||||
|
||||
foreach ($sbas_ids as $databox) {
|
||||
try {
|
||||
@@ -155,11 +155,11 @@ class databox_status
|
||||
|
||||
public static function getSearchStatus(Application $app)
|
||||
{
|
||||
$statuses = array();
|
||||
$statuses = [];
|
||||
|
||||
$sbas_ids = $app['acl']->get($app['authentication']->getUser())->get_granted_sbas();
|
||||
|
||||
$see_all = array();
|
||||
$see_all = [];
|
||||
|
||||
foreach ($sbas_ids as $databox) {
|
||||
$see_all[$databox->get_sbas_id()] = false;
|
||||
@@ -177,7 +177,7 @@ class databox_status
|
||||
}
|
||||
}
|
||||
|
||||
$stats = array();
|
||||
$stats = [];
|
||||
|
||||
foreach ($statuses as $sbas_id => $status) {
|
||||
|
||||
@@ -202,31 +202,31 @@ class databox_status
|
||||
}
|
||||
}
|
||||
if (! $set) {
|
||||
$stats[$bit][] = array(
|
||||
'sbas' => array($sbas_id),
|
||||
$stats[$bit][] = [
|
||||
'sbas' => [$sbas_id],
|
||||
'labeloff' => $props['labeloff'],
|
||||
'labelon' => $props['labelon'],
|
||||
'labels_on_i18n' => $props['labels_on_i18n'],
|
||||
'labels_off_i18n' => $props['labels_off_i18n'],
|
||||
'imgoff' => $props['img_off'],
|
||||
'imgon' => $props['img_on']
|
||||
);
|
||||
];
|
||||
$set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $set) {
|
||||
$stats[$bit] = array(
|
||||
array(
|
||||
'sbas' => array($sbas_id),
|
||||
$stats[$bit] = [
|
||||
[
|
||||
'sbas' => [$sbas_id],
|
||||
'labeloff' => $props['labeloff'],
|
||||
'labelon' => $props['labelon'],
|
||||
'labels_on_i18n' => $props['labels_on_i18n'],
|
||||
'labels_off_i18n' => $props['labels_off_i18n'],
|
||||
'imgoff' => $props['img_off'],
|
||||
'imgon' => $props['img_on']
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class databox_status
|
||||
{
|
||||
$status = self::getStatus($app, $sbas_id);
|
||||
|
||||
$switch = in_array($switch, array('on', 'off')) ? $switch : false;
|
||||
$switch = in_array($switch, ['on', 'off']) ? $switch : false;
|
||||
|
||||
if (! $switch) {
|
||||
return false;
|
||||
@@ -407,7 +407,7 @@ class databox_status
|
||||
|
||||
public static function updateIcon(Application $app, $sbas_id, $bit, $switch, UploadedFile $file)
|
||||
{
|
||||
$switch = in_array($switch, array('on', 'off')) ? $switch : false;
|
||||
$switch = in_array($switch, ['on', 'off']) ? $switch : false;
|
||||
|
||||
if (! $switch) {
|
||||
throw new Exception_InvalidArgument();
|
||||
|
@@ -31,20 +31,20 @@ class databox_subdef
|
||||
* @var string
|
||||
*/
|
||||
protected $class;
|
||||
protected $devices = array();
|
||||
protected $devices = [];
|
||||
protected $name;
|
||||
protected $path;
|
||||
protected $subdef_group;
|
||||
protected $labels = array();
|
||||
protected $labels = [];
|
||||
protected $write_meta;
|
||||
protected $downloadable;
|
||||
protected static $mediaTypeToSubdefTypes = array(
|
||||
SubdefType::TYPE_AUDIO => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_AUDIO),
|
||||
SubdefType::TYPE_DOCUMENT => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_FLEXPAPER),
|
||||
SubdefType::TYPE_FLASH => array(SubdefSpecs::TYPE_IMAGE),
|
||||
SubdefType::TYPE_IMAGE => array(SubdefSpecs::TYPE_IMAGE),
|
||||
SubdefType::TYPE_VIDEO => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_VIDEO, SubdefSpecs::TYPE_ANIMATION),
|
||||
);
|
||||
protected static $mediaTypeToSubdefTypes = [
|
||||
SubdefType::TYPE_AUDIO => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_AUDIO],
|
||||
SubdefType::TYPE_DOCUMENT => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_FLEXPAPER],
|
||||
SubdefType::TYPE_FLASH => [SubdefSpecs::TYPE_IMAGE],
|
||||
SubdefType::TYPE_IMAGE => [SubdefSpecs::TYPE_IMAGE],
|
||||
SubdefType::TYPE_VIDEO => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_VIDEO, SubdefSpecs::TYPE_ANIMATION],
|
||||
];
|
||||
|
||||
const CLASS_THUMBNAIL = 'thumbnail';
|
||||
const CLASS_PREVIEW = 'preview';
|
||||
@@ -194,16 +194,16 @@ class databox_subdef
|
||||
*/
|
||||
public function getAvailableSubdefTypes()
|
||||
{
|
||||
$subdefTypes = array();
|
||||
$subdefTypes = [];
|
||||
|
||||
$availableDevices = array(
|
||||
$availableDevices = [
|
||||
self::DEVICE_ALL,
|
||||
self::DEVICE_HANDHELD,
|
||||
self::DEVICE_PRINT,
|
||||
self::DEVICE_PROJECTION,
|
||||
self::DEVICE_SCREEN,
|
||||
self::DEVICE_TV,
|
||||
);
|
||||
];
|
||||
|
||||
if (isset(self::$mediaTypeToSubdefTypes[$this->subdef_group->getType()])) {
|
||||
|
||||
|
@@ -20,7 +20,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
protected $AvSubdefs = array();
|
||||
protected $AvSubdefs = [];
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -76,13 +76,13 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
{
|
||||
$sx_struct = $this->databox->get_sxml_structure();
|
||||
|
||||
$this->AvSubdefs = array(
|
||||
'image' => array(),
|
||||
'video' => array(),
|
||||
'audio' => array(),
|
||||
'document' => array(),
|
||||
'flash' => array()
|
||||
);
|
||||
$this->AvSubdefs = [
|
||||
'image' => [],
|
||||
'video' => [],
|
||||
'audio' => [],
|
||||
'document' => [],
|
||||
'flash' => []
|
||||
];
|
||||
|
||||
if (! $sx_struct) {
|
||||
return $this;
|
||||
@@ -94,7 +94,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
|
||||
$subdefgroup_name = strtolower($subdefs->attributes()->name);
|
||||
|
||||
if ( ! isset($AvSubdefs[$subdefgroup_name])) {
|
||||
$AvSubdefs[$subdefgroup_name] = array();
|
||||
$AvSubdefs[$subdefgroup_name] = [];
|
||||
}
|
||||
|
||||
foreach ($subdefs as $sd) {
|
||||
|
Reference in New Issue
Block a user