| 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/template/ |
Upload File : |
<?php
/**
* @file classes/template/PKPTemplateResource.inc.php
*
* Copyright (c) 2016-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 PKPTemplateResource
* @ingroup template
*
* @brief Representation for a PKP template resource (template directory).
*/
class PKPTemplateResource extends Smarty_Resource_Custom {
/** @var array|string Template path or list of paths */
protected $_templateDir;
/**
* Constructor
* @param $templateDir string|array Template directory
*/
function __construct($templateDir) {
if (is_string($templateDir)) $this->_templateDir = array($templateDir);
else $this->_templateDir = $templateDir;
}
/**
* Resource function to get a template.
* @param $name string Template name
* @param $source string Reference to variable receiving fetched Smarty source
* @param $mtime Modification time
* @return boolean
*/
function fetch($name, &$source, &$mtime) {
$filename = $this->_getFilename($name);
$mtime = filemtime($filename);
if ($mtime === false) return false;
$source = file_get_contents($filename);
return ($source !== false);
}
/**
* Get the timestamp for the specified template.
* @param $name string Template name
* @return int|boolean
*/
protected function fetchTimestamp($name) {
return filemtime($this->_getFilename($name));
}
/**
* Get the complete template path and filename.
* @param $name Template name.
* @return string|null
*/
protected function _getFilename($template) {
$filePath = null;
foreach ($this->_templateDir as $path) {
$filePath = $path . DIRECTORY_SEPARATOR . $template;
if (file_exists($filePath)) break;
}
HookRegistry::call('TemplateResource::getFilename', array(&$filePath, $template));
return $filePath;
}
}