WPCF7_Mail::get()
Retrieves a component from the email template.
Метод класса: WPCF7_Mail{}
Хуков нет.
Возвращает
Строку
. The text representation of the email component.
Использование
$WPCF7_Mail = new WPCF7_Mail(); $WPCF7_Mail->get( $component, $replace_tags );
- $component(строка) (обязательный)
- The name of the component.
- $replace_tags(true|false)
- Whether to replace mail-tags within the component.
По умолчанию: false
Код WPCF7_Mail::get() WPCF7 Mail::get CF7 5.9.8
public function get( $component, $replace_tags = false ) { $this->component = $component; $use_html = ( $this->use_html && 'body' === $component ); $exclude_blank = ( $this->exclude_blank && 'body' === $component ); $template = $this->template; $component = isset( $template[$component] ) ? $template[$component] : ''; if ( $replace_tags ) { $component = $this->replace_tags( $component, array( 'html' => $use_html, 'exclude_blank' => $exclude_blank, ) ); if ( $use_html ) { // Convert <example@example.com> to <example@example.com>. $component = preg_replace_callback( '/<(.*?)>/', static function ( $matches ) { if ( is_email( $matches[1] ) ) { return sprintf( '<%s>', $matches[1] ); } else { return $matches[0]; } }, $component ); if ( ! preg_match( '%<html[>\s].*</html>%is', $component ) ) { $component = $this->htmlize( $component ); } } } $this->component = ''; return $component; }