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 ( 36eb24...b3d82b )
by Chris
04:20
created
includes/twitter-functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Register Twitter as a servcie
24 24
  * @param  array $services The registered services
25
- * @return array           With Twitter added
25
+ * @return string[]           With Twitter added
26 26
  */
27 27
 function ppp_tw_register_service( $services = array() ) {
28 28
 	$services[] = 'tw';
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 /**
241 241
  * Register the Twitter connection area for the Social Media Accounts section
242 242
  * @param  array $content The existing content tokens
243
- * @return array          The content tokens with Twitter added
243
+ * @return string[]          The content tokens with Twitter added
244 244
  */
245 245
 function ppp_tw_register_admin_social_content( $content ) {
246 246
 	$content[] = 'tw';
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 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
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function ppp_twitter_enabled() {
13 13
 	global $ppp_social_settings;
14 14
 
15
-	if ( isset( $ppp_social_settings['twitter'] ) && !empty( $ppp_social_settings['twitter'] ) ) {
15
+	if (isset($ppp_social_settings['twitter']) && ! empty($ppp_social_settings['twitter'])) {
16 16
 		return true;
17 17
 	}
18 18
 
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function ppp_tw_account_list_avatar( $string = '' ) {
52 52
 
53
-	if ( ppp_twitter_enabled() ) {
53
+	if (ppp_twitter_enabled()) {
54 54
 		global $ppp_social_settings;
55 55
 		$avatar_url = $ppp_social_settings['twitter']['user']->profile_image_url_https;
56
-		$string .= '<img class="ppp-social-icon" src="' . $avatar_url . '" />';
56
+		$string .= '<img class="ppp-social-icon" src="'.$avatar_url.'" />';
57 57
 	}
58 58
 
59 59
 	return $string;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function ppp_tw_account_list_name( $string = '' ) {
69 69
 
70
-	if ( ppp_twitter_enabled() ) {
70
+	if (ppp_twitter_enabled()) {
71 71
 		global $ppp_social_settings;
72 72
 		$string .= $ppp_social_settings['twitter']['user']->name;
73 73
 	}
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function ppp_tw_account_list_actions( $string = '' ) {
85 85
 
86
-	if ( ! ppp_twitter_enabled() ) {
86
+	if ( ! ppp_twitter_enabled()) {
87 87
 		global $ppp_twitter_oauth, $ppp_social_settings;
88 88
 		$tw_auth    = $ppp_twitter_oauth->ppp_verify_twitter_credentials();
89 89
 		$tw_authurl = $ppp_twitter_oauth->ppp_get_twitter_auth_url();
90 90
 
91
-		$string .= '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="' . $tw_authurl . '" target="_blank"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a></span>';
92
-		$string .= '<span style="display:none;" id="tw-oob-pin-notice">' . __( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ) . '</span>';
93
-		$string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="' . wp_create_nonce( 'ppp-tw-pin' ) . '" data-user="0" /> <a href="#" class="button-secondary tw-oob-pin-submit">' . __( 'Submit', 'ppp-txt' ) . '</a><span class="spinner"></span></span>';
91
+		$string .= '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="'.$tw_authurl.'" target="_blank"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a></span>';
92
+		$string .= '<span style="display:none;" id="tw-oob-pin-notice">'.__( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ).'</span>';
93
+		$string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="'.wp_create_nonce( 'ppp-tw-pin' ).'" data-user="0" /> <a href="#" class="button-secondary tw-oob-pin-submit">'.__( 'Submit', 'ppp-txt' ).'</a><span class="spinner"></span></span>';
94 94
 	} else {
95
-		$string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ) . '" >' . __( 'Disconnect from Twitter', 'ppp-txt' ) . '</a>&nbsp;';
96
-		$string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">' . __( 'Revoke Access via Twitter', 'ppp-txt' ) . '</a>';
95
+		$string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ).'" >'.__( 'Disconnect from Twitter', 'ppp-txt' ).'</a>&nbsp;';
96
+		$string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">'.__( 'Revoke Access via Twitter', 'ppp-txt' ).'</a>';
97 97
 	}
98 98
 
99 99
 	return $string;
@@ -106,27 +106,27 @@  discard block
 block discarded – undo
106 106
 
107 107
 	ppp_set_social_tokens();
108 108
 
109
-	$nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : '';
109
+	$nonce = isset($_POST['nonce']) ? sanitize_text_field( $_POST['nonce'] ) : '';
110 110
 	$nonce_verified = wp_verify_nonce( $nonce, 'ppp-tw-pin' );
111 111
 
112
-	if ( ! $nonce_verified ) {
112
+	if ( ! $nonce_verified) {
113 113
 		wp_die();
114 114
 	}
115 115
 
116
-	$pin = isset( $_POST['pin'] ) ? absint( $_POST['pin'] ) : false;
116
+	$pin = isset($_POST['pin']) ? absint( $_POST['pin'] ) : false;
117 117
 
118
-	if ( empty( $pin ) ) {
118
+	if (empty($pin)) {
119 119
 		wp_die();
120 120
 	}
121 121
 
122 122
 	$_REQUEST['oauth_verifier'] = $pin;
123 123
 
124
-	if ( empty( $_POST['user_auth'] ) ) {
124
+	if (empty($_POST['user_auth'])) {
125 125
 		$twitter = new PPP_Twitter;
126 126
 		$twitter->ppp_initialize_twitter();
127 127
 		$settings = get_option( 'ppp_social_settings', true );
128 128
 
129
-		if ( ! empty( $settings['twitter']['user']->id ) ) {
129
+		if ( ! empty($settings['twitter']['user']->id)) {
130 130
 			echo 1;
131 131
 		} else {
132 132
 			echo 0;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$twitter->init();
137 137
 
138 138
 		$user = get_user_meta( get_current_user_id(), '_ppp_twitter_data', true );
139
-		if ( ! empty( $user['user']->id ) ) {
139
+		if ( ! empty($user['user']->id)) {
140 140
 			echo 1;
141 141
 		} else {
142 142
 			echo 0;
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
  * @return void
153 153
  */
154 154
 function ppp_capture_twitter_oauth() {
155
-	if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) {
155
+	if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) {
156 156
 		$current_screen = get_current_screen();
157
-		if ( 'user-edit' === $current_screen->base ) {
158
-			$user_id = ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false;
157
+		if ('user-edit' === $current_screen->base) {
158
+			$user_id = ! empty($_GET['user_id']) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false;
159 159
 			$twitter = new PPP_Twitter_User( $user_id );
160 160
 			$twitter->init();
161
-			$redirect = admin_url( 'user-edit.php?updated=1&user_id=' . $user_id );
161
+			$redirect = admin_url( 'user-edit.php?updated=1&user_id='.$user_id );
162 162
 		} else {
163 163
 			global $ppp_twitter_oauth;
164 164
 			$ppp_twitter_oauth->ppp_initialize_twitter();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
  * @return void
177 177
  */
178 178
 function ppp_disconnect_twitter() {
179
-	if ( ! empty( $_GET['user_id'] ) ) {
179
+	if ( ! empty($_GET['user_id'])) {
180 180
 		$user_id = (int) sanitize_text_field( $_GET['user_id'] );
181
-		if ( $user_id !== get_current_user_id() || ! current_user_can( PostPromoterPro::get_manage_capability() ) ) {
181
+		if ($user_id !== get_current_user_id() || ! current_user_can( PostPromoterPro::get_manage_capability() )) {
182 182
 			wp_die( __( 'Unable to disconnect Twitter account', 'ppp-txt' ) );
183 183
 		}
184 184
 		delete_user_meta( $user_id, '_ppp_twitter_data' );
185 185
 	} else {
186 186
 		global $ppp_social_settings;
187 187
 		$ppp_social_settings = get_option( 'ppp_social_settings' );
188
-		if ( isset( $ppp_social_settings['twitter'] ) ) {
189
-			unset( $ppp_social_settings['twitter'] );
188
+		if (isset($ppp_social_settings['twitter'])) {
189
+			unset($ppp_social_settings['twitter']);
190 190
 			update_option( 'ppp_social_settings', $ppp_social_settings );
191 191
 		}
192 192
 	}
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 	global $ppp_options, $wp_logs, $wp_filter;
218 218
 
219 219
 	$post_meta     = get_post_meta( $post_id, '_ppp_tweets', true );
220
-	$this_share    = $post_meta[ $index ];
221
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
220
+	$this_share    = $post_meta[$index];
221
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
222 222
 
223 223
 	$share_message = ppp_tw_build_share_message( $post_id, $name );
224 224
 
225
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
225
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
226 226
 		$media = $this_share['image'];
227 227
 	} else {
228 228
 		$use_media = ppp_tw_use_media( $post_id, $index );
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 
250 250
 	update_post_meta( $log_entry, '_ppp_share_status', $status );
251 251
 
252
-	if ( ! empty( $status->id_str ) ) {
252
+	if ( ! empty($status->id_str)) {
253 253
 		$post      = get_post( $post_id );
254 254
 		$author_id = $post->post_author;
255 255
 		$author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true );
256 256
 
257
-		if ( $author_rt ) {
257
+		if ($author_rt) {
258 258
 			$twitter_user = new PPP_Twitter_User( $author_id );
259 259
 			$twitter_user->retweet( $status->id_str );
260 260
 		}
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 		);
276 276
 		$other_rt = get_users( $args );
277 277
 
278
-		if ( $other_rt ){
279
-			foreach ( $other_rt as $user ) {
278
+		if ($other_rt) {
279
+			foreach ($other_rt as $user) {
280 280
 				$twitter_user = new PPP_Twitter_User( $user->ID );
281 281
 				$twitter_user->retweet( $status->id_str );
282 282
 			}
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) {
297 297
 	$share_content = ppp_tw_generate_share_content( $post_id, $name, $scheduled );
298 298
 
299
-	if ( $include_link ) {
299
+	if ($include_link) {
300 300
 		$share_link    = ppp_generate_link( $post_id, $name, $scheduled );
301
-		$share_content = $share_content . ' ' . $share_link;
301
+		$share_content = $share_content.' '.$share_link;
302 302
 	}
303 303
 
304 304
 	return apply_filters( 'ppp_tw_build_share_message', $share_content );
@@ -312,22 +312,22 @@  discard block
 block discarded – undo
312 312
  */
313 313
 function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) {
314 314
 	global $ppp_options;
315
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
315
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
316 316
 	$ppp_tweets   = get_post_meta( $post_id, '_ppp_tweets', true );
317 317
 
318
-	if ( ! empty( $ppp_tweets ) ) {
318
+	if ( ! empty($ppp_tweets)) {
319 319
 		$name_array    = explode( '_', $name );
320 320
 		$index         = $name_array[1];
321
-		if ( isset( $ppp_tweets[ $index ] ) ) {
322
-			$share_content = $ppp_tweets[ $index ]['text'];
321
+		if (isset($ppp_tweets[$index])) {
322
+			$share_content = $ppp_tweets[$index]['text'];
323 323
 		}
324 324
 	}
325 325
 
326 326
 	// If an override was found, use it, otherwise try the default text content
327
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
327
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
328 328
 
329 329
 	// If the content is still empty, just use the post title
330
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
330
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
331 331
 
332 332
 	return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) );
333 333
 }
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
  * @return bool         Whether or not this tweet should contain a media post
340 340
  */
341 341
 function ppp_tw_use_media( $post_id, $index ) {
342
-	if ( empty( $post_id ) || empty( $index ) ) {
342
+	if (empty($post_id) || empty($index)) {
343 343
 		return false;
344 344
 	}
345 345
 
346 346
 	$share_data = get_post_meta( $post_id, '_ppp_tweets', true );
347
-	$use_media  = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false;
347
+	$use_media  = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false;
348 348
 
349 349
 	return $use_media;
350 350
 }
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
  * @return void
356 356
  */
357 357
 function ppp_set_tw_token_constants( $social_tokens ) {
358
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) {
358
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) {
359 359
 		define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token );
360 360
 		define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret );
361 361
 	}
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
  */
394 394
 function ppp_tw_add_meta_tab( $tabs ) {
395 395
 	global $ppp_social_settings;
396
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
396
+	if ( ! isset($ppp_social_settings['twitter'])) {
397 397
 		return $tabs;
398 398
 	}
399 399
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
  */
411 411
 function ppp_tw_register_metabox_content( $content ) {
412 412
 	global $ppp_social_settings;
413
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
413
+	if ( ! isset($ppp_social_settings['twitter'])) {
414 414
 		return $content;
415 415
 	}
416 416
 
@@ -469,16 +469,16 @@  discard block
 block discarded – undo
469 469
 							<tbody>
470 470
 								<?php ppp_render_tweet_share_on_publish_row(); ?>
471 471
 								<?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?>
472
-								<?php if ( ! empty( $tweets ) ) : ?>
472
+								<?php if ( ! empty($tweets)) : ?>
473 473
 
474
-									<?php foreach ( $tweets as $key => $value ) :
475
-										$date          = isset( $value['date'] )          ? $value['date']          : '';
476
-										$time          = isset( $value['time'] )          ? $value['time']          : '';
477
-										$text          = isset( $value['text'] )          ? $value['text']          : '';
478
-										$image         = isset( $value['image'] )         ? $value['image']         : '';
479
-										$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
474
+									<?php foreach ($tweets as $key => $value) :
475
+										$date          = isset($value['date']) ? $value['date'] : '';
476
+										$time          = isset($value['time']) ? $value['time'] : '';
477
+										$text          = isset($value['text']) ? $value['text'] : '';
478
+										$image         = isset($value['image']) ? $value['image'] : '';
479
+										$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
480 480
 
481
-										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value );
481
+										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value );
482 482
 										?>
483 483
 
484 484
 										<?php ppp_render_tweet_row( $key, $args, $post->ID ); ?>
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 									<?php endforeach; ?>
488 488
 
489 489
 									<?php
490
-									if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) {
490
+									if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) {
491 491
 										$args = array(
492 492
 											'date'          => '',
493 493
 											'time'          => '',
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 								<tr class="ppp-add-repeatable-wrapper">
511 511
 									<td class="submit" colspan="4" style="float: none; clear:both; background:#fff;">
512 512
 										<a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a>
513
-										<?php if ( ! empty( $has_past_shares ) ) : ?>
513
+										<?php if ( ! empty($has_past_shares)) : ?>
514 514
 											<a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a>
515 515
 										<?php endif; ?>
516 516
 									</td>
@@ -536,38 +536,38 @@  discard block
 block discarded – undo
536 536
  */
537 537
 function ppp_render_tweet_share_on_publish_row() {
538 538
 	global $post, $ppp_share_settings;
539
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
539
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
540 540
 
541 541
 	$ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true );
542 542
 
543 543
 	$ppp_share_on_publish  = get_post_meta( $post->ID, '_ppp_share_on_publish', true );
544 544
 	$show_share_on_publish = false;
545 545
 
546
-	$share_by_default      = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['twitter'] ) ? false : true;
546
+	$share_by_default      = empty($ppp_share_settings['share_on_publish'][$post->post_type]['twitter']) ? false : true;
547 547
 
548
-	if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) {
548
+	if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) {
549 549
 		$show_share_on_publish = true;
550 550
 	}
551 551
 
552 552
 	$ppp_share_on_publish_text          = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
553 553
 	$ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true );
554 554
 
555
-	$disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false;
555
+	$disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false;
556 556
 	?>
557 557
 	<tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row">
558 558
 		<td colspan="2" class="ppp-on-plublish-date-column">
559
-			<input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />
559
+			<input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />
560 560
 			&nbsp;<label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label>
561 561
 		</td>
562 562
 
563 563
 		<td>
564
-			<textarea <?php if ( $disabled ): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text"><?php echo esc_attr( $ppp_share_on_publish_text ); ?></textarea>
565
-			<?php $length = ! empty( $ppp_share_on_publish_text ) ? strlen( $ppp_share_on_publish_text ) : 0; ?>
564
+			<textarea <?php if ($disabled): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text"><?php echo esc_attr( $ppp_share_on_publish_text ); ?></textarea>
565
+			<?php $length = ! empty($ppp_share_on_publish_text) ? strlen( $ppp_share_on_publish_text ) : 0; ?>
566 566
 			&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
567 567
 		</td>
568 568
 
569 569
 		<td style="width: 200px" colspan="2">
570
-			<input class="ppp-tw-featured-image-input" <?php if ( $disabled ): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/>
570
+			<input class="ppp-tw-featured-image-input" <?php if ($disabled): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/>
571 571
 			&nbsp;<label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label>
572 572
 		</td>
573 573
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 function ppp_render_tweet_row( $key, $args = array(), $post_id ) {
587 587
 	global $post, $has_past_shares;
588 588
 
589
-	if ( ! empty( $args['date'] ) && ! empty( $args['time'] ) ) {
589
+	if ( ! empty($args['date']) && ! empty($args['time'])) {
590 590
 		$share_time = ppp_generate_timestamp( $args['date'], $args['time'] );
591 591
 		$readonly   = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false;
592 592
 	} else {
@@ -594,11 +594,11 @@  discard block
 block discarded – undo
594 594
 		$readonly   = false;
595 595
 	}
596 596
 
597
-	$no_date        = ! empty( $readonly ) ? ' hasDatepicker' : '';
598
-	$hide           = ! empty( $readonly ) ? 'display: none;' : '';
599
-	$shared         = ! empty( $readonly ) ? 'past-share' : '';
597
+	$no_date        = ! empty($readonly) ? ' hasDatepicker' : '';
598
+	$hide           = ! empty($readonly) ? 'display: none;' : '';
599
+	$shared         = ! empty($readonly) ? 'past-share' : '';
600 600
 
601
-	if ( ! empty( $readonly ) ) {
601
+	if ( ! empty($readonly)) {
602 602
 		$has_past_shares++;
603 603
 	}
604 604
 	?>
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
 		<td>
615 615
 			<textarea class="ppp-tweet-text-repeatable" type="text" name="_ppp_tweets[<?php echo $key; ?>][text]" <?php echo $readonly; ?>><?php echo esc_attr( $args['text'] ); ?></textarea>
616
-			<?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?>
616
+			<?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?>
617 617
 			&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
618 618
 		</td>
619 619
 
@@ -648,24 +648,24 @@  discard block
 block discarded – undo
648 648
  */
649 649
 function ppp_tw_save_post_meta_boxes( $post_id, $post ) {
650 650
 
651
-	if ( ! ppp_should_save( $post_id, $post ) ) {
651
+	if ( ! ppp_should_save( $post_id, $post )) {
652 652
 		return;
653 653
 	}
654 654
 
655
-	$ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0';
655
+	$ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0';
656 656
 
657
-	$ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0';
658
-	$ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
659
-	$ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
657
+	$ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0';
658
+	$ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
659
+	$ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
660 660
 
661 661
 
662 662
 	update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish );
663 663
 	update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text );
664 664
 	update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image );
665 665
 
666
-	$tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array();
667
-	foreach ( $tweet_data as $index => $tweet ) {
668
-		$tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] );
666
+	$tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array();
667
+	foreach ($tweet_data as $index => $tweet) {
668
+		$tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] );
669 669
 	}
670 670
 	update_post_meta( $post_id, '_ppp_tweets', $tweet_data );
671 671
 
@@ -682,29 +682,29 @@  discard block
 block discarded – undo
682 682
 function ppp_tw_share_on_publish( $new_status, $old_status, $post ) {
683 683
 	global $ppp_options;
684 684
 
685
-	$from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true );
686
-	$from_post = isset( $_POST['_ppp_share_on_publish'] );
685
+	$from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true );
686
+	$from_post = isset($_POST['_ppp_share_on_publish']);
687 687
 
688
-	if ( empty( $from_meta ) && empty( $from_post ) ) {
688
+	if (empty($from_meta) && empty($from_post)) {
689 689
 		return;
690 690
 	}
691 691
 
692 692
 	// Determine if we're seeing the share on publish in meta or $_POST
693
-	if ( $from_meta && !$from_post ) {
693
+	if ($from_meta && ! $from_post) {
694 694
 		$ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
695 695
 		$use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true );
696 696
 	} else {
697
-		$ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : '';
698
-		$use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false;
697
+		$ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : '';
698
+		$use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false;
699 699
 	}
700 700
 
701
-	$share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
701
+	$share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
702 702
 	$share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) );
703
-	$name = 'sharedate_0_' . $post->ID;
703
+	$name = 'sharedate_0_'.$post->ID;
704 704
 	$media = ppp_post_has_media( $post->ID, 'tw', $use_media );
705 705
 	$share_link = ppp_generate_link( $post->ID, $name, true );
706 706
 
707
-	$status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media );
707
+	$status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media );
708 708
 
709 709
 	$log_title = ppp_tw_build_share_message( $post->ID, $name, false, false );
710 710
 
@@ -722,11 +722,11 @@  discard block
 block discarded – undo
722 722
 
723 723
 	$log_entry = WP_Logging::insert_log( $log_data, $log_meta );
724 724
 
725
-	if ( ! empty( $status->id_str ) ) {
725
+	if ( ! empty($status->id_str)) {
726 726
 		$author_id = $post->post_author;
727 727
 		$author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true );
728 728
 
729
-		if ( $author_rt ) {
729
+		if ($author_rt) {
730 730
 			$twitter_user = new PPP_Twitter_User( $author_id );
731 731
 			$twitter_user->retweet( $status->id_str );
732 732
 		}
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
 		);
748 748
 		$other_rt = get_users( $args );
749 749
 
750
-		if ( $other_rt ){
751
-			foreach ( $other_rt as $user ) {
750
+		if ($other_rt) {
751
+			foreach ($other_rt as $user) {
752 752
 				$twitter_user = new PPP_Twitter_User( $user->ID );
753 753
 				$twitter_user->retweet( $status->id_str );
754 754
 			}
@@ -769,20 +769,20 @@  discard block
 block discarded – undo
769 769
 function ppp_tw_generate_timestamps( $times, $post_id ) {
770 770
 	$ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true );
771 771
 
772
-	if ( empty( $ppp_tweets ) ) {
772
+	if (empty($ppp_tweets)) {
773 773
 		$ppp_tweets = array();
774 774
 	}
775 775
 
776
-	foreach ( $ppp_tweets as $key => $data ) {
777
-		if ( ! array_filter( $data ) ) {
776
+	foreach ($ppp_tweets as $key => $data) {
777
+		if ( ! array_filter( $data )) {
778 778
 			continue;
779 779
 		}
780 780
 
781 781
 		$timestamp = ppp_generate_timestamp( $data['date'], $data['time'] );
782 782
 
783
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
784
-			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw';
785
-			$times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw';
783
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
784
+			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw';
785
+			$times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw';
786 786
 		}
787 787
 
788 788
 	}
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 
803 803
 	$ret = false;
804 804
 
805
-	if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) {
805
+	if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) {
806 806
 		$ret = true;
807 807
 	}
808 808
 
@@ -817,13 +817,13 @@  discard block
 block discarded – undo
817 817
  */
818 818
 function ppp_tw_card_meta() {
819 819
 
820
-	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) {
820
+	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) {
821 821
 		return;
822 822
 	}
823 823
 
824 824
 	global $post, $ppp_options;
825 825
 
826
-	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) {
826
+	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) {
827 827
 		return;
828 828
 	}
829 829
 
@@ -841,20 +841,20 @@  discard block
 block discarded – undo
841 841
 
842 842
 	$return = '';
843 843
 
844
-	if ( ! is_single() || ! ppp_tw_cards_enabled() ) {
844
+	if ( ! is_single() || ! ppp_tw_cards_enabled()) {
845 845
 		return $return;
846 846
 	}
847 847
 
848 848
 	global $post, $ppp_social_settings;
849 849
 
850 850
 
851
-	if ( empty( $post ) ) {
851
+	if (empty($post)) {
852 852
 		return;
853 853
 	}
854 854
 
855 855
 	$elements = ppp_tw_default_meta_elements();
856
-	foreach ( $elements as $name => $content ) {
857
-		$return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n";
856
+	foreach ($elements as $name => $content) {
857
+		$return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n";
858 858
 	}
859 859
 
860 860
 	return apply_filters( 'ppp_tw_card_meta', $return );
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 	$elements = array();
875 875
 
876 876
 	$image_url = ppp_post_has_media( $post->ID, 'tw', true );
877
-	if ( $image_url ) {
877
+	if ($image_url) {
878 878
 		$elements['twitter:card']      = 'summary_large_image';
879 879
 		$elements['twitter:image:src'] = $image_url;
880 880
 
881 881
 		$thumb_id = ppp_get_attachment_id_from_image_url( $image_url );
882
-		if ( ! empty( $thumb_id ) ) {
882
+		if ( ! empty($thumb_id)) {
883 883
 			$alt_text = ppp_get_attachment_alt_text( $thumb_id );
884 884
 			// When adding media via the WP Uploader, any 'alt text' supplied will be used as the accessible alt text.
885
-			if ( ! empty( $alt_text ) ) {
885
+			if ( ! empty($alt_text)) {
886 886
 				$elements['twitter:image:alt'] = esc_attr( $alt_text );
887 887
 			}
888 888
 		}
@@ -890,15 +890,15 @@  discard block
 block discarded – undo
890 890
 		$elements['twitter:card'] = 'summary';
891 891
 	}
892 892
 
893
-	$elements['twitter:site']        = '@' . $ppp_social_settings['twitter']['user']->screen_name;
893
+	$elements['twitter:site']        = '@'.$ppp_social_settings['twitter']['user']->screen_name;
894 894
 	$elements['twitter:title']       = esc_attr( strip_tags( $post->post_title ) );
895 895
 	$elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() );
896 896
 
897 897
 	$author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true );
898
-	if ( ! empty( $author_twitter_handle ) ) {
898
+	if ( ! empty($author_twitter_handle)) {
899 899
 
900
-		if ( strpos( $author_twitter_handle, '@' ) === false ) {
901
-			$author_twitter_handle = '@' . $author_twitter_handle;
900
+		if (strpos( $author_twitter_handle, '@' ) === false) {
901
+			$author_twitter_handle = '@'.$author_twitter_handle;
902 902
 		}
903 903
 
904 904
 		$elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) );
@@ -917,13 +917,13 @@  discard block
 block discarded – undo
917 917
 function ppp_tw_get_card_description() {
918 918
 	global $post;
919 919
 
920
-	if ( ! is_single() || empty( $post ) ) {
920
+	if ( ! is_single() || empty($post)) {
921 921
 		return false;
922 922
 	}
923 923
 
924 924
 	$excerpt = $post->post_excerpt;
925 925
 
926
-	if ( empty( $excerpt ) ) {
926
+	if (empty($excerpt)) {
927 927
 		$excerpt = ppp_tw_format_card_description( $post->post_content );
928 928
 	}
929 929
 
@@ -941,10 +941,10 @@  discard block
 block discarded – undo
941 941
 	$max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 );
942 942
 	$excerpt = strip_tags( $excerpt );
943 943
 
944
-	if ( strlen( $excerpt ) > $max_len ) {
944
+	if (strlen( $excerpt ) > $max_len) {
945 945
 		$excerpt_pre = substr( $excerpt, 0, $max_len );
946 946
 		$last_space  = strrpos( $excerpt_pre, ' ' );
947
-		$excerpt     = substr( $excerpt_pre, 0, $last_space ) . '...';
947
+		$excerpt     = substr( $excerpt_pre, 0, $last_space ).'...';
948 948
 	}
949 949
 
950 950
 	return $excerpt;
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
  */
960 960
 function ppp_tw_add_contact_method( $user_contactmethods ) {
961 961
 
962
-	if ( ! isset( $user_contactmethods['twitter'] ) ) {
962
+	if ( ! isset($user_contactmethods['twitter'])) {
963 963
 		$user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' );
964 964
 	}
965 965
 	// Returns the contact methods
@@ -978,15 +978,15 @@  discard block
 block discarded – undo
978 978
 function ppp_tw_profile_settings( $user ) {
979 979
 	global $ppp_social_settings;
980 980
 
981
-	if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) {
981
+	if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) {
982 982
 		return;
983 983
 	}
984 984
 
985
-	if ( $user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() ) ) {
985
+	if ($user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() )) {
986 986
 		return;
987 987
 	}
988 988
 
989
-	if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) {
989
+	if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) {
990 990
 		return;
991 991
 	}
992 992
 
@@ -1001,12 +1001,12 @@  discard block
 block discarded – undo
1001 1001
 			$twitter = new PPP_Twitter_User( get_current_user_id() );
1002 1002
 			$tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true );
1003 1003
 
1004
-			if ( empty( $tw_user ) ) {
1005
-				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) );
1004
+			if (empty($tw_user)) {
1005
+				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) );
1006 1006
 
1007
-				$string  = '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="' . $tw_authurl . '" target="_blank"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a></span>';
1008
-				$string .= '<span style="display:none;" id="tw-oob-pin-notice">' . __( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ) . '</span>';
1009
-				$string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="' . wp_create_nonce( 'ppp-tw-pin' ) . '" data-user="1" /> <a href="#" class="button-secondary tw-oob-pin-submit">' . __( 'Submit', 'ppp-txt' ) . '</a><span class="spinner"></span></span>';
1007
+				$string  = '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="'.$tw_authurl.'" target="_blank"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a></span>';
1008
+				$string .= '<span style="display:none;" id="tw-oob-pin-notice">'.__( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ).'</span>';
1009
+				$string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="'.wp_create_nonce( 'ppp-tw-pin' ).'" data-user="1" /> <a href="#" class="button-secondary tw-oob-pin-submit">'.__( 'Submit', 'ppp-txt' ).'</a><span class="spinner"></span></span>';
1010 1010
 				$string .= '<input type="hidden" name="ppp_user_auth" value="1" />';
1011 1011
 
1012 1012
 				echo $string;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 				?>
1016 1016
 				<p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p>
1017 1017
 				<p>
1018
-					<a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id=' . $user->ID . '&ppp_social_disconnect=true&ppp_network=twitter&user_id=' . $user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>&nbsp;
1018
+					<a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id='.$user->ID.'&ppp_social_disconnect=true&ppp_network=twitter&user_id='.$user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>&nbsp;
1019 1019
 					<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a>
1020 1020
 				</p>
1021 1021
 				<?php
@@ -1024,12 +1024,12 @@  discard block
 block discarded – undo
1024 1024
 			</td>
1025 1025
 		</tr>
1026 1026
 
1027
-		<?php if ( $connected ) : ?>
1027
+		<?php if ($connected) : ?>
1028 1028
 		<?php
1029 1029
 			$share_on_publish 			= get_user_meta( $user->ID, '_ppp_share_on_publish', true );
1030
-			$share_scheduled  			= get_user_meta( $user->ID, '_ppp_share_scheduled' , true );
1030
+			$share_scheduled  			= get_user_meta( $user->ID, '_ppp_share_scheduled', true );
1031 1031
 			$share_others_on_publish 	= get_user_meta( $user->ID, '_ppp_share_others_on_publish', true );
1032
-			$share_others_scheduled  	= get_user_meta( $user->ID, '_ppp_share_others_scheduled' , true );
1032
+			$share_others_scheduled  	= get_user_meta( $user->ID, '_ppp_share_others_scheduled', true );
1033 1033
 		?>
1034 1034
 		<tr>
1035 1035
 			<th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th>
@@ -1077,19 +1077,19 @@  discard block
 block discarded – undo
1077 1077
 function ppp_tw_save_profile( $user_id ) {
1078 1078
 	global $ppp_social_settings;
1079 1079
 
1080
-	if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) {
1080
+	if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) {
1081 1081
 		return;
1082 1082
 	}
1083 1083
 
1084
-	$share_on_publish 			= ! empty( $_POST['share_on_publish'] ) ? true : false;
1085
-	$share_scheduled  			= ! empty( $_POST['share_scheduled'] )  ? true : false;
1086
-	$share_others_on_publish 	= ! empty( $_POST['share_others_on_publish'] ) ? true : false;
1087
-	$share_others_scheduled  	= ! empty( $_POST['share_others_scheduled'] )  ? true : false;
1084
+	$share_on_publish 			= ! empty($_POST['share_on_publish']) ? true : false;
1085
+	$share_scheduled  			= ! empty($_POST['share_scheduled']) ? true : false;
1086
+	$share_others_on_publish 	= ! empty($_POST['share_others_on_publish']) ? true : false;
1087
+	$share_others_scheduled  	= ! empty($_POST['share_others_scheduled']) ? true : false;
1088 1088
 
1089 1089
 	update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish );
1090
-	update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled  );
1090
+	update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled );
1091 1091
 	update_user_meta( $user_id, '_ppp_share_others_on_publish', $share_others_on_publish );
1092
-	update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled  );
1092
+	update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled );
1093 1093
 
1094 1094
 }
1095 1095
 add_action( 'personal_options_update', 'ppp_tw_save_profile' );
@@ -1098,14 +1098,14 @@  discard block
 block discarded – undo
1098 1098
 function ppp_tw_calendar_on_publish_event( $events, $post_id ) {
1099 1099
 	$share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true );
1100 1100
 
1101
-	if ( ! empty( $share_on_publish ) ) {
1101
+	if ( ! empty($share_on_publish)) {
1102 1102
 		$share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true );
1103 1103
 		$events[] = array(
1104
-			'id' => $post_id . '-share-on-publish',
1105
-			'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ),
1106
-			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
1107
-			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
1108
-			'className' => 'ppp-calendar-item-tw cal-post-' . $post_id,
1104
+			'id' => $post_id.'-share-on-publish',
1105
+			'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ),
1106
+			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
1107
+			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
1108
+			'className' => 'ppp-calendar-item-tw cal-post-'.$post_id,
1109 1109
 			'belongsTo' => $post_id,
1110 1110
 		);
1111 1111
 	}
@@ -1116,9 +1116,9 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 function ppp_tw_get_post_shares( $items, $post_id ) {
1118 1118
 	$tweets = get_post_meta( $post_id, '_ppp_tweets', true );
1119
-	if ( empty( $tweets ) ) { return $items; }
1119
+	if (empty($tweets)) { return $items; }
1120 1120
 
1121
-	foreach ( $tweets as $key => $tweet ) {
1121
+	foreach ($tweets as $key => $tweet) {
1122 1122
 		$items[] = array( 'id' => $key, 'service' => 'tw' );
1123 1123
 	}
1124 1124
 	return $items;
Please login to merge, or discard this patch.
includes/admin/admin-ajax.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	$date = sanitize_text_field( $_POST['date'] );
11 11
 	$time = sanitize_text_field( $_POST['time'] );
12 12
 
13
-	$offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense
13
+	$offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense
14 14
 
15 15
 	$share_time = explode( ':', $time );
16 16
 
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 	$minutes = (int) substr( $share_time[1], 0, 2 );
19 19
 	$ampm = strtolower( substr( $share_time[1], -2 ) );
20 20
 
21
-	if ( $ampm == 'pm' && $hours != 12 ) {
21
+	if ($ampm == 'pm' && $hours != 12) {
22 22
 		$hours = $hours + 12;
23 23
 	}
24 24
 
25
-	if ( $ampm == 'am' && $hours == 12 ) {
25
+	if ($ampm == 'am' && $hours == 12) {
26 26
 		$hours = 00;
27 27
 	}
28 28
 
Please login to merge, or discard this patch.
includes/admin/class-accounts-table.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 
8
-if ( ! class_exists( 'WP_List_Table' ) ) {
9
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
8
+if ( ! class_exists( 'WP_List_Table' )) {
9
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
10 10
 }
11 11
 
12 12
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @return string              The Content to display
43 43
 	 */
44 44
 	public function column_default( $item, $column_name ) {
45
-		return $item[ $column_name ];
45
+		return $item[$column_name];
46 46
 	}
47 47
 
48 48
 	/**
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$accounts = apply_filters( 'ppp_register_social_service', array() );
76 76
 
77
-		foreach ( $accounts as $account ) {
77
+		foreach ($accounts as $account) {
78 78
 			$data[$account] = array(
79
-				'icon'    => apply_filters( 'ppp_account_list_icon-' . $account, '' ),
80
-				'avatar'  => apply_filters( 'ppp_account_list_avatar-' . $account, '' ),
81
-				'name'    => apply_filters( 'ppp_account_list_name-' . $account, '' ),
82
-				'actions' => apply_filters( 'ppp_account_list_actions-' . $account, '' ),
83
-				'extras'  => apply_filters( 'ppp_account_list_extras-' . $account, '' ),
79
+				'icon'    => apply_filters( 'ppp_account_list_icon-'.$account, '' ),
80
+				'avatar'  => apply_filters( 'ppp_account_list_avatar-'.$account, '' ),
81
+				'name'    => apply_filters( 'ppp_account_list_name-'.$account, '' ),
82
+				'actions' => apply_filters( 'ppp_account_list_actions-'.$account, '' ),
83
+				'extras'  => apply_filters( 'ppp_account_list_extras-'.$account, '' ),
84 84
 			);
85 85
 		}
86 86
 
Please login to merge, or discard this patch.
includes/admin/do-upgrades.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' )) exit;
14 14
 
15 15
 /**
16 16
  * Render Upgrades Screen
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
  * @return void
20 20
 */
21 21
 function ppp_upgrades_screen() {
22
-	$action = isset( $_GET['ppp-upgrade'] ) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : '';
23
-	$step   = isset( $_GET['step'] )        ? absint( $_GET['step'] )                     : 1;
24
-	$total  = isset( $_GET['total'] )       ? absint( $_GET['total'] )                    : false;
25
-	$custom = isset( $_GET['custom'] )      ? absint( $_GET['custom'] )                   : 0;
26
-	$number = isset( $_GET['number'] )      ? absint( $_GET['number'] )                   : 100;
27
-	$steps  = round( ( $total / $number ), 0 );
22
+	$action = isset($_GET['ppp-upgrade']) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : '';
23
+	$step   = isset($_GET['step']) ? absint( $_GET['step'] ) : 1;
24
+	$total  = isset($_GET['total']) ? absint( $_GET['total'] ) : false;
25
+	$custom = isset($_GET['custom']) ? absint( $_GET['custom'] ) : 0;
26
+	$number = isset($_GET['number']) ? absint( $_GET['number'] ) : 100;
27
+	$steps  = round( ($total / $number), 0 );
28 28
 
29 29
 	$doing_upgrade_args = array(
30 30
 		'page'        => 'ppp-upgrades',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	);
37 37
 
38 38
 	update_option( 'ppp_doing_upgrade', $doing_upgrade_args );
39
-	if ( $step > $steps ) {
39
+	if ($step > $steps) {
40 40
 		// Prevent a weird case where the estimate was off. Usually only a couple.
41 41
 		$steps = $step;
42 42
 	}
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	<div class="wrap">
45 45
 		<h1><?php _e( 'Post Promoter Pro - Upgrades', 'ppp-txt' ); ?></h1>
46 46
 
47
-		<?php if( ! empty( $action ) ) : ?>
47
+		<?php if ( ! empty($action)) : ?>
48 48
 
49 49
 			<div id="ppp-upgrade-status">
50 50
 				<p><?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?></p>
51 51
 
52
-				<?php if( ! empty( $total ) ) : ?>
52
+				<?php if ( ! empty($total)) : ?>
53 53
 					<p><strong><?php printf( __( 'Step %d of approximately %d running', 'ppp-txt' ), $step, $steps ); ?></strong></p>
54 54
 				<?php endif; ?>
55 55
 			</div>
Please login to merge, or discard this patch.
includes/admin/meta-boxes.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 function ppp_register_meta_boxes() {
13 13
 	global $post, $ppp_options;
14 14
 
15
-	if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) ) {
15
+	if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] )) {
16 16
 		return;
17 17
 	}
18 18
 
19
-	foreach ( $ppp_options['post_types'] as $post_type => $value ) {
19
+	foreach ($ppp_options['post_types'] as $post_type => $value) {
20 20
 		add_meta_box( 'ppp_schedule_metabox', 'Post Promoter Pro', 'ppp_schedule_callback', $post_type, 'normal', 'high' );
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.
includes/libs/bitly.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
  * Handles all bitly functions
12 12
  *
13 13
  */
14
-if( !class_exists( 'PPP_Bitly' ) ) {
14
+if ( ! class_exists( 'PPP_Bitly' )) {
15 15
 
16 16
 	class PPP_Bitly {
17 17
 
18 18
 		var $bitly;
19 19
 
20
-		public function __construct(){
20
+		public function __construct() {
21 21
 			ppp_maybe_start_session();
22 22
 		}
23 23
 
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 		 * Handles to load twitter class
28 28
 		 */
29 29
 		public function ppp_load_bitly() {
30
-				if( !class_exists( 'Bitly' ) ) {
31
-					require_once ( PPP_PATH . '/includes/libs/bitly/bitly.php' );
30
+				if ( ! class_exists( 'Bitly' )) {
31
+					require_once (PPP_PATH.'/includes/libs/bitly/bitly.php');
32 32
 				}
33 33
 
34 34
 				ppp_set_social_tokens();
35 35
 
36
-				if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' ) ) {
36
+				if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' )) {
37 37
 					return false;
38 38
 				}
39 39
 
40 40
 				global $ppp_social_settings;
41 41
 
42
-				if ( isset( $ppp_social_settings['bitly'] ) ) {
43
-					if ( !defined( 'bitly_accesstoken' ) ) {
42
+				if (isset($ppp_social_settings['bitly'])) {
43
+					if ( ! defined( 'bitly_accesstoken' )) {
44 44
 						define( 'bitly_accesstoken', $ppp_social_settings['bitly']['access_token'] );
45 45
 					}
46 46
 					$this->bitly = new Bitly( bitly_clientid, bitly_secret, bitly_accesstoken );
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		public function revoke_access() {
55 55
 			global $ppp_social_settings;
56 56
 
57
-			unset( $ppp_social_settings['bitly'] );
57
+			unset($ppp_social_settings['bitly']);
58 58
 
59 59
 			update_option( 'ppp_social_settings', $ppp_social_settings );
60 60
 		}
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 		 * Get auth codes for Bitly
64 64
 		 *
65 65
 		 */
66
-		public function ppp_get_bitly_auth_url () {
66
+		public function ppp_get_bitly_auth_url() {
67 67
 			//load bitly class
68 68
 			$bitly = $this->ppp_load_bitly();
69 69
 
70 70
 			//check bitly class is loaded or not
71
-			if( !$bitly ) {
71
+			if ( ! $bitly) {
72 72
 				return false;
73 73
 			}
74 74
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 		}
78 78
 
79 79
 		public function ppp_make_bitly_link( $link = null ) {
80
-			if ( empty( $link ) ) {
80
+			if (empty($link)) {
81 81
 				return false;
82 82
 			}
83 83
 
84 84
 			$bitly = $this->ppp_load_bitly();
85 85
 
86
-			if ( !$bitly ) {
86
+			if ( ! $bitly) {
87 87
 				return false;
88 88
 			}
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		public function ppp_bitly_user_info() {
94 94
 			$bitly = $this->ppp_load_bitly();
95 95
 
96
-			if ( !$bitly ) {
96
+			if ( ! $bitly) {
97 97
 				return false;
98 98
 			}
99 99
 
Please login to merge, or discard this patch.
includes/wpme-functions.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @return void
12 12
  */
13 13
 function ppp_add_wpme_shortener( $selected_shortener ) {
14
-	if( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' ) ) { ?>
14
+	if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' )) { ?>
15 15
 		<option value="wpme" <?php selected( $selected_shortener, 'wpme', true ); ?>>WP.me</option>
16 16
 	<?php }
17 17
 }
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  * @return string      The link, after shortening through wp.me
41 41
  */
42 42
 function ppp_apply_wpme( $link ) {
43
-	if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' ) ) {
43
+	if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' )) {
44 44
 		$id = url_to_postid( $link );
45 45
 		$result = wpme_get_shortlink( $id );
46 46
 
47
-		if ( ! empty( $result ) ) {
47
+		if ( ! empty($result)) {
48 48
 			return $result;
49 49
 		} else {
50 50
 			return $link;
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined( 'ABSPATH' )) {
4 4
 	exit;
5 5
 }
6 6
 
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 $options = get_option( 'ppp_options' );
13 13
 
14
-if ( isset( $options['delete_on_uninstall'] ) ) {
14
+if (isset($options['delete_on_uninstall'])) {
15 15
 	require_once 'includes/cron-functions.php';
16 16
 
17 17
 	$crons = ppp_get_shceduled_crons();
18
-	foreach( $crons as $cron ) {
18
+	foreach ($crons as $cron) {
19 19
 		$ppp_data   = $cron['ppp_share_post_event'];
20 20
 		$array_keys = array_keys( $ppp_data );
21 21
 		$hash_key   = $array_keys[0];
Please login to merge, or discard this patch.
includes/facebook-functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Register Facebook as a service
24 24
  * @param  array $services The Currently registered services
25
- * @return array           The services with Facebook added
25
+ * @return string[]           The services with Facebook added
26 26
  */
27 27
 function ppp_fb_register_service( $services = array() ) {
28 28
 	$services[] = 'fb';
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 /**
191 191
  * Add query vars for Facebook
192 192
  * @param  array $vars Currenty Query Vars
193
- * @return array       Query vars array with facebook added
193
+ * @return string[]       Query vars array with facebook added
194 194
  */
195 195
 function ppp_fb_query_vars( $vars ) {
196 196
 	$vars[] = 'fb_access_token';
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
  * @since  2.3
749 749
  * @param  int     $post_id      Post ID
750 750
  * @param  string  $name         The cron name
751
- * @param  boolean $scheduled    If the item is being fired by a schedule (default, true), or retrieved for display (false)
751
+ * @param  boolean $is_scheduled    If the item is being fired by a schedule (default, true), or retrieved for display (false)
752 752
  * @return string                The formatted link to the post
753 753
  */
754 754
 function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) {
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 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
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function ppp_facebook_enabled() {
13 13
 	global $ppp_social_settings;
14 14
 
15
-	if ( isset( $ppp_social_settings['facebook'] ) && !empty( $ppp_social_settings['facebook'] ) ) {
15
+	if (isset($ppp_social_settings['facebook']) && ! empty($ppp_social_settings['facebook'])) {
16 16
 		return true;
17 17
 	}
18 18
 
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function ppp_fb_account_list_avatar( $string = '' ) {
52 52
 
53
-	if ( ppp_facebook_enabled() ) {
53
+	if (ppp_facebook_enabled()) {
54 54
 		global $ppp_social_settings;
55 55
 		$avatar_url = $ppp_social_settings['facebook']->avatar;
56
-		$string = '<img class="ppp-social-icon" src="' . $avatar_url . '" />';
56
+		$string = '<img class="ppp-social-icon" src="'.$avatar_url.'" />';
57 57
 	}
58 58
 
59 59
 	return $string;
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function ppp_fb_account_list_name( $string = '' ) {
69 69
 
70
-	if ( ppp_facebook_enabled() ) {
70
+	if (ppp_facebook_enabled()) {
71 71
 		global $ppp_social_settings;
72
-		$string  = $ppp_social_settings['facebook']->name;
72
+		$string = $ppp_social_settings['facebook']->name;
73 73
 	}
74 74
 
75 75
 	return $string;
@@ -84,22 +84,22 @@  discard block
 block discarded – undo
84 84
 function ppp_fb_account_list_actions( $string = '' ) {
85 85
 	global $ppp_facebook_oauth, $ppp_social_settings;
86 86
 
87
-	if ( ! ppp_facebook_enabled() ) {
87
+	if ( ! ppp_facebook_enabled()) {
88 88
 
89 89
 		$fb_authurl = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
90 90
 
91
-		$string .= '<a class="button-primary" href="' . $fb_authurl . '">' . __( 'Connect to Facebook', 'ppp-txt' ) . '</a>';
91
+		$string .= '<a class="button-primary" href="'.$fb_authurl.'">'.__( 'Connect to Facebook', 'ppp-txt' ).'</a>';
92 92
 	} else {
93
-		$string  .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=facebook' ) . '" >' . __( 'Disconnect from Facebook', 'ppp-txt' ) . '</a>&nbsp;';
93
+		$string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=facebook' ).'" >'.__( 'Disconnect from Facebook', 'ppp-txt' ).'</a>&nbsp;';
94 94
 
95 95
 		$refresh_date = (int) get_option( '_ppp_facebook_refresh', true );
96 96
 
97
-		if ( defined( 'PPP_FB_APP_ID' ) && current_time( 'timestamp' ) > $refresh_date ) {
97
+		if (defined( 'PPP_FB_APP_ID' ) && current_time( 'timestamp' ) > $refresh_date) {
98 98
 			$token       = $ppp_social_settings['facebook']->access_token;
99 99
 			$url         = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
100
-			$refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
100
+			$refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
101 101
 
102
-			$string  .= '<a class="button-secondary" href="' . $refresh_url . '" >' . __( 'Re-Authorize Facebook', 'ppp-txt' ) . '</a>&nbsp;';
102
+			$string .= '<a class="button-secondary" href="'.$refresh_url.'" >'.__( 'Re-Authorize Facebook', 'ppp-txt' ).'</a>&nbsp;';
103 103
 		}
104 104
 	}
105 105
 
@@ -114,28 +114,28 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function ppp_fb_account_list_extras( $string ) {
116 116
 
117
-	if ( ppp_facebook_enabled() ) {
117
+	if (ppp_facebook_enabled()) {
118 118
 		global $ppp_social_settings, $ppp_facebook_oauth, $ppp_options;
119 119
 		$pages = $ppp_facebook_oauth->ppp_get_fb_user_pages( $ppp_social_settings['facebook']->access_token );
120
-		$selected = isset( $ppp_social_settings['facebook']->page ) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me';
120
+		$selected = isset($ppp_social_settings['facebook']->page) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me';
121 121
 
122
-		if ( !empty( $pages ) ) {
123
-			$string = '<label>' . __( 'Publish as:', 'ppp-txt' ) . '</label><br />';
122
+		if ( ! empty($pages)) {
123
+			$string = '<label>'.__( 'Publish as:', 'ppp-txt' ).'</label><br />';
124 124
 			$string .= '<select id="fb-page">';
125
-			$string .= '<option value="me">' . __( 'Me', 'ppp-txt' ) . '</option>';
126
-			foreach ( $pages as $page ) {
127
-				$value = $page->name . '|' . $page->access_token . '|' . $page->id;
128
-				$string .= '<option ' . selected( $value, $selected, false ) . ' value="' . $value . '">' . $page->name . '</option>';
125
+			$string .= '<option value="me">'.__( 'Me', 'ppp-txt' ).'</option>';
126
+			foreach ($pages as $page) {
127
+				$value = $page->name.'|'.$page->access_token.'|'.$page->id;
128
+				$string .= '<option '.selected( $value, $selected, false ).' value="'.$value.'">'.$page->name.'</option>';
129 129
 			}
130 130
 			$string .= '</select><span class="spinner"></span>';
131 131
 		}
132 132
 
133
-		if ( ! empty( $ppp_options['enable_debug'] ) ) {
134
-			$days_left  = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
135
-			$refresh_in = absint( round( ( get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
133
+		if ( ! empty($ppp_options['enable_debug'])) {
134
+			$days_left  = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
135
+			$refresh_in = absint( round( (get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
136 136
 
137
-			$string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left );
138
-			$string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
137
+			$string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left );
138
+			$string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
139 139
 		}
140 140
 	}
141 141
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
  * @return void
150 150
  */
151 151
 function ppp_set_fb_token_constants( $social_tokens ) {
152
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'facebook' ) ) {
152
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'facebook' )) {
153 153
 		define( 'PPP_FB_APP_ID', $social_tokens->facebook->app_id );
154 154
 		define( 'PPP_FB_APP_SECRET', $social_tokens->facebook->app_secret );
155 155
 	}
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 function ppp_capture_facebook_oauth() {
164 164
 	$should_capture = false;
165 165
 
166
-	if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) {
166
+	if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) {
167 167
 		// Local config
168 168
 		$should_capture = true;
169 169
 	}
170 170
 
171
-	if ( isset( $_REQUEST['fb_access_token'] ) ) {
171
+	if (isset($_REQUEST['fb_access_token'])) {
172 172
 		// Returning from remote config
173 173
 		$should_capture = true;
174 174
 	}
175 175
 
176
-	if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) {
176
+	if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) {
177 177
 		global $ppp_facebook_oauth;
178 178
 		$ppp_facebook_oauth->ppp_initialize_facebook();
179 179
 		wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) );
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 function ppp_disconnect_facebook() {
191 191
 	global $ppp_social_settings;
192 192
 	$ppp_social_settings = get_option( 'ppp_social_settings' );
193
-	if ( isset( $ppp_social_settings['facebook'] ) ) {
194
-		unset( $ppp_social_settings['facebook'] );
193
+	if (isset($ppp_social_settings['facebook'])) {
194
+		unset($ppp_social_settings['facebook']);
195 195
 		update_option( 'ppp_social_settings', $ppp_social_settings );
196 196
 		delete_option( '_ppp_facebook_refresh' );
197 197
 	}
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
  */
218 218
 function ppp_fb_execute_refresh() {
219 219
 
220
-	if ( ! ppp_facebook_enabled() ) {
220
+	if ( ! ppp_facebook_enabled()) {
221 221
 		return;
222 222
 	}
223 223
 
224 224
 	$refresh_date = (int) get_option( '_ppp_facebook_refresh', true );
225 225
 
226
-	if ( ( empty( $_GET['page' ] ) || $_GET['page'] !== 'ppp-social-settings' ) && current_time( 'timestamp' ) > $refresh_date ) {
226
+	if ((empty($_GET['page']) || $_GET['page'] !== 'ppp-social-settings') && current_time( 'timestamp' ) > $refresh_date) {
227 227
 		add_action( 'admin_notices', 'ppp_facebook_refresh_notice' );
228 228
 	}
229 229
 }
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
  */
236 236
 function ppp_facebook_refresh_notice() {
237 237
 
238
-	if ( ! ppp_facebook_enabled() ) {
238
+	if ( ! ppp_facebook_enabled()) {
239 239
 		return;
240 240
 	}
241 241
 
242
-	$has_dismissed = get_transient( 'ppp-dismiss-refresh-fb' . get_current_user_id() );
243
-	if ( false !== $has_dismissed ) {
242
+	$has_dismissed = get_transient( 'ppp-dismiss-refresh-fb'.get_current_user_id() );
243
+	if (false !== $has_dismissed) {
244 244
 		return;
245 245
 	}
246 246
 
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 
252 252
 	$token = $ppp_social_settings['facebook']->access_token;
253 253
 	$url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
254
-	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
254
+	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
255 255
 
256
-	$days_left = (int) round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS );
256
+	$days_left = (int) round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS );
257 257
 	?>
258 258
 	<div class="notice notice-warning is-dismissible" data-service="fb">
259
-		<?php if ( $days_left > 0 ): ?>
259
+		<?php if ($days_left > 0): ?>
260 260
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication expires in %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p>
261
-		<?php elseif ( $days_left < 1 ): ?>
261
+		<?php elseif ($days_left < 1): ?>
262 262
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p>
263 263
 		<?php endif; ?>
264 264
 	</div>
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function ppp_fb_dismiss_notice() {
275 275
 
276
-	$nag = sanitize_key( $_POST[ 'nag' ] );
276
+	$nag = sanitize_key( $_POST['nag'] );
277 277
 
278
-	if ( $nag === $_POST[ 'nag' ] ) {
279
-		set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS );
278
+	if ($nag === $_POST['nag']) {
279
+		set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS );
280 280
 	}
281 281
 
282 282
 
@@ -304,18 +304,18 @@  discard block
 block discarded – undo
304 304
  * @param  string  $name    The name of the Cron
305 305
  * @return void
306 306
  */
307
-function ppp_fb_scheduled_share(  $post_id = 0, $index = 1, $name = ''  ) {
307
+function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) {
308 308
 	global $ppp_options;
309 309
 
310 310
 	$link = ppp_generate_link( $post_id, $name );
311 311
 
312 312
 	$post_meta     = get_post_meta( $post_id, '_ppp_fb_shares', true );
313
-	$this_share    = $post_meta[ $index ];
314
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
313
+	$this_share    = $post_meta[$index];
314
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
315 315
 
316 316
 	$share_message = ppp_fb_build_share_message( $post_id, $name );
317 317
 
318
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
318
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
319 319
 		$media = $this_share['image'];
320 320
 	} else {
321 321
 		$use_media = ppp_fb_use_media( $post_id, $index );
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
  */
374 374
 function ppp_fb_add_meta_tab( $tabs ) {
375 375
 	global $ppp_social_settings;
376
-	if ( ! ppp_facebook_enabled() ) {
376
+	if ( ! ppp_facebook_enabled()) {
377 377
 		return $tabs;
378 378
 	}
379 379
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
  */
391 391
 function ppp_fb_register_metabox_content( $content ) {
392 392
 	global $ppp_social_settings;
393
-	if ( ! ppp_facebook_enabled() ) {
393
+	if ( ! ppp_facebook_enabled()) {
394 394
 		return $content;
395 395
 	}
396 396
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  */
407 407
 function ppp_fb_add_metabox_content( $post ) {
408 408
 	global $ppp_options, $ppp_share_settings;
409
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
409
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
410 410
 
411 411
 	$ppp_fb_share_on_publish               = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
412 412
 	$ppp_share_on_publish_title            = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 
416 416
 	$show_share_on_publish = false;
417 417
 
418
-	$share_by_default      = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['facebook'] ) ? false : true;
418
+	$share_by_default      = empty($ppp_share_settings['share_on_publish'][$post->post_type]['facebook']) ? false : true;
419 419
 
420
-	if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) {
420
+	if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) {
421 421
 		$show_share_on_publish = true;
422 422
 	}
423 423
 
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 		<div class="ppp-post-override-wrap">
427 427
 			<p><h3><?php _e( 'Share on Facebook', 'ppp-txt' ); ?></h3></p>
428 428
 			<p>
429
-				<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
429
+				<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
430 430
 				<label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook&hellip;', 'ppp-txt' ); ?></label>
431 431
 				<select name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" class="ppp-toggle-share-on-publish">
432
-					<option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option>
433
-					<option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option>
432
+					<option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option>
433
+					<option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option>
434 434
 					<option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option>
435 435
 				</select>
436 436
 			</p>
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 								<th style="width: 10px;"></th>
447 447
 							</tr>
448 448
 						</thead>
449
-						<tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
449
+						<tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
450 450
 							<?php
451 451
 								$args = array(
452 452
 									'text'          => $ppp_share_on_publish_title,
@@ -457,18 +457,18 @@  discard block
 block discarded – undo
457 457
 								ppp_render_fb_share_on_publish_row( $args );
458 458
 							?>
459 459
 						</tbody>
460
-						<tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
460
+						<tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
461 461
 							<?php $shares = get_post_meta( $post->ID, '_ppp_fb_shares', true ); ?>
462
-							<?php if ( ! empty( $shares ) ) : ?>
462
+							<?php if ( ! empty($shares)) : ?>
463 463
 
464
-								<?php foreach ( $shares as $key => $value ) :
465
-									$date          = isset( $value['date'] )          ? $value['date']          : '';
466
-									$time          = isset( $value['time'] )          ? $value['time']          : '';
467
-									$text          = isset( $value['text'] )          ? $value['text']          : '';
468
-									$image         = isset( $value['image'] )         ? $value['image']         : '';
469
-									$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
464
+								<?php foreach ($shares as $key => $value) :
465
+									$date          = isset($value['date']) ? $value['date'] : '';
466
+									$time          = isset($value['time']) ? $value['time'] : '';
467
+									$text          = isset($value['text']) ? $value['text'] : '';
468
+									$image         = isset($value['image']) ? $value['image'] : '';
469
+									$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
470 470
 
471
-									$args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text','image','attachment_id' ), $value );
471
+									$args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value );
472 472
 									?>
473 473
 
474 474
 									<?php ppp_render_fb_share_row( $key, $args, $post->ID ); ?>
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 
549 549
 	$share_time = ppp_generate_timestamp( $args['date'], $args['time'] );
550 550
 	$readonly   = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false;
551
-	$no_date    = ! empty( $readonly ) ? ' hasDatepicker' : '';
552
-	$hide       = ! empty( $readonly ) ? 'display: none;' : '';
551
+	$no_date    = ! empty($readonly) ? ' hasDatepicker' : '';
552
+	$hide       = ! empty($readonly) ? 'display: none;' : '';
553 553
 	?>
554 554
 	<tr class="ppp-fb-wrapper ppp-repeatable-row ppp-repeatable-facebook scheduled-row" data-key="<?php echo esc_attr( $key ); ?>">
555 555
 		<td>
@@ -594,23 +594,23 @@  discard block
 block discarded – undo
594 594
  */
595 595
 function ppp_fb_save_post_meta_boxes( $post_id, $post ) {
596 596
 
597
-	if ( ! ppp_should_save( $post_id, $post ) ) {
597
+	if ( ! ppp_should_save( $post_id, $post )) {
598 598
 		return;
599 599
 	}
600 600
 
601
-	$ppp_fb_share_on_publish            = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) )               ? $_REQUEST['_ppp_fb_share_on_publish']               : '-1';
602
-	$ppp_share_on_publish_title         = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) )         ? $_REQUEST['_ppp_fb_share_on_publish_title']         : '';
603
-	$ppp_share_on_publish_image_url     = ( isset( $_REQUEST['_ppp_fb_share_on_publish_image_url'] ) )     ? $_REQUEST['_ppp_fb_share_on_publish_image_url']     : '';
604
-	$ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : '';
601
+	$ppp_fb_share_on_publish            = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1';
602
+	$ppp_share_on_publish_title         = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : '';
603
+	$ppp_share_on_publish_image_url     = (isset($_REQUEST['_ppp_fb_share_on_publish_image_url'])) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : '';
604
+	$ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_fb_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : '';
605 605
 
606
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish',               $ppp_fb_share_on_publish );
607
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish_title',         $ppp_share_on_publish_title );
608
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url',     $ppp_share_on_publish_image_url );
606
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish );
607
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title );
608
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url );
609 609
 	update_post_meta( $post_id, '_ppp_fb_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id );
610 610
 
611
-	$fb_data = ( isset( $_REQUEST['_ppp_fb_shares'] ) && empty( $ppp_fb_share_on_publish ) ) ? $_REQUEST['_ppp_fb_shares'] : array();
612
-	foreach ( $fb_data as $index => $share ) {
613
-		$fb_data[ $index ]['text'] = sanitize_text_field( $share['text'] );
611
+	$fb_data = (isset($_REQUEST['_ppp_fb_shares']) && empty($ppp_fb_share_on_publish)) ? $_REQUEST['_ppp_fb_shares'] : array();
612
+	foreach ($fb_data as $index => $share) {
613
+		$fb_data[$index]['text'] = sanitize_text_field( $share['text'] );
614 614
 	}
615 615
 
616 616
 	update_post_meta( $post_id, '_ppp_fb_shares', $fb_data );
@@ -627,10 +627,10 @@  discard block
 block discarded – undo
627 627
 function ppp_fb_share_on_publish( $new_status, $old_status, $post ) {
628 628
 	global $ppp_options;
629 629
 
630
-	$from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
631
-	$from_post = isset( $_POST['_ppp_fb_share_on_publish'] ) ? $_POST['_ppp_fb_share_on_publish'] : '0';
630
+	$from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
631
+	$from_post = isset($_POST['_ppp_fb_share_on_publish']) ? $_POST['_ppp_fb_share_on_publish'] : '0';
632 632
 
633
-	if ( '1' != $from_meta && '1' != $from_post ) {
633
+	if ('1' != $from_meta && '1' != $from_post) {
634 634
 		return;
635 635
 	}
636 636
 
@@ -642,28 +642,28 @@  discard block
 block discarded – undo
642 642
 	$image_url     = '';
643 643
 
644 644
 	// Determine if we're seeing the share on publish in meta or $_POST
645
-	if ( $from_meta && ! $from_post ) {
646
-		$title         = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title',         true );
645
+	if ($from_meta && ! $from_post) {
646
+		$title         = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
647 647
 		$attachment_id = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_attachment_id', true );
648
-		$image_url     = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url',     true );
648
+		$image_url     = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true );
649 649
 	} else {
650
-		$title         = isset( $_POST['_ppp_fb_share_on_publish_title'] )         ? $_POST['_ppp_fb_share_on_publish_title']         : '';
651
-		$attachment_id = isset( $_POST['_ppp_fb_share_on_publish_attachment_id'] ) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0;
652
-		$image_url     = isset( $_POST['_ppp_fb_share_on_publish_image_url'] )     ? $_POST['_ppp_fb_share_on_publish_image_url']     : '';
650
+		$title         = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : '';
651
+		$attachment_id = isset($_POST['_ppp_fb_share_on_publish_attachment_id']) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0;
652
+		$image_url     = isset($_POST['_ppp_fb_share_on_publish_image_url']) ? $_POST['_ppp_fb_share_on_publish_image_url'] : '';
653 653
 	}
654 654
 
655 655
 	$thumbnail = '';
656
-	if ( empty( $attachment_id ) && ! empty( $image_url ) ) {
656
+	if (empty($attachment_id) && ! empty($image_url)) {
657 657
 		$thumbnail = $image_url;
658 658
 	} else {
659 659
 		$thumbnail = ppp_post_has_media( $post->ID, 'fb', true, $attachment_id );
660 660
 	}
661 661
 
662
-	$name = 'sharedate_0_' . $post->ID . '_fb';
662
+	$name = 'sharedate_0_'.$post->ID.'_fb';
663 663
 
664
-	$default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
664
+	$default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
665 665
 	// If an override was found, use it, otherwise try the default text content
666
-	if ( empty( $title ) && empty( $default_title ) ) {
666
+	if (empty($title) && empty($default_title)) {
667 667
 		$title = get_the_title( $post->ID );
668 668
 	}
669 669
 
@@ -703,20 +703,20 @@  discard block
 block discarded – undo
703 703
 function ppp_fb_generate_timestamps( $times, $post_id ) {
704 704
 	$fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true );
705 705
 
706
-	if ( empty( $fb_shares ) ) {
706
+	if (empty($fb_shares)) {
707 707
 		$fb_shares = array();
708 708
 	}
709 709
 
710
-	foreach ( $fb_shares as $key => $data ) {
711
-		if ( ! array_filter( $data ) ) {
710
+	foreach ($fb_shares as $key => $data) {
711
+		if ( ! array_filter( $data )) {
712 712
 			continue;
713 713
 		}
714 714
 
715 715
 		$timestamp = ppp_generate_timestamp( $data['date'], $data['time'] );
716 716
 
717
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
718
-			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_fb';
719
-			$times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_fb';
717
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
718
+			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_fb';
719
+			$times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_fb';
720 720
 		}
721 721
 
722 722
 	}
@@ -766,22 +766,22 @@  discard block
 block discarded – undo
766 766
  */
767 767
 function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) {
768 768
 	global $ppp_options;
769
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
769
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
770 770
 	$fb_shares    = get_post_meta( $post_id, '_ppp_fb_shares', true );
771 771
 
772
-	if ( ! empty( $fb_shares ) ) {
772
+	if ( ! empty($fb_shares)) {
773 773
 		$name_array    = explode( '_', $name );
774 774
 		$index         = $name_array[1];
775
-		if ( isset( $fb_shares[ $index ] ) ) {
776
-			$share_content = $fb_shares[ $index ]['text'];
775
+		if (isset($fb_shares[$index])) {
776
+			$share_content = $fb_shares[$index]['text'];
777 777
 		}
778 778
 	}
779 779
 
780 780
 	// If an override was found, use it, otherwise try the default text content
781
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
781
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
782 782
 
783 783
 	// If the content is still empty, just use the post title
784
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
784
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
785 785
 
786 786
 	return apply_filters( 'ppp_share_content_fb', $share_content, array( 'post_id' => $post_id ) );
787 787
 }
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
  * @return bool         Whether or not this tweet should contain a media post
794 794
  */
795 795
 function ppp_fb_use_media( $post_id, $index ) {
796
-	if ( empty( $post_id ) || empty( $index ) ) {
796
+	if (empty($post_id) || empty($index)) {
797 797
 		return false;
798 798
 	}
799 799
 
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
 
810 810
 	ppp_set_social_tokens();
811 811
 
812
-	$account = isset( $_POST['account'] ) ? $_POST['account'] : false;
812
+	$account = isset($_POST['account']) ? $_POST['account'] : false;
813 813
 
814
-	if ( !empty( $account ) ) {
814
+	if ( ! empty($account)) {
815 815
 		$ppp_social_settings['facebook']->page = $account;
816 816
 
817 817
 		update_option( 'ppp_social_settings', $ppp_social_settings );
@@ -827,14 +827,14 @@  discard block
 block discarded – undo
827 827
 function ppp_fb_calendar_on_publish_event( $events, $post_id ) {
828 828
 	$share_on_publish = get_post_meta( $post_id, '_ppp_fb_share_on_publish', true );
829 829
 
830
-	if ( ! empty( $share_on_publish ) ) {
830
+	if ( ! empty($share_on_publish)) {
831 831
 		$share_text = get_post_meta( $post_id, '_ppp_fb_share_on_publish_title', true );
832 832
 		$events[] = array(
833
-			'id' => $post_id . '-share-on-publish',
834
-			'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ),
835
-			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
836
-			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
837
-			'className' => 'ppp-calendar-item-fb cal-post-' . $post_id,
833
+			'id' => $post_id.'-share-on-publish',
834
+			'title' => ( ! empty($share_text)) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ),
835
+			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
836
+			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
837
+			'className' => 'ppp-calendar-item-fb cal-post-'.$post_id,
838 838
 			'belongsTo' => $post_id,
839 839
 		);
840 840
 	}
@@ -845,9 +845,9 @@  discard block
 block discarded – undo
845 845
 
846 846
 function ppp_fb_get_post_shares( $items, $post_id ) {
847 847
 	$shares = get_post_meta( $post_id, '_ppp_fb_shares', true );
848
-	if ( empty( $shares ) ) { return $items; }
848
+	if (empty($shares)) { return $items; }
849 849
 
850
-	foreach ( $shares as $key => $share ) {
850
+	foreach ($shares as $key => $share) {
851 851
 		$items[] = array( 'id' => $key, 'service' => 'fb' );
852 852
 	}
853 853
 	return $items;
@@ -865,11 +865,11 @@  discard block
 block discarded – undo
865 865
  */
866 866
 function ppp_fb_clear_open_graph_cache( $post_id, $post_after, $post_before ) {
867 867
 	$post_types = ppp_allowed_post_types();
868
-	if ( ! in_array( $post_after->post_type, $post_types ) ) {
868
+	if ( ! in_array( $post_after->post_type, $post_types )) {
869 869
 		return;
870 870
 	}
871 871
 
872
-	if ( 'publish' == $post_after->post_status ) {
872
+	if ('publish' == $post_after->post_status) {
873 873
 		global $ppp_facebook_oauth;
874 874
 
875 875
 		return $ppp_facebook_oauth->clear_og_cache( $post_id );
Please login to merge, or discard this patch.