mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-02 09:32:43 +00:00
Removing need for plugins to need a model
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4485 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
24fd9b1e9b
commit
1c07701223
1 changed files with 10 additions and 10 deletions
|
@ -89,26 +89,26 @@
|
|||
if(!class_exists('AppModel')){
|
||||
loadModel();
|
||||
}
|
||||
|
||||
$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);
|
||||
} else {
|
||||
die(sprintf(__("Plugins must have a class named %s", true), $pluginAppModel));
|
||||
Overloadable::overload($pluginAppModel);
|
||||
}
|
||||
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);
|
||||
|
||||
foreach(listClasses($pluginModelDir)as $modelFileName) {
|
||||
list($name) = explode('.', $modelFileName);
|
||||
$className = Inflector::camelize($name);
|
||||
|
||||
if (!class_exists($className)) {
|
||||
require($pluginModelDir . $modelFileName);
|
||||
Overloadable::overload($className);
|
||||
if (!class_exists($className)) {
|
||||
require($pluginModelDir . $modelFileName);
|
||||
Overloadable::overload($className);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue