mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
updating api shell, will now show comments about a method. normalizing paths in configure
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6081 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
101ebba716
commit
39b37c5c34
3 changed files with 143 additions and 147 deletions
|
@ -362,7 +362,7 @@ class ShellDispatcher {
|
||||||
}
|
}
|
||||||
$result = fgets($this->stdin);
|
$result = fgets($this->stdin);
|
||||||
|
|
||||||
if($result === false){
|
if ($result === false){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$result = trim($result);
|
$result = trim($result);
|
||||||
|
@ -439,22 +439,25 @@ class ShellDispatcher {
|
||||||
function __parseParams($params) {
|
function __parseParams($params) {
|
||||||
$count = count($params);
|
$count = count($params);
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
if (!empty($params[$i]) && $params[$i]{0} === '-') {
|
if (isset($params[$i])) {
|
||||||
$key = substr($params[$i], 1);
|
if ($params[$i]{0} === '-') {
|
||||||
$this->params[$key] = true;
|
$key = substr($params[$i], 1);
|
||||||
unset($params[$i]);
|
$this->params[$key] = true;
|
||||||
if(isset($params[++$i])) {
|
unset($params[$i]);
|
||||||
if (!empty($params[$i]) && $params[$i]{0} !== '-') {
|
if (isset($params[++$i])) {
|
||||||
$this->params[$key] = str_replace('"', '', $params[$i]);
|
if ($params[$i]{0} !== '-') {
|
||||||
unset($params[$i]);
|
$this->params[$key] = str_replace('"', '', $params[$i]);
|
||||||
} else {
|
unset($params[$i]);
|
||||||
$i--;
|
} else {
|
||||||
$this->__parseParams($params);
|
$i--;
|
||||||
|
$this->__parseParams($params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->args[] = $params[$i];
|
||||||
|
unset($params[$i]);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->args[] = $params[$i];
|
|
||||||
unset($params[$i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,72 +66,74 @@ class ApiShell extends Shell {
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
return $this->help();
|
return $this->help();
|
||||||
}
|
}
|
||||||
if (count($this->args) == 1 && in_array($this->args[0], array_keys($this->paths))) {
|
|
||||||
$this->args[1] = $this->args[0];
|
$type = low($this->args[0]);
|
||||||
|
|
||||||
|
if (!isset($this->paths[$type])) {
|
||||||
|
$this->err(sprintf(__("%s could not be found", true), $path));
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) > 1) {
|
$path = $this->paths[$type];
|
||||||
$path = $this->args[0];
|
|
||||||
$class = $this->args[1];
|
|
||||||
|
|
||||||
$this->__loadDependencies($path);
|
if (count($this->args) == 1) {
|
||||||
|
$file = $type;
|
||||||
if (in_array(low($path), array('behavior', 'component', 'helper')) && low($path) !== low($class)) {
|
$class = Inflector::camelize($type);
|
||||||
if (!preg_match('/' . Inflector::camelize($path) . '$/', $class)) {
|
} elseif (count($this->args) > 1) {
|
||||||
$class .= Inflector::camelize($path);
|
$file = Inflector::underscore($this->args[1]);
|
||||||
}
|
$class = Inflector::camelize($file);
|
||||||
} elseif (low($path) === low($class)) {
|
|
||||||
$class = Inflector::camelize($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->paths[low($path)])) {
|
|
||||||
$path = $this->paths[low($path)];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$class = $this->args[0];
|
|
||||||
$path = LIBS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_readable($path) || !is_dir($path)) {
|
$objects = Configure::listObjects('class', $path);
|
||||||
$this->err(sprintf(__('Path %s could not be accessed', true), $path));
|
if (in_array($class, $objects)) {
|
||||||
return;
|
if (in_array($type, array('behavior', 'component', 'helper')) && $type !== $file) {
|
||||||
}
|
if (!preg_match('/' . Inflector::camelize($type) . '$/', $class)) {
|
||||||
|
$class .= Inflector::camelize($type);
|
||||||
$File = null;
|
|
||||||
|
|
||||||
$candidates = array(
|
|
||||||
Inflector::underscore($class),
|
|
||||||
substr(Inflector::underscore($class), 0, strpos(Inflector::underscore($class), '_'))
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($candidates as $candidate) {
|
|
||||||
$File =& new File($path . $candidate . '.php');
|
|
||||||
|
|
||||||
if ($File->exists()) {
|
|
||||||
if (!class_exists($class)) {
|
|
||||||
include_once($File->pwd());
|
|
||||||
}
|
|
||||||
if (class_exists($class)) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$File = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($File)) {
|
$parsed = $this->__parseClass($path . $file .'.php');
|
||||||
$this->err(sprintf(__('No file for class %s could be found', true), $class));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parsed = $this->__parseClass($File, $class);
|
|
||||||
|
|
||||||
if (!empty($parsed)) {
|
if (!empty($parsed)) {
|
||||||
$this->out(ucwords($class));
|
if (isset($this->params['m'])) {
|
||||||
$this->hr();
|
if (!isset($parsed[$this->params['m']])) {
|
||||||
|
$this->err(sprintf(__("%s::%s() could not be found", true), $class, $this->params['m']));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$method = $parsed[$this->params['m']];
|
||||||
|
$this->out($class .'::'.$method['method'] . $method['parameters']);
|
||||||
|
$this->hr();
|
||||||
|
$this->out($method['comment'], true);
|
||||||
|
} else {
|
||||||
|
$this->out(ucwords($class));
|
||||||
|
$this->hr();
|
||||||
|
$i = 0;
|
||||||
|
foreach ($parsed as $method) {
|
||||||
|
$list[] = ++$i . ". " . $method['method'] . $method['parameters'];
|
||||||
|
}
|
||||||
|
$this->out($list);
|
||||||
|
|
||||||
foreach ($parsed as $method) {
|
$methods = array_keys($parsed);
|
||||||
$this->out("\t" . $method['method'] . "(" . $method['parameters'] . ")", true);
|
while ($number = $this->in(__('Select a number to see the more information about a specific method. q to quit. l to list.', true), null, 'q')) {
|
||||||
|
if ($number === 'q') {
|
||||||
|
$this->out(__('Done', true));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($number === 'l') {
|
||||||
|
$this->out($list);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($methods[--$number])) {
|
||||||
|
$method = $parsed[$methods[$number]];
|
||||||
|
$this->hr();
|
||||||
|
$this->out($class .'::'.$method['method'] . $method['parameters']);
|
||||||
|
$this->hr();
|
||||||
|
$this->out($method['comment'], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,7 +144,7 @@ class ApiShell extends Shell {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function help() {
|
function help() {
|
||||||
$head = "Usage: cake api [<path>] <className>\n";
|
$head = "Usage: cake api [<type>] <className> <-m method>\n";
|
||||||
$head .= "-----------------------------------------------\n";
|
$head .= "-----------------------------------------------\n";
|
||||||
$head .= "Parameters:\n\n";
|
$head .= "Parameters:\n\n";
|
||||||
|
|
||||||
|
@ -182,60 +184,32 @@ class ApiShell extends Shell {
|
||||||
* @return array Methods and signatures indexed by method name
|
* @return array Methods and signatures indexed by method name
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __parseClass(&$File, $class) {
|
function __parseClass($path) {
|
||||||
$parsed = array();
|
$parsed = array();
|
||||||
|
|
||||||
if (get_parent_class($class)) {
|
$File = new File($path);
|
||||||
$methods = am(array(), array_diff(get_class_methods($class), get_class_methods(get_parent_class($class))));
|
if (!$File->exists()) {
|
||||||
} else {
|
$this->err(sprintf(__("%s could not be found", true), $File->name));
|
||||||
$methods = get_class_methods($class);
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = $File->read();
|
$contents = $File->read();
|
||||||
|
|
||||||
foreach ($methods as $method) {
|
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
|
||||||
if (strpos($method, '__') !== 0 && strpos($method, '_') !== 0) {
|
foreach($result[2] as $key => $method) {
|
||||||
$regex = array(
|
$method = str_replace('function ', '', trim($method));
|
||||||
'/\s+function\s+(' . preg_quote($method, '/') . ')\s*\(([^{]*)\)\s*{/is',
|
|
||||||
'/\s+function\s+(' . preg_quote('&' . $method, '/') . ')\s*\(([^{]*)\)\s*{/is'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (preg_match($regex[0], $contents, $matches) || preg_match($regex[1], $contents, $matches)) {
|
if (strpos($method, '__') === false && strpos($method, '_') !== 0) {
|
||||||
$parsed[$method] = array(
|
$parsed[$method] = array(
|
||||||
'method' => trim($matches[1]),
|
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
|
||||||
'parameters' => trim($matches[2])
|
'method' => $method,
|
||||||
);
|
'parameters' => trim($result[3][$key]),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort($parsed);
|
ksort($parsed);
|
||||||
return $parsed;
|
return $parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load dependencies for given element (controller/component/helper)
|
|
||||||
*
|
|
||||||
* @param string $element Element to load dependency for
|
|
||||||
* @access private
|
|
||||||
*/
|
|
||||||
function __loadDependencies($element) {
|
|
||||||
switch(low($element)) {
|
|
||||||
case 'behavior':
|
|
||||||
App::import('Model', 'AppModel');
|
|
||||||
App::import('Model', 'ModelBehavior');
|
|
||||||
break;
|
|
||||||
case 'controller':
|
|
||||||
App::import('Controller', 'AppController');
|
|
||||||
break;
|
|
||||||
case 'component':
|
|
||||||
break;
|
|
||||||
case 'helper':
|
|
||||||
App::import('Helper', 'AppHelper');
|
|
||||||
break;
|
|
||||||
case 'model':
|
|
||||||
App::import('Model', 'ModelBehavior');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -36,12 +36,19 @@
|
||||||
*/
|
*/
|
||||||
class Configure extends Object {
|
class Configure extends Object {
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to view files
|
* Hold array with paths to model files
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $viewPaths = array();
|
var $modelPaths = array();
|
||||||
|
/**
|
||||||
|
* Hold array with paths to behavior files
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $behaviorPaths = array();
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to controller files
|
* Hold array with paths to controller files
|
||||||
*
|
*
|
||||||
|
@ -50,12 +57,19 @@ class Configure extends Object {
|
||||||
*/
|
*/
|
||||||
var $controllerPaths = array();
|
var $controllerPaths = array();
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to model files
|
* Hold array with paths to component files
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $modelPaths = array();
|
var $componentPaths = array();
|
||||||
|
/**
|
||||||
|
* Hold array with paths to view files
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
var $viewPaths = array();
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to helper files
|
* Hold array with paths to helper files
|
||||||
*
|
*
|
||||||
|
@ -64,19 +78,19 @@ class Configure extends Object {
|
||||||
*/
|
*/
|
||||||
var $helperPaths = array();
|
var $helperPaths = array();
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to component files
|
* Hold array with paths to plugins
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $componentPaths = array();
|
var $pluginPaths = array();
|
||||||
/**
|
/**
|
||||||
* Hold array with paths to behavior files
|
* Hold array with paths to vendor files
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
var $behaviorPaths = array();
|
var $vendorPaths = array();
|
||||||
/**
|
/**
|
||||||
* Current debug level
|
* Current debug level
|
||||||
*
|
*
|
||||||
|
@ -126,7 +140,7 @@ class Configure extends Object {
|
||||||
$extension = false;
|
$extension = false;
|
||||||
$name = $type;
|
$name = $type;
|
||||||
|
|
||||||
if($type === 'file' && !$path) {
|
if ($type === 'file' && !$path) {
|
||||||
return false;
|
return false;
|
||||||
} elseif ($type === 'file') {
|
} elseif ($type === 'file') {
|
||||||
$extension = true;
|
$extension = true;
|
||||||
|
@ -142,9 +156,13 @@ class Configure extends Object {
|
||||||
|
|
||||||
$types = array(
|
$types = array(
|
||||||
'model' => array('suffix' => '.php', 'base' => 'AppModel'),
|
'model' => array('suffix' => '.php', 'base' => 'AppModel'),
|
||||||
|
'behavior' => array('suffix' => '.php', 'base' => 'ModelBehavior'),
|
||||||
'controller' => array('suffix' => '_controller.php', 'base' => 'AppController'),
|
'controller' => array('suffix' => '_controller.php', 'base' => 'AppController'),
|
||||||
|
'component' => array('suffix' => '.php', 'base' => null),
|
||||||
|
'view' => array('suffix' => '.php', 'base' => null),
|
||||||
'helper' => array('suffix' => '.php', 'base' => 'AppHelper'),
|
'helper' => array('suffix' => '.php', 'base' => 'AppHelper'),
|
||||||
'plugin' => array('suffix' => '', 'base' => null),
|
'plugin' => array('suffix' => '', 'base' => null),
|
||||||
|
'vendor' => array('suffix' => '', 'base' => null),
|
||||||
'class' => array('suffix' => '.php', 'base' => null),
|
'class' => array('suffix' => '.php', 'base' => null),
|
||||||
'file' => array('suffix' => '.php', 'base' => null)
|
'file' => array('suffix' => '.php', 'base' => null)
|
||||||
);
|
);
|
||||||
|
@ -161,7 +179,6 @@ class Configure extends Object {
|
||||||
$search = array_merge(array(APP), $_this->corePaths($type));
|
$search = array_merge(array(APP), $_this->corePaths($type));
|
||||||
|
|
||||||
foreach ($search as $delete) {
|
foreach ($search as $delete) {
|
||||||
|
|
||||||
if (is_array($path) && in_array($delete, $path)) {
|
if (is_array($path) && in_array($delete, $path)) {
|
||||||
$remove = array_flip($path);
|
$remove = array_flip($path);
|
||||||
unset($remove[$delete]);
|
unset($remove[$delete]);
|
||||||
|
@ -174,7 +191,7 @@ class Configure extends Object {
|
||||||
$objects = am($items, $objects);
|
$objects = am($items, $objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($type !== 'file') {
|
if ($type !== 'file') {
|
||||||
$objects = array_map(array(&$Inflector, 'camelize'), $objects);
|
$objects = array_map(array(&$Inflector, 'camelize'), $objects);
|
||||||
}
|
}
|
||||||
$_this->__objects[$name] = $objects;
|
$_this->__objects[$name] = $objects;
|
||||||
|
@ -190,14 +207,14 @@ class Configure extends Object {
|
||||||
* @return array List of directories or files in directory
|
* @return array List of directories or files in directory
|
||||||
*/
|
*/
|
||||||
function __list($path, $suffix = false, $extension = false) {
|
function __list($path, $suffix = false, $extension = false) {
|
||||||
if(!class_exists('folder')) {
|
if (!class_exists('folder')) {
|
||||||
uses('folder');
|
uses('folder');
|
||||||
}
|
}
|
||||||
$items = array();
|
$items = array();
|
||||||
$Folder =& new Folder($path);
|
$Folder =& new Folder($path);
|
||||||
$contents = $Folder->read(false, true);
|
$contents = $Folder->read(false, true);
|
||||||
if (is_array($contents)) {
|
if (is_array($contents)) {
|
||||||
if(!$suffix) {
|
if (!$suffix) {
|
||||||
return $contents[0];
|
return $contents[0];
|
||||||
} else {
|
} else {
|
||||||
foreach($contents[1] as $item) {
|
foreach($contents[1] as $item) {
|
||||||
|
@ -357,7 +374,7 @@ class Configure extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$found) {
|
if (!$found) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,13 +547,15 @@ class Configure extends Object {
|
||||||
$_this =& Configure::getInstance();
|
$_this =& Configure::getInstance();
|
||||||
$core = $_this->corePaths();
|
$core = $_this->corePaths();
|
||||||
$basePaths = array(
|
$basePaths = array(
|
||||||
'plugin' => APP . 'plugins' . DS,
|
'model' => array(MODELS),
|
||||||
'behavior' => array(BEHAVIORS),
|
'behavior' => array(BEHAVIORS),
|
||||||
'component' => array(COMPONENTS),
|
|
||||||
'helper' => array(HELPERS),
|
|
||||||
'controller' => array(CONTROLLERS),
|
'controller' => array(CONTROLLERS),
|
||||||
|
'component' => array(COMPONENTS),
|
||||||
'view' => array(VIEWS),
|
'view' => array(VIEWS),
|
||||||
'model' => array(MODELS));
|
'helper' => array(HELPERS),
|
||||||
|
'plugin' => array(APP . 'plugins' . DS),
|
||||||
|
'vendor' => array(APP . 'vendors' . DS, VENDORS),
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($basePaths as $type => $default) {
|
foreach ($basePaths as $type => $default) {
|
||||||
$pathsVar = $type . 'Paths';
|
$pathsVar = $type . 'Paths';
|
||||||
|
@ -571,7 +590,7 @@ class Configure extends Object {
|
||||||
*/
|
*/
|
||||||
function __loadBootstrap($boot) {
|
function __loadBootstrap($boot) {
|
||||||
$_this =& Configure::getInstance(false);
|
$_this =& Configure::getInstance(false);
|
||||||
$modelPaths = $viewPaths = $controllerPaths = $helperPaths = $componentPaths = $behaviorPaths = $pluginPaths = null;
|
$modelPaths = $behaviorPaths = $controllerPaths = $componentPaths = $viewPaths = $helperPaths = $pluginPaths = $vendorPaths = null;
|
||||||
|
|
||||||
if ($boot) {
|
if ($boot) {
|
||||||
$_this->write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR));
|
$_this->write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR));
|
||||||
|
@ -586,7 +605,7 @@ class Configure extends Object {
|
||||||
|
|
||||||
if ($_this->read('Cache.disable') !== true) {
|
if ($_this->read('Cache.disable') !== true) {
|
||||||
$cache = Cache::settings();
|
$cache = Cache::settings();
|
||||||
if(empty($cache)) {
|
if (empty($cache)) {
|
||||||
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
|
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
|
||||||
list($engine, $cache) = Cache::config('default', array('engine' => 'File'));
|
list($engine, $cache) = Cache::config('default', array('engine' => 'File'));
|
||||||
}
|
}
|
||||||
|
@ -747,7 +766,7 @@ class App extends Object {
|
||||||
$tempType = $value[0];
|
$tempType = $value[0];
|
||||||
$plugin = $value[1] . '.';
|
$plugin = $value[1] . '.';
|
||||||
$class = $value[2];
|
$class = $value[2];
|
||||||
} elseif ($count === 2 && ($type === 'Core' || $type === 'File')){
|
} elseif ($count === 2 && ($type === 'Core' || $type === 'File')) {
|
||||||
$tempType = $value[0];
|
$tempType = $value[0];
|
||||||
$class = $value[1];
|
$class = $value[1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -775,7 +794,7 @@ class App extends Object {
|
||||||
if ($load = $_this->__mapped($name . $ext['class'], $type, $plugin)) {
|
if ($load = $_this->__mapped($name . $ext['class'], $type, $plugin)) {
|
||||||
if ($_this->__load($load)) {
|
if ($_this->__load($load)) {
|
||||||
$_this->__overload($type, $name . $ext['class']);
|
$_this->__overload($type, $name . $ext['class']);
|
||||||
if($_this->return) {
|
if ($_this->return) {
|
||||||
$value = include $load;
|
$value = include $load;
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +832,7 @@ class App extends Object {
|
||||||
$_this->__cache = true;
|
$_this->__cache = true;
|
||||||
$_this->__map($directory . $file, $name . $ext['class'], $type, $plugin);
|
$_this->__map($directory . $file, $name . $ext['class'], $type, $plugin);
|
||||||
$_this->__overload($type, $name . $ext['class']);
|
$_this->__overload($type, $name . $ext['class']);
|
||||||
if( $_this->return) {
|
if ( $_this->return) {
|
||||||
$value = include $directory . $file;
|
$value = include $directory . $file;
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
@ -894,7 +913,7 @@ class App extends Object {
|
||||||
function __load($file) {
|
function __load($file) {
|
||||||
$_this =& App::getInstance();
|
$_this =& App::getInstance();
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
if(!$_this->return) {
|
if (!$_this->return) {
|
||||||
require($file);
|
require($file);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1000,9 +1019,10 @@ class App extends Object {
|
||||||
}
|
}
|
||||||
return array('class' => null, 'suffix' => null, 'path' => $path);
|
return array('class' => null, 'suffix' => null, 'path' => $path);
|
||||||
break;
|
break;
|
||||||
case 'view':
|
case 'behavior':
|
||||||
|
$_this->import($type, 'Behavior', false);
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$path = $plugin . DS . 'views' . DS;
|
$path = $plugin . DS . 'models' . DS . 'behaviors' . DS;
|
||||||
}
|
}
|
||||||
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
||||||
break;
|
break;
|
||||||
|
@ -1014,23 +1034,22 @@ class App extends Object {
|
||||||
}
|
}
|
||||||
return array('class' => $type, 'suffix' => $type, 'path' => $path);
|
return array('class' => $type, 'suffix' => $type, 'path' => $path);
|
||||||
break;
|
break;
|
||||||
case 'helper':
|
|
||||||
$_this->import($type, 'AppHelper', false);
|
|
||||||
if ($plugin) {
|
|
||||||
$path = $plugin . DS . 'views' . DS . 'helpers' . DS;
|
|
||||||
}
|
|
||||||
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
|
||||||
break;
|
|
||||||
case 'component':
|
case 'component':
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$path = $plugin . DS . 'controllers' . DS . 'components' . DS;
|
$path = $plugin . DS . 'controllers' . DS . 'components' . DS;
|
||||||
}
|
}
|
||||||
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
||||||
break;
|
break;
|
||||||
case 'behavior':
|
case 'view':
|
||||||
$_this->import($type, 'Behavior', false);
|
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$path = $plugin . DS . 'models' . DS . 'behaviors' . DS;
|
$path = $plugin . DS . 'views' . DS;
|
||||||
|
}
|
||||||
|
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
||||||
|
break;
|
||||||
|
case 'helper':
|
||||||
|
$_this->import($type, 'AppHelper', false);
|
||||||
|
if ($plugin) {
|
||||||
|
$path = $plugin . DS . 'views' . DS . 'helpers' . DS;
|
||||||
}
|
}
|
||||||
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
return array('class' => $type, 'suffix' => null, 'path' => $path);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue