use of DC constant to be up to date with official plugins and themes

This commit is contained in:
Jean-Christian Paul Denis 2021-09-07 02:04:13 +02:00
parent 5529c40922
commit 6ce6b1fdbe
2 changed files with 19 additions and 3 deletions

View File

@ -63,7 +63,7 @@ class dcAdvancedCleaner
'default', 'customCSS', 'blueSilence', 'berlin', 'ductile' 'default', 'customCSS', 'blueSilence', 'berlin', 'ductile'
], ],
'caches' => [ 'caches' => [
'cbfeed', 'dcrepo', 'versions' 'cbfeed', 'cbtpl', 'dcrepo', 'versions'
], ],
'versions' => [ 'versions' => [
'antispam', 'blogroll', 'blowupConfig', 'core', 'dcCKEditor', 'dcLegacyEditor', 'pages', 'pings', 'simpleMenu', 'tags', 'widgets' 'antispam', 'blogroll', 'blowupConfig', 'core', 'dcCKEditor', 'dcLegacyEditor', 'pages', 'pings', 'simpleMenu', 'tags', 'widgets'
@ -74,6 +74,21 @@ class dcAdvancedCleaner
'.', '..', '__MACOSX', '.svn', 'CVS', '.DS_Store', 'Thumbs.db' '.', '..', '__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) public static function getSettings($core)
{ {
$res = $core->con->select( $res = $core->con->select(
@ -351,7 +366,7 @@ class dcAdvancedCleaner
$files = files::scandir($path); $files = files::scandir($path);
foreach($files AS $file) { foreach($files AS $file) {
if (in_array($file,$exclude)) { if (in_array($file, $exclude)) {
continue; continue;
} }
if (is_dir($path . '/' . $file)) { if (is_dir($path . '/' . $file)) {

View File

@ -87,8 +87,9 @@ function drawDcAdvancedCleanerLists($core, $type)
'<th>' . __('Name') . '</th><th>' . __('Objects') . '</th>' . '<th>' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
'</tr></thead><tbody>'; '</tr></thead><tbody>';
$official = dcAdvancedCleaner::getOfficial($type);
foreach($rs as $k => $v) { 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) { if ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide && $offline) {
continue; continue;