diff --git a/lib/Config/Menu.php b/lib/Config/Menu.php index e6e0211d27..dd2f3aaf85 100644 --- a/lib/Config/Menu.php +++ b/lib/Config/Menu.php @@ -439,7 +439,7 @@ class Menu { } function formEditor() { - $id = (isset($_GET['id']) ? (int) $_GET['id'] : 0); + $id = (isset($_GET['id']) ? (int)$_GET['id'] : 0); $form = Form::findOne($id); if($form !== false) { $form = $form->asArray(); diff --git a/lib/Cron/Supervisor.php b/lib/Cron/Supervisor.php index fc93fd478c..f89f51dfa0 100644 --- a/lib/Cron/Supervisor.php +++ b/lib/Cron/Supervisor.php @@ -28,7 +28,7 @@ class Supervisor { return $this->formatDaemonStatusMessage($daemon['status']); } - $elapsed_time = time() - (int) $daemon['updated_at']; + $elapsed_time = time() - (int)$daemon['updated_at']; // if it's been less than 40 seconds since last execution and we're not // force-running the daemon, return its status and do nothing if($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT && !$this->force_run) { diff --git a/lib/Cron/Workers/Scheduler.php b/lib/Cron/Workers/Scheduler.php index 0714c7b348..5f05d891aa 100644 --- a/lib/Cron/Workers/Scheduler.php +++ b/lib/Cron/Workers/Scheduler.php @@ -51,7 +51,7 @@ class Scheduler { $queue->delete(); return; } - $subscriber_id = (int) $subscriber['to_process'][0]; + $subscriber_id = (int)$subscriber['to_process'][0]; if($newsletter->event === 'segment') { if($this->verifyMailPoetSubscriber($subscriber_id, $newsletter, $queue) === false) { return; diff --git a/lib/Cron/Workers/SendingQueue.php b/lib/Cron/Workers/SendingQueue.php index 3f2d200d83..244746c31d 100644 --- a/lib/Cron/Workers/SendingQueue.php +++ b/lib/Cron/Workers/SendingQueue.php @@ -352,9 +352,9 @@ class SendingQueue { } function checkSendingLimit() { - $frequency_interval = (int) $this->mta_config['frequency']['interval'] * 60; - $frequency_limit = (int) $this->mta_config['frequency']['emails']; - $elapsed_time = time() - (int) $this->mta_log['started']; + $frequency_interval = (int)$this->mta_config['frequency']['interval'] * 60; + $frequency_limit = (int)$this->mta_config['frequency']['emails']; + $elapsed_time = time() - (int)$this->mta_log['started']; if($this->mta_log['sent'] === $frequency_limit && $elapsed_time <= $frequency_interval ) { diff --git a/lib/Models/NewsletterTemplate.php b/lib/Models/NewsletterTemplate.php index 576f41760d..a523d4e0cf 100644 --- a/lib/Models/NewsletterTemplate.php +++ b/lib/Models/NewsletterTemplate.php @@ -28,8 +28,8 @@ class NewsletterTemplate extends Model { static function createOrUpdate($data = array()) { $template = false; - if(isset($data['id']) && (int) $data['id'] > 0) { - $template = self::findOne((int) $data['id']); + if(isset($data['id']) && (int)$data['id'] > 0) { + $template = self::findOne((int)$data['id']); } if($template === false) { diff --git a/lib/Newsletter/AutomatedLatestContent.php b/lib/Newsletter/AutomatedLatestContent.php index 4c4d6abaaa..72f8f6cdf2 100644 --- a/lib/Newsletter/AutomatedLatestContent.php +++ b/lib/Newsletter/AutomatedLatestContent.php @@ -32,8 +32,8 @@ class AutomatedLatestContent { } function getPosts($args, $posts_to_exclude = array()) { - $posts_per_page = (!empty($args['amount']) && (int) $args['amount'] > 0) - ? (int) $args['amount'] + $posts_per_page = (!empty($args['amount']) && (int)$args['amount'] > 0) + ? (int)$args['amount'] : self::DEFAULT_POSTS_PER_PAGE; $parameters = array( 'posts_per_page' => $posts_per_page, diff --git a/lib/Newsletter/Renderer/Blocks/Button.php b/lib/Newsletter/Renderer/Blocks/Button.php index 02e2d26be9..d2eff845c3 100644 --- a/lib/Newsletter/Renderer/Blocks/Button.php +++ b/lib/Newsletter/Renderer/Blocks/Button.php @@ -43,8 +43,8 @@ class Button { static function calculateWidth($element, $column_count) { $column_width = ColumnsHelper::columnWidth($column_count); $column_width = $column_width - (StylesHelper::$padding_width * 2); - $border_width = (int) $element['styles']['block']['borderWidth']; - $button_width = (int) $element['styles']['block']['width']; + $border_width = (int)$element['styles']['block']['borderWidth']; + $button_width = (int)$element['styles']['block']['width']; $button_width = ($button_width > $column_width) ? $column_width : $button_width; diff --git a/lib/Newsletter/Renderer/Blocks/Footer.php b/lib/Newsletter/Renderer/Blocks/Footer.php index 0fa0446d56..92ecbce865 100644 --- a/lib/Newsletter/Renderer/Blocks/Footer.php +++ b/lib/Newsletter/Renderer/Blocks/Footer.php @@ -8,7 +8,7 @@ class Footer { $element['text'] = preg_replace('/\n/', '
', $element['text']); $element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']); $line_height = sprintf( - '%spx', StylesHelper::$line_height_multiplier * (int) $element['styles']['text']['fontSize'] + '%spx', StylesHelper::$line_height_multiplier * (int)$element['styles']['text']['fontSize'] ); $DOM_parser = new \pQuery(); $DOM = $DOM_parser->parseStr($element['text']); diff --git a/lib/Newsletter/Renderer/Blocks/Header.php b/lib/Newsletter/Renderer/Blocks/Header.php index c5d1b916fe..7c4ef126cb 100644 --- a/lib/Newsletter/Renderer/Blocks/Header.php +++ b/lib/Newsletter/Renderer/Blocks/Header.php @@ -8,7 +8,7 @@ class Header { $element['text'] = preg_replace('/\n/', '
', $element['text']); $element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']); $line_height = sprintf( - '%spx', StylesHelper::$line_height_multiplier * (int) $element['styles']['text']['fontSize'] + '%spx', StylesHelper::$line_height_multiplier * (int)$element['styles']['text']['fontSize'] ); $DOM_parser = new \pQuery(); $DOM = $DOM_parser->parseStr($element['text']); diff --git a/lib/Newsletter/Renderer/Blocks/Image.php b/lib/Newsletter/Renderer/Blocks/Image.php index a25853bbb0..da5cf2e1a8 100644 --- a/lib/Newsletter/Renderer/Blocks/Image.php +++ b/lib/Newsletter/Renderer/Blocks/Image.php @@ -6,8 +6,8 @@ use MailPoet\Newsletter\Renderer\StylesHelper; class Image { static function render($element, $column_count) { - $element['width'] = (int) $element['width']; - $element['height'] = (int) $element['height']; + $element['width'] = (int)$element['width']; + $element['height'] = (int)$element['height']; $element = self::adjustImageDimensions($element, $column_count); $image_template = ' $column_width) { $ratio = $element['width'] / $column_width; $element['width'] = $column_width; - $element['height'] = (int) ceil($element['height'] / $ratio); + $element['height'] = (int)ceil($element['height'] / $ratio); } // resize image if the image is padded and wider than padded column width if($element['fullWidth'] === false && @@ -40,7 +40,7 @@ class Image { ) { $ratio = $element['width'] / ($column_width - $padded_width); $element['width'] = $column_width - $padded_width; - $element['height'] = (int) ceil($element['height'] / $ratio); + $element['height'] = (int)ceil($element['height'] / $ratio); } return $element; } diff --git a/lib/Newsletter/Renderer/Blocks/Social.php b/lib/Newsletter/Renderer/Blocks/Social.php index 8b177510ec..f5c2f10660 100644 --- a/lib/Newsletter/Renderer/Blocks/Social.php +++ b/lib/Newsletter/Renderer/Blocks/Social.php @@ -8,7 +8,7 @@ class Social { foreach($element['icons'] as $index => $icon) { $icons_block .= ' - ' . $icon['iconType'] . ' + ' . $icon['iconType'] . ' '; } $template = ' diff --git a/lib/Newsletter/Renderer/Blocks/Spacer.php b/lib/Newsletter/Renderer/Blocks/Spacer.php index bfbba556fb..659af7868e 100644 --- a/lib/Newsletter/Renderer/Blocks/Spacer.php +++ b/lib/Newsletter/Renderer/Blocks/Spacer.php @@ -3,7 +3,7 @@ namespace MailPoet\Newsletter\Renderer\Blocks; class Spacer { static function render($element) { - $height = (int) $element['styles']['block']['height']; + $height = (int)$element['styles']['block']['height']; $background_color = $element['styles']['block']['backgroundColor']; $template = ' diff --git a/lib/Newsletter/Renderer/StylesHelper.php b/lib/Newsletter/Renderer/StylesHelper.php index 51618ec826..05159a820a 100644 --- a/lib/Newsletter/Renderer/StylesHelper.php +++ b/lib/Newsletter/Renderer/StylesHelper.php @@ -90,14 +90,14 @@ class StylesHelper { static function applyHeadingMargin($style, $selector) { if (!preg_match('/h[1-4]/i', $selector)) return $style; - $font_size = (int) $style['fontSize']; + $font_size = (int)$style['fontSize']; $style['margin'] = sprintf('0 0 %spx 0', self::$heading_margin_multiplier * $font_size); return $style; } static function applyLineHeight($style, $selector) { if (!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style; - $font_size = (int) $style['fontSize']; + $font_size = (int)$style['fontSize']; $style['lineHeight'] = sprintf('%spx', self::$line_height_multiplier * $font_size); return $style; } diff --git a/lib/Newsletter/Scheduler/Scheduler.php b/lib/Newsletter/Scheduler/Scheduler.php index 7912ef19f6..927f9b8eba 100644 --- a/lib/Newsletter/Scheduler/Scheduler.php +++ b/lib/Newsletter/Scheduler/Scheduler.php @@ -19,7 +19,7 @@ class Scheduler { if(!$newsletter) return; $newsletter = $newsletter->asArray(); $interval_type = $newsletter['intervalType']; - $hour = (int) $newsletter['timeOfDay'] / self::SECONDS_IN_HOUR; + $hour = (int)$newsletter['timeOfDay'] / self::SECONDS_IN_HOUR; $week_day = $newsletter['weekDay']; $month_day = $newsletter['monthDay']; $nth_week_day = ($newsletter['nthWeekDay'] === self::LAST_WEEKDAY_FORMAT) ? diff --git a/lib/Router/Newsletters.php b/lib/Router/Newsletters.php index 7f31509c4a..d12225d558 100644 --- a/lib/Router/Newsletters.php +++ b/lib/Router/Newsletters.php @@ -140,7 +140,7 @@ class Newsletters { 'errors' => array(__('Newsletter data is missing.')) ); } - $newsletter_id = (isset($data['id'])) ? (int) $data['id'] : 0; + $newsletter_id = (isset($data['id'])) ? (int)$data['id'] : 0; $newsletter = Newsletter::findOne($newsletter_id); if (!$newsletter) { return array( @@ -162,7 +162,7 @@ class Newsletters { } function sendPreview($data = array()) { - $id = (isset($data['id'])) ? (int) $data['id'] : 0; + $id = (isset($data['id'])) ? (int)$data['id'] : 0; $newsletter = Newsletter::findOne($id); if($newsletter === false) { diff --git a/lib/Subscribers/ImportExport/Import/Import.php b/lib/Subscribers/ImportExport/Import/Import.php index 59d9e90ec3..51a69d121d 100644 --- a/lib/Subscribers/ImportExport/Import/Import.php +++ b/lib/Subscribers/ImportExport/Import/Import.php @@ -32,8 +32,8 @@ class Import { array_keys($data['columns']) ); $this->subscribers_count = count(reset($this->subscribers_data)); - $this->created_at = date('Y-m-d H:i:s', (int) $data['timestamp']); - $this->updated_at = date('Y-m-d H:i:s', (int) $data['timestamp'] + 1); + $this->created_at = date('Y-m-d H:i:s', (int)$data['timestamp']); + $this->updated_at = date('Y-m-d H:i:s', (int)$data['timestamp'] + 1); $this->profiler_start = microtime(true); } diff --git a/lib/Util/Helpers.php b/lib/Util/Helpers.php index f64c08fe6d..5ae0770275 100644 --- a/lib/Util/Helpers.php +++ b/lib/Util/Helpers.php @@ -8,13 +8,13 @@ class Helpers { switch (substr($maxPostSize, -1)) { case 'M': case 'm': - return (int) $maxPostSize * 1048576; + return (int)$maxPostSize * 1048576; case 'K': case 'k': - return (int) $maxPostSize * 1024; + return (int)$maxPostSize * 1024; case 'G': case 'g': - return (int) $maxPostSize * 1073741824; + return (int)$maxPostSize * 1073741824; default: return $maxPostSize; } @@ -69,7 +69,7 @@ class Helpers { $paramsIndexKey = null; if(isset($params[2])) { if(is_float($params[2]) || is_int($params[2])) { - $paramsIndexKey = (int) $params[2]; + $paramsIndexKey = (int)$params[2]; } else { $paramsIndexKey = (string) $params[2]; }