- Removes space between IF and statement
This commit is contained in:
@ -39,7 +39,7 @@ class Env {
|
||||
self::$assets_url = plugins_url('/assets', $file);
|
||||
$wp_upload_dir = wp_upload_dir();
|
||||
self::$temp_path = $wp_upload_dir['basedir'].'/'.self::$plugin_name;
|
||||
if (!is_dir(self::$temp_path)) {
|
||||
if(!is_dir(self::$temp_path)) {
|
||||
mkdir(self::$temp_path);
|
||||
}
|
||||
self::$temp_url = $wp_upload_dir['baseurl'].'/'.self::$plugin_name;
|
||||
|
@ -10,7 +10,7 @@ use \MailPoet\Segments\WP;
|
||||
use \MailPoet\Models\Setting;
|
||||
use \MailPoet\Settings\Pages;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
|
||||
@ -36,7 +36,7 @@ class Populator {
|
||||
$column_conditions = array_map(function($key) use ($field) {
|
||||
return $key . '=' . $field[$key];
|
||||
}, $field);
|
||||
if ($wpdb->get_var("SELECT COUNT(*) FROM " . $table . " WHERE " . implode(' AND ', $column_conditions)) === 0) {
|
||||
if($wpdb->get_var("SELECT COUNT(*) FROM " . $table . " WHERE " . implode(' AND ', $column_conditions)) === 0) {
|
||||
$wpdb->insert(
|
||||
$table,
|
||||
$field
|
||||
@ -207,7 +207,7 @@ class Populator {
|
||||
$_this = $this;
|
||||
|
||||
array_map(function($row) use ($_this, $table) {
|
||||
if (!$_this->rowExists($table, $row)) {
|
||||
if(!$_this->rowExists($table, $row)) {
|
||||
$_this->insertRow($table, $row);
|
||||
}
|
||||
}, $rows);
|
||||
|
@ -47,7 +47,7 @@ class Scheduler {
|
||||
|
||||
function processWelcomeNewsletter($newsletter, $queue) {
|
||||
$subscriber = unserialize($queue->subscribers);
|
||||
if (!isset($subscriber['to_process']) || !isset($subscriber['to_process'][0])) {
|
||||
if(!isset($subscriber['to_process']) || !isset($subscriber['to_process'][0])) {
|
||||
$queue->delete();
|
||||
return;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class SendingQueue {
|
||||
}
|
||||
$newsletter = $newsletter->asArray();
|
||||
$newsletter['body'] = $this->getOrRenderNewsletterBody($queue, $newsletter);
|
||||
if ($newsletter['type'] === 'notification' &&
|
||||
if($newsletter['type'] === 'notification' &&
|
||||
strpos($newsletter['body']['html'], 'data-post-id') === false
|
||||
){
|
||||
$queue->delete();
|
||||
@ -61,14 +61,14 @@ class SendingQueue {
|
||||
$subscribers_ids) {
|
||||
$subscribers = Subscriber::whereIn('id', $subscribers_ids)
|
||||
->findArray();
|
||||
if (count($subscribers_ids) !== count($subscribers)) {
|
||||
if(count($subscribers_ids) !== count($subscribers)) {
|
||||
$queue->subscribers->to_process = $this->recalculateSubscriberCount(
|
||||
Helpers::arrayColumn($subscribers, 'id'),
|
||||
$subscribers_ids,
|
||||
$queue->subscribers->to_process
|
||||
);
|
||||
}
|
||||
if (!count($queue->subscribers->to_process)) {
|
||||
if(!count($queue->subscribers->to_process)) {
|
||||
$this->updateQueue($queue);
|
||||
continue;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class Newsletter extends Model {
|
||||
}
|
||||
|
||||
function getStatistics() {
|
||||
if ($this->queue === false) {
|
||||
if($this->queue === false) {
|
||||
return false;
|
||||
}
|
||||
return SendingQueue::tableAlias('queues')
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace MailPoet\Models;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Setting extends Model {
|
||||
public static $_table = MP_SETTINGS_TABLE;
|
||||
|
@ -26,7 +26,7 @@ class AutomatedLatestContent {
|
||||
|
||||
$wherePostUnsent = 'ID NOT IN (' . $sentPostsQuery . ')';
|
||||
|
||||
if (!empty($where)) $wherePostUnsent = ' AND ' . $wherePostUnsent;
|
||||
if(!empty($where)) $wherePostUnsent = ' AND ' . $wherePostUnsent;
|
||||
|
||||
return $where . $wherePostUnsent;
|
||||
}
|
||||
@ -48,7 +48,7 @@ class AutomatedLatestContent {
|
||||
if(isset($args['posts']) && is_array($args['posts'])) {
|
||||
$parameters['post__in'] = $args['posts'];
|
||||
}
|
||||
if (!empty($posts_to_exclude)) {
|
||||
if(!empty($posts_to_exclude)) {
|
||||
$parameters['post__not_in'] = $posts_to_exclude;
|
||||
}
|
||||
$parameters['tax_query'] = $this->constructTaxonomiesQuery($args);
|
||||
@ -106,13 +106,13 @@ class AutomatedLatestContent {
|
||||
}
|
||||
|
||||
private function _attachSentPostsFilter() {
|
||||
if ($this->newsletter_id > 0) {
|
||||
if($this->newsletter_id > 0) {
|
||||
add_action('posts_where', array($this, 'filterOutSentPosts'));
|
||||
}
|
||||
}
|
||||
|
||||
private function _detachSentPostsFilter() {
|
||||
if ($this->newsletter_id > 0) {
|
||||
if($this->newsletter_id > 0) {
|
||||
remove_action('posts_where', array($this, 'filterOutSentPosts'));
|
||||
}
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ class MetaInformationManager {
|
||||
$position_field = $position . 'Text';
|
||||
$text = array();
|
||||
|
||||
if ($args['showAuthor'] === $position_field) {
|
||||
if($args['showAuthor'] === $position_field) {
|
||||
$text[] = self::getPostAuthor(
|
||||
$post->post_author,
|
||||
$args['authorPrecededBy']
|
||||
);
|
||||
}
|
||||
|
||||
if ($args['showCategories'] === $position_field) {
|
||||
if($args['showCategories'] === $position_field) {
|
||||
$text[] = self::getPostCategories(
|
||||
$post->ID,
|
||||
$post->post_type,
|
||||
@ -26,10 +26,10 @@ class MetaInformationManager {
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($text)) {
|
||||
if(!empty($text)) {
|
||||
$text = '<p>' . implode('<br />', $text) . '</p>';
|
||||
if ($position === 'above') $content = $text . $content;
|
||||
else if ($position === 'below') $content .= $text;
|
||||
if($position === 'above') $content = $text . $content;
|
||||
else if($position === 'below') $content .= $text;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,9 +8,9 @@ class PostContentManager {
|
||||
const MAX_EXCERPT_LENGTH = 60;
|
||||
|
||||
function getContent($post, $displayType) {
|
||||
if ($displayType === 'titleOnly') {
|
||||
if($displayType === 'titleOnly') {
|
||||
return '';
|
||||
} elseif ($displayType === 'excerpt') {
|
||||
} elseif($displayType === 'excerpt') {
|
||||
// get excerpt
|
||||
if(!empty($post->post_excerpt)) {
|
||||
return $post->post_excerpt;
|
||||
@ -50,7 +50,7 @@ class PostContentManager {
|
||||
private function generateExcerpt($content) {
|
||||
// if excerpt is empty then try to find the "more" tag
|
||||
$excerpts = explode('<!--more-->', $content);
|
||||
if (count($excerpts) > 1) {
|
||||
if(count($excerpts) > 1) {
|
||||
// <!--more--> separator was present
|
||||
return $excerpts[0];
|
||||
} else {
|
||||
|
@ -17,7 +17,7 @@ class PostListTransformer {
|
||||
$use_divider = $this->args['showDivider'] === 'true';
|
||||
|
||||
foreach ($posts as $index => $post) {
|
||||
if ($use_divider && $index > 0) {
|
||||
if($use_divider && $index > 0) {
|
||||
$results[] = $this->args['divider'];
|
||||
}
|
||||
|
||||
|
@ -155,13 +155,13 @@ class PostTransformer {
|
||||
private function getPostTitle($post) {
|
||||
$title = $post->post_title;
|
||||
|
||||
if ($this->args['titleIsLink'] === 'true') {
|
||||
if($this->args['titleIsLink'] === 'true') {
|
||||
$title = '<a href="' . get_permalink($post->ID) . '">' . $title . '</a>';
|
||||
}
|
||||
|
||||
if (in_array($this->args['titleFormat'], array('h1', 'h2', 'h3'))) {
|
||||
if(in_array($this->args['titleFormat'], array('h1', 'h2', 'h3'))) {
|
||||
$tag = $this->args['titleFormat'];
|
||||
} elseif ($this->args['titleFormat'] === 'ul') {
|
||||
} elseif($this->args['titleFormat'] === 'ul') {
|
||||
$tag = 'li';
|
||||
} else {
|
||||
$tag = 'h1';
|
||||
|
@ -25,7 +25,7 @@ class StructureTransformer {
|
||||
$top_ancestor = $this->findTopAncestor($item);
|
||||
$offset = $top_ancestor->index();
|
||||
|
||||
if ($item->hasParent('a')) {
|
||||
if($item->hasParent('a')) {
|
||||
$item = $item->parent;
|
||||
}
|
||||
|
||||
@ -46,8 +46,8 @@ class StructureTransformer {
|
||||
*/
|
||||
private function transformTagsToBlocks($root, $image_full_width) {
|
||||
return array_map(function($item) use ($image_full_width) {
|
||||
if ($item->tag === 'img' || $item->tag === 'a' && $item->query('img')) {
|
||||
if ($item->tag === 'a') {
|
||||
if($item->tag === 'img' || $item->tag === 'a' && $item->query('img')) {
|
||||
if($item->tag === 'a') {
|
||||
$link = $item->getAttribute('href');
|
||||
$image = $item->children[0];
|
||||
} else {
|
||||
@ -87,11 +87,11 @@ class StructureTransformer {
|
||||
$updated_structure = array();
|
||||
$text_accumulator = '';
|
||||
foreach ($structure as $item) {
|
||||
if ($item['type'] === 'text') {
|
||||
if($item['type'] === 'text') {
|
||||
$text_accumulator .= $item['text'];
|
||||
}
|
||||
if ($item['type'] !== 'text') {
|
||||
if (!empty($text_accumulator)) {
|
||||
if($item['type'] !== 'text') {
|
||||
if(!empty($text_accumulator)) {
|
||||
$updated_structure[] = array(
|
||||
'type' => 'text',
|
||||
'text' => trim($text_accumulator),
|
||||
@ -102,7 +102,7 @@ class StructureTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($text_accumulator)) {
|
||||
if(!empty($text_accumulator)) {
|
||||
$updated_structure[] = array(
|
||||
'type' => 'text',
|
||||
'text' => trim($text_accumulator),
|
||||
|
@ -25,7 +25,7 @@ class TitleListTransformer {
|
||||
$alignment = $this->args['titleAlignment'];
|
||||
$alignment = (in_array($alignment, array('left', 'right', 'center'))) ? $alignment : 'left';
|
||||
|
||||
if ($this->args['titleIsLink']) {
|
||||
if($this->args['titleIsLink']) {
|
||||
$title = '<a href="' . get_permalink($post->ID) . '">' . $title . '</a>';
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ class Transformer {
|
||||
function __construct($args) {
|
||||
$title_list_only = $args['displayType'] === 'titleOnly' && $args['titleFormat'] === 'ul';
|
||||
|
||||
if ($title_list_only) $transformer = new TitleListTransformer($args);
|
||||
if($title_list_only) $transformer = new TitleListTransformer($args);
|
||||
else $transformer = new PostListTransformer($args);
|
||||
$this->transformer = $transformer;
|
||||
}
|
||||
|
@ -29,13 +29,13 @@ class Renderer {
|
||||
}
|
||||
|
||||
function createElementFromBlockType($block, $column_count) {
|
||||
if ($block['type'] === 'automatedLatestContent') {
|
||||
if($block['type'] === 'automatedLatestContent') {
|
||||
$content = $this->processAutomatedLatestContent($block, $column_count);
|
||||
return $content;
|
||||
}
|
||||
$block = StylesHelper::applyTextAlignment($block);
|
||||
$block_class = __NAMESPACE__ . '\\' . ucfirst($block['type']);
|
||||
if (!class_exists($block_class)) {
|
||||
if(!class_exists($block_class)) {
|
||||
return '';
|
||||
}
|
||||
return $block_class::render($block, $column_count);
|
||||
|
@ -81,7 +81,7 @@ class Text {
|
||||
false;
|
||||
// if previous or next paragraphs are empty OR previous paragraph
|
||||
// is a heading, insert a break line
|
||||
if (!$next_element ||
|
||||
if(!$next_element ||
|
||||
!$previous_element ||
|
||||
(preg_match('/h\d+/', $previous_element_tag))
|
||||
) {
|
||||
|
@ -89,14 +89,14 @@ class StylesHelper {
|
||||
}
|
||||
|
||||
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'];
|
||||
$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;
|
||||
if(!preg_match('/mailpoet_paragraph|h[1-4]/i', $selector)) return $style;
|
||||
$font_size = (int)$style['fontSize'];
|
||||
$style['lineHeight'] = sprintf('%spx', self::$line_height_multiplier * $font_size);
|
||||
return $style;
|
||||
|
@ -53,7 +53,7 @@ class Newsletter {
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
if ($newsletter['type'] !== 'notification') return false;
|
||||
if($newsletter['type'] !== 'notification') return false;
|
||||
$sent_newsletters =
|
||||
SendingQueue::where('newsletter_id', $newsletter['id'])
|
||||
->where('status', 'completed')
|
||||
|
@ -142,7 +142,7 @@ class Newsletters {
|
||||
}
|
||||
$newsletter_id = (isset($data['id'])) ? (int)$data['id'] : 0;
|
||||
$newsletter = Newsletter::findOne($newsletter_id);
|
||||
if (!$newsletter) {
|
||||
if(!$newsletter) {
|
||||
return array(
|
||||
'result' => false,
|
||||
'errors' => array(__('Newsletter could not be read.'))
|
||||
|
@ -43,7 +43,7 @@ class SendingQueue {
|
||||
$options['segments'] = serialize($data['segments']);
|
||||
unset($data['options']);
|
||||
}
|
||||
if ($options &&
|
||||
if($options &&
|
||||
($newsletter['type'] === 'notification' || $newsletter['type'] === 'welcome')
|
||||
) {
|
||||
$option_fields = NewsletterOptionField::where(
|
||||
@ -54,7 +54,7 @@ class SendingQueue {
|
||||
$relation = NewsletterOption::where('option_field_id', $option_field['id'])
|
||||
->where('newsletter_id', $newsletter['id'])
|
||||
->findOne();
|
||||
if (!$relation) {
|
||||
if(!$relation) {
|
||||
$relation = NewsletterOption::create();
|
||||
$relation->newsletter_id = $newsletter['id'];
|
||||
$relation->option_field_id = $option_field['id'];
|
||||
@ -63,7 +63,7 @@ class SendingQueue {
|
||||
$relation->save();
|
||||
}
|
||||
}
|
||||
if ($newsletter['type'] === 'notification') {
|
||||
if($newsletter['type'] === 'notification') {
|
||||
// convert scheduling options into cron format and add to queue
|
||||
$newsletter = Scheduler::processPostNotificationSchedule($newsletter['id']);
|
||||
Scheduler::createPostNotificationQueue($newsletter);
|
||||
|
@ -17,8 +17,8 @@ class BootStrapMenu {
|
||||
Segment::getSegmentsWithSubscriberCount() :
|
||||
Segment::getSegmentsForExport($with_confirmed_subscribers);
|
||||
return array_map(function($segment) {
|
||||
if (!$segment['name']) $segment['name'] = __('Not In Segment');
|
||||
if (!$segment['id']) $segment['id'] = 0;
|
||||
if(!$segment['name']) $segment['name'] = __('Not In Segment');
|
||||
if(!$segment['id']) $segment['id'] = 0;
|
||||
return array(
|
||||
'id' => $segment['id'],
|
||||
'name' => $segment['name'],
|
||||
|
@ -119,7 +119,7 @@ class MailChimp {
|
||||
}
|
||||
|
||||
function getDataCenter($APIKey) {
|
||||
if (!preg_match('/-[a-zA-Z0-9]{3,}/', $APIKey)) return false;
|
||||
if(!preg_match('/-[a-zA-Z0-9]{3,}/', $APIKey)) return false;
|
||||
// double parantheses: http://phpsadness.com/sad/51
|
||||
$key_parts = explode('-', $APIKey);
|
||||
return end($key_parts);
|
||||
|
Reference in New Issue
Block a user