当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::config方法代码示例

本文整理汇总了PHP中Silex\Application::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::config方法的具体用法?PHP Application::config怎么用?PHP Application::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Silex\Application的用法示例。


在下文中一共展示了Application::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['application.speakers'] = $app->share(function ($app) {
         $userMapper = $app['spot']->mapper('OpenCFP\\Domain\\Entity\\User');
         $talkMapper = $app['spot']->mapper('OpenCFP\\Domain\\Entity\\Talk');
         $speakerRepository = new SpotSpeakerRepository($userMapper);
         return new Speakers(new CallForProposal(new \DateTime($app->config('application.enddate'))), new SentryIdentityProvider($app['sentry'], $speakerRepository), $speakerRepository, new SpotTalkRepository($talkMapper), new EventDispatcher());
     });
     $app['security.random'] = $app->share(function ($app) {
         return new PseudoRandomStringGenerator(new Factory());
     });
     $app['oauth.resource'] = $app->share(function ($app) {
         $sessionStorage = new SessionStorage();
         $accessTokenStorage = new AccessTokenStorage();
         $clientStorage = new ClientStorage();
         $scopeStorage = new ScopeStorage();
         $server = new ResourceServer($sessionStorage, $accessTokenStorage, $clientStorage, $scopeStorage);
         return $server;
     });
     $app['application.speakers.api'] = $app->share(function ($app) {
         $userMapper = $app['spot']->mapper('OpenCFP\\Domain\\Entity\\User');
         $talkMapper = $app['spot']->mapper('OpenCFP\\Domain\\Entity\\Talk');
         $speakerRepository = new SpotSpeakerRepository($userMapper);
         return new Speakers(new CallForProposal(new \DateTime($app->config('application.enddate'))), new OAuthIdentityProvider($app['oauth.resource'], $speakerRepository), $speakerRepository, new SpotTalkRepository($talkMapper), new EventDispatcher());
     });
 }
开发者ID:cloudtracer,项目名称:opencfp,代码行数:29,代码来源:ApplicationServiceProvider.php

示例2: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['reset_emailer'] = $app->share(function ($app) {
         /* @var Twig_Environment $twig */
         $twig = $app['twig'];
         return new ResetEmailer($app['mailer'], $twig->loadTemplate('emails/reset_password.twig'), $app->config('application.email'), $app->config('application.title'));
     });
 }
开发者ID:cgrandval,项目名称:opencfp,代码行数:11,代码来源:ResetEmailerServiceProvider.php

示例3: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['spot'] = $app->share(function ($app) {
         $config = new SpotConfig();
         $config->addConnection('mysql', ['dbname' => $app->config('database.database'), 'user' => $app->config('database.user'), 'password' => $app->config('database.password'), 'host' => $app->config('database.host'), 'driver' => 'pdo_mysql']);
         return new SpotLocator($config);
     });
 }
开发者ID:vaceletm,项目名称:opencfp,代码行数:11,代码来源:SpotServiceProvider.php

示例4: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['purifier'] = $app->share(function ($app) {
         $config = HTMLPurifier_Config::createDefault();
         if ($app->config('cache.enabled')) {
             $cacheDirectory = $app->config('paths.cache.purifier');
             if (!is_dir($cacheDirectory)) {
                 mkdir($cacheDirectory, 0755, true);
             }
             $config->set('Cache.SerializerPath', $cacheDirectory);
         }
         return new HTMLPurifier($config);
     });
 }
开发者ID:noahd1,项目名称:opencfp,代码行数:17,代码来源:HtmlPurifierServiceProvider.php

示例5: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app->get('/', 'OpenCFP\\Http\\Controller\\PagesController::showHomepage')->bind('homepage');
     $app->get('/package', 'OpenCFP\\Http\\Controller\\PagesController::showSpeakerPackage')->bind('speaker_package');
     $app->get('/ideas', 'OpenCFP\\Http\\Controller\\PagesController::showTalkIdeas')->bind('talk_ideas');
     $secureRoutes = [];
     // User Dashboard
     $secureRoutes[] = $app->get('/dashboard', 'OpenCFP\\Http\\Controller\\DashboardController::showSpeakerProfile')->bind('dashboard');
     // Talks
     $secureRoutes[] = $app->get('/talk/edit/{id}', 'OpenCFP\\Http\\Controller\\TalkController::editAction')->bind('talk_edit');
     $secureRoutes[] = $app->get('/talk/create', 'OpenCFP\\Http\\Controller\\TalkController::createAction')->bind('talk_new');
     $secureRoutes[] = $app->post('/talk/create', 'OpenCFP\\Http\\Controller\\TalkController::processCreateAction')->bind('talk_create');
     $secureRoutes[] = $app->post('/talk/update', 'OpenCFP\\Http\\Controller\\TalkController::updateAction')->bind('talk_update');
     $secureRoutes[] = $app->post('/talk/delete', 'OpenCFP\\Http\\Controller\\TalkController::deleteAction')->bind('talk_delete');
     $secureRoutes[] = $app->get('/talk/{id}', 'OpenCFP\\Http\\Controller\\TalkController::viewAction')->bind('talk_view');
     // Login/Logout
     $secureRoutes[] = $app->get('/login', 'OpenCFP\\Http\\Controller\\SecurityController::indexAction')->bind('login');
     $secureRoutes[] = $app->post('/login', 'OpenCFP\\Http\\Controller\\SecurityController::processAction')->bind('login_check');
     $secureRoutes[] = $app->get('/logout', 'OpenCFP\\Http\\Controller\\SecurityController::outAction')->bind('logout');
     // Create Account
     $secureRoutes[] = $app->get('/signup', 'OpenCFP\\Http\\Controller\\SignupController::indexAction')->bind('user_new');
     $secureRoutes[] = $app->post('/signup', 'OpenCFP\\Http\\Controller\\SignupController::processAction')->bind('user_create');
     $secureRoutes[] = $app->get('/signup/success', 'OpenCFP\\Http\\Controller\\SignupController::successAction')->bind('user_success');
     // Edit Profile/Account
     $secureRoutes[] = $app->get('/profile/edit/{id}', 'OpenCFP\\Http\\Controller\\ProfileController::editAction')->bind('user_edit');
     $secureRoutes[] = $app->post('/profile/edit', 'OpenCFP\\Http\\Controller\\ProfileController::processAction')->bind('user_update');
     // Change/forgot Password
     $secureRoutes[] = $app->get('/profile/change_password', 'OpenCFP\\Http\\Controller\\ProfileController::passwordAction')->bind('password_edit');
     $secureRoutes[] = $app->post('/profile/change_password', 'OpenCFP\\Http\\Controller\\ProfileController::passwordProcessAction')->bind('password_change');
     $secureRoutes[] = $app->get('/forgot', 'OpenCFP\\Http\\Controller\\ForgotController::indexAction')->bind('forgot_password');
     $secureRoutes[] = $app->post('/forgot', 'OpenCFP\\Http\\Controller\\ForgotController::sendResetAction')->bind('forgot_password_create');
     $secureRoutes[] = $app->get('/forgot_success', 'OpenCFP\\Http\\Controller\\ForgotController::successAction')->bind('forgot_password_success');
     $secureRoutes[] = $app->post('/reset', 'OpenCFP\\Http\\Controller\\ForgotController::resetAction')->bind('reset_password_create');
     $secureRoutes[] = $app->get('/reset/{user_id}/{reset_code}', 'OpenCFP\\Http\\Controller\\ForgotController::processResetAction')->bind('reset_password');
     $secureRoutes[] = $app->post('/updatepassword', 'OpenCFP\\Http\\Controller\\ForgotController::updatePasswordAction')->bind('password_update');
     // Admin Routes
     $secureRoutes[] = $app->get('/admin', 'OpenCFP\\Http\\Controller\\Admin\\DashboardController::indexAction')->bind('admin');
     // Admin::Talks
     $secureRoutes[] = $app->get('/admin/talks', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::indexAction')->bind('admin_talks');
     $secureRoutes[] = $app->get('/admin/talks/{id}', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::viewAction')->bind('admin_talk_view');
     $secureRoutes[] = $app->post('/admin/talks/{id}/favorite', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::favoriteAction')->bind('admin_talk_favorite');
     $secureRoutes[] = $app->post('/admin/talks/{id}/select', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::selectAction')->bind('admin_talk_select');
     // Admin::Speakers
     $secureRoutes[] = $app->get('/admin/speakers', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::indexAction')->bind('admin_speakers');
     $secureRoutes[] = $app->get('/admin/speakers/{id}', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::viewAction')->bind('admin_speaker_view');
     $secureRoutes[] = $app->get('/admin/speakers/delete/{id}', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::deleteAction')->bind('admin_speaker_delete');
     $secureRoutes[] = $app->get('/admin/admins', 'OpenCFP\\Http\\Controller\\Admin\\AdminsController::indexAction')->bind('admin_admins');
     $secureRoutes[] = $app->get('/admin/admins/{id}', 'OpenCFP\\Http\\Controller\\Admin\\AdminsController::removeAction')->bind('admin_admin_delete');
     // Admin::Review
     $secureRoutes[] = $app->get('/admin/review', 'OpenCFP\\Http\\Controller\\Admin\\ReviewController::indexAction')->bind('admin_reviews');
     if ($app->config('application.secure_ssl')) {
         foreach ($secureRoutes as $route) {
             $route->requireHttps();
         }
     }
 }
开发者ID:AaronMuslim,项目名称:opencfp,代码行数:59,代码来源:RouteServiceProvider.php

示例6: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app->register(new SilexTwigServiceProvider(), ['twig.path' => $app->templatesPath(), 'twig.options' => ['debug' => !$app->isProduction(), 'cache' => $app->config('cache.enabled') ? $app->cacheTwigPath() : false]]);
     if (!$app->isProduction()) {
         $app['twig']->addExtension(new Twig_Extension_Debug());
     }
     $app['twig']->addFunction(new Twig_SimpleFunction('uploads', function ($path) {
         return '/uploads/' . $path;
     }));
     $app['twig']->addFunction(new Twig_SimpleFunction('assets', function ($path) {
         return '/assets/' . $path;
     }));
     $app['twig']->addGlobal('site', $app->config('application'));
     // Twig Markdown Extension
     $markdown = new Ciconia();
     $markdown->addExtension(new InlineStyleExtension());
     $markdown->addExtension(new WhiteSpaceExtension());
     $engine = new CiconiaEngine($markdown);
     $app['twig']->addExtension(new MarkdownExtension($engine));
 }
开发者ID:hilltool,项目名称:opencfp,代码行数:23,代码来源:TwigServiceProvider.php

示例7: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app->register(new SilexTwigServiceProvider(), ['twig.path' => $app->templatesPath(), 'twig.options' => ['debug' => !$app->isProduction(), 'cache' => $app->config('cache.enabled') ? $app->cacheTwigPath() : false]]);
     /* @var Twig_Environment $twig */
     $twig = $app['twig'];
     $twig->addGlobal('current_page', function () use($app) {
         return $app['request']->getRequestUri();
     });
     $twig->addGlobal('cfp_open', strtotime('now') < strtotime($app->config('application.enddate') . ' 11:59 PM'));
     if (!$app->isProduction()) {
         $twig->addExtension(new Twig_Extension_Debug());
     }
     $twig->addFunction(new Twig_SimpleFunction('uploads', function ($path) {
         return '/uploads/' . $path;
     }));
     $twig->addFunction(new Twig_SimpleFunction('assets', function ($path) {
         return '/assets/' . $path;
     }));
     $twig->addGlobal('site', $app->config('application'));
     // Twig Markdown Extension
     $markdown = new Ciconia();
     $markdown->addExtension(new InlineStyleExtension());
     $markdown->addExtension(new WhiteSpaceExtension());
     $engine = new CiconiaEngine($markdown);
     $twig->addExtension(new MarkdownExtension($engine));
     $twig->addGlobal('talkHelper', new TalkHelper($app->config('talk.categories'), $app->config('talk.levels'), $app->config('talk.types')));
 }
开发者ID:cgrandval,项目名称:opencfp,代码行数:30,代码来源:TwigServiceProvider.php

示例8: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['application.speakers'] = $app->share(function ($app) {
         $userMapper = $app['spot']->mapper(\OpenCFP\Domain\Entity\User::class);
         $talkMapper = $app['spot']->mapper(\OpenCFP\Domain\Entity\Talk::class);
         $speakerRepository = new SpotSpeakerRepository($userMapper);
         return new Speakers(new CallForProposal(new \DateTime($app->config('application.enddate'))), new SentryIdentityProvider($app['sentry'], $speakerRepository), $speakerRepository, new SpotTalkRepository($talkMapper), new EventDispatcher());
     });
     $app[AirportInformationDatabase::class] = $app->share(function ($app) {
         $capsule = new Capsule();
         $capsule->addConnection(['driver' => 'mysql', 'host' => $app->config('database.host'), 'database' => $app->config('database.database'), 'username' => $app->config('database.user'), 'password' => $app->config('database.password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
         $capsule->setAsGlobal();
         return new IlluminateAirportInformationDatabase($capsule);
     });
     $app['security.random'] = $app->share(function ($app) {
         return new PseudoRandomStringGenerator(new Factory());
     });
     $app['oauth.resource'] = $app->share(function ($app) {
         $sessionStorage = new SessionStorage();
         $accessTokenStorage = new AccessTokenStorage();
         $clientStorage = new ClientStorage();
         $scopeStorage = new ScopeStorage();
         $server = new ResourceServer($sessionStorage, $accessTokenStorage, $clientStorage, $scopeStorage);
         return $server;
     });
     $app['application.speakers.api'] = $app->share(function ($app) {
         $userMapper = $app['spot']->mapper(\OpenCFP\Domain\Entity\User::class);
         $talkMapper = $app['spot']->mapper(\OpenCFP\Domain\Entity\Talk::class);
         $speakerRepository = new SpotSpeakerRepository($userMapper);
         return new Speakers(new CallForProposal(new \DateTime($app->config('application.enddate'))), new OAuthIdentityProvider($app['oauth.resource'], $speakerRepository), $speakerRepository, new SpotTalkRepository($talkMapper), new EventDispatcher());
     });
 }
开发者ID:intfrr,项目名称:opencfp,代码行数:35,代码来源:ApplicationServiceProvider.php

示例9: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     // Create a new Database connection
     $database = new Capsule();
     $database->addConnection(array('driver' => 'mysql', 'host' => $app->config('database.host'), 'database' => $app->config('database.database'), 'username' => $app->config('database.user'), 'password' => $app->config('database.password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci'));
     // Makes the new "capsule" the global static instance.
     $database->setAsGlobal();
     // Boots Eloquent to be used by Sentry.
     $database->bootEloquent();
     $app['sentry'] = $app->share(function ($app) {
         $hasher = new \Cartalyst\Sentry\Hashing\NativeHasher();
         $userProvider = new \Cartalyst\Sentry\Users\Eloquent\Provider($hasher);
         $groupProvider = new \Cartalyst\Sentry\Groups\Eloquent\Provider();
         $throttleProvider = new \Cartalyst\Sentry\Throttling\Eloquent\Provider($userProvider);
         $session = new SymfonySentrySession($app['session']);
         $cookie = new \Cartalyst\Sentry\Cookies\NativeCookie(array());
         $sentry = new \Cartalyst\Sentry\Sentry($userProvider, $groupProvider, $throttleProvider, $session, $cookie);
         Sentry::setupDatabaseResolver($app['db']);
         $throttleProvider->disable();
         return $sentry;
     });
 }
开发者ID:cloudtracer,项目名称:opencfp,代码行数:25,代码来源:SentryServiceProvider.php

示例10: boot

 public function boot(Application $app)
 {
     if (!$app->config('api.enabled')) {
         return;
     }
     /* @var $oauth ControllerCollection */
     $oauth = $app['controllers_factory'];
     $oauth->before(new RequestCleaner($app['purifier']));
     $oauth->before(function (Request $request, Application $app) {
         $request->headers->set('Accept', 'application/json');
         if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) {
             $data = json_decode($request->getContent(), true);
             $request->request->replace(is_array($data) ? $data : array());
         }
     });
     if ($app->config('application.secure_ssl')) {
         $oauth->requireHttps();
     }
     $oauth->get('/authorize', 'controller.oauth.authorization:authorize');
     $oauth->post('/authorize', 'controller.oauth.authorization:issueAuthCode');
     $oauth->post('/access_token', 'controller.oauth.authorization:issueAccessToken');
     $oauth->post('/clients', 'controller.oauth.clients:registerClient');
     $app->mount('/oauth', $oauth);
 }
开发者ID:noahd1,项目名称:opencfp,代码行数:24,代码来源:OAuthGatewayProvider.php

示例11: boot

 /**
  * {@inheritdoc}
  */
 public function boot(Application $app)
 {
     $app->before(function (Request $request, Application $app) {
         $app['twig']->addGlobal('current_page', $request->getRequestUri());
         $app['twig']->addGlobal('cfp_open', strtotime('now') < strtotime($app->config('application.enddate') . ' 11:59 PM'));
     });
     if ($app['sentry']->check()) {
         $app['twig']->addGlobal('user', $app['sentry']->getUser());
         $app['twig']->addGlobal('user_is_admin', $app['sentry']->getUser()->hasAccess('admin'));
     }
     if ($app['session']->has('flash')) {
         $app['twig']->addGlobal('flash', $app['session']->get('flash'));
         $app['session']->set('flash', null);
     }
 }
开发者ID:AaronMuslim,项目名称:opencfp,代码行数:18,代码来源:TwigServiceProvider.php

示例12: boot

 public function boot(Application $app)
 {
     /* @var $api ControllerCollection */
     $api = $app['controllers_factory'];
     $api->before(new RequestCleaner($app['purifier']));
     $api->before(function (Request $request) {
         $request->headers->set('Accept', 'application/json');
         if (0 === strpos($request->headers->get('Content-Type'), 'application/json')) {
             $data = json_decode($request->getContent(), true);
             $request->request->replace(is_array($data) ? $data : array());
         }
     });
     if ($app->config('application.secure_ssl')) {
         $api->requireHttps();
     }
     $api->get('/me', 'controller.api.profile:handleShowSpeakerProfile');
     $api->get('/talks', 'controller.api.talk:handleViewAllTalks');
     $api->post('/talks', 'controller.api.talk:handleSubmitTalk');
     $api->get('/talks/{id}', 'controller.api.talk:handleViewTalk');
     $app->mount('/api', $api);
 }
开发者ID:noahd1,项目名称:opencfp,代码行数:21,代码来源:ApiGatewayProvider.php

示例13: processAction

 public function processAction(Request $req, Application $app)
 {
     $form_data = ['formAction' => $this->url('user_create'), 'first_name' => $req->get('first_name'), 'last_name' => $req->get('last_name'), 'company' => $req->get('company'), 'twitter' => $req->get('twitter'), 'email' => $req->get('email'), 'password' => $req->get('password'), 'password2' => $req->get('password2'), 'airport' => $req->get('airport'), 'agree_coc' => $req->get('agree_coc'), 'buttonInfo' => 'Create my speaker profile', 'coc_link' => $this->app->config('application.coc_link')];
     $form_data['speaker_info'] = $req->get('speaker_info') ?: null;
     $form_data['speaker_bio'] = $req->get('speaker_bio') ?: null;
     $form_data['transportation'] = $req->get('transportation') ?: null;
     $form_data['hotel'] = $req->get('hotel') ?: null;
     $form_data['speaker_photo'] = null;
     if ($req->files->get('speaker_photo') !== null) {
         $form_data['speaker_photo'] = $req->files->get('speaker_photo');
     }
     $form = new SignupForm($form_data, $app['purifier'], ['has_coc' => !empty($app->config('application.coc_link'))]);
     $isValid = $form->validateAll();
     if ($isValid) {
         $sanitized_data = $form->getCleanData();
         if (isset($form_data['speaker_photo'])) {
             /** @var \Symfony\Component\HttpFoundation\File\UploadedFile $file */
             $file = $form_data['speaker_photo'];
             /** @var ProfileImageProcessor $processor */
             $processor = $app['profile_image_processor'];
             /** @var PseudoRandomStringGenerator $generator */
             $generator = $app['security.random'];
             /**
              * The extension technically is not required. We guess the extension using a trusted method.
              */
             $sanitized_data['speaker_photo'] = $generator->generate(40) . '.' . $file->guessExtension();
             $processor->process($file, $sanitized_data['speaker_photo']);
         }
         // Create account using Sentry
         try {
             $user_data = ['first_name' => $sanitized_data['first_name'], 'last_name' => $sanitized_data['last_name'], 'company' => $sanitized_data['company'], 'twitter' => $sanitized_data['twitter'], 'email' => $sanitized_data['email'], 'password' => $sanitized_data['password'], 'airport' => $sanitized_data['airport'], 'activated' => 1];
             /* @var Sentry $sentry */
             $sentry = $app['sentry'];
             $user = $sentry->getUserProvider()->create($user_data);
             // Add them to the proper group
             $user->addGroup($sentry->getGroupProvider()->findByName('Speakers'));
             /* @var Locator $spot */
             $spot = $app['spot'];
             // Add in the extra speaker information
             $mapper = $spot->mapper('\\OpenCFP\\Domain\\Entity\\User');
             $speaker = $mapper->get($user->id);
             $speaker->info = $sanitized_data['speaker_info'];
             $speaker->bio = $sanitized_data['speaker_bio'];
             $speaker->photo_path = $sanitized_data['speaker_photo'];
             $speaker->transportation = (int) $sanitized_data['transportation'];
             $speaker->hotel = (int) $sanitized_data['hotel'];
             $mapper->save($speaker);
             // This is for redirecting to OAuth endpoint if we arrived
             // as part of the Authorization Code Grant flow.
             if ($this->service('session')->has('redirectTo')) {
                 $sentry->login($user);
                 return new RedirectResponse($this->service('session')->get('redirectTo'));
             }
             // Set Success Flash Message
             $app['session']->set('flash', ['type' => 'success', 'short' => 'Success', 'ext' => "You've successfully created your account!"]);
             return $this->redirectTo('login');
         } catch (UserExistsException $e) {
             $app['session']->set('flash', ['type' => 'error', 'short' => 'Error', 'ext' => 'A user already exists with that email address']);
         }
     }
     if (!$isValid) {
         // Set Error Flash Message
         $app['session']->set('flash', ['type' => 'error', 'short' => 'Error', 'ext' => implode("<br>", $form->getErrorMessages())]);
     }
     $form_data['flash'] = $this->getFlash($app);
     return $this->render('user/create.twig', $form_data);
 }
开发者ID:cgrandval,项目名称:opencfp,代码行数:67,代码来源:SignupController.php

示例14: register

 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     $app['reset_emailer'] = $app->share(function ($app) {
         return new ResetEmailer($app['mailer'], $app['twig']->loadTemplate('emails/reset_password.twig'), $app->config('application.email'), $app->config('application.title'));
     });
 }
开发者ID:cloudtracer,项目名称:opencfp,代码行数:9,代码来源:ResetEmailerServiceProvider.php

示例15: boot

 public function boot(Application $app)
 {
     /* @var $web ControllerCollection */
     $web = $app['controllers_factory'];
     $web->before(new RequestCleaner($app['purifier']));
     $web->before(function (Request $request, Application $app) {
         $app['twig']->addGlobal('current_page', $request->getRequestUri());
         $app['twig']->addGlobal('cfp_open', strtotime('now') < strtotime($app->config('application.enddate') . ' 11:59 PM'));
         if ($app['sentry']->check()) {
             $app['twig']->addGlobal('user', $app['sentry']->getUser());
             $app['twig']->addGlobal('user_is_admin', $app['sentry']->getUser()->hasAccess('admin'));
         }
         if ($app['session']->has('flash')) {
             $app['twig']->addGlobal('flash', $app['session']->get('flash'));
             $app['session']->set('flash', null);
         }
     });
     if ($app->config('application.secure_ssl')) {
         $web->requireHttps();
     }
     $web->get('/', 'OpenCFP\\Http\\Controller\\PagesController::showHomepage')->bind('homepage');
     $web->get('/package', 'OpenCFP\\Http\\Controller\\PagesController::showSpeakerPackage')->bind('speaker_package');
     $web->get('/ideas', 'OpenCFP\\Http\\Controller\\PagesController::showTalkIdeas')->bind('talk_ideas');
     // User Dashboard
     $web->get('/dashboard', 'OpenCFP\\Http\\Controller\\DashboardController::showSpeakerProfile')->bind('dashboard');
     // Talks
     $web->get('/talk/edit/{id}', 'OpenCFP\\Http\\Controller\\TalkController::editAction')->bind('talk_edit');
     $web->get('/talk/create', 'OpenCFP\\Http\\Controller\\TalkController::createAction')->bind('talk_new');
     $web->post('/talk/create', 'OpenCFP\\Http\\Controller\\TalkController::processCreateAction')->bind('talk_create');
     $web->post('/talk/update', 'OpenCFP\\Http\\Controller\\TalkController::updateAction')->bind('talk_update');
     $web->post('/talk/delete', 'OpenCFP\\Http\\Controller\\TalkController::deleteAction')->bind('talk_delete');
     $web->get('/talk/{id}', 'OpenCFP\\Http\\Controller\\TalkController::viewAction')->bind('talk_view');
     // Login/Logout
     $web->get('/login', 'OpenCFP\\Http\\Controller\\SecurityController::indexAction')->bind('login');
     $web->post('/login', 'OpenCFP\\Http\\Controller\\SecurityController::processAction')->bind('login_check');
     $web->get('/logout', 'OpenCFP\\Http\\Controller\\SecurityController::outAction')->bind('logout');
     // Create Account
     $web->get('/signup', 'OpenCFP\\Http\\Controller\\SignupController::indexAction')->bind('user_new');
     $web->post('/signup', 'OpenCFP\\Http\\Controller\\SignupController::processAction')->bind('user_create');
     $web->get('/signup/success', 'OpenCFP\\Http\\Controller\\SignupController::successAction')->bind('user_success');
     // Edit Profile/Account
     $web->get('/profile/edit/{id}', 'OpenCFP\\Http\\Controller\\ProfileController::editAction')->bind('user_edit');
     $web->post('/profile/edit', 'OpenCFP\\Http\\Controller\\ProfileController::processAction')->bind('user_update');
     // Change/forgot Password
     $web->get('/profile/change_password', 'OpenCFP\\Http\\Controller\\ProfileController::passwordAction')->bind('password_edit');
     $web->post('/profile/change_password', 'OpenCFP\\Http\\Controller\\ProfileController::passwordProcessAction')->bind('password_change');
     $web->get('/forgot', 'OpenCFP\\Http\\Controller\\ForgotController::indexAction')->bind('forgot_password');
     $web->post('/forgot', 'OpenCFP\\Http\\Controller\\ForgotController::sendResetAction')->bind('forgot_password_create');
     $web->get('/forgot_success', 'OpenCFP\\Http\\Controller\\ForgotController::successAction')->bind('forgot_password_success');
     $web->post('/reset', 'OpenCFP\\Http\\Controller\\ForgotController::resetAction')->bind('reset_password_create');
     $web->get('/reset/{user_id}/{reset_code}', 'OpenCFP\\Http\\Controller\\ForgotController::processResetAction')->bind('reset_password');
     $web->post('/updatepassword', 'OpenCFP\\Http\\Controller\\ForgotController::updatePasswordAction')->bind('password_update');
     // Admin Routes
     $web->get('/admin', 'OpenCFP\\Http\\Controller\\Admin\\DashboardController::indexAction')->bind('admin');
     // Admin::Talks
     $web->get('/admin/talks', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::indexAction')->bind('admin_talks');
     $web->get('/admin/talks/{id}', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::viewAction')->bind('admin_talk_view');
     $web->post('/admin/talks/{id}/favorite', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::favoriteAction')->bind('admin_talk_favorite');
     $web->post('/admin/talks/{id}/select', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::selectAction')->bind('admin_talk_select');
     $web->post('/admin/talks/{id}/comment', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::commentCreateAction')->bind('admin_talk_comment_create');
     $web->post('/admin/talks/{id}/rate', 'OpenCFP\\Http\\Controller\\Admin\\TalksController::rateAction')->bind('admin_talk_rate');
     // Admin::Speakers
     $web->get('/admin/speakers', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::indexAction')->bind('admin_speakers');
     $web->get('/admin/speakers/{id}', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::viewAction')->bind('admin_speaker_view');
     $web->get('/admin/speakers/delete/{id}', 'OpenCFP\\Http\\Controller\\Admin\\SpeakersController::deleteAction')->bind('admin_speaker_delete');
     $web->get('/admin/admins', 'OpenCFP\\Http\\Controller\\Admin\\AdminsController::indexAction')->bind('admin_admins');
     $web->get('/admin/admins/{id}', 'OpenCFP\\Http\\Controller\\Admin\\AdminsController::removeAction')->bind('admin_admin_delete');
     // Admin::Review
     $web->get('/admin/review', 'OpenCFP\\Http\\Controller\\Admin\\ReviewController::indexAction')->bind('admin_reviews');
     // CSV Exports
     $web->get('/admin/export/csv', 'OpenCFP\\Http\\Controller\\Admin\\ExportsController::attributedTalksExportAction')->bind('admin_export_csv');
     $web->get('/admin/export/csv/anon', 'OpenCFP\\Http\\Controller\\Admin\\ExportsController::anonymousTalksExportAction')->bind('admin_export_csv_anon');
     $web->get('/admin/export/csv/selected', 'OpenCFP\\Http\\Controller\\Admin\\ExportsController::selectedTalksExportAction')->bind('admin_export_csv_selected');
     $web->get('/admin/export/csv/emails', 'OpenCFP\\Http\\Controller\\Admin\\ExportsController::emailExportAction')->bind('admin_export_csv_emails');
     $app->mount('/', $web);
 }
开发者ID:jaredfaris,项目名称:opencfp,代码行数:76,代码来源:WebGatewayProvider.php


注:本文中的Silex\Application::config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。