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,7 +249,7 @@ function func_rmdir($sPath) {
|
|||
if(!is_dir($sPath)) return true;
|
||||
$sPath = rtrim($sPath,'/').'/';
|
||||
|
||||
$aFiles = glob($sPath.'*', GLOB_MARK);
|
||||
if ($aFiles = glob($sPath.'*', GLOB_MARK)) {
|
||||
foreach($aFiles as $sFile ) {
|
||||
if(substr($sFile, -1) == '/') {
|
||||
func_rmdir($sFile);
|
||||
|
@ -257,7 +257,7 @@ function func_rmdir($sPath) {
|
|||
@unlink($sFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(is_dir($sPath)) @rmdir($sPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ class LsPlugin extends Module {
|
|||
* @return array
|
||||
*/
|
||||
public function GetList() {
|
||||
$aList=array_map('basename',glob($this->sPluginsDir.'*',GLOB_ONLYDIR));
|
||||
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,
|
||||
|
@ -105,7 +105,7 @@ class LsPlugin extends Module {
|
|||
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