- Updates code to work with PHP 5.3. Closes #307
This commit is contained in:
@@ -36,8 +36,9 @@ class Env {
|
|||||||
self::$views_path = self::$path . '/views';
|
self::$views_path = self::$path . '/views';
|
||||||
self::$assets_path = self::$path . '/assets';
|
self::$assets_path = self::$path . '/assets';
|
||||||
self::$assets_url = plugins_url('/assets', $file);
|
self::$assets_url = plugins_url('/assets', $file);
|
||||||
self::$temp_path = wp_upload_dir()['path'];
|
$wp_upload_dir = wp_upload_dir();
|
||||||
self::$temp_URL = wp_upload_dir()['url'];
|
self::$temp_path = $wp_upload_dir['path'];
|
||||||
|
self::$temp_URL = $wp_upload_dir['url'];
|
||||||
self::$languages_path = self::$path . '/lang';
|
self::$languages_path = self::$path . '/lang';
|
||||||
self::$lib_path = self::$path . '/lib';
|
self::$lib_path = self::$path . '/lib';
|
||||||
self::$plugin_prefix = 'mailpoet_';
|
self::$plugin_prefix = 'mailpoet_';
|
||||||
@@ -74,15 +75,16 @@ class Env {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static function isPluginActivated() {
|
static function isPluginActivated() {
|
||||||
$activatesPlugins = get_option('active_plugins');
|
$activated_plugins = get_option('active_plugins');
|
||||||
|
$plugin_basename = plugin_basename(__FILE__);
|
||||||
$isActivated = (
|
$isActivated = (
|
||||||
in_array(
|
in_array(
|
||||||
sprintf('%s/%s.php', basename(self::$path), self::$plugin_name),
|
sprintf('%s/%s.php', basename(self::$path), self::$plugin_name),
|
||||||
$activatesPlugins
|
$activated_plugins
|
||||||
) ||
|
) ||
|
||||||
in_array(
|
in_array(
|
||||||
sprintf('%s/%s.php', explode('/', plugin_basename(__FILE__))[0], self::$plugin_name),
|
sprintf('%s/%s.php', explode('/', $plugin_basename[0]), self::$plugin_name),
|
||||||
$activatesPlugins
|
$activated_plugins
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return ($isActivated) ? true : false;
|
return ($isActivated) ? true : false;
|
||||||
|
@@ -20,10 +20,11 @@ class SendGrid {
|
|||||||
$this->url,
|
$this->url,
|
||||||
$this->request($newsletter, $subscriber)
|
$this->request($newsletter, $subscriber)
|
||||||
);
|
);
|
||||||
|
$result_body = json_decode($result['body'], true);
|
||||||
return (
|
return (
|
||||||
!is_wp_error($result) === true &&
|
!is_wp_error($result) === true &&
|
||||||
!preg_match('!invalid!', $result['body']) === true &&
|
!preg_match('!invalid!', $result['body']) === true &&
|
||||||
!isset(json_decode($result['body'], true)['errors']) === true &&
|
!isset($result_body['errors']) === true &&
|
||||||
wp_remote_retrieve_response_code($result) === 200
|
wp_remote_retrieve_response_code($result) === 200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -61,10 +61,10 @@ class WP {
|
|||||||
$segment = Segment::getWPUsers();
|
$segment = Segment::getWPUsers();
|
||||||
|
|
||||||
// count WP users
|
// count WP users
|
||||||
$users_count = \count_users()['total_users'];
|
$users_count = \count_users();
|
||||||
$linked_subscribers_count = $segment->subscribers()->count();
|
$linked_subscribers_count = $segment->subscribers()->count();
|
||||||
|
|
||||||
if($users_count !== $linked_subscribers_count) {
|
if($users_count['total_users'] !== $linked_subscribers_count) {
|
||||||
$linked_subscribers = Subscriber::select('wp_user_id')
|
$linked_subscribers = Subscriber::select('wp_user_id')
|
||||||
->whereNotNull('wp_user_id')
|
->whereNotNull('wp_user_id')
|
||||||
->findArray();
|
->findArray();
|
||||||
|
@@ -318,8 +318,8 @@ class Import {
|
|||||||
$value
|
$value
|
||||||
);
|
);
|
||||||
}, $count, $subscribers_data[$column]);
|
}, $count, $subscribers_data[$column]);
|
||||||
}, $subscriber_custom_fields)[0];
|
}, $subscriber_custom_fields);
|
||||||
foreach(array_chunk($subscribers, 200) as $data) {
|
foreach(array_chunk($subscribers[0], 200) as $data) {
|
||||||
if($action === 'create') {
|
if($action === 'create') {
|
||||||
SubscriberCustomField::createMultiple(
|
SubscriberCustomField::createMultiple(
|
||||||
$data
|
$data
|
||||||
|
Reference in New Issue
Block a user