本文整理汇总了PHP中Env::getControllerClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::getControllerClass方法的具体用法?PHP Env::getControllerClass怎么用?PHP Env::getControllerClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::getControllerClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: useController
/**
* Find and include specific controller based on controller name
*
* @access public
* @param string $controller_name
* @return boolean
* @throws FileDnxError if controller file does not exists
*
*/
static function useController($controller_name) {
$controller_class = Env::getControllerClass($controller_name);
// Search For Plugin. Execute it if found
$plugins = Plugins::instance()->getActive() ;
$pluginName = null ;
foreach ($plugins as $plugin) {
/* @var $plugin Plugin */
$systemName = $plugin->getSystemName() ;
//$controller_file = ROOT."/plugins/$pluginName/application/controllers/$controller_class.class.php";
$controller_file = $plugin->getControllerPath()."$controller_class.class.php";
//echo $controller_file ."<br/>";
if (is_file($controller_file)){
$pluginName = $plugin ;
Plugins::instance()->setCurrent($plugin) ;
include_once $controller_file;
return true ;
}
}
// Plugin not found - Search for core controller
if(class_exists($controller_class, false)) return true;
$controller_file = APPLICATION_PATH . "/controllers/$controller_class.class.php";
if(is_file($controller_file)) {
include_once $controller_file;
return true;
} else {
throw new FileDnxError($controller_file, "Controller '$controller_name' does not exists (expected location '$controller_file')");
} // if
} // useController
示例2: useController
/**
* Find and include specific controller based on controller name
*
* @access public
* @param string $controller_name
* @return boolean
* @throws FileDnxError if controller file does not exists
*/
static function useController($controller_name)
{
$controller_class = Env::getControllerClass($controller_name);
if (class_exists($controller_class, false)) {
return true;
}
$controller_file = APPLICATION_PATH . "/controllers/{$controller_class}.class.php";
if (is_file($controller_file)) {
include_once $controller_file;
return true;
} else {
throw new FileDnxError($controller_file, "Controller '{$controller_name}' does not exists (expected location '{$controller_file}')");
}
// if
}
示例3: getControllerPath
/**
* Get Controller File Path, looks for controller file and returns the path
*
* @access public
* @param string $controller_name
* @return boolean
* @throws FileDnxError if controller file does not exists
*/
static function getControllerPath($controller_name)
{
trace(__FILE__, "getControllerPath({$controller_name})");
$controller_class = Env::getControllerClass($controller_name);
$controller_file = APPLICATION_PATH . "/controllers/{$controller_class}.class.php";
trace(__FILE__, "getControllerPath({$controller_name}) - core: {$controller_file}");
$controller_file_plugin = APPLICATION_PATH . "/plugins/{$controller_name}/controllers/{$controller_class}.class.php";
trace(__FILE__, "getControllerPath({$controller_name}) - plugin: {$controller_file_plugin}");
if (is_file($controller_file)) {
return $controller_file;
} else {
if (is_file($controller_file_plugin)) {
return $controller_file_plugin;
} else {
throw new FileDnxError($controller_file, "Controller '{$controller_name}' does not exists (expected location '{$controller_file}' or '{$controller_file_plugin}')");
}
}
}
示例4: getControllerPath
/**
* Get Controller File Path, looks for controller file and returns the path
*
* @access public
* @param string $controller_name
* @return boolean
* @throws FileDnxError if controller file does not exists
*/
static function getControllerPath($controller_name) {
trace(__FILE__,"getControllerPath($controller_name)");
$controller_class = Env::getControllerClass($controller_name);
$controller_file = APPLICATION_PATH . "/controllers/$controller_class.class.php";
trace(__FILE__,"getControllerPath($controller_name) - core: $controller_file");
$controller_file_plugin = APPLICATION_PATH . "/plugins/$controller_name/controllers/$controller_class.class.php";
trace(__FILE__,"getControllerPath($controller_name) - plugin: $controller_file_plugin");
if (is_file($controller_file)) return $controller_file;
else if (is_file($controller_file_plugin)) return $controller_file_plugin;
else throw new FileDnxError($controller_file, "Controller '$controller_name' does not exists (expected location '$controller_file' or '$controller_file_plugin')");
} // getControllerFilePath