source: pro-violet-viettel/sourcecode/application/third_party/Smarty/plugins/modifiercompiler.wordwrap.php @ 345

Last change on this file since 345 was 345, checked in by quyenla, 11 years ago

collaborator page

File size: 1.5 KB
Line 
1<?php
2/**
3 * Smarty plugin
4 *
5 * @package Smarty
6 * @subpackage PluginsModifierCompiler
7 */
8
9/**
10 * Smarty wordwrap modifier plugin
11 *
12 * Type:     modifier<br>
13 * Name:     wordwrap<br>
14 * Purpose:  wrap a string of text at a given length
15 *
16 * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
17 * @author Uwe Tews
18 * @param array $params parameters
19 * @return string with compiled code
20 */
21function smarty_modifiercompiler_wordwrap($params, $compiler)
22{
23    if (!isset($params[1])) {
24        $params[1] = 80;
25    }
26    if (!isset($params[2])) {
27        $params[2] = '"\n"';
28    }
29    if (!isset($params[3])) {
30        $params[3] = 'false';
31    }
32    $function = 'wordwrap';
33    if (Smarty::$_MBSTRING) {
34        if ($compiler->tag_nocache | $compiler->nocache) {
35            $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
36            $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
37        } else {
38            $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
39            $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
40        }
41        $function = 'smarty_mb_wordwrap';
42    }
43    return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
44}
45
46?>
Note: See TracBrowser for help on using the repository browser.