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


PHP Application::mount方法代码示例

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


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

示例1: elseif

                     return $app->redirectPath('setup_upgrade_instructions');
                 }
             }
         } elseif (!$app['phraseanet.configuration-tester']->isBlank()) {
             return $app->redirectPath('homepage');
         }
     } else {
         if (false === strpos($request->getPathInfo(), '/include/minify')) {
             $app['firewall']->requireSetup();
         }
     }
 }, Application::EARLY_EVENT);
 $app->bindRoutes();
 if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
     $app->register($p = new WebProfilerServiceProvider(), ['profiler.cache_dir' => $app['cache.path'] . '/profiler']);
     $app->mount('/_profiler', $p);
     if ($app['phraseanet.configuration-tester']->isInstalled()) {
         $app->register(new DoctrineProfilerServiceProvider());
         $app['db'] = $app->share(function (PhraseaApplication $app) {
             return $app['orm.em']->getConnection();
         });
     }
 }
 $app['dispatcher'] = $app->share($app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, PhraseaApplication $app) {
     $dispatcher->addSubscriber(new BridgeExceptionSubscriber($app));
     $dispatcher->addSubscriber(new FirewallSubscriber());
     $dispatcher->addSubscriber(new JsonRequestSubscriber());
     $dispatcher->addSubscriber(new DebuggerSubscriber($app));
     return $dispatcher;
 }));
 return $app;
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:31,代码来源:Root.php

示例2: call_user_func

use Alchemy\Phrasea\Core\Event\ApiLoadEndEvent;
use Alchemy\Phrasea\Core\Event\ApiLoadStartEvent;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiOauth2ErrorsSubscriber;
use Alchemy\Phrasea\Core\Event\Subscriber\ApiExceptionHandlerSubscriber;
use Monolog\Logger;
use Monolog\Processor\WebProcessor;
use Silex\Application as SilexApplication;
use Symfony\Component\HttpFoundation\Request;
return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
    $app = new PhraseaApplication($environment);
    $app->loadPlugins();
    $app['exception_handler'] = $app->share(function ($app) {
        return new ApiExceptionHandlerSubscriber($app);
    });
    $app['monolog'] = $app->share($app->extend('monolog', function (Logger $monolog) {
        $monolog->pushProcessor(new WebProcessor());
        return $monolog;
    }));
    $app->register(new \API_V1_Timer());
    $app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_START, new ApiLoadStartEvent());
    $app->get('/api/', function (Request $request, SilexApplication $app) {
        $apiAdapter = new \API_V1_adapter($app);
        $result = new \API_V1_result($app, $request, $apiAdapter);
        return $result->set_datas(['name' => $app['conf']->get(['registry', 'general', 'title']), 'type' => 'phraseanet', 'description' => $app['conf']->get(['registry', 'general', 'description']), 'documentation' => 'https://docs.phraseanet.com/Devel', 'versions' => ['1' => ['number' => $apiAdapter->get_version(), 'uri' => '/api/v1/', 'authenticationProtocol' => 'OAuth2', 'authenticationVersion' => 'draft#v9', 'authenticationEndPoints' => ['authorization_token' => '/api/oauthv2/authorize', 'access_token' => '/api/oauthv2/token']]]])->get_response();
    });
    $app->mount('/api/oauthv2', new Oauth2());
    $app->mount('/api/v1', new V1());
    $app['dispatcher']->addSubscriber(new ApiOauth2ErrorsSubscriber($app['phraseanet.exception_handler'], $app['translator']));
    $app['dispatcher']->dispatch(PhraseaEvents::API_LOAD_END, new ApiLoadEndEvent());
    return $app;
}, isset($environment) ? $environment : PhraseaApplication::ENV_PROD);
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:31,代码来源:Api.php

示例3: JsonSchemaServiceProvider

     if (!$response->headers->get('Content-Type')) {
         $response->headers->set('Content-Type', $request->getMimeType($request->getRequestFormat(Result::FORMAT_JSON)));
     }
 });
 $app->register(new JsonSchemaServiceProvider());
 $app->get('/api/', function (Request $request, SilexApplication $app) {
     return Result::create($request, ['name' => $app['conf']->get(['registry', 'general', 'title']), 'type' => 'phraseanet', 'description' => $app['conf']->get(['registry', 'general', 'description']), 'documentation' => 'https://docs.phraseanet.com/Devel', 'versions' => ['1' => ['number' => V1::VERSION, 'uri' => '/api/v1/', 'authenticationProtocol' => 'OAuth2', 'authenticationVersion' => 'draft#v9', 'authenticationEndPoints' => ['authorization_token' => '/api/oauthv2/authorize', 'access_token' => '/api/oauthv2/token']]]])->createResponse();
 });
 // Fake routes required to send emails. Sorry.
 $routes = array('root' => '/', 'admin' => '/admin/');
 foreach ($routes as $name => $route) {
     $app->get($route, function () {
         return '';
     })->bind($name);
 }
 $app->mount('/api/oauthv2', new OAuth2());
 $app->mount('/datafiles/', new Datafiles());
 $app->mount('/api/v1', new V1());
 $app->mount('/permalink/', new Permalink());
 $app->mount($app['controller.media_accessor.route_prefix'], new MediaAccessor());
 $app->mount('/include/minify/', new Minifier());
 $app->bindPluginRoutes('plugin.controller_providers.api');
 if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
     $app->register($p = new WebProfilerServiceProvider(), ['profiler.cache_dir' => $app['cache.path'] . '/profiler']);
     $app->mount('/_profiler', $p);
     if ($app['phraseanet.configuration-tester']->isInstalled()) {
         $app->register(new DoctrineProfilerServiceProvider());
         $app['db'] = $app->share(function (PhraseaApplication $app) {
             return $app['orm.em']->getConnection();
         });
     }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:31,代码来源:Api.php


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