WPCF7_Submission::setup_posted_data
Constructs posted data property based on user input values.
Метод класса: WPCF7_Submission{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->setup_posted_data();
Код WPCF7_Submission::setup_posted_data() WPCF7 Submission::setup posted data CF7 6.1.4
private function setup_posted_data() {
$posted_data = array_filter(
(array) $_POST,
static function ( $key ) {
return ! str_starts_with( $key, '_' );
},
ARRAY_FILTER_USE_KEY
);
$posted_data = wp_unslash( $posted_data );
$posted_data = $this->sanitize_posted_data( $posted_data );
$tags = $this->contact_form->scan_form_tags( array(
'feature' => array(
'name-attr',
'! not-for-mail',
),
) );
$tags = array_reduce( $tags, static function ( $carry, $tag ) {
if ( $tag->name and ! isset( $carry[$tag->name] ) ) {
$carry[$tag->name] = $tag;
}
return $carry;
}, array() );
foreach ( $tags as $tag ) {
$value_orig = $value = $posted_data[$tag->name] ?? '';
if ( wpcf7_form_tag_supports( $tag->type, 'selectable-values' ) ) {
$value = ( '' === $value ) ? array() : (array) $value;
if ( WPCF7_USE_PIPE ) {
$pipes = $this->contact_form->get_pipes( $tag->name );
$value = array_map( static function ( $value ) use ( $pipes ) {
return $pipes->do_pipe( $value );
}, $value );
}
}
$value = apply_filters( "wpcf7_posted_data_{$tag->type}",
$value,
$value_orig,
$tag
);
$posted_data[$tag->name] = $value;
if ( $tag->has_option( 'consent_for:storage' ) and empty( $value ) ) {
$this->meta['do_not_store'] = true;
}
}
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
$this->posted_data_hash = $this->create_posted_data_hash();
return $this->posted_data;
}