WPCF7_ConstantContact_ContactPostRequest::build() public CF7 1.0
{} Это метод класса: WPCF7_ConstantContact_ContactPostRequest{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WPCF7_ConstantContact_ContactPostRequest = new WPCF7_ConstantContact_ContactPostRequest(); $WPCF7_ConstantContact_ContactPostRequest->build( $submission );
Код WPCF7_ConstantContact_ContactPostRequest::build() WPCF7 ConstantContact ContactPostRequest::build CF7 5.3.2
public function build( WPCF7_Submission $submission ) {
$this->set_create_source( 'Contact' );
$posted_data = (array) $submission->get_posted_data();
if ( isset( $posted_data['your-first-name'] ) ) {
$this->set_first_name( $posted_data['your-first-name'] );
}
if ( isset( $posted_data['your-last-name'] ) ) {
$this->set_last_name( $posted_data['your-last-name'] );
}
if ( ! ( $this->first_name || $this->last_name )
and isset( $posted_data['your-name'] ) ) {
$your_name = preg_split( '/[\s]+/', $posted_data['your-name'], 2 );
$this->set_first_name( array_shift( $your_name ) );
$this->set_last_name( array_shift( $your_name ) );
}
if ( isset( $posted_data['your-email'] ) ) {
$this->set_email_address( $posted_data['your-email'], 'implicit' );
}
if ( isset( $posted_data['your-job-title'] ) ) {
$this->set_job_title( $posted_data['your-job-title'] );
}
if ( isset( $posted_data['your-company-name'] ) ) {
$this->set_company_name( $posted_data['your-company-name'] );
}
if ( isset( $posted_data['your-birthday-month'] )
and isset( $posted_data['your-birthday-day'] ) ) {
$this->set_birthday(
$posted_data['your-birthday-month'],
$posted_data['your-birthday-day']
);
} elseif ( isset( $posted_data['your-birthday'] ) ) {
$date = trim( $posted_data['your-birthday'] );
if ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})$/', $date, $matches ) ) {
$this->set_birthday( $matches[2], $matches[3] );
}
}
if ( isset( $posted_data['your-anniversary'] ) ) {
$this->set_anniversary( $posted_data['your-anniversary'] );
}
if ( isset( $posted_data['your-phone-number'] ) ) {
$this->add_phone_number( $posted_data['your-phone-number'] );
}
$this->add_street_address(
isset( $posted_data['your-address-street'] )
? $posted_data['your-address-street'] : '',
isset( $posted_data['your-address-city'] )
? $posted_data['your-address-city'] : '',
isset( $posted_data['your-address-state'] )
? $posted_data['your-address-state'] : '',
isset( $posted_data['your-address-postal-code'] )
? $posted_data['your-address-postal-code'] : '',
isset( $posted_data['your-address-country'] )
? $posted_data['your-address-country'] : ''
);
$service_option = (array) WPCF7::get_option( 'constant_contact' );
$contact_lists = isset( $service_option['contact_lists'] )
? $service_option['contact_lists'] : array();
$contact_form = $submission->get_contact_form();
if ( $contact_form->additional_setting( 'constant_contact' ) ) {
$key = sprintf( 'wpcf7_contact_form:%d', $contact_form->id() );
} else {
$key = 'default';
}
foreach ( (array) $contact_lists as $list ) {
if ( ! empty( $list['selected'][$key] ) ) {
$this->add_list_membership( $list['list_id'] );
}
}
}