original_string: public function load_plugins($subtype) {
          global $CFG;
          $result = array();
  
          $names = core_component::get_plugin_list($subtype);
  
          foreach ($names as $name => $path) {
              if (file_exists($path . '/locallib.php')) {
                  require_once($path . '/locallib.php');
  
                  $shortsubtype = substr($subtype, strlen('assign'));
                  $pluginclass = 'assign_' . $shortsubtype . '_' . $name;
  
                  $plugin = new $pluginclass($this, $name);
  
                  if ($plugin instanceof assign_plugin) {
                      $idx = $plugin->get_sort_order();
                      while (array_key_exists($idx, $result)) {
                          $idx +=1;
                      }
                      $result[$idx] = $plugin;
                  }
              }
          }
          ksort($result);
          return $result;
      }
code: public function load_plugins($subtype) {
          global $CFG;
          $result = array();
  
          $names = core_component::get_plugin_list($subtype);
  
          foreach ($names as $name => $path) {
              if (file_exists($path . '/locallib.php')) {
                  require_once($path . '/locallib.php');
  
                  $shortsubtype = substr($subtype, strlen('assign'));
                  $pluginclass = 'assign_' . $shortsubtype . '_' . $name;
  
                  $plugin = new $pluginclass($this, $name);
  
                  if ($plugin instanceof assign_plugin) {
                      $idx = $plugin->get_sort_order();
                      while (array_key_exists($idx, $result)) {
                          $idx +=1;
                      }
                      $result[$idx] = $plugin;
                  }
              }
          }
          ksort($result);
          return $result;
      }
code_tokens: public function load_plugins ( $ subtype ) { global $ CFG ; $ result = array ( ) ; $ names = core_component :: get_plugin_list ( $ subtype ) ; foreach ( $ names as $ name => $ path ) { if ( file_exists ( $ path . '/locallib.php' ) ) { require_once ( $ path . '/locallib.php' ) ; $ shortsubtype = substr ( $ subtype , strlen ( 'assign' ) ) ; $ pluginclass = 'assign_' . $ shortsubtype . '_' . $ name ; $ plugin = new $ pluginclass ( $ this , $ name ) ; if ( $ plugin instanceof assign_plugin ) { $ idx = $ plugin -> get_sort_order ( ) ; while ( array_key_exists ( $ idx , $ result ) ) { $ idx += 1 ; } $ result [ $ idx ] = $ plugin ; } } } ksort ( $ result ) ; return $ result ; }
docstring: Load the plugins from the sub folders under subtype.
  
  @param string $subtype - either submission or feedback
  @return array - The sorted list of plugins
docstring_tokens: Load the plugins from the sub folders under subtype .