From 76c49cae51bd76984c6f3bf85a7c779cfee8109b Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Tue, 22 Nov 2022 00:24:07 +0100 Subject: [PATCH] add deprecated from dc 2.24 (wip) --- inc/module/dcdeprecated.php | 94 +++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 34 deletions(-) diff --git a/inc/module/dcdeprecated.php b/inc/module/dcdeprecated.php index 1e362ea..265cd8f 100644 --- a/inc/module/dcdeprecated.php +++ b/inc/module/dcdeprecated.php @@ -25,47 +25,73 @@ class dcdeprecated extends action /** @var array Deprecated functions [filetype [pattern, deprecated, replacement, version]] */ private static $deprecated = [ 'php' => [ - ['adminPostsActionsCombo', 'adminPostsActionsCombo', 'adminPostsActionsPage'], - ['adminPostsActionsHeaders', 'adminPostsActionsHeaders', 'adminPostsActionsPage'], - ['adminPostsActionsContent', 'adminPostsActionsContent', 'adminPostsActionsPage'], - ['adminCommentsActionsCombo', 'adminCommentsActionsCombo', 'adminCommentsActionsCombo'], - ['adminCommentsActionsHeaders', 'adminCommentsActionsHeaders', 'adminCommentsActionsPage'], - ['adminCommentsActionsContent', 'adminCommentsActionsContent', 'adminCommentsActionsPage'], - ['adminPagesActionsCombo', 'adminPagesActionsCombo', 'adminPagesActionsCombo', 'adminPagesActionsPage'], - ['adminPagesActionsHeaders', 'adminPagesActionsHeaders', 'adminPagesActionsPage'], - ['adminPagesActionsContent', 'adminPagesActionsContent', 'adminPagesActionsPage'], + ['(\$core|\$GLOBALS\[(\'|")core(\'|")\]|\$this->core)', '$core', 'dcCore::app()', '2.23', 'https://open-time.net/post/2022/10/21/Adapter-son-code-pour-la-224-n-2'], + ['(\$_ctx|\$GLOBALS\[(\'|")_ctx(\'|")\])', '$_ctx', 'dcCore::app()->ctx', '2.23', 'https://open-time.net/post/2022/10/22/Adapter-son-code-pour-la-224-n-3'], + ['(\$_lang|\$GLOBALS\[(\'|")_lang(\'|")\])', '$_lang', 'dcCore::app()->lang', '2.23', 'https://open-time.net/post/2022/10/23/Adapter-son-code-pour-la-224-n-4'], + ['(\$_menu|\$GLOBALS\[(\'|")_menu(\'|")\])', '$_menu', 'dcCore::app()->menu', '2.23', 'https://open-time.net/post/2022/10/24/Adapter-son-code-pour-la-224-n-5'], + ['(\$__resources|\$GLOBALS\[(\'|")__resources(\'|")\])', '$__resources', 'dcCore::app()->resources', '2.23', 'https://open-time.net/post/2022/10/26/Adapter-son-code-pour-la-224-n-6'], + ['(\$__widgets|\$GLOBALS\[(\'|")__widgets(\'|")\])', '$__widgets', 'dcCore::app()->widgets', '2.23', 'https://open-time.net/post/2022/10/31/Adapter-son-code-pour-la-224-n-11'], + ['(\$_page_number|\$GLOBALS\[(\'|")_page_number(\'|")\])', '$_page_number', 'dcCore::app()->public->getPageNumber()', '2.23', 'https://open-time.net/post/2022/11/01/Adapter-son-code-pour-la-224-n-12'], + ['(\$_search|\$GLOBALS\[(\'|")_search(\'|")\])', '$_search', 'dcCore::app()->public->search', '2.23', 'https://open-time.net/post/2022/11/02/Adapter-son-code-pour-la-224-n-13'], + ['(\$_search_count|\$GLOBALS\[(\'|")_search_count(\'|")\])', '$_search_count', 'dcCore::app()->public->search_count', '2.23', 'https://open-time.net/post/2022/11/02/Adapter-son-code-pour-la-224-n-13'], + ['(\$__theme|\$GLOBALS\[(\'|")__theme(\'|")\])', '$__theme', 'dcCore::app()->public->theme', '2.23', 'https://open-time.net/post/2022/11/03/Adapter-son-code-pour-la-224-n-14'], + ['(\$__parent_theme|\$GLOBALS\[(\'|")__parent_theme(\'|")\])', '$__parent_theme', 'dcCore::app()->public->parent_theme', '2.23', 'https://open-time.net/post/2022/11/03/Adapter-son-code-pour-la-224-n-14'], + ['(\$__smilies|\$GLOBALS\[(\'|")__smilies(\'|")\])', '$__smilies', 'dcCore::app()->public->smilies', '2.23', 'https://open-time.net/post/2022/11/04/Adapter-son-code-pour-la-224-n-15'], + ['(\$__autoload|\$GLOBALS\[(\'|")__autoload(\'|")\])', '$__autoload', 'Clearbricks::lib()->autoload()', '2.23', 'https://open-time.net/post/2022/11/05/Adapter-son-code-pour-la-224-n-16'], + ['(\$p_url|\$GLOBALS\[(\'|")p_url(\'|")\])', '$p_url', 'dcCore::app()->admin->getPageURL()', '2.23', 'https://open-time.net/post/2022/11/13/Adapter-son-code-pour-la-224-n-24'], - ['comments_actions.php', 'comments_actions.php', 'dcCommentsActionsPage'], - ['posts_actions.php', 'posts_actions.php', 'dcPostsActionsPage'], + ['adminPostsActionsPage (\s|"|\')', 'adminPostsActionsPage ', 'adminPostsActions', '2.24', 'https://open-time.net/post/2022/11/17/Adapter-son-code-pour-la-224-n-28'], + ['adminCommentsActionsPage(\s|"|\')', 'adminCommentsActionsPage', 'adminCommentsActions', '2.24', 'https://open-time.net/post/2022/11/17/Adapter-son-code-pour-la-224-n-28'], + ['adminPagesActionsPage(\s|"|\')', 'adminPagesActionsPage', 'adminPagesActions', '2.24', 'https://open-time.net/post/2022/11/17/Adapter-son-code-pour-la-224-n-28'], - ['global_filter', 'global_filter', 'tpl_context::global_filters', '2.11'], + ['coreBeforeLoadingNsFiles(\s|"|\')', 'coreBeforeLoadingNsFiles', 'coreBeforeLoadingNsFilesV2', '2.24', 'https://open-time.net/post/2022/11/06/Adapter-son-code-pour-la-224-n-17'], + ['coreCommentSearch(\s|"|\')', 'coreCommentSearch', 'coreCommentSearchV2', '2.24', 'https://open-time.net/post/2022/11/06/Adapter-son-code-pour-la-224-n-17'], + ['corePostSearch(\s|"|\')', 'corePostSearch', 'corePostSearchV2', '2.24', 'https://open-time.net/post/2022/11/06/Adapter-son-code-pour-la-224-n-17'], + ['adminDashboardFavorites(\s|"|\')', 'adminDashboardFavorites', 'adminDashboardFavoritesV2', '2.24', 'https://open-time.net/post/2022/11/06/Adapter-son-code-pour-la-224-n-17'], + //... - ['getLangFile', 'getLangFile', 'nothing', 'unknow'], - ['getTextDirection', 'getTextDirection', 'getLanguageTextDirection'], + ['adminPostsActionsCombo', 'adminPostsActionsCombo', 'adminPostsActions', '2.21', ''], + ['adminPostsActionsHeaders', 'adminPostsActionsHeaders', 'adminPostsActions', '2.21', ''], + ['adminPostsActionsContent', 'adminPostsActionsContent', 'adminPostsActions', '2.21', ''], + ['adminCommentsActionsCombo', 'adminCommentsActionsCombo', 'adminCommentsActionsCombo', '2.21', ''], + ['adminCommentsActionsHeaders', 'adminCommentsActionsHeaders', 'adminCommentsActions', '2.21', ''], + ['adminCommentsActionsContent', 'adminCommentsActionsContent', 'adminCommentsActions', '2.21', ''], + ['adminPagesActionsCombo', 'adminPagesActionsCombo', 'adminPagesActionsCombo', 'adminPagesActions', '2.21', ''], + ['adminPagesActionsHeaders', 'adminPagesActionsHeaders', 'adminPagesActions', '2.21', ''], + ['adminPagesActionsContent', 'adminPagesActionsContent', 'adminPagesActions', '2.21', ''], - ['dcUtils::jsVar(s|)', 'dcUtils::jsVar(s)', 'dcUtils::jsJson', '2.15'], - ['adminurl->decode', '$core->adminurl->decode', 'nothing'], - ['dcPage::help[^B]', 'dcPage::help', 'nothing'], - ['dcPage::jsVar(s|)', 'dcPage::jsVar(s)', 'dcPage::jsJson', '2.15'], - ['dcPage::jsLoadIE7', 'dcPage::jsLoadIE7', 'nothing', '2.11'], - ['dcPage::jsColorPicker', 'dcPage::jsColorPicker', 'nothing', '2.16'], - ['dcPage::jsToolBar', 'dcPage::jsToolBar', 'nothing'], + // + ['comments_actions.php', 'comments_actions.php', 'dcCommentsActionsPage', '2.21', ''], + ['posts_actions.php', 'posts_actions.php', 'dcPostsActionsPage', '2.21', ''], - ['adminPostForm[^I]', 'adminPostForm', 'adminPostFormItems'], - ['adminPostFormSidebar', 'adminPostFormSidebar', 'adminPostFormItems'], + ['global_filter', 'global_filter', 'tpl_context::global_filters', '2.11', ''], - ['three-cols', 'three-cols', 'three-boxes', '2.6'], + ['getLangFile', 'getLangFile', 'nothing', '2.11', ''], + ['getTextDirection', 'getTextDirection', 'getLanguageTextDirection', '2.11', ''], + + ['dcUtils::jsVar(s|)', 'dcUtils::jsVar(s)', 'dcUtils::jsJson', '2.15', ''], + ['adminurl->decode', '$core->adminurl->decode', 'nothing', '2.15', ''], + ['dcPage::help[^B]', 'dcPage::help', 'nothing', '2.15', ''], + ['dcPage::jsVar(s|)', 'dcPage::jsVar(s)', 'dcPage::jsJson', '2.15', ''], + ['dcPage::jsLoadIE7', 'dcPage::jsLoadIE7', 'nothing', '2.11', ''], + ['dcPage::jsColorPicker', 'dcPage::jsColorPicker', 'nothing', '2.16', ''], + ['dcPage::jsToolBar', 'dcPage::jsToolBar', 'nothing', '2.16', ''], + + ['adminPostForm[^I]', 'adminPostForm', 'adminPostFormItems', '2.21', ''], + ['adminPostFormSidebar', 'adminPostFormSidebar', 'adminPostFormItems', '2.21', ''], + + ['three-cols', 'three-cols', 'three-boxes', '2.6', ''], ], 'js' => [ - ['\sstoreLocalData', 'storeLocalData', 'dotclear.storeLocalData'], - ['\sdropLocalData', 'dropLocalData', 'dotclear.dropLocalData'], - ['\sreadLocalData', 'readLocalData', 'dotclear.readLocalData'], - ['\sgetData', 'getData', 'dotclear.getData'], - ['\sisObject', 'isObject', 'dotclear.isObject'], - ['\smergeDeep', 'mergeDeep', 'dotclear.mergeDeep'], - ['\sgetCookie', 'getCookie', 'dotclear.getCookie'], - ['\ssetCookie', 'setCookie', 'dotclear.setCookie'], - ['\sdeleteCookie', 'deleteCookie', 'dotclear.deleteCookie'], + ['\sstoreLocalData', 'storeLocalData', 'dotclear.storeLocalData', '2.21', ''], + ['\sdropLocalData', 'dropLocalData', 'dotclear.dropLocalData', '2.21', ''], + ['\sreadLocalData', 'readLocalData', 'dotclear.readLocalData', '2.21', ''], + ['\sgetData', 'getData', 'dotclear.getData', '2.21', ''], + ['\sisObject', 'isObject', 'dotclear.isObject', '2.21', ''], + ['\smergeDeep', 'mergeDeep', 'dotclear.mergeDeep', '2.21', ''], + ['\sgetCookie', 'getCookie', 'dotclear.getCookie', '2.21', ''], + ['\ssetCookie', 'setCookie', 'dotclear.setCookie', '2.21', ''], + ['\sdeleteCookie', 'deleteCookie', 'dotclear.deleteCookie', '2.21', ''], ], ]; @@ -94,7 +120,7 @@ class dcdeprecated extends action } foreach (self::$deprecated[$this->path_extension] as $d) { if (preg_match('/' . $d[0] . '/i', $content)) { - $this->setWarning(sprintf(__('Use of deprecated "%s", you should use "%s" instead.'), $d[1], __($d[2]))); + $this->setWarning(sprintf(__('Possible use of deprecated "%s", you should use "%s" instead since Dotclear %s.'), $d[1], __($d[2]), $d[3]) . (empty($d[4]) ? '' : ' ' . __('Help') . ' ')); } }