wpcf7_flamingo_serial_number()
Returns output string of a special mail-tag.
Хуков нет.
Возвращает
Строку. Output of the given special mail-tag.
Использование
wpcf7_flamingo_serial_number( $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_flamingo_serial_number() wpcf7 flamingo serial number CF7 6.1.6
function wpcf7_flamingo_serial_number( $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'
);
}
if ( '_serial_number' !== $name ) {
return $output;
}
if (
! class_exists( 'Flamingo_Inbound_Message' ) or
! method_exists( 'Flamingo_Inbound_Message', 'count' )
) {
return $output;
}
if ( ! $contact_form = WPCF7_ContactForm::get_current() ) {
return $output;
}
$serial_number = 0;
$post_meta = get_post_meta( $contact_form->id(), '_flamingo', true );
$channel_id = isset( $post_meta['channel'] )
? (int) $post_meta['channel']
: wpcf7_flamingo_add_channel(
$contact_form->name(), $contact_form->title()
);
if ( $channel_id ) {
$serial_number = 1 + Flamingo_Inbound_Message::count( array(
'channel_id' => $channel_id,
) );
}
return (string) $serial_number;
}