- Removes space between (int) and variable

This commit is contained in:
Vlad
2016-05-18 09:23:50 -04:00
parent 8540c51679
commit bf1ab3a593
17 changed files with 31 additions and 31 deletions

View File

@ -439,7 +439,7 @@ class Menu {
} }
function formEditor() { function formEditor() {
$id = (isset($_GET['id']) ? (int) $_GET['id'] : 0); $id = (isset($_GET['id']) ? (int)$_GET['id'] : 0);
$form = Form::findOne($id); $form = Form::findOne($id);
if($form !== false) { if($form !== false) {
$form = $form->asArray(); $form = $form->asArray();

View File

@ -28,7 +28,7 @@ class Supervisor {
return $this->formatDaemonStatusMessage($daemon['status']); 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 // 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 // force-running the daemon, return its status and do nothing
if($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT && !$this->force_run) { if($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT && !$this->force_run) {

View File

@ -51,7 +51,7 @@ class Scheduler {
$queue->delete(); $queue->delete();
return; return;
} }
$subscriber_id = (int) $subscriber['to_process'][0]; $subscriber_id = (int)$subscriber['to_process'][0];
if($newsletter->event === 'segment') { if($newsletter->event === 'segment') {
if($this->verifyMailPoetSubscriber($subscriber_id, $newsletter, $queue) === false) { if($this->verifyMailPoetSubscriber($subscriber_id, $newsletter, $queue) === false) {
return; return;

View File

@ -352,9 +352,9 @@ class SendingQueue {
} }
function checkSendingLimit() { function checkSendingLimit() {
$frequency_interval = (int) $this->mta_config['frequency']['interval'] * 60; $frequency_interval = (int)$this->mta_config['frequency']['interval'] * 60;
$frequency_limit = (int) $this->mta_config['frequency']['emails']; $frequency_limit = (int)$this->mta_config['frequency']['emails'];
$elapsed_time = time() - (int) $this->mta_log['started']; $elapsed_time = time() - (int)$this->mta_log['started'];
if($this->mta_log['sent'] === $frequency_limit && if($this->mta_log['sent'] === $frequency_limit &&
$elapsed_time <= $frequency_interval $elapsed_time <= $frequency_interval
) { ) {

View File

@ -28,8 +28,8 @@ class NewsletterTemplate extends Model {
static function createOrUpdate($data = array()) { static function createOrUpdate($data = array()) {
$template = false; $template = false;
if(isset($data['id']) && (int) $data['id'] > 0) { if(isset($data['id']) && (int)$data['id'] > 0) {
$template = self::findOne((int) $data['id']); $template = self::findOne((int)$data['id']);
} }
if($template === false) { if($template === false) {

View File

@ -32,8 +32,8 @@ class AutomatedLatestContent {
} }
function getPosts($args, $posts_to_exclude = array()) { function getPosts($args, $posts_to_exclude = array()) {
$posts_per_page = (!empty($args['amount']) && (int) $args['amount'] > 0) $posts_per_page = (!empty($args['amount']) && (int)$args['amount'] > 0)
? (int) $args['amount'] ? (int)$args['amount']
: self::DEFAULT_POSTS_PER_PAGE; : self::DEFAULT_POSTS_PER_PAGE;
$parameters = array( $parameters = array(
'posts_per_page' => $posts_per_page, 'posts_per_page' => $posts_per_page,

View File

@ -43,8 +43,8 @@ class Button {
static function calculateWidth($element, $column_count) { static function calculateWidth($element, $column_count) {
$column_width = ColumnsHelper::columnWidth($column_count); $column_width = ColumnsHelper::columnWidth($column_count);
$column_width = $column_width - (StylesHelper::$padding_width * 2); $column_width = $column_width - (StylesHelper::$padding_width * 2);
$border_width = (int) $element['styles']['block']['borderWidth']; $border_width = (int)$element['styles']['block']['borderWidth'];
$button_width = (int) $element['styles']['block']['width']; $button_width = (int)$element['styles']['block']['width'];
$button_width = ($button_width > $column_width) ? $button_width = ($button_width > $column_width) ?
$column_width : $column_width :
$button_width; $button_width;

View File

@ -8,7 +8,7 @@ class Footer {
$element['text'] = preg_replace('/\n/', '<br />', $element['text']); $element['text'] = preg_replace('/\n/', '<br />', $element['text']);
$element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']); $element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']);
$line_height = sprintf( $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_parser = new \pQuery();
$DOM = $DOM_parser->parseStr($element['text']); $DOM = $DOM_parser->parseStr($element['text']);

View File

@ -8,7 +8,7 @@ class Header {
$element['text'] = preg_replace('/\n/', '<br />', $element['text']); $element['text'] = preg_replace('/\n/', '<br />', $element['text']);
$element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']); $element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']);
$line_height = sprintf( $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_parser = new \pQuery();
$DOM = $DOM_parser->parseStr($element['text']); $DOM = $DOM_parser->parseStr($element['text']);

View File

@ -6,8 +6,8 @@ use MailPoet\Newsletter\Renderer\StylesHelper;
class Image { class Image {
static function render($element, $column_count) { static function render($element, $column_count) {
$element['width'] = (int) $element['width']; $element['width'] = (int)$element['width'];
$element['height'] = (int) $element['height']; $element['height'] = (int)$element['height'];
$element = self::adjustImageDimensions($element, $column_count); $element = self::adjustImageDimensions($element, $column_count);
$image_template = ' $image_template = '
<img style="max-width:' . $element['width'] . 'px;" src="' . $element['src'] . '" <img style="max-width:' . $element['width'] . 'px;" src="' . $element['src'] . '"
@ -32,7 +32,7 @@ class Image {
if($element['width'] > $column_width) { if($element['width'] > $column_width) {
$ratio = $element['width'] / $column_width; $ratio = $element['width'] / $column_width;
$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 // resize image if the image is padded and wider than padded column width
if($element['fullWidth'] === false && if($element['fullWidth'] === false &&
@ -40,7 +40,7 @@ class Image {
) { ) {
$ratio = $element['width'] / ($column_width - $padded_width); $ratio = $element['width'] / ($column_width - $padded_width);
$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; return $element;
} }

View File

@ -8,7 +8,7 @@ class Social {
foreach($element['icons'] as $index => $icon) { foreach($element['icons'] as $index => $icon) {
$icons_block .= ' $icons_block .= '
<a href="' . $icon['link'] . '" style="text-decoration:none!important;"> <a href="' . $icon['link'] . '" style="text-decoration:none!important;">
<img src="' . $icon['image'] . '" width="' . (int) $icon['width'] . '" height="' . (int) $icon['height'] . '" style="width:' . $icon['width'] . ';height:' . $icon['width'] . ';-ms-interpolation-mode:bicubic;border:0;display:inline;outline:none;" alt="' . $icon['iconType'] . '"> <img src="' . $icon['image'] . '" width="' . (int)$icon['width'] . '" height="' . (int)$icon['height'] . '" style="width:' . $icon['width'] . ';height:' . $icon['width'] . ';-ms-interpolation-mode:bicubic;border:0;display:inline;outline:none;" alt="' . $icon['iconType'] . '">
</a>'; </a>';
} }
$template = ' $template = '

View File

@ -3,7 +3,7 @@ namespace MailPoet\Newsletter\Renderer\Blocks;
class Spacer { class Spacer {
static function render($element) { static function render($element) {
$height = (int) $element['styles']['block']['height']; $height = (int)$element['styles']['block']['height'];
$background_color = $element['styles']['block']['backgroundColor']; $background_color = $element['styles']['block']['backgroundColor'];
$template = ' $template = '
<tr> <tr>

View File

@ -90,14 +90,14 @@ class StylesHelper {
static function applyHeadingMargin($style, $selector) { static function applyHeadingMargin($style, $selector) {
if (!preg_match('/h[1-4]/i', $selector)) return $style; 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); $style['margin'] = sprintf('0 0 %spx 0', self::$heading_margin_multiplier * $font_size);
return $style; return $style;
} }
static function applyLineHeight($style, $selector) { static function applyLineHeight($style, $selector) {
if (!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style; 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); $style['lineHeight'] = sprintf('%spx', self::$line_height_multiplier * $font_size);
return $style; return $style;
} }

View File

@ -19,7 +19,7 @@ class Scheduler {
if(!$newsletter) return; if(!$newsletter) return;
$newsletter = $newsletter->asArray(); $newsletter = $newsletter->asArray();
$interval_type = $newsletter['intervalType']; $interval_type = $newsletter['intervalType'];
$hour = (int) $newsletter['timeOfDay'] / self::SECONDS_IN_HOUR; $hour = (int)$newsletter['timeOfDay'] / self::SECONDS_IN_HOUR;
$week_day = $newsletter['weekDay']; $week_day = $newsletter['weekDay'];
$month_day = $newsletter['monthDay']; $month_day = $newsletter['monthDay'];
$nth_week_day = ($newsletter['nthWeekDay'] === self::LAST_WEEKDAY_FORMAT) ? $nth_week_day = ($newsletter['nthWeekDay'] === self::LAST_WEEKDAY_FORMAT) ?

View File

@ -140,7 +140,7 @@ class Newsletters {
'errors' => array(__('Newsletter data is missing.')) '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); $newsletter = Newsletter::findOne($newsletter_id);
if (!$newsletter) { if (!$newsletter) {
return array( return array(
@ -162,7 +162,7 @@ class Newsletters {
} }
function sendPreview($data = array()) { function sendPreview($data = array()) {
$id = (isset($data['id'])) ? (int) $data['id'] : 0; $id = (isset($data['id'])) ? (int)$data['id'] : 0;
$newsletter = Newsletter::findOne($id); $newsletter = Newsletter::findOne($id);
if($newsletter === false) { if($newsletter === false) {

View File

@ -32,8 +32,8 @@ class Import {
array_keys($data['columns']) array_keys($data['columns'])
); );
$this->subscribers_count = count(reset($this->subscribers_data)); $this->subscribers_count = count(reset($this->subscribers_data));
$this->created_at = date('Y-m-d H:i:s', (int) $data['timestamp']); $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->updated_at = date('Y-m-d H:i:s', (int)$data['timestamp'] + 1);
$this->profiler_start = microtime(true); $this->profiler_start = microtime(true);
} }

View File

@ -8,13 +8,13 @@ class Helpers {
switch (substr($maxPostSize, -1)) { switch (substr($maxPostSize, -1)) {
case 'M': case 'M':
case 'm': case 'm':
return (int) $maxPostSize * 1048576; return (int)$maxPostSize * 1048576;
case 'K': case 'K':
case 'k': case 'k':
return (int) $maxPostSize * 1024; return (int)$maxPostSize * 1024;
case 'G': case 'G':
case 'g': case 'g':
return (int) $maxPostSize * 1073741824; return (int)$maxPostSize * 1073741824;
default: default:
return $maxPostSize; return $maxPostSize;
} }
@ -69,7 +69,7 @@ class Helpers {
$paramsIndexKey = null; $paramsIndexKey = null;
if(isset($params[2])) { if(isset($params[2])) {
if(is_float($params[2]) || is_int($params[2])) { if(is_float($params[2]) || is_int($params[2])) {
$paramsIndexKey = (int) $params[2]; $paramsIndexKey = (int)$params[2];
} else { } else {
$paramsIndexKey = (string) $params[2]; $paramsIndexKey = (string) $params[2];
} }