Skip to content

Commit

Permalink
- correction of PHPDoc blocks
Browse files Browse the repository at this point in the history
  - minor code cleanup
  • Loading branch information
uwetews committed Oct 26, 2017
1 parent 8127582 commit dd9c076
Show file tree
Hide file tree
Showing 76 changed files with 613 additions and 141 deletions.
2 changes: 2 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
as Smarty does no longer use error suppression like @filemtime().
for backward compatibility code is moved from Smarty class to an external class and still can be
called.
- correction of PHPDoc blocks
- minor code cleanup

21.10.2017
- bugfix custom delimiters could fail since modification of version 3.1.32-dev-23
Expand Down
33 changes: 29 additions & 4 deletions libs/Smarty.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,31 @@
* Sets SMARTY_DIR only if user application has not already defined it.
*/
if (!defined('SMARTY_DIR')) {
/**
*
*/
define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}
/**
* set SMARTY_SYSPLUGINS_DIR to absolute path to Smarty internal plugins.
* Sets SMARTY_SYSPLUGINS_DIR only if user application has not already defined it.
*/
if (!defined('SMARTY_SYSPLUGINS_DIR')) {
/**
*
*/
define('SMARTY_SYSPLUGINS_DIR', SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR);
}
if (!defined('SMARTY_PLUGINS_DIR')) {
/**
*
*/
define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DIRECTORY_SEPARATOR);
}
if (!defined('SMARTY_MBSTRING')) {
/**
*
*/
define('SMARTY_MBSTRING', function_exists('mb_get_info'));
}
if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
Expand Down Expand Up @@ -100,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.32-dev-30';
const SMARTY_VERSION = '3.1.32-dev-31';
/**
* define variable scopes
*/
Expand Down Expand Up @@ -620,7 +632,7 @@ public function __construct()
/**
* Enable error handler to mute expected messages
*
* @return void
* @return boolean
* @deprecated
*/
public static function muteExpectedErrors()
Expand All @@ -643,7 +655,8 @@ public static function unmuteExpectedErrors()
*
* @param string $resource_name template name
*
* @return boolean status
* @return bool status
* @throws \SmartyException
*/
public function templateExists($resource_name)
{
Expand Down Expand Up @@ -922,7 +935,8 @@ public function setCacheDir($cache_dir)
* @param object $parent next higher level of Smarty variables
* @param boolean $do_clone flag is Smarty object shall be cloned
*
* @return object template object
* @return object template object
* @throws \SmartyException
*/
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
{
Expand Down Expand Up @@ -1002,6 +1016,7 @@ public function loadPlugin($plugin_name, $check = true)
* @param \Smarty_Internal_Template $template
*
* @return string
* @throws \SmartyException
*/
public function _getTemplateId($template_name,
$cache_id = null,
Expand Down Expand Up @@ -1259,6 +1274,16 @@ public function testInstall(&$errors = null)
Smarty_Internal_TestInstall::testInstall($this, $errors);
}

/**
* Get Smarty object
*
* @return Smarty
*/
public function _getSmartyObj()
{
return $this;
}

/**
* <<magic>> Generic getter.
* Calls the appropriate getter function.
Expand Down
23 changes: 21 additions & 2 deletions libs/SmartyBC.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public function clear_assign($tpl_var)
* @param string $function_impl the name of the PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
{
Expand Down Expand Up @@ -153,6 +155,8 @@ public function unregister_object($object)
* @param string $block_impl PHP function to register
* @param bool $cacheable
* @param mixed $cache_attrs
*
* @throws \SmartyException
*/
public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
{
Expand All @@ -175,6 +179,8 @@ public function unregister_block($block)
* @param string $function name of template function
* @param string $function_impl name of PHP function to register
* @param bool $cacheable
*
* @throws \SmartyException
*/
public function register_compiler_function($function, $function_impl, $cacheable = true)
{
Expand All @@ -196,6 +202,8 @@ public function unregister_compiler_function($function)
*
* @param string $modifier name of template modifier
* @param string $modifier_impl name of PHP function to register
*
* @throws \SmartyException
*/
public function register_modifier($modifier, $modifier_impl)
{
Expand Down Expand Up @@ -238,6 +246,8 @@ public function unregister_resource($type)
* to a template before compiling
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_prefilter($function)
{
Expand All @@ -259,6 +269,8 @@ public function unregister_prefilter($function)
* to a compiled template after compilation
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_postfilter($function)
{
Expand All @@ -280,6 +292,8 @@ public function unregister_postfilter($function)
* to a template output
*
* @param callable $function
*
* @throws \SmartyException
*/
public function register_outputfilter($function)
{
Expand All @@ -301,6 +315,8 @@ public function unregister_outputfilter($function)
*
* @param string $type filter type
* @param string $name filter name
*
* @throws \SmartyException
*/
public function load_filter($type, $name)
{
Expand Down Expand Up @@ -341,7 +357,9 @@ public function clear_all_cache($exp_time = null)
* @param string $cache_id
* @param string $compile_id
*
* @return boolean
* @return bool
* @throws \Exception
* @throws \SmartyException
*/
public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
{
Expand Down Expand Up @@ -377,7 +395,8 @@ public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_ti
*
* @param string $tpl_file
*
* @return boolean
* @return bool
* @throws \SmartyException
*/
public function template_exists($tpl_file)
{
Expand Down
16 changes: 14 additions & 2 deletions libs/plugins/function.html_checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,21 @@ function smarty_function_html_checkboxes($params, $template)
return implode("\n", $_html_result);
}
}

/**
* @param $name
* @param $value
* @param $output
* @param $selected
* @param $extra
* @param $separator
* @param $labels
* @param $label_ids
* @param bool $escape
*
* @return string
*/
function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
$label_ids, $escape = true)
$label_ids, $escape = true)
{
$_output = '';

Expand Down
22 changes: 20 additions & 2 deletions libs/plugins/function.html_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,16 @@ function smarty_function_html_options($params, Smarty_Internal_Template $templat

return $_html_result;
}

/**
* @param $key
* @param $value
* @param $selected
* @param $id
* @param $class
* @param $idx
*
* @return string
*/
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
if (!is_array($value)) {
Expand Down Expand Up @@ -196,7 +205,16 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c

return $_html_result;
}

/**
* @param $key
* @param $values
* @param $selected
* @param $id
* @param $class
* @param $idx
*
* @return string
*/
function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
{
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
Expand Down
16 changes: 14 additions & 2 deletions libs/plugins/function.html_radios.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,21 @@ function smarty_function_html_radios($params, $template)
return implode("\n", $_html_result);
}
}

/**
* @param $name
* @param $value
* @param $output
* @param $selected
* @param $extra
* @param $separator
* @param $labels
* @param $label_ids
* @param $escape
*
* @return string
*/
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids,
$escape)
$escape)
{
$_output = '';

Expand Down
8 changes: 7 additions & 1 deletion libs/plugins/function.html_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,13 @@ function smarty_function_html_table($params)

return $output;
}

/**
* @param $name
* @param $var
* @param $no
*
* @return string
*/
function smarty_function_html_table_cycle($name, $var, $no)
{
if (!is_array($var)) {
Expand Down
23 changes: 20 additions & 3 deletions libs/plugins/modifier.capitalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,38 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
*
* @author Kyle Renfrow
*/
/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_mbconvert_cb($matches)
{
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
}

/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_mbconvert2_cb($matches)
{
return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
}

/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_ucfirst_cb($matches)
{
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
}

/**
* @param $matches
*
* @return string
*/
function smarty_mod_cap_ucfirst2_cb($matches)
{
return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
Expand Down
1 change: 0 additions & 1 deletion libs/plugins/modifier.escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
{
static $_double_encode = null;
static $is_loaded1 = false;
static $is_loaded2 = false;
if ($_double_encode === null) {
$_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
}
Expand Down
6 changes: 3 additions & 3 deletions libs/plugins/modifiercompiler.wordwrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* @package Smarty
* @subpackage PluginsModifierCompiler
*/

/**
* Smarty wordwrap modifier plugin
* Type: modifier<br>
Expand All @@ -15,10 +14,11 @@
* @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
* @param $compiler
* @param array $params parameters
* @param \Smarty_Internal_TemplateCompilerBase $compiler
*
* @return string with compiled code
* @throws \SmartyException
*/
function smarty_modifiercompiler_wordwrap($params, Smarty_Internal_TemplateCompilerBase $compiler)
{
Expand Down
Loading

0 comments on commit dd9c076

Please sign in to comment.