Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 59... Línea 59...
59
                // Skip plugins that do not implement the plugin interface.
59
                // Skip plugins that do not implement the plugin interface.
60
                debugging("Plugin {$plugin} does not implement the plugin interface", DEBUG_DEVELOPER);
60
                debugging("Plugin {$plugin} does not implement the plugin interface", DEBUG_DEVELOPER);
61
                continue;
61
                continue;
62
            }
62
            }
Línea -... Línea 63...
-
 
63
 
-
 
64
            $options['pluginname'] = $pluginname;
63
 
65
 
64
            if (!$classname::is_enabled($context, $options, $fpoptions, $editor)) {
66
            if (!$classname::is_enabled($context, $options, $fpoptions, $editor)) {
65
                // This plugin has disabled itself for some reason.
67
                // This plugin has disabled itself for some reason.
66
                // This is typical for media plugins where there is no file storage.
68
                // This is typical for media plugins where there is no file storage.
67
                continue;
69
                continue;
Línea 81... Línea 83...
81
 
83
 
82
        return $plugins;
84
        return $plugins;
Línea 83... Línea 85...
83
    }
85
    }
-
 
86
 
-
 
87
    /**
-
 
88
     * Get the configuration for external functions.
-
 
89
     *
-
 
90
     * @param context $context The context that the editor is used within.
-
 
91
     */
-
 
92
    public function get_plugin_configuration_for_external(context $context): array {
-
 
93
        $plugins = [];
-
 
94
 
-
 
95
        $moodleplugins = \core_component::get_plugin_list_with_class('tiny', 'plugininfo');
-
 
96
        $enabledplugins = \editor_tiny\plugininfo\tiny::get_enabled_plugins();
-
 
97
 
-
 
98
        foreach ($moodleplugins as $plugin => $classname) {
-
 
99
            [, $pluginname] = explode('_', $plugin, 2);
-
 
100
            if (!in_array($pluginname, $enabledplugins)) {
-
 
101
                // This plugin has been disabled.
-
 
102
                continue;
-
 
103
            }
-
 
104
 
-
 
105
            if (!is_a($classname, plugin::class, true)) {
-
 
106
                // Skip plugins that do not implement the plugin interface.
-
 
107
                debugging("Plugin {$plugin} does not implement the plugin interface", DEBUG_DEVELOPER);
-
 
108
                continue;
-
 
109
            }
-
 
110
 
-
 
111
            $options = ['pluginname' => $pluginname];
-
 
112
            if (!$classname::is_enabled_for_external($context, $options)) {
-
 
113
                // This plugin has disabled itself for some reason.
-
 
114
                continue;
-
 
115
            }
-
 
116
 
-
 
117
            // Get the plugin configuration for external functions.
-
 
118
            $pluginconfig = [];
-
 
119
            if (is_a($classname, plugin_with_configuration_for_external::class, true)) {
-
 
120
                $pluginconfig = $classname::get_plugin_configuration_for_external($context);
-
 
121
            }
-
 
122
 
-
 
123
            $plugins[$pluginname] = $pluginconfig;
-
 
124
        }
-
 
125
 
-
 
126
        return $plugins;
-
 
127
    }
84
 
128
 
85
    /**
129
    /**
86
     * Get a list of the buttons provided by this plugin.
130
     * Get a list of the buttons provided by this plugin.
87
     *
131
     *
88
     * @return string[]
132
     * @return string[]
Línea 438... Línea 482...
438
                    'tablepasterowafter' => 'table',
482
                    'tablepasterowafter' => 'table',
439
                    'tablerowprops' => 'table',
483
                    'tablerowprops' => 'table',
440
                    'tabledeleterow' => 'table',
484
                    'tabledeleterow' => 'table',
441
                ],
485
                ],
442
            ],
486
            ],
443
            'template' => [
-
 
444
                'buttons' => [
-
 
445
                    'template',
-
 
446
                ],
-
 
447
                'menuitems' => [
-
 
448
                    'template' => 'insert',
-
 
449
                ],
-
 
450
            ],
-
 
451
            'visualblocks' => [
487
            'visualblocks' => [
452
                'buttons' => [
488
                'buttons' => [
453
                    'visualblocks',
489
                    'visualblocks',
454
                ],
490
                ],
455
                'menuitems' => [
491
                'menuitems' => [
Línea 490... Línea 526...
490
            'media',
526
            'media',
Línea 491... Línea 527...
491
 
527
 
492
            // Use the Moodle autosave plugin instead.
528
            // Use the Moodle autosave plugin instead.
Línea 493... Línea -...
493
            'autosave',
-
 
494
 
-
 
495
            // Disable the Template plugin for now.
-
 
496
            'template',
529
            'autosave',
497
 
530
 
Línea 498... Línea 531...
498
            // Disable the preview plugin as it does not support Moodle filters.
531
            // Disable the preview plugin as it does not support Moodle filters.
499
            'preview',
532
            'preview',