本文整理汇总了PHP中Router::parseExtensions方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::parseExtensions方法的具体用法?PHP Router::parseExtensions怎么用?PHP Router::parseExtensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::parseExtensions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startTest
public function startTest($method)
{
parent::startTest($method);
Router::parseExtensions('json');
$this->Pages =& new TestPagesController();
$this->Pages->__construct();
$this->Pages->constructClasses();
$this->testController = $this->Pages;
}
示例2: startTest
public function startTest($method)
{
parent::startTest($method);
Router::parseExtensions('json');
$this->loadFixtures('AppSetting', 'User');
$this->AppSettings =& new TestAppSettingsController();
$this->AppSettings->__construct();
$this->AppSettings->constructClasses();
$this->AppSettings->setReturnValue('isAuthorized', true);
$this->testController = $this->AppSettings;
}
示例3: testNoHandleRoutedExtension
/**
* AssetDispatcher should not 404 extensions that could be handled
* by Routing.
*
* @return void
*/
public function testNoHandleRoutedExtension()
{
$filter = new AssetDispatcher();
$response = $this->getMock('CakeResponse', array('_sendHeader'));
Configure::write('Asset.filter', array('js' => '', 'css' => ''));
App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)), App::RESET);
Router::parseExtensions('json');
Router::connect('/test_plugin/api/v1/:action', array('controller' => 'api'));
CakePlugin::load('TestPlugin');
$request = new CakeRequest('test_plugin/api/v1/forwarding.json');
$event = new CakeEvent('DispatcherTest', $this, compact('request', 'response'));
$this->assertNull($filter->beforeDispatch($event));
$this->assertFalse($event->isStopped(), 'Events for routed extensions should not be stopped');
}
示例4: startTest
public function startTest($method)
{
parent::startTest($method);
Router::parseExtensions('json');
$this->loadFixtures('Involvement', 'Date');
$this->Dates =& new TestDatesController();
$this->Dates->__construct();
$this->Dates->constructClasses();
$this->Dates->Notifier->QueueEmail = new MockDatesQueueEmailComponent();
$this->Dates->Notifier->QueueEmail->enabled = true;
$this->Dates->Notifier->QueueEmail->initialize($this->Dates);
$this->Dates->Notifier->QueueEmail->setReturnValue('_smtp', true);
$this->Dates->Notifier->QueueEmail->setReturnValue('_mail', true);
$this->Dates->setReturnValue('isAuthorized', true);
$this->testController = $this->Dates;
}
示例5: startTest
function startTest($method)
{
Router::reload();
$this->c = new TestControllerForSearchPaginationComponentTestCase();
// set 'ext' parameter
if (preg_match('/parseExtensions/i', $method)) {
Router::parseExtensions();
}
$this->c->params = Router::parse($this->url);
// always set 'url' parameter
if (!isset($this->c->params['url'])) {
$this->c->params['url'] = array();
}
$this->c->params['url']['url'] = $this->url;
$this->s = new SearchPaginationComponent();
$this->s->initialize($this->c);
}
示例6: startTest
public function startTest($method)
{
parent::startTest($method);
Router::parseExtensions('csv', 'print');
// necessary fixtures
$this->loadFixtures('User', 'Roster', 'Ministry', 'Involvement', 'Campus', 'InvolvementType');
$this->Reports = new TestReportsController();
$this->Reports->__construct();
$this->Reports->constructClasses();
$this->Reports->Notifier->QueueEmail = new MockReportsQueueEmailComponent();
$this->Reports->Notifier->QueueEmail->enabled = true;
$this->Reports->Notifier->QueueEmail->initialize($this->Reports);
$this->Reports->Notifier->QueueEmail->setReturnValue('_smtp', true);
$this->Reports->Notifier->QueueEmail->setReturnValue('_mail', true);
$this->Reports->setReturnValue('isAuthorized', true);
$this->testController = $this->Reports;
}
示例7: array
//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';
示例8: array
* 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.
*/
require CAKE . 'Config' . DS . 'routes.php';
Router::parseExtensions("pdf");
Router::parseExtensions("json");
示例9: testParsingWithTrailingPeriodAndParseExtensions
/**
* test that requests with a trailing dot don't loose the do.
*
* @return void
*/
function testParsingWithTrailingPeriodAndParseExtensions()
{
Router::reload();
Router::parseExtensions('json');
$result = Router::parse('/posts/view/something.');
$this->assertEqual($result['pass'][0], 'something.', 'Period was chopped off %s');
$result = Router::parse('/posts/view/something. . .');
$this->assertEqual($result['pass'][0], 'something. . .', 'Period was chopped off %s');
}
示例10: array
* different URLs to chosen controllers and their actions (functions).
*
* 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::parseExtensions('html', 'rss', 'json', 'csv');
/**
* 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('/feed', array('controller' => 'poles', 'action' => 'equipage'));
Router::connect('/login', array('controller' => 'users', 'action' => 'login'));
Router::connect('/logout', array('controller' => 'users', 'action' => 'logout'));
Router::connect('/', array('controller' => 'poles', 'action' => 'equipage'));
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/:controller/:id', array('action' => 'view'), array('pass' => array('id'), 'id' => '[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}'));
/**
示例11: array
* @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'));
/*
示例12: array
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.2.9
* @version $Revision: 7945 $
* @modifiedby $LastChangedBy: gwoo $
* @lastmodified $Date: 2008-12-19 13:16:01 +1100 (Fri, 19 Dec 2008) $
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
Router::parseExtensions('rss', '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/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::connect('/p/:slug-:id', array('controller' => 'posts', 'action' => 'view'), array('pass' => array('id'), 'id' => $UUID));
$controllers = array_map(array('Inflector', 'underscore'), Configure::listObjects('controller'));
Router::connect('/:controller', array(), array('controller' => join('|', $controllers)));
Router::connect('/:username', array('controller' => 'users', 'action' => 'view'), array('pass', array('username')));
示例13: array
<?php
/**
* pHKapa routes file
*
* PHP 5
*
* @category Controller
* @package pHKapa.app.Config
* @version V1
* @author Paulo Homem <contact@phalkaline.eu>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://phkapa.net
*/
/*if (file_exists(TMP.'installed.txt')) {
// the routes for when the application has been installed
//echo "installed";
} else {
//echo "install";
Router::connect('/:controler/:action', array('controller' => 'install'));
}*/
Router::parseExtensions('pdf');
Router::parseExtensions('csv');
示例14: array
* 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');
示例15: array
<?php
/* SVN FILE: $Id$ */
/**
* @copyright Copyright 2008, Passion Mansion, Inc.
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
*/
Router::parseExtensions('rss', 'xml', 'html');
// Default
Router::connect('/', array('controller' => 'default', 'action' => 'index'));
// Blocked
Router::connect('/blocked', array('controller' => 'pages', 'action' => 'display', 'blocked'));
// Product View
Router::connect('/p/view', array('controller' => 'product', 'action' => 'index'));
Router::connect('/p', array('controller' => 'product', 'action' => 'index'));
Router::connect('/p/*', array('controller' => 'product', 'action' => 'view'));
Router::connect('/c/*', array('controller' => 'category', 'action' => 'view'));
Router::connect('/product_info/*', array('controller' => 'product', 'action' => 'view'));
Router::connect('/cart/add_country/*', array('controller' => 'cart', 'action' => 'add_country'));
Router::connect('/cart/add/*', array('controller' => 'cart', 'action' => 'add'));
Router::connect('/cart', array('controller' => 'cart', 'action' => 'index'));
// Custom Error Message
Router::connect('/404', array('controller' => 'pages', 'action' => 'display', 'error'));
Router::connect('/error/*', array('controller' => 'pages', 'action' => 'display', 'error'));
Router::connect('/docs/*', array('controller' => 'pages', 'action' => 'display'));
Router::connect('/sitemap', array('controller' => 'sitemaps', 'action' => 'index', 'url' => array('ext' => 'xml')));