本文整理汇总了PHP中Zend_Controller_Router_Rewrite类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Router_Rewrite类的具体用法?PHP Zend_Controller_Router_Rewrite怎么用?PHP Zend_Controller_Router_Rewrite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Controller_Router_Rewrite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>");
}
}
}
示例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;
}
示例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);
}
示例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()));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}