Fix spacing between control structure and opening parenthesis

This commit is contained in:
Tautvidas Sipavičius
2016-06-29 18:54:01 +03:00
parent 0bfbe6dc79
commit 48f0c03425
16 changed files with 35 additions and 35 deletions

View File

@@ -25,7 +25,7 @@ class Permissions {
'mailpoet_statistics' 'mailpoet_statistics'
); );
foreach($roles as $role_key){ foreach($roles as $role_key) {
// get role based on role key // get role based on role key
$role = get_role($role_key); $role = get_role($role_key);

View File

@@ -32,17 +32,16 @@ class Supervisor {
// 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) {
return $this->formatDaemonStatusMessage($daemon['status']); return $this->formatDaemonStatusMessage($daemon['status']);
} } elseif($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT &&
// if it's been less than 40 seconds since last execution, we are
// force-running the daemon and it's either being started or stopped,
// return its status and do nothing
elseif($elapsed_time < CronHelper::DAEMON_EXECUTION_TIMEOUT &&
$this->force_run && $this->force_run &&
in_array($daemon['status'], array( in_array($daemon['status'], array(
Daemon::STATUS_STOPPING, Daemon::STATUS_STOPPING,
Daemon::STATUS_STARTING Daemon::STATUS_STARTING
)) ))
) { ) {
// if it's been less than 40 seconds since last execution, we are
// force-running the daemon and it's either being started or stopped,
// return its status and do nothing
return $this->formatDaemonStatusMessage($daemon['status']); return $this->formatDaemonStatusMessage($daemon['status']);
} }
// re-create (restart) daemon // re-create (restart) daemon

View File

@@ -84,7 +84,7 @@ class Scheduler {
return; return;
} }
// schedule new queue if the post notification is not destined for immediate delivery // schedule new queue if the post notification is not destined for immediate delivery
if ($newsletter->intervalType !== NewsletterScheduler::INTERVAL_IMMEDIATELY) { if($newsletter->intervalType !== NewsletterScheduler::INTERVAL_IMMEDIATELY) {
$new_queue = SendingQueue::create(); $new_queue = SendingQueue::create();
$new_queue->newsletter_id = $newsletter->id; $new_queue->newsletter_id = $newsletter->id;
$new_queue->status = NewsletterScheduler::STATUS_SCHEDULED; $new_queue->status = NewsletterScheduler::STATUS_SCHEDULED;

View File

@@ -41,7 +41,7 @@ class Renderer {
static function renderBlocks($blocks = array()) { static function renderBlocks($blocks = array()) {
$html = ''; $html = '';
foreach ($blocks as $key => $block) { foreach($blocks as $key => $block) {
$html .= static::renderBlock($block)."\n"; $html .= static::renderBlock($block)."\n";
} }

View File

@@ -67,7 +67,7 @@ class Widget extends \WP_Widget {
<p> <p>
<select class="widefat" id="<?php echo $this->get_field_id('form') ?>" name="<?php echo $this->get_field_name('form'); ?>"> <select class="widefat" id="<?php echo $this->get_field_id('form') ?>" name="<?php echo $this->get_field_name('form'); ?>">
<?php <?php
foreach ($forms as $form) { foreach($forms as $form) {
$is_selected = ($selected_form === (int)$form['id']) ? 'selected="selected"' : ''; $is_selected = ($selected_form === (int)$form['id']) ? 'selected="selected"' : '';
?> ?>
<option value="<?php echo (int)$form['id']; ?>" <?php echo $is_selected; ?>><?php echo esc_html($form['name']); ?></option> <option value="<?php echo (int)$form['id']; ?>" <?php echo $is_selected; ?>><?php echo esc_html($form['name']); ?></option>

View File

@@ -278,7 +278,7 @@ class Newsletter extends Model {
static function filterWithOptions($orm) { static function filterWithOptions($orm) {
$orm = $orm->select(MP_NEWSLETTERS_TABLE.'.*'); $orm = $orm->select(MP_NEWSLETTERS_TABLE.'.*');
$optionFields = NewsletterOptionField::findArray(); $optionFields = NewsletterOptionField::findArray();
foreach ($optionFields as $optionField) { foreach($optionFields as $optionField) {
$orm = $orm->select_expr( $orm = $orm->select_expr(
'IFNULL(GROUP_CONCAT(CASE WHEN ' . 'IFNULL(GROUP_CONCAT(CASE WHEN ' .
MP_NEWSLETTER_OPTION_FIELDS_TABLE . '.id=' . $optionField['id'] . ' THEN ' . MP_NEWSLETTER_OPTION_FIELDS_TABLE . '.id=' . $optionField['id'] . ' THEN ' .

View File

@@ -313,7 +313,7 @@ class Subscriber extends Model {
static function filterWithCustomFields($orm) { static function filterWithCustomFields($orm) {
$orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*'); $orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*');
$customFields = CustomField::findArray(); $customFields = CustomField::findArray();
foreach ($customFields as $customField) { foreach($customFields as $customField) {
$orm = $orm->select_expr( $orm = $orm->select_expr(
'IFNULL(GROUP_CONCAT(CASE WHEN ' . 'IFNULL(GROUP_CONCAT(CASE WHEN ' .
MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' . MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' .
@@ -335,7 +335,7 @@ class Subscriber extends Model {
static function filterWithCustomFieldsForExport($orm) { static function filterWithCustomFieldsForExport($orm) {
$orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*'); $orm = $orm->select(MP_SUBSCRIBERS_TABLE.'.*');
$customFields = CustomField::findArray(); $customFields = CustomField::findArray();
foreach ($customFields as $customField) { foreach($customFields as $customField) {
$orm = $orm->selectExpr( $orm = $orm->selectExpr(
'MAX(CASE WHEN ' . 'MAX(CASE WHEN ' .
MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' . MP_CUSTOM_FIELDS_TABLE . '.id=' . $customField['id'] . ' THEN ' .

View File

@@ -7,7 +7,7 @@ class MetaInformationManager {
function appendMetaInformation($content, $post, $args) { function appendMetaInformation($content, $post, $args) {
// Append author and categories above and below contents // Append author and categories above and below contents
foreach (array('above', 'below') as $position) { foreach(array('above', 'below') as $position) {
$position_field = $position . 'Text'; $position_field = $position . 'Text';
$text = array(); $text = array();

View File

@@ -16,7 +16,7 @@ class PostListTransformer {
$results = array(); $results = array();
$use_divider = $this->args['showDivider'] === 'true'; $use_divider = $this->args['showDivider'] === 'true';
foreach ($posts as $index => $post) { foreach($posts as $index => $post) {
if($use_divider && $index > 0) { if($use_divider && $index > 0) {
$results[] = $this->args['divider']; $results[] = $this->args['divider'];
} }

View File

@@ -21,7 +21,7 @@ class StructureTransformer {
* and inserts tags before top ancestor * and inserts tags before top ancestor
*/ */
private function hoistImagesToRoot($root) { private function hoistImagesToRoot($root) {
foreach ($root->query('img') as $item) { foreach($root->query('img') as $item) {
$top_ancestor = $this->findTopAncestor($item); $top_ancestor = $this->findTopAncestor($item);
$offset = $top_ancestor->index(); $offset = $top_ancestor->index();
@@ -34,7 +34,7 @@ class StructureTransformer {
} }
private static function findTopAncestor($item) { private static function findTopAncestor($item) {
while ($item->parent->parent !== null) { while($item->parent->parent !== null) {
$item = $item->parent; $item = $item->parent;
} }
return $item; return $item;
@@ -86,7 +86,7 @@ class StructureTransformer {
private function mergeNeighboringBlocks($structure) { private function mergeNeighboringBlocks($structure) {
$updated_structure = array(); $updated_structure = array();
$text_accumulator = ''; $text_accumulator = '';
foreach ($structure as $item) { foreach($structure as $item) {
if($item['type'] === 'text') { if($item['type'] === 'text') {
$text_accumulator .= $item['text']; $text_accumulator .= $item['text'];
} }

View File

@@ -23,8 +23,7 @@ class Renderer {
// vertical orientation denotes column container // vertical orientation denotes column container
if($block['type'] === 'container' && $block['orientation'] === 'vertical') { if($block['type'] === 'container' && $block['orientation'] === 'vertical') {
$column_content[] = $rendered_block_element; $column_content[] = $rendered_block_element;
} } else {
else {
$block_content .= $rendered_block_element; $block_content .= $rendered_block_element;
} }
}, $data['blocks']); }, $data['blocks']);

View File

@@ -149,7 +149,7 @@ class Forms {
// or if it's selected by the admin // or if it's selected by the admin
$has_segment_selection = false; $has_segment_selection = false;
foreach ($body as $i => $block) { foreach($body as $i => $block) {
if($block['type'] === 'segment') { if($block['type'] === 'segment') {
$has_segment_selection = true; $has_segment_selection = true;
if(!empty($block['params']['values'])) { if(!empty($block['params']['values'])) {

View File

@@ -86,7 +86,9 @@ class Router {
} }
function checkPermissions() { function checkPermissions() {
if(!current_user_can('manage_options')) { die(); } if(!current_user_can('manage_options')) {
die();
}
} }
function verifyToken() { function verifyToken() {

View File

@@ -23,7 +23,7 @@ class MailChimp {
return $this->processError('connection'); return $this->processError('connection');
} else { } else {
$response = ''; $response = '';
while (!feof($connection)) { while(!feof($connection)) {
$buffer = fgets($connection, 4096); $buffer = fgets($connection, 4096);
if(trim($buffer) !== '') { if(trim($buffer) !== '') {
$response .= $buffer; $response .= $buffer;
@@ -38,7 +38,7 @@ class MailChimp {
return $this->processError('API'); return $this->processError('API');
} }
foreach ($response->data as $list) { foreach($response->data as $list) {
$lists[] = array( $lists[] = array(
'id' => $list->id, 'id' => $list->id,
'name' => $list->name 'name' => $list->name
@@ -61,7 +61,7 @@ class MailChimp {
} }
$bytes_fetched = 0; $bytes_fetched = 0;
foreach ($lists as $list) { foreach($lists as $list) {
$url = sprintf($this->export_url, $this->data_center, $this->api_key, $list); $url = sprintf($this->export_url, $this->data_center, $this->api_key, $list);
$connection = @fopen($url, 'r'); $connection = @fopen($url, 'r');
if(!$connection) { if(!$connection) {
@@ -69,7 +69,7 @@ class MailChimp {
} else { } else {
$i = 0; $i = 0;
$header = array(); $header = array();
while (!feof($connection)) { while(!feof($connection)) {
$buffer = fgets($connection, 4096); $buffer = fgets($connection, 4096);
if(trim($buffer) !== '') { if(trim($buffer) !== '') {
$obj = json_decode($buffer); $obj = json_decode($buffer);

View File

@@ -238,7 +238,7 @@ class Pages {
} }
$subscribed_segment_ids = array(); $subscribed_segment_ids = array();
if(!empty($this->subscriber->subscriptions)) { if(!empty($this->subscriber->subscriptions)) {
foreach ($this->subscriber->subscriptions as $subscription) { foreach($this->subscriber->subscriptions as $subscription) {
if($subscription['status'] === Subscriber::STATUS_SUBSCRIBED) { if($subscription['status'] === Subscriber::STATUS_SUBSCRIBED) {
$subscribed_segment_ids[] = $subscription['segment_id']; $subscribed_segment_ids[] = $subscription['segment_id'];
} }

View File

@@ -52,7 +52,7 @@ class DateTime {
$formatted_time = $start_time; $formatted_time = $start_time;
$timestamp = strtotime($formatted_time); $timestamp = strtotime($formatted_time);
for ($step = 0; $step < $total_steps; $step += 1) { for($step = 0; $step < $total_steps; $step += 1) {
$formatted_time = $this->formatTime($timestamp, self::DEFAULT_TIME_FORMAT); $formatted_time = $this->formatTime($timestamp, self::DEFAULT_TIME_FORMAT);
$label_time = $this->formatTime($timestamp); $label_time = $this->formatTime($timestamp);
$steps[$formatted_time] = $label_time; $steps[$formatted_time] = $label_time;