function get() { $controllerList = array(); $controllerClasses = listClasses(CONTROLLERS); foreach ($controllerClasses as $controller => $fileName) { list($name) = explode('.', $fileName); $controllerName = Inflector::camelize(str_replace('_controller', '', $name)); $file = CONTROLLERS . $fileName; require_once $file; $className = $controllerName . 'Controller'; $actions = get_class_methods($className); $parentActions = get_class_methods('AppController'); $actions = array_diff($actions, $parentActions); $actions = $this->filterMethods($actions); $controllers[$controllerName] = $actions; } return $controllers; }
function beforeRender() { if (!isset($this->viewVars['data'])) { $this->set('data', $this->data); } if (!$this->_isRequestAction()) { if (!$this->menuItems) { $this->menuItems['Home'] = array('url' => '/'); if ($this->plugin) { $Human = Inflector::humanize($this->plugin); $this->menuItems[$Human]['url'] = '/' . $this->PluginName; $this->menuItems[$Human]['active'] = true; $FileList = listClasses(APP . "plugins" . DS . $this->plugin . DS . "controllers"); foreach ($FileList as $file) { $list = explode("_", $file); unset($list[count($list) - 1]); $controller = implode($list, "_"); if (up($controller) != up($this->plugin)) { $array = array("url" => '/' . $this->PluginName . '/' . Inflector::camelize($controller)); if (Inflector::underscore($this->name) == $controller) { $array['active'] = true; } $this->menuItems[Inflector::humanize($controller)] = $array; } } } else { $this->menuItems['Home']['active'] = true; uses('Folder'); $Folder = new Folder(APP . DS . "plugins"); list($Plugins) = $Folder->ls(); foreach ($Plugins as $Plugin) { $Camel = Inflector::Camelize($Plugin); $Human = Inflector::humanize($Plugin); $this->menuItems[$Human] = array('url' => '/' . $Camel); } } } $this->set('Menu', $this->menuItems); $this->set('javascripts', $this->javascripts); } }
/** * Loads all controllers. */ function loadControllers() { $paths = Configure::getInstance(); if (!class_exists('AppController')) { if (file_exists(APP . 'app_controller.php')) { require APP . 'app_controller.php'; } else { require CAKE . 'app_controller.php'; } } $loadedControllers = array(); foreach ($paths->controllerPaths as $path) { foreach (listClasses($path) as $controller) { list($name) = explode('.', $controller); $className = Inflector::camelize(str_replace('_controller', '', $name)); if (loadController($className)) { $loadedControllers[$controller] = $className; } } } return $loadedControllers; }
function _getControllers($section = APP_DIR, $sectionStatus = 'error', $AclMode = 'full') { $controllers = array(); if ($section == APP_DIR) { $controllerList = listClasses(APP . "/controllers/"); if ($AclMode == 'full') { $acos = $this->Aco->findByAlias(low(APP_DIR)); $sectionPrefix = APP_DIR . ':'; } else { $acos = $this->Aco->findByAlias(low('ROOT')); $sectionPrefix = ''; } } else { $Plugin = low($section); $acos = $this->Aco->findByAlias($Plugin); $sectionPrefix = $Plugin . ':'; $controllerList = listClasses(APP . "/plugins/{$Plugin}/controllers"); } if (empty($acos['Aco']['alias'])) { if ($sectionStatus == 'on') { $status = 'on'; $type = 'inherited'; } else { $status = 'off'; $type = 'off'; } } else { $status = 'on'; $noChildren = ($acos['Aco']['rght'] - $acos['Aco']['lft']) / 2; if ($noChildren > 1) { $type = 'granular'; } else { $type = 'global'; } } foreach ($controllerList as $controller => $file) { list($name) = explode('.', $file); $controllerName = r('_controller', '', $name); $acos = $this->Aco->findByAlias(low($sectionPrefix . $controllerName)); if (empty($acos['Aco']['alias'])) { if ($sectionStatus == 'on') { $status = 'on'; $type = 'inherited'; } else { $status = 'off'; $type = 'off'; } } else { $status = 'on'; $noChildren = ($acos['Aco']['rght'] - $acos['Aco']['lft']) / 2; if ($noChildren > 1) { $type = 'granular'; } else { $type = 'global'; } } $controllers[$controllerName] = array("name" => low($sectionPrefix . $controllerName), "status" => $status, "type" => $type); } return $controllers; }
<html> <body> Your current major is <?php echo $_POST["major"]; ?> <br /> <?php $aClass = $_POST['classestaken']; function listClasses($aClass){ if(empty($aClass)){ echo("nothing"); } else{ for ($i=0; $i<count($aClass); $i++){ echo($aClass[$i] . " "); } } } ?> And you have taken <?php listClasses($_POST["classestaken"]); ?> </body> </html>
/** * Shows console help * * @access public */ function help() { $this->stdout("Current Paths:"); $this->stdout(" -working: " . $this->params['working']); $this->stdout(" -root: " . ROOT); $this->stdout(" -app: " . APP); $this->stdout(" -core: " . CORE_PATH); $this->stdout(""); $this->stdout("Changing Paths:"); $this->stdout("your working path should be the same as your application path"); $this->stdout("to change your path use the '-app' param."); $this->stdout("Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"); $this->stdout("\nAvailable Shells:"); foreach ($this->shellPaths as $path) { if (is_dir($path)) { $shells = listClasses($path); $path = r(CORE_PATH, '', $path); $this->stdout("\n " . $path . ":"); if (empty($shells)) { $this->stdout("\t - none"); } else { foreach ($shells as $shell) { if ($shell != 'shell.php') { $this->stdout("\t " . r('.php', '', $shell)); } } } } } $this->stdout("\nTo run a command, type 'cake shell_name [args]'"); $this->stdout("To get help on a specific command, type 'cake shell_name help'"); exit; }
/** * @deprecated * @see App::import('Model', 'PluginName.PluginModel'); */ function loadPluginModels($plugin) { if (!class_exists('AppModel')) { loadModel(); } $plugin = Inflector::underscore($plugin); $pluginAppModel = Inflector::camelize($plugin . '_app_model'); $pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php'; if (!class_exists($pluginAppModel)) { if (file_exists($pluginAppModelFile)) { require $pluginAppModelFile; Overloadable::overload($pluginAppModel); } } $pluginModelDir = APP . 'plugins' . DS . $plugin . DS . 'models' . DS; if (is_dir($pluginModelDir)) { foreach (listClasses($pluginModelDir) as $modelFileName) { list($name) = explode('.', $modelFileName); $className = Inflector::camelize($name); if (!class_exists($className)) { require $pluginModelDir . $modelFileName; Overloadable::overload($className); } } } trigger_error('loadPluginModels is deprecated see App::import(\'Model\', \'PluginName.PluginModel\');', E_USER_WARNING); }
<Center> <?php $aClass = $_POST['taken']; function listClasses($aClass){ if(empty($aClass)){ echo("nothing"); } else{ for ($i=0; $i<count($aClass); $i++){ echo($aClass[$i] . "<br>"); } } } ?> You have taken:<br> <?php listClasses($_POST["taken"]); ?> </Center> <p> </p> </div> <!-- end #content --> <div id="footer"> <p>Copyright © 2012 Serious Business</a></p> </div> <!-- end #footer --> </div> <!-- End #wrapper -->