Habari\HiEngineParser::hi_command PHP Метод

hi_command() публичный Метод

Replace a single function template tag with its PHP counterpart
public hi_command ( array $matches ) : string
$matches array The match array found in HiEngineParser::process()
Результат string The PHP replacement for the function template tag
    function hi_command($matches)
    {
        $cmd = trim($matches[1]);
        // Catch tags in the format {hi:command:parameter}
        if (preg_match('/^(\\w+):(.+)$/u', $cmd, $cmd_matches)) {
            switch (strtolower($cmd_matches[1])) {
                case 'area':
                    return '<?php echo $theme->area(\'' . $cmd_matches[2] . '\'); ?>';
                case 'display':
                    return '<?php $theme->display(\'' . $cmd_matches[2] . '\'); ?>';
                case 'option':
                case 'options':
                    return '<?php Options::out(\'' . $cmd_matches[2] . '\'); ?>';
                case 'siteurl':
                    return '<?php Site::out_url( \'' . $cmd_matches[2] . '\' ); ?>';
                case 'url':
                    return '<?php URL::out( \'' . $cmd_matches[2] . '\' ); ?>';
                case 'session':
                    switch ($cmd_matches[2]) {
                        case 'messages':
                            return '<?php if (Session::has_messages()){Session::messages_out();} ?>';
                        case 'errors':
                            return '<?php if (Session::has_errors()){Session::messages_out();} ?>';
                    }
                    // this is an internal match
                // this is an internal match
                case 'context':
                    return $this->hi_to_var($cmd_matches[2]);
                case 'escape':
                    return '<?php echo Utils::htmlspecialchars( ' . $this->hi_to_var($cmd_matches[2]) . ' ); ?>';
            }
        }
        return $matches[0];
    }