本文整理汇总了PHP中api::permit方法的典型用法代码示例。如果您正苦于以下问题:PHP api::permit方法的具体用法?PHP api::permit怎么用?PHP api::permit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api
的用法示例。
在下文中一共展示了api::permit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
define('DINGO_VERSION', '0.7.1');
// Start buffer
ob_start();
// Autoloading files
require_once SYSTEM . '/core/core.php';
require_once SYSTEM . '/core/error.php';
spl_autoload_register(array('bootstrap', 'autoload'));
bootstrap::addPackage(SYSTEM . '/core');
bootstrap::addPackage(SYSTEM . '/library');
bootstrap::addPackage(APPLICATION . '/');
load::library('db');
require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/config.php';
set_error_handler('dingo_error');
set_exception_handler('dingo_exception');
// Load route configuration
require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/route.php';
set_error_handler('dingo_error');
set_exception_handler('dingo_exception');
config::set('system', SYSTEM);
config::set('application', APPLICATION);
config::set('config', CONFIG);
// Load route configuration
require_once APPLICATION . '/' . CONFIG . '/' . CONFIGURATION . '/route.php';
// Get route
$uri = route::get(bootstrap::get_request_url());
// Set current page
define('CURRENT_PAGE', $uri['string']);
// Validate
if (!route::valid($uri)) {
load::error('general', 'Invalid URL', 'The requested URL contains invalid characters.');
}
// Load Controller
//----------------------------------------------------------------------------------------------
// Initialize controller
$tmp = "{$uri['controller_class']}_controller";
if (!class_exists($tmp)) {
load::error('404');
}
$controller = new $tmp();
unset($tmp);
// Check if using valid REST API
if (api::get()) {
if (!empty($controller->controller_api) and is_array($controller->controller_api) and !empty($controller->controller_api[$uri['function']]) and is_array($controller->controller_api[$uri['function']])) {
foreach ($controller->controller_api[$uri['function']] as $e) {
api::permit($e);
}
if (!api::allowed(api::get())) {
load::error('404');
}
} else {
load::error('404');
}
}
// Autoload Components
bootstrap::autoload1($controller);
// Check to see if function exists
if (!is_callable(array($controller, $uri['function']))) {
// Try replacing underscores with dashes
$minus_function_name = str_replace('-', '_', $uri['function']);
if (!is_callable(array($controller, $minus_function_name))) {
load::error('404');
} else {
$uri['function'] = $minus_function_name;
}
}
// Run Function
call_user_func_array(array($controller, $uri['function']), $uri['arguments']);
// Display echoed content
ob_end_flush();
}