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
Pull Request — master (#25)
by
unknown
01:57
created
hm-post-repeat.php 2 patches
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -35,28 +35,28 @@  discard block
 block discarded – undo
35 35
 /**
36 36
  * Setup the actions and filters required by this class.
37 37
  */
38
-add_action( 'post_submitbox_misc_actions', __NAMESPACE__ . '\publish_box_ui' );
39
-add_action( 'save_post', __NAMESPACE__ . '\save_post_repeating_status', 10 );
40
-add_action( 'save_post', __NAMESPACE__ . '\create_next_repeat_post', 11 );
41
-add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts' );
42
-add_filter( 'display_post_states', __NAMESPACE__ . '\post_states', 10, 2 );
43
-add_filter( 'hm_post_repeat_scheduled_post', __NAMESPACE__ . '\insert_date', 10, 2 );
38
+add_action('post_submitbox_misc_actions', __NAMESPACE__.'\publish_box_ui');
39
+add_action('save_post', __NAMESPACE__.'\save_post_repeating_status', 10);
40
+add_action('save_post', __NAMESPACE__.'\create_next_repeat_post', 11);
41
+add_action('admin_enqueue_scripts', __NAMESPACE__.'\enqueue_scripts');
42
+add_filter('display_post_states', __NAMESPACE__.'\post_states', 10, 2);
43
+add_filter('hm_post_repeat_scheduled_post', __NAMESPACE__.'\insert_date', 10, 2);
44 44
 
45 45
 /**
46 46
  * Enqueue the scripts and styles that are needed by this plugin.
47 47
  */
48
-function enqueue_scripts( $hook ) {
48
+function enqueue_scripts($hook) {
49 49
 
50 50
 	// Ensure we only load them on the edit post and add new post admin screens
51
-	if ( ! in_array( $hook, array( 'post.php', 'post-new.php' ) ) ) {
51
+	if ( ! in_array($hook, array('post.php', 'post-new.php'))) {
52 52
 		return;
53 53
 	}
54 54
 
55
-	$plugin_data = get_plugin_data( __FILE__ );
56
-	$plugin_dir_url = plugin_dir_url( __FILE__ );
55
+	$plugin_data = get_plugin_data(__FILE__);
56
+	$plugin_dir_url = plugin_dir_url(__FILE__);
57 57
 
58
-	wp_enqueue_script( 'hm-post-repeat', $plugin_dir_url . 'hm-post-repeat.js', 'jquery', $plugin_data['Version'], true );
59
-	wp_enqueue_style( 'hm-post-repeat', $plugin_dir_url . 'hm-post-repeat.css', array(), $plugin_data['Version'] );
58
+	wp_enqueue_script('hm-post-repeat', $plugin_dir_url.'hm-post-repeat.js', 'jquery', $plugin_data['Version'], true);
59
+	wp_enqueue_style('hm-post-repeat', $plugin_dir_url.'hm-post-repeat.css', array(), $plugin_data['Version']);
60 60
 
61 61
 }
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  */
69 69
 function publish_box_ui() {
70 70
 
71
-	if ( ! in_array( get_post_type(), repeating_post_types() ) ) {
71
+	if ( ! in_array(get_post_type(), repeating_post_types())) {
72 72
 		return;
73 73
 	} ?>
74 74
 
@@ -76,31 +76,31 @@  discard block
 block discarded – undo
76 76
 
77 77
 		<span class="dashicons dashicons-controls-repeat"></span>
78 78
 
79
-		<?php esc_html_e( 'Repeat:', 'hm-post-repeat' ); ?>
79
+		<?php esc_html_e('Repeat:', 'hm-post-repeat'); ?>
80 80
 
81
-		<?php if ( is_repeat_post( get_the_id() ) ) : ?>
81
+		<?php if (is_repeat_post(get_the_id())) : ?>
82 82
 
83
-			<strong><?php printf( esc_html__( 'Repeat of %s', 'hm-post-repeat' ), '<a href="' . esc_url( get_edit_post_link( get_post()->post_parent ) ) . '">' . esc_html( get_the_title( get_post_field( 'post_parent', get_the_id() ) ) ) . '</a>' ); ?></strong>
83
+			<strong><?php printf(esc_html__('Repeat of %s', 'hm-post-repeat'), '<a href="'.esc_url(get_edit_post_link(get_post()->post_parent)).'">'.esc_html(get_the_title(get_post_field('post_parent', get_the_id()))).'</a>'); ?></strong>
84 84
 
85 85
 		<?php else : ?>
86 86
 
87
-			<?php $repeating_schedule = get_repeating_schedule( get_the_id() ); ?>
88
-			<?php $is_repeating_post = is_repeating_post( get_the_id() ) && isset( $repeating_schedule ); ?>
87
+			<?php $repeating_schedule = get_repeating_schedule(get_the_id()); ?>
88
+			<?php $is_repeating_post = is_repeating_post(get_the_id()) && isset($repeating_schedule); ?>
89 89
 
90
-			<strong><?php echo ! $is_repeating_post ? esc_html__( 'No', 'hm-post-repeat' ) : esc_html( $repeating_schedule['display'] ); ?></strong>
90
+			<strong><?php echo ! $is_repeating_post ? esc_html__('No', 'hm-post-repeat') : esc_html($repeating_schedule['display']); ?></strong>
91 91
 
92
-			<a href="#hm-post-repeat" class="edit-hm-post-repeat hide-if-no-js"><span aria-hidden="true"><?php esc_html_e( 'Edit', 'hm-post-repeat' ); ?></span> <span class="screen-reader-text"><?php esc_html_e( 'Edit Repeat Settings', 'hm-post-repeat' ); ?></span></a>
92
+			<a href="#hm-post-repeat" class="edit-hm-post-repeat hide-if-no-js"><span aria-hidden="true"><?php esc_html_e('Edit', 'hm-post-repeat'); ?></span> <span class="screen-reader-text"><?php esc_html_e('Edit Repeat Settings', 'hm-post-repeat'); ?></span></a>
93 93
 
94 94
 			<span class="hide-if-js" id="hm-post-repeat">
95 95
 
96 96
 				<select name="hm-post-repeat">
97
-					<option<?php selected( ! $is_repeating_post ); ?> value="no"><?php esc_html_e( 'No', 'hm-post-repeat' ); ?></option>
98
-					<?php foreach ( get_repeating_schedules() as $schedule_slug => $schedule ) : ?>
99
-						<option<?php selected( $is_repeating_post && $schedule_slug === $repeating_schedule['slug'] ); ?> value="<?php echo esc_attr( $schedule_slug ); ?>"><?php echo esc_html( $schedule['display'] ); ?></option>
97
+					<option<?php selected( ! $is_repeating_post); ?> value="no"><?php esc_html_e('No', 'hm-post-repeat'); ?></option>
98
+					<?php foreach (get_repeating_schedules() as $schedule_slug => $schedule) : ?>
99
+						<option<?php selected($is_repeating_post && $schedule_slug === $repeating_schedule['slug']); ?> value="<?php echo esc_attr($schedule_slug); ?>"><?php echo esc_html($schedule['display']); ?></option>
100 100
 					<?php endforeach; ?>
101 101
 				</select>
102 102
 
103
-				<a href="#hm-post-repeat" class="save-post-hm-post-repeat hide-if-no-js button"><?php esc_html_e( 'OK', 'hm-post-repeat' ); ?></a>
103
+				<a href="#hm-post-repeat" class="save-post-hm-post-repeat hide-if-no-js button"><?php esc_html_e('OK', 'hm-post-repeat'); ?></a>
104 104
 
105 105
 			</span>
106 106
 
@@ -119,21 +119,21 @@  discard block
 block discarded – undo
119 119
  * @param WP_Post $post        The post object to get / return the states.
120 120
  * @return array The array of post states with ours added.
121 121
  */
122
-function post_states( $post_states, $post ) {
122
+function post_states($post_states, $post) {
123 123
 
124
-	if ( is_repeating_post( $post->ID ) ) {
124
+	if (is_repeating_post($post->ID)) {
125 125
 
126 126
 		// If the schedule has been removed since publishing, let the user know.
127
-		if ( get_repeating_schedule( $post->ID ) ) {
128
-			$post_states['hm-post-repeat'] = __( 'Repeating', 'hm-post-repeat' );
127
+		if (get_repeating_schedule($post->ID)) {
128
+			$post_states['hm-post-repeat'] = __('Repeating', 'hm-post-repeat');
129 129
 		} else {
130
-			$post_states['hm-post-repeat'] = __( 'Invalid Repeating Schedule', 'hm-post-repeat' );
130
+			$post_states['hm-post-repeat'] = __('Invalid Repeating Schedule', 'hm-post-repeat');
131 131
 		}
132 132
 
133 133
 	}
134 134
 
135
-	if ( is_repeat_post( $post->ID ) ) {
136
-		$post_states['hm-post-repeat'] = __( 'Repeat', 'hm-post-repeat' );
135
+	if (is_repeat_post($post->ID)) {
136
+		$post_states['hm-post-repeat'] = __('Repeat', 'hm-post-repeat');
137 137
 	}
138 138
 
139 139
 	return $post_states;
@@ -148,23 +148,23 @@  discard block
 block discarded – undo
148 148
  * @param int    $post_id             The ID of the post.
149 149
  * @param string $post_repeat_setting Used to manually set the repeating schedule from tests.
150 150
  */
151
-function save_post_repeating_status( $post_id = null, $post_repeat_setting = null ) {
151
+function save_post_repeating_status($post_id = null, $post_repeat_setting = null) {
152 152
 
153
-	if ( is_null( $post_repeat_setting ) ) {
154
-		$post_repeat_setting = isset( $_POST['hm-post-repeat'] ) ? sanitize_text_field( $_POST['hm-post-repeat'] ) : '';
153
+	if (is_null($post_repeat_setting)) {
154
+		$post_repeat_setting = isset($_POST['hm-post-repeat']) ? sanitize_text_field($_POST['hm-post-repeat']) : '';
155 155
 	}
156 156
 
157
-	if ( ! in_array( get_post_type( $post_id ), repeating_post_types() ) || empty( $post_repeat_setting ) ) {
157
+	if ( ! in_array(get_post_type($post_id), repeating_post_types()) || empty($post_repeat_setting)) {
158 158
 		return;
159 159
 	}
160 160
 
161
-	if ( 'no' === $post_repeat_setting ) {
162
-		delete_post_meta( $post_id, 'hm-post-repeat' );
161
+	if ('no' === $post_repeat_setting) {
162
+		delete_post_meta($post_id, 'hm-post-repeat');
163 163
 	}
164 164
 
165 165
 	// Make sure we have a valid schedule.
166
-	elseif ( in_array( $post_repeat_setting, array_keys( get_repeating_schedules() ) ) ) {
167
-		update_post_meta( $post_id, 'hm-post-repeat', $post_repeat_setting );
166
+	elseif (in_array($post_repeat_setting, array_keys(get_repeating_schedules()))) {
167
+		update_post_meta($post_id, 'hm-post-repeat', $post_repeat_setting);
168 168
 	}
169 169
 
170 170
 }
@@ -180,50 +180,50 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @param int $post_id The ID of the post.
182 182
  */
183
-function create_next_repeat_post( $post_id ) {
183
+function create_next_repeat_post($post_id) {
184 184
 
185
-	if ( ! in_array( get_post_type( $post_id ), repeating_post_types() ) ) {
185
+	if ( ! in_array(get_post_type($post_id), repeating_post_types())) {
186 186
 		return false;
187 187
 	}
188 188
 
189
-	if ( 'publish' !== get_post_status( $post_id ) ) {
189
+	if ('publish' !== get_post_status($post_id)) {
190 190
 		return false;
191 191
 	}
192 192
 
193
-	$original_post_id = get_repeating_post( $post_id );
193
+	$original_post_id = get_repeating_post($post_id);
194 194
 
195 195
 	// Bail if we're not publishing a repeat(ing) post
196
-	if ( ! $original_post_id ) {
196
+	if ( ! $original_post_id) {
197 197
 		return false;
198 198
 	}
199 199
 
200
-	$original_post = get_post( $original_post_id, ARRAY_A );
200
+	$original_post = get_post($original_post_id, ARRAY_A);
201 201
 
202 202
 	// If there is already a repeat post scheduled don't create another one
203
-	if ( get_next_scheduled_repeat_post( $original_post['ID'] ) ) {
203
+	if (get_next_scheduled_repeat_post($original_post['ID'])) {
204 204
 		return false;
205 205
 	}
206 206
 
207 207
 	// Bail if the saved schedule doesn't exist
208
-	$repeating_schedule = get_repeating_schedule( $original_post['ID'] );
208
+	$repeating_schedule = get_repeating_schedule($original_post['ID']);
209 209
 
210
-	if ( ! $repeating_schedule ) {
210
+	if ( ! $repeating_schedule) {
211 211
 		return false;
212 212
 	}
213 213
 
214 214
 	// Bail if the original post isn't already published
215
-	if ( 'publish' !== $original_post['post_status'] ) {
215
+	if ('publish' !== $original_post['post_status']) {
216 216
 		return false;
217 217
 	}
218 218
 
219 219
 	$next_post = $original_post;
220 220
 
221 221
 	// Create the repeat post as a copy of the original, but ignore some fields
222
-	unset( $next_post['ID'] );
223
-	unset( $next_post['guid'] );
224
-	unset( $next_post['post_date_gmt'] );
225
-	unset( $next_post['post_modified'] );
226
-	unset( $next_post['post_modified_gmt'] );
222
+	unset($next_post['ID']);
223
+	unset($next_post['guid']);
224
+	unset($next_post['post_date_gmt']);
225
+	unset($next_post['post_modified']);
226
+	unset($next_post['post_modified_gmt']);
227 227
 
228 228
 	// We set the post_parent to the original post_id, so they're related
229 229
 	$next_post['post_parent'] = $original_post['ID'];
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
 	$next_post['post_status'] = 'future';
233 233
 
234 234
 	// Use the date of the current post being saved as the base
235
-	$next_post['post_date'] = date( 'Y-m-d H:i:s', strtotime( get_post_field( 'post_date', $post_id ) . ' + ' . $repeating_schedule['interval'] ) );
235
+	$next_post['post_date'] = date('Y-m-d H:i:s', strtotime(get_post_field('post_date', $post_id).' + '.$repeating_schedule['interval']));
236 236
 
237 237
 	// Make sure the next post will be in the future
238
-	if ( strtotime( $next_post['post_date'] ) <= time() ) {
238
+	if (strtotime($next_post['post_date']) <= time()) {
239 239
 		return false;
240 240
 	}
241 241
 
@@ -246,39 +246,39 @@  discard block
 block discarded – undo
246 246
 	 * @param
247 247
 	 * @param array $original_post The original repeating post
248 248
 	 */
249
-	$next_post = apply_filters( 'hm_post_repeat_scheduled_post', $next_post, $repeating_schedule, $original_post );
249
+	$next_post = apply_filters('hm_post_repeat_scheduled_post', $next_post, $repeating_schedule, $original_post);
250 250
 
251 251
 	// All checks done, get that post scheduled!
252
-	$next_post_id = wp_insert_post( wp_slash( $next_post ), true );
252
+	$next_post_id = wp_insert_post(wp_slash($next_post), true);
253 253
 
254
-	if ( is_wp_error( $next_post_id ) ) {
254
+	if (is_wp_error($next_post_id)) {
255 255
 		return false;
256 256
 	}
257 257
 
258 258
 	// Mirror any post_meta
259
-	$post_meta = get_post_meta( $original_post['ID'] );
259
+	$post_meta = get_post_meta($original_post['ID']);
260 260
 
261
-	if ( $post_meta  ) {
261
+	if ($post_meta) {
262 262
 
263 263
 		// Ignore some internal meta fields
264
-		unset( $post_meta['_edit_lock'] );
265
-		unset( $post_meta['_edit_last'] );
264
+		unset($post_meta['_edit_lock']);
265
+		unset($post_meta['_edit_last']);
266 266
 
267 267
 		// Don't copy the post repeat meta as only the original post should have that
268
-		unset( $post_meta['hm-post-repeat'] );
268
+		unset($post_meta['hm-post-repeat']);
269 269
 
270
-		foreach ( $post_meta as $key => $values ) {
271
-			foreach ( $values as $value ) {
272
-				add_post_meta( $next_post_id, $key, maybe_unserialize( $value ) );
270
+		foreach ($post_meta as $key => $values) {
271
+			foreach ($values as $value) {
272
+				add_post_meta($next_post_id, $key, maybe_unserialize($value));
273 273
 			}
274 274
 		}
275 275
 	}
276 276
 
277 277
 	// Mirror any term relationships
278
-	$taxonomies = get_object_taxonomies( $original_post['post_type'] );
278
+	$taxonomies = get_object_taxonomies($original_post['post_type']);
279 279
 
280
-	foreach ( $taxonomies as $taxonomy ) {
281
-		wp_set_object_terms( $next_post_id, wp_list_pluck( wp_get_object_terms( $original_post['ID'], $taxonomy ), 'slug' ), $taxonomy );
280
+	foreach ($taxonomies as $taxonomy) {
281
+		wp_set_object_terms($next_post_id, wp_list_pluck(wp_get_object_terms($original_post['ID'], $taxonomy), 'slug'), $taxonomy);
282 282
 	}
283 283
 
284 284
 	return $next_post_id;
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param string[] $post_types Post type slugs.
301 301
 	 */
302
-	return apply_filters( 'hm_post_repeat_post_types', array( 'post' ) );
302
+	return apply_filters('hm_post_repeat_post_types', array('post'));
303 303
 
304 304
 }
305 305
 
@@ -315,13 +315,13 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @param array[] $schedules Schedule array items.
317 317
 	 */
318
-	$schedules = apply_filters( 'hm_post_repeat_schedules', array(
319
-		'daily'   => array( 'interval' => '1 day',   'display' => __( 'Daily',   'hm-post-repeat' ) ),
320
-		'weekly'  => array( 'interval' => '1 week',  'display' => __( 'Weekly',  'hm-post-repeat' ) ),
321
-		'monthly' => array( 'interval' => '1 month', 'display' => __( 'Monthly', 'hm-post-repeat' ) ),
322
-	) );
318
+	$schedules = apply_filters('hm_post_repeat_schedules', array(
319
+		'daily'   => array('interval' => '1 day', 'display' => __('Daily', 'hm-post-repeat')),
320
+		'weekly'  => array('interval' => '1 week', 'display' => __('Weekly', 'hm-post-repeat')),
321
+		'monthly' => array('interval' => '1 month', 'display' => __('Monthly', 'hm-post-repeat')),
322
+	));
323 323
 
324
-	foreach ( $schedules as $slug => &$schedule ) {
324
+	foreach ($schedules as $slug => &$schedule) {
325 325
 		$schedule['slug'] = $slug;
326 326
 	}
327 327
 
@@ -335,22 +335,22 @@  discard block
 block discarded – undo
335 335
  * @param int $post_id The id of the post you want to check.
336 336
  * @return array|null The schedule to repeat by, or null if invalid.
337 337
  */
338
-function get_repeating_schedule( $post_id ) {
338
+function get_repeating_schedule($post_id) {
339 339
 
340
-	if ( ! is_repeating_post( $post_id ) ) {
340
+	if ( ! is_repeating_post($post_id)) {
341 341
 		return;
342 342
 	}
343 343
 
344
-	$repeating_schedule = get_post_meta( $post_id, 'hm-post-repeat', true );
344
+	$repeating_schedule = get_post_meta($post_id, 'hm-post-repeat', true);
345 345
 	$schedules = get_repeating_schedules();
346 346
 
347 347
 	// Backwards compatibility with 0.3 when we only supported weekly
348
-	if ( '1' === $repeating_schedule ) {
348
+	if ('1' === $repeating_schedule) {
349 349
 		$repeating_schedule = 'weekly';
350 350
 	}
351 351
 
352
-	if ( array_key_exists( $repeating_schedule, $schedules ) ) {
353
-		return $schedules[ $repeating_schedule ];
352
+	if (array_key_exists($repeating_schedule, $schedules)) {
353
+		return $schedules[$repeating_schedule];
354 354
 	}
355 355
 
356 356
 }
@@ -363,14 +363,14 @@  discard block
 block discarded – undo
363 363
  * @param int $post_id The id of the post you want to check.
364 364
  * @return bool Whether the passed post_id is a repeating post or not.
365 365
  */
366
-function is_repeating_post( $post_id ) {
366
+function is_repeating_post($post_id) {
367 367
 
368 368
 	// We check $_POST data so that this function works inside a `save_post` hook when the post_meta hasn't yet been saved
369
-	if ( isset( $_POST['hm-post-repeat'] ) && isset( $_POST['ID'] ) && $_POST['ID'] === $post_id ) {
369
+	if (isset($_POST['hm-post-repeat']) && isset($_POST['ID']) && $_POST['ID'] === $post_id) {
370 370
 		return true;
371 371
 	}
372 372
 
373
-	if ( get_post_meta( $post_id, 'hm-post-repeat', true ) ) {
373
+	if (get_post_meta($post_id, 'hm-post-repeat', true)) {
374 374
 		return true;
375 375
 	}
376 376
 
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
  * @param int $post_id The id of the post you want to check.
387 387
  * @return bool Whether the passed post_id is a repeat post or not.
388 388
  */
389
-function is_repeat_post( $post_id ) {
389
+function is_repeat_post($post_id) {
390 390
 
391
-	$post_parent = get_post_field( 'post_parent', $post_id );
391
+	$post_parent = get_post_field('post_parent', $post_id);
392 392
 
393
-	if ( $post_parent && get_post_meta( $post_parent, 'hm-post-repeat', true ) ) {
393
+	if ($post_parent && get_post_meta($post_parent, 'hm-post-repeat', true)) {
394 394
 		return true;
395 395
 	}
396 396
 
@@ -404,13 +404,13 @@  discard block
 block discarded – undo
404 404
  * @param int $post_id The id of a repeat or repeating post
405 405
  * @return Int|Bool Return the ID of the next repeat post_id or false if it can't find one
406 406
  */
407
-function get_next_scheduled_repeat_post( $post_id ) {
407
+function get_next_scheduled_repeat_post($post_id) {
408 408
 
409
-	$post = get_post( get_repeating_post( $post_id ) );
409
+	$post = get_post(get_repeating_post($post_id));
410 410
 
411
-	$repeat_posts = get_posts( array( 'post_status' => 'future', 'post_parent' => $post->ID ) );
411
+	$repeat_posts = get_posts(array('post_status' => 'future', 'post_parent' => $post->ID));
412 412
 
413
-	if ( isset( $repeat_posts[0] ) ) {
413
+	if (isset($repeat_posts[0])) {
414 414
 	 	return $repeat_posts[0];
415 415
 	}
416 416
 
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
  * @param int $post_id The id of a repeat or repeating post
425 425
  * @return Int|Bool Return the original repeating post_id or false if it can't find it
426 426
  */
427
-function get_repeating_post( $post_id ) {
427
+function get_repeating_post($post_id) {
428 428
 
429 429
 	$original_post_id = false;
430 430
 
431 431
 	// Are we publishing a repeat post
432
-	if ( is_repeat_post( $post_id ) ) {
433
-		$original_post_id = get_post( $post_id )->post_parent;
432
+	if (is_repeat_post($post_id)) {
433
+		$original_post_id = get_post($post_id)->post_parent;
434 434
 	}
435 435
 
436 436
 	// Or the original
437
-	elseif ( is_repeating_post( $post_id ) ) {
437
+	elseif (is_repeating_post($post_id)) {
438 438
 		$original_post_id = $post_id;
439 439
 	}
440 440
 
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
  * @param array $schedule  The schedule array
451 451
  * @return array
452 452
  */
453
-function insert_date( $next_post, $schedule ) {
453
+function insert_date($next_post, $schedule) {
454 454
 
455
-	switch( $schedule['slug'] ) {
455
+	switch ($schedule['slug']) {
456 456
 		case 'weekly':
457 457
 			$format = '\W\e\e\k W Y';
458 458
 			break;
@@ -460,11 +460,11 @@  discard block
 block discarded – undo
460 460
 			$format = 'F Y';
461 461
 			break;
462 462
 		default:
463
-			$format = get_option( 'date_format', 'Y-m-d' );
463
+			$format = get_option('date_format', 'Y-m-d');
464 464
 	}
465 465
 
466 466
 	// Expand the placeholder
467
-	$next_post['post_title'] = str_replace( '[date]', date( $format, strtotime( $next_post['date'] ) ), $next_post['title'] );
467
+	$next_post['post_title'] = str_replace('[date]', date($format, strtotime($next_post['date'])), $next_post['title']);
468 468
 
469 469
 	return $next_post;
470 470
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,9 +82,12 @@
 block discarded – undo
82 82
 
83 83
 			<strong><?php printf( esc_html__( 'Repeat of %s', 'hm-post-repeat' ), '<a href="' . esc_url( get_edit_post_link( get_post()->post_parent ) ) . '">' . esc_html( get_the_title( get_post_field( 'post_parent', get_the_id() ) ) ) . '</a>' ); ?></strong>
84 84
 
85
-		<?php else : ?>
85
+		<?php else {
86
+	: ?>
86 87
 
87
-			<?php $repeating_schedule = get_repeating_schedule( get_the_id() ); ?>
88
+			<?php $repeating_schedule = get_repeating_schedule( get_the_id() );
89
+}
90
+?>
88 91
 			<?php $is_repeating_post = is_repeating_post( get_the_id() ) && isset( $repeating_schedule ); ?>
89 92
 
90 93
 			<strong><?php echo ! $is_repeating_post ? esc_html__( 'No', 'hm-post-repeat' ) : esc_html( $repeating_schedule['display'] ); ?></strong>
Please login to merge, or discard this patch.