/** * Import data from a file * * @param array $file * @return array */ public function onImport($file, $scope = NULL, $scope_id = NULL) { //array of acceptable file types $acceptable = array('txt'); //get the file extension $extension = $file->getClientOriginalExtension(); //only process acceptable files if (!in_array($extension, $acceptable)) { return; } //get the file contents, uses temporary file $raw_contents = file_get_contents($file->getFilename()); //check to see if this is endnote content if (preg_match('/%A|%0|%T/', $raw_contents)) { //make new file to pass to dispatcher $new_file = array('name' => $file->getClientOriginalName() . '.enw', 'type' => $file->getType(), 'tmp_name' => $file->getName(), 'error' => $file->getError(), 'size' => $file->getClientSize()); $return = event::trigger('citation.onImport', array($new_file), $scope, $scope_id); return $return[0]; } }