Fix other minor type issues in libs
[MAILPOET-3926]
This commit is contained in:
committed by
Veljko V
parent
82f666c488
commit
d13f63b3e2
@ -64,9 +64,8 @@ class Forms {
|
|||||||
$data['site_url'] = $this->wp->siteUrl();
|
$data['site_url'] = $this->wp->siteUrl();
|
||||||
$data['premium_plugin_active'] = License::getLicense();
|
$data['premium_plugin_active'] = License::getLicense();
|
||||||
$data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname;
|
$data['current_wp_user_firstname'] = $this->wp->wpGetCurrentUser()->user_firstname;
|
||||||
$installedAtDateTime = new \DateTime($this->settings->get('installed_at'));
|
$installedAtDiff = (new \DateTime($this->settings->get('installed_at')))->diff(new \DateTime());
|
||||||
$data['installed_days_ago'] = (int)$installedAtDateTime->diff(new \DateTime())->format('%a');
|
$data['installed_days_ago'] = $installedAtDiff instanceof \DateInterval ? (int)$installedAtDiff->format('%a') : null;
|
||||||
|
|
||||||
$data['display_nps_survey'] = true;
|
$data['display_nps_survey'] = true;
|
||||||
$this->userFlags->set('display_new_form_editor_nps_survey', false);
|
$this->userFlags->set('display_new_form_editor_nps_survey', false);
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,9 @@ class Newsletters {
|
|||||||
$data['roles'] = $wp_roles->get_names(); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
$data['roles'] = $wp_roles->get_names(); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
$data['roles']['mailpoet_all'] = $this->wp->__('In any WordPress role', 'mailpoet');
|
$data['roles']['mailpoet_all'] = $this->wp->__('In any WordPress role', 'mailpoet');
|
||||||
|
|
||||||
$installedAtDateTime = new \DateTime($data['settings']['installed_at']);
|
$installedAtDiff = (new \DateTime($this->settings->get('installed_at')))->diff(new \DateTime());
|
||||||
$data['installed_days_ago'] = (int)$installedAtDateTime->diff(new \DateTime())->format('%a');
|
$data['installed_days_ago'] = $installedAtDiff instanceof \DateInterval ? (int)$installedAtDiff->format('%a') : null;
|
||||||
|
|
||||||
$data['subscribers_limit'] = $this->subscribersFeature->getSubscribersLimit();
|
$data['subscribers_limit'] = $this->subscribersFeature->getSubscribersLimit();
|
||||||
$data['subscribers_limit_reached'] = $this->subscribersFeature->check();
|
$data['subscribers_limit_reached'] = $this->subscribersFeature->check();
|
||||||
$data['has_valid_api_key'] = $this->subscribersFeature->hasValidApiKey();
|
$data['has_valid_api_key'] = $this->subscribersFeature->hasValidApiKey();
|
||||||
|
@ -19,7 +19,7 @@ class ExportFilesCleanup extends SimpleWorker {
|
|||||||
$name = $file->getPathname();
|
$name = $file->getPathname();
|
||||||
$created = $file->getMTime();
|
$created = $file->getMTime();
|
||||||
$now = new Carbon();
|
$now = new Carbon();
|
||||||
if (Carbon::createFromTimestamp($created)->lessThan($now->subDays(self::DELETE_FILES_AFTER_X_DAYS))) {
|
if (Carbon::createFromTimestamp((int)$created)->lessThan($now->subDays(self::DELETE_FILES_AFTER_X_DAYS))) {
|
||||||
unlink($name);
|
unlink($name);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,9 @@ class MetadataCache extends CacheProvider {
|
|||||||
if ($fileExists && $this->isDevMode) {
|
if ($fileExists && $this->isDevMode) {
|
||||||
$classMetadata = unserialize((string)file_get_contents($filename));
|
$classMetadata = unserialize((string)file_get_contents($filename));
|
||||||
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
assert($classMetadata instanceof DoctrineClassMetadata || $classMetadata instanceof ValidatorClassMetadata);
|
||||||
|
if (!class_exists($classMetadata->name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$reflection = new ReflectionClass($classMetadata->name);
|
$reflection = new ReflectionClass($classMetadata->name);
|
||||||
} catch (ReflectionException $e) {
|
} catch (ReflectionException $e) {
|
||||||
|
@ -34,7 +34,7 @@ class RequirementsChecker {
|
|||||||
|
|
||||||
$className = get_class($filter);
|
$className = get_class($filter);
|
||||||
$ref = new \ReflectionClass($className);
|
$ref = new \ReflectionClass($className);
|
||||||
$constants = $ref->getConstants();
|
$constants = $ref->getConstants() ?? [];
|
||||||
if (!array_key_exists('SEGMENT_TYPE', $constants)) {
|
if (!array_key_exists('SEGMENT_TYPE', $constants)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class SettingEntity {
|
|||||||
|
|
||||||
/** @return mixed */
|
/** @return mixed */
|
||||||
public function getValue() {
|
public function getValue() {
|
||||||
return is_serialized($this->value) ? unserialize($this->value) : $this->value;
|
return $this->value !== null && is_serialized($this->value) ? unserialize($this->value) : $this->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param mixed $value */
|
/** @param mixed $value */
|
||||||
|
@ -36,9 +36,6 @@ class FeatureFlagsController {
|
|||||||
),
|
),
|
||||||
$flags
|
$flags
|
||||||
);
|
);
|
||||||
if ($flagsMap === false) {
|
|
||||||
$flagsMap = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = [];
|
$output = [];
|
||||||
foreach ($this->featuresController->getDefaults() as $name => $default) {
|
foreach ($this->featuresController->getDefaults() as $name => $default) {
|
||||||
|
@ -168,7 +168,7 @@ class AmazonSES {
|
|||||||
'Authorization' => $this->signRequest($body),
|
'Authorization' => $this->signRequest($body),
|
||||||
'X-Amz-Date' => $this->date,
|
'X-Amz-Date' => $this->date,
|
||||||
],
|
],
|
||||||
'body' => urldecode(http_build_query($body, null, '&')),
|
'body' => urldecode(http_build_query($body, '', '&')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ class AmazonSES {
|
|||||||
'x-amz-date:' . $this->date,
|
'x-amz-date:' . $this->date,
|
||||||
'',
|
'',
|
||||||
'host;x-amz-date',
|
'host;x-amz-date',
|
||||||
hash($this->hashAlgorithm, urldecode(http_build_query($body, null, '&'))),
|
hash($this->hashAlgorithm, urldecode(http_build_query($body, '', '&'))),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class SendGrid {
|
|||||||
'headers' => [
|
'headers' => [
|
||||||
'Authorization' => $this->auth(),
|
'Authorization' => $this->auth(),
|
||||||
],
|
],
|
||||||
'body' => http_build_query($body, null, '&'),
|
'body' => http_build_query($body, '', '&'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,10 @@ class PostContentManager {
|
|||||||
$tagsNotBeingStripped = array_merge($tagsNotBeingStripped, ['<figure>', '<img>', '<h1>', '<h2>', '<h3>']);
|
$tagsNotBeingStripped = array_merge($tagsNotBeingStripped, ['<figure>', '<img>', '<h1>', '<h2>', '<h3>']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($content)) {
|
||||||
|
$content = implode(' ', $content);
|
||||||
|
}
|
||||||
|
|
||||||
$content = strip_tags($content, implode('', $tagsNotBeingStripped));
|
$content = strip_tags($content, implode('', $tagsNotBeingStripped));
|
||||||
if ($withPostClass) {
|
if ($withPostClass) {
|
||||||
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS . '"', WPFunctions::get()->wpautop($content));
|
$content = str_replace('<p', '<p class="' . self::WP_POST_CLASS . '"', WPFunctions::get()->wpautop($content));
|
||||||
|
Reference in New Issue
Block a user