Created
June 10, 2011 14:47
-
-
Save splittingred/1018976 to your computer and use it in GitHub Desktop.
base Resource manager controller class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class ResourceManagerController extends modManagerController { | |
public static function getInstance(modX &$modx,$className,array $config = array()) { | |
if (!empty($_REQUEST['class_key'])) { | |
$resourceClass = str_replace(array('../','..','/','\\'),'',$_REQUEST['class_key']); | |
$delegateView = $modx->call($resourceClass,'getControllerPath',array(&$modx)); | |
$action = strtolower(str_replace(array('Resource','ManagerController'),'',$className)); | |
$className = str_replace('mod','',$resourceClass).ucfirst($action).'ManagerController'; | |
$controllerFile = $delegateView.$action.'.class.php'; | |
require_once $controllerFile; | |
} | |
$controller = new $className($modx,$config); | |
return $controller; | |
} | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment