Files
smarty/tests/UnitTests/ResourceTests/ResourcePlugins/PHPunitplugins/resource.db4.php

36 lines
842 B
PHP
Raw Normal View History

<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* File: resource.db3.php
* Type: resource
* Name: db
* Purpose: Fetches templates from a database
* -------------------------------------------------------------
*/
2022-12-22 21:23:22 +01:00
use Smarty\Template;
2023-01-03 14:12:36 +01:00
use Smarty\Template\Config;
2022-12-22 21:23:22 +01:00
use Smarty\Template\Source;
2022-12-21 16:33:26 +01:00
class Smarty_Resource_Db4 extends Smarty\Resource\BasePlugin
{
2022-12-22 21:23:22 +01:00
public function populate(Source $source, Template $_template = null)
{
$source->filepath = 'db4:';
$source->uid = sha1($source->resource);
$source->timestamp = 0;
$source->exists = true;
}
2022-12-22 21:23:22 +01:00
public function getContent(Source $source)
{
2023-01-03 14:12:36 +01:00
if ($source instanceof Config) {
return "foo = 'bar'\n";
}
return '{$x="hello world"}{$x}';
}
}