mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Use Short Array notation
This commit is contained in:
@@ -79,7 +79,7 @@ class API_OAuth2_Account
|
||||
WHERE api_account_id = :api_account_id';
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':api_account_id' => $this->id));
|
||||
$stmt->execute([':api_account_id' => $this->id]);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -141,10 +141,10 @@ class API_OAuth2_Account
|
||||
$sql = 'UPDATE api_accounts SET revoked = :revoked
|
||||
WHERE api_account_id = :account_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':revoked' => ($boolean ? '1' : '0')
|
||||
, 'account_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -209,7 +209,7 @@ class API_OAuth2_Account
|
||||
$sql = 'DELETE FROM api_accounts WHERE api_account_id = :account_id';
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array('account_id' => $this->id));
|
||||
$stmt->execute(['account_id' => $this->id]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
return;
|
||||
@@ -222,13 +222,13 @@ class API_OAuth2_Account
|
||||
VALUES (null, :usr_id, :revoked, :api_version, :application_id, :created)';
|
||||
|
||||
$datetime = new Datetime();
|
||||
$params = array(
|
||||
$params = [
|
||||
':usr_id' => $user->getId()
|
||||
, ':application_id' => $application->get_id()
|
||||
, ':api_version' => API_OAuth2_Adapter::API_VERSION
|
||||
, ':revoked' => 0
|
||||
, ':created' => $datetime->format("Y-m-d H:i:s")
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -244,10 +244,10 @@ class API_OAuth2_Account
|
||||
$sql = 'SELECT api_account_id FROM api_accounts
|
||||
WHERE usr_id = :usr_id AND application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
":usr_id" => $user->getId(),
|
||||
":application_id" => $application->get_id()
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
|
@@ -138,7 +138,7 @@ class API_OAuth2_Application
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':application_id' => $this->id));
|
||||
$stmt->execute([':application_id' => $this->id]);
|
||||
|
||||
if (0 === $stmt->rowCount()) {
|
||||
throw new NotFoundHttpException(sprintf('Application with id %d not found', $this->id));
|
||||
@@ -206,7 +206,7 @@ class API_OAuth2_Application
|
||||
*/
|
||||
public function set_type($type)
|
||||
{
|
||||
if ( ! in_array($type, array(self::DESKTOP_TYPE, self::WEB_TYPE)))
|
||||
if ( ! in_array($type, [self::DESKTOP_TYPE, self::WEB_TYPE]))
|
||||
throw new Exception_InvalidArgument();
|
||||
|
||||
$this->type = $type;
|
||||
@@ -217,10 +217,10 @@ class API_OAuth2_Application
|
||||
$sql = 'UPDATE api_applications SET type = :type, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':type' => $this->type
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -250,10 +250,10 @@ class API_OAuth2_Application
|
||||
$sql = 'UPDATE api_applications SET name = :name, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':name' => $this->name
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -284,10 +284,10 @@ class API_OAuth2_Application
|
||||
SET description = :description, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':description' => $this->description
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -318,10 +318,10 @@ class API_OAuth2_Application
|
||||
SET website = :website, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':website' => $this->website
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -352,10 +352,10 @@ class API_OAuth2_Application
|
||||
SET activated = :activated, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':activated' => $this->activated
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -386,10 +386,10 @@ class API_OAuth2_Application
|
||||
SET grant_password = :grant_password, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':grant_password' => $this->grant_password
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -438,10 +438,10 @@ class API_OAuth2_Application
|
||||
SET client_id = :client_id, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':client_id' => $this->client_id
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -472,10 +472,10 @@ class API_OAuth2_Application
|
||||
SET client_secret = :client_secret, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':client_secret' => $this->client_secret
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -505,10 +505,10 @@ class API_OAuth2_Application
|
||||
SET redirect_uri = :redirect_uri, last_modified = NOW()
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':redirect_uri' => $this->redirect_uri
|
||||
, ':application_id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -527,10 +527,10 @@ class API_OAuth2_Application
|
||||
$sql = 'SELECT api_account_id FROM api_accounts
|
||||
WHERE usr_id = :usr_id AND application_id = :id';
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':usr_id' => $user->getId()
|
||||
, ':id' => $this->id
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -557,7 +557,7 @@ class API_OAuth2_Application
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':application_id' => $this->get_id()));
|
||||
$stmt->execute([':application_id' => $this->get_id()]);
|
||||
$stmt->closeCursor();
|
||||
|
||||
return;
|
||||
@@ -573,11 +573,11 @@ class API_OAuth2_Application
|
||||
WHERE application_id = :application_id';
|
||||
|
||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':application_id' => $this->get_id()));
|
||||
$stmt->execute([':application_id' => $this->get_id()]);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$accounts = array();
|
||||
$accounts = [];
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$accounts[] = new API_OAuth2_Account($this->app, $row['api_account_id']);
|
||||
@@ -609,7 +609,7 @@ class API_OAuth2_Application
|
||||
$client_secret = API_OAuth2_Token::generate_token();
|
||||
$client_token = API_OAuth2_Token::generate_token();
|
||||
|
||||
$params = array(
|
||||
$params = [
|
||||
':usr_id' => $user ? $user->getId() : null,
|
||||
':name' => $name,
|
||||
':client_id' => $client_token,
|
||||
@@ -617,7 +617,7 @@ class API_OAuth2_Application
|
||||
':nonce' => $nonce,
|
||||
':activated' => 1,
|
||||
':grant_password' => 0
|
||||
);
|
||||
];
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
@@ -646,7 +646,7 @@ class API_OAuth2_Application
|
||||
WHERE client_id = :client_id';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':client_id' => $client_id));
|
||||
$stmt->execute([':client_id' => $client_id]);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
@@ -663,11 +663,11 @@ class API_OAuth2_Application
|
||||
WHERE a.creator = :usr_id AND a.application_id = b.application_id';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $user->getId()));
|
||||
$stmt->execute([':usr_id' => $user->getId()]);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$apps = array();
|
||||
$apps = [];
|
||||
foreach ($rs as $row) {
|
||||
$apps[] = new API_OAuth2_Application($app, $row['application_id']);
|
||||
}
|
||||
@@ -682,11 +682,11 @@ class API_OAuth2_Application
|
||||
WHERE usr_id = :usr_id AND c.application_id = a.application_id';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $user->getId()));
|
||||
$stmt->execute([':usr_id' => $user->getId()]);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$apps = array();
|
||||
$apps = [];
|
||||
foreach ($rs as $row) {
|
||||
$apps[] = new API_OAuth2_Application($app, $row['application_id']);
|
||||
}
|
||||
@@ -703,11 +703,11 @@ class API_OAuth2_Application
|
||||
AND revoked = 0';
|
||||
|
||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':usr_id' => $user->getId()));
|
||||
$stmt->execute([':usr_id' => $user->getId()]);
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$apps = array();
|
||||
$apps = [];
|
||||
foreach ($rs as $row) {
|
||||
$apps[] = new API_OAuth2_Application($app, $row['application_id']);
|
||||
}
|
||||
|
@@ -116,14 +116,14 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$date = new \DateTime();
|
||||
$data = $app['task-manager.live-information']->getManager();
|
||||
|
||||
$result->set_datas(array('scheduler' => array(
|
||||
$result->set_datas(['scheduler' => [
|
||||
'configuration' => $data['configuration'],
|
||||
'state' => $data['actual'],
|
||||
'status' => $data['actual'],
|
||||
'pid' => $data['process-id'],
|
||||
'process-id' => $data['process-id'],
|
||||
'updated_on' => $date->format(DATE_ATOM),
|
||||
)));
|
||||
]]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -139,12 +139,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
{
|
||||
$result = new \API_V1_result($app, $app['request'], $this);
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($app['manipulator.task']->getRepository()->findAll() as $task) {
|
||||
$ret[] = $this->list_task($app, $task);
|
||||
}
|
||||
|
||||
$result->set_datas(array('tasks' => $ret));
|
||||
$result->set_datas(['tasks' => $ret]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
{
|
||||
$data = $app['task-manager.live-information']->getTask($task);
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => $task->getId(),
|
||||
'title' => $task->getName(),
|
||||
'name' => $task->getName(),
|
||||
@@ -171,7 +171,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'auto_start' => $task->getStatus() === Task::STATUS_STARTED,
|
||||
'crashed' => $task->getCrashed(),
|
||||
'status' => $task->getStatus(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
public function get_task(Application $app, Task $task)
|
||||
{
|
||||
$result = new \API_V1_result($app, $app['request'], $this);
|
||||
$ret = array('task' => $this->list_task($app, $task));
|
||||
$ret = ['task' => $this->list_task($app, $task)];
|
||||
$result->set_datas($ret);
|
||||
|
||||
return $result;
|
||||
@@ -202,7 +202,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new \API_V1_result($app, $app['request'], $this);
|
||||
|
||||
$app['manipulator.task']->start($task);
|
||||
$result->set_datas(array('task' => $this->list_task($app, $task)));
|
||||
$result->set_datas(['task' => $this->list_task($app, $task)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new API_V1_result($app, $app['request'], $this);
|
||||
|
||||
$app['manipulator.task']->stop($task);
|
||||
$result->set_datas(array('task' => $this->list_task($app, $task)));
|
||||
$result->set_datas(['task' => $this->list_task($app, $task)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$task->setStatus(Task::STATUS_STARTED);
|
||||
}
|
||||
|
||||
$result->set_datas(array('task' => $this->list_task($app, $task)));
|
||||
$result->set_datas(['task' => $this->list_task($app, $task)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -265,23 +265,23 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function get_cache_info(Application $app)
|
||||
{
|
||||
$caches = array(
|
||||
$caches = [
|
||||
'main' => $app['cache'],
|
||||
'op_code' => $app['opcode-cache'],
|
||||
'doctrine_metadatas' => $this->app['EM']->getConfiguration()->getMetadataCacheImpl(),
|
||||
'doctrine_query' => $this->app['EM']->getConfiguration()->getQueryCacheImpl(),
|
||||
'doctrine_result' => $this->app['EM']->getConfiguration()->getResultCacheImpl(),
|
||||
);
|
||||
];
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($caches as $name => $service) {
|
||||
if ($service instanceof \Alchemy\Phrasea\Cache\Cache) {
|
||||
$ret['cache'][$name] = array(
|
||||
$ret['cache'][$name] = [
|
||||
'type' => $service->getName(),
|
||||
'online' => $service->isOnline(),
|
||||
'stats' => $service->getStats(),
|
||||
);
|
||||
];
|
||||
} else {
|
||||
$ret['cache'][$name] = null;
|
||||
}
|
||||
@@ -298,12 +298,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function get_config_info(Application $app)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
$ret['phraseanet']['version'] = array(
|
||||
$ret['phraseanet']['version'] = [
|
||||
'name' => $app['phraseanet.version']::getName(),
|
||||
'number' => $app['phraseanet.version']::getNumber(),
|
||||
);
|
||||
];
|
||||
|
||||
$ret['phraseanet']['environment'] = $app->getEnvironment();
|
||||
$ret['phraseanet']['debug'] = $app['debug'];
|
||||
@@ -324,7 +324,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
try {
|
||||
$SEStatus = $app['phraseanet.SE']->getStatus();
|
||||
} catch (\RuntimeException $e) {
|
||||
$SEStatus = array('error' => $e->getMessage());
|
||||
$SEStatus = ['error' => $e->getMessage()];
|
||||
}
|
||||
|
||||
$binaries = $app['conf']->get(['main', 'binaries']);
|
||||
@@ -404,9 +404,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'type' => $app['phraseanet.SE']->getName(),
|
||||
'status' => $SEStatus,
|
||||
'configuration' => $app['phraseanet.SE']->getConfigurationPanel()->getConfiguration(),
|
||||
),
|
||||
),
|
||||
'binary' => array(
|
||||
],
|
||||
],
|
||||
'binary' => [
|
||||
'phpCli' => isset($binaries['php_binary']) ? $binaries['php_binary'] : null,
|
||||
'phpIni' => $app['conf']->get(['registry', 'executables', 'php-conf-path']),
|
||||
'swfExtract' => isset($binaries['swf_extract_binary']) ? $binaries['swf_extract_binary'] : null,
|
||||
@@ -502,7 +502,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
{
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(array("databoxes" => $this->list_databoxes()));
|
||||
$result->set_datas(["databoxes" => $this->list_databoxes()]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -520,11 +520,11 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"collections" => $this->list_databox_collections(
|
||||
$this->app['phraseanet.appbox']->get_databox($databox_id)
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -543,12 +543,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"status" =>
|
||||
$this->list_databox_status(
|
||||
$this->app['phraseanet.appbox']->get_databox($databox_id)->get_statusbits()
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -567,13 +567,13 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"document_metadatas" =>
|
||||
$this->list_databox_metadatas_fields(
|
||||
$this->app['phraseanet.appbox']->get_databox($databox_id)
|
||||
->get_meta_structure()
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -592,10 +592,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"termsOfUse" =>
|
||||
$this->list_databox_terms($this->app['phraseanet.appbox']->get_databox($databox_id))
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -608,14 +608,14 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$record = $this->app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||
$fields = $record->get_caption()->get_fields();
|
||||
|
||||
$ret = array('caption_metadatas' => array());
|
||||
$ret = ['caption_metadatas' => []];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$ret['caption_metadatas'][] = array(
|
||||
$ret['caption_metadatas'][] = [
|
||||
'meta_structure_id' => $field->get_meta_struct_id(),
|
||||
'name' => $field->get_name(),
|
||||
'value' => $field->get_serialized_values(";"),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$result->set_datas($ret);
|
||||
@@ -668,7 +668,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$callback = function ($element, $visa, $code) use ($app, &$reasons, &$output) {
|
||||
if (!$visa->isValid()) {
|
||||
$reasons = array();
|
||||
$reasons = [];
|
||||
|
||||
foreach ($visa->getResponses() as $response) {
|
||||
$reasons[] = $response->getMessage($app['translator']);
|
||||
@@ -695,9 +695,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$app['border-manager']->process($session, $Package, $callback, $behavior);
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'entity' => null,
|
||||
);
|
||||
];
|
||||
|
||||
if ($output instanceof \record_adapter) {
|
||||
$ret['entity'] = '0';
|
||||
@@ -721,9 +721,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$offset_start = max($request->get('offset_start', 0), 0);
|
||||
$per_page = min(max($request->get('per_page', 10), 1), 20);
|
||||
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canaddrecord')));
|
||||
$baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canaddrecord']));
|
||||
|
||||
$lazaretFiles = array();
|
||||
$lazaretFiles = [];
|
||||
|
||||
if (count($baseIds) > 0) {
|
||||
$lazaretRepository = $app['EM']->getRepository('Phraseanet:LazaretFile');
|
||||
@@ -733,7 +733,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
);
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($lazaretFiles as $lazaretFile) {
|
||||
$ret[] = $this->list_lazaret_file($lazaretFile);
|
||||
@@ -741,11 +741,11 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
$result->set_datas(array(
|
||||
$result->set_datas([
|
||||
'offset_start' => $offset_start,
|
||||
'per_page' => $per_page,
|
||||
'quarantine_items' => $ret,
|
||||
));
|
||||
]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -763,7 +763,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
throw new \API_V1_exception_forbidden('You do not have access to this quarantine item');
|
||||
}
|
||||
|
||||
$ret = array('quarantine_item' => $this->list_lazaret_file($lazaretFile));
|
||||
$ret = ['quarantine_item' => $this->list_lazaret_file($lazaretFile)];
|
||||
|
||||
$result = new API_V1_result($this->app, $request, $this);
|
||||
|
||||
@@ -774,7 +774,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
protected function list_lazaret_file(LazaretFile $file)
|
||||
{
|
||||
$checks = array();
|
||||
$checks = [];
|
||||
|
||||
if ($file->getChecks()) {
|
||||
foreach ($file->getChecks() as $checker) {
|
||||
@@ -788,12 +788,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$usr_id = $file->getSession()->getUser($this->app)->getId();
|
||||
}
|
||||
|
||||
$session = array(
|
||||
$session = [
|
||||
'id' => $file->getSession()->getId(),
|
||||
'usr_id' => $usr_id,
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => $file->getId(),
|
||||
'quarantine_session' => $session,
|
||||
'base_id' => $file->getBaseId(),
|
||||
@@ -801,10 +801,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'sha256' => $file->getSha256(),
|
||||
'uuid' => $file->getUuid(),
|
||||
'forced' => $file->getForced(),
|
||||
'checks' => $file->getForced() ? array() : $checks,
|
||||
'checks' => $file->getForced() ? [] : $checks,
|
||||
'created_on' => $file->getCreated()->format(DATE_ATOM),
|
||||
'updated_on' => $file->getUpdated()->format(DATE_ATOM),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -819,7 +819,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
list($ret, $search_result) = $this->prepare_search_request($request);
|
||||
|
||||
$ret['results'] = array('records' => array(), 'stories' => array());
|
||||
$ret['results'] = ['records' => [], 'stories' => []];
|
||||
|
||||
foreach ($search_result->getResults() as $record) {
|
||||
if ($record->is_grouping()) {
|
||||
@@ -895,7 +895,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$this->app['phraseanet.SE']->clearCache();
|
||||
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'offset_start' => $offsetStart,
|
||||
'per_page' => $perPage,
|
||||
'available_results' => $search_result->getAvailable(),
|
||||
@@ -907,11 +907,11 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'suggestions' => array_map(function (SearchEngineSuggestion $suggestion) {
|
||||
return $suggestion->toArray();
|
||||
}, $search_result->getSuggestions()->toArray()),
|
||||
'results' => array(),
|
||||
'results' => [],
|
||||
'query' => $search_result->getQuery(),
|
||||
);
|
||||
];
|
||||
|
||||
return array($ret, $search_result);
|
||||
return [$ret, $search_result];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -942,10 +942,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
return $that->list_story($story);
|
||||
}, array_values($record->get_grouping_parents()->get_elements()));
|
||||
|
||||
$result->set_datas(array(
|
||||
$result->set_datas([
|
||||
"baskets" => $baskets,
|
||||
"stories" => $stories,
|
||||
));
|
||||
]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -966,9 +966,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$record = $this->app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"record_metadatas" => $this->list_record_caption($record->get_caption())
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -992,13 +992,13 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
->get_record($record_id);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"status" =>
|
||||
$this->list_record_status(
|
||||
$this->app['phraseanet.appbox']->get_databox($databox_id)
|
||||
, $record->get_status()
|
||||
)
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -1020,10 +1020,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$record = $this->app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
$devices = $request->get('devices', array());
|
||||
$mimes = $request->get('mimes', array());
|
||||
$devices = $request->get('devices', []);
|
||||
$mimes = $request->get('mimes', []);
|
||||
|
||||
foreach ($record->get_embedable_medias($devices, $mimes) as $media) {
|
||||
if (null !== $embed = $this->list_embedable_media($media)) {
|
||||
@@ -1031,7 +1031,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
}
|
||||
|
||||
$result->set_datas(array("embed" => $ret));
|
||||
$result->set_datas(["embed" => $ret]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1054,10 +1054,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
->get_databox($databox_id)
|
||||
->get_record($record_id);
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
$devices = $request->get('devices', array());
|
||||
$mimes = $request->get('mimes', array());
|
||||
$devices = $request->get('devices', []);
|
||||
$mimes = $request->get('mimes', []);
|
||||
|
||||
foreach ($record->get_embedable_medias($devices, $mimes) as $media) {
|
||||
if (null !== $embed = $this->list_embedable_media($media)) {
|
||||
@@ -1065,7 +1065,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
}
|
||||
|
||||
$result->set_datas(array("embed" => $ret));
|
||||
$result->set_datas(["embed" => $ret]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1089,7 +1089,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
|
||||
$record->set_metadatas($metadatas);
|
||||
$result->set_datas(array("record_metadatas" => $this->list_record_caption($record->get_caption())));
|
||||
$result->set_datas(["record_metadatas" => $this->list_record_caption($record->get_caption())]);
|
||||
} catch (Exception $e) {
|
||||
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured'));
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
if ($n > 31 || $n < 4) {
|
||||
throw new API_V1_exception_badrequest();
|
||||
}
|
||||
if (!in_array($value, array('0', '1'))) {
|
||||
if (!in_array($value, ['0', '1'])) {
|
||||
throw new API_V1_exception_badrequest();
|
||||
}
|
||||
if (!isset($status_bits[$n])) {
|
||||
@@ -1131,10 +1131,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$this->app['phraseanet.SE']->updateRecord($record);
|
||||
|
||||
$result->set_datas(array(
|
||||
$result->set_datas([
|
||||
"status" =>
|
||||
$this->list_record_status($databox, $record->get_status())
|
||||
)
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('An error occured'));
|
||||
@@ -1161,7 +1161,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$collection = collection::get_from_base_id($this->app, $request->get('base_id'));
|
||||
|
||||
$record->move_to_collection($collection, $this->app['phraseanet.appbox']);
|
||||
$result->set_datas(array("record" => $this->list_record($record)));
|
||||
$result->set_datas(["record" => $this->list_record($record)]);
|
||||
} catch (Exception $e) {
|
||||
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $e->getMessage());
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($databox_id);
|
||||
try {
|
||||
$record = $databox->get_record($record_id);
|
||||
$result->set_datas(array('record' => $this->list_record($record)));
|
||||
$result->set_datas(['record' => $this->list_record($record)]);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('Record Not Found'));
|
||||
} catch (Exception $e) {
|
||||
@@ -1207,7 +1207,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($databox_id);
|
||||
try {
|
||||
$story = $databox->get_record($story_id);
|
||||
$result->set_datas(array('story' => $this->list_story($story)));
|
||||
$result->set_datas(['story' => $this->list_story($story)]);
|
||||
} catch (NotFoundHttpException $e) {
|
||||
$result->set_error_message(API_V1_result::ERROR_BAD_REQUEST, $this->app->trans('Story Not Found'));
|
||||
} catch (Exception $e) {
|
||||
@@ -1229,7 +1229,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$usr_id = $this->app['authentication']->getUser()->getId();
|
||||
|
||||
$result->set_datas(array('baskets' => $this->list_baskets($usr_id)));
|
||||
$result->set_datas(['baskets' => $this->list_baskets($usr_id)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1247,7 +1247,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$baskets = $repo->findActiveByUser($this->app['authentication']->getUser());
|
||||
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($baskets as $basket) {
|
||||
$ret[] = $this->list_basket($basket);
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$this->app['EM']->persist($Basket);
|
||||
$this->app['EM']->flush();
|
||||
|
||||
$result->set_datas(array("basket" => $this->list_basket($Basket)));
|
||||
$result->set_datas(["basket" => $this->list_basket($Basket)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1321,10 +1321,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$Basket = $repository->findUserBasket($this->app, $basket_id, $this->app['authentication']->getUser(), false);
|
||||
|
||||
$result->set_datas(
|
||||
array(
|
||||
[
|
||||
"basket" => $this->list_basket($Basket),
|
||||
"basket_elements" => $this->list_basket_content($Basket)
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
@@ -1338,7 +1338,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_basket_content(Basket $Basket)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($Basket->getElements() as $basket_element) {
|
||||
$ret[] = $this->list_basket_element($basket_element);
|
||||
@@ -1355,15 +1355,15 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_basket_element(BasketElement $basket_element)
|
||||
{
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'basket_element_id' => $basket_element->getId(),
|
||||
'order' => $basket_element->getOrd(),
|
||||
'record' => $this->list_record($basket_element->getRecord($this->app)),
|
||||
'validation_item' => null != $basket_element->getBasket()->getValidation(),
|
||||
);
|
||||
];
|
||||
|
||||
if ($basket_element->getBasket()->getValidation()) {
|
||||
$choices = array();
|
||||
$choices = [];
|
||||
$agreement = null;
|
||||
$note = '';
|
||||
|
||||
@@ -1423,7 +1423,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$this->app['EM']->merge($Basket);
|
||||
$this->app['EM']->flush();
|
||||
|
||||
$result->set_datas(array("basket" => $this->list_basket($Basket)));
|
||||
$result->set_datas(["basket" => $this->list_basket($Basket)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1451,7 +1451,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$this->app['EM']->merge($Basket);
|
||||
$this->app['EM']->flush();
|
||||
|
||||
$result->set_datas(array("basket" => $this->list_basket($Basket)));
|
||||
$result->set_datas(["basket" => $this->list_basket($Basket)]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1469,12 +1469,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$coll = $this->app['EM']->getRepository('Phraseanet:Feed')->getAllForUser($this->app['acl']->get($user));
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
foreach ($coll as $feed) {
|
||||
$datas[] = $this->list_publication($feed, $user);
|
||||
}
|
||||
|
||||
$result->set_datas(array("feeds" => $datas));
|
||||
$result->set_datas(["feeds" => $datas]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -1502,19 +1502,19 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$feed = $this->app['EM']->getRepository('Phraseanet:Feed')->find($publication_id);
|
||||
if (!$feed->isAccessible($user, $this->app)) {
|
||||
return $result->set_datas(array());
|
||||
return $result->set_datas([]);
|
||||
}
|
||||
$offset_start = (int) ($request->get('offset_start') ? : 0);
|
||||
$per_page = (int) ($request->get('per_page') ? : 5);
|
||||
|
||||
$per_page = (($per_page >= 1) && ($per_page <= 20)) ? $per_page : 5;
|
||||
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'feed' => $this->list_publication($feed, $user),
|
||||
'offset_start' => $offset_start,
|
||||
'per_page' => $per_page,
|
||||
'entries' => $this->list_publications_entries($feed, $offset_start, $per_page),
|
||||
);
|
||||
];
|
||||
|
||||
$result->set_datas($datas);
|
||||
|
||||
@@ -1532,12 +1532,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$per_page = (($per_page >= 1) && ($per_page <= 20)) ? $per_page : 5;
|
||||
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'total_entries' => $feed->getCountTotalEntries(),
|
||||
'offset_start' => $offset_start,
|
||||
'per_page' => $per_page,
|
||||
'entries' => $this->list_publications_entries($feed, $offset_start, $per_page),
|
||||
);
|
||||
];
|
||||
|
||||
$result->set_datas($datas);
|
||||
|
||||
@@ -1556,9 +1556,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
throw new \API_V1_exception_forbidden('You have not access to the parent feed');
|
||||
}
|
||||
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'entry' => $this->list_publication_entry($entry),
|
||||
);
|
||||
];
|
||||
|
||||
$result->set_datas($datas);
|
||||
|
||||
@@ -1574,7 +1574,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_publication(Feed $feed, $user)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'id' => $feed->getId(),
|
||||
'title' => $feed->getTitle(),
|
||||
'subtitle' => $feed->getSubtitle(),
|
||||
@@ -1585,7 +1585,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'deletable' => $feed->isOwner($user),
|
||||
'created_on' => $feed->getCreatedOn()->format(DATE_ATOM),
|
||||
'updated_on' => $feed->getUpdatedOn()->format(DATE_ATOM),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1601,7 +1601,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
|
||||
$entries = $feed->getEntries($offset_start, $how_many);
|
||||
|
||||
$out = array();
|
||||
$out = [];
|
||||
foreach ($entries as $entry) {
|
||||
$out[] = $this->list_publication_entry($entry);
|
||||
}
|
||||
@@ -1617,12 +1617,12 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_publication_entry(FeedEntry $entry)
|
||||
{
|
||||
$items = array();
|
||||
$items = [];
|
||||
foreach ($entry->getItems() as $item) {
|
||||
$items[] = $this->list_publication_entry_item($item);
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'id' => $entry->getId(),
|
||||
'author_email' => $entry->getAuthorEmail(),
|
||||
'author_name' => $entry->getAuthorName(),
|
||||
@@ -1634,7 +1634,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'feed_id' => $entry->getFeed()->getId(),
|
||||
'feed_url' => '/feeds/' . $entry->getFeed()->getId() . '/content/',
|
||||
'url' => '/feeds/entry/' . $entry->getId() . '/',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1645,10 +1645,10 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_publication_entry_item(FeedItem $item)
|
||||
{
|
||||
$datas = array(
|
||||
$datas = [
|
||||
'item_id' => $item->getId()
|
||||
, 'record' => $this->list_record($item->getRecord($this->app))
|
||||
);
|
||||
];
|
||||
|
||||
return $datas;
|
||||
}
|
||||
@@ -1698,7 +1698,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$permalink = null;
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'name' => $media->get_name(),
|
||||
'permalink' => $permalink,
|
||||
'height' => $media->get_height(),
|
||||
@@ -1707,7 +1707,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'devices' => $media->getDevices(),
|
||||
'player_type' => $media->get_type(),
|
||||
'mime_type' => $media->get_mime(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1719,7 +1719,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_permalink(media_Permalink_Adapter $permalink)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'created_on' => $permalink->get_created_on()->format(DATE_ATOM),
|
||||
'id' => $permalink->get_id(),
|
||||
'is_activated' => $permalink->get_is_activated(),
|
||||
@@ -1729,7 +1729,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'page_url' => $permalink->get_page(),
|
||||
'download_url' => $permalink->get_url() . '&download',
|
||||
'url' => $permalink->get_url()
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1742,9 +1742,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
protected function list_record_status(databox $databox, $status)
|
||||
{
|
||||
$status = strrev($status);
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($databox->get_statusbits() as $bit => $status_datas) {
|
||||
$ret[] = array('bit' => $bit, 'state' => !!substr($status, ($bit - 1), 1));
|
||||
$ret[] = ['bit' => $bit, 'state' => !!substr($status, ($bit - 1), 1)];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@@ -1758,7 +1758,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_record_caption(caption_record $caption)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($caption->get_fields() as $field) {
|
||||
foreach ($field->get_values() as $value) {
|
||||
$ret[] = $this->list_record_caption_field($value, $field);
|
||||
@@ -1776,18 +1776,18 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_record_caption_field(caption_Field_Value $value, caption_field $field)
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'meta_id' => $value->getId(),
|
||||
'meta_structure_id' => $field->get_meta_struct_id(),
|
||||
'name' => $field->get_name(),
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'fr' => $field->get_databox_field()->get_label('fr'),
|
||||
'en' => $field->get_databox_field()->get_label('en'),
|
||||
'de' => $field->get_databox_field()->get_label('de'),
|
||||
'nl' => $field->get_databox_field()->get_label('nl'),
|
||||
),
|
||||
],
|
||||
'value' => $value->getValue(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1798,7 +1798,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
public function list_basket(Basket $basket)
|
||||
{
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'basket_id' => $basket->getId(),
|
||||
'created_on' => $basket->getCreated()->format(DATE_ATOM),
|
||||
'description' => (string) $basket->getDescription(),
|
||||
@@ -1807,23 +1807,23 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'updated_on' => $basket->getUpdated()->format(DATE_ATOM),
|
||||
'unread' => !$basket->getIsRead(),
|
||||
'validation_basket' => !!$basket->getValidation()
|
||||
);
|
||||
];
|
||||
|
||||
if ($basket->getValidation()) {
|
||||
$users = array();
|
||||
$users = [];
|
||||
|
||||
foreach ($basket->getValidation()->getParticipants() as $participant) {
|
||||
/* @var $participant ValidationParticipant */
|
||||
$user = $participant->getUser($this->app);
|
||||
|
||||
$users[] = array(
|
||||
$users[] = [
|
||||
'usr_id' => $user->getId(),
|
||||
'usr_name' => $user->getDisplayName(),
|
||||
'confirmed' => $participant->getIsConfirmed(),
|
||||
'can_agree' => $participant->getCanAgree(),
|
||||
'can_see_others' => $participant->getCanSeeOthers(),
|
||||
'readonly' => $user->getId() != $this->app['authentication']->getUser()->getId(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$expires_on_atom = $basket->getValidation()->getExpires();
|
||||
@@ -1833,13 +1833,13 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
}
|
||||
|
||||
$ret = array_merge(
|
||||
array(
|
||||
[
|
||||
'validation_users' => $users,
|
||||
'expires_on' => $expires_on_atom,
|
||||
'validation_infos' => $basket->getValidation()->getValidationString($this->app, $this->app['authentication']->getUser()),
|
||||
'validation_confirmed' => $basket->getValidation()->getParticipant($this->app['authentication']->getUser(), $this->app)->getIsConfirmed(),
|
||||
'validation_initiator' => $basket->getValidation()->isInitiator($this->app['authentication']->getUser()),
|
||||
), $ret
|
||||
], $ret
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1854,15 +1854,15 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
public function list_record(record_adapter $record)
|
||||
{
|
||||
$technicalInformation = array();
|
||||
$technicalInformation = [];
|
||||
foreach ($record->get_technical_infos() as $name => $value) {
|
||||
$technicalInformation[] = array(
|
||||
$technicalInformation[] = [
|
||||
'name' => $name,
|
||||
'value' => $value
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
'databox_id' => $record->get_sbas_id(),
|
||||
'record_id' => $record->get_record_id(),
|
||||
'mime_type' => $record->get_mime(),
|
||||
@@ -1876,7 +1876,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'technical_informations' => $technicalInformation,
|
||||
'phrasea_type' => $record->get_type(),
|
||||
'uuid' => $record->get_uuid(),
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1910,7 +1910,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
return $field->get_serialized_values();
|
||||
};
|
||||
|
||||
return array(
|
||||
return [
|
||||
'@entity@' => self::OBJECT_TYPE_STORY,
|
||||
'databox_id' => $story->get_sbas_id(),
|
||||
'story_id' => $story->get_record_id(),
|
||||
@@ -1919,7 +1919,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'collection_id' => phrasea::collFromBas($this->app, $story->get_base_id()),
|
||||
'thumbnail' => $this->list_embedable_media($story->get_thumbnail()),
|
||||
'uuid' => $story->get_uuid(),
|
||||
'metadatas' => array(
|
||||
'metadatas' => [
|
||||
'@entity@' => self::OBJECT_TYPE_STORY_METADATA_BAG,
|
||||
'dc:contributor' => $format($caption, databox_Field_DCESAbstract::Contributor),
|
||||
'dc:coverage' => $format($caption, databox_Field_DCESAbstract::Coverage),
|
||||
@@ -1936,9 +1936,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'dc:subject' => $format($caption, databox_Field_DCESAbstract::Subject),
|
||||
'dc:title' => $format($caption, databox_Field_DCESAbstract::Title),
|
||||
'dc:type' => $format($caption, databox_Field_DCESAbstract::Type),
|
||||
),
|
||||
],
|
||||
'records' => $records,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1948,7 +1948,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databoxes()
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
$ret[] = $this->list_databox($databox);
|
||||
}
|
||||
@@ -1964,9 +1964,9 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox_terms(databox $databox)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($databox->get_cgus() as $locale => $array_terms) {
|
||||
$ret[] = array('locale' => $locale, 'terms' => $array_terms['value']);
|
||||
$ret[] = ['locale' => $locale, 'terms' => $array_terms['value']];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@@ -1979,17 +1979,17 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox(databox $databox)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
$ret['databox_id'] = $databox->get_sbas_id();
|
||||
$ret['name'] = $databox->get_dbname();
|
||||
$ret['viewname'] = $databox->get_viewname();
|
||||
$ret['labels'] = array(
|
||||
$ret['labels'] = [
|
||||
'en' => $databox->get_label('en'),
|
||||
'de' => $databox->get_label('de'),
|
||||
'fr' => $databox->get_label('fr'),
|
||||
'nl' => $databox->get_label('nl'),
|
||||
);
|
||||
];
|
||||
$ret['version'] = $databox->get_version();
|
||||
|
||||
return $ret;
|
||||
@@ -2003,7 +2003,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox_collections(databox $databox)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$ret[] = $this->list_collection($collection);
|
||||
@@ -2020,18 +2020,18 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_collection(collection $collection)
|
||||
{
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'base_id' => $collection->get_base_id(),
|
||||
'collection_id' => $collection->get_coll_id(),
|
||||
'name' => $collection->get_name(),
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'fr' => $collection->get_label('fr'),
|
||||
'en' => $collection->get_label('en'),
|
||||
'de' => $collection->get_label('de'),
|
||||
'nl' => $collection->get_label('nl'),
|
||||
),
|
||||
],
|
||||
'record_amount' => $collection->get_record_amount(),
|
||||
);
|
||||
];
|
||||
|
||||
return $ret;
|
||||
}
|
||||
@@ -2044,23 +2044,23 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox_status(array $status)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($status as $n => $datas) {
|
||||
$ret[] = array(
|
||||
$ret[] = [
|
||||
'bit' => $n,
|
||||
'label_on' => $datas['labelon'],
|
||||
'label_off' => $datas['labeloff'],
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'en' => $datas['labels_on_i18n']['en'],
|
||||
'fr' => $datas['labels_on_i18n']['fr'],
|
||||
'de' => $datas['labels_on_i18n']['de'],
|
||||
'nl' => $datas['labels_on_i18n']['nl'],
|
||||
),
|
||||
],
|
||||
'img_on' => $datas['img_on'],
|
||||
'img_off' => $datas['img_off'],
|
||||
'searchable' => !!$datas['searchable'],
|
||||
'printable' => !!$datas['printable'],
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@@ -2074,7 +2074,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox_metadatas_fields(databox_descriptionStructure $meta_struct)
|
||||
{
|
||||
$ret = array();
|
||||
$ret = [];
|
||||
foreach ($meta_struct as $meta) {
|
||||
$ret[] = $this->list_databox_metadata_field_properties($meta);
|
||||
}
|
||||
@@ -2090,18 +2090,18 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
*/
|
||||
protected function list_databox_metadata_field_properties(databox_field $databox_field)
|
||||
{
|
||||
$ret = array(
|
||||
$ret = [
|
||||
'id' => $databox_field->get_id(),
|
||||
'namespace' => $databox_field->get_tag()->getGroupName(),
|
||||
'source' => $databox_field->get_tag()->getTagname(),
|
||||
'tagname' => $databox_field->get_tag()->getName(),
|
||||
'name' => $databox_field->get_name(),
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'fr' => $databox_field->get_label('fr'),
|
||||
'en' => $databox_field->get_label('en'),
|
||||
'de' => $databox_field->get_label('de'),
|
||||
'nl' => $databox_field->get_label('nl'),
|
||||
),
|
||||
],
|
||||
'separator' => $databox_field->get_separator(),
|
||||
'thesaurus_branch' => $databox_field->get_tbranch(),
|
||||
'type' => $databox_field->get_type(),
|
||||
@@ -2109,7 +2109,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
'multivalue' => $databox_field->is_multi(),
|
||||
'readonly' => $databox_field->is_readonly(),
|
||||
'required' => $databox_field->is_required(),
|
||||
);
|
||||
];
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user