本文整理汇总了PHP中getRoute函数的典型用法代码示例。如果您正苦于以下问题:PHP getRoute函数的具体用法?PHP getRoute怎么用?PHP getRoute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRoute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: raise
public static function raise($exception)
{
getLogger()->warn($exception->getMessage());
$class = get_class($exception);
$baseController = new BaseController();
switch ($class) {
case 'OPAuthorizationException':
case 'OPAuthorizationSessionException':
if (isset($_GET['__route__']) && substr($_GET['__route__'], -5) == '.json') {
echo json_encode($baseController->forbidden('You do not have sufficient permissions to access this page.'));
} else {
getRoute()->run('/error/403', EpiRoute::httpGet);
}
die;
break;
case 'OPAuthorizationOAuthException':
echo json_encode($baseController->forbidden($exception->getMessage()));
die;
break;
default:
getLogger()->warn(sprintf('Uncaught exception (%s:%s): %s', $exception->getFile(), $exception->getLine(), $exception->getMessage()));
throw $exception;
break;
}
}
示例2: callHook
function callHook()
{
$url = $_GET['url'];
//Matching url param from route list
$routes = getRoute();
$controllerMatch = '';
$actionMatch = '';
foreach ($routes as $route) {
$routeUrl = $route['url'];
if (preg_match("/^{$routeUrl}\$/", $url, $match)) {
$controllerMatch = $route['controller'];
$actionMatch = $route['action'];
if (isset($match[1])) {
setGetParams($match, $route['params']);
}
break;
}
}
//Create actual action and dispatcher names to be called
$controller = $controllerMatch;
$action = $actionMatch;
$action .= 'Action';
$controller = ucwords($controller);
$controller .= 'Controller';
$dispatch = new $controller();
if (method_exists($dispatch, $action)) {
echo call_user_func_array(array($dispatch, $action), array());
} else {
//404
return new View('page/404.php', array());
}
}
示例3: delete
public function delete($route, $callback, $visibility = self::internal)
{
$this->addRoute($route, $callback, EpiRoute::httpDelete);
if ($visibility === self::external) {
getRoute()->delete($route, $callback, true);
}
}
示例4: processLogin
public static function processLogin()
{
// Confirm the password is correct
// * Assume it's all good for the time being * //
// Redirect to the logged in home page
getSession()->set(Constants::LOGGED_IN, true);
getRoute()->redirect('/dashboard');
}
示例5: executeDelete
public function executeDelete(sfWebRequest $request)
{
$request->checkCSRFProtection();
///$this->forward404Unless($JobeetJob = JobeetJobPeer::retrieveByPk($request->getParameter('id')), sprintf('Object JobeetJob does not exist (%s).', $request->getParameter('id')));
$JobeetJob = $this - _ > getRoute()->getObject();
$JobeetJob->delete();
$this->redirect('job/index');
}
示例6: active_menu_sidebar
function active_menu_sidebar($array)
{
$resultado = array_value_recursive(getRoute(), $array);
if (!empty($resultado)) {
return 'active';
}
return '';
}
示例7: __construct
public function __construct()
{
$this->api = getApi();
$this->config = getConfig()->get();
$this->plugin = getPlugin();
$this->route = getRoute();
$this->session = getSession();
$this->template = getTemplate();
$this->utility = new Utility();
$this->url = new Url();
$this->apiVersion = Request::getApiVersion();
}
示例8: __construct
public function __construct()
{
$this->api = getApi();
$this->config = getConfig()->get();
$this->logger = getLogger();
$this->route = getRoute();
$this->session = getSession();
$this->cache = getCache();
// really just for setup when the systems don't yet exist
if (isset($this->config->systems)) {
$this->db = getDb();
$this->fs = getFs();
}
}
示例9: __construct
public function __construct()
{
$this->api = getApi();
$this->config = getConfig()->get();
$this->plugin = getPlugin();
$this->route = getRoute();
$this->session = getSession();
$this->template = getTemplate();
$this->theme = getTheme();
$this->utility = new Utility();
$this->url = new Url();
$this->template->template = $this->template;
$this->template->config = $this->config;
$this->template->plugin = $this->plugin;
$this->template->session = $this->session;
$this->template->theme = $this->theme;
$this->template->utility = $this->utility;
$this->template->url = $this->url;
$this->template->user = new User();
}
示例10: run
/**
* Start routing
*/
public static function run()
{
if (!is_file(ROUTER_CACHE_FILE)) {
crash('The cache-route-file is not exists');
}
require_once ROUTER_CACHE_FILE;
if (!function_exists('getRoute')) {
crash('Route function "getRoute" does not exists');
}
$route = getRoute();
if (Cache::e_array($route)) {
crash('Route value is not correct in cache-route-file');
}
/**
* Start finding
*/
try {
if (isset($route[URI])) {
$data = $route[URI];
throw new Exception();
}
$onlyRegexp = array_filter(array_keys($route), function ($element) {
if (substr($element, 0, 1) === '~') {
return true;
}
return false;
});
foreach ($onlyRegexp as $pattern) {
if (preg_match($pattern, URI, $match)) {
controllerManager::$matchUrl = $match;
$data = $route[$pattern];
throw new Exception();
}
}
} catch (Exception $e) {
require_once $controllerPath = WORK_SPACE_FOLDER_PATH . 'controllers' . DS . $data['controller'] . 'Controller.php';
$render = new Render();
$render->execute($data, $data['controller'], $controllerPath);
}
Render::generate404Error();
}
示例11: processLogout
public static function processLogout()
{
// Redirect to the logged in home page
getSession()->set(Constants::LOGGED_IN, false);
getRoute()->redirect('/');
}
示例12: define
<?php
$config = (include "config.php");
include "functions.php";
include "mysql.php";
define("CSS", "/view/css");
define("JS", "/view/js");
define("IMAGE", "/view/image");
include ROOT . "/controllers/Controller.php";
$dbconf = $config['dbconfig'];
$dbcon = connectMysql($dbconf);
$route = getRoute();
ob_start();
execAction($route);
$output = ob_flush();
示例13: array
$routeObj->get('/manage/albums', array('ManageController', 'albums'));
$routeObj->get('/manage/apps', array('ManageController', 'apps'));
$routeObj->get('/manage/apps/callback', array('ManageController', 'appsCallback'));
$routeObj->get('/manage/features', array('ManageController', 'features'));
// redirect to /manage/settings
$routeObj->get('/manage/settings', array('ManageController', 'settings'));
$routeObj->post('/manage/settings', array('ManageController', 'settingsPost'));
$routeObj->get('/manage/groups', array('ManageController', 'groups'));
$routeObj->get('/manage/password/reset/([a-z0-9]{32})', array('ManageController', 'passwordReset'));
/*
* Album endpoints
* All album endpoints follow the same convention.
* Everything in []'s are optional
* /album[s][/:id]/{action}
*/
getRoute()->get('/albums/list', array('AlbumController', 'list_'));
// retrieve activities (/albums/list)
/*
* Photo endpoints
* All photo endpoints follow the same convention.
* Everything in []'s are optional
* /photo/{id}[/{additional}]
*/
$routeObj->get('/photo/([a-zA-Z0-9]+)/edit', array('PhotoController', 'edit'));
// edit form for a photo (/photo/{id}/edit)
$routeObj->get('/photo/([a-zA-Z0-9]+)/create/([a-z0-9]+)/([0-9]+)x([0-9]+)x?(.*).jpg', array('PhotoController', 'create'));
// create a version of a photo (/photo/create/{id}/{options}.jpg)
$routeObj->get('/photo/([a-zA-Z0-9]+)/?(token-[a-z0-9]+)?/download', array('PhotoController', 'download'));
// download a high resolution version of a photo (/photo/create/{id}/{options}.jpg)
$routeObj->get('/photo/([a-zA-Z0-9]+)/?(.+)?/view', array('PhotoController', 'view'));
// view a photo (/photo/{id}[/{options}])/view
示例14: getPageByRoute
<?php
$page = getPageByRoute(getRoute());
?>
<div class="container">
<div class="row">
<div class="page-header">
<h1><?php
echo $page['title'];
?>
</h1>
</div>
<div class="row">
<?php
echo $page['content'];
?>
</div>
</div>
</div>
示例15: define
use Classes\Sanitiser;
use Classes\DBConnection;
use Classes\CurrencyFairDB;
use Classes\View;
use Classes\Render;
define('BASE_PATH', __DIR__);
#get autoloader
include_once BASE_PATH . DIRECTORY_SEPARATOR . 'loader.php';
#include settings
$settings = (include_once BASE_PATH . DIRECTORY_SEPARATOR . 'settings.php');
#connect to the db using PDO and then get the instantiate the currency fair db.
$dbConnection = new DBConnection($settings);
$db = $dbConnection->getPDOConnection();
#currencyFairDB
$currencyFairDB = new CurrencyFairDB($db);
#this will simply take the first name after the currencyfair in the url.
$myroute = getRoute();
if ($myroute == 'render') {
#my view
$view = new View();
$render = new Render($settings, $currencyFairDB, $view);
$render->run();
} elseif ($myroute == 'consumption') {
#currencyFairDB
$currencyFairDB = new CurrencyFairDB($db);
$sanitiser = new Sanitiser();
$consumption = new Consumption($settings, $sanitiser, $currencyFairDB);
$consumption->run();
} else {
die('invalid path');
}