Redbean + Smarty update
This commit is contained in:
parent
c1b8226466
commit
eb0835ff74
122 changed files with 12653 additions and 11637 deletions
|
@ -2,27 +2,23 @@
|
|||
/**
|
||||
* Smarty Internal Plugin Config
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty Internal Plugin Config
|
||||
*
|
||||
* Main class for config variables
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Config
|
||||
*
|
||||
* @property Smarty_Config_Source $source
|
||||
* @property Smarty_Config_Compiled $compiled
|
||||
* @ignore
|
||||
*/
|
||||
class Smarty_Internal_Config
|
||||
{
|
||||
/**
|
||||
* Samrty instance
|
||||
* Smarty instance
|
||||
*
|
||||
* @var Smarty object
|
||||
*/
|
||||
|
@ -35,6 +31,7 @@ class Smarty_Internal_Config
|
|||
public $data = null;
|
||||
/**
|
||||
* Config resource
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $config_resource = null;
|
||||
|
@ -58,6 +55,7 @@ class Smarty_Internal_Config
|
|||
public $compiled_timestamp = null;
|
||||
/**
|
||||
* flag if compiled config file is invalid and must be (re)compiled
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $mustCompile = null;
|
||||
|
@ -90,8 +88,8 @@ class Smarty_Internal_Config
|
|||
public function getCompiledFilepath()
|
||||
{
|
||||
return $this->compiled_filepath === null ?
|
||||
($this->compiled_filepath = $this->buildCompiledFilepath()) :
|
||||
$this->compiled_filepath;
|
||||
($this->compiled_filepath = $this->buildCompiledFilepath()) :
|
||||
$this->compiled_filepath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,14 +101,14 @@ class Smarty_Internal_Config
|
|||
{
|
||||
$_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null;
|
||||
$_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2
|
||||
+ (int) $this->smarty->config_overwrite * 4;
|
||||
$_filepath = sha1($this->source->filepath . $_flag);
|
||||
+ (int) $this->smarty->config_overwrite * 4;
|
||||
$_filepath = sha1(realpath($this->source->filepath) . $_flag);
|
||||
// if use_sub_dirs, break file into directories
|
||||
if ($this->smarty->use_sub_dirs) {
|
||||
$_filepath = substr($_filepath, 0, 2) . DS
|
||||
. substr($_filepath, 2, 2) . DS
|
||||
. substr($_filepath, 4, 2) . DS
|
||||
. $_filepath;
|
||||
. substr($_filepath, 2, 2) . DS
|
||||
. substr($_filepath, 4, 2) . DS
|
||||
. $_filepath;
|
||||
}
|
||||
$_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
|
||||
if (isset($_compile_id)) {
|
||||
|
@ -122,7 +120,7 @@ class Smarty_Internal_Config
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the timpestamp of the compiled file
|
||||
* Returns the timestamp of the compiled file
|
||||
*
|
||||
* @return integer the file timestamp
|
||||
*/
|
||||
|
@ -135,7 +133,6 @@ class Smarty_Internal_Config
|
|||
|
||||
/**
|
||||
* Returns if the current config file must be compiled
|
||||
*
|
||||
* It does compare the timestamps of config source and the compiled config and checks the force compile configuration
|
||||
*
|
||||
* @return boolean true if the file must be compiled
|
||||
|
@ -143,13 +140,12 @@ class Smarty_Internal_Config
|
|||
public function mustCompile()
|
||||
{
|
||||
return $this->mustCompile === null ?
|
||||
$this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp () === false || $this->smarty->compile_check && $this->getCompiledTimestamp () < $this->source->timestamp):
|
||||
$this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp() === false || $this->smarty->compile_check && $this->getCompiledTimestamp() < $this->source->timestamp) :
|
||||
$this->mustCompile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the compiled config file
|
||||
*
|
||||
* It checks if the config file must be compiled or just read the compiled version
|
||||
*
|
||||
* @return string the compiled config file
|
||||
|
@ -189,14 +185,15 @@ class Smarty_Internal_Config
|
|||
// call compiler
|
||||
try {
|
||||
$this->compiler_object->compileSource($this);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// restore old timestamp in case of error
|
||||
if ($this->smarty->compile_locking && $saved_timestamp) {
|
||||
touch($this->getCompiledFilepath(), $saved_timestamp);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
// compiling succeded
|
||||
// compiling succeeded
|
||||
// write compiled template
|
||||
Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);
|
||||
}
|
||||
|
@ -204,8 +201,10 @@ class Smarty_Internal_Config
|
|||
/**
|
||||
* load config variables
|
||||
*
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
* @param object $scope global,parent or local
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
* @param string $scope global,parent or local
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadConfigVars($sections = null, $scope = 'local')
|
||||
{
|
||||
|
@ -259,8 +258,9 @@ class Smarty_Internal_Config
|
|||
/**
|
||||
* set Smarty property in template context
|
||||
*
|
||||
* @param string $property_name property name
|
||||
* @param mixed $value value
|
||||
* @param string $property_name property name
|
||||
* @param mixed $value value
|
||||
*
|
||||
* @throws SmartyException if $property_name is not valid
|
||||
*/
|
||||
public function __set($property_name, $value)
|
||||
|
@ -279,7 +279,9 @@ class Smarty_Internal_Config
|
|||
/**
|
||||
* get Smarty property in template context
|
||||
*
|
||||
* @param string $property_name property name
|
||||
* @param string $property_name property name
|
||||
*
|
||||
* @return \Smarty_Config_Source|\Smarty_Template_Compiled
|
||||
* @throws SmartyException if $property_name is not valid
|
||||
*/
|
||||
public function __get($property_name)
|
||||
|
@ -301,5 +303,4 @@ class Smarty_Internal_Config
|
|||
|
||||
throw new SmartyException("config attribute '$property_name' does not exist.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue