original_string: function get_plugin_type($dirpath) {
          global $CFG;
          $dirpath = $CFG->dirroot.$dirpath;
          // Reverse order so that we get subplugin matches.
          $plugintypes = array_reverse(core_component::get_plugin_types());
          foreach ($plugintypes as $plugintype => $pluginbasedir) {
              if (substr($dirpath, 0, strlen($pluginbasedir)) == $pluginbasedir) {
                  return $plugintype;
              }
          }
          return null;
      }
code: function get_plugin_type($dirpath) {
          global $CFG;
          $dirpath = $CFG->dirroot.$dirpath;
          // Reverse order so that we get subplugin matches.
          $plugintypes = array_reverse(core_component::get_plugin_types());
          foreach ($plugintypes as $plugintype => $pluginbasedir) {
              if (substr($dirpath, 0, strlen($pluginbasedir)) == $pluginbasedir) {
                  return $plugintype;
              }
          }
          return null;
      }
code_tokens: function get_plugin_type ( $ dirpath ) { global $ CFG ; $ dirpath = $ CFG -> dirroot . $ dirpath ; // Reverse order so that we get subplugin matches. $ plugintypes = array_reverse ( core_component :: get_plugin_types ( ) ) ; foreach ( $ plugintypes as $ plugintype => $ pluginbasedir ) { if ( substr ( $ dirpath , 0 , strlen ( $ pluginbasedir ) ) == $ pluginbasedir ) { return $ plugintype ; } } return null ; }
docstring: From a given path, work out what type of plugin
  this belongs to
  @param string $dirpath Path to the db file for this plugin
  @return string the type of the plugin or null if not found
docstring_tokens: From a given path work out what type of plugin this belongs to