mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-17 07:10:48 +03:00
fix use of function GLOB
This commit is contained in:
parent
0f43cfa37b
commit
04dc8a120a
|
@ -136,7 +136,7 @@ if($aPluginsList=@file($sPluginsListFile)) {
|
|||
$aPluginsList=array_map('trim',$aPluginsList);
|
||||
foreach ($aPluginsList as $sPlugin) {
|
||||
$aConfigFiles = glob($sPluginsDir.'/'.$sPlugin.'/config/*.php');
|
||||
if(count($aConfigFiles)>0) {
|
||||
if($aConfigFiles and count($aConfigFiles)>0) {
|
||||
$aConfig=array();
|
||||
foreach ($aConfigFiles as $sPath) {
|
||||
$aConfig = include($sPath);
|
||||
|
|
|
@ -51,16 +51,17 @@ abstract class ActionPlugin extends Action {
|
|||
* Проверяем в списке шаблонов
|
||||
*/
|
||||
$aMatches[1]=strtolower($aMatches[1]);
|
||||
$sTemplateName=in_array(
|
||||
$aPaths=glob(Config::Get('path.root.server').'/plugins/'.$aMatches[1].'/templates/skin/*/actions/Action'.ucfirst($aMatches[2]),GLOB_ONLYDIR);
|
||||
$sTemplateName=($aPaths and in_array(
|
||||
Config::Get('view.skin'),
|
||||
array_map(
|
||||
create_function(
|
||||
'$sPath',
|
||||
'preg_match("/skin\/([\w]+)\/actions/i",$sPath,$aMatches); return $aMatches[1];'
|
||||
),
|
||||
glob(Config::Get('path.root.server').'/plugins/'.$aMatches[1].'/templates/skin/*/actions/Action'.ucfirst($aMatches[2]),GLOB_ONLYDIR)
|
||||
$aPaths
|
||||
)
|
||||
)
|
||||
))
|
||||
? Config::Get('view.skin')
|
||||
: 'default';
|
||||
|
||||
|
|
|
@ -187,7 +187,8 @@ abstract class Plugin extends Object {
|
|||
? strtolower($aMatches[1])
|
||||
: strtolower($sName);
|
||||
if(!isset(self::$aTemplatePath[$sName])) {
|
||||
$sTemplateName=in_array(Config::Get('view.skin'),array_map('basename',glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR)))
|
||||
$aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR);
|
||||
$sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths)))
|
||||
? Config::Get('view.skin')
|
||||
: 'default';
|
||||
|
||||
|
@ -208,7 +209,8 @@ abstract class Plugin extends Object {
|
|||
? strtolower($aMatches[1])
|
||||
: strtolower($sName);
|
||||
if(!isset(self::$aTemplateWebPath[$sName])) {
|
||||
$sTemplateName=in_array(Config::Get('view.skin'),array_map('basename',glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR)))
|
||||
$aPaths=glob(Config::Get('path.root.server').'/plugins/'.$sName.'/templates/skin/*',GLOB_ONLYDIR);
|
||||
$sTemplateName=($aPaths and in_array(Config::Get('view.skin'),array_map('basename',$aPaths)))
|
||||
? Config::Get('view.skin')
|
||||
: 'default';
|
||||
|
||||
|
|
|
@ -249,15 +249,15 @@ function func_rmdir($sPath) {
|
|||
if(!is_dir($sPath)) return true;
|
||||
$sPath = rtrim($sPath,'/').'/';
|
||||
|
||||
$aFiles = glob($sPath.'*', GLOB_MARK);
|
||||
foreach($aFiles as $sFile ) {
|
||||
if(substr($sFile, -1) == '/') {
|
||||
func_rmdir($sFile);
|
||||
} else {
|
||||
@unlink($sFile);
|
||||
}
|
||||
}
|
||||
|
||||
if ($aFiles = glob($sPath.'*', GLOB_MARK)) {
|
||||
foreach($aFiles as $sFile ) {
|
||||
if(substr($sFile, -1) == '/') {
|
||||
func_rmdir($sFile);
|
||||
} else {
|
||||
@unlink($sFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(is_dir($sPath)) @rmdir($sPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,40 +72,40 @@ class LsPlugin extends Module {
|
|||
* @return array
|
||||
*/
|
||||
public function GetList() {
|
||||
$aList=array_map('basename',glob($this->sPluginsDir.'*',GLOB_ONLYDIR));
|
||||
$aActivePlugins=$this->GetActivePlugins();
|
||||
|
||||
foreach($aList as $sPlugin) {
|
||||
$this->aPluginsList[$sPlugin] = array(
|
||||
if ($aPaths=glob($this->sPluginsDir.'*',GLOB_ONLYDIR)) {
|
||||
$aList=array_map('basename',$aPaths);
|
||||
$aActivePlugins=$this->GetActivePlugins();
|
||||
foreach($aList as $sPlugin) {
|
||||
$this->aPluginsList[$sPlugin] = array(
|
||||
'code' => $sPlugin,
|
||||
'is_active' => in_array($sPlugin,$aActivePlugins)
|
||||
);
|
||||
'is_active' => in_array($sPlugin,$aActivePlugins)
|
||||
);
|
||||
|
||||
/**
|
||||
* Считываем данные из XML файла описания
|
||||
*/
|
||||
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_XML_FILE;
|
||||
if($oXml = @simplexml_load_file($sPluginXML)) {
|
||||
/**
|
||||
* Обрабатываем данные, считанные из XML-описания
|
||||
*/
|
||||
$sLang=$this->Lang_GetLang();
|
||||
* Считываем данные из XML файла описания
|
||||
*/
|
||||
$sPluginXML = $this->sPluginsDir.$sPlugin.'/'.self::PLUGIN_XML_FILE;
|
||||
if($oXml = @simplexml_load_file($sPluginXML)) {
|
||||
/**
|
||||
* Обрабатываем данные, считанные из XML-описания
|
||||
*/
|
||||
$sLang=$this->Lang_GetLang();
|
||||
|
||||
$this->Xlang($oXml,'name',$sLang);
|
||||
$this->Xlang($oXml,'author',$sLang);
|
||||
$this->Xlang($oXml,'description',$sLang);
|
||||
$oXml->homepage=$this->Text_Parser($oXml->homepage);
|
||||
|
||||
$this->aPluginsList[$sPlugin]['property']=$oXml;
|
||||
} else {
|
||||
/**
|
||||
* Если XML-файл описания отсутствует, или не является валидным XML,
|
||||
* удаляем плагин из списка
|
||||
*/
|
||||
unset($this->aPluginsList[$sPlugin]);
|
||||
$this->Xlang($oXml,'name',$sLang);
|
||||
$this->Xlang($oXml,'author',$sLang);
|
||||
$this->Xlang($oXml,'description',$sLang);
|
||||
$oXml->homepage=$this->Text_Parser($oXml->homepage);
|
||||
|
||||
$this->aPluginsList[$sPlugin]['property']=$oXml;
|
||||
} else {
|
||||
/**
|
||||
* Если XML-файл описания отсутствует, или не является валидным XML,
|
||||
* удаляем плагин из списка
|
||||
*/
|
||||
unset($this->aPluginsList[$sPlugin]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->aPluginsList;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ class TemplateCacheCleanCron extends Cron {
|
|||
/**
|
||||
* Выбираем все файлы кеша
|
||||
*/
|
||||
$aFiles = (array)glob($sDir. DIRECTORY_SEPARATOR ."*.{css,js}", GLOB_BRACE);
|
||||
$aFiles = glob($sDir. DIRECTORY_SEPARATOR ."*.{css,js}", GLOB_BRACE);
|
||||
if (!$aFiles) $aFiles=array();
|
||||
|
||||
print PHP_EOL."Cache files count: ".count($aFiles);
|
||||
|
||||
|
|
Loading…
Reference in a new issue