GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c0fc47...4f8ffd )
by Chris
17s
created
includes/cron-functions.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -14,19 +14,19 @@  discard block
 block discarded – undo
14 14
 function ppp_schedule_share( $post_id, $post ) {
15 15
 	$allowed_post_types = ppp_allowed_post_types();
16 16
 
17
-	if ( ! isset( $_POST['post_status'] ) || ! in_array( $post->post_type, $allowed_post_types ) ) {
17
+	if ( ! isset($_POST['post_status']) || ! in_array( $post->post_type, $allowed_post_types )) {
18 18
 		return;
19 19
 	}
20 20
 
21 21
 	ppp_remove_scheduled_shares( $post_id );
22 22
 
23
-	if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published
24
-		( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post
25
-		( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post
23
+	if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published
24
+		($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post
25
+		($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post
26 26
 
27 27
 		$timestamps = ppp_get_timestamps( $post_id );
28 28
 
29
-		foreach ( $timestamps as $timestamp => $name ) {
29
+		foreach ($timestamps as $timestamp => $name) {
30 30
 			$timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 );
31 31
 			wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) );
32 32
 		}
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 	$current_item_shares = ppp_get_shceduled_crons( $post_id );
47 47
 
48
-	foreach ( $current_item_shares as $share ) {
48
+	foreach ($current_item_shares as $share) {
49 49
 		wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) );
50 50
 	}
51 51
 
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
 	$all_crons = get_option( 'cron' );
71 71
 	$ppp_crons = array();
72 72
 
73
-	foreach ( $all_crons as $timestamp => $cron ) {
74
-		if ( ! isset( $cron['ppp_share_post_event'] ) ) {
73
+	foreach ($all_crons as $timestamp => $cron) {
74
+		if ( ! isset($cron['ppp_share_post_event'])) {
75 75
 			continue;
76 76
 		}
77 77
 
78
-		foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) {
78
+		foreach ($cron['ppp_share_post_event'] as $key => $single_event) {
79 79
 			$name_parts = explode( '_', $single_event['args'][1] );
80
-			if ( false !== $post_id && $post_id != $name_parts[2] ) {
80
+			if (false !== $post_id && $post_id != $name_parts[2]) {
81 81
 				continue;
82 82
 			}
83 83
 
84 84
 			$single_event['timestamp'] = $timestamp;
85
-			$ppp_crons[ $key ]         = $single_event;
85
+			$ppp_crons[$key]         = $single_event;
86 86
 		}
87 87
 
88 88
 	}
@@ -111,26 +111,26 @@  discard block
 block discarded – undo
111 111
  *
112 112
  */
113 113
 function ppp_has_cron_within( $time = 0, $within = 0 ) {
114
-	if ( empty( $time ) ) {
114
+	if (empty($time)) {
115 115
 		$time = current_time( 'timestamp' );
116 116
 	}
117 117
 
118
-	if ( empty( $within ) ) {
118
+	if (empty($within)) {
119 119
 		$within = ppp_get_default_conflict_window();
120 120
 	}
121 121
 
122 122
 	$crons = ppp_get_shceduled_crons();
123 123
 
124
-	if ( empty( $crons ) ) {
124
+	if (empty($crons)) {
125 125
 		return false;
126 126
 	}
127 127
 
128 128
 	$scheduled_times = wp_list_pluck( $crons, 'timestamp' );
129 129
 
130 130
 	$found_time = false;
131
-	foreach ( $scheduled_times as $key => $scheduled_time ) {
131
+	foreach ($scheduled_times as $key => $scheduled_time) {
132 132
 		$found_time = ppp_is_time_within( $scheduled_time, $time, $within );
133
-		if ( $found_time ) {
133
+		if ($found_time) {
134 134
 			break;
135 135
 		}
136 136
 	}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	$min = $target_time - $within;
153 153
 	$max = $target_time + $within;
154 154
 
155
-	return ( ( $time >= $min ) && ( $time <= $max ) );
155
+	return (($time >= $min) && ($time <= $max));
156 156
 }
157 157
 
158 158
 /**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function ppp_unschedule_shares( $new_status, $old_status, $post ) {
222 222
 
223
-	if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) {
223
+	if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) {
224 224
 		ppp_remove_scheduled_shares( $post->ID );
225 225
 	}
226 226
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 	// Just in case we need this, let's set it once
240 240
 	$current_time = current_time( 'timestamp' );
241 241
 
242
-	if ( empty( $date ) ) {
242
+	if (empty($date)) {
243 243
 		$date = date( 'm/d/Y', $current_time );
244 244
 	}
245 245
 
246
-	if ( empty( $time ) ) {
246
+	if (empty($time)) {
247 247
 		$time = date( 'h:ia', $current_time );
248 248
 	}
249 249
 
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
 	$minutes    = (int) substr( $share_time[1], 0, 2 );
253 253
 	$ampm       = strtolower( substr( $share_time[1], -2 ) );
254 254
 
255
-	if ( $ampm == 'pm' && $hours != 12 ) {
255
+	if ($ampm == 'pm' && $hours != 12) {
256 256
 		$hours = $hours + 12;
257 257
 	}
258 258
 
259
-	if ( $ampm == 'am' && $hours == 12 ) {
259
+	if ($ampm == 'am' && $hours == 12) {
260 260
 		$hours = 00;
261 261
 	}
262 262
 
263
-	$offset    = (int) -( get_option( 'gmt_offset' ) );
263
+	$offset    = (int) -(get_option( 'gmt_offset' ));
264 264
 	$hours     = $hours + $offset;
265 265
 	$date      = explode( '/', $date );
266 266
 	$timestamp = mktime( (int) $hours, (int) $minutes, 0, (int) $date[0], (int) $date[1], (int) $date[2] );
Please login to merge, or discard this patch.