WPCF7_ConstantContact::update_contact_lists()
Метод класса: WPCF7_ConstantContact{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WPCF7_ConstantContact = new WPCF7_ConstantContact(); $WPCF7_ConstantContact->update_contact_lists( $selection );
- $selection **
- -
По умолчанию: array()
Код WPCF7_ConstantContact::update_contact_lists() WPCF7 ConstantContact::update contact lists CF7 5.9.8
public function update_contact_lists( $selection = array() ) { $contact_lists = array(); $contact_lists_on_api = $this->get_contact_lists(); if ( false !== $contact_lists_on_api ) { foreach ( (array) $contact_lists_on_api as $list ) { if ( isset( $list['list_id'] ) ) { $list_id = trim( $list['list_id'] ); } else { continue; } if ( isset( $this->contact_lists[$list_id]['selected'] ) ) { $list['selected'] = $this->contact_lists[$list_id]['selected']; } else { $list['selected'] = array(); } $contact_lists[$list_id] = $list; } } else { $contact_lists = $this->contact_lists; } foreach ( (array) $selection as $key => $ids_or_names ) { foreach( $contact_lists as $list_id => $list ) { if ( in_array( $list['list_id'], (array) $ids_or_names, true ) or in_array( $list['name'], (array) $ids_or_names, true ) ) { $contact_lists[$list_id]['selected'][$key] = true; } else { unset( $contact_lists[$list_id]['selected'][$key] ); } } } $this->contact_lists = $contact_lists; if ( $selection ) { $this->save_data(); } return $this->contact_lists; }