本文整理汇总了PHP中WFController::authorize方法的典型用法代码示例。如果您正苦于以下问题:PHP WFController::authorize方法的具体用法?PHP WFController::authorize怎么用?PHP WFController::authorize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WFController
的用法示例。
在下文中一共展示了WFController::authorize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ucfirst
if (file_exists($controllerPath)) {
require_once $controllerPath;
$controllerClass = 'WFController' . ucfirst($view);
$controller = new $controllerClass(array('base_path' => WF_ADMINISTRATOR));
// load default controller
} else {
$controller = new WFController(array('base_path' => WF_ADMINISTRATOR));
}
// check Authorisations
switch ($view) {
case 'editor':
case 'help':
case 'popup':
break;
default:
$app = JFactory::getApplication();
if ($app->isAdmin() === false) {
$app->redirect('index.php', WFText::_('ALERTNOTAUTH'), 'error');
}
if ($view == 'cpanel') {
$view = 'manage';
}
// Authorise
$controller->authorize($view);
// check state of extension
$controller->check();
break;
}
// Perform the Request task
$controller->execute($task);
$controller->redirect();
示例2: dirname
jimport('joomla.application.component.controller');
// Require the base controller
require_once dirname(__FILE__) . DS . 'controller.php';
// Load controller
$controllerPath = dirname(__FILE__) . DS . 'controller' . DS . $view . '.php';
if (file_exists($controllerPath)) {
require_once $controllerPath;
$controllerClass = 'WFController' . ucfirst($view);
$controller = new $controllerClass(array('base_path' => dirname(__FILE__)));
// load default controller
} else {
$controller = new WFController(array('base_path' => dirname(__FILE__)));
}
// check Authorisations
switch ($view) {
case 'editor':
case 'help':
case 'popup':
break;
case 'cpanel':
// Authorise
$controller->authorize('admin');
break;
default:
// Authorise
$controller->authorize($view);
break;
}
// Perform the Request task
$controller->execute($task);
$controller->redirect();