WPCF7_ContactForm::suggest_mail_tags()publicCF7 1.0

Prints a mail-tag suggestion list.

{} Это метод класса: WPCF7_ContactForm{}

Хуков нет.

Возвращает

null. Ничего.

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

$WPCF7_ContactForm = new WPCF7_ContactForm();
$WPCF7_ContactForm->suggest_mail_tags( $template_name );
$template_name(строка)
Mail template name.
По умолчанию: 'mail'

Код WPCF7_ContactForm::suggest_mail_tags() CF7 5.6.3

public function suggest_mail_tags( $template_name = 'mail' ) {
	$mail = wp_parse_args( $this->prop( $template_name ),
		array(
			'active' => false,
			'recipient' => '',
			'sender' => '',
			'subject' => '',
			'body' => '',
			'additional_headers' => '',
			'attachments' => '',
			'use_html' => false,
			'exclude_blank' => false,
		)
	);

	$mail = array_filter( $mail );

	foreach ( (array) $this->collect_mail_tags() as $mail_tag ) {
		$pattern = sprintf(
			'/\[(_[a-z]+_)?%s([ \t]+[^]]+)?\]/',
			preg_quote( $mail_tag, '/' )
		);

		$used = preg_grep( $pattern, $mail );

		echo sprintf(
			'<span class="%1$s">[%2$s]</span>',
			'mailtag code ' . ( $used ? 'used' : 'unused' ),
			esc_html( $mail_tag )
		);
	}
}