diff --git a/admin/tool/customlang/filter_form.php b/admin/tool/customlang/filter_form.php index 547a8a4d51335..19d74c1c76844 100644 --- a/admin/tool/customlang/filter_form.php +++ b/admin/tool/customlang/filter_form.php @@ -39,7 +39,7 @@ function definition() { // Component $options = array(); foreach (tool_customlang_utils::list_components() as $component => $normalized) { - list($type, $plugin) = normalize_component($normalized); + list($type, $plugin) = core_component::normalize_component($normalized); if ($type == 'core' and is_null($plugin)) { $plugin = 'moodle'; } diff --git a/admin/tool/customlang/locallib.php b/admin/tool/customlang/locallib.php index f209785de3117..2492730944886 100644 --- a/admin/tool/customlang/locallib.php +++ b/admin/tool/customlang/locallib.php @@ -267,7 +267,7 @@ protected static function dump_strings($lang, $component, $strings) { if ($filename !== clean_param($filename, PARAM_FILE)) { throw new coding_exception('Incorrect file name '.s($filename)); } - list($package, $subpackage) = normalize_component($component); + list($package, $subpackage) = core_component::normalize_component($component); $packageinfo = " * @package $package"; if (!is_null($subpackage)) { $packageinfo .= "\n * @subpackage $subpackage"; diff --git a/admin/tool/installaddon/classes/installer.php b/admin/tool/installaddon/classes/installer.php index d3affb98af640..37c36007c3f20 100644 --- a/admin/tool/installaddon/classes/installer.php +++ b/admin/tool/installaddon/classes/installer.php @@ -250,7 +250,7 @@ public function handle_remote_request(tool_installaddon_renderer $output, $reque exit(); } - list($plugintype, $pluginname) = normalize_component($data->component); + list($plugintype, $pluginname) = core_component::normalize_component($data->component); $plugintypepath = $this->get_plugintype_root($plugintype); diff --git a/admin/tool/installaddon/classes/validator.php b/admin/tool/installaddon/classes/validator.php index e5865c7ccd3e9..cafd9b99474ea 100644 --- a/admin/tool/installaddon/classes/validator.php +++ b/admin/tool/installaddon/classes/validator.php @@ -332,7 +332,7 @@ protected function validate_version_php() { if (isset($info[$type.'->component'])) { $this->versionphp['component'] = $info[$type.'->component']; - list($reqtype, $reqname) = normalize_component($this->versionphp['component']); + list($reqtype, $reqname) = core_component::normalize_component($this->versionphp['component']); if ($reqtype !== $this->assertions['plugintype']) { $this->add_message(self::ERROR, 'componentmismatchtype', array( 'expected' => $this->assertions['plugintype'], diff --git a/comment/lib.php b/comment/lib.php index ef1e619cd80c1..5381866c42420 100644 --- a/comment/lib.php +++ b/comment/lib.php @@ -260,7 +260,7 @@ public function set_component($component) { throw new coding_exception('You cannot change the component of a comment once it has been set'); } $this->component = $component; - list($this->plugintype, $this->pluginname) = normalize_component($component); + list($this->plugintype, $this->pluginname) = core_component::normalize_component($component); } /** diff --git a/course/dnduploadlib.php b/course/dnduploadlib.php index 45564e878e46c..a1b8d02253d91 100644 --- a/course/dnduploadlib.php +++ b/course/dnduploadlib.php @@ -122,7 +122,7 @@ public function __construct($course, $modnames = null) { // Loop through all modules to find handlers. $mods = get_plugin_list_with_function('mod', 'dndupload_register'); foreach ($mods as $component => $funcname) { - list($modtype, $modname) = normalize_component($component); + list($modtype, $modname) = core_component::normalize_component($component); if ($modnames && !array_key_exists($modname, $modnames)) { continue; // Module is deactivated (hidden) at the site level. } diff --git a/grade/grading/form/lib.php b/grade/grading/form/lib.php index 6c8c8acc5da2a..f28c5162a939f 100644 --- a/grade/grading/form/lib.php +++ b/grade/grading/form/lib.php @@ -88,7 +88,7 @@ public function __construct(stdClass $context, $component, $area, $areaid) { global $DB; $this->context = $context; - list($type, $name) = normalize_component($component); + list($type, $name) = core_component::normalize_component($component); $this->component = $type.'_'.$name; $this->area = $area; $this->areaid = $areaid; diff --git a/grade/grading/lib.php b/grade/grading/lib.php index c0cd8ce4dee6f..215d346bd93a2 100644 --- a/grade/grading/lib.php +++ b/grade/grading/lib.php @@ -139,7 +139,7 @@ public function get_component() { */ public function set_component($component) { $this->areacache = null; - list($type, $name) = normalize_component($component); + list($type, $name) = core_component::normalize_component($component); $this->component = $type.'_'.$name; } @@ -288,7 +288,7 @@ public function get_available_methods($includenone = true) { public static function available_areas($component) { global $CFG; - list($plugintype, $pluginname) = normalize_component($component); + list($plugintype, $pluginname) = core_component::normalize_component($component); if ($component === 'core_grading') { return array(); diff --git a/lib/accesslib.php b/lib/accesslib.php index 02df5586b8e78..a8cc9c09102c5 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2895,7 +2895,7 @@ function get_component_string($component, $contextlevel) { } } - list($type, $name) = normalize_component($component); + list($type, $name) = core_component::normalize_component($component); $dir = core_component::get_plugin_directory($type, $name); if (!file_exists($dir)) { // plugin not installed, bad luck, there is no way to find the name diff --git a/lib/adminlib.php b/lib/adminlib.php index f10b899f371d5..d4f8853a5dfd7 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -342,7 +342,7 @@ function uninstall_plugin($type, $name) { function get_component_version($component, $source='installed') { global $CFG, $DB; - list($type, $name) = normalize_component($component); + list($type, $name) = core_component::normalize_component($component); // moodle core or a core subsystem if ($type === 'core') { diff --git a/lib/messagelib.php b/lib/messagelib.php index defa97d34e8a0..c07af1dab2b30 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -414,7 +414,7 @@ function message_get_providers_for_user($userid) { // If the component is an enrolment plugin, check it is enabled foreach ($providers as $providerid => $provider) { - list($type, $name) = normalize_component($provider->component); + list($type, $name) = core_component::normalize_component($provider->component); if ($type == 'enrol' && !enrol_is_enabled($name)) { unset($providers[$providerid]); } diff --git a/lib/outputfactories.php b/lib/outputfactories.php index 1d8183f324d28..499ca562a570b 100644 --- a/lib/outputfactories.php +++ b/lib/outputfactories.php @@ -165,7 +165,7 @@ protected function standard_renderer_classname($component, $subtype = null) { global $CFG; // needed in included files // standardize component name ala frankenstyle - list($plugin, $type) = normalize_component($component); + list($plugin, $type) = core_component::normalize_component($component); if ($type === null) { $component = $plugin; } else { diff --git a/lib/pluginlib.php b/lib/pluginlib.php index c4fa6b106211f..4926796e101ba 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -868,7 +868,7 @@ public static function standard_plugins_list($type) { } /** - * Wrapper for the core function {@link normalize_component()}. + * Wrapper for the core function {@link core_component::normalize_component()}. * * This is here just to make it possible to mock it in unit tests. * @@ -876,7 +876,7 @@ public static function standard_plugins_list($type) { * @return array */ protected function normalize_component($component) { - return normalize_component($component); + return core_component::normalize_component($component); } /** @@ -1619,7 +1619,7 @@ protected function cron_notifications(array $changes) { // is a real update with higher version. That is, the $componentchange // is present in the array of {@link available_update_info} objects // returned by the plugin's available_updates() method. - list($plugintype, $pluginname) = normalize_component($component); + list($plugintype, $pluginname) = core_component::normalize_component($component); if (!empty($plugins[$plugintype][$pluginname])) { $availableupdates = $plugins[$plugintype][$pluginname]->available_updates(); if (!empty($availableupdates)) { @@ -1974,7 +1974,7 @@ public function deployment_impediments(available_update_info $info) { public function plugin_external_source(available_update_info $info) { $paths = core_component::get_plugin_types(); - list($plugintype, $pluginname) = normalize_component($info->component); + list($plugintype, $pluginname) = core_component::normalize_component($info->component); $pluginroot = $paths[$plugintype].'/'.$pluginname; if (is_dir($pluginroot.'/.git')) { @@ -2033,7 +2033,7 @@ public function make_execution_widget(available_update_info $info, moodle_url $r $pluginrootpaths = core_component::get_plugin_types(); - list($plugintype, $pluginname) = normalize_component($info->component); + list($plugintype, $pluginname) = core_component::normalize_component($info->component); if (empty($pluginrootpaths[$plugintype])) { throw new coding_exception('Unknown plugin type root location', $plugintype); @@ -2302,7 +2302,7 @@ protected function generate_password() { */ protected function component_writable($component) { - list($plugintype, $pluginname) = normalize_component($component); + list($plugintype, $pluginname) = core_component::normalize_component($component); $directory = core_component::get_plugin_directory($plugintype, $pluginname); diff --git a/lib/testing/generator/data_generator.php b/lib/testing/generator/data_generator.php index 423d4a793c759..fe0f34bb9dc9a 100644 --- a/lib/testing/generator/data_generator.php +++ b/lib/testing/generator/data_generator.php @@ -95,7 +95,7 @@ public function reset() { * @return component_generator_base or rather an instance of the appropriate subclass. */ public function get_plugin_generator($component) { - list($type, $plugin) = normalize_component($component); + list($type, $plugin) = core_component::normalize_component($component); $cleancomponent = $type . '_' . $plugin; if ($cleancomponent != $component) { debugging("Please specify the component you want a generator for as " . diff --git a/lib/upgradelib.php b/lib/upgradelib.php index a11c4ead72c9e..e04b0c8089e1f 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -1164,7 +1164,7 @@ function upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) { $plugin = 'core'; } - list($plugintype, $pluginname) = normalize_component($plugin); + list($plugintype, $pluginname) = core_component::normalize_component($plugin); $component = is_null($pluginname) ? $plugintype : $plugintype . '_' . $pluginname; $backtrace = format_backtrace($backtrace, true); diff --git a/rating/lib.php b/rating/lib.php index 969fbd98c5ddf..e2d786d6b2a56 100644 --- a/rating/lib.php +++ b/rating/lib.php @@ -523,7 +523,7 @@ public function get_ratings($options) { // Get the item table name, the item id field, and the item user field for the given rating item // from the related component. - list($type, $name) = normalize_component($options->component); + list($type, $name) = core_component::normalize_component($options->component); $default = array(null, 'id', 'userid'); list($itemtablename, $itemidcol, $itemuseridcol) = plugin_callback($type, $name, 'rating', 'get_item_fields', array($options), $default); @@ -928,7 +928,7 @@ public function get_plugin_permissions_array($contextid, $component, $ratingarea $pluginpermissionsarray = null; $defaultpluginpermissions = array('rate'=>false,'view'=>false,'viewany'=>false,'viewall'=>false);//deny by default if (!empty($component)) { - list($type, $name) = normalize_component($component); + list($type, $name) = core_component::normalize_component($component); $pluginpermissionsarray = plugin_callback($type, $name, 'rating', 'permissions', array($contextid, $component, $ratingarea), $defaultpluginpermissions); } else { $pluginpermissionsarray = $defaultpluginpermissions; @@ -971,7 +971,7 @@ public function check_rating_is_valid($params) { throw new coding_exception('The rateduserid option is now a required option when checking rating validity'); } - list($plugintype, $pluginname) = normalize_component($params['component']); + list($plugintype, $pluginname) = core_component::normalize_component($params['component']); //this looks for a function like forum_rating_validate() in mod_forum lib.php //wrapping the params array in another array as call_user_func_array() expands arrays into multiple arguments diff --git a/rss/file.php b/rss/file.php index d7e47c8f4f8aa..c231c91f06b53 100644 --- a/rss/file.php +++ b/rss/file.php @@ -149,7 +149,7 @@ // Work out which component in Moodle we want (from the frankenstyle name) $componentdir = get_component_directory($componentname); -list($type, $plugin) = normalize_component($componentname); +list($type, $plugin) = core_component::normalize_component($componentname); // Call the component to check/update the feed and tell us the path to the cached file