Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Tiny subplugin management.
19
 *
20
 * @package   editor_tinymce
21
 * @copyright  2023 Andrew Lyons <andrew@nicols.co.uk>
22
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
require(__DIR__ . '/../../../config.php');
26
require_once("{$CFG->libdir}/adminlib.php");
27
 
28
$action = optional_param('action', '', PARAM_ALPHA);
29
$plugin = optional_param('plugin', '', PARAM_PLUGIN);
30
 
31
$PAGE->set_context(context_system::instance());
32
$PAGE->set_url('/lib/editor/tinymce/subplugins.php');
33
 
34
require_login();
35
require_capability('moodle/site:config', context_system::instance());
36
require_sesskey();
37
 
38
$tinymanager = \core_plugin_manager::resolve_plugininfo_class('tiny');
39
$pluginname = get_string('pluginname', "tiny_{$plugin}");
40
 
41
switch ($action) {
42
    case 'disable':
43
        if ($tinymanager::enable_plugin($plugin, 0)) {
44
            \core\notification::add(
45
                get_string('plugin_disabled', 'editor_tiny', $pluginname),
46
                \core\notification::SUCCESS
47
            );
48
        }
49
        break;
50
    case 'enable':
51
        if ($tinymanager::enable_plugin($plugin, 1)) {
52
            \core\notification::add(
53
                get_string('plugin_enabled', 'editor_tiny', $pluginname),
54
                \core\notification::SUCCESS
55
            );
56
        }
57
        break;
58
    default:
59
}
60
 
61
redirect(new moodle_url('/admin/settings.php', [
62
    'section' => 'editorsettingstiny',
63
]));