文件在/system/core/plugins.php
$dir_handle = opendir($this->plugins_path);
while (($file = readdir($dir_handle)) !== false)
{
if ($file != '.' AND $file != '..' AND is_dir($file))
{
$config_file = $this->plugins_path . $file . '/config.php';
if (file_exists($config_file))
{
$aws_plugin = false;
require_once($config_file);
if (is_array($aws_plugin) AND G_VERSION_BUILD >= $aws_plugin['requirements'])
{
if ($aws_plugin['contents']['model'])
{
$this->plugins_model[$aws_plugin['contents']['model']['class_name']] = $this->plugins_path . $file . '/' . $aws_plugin['contents']['model']['include'];
}
foreach ($aws_plugin['contents']['setups'] AS $key => $data)
{
if ($data['app'] AND $data['controller'] AND $data['include'])
{
$this->plugins_table[$data['app']][$data['controller']]['setup'][] = array(
'file' => $this->plugins_path . $file . '/' . $data['include'],
);
}
}
foreach ($aws_plugin['contents']['actions'] AS $key => $data)
{
if ($data['app'] AND $data['controller'] AND $data['include'])
{
$this->plugins_table[$data['app']][$data['controller']][$data['action']][] = array(
'file' => $this->plugins_path . $file . '/' . $data['include'],
'template' => $data['template']
);
}
}
$this->plugins[$file] = $aws_plugin;
}
}
}
}
closedir($dir_handle);
其中is_dir永远为false;
需要改为以下的方式判断:
$dir_handle = opendir ( $this->plugins_path );
while ( ($file = readdir ( $dir_handle )) !== false ) {
if ($file != '.' && $file != '..' && $file != '.svn') {
$entry = $this->plugins_path . $file;
if (is_dir ( $entry )) {
$config_file = $entry . '/config.php';
if (file_exists ( $config_file )) {
$aws_plugin = false;
require_once ($config_file);
if (is_array ( $aws_plugin ) and G_VERSION_BUILD >= $aws_plugin ['requirements']) {
if ($aws_plugin ['contents'] ['model']) {
$this->plugins_model [$aws_plugin ['contents'] ['model'] ['class_name']] = $entry . '/' . $aws_plugin ['contents'] ['model'] ['include'];
}
foreach ( $aws_plugin ['contents'] ['setups'] as $key => $data ) {
if ($data ['app'] and $data ['controller'] and $data ['include']) {
$this->plugins_table [$data ['app']] [$data ['controller']] ['setup'] [] = array ('file' => $entry . '/' . $data ['include'] );
}
}
foreach ( $aws_plugin ['contents'] ['actions'] as $key => $data ) {
if ($data ['app'] and $data ['controller'] and $data ['include']) {
$this->plugins_table [$data ['app']] [$data ['controller']] [$data ['action']] [] = array ('file' => $entry . '/' . $data ['include'], 'template' => $data ['template'] );
}
}
$this->plugins [$file] = $aws_plugin;
}
}
}
}
}
closedir ( $dir_handle );
阅读全文
收起全文