code/libraries/joomlatools/library/template/filter/form.php
protected function _addQueryParameters(&$text)
    {
        $matches = array();

        if (preg_match_all('#(<\s*form[^>]+action="[^"]*?\?(.*?)"[^>]*>)(.*?)</form>#si', $text, $matches))
        {
            foreach ($matches[1] as $key => $match)
            {
                // Only deal with GET forms.
                if (strpos($match, 'method="get"') !== false)
                {
                    $query = $matches[2][$key];

                    parse_str(str_replace('&amp;', '&', $query), $query);

                    $input = '';

                    foreach ($query as $name => $value)
                    {
                        if (is_array($value)) {
                            $name = $name . '[]';
                        }

                        if (strpos($matches[3][$key], 'name="' . $name . '"') !== false) {
                            continue;
                        }

                        $name =  $this->getTemplate()->escape($name);

                        if (is_array($value))
                        {
                            foreach ($value as $k => $v)
                            {
                                if (!is_scalar($v) || !is_numeric($k)) {
                                    continue;
                                }

                                $v = $this->getTemplate()->escape($v);

                                $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$v.'" />';
                            }
                        }
                        else {
                            $value  = $this->getTemplate()->escape($value);
                            $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
                        }
                    }

                    $text = str_replace($matches[3][$key], $input.$matches[3][$key], $text);
                }

            }
        }

        return $this;
    }
protected function _addQueryParameters(&$text)
    {
        $matches = array();

        if (preg_match_all('#(<\s*form[^>]+action="[^"]*?\?(.*?)"[^>]*>)(.*?)</form>#si', $text, $matches))
        {
            foreach ($matches[1] as $key => $match)
            {
                // Only deal with GET forms.
                if (strpos($match, 'method="get"') !== false)
                {
                    $query = $matches[2][$key];

                    parse_str(str_replace('&amp;', '&', $query), $query);

                    $input = '';

                    foreach ($query as $name => $value)
                    {
                        if (is_array($value)) {
                            $name = $name . '[]';
                        }

                        if (strpos($matches[3][$key], 'name="' . $name . '"') !== false) {
                            continue;
                        }

                        $name =  $this->getTemplate()->escape($name);

                        if (is_array($value))
                        {
                            foreach ($value as $k => $v)
                            {
                                if (!is_scalar($v) || !is_numeric($k)) {
                                    continue;
                                }

                                $v = $this->getTemplate()->escape($v);

                                $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$v.'" />';
                            }
                        }
                        else {
                            $value  = $this->getTemplate()->escape($value);
                            $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
                        }
                    }

                    $text = str_replace($matches[3][$key], $input.$matches[3][$key], $text);
                }

            }
        }

        return $this;
    }
protected function _addQueryParameters ( & $ text ) { $ matches = array ( ) ; if ( preg_match_all ( '#(<\s*form[^>]+action="[^"]*?\?(.*?)"[^>]*>)(.*?)</form>#si' , $ text , $ matches ) ) { foreach ( $ matches [ 1 ] as $ key => $ match ) { // Only deal with GET forms. if ( strpos ( $ match , 'method="get"' ) !== false ) { $ query = $ matches [ 2 ] [ $ key ] ; parse_str ( str_replace ( '&amp;' , '&' , $ query ) , $ query ) ; $ input = '' ; foreach ( $ query as $ name => $ value ) { if ( is_array ( $ value ) ) { $ name = $ name . '[]' ; } if ( strpos ( $ matches [ 3 ] [ $ key ] , 'name="' . $ name . '"' ) !== false ) { continue ; } $ name = $ this -> getTemplate ( ) -> escape ( $ name ) ; if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( ! is_scalar ( $ v ) || ! is_numeric ( $ k ) ) { continue ; } $ v = $ this -> getTemplate ( ) -> escape ( $ v ) ; $ input .= PHP_EOL . '<input type="hidden" name="' . $ name . '" value="' . $ v . '" />' ; } } else { $ value = $ this -> getTemplate ( ) -> escape ( $ value ) ; $ input .= PHP_EOL . '<input type="hidden" name="' . $ name . '" value="' . $ value . '" />' ; } } $ text = str_replace ( $ matches [ 3 ] [ $ key ] , $ input . $ matches [ 3 ] [ $ key ] , $ text ) ; } } } return $ this ; }
Add query parameters as hidden fields to the GET forms

@param string $text Template text
@return $this
Add query parameters as hidden fields to the GET forms