From 6ce6b1fdbe4ab5b0051a79ba3e6be709674b21f9 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Tue, 7 Sep 2021 02:04:13 +0200 Subject: [PATCH] use of DC constant to be up to date with official plugins and themes --- inc/class.dc.advanced.cleaner.php | 19 +++++++++++++++++-- index.php | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/inc/class.dc.advanced.cleaner.php b/inc/class.dc.advanced.cleaner.php index 71258f3..6e6b8cf 100644 --- a/inc/class.dc.advanced.cleaner.php +++ b/inc/class.dc.advanced.cleaner.php @@ -63,7 +63,7 @@ class dcAdvancedCleaner 'default', 'customCSS', 'blueSilence', 'berlin', 'ductile' ], 'caches' => [ - 'cbfeed', 'dcrepo', 'versions' + 'cbfeed', 'cbtpl', 'dcrepo', 'versions' ], 'versions' => [ 'antispam', 'blogroll', 'blowupConfig', 'core', 'dcCKEditor', 'dcLegacyEditor', 'pages', 'pings', 'simpleMenu', 'tags', 'widgets' @@ -74,6 +74,21 @@ class dcAdvancedCleaner '.', '..', '__MACOSX', '.svn', 'CVS', '.DS_Store', 'Thumbs.db' ]; + public static function getOfficial($type = '') + { + $official = array_merge( + self::$dotclear, + [ + 'plugins' => explode(',', DC_DISTRIB_PLUGINS), + 'themes' => explode(',', DC_DISTRIB_THEMES) + ] + ); + if (empty($type)) { + return $official; + } + return array_key_exists($type, $official) ? $official[$type] : []; + } + public static function getSettings($core) { $res = $core->con->select( @@ -351,7 +366,7 @@ class dcAdvancedCleaner $files = files::scandir($path); foreach($files AS $file) { - if (in_array($file,$exclude)) { + if (in_array($file, $exclude)) { continue; } if (is_dir($path . '/' . $file)) { diff --git a/index.php b/index.php index 3174c99..3707a02 100644 --- a/index.php +++ b/index.php @@ -87,8 +87,9 @@ function drawDcAdvancedCleanerLists($core, $type) '' . __('Name') . '' . __('Objects') . '' . ''; + $official = dcAdvancedCleaner::getOfficial($type); foreach($rs as $k => $v) { - $offline = in_array($v['key'], dcAdvancedCleaner::$dotclear[$type]); + $offline = in_array($v['key'], $official); if ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide && $offline) { continue;