Exemplo n.º 1
0
/**
 * Internal callback function.
 */
function process_template_callback($block)
{
    global $template_globals;
    $textlib = textlib::get_instance();
    $repl = $block[0];
    switch ($block[3]) {
        case 'u':
            $repl = $template_globals->username;
            break;
        case 'f':
            $repl = $template_globals->firstname;
            break;
        case 'l':
            $repl = $template_globals->lastname;
            break;
    }
    switch ($block[1]) {
        case '+':
            $repl = textlib::strtoupper($repl);
            break;
        case '-':
            $repl = textlib::strtolower($repl);
            break;
        case '~':
            $repl = textlib::strtotitle($repl);
            break;
    }
    if (!empty($block[2])) {
        $repl = textlib::substr($repl, 0, $block[2]);
    }
    return $repl;
}