WPCF7_HTMLFormatter::pre_format
Normalizes content in each chunk. This may change the type and position of the chunk.
Метод класса: WPCF7_HTMLFormatter{}
Хуков нет.
Возвращает
iterable. Normalized chunks.
Использование
$WPCF7_HTMLFormatter = new WPCF7_HTMLFormatter(); $WPCF7_HTMLFormatter->pre_format( $chunks );
- $chunks(iterable) (обязательный)
- The original chunks.
Код WPCF7_HTMLFormatter::pre_format() WPCF7 HTMLFormatter::pre format CF7 6.1.5
public function pre_format( $chunks ) {
$position = 0;
foreach ( $chunks as $chunk ) {
$chunk['position'] = $position;
// Standardize newline characters to "\n".
$chunk['content'] = str_replace(
array( "\r\n", "\r" ), "\n", $chunk['content']
);
if ( self::start_tag === $chunk['type'] ) {
list( $chunk['content'] ) =
self::normalize_start_tag( $chunk['content'] );
// Replace <br /> by a line break.
if (
$this->options['auto_br'] and
preg_match( '/^<br\s*\/?>$/i', $chunk['content'] )
) {
$chunk['type'] = self::text;
$chunk['content'] = "\n";
}
}
yield $chunk;
$position = self::calc_next_position( $chunk );
}
}