Swat/SwatForm.php
protected function displayHiddenFields()
    {
        $input_tag = new SwatHtmlTag('input');
        $input_tag->type = 'hidden';

        echo '<div class="swat-hidden">';

        if ($this->_8bit_encoding !== null) {
            // The character encoding detection field is intentionally not using
            // SwatHtmlTag to avoid minimizing entities.
            echo '<input type="hidden" ',
                'name="',
                self::ENCODING_FIELD,
                '" ',
                'value="',
                self::ENCODING_ENTITY_VALUE,
                '" />';
        }

        foreach ($this->hidden_fields as $name => $value) {
            // display unserialized value for primative types
            if ($value !== null && !is_array($value) && !is_object($value)) {
                // SwatHtmlTag uses SwatString::minimizeEntities(), which
                // prevents double-escaping entities. For hidden form-fields,
                // we want data to be returned exactly as it was specified. This
                // necessitates double-escaping to ensure any entities that were
                // specified in the hidden field value are returned correctly.
                $escaped_value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');

                $input_tag->name = $name;
                $input_tag->value = $escaped_value;
                $input_tag->display();
            }

            // display serialized value
            $serialized_data = $this->serializeHiddenField($value);

            // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents
            // double-escaping entities. For hidden form-fields, we want data
            // to be returned exactly as it was specified. This  necessitates
            // double-escaping to ensure any entities that were specified in
            // the hidden field value are returned correctly.
            $escaped_serialized_data = htmlspecialchars(
                $serialized_data,
                ENT_COMPAT,
                'UTF-8'
            );

            $input_tag->name = self::SERIALIZED_PREFIX . $name;
            $input_tag->value = $escaped_serialized_data;
            $input_tag->display();
        }

        // display hidden field names
        if (count($this->hidden_fields) > 0) {
            // array of field names
            $serialized_data = SwatString::signedSerialize(
                array_keys($this->hidden_fields),
                $this->salt
            );

            $input_tag->name = self::HIDDEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        // display authentication token
        if (self::$authentication_token !== null) {
            $serialized_data = SwatString::signedSerialize(
                self::$authentication_token,
                $this->salt
            );

            $input_tag = new SwatHtmlTag('input');
            $input_tag->type = 'hidden';
            $input_tag->name = self::AUTHENTICATION_TOKEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        echo '</div>';
    }
protected function displayHiddenFields()
    {
        $input_tag = new SwatHtmlTag('input');
        $input_tag->type = 'hidden';

        echo '<div class="swat-hidden">';

        if ($this->_8bit_encoding !== null) {
            // The character encoding detection field is intentionally not using
            // SwatHtmlTag to avoid minimizing entities.
            echo '<input type="hidden" ',
                'name="',
                self::ENCODING_FIELD,
                '" ',
                'value="',
                self::ENCODING_ENTITY_VALUE,
                '" />';
        }

        foreach ($this->hidden_fields as $name => $value) {
            // display unserialized value for primative types
            if ($value !== null && !is_array($value) && !is_object($value)) {
                // SwatHtmlTag uses SwatString::minimizeEntities(), which
                // prevents double-escaping entities. For hidden form-fields,
                // we want data to be returned exactly as it was specified. This
                // necessitates double-escaping to ensure any entities that were
                // specified in the hidden field value are returned correctly.
                $escaped_value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');

                $input_tag->name = $name;
                $input_tag->value = $escaped_value;
                $input_tag->display();
            }

            // display serialized value
            $serialized_data = $this->serializeHiddenField($value);

            // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents
            // double-escaping entities. For hidden form-fields, we want data
            // to be returned exactly as it was specified. This  necessitates
            // double-escaping to ensure any entities that were specified in
            // the hidden field value are returned correctly.
            $escaped_serialized_data = htmlspecialchars(
                $serialized_data,
                ENT_COMPAT,
                'UTF-8'
            );

            $input_tag->name = self::SERIALIZED_PREFIX . $name;
            $input_tag->value = $escaped_serialized_data;
            $input_tag->display();
        }

        // display hidden field names
        if (count($this->hidden_fields) > 0) {
            // array of field names
            $serialized_data = SwatString::signedSerialize(
                array_keys($this->hidden_fields),
                $this->salt
            );

            $input_tag->name = self::HIDDEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        // display authentication token
        if (self::$authentication_token !== null) {
            $serialized_data = SwatString::signedSerialize(
                self::$authentication_token,
                $this->salt
            );

            $input_tag = new SwatHtmlTag('input');
            $input_tag->type = 'hidden';
            $input_tag->name = self::AUTHENTICATION_TOKEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        echo '</div>';
    }
protected function displayHiddenFields ( ) { $ input_tag = new SwatHtmlTag ( 'input' ) ; $ input_tag -> type = 'hidden' ; echo '<div class="swat-hidden">' ; if ( $ this -> _8bit_encoding !== null ) { // The character encoding detection field is intentionally not using // SwatHtmlTag to avoid minimizing entities. echo '<input type="hidden" ' , 'name="' , self :: ENCODING_FIELD , '" ' , 'value="' , self :: ENCODING_ENTITY_VALUE , '" />' ; } foreach ( $ this -> hidden_fields as $ name => $ value ) { // display unserialized value for primative types if ( $ value !== null && ! is_array ( $ value ) && ! is_object ( $ value ) ) { // SwatHtmlTag uses SwatString::minimizeEntities(), which // prevents double-escaping entities. For hidden form-fields, // we want data to be returned exactly as it was specified. This // necessitates double-escaping to ensure any entities that were // specified in the hidden field value are returned correctly. $ escaped_value = htmlspecialchars ( $ value , ENT_COMPAT , 'UTF-8' ) ; $ input_tag -> name = $ name ; $ input_tag -> value = $ escaped_value ; $ input_tag -> display ( ) ; } // display serialized value $ serialized_data = $ this -> serializeHiddenField ( $ value ) ; // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents // double-escaping entities. For hidden form-fields, we want data // to be returned exactly as it was specified. This  necessitates // double-escaping to ensure any entities that were specified in // the hidden field value are returned correctly. $ escaped_serialized_data = htmlspecialchars ( $ serialized_data , ENT_COMPAT , 'UTF-8' ) ; $ input_tag -> name = self :: SERIALIZED_PREFIX . $ name ; $ input_tag -> value = $ escaped_serialized_data ; $ input_tag -> display ( ) ; } // display hidden field names if ( count ( $ this -> hidden_fields ) > 0 ) { // array of field names $ serialized_data = SwatString :: signedSerialize ( array_keys ( $ this -> hidden_fields ) , $ this -> salt ) ; $ input_tag -> name = self :: HIDDEN_FIELD ; $ input_tag -> value = $ serialized_data ; $ input_tag -> display ( ) ; } // display authentication token if ( self :: $ authentication_token !== null ) { $ serialized_data = SwatString :: signedSerialize ( self :: $ authentication_token , $ this -> salt ) ; $ input_tag = new SwatHtmlTag ( 'input' ) ; $ input_tag -> type = 'hidden' ; $ input_tag -> name = self :: AUTHENTICATION_TOKEN_FIELD ; $ input_tag -> value = $ serialized_data ; $ input_tag -> display ( ) ; } echo '</div>' ; }
Displays hidden form fields

Displays hiden form fields as <input type="hidden" /> XHTML elements.
This method automatically handles array type values so they will be
returned correctly as arrays.

This methods also generates an array of hidden field names and passes
them as hidden fields.

If an authentication token is set on this form to prevent cross-site
request forgeries, the token is displayed in a hidden field.
Displays hidden form fields