本文整理汇总了PHP中getRoute函数的典型用法代码示例。如果您正苦于以下问题:PHP getRoute函数的具体用法?PHP getRoute怎么用?PHP getRoute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRoute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:gg1977,项目名称:frontend,代码行数:25,代码来源:exceptions.php
示例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());
}
}
开发者ID:yakobabada,项目名称:beeGame,代码行数:32,代码来源:bootstrap.php
示例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);
}
}
开发者ID:yllus,项目名称:epiphany,代码行数:7,代码来源:EpiApi.php
示例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');
}
开发者ID:Jpsstack,项目名称:epiphany,代码行数:8,代码来源:login.class.php
示例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');
}
开发者ID:rdi0r,项目名称:dreamrc,代码行数:8,代码来源:actions.class.php
示例6: active_menu_sidebar
function active_menu_sidebar($array)
{
$resultado = array_value_recursive(getRoute(), $array);
if (!empty($resultado)) {
return 'active';
}
return '';
}
开发者ID:filipepaladino,项目名称:base-admin,代码行数:8,代码来源:helpers.php
示例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();
}
开发者ID:nicolargo,项目名称:frontend,代码行数:12,代码来源:ApiBaseController.php
示例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();
}
}
开发者ID:nicolargo,项目名称:frontend,代码行数:14,代码来源:BaseModel.php
示例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();
}
开发者ID:gg1977,项目名称:frontend,代码行数:20,代码来源:BaseController.php
示例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();
}
开发者ID:stan-coder,项目名称:online_store,代码行数:44,代码来源:routing.php
示例11: processLogout
public static function processLogout()
{
// Redirect to the logged in home page
getSession()->set(Constants::LOGGED_IN, false);
getRoute()->redirect('/');
}
开发者ID:Jpsstack,项目名称:epiphany,代码行数:6,代码来源:logout.class.php
示例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();
开发者ID:lvchenbaby,项目名称:convey,代码行数:15,代码来源:base.php
示例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
开发者ID:gg1977,项目名称:frontend,代码行数:31,代码来源:routes.php
示例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>
开发者ID:brunowerneck,项目名称:PHPFoundation,代码行数:20,代码来源:produtos.php
示例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');
}
开发者ID:apetmarcel,项目名称:currencyfairtest,代码行数:31,代码来源:index.php
示例16: date_default_timezone_set
// TODO, remove these
date_default_timezone_set('America/Los_Angeles');
if (isset($_GET['__route__']) && strstr($_GET['__route__'], '.json')) {
header('Content-type: application/json');
}
$basePath = dirname(dirname(__FILE__));
$epiPath = "{$basePath}/libraries/external/epi";
require "{$epiPath}/Epi.php";
require "{$basePath}/libraries/compatability.php";
require "{$basePath}/libraries/models/UserConfig.php";
Epi::setSetting('exceptions', true);
Epi::setPath('base', $epiPath);
Epi::setPath('config', "{$basePath}/configs");
Epi::setPath('view', '');
Epi::init('api', 'cache', 'config', 'curl', 'form', 'logger', 'route', 'session', 'template', 'database');
$routeObj = getRoute();
$apiObj = getApi();
// loads configs and dependencies
$userConfigObj = new UserConfig();
$hasConfig = $userConfigObj->load();
$configObj = getConfig();
EpiCache::employ($configObj->get('epi')->cache);
$sessionParams = array($configObj->get('epi')->session);
if ($configObj->get('epiSessionParams')) {
$sessionParams = array_merge($sessionParams, (array) $configObj->get('epiSessionParams'));
// for TLDs we need to override the cookie domain if specified
if (isset($sessionParams['domain']) && stristr($_SERVER['HTTP_HOST'], $sessionParams['domain']) === false) {
$sessionParams['domain'] = $_SERVER['HTTP_HOST'];
}
$sessionParams = array_values($sessionParams);
// reset keys
开发者ID:nicolargo,项目名称:frontend,代码行数:31,代码来源:initialize.php
示例17: p
}
function p($data)
{
echo "<pre>" . print_r($data, true) . "</pre>";
}
getRoute()->get('/', 'home', 'insecure');
//user
getApi()->get('/users', array('users', 'getAll'), 'secure', EpiApi::external);
getApi()->get('/users/self', array('users', 'getSelf'), 'secure', EpiApi::external);
getApi()->get('/users/(\\d+)', array('users', 'get'), 'secure', EpiApi::external);
getApi()->get('/users/relations', array('users', 'relations'), 'secure', EpiApi::external);
getApi()->get('/users/relationsng', array('users', 'relationsng'), 'secure', EpiApi::external);
getApi()->get('/users/phone/(\\w+)', array('users', 'phonenumber'), 'secure', EpiApi::external);
//group
//event
getApi()->get('/events', array('events', 'getng'), 'secure', EpiApi::external);
getApi()->get('/events/all', array('events', 'getAll'), 'secure', EpiApi::external);
getApi()->get('/events/(\\d+)', array('events', 'getng'), 'secure', EpiApi::external);
getApi()->get('/events/shortname/(\\w+)', array('events', 'getShort'), 'secure', EpiApi::external);
require_once "src/Epi.php";
try {
response(getRoute()->run('/' . implode($request, '/')));
} catch (Exception $err) {
// Make sure we always change the respose code to something else than 200
if (http_response_code() == 200) {
http_response_code(500);
}
$err = array('error' => $err->getMessage(), 'file' => $err->getFile(), 'line' => $err->getLine());
response($err);
}
die;
开发者ID:Hulth,项目名称:API,代码行数:31,代码来源:router.php
示例18: showResult
*/
echo 'Cordoba -> Edinburgh' . "<br>";
showResult(getRoute('Cordoba', 'Edinburgh', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Edinburgh -> Cordoba' . "<br>";
showResult(getRoute('Edinburgh', 'Cordoba', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Cordoba -> Astana' . "<br>";
showResult(getRoute('Cordoba', 'Astana', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Astana -> Cordoba' . "<br>";
showResult(getRoute('Astana', 'Cordoba', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Moscow -> Astana' . "<br>";
showResult(getRoute('Moscow', 'Astana', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Astana -> Moscow' . "<br>";
showResult(getRoute('Astana', 'Moscow', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Edinburgh -> Moscow' . "<br>";
showResult(getRoute('Edinburgh', 'Moscow', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Cordoba -> Moscow' . "<br>";
showResult(getRoute('Cordoba', 'Moscow', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Astana -> Dusseldorf' . "<br>";
showResult(getRoute('Astana', 'Dusseldorf', $test));
echo '-----------------------------------------------------------------------' . "<br>";
echo 'Dusseldorf -> Edinburgh' . "<br>";
showResult(getRoute('Dusseldorf', 'Edinburgh', $test));
echo '-----------------------------------------------------------------------' . "<br>";
开发者ID:bigler,项目名称:test_lab,代码行数:31,代码来源:test_final.php
示例19: getRoute
<?php
require 'vendor/autoload.php';
Epi::init('template', 'route');
Epi::setPath('view', 'templates');
getRoute()->get('/', array('DomainChecker', 'Run'));
getRoute()->run();
class DomainChecker
{
public static function Run()
{
if (file_exists("cache.json")) {
$cache = json_decode(file_get_contents("cache.json"), true);
} else {
$cache = array();
}
$tlds = explode(",", isset($_GET['tlds']) ? $_GET['tlds'] : "com,co.uk,net,org");
$domains = explode(",", isset($_GET['domains']) ? $_GET['domains'] : "");
$whois = new Whois();
$rows = array();
foreach ($domains as $domain) {
if (strlen($domain) == 0) {
continue;
}
$results = array();
$domain = trim($domain);
$alltaken = true;
foreach ($tlds as $tld) {
if (array_key_exists($domain . "." . $tld, $cache) && $cache[$domain . "." . $tld]['time'] > time() - 60 * 60 * 24) {
$info = $cache[$domain . "." . $tld]['data'];
} else {
开发者ID:BenWoodford,项目名称:DomainCheck,代码行数:31,代码来源:index.php
示例20: nextStation
function nextStation($userID, $station)
{
$route = getRoute($userID);
if ($route == 1 && $station < 17) {
return $station + 1;
}
if ($route == 2 && $station < 26) {
return $station + 1;
}
if ($route == 1) {
return 11;
}
if ($route == 2) {
return 21;
}
return -1;
}
开发者ID:mapsir,项目名称:Live_Tracking_System,代码行数:17,代码来源:stateUpdate.php
注:本文中的getRoute函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论