diff --git a/bin/developer b/bin/developer index d52174170c..4962c3bf63 100755 --- a/bin/developer +++ b/bin/developer @@ -20,6 +20,7 @@ use Alchemy\Phrasea\Command\Developer\LessCompiler; use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb; use Alchemy\Phrasea\Command\Developer\RoutesDumper; use Alchemy\Phrasea\Command\Developer\Uninstaller; +use Alchemy\Phrasea\Command\Developer\TranslationDumper; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; 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 BowerInstall()); diff --git a/hudson/fixtures.sql b/hudson/fixtures.sql index a33ce86ec9..749c3ed21c 100644 --- a/hudson/fixtures.sql +++ b/hudson/fixtures.sql @@ -1642,7 +1642,7 @@ CREATE TABLE `pref` ( LOCK TABLES `pref` WRITE; /*!40000 ALTER TABLE `pref` DISABLE KEYS */; -INSERT INTO `pref` VALUES (1,'thesaurus','','','0000-00-00 00:00:00','2012-04-27 02:06:31'),(2,'structure','\n\n /tmp/db_test/documents\n1\n \n \n \n /tmp/db_test/subdefs\n 800\n resample\n 72\n no\n 75\n yes\n image\n \n \n \n \n /tmp/db_test/subdefs\n 200\n resample\n 72\n yes\n 75\n no\n image\n \n \n \n \n \n \n /tmp/db_test/subdefs\n 800\n video\n yes\n libvo_aacenc\n libx264\n 1000\n 8\n 15\n \n \n \n \n /tmp/db_test/subdefs\n 200\n gif\n 500\n no\n \n \n \n \n /tmp/db_test/subdefs\n 200\n image\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n audio\n yes\n \n \n \n \n /tmp/db_test/subdefs\n image\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n flexpaper\n no\n \n \n \n \n /tmp/db_test/subdefs\n image\n resample\n 72\n 200\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n image\n 200\n no\n resample\n 72\n \n \n \n \n /tmp/db_test/subdefs\n image\n no\n resample\n 72\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Online\n \n\n','','2012-04-27 02:06:34','2012-04-27 02:06:31'),(3,'cterms','','','0000-00-00 00:00:00','2012-04-27 02:06:31'),(4,'indexes','1','','2012-04-27 02:06:31','2012-04-27 02:06:31'),(5,'ToU','','fr_FR','0000-00-00 00:00:00','2012-04-27 02:06:31'),(6,'ToU','','ar_SA','0000-00-00 00:00:00','2012-04-27 02:06:31'),(7,'ToU','','de_DE','0000-00-00 00:00:00','2012-04-27 02:06:31'),(8,'ToU','','en_GB','0000-00-00 00:00:00','2012-04-27 02:06:31'),(9,'version','3.1.21','','2012-04-27 02:06:33','0000-00-00 00:00:00'); +INSERT INTO `pref` VALUES (1,'thesaurus','','','0000-00-00 00:00:00','2012-04-27 02:06:31'),(2,'structure','\n\n /tmp/db_test/documents\n1\n \n \n \n /tmp/db_test/subdefs\n 800\n resample\n 72\n no\n 75\n yes\n image\n \n \n \n \n /tmp/db_test/subdefs\n 200\n resample\n 72\n yes\n 75\n no\n image\n \n \n \n \n \n \n /tmp/db_test/subdefs\n 800\n video\n yes\n libvo_aacenc\n libx264\n 1000\n 8\n 15\n \n \n \n \n /tmp/db_test/subdefs\n 200\n gif\n 500\n no\n \n \n \n \n /tmp/db_test/subdefs\n 200\n image\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n audio\n yes\n \n \n \n \n /tmp/db_test/subdefs\n image\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n flexpaper\n no\n \n \n \n \n /tmp/db_test/subdefs\n image\n resample\n 72\n 200\n no\n \n \n \n \n \n \n /tmp/db_test/subdefs\n image\n 200\n no\n resample\n 72\n \n \n \n \n /tmp/db_test/subdefs\n image\n no\n resample\n 72\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Online\n \n\n','','2012-04-27 02:06:34','2012-04-27 02:06:31'),(3,'cterms','','','0000-00-00 00:00:00','2012-04-27 02:06:31'),(4,'indexes','1','','2012-04-27 02:06:31','2012-04-27 02:06:31'),(5,'ToU','','fr_FR','0000-00-00 00:00:00','2012-04-27 02:06:31'),(6,'ToU','','nl_NL','0000-00-00 00:00:00','2012-04-27 02:06:31'),(7,'ToU','','de_DE','0000-00-00 00:00:00','2012-04-27 02:06:31'),(8,'ToU','','en_GB','0000-00-00 00:00:00','2012-04-27 02:06:31'),(9,'version','3.1.21','','2012-04-27 02:06:33','0000-00-00 00:00:00'); /*!40000 ALTER TABLE `pref` ENABLE KEYS */; UNLOCK TABLES; diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 5206a42433..8bb56b9fce 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -137,7 +137,6 @@ use Silex\Provider\UrlGeneratorServiceProvider; use Silex\Provider\ValidatorServiceProvider; use Silex\Provider\ServiceControllerServiceProvider; use Symfony\Bridge\Twig\Extension\TranslationExtension; -use Symfony\Component\Translation\Loader\MoFileLoader; use Unoconv\UnoconvServiceProvider; use XPDF\PdfToText; use XPDF\XPDFServiceProvider; diff --git a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php index 0944127736..95b379f15e 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php +++ b/lib/Alchemy/Phrasea/Command/Developer/TranslationDumper.php @@ -36,13 +36,13 @@ class TranslationDumper extends Command $config = $builder->setLocale($code) ->setOutputFormat('xliff') ->setTranslationsDir(__DIR__ . '/../../../../../resources/locales') - ->setScanDirs(array( + ->setScanDirs([ $this->container['root.path'].'/templates/web/admin/user', $this->container['root.path'].'/lib', $this->container['root.path'].'/templates', $this->container['root.path'].'/bin', $this->container['root.path'].'/www', - )) + ]) ->getConfig(); $this->container['translation-extractor.updater']->process($config); diff --git a/lib/Alchemy/Phrasea/Command/Developer/Utils/ConstraintExtractor.php b/lib/Alchemy/Phrasea/Command/Developer/Utils/ConstraintExtractor.php index d4862916c7..3f75f78c98 100644 --- a/lib/Alchemy/Phrasea/Command/Developer/Utils/ConstraintExtractor.php +++ b/lib/Alchemy/Phrasea/Command/Developer/Utils/ConstraintExtractor.php @@ -1,5 +1,14 @@ toArray(); } catch (\Exception $e) { $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; } } @@ -235,7 +235,7 @@ class Fields implements ControllerProviderInterface $this->updateFieldWithData($app, $field, $data); $field->save(); } 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, [ diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Users.php b/lib/Alchemy/Phrasea/Controller/Admin/Users.php index e77478328c..ca7bc6539d 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Users.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Users.php @@ -656,12 +656,12 @@ class Users implements ControllerProviderInterface if ($sqlField === 'usr_login') { $loginToAdd = $value; 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)) { - $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 { 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 { $loginValid = true; } @@ -672,9 +672,9 @@ class Users implements ControllerProviderInterface $mailToAdd = $value; 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)) { - $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 { $mailValid = true; } @@ -684,7 +684,7 @@ class Users implements ControllerProviderInterface $passwordToVerif = $value; 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 { $pwdValid = true; } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php b/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php index 949f38cd92..a064fed29a 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/BasketController.php @@ -335,7 +335,7 @@ class BasketController implements ControllerProviderInterface $data = [ 'success' => true - , 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n)) + , 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n]) ]; if ($request->getRequestFormat() === 'json') { @@ -367,7 +367,7 @@ class BasketController implements ControllerProviderInterface $data = [ 'success' => true - , 'message' => $app->trans('%quantity% records moved', array('%quantity%' => $n)) + , 'message' => $app->trans('%quantity% records moved', ['%quantity%' => $n]) ]; if ($request->getRequestFormat() === 'json') { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php index 7c25d86c7a..15045eb7d0 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Bridge.php @@ -467,6 +467,6 @@ class Bridge implements ControllerProviderInterface \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())])); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 3740d109c7..69d5912428 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -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')) { - $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); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Order.php b/lib/Alchemy/Phrasea/Controller/Prod/Order.php index 4363669f83..bd035fef26 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Order.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Order.php @@ -247,7 +247,7 @@ class Order implements ControllerProviderInterface if (null === $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->setPusher($app['authentication']->getUser()); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index ed389c9656..88fb0da740 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -160,7 +160,7 @@ class Push implements ControllerProviderInterface try { $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'); $receivers = $request->request->get('participants'); @@ -177,7 +177,7 @@ class Push implements ControllerProviderInterface try { $user_receiver = \User_Adapter::getInstance($receiver['usr_id'], $app); } 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(); @@ -247,10 +247,10 @@ class Push implements ControllerProviderInterface $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_users%' => count($receivers), - )); + ]); $ret = [ 'success' => true, @@ -278,7 +278,7 @@ class Push implements ControllerProviderInterface $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'); $participants = $request->request->get('participants'); @@ -354,13 +354,13 @@ class Push implements ControllerProviderInterface foreach ($participants as $key => $participant) { foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) { 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 { $participant_user = \User_Adapter::getInstance($participant['usr_id'], $app); } 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 { @@ -445,10 +445,10 @@ class Push implements ControllerProviderInterface $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_users%' => count($request->request->get('participants')), - )); + ]); $ret = [ 'success' => true, diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 01c4cdb0b6..e7a7672696 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -153,16 +153,16 @@ class Query implements ControllerProviderInterface $explain .= ""; 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 { - $explain .= $app->trans('reponses:: %total% Resultats', array('%total%' => $result->getTotal())); + $explain .= $app->trans('reponses:: %total% Resultats', ['%total%' => $result->getTotal()]); } $explain .= " "; $explain .= '
' . $result->getDuration() . ' s
dans index ' . $result->getIndexes(); $explain .= ""; - $infoResult = '' . $app->trans('reponses:: %total% reponses', array('%total%' => $result->getTotal())) . ' | ' . $app->trans('reponses:: %number% documents selectionnes', array('%number%' => '')); + $infoResult = '' . $app->trans('reponses:: %total% reponses', ['%total%' => $result->getTotal()]) . ' | ' . $app->trans('reponses:: %number% documents selectionnes', ['%number%' => '']); $json['infos'] = $infoResult; $json['navigation'] = $string; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Story.php b/lib/Alchemy/Phrasea/Controller/Prod/Story.php index 66b0ddfaed..c4bb9d7fb3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Story.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Story.php @@ -136,7 +136,7 @@ class Story implements ControllerProviderInterface $data = [ 'success' => true - , 'message' => $app->trans('%quantity% records added', array('%quantity%' => $n)) + , 'message' => $app->trans('%quantity% records added', ['%quantity%' => $n]) ]; if ($request->getRequestFormat() == 'json') { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php index 0df6380246..4fb30b8867 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php @@ -153,7 +153,7 @@ class UsrLists implements ControllerProviderInterface $datas = [ '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 ]; @@ -178,7 +178,7 @@ class UsrLists implements ControllerProviderInterface $datas = [ '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() ]; } catch (ControllerException $e) { @@ -393,13 +393,13 @@ class UsrLists implements ControllerProviderInterface if (count($inserted_usr_ids) > 1) { $datas = [ '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 ]; } else { $datas = [ '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 ]; } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php index 7c531c8e4c..f265390776 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php @@ -158,15 +158,15 @@ class WorkZone implements ControllerProviderInterface if ($alreadyFixed === 0) { 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 { - $message = $app->trans('%quantity% Stories attached to the WorkZone', array('%quantity%' => $done)); + $message = $app->trans('%quantity% Stories attached to the WorkZone', ['%quantity%' => $done]); } } else { 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 { - $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]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Report/Activity.php b/lib/Alchemy/Phrasea/Controller/Report/Activity.php index 2260ec8d3f..0c92e89c99 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Activity.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Activity.php @@ -819,7 +819,7 @@ class Activity implements ControllerProviderInterface return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($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) { @@ -864,7 +864,7 @@ class Activity implements ControllerProviderInterface 'is_doc' => 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]) ]); } diff --git a/lib/Alchemy/Phrasea/Controller/Report/Informations.php b/lib/Alchemy/Phrasea/Controller/Report/Informations.php index efd8ee88ca..b19b2945f6 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Informations.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Informations.php @@ -151,7 +151,7 @@ class Informations implements ControllerProviderInterface return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($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) { @@ -409,7 +409,7 @@ class Informations implements ControllerProviderInterface return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $download->colFilter($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) { diff --git a/lib/Alchemy/Phrasea/Controller/Report/Root.php b/lib/Alchemy/Phrasea/Controller/Report/Root.php index 63167c9888..57dd444fff 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Root.php @@ -570,7 +570,7 @@ class Root implements ControllerProviderInterface return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($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) { @@ -615,7 +615,7 @@ class Root implements ControllerProviderInterface 'is_doc' => 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]) ]); } diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index f753f0dfed..e70f362af5 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -899,7 +899,7 @@ class Login implements ControllerProviderInterface $provider->onCallback($request); $token = $provider->getToken(); } 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'); } diff --git a/lib/Alchemy/Phrasea/Controller/Setup.php b/lib/Alchemy/Phrasea/Controller/Setup.php index 36de8267c6..33a7734343 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Setup.php @@ -180,7 +180,7 @@ class Setup implements ControllerProviderInterface ]); } catch (\Exception $e) { 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()]), ]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php index 37f99cbd73..956267317e 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php @@ -429,7 +429,7 @@ class Thesaurus implements ControllerProviderInterface $dom->formatOutput = true; $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')) ->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'); 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 { $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); } 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; } $line = trim($line); 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; } $line = str_replace($cbad, $cok, ($oldline = $line)); 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; } diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php index 572f9c2257..3582e61105 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php @@ -1508,10 +1508,10 @@ class Xmlhttp implements ControllerProviderInterface $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 { // 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); diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/TranslationExtractorServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/TranslationExtractorServiceProvider.php index 283b702023..b0e903e4d9 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/TranslationExtractorServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/TranslationExtractorServiceProvider.php @@ -15,7 +15,6 @@ use Alchemy\Phrasea\Command\Developer\Utils\ConstraintExtractor; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\DocParser; use Doctrine\Common\Annotations\AnnotationRegistry; -use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver; use Gedmo\SoftDeleteable\Mapping\Driver\Annotation; use JMS\TranslationBundle\Translation\ConfigBuilder; 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\LoaderManager; use JMS\TranslationBundle\Translation\Updater; -use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Translation\Dumper\PoFileDumper; use Symfony\Component\Translation\Loader\PoFileLoader; @@ -53,13 +51,13 @@ class TranslationExtractorServiceProvider implements ServiceProviderInterface return $parser; }); $app['translation-extractor.node-visitors'] = $app->share(function (Application $app) { - return array( + return [ new ConstraintExtractor($app), new ValidationExtractor($app['validator']->getMetadataFactory()), new DefaultPhpFileExtractor($app['translation-extractor.doc-parser']), new TwigFileExtractor($app['twig']), new FormExtractor($app['translation-extractor.doc-parser']), - ); + ]; }); $app['translation-extractor.file-extractor'] = $app->share(function (Application $app) { 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 () { - return array( + return [ 'po' => new SymfonyDumperAdapter(new PoFileDumper(), 'po'), 'xliff' => new XliffDumper(), - ); + ]; }); $app['translation-extractor.loader-manager'] = $app->share(function (Application $app) { return new LoaderManager($app['translation-extractor.loaders']); }); $app['translation-extractor.loaders'] = $app->share(function () { - return array( + return [ 'po' => new SymfonyLoaderAdapter(new PoFileLoader()), 'xliff' => new XliffLoader() - ); + ]; }); $app['translation-extractor.updater'] = $app->share(function (Application $app) { diff --git a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php index 34eeb0e2bc..c35f3eb2f4 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php @@ -26,7 +26,7 @@ class LocaleServiceProvider implements ServiceProviderInterface $app['locales.available'] = $app->share(function (Application $app) { $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']); $enabledLanguages = $availableLanguages; diff --git a/lib/Alchemy/Phrasea/Core/Provider/TranslationServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TranslationServiceProvider.php index da6b807649..fb05455176 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TranslationServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TranslationServiceProvider.php @@ -13,13 +13,13 @@ class TranslationServiceProvider implements ServiceProviderInterface { public function register(Application $app) { - $app['translator.cache-options'] = array(); + $app['translator.cache-options'] = []; $app['translator'] = $app->share(function ($app) { $app['translator.cache-options'] = array_replace( - array( + [ 'debug' => $app['debug'], - ), $app['translator.cache-options'] + ], $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(); }); - $app['translator.domains'] = array(); - $app['locale_fallbacks'] = array('en'); + $app['translator.domains'] = []; + $app['locale_fallbacks'] = ['en']; } public function boot(Application $app) diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php index 41d6601d2b..443d084ad5 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php @@ -20,7 +20,7 @@ class PhraseaForgotPasswordForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', 'email', [ - 'label' => ('E-mail'), + 'label' => 'E-mail', 'required' => true, 'constraints' => [ new Assert\NotBlank(), diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php index 86f05cc822..78a41b453c 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php @@ -44,8 +44,8 @@ class PhraseaRecoverPasswordForm extends AbstractType 'invalid_message' => 'Please provide the same passwords.', 'first_name' => 'password', 'second_name' => 'confirm', - 'first_options' => ['label' => ('New password')], - 'second_options' => ['label' => ('New password (confirmation)')], + 'first_options' => ['label' => 'New password'], + 'second_options' => ['label' => 'New password (confirmation)'], 'constraints' => [ new Assert\NotBlank(), new Assert\Length(['min' => 5]), diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index 5f7d2d9d13..7e2581f5eb 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -35,7 +35,7 @@ class PhraseaRegisterForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('email', 'email', [ - 'label' => ('E-mail'), + 'label' => 'E-mail', 'required' => true, 'constraints' => [ new Assert\NotBlank(), @@ -60,11 +60,11 @@ class PhraseaRegisterForm extends AbstractType if ($this->app->hasTermsOfUse()) { $builder->add('accept-tou', 'checkbox', [ - 'label' => ('Terms of Use'), + 'label' => 'Terms of Use', 'mapped' => false, "constraints" => [ 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' => [ new Assert\Choice([ 'choices' => $baseIds, - 'minMessage' => ('You must select at least %s collection.'), + 'minMessage' => 'You must select at least %s collection.', 'multiple' => true, 'min' => 1, ]), diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index e54e3c3628..e5526fd563 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -617,7 +617,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper } 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); } @@ -628,7 +628,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper } 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); } } diff --git a/lib/Alchemy/Phrasea/Model/Entities/User.php b/lib/Alchemy/Phrasea/Model/Entities/User.php index 0590b04a0c..e545d7ccb8 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/User.php +++ b/lib/Alchemy/Phrasea/Model/Entities/User.php @@ -965,7 +965,7 @@ class User public function getDisplayName(TranslatorInterface $translator) { 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) !== '') { diff --git a/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php b/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php index 73a90c7534..07546f672c 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php +++ b/lib/Alchemy/Phrasea/Model/Entities/ValidationSession.php @@ -264,15 +264,15 @@ class ValidationSession if ($this->isInitiator($user)) { 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 { - 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 { 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 { - 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()]); } } } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoBridgeUploadFailed.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoBridgeUploadFailed.php index f3fe932ef2..3bcd905cb7 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoBridgeUploadFailed.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoBridgeUploadFailed.php @@ -45,7 +45,7 @@ class MailInfoBridgeUploadFailed extends AbstractMailWithLink */ 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'); } - 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]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php index 07b67a6181..f1e61cad42 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewOrder.php @@ -33,7 +33,7 @@ class MailInfoNewOrder extends AbstractMail */ 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()'); } - 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() { - return $this->app->trans('Review order on %website%', array('%website%' => $this->getPhraseanetTitle())); + return $this->app->trans('Review order on %website%', ['%website%' => $this->getPhraseanetTitle()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewPublication.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewPublication.php index 74521ccbdf..ea81eb5f3a 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewPublication.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoNewPublication.php @@ -49,7 +49,7 @@ class MailInfoNewPublication extends AbstractMailWithLink 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'); } - 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() { - return $this->app->trans('View on %title%', array('%title%' => $this->getPhraseanetTitle())); + return $this->app->trans('View on %title%', ['%title%' => $this->getPhraseanetTitle()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php index 13abc3ee93..221129f7bc 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderCancelled.php @@ -60,10 +60,10 @@ class MailInfoOrderCancelled extends AbstractMail 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(), '%quantity%' => $this->quantity, - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php index 757db48a2e..effc4dd748 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoOrderDelivered.php @@ -50,7 +50,7 @@ class MailInfoOrderDelivered extends AbstractMail 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'); } - 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()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php index a77c5a76c0..1f09854595 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoPushReceived.php @@ -45,7 +45,7 @@ class MailInfoPushReceived extends AbstractMailWithLink 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 - $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; } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php index 685487460c..9c5f172d7f 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php @@ -18,7 +18,7 @@ class MailInfoSomebodyAutoregistered extends AbstractMailWithLink */ 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()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php index 705cc04e46..058452f453 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php @@ -33,7 +33,7 @@ class MailInfoUserRegistered extends AbstractMail */ 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()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php index 99236989f9..f1a513a216 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationDone.php @@ -52,10 +52,10 @@ class MailInfoValidationDone extends AbstractMailWithLink 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(), '%title%' => $this->title, - )); + ]); } /** @@ -67,9 +67,9 @@ class MailInfoValidationDone extends AbstractMailWithLink 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(), - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationReminder.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationReminder.php index e6b7e755e5..ceefe7fb2a 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationReminder.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationReminder.php @@ -37,7 +37,7 @@ class MailInfoValidationReminder extends AbstractMailWithLink 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() { - 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') - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php index d39d204273..006f5d9fe6 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoValidationRequest.php @@ -59,7 +59,7 @@ class MailInfoValidationRequest extends AbstractMailWithLink 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 (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 { return $this->message . "\n\n" . $this->app->trans("You have 1 day to validate the selection."); } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordSetup.php b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordSetup.php index 61330e6fb0..0c0fcb747b 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordSetup.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordSetup.php @@ -33,7 +33,7 @@ class MailRequestPasswordSetup extends AbstractMailWithLink */ 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'); } - 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" . $this->app->trans('You now have to set up your pasword'); } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php index 39da70438b..aae32a4491 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php @@ -45,7 +45,7 @@ class MailRequestPasswordUpdate extends AbstractMailWithLink 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" . $this->app->trans('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien'); } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessAccessRequest.php b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessAccessRequest.php index df7d1c5251..4c77be1535 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessAccessRequest.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessAccessRequest.php @@ -18,7 +18,7 @@ class MailSuccessAccessRequest extends AbstractMailWithLink */ 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()]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegistered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegistered.php index 3185c2c1a3..3ecb4969af 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegistered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegistered.php @@ -34,7 +34,7 @@ class MailSuccessEmailConfirmationRegistered extends AbstractMailWithLink */ 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')]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailUpdate.php b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailUpdate.php index f2602ce2cb..fff6dae681 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailUpdate.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessEmailUpdate.php @@ -18,7 +18,7 @@ class MailSuccessEmailUpdate extends AbstractMail */ 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() { 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->message ); diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPSender.php b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPSender.php index cdb5573df6..242aac0b19 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPSender.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailSuccessFTPSender.php @@ -37,10 +37,10 @@ class MailSuccessFTPSender extends AbstractMail 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(), '%server%' => $this->server, - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailTest.php b/lib/Alchemy/Phrasea/Notification/Mail/MailTest.php index 18b6961e1e..56daa51faa 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailTest.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailTest.php @@ -26,7 +26,7 @@ class MailTest extends AbstractMail */ 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); } /** diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index c1370504ac..bdc01e1256 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -494,13 +494,13 @@ class PhraseaEngine implements SearchEngineInterface if ((int) (count($proposals["BASES"]) > 1) && count($zbase["TERMS"]) > 0) { $style = $b ? 'style="margin-top:0px;"' : ''; $b = false; - $html .= "

" . $translator->trans('reponses::propositions pour la base %name', array('%name%' => $zbase["NAME"])) . "

"; + $html .= "

" . $translator->trans('reponses::propositions pour la base %name', ['%name%' => $zbase["NAME"]]) . "

"; } $t = true; foreach ($zbase["TERMS"] as $path => $props) { $style = $t ? 'style="margin-top:0px;"' : ''; $t = false; - $html .= "

" . $translator->trans('reponses::propositions pour le terme %terme%', array('%terme%' => $props["TERM"])) . "

"; + $html .= "

" . $translator->trans('reponses::propositions pour le terme %terme%', ['%terme%' => $props["TERM"]]) . "

"; $html .= $props["HTML"]; } } diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php index ef703c6183..61a92a9fd2 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php @@ -895,7 +895,7 @@ class PhraseaEngineQueryParser // un op. arith. doit étre précédé d'un seul nom de champ if ($this->errmsg != "") $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); } @@ -903,7 +903,7 @@ class PhraseaEngineQueryParser // un op. arith. doit étre suivi d'une valeur if ($this->errmsg != "") $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); } @@ -1456,7 +1456,7 @@ class PhraseaEngineQueryParser if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if ($this->errmsg != "") $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"]; } @@ -1505,14 +1505,14 @@ class PhraseaEngineQueryParser if (!$tree) { if ($this->errmsg != "") $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); } if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if ($this->errmsg != "") $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); } @@ -1525,7 +1525,7 @@ class PhraseaEngineQueryParser if (!$tree) { if ($this->errmsg != "") $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); } @@ -1533,7 +1533,7 @@ class PhraseaEngineQueryParser if ($this->errmsg != "") $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); } diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php index 1c3a251570..d3e4eebbd3 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/FtpJob.php @@ -101,19 +101,19 @@ class FtpJob extends AbstractJob $ftpLog = $ftp_user_name . "@" . \p4string::addEndSlash($ftp_server) . $export->getDestfolder(); 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, '%username%' => $ftp_user_name, '%directory%' => $export->getDestfolder(), - )) . PHP_EOL; + ]) . PHP_EOL; $state .= $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, '%date%' => " (" . date('r') . ")" - )) . PHP_EOL; + ]) . PHP_EOL; $this->log('debug', $line); @@ -242,7 +242,7 @@ class FtpJob extends AbstractJob $app['EM']->flush(); $this->logexport($app, $record, $obj, $ftpLog); } 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
"; + $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
"; $this->log('debug', $line); @@ -340,22 +340,22 @@ class FtpJob extends AbstractJob foreach ($export->getElements() as $element) { if (!$element->isError() && $element->isDone()) { $transferts[] = - '
  • ' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', array( + '
  • ' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', [ '%recordid%' => $element->getRecordId(), '%filename%' => $element->getFilename(), '%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app), '%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(), '%subdefname%' => $element->getSubdef(), - )) . ' : ' . $this->translator->trans('Transfert OK') . '
  • '; + ]) . ' : ' . $this->translator->trans('Transfert OK') . ''; } else { $transferts[] = - '
  • ' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', array( + '
  • ' . $this->translator->trans('task::ftp:Record %recordid% - %filename% de la base (%databoxname% - %collectionname%) - %subdefname%', [ '%recordid%' => $element->getRecordId(), '%filename%' => $element->getFilename(), '%databoxname%' => \phrasea::sbas_labels(\phrasea::sbasFromBas($app, $element->getBaseId()), $app), '%collectionname%' => \phrasea::bas_labels($element->getBaseId(), $app), $element->getSubdef(), '%subdefname%' => $element->getSubdef(), - )) . ' : ' . $this->translator->trans('Transfert Annule') . '
  • '; + ]) . ' : ' . $this->translator->trans('Transfert Annule') . ''; $transfert_status = $this->translator->trans('task::ftp:Certains documents n\'ont pas pu etre tranferes'); } } diff --git a/lib/Alchemy/Phrasea/Utilities/CachedTranslator.php b/lib/Alchemy/Phrasea/Utilities/CachedTranslator.php index 95b4768a6a..5fdd162322 100644 --- a/lib/Alchemy/Phrasea/Utilities/CachedTranslator.php +++ b/lib/Alchemy/Phrasea/Utilities/CachedTranslator.php @@ -1,12 +1,7 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. +/** + * Largely inspired from Symfony Framework Bundle */ namespace Alchemy\Phrasea\Utilities; @@ -23,12 +18,12 @@ use Symfony\Component\Translation\MessageSelector; class CachedTranslator extends Translator { protected $app; - protected $options = array( + protected $options = [ 'cache_dir' => null, 'debug' => false, - ); + ]; - public function __construct(Application $app, MessageSelector $selector, array $options = array()) + public function __construct(Application $app, MessageSelector $selector, array $options = []) { $this->app = $app; diff --git a/lib/classes/API/OAuth2/Form/DevAppDesktop.php b/lib/classes/API/OAuth2/Form/DevAppDesktop.php index e8b6214667..7853a754e3 100644 --- a/lib/classes/API/OAuth2/Form/DevAppDesktop.php +++ b/lib/classes/API/OAuth2/Form/DevAppDesktop.php @@ -133,8 +133,6 @@ class API_OAuth2_Form_DevAppDesktop */ 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('description', new Constraints\NotBlank()); $metadata->addPropertyConstraint('urlwebsite', new Constraints\NotBlank()); diff --git a/lib/classes/Bridge/Api/Dailymotion.php b/lib/classes/Bridge/Api/Dailymotion.php index 679480144c..30237750ad 100644 --- a/lib/classes/Bridge/Api/Dailymotion.php +++ b/lib/classes/Bridge/Api/Dailymotion.php @@ -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"); } else { 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) - $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"); } else { 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) - $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 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) - $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; } diff --git a/lib/classes/Bridge/Api/Flickr.php b/lib/classes/Bridge/Api/Flickr.php index 0ac2ce1709..01957c4f69 100644 --- a/lib/classes/Bridge/Api/Flickr.php +++ b/lib/classes/Bridge/Api/Flickr.php @@ -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"); } elseif ($length !== 0) { 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"); } elseif ($length !== 0) { 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) $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) - $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; } diff --git a/lib/classes/Bridge/Api/Youtube.php b/lib/classes/Bridge/Api/Youtube.php index 58c80a413a..833b9f2ec4 100644 --- a/lib/classes/Bridge/Api/Youtube.php +++ b/lib/classes/Bridge/Api/Youtube.php @@ -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"); } elseif ($length !== 0) { 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"); } elseif ($length !== 0) { 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 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) - $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; } diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index 8a066cfb9f..6581f0b729 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -378,7 +378,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $test_user = User_Adapter::get_usr_id_from_email($this->app, $email); 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'; @@ -1112,7 +1112,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function get_display_name() { 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) !== '') $display_name = $this->firstname . ' ' . $this->lastname; elseif (trim($this->email) !== '') diff --git a/lib/classes/appbox.php b/lib/classes/appbox.php index 8e7cddf11a..a8ad4ab329 100644 --- a/lib/classes/appbox.php +++ b/lib/classes/appbox.php @@ -357,7 +357,7 @@ class appbox extends base * Step 7 */ 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)); $upgrader->add_steps_complete(1); } diff --git a/lib/classes/base.php b/lib/classes/base.php index e888d716ee..80f74c4cc8 100644 --- a/lib/classes/base.php +++ b/lib/classes/base.php @@ -301,7 +301,7 @@ abstract class base implements cache_cacheableInterface foreach ($rs as $row) { $tname = $row["Name"]; 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)); $ref_engine = strtolower($row['Engine']); @@ -314,7 +314,7 @@ abstract class base implements cache_cacheableInterface $stmt->closeCursor(); } catch (Exception $e) { $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 ]; } @@ -333,13 +333,13 @@ abstract class base implements cache_cacheableInterface } 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); $upgrader->add_steps_complete(1); } $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) { $this->apply_patches($current_version, $app['phraseanet.version']->getNumber(), false, $upgrader, $app); } @@ -536,7 +536,7 @@ abstract class base implements cache_cacheableInterface $stmt->closeCursor(); } catch (Exception $e) { $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'] ]; } @@ -750,7 +750,7 @@ abstract class base implements cache_cacheableInterface $stmt->closeCursor(); } catch (Exception $e) { $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 ]; } @@ -763,7 +763,7 @@ abstract class base implements cache_cacheableInterface $stmt->closeCursor(); } catch (Exception $e) { $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 ]; } @@ -821,7 +821,7 @@ abstract class base implements cache_cacheableInterface $upgrader->add_steps_complete(1) ->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); $success = true; diff --git a/lib/classes/databox/cgu.php b/lib/classes/databox/cgu.php index 259739030e..e9b0bf59e9 100644 --- a/lib/classes/databox/cgu.php +++ b/lib/classes/databox/cgu.php @@ -88,7 +88,7 @@ class databox_cgu if ($out != '') $out .= '
    '; - $out .= '

    ' . str_replace('"', '"', $app->trans('cgus:: CGUs de la base %databox_name%', array('%databox_name%' => $name))) . '

    '; + $out .= '

    ' . str_replace('"', '"', $app->trans('cgus:: CGUs de la base %databox_name%', ['%databox_name%' => $name])) . '

    '; $out .= '
    ' . $term['terms'] . '
    '; diff --git a/lib/classes/eventsmanager/notify/autoregister.php b/lib/classes/eventsmanager/notify/autoregister.php index 9701e70cb9..5941caba1b 100644 --- a/lib/classes/eventsmanager/notify/autoregister.php +++ b/lib/classes/eventsmanager/notify/autoregister.php @@ -149,7 +149,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $ret = [ - 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', array('%user%' => $sender, '%before_link%' => '', '%after_link%' => '')) + 'text' => $this->app->trans('%user% s\'est enregistre sur une ou plusieurs %before_link% scollections %after_link%', ['%user%' => $sender, '%before_link%' => '', '%after_link%' => '']) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/bridgeuploadfail.php b/lib/classes/eventsmanager/notify/bridgeuploadfail.php index 63ac8a265d..1e566bb083 100644 --- a/lib/classes/eventsmanager/notify/bridgeuploadfail.php +++ b/lib/classes/eventsmanager/notify/bridgeuploadfail.php @@ -125,11 +125,11 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract } $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(), '%bridge_name%' => $account->get_api()->get_connector()->get_name(), '%reason%' => $reason - )) + ]) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/downloadmailfail.php b/lib/classes/eventsmanager/notify/downloadmailfail.php index 57368cd58f..89bacf4d85 100644 --- a/lib/classes/eventsmanager/notify/downloadmailfail.php +++ b/lib/classes/eventsmanager/notify/downloadmailfail.php @@ -105,7 +105,7 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract $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 = [ 'text' => $text diff --git a/lib/classes/eventsmanager/notify/feed.php b/lib/classes/eventsmanager/notify/feed.php index fe72e29933..f7ee8f5aa5 100644 --- a/lib/classes/eventsmanager/notify/feed.php +++ b/lib/classes/eventsmanager/notify/feed.php @@ -140,7 +140,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract } $ret = [ - 'text' => $this->app->trans('%user% has published %title%', array('%user%' => $entry->getAuthorName(), '%title%' => '' . $entry->getTitle() . '')) + 'text' => $this->app->trans('%user% has published %title%', ['%user%' => $entry->getAuthorName(), '%title%' => '' . $entry->getTitle() . '']) , 'class' => ($unread == 1 ? 'reload_baskets' : '') ]; diff --git a/lib/classes/eventsmanager/notify/order.php b/lib/classes/eventsmanager/notify/order.php index 564950bf89..1f0d33d7b4 100644 --- a/lib/classes/eventsmanager/notify/order.php +++ b/lib/classes/eventsmanager/notify/order.php @@ -147,10 +147,10 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $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, '%opening_link%' => '', - '%end_link%' => '',)) + '%end_link%' => '',]) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php index 7d1c8cf301..f3f3df5d5f 100644 --- a/lib/classes/eventsmanager/notify/orderdeliver.php +++ b/lib/classes/eventsmanager/notify/orderdeliver.php @@ -158,9 +158,9 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract return []; } $ret = [ - 'text' => $this->app->trans('%user% vous a delivre %quantity% document(s) pour votre commande %title%', array('%user%' => $sender, '%quantity%' => $n, '%title%' => 'ssel_id . '/" target="_blank">' - . $basket->getName() . '')) + . $basket->getName() . '']) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.php b/lib/classes/eventsmanager/notify/ordernotdelivered.php index 9662f3f4c2..23afc20ed2 100644 --- a/lib/classes/eventsmanager/notify/ordernotdelivered.php +++ b/lib/classes/eventsmanager/notify/ordernotdelivered.php @@ -116,7 +116,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac $sender = User_Adapter::getInstance($from, $this->app)->get_display_name(); $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' => '' ]; diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php index 73ae675930..294f24284e 100644 --- a/lib/classes/eventsmanager/notify/push.php +++ b/lib/classes/eventsmanager/notify/push.php @@ -128,8 +128,8 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract $sender = User_Adapter::getInstance($from, $this->app)->get_display_name(); $ret = [ - 'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', array('%user%' => $sender, '%before_link%' => '', '%after_link%' => '')) + 'text' => $this->app->trans('%user% vous a envoye un %before_link% panier %after_link%', ['%user%' => $sender, '%before_link%' => '', '%after_link%' => '']) , 'class' => ($unread == 1 ? 'reload_baskets' : '') ]; diff --git a/lib/classes/eventsmanager/notify/register.php b/lib/classes/eventsmanager/notify/register.php index 485b1cbd0d..8a121fc8d2 100644 --- a/lib/classes/eventsmanager/notify/register.php +++ b/lib/classes/eventsmanager/notify/register.php @@ -159,7 +159,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name(); $ret = [ - 'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', array('%user%' => $sender, '%before_link%' => '', '%after_link%' => '')) + 'text' => $this->app->trans('%user% demande votre approbation sur une ou plusieurs %before_link% collections %after_link%', ['%user%' => $sender, '%before_link%' => '', '%after_link%' => '']) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/uploadquarantine.php b/lib/classes/eventsmanager/notify/uploadquarantine.php index b4510341d5..354661e5a7 100644 --- a/lib/classes/eventsmanager/notify/uploadquarantine.php +++ b/lib/classes/eventsmanager/notify/uploadquarantine.php @@ -146,10 +146,10 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract $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)) { - $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' => '']; diff --git a/lib/classes/eventsmanager/notify/validate.php b/lib/classes/eventsmanager/notify/validate.php index 0dc8975d95..f6e41c0b23 100644 --- a/lib/classes/eventsmanager/notify/validate.php +++ b/lib/classes/eventsmanager/notify/validate.php @@ -158,10 +158,10 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract . $basket_name . ''; $ret = [ - 'text' => $this->app->trans('%user% vous demande de valider %title%', array( + 'text' => $this->app->trans('%user% vous demande de valider %title%', [ '%user%' => $sender, '%title%' => $bask_link, - )) + ]) , 'class' => ($unread == 1 ? 'reload_baskets' : '') ]; diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php index 7efb8ec5cb..1dbfd8ca49 100644 --- a/lib/classes/eventsmanager/notify/validationdone.php +++ b/lib/classes/eventsmanager/notify/validationdone.php @@ -146,10 +146,10 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract } $ret = [ - 'text' => $this->app->trans('%user% a envoye son rapport de validation de %title%', array('%user%' => $sender, '%title%' => 'ssel_id . '/" target="_blank">' . $basket->getName() . '' - )) + ]) , 'class' => '' ]; diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php index 26ae1ad42d..224bb5ce4f 100644 --- a/lib/classes/eventsmanager/notify/validationreminder.php +++ b/lib/classes/eventsmanager/notify/validationreminder.php @@ -156,7 +156,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra . $basket_name . ''; $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' : '') ]; diff --git a/lib/classes/module/report/activity.php b/lib/classes/module/report/activity.php index 5801c4036d..f7bd006238 100644 --- a/lib/classes/module/report/activity.php +++ b/lib/classes/module/report/activity.php @@ -313,7 +313,7 @@ class module_report_activity extends module_report $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); diff --git a/lib/classes/module/report/nav.php b/lib/classes/module/report/nav.php index 921889e6c8..f6ac2079db 100644 --- a/lib/classes/module/report/nav.php +++ b/lib/classes/module/report/nav.php @@ -415,7 +415,7 @@ class module_report_nav extends module_report $filter_id_apbox = $filter_id_datbox = []; $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 ( ! empty($req)) { @@ -471,7 +471,7 @@ class module_report_nav extends module_report $this->app->trans('phraseanet::utilisateur inconnu') : $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->setDisplayNav(); @@ -511,7 +511,7 @@ class module_report_nav extends module_report ]; $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(); $this->result[] = [ @@ -534,7 +534,7 @@ class module_report_nav extends module_report public function buildTabInfoNav($tab = false, $navigator) { $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); $filter = $sqlBuilder->getFilters(); $report_filter = $filter->getReportFilter(); diff --git a/lib/classes/phraseadate.php b/lib/classes/phraseadate.php index c1f154c28f..a26691d410 100644 --- a/lib/classes/phraseadate.php +++ b/lib/classes/phraseadate.php @@ -104,11 +104,11 @@ class phraseadate } elseif ($diff < 120) { return $this->app->trans('phraseanet::temps:: il y a une minute'); } 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) { return $this->app->trans('phraseanet::temps:: il y a une heure'); } 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) { return $this->app->trans('phraseanet::temps:: hier'); diff --git a/lib/classes/record/exportElement.php b/lib/classes/record/exportElement.php index 8af4057c30..7ee14a6e1d 100644 --- a/lib/classes/record/exportElement.php +++ b/lib/classes/record/exportElement.php @@ -130,16 +130,22 @@ class record_exportElement extends record_adapter if ($go_dl['document'] === true) { if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) { $this->remain_hd --; - if ($this->remain_hd >= 0) + if ($this->remain_hd >= 0) { + $localizedLabel = $this->app->trans('document original'); $downloadable['document'] = [ 'class' => 'document', - 'label' => 'document original' + /** @Ignore */ + 'label' => $localizedLabel, ]; - } else + } + } else { + $localizedLabel = $this->app->trans('document original'); $downloadable['document'] = [ 'class' => 'document', - 'label' => 'document original' + /** @Ignore */ + 'label' => $localizedLabel ]; + } } if ($go_cmd === true) { $orderable['document'] = true; @@ -206,14 +212,19 @@ class record_exportElement extends record_adapter $xml = $this->get_caption()->serialize(caption_record::SERIALIZE_XML); if ($xml) { + $localizedLabel = $this->app->trans('caption XML'); $downloadable['caption'] = [ 'class' => 'caption', - 'label' => 'caption XML' + /** @Ignore */ + 'label' => $localizedLabel, ]; $this->add_count('caption', strlen($xml)); + + $localizedLabel = $this->app->trans('caption YAML'); $downloadable['caption-yaml'] = [ 'class' => 'caption', - 'label' => 'caption YAML' + /** @Ignore */ + 'label' => $localizedLabel, ]; $this->add_count('caption-yaml', strlen(strip_tags($xml))); } diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php index ccd5804cf2..9ab63fa872 100644 --- a/lib/classes/record/preview.php +++ b/lib/classes/record/preview.php @@ -279,7 +279,7 @@ class record_preview extends record_adapter switch ($this->env) { case "RESULT": - $this->title .= $this->app->trans('preview:: resultat numero %number%', array('%number%' => '' . ($this->number + 1) . ' : ')); + $this->title .= $this->app->trans('preview:: resultat numero %number%', ['%number%' => '' . ($this->number + 1) . ' : ']); $this->title .= parent::get_title($highlight, $search_engine); break; case "BASK": diff --git a/lib/conf.d/_GV_template.inc b/lib/conf.d/_GV_template.inc index 6e3b7f88c8..39adc1dd6a 100644 --- a/lib/conf.d/_GV_template.inc +++ b/lib/conf.d/_GV_template.inc @@ -99,7 +99,7 @@ return call_user_func_array(function(Application $app) { 'type' => \registry::TYPE_BOOLEAN, 'name' => 'GV_captchas', '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, 'required' => true ], @@ -123,7 +123,7 @@ return call_user_func_array(function(Application $app) { 'type' => \registry::TYPE_BOOLEAN, 'name' => 'GV_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, 'required' => true ], @@ -143,7 +143,7 @@ return call_user_func_array(function(Application $app) { 'type' => \registry::TYPE_STRING, 'name' => 'GV_youtube_dev_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' => '' ] ] @@ -154,7 +154,7 @@ return call_user_func_array(function(Application $app) { 'type' => \registry::TYPE_BOOLEAN, 'name' => 'GV_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, 'required' => true ], @@ -178,7 +178,7 @@ return call_user_func_array(function(Application $app) { 'type' => \registry::TYPE_BOOLEAN, 'name' => 'GV_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, 'required' => true ], @@ -269,7 +269,7 @@ return call_user_func_array(function(Application $app) { 'name' => 'GV_imagine_driver', 'default' => '', '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' => [ '' => 'Auto', 'gmagick' => 'GraphicsMagick', diff --git a/lib/conf.d/bases_structure.xml b/lib/conf.d/bases_structure.xml index 4a798ccbed..ee944adb23 100644 --- a/lib/conf.d/bases_structure.xml +++ b/lib/conf.d/bases_structure.xml @@ -4648,7 +4648,7 @@ ToU - ar + nl NOW() diff --git a/templates/mobile/api/auth/end_user_authorization.html.twig b/templates/mobile/api/auth/end_user_authorization.html.twig index d993468d0c..5aca259774 100644 --- a/templates/mobile/api/auth/end_user_authorization.html.twig +++ b/templates/mobile/api/auth/end_user_authorization.html.twig @@ -50,7 +50,7 @@

    - {{ 'Problèmes de connexion ?' | trans }} + {{ 'Problemes de connexion ?' | trans }}

    {% else %} diff --git a/templates/web/api/auth/end_user_authorization.html.twig b/templates/web/api/auth/end_user_authorization.html.twig index cb004e78da..1304a039a8 100644 --- a/templates/web/api/auth/end_user_authorization.html.twig +++ b/templates/web/api/auth/end_user_authorization.html.twig @@ -50,7 +50,7 @@

    - {{ 'Problèmes de connexion ?' | trans }} + {{ 'Problemes de connexion ?' | trans }}

    {% else %} diff --git a/templates/web/common/dialog_export.html.twig b/templates/web/common/dialog_export.html.twig index 582877b040..16d7880c1d 100644 --- a/templates/web/common/dialog_export.html.twig +++ b/templates/web/common/dialog_export.html.twig @@ -518,7 +518,7 @@ title : '{{ "Warning !" | trans }}' }, 2); - alert.setContent("{{ alert_message|e }}"); + alert.setContent("{{ alert_message | e('js') }}"); return false; } @@ -558,10 +558,10 @@ size : 'Alert', closeOnEscape : true, closeButton:true, - title : '{{ "Warning !" | trans }}' + title : '{{ "Warning !" | trans | e('js') }}' }, 2); - alert.setContent("{{ alert_message|e }}"); + alert.setContent("{{ alert_message | e('js') }}"); return false; } @@ -575,10 +575,10 @@ size : 'Alert', closeOnEscape : true, closeButton:true, - title : '{{ "Warning !" | trans }}' + title : '{{ "Warning !" | trans | e('js') }}' }, 2); - alert.setContent("{{ alert_message|e }}"); + alert.setContent("{{ alert_message | e('js') }}"); return false; } @@ -651,7 +651,7 @@ {% endset %} 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[]"][value="'+$(n).val()+'"]', $('#sendmail')).attr('checked', true); }); @@ -689,9 +689,9 @@ $('#order .order_button_loader').css('visibility','hidden'); if(!data.error) { - var title = '{{ "Success" | trans }}'; + var title = '{{ "Success" | trans | e('js') }}'; } else { - var title = '{{ "Warning !" | trans }}'; + var title = '{{ "Warning !" | trans | e('js') }}'; } var options = { @@ -745,7 +745,7 @@ size : 'Alert', closeOnEscape : true, closeButton:true, - title : '{{ "Warning !" | trans }}' + title : '{{ "Warning !" | trans | e('js') }}' }, 2); alert.setContent(data.message); @@ -769,7 +769,7 @@ var options = { size : 'Alert', 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); diff --git a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php index a9247d5b3f..e598f583eb 100644 --- a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php @@ -349,7 +349,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract $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->assertFileExists($tempDir.'/catalogue.'.($locale ?: 'en').'.php'); @@ -357,10 +357,10 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract public function transProvider() { - return array( - array('key1', 'de', 'The german translation'), - array('test.key', 'de', 'It works in german'), - ); + return [ + ['key1', 'de', 'The german translation'], + ['test.key', 'de', 'It works in german'], + ]; } protected function getPreparedApp($tempDir) @@ -371,25 +371,25 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract 'cache_dir' => $tempDir, ]; - $app['translator.domains'] = array( - 'messages' => array( - 'en' => array ( + $app['translator.domains'] = [ + 'messages' => [ + 'en' => [ 'key1' => 'The translation', 'key_only_english' => 'Foo', 'key2' => 'One apple|%count% apples', - 'test' => array( + 'test' => [ 'key' => 'It works' - ) - ), - 'de' => array ( + ] + ], + 'de' => [ 'key1' => 'The german translation', 'key2' => 'One german apple|%count% german apples', - 'test' => array( + 'test' => [ 'key' => 'It works in german' - ) - ) - ) - ); + ] + ] + ] + ]; return $app; } diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TaskManagerServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TaskManagerServiceProviderTest.php index aea1ce8aec..e32bca4831 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TaskManagerServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TaskManagerServiceProviderTest.php @@ -3,7 +3,7 @@ namespace Alchemy\Tests\Phrasea\Core\CLIProvider; /** - * @covers Alchemy\Phrasea\Core\Provider\TaskManagerServiceProvider + * @covers Alchemy\Phrasea\Core\CLIProvider\TaskManagerServiceProvider */ class TaskManagerServiceProvidertest extends ServiceProviderTestCase { diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TranslationExtractorServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TranslationExtractorServiceProviderTest.php new file mode 100644 index 0000000000..2fb215b51e --- /dev/null +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/TranslationExtractorServiceProviderTest.php @@ -0,0 +1,50 @@ +getMail(); - $this->assertContainsString('dailymotion', $mail->getMessage()); + $this->assertEquals('An upload on %bridge_adapter% failed, the resaon is : %reason%', $mail->getMessage()); } public function testSHouldThrowALogicExceptionIfNoAdapterProvided() @@ -63,7 +63,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase { $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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php index d686d32d63..2856c850a6 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php @@ -12,7 +12,7 @@ class MailInfoNewOrderTest extends MailTestCase { public function testSetUser() { - $this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); + $this->assertEquals('%user% has ordered documents', $this->getMail()->getMessage()); } public function testShouldThrowALogicExceptionIfNoUserProvided() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php index 1e8e19ef52..9ee15745d5 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php @@ -13,8 +13,8 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase public function testSetTitle() { - $this->assertContainsString('joli titre', $this->getMail()->getSubject()); - $this->assertContainsString('joli titre', $this->getMail()->getMessage()); + $this->assertEquals('Nouvelle publication : %title%', $this->getMail()->getSubject()); + $this->assertEquals('%user% vient de publier %title%', $this->getMail()->getMessage()); } public function testShouldThrowALogicExceptionIfNoTitleProvided() @@ -64,7 +64,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase public function testSetAuthor() { - $this->assertContainsString('bel author', $this->getMail()->getMessage()); + $this->assertEquals('%user% vient de publier %title%', $this->getMail()->getMessage()); } public function getMail() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php index 3a662d708c..48760dc8a7 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php @@ -12,12 +12,12 @@ class MailInfoOrderCancelledTest extends MailTestCase { 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() { - $this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); + $this->assertEquals('%user% a refuse %quantity% elements de votre commande', $this->getMail()->getMessage()); } public function testShouldThrowALogicExceptionIfNoQuantityProvided() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php index eedf0d9cba..ac32499bbc 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php @@ -12,12 +12,12 @@ class MailInfoOrderDeliveredTest extends MailTestCase { 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() { - $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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php index 8ebd5b5ae6..1ed4fa6b49 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php @@ -14,7 +14,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase { $mail = $this->getMail(); - $this->assertContainsString('Hello basket', $mail->getSubject()); + $this->assertEquals('Reception of %basket_name%', $mail->getSubject()); } public function testShouldThrowLogicExceptionsIfBasketNotSet() @@ -50,7 +50,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase { $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() @@ -83,7 +83,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase { $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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php index f41eb8eeff..3eab91a560 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php @@ -15,7 +15,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase */ 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() { - $this->assertContainsString('JeanPhil', $this->getMail()->getSubject()); - $this->assertContainsString('JeanPhil', $this->getMail()->getMessage()); + $this->assertEquals('push::mail:: Rapport de validation de %user% pour %title%', $this->getMail()->getSubject()); + $this->assertEquals('%user% has just sent its validation report, you can now see it', $this->getMail()->getMessage()); } public function testShouldThrowALogicExceptionIfNoTitleProvided() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php index c2e06771a6..8675b349df 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php @@ -15,7 +15,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase */ public function testSetTitle() { - $this->assertContainsString('Hulk Hogan', $this->getMail()->getSubject()); + $this->assertEquals('Reminder : validate \'%title%\'', $this->getMail()->getSubject()); } public function testShouldThrowALogicExceptionIfNoTitleProvided() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php index 991aba7e33..50d76d6de1 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php @@ -12,7 +12,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase { public function testSetTitle() { - $this->assertContainsString('Hello World', $this->getMail()->getSubject()); + $this->assertEquals('Validation request from %user% for \'%title%\'', $this->getMail()->getSubject()); } public function testShouldThrowALogicExceptionIfNoUserProvided() @@ -67,7 +67,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase public function testSetUser() { - $this->assertContainsString('jeanPhil', $this->getMail()->getSubject()); + $this->assertEquals('Validation request from %user% for \'%title%\'', $this->getMail()->getSubject()); } public function getMail() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php index 706e0b3bce..9d899a049a 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php @@ -13,7 +13,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase public function testSetLogin() { $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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php index cfcd519715..87263fd008 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php @@ -13,7 +13,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase public function testSetLogin() { $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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php index 0ccdd39ee2..8f2f41890a 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php @@ -12,7 +12,7 @@ class MailSuccessFTPSenderTest extends MailTestCase { 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() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php index cb2968c521..f8d1c989c9 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php @@ -68,9 +68,4 @@ abstract class MailTestCase extends \PhraseanetPHPUnitAbstract * @return MailInterface */ abstract public function getMail(); - - public function assertContainsString($expected, $message) - { - $this->assertTrue(false !== stripos($message, $expected)); - } }