本文整理汇总了PHP中Alchemy\Phrasea\Application::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::url方法的具体用法?PHP Application::url怎么用?PHP Application::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alchemy\Phrasea\Application
的用法示例。
在下文中一共展示了Application::url方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPhraseanetURL
/**
* {@inheritdoc}
*/
public function getPhraseanetURL()
{
return $this->app->url('root');
}
示例2: testGenerateUrl
public function testGenerateUrl()
{
$generator = $this->getMockBuilder('Symfony\\Component\\Routing\\Generator\\UrlGenerator')->disableOriginalConstructor()->getMock();
$app = new Application(Application::ENV_TEST);
$app['url_generator'] = $generator;
$ret = 'retval-' . mt_rand();
$route = 'route';
$generator->expects($this->once())->method('generate')->with($this->equalTo($route), $this->equalTo([]), $this->equalTo(UrlGenerator::ABSOLUTE_URL))->will($this->returnValue($ret));
$this->assertEquals($ret, $app->url($route));
}
示例3: postAuthProcess
public function postAuthProcess(PhraseaApplication $app, User $user)
{
$date = new \DateTime('+' . (int) $app['conf']->get(['registry', 'actions', 'validation-reminder-days']) . ' days');
foreach ($app['EM']->getRepository('Phraseanet:ValidationParticipant')->findNotConfirmedAndNotRemindedParticipantsByExpireDate($date) as $participant) {
/* @var $participant ValidationParticipant */
$validationSession = $participant->getSession();
$participantId = $participant->getUser()->getId();
$basketId = $validationSession->getBasket()->getId();
try {
$token = $app['tokens']->getValidationToken($participantId, $basketId);
} catch (NotFoundHttpException $e) {
continue;
}
$app['events-manager']->trigger('__VALIDATION_REMINDER__', ['to' => $participantId, 'ssel_id' => $basketId, 'from' => $validationSession->getInitiator()->getId(), 'validate_id' => $validationSession->getId(), 'url' => $app->url('lightbox_validation', ['basket' => $basketId, 'LOG' => $token])]);
$participant->setReminded(new \DateTime('now'));
$app['EM']->persist($participant);
}
$app['EM']->flush();
$session = $app['authentication']->openAccount($user);
if ($user->getLocale() != $app['locale']) {
$user->setLocale($app['locale']);
}
$width = $height = null;
if ($app['request']->cookies->has('screen')) {
$data = explode('x', $app['request']->cookies->get('screen'));
$width = $data[0];
$height = $data[1];
}
$session->setIpAddress($app['request']->getClientIp())->setScreenHeight($height)->setScreenWidth($width);
$app['EM']->persist($session);
$app['EM']->flush();
return $session;
}
示例4: get_page
/**
* @return string
*/
public function get_page()
{
return $this->app->url('permalinks_permaview', ['sbas_id' => $this->media_subdef->get_sbas_id(), 'record_id' => $this->media_subdef->get_record_id(), 'subdef' => $this->media_subdef->get_name(), 'token' => $this->get_token()]);
}
示例5: resetEmail
/**
* Reset Email
*
* @param Application $app
* @param Request $request
* @return RedirectResponse
*/
public function resetEmail(PhraseaApplication $app, Request $request)
{
if (null === ($password = $request->request->get('form_password')) || null === ($email = $request->request->get('form_email')) || null === ($emailConfirm = $request->request->get('form_email_confirm'))) {
$app->abort(400, $app->trans('Could not perform request, please contact an administrator.'));
}
$user = $app['authentication']->getUser();
if (!$app['auth.password-encoder']->isPasswordValid($user->getPassword(), $password, $user->getNonce())) {
$app->addFlash('error', $app->trans('admin::compte-utilisateur:ftp: Le mot de passe est errone'));
return $app->redirectPath('account_reset_email');
}
if (!\Swift_Validate::email($email)) {
$app->addFlash('error', $app->trans('forms::l\'email semble invalide'));
return $app->redirectPath('account_reset_email');
}
if ($email !== $emailConfirm) {
$app->addFlash('error', $app->trans('forms::les emails ne correspondent pas'));
return $app->redirectPath('account_reset_email');
}
$date = new \DateTime('1 day');
$token = $app['tokens']->getUrlToken(\random::TYPE_EMAIL, $app['authentication']->getUser()->getId(), $date, $app['authentication']->getUser()->getEmail());
$url = $app->url('account_reset_email', ['token' => $token]);
try {
$receiver = Receiver::fromUser($app['authentication']->getUser());
} catch (InvalidArgumentException $e) {
$app->addFlash('error', $app->trans('phraseanet::erreur: echec du serveur de mail'));
return $app->redirectPath('account_reset_email');
}
$mail = MailRequestEmailUpdate::create($app, $receiver, null);
$mail->setButtonUrl($url);
$mail->setExpiration($date);
$app['notification.deliverer']->deliver($mail);
$app->addFlash('info', $app->trans('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer'));
return $app->redirectPath('account');
}
示例6: postAuthProcess
public function postAuthProcess(PhraseaApplication $app, User $user)
{
$date = new \DateTime('+' . (int) $app['conf']->get(['registry', 'actions', 'validation-reminder-days']) . ' days');
foreach ($app['repo.validation-participants']->findNotConfirmedAndNotRemindedParticipantsByExpireDate($date) as $participant) {
/* @var $participant ValidationParticipant */
$validationSession = $participant->getSession();
$basket = $validationSession->getBasket();
if (null === ($token = $app['repo.tokens']->findValidationToken($basket, $participant->getUser()))) {
continue;
}
$url = $app->url('lightbox_validation', ['basket' => $basket->getId(), 'LOG' => $token->getValue()]);
$app['dispatcher']->dispatch(PhraseaEvents::VALIDATION_REMINDER, new ValidationEvent($participant, $basket, $url));
$participant->setReminded(new \DateTime('now'));
$app['EM']->persist($participant);
}
$app['EM']->flush();
$session = $app['authentication']->openAccount($user);
if ($user->getLocale() != $app['locale']) {
$user->setLocale($app['locale']);
}
$width = $height = null;
if ($app['request']->cookies->has('screen')) {
$data = explode('x', $app['request']->cookies->get('screen'));
$width = $data[0];
$height = $data[1];
}
$session->setIpAddress($app['request']->getClientIp())->setScreenHeight($height)->setScreenWidth($width);
$app['EM']->persist($session);
$app['EM']->flush();
return $session;
}