当前位置: 首页>>代码示例>>PHP>>正文


PHP getRoute函数代码示例

本文整理汇总了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;
     }
 }
开发者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


注:本文中的getRoute函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。