WPCF7_ConfigValidator::count_errors()
Counts detected errors.
Метод класса: WPCF7_ConfigValidator{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$WPCF7_ConfigValidator = new WPCF7_ConfigValidator(); $WPCF7_ConfigValidator->count_errors( $args );
- $args **
- -
По умолчанию: ''
Код WPCF7_ConfigValidator::count_errors() WPCF7 ConfigValidator::count errors CF7 5.7.4
public function count_errors( $args = '' ) { $args = wp_parse_args( $args, array( 'section' => '', 'code' => '', ) ); $count = 0; foreach ( $this->errors as $key => $errors ) { if ( preg_match( '/^mail_[0-9]+\.(.*)$/', $key, $matches ) ) { $key = sprintf( 'mail.%s', $matches[1] ); } if ( $args['section'] and $key != $args['section'] and preg_replace( '/\..*$/', '', $key, 1 ) != $args['section'] ) { continue; } foreach ( $errors as $error ) { if ( empty( $error ) ) { continue; } if ( $args['code'] and $error['code'] != $args['code'] ) { continue; } $count += 1; } } return $count; }