mapResources() public static method

### Options: - 'id' - The regular expression fragment to use when matching IDs. By default, matches integer values and UUIDs. - 'prefix' - URL prefix to use for the generated routes. Defaults to '/'.
public static mapResources ( string | array $controller, array $options = [] ) : array
$controller string | array A controller name or array of controller names (i.e. "Posts" or "ListItems")
$options array Options to use when generating REST routes
return array Array of mapped resources
Example #1
0
 * different urls to chosen controllers and their actions (functions).
 *
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
App::uses('CroogoRouter', 'Croogo.Lib');
Router::connect('/signup', array('controller' => 'user', 'action' => 'register'));
Router::connect('/loggout', array('controller' => 'user', 'action' => 'loggout'));
Router::connect('/admin', array('controller' => 'admin', 'action' => 'index'));
Router::connect('/wxapi/*', array('controller' => 'wxapi', 'action' => 'index'));
Router::connect('/admin/wc/*', array('controller' => 'admin', 'action' => 'wc'));
Router::connect('/version', array('controller' => 'user', 'action' => 'version'));
Router::mapResources('users');
Router::mapResources('education');
Router::mapResources('wx');
CakePlugin::routes();
Router::connect('/', array('controller' => 'user', 'action' => 'login'));
Router::parseExtensions('json', 'rss');
CroogoRouter::localize();
require CAKE . 'Config' . DS . 'routes.php';
<?php

Router::mapResources(array('gifts', 'users'));
Router::resourceMap(array(array('action' => 'index', 'method' => 'GET', 'id' => false), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => false), array('action' => 'update', 'method' => 'PUT', 'id' => true), array('action' => 'signup', 'method' => 'POST', 'id' => false), array('action' => 'delete', 'method' => 'DELETE', 'id' => true)));
Router::parseExtensions();
require CAKE . 'Config' . DS . 'routes.php';
Example #3
0
 /**
  * testHttpMethodOverrides method
  *
  * @return void
  * @triggers DispatcherTest $dispatcher, array('request' => $request)
  * @triggers DispatcherTest $dispatcher, array('request' => $request)
  * @triggers DispatcherTest $dispatcher, array('request' => $request)
  * @triggers DispatcherTest $dispatcher, array('request' => $request)
  * @triggers DispatcherTest $dispatcher, array('request' => $request)
  */
 public function testHttpMethodOverrides()
 {
     Router::reload();
     Router::mapResources('Posts');
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $dispatcher = new Dispatcher();
     $request = new CakeRequest('/posts');
     $event = new CakeEvent('DispatcherTest', $dispatcher, array('request' => $request));
     $dispatcher->parseParams($event);
     $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST');
     foreach ($expected as $key => $value) {
         $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
     }
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';
     $request = new CakeRequest('/posts/5');
     $event = new CakeEvent('DispatcherTest', $dispatcher, array('request' => $request));
     $dispatcher->parseParams($event);
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT');
     foreach ($expected as $key => $value) {
         $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
     }
     unset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $request = new CakeRequest('/posts/5');
     $event = new CakeEvent('DispatcherTest', $dispatcher, array('request' => $request));
     $dispatcher->parseParams($event);
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'view', '[method]' => 'GET');
     foreach ($expected as $key => $value) {
         $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
     }
     $_POST['_method'] = 'PUT';
     $request = new CakeRequest('/posts/5');
     $event = new CakeEvent('DispatcherTest', $dispatcher, array('request' => $request));
     $dispatcher->parseParams($event);
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT');
     foreach ($expected as $key => $value) {
         $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
     }
     $_POST['_method'] = 'POST';
     $_POST['data'] = array('Post' => array('title' => 'New Post'));
     $_POST['extra'] = 'data';
     $_SERVER = array();
     $request = new CakeRequest('/posts');
     $event = new CakeEvent('DispatcherTest', $dispatcher, array('request' => $request));
     $dispatcher->parseParams($event);
     $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST', 'data' => array('extra' => 'data', 'Post' => array('title' => 'New Post')));
     foreach ($expected as $key => $value) {
         $this->assertEquals($value, $request[$key], 'Value mismatch for ' . $key . ' %s');
     }
     unset($_POST['_method']);
 }
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'index'));
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Create RESTful routes for some controllers...
 */
Router::mapResources('notes');
Router::parseExtensions('json');
/*
    Router::connect('/videos/:id/notes', 
        array('controller' => 'videos', 'action' => 'notes', "[method]" => "GET"), 
        array('pass' => array('id'))
    );
	
    Router::connect('/videos/:id/notes',
        array('controller' => 'videos', 'action' => 'notes', "[method]" => "POST"), 
        array('pass' => array('id'))
    );
*/
/**
 * Create shortcuts to the installation controller
 */
Example #5
0
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
Router::mapResources(array('posts', 'client'));
Router::parseExtensions('json', 'xml');
require CAKE . 'Config' . DS . 'routes.php';
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
Router::mapResources('tarefas');
Router::parseExtensions();
require CAKE . 'Config' . DS . 'routes.php';
 /**
  * testHttpMethodOverrides method
  *
  * @access public
  * @return void
  */
 function testHttpMethodOverrides()
 {
     Router::reload();
     Router::mapResources('Posts');
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $dispatcher =& new Dispatcher();
     $dispatcher->base = false;
     $result = $dispatcher->parseParams('/posts');
     $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST', 'form' => array(), 'url' => array());
     $this->assertEqual($result, $expected);
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';
     $result = $dispatcher->parseParams('/posts/5');
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array());
     $this->assertEqual($result, $expected);
     unset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $result = $dispatcher->parseParams('/posts/5');
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'view', '[method]' => 'GET', 'form' => array(), 'url' => array());
     $this->assertEqual($result, $expected);
     $_POST['_method'] = 'PUT';
     $result = $dispatcher->parseParams('/posts/5');
     $expected = array('pass' => array('5'), 'named' => array(), 'id' => '5', 'plugin' => null, 'controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'form' => array(), 'url' => array());
     $this->assertEqual($result, $expected);
     $_POST['_method'] = 'POST';
     $_POST['data'] = array('Post' => array('title' => 'New Post'));
     $_POST['extra'] = 'data';
     $_SERVER = array();
     $result = $dispatcher->parseParams('/posts');
     $expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST', 'form' => array('extra' => 'data'), 'data' => array('Post' => array('title' => 'New Post')), 'url' => array());
     $this->assertEqual($result, $expected);
     unset($_POST['_method']);
 }
Example #8
0
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'Books', 'action' => 'index', 'home'));
// Router::connect('/index', array('controller' => 'Books', 'action' => 'index', 'home'));
// Router::connect('/books/add', array('controller' => 'Books', 'action' => 'add'));
Router::mapResources('books');
Router::mapResources('bets');
Router::mapResources('users');
// Router::connect('/test', array('controller' => 'Books', 'action' => 'test', 'home'));
// Router::connect('/user-rankings', array('controller' => 'Users', 'action' => 'userRankings', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/update/*', array('controller' => 'updates'));
Router::connect('/users/logout', array('controller' => 'users', 'action' => 'logout'));
Router::connect('/users/facebook_login', array('controller' => 'users', 'action' => 'facebook_login'));
Router::connect('/profile/edit', array('controller' => 'users', 'action' => 'edit'));
Router::connect('/profile/home', array('controller' => 'users', 'action' => 'home'));
Router::connect('/passbooks/*', array('controller' => 'users', 'action' => 'profile', 'passbooks'));
// Router::connect('/profile/*', array('controller' => 'users', 'action' => 'profile','profile'));
Router::connect('/betlists/*', array('controller' => 'users', 'action' => 'profile', 'betlists'));
Router::connect('/makedbooks/*', array('controller' => 'users', 'action' => 'profile', 'makedbooks'));
Example #9
0
 * Link demo calculo frete da estrutura 
 * WordPress
 */
CroogoRouter::connect('/calculo/frete.html', array('controller' => 'produtos', 'action' => 'frete'));
/**
 * Corrige links de versões antigas como a estrutura
 * WordPress
 */
CroogoRouter::connect('/calcular-frete/*', array('controller' => 'urls', 'action' => 'url'));
// Botao calculo frete antigo
CroogoRouter::connect('/frete/*', array('controller' => 'produtos', 'action' => 'frete'));
/**
 * BOTOES
 * no WordPress existia uma estrutura na raiz
 * onde havia o diretório botoes na raiz
 */
CroogoRouter::connect('/botoes/*', array('controller' => 'urls', 'action' => 'botoes'));
/**
 * Rastreamento
 * Corrige links de versões antigas como a estrutura 
 * WordPress
 */
//CroogoRouter::connect( '/rastreamento/rastrear-pedido.html', array( 'controller' => 'codigos', 'action' => 'add' ) );
/**
 * API Rest
 */
//Router::mapResources( 'Produtos', array('prefix' => '/api/') );
Router::mapResources('Produtos');
Router::mapResources('Codigos');
Router::mapResources('Avisos');
Router::parseExtensions('xml', 'html', 'pdf');
Example #10
0
 /**
  * testResourceRoutes method
  *
  * @access public
  * @return void
  */
 function testResourceRoutes()
 {
     Router::mapResources('Posts');
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $result = Router::parse('/posts');
     $this->assertEqual($result, array('pass' => array(), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'index', '[method]' => 'GET'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $result = Router::parse('/posts/13');
     $this->assertEqual($result, array('pass' => array('13'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'view', 'id' => '13', '[method]' => 'GET'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $result = Router::parse('/posts');
     $this->assertEqual($result, array('pass' => array(), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'add', '[method]' => 'POST'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $result = Router::parse('/posts/13');
     $this->assertEqual($result, array('pass' => array('13'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'edit', 'id' => '13', '[method]' => 'PUT'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $result = Router::parse('/posts/475acc39-a328-44d3-95fb-015000000000');
     $this->assertEqual($result, array('pass' => array('475acc39-a328-44d3-95fb-015000000000'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'edit', 'id' => '475acc39-a328-44d3-95fb-015000000000', '[method]' => 'PUT'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'DELETE';
     $result = Router::parse('/posts/13');
     $this->assertEqual($result, array('pass' => array('13'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'delete', 'id' => '13', '[method]' => 'DELETE'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $result = Router::parse('/posts/add');
     $this->assertEqual($result, array('pass' => array(), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'add'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     Router::reload();
     Router::mapResources('Posts', array('id' => '[a-z0-9_]+'));
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $result = Router::parse('/posts/add');
     $this->assertEqual($result, array('pass' => array('add'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'view', 'id' => 'add', '[method]' => 'GET'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
     $_SERVER['REQUEST_METHOD'] = 'PUT';
     $result = Router::parse('/posts/name');
     $this->assertEqual($result, array('pass' => array('name'), 'named' => array(), 'plugin' => '', 'controller' => 'posts', 'action' => 'edit', 'id' => 'name', '[method]' => 'PUT'));
     $this->assertEqual($this->router->__resourceMapped, array('posts'));
 }
Example #11
0
<?php

/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/views/pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'leads', 'action' => 'index'));
Router::connect('/mobile', array('controller' => 'users', 'action' => 'login', 'plugin' => 'mobile'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::mapResources(array('users', 'acodeounts'));
Router::parseExtensions();
 * different URLs to chosen controllers and their actions (functions).
 *
 * PHP 5
 *
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
Router::mapResources("posts");
Router::mapResources("users");
Router::parseExtensions();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #13
0
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Chef Router 
 */
App::uses("Vendor", "Model");
$vendorModel = new Vendor();
$vendors = $vendorModel->find("all", array("contain" => false));
foreach ($vendors as $v) {
    $slug = strtolower($v['Vendor']['name']);
    $slug = str_replace(" ", "-", $slug);
    Router::connect('/' . $slug, array('controller' => 'Webapp', 'action' => 'chef', $slug));
    //            echo $slug."\n";
}
//        exit;
Router::connect('/', array('controller' => 'Webapp', 'action' => 'home'));
Router::connect('/dev', array('controller' => 'Webapp', 'action' => 'dev'));
Router::mapResources('vendors');
Router::parseExtensions();
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #14
0
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Rest API aktivieren
 */
Router::mapResources('bookings');
Router::parseExtensions();
/**
 * Load all plugin routes.  See the CakePlugin documentation on 
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::mapResources('users');
Router::mapResources('customers');
Router::parseExtensions();
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #16
0
I18nRouter::connect("/[m_services_url]", array('controller' => 'services', 'action' => 'index'));
I18nRouter::connect("/[m_register_url]/*", array('controller' => 'users', 'action' => 'singin'));
I18nRouter::connect("/[buy_error_url]/*", array('controller' => 'pages', 'action' => 'display', 'buy_error'));
I18nRouter::connect("/[user_confirm_url]/*", array('controller' => 'users', 'action' => 'confirm'));
I18nRouter::connect("/[maintenance_url]/*", array('controller' => 'pages', 'action' => 'display', 'maintenance'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display', 'restricted' => false));
Router::connect('/admin', array('controller' => 'pages', 'action' => 'display', 'admin_home', 'admin' => true));
Router::connect("/contacts.captcha", array('controller' => 'contacts', 'action' => 'captcha'));
Router::mapResources('locations');
Router::mapResources('shows');
Router::mapResources('movies');
Router::mapResources('users');
Router::mapResources('cities');
Router::parseExtensions('json', 'xml');
Router::connect('/billboard/*', array('controller' => 'shows', 'action' => 'rest'));
Router::connect('/billboard-full/*', array('controller' => 'shows', 'action' => 'rest_schedules'));
Router::connect('/movie/*', array('controller' => 'movies', 'action' => 'view'));
Router::connect('/commingsoon/*', array('controller' => 'movies', 'action' => 'premiere'));
Router::connect('/slideshow', array('controller' => 'movies', 'action' => 'slideshow'));
Router::connect('/dates/*', array('controller' => 'shows', 'action' => 'get_date'));
/*
 * Carga todos los archivos routes de los plugins
 */
$f = new Folder(APP . 'plugins');
$files = $f->read();
foreach ($files[0] as $file) {
    if (file_exists(APP . 'plugins' . DS . $file . DS . 'config' . DS . 'routes.php')) {
        require_once APP . 'plugins' . DS . $file . DS . 'config' . DS . 'routes.php';
Example #17
0
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
Router::mapResources('session');
Router::mapResources('image');
Router::mapResources('signup');
Router::mapResources('articles');
Router::mapResources('messages');
Router::mapResources('message', array('prefix' => '/messages/'));
Router::parseExtensions();
require CAKE . 'Config' . DS . 'routes.php';
Example #18
0
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
Router::mapResources("companies");
Router::parseExtensions();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #19
0
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/*
 * API
 */
Router::mapResources(array('todo_lists'));
Router::parseExtensions('json');
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #20
0
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
Router::resourceMap(array(array('action' => 'index', 'method' => 'GET', 'id' => false, 'ext' => 'json'), array('action' => 'view', 'method' => 'GET', 'id' => true), array('action' => 'index', 'method' => 'POST', 'id' => false), array('action' => 'edit', 'method' => 'PUT', 'id' => true), array('action' => 'delete', 'method' => 'DELETE', 'id' => true), array('action' => 'add', 'method' => 'POST', 'id' => true)));
Router::mapResources('aliases', array('id' => '[^/]*'));
Router::parseExtensions('xml', 'json');
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
Example #21
0
//Router::connect('/whitelists/admin_add/*', array('controller' => 'whitelists', 'action' => 'add', 'admin' => true));
Router::connect('/whitelists/admin_index/*', array('controller' => 'whitelists', 'action' => 'index', 'admin' => true));
//Router::connect('/whitelists/admin_edit/*', array('controller' => 'whitelists', 'action' => 'edit', 'admin' => true));
//Router::connect('/whitelists/admin_delete/*', array('controller' => 'whitelists', 'action' => 'delete', 'admin' => true));
//	Router::connect('/regexp/admin_index/*', array('controller' => 'regexp', 'action' => 'index', 'admin' => true));
Router::connect('/users/admin_index/*', array('controller' => 'users', 'action' => 'index', 'admin' => true));
Router::connect('/roles/admin_index/*', array('controller' => 'roles', 'action' => 'index', 'admin' => true));
Router::connect('/logs/admin_search/*', array('controller' => 'logs', 'action' => 'search', 'admin' => true));
//	Router::connect('/roles/admin_add/*', array('controller' => 'roles', 'action' => 'add', 'admin' => true));
//	Router::connect('/roles/admin_edit/*', array('controller' => 'roles', 'action' => 'edit', 'admin' => true));
Router::connect('/logs/admin_index/*', array('controller' => 'logs', 'action' => 'index', 'admin' => true));
//	Router::connect('/logs/admin_search/*', array('controller' => 'logs', 'action' => 'search', 'admin' => true));
//	Router::connect('/admin/users/terms', array('controller' => 'users', 'action' => 'terms'));
//Router::connect('/admin/users/login', array('controller' => 'users', 'action' => 'login'));
//Router::connect('/admin/users/routeafterlogin', array('controller' => 'users', 'action' => 'routeafterlogin'));
//	Router::connect('/admin/users/edit/:id', array('controller' => 'users', 'action' => 'edit'), array('pass' => array('field', 'id')));
//	Router::connect('/admin/users/view/:id', array('controller' => 'users', 'action' => 'view'), array('pass' => array('field', 'id')));
//	Router::connect('/:controller/:field/:newValue/:oldValue', array('action' => 'call'), array('pass' => array('field', 'newValue', 'oldValue')));
// Activate REST
Router::mapResources(array('events', 'attributes'));
Router::parseExtensions('xml');
/**
 * Load all plugin routes.  See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
<?php

Router::mapResources('Dane.subscriptions', array('prefix' => '/dane/'));
Router::connect('/dane/subscriptions/transfer_anonymous', array('plugin' => 'Dane', 'controller' => 'Subscriptions', 'action' => 'transfer_anonymous'));
Router::connect('/dane', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'index'));
// TODO namespace /dane/utils/ ?
Router::connect('/dane/suggest', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'suggest'));
Router::connect('/dane/:dataset', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'index'), array('dataset' => '[a-zA-Z_]+', 'pass' => array('dataset')));
Router::connect('/dane/:dataset/:id', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'post', '[method]' => 'POST'), array('id' => '[0-9]+', 'pass' => array('dataset', 'id')));
Router::connect('/dane/zbiory/:id', array('plugin' => 'Dane', 'controller' => 'Datasets', 'action' => 'view'), array('id' => '[a-zA-Z_]+', 'pass' => array('id')));
Router::connect('/dane/:dataset/:id', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'view'), array('id' => '[0-9]+', 'pass' => array('dataset', 'id')));
Router::connect('/dane/:dataset/feed', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'feed'), array('id' => '[0-9]+', 'pass' => array('dataset')));
Router::connect('/dane/:dataset/:id/:action', array('plugin' => 'Dane', 'controller' => 'Dataobjects'), array('id' => '[0-9]+', 'pass' => array('dataset', 'id')));
Router::connect('/dane/:dataset/:id/:layer', array('plugin' => 'Dane', 'controller' => 'Dataobjects', 'action' => 'view_layer'), array('id' => '[0-9]+', 'pass' => array('dataset', 'id', 'layer')));
# ObjectUsersManagement
Router::connect('/dane/:dataset/:object_id/users/index', array('plugin' => 'Dane', 'controller' => 'ObjectUsersManagement', 'action' => 'index', '[method]' => 'GET'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/users/index', array('plugin' => 'Dane', 'controller' => 'ObjectUsersManagement', 'action' => 'add', '[method]' => 'POST'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/users/:user_id', array('plugin' => 'Dane', 'controller' => 'ObjectUsersManagement', 'action' => 'edit', '[method]' => 'PUT'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+', 'user_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/users/:user_id', array('plugin' => 'Dane', 'controller' => 'ObjectUsersManagement', 'action' => 'delete', '[method]' => 'DELETE'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+', 'user_id' => '[0-9]+'));
# ObjectPagesManagement
Router::connect('/dane/:dataset/:object_id/pages/isEditable', array('plugin' => 'Dane', 'controller' => 'ObjectPagesManagement', 'action' => 'isEditable', '[method]' => 'POST'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/pages/setLogo', array('plugin' => 'Dane', 'controller' => 'ObjectPagesManagement', 'action' => 'setLogo', '[method]' => 'POST'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/pages/setCover', array('plugin' => 'Dane', 'controller' => 'ObjectPagesManagement', 'action' => 'setCover', '[method]' => 'POST'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/pages/deleteLogo', array('plugin' => 'Dane', 'controller' => 'ObjectPagesManagement', 'action' => 'deleteLogo', '[method]' => 'DELETE'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:dataset/:object_id/pages/deleteCover', array('plugin' => 'Dane', 'controller' => 'ObjectPagesManagement', 'action' => 'deleteCover', '[method]' => 'DELETE'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Router::connect('/dane/:controller/:object_id/:action/:id', array('plugin' => 'Dane'), array('dataset' => '([a-zA-Z\\_]+)', 'object_id' => '[0-9]+'));
Example #23
0
<?php

/**
 * REST API
 */
Router::mapResources(array('roster', 'events', 'characters'));
Router::parseExtensions('json', 'xml');
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #24
0
 * PHP 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
//RadiusDesk REST Interface
Router::mapResources(array('Countries', 'Languages', 'PhraseKeys', 'PhraseValues', 'Groups', 'Realms', 'PhpPhrases'));
Router::parseExtensions();
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes.  See the CakePlugin documentation on 
 * how to customize the loading of plugin routes.
 */
Example #25
0
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/*
    Router::resourceMap( array(
        array( 'action' => 'index_api', 'method' => 'GET', 'id' => false ),
        array( 'action' => 'view_api', 'method' => 'GET', 'id' => true ),
        array( 'action' => 'add_api', 'method' => 'POST', 'id' => false),
        array( 'action' => 'edit_api', 'method' => 'PUT', 'id' => true ),
        array( 'action' => 'delete_api', 'method' => 'DELETE', 'id' => true ),
    ));*/
Router::mapResources('api');
Router::parseExtensions('json');
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/*
* MANEJO DE EMBARCACIONES
*/
Router::connect('/api/ships/person/:id', array('controller' => 'api', '[method]' => 'GET', 'action' => 'person_ships'), array('pass' => array('id'), 'id' => '[EV][0-9]+'));
Router::connect('/api/ships/person', array('controller' => 'api', '[method]' => array('POST', 'PUT', 'DELETE'), 'action' => 'NotAllow'));
Router::connect('/api/ships', array('controller' => 'api', '[method]' => 'POST', 'action' => 'add_ship'));
Router::connect('/api/ships', array('controller' => 'api', '[method]' => 'DELETE', 'action' => 'disable_ship'));
Router::connect('/api/ships', array('controller' => 'api', '[method]' => array('PUT', 'GET'), 'action' => 'NotAllow'));
Example #26
0
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
CakePlugin::routes();
Router::mapResources(array('dataviews', 'stocks'));
Router::parseExtensions();
/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
require CAKE . 'Config' . DS . 'routes.php';
Example #27
0
<?php

Router::mapResources('users');
Router::mapResources('games');
Router::mapResources('payments');
Router::mapResources('tokens');
Router::mapResources('channels');
Router::mapResources('histories');
Router::mapResources('orders');
Router::mapResources('items');
Router::mapResources('facebooks');
Router::mapResources('friends');
Router::mapResources('PaymentsReports');
Router::parseExtensions();
	Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
	Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
	CakePlugin::routes();

/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
	require CAKE . 'Config' . DS . 'routes.php';
Example #28
0
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different urls to chosen controllers and their actions (functions).
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app.config
 * @since         CakePHP(tm) v 0.2.9
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/views/pages/home.ctp)...
 */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's urls.
 */
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::mapResources('products');
Router::parseExtensions('json', 'xml');
Example #29
0
 /**
  * testGenerateUrlResourceRoute method
  *
  * @access public
  * @return void
  */
 function testGenerateUrlResourceRoute()
 {
     Router::mapResources('Posts');
     $result = Router::url(array('controller' => 'posts', 'action' => 'index', '[method]' => 'GET'));
     $expected = '/posts';
     $this->assertEqual($result, $expected);
     $result = Router::url(array('controller' => 'posts', 'action' => 'view', '[method]' => 'GET', 'id' => 10));
     $expected = '/posts/10';
     $this->assertEqual($result, $expected);
     $result = Router::url(array('controller' => 'posts', 'action' => 'add', '[method]' => 'POST'));
     $expected = '/posts';
     $this->assertEqual($result, $expected);
     $result = Router::url(array('controller' => 'posts', 'action' => 'edit', '[method]' => 'PUT', 'id' => 10));
     $expected = '/posts/10';
     $this->assertEqual($result, $expected);
     $result = Router::url(array('controller' => 'posts', 'action' => 'delete', '[method]' => 'DELETE', 'id' => 10));
     $expected = '/posts/10';
     $this->assertEqual($result, $expected);
     $result = Router::url(array('controller' => 'posts', 'action' => 'edit', '[method]' => 'POST', 'id' => 10));
     $expected = '/posts/10';
     $this->assertEqual($result, $expected);
 }
Example #30
0
<?php

/**
 * Pages routes configuration
 *
 * @copyright Copyright 2014, NetCommons Project
 * @author Kohei Teraguchi <*****@*****.**>
 * @link http://www.netcommons.org NetCommons Project
 * @license http://www.netcommons.org/license.txt NetCommons License
 */
Router::mapResources('frames.frames');