本文整理汇总了PHP中Zend_Controller_Router_Rewrite类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Router_Rewrite类的具体用法?PHP Zend_Controller_Router_Rewrite怎么用?PHP Zend_Controller_Router_Rewrite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Controller_Router_Rewrite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _initHeader
function _initHeader()
{
//date_default_timezone_set("PRC");
header("Content-Type:text/html;charset=utf-8");
$config = new Zend_Config_Ini(CONFIGS_PATH . '/application.ini', 'production');
defined("SYS_NAME") || define("SYS_NAME", $config->sys->name);
defined("SYS_COPYRIGHT") || define("SYS_COPYRIGHT", $config->sys->copyright . date('Y'));
defined("SYS_EMAIL_SUFFIX") || define("SYS_EMAIL_SUFFIX", $config->sys->email_suffix);
$page_head = '<title>' . SYS_NAME . '</title>
<link type="image/x-icon" rel=icon href="' . HOME_PATH . '/public/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/style.css"/>
<link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/icon.css"/>
<link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/library/ext/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="' . HOME_PATH . '/public/css/BoxSelect.css">
<script type="text/javascript" src="' . HOME_PATH . '/library/ext/ext-all.js"></script>
<script type="text/javascript" src="' . HOME_PATH . '/library/ext/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="' . HOME_PATH . '/public/js/BoxSelect.js"></script>
<script type="text/javascript" src="' . HOME_PATH . '/public/js/EmployeeCombo.js"></script>
<script type="text/javascript">Ext.override(Ext.view.Table, { enableTextSelection: true });var homePath="' . HOME_PATH . '";</script>';
defined("SYS_HEAD") || define("SYS_HEAD", $page_head);
$router = new Zend_Controller_Router_Rewrite();
$request = new Zend_Controller_Request_Http();
$router->route($request);
$controller = $request->getControllerName();
$action = $request->getActionName();
// 已登录验证过滤
if ($controller != 'home' && $controller != 'index' && $controller != 'login' && $controller != 'hra' && $controller != 'admin' && $controller != 'dcc' || $controller == 'hra' && $action != 'news' || $controller == 'admin' && $action != 'cron' || $controller == 'dcc' && $action != 'upload') {
$user_session = new Zend_Session_Namespace('user');
if (!isset($user_session->user_info)) {
exit("<script>window.location.href='" . HOME_PATH . "/public/home/login';</script>");
}
}
}
开发者ID:xindalu,项目名称:evolve,代码行数:33,代码来源:Bootstrap.php
示例2: getRouter
/**
* Retrieve router object
*
* @return Zend_Controller_Router_Rewrite
*/
public function getRouter()
{
if (null === $this->_router) {
$bootstrap = $this->getBootstrap();
$bootstrap->bootstrap('FrontController');
$this->_router = $bootstrap->getContainer()->frontcontroller->getRouter();
$options = $this->getOptions();
if (!isset($options['routes'])) {
$options['routes'] = array();
}
if (isset($options['chainNameSeparator'])) {
$this->_router->setChainNameSeparator($options['chainNameSeparator']);
}
if (isset($options['useRequestParametersAsGlobal'])) {
$this->_router->useRequestParametersAsGlobal($options['useRequestParametersAsGlobal']);
}
$this->_router->addConfig(new Zend_Config($options['routes']));
}
return $this->_router;
}
开发者ID:nhp,项目名称:shopware-4,代码行数:30,代码来源:Router.php
示例3: _initRouter
protected function _initRouter()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini');
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config);
Zend_Controller_Front::getInstance()->setRouter($router);
}
开发者ID:komik966,项目名称:rek-php-task2,代码行数:7,代码来源:Bootstrap.php
示例4: setUp
protected function setUp()
{
parent::setUp();
foreach (array_keys($_POST) as $key) {
unset($_POST[$key]);
}
Zend_Auth::getInstance()->setStorage(new Zend_Auth_Storage_NonPersistent());
$this->clean();
$front = Zend_Controller_Front::getInstance();
$router = new Zend_Controller_Router_Rewrite();
$routes_config = new USVN_Config_Ini(USVN_ROUTES_CONFIG_FILE, USVN_CONFIG_SECTION);
$router->addConfig($routes_config, 'routes');
$front->setRouter($router);
$table = new USVN_Db_Table_Users();
$this->user = $table->fetchNew();
$this->user->setFromArray(array('users_login' => 'john', 'users_password' => 'pinocchio'));
$this->user->save();
$this->admin_user = $table->fetchNew();
$this->admin_user->setFromArray(array('users_login' => 'god', 'users_password' => 'ingodwetrust', 'users_is_admin' => true));
$this->admin_user->save();
$authAdapter = new USVN_Auth_Adapter_Database('john', 'pinocchio');
Zend_Auth::getInstance()->authenticate($authAdapter);
$front->setControllerDirectory(USVN_CONTROLLERS_DIR);
$this->request = new USVN_Controller_Request_Http();
$front->setRequest($this->request);
$this->response = new Zend_Controller_Response_Cli();
$front->setResponse($this->response);
$router->addRoute('default', new Zend_Controller_Router_Route_Module(array(), $front->getDispatcher(), $front->getRequest()));
}
开发者ID:phpscr,项目名称:usvn,代码行数:29,代码来源:Controller.php
示例5: _initRewrite
/**
*
* Initialize router
*/
protected function _initRewrite()
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$objRouter = new Zend_Controller_Router_Rewrite();
$router = $objRouter->addConfig($config, 'routes');
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
}
开发者ID:alienpham,项目名称:resume-manager,代码行数:12,代码来源:Bootstrap.php
示例6: _initRouter
/**
* Initialize the routes
*
* @return void
*/
protected function _initRouter()
{
$routes = new Zend_Config_Xml(APPLICATION_PATH . '/configs/frontend_routes.xml');
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($routes);
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
}
开发者ID:omusico,项目名称:logica,代码行数:13,代码来源:CliBootstrap.php
示例7: _initLoadRouter
protected function _initLoadRouter()
{
$config = new Zend_Config_Ini(CONFIG_PATH . '/routers.ini', 'setup-router');
$objRouter = new Zend_Controller_Router_Rewrite();
//new Zend_Controller_Router_Route_Regex()
$router = $objRouter->addConfig($config, 'routers');
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
}
开发者ID:rongandat,项目名称:phanloaicanbo,代码行数:9,代码来源:Bootstrap.php
示例8: _initRoutes
/**
* Initialize router
*
* @return \Zend_Controller_Router_Rewrite
*/
protected function _initRoutes()
{
$config = new Zend_Config_Json(APPLICATION_PATH . '/configs/routes/en.json', 'routes', array('ignore_constants' => true, 'skip_extends' => true));
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config);
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
return $router;
}
开发者ID:georgetutuianu,项目名称:licenta,代码行数:14,代码来源:Bootstrap.php
示例9: _getRouterInstance
protected function _getRouterInstance()
{
$routes = array('default' => $this->_getRoute('*', self::CONTROLLER_INDEX), self::ROUTE_INDEX => $this->_getRoute('form-to-mail', self::CONTROLLER_INDEX), self::ROUTE_CONFIRM => $this->_getRoute('form-to-mail/confirm', self::CONTROLLER_INDEX), self::ROUTE_LOGIN => $this->_getRoute('form-to-mail/login', self::CONTROLLER_LOGIN));
require_once 'Zend/Controller/Router/Rewrite.php';
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$router->addRoutes($routes);
return $router;
}
开发者ID:sitengine,项目名称:sitengine,代码行数:9,代码来源:Front.php
示例10: _initRouter
protected function _initRouter()
{
// Loads routes from specific config file
$front = $this->bootstrap('FrontController')->getResource('FrontController');
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'production');
$routing = new Zend_Controller_Router_Rewrite();
$routing->addConfig($config, 'routes');
$front->setRouter($routing);
}
开发者ID:berliozd,项目名称:cherbouquin,代码行数:9,代码来源:Bootstrap.php
示例11: _getRouterInstance
protected function _getRouterInstance()
{
$path = $this->getServicePath();
$routes = array('default' => $this->_getRoute('*', self::CONTROLLER_CAMPAIGNS), self::ROUTE_CAMPAIGNS => $this->_getRoute("{$path}/campaigns", self::CONTROLLER_CAMPAIGNS), self::ROUTE_CAMPAIGNS_SHARP => $this->_getRoute("{$path}/campaigns/:id", self::CONTROLLER_CAMPAIGNS), self::ROUTE_SUBSCRIPTIONS_SUBSCRIBE => $this->_getRoute("{$path}/subscriptions", self::CONTROLLER_SUBSCRIPTIONS), self::ROUTE_SUBSCRIPTIONS_UNSUBSCRIBE => $this->_getRoute("{$path}/subscriptions/unsubscribe", self::CONTROLLER_SUBSCRIPTIONS), self::ROUTE_SUBSCRIPTIONS_CONFIRM_OPTIN => $this->_getRoute("{$path}/subscriptions/confirm/optin", self::CONTROLLER_SUBSCRIPTIONS), self::ROUTE_SUBSCRIPTIONS_CONFIRM_FINAL => $this->_getRoute("{$path}/subscriptions/confirm/final", self::CONTROLLER_SUBSCRIPTIONS), self::ROUTE_SUBSCRIPTIONS_CONFIRM_UNSUBSCRIBE => $this->_getRoute("{$path}/subscriptions/confirm/unsubscribe", self::CONTROLLER_SUBSCRIPTIONS));
require_once 'Zend/Controller/Router/Rewrite.php';
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$router->addRoutes($routes);
return $router;
}
开发者ID:sitengine,项目名称:sitengine,代码行数:10,代码来源:Front.php
示例12: _getRouterInstance
protected function _getRouterInstance()
{
require_once 'Zend/Controller/Router/Route.php';
$routes = array('default' => new Zend_Controller_Router_Route('*', array(Sitengine_Env::PARAM_CONTROLLER => $this->getController(self::CONTROLLER_INDEX), Sitengine_Env::PARAM_ACTION => 'index')), self::ROUTE_INDEX => new Zend_Controller_Router_Route('backend/sitemap/:' . Sitengine_Env::PARAM_ACTION . '/*', array(Sitengine_Env::PARAM_CONTROLLER => $this->getController(self::CONTROLLER_INDEX), Sitengine_Env::PARAM_ACTION => 'index')), self::ROUTE_LOGIN => new Zend_Controller_Router_Route('backend/sitemap/login', array(Sitengine_Env::PARAM_CONTROLLER => $this->getController(self::CONTROLLER_LOGIN), Sitengine_Env::PARAM_ACTION => 'index')));
require_once 'Zend/Controller/Router/Rewrite.php';
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$router->addRoutes($routes);
return $router;
}
开发者ID:sitengine,项目名称:sitengine,代码行数:10,代码来源:Front.php
示例13: _getRouterInstance
protected function _getRouterInstance()
{
$path = $this->getServicePath();
$routes = array('default' => $this->_getRoute('*', self::CONTROLLER_USER), self::ROUTE_USER => $this->_getRoute("{$path}/user", self::CONTROLLER_USER), self::ROUTE_USER_NEW => $this->_getRoute("{$path}/join", self::CONTROLLER_USER), self::ROUTE_LOGIN => $this->_getRoute("{$path}/login", self::CONTROLLER_LOGIN));
require_once 'Zend/Controller/Router/Rewrite.php';
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$router->addRoutes($routes);
return $router;
}
开发者ID:sitengine,项目名称:sitengine,代码行数:10,代码来源:Front.php
示例14: getRouter
public static function getRouter()
{
/* @var $router Zend_Controller_Router_Rewrite */
$router = new \Zend_Controller_Router_Rewrite();
$routes = array();
$routes['watch'] = new \Zend_Controller_Router_Route('watch/:id/:name', array('controller' => 'watch', 'action' => 'index', 'id' => "0", 'name' => ''));
$routes['category'] = new \Zend_Controller_Router_Route('category/:categoryId/:page', array('controller' => 'category', 'action' => 'index', 'categoryId' => "0", 'page' => '1'));
$routes['latest-update'] = new \Zend_Controller_Router_Route('latest-update/:page', array('controller' => 'index', 'action' => 'index', 'page' => "1"));
$router->addRoutes($routes);
return $router;
}
开发者ID:jay45,项目名称:porn,代码行数:11,代码来源:MyRouterConfiguration.php
示例15: recentAction
public function recentAction()
{
//@todo route: do it the right way!
$router = new Zend_Controller_Router_Rewrite();
$routeConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/defaultRoutes.ini');
$router->addConfig($routeConfig, 'routes');
$registry = Zend_Registry::getInstance();
$config = $registry->get("config");
$this->_helper->verifyIdentity();
$recent = new Ml_Model_Recent();
if (!$registry->isRegistered("authedUserInfo")) {
throw new Exception("Not authenticated.");
}
$userInfo = $registry->get("authedUserInfo");
$uploads = $recent->contactsUploads($userInfo['id']);
//send response
$doc = new Ml_Model_Dom();
$doc->formatOutput = true;
$rootElement = $doc->createElement("items");
$doc->appendChild($rootElement);
foreach ($uploads as $share) {
$shareElement = $doc->createElement("item");
$avatarInfo = unserialize($share['people.avatarInfo']);
if (isset($avatarInfo['secret'])) {
$iconSecret = $avatarInfo['secret'];
} else {
$iconSecret = '';
}
$shareData = array("type" => "file", "id" => $share['id']);
foreach ($shareData as $name => $field) {
$shareElement->appendChild($doc->newTextAttribute($name, $field));
}
$shareData = array("title" => $share['share.title'], "short" => $share['share.short'], "url" => "http://" . $config['webhost'] . $router->assemble(array("username" => $share['people.alias'], "share_id" => $share['id']), "sharepage_1stpage"));
foreach ($shareData as $name => $field) {
$shareElement->appendChild($doc->newTextElement($name, $field));
}
$filesizeElement = $doc->createElement("filesize");
$filesizeElement->appendChild($doc->newTextAttribute("bits", $share['share.fileSize']));
$filesizeElement->appendChild($doc->newTextAttribute("kbytes", ceil($share['share.fileSize'] / (1024 * 8))));
$shareElement->appendChild($filesizeElement);
$ownerElement = $doc->createElement("owner");
$shareData = array("id" => $share['people.id'], "alias" => $share['people.alias'], "realname" => $share['people.name'], "iconsecret" => $iconSecret);
foreach ($shareData as $name => $field) {
$ownerElement->appendChild($doc->newTextAttribute($name, $field));
}
$shareElement->appendChild($ownerElement);
$rootElement->appendChild($shareElement);
}
$this->_helper->printResponse($doc);
}
开发者ID:henvic,项目名称:MediaLab,代码行数:50,代码来源:ActivityController.php
示例16: _initRoutes
/**
* Routes initialization
*
* @return Zend_Controller_Router
*/
protected function _initRoutes()
{
$this->bootstrapOptions();
$router = new \Zend_Controller_Router_Rewrite();
foreach (\NS\Service\AbstractService::getConfig() as $module => $config) {
if ($config->routes) {
foreach ($config->routes as $r => $routeConfig) {
$router->addRoute($module . '_' . $r, \Zend_Controller_Router_Route::getInstance($routeConfig));
}
}
}
\Zend_Controller_Front::getInstance()->setRouter($router);
return $router;
}
开发者ID:MossesX,项目名称:mongo-cms,代码行数:19,代码来源:Bootstrap.php
示例17: getRouter
/**
* Retrieve router object
*
* @return Zend_Controller_Router_Rewrite
*/
public function getRouter()
{
if (null === $this->_router) {
$bootstrap = $this->getBootstrap();
$bootstrap->bootstrap('FrontController');
$front = $bootstrap->getContainer()->frontcontroller;
$options = $this->getOptions();
if (!isset($options['routes'])) {
$options['routes'] = array();
}
$this->_router = $front->getRouter();
$this->_router->addConfig(new Zend_Config($options['routes']));
}
return $this->_router;
}
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:20,代码来源:Router.php
示例18: _addHomepageRedirect
/**
* Adds a redirect route for the homepage.
*
* A redirect is required to make a "homepage" that is an external URL, an
* admin URL, or a URL with a query string.
*
* @param string $uri The absolute uri to redirect to the default route to
* @param Zend_Controller_Router_Rewrite $router The router
* @return boolean True if the route was successfully added, else false.
*/
protected function _addHomepageRedirect($uri, $router)
{
// Handle possible internal links by stripping the base URL
$uri = $this->_leftTrim($uri, PUBLIC_BASE_URL);
if ($uri == '' || $uri == '/' || strpos($uri, '?') === 0 || strpos($uri, '/?') === 0) {
return false;
}
$router->addRoute(self::HOMEPAGE_ROUTE_NAME, new Zend_Controller_Router_Route('/', array('controller' => 'redirector', 'action' => 'index', 'redirect_uri' => $uri)));
return true;
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:20,代码来源:Router.php
示例19: _initFrontController
/**
* Router rewrite Front
*
* @return string url
*/
protected function _initFrontController()
{
$url = $_SERVER['REQUEST_URI'];
$arr = explode('/', $url);
$total_arr = sizeof($arr);
$urlCheck = 3;
//localhost = 3 server = 2, $arr[1]
$detail = $total_arr == $urlCheck && preg_match('/^\\d+-\\d+-.*+$/', $arr[2], $matches) ? true : false;
if ($total_arr == $urlCheck && !empty($arr[2]) && !$detail) {
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array('default' => APPLICATION_PATH . "/modules/front/controllers", 'admin' => APPLICATION_PATH . "/modules/admin/controllers"));
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routers.ini', 'estore');
$router = new Zend_Controller_Router_Rewrite();
return $front->setRouter($router->addConfig($config, 'routes'));
} else {
$front = Zend_Controller_Front::getInstance();
$front->setControllerDirectory(array('default' => APPLICATION_PATH . "/modules/front/controllers", 'admin' => APPLICATION_PATH . "/modules/admin/controllers"));
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routers.ini', 'rewriteshopname');
$router = new Zend_Controller_Router_Rewrite();
return $front->setRouter($router->addConfig($config, 'routes'));
}
}
开发者ID:nhantam,项目名称:MangoHRM,代码行数:27,代码来源:Bootstrap.php
示例20: _setRouter
/**
* set router
*/
protected function _setRouter()
{
if (null === self::$_router) {
self::$_router = new Zend_Controller_Router_Rewrite();
$route_project = new Zend_Controller_Router_Route_Regex('index.php/project/(\\d+)', array('controller' => 'project', 'action' => 'view'), array(1 => 'id'));
$route_project_list = new Zend_Controller_Router_Route_Regex('project/list/(\\d+)', array('controller' => 'Index', 'action' => 'list', 'module' => 'project'), array(1 => 'page'), 'project/list/%d');
$route_user_login = new Zend_Controller_Router_Route_Regex('user/login', array('module' => 'user', 'controller' => 'index', 'action' => 'login'));
$route_user_logout = new Zend_Controller_Router_Route_Regex('user/logout', array('module' => 'user', 'controller' => 'index', 'action' => 'logout'));
$route_user_list = new Zend_Controller_Router_Route_Regex('user/list/(\\d+)', array('module' => 'user', 'controller' => 'Index', 'action' => 'list'), array(1 => 'page'), 'user/list/%d');
$route_user_edit = new Zend_Controller_Router_Route_Regex('user/edit', array('module' => 'user', 'controller' => 'index', 'action' => 'edit'));
$route_user_edit_id = new Zend_Controller_Router_Route_Regex('user/edit/(\\d+)', array('module' => 'user', 'controller' => 'index', 'action' => 'edit'), array(1 => 'id'));
$route_user_save = new Zend_Controller_Router_Route_Regex('user/save', array('module' => 'user', 'controller' => 'index', 'action' => 'save'));
self::$_router->addRoutes(array($route_project, $route_user_login, $route_user_logout, $route_user_list, $route_user_edit, $route_user_edit_id, $route_user_save));
}
}
开发者ID:victorli,项目名称:ShrimpProject,代码行数:18,代码来源:Application.php
注:本文中的Zend_Controller_Router_Rewrite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论