WPCF7_HTMLFormatter::start_tag()publicCF7 1.0

Appends a start tag to the output property.

Метод класса: WPCF7_HTMLFormatter{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WPCF7_HTMLFormatter = new WPCF7_HTMLFormatter();
$WPCF7_HTMLFormatter->start_tag( $tag );
$tag(строка) (обязательный)
A start tag.

Код WPCF7_HTMLFormatter::start_tag() CF7 5.9.3

public function start_tag( $tag ) {
	list( $tag, $tag_name ) = self::normalize_start_tag( $tag );

	if ( in_array( $tag_name, self::p_child_elements ) ) {
		if (
			! $this->is_inside( 'p' ) and
			! $this->is_inside( self::p_child_elements ) and
			! $this->has_parent( self::p_nonparent_elements )
		) {
			// Open <p> if it does not exist.
			$this->start_tag( 'p' );
		}
	} elseif (
		'p' === $tag_name or
		in_array( $tag_name, self::p_parent_elements ) or
		in_array( $tag_name, self::p_nonparent_elements )
	) {
		// Close <p> if it exists.
		$this->end_tag( 'p' );
	}

	if ( 'dd' === $tag_name or 'dt' === $tag_name ) {
		// Close <dd> and <dt> if closing tag is omitted.
		$this->end_tag( 'dd' );
		$this->end_tag( 'dt' );
	}

	if ( 'li' === $tag_name ) {
		// Close <li> if closing tag is omitted.
		$this->end_tag( 'li' );
	}

	if ( 'optgroup' === $tag_name ) {
		// Close <option> and <optgroup> if closing tag is omitted.
		$this->end_tag( 'option' );
		$this->end_tag( 'optgroup' );
	}

	if ( 'option' === $tag_name ) {
		// Close <option> if closing tag is omitted.
		$this->end_tag( 'option' );
	}

	if ( 'rp' === $tag_name or 'rt' === $tag_name ) {
		// Close <rp> and <rt> if closing tag is omitted.
		$this->end_tag( 'rp' );
		$this->end_tag( 'rt' );
	}

	if ( 'td' === $tag_name or 'th' === $tag_name ) {
		// Close <td> and <th> if closing tag is omitted.
		$this->end_tag( 'td' );
		$this->end_tag( 'th' );
	}

	if ( 'tr' === $tag_name ) {
		// Close <tr> if closing tag is omitted.
		$this->end_tag( 'tr' );
	}

	if ( 'tbody' === $tag_name or 'tfoot' === $tag_name ) {
		// Close <thead> if closing tag is omitted.
		$this->end_tag( 'thead' );
	}

	if ( 'tfoot' === $tag_name ) {
		// Close <tbody> if closing tag is omitted.
		$this->end_tag( 'tbody' );
	}

	if ( ! in_array( $tag_name, self::void_elements ) ) {
		array_unshift( $this->stacked_elements, $tag_name );
	}

	if ( ! in_array( $tag_name, self::p_child_elements ) ) {
		if ( '' !== $this->output ) {
			$this->output = rtrim( $this->output ) . "\n";
		}

		if ( $this->options['auto_indent'] ) {
			$this->output .= self::indent( count( $this->stacked_elements ) - 1 );
		}
	}

	$this->output .= $tag;
}