mirror of
https://github.com/smarty-php/smarty.git
synced 2026-07-11 02:40:49 +02:00
7408c18cdc
Removed $smarty->_current_file and $smarty->allow_ambiguous_resources properties, both unused. Removed public Source::filepath property.
Cached an Compiled files (and Exceptions) no longer rely on the filepath being set. Removed explicit tests for cached and compiled filenames. The exact implementation is not important. Added tests for compile_check property, fixing a file_exists check that would always be done on source template files, even when compile_check was true. Remove code duplication between Source en Config classes. Added a local $_smarty_current_dir to the generated code files for backwards compatability for {$smarty.current_dir}.
35 lines
786 B
PHP
35 lines
786 B
PHP
<?php
|
|
|
|
/*
|
|
* Smarty plugin
|
|
* -------------------------------------------------------------
|
|
* File: resource.db3.php
|
|
* Type: resource
|
|
* Name: db
|
|
* Purpose: Fetches templates from a database
|
|
* -------------------------------------------------------------
|
|
*/
|
|
|
|
use Smarty\Template;
|
|
use Smarty\Template\Source;
|
|
|
|
class Smarty_Resource_Db3 extends Smarty\Resource\BasePlugin
|
|
{
|
|
public function populate(Source $source, Template $_template = null)
|
|
{
|
|
$source->uid = sha1($source->resource);
|
|
$source->timestamp = 0;
|
|
$source->exists = true;
|
|
}
|
|
|
|
public function getContent(Source $source)
|
|
{
|
|
return '{$x="hello world"}{$x}';
|
|
}
|
|
|
|
public function getCompiledFilepath(Template $_template)
|
|
{
|
|
return false;
|
|
}
|
|
}
|