MDL-40220 use new core_component::get_plugin_list()

This commit is contained in:
Petr Škoda 2013-07-16 22:36:11 +02:00
parent 46f6f7f224
commit bd3b3bba9f
87 changed files with 147 additions and 147 deletions

View File

@ -47,7 +47,7 @@ $table->set_attribute('class', 'admintable generaltable');
$table->setup();
$plugins = array();
foreach (get_plugin_list('local') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $plugin)) {
$strpluginname = get_string('pluginname', 'local_' . $plugin);
} else {

View File

@ -95,7 +95,7 @@ class mnet_review_host_form extends moodleform {
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$themes = array('' => get_string('forceno'));
foreach (array_keys(get_plugin_list('theme')) as $themename) {
foreach (array_keys(core_component::get_plugin_list('theme')) as $themename) {
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);

View File

@ -39,7 +39,7 @@ echo $OUTPUT->header();
$txt = get_strings(array('settings', 'name', 'version'));
$txt->uninstall = get_string('uninstallplugin', 'core_admin');
$plagiarismplugins = get_plugin_list('plagiarism');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
echo $OUTPUT->footer();

View File

@ -163,7 +163,7 @@ if (($action == 'edit') || ($action == 'new')) {
$output = $OUTPUT->box_start('generalbox');
$plugins = get_plugin_list('portfolio');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = array();

View File

@ -39,7 +39,7 @@ require_capability('moodle/question:config', $systemcontext);
admin_externalpage_setup('manageqbehaviours');
$thispageurl = new moodle_url('/admin/qbehaviours.php');
$behaviours = get_plugin_list('qbehaviour');
$behaviours = core_component::get_plugin_list('qbehaviour');
$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.

View File

@ -49,7 +49,7 @@ $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthw
$table->setup();
$plugins = array();
foreach (get_plugin_list('report') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'report_' . $plugin)) {
$strpluginname = get_string('pluginname', 'report_' . $plugin);
} else {

View File

@ -390,7 +390,7 @@ if (($action == 'edit') || ($action == 'new')) {
}
// Get all the plugins that exist on disk
$plugins = get_plugin_list('repository');
$plugins = core_component::get_plugin_list('repository');
if (!empty($plugins)) {
foreach ($plugins as $plugin => $dir) {
// Check that it has not already been listed

View File

@ -24,7 +24,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('themes', new admin_externalpage('themeselector', new lang_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
// settings for each theme
foreach (get_plugin_list('theme') as $theme => $themedir) {
foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
$settings_path = "$themedir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('themesetting'.$theme, new lang_string('pluginname', 'theme_'.$theme));

View File

@ -178,7 +178,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// Reports
$ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradereport'.$plugin, new lang_string('pluginname', 'gradereport_'.$plugin), 'moodle/grade:manage');
@ -191,7 +191,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// Imports
$ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
@ -206,7 +206,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// Exports
$ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradeexport'.$plugin, new lang_string('pluginname', 'gradeexport_'.$plugin), 'moodle/grade:manage');

View File

@ -382,7 +382,7 @@ $ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comme
// Course reports settings
if ($hassiteconfig) {
$pages = array();
foreach (get_plugin_list('coursereport') as $report => $path) {
foreach (core_component::get_plugin_list('coursereport') as $report => $path) {
$file = $CFG->dirroot . '/course/report/' . $report . '/settings.php';
if (file_exists($file)) {
$settings = new admin_settingpage('coursereport' . $report,
@ -405,7 +405,7 @@ if ($hassiteconfig) {
// Now add reports
$pages = array();
foreach (get_plugin_list('report') as $report => $plugindir) {
foreach (core_component::get_plugin_list('report') as $report => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('report' . $report,
@ -431,7 +431,7 @@ if ($hassiteconfig) {
}
// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
include($settings_path);
@ -444,7 +444,7 @@ if ($hassiteconfig) {
$ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php'));
$ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php'));
$ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache')));
foreach (get_plugin_list('cachestore') as $plugin => $path) {
foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) {
$settingspath = $path.'/settings.php';
if (file_exists($settingspath)) {
$settings = new admin_settingpage('cachestore_'.$plugin.'_settings', new lang_string('pluginname', 'cachestore_'.$plugin), 'moodle/site:config');
@ -463,7 +463,7 @@ if ($hassiteconfig) {
// extend settings for each local plugin. Note that their settings may be in any part of the
// settings tree and may be visible not only for administrators. We can not use $allplugins here
foreach (get_plugin_list('local') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
include($settings_path);

View File

@ -107,7 +107,7 @@ function tool_dbtransfer_rebuild_target_log_actions(moodle_database $target, pro
log_update_descriptions('moodle');
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type => $location) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug => $fullplug) {
$component = $type.'_'.$plug;
$DB->delete_records('log_display', array('component'=>$component));

View File

@ -44,7 +44,7 @@ class tool_qeupgradehelper_extract_options_form extends moodleform {
'adaptivenopenalty' => 'Adaptive (no penalties)',
);
$qtypes = get_plugin_list('qtype');
$qtypes = core_component::get_plugin_list('qtype');
foreach ($qtypes as $qtype => $notused) {
$qtypes[$qtype] = get_string($qtype, 'qtype_' . $qtype);
}

View File

@ -53,7 +53,7 @@ class tool_uploadcourse_helper_testcase extends advanced_testcase {
public function test_get_course_formats() {
$result = tool_uploadcourse_helper::get_course_formats();
$this->assertSame(array_keys(get_plugin_list('format')), $result);
$this->assertSame(array_keys(core_component::get_plugin_list('format')), $result);
// Should be similar as first result, as cached.
$this->assertSame($result, tool_uploadcourse_helper::get_course_formats());
}

View File

@ -49,7 +49,7 @@ $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthw
$table->setup();
$plugins = array();
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'tool_' . $plugin)) {
$strpluginname = get_string('pluginname', 'tool_' . $plugin);
} else {

View File

@ -40,7 +40,7 @@ $webservice = optional_param('webservice', '', PARAM_SAFEDIR);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
// get currently installed and enabled auth plugins
$available_webservices = get_plugin_list('webservice');
$available_webservices = core_component::get_plugin_list('webservice');
if (!empty($webservice) and empty($available_webservices[$webservice])) {
redirect($returnurl);
}

View File

@ -67,7 +67,7 @@ if (!isset($functions[$function])) {
}
// list all enabled webservices
$available_protocols = get_plugin_list('webservice');
$available_protocols = core_component::get_plugin_list('webservice');
$active_protocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
$protocols = array();
foreach ($active_protocols as $p) {

View File

@ -84,7 +84,7 @@ abstract class moodle1_handlers_factory {
global $CFG;
$handlers = array();
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $name => $dir) {
$handlerfile = $dir . '/backup/moodle1/lib.php';
$handlerclass = "moodle1_{$type}_{$name}_handler";
@ -1335,7 +1335,7 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
if (is_null($this->qtypehandlers)) {
// initialize the list of qtype handler instances
$this->qtypehandlers = array();
foreach (get_plugin_list('qtype') as $qtypename => $qtypelocation) {
foreach (core_component::get_plugin_list('qtype') as $qtypename => $qtypelocation) {
$filename = $qtypelocation.'/backup/moodle1/lib.php';
if (file_exists($filename)) {
$classname = 'moodle1_qtype_'.$qtypename.'_handler';

View File

@ -50,7 +50,7 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_stepslib.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php');
// Load all the activity tasks for moodle2 format
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
$taskpath = $moddir . '/backup/moodle2/backup_' . $mod . '_activity_task.class.php';
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
@ -61,7 +61,7 @@ foreach ($mods as $mod => $moddir) {
}
// Load all the block tasks for moodle2 format
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
$taskpath = $blockdir . '/backup/moodle2/backup_' . $block . '_block_task.class.php';
if (file_exists($taskpath)) {

View File

@ -176,7 +176,7 @@ abstract class backup_qtype_plugin extends backup_plugin {
public static function get_components_and_fileareas($filter = null) {
$components = array();
// Get all the plugins of this type
$qtypes = get_plugin_list('qtype');
$qtypes = core_component::get_plugin_list('qtype');
foreach ($qtypes as $name => $path) {
// Apply filter if specified
if (!is_null($filter) && $filter != $name) {

View File

@ -121,7 +121,7 @@ abstract class backup_activity_structure_step extends backup_structure_step {
$element->add_child($optigroup); // Add optigroup to stay connected since beginning
// Get all the optigroup_elements, looking across all the subplugin dirs
$subpluginsdirs = get_plugin_list($subplugintype);
$subpluginsdirs = core_component::get_plugin_list($subplugintype);
foreach ($subpluginsdirs as $name => $subpluginsdir) {
$classname = 'backup_' . $subplugintype . '_' . $name . '_subplugin';
$backupfile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';

View File

@ -157,7 +157,7 @@ class backup_xml_transformer extends xml_contenttransformer {
$encoders['backup_course_task'] = 'encode_content_links';
// Add the module ones. Each module supporting moodle2 backups MUST have it
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
$encoders['backup_' . $mod . '_activity_task'] = 'encode_content_links';
@ -165,7 +165,7 @@ class backup_xml_transformer extends xml_contenttransformer {
}
// Add the block encoders
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
if (class_exists('backup_' . $block . '_block_task')) {
$encoders['backup_' . $block . '_block_task'] = 'encode_content_links';

View File

@ -57,7 +57,7 @@ require_once($CFG->dirroot . '/backup/moodle2/restore_settingslib.php');
require_once($CFG->dirroot . '/backup/moodle2/restore_stepslib.php');
// Load all the activity tasks for moodle2 format
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
$taskpath = $moddir . '/backup/moodle2/restore_' . $mod . '_activity_task.class.php';
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
@ -68,7 +68,7 @@ foreach ($mods as $mod => $moddir) {
}
// Load all the block tasks for moodle2 format
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
$taskpath = $blockdir . '/backup/moodle2/restore_' . $block . '_block_task.class.php';
if (file_exists($taskpath)) {

View File

@ -135,7 +135,7 @@ abstract class restore_plugin {
// (only the needed ones have been loaded, so they will
// be the ones being asked here). Fetch their restore contents
// by calling (if exists) to their define_decode_contents() method
$plugins = get_plugin_list($plugintype);
$plugins = core_component::get_plugin_list($plugintype);
foreach ($plugins as $plugin => $plugindir) {
$classname = 'restore_' . $plugintype . '_' . $plugin . '_plugin';
if (class_exists($classname)) {

View File

@ -1483,7 +1483,7 @@ class restore_course_structure_step extends restore_structure_step {
unset($roleids[$roleid]);
}
foreach (get_plugin_list('mod') as $modname => $notused) {
foreach (core_component::get_plugin_list('mod') as $modname => $notused) {
if (isset($this->legacyallowedmodules[$modname])) {
// Module is allowed, no worries.
continue;
@ -3184,7 +3184,7 @@ abstract class restore_activity_structure_step extends restore_structure_step {
throw new restore_step_exception('incorrect_subplugin_type', $subplugintype);
}
// Get all the restore path elements, looking across all the subplugin dirs
$subpluginsdirs = get_plugin_list($subplugintype);
$subpluginsdirs = core_component::get_plugin_list($subplugintype);
foreach ($subpluginsdirs as $name => $subpluginsdir) {
$classname = 'restore_' . $subplugintype . '_' . $name . '_subplugin';
$restorefile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';

View File

@ -72,7 +72,7 @@ abstract class backup_general_helper extends backup_helper {
static $availableblocks = array(); // Get and cache available blocks
if (empty($availableblocks)) {
$availableblocks = array_keys(get_plugin_list('block'));
$availableblocks = array_keys(core_component::get_plugin_list('block'));
}
$path = $path . '/blocks'; // Always look under blocks subdir

View File

@ -110,7 +110,7 @@ class restore_decode_processor {
$tasks[] = 'restore_section_task';
// Add the module tasks
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (class_exists('restore_' . $mod . '_activity_task')) {
$tasks[] = 'restore_' . $mod . '_activity_task';
@ -121,7 +121,7 @@ class restore_decode_processor {
$tasks[] = 'restore_default_block_task';
// Add the custom block tasks
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
if (class_exists('restore_' . $block . '_block_task')) {
$tasks[] = 'restore_' . $block . '_block_task';

View File

@ -110,7 +110,7 @@ class restore_logs_processor {
$rules = array(); // To accumulate rules for course
// Add the module tasks
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (class_exists('restore_' . $mod . '_activity_task')) {
$tasks[$mod] = 'restore_' . $mod . '_activity_task';

View File

@ -146,7 +146,7 @@ abstract class backup_structure_step extends backup_step {
$element->add_child($optigroup); // Add optigroup to stay connected since beginning
// Get all the optigroup_elements, looking across all the plugin dirs
$pluginsdirs = get_plugin_list($plugintype);
$pluginsdirs = core_component::get_plugin_list($plugintype);
foreach ($pluginsdirs as $name => $plugindir) {
$classname = 'backup_' . $plugintype . '_' . $name . '_plugin';
$backupfile = $plugindir . '/backup/moodle2/' . $classname . '.class.php';

View File

@ -303,7 +303,7 @@ abstract class restore_structure_step extends restore_step {
}
// Get all the restore path elements, looking across all the plugin dirs
$pluginsdirs = get_plugin_list($plugintype);
$pluginsdirs = core_component::get_plugin_list($plugintype);
foreach ($pluginsdirs as $name => $pluginsdir) {
// We need to add also backup plugin classes on restore, they may contain
// some stuff used both in backup & restore

View File

@ -193,8 +193,8 @@ class block_community_renderer extends plugin_renderer_base {
//Create course content html
$blocks = get_plugin_list('block');
$activities = get_plugin_list('mod');
$blocks = core_component::get_plugin_list('block');
$activities = core_component::get_plugin_list('mod');
if (!empty($course->contents)) {
$activitieshtml = '';
$blockhtml = '';

6
cache/locallib.php vendored
View File

@ -954,7 +954,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_add_store_form($plugin) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachestore');
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
}
@ -986,7 +986,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_edit_store_form($plugin, $store) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachestore');
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
}
@ -1215,7 +1215,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_add_lock_form($plugin, array $lockplugin = null) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachelock');
$plugins = core_component::get_plugin_list('cachelock');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache lock plugin requested when trying to create a form.');
}

View File

@ -528,7 +528,7 @@ class core_course_external extends external_api {
$params = self::validate_parameters(self::create_courses_parameters(),
array('courses' => $courses));
$availablethemes = get_plugin_list('theme');
$availablethemes = core_component::get_plugin_list('theme');
$availablelangs = get_string_manager()->get_list_of_translations();
$transaction = $DB->start_delegated_transaction();
@ -692,7 +692,7 @@ class core_course_external extends external_api {
$params = self::validate_parameters(self::update_courses_parameters(),
array('courses' => $courses));
$availablethemes = get_plugin_list('theme');
$availablethemes = core_component::get_plugin_list('theme');
$availablelangs = get_string_manager()->get_list_of_translations();
foreach ($params['courses'] as $course) {

View File

@ -134,7 +134,7 @@ abstract class format_base {
global $CFG;
static $classnames = array('site' => 'format_site');
if (!isset($classnames[$format])) {
$plugins = get_plugin_list('format');
$plugins = core_component::get_plugin_list('format');
$usedformat = self::get_format_or_default($format);
if (file_exists($plugins[$usedformat].'/lib.php')) {
require_once($plugins[$usedformat].'/lib.php');

View File

@ -2985,7 +2985,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
*/
function get_sorted_course_formats($enabledonly = false) {
global $CFG;
$formats = get_plugin_list('format');
$formats = core_component::get_plugin_list('format');
if (!empty($CFG->format_plugins_sortorder)) {
$order = explode(',', $CFG->format_plugins_sortorder);

View File

@ -19,7 +19,7 @@
$PAGE->set_heading($course->fullname.': '.$strreports);
echo $OUTPUT->header();
$reports = get_plugin_list('coursereport');
$reports = core_component::get_plugin_list('coursereport');
foreach ($reports as $report => $reportdirectory) {
$pluginfile = $reportdirectory.'/mod.php';

View File

@ -104,7 +104,7 @@ class course_settings_form extends moodleform {
$types = array('report', 'export', 'import');
foreach($types as $type) {
foreach (get_plugin_list('grade'.$type) as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('grade'.$type) as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');

View File

@ -253,7 +253,7 @@ class grading_manager {
$list = array();
}
foreach (get_plugin_list('gradingform') as $name => $location) {
foreach (core_component::get_plugin_list('gradingform') as $name => $location) {
$list[$name] = get_string('pluginname', 'gradingform_'.$name);
}

View File

@ -2513,7 +2513,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
$gradereports = array();
$gradepreferences = array();
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
//some reports make no sense if we're not within a course
if ($courseid==$SITE->id && ($plugin=='grader' || $plugin=='user')) {
continue;
@ -2679,7 +2679,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
if (has_capability('moodle/grade:import', $context)) {
foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
if (!has_capability('gradeimport/'.$plugin.':view', $context)) {
continue;
}
@ -2717,7 +2717,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
$exportplugins = array();
if (has_capability('moodle/grade:export', $context)) {
foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
if (!has_capability('gradeexport/'.$plugin.':view', $context)) {
continue;
}

View File

@ -36,7 +36,7 @@ require_login($course);
$context = context_course::instance($course->id);
/// find all accessible reports
$reports = get_plugin_list('gradereport'); // Get all installed reports
$reports = core_component::get_plugin_list('gradereport'); // Get all installed reports
foreach ($reports as $plugin => $plugindir) { // Remove ones we can't see
if (!has_capability('gradereport/'.$plugin.':view', $context)) {

View File

@ -6863,7 +6863,7 @@ class context_module extends context {
include($subpluginsfile);
if (!empty($subplugins)) {
foreach (array_keys($subplugins) as $subplugintype) {
foreach (array_keys(get_plugin_list($subplugintype)) as $subpluginname) {
foreach (array_keys(core_component::get_plugin_list($subplugintype)) as $subpluginname) {
$subcaps = array_merge($subcaps, array_keys(load_capability_def($subplugintype.'_'.$subpluginname)));
}
}

View File

@ -368,7 +368,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return $DB->get_field('modules', 'version', array('name'=>$name));
} else {
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
if (empty($mods[$name]) or !is_readable($mods[$name].'/version.php')) {
return false;
} else {
@ -384,7 +384,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return $DB->get_field('block', 'version', array('name'=>$name));
} else {
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
if (empty($blocks[$name]) or !is_readable($blocks[$name].'/version.php')) {
return false;
} else {
@ -399,7 +399,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return get_config($type.'_'.$name, 'version');
} else {
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
if (empty($plugins[$name])) {
return false;
} else {
@ -497,7 +497,7 @@ function get_db_directories() {
/// Then, all the ones defined by core_component::get_plugin_types()
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $plugintype => $pluginbasedir) {
if ($plugins = get_plugin_list($plugintype)) {
if ($plugins = core_component::get_plugin_list($plugintype)) {
foreach ($plugins as $plugin => $plugindir) {
$dbdirs[] = $plugindir.'/db';
}
@ -4732,7 +4732,7 @@ class admin_setting_special_gradeexport extends admin_setting_configmulticheckbo
}
$this->choices = array();
if ($plugins = get_plugin_list('gradeexport')) {
if ($plugins = core_component::get_plugin_list('gradeexport')) {
foreach($plugins as $plugin => $unused) {
$this->choices[$plugin] = get_string('pluginname', 'gradeexport_'.$plugin);
}
@ -4902,7 +4902,7 @@ class admin_setting_grade_profilereport extends admin_setting_configselect {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');
$functionname = 'grade_report_'.$plugin.'_profilereport';
@ -5411,7 +5411,7 @@ class admin_page_manageqbehaviours extends admin_externalpage {
$found = false;
require_once($CFG->dirroot . '/question/engine/lib.php');
foreach (get_plugin_list('qbehaviour') as $behaviour => $notused) {
foreach (core_component::get_plugin_list('qbehaviour') as $behaviour => $notused) {
if (strpos(textlib::strtolower(question_engine::get_behaviour_name($behaviour)),
$query) !== false) {
$found = true;
@ -5499,7 +5499,7 @@ class admin_page_manageportfolios extends admin_externalpage {
}
$found = false;
$portfolios = get_plugin_list('portfolio');
$portfolios = core_component::get_plugin_list('portfolio');
foreach ($portfolios as $p => $dir) {
if (strpos($p, $query) !== false) {
$found = true;
@ -5550,7 +5550,7 @@ class admin_page_managerepositories extends admin_externalpage {
}
$found = false;
$repositories= get_plugin_list('repository');
$repositories= core_component::get_plugin_list('repository');
foreach ($repositories as $p => $dir) {
if (strpos($p, $query) !== false) {
$found = true;
@ -5632,7 +5632,7 @@ class admin_setting_manageauths extends admin_setting {
return true;
}
$authsavailable = get_plugin_list('auth');
$authsavailable = core_component::get_plugin_list('auth');
foreach ($authsavailable as $auth => $dir) {
if (strpos($auth, $query) !== false) {
return true;
@ -5663,7 +5663,7 @@ class admin_setting_manageauths extends admin_setting {
'up', 'down', 'none'));
$txt->updown = "$txt->up/$txt->down";
$authsavailable = get_plugin_list('auth');
$authsavailable = core_component::get_plugin_list('auth');
get_enabled_auth_plugins(true); // fix the list of enabled auths
if (empty($CFG->auth)) {
$authsenabled = array();
@ -6782,7 +6782,7 @@ function db_replace($search, $replace) {
rebuild_course_cache(0, true);
// TODO: we should ask all plugins to do the search&replace, for now let's do only blocks...
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $blockname=>$fullblock) {
if ($blockname === 'NEWBLOCK') { // Someone has unzipped the template, ignore it
continue;
@ -6875,7 +6875,7 @@ class admin_setting_managerepository extends admin_setting {
return true;
}
$repositories= get_plugin_list('repository');
$repositories= core_component::get_plugin_list('repository');
foreach ($repositories as $p => $dir) {
if (strpos($p, $query) !== false) {
return true;
@ -7040,7 +7040,7 @@ class admin_setting_managerepository extends admin_setting {
}
// Get all the plugins that exist on disk
$plugins = get_plugin_list('repository');
$plugins = core_component::get_plugin_list('repository');
if (!empty($plugins)) {
foreach ($plugins as $plugin => $dir) {
// Check that it has not already been listed
@ -7784,7 +7784,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting {
return true;
}
$protocols = get_plugin_list('webservice');
$protocols = core_component::get_plugin_list('webservice');
foreach ($protocols as $protocol=>$location) {
if (strpos($protocol, $query) !== false) {
return true;
@ -7816,7 +7816,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting {
$strdisable = get_string('disable');
$strversion = get_string('version');
$protocols_available = get_plugin_list('webservice');
$protocols_available = core_component::get_plugin_list('webservice');
$active_protocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
ksort($protocols_available);

View File

@ -443,7 +443,7 @@ function cron_run() {
// and finally run any local cronjobs, if any
if ($locals = get_plugin_list('local')) {
if ($locals = core_component::get_plugin_list('local')) {
mtrace('Processing customized cron scripts ...', '');
// new cron functions in lib.php first
cron_execute_plugin_type('local');
@ -589,7 +589,7 @@ function cron_bc_hack_plugin_functions($plugintype, $plugins) {
if ($plugintype === 'report') {
// Admin reports only - not course report because course report was
// never implemented before, so doesn't need BC
foreach (get_plugin_list($plugintype) as $pluginname=>$dir) {
foreach (core_component::get_plugin_list($plugintype) as $pluginname=>$dir) {
$component = $plugintype . '_' . $pluginname;
if (isset($plugins[$component])) {
// We already have detected the function using the new API
@ -612,7 +612,7 @@ function cron_bc_hack_plugin_functions($plugintype, $plugins) {
// Detect old style cron function names
// Plugin gradeexport_frog used to use grade_export_frog_cron() instead of
// new standard API gradeexport_frog_cron(). Also applies to gradeimport, gradereport
foreach(get_plugin_list($plugintype) as $pluginname=>$dir) {
foreach(core_component::get_plugin_list($plugintype) as $pluginname=>$dir) {
$component = $plugintype.'_'.$pluginname;
if (isset($plugins[$component])) {
// We already have detected the function using the new API

View File

@ -135,7 +135,7 @@ class tiynce_subplugins_settings extends admin_setting {
return true;
}
$subplugins = get_plugin_list('tinymce');
$subplugins = core_component::get_plugin_list('tinymce');
foreach ($subplugins as $name=>$dir) {
if (stripos($name, $query) !== false) {
return true;
@ -173,7 +173,7 @@ class tiynce_subplugins_settings extends admin_setting {
$struninstall = get_string('uninstallplugin', 'core_admin');
$strversion = get_string('version');
$subplugins = get_plugin_list('tinymce');
$subplugins = core_component::get_plugin_list('tinymce');
$return = $OUTPUT->heading(get_string('subplugintype_tinymce_plural', 'editor_tinymce'), 3, 'main', true);
$return .= $OUTPUT->box_start('generalbox tinymcesubplugins');

View File

@ -68,7 +68,7 @@ foreach ($string as $key=>$value) {
}
// Add subplugin strings, accept only those with proper pluginname prefix with colon.
foreach (get_plugin_list('tinymce') as $component => $ignored) {
foreach (core_component::get_plugin_list('tinymce') as $component => $ignored) {
$componentstrings = get_string_manager()->load_component_strings(
'tinymce_' . $component, $lang);
foreach ($componentstrings as $key => $value) {

View File

@ -378,7 +378,7 @@ abstract class editor_tinymce_plugin {
global $CFG;
// Get list of plugin directories.
$plugins = get_plugin_list('tinymce');
$plugins = core_component::get_plugin_list('tinymce');
// Get list of disabled subplugins.
$disabled = array();

View File

@ -158,7 +158,7 @@ function get_texteditor($editorname) {
*/
function editors_get_available() {
$editors = array();
foreach (get_plugin_list('editor') as $editorname => $dir) {
foreach (core_component::get_plugin_list('editor') as $editorname => $dir) {
$editors[$editorname] = get_string('pluginname', 'editor_'.$editorname);
}
return $editors;

View File

@ -86,7 +86,7 @@ function enrol_get_plugins($enabled) {
}
} else {
// sorted alphabetically
$plugins = get_plugin_list('enrol');
$plugins = core_component::get_plugin_list('enrol');
ksort($plugins);
}

View File

@ -513,7 +513,7 @@ function filter_get_all_installed() {
global $CFG;
$filternames = array();
foreach (get_plugin_list('filter') as $filter => $fulldir) {
foreach (core_component::get_plugin_list('filter') as $filter => $fulldir) {
if (is_readable("$fulldir/filter.php")) {
$filternames[$filter] = filter_get_name($filter);
}

View File

@ -1138,7 +1138,7 @@ function grade_grab_course_grades($courseid, $modname=null, $userid=0) {
return;
}
if (!$mods = get_plugin_list('mod') ) {
if (!$mods = core_component::get_plugin_list('mod') ) {
print_error('nomodules', 'debug');
}

View File

@ -8215,7 +8215,7 @@ function get_plugin_list_with_function($plugintype, $function, $file = 'lib.php'
* Lists plugin-like directories within specified directory
*
* This function was originally used for standard Moodle plugins, please use
* new get_plugin_list() now.
* new core_component::get_plugin_list() now.
*
* This function is used for general directory listing and backwards compatility.
*

View File

@ -2222,7 +2222,7 @@ class global_navigation extends navigation_node {
} else if ($course->id == $SITE->id && has_capability('moodle/user:viewdetails', $usercontext) && (!in_array('mycourses', $hiddenfields) || has_capability('moodle/user:viewhiddendetails', $coursecontext))) {
// Add view grade report is permitted
$reports = get_plugin_list('gradereport');
$reports = core_component::get_plugin_list('gradereport');
arsort($reports); // user is last, we want to test it first
$userscourses = enrol_get_users_courses($user->id);
@ -3572,7 +3572,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports.
$reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null,
new pix_icon('i/stats', ''));
$coursereports = get_plugin_list('coursereport');
$coursereports = core_component::get_plugin_list('coursereport');
foreach ($coursereports as $report => $dir) {
$libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
if (file_exists($libfile)) {
@ -3595,7 +3595,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/grade:viewall', $coursecontext)) {
$reportavailable = true;
} else if (!empty($course->showgrades)) {
$reports = get_plugin_list('gradereport');
$reports = core_component::get_plugin_list('gradereport');
if (is_array($reports) && count($reports)>0) { // Get all installed reports
arsort($reports); // user is last, we want to test it first
foreach ($reports as $plugin => $plugindir) {
@ -4297,7 +4297,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports.
$frontpagenav = $frontpage->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null,
new pix_icon('i/stats', ''));
$coursereports = get_plugin_list('coursereport');
$coursereports = core_component::get_plugin_list('coursereport');
foreach ($coursereports as $report=>$dir) {
$libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
if (file_exists($libfile)) {

View File

@ -609,7 +609,7 @@ class theme_config {
$files = array();
// first editor plugins
$plugins = get_plugin_list('editor');
$plugins = core_component::get_plugin_list('editor');
foreach ($plugins as $plugin=>$fulldir) {
$sheetfile = "$fulldir/editor_styles.css";
if (is_readable($sheetfile)) {
@ -778,7 +778,7 @@ class theme_config {
if ($type === 'theme' || (!empty($excludes[$type]) and $excludes[$type] === true)) {
continue;
}
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $plugin=>$fulldir) {
if (!empty($excludes[$type]) and is_array($excludes[$type])
and in_array($plugin, $excludes[$type])) {

View File

@ -1665,7 +1665,7 @@ class YUI_config {
// And finally the plugins.
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $plugintype => $pathroot) {
$pluginlist = get_plugin_list($plugintype);
$pluginlist = core_component::get_plugin_list($plugintype);
foreach ($pluginlist as $plugin => $path) {
if ($module = $this->get_moodle_path_metadata($path)) {
$moodlemodules = array_merge($moodlemodules, $module);

View File

@ -459,7 +459,7 @@ class phpunit_util extends testing_util {
$plugintypes = core_component::get_plugin_types();
ksort($plugintypes);
foreach ($plugintypes as $type=>$unused) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug=>$fullplug) {
if (!file_exists("$fullplug/tests/")) {

View File

@ -188,7 +188,7 @@ function plagiarism_load_available_plugins() {
if (empty($CFG->enableplagiarism)) {
return array();
}
$plagiarismplugins = get_plugin_list('plagiarism');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
$availableplugins = array();
foreach($plagiarismplugins as $plugin => $dir) {
//check this plugin is enabled and a lib file exists.

View File

@ -2460,7 +2460,7 @@ abstract class plugininfo_base {
public static function get_plugins($type, $typerootdir, $typeclass) {
// get the information about plugins at the disk
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
$ondisk = array();
foreach ($plugins as $pluginname => $pluginrootdir) {
$ondisk[$pluginname] = plugininfo_default_factory::make($type, $typerootdir,

View File

@ -815,7 +815,7 @@ function portfolio_plugin_sanity_check($plugins=null) {
if (is_string($plugins)) {
$plugins = array($plugins);
} else if (empty($plugins)) {
$plugins = get_plugin_list('portfolio');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
}

View File

@ -138,7 +138,7 @@ function questions_in_use($questionids) {
return true;
}
foreach (get_plugin_list('mod') as $module => $path) {
foreach (core_component::get_plugin_list('mod') as $module => $path) {
$lib = $path . '/lib.php';
if (is_readable($lib)) {
include_once($lib);

View File

@ -66,7 +66,7 @@ class tests_finder {
$plugintypes = core_component::get_plugin_types();
ksort($plugintypes);
foreach ($plugintypes as $type => $unused) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug => $fullplug) {
// Look for tests recursively

View File

@ -690,7 +690,7 @@ abstract class testing_util {
$versions['core'] = $version;
// modules
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
ksort($mods);
foreach ($mods as $mod => $fullmod) {
$module = new stdClass();
@ -704,7 +704,7 @@ abstract class testing_util {
unset($plugintypes['mod']);
ksort($plugintypes);
foreach ($plugintypes as $type => $unused) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug => $fullplug) {
$plugin = new stdClass();

View File

@ -385,7 +385,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
return upgrade_plugins_blocks($startcallback, $endcallback, $verbose);
}
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug=>$fullplug) {
// Reset time so that it works when installing a large number of plugins
@ -540,7 +540,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
global $CFG, $DB;
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod=>$fullmod) {
@ -715,7 +715,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
//Is this a first install
$first_install = null;
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $blockname=>$fullblock) {

View File

@ -65,7 +65,7 @@ class assign_admin_page_manage_assign_plugins extends admin_externalpage {
$found = false;
$textlib = new textlib();
foreach (get_plugin_list($this->subtype) as $name => $notused) {
foreach (core_component::get_plugin_list($this->subtype) as $name => $notused) {
if (strpos($textlib::strtolower(get_string('pluginname', $this->subtype . '_' . $name)),
$query) !== false) {
$found = true;
@ -116,7 +116,7 @@ class assign_plugin_manager {
* @return array The list of plugins
*/
public function get_sorted_plugins_list() {
$names = get_plugin_list($this->subtype);
$names = core_component::get_plugin_list($this->subtype);
$result = array();

View File

@ -75,7 +75,7 @@ abstract class assign_plugin {
* @return bool
*/
public final function is_last() {
$lastindex = count(get_plugin_list($this->get_subtype()))-1;
$lastindex = count(core_component::get_plugin_list($this->get_subtype()))-1;
$currentindex = get_config($this->get_subtype() . '_' . $this->get_type(), 'sortorder');
if ($lastindex == $currentindex) {
return true;

View File

@ -858,7 +858,7 @@ function assign_cron() {
require_once($CFG->dirroot . '/mod/assign/locallib.php');
assign::cron();
$plugins = get_plugin_list('assignsubmission');
$plugins = core_component::get_plugin_list('assignsubmission');
foreach ($plugins as $name => $plugin) {
$disabled = get_config('assignsubmission_' . $name, 'disabled');
@ -868,7 +868,7 @@ function assign_cron() {
$class::cron();
}
}
$plugins = get_plugin_list('assignfeedback');
$plugins = core_component::get_plugin_list('assignfeedback');
foreach ($plugins as $name => $plugin) {
$disabled = get_config('assignfeedback_' . $name, 'disabled');

View File

@ -331,7 +331,7 @@ class assign {
global $CFG;
$result = array();
$names = get_plugin_list($subtype);
$names = core_component::get_plugin_list($subtype);
foreach ($names as $name => $path) {
if (file_exists($path . '/locallib.php')) {

View File

@ -40,7 +40,7 @@ assign_plugin_manager::add_admin_assign_plugin_settings('assignfeedback', $ADMIN
if ($ADMIN->fulltree) {
$menu = array();
foreach (get_plugin_list('assignfeedback') as $type => $notused) {
foreach (core_component::get_plugin_list('assignfeedback') as $type => $notused) {
$visible = !get_config('assignfeedback_' . $type, 'disabled');
if ($visible) {
$menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type);

View File

@ -54,7 +54,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
public function test_get_feedback_plugins() {
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
$installedplugins = array_keys(get_plugin_list('assignfeedback'));
$installedplugins = array_keys(core_component::get_plugin_list('assignfeedback'));
foreach ($assign->get_feedback_plugins() as $plugin) {
$this->assertContains($plugin->get_type(), $installedplugins, 'Feedback plugin not in list of installed plugins');
@ -64,7 +64,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
public function test_get_submission_plugins() {
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
$installedplugins = array_keys(get_plugin_list('assignsubmission'));
$installedplugins = array_keys(core_component::get_plugin_list('assignsubmission'));
foreach ($assign->get_submission_plugins() as $plugin) {
$this->assertContains($plugin->get_type(), $installedplugins, 'Submission plugin not in list of installed plugins');

View File

@ -173,7 +173,7 @@ class moodle1_mod_assignment_handler extends moodle1_mod_handler {
if (is_null($this->subpluginhandlers)) {
$this->subpluginhandlers = array();
$subplugins = get_plugin_list('assignment');
$subplugins = core_component::get_plugin_list('assignment');
foreach ($subplugins as $name => $dir) {
$handlerfile = $dir.'/backup/moodle1/lib.php';
$handlerclass = "moodle1_mod_assignment_{$name}_subplugin_handler";

View File

@ -2825,7 +2825,7 @@ function assignment_cron () {
global $CFG, $USER, $DB;
/// first execute all crons in plugins
if ($plugins = get_plugin_list('assignment')) {
if ($plugins = core_component::get_plugin_list('assignment')) {
foreach ($plugins as $plugin=>$dir) {
require_once("$dir/assignment.class.php");
$assignmentclass = "assignment_$plugin";
@ -3637,7 +3637,7 @@ function assignment_get_coursemodule_info($coursemodule) {
*/
function assignment_types() {
$types = array();
$names = get_plugin_list('assignment');
$names = core_component::get_plugin_list('assignment');
foreach ($names as $name=>$dir) {
$types[$name] = get_string('type'.$name, 'assignment');
@ -3820,7 +3820,7 @@ function assignment_get_types() {
}
/// Drop-in extra assignment types
$assignmenttypes = get_plugin_list('assignment');
$assignmenttypes = core_component::get_plugin_list('assignment');
foreach ($assignmenttypes as $assignmenttype=>$fulldir) {
if (!empty($CFG->{'assignment_hide_'.$assignmenttype})) { // Not wanted
continue;
@ -3880,7 +3880,7 @@ function assignment_reset_userdata($data) {
global $CFG;
$status = array();
foreach (get_plugin_list('assignment') as $type=>$dir) {
foreach (core_component::get_plugin_list('assignment') as $type=>$dir) {
require_once("$dir/assignment.class.php");
$assignmentclass = "assignment_$type";
$ass = new $assignmentclass();

View File

@ -229,7 +229,7 @@ function book_get_view_actions() {
$return = array('view', 'view all');
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");
@ -254,7 +254,7 @@ function book_get_post_actions() {
$return = array('update');
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");
@ -303,7 +303,7 @@ function book_supports($feature) {
function book_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE;
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");

View File

@ -240,7 +240,7 @@ switch ($mode) {
/// Print the browsing interface
///get the list of possible fields (plugins)
$plugins = get_plugin_list('datafield');
$plugins = core_component::get_plugin_list('datafield');
$menufield = array();
foreach ($plugins as $plugin=>$fulldir){

View File

@ -1877,7 +1877,7 @@ function data_get_available_presets($context) {
$presets = array();
// First load the ratings sub plugins that exist within the modules preset dir
if ($dirs = get_plugin_list('datapreset')) {
if ($dirs = core_component::get_plugin_list('datapreset')) {
foreach ($dirs as $dir=>$fulldir) {
if (is_directory_a_preset($fulldir)) {
$preset = new stdClass();

View File

@ -803,7 +803,7 @@ function lesson_extend_settings_navigation($settings, $lessonnode) {
*/
function lesson_get_import_export_formats($type) {
global $CFG;
$fileformats = get_plugin_list("qformat");
$fileformats = core_component::get_plugin_list("qformat");
$fileformatname=array();
foreach ($fileformats as $fileformat=>$fdir) {

View File

@ -113,7 +113,7 @@ function xmldb_quiz_upgrade($oldversion) {
// Get a list of response variables that have files.
require_once($CFG->dirroot . '/question/type/questiontypebase.php');
$variables = array();
foreach (get_plugin_list('qtype') as $qtypename => $path) {
foreach (core_component::get_plugin_list('qtype') as $qtypename => $path) {
$file = $path . '/questiontype.php';
if (!is_readable($file)) {
continue;

View File

@ -331,7 +331,7 @@ function quiz_report_list($context) {
}
$reports = $DB->get_records('quiz_reports', null, 'displayorder DESC', 'name, capability');
$reportdirs = get_plugin_list('quiz');
$reportdirs = core_component::get_plugin_list('quiz');
// Order the reports tab in descending order of displayorder.
$reportcaps = array();

View File

@ -35,7 +35,7 @@ function scorm_report_list($context) {
if (!empty($reportlist)) {
return $reportlist;
}
$installed = get_plugin_list('scormreport');
$installed = core_component::get_plugin_list('scormreport');
foreach ($installed as $reportname => $notused) {
$pluginfile = $CFG->dirroot.'/mod/scorm/report/'.$reportname.'/report.php';
if (is_readable($pluginfile)) {

View File

@ -268,7 +268,7 @@ class moodle1_mod_workshop_handler extends moodle1_mod_handler {
if (is_null($this->strategyhandlers)) {
$this->strategyhandlers = array();
$subplugins = get_plugin_list('workshopform');
$subplugins = core_component::get_plugin_list('workshopform');
foreach ($subplugins as $name => $dir) {
$handlerfile = $dir.'/backup/moodle1/lib.php';
$handlerclass = "moodle1_workshopform_{$name}_handler";

View File

@ -211,21 +211,21 @@ function workshop_delete_instance($id) {
$DB->delete_records_list('workshop_submissions', 'id', array_keys($submissions));
// call the static clean-up methods of all available subplugins
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$strategy.'_strategy';
call_user_func($classname.'::delete_instance', $workshop->id);
}
$allocators = get_plugin_list('workshopallocation');
$allocators = core_component::get_plugin_list('workshopallocation');
foreach ($allocators as $allocator => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$allocator.'_allocator';
call_user_func($classname.'::delete_instance', $workshop->id);
}
$evaluators = get_plugin_list('workshopeval');
$evaluators = core_component::get_plugin_list('workshopeval');
foreach ($evaluators as $evaluator => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$evaluator.'_evaluation';
@ -974,7 +974,7 @@ function workshop_cron() {
function workshop_scale_used($workshopid, $scaleid) {
global $CFG; // other files included from here
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $strategypath) {
$strategylib = $strategypath . '/lib.php';
if (is_readable($strategylib)) {
@ -1007,7 +1007,7 @@ function workshop_scale_used($workshopid, $scaleid) {
function workshop_scale_used_anywhere($scaleid) {
global $CFG; // other files included from here
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $strategypath) {
$strategylib = $strategypath . '/lib.php';
if (is_readable($strategylib)) {

View File

@ -212,7 +212,7 @@ class workshop {
* @return array Array ['string' => 'string'] of localized allocation method names
*/
public static function installed_allocators() {
$installed = get_plugin_list('workshopallocation');
$installed = core_component::get_plugin_list('workshopallocation');
$forms = array();
foreach ($installed as $allocation => $allocationpath) {
if (file_exists($allocationpath . '/lib.php')) {
@ -287,7 +287,7 @@ class workshop {
* @return array ['string' => 'string']
*/
public static function available_strategies_list() {
$installed = get_plugin_list('workshopform');
$installed = core_component::get_plugin_list('workshopform');
$forms = array();
foreach ($installed as $strategy => $strategypath) {
if (file_exists($strategypath . '/lib.php')) {

View File

@ -61,7 +61,7 @@ if ($ADMIN->fulltree) {
get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));
// include the settings of allocation subplugins
$allocators = get_plugin_list('workshopallocation');
$allocators = core_component::get_plugin_list('workshopallocation');
foreach ($allocators as $allocator => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopallocationsetting'.$allocator,
@ -71,7 +71,7 @@ if ($ADMIN->fulltree) {
}
// include the settings of grading strategy subplugins
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopformsetting'.$strategy,
@ -81,7 +81,7 @@ if ($ADMIN->fulltree) {
}
// include the settings of grading evaluation subplugins
$evaluations = get_plugin_list('workshopeval');
$evaluations = core_component::get_plugin_list('workshopeval');
foreach ($evaluations as $evaluation => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopevalsetting'.$evaluation,

View File

@ -133,7 +133,7 @@ abstract class question_bank {
* @return bool whether this question type exists.
*/
public static function qtype_exists($qtypename) {
return array_key_exists($qtypename, get_plugin_list('qtype'));
return array_key_exists($qtypename, core_component::get_plugin_list('qtype'));
}
/**
@ -149,7 +149,7 @@ abstract class question_bank {
*/
public static function get_all_qtypes() {
$qtypes = array();
foreach (get_plugin_list('qtype') as $plugin => $notused) {
foreach (core_component::get_plugin_list('qtype') as $plugin => $notused) {
try {
$qtypes[$plugin] = self::get_qtype($plugin);
} catch (coding_exception $e) {

View File

@ -225,7 +225,7 @@ abstract class question_engine {
*/
public static function get_archetypal_behaviours() {
$archetypes = array();
$behaviours = get_plugin_list('qbehaviour');
$behaviours = core_component::get_plugin_list('qbehaviour');
foreach ($behaviours as $behaviour => $notused) {
if (self::is_behaviour_archetypal($behaviour)) {
$archetypes[$behaviour] = self::get_behaviour_name($behaviour);

View File

@ -152,7 +152,7 @@ if (!empty($CFG->enabledevicedetection) && empty($device)) {
$table->id = 'adminthemeselector';
$table->head = array(get_string('theme'), get_string('info'));
$themes = get_plugin_list('theme');
$themes = core_component::get_plugin_list('theme');
foreach ($themes as $themename => $themedir) {

View File

@ -46,7 +46,7 @@ class user_editadvanced_form extends moodleform {
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$auths = get_plugin_list('auth');
$auths = core_component::get_plugin_list('auth');
$enabled = get_string('pluginenabled', 'core_plugin');
$disabled = get_string('plugindisabled', 'core_plugin');
$auth_options = array($enabled=>array(), $disabled=>array());

View File

@ -112,11 +112,11 @@ class core_user_external extends external_api {
// If any problems are found then exceptions are thrown with helpful error messages
$params = self::validate_parameters(self::create_users_parameters(), array('users'=>$users));
$availableauths = get_plugin_list('auth');
$availableauths = core_component::get_plugin_list('auth');
unset($availableauths['mnet']); // these would need mnethostid too
unset($availableauths['webservice']); // we do not want new webservice users for now
$availablethemes = get_plugin_list('theme');
$availablethemes = core_component::get_plugin_list('theme');
$availablelangs = get_string_manager()->get_list_of_translations();
$transaction = $DB->start_delegated_transaction();

View File

@ -121,7 +121,7 @@ class user_filtering {
case 'nevermodified': return new user_filter_checkbox('nevermodified', get_string('nevermodified', 'filters'), $advanced, array('timemodified', 'timecreated'), array('timemodified_sck', 'timemodified_eck'));
case 'cohort': return new user_filter_cohort($advanced);
case 'auth':
$plugins = get_plugin_list('auth');
$plugins = core_component::get_plugin_list('auth');
$choices = array();
foreach ($plugins as $auth => $unused) {
$choices[$auth] = get_string('pluginname', "auth_{$auth}");

View File

@ -392,7 +392,7 @@ function profile_list_datatypes() {
$datatypes = array();
$plugins = get_plugin_list('profilefield');
$plugins = core_component::get_plugin_list('profilefield');
foreach ($plugins as $type=>$unused) {
$datatypes[$type] = get_string('pluginname', 'profilefield_'.$type);
}