/**
  * Is this filename valid (contains a unique participant ID) for import?
  *
  * @param sepl $seplment - The seplment instance
  * @param stored_file $fileinfo - The fileinfo
  * @param array $participants - A list of valid participants for this module indexed by unique_id
  * @param stdClass $user - Set to the user that matches by participant id
  * @param sepl_plugin $plugin - Set to the plugin that exported the file
  * @param string $filename - Set to truncated filename (prefix stripped)
  * @return true If the participant Id can be extracted and this is a valid user
  */
 public function is_valid_filename_for_import($seplment, $fileinfo, $participants, &$user, &$plugin, &$filename)
 {
     if ($fileinfo->is_directory()) {
         return false;
     }
     // Ignore hidden files.
     if (strpos($fileinfo->get_filename(), '.') === 0) {
         return false;
     }
     // Ignore hidden files.
     if (strpos($fileinfo->get_filename(), '~') === 0) {
         return false;
     }
     $info = explode('_', $fileinfo->get_filename(), 5);
     if (count($info) < 5) {
         return false;
     }
     $participantid = $info[1];
     $filename = $info[4];
     $plugin = $seplment->get_plugin_by_type($info[2], $info[3]);
     if (!is_numeric($participantid)) {
         return false;
     }
     if (!$plugin) {
         return false;
     }
     // Convert to int.
     $participantid += 0;
     if (empty($participants[$participantid])) {
         return false;
     }
     $user = $participants[$participantid];
     return true;
 }