MDL-38109 use always get_plugin_list() to get list of plugins
authorPetr Škoda <commits@skodak.org>
Fri, 7 Jun 2013 15:26:01 +0000 (17:26 +0200)
committerPetr Škoda <commits@skodak.org>
Tue, 11 Jun 2013 08:22:45 +0000 (10:22 +0200)
get_list_of_plugins() is NOT intended for real plugins, only plugin like directories.

lib/filterlib.php
mod/assignment/lib.php
mod/data/field.php
mod/data/lib.php

index a01de83..946c7cf 100644 (file)
@@ -513,8 +513,8 @@ function filter_get_all_installed() {
     global $CFG;
 
     $filternames = array();
-    foreach (get_list_of_plugins('filter') as $filter) {
-        if (is_readable("$CFG->dirroot/filter/$filter/filter.php")) {
+    foreach (get_plugin_list('filter') as $filter => $fulldir) {
+        if (is_readable("$fulldir/filter.php")) {
             $filternames[$filter] = filter_get_name($filter);
         }
     }
index 8ea3937..ba560cf 100644 (file)
@@ -3820,8 +3820,8 @@ function assignment_get_types() {
     }
 
     /// Drop-in extra assignment types
-    $assignmenttypes = get_list_of_plugins('mod/assignment/type');
-    foreach ($assignmenttypes as $assignmenttype) {
+    $assignmenttypes = get_plugin_list('assignment');
+    foreach ($assignmenttypes as $assignmenttype=>$fulldir) {
         if (!empty($CFG->{'assignment_hide_'.$assignmenttype})) {  // Not wanted
             continue;
         }
index 7b54450..4a08a41 100644 (file)
@@ -240,11 +240,11 @@ switch ($mode) {
 /// Print the browsing interface
 
 ///get the list of possible fields (plugins)
-$directories = get_list_of_plugins('mod/data/field/');
+$plugins = get_plugin_list('datafield');
 $menufield = array();
 
-foreach ($directories as $directory){
-    $menufield[$directory] = get_string($directory,'data');    //get from language files
+foreach ($plugins as $plugin=>$fulldir){
+    $menufield[$plugin] = get_string('pluginname', 'datafield_'.$plugin);    //get from language files
 }
 asort($menufield);    //sort in alphabetical order
 $PAGE->set_title(get_string('course') . ': ' . $course->fullname);
index 653f251..46a260c 100644 (file)
@@ -1877,9 +1877,8 @@ function data_get_available_presets($context) {
     $presets = array();
 
     // First load the ratings sub plugins that exist within the modules preset dir
-    if ($dirs = get_list_of_plugins('mod/data/preset')) {
-        foreach ($dirs as $dir) {
-            $fulldir = $CFG->dirroot.'/mod/data/preset/'.$dir;
+    if ($dirs = get_plugin_list('datapreset')) {
+        foreach ($dirs as $dir=>$fulldir) {
             if (is_directory_a_preset($fulldir)) {
                 $preset = new stdClass();
                 $preset->path = $fulldir;