Use short array syntax
[MAILPOET-2090]
This commit is contained in:
@@ -37,37 +37,37 @@ class API {
|
||||
}
|
||||
|
||||
function getSubscriberFields() {
|
||||
$data = array(
|
||||
array(
|
||||
$data = [
|
||||
[
|
||||
'id' => 'email',
|
||||
'name' => WPFunctions::get()->__('Email', 'mailpoet')
|
||||
),
|
||||
array(
|
||||
'name' => WPFunctions::get()->__('Email', 'mailpoet'),
|
||||
],
|
||||
[
|
||||
'id' => 'first_name',
|
||||
'name' => WPFunctions::get()->__('First name', 'mailpoet')
|
||||
),
|
||||
array(
|
||||
'name' => WPFunctions::get()->__('First name', 'mailpoet'),
|
||||
],
|
||||
[
|
||||
'id' => 'last_name',
|
||||
'name' => WPFunctions::get()->__('Last name', 'mailpoet')
|
||||
)
|
||||
);
|
||||
'name' => WPFunctions::get()->__('Last name', 'mailpoet'),
|
||||
],
|
||||
];
|
||||
|
||||
$custom_fields = CustomField::selectMany(array('id', 'name'))->findMany();
|
||||
$custom_fields = CustomField::selectMany(['id', 'name'])->findMany();
|
||||
foreach ($custom_fields as $custom_field) {
|
||||
$data[] = array(
|
||||
$data[] = [
|
||||
'id' => 'cf_' . $custom_field->id,
|
||||
'name' => $custom_field->name
|
||||
);
|
||||
'name' => $custom_field->name,
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function subscribeToList($subscriber_id, $segment_id, $options = array()) {
|
||||
return $this->subscribeToLists($subscriber_id, array($segment_id), $options);
|
||||
function subscribeToList($subscriber_id, $segment_id, $options = []) {
|
||||
return $this->subscribeToLists($subscriber_id, [$segment_id], $options);
|
||||
}
|
||||
|
||||
function subscribeToLists($subscriber_id, array $segments_ids, $options = array()) {
|
||||
function subscribeToLists($subscriber_id, array $segments_ids, $options = []) {
|
||||
$schedule_welcome_email = (isset($options['schedule_welcome_email']) && $options['schedule_welcome_email'] === false) ? false : true;
|
||||
$send_confirmation_email = (isset($options['send_confirmation_email']) && $options['send_confirmation_email'] === false) ? false : true;
|
||||
|
||||
@@ -89,7 +89,7 @@ class API {
|
||||
}
|
||||
|
||||
// throw exception when trying to subscribe to WP Users or WooCommerce Customers segments
|
||||
$found_segments_ids = array();
|
||||
$found_segments_ids = [];
|
||||
foreach ($found_segments as $found_segment) {
|
||||
if ($found_segment->type === Segment::TYPE_WP_USERS) {
|
||||
throw new \Exception(__(sprintf("Can't subscribe to a WordPress Users list with ID %d.", $found_segment->id), 'mailpoet'));
|
||||
@@ -135,7 +135,7 @@ class API {
|
||||
}
|
||||
|
||||
function unsubscribeFromList($subscriber_id, $segment_id) {
|
||||
return $this->unsubscribeFromLists($subscriber_id, array($segment_id));
|
||||
return $this->unsubscribeFromLists($subscriber_id, [$segment_id]);
|
||||
}
|
||||
|
||||
function unsubscribeFromLists($subscriber_id, array $segments_ids) {
|
||||
@@ -157,7 +157,7 @@ class API {
|
||||
}
|
||||
|
||||
// throw exception when trying to subscribe to WP Users or WooCommerce Customers segments
|
||||
$found_segments_ids = array();
|
||||
$found_segments_ids = [];
|
||||
foreach ($found_segments as $segment) {
|
||||
if ($segment->type === Segment::TYPE_WP_USERS) {
|
||||
throw new \Exception(__(sprintf("Can't unsubscribe from a WordPress Users list with ID %d.", $segment->id), 'mailpoet'));
|
||||
@@ -187,7 +187,7 @@ class API {
|
||||
->findArray();
|
||||
}
|
||||
|
||||
function addSubscriber(array $subscriber, $segments = array(), $options = array()) {
|
||||
function addSubscriber(array $subscriber, $segments = [], $options = []) {
|
||||
$send_confirmation_email = (isset($options['send_confirmation_email']) && $options['send_confirmation_email'] === false) ? false : true;
|
||||
$schedule_welcome_email = (isset($options['schedule_welcome_email']) && $options['schedule_welcome_email'] === false) ? false : true;
|
||||
$skip_subscriber_notification = (isset($options['skip_subscriber_notification']) && $options['skip_subscriber_notification'] === true) ? true : false;
|
||||
|
Reference in New Issue
Block a user