wpcf7_site_related_smt()
Returns output string of a special mail-tag.
Хуков нет.
Возвращает
Строку. Output of the given special mail-tag.
Использование
wpcf7_site_related_smt( $output, $name, $html, $mail_tag );
- $output(строка) (обязательный)
- The string to be output.
- $name(строка) (обязательный)
- The tag name of the special mail-tag.
- $html(true|false) (обязательный)
- Whether the mail-tag is used in an HTML content.
- $mail_tag(WPCF7_MailTag)
- An object representation of the mail-tag.
По умолчанию:null
Код wpcf7_site_related_smt() wpcf7 site related smt CF7 6.1.6
function wpcf7_site_related_smt( $output, $name, $html, $mail_tag = null ) {
if ( ! $mail_tag instanceof WPCF7_MailTag ) {
wpcf7_doing_it_wrong(
sprintf( '%s()', __FUNCTION__ ),
__( 'The fourth parameter ($mail_tag) must be an instance of the WPCF7_MailTag class.', 'contact-form-7' ),
'5.2.2'
);
}
$filter = $html ? 'display' : 'raw';
if ( '_site_title' === $name ) {
$output = get_bloginfo( 'name', $filter );
if ( ! $html ) {
$output = wp_specialchars_decode( $output, ENT_QUOTES );
}
return $output;
}
if ( '_site_description' === $name ) {
$output = get_bloginfo( 'description', $filter );
if ( ! $html ) {
$output = wp_specialchars_decode( $output, ENT_QUOTES );
}
return $output;
}
if ( '_site_url' === $name ) {
return get_bloginfo( 'url', $filter );
}
if ( '_site_domain' === $name ) {
$url = get_bloginfo( 'url', $filter );
$host = wp_parse_url( $url, PHP_URL_HOST );
if ( null === $host ) {
return '';
}
if ( str_starts_with( $host, 'www.' ) ) {
$host = substr( $host, 4 );
}
return $host;
}
if ( '_site_admin_email' === $name ) {
return get_bloginfo( 'admin_email', $filter );
}
return $output;
}