1 | <?php |
---|
2 | /** |
---|
3 | * @brief dclegacy, a plugin for Dotclear 2 |
---|
4 | * |
---|
5 | * @package Dotclear |
---|
6 | * @subpackage Plugins |
---|
7 | * |
---|
8 | * @copyright Olivier Meunier & Association Dotclear |
---|
9 | * @copyright GPL-2.0-only |
---|
10 | */ |
---|
11 | |
---|
12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
---|
13 | |
---|
14 | $GLOBALS['core']->addBehavior('adminPostsActionsPage', ['dcLegacyPosts', 'adminPostsActionsPage']); |
---|
15 | $GLOBALS['core']->addBehavior('adminPagesActionsPage', ['dcLegacyPages', 'adminPagesActionsPage']); |
---|
16 | $GLOBALS['core']->addBehavior('adminCommentsActionsPage', ['dcLegacyComments', 'adminCommentsActionsPage']); |
---|
17 | |
---|
18 | /* Handle deprecated behaviors : |
---|
19 | * adminPostsActionsCombo |
---|
20 | * adminPostsActionsHeaders |
---|
21 | * adminPostsActionsContent |
---|
22 | */ |
---|
23 | class dcLegacyPosts |
---|
24 | { |
---|
25 | public static function adminPostsActionsPage($core, dcPostsActionsPage $as) |
---|
26 | { |
---|
27 | $stub_actions = new ArrayObject(); |
---|
28 | $core->callBehavior('adminPostsActionsCombo', [$stub_actions]); |
---|
29 | if (!empty($stub_actions)) { |
---|
30 | $as->addAction($stub_actions, ['dcLegacyPosts', 'onActionLegacy']); |
---|
31 | } |
---|
32 | } |
---|
33 | |
---|
34 | public static function onActionLegacy($core, dcPostsActionsPage $as, $post) |
---|
35 | { |
---|
36 | $core->callBehavior('adminPostsActions', $core, $as->getRS(), $as->getAction(), $as->getRedirection()); |
---|
37 | $as->beginPage('', |
---|
38 | dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . |
---|
39 | dcPage::jsMetaEditor() . |
---|
40 | $core->callBehavior('adminPostsActionsHeaders'), ''); |
---|
41 | $core->callBehavior('adminPostsActionsContent', $core, $as->getAction(), $as->getHiddenFields(true)); |
---|
42 | $as->endPage(); |
---|
43 | |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | /* Handle deprecated behaviors : |
---|
48 | * adminCommentsActionsCombo |
---|
49 | * adminCommentsActionsHeaders |
---|
50 | * adminCommentsActionsContent |
---|
51 | */ |
---|
52 | class dcLegacyComments |
---|
53 | { |
---|
54 | public static function adminCommentsActionsPage($core, dcCommentsActionsPage $as) |
---|
55 | { |
---|
56 | $stub_actions = new ArrayObject(); |
---|
57 | $core->callBehavior('adminCommentsActionsCombo', [$stub_actions]); |
---|
58 | if (!empty($stub_actions)) { |
---|
59 | $as->addAction($stub_actions, ['dcLegacyComments', 'onActionLegacy']); |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | public static function onActionLegacy($core, dcCommentsActionsPage $as, $Comment) |
---|
64 | { |
---|
65 | $core->callBehavior('adminCommentsActions', $core, $as->getRS(), $as->getAction(), $as->getRedirection()); |
---|
66 | $as->beginPage('', |
---|
67 | dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . |
---|
68 | dcPage::jsMetaEditor() . |
---|
69 | $core->callBehavior('adminCommentsActionsHeaders'), ''); |
---|
70 | ob_start(); |
---|
71 | $core->callBehavior('adminCommentsActionsContent', $core, $as->getAction(), $as->getHiddenFields(true)); |
---|
72 | $res = ob_get_contents(); |
---|
73 | ob_end_clean(); |
---|
74 | $res = str_replace("comments_actions.php", $as->getURI(), $res); |
---|
75 | echo $res; |
---|
76 | $as->endPage(); |
---|
77 | |
---|
78 | } |
---|
79 | } |
---|
80 | /* Handle deprecated behaviors : |
---|
81 | * adminPagesActionsCombo |
---|
82 | * adminPagesActionsHeaders |
---|
83 | * adminPagesActionsContent |
---|
84 | */ |
---|
85 | class dcLegacyPages |
---|
86 | { |
---|
87 | public static function adminPagesActionsPage($core, dcPagesActionsPage $as) |
---|
88 | { |
---|
89 | $stub_actions = new ArrayObject(); |
---|
90 | $core->callBehavior('adminPagesActionsCombo', [$stub_actions]); |
---|
91 | if (!empty($stub_actions)) { |
---|
92 | $as->addAction($stub_actions, ['dcLegacyPages', 'onActionLegacy']); |
---|
93 | } |
---|
94 | } |
---|
95 | |
---|
96 | public static function onActionLegacy($core, dcPagesActionsPage $as, $post) |
---|
97 | { |
---|
98 | $core->callBehavior('adminPostsActions', $core, $as->getRS(), $as->getAction(), $as->getRedirection()); |
---|
99 | $as->beginPage('', |
---|
100 | dcPage::jsLoad('js/jquery/jquery.autocomplete.js') . |
---|
101 | dcPage::jsMetaEditor() . |
---|
102 | $core->callBehavior('adminPostsActionsHeaders'), ''); |
---|
103 | ob_start(); |
---|
104 | $core->callBehavior('adminPostsActionsContent', $core, $as->getAction(), $as->getHiddenFields(true)); |
---|
105 | $res = ob_get_contents(); |
---|
106 | ob_end_clean(); |
---|
107 | $res = str_replace("posts_actions.php", "plugin.php", $res); |
---|
108 | echo $res; |
---|
109 | $as->endPage(); |
---|
110 | } |
---|
111 | } |
---|