WPCF7_FormTagsManager::scan()publicCF7 1.0

Scans form-tags in the text content.

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

Хуков нет.

Возвращает

Массив|Строку. An array of scanned form-tags if $replace is false. Otherwise text that scanned form-tags are replaced.

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

$WPCF7_FormTagsManager = new WPCF7_FormTagsManager();
$WPCF7_FormTagsManager->scan( $content, $replace );
$content(строка) (обязательный)
The text content including form-tags.
$replace(true|false)
Whether scanned form-tags will be replaced.
По умолчанию: false

Код WPCF7_FormTagsManager::scan() CF7 5.9.3

public function scan( $content, $replace = false ) {
	$this->scanned_tags = array();

	if ( empty( $this->tag_types ) ) {
		if ( $replace ) {
			return $content;
		} else {
			return $this->scanned_tags;
		}
	}

	if ( $replace ) {
		$content = preg_replace_callback(
			'/' . $this->tag_regex() . '/s',
			array( $this, 'replace_callback' ),
			$content
		);

		return $content;
	} else {
		preg_replace_callback(
			'/' . $this->tag_regex() . '/s',
			array( $this, 'scan_callback' ),
			$content
		);

		return $this->scanned_tags;
	}
}