PageRenderTime 29ms CodeModel.GetById 20ms app.highlight 8ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/Output/Smarty/Core/plugins/modifiercompiler.lower.php

https://bitbucket.org/alexamiryan/stingle
PHP | 31 lines | 8 code | 2 blank | 21 comment | 1 complexity | 977cca395f09c861cfc6c4d82d4568bb MD5 | raw file
 1<?php
 2/**
 3 * Smarty plugin
 4 *
 5 * @package    Smarty
 6 * @subpackage PluginsModifierCompiler
 7 */
 8
 9/**
10 * Smarty lower modifier plugin
11 * Type:     modifier<br>
12 * Name:     lower<br>
13 * Purpose:  convert string to lowercase
14 *
15 * @link   http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
16 * @author Monte Ohrt <monte at ohrt dot com>
17 * @author Uwe Tews
18 *
19 * @param array $params parameters
20 *
21 * @return string with compiled code
22 */
23
24function smarty_modifiercompiler_lower($params)
25{
26    if (Smarty::$_MBSTRING) {
27        return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
28    }
29    // no MBString fallback
30    return 'strtolower(' . $params[ 0 ] . ')';
31}