Fix unit tests and arrays declaration

This commit is contained in:
Romain Neutron
2013-12-03 17:17:21 +01:00
parent 199134c25a
commit 680643c0fc
101 changed files with 328 additions and 272 deletions

View File

@@ -20,6 +20,7 @@ use Alchemy\Phrasea\Command\Developer\LessCompiler;
use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb; use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb;
use Alchemy\Phrasea\Command\Developer\RoutesDumper; use Alchemy\Phrasea\Command\Developer\RoutesDumper;
use Alchemy\Phrasea\Command\Developer\Uninstaller; use Alchemy\Phrasea\Command\Developer\Uninstaller;
use Alchemy\Phrasea\Command\Developer\TranslationDumper;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
@@ -75,7 +76,7 @@ if ($cli['configuration.store']->isSetup()) {
} }
} }
$cli->command(new \Alchemy\Phrasea\Command\Developer\TranslationDumper()); $cli->command(new TranslationDumper());
$cli->command(new InstallAll()); $cli->command(new InstallAll());
$cli->command(new BowerInstall()); $cli->command(new BowerInstall());

File diff suppressed because one or more lines are too long

View File

@@ -137,7 +137,6 @@ use Silex\Provider\UrlGeneratorServiceProvider;
use Silex\Provider\ValidatorServiceProvider; use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider; use Silex\Provider\ServiceControllerServiceProvider;
use Symfony\Bridge\Twig\Extension\TranslationExtension; use Symfony\Bridge\Twig\Extension\TranslationExtension;
use Symfony\Component\Translation\Loader\MoFileLoader;
use Unoconv\UnoconvServiceProvider; use Unoconv\UnoconvServiceProvider;
use XPDF\PdfToText; use XPDF\PdfToText;
use XPDF\XPDFServiceProvider; use XPDF\XPDFServiceProvider;

View File

@@ -36,13 +36,13 @@ class TranslationDumper extends Command
$config = $builder->setLocale($code) $config = $builder->setLocale($code)
->setOutputFormat('xliff') ->setOutputFormat('xliff')
->setTranslationsDir(__DIR__ . '/../../../../../resources/locales') ->setTranslationsDir(__DIR__ . '/../../../../../resources/locales')
->setScanDirs(array( ->setScanDirs([
$this->container['root.path'].'/templates/web/admin/user', $this->container['root.path'].'/templates/web/admin/user',
$this->container['root.path'].'/lib', $this->container['root.path'].'/lib',
$this->container['root.path'].'/templates', $this->container['root.path'].'/templates',
$this->container['root.path'].'/bin', $this->container['root.path'].'/bin',
$this->container['root.path'].'/www', $this->container['root.path'].'/www',
)) ])
->getConfig(); ->getConfig();
$this->container['translation-extractor.updater']->process($config); $this->container['translation-extractor.updater']->process($config);

View File

@@ -1,5 +1,14 @@
<?php <?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Command\Developer\Utils; namespace Alchemy\Phrasea\Command\Developer\Utils;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
@@ -13,13 +22,13 @@ use Symfony\Component\Validator\Constraint;
*/ */
class ConstraintExtractor implements FileVisitorInterface, \PHPParser_NodeVisitor class ConstraintExtractor implements FileVisitorInterface, \PHPParser_NodeVisitor
{ {
private $messageProperties = array('message', 'minMessage', 'maxMessage', 'multipleMessage', private $messageProperties = ['message', 'minMessage', 'maxMessage', 'multipleMessage',
'extractFieldsMessage', 'missingFieldsMessage', 'notFoundMessage', 'extractFieldsMessage', 'missingFieldsMessage', 'notFoundMessage',
'notReadableMessage', 'maxSizeMessage', 'mimeTypesMessage', 'notReadableMessage', 'maxSizeMessage', 'mimeTypesMessage',
'uplaodIniSizeErrorMessage', 'uploadFormSizeErrorMessage', 'uplaodIniSizeErrorMessage', 'uploadFormSizeErrorMessage',
'uploadErrorMessage', 'mimeTypesMessage', 'sizeNotDetectedMessage', 'uploadErrorMessage', 'mimeTypesMessage', 'sizeNotDetectedMessage',
'maxWidthMessage', 'maxWidthMessage', 'minWidthMessage', 'maxHeightMessage', 'maxWidthMessage', 'maxWidthMessage', 'minWidthMessage', 'maxHeightMessage',
'minHeightMessage', 'invalidMessage',); 'minHeightMessage', 'invalidMessage',];
private $app; private $app;
private $traverser; private $traverser;

View File

@@ -114,7 +114,7 @@ class Fields implements ControllerProviderInterface
$fields[] = $field->toArray(); $fields[] = $field->toArray();
} catch (\Exception $e) { } catch (\Exception $e) {
$connection->rollback(); $connection->rollback();
$app->abort(500, $app->trans('Field %name% could not be saved, please try again or contact an admin.', array('%name%' => $jsonField['name']))); $app->abort(500, $app->trans('Field %name% could not be saved, please try again or contact an admin.', ['%name%' => $jsonField['name']]));
break; break;
} }
} }
@@ -235,7 +235,7 @@ class Fields implements ControllerProviderInterface
$this->updateFieldWithData($app, $field, $data); $this->updateFieldWithData($app, $field, $data);
$field->save(); $field->save();
} catch (\Exception $e) { } catch (\Exception $e) {
$app->abort(500, $app->trans('Field %name% could not be created, please try again or contact an admin.', array('%name%' => $data['name']))); $app->abort(500, $app->trans('Field %name% could not be created, please try again or contact an admin.', ['%name%' => $data['name']]));
} }
return $app->json($field->toArray(), 201, [ return $app->json($field->toArray(), 201, [

View File

@@ -656,12 +656,12 @@ class Users implements ControllerProviderInterface
if ($sqlField === 'usr_login') { if ($sqlField === 'usr_login') {
$loginToAdd = $value; $loginToAdd = $value;
if ($loginToAdd === "") { if ($loginToAdd === "") {
$out['errors'][] = $app->trans("Login line %line% is empty", array('%line%' => $nbLine + 1)); $out['errors'][] = $app->trans("Login line %line% is empty", ['%line%' => $nbLine + 1]);
} elseif (in_array($loginToAdd, $loginNew)) { } elseif (in_array($loginToAdd, $loginNew)) {
$out['errors'][] = $app->trans("Login %login% is already defined in the file at line %line%", array('%login%' => $loginToAdd, '%line%' => $nbLine)); $out['errors'][] = $app->trans("Login %login% is already defined in the file at line %line%", ['%login%' => $loginToAdd, '%line%' => $nbLine]);
} else { } else {
if (\User_Adapter::get_usr_id_from_login($app, $loginToAdd)) { if (\User_Adapter::get_usr_id_from_login($app, $loginToAdd)) {
$out['errors'][] = $app->trans("Login %login% already exists in database", array('%login%' => $loginToAdd)); $out['errors'][] = $app->trans("Login %login% already exists in database", ['%login%' => $loginToAdd]);
} else { } else {
$loginValid = true; $loginValid = true;
} }
@@ -672,9 +672,9 @@ class Users implements ControllerProviderInterface
$mailToAdd = $value; $mailToAdd = $value;
if ($mailToAdd === "") { if ($mailToAdd === "") {
$out['errors'][] = $app->trans("Mail line %line% is empty", array('%line%' => $nbLine + 1)); $out['errors'][] = $app->trans("Mail line %line% is empty", ['%line%' => $nbLine + 1]);
} elseif (false !== \User_Adapter::get_usr_id_from_email($app, $mailToAdd)) { } elseif (false !== \User_Adapter::get_usr_id_from_email($app, $mailToAdd)) {
$out['errors'][] = $app->trans("Email '%email%' for login '%login%' already exists in database", array('%email%' => $mailToAdd, '%login%' => $loginToAdd)); $out['errors'][] = $app->trans("Email '%email%' for login '%login%' already exists in database", ['%email%' => $mailToAdd, '%login%' => $loginToAdd]);
} else { } else {
$mailValid = true; $mailValid = true;
} }
@@ -684,7 +684,7 @@ class Users implements ControllerProviderInterface
$passwordToVerif = $value; $passwordToVerif = $value;
if ($passwordToVerif === "") { if ($passwordToVerif === "") {
$out['errors'][] = $app->trans("Password is empty at line %line%", array('%line%' => $nbLine)); $out['errors'][] = $app->trans("Password is empty at line %line%", ['%line%' => $nbLine]);
} else { } else {
$pwdValid = true; $pwdValid = true;
} }

View File

@@ -335,7 +335,7 @@ class BasketController implements ControllerProviderInterface
$data = [ $data = [
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n)) , 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n])
]; ];
if ($request->getRequestFormat() === 'json') { if ($request->getRequestFormat() === 'json') {
@@ -367,7 +367,7 @@ class BasketController implements ControllerProviderInterface
$data = [ $data = [
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% records moved', array('%quantity%' => $n)) , 'message' => $app->trans('%quantity% records moved', ['%quantity%' => $n])
]; ];
if ($request->getRequestFormat() === 'json') { if ($request->getRequestFormat() === 'json') {

View File

@@ -467,6 +467,6 @@ class Bridge implements ControllerProviderInterface
\Bridge_Element::create($app, $account, $record, $title, \Bridge_Element::STATUS_PENDING, $default_type, $datas); \Bridge_Element::create($app, $account, $record, $title, \Bridge_Element::STATUS_PENDING, $default_type, $datas);
} }
return $app->redirect('/prod/bridge/adapter/' . $account->get_id() . '/load-records/?notice=' . $app->trans('%quantity% elements en attente', array('%quantity%' => count($route->get_elements())))); return $app->redirect('/prod/bridge/adapter/' . $account->get_id() . '/load-records/?notice=' . $app->trans('%quantity% elements en attente', ['%quantity%' => count($route->get_elements())]));
} }
} }

View File

@@ -76,7 +76,7 @@ class MoveCollection implements ControllerProviderInterface
} }
if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) { if (!$app['acl']->get($app['authentication']->getUser())->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
$datas['message'] = $app->trans("You do not have the permission to move records to %collection%", array('%collection%', \phrasea::bas_labels($request->request->get('base_id'), $app))); $datas['message'] = $app->trans("You do not have the permission to move records to %collection%", ['%collection%', \phrasea::bas_labels($request->request->get('base_id'), $app)]);
return $app->json($datas); return $app->json($datas);
} }

View File

@@ -247,7 +247,7 @@ class Order implements ControllerProviderInterface
if (null === $basket) { if (null === $basket) {
$basket = new Basket(); $basket = new Basket();
$basket->setName($app->trans('Commande du %date%', array('%date%' => $order->getCreatedOn()->format('Y-m-d')))); $basket->setName($app->trans('Commande du %date%', ['%date%' => $order->getCreatedOn()->format('Y-m-d')]));
$basket->setOwner($dest_user); $basket->setOwner($dest_user);
$basket->setPusher($app['authentication']->getUser()); $basket->setPusher($app['authentication']->getUser());

View File

@@ -160,7 +160,7 @@ class Push implements ControllerProviderInterface
try { try {
$pusher = new RecordHelper\Push($app, $app['request']); $pusher = new RecordHelper\Push($app, $app['request']);
$push_name = $request->request->get('name', $app->trans('Push from %user%', array('%user%' => $app['authentication']->getUser()->get_display_name()))); $push_name = $request->request->get('name', $app->trans('Push from %user%', ['%user%' => $app['authentication']->getUser()->get_display_name()]));
$push_description = $request->request->get('push_description'); $push_description = $request->request->get('push_description');
$receivers = $request->request->get('participants'); $receivers = $request->request->get('participants');
@@ -177,7 +177,7 @@ class Push implements ControllerProviderInterface
try { try {
$user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app); $user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ControllerException($app->trans('Unknown user %user_id%', array('%user_id%' => $receiver['usr_id']))); throw new ControllerException($app->trans('Unknown user %user_id%', ['%user_id%' => $receiver['usr_id']]));
} }
$Basket = new Basket(); $Basket = new Basket();
@@ -247,10 +247,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$message = $app->trans('%quantity_records% records have been sent to %quantity_users% users', array( $message = $app->trans('%quantity_records% records have been sent to %quantity_users% users', [
'%quantity_records%' => count($pusher->get_elements()), '%quantity_records%' => count($pusher->get_elements()),
'%quantity_users%' => count($receivers), '%quantity_users%' => count($receivers),
)); ]);
$ret = [ $ret = [
'success' => true, 'success' => true,
@@ -278,7 +278,7 @@ class Push implements ControllerProviderInterface
$repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket'); $repository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket');
$validation_name = $request->request->get('name', $app->trans('Validation from %user%', array('%user%' => $app['authentication']->getUser()->get_display_name()))); $validation_name = $request->request->get('name', $app->trans('Validation from %user%', ['%user%' => $app['authentication']->getUser()->get_display_name()]));
$validation_description = $request->request->get('validation_description'); $validation_description = $request->request->get('validation_description');
$participants = $request->request->get('participants'); $participants = $request->request->get('participants');
@@ -354,13 +354,13 @@ class Push implements ControllerProviderInterface
foreach ($participants as $key => $participant) { foreach ($participants as $key => $participant) {
foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) { foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) {
if (!array_key_exists($mandatoryparam, $participant)) if (!array_key_exists($mandatoryparam, $participant))
throw new ControllerException($app->trans('Missing mandatory parameter %parameter%', array('%parameter%' => $mandatoryparam))); throw new ControllerException($app->trans('Missing mandatory parameter %parameter%', ['%parameter%' => $mandatoryparam]));
} }
try { try {
$participant_user = \User_Adapter::getInstance($participant['usr_id'], $app); $participant_user = \User_Adapter::getInstance($participant['usr_id'], $app);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new ControllerException($app->trans('Unknown user %usr_id%', array('%usr_id%' => $participant['usr_id']))); throw new ControllerException($app->trans('Unknown user %usr_id%', ['%usr_id%' => $participant['usr_id']]));
} }
try { try {
@@ -445,10 +445,10 @@ class Push implements ControllerProviderInterface
$app['EM']->flush(); $app['EM']->flush();
$message = $app->trans('%quantity_records% records have been sent for validation to %quantity_users% users', array( $message = $app->trans('%quantity_records% records have been sent for validation to %quantity_users% users', [
'%quantity_records%' => count($pusher->get_elements()), '%quantity_records%' => count($pusher->get_elements()),
'%quantity_users%' => count($request->request->get('participants')), '%quantity_users%' => count($request->request->get('participants')),
)); ]);
$ret = [ $ret = [
'success' => true, 'success' => true,

View File

@@ -153,16 +153,16 @@ class Query implements ControllerProviderInterface
$explain .= "<img src=\"/skins/icons/answers.gif\" /><span><b>"; $explain .= "<img src=\"/skins/icons/answers.gif\" /><span><b>";
if ($result->getTotal() != $result->getAvailable()) { if ($result->getTotal() != $result->getAvailable()) {
$explain .= $app->trans('reponses:: %available% Resultats rappatries sur un total de %total% trouves', array('available' => $result->getAvailable(), '%total%' => $result->getTotal())); $explain .= $app->trans('reponses:: %available% Resultats rappatries sur un total de %total% trouves', ['available' => $result->getAvailable(), '%total%' => $result->getTotal()]);
} else { } else {
$explain .= $app->trans('reponses:: %total% Resultats', array('%total%' => $result->getTotal())); $explain .= $app->trans('reponses:: %total% Resultats', ['%total%' => $result->getTotal()]);
} }
$explain .= " </b></span>"; $explain .= " </b></span>";
$explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes(); $explain .= '<br><div>' . $result->getDuration() . ' s</div>dans index ' . $result->getIndexes();
$explain .= "</div>"; $explain .= "</div>";
$infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '&quot;', $explain) . '">' . $app->trans('reponses:: %total% reponses', array('%total%' => $result->getTotal())) . '</a> | ' . $app->trans('reponses:: %number% documents selectionnes', array('%number%' => '<span id="nbrecsel"></span>')); $infoResult = '<a href="#" class="infoDialog" infos="' . str_replace('"', '&quot;', $explain) . '">' . $app->trans('reponses:: %total% reponses', ['%total%' => $result->getTotal()]) . '</a> | ' . $app->trans('reponses:: %number% documents selectionnes', ['%number%' => '<span id="nbrecsel"></span>']);
$json['infos'] = $infoResult; $json['infos'] = $infoResult;
$json['navigation'] = $string; $json['navigation'] = $string;

View File

@@ -136,7 +136,7 @@ class Story implements ControllerProviderInterface
$data = [ $data = [
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n)) , 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n])
]; ];
if ($request->getRequestFormat() == 'json') { if ($request->getRequestFormat() == 'json') {

View File

@@ -153,7 +153,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => false 'success' => false
, 'message' => $app->trans('Unable to create list %name%', array('%name%' => $list_name)) , 'message' => $app->trans('Unable to create list %name%', ['%name%' => $list_name])
, 'list_id' => null , 'list_id' => null
]; ];
@@ -178,7 +178,7 @@ class UsrLists implements ControllerProviderInterface
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => $app->trans('List %name% has been created', array('%name%' => $list_name)) , 'message' => $app->trans('List %name% has been created', ['%name%' => $list_name])
, 'list_id' => $List->getId() , 'list_id' => $List->getId()
]; ];
} catch (ControllerException $e) { } catch (ControllerException $e) {
@@ -393,13 +393,13 @@ class UsrLists implements ControllerProviderInterface
if (count($inserted_usr_ids) > 1) { if (count($inserted_usr_ids) > 1) {
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% Users added to list', array('%quantity%' => count($inserted_usr_ids))) , 'message' => $app->trans('%quantity% Users added to list', ['%quantity%' => count($inserted_usr_ids)])
, 'result' => $inserted_usr_ids , 'result' => $inserted_usr_ids
]; ];
} else { } else {
$datas = [ $datas = [
'success' => true 'success' => true
, 'message' => $app->trans('%quantity% User added to list', array('%quantity%' => count($inserted_usr_ids))) , 'message' => $app->trans('%quantity% User added to list', ['%quantity%' => count($inserted_usr_ids)])
, 'result' => $inserted_usr_ids , 'result' => $inserted_usr_ids
]; ];
} }

View File

@@ -158,15 +158,15 @@ class WorkZone implements ControllerProviderInterface
if ($alreadyFixed === 0) { if ($alreadyFixed === 0) {
if ($done <= 1) { if ($done <= 1) {
$message = $app->trans('%quantity% Story attached to the WorkZone', array('%quantity%' => $done)); $message = $app->trans('%quantity% Story attached to the WorkZone', ['%quantity%' => $done]);
} else { } else {
$message = $app->trans('%quantity% Stories attached to the WorkZone', array('%quantity%' => $done)); $message = $app->trans('%quantity% Stories attached to the WorkZone', ['%quantity%' => $done]);
} }
} else { } else {
if ($done <= 1) { if ($done <= 1) {
$message = $app->trans('%quantity% Story attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed)); $message = $app->trans('%quantity% Story attached to the WorkZone, %quantity_already% already attached', ['%quantity%' => $done, '%quantity_already%' => $alreadyFixed]);
} else { } else {
$message = $app->trans('%quantity% Stories attached to the WorkZone, %quantity_already% already attached', array('%quantity%' => $done, '%quantity_already%' => $alreadyFixed)); $message = $app->trans('%quantity% Stories attached to the WorkZone, %quantity_already% already attached', ['%quantity%' => $done, '%quantity_already%' => $alreadyFixed]);
} }
} }

View File

@@ -819,7 +819,7 @@ class Activity implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $field 'field' => $field
]), "title" => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]); ]), "title" => $app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
} }
if ($field === $value) { if ($field === $value) {
@@ -864,7 +864,7 @@ class Activity implements ControllerProviderInterface
'is_doc' => false 'is_doc' => false
]), ]),
'display_nav' => false, 'display_nav' => false,
'title' => $app->trans('Groupement des resultats sur le champ %name%', array('%name%' => $groupField)) 'title' => $app->trans('Groupement des resultats sur le champ %name%', ['%name%' => $groupField])
]); ]);
} }

View File

@@ -151,7 +151,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $field 'field' => $field
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]); ]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
} }
if ($field === $value) { if ($field === $value) {
@@ -409,7 +409,7 @@ class Informations implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $download->colFilter($field), 'result' => $download->colFilter($field),
'field' => $field 'field' => $field
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]); ]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
} }
if ($field === $value) { if ($field === $value) {

View File

@@ -570,7 +570,7 @@ class Root implements ControllerProviderInterface
return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [
'result' => $report->colFilter($field), 'result' => $report->colFilter($field),
'field' => $field 'field' => $field
]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', array('%colonne%' => $field))]); ]), 'title' => $app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
} }
if ($field === $value) { if ($field === $value) {
@@ -615,7 +615,7 @@ class Root implements ControllerProviderInterface
'is_doc' => false 'is_doc' => false
]), ]),
'display_nav' => false, 'display_nav' => false,
'title' => $app->trans('Groupement des resultats sur le champ %name%', array('%name%' => $groupField)) 'title' => $app->trans('Groupement des resultats sur le champ %name%', ['%name%' => $groupField])
]); ]);
} }

View File

@@ -899,7 +899,7 @@ class Login implements ControllerProviderInterface
$provider->onCallback($request); $provider->onCallback($request);
$token = $provider->getToken(); $token = $provider->getToken();
} catch (NotAuthenticatedException $e) { } catch (NotAuthenticatedException $e) {
$app['session']->getFlashBag()->add('error', $app->trans('Unable to authenticate with %provider_name%', array('%provider_name%' => $provider->getName()))); $app['session']->getFlashBag()->add('error', $app->trans('Unable to authenticate with %provider_name%', ['%provider_name%' => $provider->getName()]));
return $app->redirectPath('homepage'); return $app->redirectPath('homepage');
} }

View File

@@ -180,7 +180,7 @@ class Setup implements ControllerProviderInterface
]); ]);
} catch (\Exception $e) { } catch (\Exception $e) {
return $app->redirectPath('install_step2', [ return $app->redirectPath('install_step2', [
'error' => $app->trans('an error occured : %message%', array('%message%' => $e->getMessage())), 'error' => $app->trans('an error occured : %message%', ['%message%' => $e->getMessage()]),
]); ]);
} }
} }

View File

@@ -429,7 +429,7 @@ class Thesaurus implements ControllerProviderInterface
$dom->formatOutput = true; $dom->formatOutput = true;
$root = $dom->appendChild($dom->createElementNS('www.phraseanet.com', 'phraseanet:topics')); $root = $dom->appendChild($dom->createElementNS('www.phraseanet.com', 'phraseanet:topics'));
$root->appendChild($dom->createComment($app->trans('thesaurus:: fichier genere le %date%', array('%date%' => $now)))); $root->appendChild($dom->createComment($app->trans('thesaurus:: fichier genere le %date%', ['%date%' => $now])));
$root->appendChild($dom->createElement('display')) $root->appendChild($dom->createElement('display'))
->appendChild($dom->createElement('defaultview')) ->appendChild($dom->createElement('defaultview'))
@@ -445,7 +445,7 @@ class Thesaurus implements ControllerProviderInterface
@rename($app['root.path'] . '/config/topics/' . $fname, $app['root.path'] . '/config/topics/topics_' . $lng . '_BKP_' . $now . '.xml'); @rename($app['root.path'] . '/config/topics/' . $fname, $app['root.path'] . '/config/topics/topics_' . $lng . '_BKP_' . $now . '.xml');
if ($dom->save($app['root.path'] . '/config/topics/' . $fname)) { if ($dom->save($app['root.path'] . '/config/topics/' . $fname)) {
$lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: fichier genere : %filename%', array('%filename%' => $fname))); $lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: fichier genere : %filename%', ['%filename%' => $fname]));
} else { } else {
$lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: erreur lors de l\'enregsitrement du fichier')); $lngs[$lng] = \p4string::MakeString($app->trans('thesaurus:: erreur lors de l\'enregsitrement du fichier'));
} }
@@ -608,20 +608,20 @@ class Thesaurus implements ControllerProviderInterface
$line = substr($line, 1); $line = substr($line, 1);
} }
if ($depth > $curdepth + 1) { if ($depth > $curdepth + 1) {
$err = $app->trans("over-indent at line %line%", array('%line%' => $iline)); $err = $app->trans("over-indent at line %line%", ['%line%' => $iline]);
continue; continue;
} }
$line = trim($line); $line = trim($line);
if ( ! $this->checkEncoding($line, 'UTF-8')) { if ( ! $this->checkEncoding($line, 'UTF-8')) {
$err = $app->trans("bad encoding at line %line%", array('%line%' => $iline)); $err = $app->trans("bad encoding at line %line%", ['%line%' => $iline]);
continue; continue;
} }
$line = str_replace($cbad, $cok, ($oldline = $line)); $line = str_replace($cbad, $cok, ($oldline = $line));
if ($line != $oldline) { if ($line != $oldline) {
$err = $app->trans("bad character at line %line%", array('%line%' => $iline)); $err = $app->trans("bad character at line %line%", ['%line%' => $iline]);
continue; continue;
} }

View File

@@ -1508,10 +1508,10 @@ class Xmlhttp implements ControllerProviderInterface
$databox->saveCterms($sbas['domct']); $databox->saveCterms($sbas['domct']);
} }
} }
$ret['msg'] = $app->trans('prod::thesaurusTab:dlg:%number% record(s) updated', array('%number%' => $ret['nRecsUpdated'])); $ret['msg'] = $app->trans('prod::thesaurusTab:dlg:%number% record(s) updated', ['%number%' => $ret['nRecsUpdated']]);
} else { } else {
// too many records to update // too many records to update
$ret['msg'] = $app->trans('prod::thesaurusTab:dlg:too many (%number%) records to update (limit=%maximum%)', array('%number%' => $ret['nRecsToUpdate'], '%maximum%' => self::SEARCH_REPLACE_MAXREC)); $ret['msg'] = $app->trans('prod::thesaurusTab:dlg:too many (%number%) records to update (limit=%maximum%)', ['%number%' => $ret['nRecsToUpdate'], '%maximum%' => self::SEARCH_REPLACE_MAXREC]);
} }
return $app->json($ret); return $app->json($ret);

View File

@@ -15,7 +15,6 @@ use Alchemy\Phrasea\Command\Developer\Utils\ConstraintExtractor;
use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\DocParser; use Doctrine\Common\Annotations\DocParser;
use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver;
use Gedmo\SoftDeleteable\Mapping\Driver\Annotation; use Gedmo\SoftDeleteable\Mapping\Driver\Annotation;
use JMS\TranslationBundle\Translation\ConfigBuilder; use JMS\TranslationBundle\Translation\ConfigBuilder;
use JMS\TranslationBundle\Translation\Dumper\SymfonyDumperAdapter; use JMS\TranslationBundle\Translation\Dumper\SymfonyDumperAdapter;
@@ -31,7 +30,6 @@ use JMS\TranslationBundle\Translation\Loader\SymfonyLoaderAdapter;
use JMS\TranslationBundle\Translation\Loader\XliffLoader; use JMS\TranslationBundle\Translation\Loader\XliffLoader;
use JMS\TranslationBundle\Translation\LoaderManager; use JMS\TranslationBundle\Translation\LoaderManager;
use JMS\TranslationBundle\Translation\Updater; use JMS\TranslationBundle\Translation\Updater;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Translation\Dumper\PoFileDumper; use Symfony\Component\Translation\Dumper\PoFileDumper;
use Symfony\Component\Translation\Loader\PoFileLoader; use Symfony\Component\Translation\Loader\PoFileLoader;
@@ -53,13 +51,13 @@ class TranslationExtractorServiceProvider implements ServiceProviderInterface
return $parser; return $parser;
}); });
$app['translation-extractor.node-visitors'] = $app->share(function (Application $app) { $app['translation-extractor.node-visitors'] = $app->share(function (Application $app) {
return array( return [
new ConstraintExtractor($app), new ConstraintExtractor($app),
new ValidationExtractor($app['validator']->getMetadataFactory()), new ValidationExtractor($app['validator']->getMetadataFactory()),
new DefaultPhpFileExtractor($app['translation-extractor.doc-parser']), new DefaultPhpFileExtractor($app['translation-extractor.doc-parser']),
new TwigFileExtractor($app['twig']), new TwigFileExtractor($app['twig']),
new FormExtractor($app['translation-extractor.doc-parser']), new FormExtractor($app['translation-extractor.doc-parser']),
); ];
}); });
$app['translation-extractor.file-extractor'] = $app->share(function (Application $app) { $app['translation-extractor.file-extractor'] = $app->share(function (Application $app) {
return new FileExtractor($app['twig'], $app['translation-extractor.logger'], $app['translation-extractor.node-visitors']); return new FileExtractor($app['twig'], $app['translation-extractor.logger'], $app['translation-extractor.node-visitors']);
@@ -73,20 +71,20 @@ class TranslationExtractorServiceProvider implements ServiceProviderInterface
}); });
$app['translation-extractor.writers'] = $app->share(function () { $app['translation-extractor.writers'] = $app->share(function () {
return array( return [
'po' => new SymfonyDumperAdapter(new PoFileDumper(), 'po'), 'po' => new SymfonyDumperAdapter(new PoFileDumper(), 'po'),
'xliff' => new XliffDumper(), 'xliff' => new XliffDumper(),
); ];
}); });
$app['translation-extractor.loader-manager'] = $app->share(function (Application $app) { $app['translation-extractor.loader-manager'] = $app->share(function (Application $app) {
return new LoaderManager($app['translation-extractor.loaders']); return new LoaderManager($app['translation-extractor.loaders']);
}); });
$app['translation-extractor.loaders'] = $app->share(function () { $app['translation-extractor.loaders'] = $app->share(function () {
return array( return [
'po' => new SymfonyLoaderAdapter(new PoFileLoader()), 'po' => new SymfonyLoaderAdapter(new PoFileLoader()),
'xliff' => new XliffLoader() 'xliff' => new XliffLoader()
); ];
}); });
$app['translation-extractor.updater'] = $app->share(function (Application $app) { $app['translation-extractor.updater'] = $app->share(function (Application $app) {

View File

@@ -26,7 +26,7 @@ class LocaleServiceProvider implements ServiceProviderInterface
$app['locales.available'] = $app->share(function (Application $app) { $app['locales.available'] = $app->share(function (Application $app) {
$availableLanguages = PhraseaApplication::getAvailableLanguages(); $availableLanguages = PhraseaApplication::getAvailableLanguages();
if ($app['configuration.store']->isSetup() && $app['conf']->has(['main', 'languages'])) { if ($app['configuration.store']->isSetup() && 0 < count((array) $app['conf']->get(['main', 'languages'], []))) {
$languages = $app['conf']->get(['main', 'languages']); $languages = $app['conf']->get(['main', 'languages']);
$enabledLanguages = $availableLanguages; $enabledLanguages = $availableLanguages;

View File

@@ -13,13 +13,13 @@ class TranslationServiceProvider implements ServiceProviderInterface
{ {
public function register(Application $app) public function register(Application $app)
{ {
$app['translator.cache-options'] = array(); $app['translator.cache-options'] = [];
$app['translator'] = $app->share(function ($app) { $app['translator'] = $app->share(function ($app) {
$app['translator.cache-options'] = array_replace( $app['translator.cache-options'] = array_replace(
array( [
'debug' => $app['debug'], 'debug' => $app['debug'],
), $app['translator.cache-options'] ], $app['translator.cache-options']
); );
$translator = new CachedTranslator($app, $app['translator.message_selector'], $app['translator.cache-options']); $translator = new CachedTranslator($app, $app['translator.message_selector'], $app['translator.cache-options']);
@@ -47,8 +47,8 @@ class TranslationServiceProvider implements ServiceProviderInterface
return new MessageSelector(); return new MessageSelector();
}); });
$app['translator.domains'] = array(); $app['translator.domains'] = [];
$app['locale_fallbacks'] = array('en'); $app['locale_fallbacks'] = ['en'];
} }
public function boot(Application $app) public function boot(Application $app)

View File

@@ -20,7 +20,7 @@ class PhraseaForgotPasswordForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('email', 'email', [ $builder->add('email', 'email', [
'label' => ('E-mail'), 'label' => 'E-mail',
'required' => true, 'required' => true,
'constraints' => [ 'constraints' => [
new Assert\NotBlank(), new Assert\NotBlank(),

View File

@@ -44,8 +44,8 @@ class PhraseaRecoverPasswordForm extends AbstractType
'invalid_message' => 'Please provide the same passwords.', 'invalid_message' => 'Please provide the same passwords.',
'first_name' => 'password', 'first_name' => 'password',
'second_name' => 'confirm', 'second_name' => 'confirm',
'first_options' => ['label' => ('New password')], 'first_options' => ['label' => 'New password'],
'second_options' => ['label' => ('New password (confirmation)')], 'second_options' => ['label' => 'New password (confirmation)'],
'constraints' => [ 'constraints' => [
new Assert\NotBlank(), new Assert\NotBlank(),
new Assert\Length(['min' => 5]), new Assert\Length(['min' => 5]),

View File

@@ -35,7 +35,7 @@ class PhraseaRegisterForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('email', 'email', [ $builder->add('email', 'email', [
'label' => ('E-mail'), 'label' => 'E-mail',
'required' => true, 'required' => true,
'constraints' => [ 'constraints' => [
new Assert\NotBlank(), new Assert\NotBlank(),
@@ -60,11 +60,11 @@ class PhraseaRegisterForm extends AbstractType
if ($this->app->hasTermsOfUse()) { if ($this->app->hasTermsOfUse()) {
$builder->add('accept-tou', 'checkbox', [ $builder->add('accept-tou', 'checkbox', [
'label' => ('Terms of Use'), 'label' => 'Terms of Use',
'mapped' => false, 'mapped' => false,
"constraints" => [ "constraints" => [
new Assert\True([ new Assert\True([
"message" => ("Please accept the Terms and conditions in order to register.") "message" => "Please accept the Terms and conditions in order to register."
])], ])],
]); ]);
} }
@@ -115,7 +115,7 @@ class PhraseaRegisterForm extends AbstractType
'constraints' => [ 'constraints' => [
new Assert\Choice([ new Assert\Choice([
'choices' => $baseIds, 'choices' => $baseIds,
'minMessage' => ('You must select at least %s collection.'), 'minMessage' => 'You must select at least %s collection.',
'multiple' => true, 'multiple' => true,
'min' => 1, 'min' => 1,
]), ]),

View File

@@ -617,7 +617,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
} }
if ($oldReceiver) { if ($oldReceiver) {
$mailOldAddress = MailSuccessEmailUpdate::create($this->app, $oldReceiver, null, $this->app->trans('You will now receive notifications at %new_email%', array('%new_email%' => $new_email))); $mailOldAddress = MailSuccessEmailUpdate::create($this->app, $oldReceiver, null, $this->app->trans('You will now receive notifications at %new_email%', ['%new_email%' => $new_email]));
$this->app['notification.deliverer']->deliver($mailOldAddress); $this->app['notification.deliverer']->deliver($mailOldAddress);
} }
@@ -628,7 +628,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
} }
if ($newReceiver) { if ($newReceiver) {
$mailNewAddress = MailSuccessEmailUpdate::create($this->app, $newReceiver, null, $this->app->trans('You will no longer receive notifications at %old_email%', array('%old_email%' => $old_email))); $mailNewAddress = MailSuccessEmailUpdate::create($this->app, $newReceiver, null, $this->app->trans('You will no longer receive notifications at %old_email%', ['%old_email%' => $old_email]));
$this->app['notification.deliverer']->deliver($mailNewAddress); $this->app['notification.deliverer']->deliver($mailNewAddress);
} }
} }

View File

@@ -965,7 +965,7 @@ class User
public function getDisplayName(TranslatorInterface $translator) public function getDisplayName(TranslatorInterface $translator)
{ {
if ($this->isTemplate()) { if ($this->isTemplate()) {
return $translator->trans('modele %name%', array('%name%' => $this->getLogin())); return $translator->trans('modele %name%', ['%name%' => $this->getLogin()]);
} }
if (trim($this->lastName) !== '' || trim($this->firstName) !== '') { if (trim($this->lastName) !== '' || trim($this->firstName) !== '') {

View File

@@ -264,15 +264,15 @@ class ValidationSession
if ($this->isInitiator($user)) { if ($this->isInitiator($user)) {
if ($this->isFinished()) { if ($this->isFinished()) {
return $app->trans('Vous aviez envoye cette demande a %n% utilisateurs', array('%n%' => count($this->getParticipants()) - 1)); return $app->trans('Vous aviez envoye cette demande a %n% utilisateurs', ['%n%' => count($this->getParticipants()) - 1]);
} else { } else {
return $app->trans('Vous avez envoye cette demande a %n% utilisateurs', array('%n%' => count($this->getParticipants()) - 1)); return $app->trans('Vous avez envoye cette demande a %n% utilisateurs', ['%n%' => count($this->getParticipants()) - 1]);
} }
} else { } else {
if ($this->getParticipant($user, $app)->getCanSeeOthers()) { if ($this->getParticipant($user, $app)->getCanSeeOthers()) {
return $app->trans('Processus de validation recu de %user% et concernant %n% utilisateurs', array('%user%' => $this->getInitiator($app)->get_display_name(), '%n%' => count($this->getParticipants()) - 1)); return $app->trans('Processus de validation recu de %user% et concernant %n% utilisateurs', ['%user%' => $this->getInitiator($app)->get_display_name(), '%n%' => count($this->getParticipants()) - 1]);
} else { } else {
return $app->trans('Processus de validation recu de %user%', array('%user%' => $this->getInitiator($app)->get_display_name())); return $app->trans('Processus de validation recu de %user%', ['%user%' => $this->getInitiator($app)->get_display_name()]);
} }
} }
} }

View File

@@ -45,7 +45,7 @@ class MailInfoBridgeUploadFailed extends AbstractMailWithLink
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('Upload failed on %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('Upload failed on %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**
@@ -60,7 +60,7 @@ class MailInfoBridgeUploadFailed extends AbstractMailWithLink
throw new LogicException('You must set a reason before calling getMessage'); throw new LogicException('You must set a reason before calling getMessage');
} }
return $this->app->trans('An upload on %bridge_adapter% failed, the resaon is : %reason%', array('%bridge_adapter%' => $this->adapter, '%reason%' => $this->reason)); return $this->app->trans('An upload on %bridge_adapter% failed, the resaon is : %reason%', ['%bridge_adapter%' => $this->adapter, '%reason%' => $this->reason]);
} }
/** /**

View File

@@ -33,7 +33,7 @@ class MailInfoNewOrder extends AbstractMail
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('admin::register: Nouvelle commande sur %s', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('admin::register: Nouvelle commande sur %s', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**
@@ -45,7 +45,7 @@ class MailInfoNewOrder extends AbstractMail
throw new LogicException('You must set a user before calling getMessage()'); throw new LogicException('You must set a user before calling getMessage()');
} }
return $this->app->trans('%user% has ordered documents', array('%user%' => $this->user->get_display_name())); return $this->app->trans('%user% has ordered documents', ['%user%' => $this->user->get_display_name()]);
} }
/** /**
@@ -53,7 +53,7 @@ class MailInfoNewOrder extends AbstractMail
*/ */
public function getButtonText() public function getButtonText()
{ {
return $this->app->trans('Review order on %website%', array('%website%' => $this->getPhraseanetTitle())); return $this->app->trans('Review order on %website%', ['%website%' => $this->getPhraseanetTitle()]);
} }
/** /**

View File

@@ -49,7 +49,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getMessage'); throw new LogicException('You must set an title before calling getMessage');
} }
return $this->app->trans('Nouvelle publication : %title%', array('%title%' => $this->title)); return $this->app->trans('Nouvelle publication : %title%', ['%title%' => $this->title]);
} }
/** /**
@@ -64,7 +64,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getMessage'); throw new LogicException('You must set an title before calling getMessage');
} }
return $this->app->trans('%user% vient de publier %title%', array('%user%' => $this->author, '%title%' => $this->title)); return $this->app->trans('%user% vient de publier %title%', ['%user%' => $this->author, '%title%' => $this->title]);
} }
/** /**
@@ -72,7 +72,7 @@ class MailInfoNewPublication extends AbstractMailWithLink
*/ */
public function getButtonText() public function getButtonText()
{ {
return $this->app->trans('View on %title%', array('%title%' => $this->getPhraseanetTitle())); return $this->app->trans('View on %title%', ['%title%' => $this->getPhraseanetTitle()]);
} }
/** /**

View File

@@ -60,10 +60,10 @@ class MailInfoOrderCancelled extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage()'); throw new LogicException('You must set a deliverer before calling getMessage()');
} }
return $this->app->trans('%user% a refuse %quantity% elements de votre commande', array( return $this->app->trans('%user% a refuse %quantity% elements de votre commande', [
'%user%' => $this->deliverer->get_display_name(), '%user%' => $this->deliverer->get_display_name(),
'%quantity%' => $this->quantity, '%quantity%' => $this->quantity,
)); ]);
} }
/** /**

View File

@@ -50,7 +50,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a basket before calling getSubject'); throw new LogicException('You must set a basket before calling getSubject');
} }
return $this->app->trans('push::mail:: Reception de votre commande %title%', array('%title%' => $this->basket->getName())); return $this->app->trans('push::mail:: Reception de votre commande %title%', ['%title%' => $this->basket->getName()]);
} }
/** /**
@@ -62,7 +62,7 @@ class MailInfoOrderDelivered extends AbstractMail
throw new LogicException('You must set a deliverer before calling getMessage'); throw new LogicException('You must set a deliverer before calling getMessage');
} }
return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', array('%user%' => $this->deliverer->get_display_name())); return $this->app->trans('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', ['%user%' => $this->deliverer->get_display_name()]);
} }
/** /**

View File

@@ -45,7 +45,7 @@ class MailInfoPushReceived extends AbstractMailWithLink
throw new LogicException('You must set a basket before calling getSubject'); throw new LogicException('You must set a basket before calling getSubject');
} }
return $this->app->trans('Reception of %basket_name%', array('%basket_name%' => $this->basket->getName())); return $this->app->trans('Reception of %basket_name%', ['%basket_name%' => $this->basket->getName()]);
} }
/** /**
@@ -61,7 +61,7 @@ class MailInfoPushReceived extends AbstractMailWithLink
} }
return return
$this->app->trans('You just received a push containing %quantity% documents from %user%', array('%quantity%' => count($this->basket->getElements()), '%user%' => $this->pusher->get_display_name())) $this->app->trans('You just received a push containing %quantity% documents from %user%', ['%quantity%' => count($this->basket->getElements()), '%user%' => $this->pusher->get_display_name()])
. "\n" . $this->message; . "\n" . $this->message;
} }

View File

@@ -18,7 +18,7 @@ class MailInfoSomebodyAutoregistered extends AbstractMailWithLink
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('admin::register: Inscription automatique sur %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('admin::register: Inscription automatique sur %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**

View File

@@ -33,7 +33,7 @@ class MailInfoUserRegistered extends AbstractMail
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('admin::register: demande d\'inscription sur %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('admin::register: demande d\'inscription sur %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**

View File

@@ -52,10 +52,10 @@ class MailInfoValidationDone extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getSubject'); throw new LogicException('You must set an title before calling getSubject');
} }
return $this->app->trans('push::mail:: Rapport de validation de %user% pour %title%', array( return $this->app->trans('push::mail:: Rapport de validation de %user% pour %title%', [
'%user%' => $this->user->get_display_name(), '%user%' => $this->user->get_display_name(),
'%title%' => $this->title, '%title%' => $this->title,
)); ]);
} }
/** /**
@@ -67,9 +67,9 @@ class MailInfoValidationDone extends AbstractMailWithLink
throw new LogicException('You must set an user before calling getMessage'); throw new LogicException('You must set an user before calling getMessage');
} }
return $this->app->trans('%user% has just sent its validation report, you can now see it', array( return $this->app->trans('%user% has just sent its validation report, you can now see it', [
'%user%' => $this->user->get_display_name(), '%user%' => $this->user->get_display_name(),
)); ]);
} }
/** /**

View File

@@ -37,7 +37,7 @@ class MailInfoValidationReminder extends AbstractMailWithLink
throw new LogicException('You must set an title before calling getSubject'); throw new LogicException('You must set an title before calling getSubject');
} }
return $this->app->trans("Reminder : validate '%title%'", array('%title%' => $this->title)); return $this->app->trans("Reminder : validate '%title%'", ['%title%' => $this->title]);
} }
/** /**
@@ -45,9 +45,9 @@ class MailInfoValidationReminder extends AbstractMailWithLink
*/ */
public function getMessage() public function getMessage()
{ {
return $this->app->trans('Il ne vous reste plus que %quantity% jours pour terminer votre validation', array( return $this->app->trans('Il ne vous reste plus que %quantity% jours pour terminer votre validation', [
'%quantity%' => $this->app['phraseanet.registry']->get('GV_validation_reminder') '%quantity%' => $this->app['phraseanet.registry']->get('GV_validation_reminder')
)); ]);
} }
/** /**

View File

@@ -59,7 +59,7 @@ class MailInfoValidationRequest extends AbstractMailWithLink
throw new LogicException('You must set a title before calling getSubject'); throw new LogicException('You must set a title before calling getSubject');
} }
return $this->app->trans("Validation request from %user% for '%title%'", array('%user%' => $this->user->get_display_name(), '%title%' => $this->title)); return $this->app->trans("Validation request from %user% for '%title%'", ['%user%' => $this->user->get_display_name(), '%title%' => $this->title]);
} }
/** /**
@@ -69,7 +69,7 @@ class MailInfoValidationRequest extends AbstractMailWithLink
{ {
if (0 < $this->duration) { if (0 < $this->duration) {
if (1 < $this->duration) { if (1 < $this->duration) {
return $this->message . "\n\n" . $this->app->trans("You have %d days to validate the selection.", array('%quantity%' => $this->duration)); return $this->message . "\n\n" . $this->app->trans("You have %d days to validate the selection.", ['%quantity%' => $this->duration]);
} else { } else {
return $this->message . "\n\n" . $this->app->trans("You have 1 day to validate the selection."); return $this->message . "\n\n" . $this->app->trans("You have 1 day to validate the selection.");
} }

View File

@@ -33,7 +33,7 @@ class MailRequestPasswordSetup extends AbstractMailWithLink
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('Your account on %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('Your account on %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**
@@ -45,7 +45,7 @@ class MailRequestPasswordSetup extends AbstractMailWithLink
throw new LogicException('You must set a login before calling getMessage'); throw new LogicException('You must set a login before calling getMessage');
} }
return $this->app->trans('Your account with the login %login% as been created', array('%login%' => $this->login)) return $this->app->trans('Your account with the login %login% as been created', ['%login%' => $this->login])
. "\n" . "\n"
. $this->app->trans('You now have to set up your pasword'); . $this->app->trans('You now have to set up your pasword');
} }

View File

@@ -45,7 +45,7 @@ class MailRequestPasswordUpdate extends AbstractMailWithLink
throw new LogicException('You must set a login before calling getMessage'); throw new LogicException('You must set a login before calling getMessage');
} }
return $this->app->trans('Password renewal for login "%login%" has been requested', array('%login%' => $this->login)) return $this->app->trans('Password renewal for login "%login%" has been requested', ['%login%' => $this->login])
. "\n" . "\n"
. $this->app->trans('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien'); . $this->app->trans('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien');
} }

View File

@@ -18,7 +18,7 @@ class MailSuccessAccessRequest extends AbstractMailWithLink
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('login::register:email: Votre compte %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('login::register:email: Votre compte %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**

View File

@@ -34,7 +34,7 @@ class MailSuccessEmailConfirmationRegistered extends AbstractMailWithLink
*/ */
public function getButtonText() public function getButtonText()
{ {
return $this->app->trans('Your access on %application%', array('%application%' => $this->app['phraseanet.registry']->get('GV_homeTile'))); return $this->app->trans('Your access on %application%', ['%application%' => $this->app['phraseanet.registry']->get('GV_homeTile')]);
} }
/** /**

View File

@@ -18,7 +18,7 @@ class MailSuccessEmailUpdate extends AbstractMail
*/ */
public function getSubject() public function getSubject()
{ {
return $this->app->trans('Update of your email address on %application%', array('%application%' => $this->getPhraseanetTitle())); return $this->app->trans('Update of your email address on %application%', ['%application%' => $this->getPhraseanetTitle()]);
} }
/** /**
@@ -27,7 +27,7 @@ class MailSuccessEmailUpdate extends AbstractMail
public function getMessage() public function getMessage()
{ {
return sprintf("%s\n%s\n%s", return sprintf("%s\n%s\n%s",
$this->app->trans('Dear %user%,', array('%user%' => $this->receiver->getName())), $this->app->trans('Dear %user%,', ['%user%' => $this->receiver->getName()]),
$this->app->trans('Your contact email address has been updated'), $this->app->trans('Your contact email address has been updated'),
$this->message $this->message
); );

View File

@@ -37,10 +37,10 @@ class MailSuccessFTPSender extends AbstractMail
throw new LogicException('You must set server before calling getSubject'); throw new LogicException('You must set server before calling getSubject');
} }
return $this->app->trans('task::ftp:Status about your FTP transfert from %application% to %server%', array( return $this->app->trans('task::ftp:Status about your FTP transfert from %application% to %server%', [
'%application%' => $this->getPhraseanetTitle(), '%application%' => $this->getPhraseanetTitle(),
'%server%' => $this->server, '%server%' => $this->server,
)); ]);
} }
/** /**

View File

@@ -26,7 +26,7 @@ class MailTest extends AbstractMail
*/ */
public function getMessage() public function getMessage()
{ {
return sprintf("%s\n%s", $this->app->trans('Ce mail est un test d\'envoi de mail depuis %application%', array('%application%' => $this->getPhraseanetTitle())), $this->message); return sprintf("%s\n%s", $this->app->trans('Ce mail est un test d\'envoi de mail depuis %application%', ['%application%' => $this->getPhraseanetTitle()]), $this->message);
} }
/** /**

View File

@@ -494,13 +494,13 @@ class PhraseaEngine implements SearchEngineInterface
if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) { if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) {
$style = $b ? 'style="margin-top:0px;"' : ''; $style = $b ? 'style="margin-top:0px;"' : '';
$b = false; $b = false;
$html .= "<h1 $style>" . $translator->trans('reponses::propositions pour la base %name', array('%name%' => $zbase["NAME"])) . "</h1>"; $html .= "<h1 $style>" . $translator->trans('reponses::propositions pour la base %name', ['%name%' => $zbase["NAME"]]) . "</h1>";
} }
$t = true; $t = true;
foreach ($zbase["TERMS"] as $path => $props) { foreach ($zbase["TERMS"] as $path => $props) {
$style = $t ? 'style="margin-top:0px;"' : ''; $style = $t ? 'style="margin-top:0px;"' : '';
$t = false; $t = false;
$html .= "<h2 $style>" . $translator->trans('reponses::propositions pour le terme %terme%', array('%terme%' => $props["TERM"])) . "</h2>"; $html .= "<h2 $style>" . $translator->trans('reponses::propositions pour le terme %terme%', ['%terme%' => $props["TERM"]]) . "</h2>";
$html .= $props["HTML"]; $html .= $props["HTML"];
} }
} }

View File

@@ -895,7 +895,7 @@ class PhraseaEngineQueryParser
// un op. arith. doit étre précédé d'un seul nom de champ // un op. arith. doit étre précédé d'un seul nom de champ
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
$this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, un nom de champs est attendu avant l operateur %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, un nom de champs est attendu avant l operateur %token%', ['%token%' => $tree["VALUE"]]);
return(false); return(false);
} }
@@ -903,7 +903,7 @@ class PhraseaEngineQueryParser
// un op. arith. doit étre suivi d'une valeur // un op. arith. doit étre suivi d'une valeur
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
$this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, une valeur est attendue apres l operateur %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, une valeur est attendue apres l operateur %token%', ['%token%' => $tree["VALUE"]]);
return(false); return(false);
} }
@@ -1456,7 +1456,7 @@ class PhraseaEngineQueryParser
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
$this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, une valeur est attendu apres %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, une valeur est attendu apres %token%', ['%token%' => $tree["VALUE"]]);
$tree = $tree["LB"]; $tree = $tree["LB"];
} }
@@ -1505,14 +1505,14 @@ class PhraseaEngineQueryParser
if (!$tree) { if (!$tree) {
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
$this->errmsg .= $this->app->trans('qparser::erreur : une question ne peut commencer par %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::erreur : une question ne peut commencer par %token%', ['%token%' => $tree["VALUE"]]);
return(null); return(null);
} }
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
$this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, ne peut suivre un operateur : %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, ne peut suivre un operateur : %token%', ['%token%' => $tree["VALUE"]]);
return(null); return(null);
} }
@@ -1525,7 +1525,7 @@ class PhraseaEngineQueryParser
if (!$tree) { if (!$tree) {
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
$this->errmsg .= $this->app->trans('qparser::erreur : une question ne peut commencer par %token%', array('%token%' => $tree["VALUE"])); $this->errmsg .= $this->app->trans('qparser::erreur : une question ne peut commencer par %token%', ['%token%' => $tree["VALUE"]]);
return(null); return(null);
} }
@@ -1533,7 +1533,7 @@ class PhraseaEngineQueryParser
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
$this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, %token% ne peut suivre un operateur', array('%token%' => $t["VALUE"])); $this->errmsg .= $this->app->trans('qparser::Formulation incorrecte, %token% ne peut suivre un operateur', ['%token%' => $t["VALUE"]]);
return(null); return(null);
} }

View File

@@ -101,19 +101,19 @@ class FtpJob extends AbstractJob
$ftpLog = $ftp_user_name . "@" . \p4string::addEndSlash($ftp_server) . $export->getDestfolder(); $ftpLog = $ftp_user_name . "@" . \p4string::addEndSlash($ftp_server) . $export->getDestfolder();
if ($export->getCrash() == 0) { if ($export->getCrash() == 0) {
$line = $this->translator->trans('task::ftp:Etat d\'envoi FTP vers le serveur "%server%" avec le compte "%username%" et pour destination le dossier : "%directory%"', array( $line = $this->translator->trans('task::ftp:Etat d\'envoi FTP vers le serveur "%server%" avec le compte "%username%" et pour destination le dossier : "%directory%"', [
'%server%' => $ftp_server, '%server%' => $ftp_server,
'%username%' => $ftp_user_name, '%username%' => $ftp_user_name,
'%directory%' => $export->getDestfolder(), '%directory%' => $export->getDestfolder(),
)) . PHP_EOL; ]) . PHP_EOL;
$state .= $line; $state .= $line;
$this->log('debug', $line); $this->log('debug', $line);
} }
$state .= $line = $this->translator->trans("task::ftp:TENTATIVE no %number%, %date%", array( $state .= $line = $this->translator->trans("task::ftp:TENTATIVE no %number%, %date%", [
'%number%' => $export->getCrash() + 1, '%number%' => $export->getCrash() + 1,
'%date%' => " (" . date('r') . ")" '%date%' => " (" . date('r') . ")"
)) . PHP_EOL; ]) . PHP_EOL;
$this->log('debug', $line); $this->log('debug', $line);
@@ -242,7 +242,7 @@ class FtpJob extends AbstractJob
$app['EM']->flush(); $app['EM']->flush();
$this->logexport($app, $record, $obj, $ftpLog); $this->logexport($app, $record, $obj, $ftpLog);
} catch (\Exception $e) { } catch (\Exception $e) {
$state .= $line = $this->translator->trans('task::ftp:File "%file%" (record %record_id%) de la base "%basename%" (Export du Document) : Transfert cancelled (le document n\'existe plus)', array('%file%' => basename($localfile), '%record_id%' => $record_id, '%basename%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $base_id), $app))) . "\n<br/>"; $state .= $line = $this->translator->trans('task::ftp:File "%file%" (record %record_id%) de la base "%basename%" (Export du Document) : Transfert cancelled (le document n\'existe plus)', ['%file%' => basename($localfile), '%record_id%' => $record_id, '%basename%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $base_id), $app)]) . "\n<br/>";
$this->log('debug', $line); $this->log('debug', $line);
@@ -340,22 +340,22 @@ class FtpJob extends AbstractJob
foreach ($export->getElements() as $element) { foreach ($export->getElements() as $element) {
if (!$element->isError() && $element->isDone()) { if (!$element->isError() && $element->isDone()) {
$transferts[] = $transferts[] =
'<li>' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', array( '<li>' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', [
'%recordid%' => $element->getRecordId(), '%recordid%' => $element->getRecordId(),
'%filename%' => $element->getFilename(), '%filename%' => $element->getFilename(),
'%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app), '%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app),
'%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(), '%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(),
'%subdefname%' => $element->getSubdef(), '%subdefname%' => $element->getSubdef(),
)) . ' : ' . $this->translator->trans('Transfert OK') . '</li>'; ]) . ' : ' . $this->translator->trans('Transfert OK') . '</li>';
} else { } else {
$transferts[] = $transferts[] =
'<li>' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', array( '<li>' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', [
'%recordid%' => $element->getRecordId(), '%recordid%' => $element->getRecordId(),
'%filename%' => $element->getFilename(), '%filename%' => $element->getFilename(),
'%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app), '%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app),
'%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(), '%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(),
'%subdefname%' => $element->getSubdef(), '%subdefname%' => $element->getSubdef(),
)) . ' : ' . $this->translator->trans('Transfert Annule') . '</li>'; ]) . ' : ' . $this->translator->trans('Transfert Annule') . '</li>';
$transfert_status = $this->translator->trans('task::ftp:Certains documents n\'ont pas pu etre tranferes'); $transfert_status = $this->translator->trans('task::ftp:Certains documents n\'ont pas pu etre tranferes');
} }
} }

View File

@@ -1,12 +1,7 @@
<?php <?php
/* /**
* This file is part of the Silex framework. * Largely inspired from Symfony Framework Bundle
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/ */
namespace Alchemy\Phrasea\Utilities; namespace Alchemy\Phrasea\Utilities;
@@ -23,12 +18,12 @@ use Symfony\Component\Translation\MessageSelector;
class CachedTranslator extends Translator class CachedTranslator extends Translator
{ {
protected $app; protected $app;
protected $options = array( protected $options = [
'cache_dir' => null, 'cache_dir' => null,
'debug' => false, 'debug' => false,
); ];
public function __construct(Application $app, MessageSelector $selector, array $options = array()) public function __construct(Application $app, MessageSelector $selector, array $options = [])
{ {
$this->app = $app; $this->app = $app;

View File

@@ -133,8 +133,6 @@ class API_OAuth2_Form_DevAppDesktop
*/ */
public static function loadValidatorMetadata(ClassMetadata $metadata) public static function loadValidatorMetadata(ClassMetadata $metadata)
{ {
// supprimer avant merge : verifier que les contraintes URL et NotBlank sont bien analysées dans le dump
$metadata->addPropertyConstraint('name', new Constraints\NotBlank()); $metadata->addPropertyConstraint('name', new Constraints\NotBlank());
$metadata->addPropertyConstraint('description', new Constraints\NotBlank()); $metadata->addPropertyConstraint('description', new Constraints\NotBlank());
$metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank()); $metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank());

View File

@@ -810,9 +810,9 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire");
} else { } else {
if ($length != 0 && mb_strlen($datas[$name]) > $length) if ($length != 0 && mb_strlen($datas[$name]) > $length)
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
if ($length_min != 0 && mb_strlen($datas[$name]) < $length_min) if ($length_min != 0 && mb_strlen($datas[$name]) < $length_min)
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop court %length% caracteres min", array('%length%' => $length_min)); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop court %length% caracteres min", ['%length%' => $length_min]);
} }
}; };
@@ -835,9 +835,9 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
$errors[$name] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name] = $this->translator->trans("Ce champ est obligatoire");
} else { } else {
if ($length != 0 && mb_strlen($datas[$name]) > $length) if ($length != 0 && mb_strlen($datas[$name]) > $length)
$errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
if ($length_min != 0 && mb_strlen($datas[$name]) < $length_min) if ($length_min != 0 && mb_strlen($datas[$name]) < $length_min)
$errors[$name] = $this->translator->trans("Ce champ est trop court %length% caracteres min", array('%length%' => $length_min)); $errors[$name] = $this->translator->trans("Ce champ est trop court %length% caracteres min", ['%length%' => $length_min]);
} }
}; };
@@ -907,10 +907,10 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
$errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file $errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file
if ($record->get_duration() > self::AUTH_VIDEO_DURATION) if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
$errors["duration"] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", array('%duration%' => self::AUTH_VIDEO_DURATION / 60)); $errors["duration"] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", ['%duration%' => self::AUTH_VIDEO_DURATION / 60]);
if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE) if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE)
$errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", array('%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE))); $errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]);
return $errors; return $errors;
} }

View File

@@ -702,7 +702,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire");
} elseif ($length !== 0) { } elseif ($length !== 0) {
if (mb_strlen($datas[$name]) > $length) if (mb_strlen($datas[$name]) > $length)
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
} }
}; };
@@ -724,7 +724,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
$errors[$name] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name] = $this->translator->trans("Ce champ est obligatoire");
} elseif ($length !== 0) { } elseif ($length !== 0) {
if (mb_strlen($datas[$name]) > $length) if (mb_strlen($datas[$name]) > $length)
$errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
} }
}; };
@@ -817,7 +817,7 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf
if ( ! $record->get_hd_file() instanceof \SplFileInfo) if ( ! $record->get_hd_file() instanceof \SplFileInfo)
$errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file $errors["file_size"] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file
if ($record->get_technical_infos('size') > self::AUTH_PHOTO_SIZE) if ($record->get_technical_infos('size') > self::AUTH_PHOTO_SIZE)
$errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", array('%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE))); $errors["size"] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]);
return $errors; return $errors;
} }

View File

@@ -920,7 +920,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est obligatoire");
} elseif ($length !== 0) { } elseif ($length !== 0) {
if (mb_strlen($datas[$name]) > $length) if (mb_strlen($datas[$name]) > $length)
$errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name . '_' . $key] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
} }
}; };
@@ -946,7 +946,7 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
$errors[$name] = $this->translator->trans("Ce champ est obligatoire"); $errors[$name] = $this->translator->trans("Ce champ est obligatoire");
} elseif ($length !== 0) { } elseif ($length !== 0) {
if (mb_strlen($datas[$name]) > $length) if (mb_strlen($datas[$name]) > $length)
$errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", array('%length%' => $length)); $errors[$name] = $this->translator->trans("Ce champ est trop long %length% caracteres max", ['%length%' => $length]);
} }
}; };
@@ -1021,10 +1021,10 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter
$errors["file_size_" . $key] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file $errors["file_size_" . $key] = $this->translator->trans("Le record n'a pas de fichier physique"); //Record must rely on real file
if ($record->get_duration() > self::AUTH_VIDEO_DURATION) if ($record->get_duration() > self::AUTH_VIDEO_DURATION)
$errors["duration_" . $key] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", array('%duration%' => self::AUTH_VIDEO_DURATION / 60)); $errors["duration_" . $key] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", ['%duration%' => self::AUTH_VIDEO_DURATION / 60]);
if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE) if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE)
$errors["size_" . $key] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", array('%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE))); $errors["size_" . $key] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]);
return $errors; return $errors;
} }

View File

@@ -378,7 +378,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$test_user = User_Adapter::get_usr_id_from_email($this->app, $email); $test_user = User_Adapter::get_usr_id_from_email($this->app, $email);
if ($test_user && $test_user != $this->get_id()) { if ($test_user && $test_user != $this->get_id()) {
throw new Exception_InvalidArgument($this->app->trans('A user already exists with email addres %email%', array('%email%' => $email))); throw new Exception_InvalidArgument($this->app->trans('A user already exists with email addres %email%', ['%email%' => $email]));
} }
$sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id'; $sql = 'UPDATE usr SET usr_mail = :new_email WHERE usr_id = :usr_id';
@@ -1112,7 +1112,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_display_name() public function get_display_name()
{ {
if ($this->is_template()) if ($this->is_template())
$display_name = $this->app->trans('modele %name%', array('%name%' => $this->get_login())); $display_name = $this->app->trans('modele %name%', ['%name%' => $this->get_login()]);
elseif (trim($this->lastname) !== '' || trim($this->firstname) !== '') elseif (trim($this->lastname) !== '' || trim($this->firstname) !== '')
$display_name = $this->firstname . ' ' . $this->lastname; $display_name = $this->firstname . ' ' . $this->lastname;
elseif (trim($this->email) !== '') elseif (trim($this->email) !== '')

View File

@@ -357,7 +357,7 @@ class appbox extends base
* Step 7 * Step 7
*/ */
foreach ($this->get_databoxes() as $s) { foreach ($this->get_databoxes() as $s) {
$upgrader->set_current_message($this->app->trans('Upgrading %databox_name%', array('%databox_name%' => $s->get_label($this->app['locale'])))); $upgrader->set_current_message($this->app->trans('Upgrading %databox_name%', ['%databox_name%' => $s->get_label($this->app['locale'])]));
$advices = array_merge($advices, $s->upgradeDB(true, $upgrader, $app)); $advices = array_merge($advices, $s->upgradeDB(true, $upgrader, $app));
$upgrader->add_steps_complete(1); $upgrader->add_steps_complete(1);
} }

View File

@@ -301,7 +301,7 @@ abstract class base implements cache_cacheableInterface
foreach ($rs as $row) { foreach ($rs as $row) {
$tname = $row["Name"]; $tname = $row["Name"];
if (isset($allTables[$tname])) { if (isset($allTables[$tname])) {
$upgrader->set_current_message($app->trans('Updating table %table_name%', array('%table_name%' => $tname))); $upgrader->set_current_message($app->trans('Updating table %table_name%', ['%table_name%' => $tname]));
$engine = strtolower(trim($allTables[$tname]->engine)); $engine = strtolower(trim($allTables[$tname]->engine));
$ref_engine = strtolower($row['Engine']); $ref_engine = strtolower($row['Engine']);
@@ -314,7 +314,7 @@ abstract class base implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
} catch (Exception $e) { } catch (Exception $e) {
$recommends[] = [ $recommends[] = [
'message' => $app->trans('Erreur lors de la tentative ; errreur : %message%', array('%message%' => $e->getMessage())), 'message' => $app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]),
'sql' => $sql 'sql' => $sql
]; ];
} }
@@ -333,13 +333,13 @@ abstract class base implements cache_cacheableInterface
} }
foreach ($allTables as $tname => $table) { foreach ($allTables as $tname => $table) {
$upgrader->set_current_message($app->trans('Creating table %table_name%', array('%table_name%' => $table))); $upgrader->set_current_message($app->trans('Creating table %table_name%', ['%table_name%' => $table]));
$this->createTable($table); $this->createTable($table);
$upgrader->add_steps_complete(1); $upgrader->add_steps_complete(1);
} }
$current_version = $this->get_version(); $current_version = $this->get_version();
$upgrader->set_current_message($app->trans('Applying patches on %databox_name%', array('%databox_name%' => $this->get_dbname()))); $upgrader->set_current_message($app->trans('Applying patches on %databox_name%', ['%databox_name%' => $this->get_dbname()]));
if ($apply_patches) { if ($apply_patches) {
$this->apply_patches($current_version, $app['phraseanet.version']->getNumber(), false, $upgrader, $app); $this->apply_patches($current_version, $app['phraseanet.version']->getNumber(), false, $upgrader, $app);
} }
@@ -536,7 +536,7 @@ abstract class base implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
} catch (Exception $e) { } catch (Exception $e) {
$recommends[] = [ $recommends[] = [
'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', array('%message%' => $e->getMessage())), 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]),
'sql' => $def['sql'] 'sql' => $def['sql']
]; ];
} }
@@ -750,7 +750,7 @@ abstract class base implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
} catch (Exception $e) { } catch (Exception $e) {
$return[] = [ $return[] = [
'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', array('%message%' => $e->getMessage())), 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]),
'sql' => $a 'sql' => $a
]; ];
} }
@@ -763,7 +763,7 @@ abstract class base implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
} catch (Exception $e) { } catch (Exception $e) {
$return[] = [ $return[] = [
'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', array('%message%' => $e->getMessage())), 'message' => $this->app->trans('Erreur lors de la tentative ; errreur : %message%', ['%message%' => $e->getMessage()]),
'sql' => $a 'sql' => $a
]; ];
} }
@@ -821,7 +821,7 @@ abstract class base implements cache_cacheableInterface
$upgrader->add_steps_complete(1) $upgrader->add_steps_complete(1)
->add_steps(count($list_patches)) ->add_steps(count($list_patches))
->set_current_message($app->trans('Applying patches on %databox_name%', array('%databox_name%' => $this->get_dbname()))); ->set_current_message($app->trans('Applying patches on %databox_name%', ['%databox_name%' => $this->get_dbname()]));
ksort($list_patches); ksort($list_patches);
$success = true; $success = true;

View File

@@ -88,7 +88,7 @@ class databox_cgu
if ($out != '') if ($out != '')
$out .= '<hr/>'; $out .= '<hr/>';
$out .= '<div><h1 style="text-align:center;">' . str_replace('"', '&quot;', $app->trans('cgus:: CGUs de la base %databox_name%', array('%databox_name%' => $name))) . '</h1>'; $out .= '<div><h1 style="text-align:center;">' . str_replace('"', '&quot;', $app->trans('cgus:: CGUs de la base %databox_name%', ['%databox_name%' => $name])) . '</h1>';
$out .= '<blockquote>' . $term['terms'] . '</blockquote>'; $out .= '<blockquote>' . $term['terms'] . '</blockquote>';

View File

@@ -149,7 +149,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
$ret = [ $ret = [
'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', array('%user%' => $sender, '%before_link%' => '<a href="/admin/?section=users" target="_blank">', '%after_link%' => '</a>')) 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="/admin/?section=users" target="_blank">', '%after_link%' => '</a>'])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -125,11 +125,11 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans("L'upload concernant le record %title% sur le compte %bridge_name% a echoue pour les raisons suivantes : %reason%", array( 'text' => $this->app->trans("L'upload concernant le record %title% sur le compte %bridge_name% a echoue pour les raisons suivantes : %reason%", [
'%title%' => $record->get_title(), '%title%' => $record->get_title(),
'%bridge_name%' => $account->get_api()->get_connector()->get_name(), '%bridge_name%' => $account->get_api()->get_connector()->get_name(),
'%reason%' => $reason '%reason%' => $reason
)) ])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -105,7 +105,7 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
$reason = $this->app->trans('an error occured while exporting records'); $reason = $this->app->trans('an error occured while exporting records');
} }
$text = $this->app->trans("The delivery to %email% failed for the following reason : %reason%", array('%email%' => $dest, '%reason%' => $reason)); $text = $this->app->trans("The delivery to %email% failed for the following reason : %reason%", ['%email%' => $dest, '%reason%' => $reason]);
$ret = [ $ret = [
'text' => $text 'text' => $text

View File

@@ -140,7 +140,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% has published %title%', array('%user%' => $entry->getAuthorName(), '%title%' => '<a href="/lightbox/feeds/entry/' . $entry->getId() . '/" target="_blank">' . $entry->getTitle() . '</a>')) 'text' => $this->app->trans('%user% has published %title%', ['%user%' => $entry->getAuthorName(), '%title%' => '<a href="/lightbox/feeds/entry/' . $entry->getId() . '/" target="_blank">' . $entry->getTitle() . '</a>'])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -147,10 +147,10 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
$ret = [ $ret = [
'text' => $this->app->trans('%user% a passe une %opening_link% commande %end_link%', array( 'text' => $this->app->trans('%user% a passe une %opening_link% commande %end_link%', [
'%user%' => $sender, '%user%' => $sender,
'%opening_link%' => '<a href="/prod/order/'.$order_id.'/" class="dialog full-dialog" title="'.$this->app->trans('Orders manager').'">', '%opening_link%' => '<a href="/prod/order/'.$order_id.'/" class="dialog full-dialog" title="'.$this->app->trans('Orders manager').'">',
'%end_link%' => '</a>',)) '%end_link%' => '</a>',])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -158,9 +158,9 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
return []; return [];
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous a delivre %quantity% document(s) pour votre commande %title%', array('%user%' => $sender, '%quantity%' => $n, '%title%' => '<a href="/lightbox/compare/' 'text' => $this->app->trans('%user% vous a delivre %quantity% document(s) pour votre commande %title%', ['%user%' => $sender, '%quantity%' => $n, '%title%' => '<a href="/lightbox/compare/'
. (string) $sx->ssel_id . '/" target="_blank">' . (string) $sx->ssel_id . '/" target="_blank">'
. $basket->getName() . '</a>')) . $basket->getName() . '</a>'])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -116,7 +116,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name(); $sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
$ret = [ $ret = [
'text' => $this->app->trans('%user% a refuse la livraison de %quantity% document(s) pour votre commande', array('%user%' => $sender, '%quantity%' => $n)) 'text' => $this->app->trans('%user% a refuse la livraison de %quantity% document(s) pour votre commande', ['%user%' => $sender, '%quantity%' => $n])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -128,8 +128,8 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name(); $sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', array('%user%' => $sender, '%before_link%' => '<a href="#" onclick="openPreview(\'BASK\',1,\'' 'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="#" onclick="openPreview(\'BASK\',1,\''
. (string) $sx->ssel_id . '\');return false;">', '%after_link%' => '</a>')) . (string) $sx->ssel_id . '\');return false;">', '%after_link%' => '</a>'])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -159,7 +159,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
$ret = [ $ret = [
'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', array('%user%' => $sender, '%before_link%' => '<a href="' . $this->app->url('admin', ['section' => 'registrations']) . '" target="_blank">', '%after_link%' => '</a>')) 'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', ['%user%' => $sender, '%before_link%' => '<a href="' . $this->app->url('admin', ['section' => 'registrations']) . '" target="_blank">', '%after_link%' => '</a>'])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -146,10 +146,10 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
$filename = (string) $sx->filename; $filename = (string) $sx->filename;
$text = $this->app->trans('The document %name% has been quarantined', array('%name%' => $filename)); $text = $this->app->trans('The document %name% has been quarantined', ['%name%' => $filename]);
if ( ! ! count($reasons)) { if ( ! ! count($reasons)) {
$text .= ' ' . $this->app->trans('for the following reasons : %reasons%', array('%reasons%' => implode(', ', $reasons))); $text .= ' ' . $this->app->trans('for the following reasons : %reasons%', ['%reasons%' => implode(', ', $reasons)]);
} }
$ret = ['text' => $text, 'class' => '']; $ret = ['text' => $text, 'class' => ''];

View File

@@ -158,10 +158,10 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
. $basket_name . '</a>'; . $basket_name . '</a>';
$ret = [ $ret = [
'text' => $this->app->trans('%user% vous demande de valider %title%', array( 'text' => $this->app->trans('%user% vous demande de valider %title%', [
'%user%' => $sender, '%user%' => $sender,
'%title%' => $bask_link, '%title%' => $bask_link,
)) ])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -146,10 +146,10 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
} }
$ret = [ $ret = [
'text' => $this->app->trans('%user% a envoye son rapport de validation de %title%', array('%user%' => $sender, '%title%' => '<a href="/lightbox/validate/' 'text' => $this->app->trans('%user% a envoye son rapport de validation de %title%', ['%user%' => $sender, '%title%' => '<a href="/lightbox/validate/'
. (string) $sx->ssel_id . '/" target="_blank">' . (string) $sx->ssel_id . '/" target="_blank">'
. $basket->getName() . '</a>' . $basket->getName() . '</a>'
)) ])
, 'class' => '' , 'class' => ''
]; ];

View File

@@ -156,7 +156,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
. $basket_name . '</a>'; . $basket_name . '</a>';
$ret = [ $ret = [
'text' => $this->app->trans('Rappel : Il vous reste %number% jours pour valider %title% de %user%', array('%number%' => $this->app['phraseanet.registry']->get('GV_validation_reminder'), '%title%' => $bask_link, '%user%' => $sender)) 'text' => $this->app->trans('Rappel : Il vous reste %number% jours pour valider %title% de %user%', ['%number%' => $this->app['phraseanet.registry']->get('GV_validation_reminder'), '%title%' => $bask_link, '%user%' => $sender])
, 'class' => ($unread == 1 ? 'reload_baskets' : '') , 'class' => ($unread == 1 ? 'reload_baskets' : '')
]; ];

View File

@@ -313,7 +313,7 @@ class module_report_activity extends module_report
$i ++; $i ++;
} }
$this->title = $this->app->trans('report:: Telechargement effectue par l\'utilisateur %name%', array('%name%' => $login)); $this->title = $this->app->trans('report:: Telechargement effectue par l\'utilisateur %name%', ['%name%' => $login]);
$this->setResult($result); $this->setResult($result);

View File

@@ -415,7 +415,7 @@ class module_report_nav extends module_report
$filter_id_apbox = $filter_id_datbox = []; $filter_id_apbox = $filter_id_datbox = [];
$conn = $this->app['phraseanet.appbox']->get_connection(); $conn = $this->app['phraseanet.appbox']->get_connection();
$this->title = $this->app->trans('report:: Information sur les utilisateurs correspondant a %critere%', array('%critere%' => $val)); $this->title = $this->app->trans('report:: Information sur les utilisateurs correspondant a %critere%', ['%critere%' => $val]);
if ($on) { if ($on) {
if ( ! empty($req)) { if ( ! empty($req)) {
@@ -471,7 +471,7 @@ class module_report_nav extends module_report
$this->app->trans('phraseanet::utilisateur inconnu') : $this->app->trans('phraseanet::utilisateur inconnu') :
$this->result[0]['identifiant']; $this->result[0]['identifiant'];
$this->title = $this->app->trans('report:: Information sur l\'utilisateur %name%', array('%name%' => $login)); $this->title = $this->app->trans('report:: Information sur l\'utilisateur %name%', ['%name%' => $login]);
} }
$this->calculatePages(); $this->calculatePages();
$this->setDisplayNav(); $this->setDisplayNav();
@@ -511,7 +511,7 @@ class module_report_nav extends module_report
]; ];
$document = $record->get_subdef('document'); $document = $record->get_subdef('document');
$this->title = $this->app->trans('report:: Information sur l\'enregistrement numero %number%', array('%number%' => (int) $rid)); $this->title = $this->app->trans('report:: Information sur l\'enregistrement numero %number%', ['%number%' => (int) $rid]);
$x = $record->get_thumbnail(); $x = $record->get_thumbnail();
$this->result[] = [ $this->result[] = [
@@ -534,7 +534,7 @@ class module_report_nav extends module_report
public function buildTabInfoNav($tab = false, $navigator) public function buildTabInfoNav($tab = false, $navigator)
{ {
$conn = connection::getPDOConnection($this->app, $this->sbas_id); $conn = connection::getPDOConnection($this->app, $this->sbas_id);
$this->title = $this->app->trans('report:: Information sur le navigateur %name%', array('%name%' => $navigator)); $this->title = $this->app->trans('report:: Information sur le navigateur %name%', ['%name%' => $navigator]);
$sqlBuilder = new module_report_sql($this->app, $this); $sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters(); $filter = $sqlBuilder->getFilters();
$report_filter = $filter->getReportFilter(); $report_filter = $filter->getReportFilter();

View File

@@ -104,11 +104,11 @@ class phraseadate
} elseif ($diff < 120) { } elseif ($diff < 120) {
return $this->app->trans('phraseanet::temps:: il y a une minute'); return $this->app->trans('phraseanet::temps:: il y a une minute');
} elseif ($diff < 3600) { } elseif ($diff < 3600) {
return $this->app->trans('phraseanet::temps:: il y a %quantity% minutes', array('%quantity%' => floor($diff / 60))); return $this->app->trans('phraseanet::temps:: il y a %quantity% minutes', ['%quantity%' => floor($diff / 60)]);
} elseif ($diff < 7200) { } elseif ($diff < 7200) {
return $this->app->trans('phraseanet::temps:: il y a une heure'); return $this->app->trans('phraseanet::temps:: il y a une heure');
} elseif ($diff < 86400) { } elseif ($diff < 86400) {
return $this->app->trans('phraseanet::temps:: il y a %quantity% heures', array('%quantity%' => floor($diff / 3600))); return $this->app->trans('phraseanet::temps:: il y a %quantity% heures', ['%quantity%' => floor($diff / 3600)]);
} }
} elseif ($dayDiff == 1) { } elseif ($dayDiff == 1) {
return $this->app->trans('phraseanet::temps:: hier'); return $this->app->trans('phraseanet::temps:: hier');

View File

@@ -130,16 +130,22 @@ class record_exportElement extends record_adapter
if ($go_dl['document'] === true) { if ($go_dl['document'] === true) {
if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) { if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) {
$this->remain_hd --; $this->remain_hd --;
if ($this->remain_hd >= 0) if ($this->remain_hd >= 0) {
$localizedLabel = $this->app->trans('document original');
$downloadable['document'] = [ $downloadable['document'] = [
'class' => 'document', 'class' => 'document',
'label' => 'document original' /** @Ignore */
'label' => $localizedLabel,
]; ];
} else }
} else {
$localizedLabel = $this->app->trans('document original');
$downloadable['document'] = [ $downloadable['document'] = [
'class' => 'document', 'class' => 'document',
'label' => 'document original' /** @Ignore */
'label' => $localizedLabel
]; ];
}
} }
if ($go_cmd === true) { if ($go_cmd === true) {
$orderable['document'] = true; $orderable['document'] = true;
@@ -206,14 +212,19 @@ class record_exportElement extends record_adapter
$xml = $this->get_caption()->serialize(caption_record::SERIALIZE_XML); $xml = $this->get_caption()->serialize(caption_record::SERIALIZE_XML);
if ($xml) { if ($xml) {
$localizedLabel = $this->app->trans('caption XML');
$downloadable['caption'] = [ $downloadable['caption'] = [
'class' => 'caption', 'class' => 'caption',
'label' => 'caption XML' /** @Ignore */
'label' => $localizedLabel,
]; ];
$this->add_count('caption', strlen($xml)); $this->add_count('caption', strlen($xml));
$localizedLabel = $this->app->trans('caption YAML');
$downloadable['caption-yaml'] = [ $downloadable['caption-yaml'] = [
'class' => 'caption', 'class' => 'caption',
'label' => 'caption YAML' /** @Ignore */
'label' => $localizedLabel,
]; ];
$this->add_count('caption-yaml', strlen(strip_tags($xml))); $this->add_count('caption-yaml', strlen(strip_tags($xml)));
} }

View File

@@ -279,7 +279,7 @@ class record_preview extends record_adapter
switch ($this->env) { switch ($this->env) {
case "RESULT": case "RESULT":
$this->title .= $this->app->trans('preview:: resultat numero %number%', array('%number%' => '<span id="current_result_n">' . ($this->number + 1) . '</span> : ')); $this->title .= $this->app->trans('preview:: resultat numero %number%', ['%number%' => '<span id="current_result_n">' . ($this->number + 1) . '</span> : ']);
$this->title .= parent::get_title($highlight, $search_engine); $this->title .= parent::get_title($highlight, $search_engine);
break; break;
case "BASK": case "BASK":

View File

@@ -99,7 +99,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_BOOLEAN, 'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_captchas', 'name' => 'GV_captchas',
'comment' => $app->trans('Use recaptcha API'), 'comment' => $app->trans('Use recaptcha API'),
'help' => $app->trans('See documentation at %website%', array('%website%' => $recaptchaDoc)), 'help' => $app->trans('See documentation at %website%', ['%website%' => $recaptchaDoc]),
'default' => false, 'default' => false,
'required' => true 'required' => true
], ],
@@ -123,7 +123,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_BOOLEAN, 'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_youtube_api', 'name' => 'GV_youtube_api',
'comment' => $app->trans('Use youtube API'), 'comment' => $app->trans('Use youtube API'),
'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', array('%website_url%' => $youtube_console_url, '%callback_url%' => $youtube_callback)), 'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', ['%website_url%' => $youtube_console_url, '%callback_url%' => $youtube_callback]),
'default' => false, 'default' => false,
'required' => true 'required' => true
], ],
@@ -143,7 +143,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_STRING, 'type' => \registry::TYPE_STRING,
'name' => 'GV_youtube_dev_key', 'name' => 'GV_youtube_dev_key',
'comment' => $app->trans('Youtube developer key'), 'comment' => $app->trans('Youtube developer key'),
'help' => $app->trans('See %url%', array('%url%' => $dashboard_youtube)), 'help' => $app->trans('See %url%', ['%url%' => $dashboard_youtube]),
'default' => '' 'default' => ''
] ]
] ]
@@ -154,7 +154,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_BOOLEAN, 'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_flickr_api', 'name' => 'GV_flickr_api',
'comment' => $app->trans('Use Flickr API'), 'comment' => $app->trans('Use Flickr API'),
'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', array('%website_url%' => $create_api_flickr, '%callback_url%' => $flickr_callback)), 'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', ['%website_url%' => $create_api_flickr, '%callback_url%' => $flickr_callback]),
'default' => false, 'default' => false,
'required' => true 'required' => true
], ],
@@ -178,7 +178,7 @@ return call_user_func_array(function(Application $app) {
'type' => \registry::TYPE_BOOLEAN, 'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_dailymotion_api', 'name' => 'GV_dailymotion_api',
'comment' => $app->trans('Use Dailymotion API'), 'comment' => $app->trans('Use Dailymotion API'),
'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', array('%website_url%' => $create_api_dailymotion, '%callback_url%' => $dailymotion_callback)), 'help' => $app->trans('Create API account at %website_url%, then use %callback_url% as callback URL value', ['%website_url%' => $create_api_dailymotion, '%callback_url%' => $dailymotion_callback]),
'default' => false, 'default' => false,
'required' => true 'required' => true
], ],
@@ -269,7 +269,7 @@ return call_user_func_array(function(Application $app) {
'name' => 'GV_imagine_driver', 'name' => 'GV_imagine_driver',
'default' => '', 'default' => '',
'comment' => $app->trans('Imagine driver'), 'comment' => $app->trans('Imagine driver'),
'help' => $app->trans('See documentation at %website%', array('%website%' => $imagineDoc)), 'help' => $app->trans('See documentation at %website%', ['%website%' => $imagineDoc]),
'available' => [ 'available' => [
'' => 'Auto', '' => 'Auto',
'gmagick' => 'GraphicsMagick', 'gmagick' => 'GraphicsMagick',

View File

@@ -4648,7 +4648,7 @@
<default> <default>
<data key="prop">ToU</data> <data key="prop">ToU</data>
<data key="value"></data> <data key="value"></data>
<data key="locale">ar</data> <data key="locale">nl</data>
<data key="created_on">NOW()</data> <data key="created_on">NOW()</data>
</default> </default>
<default> <default>

View File

@@ -50,7 +50,7 @@
<input id="button_login" name="action_login" class="btn btn-inverse btn-large span6" type="submit" value="{{ 'Se connecter' | trans }}" /> <input id="button_login" name="action_login" class="btn btn-inverse btn-large span6" type="submit" value="{{ 'Se connecter' | trans }}" />
</form> </form>
<p> <p>
<a href="#">{{ 'Probl&egrave;mes de connexion ?' | trans }}</a> <a href="#">{{ 'Problemes de connexion ?' | trans }}</a>
</p> </p>
</div> </div>
{% else %} {% else %}

View File

@@ -50,7 +50,7 @@
<input id="button_login" name="action_login" class="btn btn-inverse btn-large span6" type="submit" value="{{ 'Se connecter' | trans }}" /> <input id="button_login" name="action_login" class="btn btn-inverse btn-large span6" type="submit" value="{{ 'Se connecter' | trans }}" />
</form> </form>
<p> <p>
<a href="#">{{ 'Probl&egrave;mes de connexion ?' | trans }}</a> <a href="#">{{ 'Problemes de connexion ?' | trans }}</a>
</p> </p>
</div> </div>
{% else %} {% else %}

View File

@@ -518,7 +518,7 @@
title : '{{ "Warning !" | trans }}' title : '{{ "Warning !" | trans }}'
}, 2); }, 2);
alert.setContent("{{ alert_message|e }}"); alert.setContent("{{ alert_message | e('js') }}");
return false; return false;
} }
@@ -558,10 +558,10 @@
size : 'Alert', size : 'Alert',
closeOnEscape : true, closeOnEscape : true,
closeButton:true, closeButton:true,
title : '{{ "Warning !" | trans }}' title : '{{ "Warning !" | trans | e('js') }}'
}, 2); }, 2);
alert.setContent("{{ alert_message|e }}"); alert.setContent("{{ alert_message | e('js') }}");
return false; return false;
} }
@@ -575,10 +575,10 @@
size : 'Alert', size : 'Alert',
closeOnEscape : true, closeOnEscape : true,
closeButton:true, closeButton:true,
title : '{{ "Warning !" | trans }}' title : '{{ "Warning !" | trans | e('js') }}'
}, 2); }, 2);
alert.setContent("{{ alert_message|e }}"); alert.setContent("{{ alert_message | e('js') }}");
return false; return false;
} }
@@ -651,7 +651,7 @@
{% endset %} {% endset %}
if(count>1 && total/1024/1024 > {{max_download}}) { if(count>1 && total/1024/1024 > {{max_download}}) {
if(confirm("{{alert_too_big_one|e('js') ~ "\\n" ~ alert_too_big_two ~ "\\n" ~ alert_too_big_three}}")) { if(confirm("{{alert_too_big_one|e('js') ~ "\\n" ~ alert_too_big_two|e('js') ~ "\\n" ~ alert_too_big_three|e('js')}}")) {
$('input[name="obj[]"]:checked', $('#download')).each(function(i,n){ $('input[name="obj[]"]:checked', $('#download')).each(function(i,n){
$('input[name="obj[]"][value="'+$(n).val()+'"]', $('#sendmail')).attr('checked', true); $('input[name="obj[]"][value="'+$(n).val()+'"]', $('#sendmail')).attr('checked', true);
}); });
@@ -689,9 +689,9 @@
$('#order .order_button_loader').css('visibility','hidden'); $('#order .order_button_loader').css('visibility','hidden');
if(!data.error) { if(!data.error) {
var title = '{{ "Success" | trans }}'; var title = '{{ "Success" | trans | e('js') }}';
} else { } else {
var title = '{{ "Warning !" | trans }}'; var title = '{{ "Warning !" | trans | e('js') }}';
} }
var options = { var options = {
@@ -745,7 +745,7 @@
size : 'Alert', size : 'Alert',
closeOnEscape : true, closeOnEscape : true,
closeButton:true, closeButton:true,
title : '{{ "Warning !" | trans }}' title : '{{ "Warning !" | trans | e('js') }}'
}, 2); }, 2);
alert.setContent(data.message); alert.setContent(data.message);
@@ -769,7 +769,7 @@
var options = { var options = {
size : 'Alert', size : 'Alert',
closeButton: true, closeButton: true,
title : data.success ? '{{ "Success" | trans }}' : '{{ "Warning !" | trans }}' title : data.success ? '{{ "Success" | trans | e('js') }}' : '{{ "Warning !" | trans | e('js') }}'
}; };
p4.Dialog.Create(options, 2).setContent(data.message); p4.Dialog.Create(options, 2).setContent(data.message);

View File

@@ -349,7 +349,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$this->assertInstanceOf('Alchemy\Phrasea\Utilities\CachedTranslator', $app['translator']); $this->assertInstanceOf('Alchemy\Phrasea\Utilities\CachedTranslator', $app['translator']);
$result = $app['translator']->trans($key, array(), null, $locale); $result = $app['translator']->trans($key, [], null, $locale);
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$this->assertFileExists($tempDir.'/catalogue.'.($locale ?: 'en').'.php'); $this->assertFileExists($tempDir.'/catalogue.'.($locale ?: 'en').'.php');
@@ -357,10 +357,10 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
public function transProvider() public function transProvider()
{ {
return array( return [
array('key1', 'de', 'The german translation'), ['key1', 'de', 'The german translation'],
array('test.key', 'de', 'It works in german'), ['test.key', 'de', 'It works in german'],
); ];
} }
protected function getPreparedApp($tempDir) protected function getPreparedApp($tempDir)
@@ -371,25 +371,25 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
'cache_dir' => $tempDir, 'cache_dir' => $tempDir,
]; ];
$app['translator.domains'] = array( $app['translator.domains'] = [
'messages' => array( 'messages' => [
'en' => array ( 'en' => [
'key1' => 'The translation', 'key1' => 'The translation',
'key_only_english' => 'Foo', 'key_only_english' => 'Foo',
'key2' => 'One apple|%count% apples', 'key2' => 'One apple|%count% apples',
'test' => array( 'test' => [
'key' => 'It works' 'key' => 'It works'
) ]
), ],
'de' => array ( 'de' => [
'key1' => 'The german translation', 'key1' => 'The german translation',
'key2' => 'One german apple|%count% german apples', 'key2' => 'One german apple|%count% german apples',
'test' => array( 'test' => [
'key' => 'It works in german' 'key' => 'It works in german'
) ]
) ]
) ]
); ];
return $app; return $app;
} }

View File

@@ -3,7 +3,7 @@
namespace Alchemy\Tests\Phrasea\Core\CLIProvider; namespace Alchemy\Tests\Phrasea\Core\CLIProvider;
/** /**
* @covers Alchemy\Phrasea\Core\Provider\TaskManagerServiceProvider * @covers Alchemy\Phrasea\Core\CLIProvider\TaskManagerServiceProvider
*/ */
class TaskManagerServiceProvidertest extends ServiceProviderTestCase class TaskManagerServiceProvidertest extends ServiceProviderTestCase
{ {

View File

@@ -0,0 +1,50 @@
<?php
namespace Alchemy\Tests\Phrasea\Core\CLIProvider;
/**
* @covers Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider
*/
class TranslationExtractorServiceProvidertest extends ServiceProviderTestCase
{
public function provideServiceDescription()
{
return [
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.logger',
'Monolog\Logger'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.doc-parser',
'Doctrine\Common\Annotations\DocParser'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.file-extractor',
'JMS\TranslationBundle\Translation\Extractor\FileExtractor'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.extractor-manager',
'JMS\TranslationBundle\Translation\ExtractorManager'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.writer',
'JMS\TranslationBundle\Translation\FileWriter'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.loader-manager',
'JMS\TranslationBundle\Translation\LoaderManager'
],
[
'Alchemy\Phrasea\Core\CLIProvider\TranslationExtractorServiceProvider',
'translation-extractor.updater',
'JMS\TranslationBundle\Translation\Updater'
],
];
}
}

View File

@@ -14,7 +14,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertContainsString('dailymotion', $mail->getMessage()); $this->assertEquals('An upload on %bridge_adapter% failed, the resaon is : %reason%', $mail->getMessage());
} }
public function testSHouldThrowALogicExceptionIfNoAdapterProvided() public function testSHouldThrowALogicExceptionIfNoAdapterProvided()
@@ -63,7 +63,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertContainsString('you\'re too fat', $mail->getMessage()); $this->assertEquals('An upload on %bridge_adapter% failed, the resaon is : %reason%', $mail->getMessage());
} }
public function getMail() public function getMail()

View File

@@ -12,7 +12,7 @@ class MailInfoNewOrderTest extends MailTestCase
{ {
public function testSetUser() public function testSetUser()
{ {
$this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); $this->assertEquals('%user% has ordered documents', $this->getMail()->getMessage());
} }
public function testShouldThrowALogicExceptionIfNoUserProvided() public function testShouldThrowALogicExceptionIfNoUserProvided()

View File

@@ -13,8 +13,8 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase
public function testSetTitle() public function testSetTitle()
{ {
$this->assertContainsString('joli titre', $this->getMail()->getSubject()); $this->assertEquals('Nouvelle publication : %title%', $this->getMail()->getSubject());
$this->assertContainsString('joli titre', $this->getMail()->getMessage()); $this->assertEquals('%user% vient de publier %title%', $this->getMail()->getMessage());
} }
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()
@@ -64,7 +64,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase
public function testSetAuthor() public function testSetAuthor()
{ {
$this->assertContainsString('bel author', $this->getMail()->getMessage()); $this->assertEquals('%user% vient de publier %title%', $this->getMail()->getMessage());
} }
public function getMail() public function getMail()

View File

@@ -12,12 +12,12 @@ class MailInfoOrderCancelledTest extends MailTestCase
{ {
public function testSetQuantity() public function testSetQuantity()
{ {
$this->assertContainsString('42', $this->getMail()->getMessage()); $this->assertEquals('%user% a refuse %quantity% elements de votre commande', $this->getMail()->getMessage());
} }
public function testSetDeliverer() public function testSetDeliverer()
{ {
$this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); $this->assertEquals('%user% a refuse %quantity% elements de votre commande', $this->getMail()->getMessage());
} }
public function testShouldThrowALogicExceptionIfNoQuantityProvided() public function testShouldThrowALogicExceptionIfNoQuantityProvided()

View File

@@ -12,12 +12,12 @@ class MailInfoOrderDeliveredTest extends MailTestCase
{ {
public function testSetBasket() public function testSetBasket()
{ {
$this->assertContainsString('Hello basket', $this->getMail()->getSubject()); $this->assertEquals('push::mail:: Reception de votre commande %title%', $this->getMail()->getSubject());
} }
public function testSetDeliverer() public function testSetDeliverer()
{ {
$this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); $this->assertEquals('%user% vous a delivre votre commande, consultez la en ligne a l\'adresse suivante', $this->getMail()->getMessage());
} }
public function testShouldThrowALogicExceptionIfNoDelivererProvided() public function testShouldThrowALogicExceptionIfNoDelivererProvided()

View File

@@ -14,7 +14,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertContainsString('Hello basket', $mail->getSubject()); $this->assertEquals('Reception of %basket_name%', $mail->getSubject());
} }
public function testShouldThrowLogicExceptionsIfBasketNotSet() public function testShouldThrowLogicExceptionsIfBasketNotSet()
@@ -50,7 +50,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertContainsString('JeanPhil', $mail->getMessage()); $this->assertEquals("You just received a push containing %quantity% documents from %user%\nLorem ipsum dolor", $mail->getMessage());
} }
public function testShouldThrowLogicExceptionsIfPusherNotSet() public function testShouldThrowLogicExceptionsIfPusherNotSet()
@@ -83,7 +83,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertContainsString('5', $mail->getMessage()); $this->assertEquals("You just received a push containing %quantity% documents from %user%\nLorem ipsum dolor", $mail->getMessage());
} }
public function getMail() public function getMail()

View File

@@ -15,7 +15,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase
*/ */
public function testSetTitle() public function testSetTitle()
{ {
$this->assertContainsString('Hulk Hogan', $this->getMail()->getSubject()); $this->assertEquals('push::mail:: Rapport de validation de %user% pour %title%', $this->getMail()->getSubject());
} }
/** /**
@@ -23,8 +23,8 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase
*/ */
public function testSetUser() public function testSetUser()
{ {
$this->assertContainsString('JeanPhil', $this->getMail()->getSubject()); $this->assertEquals('push::mail:: Rapport de validation de %user% pour %title%', $this->getMail()->getSubject());
$this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); $this->assertEquals('%user% has just sent its validation report, you can now see it', $this->getMail()->getMessage());
} }
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()

View File

@@ -15,7 +15,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase
*/ */
public function testSetTitle() public function testSetTitle()
{ {
$this->assertContainsString('Hulk Hogan', $this->getMail()->getSubject()); $this->assertEquals('Reminder : validate \'%title%\'', $this->getMail()->getSubject());
} }
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()

View File

@@ -12,7 +12,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase
{ {
public function testSetTitle() public function testSetTitle()
{ {
$this->assertContainsString('Hello World', $this->getMail()->getSubject()); $this->assertEquals('Validation request from %user% for \'%title%\'', $this->getMail()->getSubject());
} }
public function testShouldThrowALogicExceptionIfNoUserProvided() public function testShouldThrowALogicExceptionIfNoUserProvided()
@@ -67,7 +67,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase
public function testSetUser() public function testSetUser()
{ {
$this->assertContainsString('jeanPhil', $this->getMail()->getSubject()); $this->assertEquals('Validation request from %user% for \'%title%\'', $this->getMail()->getSubject());
} }
public function getMail() public function getMail()

View File

@@ -13,7 +13,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase
public function testSetLogin() public function testSetLogin()
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertTrue(false !== strpos($mail->getMessage(), 'RomainNeutron')); $this->assertEquals("Your account with the login %login% as been created\nYou now have to set up your pasword", $mail->getMessage());
} }
public function testThatALogicExceptionIsThrownIfNoLoginProvided() public function testThatALogicExceptionIsThrownIfNoLoginProvided()

View File

@@ -13,7 +13,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase
public function testSetLogin() public function testSetLogin()
{ {
$mail = $this->getMail(); $mail = $this->getMail();
$this->assertTrue(false !== strpos($mail->getMessage(), 'RomainNeutron')); $this->assertEquals("Password renewal for login \"%login%\" has been requested\nlogin:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien", $mail->getMessage());
} }
public function getMail() public function getMail()

View File

@@ -12,7 +12,7 @@ class MailSuccessFTPSenderTest extends MailTestCase
{ {
public function testSetServer() public function testSetServer()
{ {
$this->assertTrue(false !== stripos($this->getMail()->getSubject(), 'ftp://example.com')); $this->assertEquals('task::ftp:Status about your FTP transfert from %application% to %server%', $this->getMail()->getSubject());
} }
public function testThatALgicExceptionIsThrownIfNoServerSet() public function testThatALgicExceptionIsThrownIfNoServerSet()

Some files were not shown because too many files have changed in this diff Show More