コード例 #1
1
 /**
  * Constructor
  *
  * @param \Cake\Network\Request $request Request instance.
  * @param \Cake\Network\Response $response Reponse instance.
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if (count(Router::extensions()) && !isset($this->RequestHandler)) {
         $this->loadComponent('RequestHandler');
     }
     $eventManager = $this->eventManager();
     if (isset($this->Auth)) {
         $eventManager->detach($this->Auth);
     }
     if (isset($this->Security)) {
         $eventManager->detach($this->Security);
     }
     $this->cacheAction = false;
     $this->viewPath = 'Error';
 }
コード例 #2
0
 /**
  * [setUp description]
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->resetReflectionCache();
     $this->_eventManager = EventManager::instance();
     $existing = Configure::read('App.paths.templates');
     $existing[] = Plugin::path('Crud') . 'tests/App/Template/';
     Configure::write('App.paths.templates', $existing);
     Configure::write('App.namespace', 'Crud\\Test\\App');
     Router::extensions('json');
     Router::connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);
     Router::connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);
     $this->useHttpServer(false);
 }
コード例 #3
0
ファイル: ErrorController.php プロジェクト: CakeDC/cakephp
 /**
  * Constructor
  *
  * @param \Cake\Network\Request|null $request Request instance.
  * @param \Cake\Network\Response|null $response Response instance.
  */
 public function __construct($request = null, $response = null)
 {
     parent::__construct($request, $response);
     if (count(Router::extensions()) && !isset($this->RequestHandler)) {
         $this->loadComponent('RequestHandler');
     }
     $eventManager = $this->eventManager();
     if (isset($this->Auth)) {
         $eventManager->off($this->Auth);
     }
     if (isset($this->Security)) {
         $eventManager->off($this->Security);
     }
 }
コード例 #4
0
ファイル: RouterTest.php プロジェクト: maitrepylos/nazeweb
 /**
  * Test that extensions work with Router::reverse()
  *
  * @return void
  */
 public function testReverseWithExtension()
 {
     Router::connect('/:controller/:action/*');
     Router::extensions('json', false);
     $request = new Request('/posts/view/1.json');
     $request->addParams(array('controller' => 'posts', 'action' => 'view', 'pass' => array(1), '_ext' => 'json'));
     $request->query = [];
     $result = Router::reverse($request);
     $expected = '/posts/view/1.json';
     $this->assertEquals($expected, $result);
 }
コード例 #5
0
 /**
  * testSetExtensions method
  *
  * @return void
  */
 public function testSetExtensions()
 {
     Router::extensions();
     Router::parseExtensions('rss', false);
     $this->assertContains('rss', Router::extensions());
     require CAKE . 'Config/routes.php';
     $result = Router::parse('/posts.rss');
     $this->assertEquals('rss', $result['_ext']);
     $result = Router::parse('/posts.xml');
     $this->assertFalse(isset($result['_ext']));
     Router::parseExtensions(array('xml'));
     $result = Router::extensions();
     $this->assertContains('rss', $result);
     $this->assertContains('xml', $result);
     $result = Router::parse('/posts.xml');
     $this->assertEquals('xml', $result['_ext']);
     $result = Router::parseExtensions(array('pdf'), false);
     $this->assertEquals(array('pdf'), $result);
 }
コード例 #6
0
ファイル: routes.php プロジェクト: BharadhwajGummadi/library
     * Connect catchall routes for all controllers.
     *
     * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
     *    `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
     *    `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
     *
     * Any route class can be used with this method, such as:
     * - DashedRoute
     * - InflectedRoute
     * - Route
     * - Or your own route class
     *
     * You can remove these routes once you've connected the
     * routes you want in your application.
     */
    //$routes->fallbacks('DashedRoute');
    /**    
     * map controller resources
     */
    Router::mapResources('users');
    Router::mapResources('books');
    Router::mapResources('authors');
    Router::mapResources('BookIssues');
    Router::mapResources('geners');
    Router::extensions(['json', 'xml']);
});
/**
 * Load all plugin routes.  See the Plugin documentation on
 * how to customize the loading of plugin routes.
 */
Plugin::routes();
コード例 #7
0
ファイル: routes.php プロジェクト: laurentdamien/sportlay
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions('json');
Router::scope('/', function ($routes) {
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
     * to use (in this case, src/Template/Pages/home.ctp)...
     */
    $routes->connect('/', ['controller' => 'Prognostics', 'action' => 'home']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/*', ['controller' => 'Pages', 'action' => 'page404']);
    $routes->connect('/prognostic/:id', ['controller' => 'Prognostics', 'action' => 'pronostic'], ['id' => '\\d+', 'pass' => ['id']]);
    $routes->connect('/ticket/:id/:match', ['controller' => 'Prognostics', 'action' => 'ticket'], ['id' => '\\d+', 'match' => '\\w+', 'pass' => ['id', 'match']]);
    $routes->connect('/cgu', ['controller' => 'Pages', 'action' => 'cgu']);
    $routes->connect('/login', ['controller' => 'Users', 'action' => 'login']);
コード例 #8
0
 /**
  * test configured extension but no view class set.
  *
  * @return void
  * @triggers Controller.beforeRender $this->Controller
  */
 public function testNoViewClassExtension()
 {
     Router::extensions(['json', 'xml', 'ajax', 'csv'], false);
     $this->Controller->request->params['_ext'] = 'csv';
     $event = new Event('Controller.startup', $this->Controller);
     $this->RequestHandler->initialize([]);
     $this->RequestHandler->startup($event);
     $this->Controller->eventManager()->on('Controller.beforeRender', function () {
         return $this->Controller->response;
     });
     $this->Controller->render();
     $this->assertEquals('RequestHandlerTest' . DS . 'csv', $this->Controller->viewBuilder()->templatePath());
     $this->assertEquals('csv', $this->Controller->viewBuilder()->layoutPath());
 }
コード例 #9
0
ファイル: RouterTest.php プロジェクト: rashmi/newrepo
 /**
  * Test to ensure that extensions defined in scopes don't leak.
  * And that global extensions are propagated.
  *
  * @return void
  */
 public function testScopeExtensionsContained()
 {
     Router::extensions(['json']);
     Router::scope('/', function ($routes) {
         $this->assertEquals(['json'], $routes->extensions(), 'Should default to global extensions.');
         $routes->extensions(['rss']);
         $this->assertEquals(['rss'], $routes->extensions(), 'Should include new extensions.');
         $routes->connect('/home', []);
     });
     $this->assertEquals(['json', 'rss'], array_values(Router::extensions()));
     Router::scope('/api', function ($routes) {
         $this->assertEquals(['json'], $routes->extensions(), 'Should default to global extensions.');
         $routes->extensions(['json', 'csv']);
         $routes->connect('/export', []);
         $routes->scope('/v1', function ($routes) {
             $this->assertEquals(['json', 'csv'], $routes->extensions());
         });
     });
     $this->assertEquals(['json', 'rss', 'csv'], array_values(Router::extensions()));
 }
コード例 #10
0
ファイル: routes.php プロジェクト: byu-oit-appdev/byusa-clubs
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions(['csv', 'json', 'html']);
Router::scope('/', function ($routes) {
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
     * to use (in this case, src/Template/Pages/home.ctp)...
     */
    $routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
    //Just as an example. Might not bother keeping custom routes like this:
    $routes->connect('/create', ['controller' => 'Clubs', 'action' => 'create']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Catching urls based on old system. Can delete later
コード例 #11
0
ファイル: routes.php プロジェクト: Aerue/avalia
<?php

use Cake\Routing\Router;
Router::extensions(['html', 'json']);
Router::plugin('BoxManager', ['path' => '/box-manager'], function ($routes) {
    $routes->connect('/login', ['controller' => 'Users', 'action' => 'login']);
    $routes->fallbacks('DashedRoute');
});
Router::prefix('admin', function ($routes) {
    $routes->plugin('BoxManager', ['path' => '/box-manager'], function ($routes) {
        $routes->fallbacks('DashedRoute');
    });
    $routes->fallbacks('DashedRoute');
});
コード例 #12
0
 /**
  * Test that a type mismatch doesn't incorrectly set the ext
  *
  * @return void
  */
 public function testInitializeContentTypeAndExtensionMismatch()
 {
     $event = new Event('Controller.initialize', $this->Controller);
     $this->assertNull($this->RequestHandler->ext);
     $extensions = Router::extensions();
     Router::parseExtensions('xml', false);
     $this->Controller->request = $this->getMock('Cake\\Network\\Request', ['accepts']);
     $this->Controller->request->expects($this->any())->method('accepts')->will($this->returnValue(array('application/json')));
     $this->RequestHandler->initialize($event);
     $this->assertNull($this->RequestHandler->ext);
     call_user_func_array(array('Cake\\Routing\\Router', 'parseExtensions'), [$extensions, false]);
 }
コード例 #13
0
ファイル: routes.php プロジェクト: Kaju-Bubanja/GSOA
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions(['json', 'xml', 'text', 'html']);
Router::scope('/', function ($routes) {
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
     * to use (in this case, src/Template/Pages/home.ctp)...
     */
    $routes->connect('/', ['controller' => 'Export', 'action' => 'test']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Connect catchall routes for all controllers.
     *
     * Using the argument `InflectedRoute`, the `fallbacks` method is a shortcut for
コード例 #14
0
<?php

use Cake\Routing\Router;
Router::extensions('csv');
コード例 #15
0
ファイル: bootstrap.php プロジェクト: jxav/cakephp-feed
<?php

use Cake\Routing\Router;
Router::extensions(['rss']);
コード例 #16
0
ファイル: routes.php プロジェクト: mirko-pagliai/me-instagram
 * MeInstagram is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with MeInstagram.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author      Mirko Pagliai <*****@*****.**>
 * @copyright   Copyright (c) 2016, Mirko Pagliai for Nova Atlantis Ltd
 * @license     http://www.gnu.org/licenses/agpl.txt AGPL License
 * @link        http://git.novatlantis.it Nova Atlantis Ltd
 */
use Cake\Routing\Router;
Router::defaultRouteClass('DashedRoute');
Router::extensions('rss');
/**
 * MeInstagram routes
 */
Router::scope('/', ['plugin' => MEINSTAGRAM], function ($routes) {
    //Instagram
    if (!$routes->nameExists('instagramPhotos')) {
        $routes->connect('/instagram', ['controller' => 'Instagram', 'action' => 'index'], ['_name' => 'instagramPhotos']);
    }
    //Instagram (with ID)
    $routes->connect('/instagram/:id', ['controller' => 'Instagram', 'action' => 'index'], ['id' => '\\d+_\\d+', 'pass' => ['id']]);
    //Instragram photo
    if (!$routes->nameExists('instagramPhoto')) {
        $routes->connect('/instagram/view/:id', ['controller' => 'Instagram', 'action' => 'view'], ['_name' => 'instagramPhoto', 'id' => '\\d+_\\d+', 'pass' => ['id']]);
    }
});
コード例 #17
0
ファイル: routes.php プロジェクト: rashmi/newrepo
<?php

use Cake\Routing\Router;
Router::extensions('xlsx');
コード例 #18
0
ファイル: routes.php プロジェクト: Raphai/shaka
<?php

use Cake\Core\Plugin;
use Cake\Routing\Router;
Router::defaultRouteClass('Route');
Router::scope('/', function ($routes) {
    $routes->connect('/', ['controller' => 'Pages', 'action' => 'accueil']);
    $routes->fallbacks('InflectedRoute');
});
Router::connect('/accueil', array('controller' => 'Pages', 'action' => 'accueil'));
Router::connect('/manager', array('controller' => 'Pages', 'action' => 'manager'));
Router::connect('/plan-de-site', array('controller' => 'Pages', 'action' => 'planDeSite'));
Router::connect('/travaux-portfolio', array('controller' => 'Pages', 'action' => 'travaux'));
Router::connect('/demande-de-devis', array('controller' => 'Pages', 'action' => 'devis'));
Router::connect('/creation-de-sites-internet-a-poitiers', array('controller' => 'Pages', 'action' => 'view', 3));
Router::connect('/design-creations-graphiques', array('controller' => 'Pages', 'action' => 'view', 14));
Router::connect('/supports-de-communication-papier', array('controller' => 'Pages', 'action' => 'view', 17));
Router::connect('/a-propos-de-votre-prestataire', array('controller' => 'Pages', 'action' => 'view', 20));
Router::connect('/liens-utiles', array('controller' => 'Pages', 'action' => 'view', 23));
Router::connect('/assistance', array('controller' => 'Pages', 'action' => 'view', 26));
Router::connect('/informations-legales', array('controller' => 'Pages', 'action' => 'view', 22));
//Router::connect('/page/:slug-:id',
//    ['controller' => 'Pages', 'action' => 'view'],
//    [
//        'pass' => ['id', 'slug'],
//        'id' => '[0-9]+']
//);
Router::connect('/projets/:slug-:id', ['controller' => 'Pages', 'action' => 'projet'], ['pass' => ['id', 'slug'], 'id' => '[0-9]+']);
Router::extensions(['rss', 'xml']);
Router::connect('/sitemaps', array('controller' => 'Sitemaps', 'action' => 'index'));
Plugin::routes();
コード例 #19
0
 /**
  * Test POST & PUT verbs using API Listener
  * with data validation errors
  *
  * @dataProvider apiUpdateHttpMethodProvider
  * @param  string $method
  * @return void
  */
 public function testApiCreateErrors($method)
 {
     Router::extensions('json');
     $this->_eventManager->on('Dispatcher.beforeDispatch', ['priority' => 1000], function ($event) {
         $this->_controller->Flash = $this->getMock('Cake\\Controller\\Component\\Flash', ['set']);
         $this->_controller->Flash->expects($this->never())->method('set');
         $this->_subscribeToEvents($this->_controller);
         $this->_controller->Crud->addListener('api', 'Crud.Api');
         $this->_controller->Blogs->validator()->requirePresence('name')->requirePresence('body')->add('name', ['length' => ['rule' => ['minLength', 10], 'message' => 'Name need to be at least 10 characters long']]);
     });
     $this->{$method}('/blogs/add.json', ['name' => 'too short']);
     $this->assertResponseError();
     $this->assertResponseContains('2 validation errors occurred');
 }
コード例 #20
0
 /**
  * Set the extension based on the accept headers.
  * Compares the accepted types and configured extensions.
  * If there is one common type, that is assigned as the ext/content type for the response.
  * The type with the highest weight will be set. If the highest weight has more
  * than one type matching the extensions, the order in which extensions are specified
  * determines which type will be set.
  *
  * If html is one of the preferred types, no content type will be set, this
  * is to avoid issues with browsers that prefer HTML and several other content types.
  *
  * @param \Cake\Network\Request $request The request instance.
  * @param \Cake\Network\Response $response The response instance.
  * @return void
  */
 protected function _setExtension($request, $response)
 {
     $accept = $request->parseAccept();
     if (empty($accept)) {
         return;
     }
     $accepts = $response->mapType($accept);
     $preferredTypes = current($accepts);
     if (array_intersect($preferredTypes, ['html', 'xhtml'])) {
         return;
     }
     $extensions = array_unique(array_merge(Router::extensions(), array_keys($this->config('viewClassMap'))));
     foreach ($accepts as $types) {
         $ext = array_intersect($extensions, $types);
         if (!empty($ext)) {
             $this->ext = current($ext);
             break;
         }
     }
 }
コード例 #21
0
ファイル: routes.php プロジェクト: foxxor/click-delivery-test
    $routes->connect('/login', ['controller' => 'Users', 'action' => 'login']);
    $routes->connect('/signup', ['controller' => 'Users', 'action' => 'signup']);
    $routes->connect('/dashboard', ['controller' => 'Users', 'action' => 'dashboard']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Connect catchall routes for all controllers.
     *
     * Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
     *    `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
     *    `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
     *
     * Any route class can be used with this method, such as:
     * - DashedRoute
     * - InflectedRoute
     * - Route
     * - Or your own route class
     *
     * You can remove these routes once you've connected the
     * routes you want in your application.
     */
    $routes->fallbacks('DashedRoute');
});
Router::extensions(['csv']);
/**
 * Load all plugin routes.  See the Plugin documentation on
 * how to customize the loading of plugin routes.
 */
Plugin::routes();
コード例 #22
0
 /**
  * Set the extension based on the accept headers.
  * Compares the accepted types and configured extensions.
  * If there is one common type, that is assigned as the ext/content type for the response.
  * The type with the highest weight will be set. If the highest weight has more
  * than one type matching the extensions, the order in which extensions are specified
  * determines which type will be set.
  *
  * If html is one of the preferred types, no content type will be set, this
  * is to avoid issues with browsers that prefer HTML and several other content types.
  *
  * @param \Cake\Network\Request $request The request instance.
  * @param \Cake\Network\Response $response The response instance.
  * @return void
  */
 protected function _setExtension($request, $response)
 {
     $accept = $request->parseAccept();
     if (empty($accept)) {
         return;
     }
     $accepts = $response->mapType($accept);
     $preferedTypes = current($accepts);
     if (array_intersect($preferedTypes, ['html', 'xhtml'])) {
         return;
     }
     $extensions = Router::extensions();
     foreach ($accepts as $types) {
         $ext = array_intersect($extensions, $types);
         if ($ext) {
             $this->ext = current($ext);
             break;
         }
     }
 }
コード例 #23
0
 /**
  * test configured extension but no view class set.
  *
  * @return void
  * @triggers Controller.startup $this->Controller
  */
 public function testNoViewClassExtension()
 {
     Router::extensions(['json', 'xml', 'ajax', 'csv'], false);
     $this->Controller->request->params['_ext'] = 'csv';
     $event = new Event('Controller.startup', $this->Controller);
     $this->RequestHandler->initialize([]);
     $this->RequestHandler->startup($event);
     $this->assertEquals('RequestHandlerTest' . DS . 'csv', $this->Controller->viewPath);
     $this->assertEquals('csv', $this->Controller->layoutPath);
 }
コード例 #24
0
ファイル: routes.php プロジェクト: AlexandreSGV/siteentec
<?php

use Cake\Routing\Router;
Router::extensions(['pdf']);
コード例 #25
0
ファイル: routes.php プロジェクト: awebdesigner/tukole
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions('json', 'xml');
Router::scope('/', function ($routes) {
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
     * to use (in this case, src/Template/Pages/home.ctp)...
     */
    //$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
    $routes->connect('/', ['controller' => 'Jobs', 'action' => 'index', 'home']);
    /**
     * ...and connect the rest of 'Pages' controller's URLs.
     */
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Connect catchall routes for all controllers.
     *
コード例 #26
0
ファイル: routes.php プロジェクト: rashmi/newrepo
<?php

use Cake\Routing\Router;
Router::extensions(['xlsx']);
Router::plugin('Cewi/Excel', null, function ($routes) {
    $routes->connect('/:controller/:action');
});
コード例 #27
0
ファイル: routes.php プロジェクト: Aerue/avalia
 *
 * The following route classes are supplied with CakePHP and are appropriate
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass()`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::extensions(['html']);
Router::defaultRouteClass('DashedRoute');
Router::scope('/', function ($routes) {
    $routes->connect('/*', ['controller' => 'Contentbuilders', 'action' => 'display']);
    $routes->connect('/projet/**', ['controller' => 'Contentbuilders', 'action' => 'projet']);
    $routes->fallbacks('DashedRoute');
});
Router::prefix('admin', function ($routes) {
    $routes->fallbacks('DashedRoute');
});
/**
 * Load all plugin routes.  See the Plugin documentation on
 * how to customize the loading of plugin routes.
 */
Plugin::routes();
コード例 #28
0
 * to set as the default:
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions(['json']);
Router::scope('/', function ($routes) {
    $routes->extensions(['json']);
    $routes->resources('Accesses');
    $routes->resources('Categories');
    $routes->resources('Groups');
    $routes->resources('Markers');
    $routes->resources('Markerviews');
    $routes->resources('Places');
    $routes->resources('Respondents');
    $routes->resources('Users');
    $routes->resources('Weather');
    $routes->fallbacks('InflectedRoute');
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
コード例 #29
0
ファイル: routes.php プロジェクト: nadymain/quebolu
 *
 * - Route
 * - InflectedRoute
 * - DashedRoute
 *
 * If no call is made to `Router::defaultRouteClass`, the class used is
 * `Route` (`Cake\Routing\Route\Route`)
 *
 * Note that `Route` does not do any inflections on URLs which will result in
 * inconsistently cased URLs when used with `:plugin`, `:controller` and
 * `:action` markers.
 *
 */
Router::defaultRouteClass('Route');
Router::extensions('rss');
Router::extensions('xml');
Router::scope('/', function ($routes) {
    /**
     * Here, we are connecting '/' (base path) to a controller called 'Pages',
     * its action called 'display', and we pass a param to select the view file
     * to use (in this case, src/Template/Pages/home.ctp)...
     */
    // $routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
    $routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
    /**
     * Posts
     */
    $routes->connect('/', ['controller' => 'Blog', 'action' => 'index']);
    $routes->connect('/:id-:slug', ['controller' => 'Blog', 'action' => 'view'], ['pass' => ['id', 'slug'], 'id' => '[0-9]+']);
    /**
     * Categories