public function injectForms($html)
    {
        preg_match_all("/<form(.*?)>(.*?)<\\/form>/is", $html, $matches, PREG_SET_ORDER);
        if (is_array($matches)) {
            foreach ($matches as $match) {
                if (strpos($match[1], "nocsrf") !== false) {
                    continue;
                }
                $hiddenFields = self::generateHiddenFields();
                $html = str_replace($match[0], "<form{$match[1]}>{$hiddenFields}{$match[2]}</form>", $html);
            }
        }
        return $html;
    }
public function injectForms($html)
    {
        preg_match_all("/<form(.*?)>(.*?)<\\/form>/is", $html, $matches, PREG_SET_ORDER);
        if (is_array($matches)) {
            foreach ($matches as $match) {
                if (strpos($match[1], "nocsrf") !== false) {
                    continue;
                }
                $hiddenFields = self::generateHiddenFields();
                $html = str_replace($match[0], "<form{$match[1]}>{$hiddenFields}{$match[2]}</form>", $html);
            }
        }
        return $html;
    }
public function injectForms ( $ html ) { preg_match_all ( "/<form(.*?)>(.*?)<\\/form>/is" , $ html , $ matches , PREG_SET_ORDER ) ; if ( is_array ( $ matches ) ) { foreach ( $ matches as $ match ) { if ( strpos ( $ match [ 1 ] , "nocsrf" ) !== false ) { continue ; } $ hiddenFields = self :: generateHiddenFields ( ) ; $ html = str_replace ( $ match [ 0 ] , "<form{$match[1]}>{$hiddenFields}{$match[2]}</form>" , $ html ) ; } } return $ html ; }
Automatically adds CSRF hidden fields to any forms present in the given
HTML. This method is to be used with automatic injection behavior.

@param string $html
@return string
Automatically adds CSRF hidden fields to any forms present in the given HTML . This method is to be used with automatic injection behavior .