Habari\HiEngineParser::hi_quote PHP Method

hi_quote() public method

Prepare strings for translation
public hi_quote ( array $matches )
$matches array Matches in HiEngineParser::process()
    function hi_quote($matches)
    {
        $args = preg_split('/\\s+/u', trim($matches[2]));
        preg_match_all('/"(.+?)(?<!\\\\)"/', $matches[1], $quotes);
        $count = 0;
        $all_vars = array();
        foreach ($quotes[1] as $index => $quote) {
            preg_match_all('/{hi:([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff.]*)}/', $quote, $vars, PREG_SET_ORDER);
            foreach ($vars as $var) {
                $count++;
                $quote = str_replace($var[0], '%' . $count . '\\$s', $quote);
                $all_vars[] = '{hi:context:' . $var[1] . '}';
                //$this->hi_to_var($var[1]);
            }
            $quotes[1][$index] = $quote;
        }
        if (count($quotes[1]) > 1) {
            $output = '<?php printf(_n("' . $quotes[1][0] . '", "' . $quotes[1][1] . '", {hi:context:' . $args[0] . '})';
            // Add vars
            if (count($all_vars) > 0) {
                $output .= ', ' . implode(', ', $all_vars);
            }
            array_shift($args);
        } else {
            $output = '<?php _e("' . $quotes[1][0] . '"';
            // Add vars
            if (count($all_vars) > 0) {
                $output .= ', array(' . implode(', ', $all_vars) . ')';
            }
        }
        // Add the domain, if any
        if (isset($args[0])) {
            $output .= ', "' . $args[0] . '"';
        }
        // Close the tag
        $output .= '); ?>';
        return $output;
    }