Redbean + Smarty update
This commit is contained in:
parent
c1b8226466
commit
eb0835ff74
122 changed files with 12653 additions and 11637 deletions
|
@ -1,18 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Smarty Internal Plugin Data
|
||||
* This file contains the basic classes and methods for template and variable creation
|
||||
*
|
||||
* This file contains the basic classes and methodes for template and variable creation
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
* @author Uwe Tews
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class with template and variable methodes
|
||||
* Base class with template and variable methods
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Internal_Data
|
||||
|
@ -45,10 +44,10 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* assigns a Smarty variable
|
||||
*
|
||||
* @param array|string $tpl_var the template variable name(s)
|
||||
* @param mixed $value the value to assign
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
* @param boolean $scope the scope the variable will have (local,parent or root)
|
||||
* @param array|string $tpl_var the template variable name(s)
|
||||
* @param mixed $value the value to assign
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function assign($tpl_var, $value = null, $nocache = false)
|
||||
|
@ -71,9 +70,10 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* assigns a global Smarty variable
|
||||
*
|
||||
* @param string $varname the global variable name
|
||||
* @param mixed $value the value to assign
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
* @param string $varname the global variable name
|
||||
* @param mixed $value the value to assign
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function assignGlobal($varname, $value = null, $nocache = false)
|
||||
|
@ -89,19 +89,21 @@ class Smarty_Internal_Data
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* assigns values to template variables by reference
|
||||
*
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param mixed $ &$value the referenced value to assign
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param $value
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function assignByRef($tpl_var, &$value, $nocache = false)
|
||||
{
|
||||
if ($tpl_var != '') {
|
||||
$this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache);
|
||||
$this->tpl_vars[$tpl_var]->value = &$value;
|
||||
$this->tpl_vars[$tpl_var]->value = & $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -110,10 +112,11 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* appends values to template variables
|
||||
*
|
||||
* @param array|string $tpl_var the template variable name(s)
|
||||
* @param mixed $value the value to append
|
||||
* @param boolean $merge flag if array elements shall be merged
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
* @param array|string $tpl_var the template variable name(s)
|
||||
* @param mixed $value the value to append
|
||||
* @param boolean $merge flag if array elements shall be merged
|
||||
* @param boolean $nocache if true any output of this variable will be not cached
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function append($tpl_var, $value = null, $merge = false, $nocache = false)
|
||||
|
@ -171,9 +174,10 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* appends values to template variables by reference
|
||||
*
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param mixed &$value the referenced value to append
|
||||
* @param boolean $merge flag if array elements shall be merged
|
||||
* @param string $tpl_var the template variable name
|
||||
* @param mixed &$value the referenced value to append
|
||||
* @param boolean $merge flag if array elements shall be merged
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function appendByRef($tpl_var, &$value, $merge = false)
|
||||
|
@ -187,10 +191,10 @@ class Smarty_Internal_Data
|
|||
}
|
||||
if ($merge && is_array($value)) {
|
||||
foreach ($value as $_key => $_val) {
|
||||
$this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
|
||||
$this->tpl_vars[$tpl_var]->value[$_key] = & $value[$_key];
|
||||
}
|
||||
} else {
|
||||
$this->tpl_vars[$tpl_var]->value[] = &$value;
|
||||
$this->tpl_vars[$tpl_var]->value[] = & $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,8 +205,9 @@ class Smarty_Internal_Data
|
|||
* Returns a single or all template variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @param string $_ptr optional pointer to data object
|
||||
* @param object $_ptr optional pointer to data object
|
||||
* @param boolean $search_parents include parent templates?
|
||||
*
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
|
||||
|
@ -218,7 +223,8 @@ class Smarty_Internal_Data
|
|||
$_result = array();
|
||||
if ($_ptr === null) {
|
||||
$_ptr = $this;
|
||||
} while ($_ptr !== null) {
|
||||
}
|
||||
while ($_ptr !== null) {
|
||||
foreach ($_ptr->tpl_vars AS $key => $var) {
|
||||
if (!array_key_exists($key, $_result)) {
|
||||
$_result[$key] = $var->value;
|
||||
|
@ -246,7 +252,8 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* clear the given assigned template variable.
|
||||
*
|
||||
* @param string|array $tpl_var the template variable(s) to clear
|
||||
* @param string|array $tpl_var the template variable(s) to clear
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function clearAssign($tpl_var)
|
||||
|
@ -264,6 +271,7 @@ class Smarty_Internal_Data
|
|||
|
||||
/**
|
||||
* clear all the assigned template variables.
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function clearAllAssign()
|
||||
|
@ -276,8 +284,9 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* load a config file, optionally load just selected sections
|
||||
*
|
||||
* @param string $config_file filename
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
* @param string $config_file filename
|
||||
* @param mixed $sections array of section names, single section or null
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function configLoad($config_file, $sections = null)
|
||||
|
@ -295,13 +304,16 @@ class Smarty_Internal_Data
|
|||
* @param string $variable the name of the Smarty variable
|
||||
* @param object $_ptr optional pointer to data object
|
||||
* @param boolean $search_parents search also in parent data
|
||||
* @param bool $error_enable
|
||||
*
|
||||
* @return object the object of the variable
|
||||
*/
|
||||
public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
|
||||
{
|
||||
if ($_ptr === null) {
|
||||
$_ptr = $this;
|
||||
} while ($_ptr !== null) {
|
||||
}
|
||||
while ($_ptr !== null) {
|
||||
if (isset($_ptr->tpl_vars[$variable])) {
|
||||
// found it, return it
|
||||
return $_ptr->tpl_vars[$variable];
|
||||
|
@ -329,6 +341,8 @@ class Smarty_Internal_Data
|
|||
* gets a config variable
|
||||
*
|
||||
* @param string $variable the name of the config variable
|
||||
* @param bool $error_enable
|
||||
*
|
||||
* @return mixed the value of the config variable
|
||||
*/
|
||||
public function getConfigVariable($variable, $error_enable = true)
|
||||
|
@ -354,6 +368,8 @@ class Smarty_Internal_Data
|
|||
* gets a stream variable
|
||||
*
|
||||
* @param string $variable the stream of the variable
|
||||
*
|
||||
* @throws SmartyException
|
||||
* @return mixed the value of the stream variable
|
||||
*/
|
||||
public function getStreamVariable($variable)
|
||||
|
@ -361,7 +377,7 @@ class Smarty_Internal_Data
|
|||
$_result = '';
|
||||
$fp = fopen($variable, 'r+');
|
||||
if ($fp) {
|
||||
while (!feof($fp) && ($current_line = fgets($fp)) !== false ) {
|
||||
while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
|
||||
$_result .= $current_line;
|
||||
}
|
||||
fclose($fp);
|
||||
|
@ -380,6 +396,8 @@ class Smarty_Internal_Data
|
|||
* Returns a single or all config variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @param bool $search_parents
|
||||
*
|
||||
* @return string variable value or or array of variables
|
||||
*/
|
||||
public function getConfigVars($varname = null, $search_parents = true)
|
||||
|
@ -394,7 +412,7 @@ class Smarty_Internal_Data
|
|||
} else {
|
||||
$var_array = array_merge($_ptr->config_vars, $var_array);
|
||||
}
|
||||
// not found, try at parent
|
||||
// not found, try at parent
|
||||
if ($search_parents) {
|
||||
$_ptr = $_ptr->parent;
|
||||
} else {
|
||||
|
@ -411,7 +429,8 @@ class Smarty_Internal_Data
|
|||
/**
|
||||
* Deassigns a single or all config variables
|
||||
*
|
||||
* @param string $varname variable name or null
|
||||
* @param string $varname variable name or null
|
||||
*
|
||||
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
|
||||
*/
|
||||
public function clearConfig($varname = null)
|
||||
|
@ -424,15 +443,13 @@ class Smarty_Internal_Data
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* class for the Smarty data object
|
||||
*
|
||||
* The Smarty data object will hold Smarty variables in the current scope
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Data extends Smarty_Internal_Data
|
||||
|
@ -448,9 +465,11 @@ class Smarty_Data extends Smarty_Internal_Data
|
|||
* create Smarty data object
|
||||
*
|
||||
* @param Smarty|array $_parent parent template
|
||||
* @param Smarty $smarty global smarty instance
|
||||
* @param Smarty|Smarty_Internal_Template $smarty global smarty instance
|
||||
*
|
||||
* @throws SmartyException
|
||||
*/
|
||||
public function __construct ($_parent = null, $smarty = null)
|
||||
public function __construct($_parent = null, $smarty = null)
|
||||
{
|
||||
$this->smarty = $smarty;
|
||||
if (is_object($_parent)) {
|
||||
|
@ -465,15 +484,13 @@ class Smarty_Data extends Smarty_Internal_Data
|
|||
throw new SmartyException("Wrong type for template variables");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* class for the Smarty variable object
|
||||
*
|
||||
* This class defines the Smarty variable object
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Smarty_Variable
|
||||
|
@ -520,15 +537,13 @@ class Smarty_Variable
|
|||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* class for undefined variable object
|
||||
*
|
||||
* This class defines an object for undefined variable handling
|
||||
*
|
||||
* @package Smarty
|
||||
* @package Smarty
|
||||
* @subpackage Template
|
||||
*/
|
||||
class Undefined_Smarty_Variable
|
||||
|
@ -537,6 +552,7 @@ class Undefined_Smarty_Variable
|
|||
* Returns FALSE for 'nocache' and NULL otherwise.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function __get($name)
|
||||
|
@ -557,5 +573,4 @@ class Undefined_Smarty_Variable
|
|||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue