* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ /** * Override module templates easily. * * @since 1.7.0.0 */ class SmartyResourceParentCore extends Smarty_Resource_Custom { /** * @var array */ public $paths; public function __construct(array $paths) { $this->paths = $paths; } /** * Fetch a template. * * @param string $name template name * @param string $source template source * @param int $mtime template modification timestamp (epoch) */ protected function fetch($name, &$source, &$mtime) { foreach ($this->paths as $path) { if (Tools::file_exists_cache($file = $path . $name)) { if (_PS_MODE_DEV_) { $source = implode('', [ '', file_get_contents($file), '', ]); } else { $source = file_get_contents($file); } $mtime = filemtime($file); return; } } } }