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 (#208)
by Dan
21:20
created
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/cron-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@
 block discarded – undo
225 225
  * @since  2.3
226 226
  * @param  string $date The Date
227 227
  * @param  string $time The time
228
- * @return long         A timestamp
228
+ * @return integer         A timestamp
229 229
  */
230 230
 function ppp_generate_timestamp( $date, $time ) {
231 231
 	$share_time = explode( ':', $time );
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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
 
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function ppp_schedule_share( $post_id, $post ) {
15 15
 	global $ppp_options;
16
-	$allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array();
16
+	$allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array();
17 17
 	$allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types );
18 18
 
19
-	if ( ! isset( $_POST['post_status'] ) || ! array_key_exists( $post->post_type, $allowed_post_types ) ) {
19
+	if ( ! isset($_POST['post_status']) || ! array_key_exists( $post->post_type, $allowed_post_types )) {
20 20
 		return;
21 21
 	}
22 22
 
23 23
 	ppp_remove_scheduled_shares( $post_id );
24 24
 
25
-	if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published
26
-		( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post
27
-		( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post
25
+	if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published
26
+		($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post
27
+		($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post
28 28
 		global $ppp_options, $ppp_social_settings;
29 29
 
30 30
 		$timestamps = ppp_get_timestamps( $post_id );
31 31
 
32
-		foreach ( $timestamps as $timestamp => $name ) {
32
+		foreach ($timestamps as $timestamp => $name) {
33 33
 			$timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 );
34 34
 			wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) );
35 35
 		}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	$current_item_shares = ppp_get_shceduled_crons( $post_id );
50 50
 
51
-	foreach ( $current_item_shares as $share ) {
51
+	foreach ($current_item_shares as $share) {
52 52
 		wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) );
53 53
 	}
54 54
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 	$all_crons = get_option( 'cron' );
74 74
 	$ppp_crons = array();
75 75
 
76
-	foreach ( $all_crons as $timestamp => $cron ) {
77
-		if ( ! isset( $cron['ppp_share_post_event'] ) ) {
76
+	foreach ($all_crons as $timestamp => $cron) {
77
+		if ( ! isset($cron['ppp_share_post_event'])) {
78 78
 			continue;
79 79
 		}
80 80
 
81
-		foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) {
81
+		foreach ($cron['ppp_share_post_event'] as $key => $single_event) {
82 82
 			$name_parts = explode( '_', $single_event['args'][1] );
83
-			if ( false !== $post_id && $post_id != $name_parts[2] ) {
83
+			if (false !== $post_id && $post_id != $name_parts[2]) {
84 84
 				continue;
85 85
 			}
86 86
 
87 87
 			$single_event['timestamp'] = $timestamp;
88
-			$ppp_crons[ $key ]         = $single_event;
88
+			$ppp_crons[$key]         = $single_event;
89 89
 		}
90 90
 
91 91
 	}
@@ -103,26 +103,26 @@  discard block
 block discarded – undo
103 103
  *
104 104
  */
105 105
 function ppp_has_cron_within( $time = 0, $within = 0 ) {
106
-	if ( empty( $time ) ) {
106
+	if (empty($time)) {
107 107
 		$time = current_time( 'timestamp' );
108 108
 	}
109 109
 
110
-	if ( empty( $within ) ) {
110
+	if (empty($within)) {
111 111
 		$within = ppp_get_default_conflict_window();
112 112
 	}
113 113
 
114 114
 	$crons = ppp_get_shceduled_crons();
115 115
 
116
-	if ( empty( $crons ) ) {
116
+	if (empty($crons)) {
117 117
 		return false;
118 118
 	}
119 119
 
120 120
 	$scheduled_times = wp_list_pluck( $crons, 'timestamp' );
121 121
 
122 122
 	$found_time = false;
123
-	foreach ( $scheduled_times as $key => $scheduled_time ) {
123
+	foreach ($scheduled_times as $key => $scheduled_time) {
124 124
 		$found_time = ppp_is_time_within( $scheduled_time, $time, $within );
125
-		if ( $found_time ) {
125
+		if ($found_time) {
126 126
 			break;
127 127
 		}
128 128
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	$min = $target_time - $within;
145 145
 	$max = $target_time + $within;
146 146
 
147
-	return ( ( $time >= $min ) && ( $time <= $max ) );
147
+	return (($time >= $min) && ($time <= $max));
148 148
 }
149 149
 
150 150
 /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
  */
213 213
 function ppp_unschedule_shares( $new_status, $old_status, $post ) {
214 214
 
215
-	if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) {
215
+	if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) {
216 216
 		ppp_remove_scheduled_shares( $post->ID );
217 217
 	}
218 218
 
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
 	// Just in case we need this, let's set it once
232 232
 	$current_time = current_time( 'timestamp' );
233 233
 
234
-	if ( empty( $date ) ) {
234
+	if (empty($date)) {
235 235
 		$date = date( 'm/d/Y', $current_time );
236 236
 	}
237 237
 
238
-	if ( empty( $time ) ) {
238
+	if (empty($time)) {
239 239
 		$time = date( 'h:ia', $current_time );
240 240
 	}
241 241
 
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 	$minutes    = (int) substr( $share_time[1], 0, 2 );
245 245
 	$ampm       = strtolower( substr( $share_time[1], -2 ) );
246 246
 
247
-	if ( $ampm == 'pm' && $hours != 12 ) {
247
+	if ($ampm == 'pm' && $hours != 12) {
248 248
 		$hours = $hours + 12;
249 249
 	}
250 250
 
251
-	if ( $ampm == 'am' && $hours == 12 ) {
251
+	if ($ampm == 'am' && $hours == 12) {
252 252
 		$hours = 00;
253 253
 	}
254 254
 
255
-	$offset    = (int) -( get_option( 'gmt_offset' ) );
255
+	$offset    = (int) -(get_option( 'gmt_offset' ));
256 256
 	$hours     = $hours + $offset;
257 257
 	$date      = explode( '/', $date );
258 258
 	$timestamp = mktime( (int) $hours, (int) $minutes, 0, (int) $date[0], (int) $date[1], (int) $date[2] );
Please login to merge, or discard this patch.
includes/facebook-functions.php 3 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.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -464,9 +464,12 @@
 block discarded – undo
464 464
 
465 465
 								<?php endforeach; ?>
466 466
 
467
-							<?php else: ?>
467
+							<?php else {
468
+	: ?>
468 469
 
469
-								<?php ppp_render_fb_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); ?>
470
+								<?php ppp_render_fb_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 );
471
+}
472
+?>
470 473
 
471 474
 							<?php endif; ?>
472 475
 						</tbody>
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 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;
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function ppp_fb_account_list_actions( $string = '' ) {
85 85
 
86
-	if ( ! ppp_facebook_enabled() ) {
86
+	if ( ! ppp_facebook_enabled()) {
87 87
 		global $ppp_facebook_oauth, $ppp_social_settings;
88 88
 		$fb_authurl = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
89 89
 
90
-		$string .= '<a class="button-primary" href="' . $fb_authurl . '">' . __( 'Connect to Facebook', 'ppp-txt' ) . '</a>';
90
+		$string .= '<a class="button-primary" href="'.$fb_authurl.'">'.__( 'Connect to Facebook', 'ppp-txt' ).'</a>';
91 91
 	} else {
92
-		$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;';
92
+		$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 93
 	}
94 94
 
95 95
 	return $string;
@@ -103,28 +103,28 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function ppp_fb_account_list_extras( $string ) {
105 105
 
106
-	if ( ppp_facebook_enabled() ) {
106
+	if (ppp_facebook_enabled()) {
107 107
 		global $ppp_social_settings, $ppp_facebook_oauth, $ppp_options;
108 108
 		$pages = $ppp_facebook_oauth->ppp_get_fb_user_pages( $ppp_social_settings['facebook']->access_token );
109
-		$selected = isset( $ppp_social_settings['facebook']->page ) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me';
109
+		$selected = isset($ppp_social_settings['facebook']->page) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me';
110 110
 
111
-		if ( !empty( $pages ) ) {
112
-			$string = '<label>' . __( 'Publish as:', 'ppp-txt' ) . '</label><br />';
111
+		if ( ! empty($pages)) {
112
+			$string = '<label>'.__( 'Publish as:', 'ppp-txt' ).'</label><br />';
113 113
 			$string .= '<select id="fb-page">';
114
-			$string .= '<option value="me">' . __( 'Me', 'ppp-txt' ) . '</option>';
115
-			foreach ( $pages as $page ) {
116
-				$value = $page->name . '|' . $page->access_token . '|' . $page->id;
117
-				$string .= '<option ' . selected( $value, $selected, false ) . ' value="' . $value . '">' . $page->name . '</option>';
114
+			$string .= '<option value="me">'.__( 'Me', 'ppp-txt' ).'</option>';
115
+			foreach ($pages as $page) {
116
+				$value = $page->name.'|'.$page->access_token.'|'.$page->id;
117
+				$string .= '<option '.selected( $value, $selected, false ).' value="'.$value.'">'.$page->name.'</option>';
118 118
 			}
119 119
 			$string .= '</select><span class="spinner"></span>';
120 120
 		}
121 121
 
122
-		if ( ! empty( $ppp_options['enable_debug'] ) ) {
123
-			$days_left  = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
124
-			$refresh_in = absint( round( ( get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
122
+		if ( ! empty($ppp_options['enable_debug'])) {
123
+			$days_left  = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
124
+			$refresh_in = absint( round( (get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
125 125
 
126
-			$string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left );
127
-			$string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
126
+			$string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left );
127
+			$string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
128 128
 		}
129 129
 	}
130 130
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
  * @return void
139 139
  */
140 140
 function ppp_set_fb_token_constants( $social_tokens ) {
141
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'facebook' ) ) {
141
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'facebook' )) {
142 142
 		define( 'PPP_FB_APP_ID', $social_tokens->facebook->app_id );
143 143
 		define( 'PPP_FB_APP_SECRET', $social_tokens->facebook->app_secret );
144 144
 	}
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 function ppp_capture_facebook_oauth() {
153 153
 	$should_capture = false;
154 154
 
155
-	if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) {
155
+	if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) {
156 156
 		// Local config
157 157
 		$should_capture = true;
158 158
 	}
159 159
 
160
-	if ( isset( $_REQUEST['fb_access_token'] ) ) {
160
+	if (isset($_REQUEST['fb_access_token'])) {
161 161
 		// Returning from remote config
162 162
 		$should_capture = true;
163 163
 	}
164 164
 
165
-	if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) {
165
+	if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) {
166 166
 		global $ppp_facebook_oauth;
167 167
 		$ppp_facebook_oauth->ppp_initialize_facebook();
168 168
 		wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) );
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 function ppp_disconnect_facebook() {
180 180
 	global $ppp_social_settings;
181 181
 	$ppp_social_settings = get_option( 'ppp_social_settings' );
182
-	if ( isset( $ppp_social_settings['facebook'] ) ) {
183
-		unset( $ppp_social_settings['facebook'] );
182
+	if (isset($ppp_social_settings['facebook'])) {
183
+		unset($ppp_social_settings['facebook']);
184 184
 		update_option( 'ppp_social_settings', $ppp_social_settings );
185 185
 		delete_option( '_ppp_facebook_refresh' );
186 186
 	}
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function ppp_fb_execute_refresh() {
208 208
 
209
-	if ( ! ppp_facebook_enabled() ) {
209
+	if ( ! ppp_facebook_enabled()) {
210 210
 		return;
211 211
 	}
212 212
 
213 213
 	$refresh_date = (int) get_option( '_ppp_facebook_refresh', true );
214 214
 
215
-	if ( current_time( 'timestamp' ) > $refresh_date ) {
215
+	if (current_time( 'timestamp' ) > $refresh_date) {
216 216
 		add_action( 'admin_notices', 'ppp_facebook_refresh_notice' );
217 217
 	}
218 218
 }
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function ppp_facebook_refresh_notice() {
226 226
 
227
-	if ( ! ppp_facebook_enabled() ) {
227
+	if ( ! ppp_facebook_enabled()) {
228 228
 		return;
229 229
 	}
230 230
 
231
-	$has_dismissed = get_transient( 'ppp-dismiss-refresh-fb' . get_current_user_id() );
232
-	if ( false !== $has_dismissed ) {
231
+	$has_dismissed = get_transient( 'ppp-dismiss-refresh-fb'.get_current_user_id() );
232
+	if (false !== $has_dismissed) {
233 233
 		return;
234 234
 	}
235 235
 
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 
241 241
 	$token = $ppp_social_settings['facebook']->access_token;
242 242
 	$url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
243
-	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
243
+	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
244 244
 
245
-	$days_left = (int) round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS );
245
+	$days_left = (int) round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS );
246 246
 	?>
247 247
 	<div class="notice notice-warning is-dismissible" data-service="fb">
248
-		<?php if ( $days_left > 0 ): ?>
248
+		<?php if ($days_left > 0): ?>
249 249
 			<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>
250
-		<?php elseif ( $days_left < 1 ): ?>
250
+		<?php elseif ($days_left < 1): ?>
251 251
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p>
252 252
 		<?php endif; ?>
253 253
 	</div>
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
  */
263 263
 function ppp_fb_dismiss_notice() {
264 264
 
265
-	$nag = sanitize_key( $_POST[ 'nag' ] );
265
+	$nag = sanitize_key( $_POST['nag'] );
266 266
 
267
-	if ( $nag === $_POST[ 'nag' ] ) {
268
-		set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS );
267
+	if ($nag === $_POST['nag']) {
268
+		set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS );
269 269
 	}
270 270
 
271 271
 
@@ -293,18 +293,18 @@  discard block
 block discarded – undo
293 293
  * @param  string  $name    The name of the Cron
294 294
  * @return void
295 295
  */
296
-function ppp_fb_scheduled_share(  $post_id = 0, $index = 1, $name = ''  ) {
296
+function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) {
297 297
 	global $ppp_options;
298 298
 
299 299
 	$link = ppp_generate_link( $post_id, $name );
300 300
 
301 301
 	$post_meta     = get_post_meta( $post_id, '_ppp_fb_shares', true );
302
-	$this_share    = $post_meta[ $index ];
303
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
302
+	$this_share    = $post_meta[$index];
303
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
304 304
 
305 305
 	$share_message = ppp_fb_build_share_message( $post_id, $name );
306 306
 
307
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
307
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
308 308
 		$media = $this_share['image'];
309 309
 	} else {
310 310
 		$use_media = ppp_fb_use_media( $post_id, $index );
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function ppp_fb_add_meta_tab( $tabs ) {
363 363
 	global $ppp_social_settings;
364
-	if ( ! ppp_facebook_enabled() ) {
364
+	if ( ! ppp_facebook_enabled()) {
365 365
 		return $tabs;
366 366
 	}
367 367
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
  */
379 379
 function ppp_fb_register_metabox_content( $content ) {
380 380
 	global $ppp_social_settings;
381
-	if ( ! ppp_facebook_enabled() ) {
381
+	if ( ! ppp_facebook_enabled()) {
382 382
 		return $content;
383 383
 	}
384 384
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
  */
395 395
 function ppp_fb_add_metabox_content( $post ) {
396 396
 	global $ppp_options, $ppp_share_settings;
397
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
397
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
398 398
 
399 399
 	$ppp_fb_share_on_publish               = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
400 400
 	$ppp_share_on_publish_title            = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 
404 404
 	$show_share_on_publish = false;
405 405
 
406
-	$share_by_default      = empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? false : true;
406
+	$share_by_default      = empty($ppp_share_settings['facebook']['share_on_publish']) ? false : true;
407 407
 
408
-	if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) {
408
+	if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) {
409 409
 		$show_share_on_publish = true;
410 410
 	}
411 411
 
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 		<div class="ppp-post-override-wrap">
415 415
 			<p><h3><?php _e( 'Share on Facebook', 'ppp-txt' ); ?></h3></p>
416 416
 			<p>
417
-				<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
417
+				<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
418 418
 				<label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook&hellip;', 'ppp-txt' ); ?></label>
419 419
 				<select name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" class="ppp-toggle-share-on-publish">
420
-					<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>
421
-					<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>
420
+					<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>
421
+					<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>
422 422
 					<option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option>
423 423
 				</select>
424 424
 			</p>
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 								<th style="width: 10px;"></th>
435 435
 							</tr>
436 436
 						</thead>
437
-						<tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
437
+						<tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
438 438
 							<?php
439 439
 								$args = array(
440 440
 									'text'          => $ppp_share_on_publish_title,
@@ -445,18 +445,18 @@  discard block
 block discarded – undo
445 445
 								ppp_render_fb_share_on_publish_row( $args );
446 446
 							?>
447 447
 						</tbody>
448
-						<tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
448
+						<tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
449 449
 							<?php $shares = get_post_meta( $post->ID, '_ppp_fb_shares', true ); ?>
450
-							<?php if ( ! empty( $shares ) ) : ?>
450
+							<?php if ( ! empty($shares)) : ?>
451 451
 
452
-								<?php foreach ( $shares as $key => $value ) :
453
-									$date          = isset( $value['date'] )          ? $value['date']          : '';
454
-									$time          = isset( $value['time'] )          ? $value['time']          : '';
455
-									$text          = isset( $value['text'] )          ? $value['text']          : '';
456
-									$image         = isset( $value['image'] )         ? $value['image']         : '';
457
-									$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
452
+								<?php foreach ($shares as $key => $value) :
453
+									$date          = isset($value['date']) ? $value['date'] : '';
454
+									$time          = isset($value['time']) ? $value['time'] : '';
455
+									$text          = isset($value['text']) ? $value['text'] : '';
456
+									$image         = isset($value['image']) ? $value['image'] : '';
457
+									$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
458 458
 
459
-									$args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text','image','attachment_id' ), $value );
459
+									$args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value );
460 460
 									?>
461 461
 
462 462
 									<?php ppp_render_fb_share_row( $key, $args, $post->ID ); ?>
@@ -536,8 +536,8 @@  discard block
 block discarded – undo
536 536
 
537 537
 	$share_time = ppp_generate_timestamp( $args['date'], $args['time'] );
538 538
 	$readonly   = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false;
539
-	$no_date    = ! empty( $readonly ) ? ' hasDatepicker' : '';
540
-	$hide       = ! empty( $readonly ) ? 'display: none;' : '';
539
+	$no_date    = ! empty($readonly) ? ' hasDatepicker' : '';
540
+	$hide       = ! empty($readonly) ? 'display: none;' : '';
541 541
 	?>
542 542
 	<tr class="ppp-fb-wrapper ppp-repeatable-row ppp-repeatable-facebook scheduled-row" data-key="<?php echo esc_attr( $key ); ?>">
543 543
 		<td>
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 		</td>
568 568
 
569 569
 		<td>
570
-			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
570
+			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
571 571
 		</td>
572 572
 
573 573
 	</tr>
@@ -582,23 +582,23 @@  discard block
 block discarded – undo
582 582
  */
583 583
 function ppp_fb_save_post_meta_boxes( $post_id, $post ) {
584 584
 
585
-	if ( ! ppp_should_save( $post_id, $post ) ) {
585
+	if ( ! ppp_should_save( $post_id, $post )) {
586 586
 		return;
587 587
 	}
588 588
 
589
-	$ppp_fb_share_on_publish            = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) )               ? $_REQUEST['_ppp_fb_share_on_publish']               : '-1';
590
-	$ppp_share_on_publish_title         = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) )         ? $_REQUEST['_ppp_fb_share_on_publish_title']         : '';
591
-	$ppp_share_on_publish_image_url     = ( isset( $_REQUEST['_ppp_fb_share_on_publish_image_url'] ) )     ? $_REQUEST['_ppp_fb_share_on_publish_image_url']     : '';
592
-	$ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : '';
589
+	$ppp_fb_share_on_publish            = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1';
590
+	$ppp_share_on_publish_title         = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : '';
591
+	$ppp_share_on_publish_image_url     = (isset($_REQUEST['_ppp_fb_share_on_publish_image_url'])) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : '';
592
+	$ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_fb_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : '';
593 593
 
594
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish',               $ppp_fb_share_on_publish );
595
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish_title',         $ppp_share_on_publish_title );
596
-	update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url',     $ppp_share_on_publish_image_url );
594
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish );
595
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title );
596
+	update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url );
597 597
 	update_post_meta( $post_id, '_ppp_fb_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id );
598 598
 
599
-	$fb_data = ( isset( $_REQUEST['_ppp_fb_shares'] ) && empty( $ppp_fb_share_on_publish ) ) ? $_REQUEST['_ppp_fb_shares'] : array();
600
-	foreach ( $fb_data as $index => $share ) {
601
-		$fb_data[ $index ]['text'] = sanitize_text_field( $share['text'] );
599
+	$fb_data = (isset($_REQUEST['_ppp_fb_shares']) && empty($ppp_fb_share_on_publish)) ? $_REQUEST['_ppp_fb_shares'] : array();
600
+	foreach ($fb_data as $index => $share) {
601
+		$fb_data[$index]['text'] = sanitize_text_field( $share['text'] );
602 602
 	}
603 603
 
604 604
 	update_post_meta( $post_id, '_ppp_fb_shares', $fb_data );
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 function ppp_fb_share_on_publish( $new_status, $old_status, $post ) {
616 616
 	global $ppp_options;
617 617
 
618
-	$from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
619
-	$from_post = isset( $_POST['_ppp_fb_share_on_publish'] ) ? $_POST['_ppp_fb_share_on_publish'] : '0';
618
+	$from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
619
+	$from_post = isset($_POST['_ppp_fb_share_on_publish']) ? $_POST['_ppp_fb_share_on_publish'] : '0';
620 620
 
621
-	if ( '1' != $from_meta && '1' != $from_post ) {
621
+	if ('1' != $from_meta && '1' != $from_post) {
622 622
 		return;
623 623
 	}
624 624
 
@@ -630,28 +630,28 @@  discard block
 block discarded – undo
630 630
 	$image_url     = '';
631 631
 
632 632
 	// Determine if we're seeing the share on publish in meta or $_POST
633
-	if ( $from_meta && ! $from_post ) {
634
-		$title         = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title',         true );
633
+	if ($from_meta && ! $from_post) {
634
+		$title         = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
635 635
 		$attachment_id = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_attachment_id', true );
636
-		$image_url     = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url',     true );
636
+		$image_url     = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true );
637 637
 	} else {
638
-		$title         = isset( $_POST['_ppp_fb_share_on_publish_title'] )         ? $_POST['_ppp_fb_share_on_publish_title']         : '';
639
-		$attachment_id = isset( $_POST['_ppp_fb_share_on_publish_attachment_id'] ) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0;
640
-		$image_url     = isset( $_POST['_ppp_fb_share_on_publish_image_url'] )     ? $_POST['_ppp_fb_share_on_publish_image_url']     : '';
638
+		$title         = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : '';
639
+		$attachment_id = isset($_POST['_ppp_fb_share_on_publish_attachment_id']) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0;
640
+		$image_url     = isset($_POST['_ppp_fb_share_on_publish_image_url']) ? $_POST['_ppp_fb_share_on_publish_image_url'] : '';
641 641
 	}
642 642
 
643 643
 	$thumbnail = '';
644
-	if ( empty( $attachment_id ) && ! empty( $image_url ) ) {
644
+	if (empty($attachment_id) && ! empty($image_url)) {
645 645
 		$thumbnail = $image_url;
646 646
 	} else {
647 647
 		$thumbnail = ppp_post_has_media( $post->ID, 'fb', true, $attachment_id );
648 648
 	}
649 649
 
650
-	$name = 'sharedate_0_' . $post->ID . '_fb';
650
+	$name = 'sharedate_0_'.$post->ID.'_fb';
651 651
 
652
-	$default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
652
+	$default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
653 653
 	// If an override was found, use it, otherwise try the default text content
654
-	if ( empty( $title ) && empty( $default_title ) ) {
654
+	if (empty($title) && empty($default_title)) {
655 655
 		$title = get_the_title( $post->ID );
656 656
 	}
657 657
 
@@ -690,20 +690,20 @@  discard block
 block discarded – undo
690 690
 function ppp_fb_generate_timestamps( $times, $post_id ) {
691 691
 	$fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true );
692 692
 
693
-	if ( empty( $fb_shares ) ) {
693
+	if (empty($fb_shares)) {
694 694
 		$fb_shares = array();
695 695
 	}
696 696
 
697
-	foreach ( $fb_shares as $key => $data ) {
698
-		if ( ! array_filter( $data ) ) {
697
+	foreach ($fb_shares as $key => $data) {
698
+		if ( ! array_filter( $data )) {
699 699
 			continue;
700 700
 		}
701 701
 
702 702
 		$timestamp = ppp_generate_timestamp( $data['date'], $data['time'] );
703 703
 
704
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
705
-			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_fb';
706
-			$times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_fb';
704
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
705
+			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_fb';
706
+			$times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_fb';
707 707
 		}
708 708
 
709 709
 	}
@@ -753,20 +753,20 @@  discard block
 block discarded – undo
753 753
  */
754 754
 function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) {
755 755
 	global $ppp_options;
756
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
756
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
757 757
 	$fb_shares    = get_post_meta( $post_id, '_ppp_fb_shares', true );
758 758
 
759
-	if ( $is_scheduled && ! empty( $fb_shares ) ) {
759
+	if ($is_scheduled && ! empty($fb_shares)) {
760 760
 		$name_array    = explode( '_', $name );
761 761
 		$index         = $name_array[1];
762
-		$share_content = $fb_shares[ $index ]['text'];
762
+		$share_content = $fb_shares[$index]['text'];
763 763
 	}
764 764
 
765 765
 	// If an override was found, use it, otherwise try the default text content
766
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
766
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
767 767
 
768 768
 	// If the content is still empty, just use the post title
769
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
769
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
770 770
 
771 771
 	return apply_filters( 'ppp_share_content_fb', $share_content, array( 'post_id' => $post_id ) );
772 772
 }
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
  * @return bool         Whether or not this tweet should contain a media post
779 779
  */
780 780
 function ppp_fb_use_media( $post_id, $index ) {
781
-	if ( empty( $post_id ) || empty( $index ) ) {
781
+	if (empty($post_id) || empty($index)) {
782 782
 		return false;
783 783
 	}
784 784
 
@@ -794,9 +794,9 @@  discard block
 block discarded – undo
794 794
 
795 795
 	ppp_set_social_tokens();
796 796
 
797
-	$account = isset( $_POST['account'] ) ? $_POST['account'] : false;
797
+	$account = isset($_POST['account']) ? $_POST['account'] : false;
798 798
 
799
-	if ( !empty( $account ) ) {
799
+	if ( ! empty($account)) {
800 800
 		$ppp_social_settings['facebook']->page = $account;
801 801
 
802 802
 		update_option( 'ppp_social_settings', $ppp_social_settings );
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
 function ppp_fb_calendar_on_publish_event( $events, $post_id ) {
813 813
 	$share_on_publish = get_post_meta( $post_id, '_ppp_fb_share_on_publish', true );
814 814
 
815
-	if ( ! empty( $share_on_publish ) ) {
815
+	if ( ! empty($share_on_publish)) {
816 816
 		$share_text = get_post_meta( $post_id, '_ppp_fb_share_on_publish_title', true );
817 817
 		$events[] = array(
818
-			'id' => $post_id . '-share-on-publish',
819
-			'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ),
820
-			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
821
-			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
822
-			'className' => 'ppp-calendar-item-fb cal-post-' . $post_id,
818
+			'id' => $post_id.'-share-on-publish',
819
+			'title' => ( ! empty($share_text)) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ),
820
+			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
821
+			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
822
+			'className' => 'ppp-calendar-item-fb cal-post-'.$post_id,
823 823
 			'belongsTo' => $post_id,
824 824
 		);
825 825
 	}
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
 
831 831
 function ppp_fb_get_post_shares( $items, $post_id ) {
832 832
 	$shares = get_post_meta( $post_id, '_ppp_fb_shares', true );
833
-	if ( empty( $shares ) ) { return $items; }
833
+	if (empty($shares)) { return $items; }
834 834
 
835
-	foreach ( $shares as $key => $share ) {
835
+	foreach ($shares as $key => $share) {
836 836
 		$items[] = array( 'id' => $key, 'service' => 'fb' );
837 837
 	}
838 838
 	return $items;
Please login to merge, or discard this patch.
includes/libs/class-wp-logging.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @since       1.0
202 202
 	 *
203 203
 	 *
204
-	 * @return     array
204
+	 * @return     boolean
205 205
 	*/
206 206
 
207 207
 	private static function valid_type( $type ) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 * @uses 		wp_update_post()
300 300
 	 * @uses 		update_post_meta()
301 301
 	 *
302
-	 * @return      bool True if successful, false otherwise
302
+	 * @return      boolean|null True if successful, false otherwise
303 303
 	*/
304 304
 	public static function update_log( $log_data = array(), $log_meta = array() ) {
305 305
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @since       1.0
124 124
 	 *
125 125
 	 * @return     array
126
-	*/
126
+	 */
127 127
 
128 128
 	private static function log_types() {
129 129
 		$terms = array(
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @uses 		register_post_type()
144 144
 	 *
145 145
 	 * @return     void
146
-	*/
146
+	 */
147 147
 
148 148
 	public function register_post_type() {
149 149
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @uses 		wp_insert_term()
177 177
 	 *
178 178
 	 * @return     void
179
-	*/
179
+	 */
180 180
 
181 181
 	public function register_taxonomy() {
182 182
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 *
204 204
 	 * @return     array
205
-	*/
205
+	 */
206 206
 
207 207
 	private static function valid_type( $type ) {
208 208
 		return in_array( $type, self::log_types() );
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @uses 		self::insert_log()
222 222
 	 *
223 223
 	 * @return      int The ID of the new log entry
224
-	*/
224
+	 */
225 225
 
226 226
 	public static function add( $title = '', $message = '', $parent = 0, $type = null ) {
227 227
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @uses 		sanitize_key()
251 251
 	 *
252 252
 	 * @return      int The ID of the newly created log item
253
-	*/
253
+	 */
254 254
 
255 255
 	public static function insert_log( $log_data = array(), $log_meta = array() ) {
256 256
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @uses 		update_post_meta()
301 301
 	 *
302 302
 	 * @return      bool True if successful, false otherwise
303
-	*/
303
+	 */
304 304
 	public static function update_log( $log_data = array(), $log_meta = array() ) {
305 305
 
306 306
 		do_action( 'wp_pre_update_log', $log_id );
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 * @uses 		self::get_connected_logs()
338 338
 	 *
339 339
 	 * @return      array
340
-	*/
340
+	 */
341 341
 
342 342
 	public static function get_logs( $object_id = 0, $type = null, $paged = null ) {
343 343
 		return self::get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) );
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @uses 	self::valid_type()
360 360
 	 *
361 361
 	 * @return  array / false
362
-	*/
362
+	 */
363 363
 
364 364
 	public static function get_connected_logs( $args = array() ) {
365 365
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @uses 	self::valid_type()
408 408
 	 *
409 409
 	 * @return  int
410
-	*/
410
+	 */
411 411
 
412 412
 	public static function get_log_count( $object_id = 0, $type = null, $meta_query = null ) {
413 413
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @uses $this->get_logs_to_prune()     Returns array of posts via get_posts of logs to prune
42 42
 	 * @uses $this->prune_old_logs()        Deletes the logs that we don't want anymore
43 43
 	 */
44
-	public function prune_logs(){
44
+	public function prune_logs() {
45 45
 
46 46
 		$should_we_prune = apply_filters( 'wp_logging_should_we_prune', false );
47 47
 
48
-		if ( $should_we_prune === false ){
48
+		if ($should_we_prune === false) {
49 49
 			return;
50 50
 		}
51 51
 
52 52
 		$logs_to_prune = $this->get_logs_to_prune();
53 53
 
54
-		if ( isset( $logs_to_prune ) && ! empty( $logs_to_prune ) ){
54
+		if (isset($logs_to_prune) && ! empty($logs_to_prune)) {
55 55
 			$this->prune_old_logs( $logs_to_prune );
56 56
 		}
57 57
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @filter wp_logging_force_delete_log         Allows user to override the force delete setting which bypasses the trash
71 71
 	 */
72
-	private function prune_old_logs( $logs ){
72
+	private function prune_old_logs( $logs ) {
73 73
 
74 74
 		$force = apply_filters( 'wp_logging_force_delete_log', true );
75 75
 
76
-		foreach( $logs as $l ){
76
+		foreach ($logs as $l) {
77 77
 			wp_delete_post( $l->ID, $force );
78 78
 		}
79 79
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @filter wp_logging_prune_when           Users can change how long ago we are looking for logs to prune
94 94
 	 * @filter wp_logging_prune_query_args     Gives users access to change any query args for pruning
95 95
 	 */
96
-	private function get_logs_to_prune(){
96
+	private function get_logs_to_prune() {
97 97
 
98 98
 		$how_old = apply_filters( 'wp_logging_prune_when', '2 weeks ago' );
99 99
 
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
 
185 185
 		$types = self::log_types();
186 186
 
187
-		foreach ( $types as $type ) {
188
-			if( ! term_exists( $type, 'wp_log_type' ) ) {
187
+		foreach ($types as $type) {
188
+			if ( ! term_exists( $type, 'wp_log_type' )) {
189 189
 				wp_insert_term( $type, 'wp_log_type' );
190 190
 			}
191 191
 		}
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
 		$log_id = wp_insert_post( $args );
271 271
 
272 272
 		// set the log type, if any
273
-		if( $log_data['log_type'] && self::valid_type( $log_data['log_type'] ) ) {
273
+		if ($log_data['log_type'] && self::valid_type( $log_data['log_type'] )) {
274 274
 			wp_set_object_terms( $log_id, $log_data['log_type'], 'wp_log_type', false );
275 275
 		}
276 276
 
277 277
 
278 278
 		// set log meta, if any
279
-		if( $log_id && ! empty( $log_meta ) ) {
280
-			foreach( (array) $log_meta as $key => $meta ) {
281
-				update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
279
+		if ($log_id && ! empty($log_meta)) {
280
+			foreach ((array) $log_meta as $key => $meta) {
281
+				update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta );
282 282
 			}
283 283
 		}
284 284
 
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 		// store the log entry
317 317
 		$log_id = wp_update_post( $args );
318 318
 
319
-		if( $log_id && ! empty( $log_meta ) ) {
320
-			foreach( (array) $log_meta as $key => $meta ) {
321
-				if( ! empty( $meta ) )
322
-					update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
319
+		if ($log_id && ! empty($log_meta)) {
320
+			foreach ((array) $log_meta as $key => $meta) {
321
+				if ( ! empty($meta))
322
+					update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta );
323 323
 			}
324 324
 		}
325 325
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
 		$query_args = wp_parse_args( $args, $defaults );
376 376
 
377
-		if( $query_args['log_type'] && self::valid_type( $query_args['log_type'] ) ) {
377
+		if ($query_args['log_type'] && self::valid_type( $query_args['log_type'] )) {
378 378
 
379 379
 			$query_args['tax_query'] = array(
380 380
 				array(
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
 		$logs = get_posts( $query_args );
390 390
 
391
-		if( $logs )
391
+		if ($logs)
392 392
 			return $logs;
393 393
 
394 394
 		// no logs found
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 			'post_status'    => 'publish'
419 419
 		);
420 420
 
421
-		if( ! empty( $type ) && self::valid_type( $type ) ) {
421
+		if ( ! empty($type) && self::valid_type( $type )) {
422 422
 
423 423
 			$query_args['tax_query'] = array(
424 424
 				array(
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
 		}
432 432
 
433
-		if( ! empty( $meta_query ) ) {
433
+		if ( ! empty($meta_query)) {
434 434
 			$query_args['meta_query'] = $meta_query;
435 435
 		}
436 436
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -318,8 +318,9 @@  discard block
 block discarded – undo
318 318
 
319 319
 		if( $log_id && ! empty( $log_meta ) ) {
320 320
 			foreach( (array) $log_meta as $key => $meta ) {
321
-				if( ! empty( $meta ) )
322
-					update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
321
+				if( ! empty( $meta ) ) {
322
+									update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
323
+				}
323 324
 			}
324 325
 		}
325 326
 
@@ -388,8 +389,9 @@  discard block
 block discarded – undo
388 389
 
389 390
 		$logs = get_posts( $query_args );
390 391
 
391
-		if( $logs )
392
-			return $logs;
392
+		if( $logs ) {
393
+					return $logs;
394
+		}
393 395
 
394 396
 		// no logs found
395 397
 		return false;
Please login to merge, or discard this patch.
includes/linkedin-functions.php 3 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Registers LinkedIn as a service
24 24
  * @param  array $services The registered servcies
25
- * @return array           With LinkedIn added
25
+ * @return string[]           With LinkedIn added
26 26
  */
27 27
 function ppp_li_register_service( $services = array() ) {
28 28
 	$services[] = 'li';
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 /**
157 157
  * Add query vars for Linkedin
158 158
  * @param  array $vars Currenty Query Vars
159
- * @return array       Query vars array with linkedin added
159
+ * @return string[]       Query vars array with linkedin added
160 160
  */
161 161
 function ppp_li_query_vars( $vars ) {
162 162
 	$vars[] = 'li_access_token';
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 /**
287 287
  * Add the content box for LinkedIn in the social media settings
288 288
  * @param  array $content The existing content blocks
289
- * @return array          With LinkedIn
289
+ * @return string[]          With LinkedIn
290 290
  */
291 291
 function ppp_li_register_admin_social_content( $content ) {
292 292
 	$content[] = 'li';
@@ -497,7 +497,6 @@  discard block
 block discarded – undo
497 497
  * @since  2.3
498 498
  * @param  int $key        The key in the array
499 499
  * @param  array  $args    Arguements for the current post's share data
500
- * @param  int    $post_id The post ID being edited
501 500
  * @return void
502 501
  */
503 502
 function ppp_render_li_share_row( $key, $args = array() ) {
@@ -740,7 +739,7 @@  discard block
 block discarded – undo
740 739
  * @since  2.3
741 740
  * @param  int     $post_id      Post ID
742 741
  * @param  string  $name         The cron name
743
- * @param  boolean $scheduled    If the item is being fired by a schedule (default, true), or retrieved for display (false)
742
+ * @param  boolean $is_scheduled    If the item is being fired by a schedule (default, true), or retrieved for display (false)
744 743
  * @return string                The formatted link to the post
745 744
  */
746 745
 function ppp_li_generate_share_content( $post_id, $name, $is_scheduled = true ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -429,9 +429,12 @@
 block discarded – undo
429 429
 
430 430
 								<?php endforeach; ?>
431 431
 
432
-							<?php else: ?>
432
+							<?php else {
433
+	: ?>
433 434
 
434
-								<?php ppp_render_li_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'desc' => '', 'image' => '', 'attachment_id' => '' ) ); ?>
435
+								<?php ppp_render_li_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'desc' => '', 'image' => '', 'attachment_id' => '' ) );
436
+}
437
+?>
435 438
 
436 439
 							<?php endif; ?>
437 440
 						</tbody>
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 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_linkedin_enabled() {
13 13
 	global $ppp_social_settings;
14 14
 
15
-	if ( isset( $ppp_social_settings['linkedin'] ) && !empty( $ppp_social_settings['linkedin'] ) ) {
15
+	if (isset($ppp_social_settings['linkedin']) && ! empty($ppp_social_settings['linkedin'])) {
16 16
 		return true;
17 17
 	}
18 18
 
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function ppp_li_account_list_name( $string = '' ) {
62 62
 
63
-	if ( ppp_linkedin_enabled() ) {
63
+	if (ppp_linkedin_enabled()) {
64 64
 		global $ppp_social_settings;
65
-		$string .= $ppp_social_settings['linkedin']->firstName . ' ' . $ppp_social_settings['linkedin']->lastName;
66
-		$string .= '<br />' . $ppp_social_settings['linkedin']->headline;
65
+		$string .= $ppp_social_settings['linkedin']->firstName.' '.$ppp_social_settings['linkedin']->lastName;
66
+		$string .= '<br />'.$ppp_social_settings['linkedin']->headline;
67 67
 	}
68 68
 
69 69
 	return $string;
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function ppp_li_account_list_actions( $string = '' ) {
79 79
 
80
-	if ( ! ppp_linkedin_enabled() ) {
80
+	if ( ! ppp_linkedin_enabled()) {
81 81
 		global $ppp_linkedin_oauth, $ppp_social_settings;
82 82
 		$li_authurl = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
83 83
 
84
-		$string .= '<a class="button-primary" href="' . $li_authurl . '">' . __( 'Connect to Linkedin', 'ppp-txt' ) . '</a>';
84
+		$string .= '<a class="button-primary" href="'.$li_authurl.'">'.__( 'Connect to Linkedin', 'ppp-txt' ).'</a>';
85 85
 	} else {
86
-		$string  .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=linkedin' ) . '" >' . __( 'Disconnect from Linkedin', 'ppp-txt' ) . '</a>&nbsp;';
86
+		$string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=linkedin' ).'" >'.__( 'Disconnect from Linkedin', 'ppp-txt' ).'</a>&nbsp;';
87 87
 	}
88 88
 
89 89
 	return $string;
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
  * @return string         The HTML for the LinkedIn Extras column
97 97
  */
98 98
 function ppp_li_account_list_extras( $string ) {
99
-	if ( ppp_linkedin_enabled() ) {
99
+	if (ppp_linkedin_enabled()) {
100 100
 		global $ppp_social_settings, $ppp_options;
101
-		if ( ! empty( $ppp_options['enable_debug'] ) ) {
102
-			$days_left  = absint( round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
103
-			$refresh_in = absint( round( ( get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
101
+		if ( ! empty($ppp_options['enable_debug'])) {
102
+			$days_left  = absint( round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
103
+			$refresh_in = absint( round( (get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
104 104
 
105
-			$string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left );
106
-			$string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
105
+			$string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left );
106
+			$string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in );
107 107
 		}
108 108
 	}
109 109
 
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 function ppp_capture_linkedin_oauth() {
120 120
 	$should_capture = false;
121 121
 
122
-	if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false ) {
122
+	if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false) {
123 123
 		// Local config
124 124
 		$should_capture = true;
125 125
 	}
126 126
 
127
-	if ( isset( $_REQUEST['li_access_token'] ) ) {
127
+	if (isset($_REQUEST['li_access_token'])) {
128 128
 		// Returning from remote config
129 129
 		$should_capture = true;
130 130
 	}
131 131
 
132
-	if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) {
132
+	if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) {
133 133
 		global $ppp_linkedin_oauth;
134 134
 		$ppp_linkedin_oauth->ppp_initialize_linkedin();
135 135
 		wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) );
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 function ppp_disconnect_linkedin() {
146 146
 	global $ppp_social_settings;
147 147
 	$ppp_social_settings = get_option( 'ppp_social_settings' );
148
-	if ( isset( $ppp_social_settings['linkedin'] ) ) {
149
-		unset( $ppp_social_settings['linkedin'] );
148
+	if (isset($ppp_social_settings['linkedin'])) {
149
+		unset($ppp_social_settings['linkedin']);
150 150
 		update_option( 'ppp_social_settings', $ppp_social_settings );
151 151
 		delete_option( '_ppp_linkedin_refresh' );
152 152
 	}
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
  */
173 173
 function ppp_li_execute_refresh() {
174 174
 
175
-	if ( ! ppp_linkedin_enabled() ) {
175
+	if ( ! ppp_linkedin_enabled()) {
176 176
 		return;
177 177
 	}
178 178
 
179 179
 	$refresh_date = (int) get_option( '_ppp_linkedin_refresh', true );
180 180
 
181
-	if ( current_time( 'timestamp' ) > $refresh_date ) {
181
+	if (current_time( 'timestamp' ) > $refresh_date) {
182 182
 		add_action( 'admin_notices', 'ppp_linkedin_refresh_notice' );
183 183
 	}
184 184
 }
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function ppp_linkedin_refresh_notice() {
192 192
 
193
-	if ( ! ppp_linkedin_enabled() ) {
193
+	if ( ! ppp_linkedin_enabled()) {
194 194
 		return;
195 195
 	}
196 196
 
197
-	$has_dismissed = get_transient( 'ppp-dismiss-refresh-li' . get_current_user_id() );
198
-	if ( false !== $has_dismissed ) {
197
+	$has_dismissed = get_transient( 'ppp-dismiss-refresh-li'.get_current_user_id() );
198
+	if (false !== $has_dismissed) {
199 199
 		return;
200 200
 	}
201 201
 
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 
207 207
 	$token = $ppp_social_settings['linkedin']->access_token;
208 208
 	$url = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
209
-	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
209
+	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
210 210
 
211
-	$days_left = (int) round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS );
211
+	$days_left = (int) round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS );
212 212
 	?>
213 213
 	<div class="notice notice-warning is-dismissible" data-service="li">
214
-		<?php if ( $days_left > 0 ): ?>
214
+		<?php if ($days_left > 0): ?>
215 215
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication expires in %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p>
216
-		<?php elseif ( $days_left < 1 ): ?>
216
+		<?php elseif ($days_left < 1): ?>
217 217
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p>
218 218
 		<?php endif; ?>
219 219
 	</div>
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
  */
229 229
 function ppp_li_dismiss_notice() {
230 230
 
231
-	$nag = sanitize_key( $_POST[ 'nag' ] );
231
+	$nag = sanitize_key( $_POST['nag'] );
232 232
 
233
-	if ( $nag === $_POST[ 'nag' ] ) {
234
-		set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS );
233
+	if ($nag === $_POST['nag']) {
234
+		set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS );
235 235
 	}
236 236
 
237 237
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
  * @return void
245 245
  */
246 246
 function ppp_set_li_token_constants( $social_tokens ) {
247
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'linkedin' ) ) {
247
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'linkedin' )) {
248 248
 		define( 'LINKEDIN_KEY', $social_tokens->linkedin->api_key );
249 249
 		define( 'LINKEDIN_SECRET', $social_tokens->linkedin->secret_key );
250 250
 	}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
  */
262 262
 function ppp_li_share( $title, $description, $link, $media ) {
263 263
 	global $ppp_linkedin_oauth;
264
-	$args = array (
264
+	$args = array(
265 265
 		'title' => ppp_entities_and_slashes( $title ),
266 266
 		'description' => ppp_entities_and_slashes( $description ),
267 267
 		'submitted-url' => $link,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
  */
303 303
 function ppp_li_add_meta_tab( $tabs ) {
304 304
 	global $ppp_social_settings;
305
-	if ( ! ppp_linkedin_enabled() ) {
305
+	if ( ! ppp_linkedin_enabled()) {
306 306
 		return $tabs;
307 307
 	}
308 308
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  */
320 320
 function ppp_li_register_metabox_content( $content ) {
321 321
 	global $ppp_social_settings;
322
-	if ( ! ppp_linkedin_enabled() ) {
322
+	if ( ! ppp_linkedin_enabled()) {
323 323
 		return $content;
324 324
 	}
325 325
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function ppp_li_add_metabox_content( $post ) {
359 359
 	global $ppp_options, $ppp_share_settings;
360
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
360
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
361 361
 
362 362
 	$ppp_li_share_on_publish               = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true );
363 363
 	$ppp_share_on_publish_title            = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true );
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 
368 368
 	$show_share_on_publish = false;
369 369
 
370
-	$share_by_default      = empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? false : true;
370
+	$share_by_default      = empty($ppp_share_settings['linkedin']['share_on_publish']) ? false : true;
371 371
 
372
-	if ( $ppp_li_share_on_publish == '1' || ( $ppp_li_share_on_publish == '' && $share_by_default ) ) {
372
+	if ($ppp_li_share_on_publish == '1' || ($ppp_li_share_on_publish == '' && $share_by_default)) {
373 373
 		$show_share_on_publish = true;
374 374
 	}
375 375
 	?>
@@ -377,11 +377,11 @@  discard block
 block discarded – undo
377 377
 		<div class="ppp-post-override-wrap">
378 378
 			<p><h3><?php _e( 'Share on LinkedIn', 'ppp-txt' ); ?></h3></p>
379 379
 			<p>
380
-				<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
380
+				<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
381 381
 				<label for="ppp_li_share_on_publish"><?php _e( 'Share this post on LinkedIn&hellip;', 'ppp-txt' ); ?></label>
382 382
 				<select name="_ppp_li_share_on_publish" id="ppp_li_share_on_publish" class="ppp-toggle-share-on-publish">
383
-					<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>
384
-					<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>
383
+					<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>
384
+					<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>
385 385
 					<option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option>
386 386
 				</select>
387 387
 			</p>
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 								<th style="width: 10px;"></th>
398 398
 							</tr>
399 399
 						</thead>
400
-						<tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
400
+						<tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
401 401
 							<?php
402 402
 								$args = array(
403 403
 									'text'          => $ppp_share_on_publish_title,
@@ -409,19 +409,19 @@  discard block
 block discarded – undo
409 409
 								ppp_render_li_share_on_publish_row( $args );
410 410
 							?>
411 411
 						</tbody>
412
-						<tbody id="li-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>>
412
+						<tbody id="li-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>>
413 413
 							<?php $shares = get_post_meta( $post->ID, '_ppp_li_shares', true ); ?>
414
-							<?php if ( ! empty( $shares ) ) : ?>
414
+							<?php if ( ! empty($shares)) : ?>
415 415
 
416
-								<?php foreach ( $shares as $key => $value ) :
417
-									$date          = isset( $value['date'] )          ? $value['date']          : '';
418
-									$time          = isset( $value['time'] )          ? $value['time']          : '';
419
-									$text          = isset( $value['text'] )          ? $value['text']          : '';
420
-									$desc          = isset( $value['desc'] )          ? $value['desc']          : '';
421
-									$image         = isset( $value['image'] )         ? $value['image']         : '';
422
-									$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
416
+								<?php foreach ($shares as $key => $value) :
417
+									$date          = isset($value['date']) ? $value['date'] : '';
418
+									$time          = isset($value['time']) ? $value['time'] : '';
419
+									$text          = isset($value['text']) ? $value['text'] : '';
420
+									$desc          = isset($value['desc']) ? $value['desc'] : '';
421
+									$image         = isset($value['image']) ? $value['image'] : '';
422
+									$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
423 423
 
424
-									$args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text', 'desc', 'image','attachment_id' ), $value );
424
+									$args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'desc', 'image', 'attachment_id' ), $value );
425 425
 									?>
426 426
 
427 427
 									<?php ppp_render_li_share_row( $key, $args ); ?>
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 function ppp_render_li_share_on_publish_row( $args = array() ) {
458 458
 	global $post;
459 459
 	$readonly = $post->post_status !== 'publish' ? '' : 'readonly="readonly" ';
460
-	$disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false;
460
+	$disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false;
461 461
 	?>
462 462
 	<tr class="ppp-li-wrapper ppp-repeatable-row on-publish-row">
463 463
 		<td colspan="2" class="ppp-on-plublish-date-column">
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 	<tr>
486 486
 		<td colspan="2"></td>
487 487
 		<td colspan="3">
488
-			<textarea <?php if ( $disabled ): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc" placeholder="<?php _e( 'Link Description', 'ppp-txt' ); ?>"><?php echo esc_attr( $args['desc'] ); ?></textarea>
488
+			<textarea <?php if ($disabled): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc" placeholder="<?php _e( 'Link Description', 'ppp-txt' ); ?>"><?php echo esc_attr( $args['desc'] ); ?></textarea>
489 489
 		</td>
490 490
 	</tr>
491 491
 <?php
@@ -505,8 +505,8 @@  discard block
 block discarded – undo
505 505
 
506 506
 	$share_time = ppp_generate_timestamp( $args['date'], $args['time'] );
507 507
 	$readonly   = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false;
508
-	$no_date    = ! empty( $readonly ) ? ' hasDatepicker' : '';
509
-	$hide       = ! empty( $readonly ) ? 'display: none;' : '';
508
+	$no_date    = ! empty($readonly) ? ' hasDatepicker' : '';
509
+	$hide       = ! empty($readonly) ? 'display: none;' : '';
510 510
 	?>
511 511
 	<tr class="ppp-li-wrapper ppp-repeatable-row ppp-repeatable-linkedin scheduled-row" data-key="<?php echo esc_attr( $key ); ?>">
512 512
 		<td>
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 		</td>
537 537
 
538 538
 		<td>
539
-			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="linkedin" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
539
+			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="linkedin" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
540 540
 		</td>
541 541
 
542 542
 	</tr>
@@ -557,26 +557,26 @@  discard block
 block discarded – undo
557 557
  */
558 558
 function ppp_li_save_post_meta_boxes( $post_id, $post ) {
559 559
 
560
-	if ( ! ppp_should_save( $post_id, $post ) ) {
560
+	if ( ! ppp_should_save( $post_id, $post )) {
561 561
 		return;
562 562
 	}
563 563
 
564
-	$ppp_li_share_on_publish            = ( isset( $_REQUEST['_ppp_li_share_on_publish'] ) )               ? $_REQUEST['_ppp_li_share_on_publish']               : '-1';
565
-	$ppp_share_on_publish_title         = ( isset( $_REQUEST['_ppp_li_share_on_publish_title'] ) )         ? $_REQUEST['_ppp_li_share_on_publish_title']         : '';
566
-	$ppp_share_on_publish_desc          = ( isset( $_REQUEST['_ppp_li_share_on_publish_desc'] ) )          ? $_REQUEST['_ppp_li_share_on_publish_desc']          : '';
567
-	$ppp_share_on_publish_image_url     = ( isset( $_REQUEST['_ppp_li_share_on_publish_image_url'] ) )     ? $_REQUEST['_ppp_li_share_on_publish_image_url']     : '';
568
-	$ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_li_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : '';
564
+	$ppp_li_share_on_publish            = (isset($_REQUEST['_ppp_li_share_on_publish'])) ? $_REQUEST['_ppp_li_share_on_publish'] : '-1';
565
+	$ppp_share_on_publish_title         = (isset($_REQUEST['_ppp_li_share_on_publish_title'])) ? $_REQUEST['_ppp_li_share_on_publish_title'] : '';
566
+	$ppp_share_on_publish_desc          = (isset($_REQUEST['_ppp_li_share_on_publish_desc'])) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : '';
567
+	$ppp_share_on_publish_image_url     = (isset($_REQUEST['_ppp_li_share_on_publish_image_url'])) ? $_REQUEST['_ppp_li_share_on_publish_image_url'] : '';
568
+	$ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_li_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : '';
569 569
 
570
-	update_post_meta( $post_id, '_ppp_li_share_on_publish',               $ppp_li_share_on_publish );
571
-	update_post_meta( $post_id, '_ppp_li_share_on_publish_title',         $ppp_share_on_publish_title );
572
-	update_post_meta( $post_id, '_ppp_li_share_on_publish_desc',          $ppp_share_on_publish_desc );
573
-	update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url',     $ppp_share_on_publish_image_url );
570
+	update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish );
571
+	update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title );
572
+	update_post_meta( $post_id, '_ppp_li_share_on_publish_desc', $ppp_share_on_publish_desc );
573
+	update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url', $ppp_share_on_publish_image_url );
574 574
 	update_post_meta( $post_id, '_ppp_li_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id );
575 575
 
576
-	$li_data = ( isset( $_REQUEST['_ppp_li_shares'] ) && empty( $ppp_li_share_on_publish ) ) ? $_REQUEST['_ppp_li_shares'] : array();
577
-	foreach ( $li_data as $index => $share ) {
578
-		$li_data[ $index ]['text'] = sanitize_text_field( $share['text'] );
579
-		$li_data[ $index ]['desc'] = sanitize_text_field( $share['desc'] );
576
+	$li_data = (isset($_REQUEST['_ppp_li_shares']) && empty($ppp_li_share_on_publish)) ? $_REQUEST['_ppp_li_shares'] : array();
577
+	foreach ($li_data as $index => $share) {
578
+		$li_data[$index]['text'] = sanitize_text_field( $share['text'] );
579
+		$li_data[$index]['desc'] = sanitize_text_field( $share['desc'] );
580 580
 	}
581 581
 
582 582
 	update_post_meta( $post_id, '_ppp_li_shares', $li_data );
@@ -592,10 +592,10 @@  discard block
 block discarded – undo
592 592
  */
593 593
 function ppp_li_share_on_publish( $new_status, $old_status, $post ) {
594 594
 	global $ppp_options;
595
-	$from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_li_share_on_publish', true );
596
-	$from_post = isset( $_POST['_ppp_li_share_on_publish'] ) ? $_POST['_ppp_li_share_on_publish']: '0';
595
+	$from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_li_share_on_publish', true );
596
+	$from_post = isset($_POST['_ppp_li_share_on_publish']) ? $_POST['_ppp_li_share_on_publish'] : '0';
597 597
 
598
-	if ( '1' != $from_meta && '1' != $from_post ) {
598
+	if ('1' != $from_meta && '1' != $from_post) {
599 599
 		return;
600 600
 	}
601 601
 
@@ -608,30 +608,30 @@  discard block
 block discarded – undo
608 608
 	$image_url     = '';
609 609
 
610 610
 	// Determine if we're seeing the share on publish in meta or $_POST
611
-	if ( $from_meta && ! $from_post ) {
612
-		$title         = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title'        , true );
613
-		$desc          = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc'         , true );
611
+	if ($from_meta && ! $from_post) {
612
+		$title         = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true );
613
+		$desc          = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc', true );
614 614
 		$attachment_id = get_post_meta( $post->ID, '_ppp_li_share_on_publish_attachment_id', true );
615
-		$image_url     = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url'    , true );
615
+		$image_url     = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url', true );
616 616
 	} else {
617
-		$title         = isset( $_POST['_ppp_li_share_on_publish_title'] )         ? $_POST['_ppp_li_share_on_publish_title']         : '';
618
-		$desc          = isset( $_POST['_ppp_li_share_on_publish_desc'] )          ? $_POST['_ppp_li_share_on_publish_desc']          : false;
619
-		$attachment_id = isset( $_POST['_ppp_li_share_on_publish_attachment_id'] ) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0;
620
-		$image_url     = isset( $_POST['_ppp_li_share_on_publish_image_url'] )     ? $_POST['_ppp_li_share_on_publish_image_url']     : '';
617
+		$title         = isset($_POST['_ppp_li_share_on_publish_title']) ? $_POST['_ppp_li_share_on_publish_title'] : '';
618
+		$desc          = isset($_POST['_ppp_li_share_on_publish_desc']) ? $_POST['_ppp_li_share_on_publish_desc'] : false;
619
+		$attachment_id = isset($_POST['_ppp_li_share_on_publish_attachment_id']) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0;
620
+		$image_url     = isset($_POST['_ppp_li_share_on_publish_image_url']) ? $_POST['_ppp_li_share_on_publish_image_url'] : '';
621 621
 	}
622 622
 
623 623
 	$thumbnail = '';
624
-	if ( empty( $attachment_id ) && ! empty( $image_url ) ) {
624
+	if (empty($attachment_id) && ! empty($image_url)) {
625 625
 		$thumbnail = $image_url;
626 626
 	} else {
627 627
 		$thumbnail = ppp_post_has_media( $post->ID, 'li', true, $attachment_id );
628 628
 	}
629 629
 
630
-	$name = 'sharedate_0_' . $post->ID . '_li';
630
+	$name = 'sharedate_0_'.$post->ID.'_li';
631 631
 
632
-	$default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
632
+	$default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
633 633
 	// If an override was found, use it, otherwise try the default text content
634
-	if ( empty( $title ) && empty( $default_title ) ) {
634
+	if (empty($title) && empty($default_title)) {
635 635
 		$title = get_the_title( $post->ID );
636 636
 	}
637 637
 
@@ -665,18 +665,18 @@  discard block
 block discarded – undo
665 665
  * @param  string  $name    The name of the Cron
666 666
  * @return void
667 667
  */
668
-function ppp_li_scheduled_share(  $post_id = 0, $index = 1, $name = ''  ) {
668
+function ppp_li_scheduled_share( $post_id = 0, $index = 1, $name = '' ) {
669 669
 	global $ppp_options;
670 670
 
671 671
 	$link = ppp_generate_link( $post_id, $name );
672 672
 
673 673
 	$post_meta     = get_post_meta( $post_id, '_ppp_li_shares', true );
674
-	$this_share    = $post_meta[ $index ];
675
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
674
+	$this_share    = $post_meta[$index];
675
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
676 676
 
677 677
 	$share_message = ppp_li_build_share_message( $post_id, $name );
678 678
 
679
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
679
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
680 680
 		$media = $this_share['image'];
681 681
 	} else {
682 682
 		$use_media = ppp_li_use_media( $post_id, $index );
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
  * @return bool         Whether or not this tweet should contain a media post
713 713
  */
714 714
 function ppp_li_use_media( $post_id, $index ) {
715
-	if ( empty( $post_id ) || empty( $index ) ) {
715
+	if (empty($post_id) || empty($index)) {
716 716
 		return false;
717 717
 	}
718 718
 
@@ -745,20 +745,20 @@  discard block
 block discarded – undo
745 745
  */
746 746
 function ppp_li_generate_share_content( $post_id, $name, $is_scheduled = true ) {
747 747
 	global $ppp_options;
748
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
748
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
749 749
 	$li_shares    = get_post_meta( $post_id, '_ppp_li_shares', true );
750 750
 
751
-	if ( $is_scheduled && ! empty( $li_shares ) ) {
751
+	if ($is_scheduled && ! empty($li_shares)) {
752 752
 		$name_array    = explode( '_', $name );
753 753
 		$index         = $name_array[1];
754
-		$share_content = $li_shares[ $index ]['text'];
754
+		$share_content = $li_shares[$index]['text'];
755 755
 	}
756 756
 
757 757
 	// If an override was found, use it, otherwise try the default text content
758
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
758
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
759 759
 
760 760
 	// If the content is still empty, just use the post title
761
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
761
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
762 762
 
763 763
 	return apply_filters( 'ppp_share_content_li', $share_content, array( 'post_id' => $post_id ) );
764 764
 }
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 	$description = '';
776 776
 	$li_shares   = get_post_meta( $post_id, '_ppp_li_shares', true );
777 777
 
778
-	if ( ! empty( $li_shares[ $index ] ) ) {
779
-		$description = ! empty( $li_shares[ $index ]['desc'] ) ? $li_shares[ $index ]['desc'] : '';
778
+	if ( ! empty($li_shares[$index])) {
779
+		$description = ! empty($li_shares[$index]['desc']) ? $li_shares[$index]['desc'] : '';
780 780
 	}
781 781
 
782 782
 	return $description;
@@ -793,20 +793,20 @@  discard block
 block discarded – undo
793 793
 function ppp_li_generate_timestamps( $times, $post_id ) {
794 794
 	$li_shares = get_post_meta( $post_id, '_ppp_li_shares', true );
795 795
 
796
-	if ( empty( $li_shares ) ) {
796
+	if (empty($li_shares)) {
797 797
 		$li_shares = array();
798 798
 	}
799 799
 
800
-	foreach ( $li_shares as $key => $data ) {
801
-		if ( ! array_filter( $data ) ) {
800
+	foreach ($li_shares as $key => $data) {
801
+		if ( ! array_filter( $data )) {
802 802
 			continue;
803 803
 		}
804 804
 
805 805
 		$timestamp = ppp_generate_timestamp( $data['date'], $data['time'] );
806 806
 
807
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
808
-			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_li';
809
-			$times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_li';
807
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
808
+			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_li';
809
+			$times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_li';
810 810
 		}
811 811
 
812 812
 	}
@@ -826,14 +826,14 @@  discard block
 block discarded – undo
826 826
 function ppp_li_calendar_on_publish_event( $events, $post_id ) {
827 827
 	$share_on_publish = get_post_meta( $post_id, '_ppp_li_share_on_publish', true );
828 828
 
829
-	if ( ! empty( $share_on_publish ) ) {
829
+	if ( ! empty($share_on_publish)) {
830 830
 		$share_text = get_post_meta( $post_id, '_ppp_li_share_on_publish_title', true );
831 831
 		$events[] = array(
832
-			'id'        => $post_id . '-share-on-publish',
833
-			'title'     => ( ! empty( $share_text ) ) ? $share_text : ppp_li_generate_share_content( $post_id, null, false ),
834
-			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
835
-			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
836
-			'className' => 'ppp-calendar-item-li cal-post-' . $post_id,
832
+			'id'        => $post_id.'-share-on-publish',
833
+			'title'     => ( ! empty($share_text)) ? $share_text : ppp_li_generate_share_content( $post_id, null, false ),
834
+			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
835
+			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
836
+			'className' => 'ppp-calendar-item-li cal-post-'.$post_id,
837 837
 			'belongsTo' => $post_id,
838 838
 		);
839 839
 	}
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 
845 845
 function ppp_li_get_post_shares( $items, $post_id ) {
846 846
 	$shares = get_post_meta( $post_id, '_ppp_li_shares', true );
847
-	if ( empty( $shares ) ) { return $items; }
847
+	if (empty($shares)) { return $items; }
848 848
 
849
-	foreach ( $shares as $key => $share ) {
849
+	foreach ($shares as $key => $share) {
850 850
 		$items[] = array( 'id' => $key, 'service' => 'li' );
851 851
 	}
852 852
 	return $items;
Please login to merge, or discard this patch.
post-promoter-pro.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 	/**
322 322
 	 * Deactivates the license key
323
-	 * @return void
323
+	 * @return null|false
324 324
 	 */
325 325
 	public function deactivate_license() {
326 326
 		// listen for our activate button to be clicked
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
 	/**
366 366
 	 * Activates the license key provided
367
-	 * @return void
367
+	 * @return null|false
368 368
 	 */
369 369
 	public function activate_license() {
370 370
 		// listen for our activate button to be clicked
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 *
435 435
 	 * @since  2.3
436 436
 	 * @param  array $log_types Array of log types
437
-	 * @return array
437
+	 * @return string[]
438 438
 	 */
439 439
 	public function register_log_type( $log_types ) {
440 440
 		$types[] = 'ppp_share';
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 define( 'PPP_STORE_URL', 'https://postpromoterpro.com' );
18 18
 define( 'PPP_PLUGIN_NAME', 'Post Promoter Pro' );
19
-if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
19
+if ( ! class_exists( 'EDD_SL_Plugin_Updater' )) {
20 20
 	// load our custom updater
21
-	include( PPP_PATH . '/includes/EDD_SL_Plugin_Updater.php' );
21
+	include(PPP_PATH.'/includes/EDD_SL_Plugin_Updater.php');
22 22
 }
23 23
 
24 24
 class PostPromoterPro {
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
 	private function __construct() {
28 28
 		add_action( 'init', array( $this, 'ppp_loaddomain' ), 1 );
29 29
 
30
-		if ( ! is_callable( 'curl_init' ) ) {
30
+		if ( ! is_callable( 'curl_init' )) {
31 31
 			add_action( 'admin_notices', array( $this, 'no_curl' ) );
32 32
 		} else {
33 33
 			global $ppp_options, $ppp_social_settings, $ppp_share_settings;
34 34
 
35
-			include PPP_PATH . '/includes/general-functions.php';
36
-			include PPP_PATH . '/includes/share-functions.php';
37
-			include PPP_PATH . '/includes/cron-functions.php';
38
-			include PPP_PATH . '/includes/filters.php';
39
-			include PPP_PATH . '/includes/libs/social-loader.php';
35
+			include PPP_PATH.'/includes/general-functions.php';
36
+			include PPP_PATH.'/includes/share-functions.php';
37
+			include PPP_PATH.'/includes/cron-functions.php';
38
+			include PPP_PATH.'/includes/filters.php';
39
+			include PPP_PATH.'/includes/libs/social-loader.php';
40 40
 
41
-			if( ! class_exists( 'WP_Logging' ) ) {
42
-				include PPP_PATH . '/includes/libs/class-wp-logging.php';
41
+			if ( ! class_exists( 'WP_Logging' )) {
42
+				include PPP_PATH.'/includes/libs/class-wp-logging.php';
43 43
 			}
44 44
 
45
-			if ( is_admin() ) {
46
-				include PPP_PATH . '/includes/admin/upgrades.php';
47
-				include PPP_PATH . '/includes/admin/do-upgrades.php';
48
-				include PPP_PATH . '/includes/admin/actions.php';
49
-				include PPP_PATH . '/includes/admin/admin-pages.php';
50
-				include PPP_PATH . '/includes/admin/admin-ajax.php';
51
-				include PPP_PATH . '/includes/admin/meta-boxes.php';
52
-				include PPP_PATH . '/includes/admin/welcome.php';
53
-				include PPP_PATH . '/includes/admin/dashboard.php';
45
+			if (is_admin()) {
46
+				include PPP_PATH.'/includes/admin/upgrades.php';
47
+				include PPP_PATH.'/includes/admin/do-upgrades.php';
48
+				include PPP_PATH.'/includes/admin/actions.php';
49
+				include PPP_PATH.'/includes/admin/admin-pages.php';
50
+				include PPP_PATH.'/includes/admin/admin-ajax.php';
51
+				include PPP_PATH.'/includes/admin/meta-boxes.php';
52
+				include PPP_PATH.'/includes/admin/welcome.php';
53
+				include PPP_PATH.'/includes/admin/dashboard.php';
54 54
 			}
55 55
 
56
-			include PPP_PATH . '/install.php';
56
+			include PPP_PATH.'/install.php';
57 57
 
58 58
 			$ppp_options         = get_option( 'ppp_options' );
59 59
 			$ppp_social_settings = get_option( 'ppp_social_settings' );
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @access public
71 71
 	 */
72 72
 	public static function getInstance() {
73
-		if ( !self::$ppp_instance ) {
73
+		if ( ! self::$ppp_instance) {
74 74
 			self::$ppp_instance = new PostPromoterPro();
75 75
 		}
76 76
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	private function hooks() {
93
-		if ( is_admin() ) {
93
+		if (is_admin()) {
94 94
 			add_action( 'admin_init', array( $this, 'ppp_register_settings' ) );
95 95
 			add_action( 'admin_init', 'ppp_upgrade_plugin', 1 );
96 96
 
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 
109 109
 		add_action( 'init', array( $this, 'get_actions' ) );
110
-		add_action( 'save_post', 'ppp_schedule_share', 99, 2);
111
-		add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3);
110
+		add_action( 'save_post', 'ppp_schedule_share', 99, 2 );
111
+		add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 );
112 112
 		add_action( 'init', 'ppp_add_image_sizes' );
113 113
 		add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 );
114 114
 	}
@@ -131,15 +131,15 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook );
133 133
 
134
-		if ( ! in_array( $hook, $allowed_pages ) ) {
134
+		if ( ! in_array( $hook, $allowed_pages )) {
135 135
 			return;
136 136
 		}
137 137
 
138 138
 		wp_enqueue_script( 'jquery-ui-core' );
139 139
 		wp_enqueue_script( 'jquery-ui-datepicker' );
140 140
 
141
-		$jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js';
142
-		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
141
+		$jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js';
142
+		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
143 143
 		wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true );
144 144
 
145 145
 	}
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 
149 149
 		// List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only
150 150
 		// load ours if they don't exist
151
-		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) {
151
+		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) {
152 152
 			wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' );
153 153
 		}
154 154
 
155
-		wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION );
155
+		wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION );
156 156
 		wp_enqueue_style( 'ppp_admin_css' );
157 157
 
158 158
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @access public
166 166
 	 */
167 167
 	public function plugin_settings_links( $links, $file ) {
168
-		if ( $file != PPP_FILE ) {
168
+		if ($file != PPP_FILE) {
169 169
 			return $links;
170 170
 		}
171 171
 
@@ -259,22 +259,22 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public function plugin_updater() {
261 261
 
262
-		if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) {
262
+		if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) {
263 263
 			return;
264 264
 		}
265 265
 
266 266
 		$license_key = trim( get_option( '_ppp_license_key' ) );
267 267
 
268
-		if ( empty( $license_key ) ) {
268
+		if (empty($license_key)) {
269 269
 			add_action( 'admin_notices', array( $this, 'no_license_nag' ) );
270 270
 			return;
271 271
 		}
272 272
 
273 273
 		// setup the updater
274 274
 		$edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array(
275
-				'version'   => PPP_VERSION,         // current version number
276
-				'license'   => $license_key,        // license key (used get_option above to retrieve from DB)
277
-				'item_name' => PPP_PLUGIN_NAME,     // name of this plugin
275
+				'version'   => PPP_VERSION, // current version number
276
+				'license'   => $license_key, // license key (used get_option above to retrieve from DB)
277
+				'item_name' => PPP_PLUGIN_NAME, // name of this plugin
278 278
 				'author'    => 'Post Promoter Pro'  // author of this plugin
279 279
 			)
280 280
 		);
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	public function deactivate_license() {
306 306
 		// listen for our activate button to be clicked
307
-		if( isset( $_POST['ppp_license_deactivate'] ) ) {
307
+		if (isset($_POST['ppp_license_deactivate'])) {
308 308
 
309 309
 			// run a quick security check
310
-			if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) {
310
+			if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) {
311 311
 				return;
312 312
 			}
313 313
 			// get out if we didn't click the Activate button
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
328 328
 
329 329
 			// make sure the response came back okay
330
-			if ( is_wp_error( $response ) ) {
330
+			if (is_wp_error( $response )) {
331 331
 				return false;
332 332
 			}
333 333
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
336 336
 
337 337
 			// $license_data->license will be either "deactivated" or "failed"
338
-			if( $license_data->license == 'deactivated' ) {
338
+			if ($license_data->license == 'deactivated') {
339 339
 				delete_option( '_ppp_license_key_status' );
340 340
 			}
341 341
 
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public function activate_license() {
350 350
 		// listen for our activate button to be clicked
351
-		if( isset( $_POST['ppp_license_activate'] ) ) {
351
+		if (isset($_POST['ppp_license_activate'])) {
352 352
 
353 353
 			// run a quick security check
354
-			if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) {
354
+			if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) {
355 355
 				return;
356 356
 			}
357 357
 			// get out if we didn't click the Activate button
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
372 372
 
373 373
 			// make sure the response came back okay
374
-			if ( is_wp_error( $response ) ) {
374
+			if (is_wp_error( $response )) {
375 375
 				return false;
376 376
 			}
377 377
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	public function ppp_sanitize_license( $new ) {
394 394
 		$old = get_option( '_ppp_license_key' );
395
-		if( $old && $old != $new ) {
395
+		if ($old && $old != $new) {
396 396
 			delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate
397 397
 		}
398 398
 		return $new;
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 	 * @return void
405 405
 	 */
406 406
 	public function get_actions() {
407
-		if ( isset( $_GET['ppp_action'] ) ) {
408
-			do_action( 'ppp_' . $_GET['ppp_action'], $_GET );
407
+		if (isset($_GET['ppp_action'])) {
408
+			do_action( 'ppp_'.$_GET['ppp_action'], $_GET );
409 409
 		}
410 410
 	}
411 411
 
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function ppp_replace_text_tokens( $string, $args = array() ) {
30 30
 	$tokens = wp_list_pluck( ppp_get_text_tokens(), 'token' );
31
-	foreach ( $tokens as $key => $token ) {
32
-		$string = apply_filters( 'ppp_replace_token-' . $token, $string, $args );
31
+	foreach ($tokens as $key => $token) {
32
+		$string = apply_filters( 'ppp_replace_token-'.$token, $string, $args );
33 33
 	}
34 34
 
35 35
 	return $string;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @return string         The string with the token {post_title} replaced
44 44
  */
45 45
 function ppp_post_title_token( $string, $args ) {
46
-	if ( !isset( $args['post_id'] ) ) {
46
+	if ( ! isset($args['post_id'])) {
47 47
 		return $string;
48 48
 	}
49 49
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function ppp_generate_unique_link( $share_link, $post_id, $name ) {
73 73
 	$name_parts = explode( '_', $name );
74
-	$share_link .= strpos( $share_link, '?' ) ? '&' : '?' ;
74
+	$share_link .= strpos( $share_link, '?' ) ? '&' : '?';
75 75
 
76 76
 	$query_string_var = apply_filters( 'ppp_query_string_var', 'ppp' );
77 77
 
78
-	$share_link .= $query_string_var . '=' . $post_id . '-' . $name_parts[1];
78
+	$share_link .= $query_string_var.'='.$post_id.'-'.$name_parts[1];
79 79
 
80 80
 	return $share_link;
81 81
 }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function ppp_generate_google_utm_link( $share_link, $post_id, $name ) {
92 92
 	$name_parts = explode( '_', $name );
93
-	$service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw';
93
+	$service = isset($name_parts[3]) ? $name_parts[3] : 'tw';
94 94
 
95
-	switch( $service ) {
95
+	switch ($service) {
96 96
 		case 'li':
97 97
 			$network = 'LinkedIn';
98 98
 			break;
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 
108 108
 	$utm['source']   = $network;
109 109
 	$utm['medium']   = 'social';
110
-	$utm['term']     =  ppp_get_post_slug_by_id( $post_id );
110
+	$utm['term']     = ppp_get_post_slug_by_id( $post_id );
111 111
 	$utm['content']  = $name_parts[1]; // The day after publishing
112 112
 	$utm['campaign'] = 'PostPromoterPro';
113 113
 
114
-	$utm_string  = strpos( $share_link, '?' ) ? '&' : '?' ;
114
+	$utm_string = strpos( $share_link, '?' ) ? '&' : '?';
115 115
 	$first = true;
116
-	foreach ( $utm as $key => $value ) {
117
-		if ( !$first ) {
116
+	foreach ($utm as $key => $value) {
117
+		if ( ! $first) {
118 118
 			$utm_string .= '&';
119 119
 		}
120
-		$utm_string .= 'utm_' . $key . '=' . $value;
120
+		$utm_string .= 'utm_'.$key.'='.$value;
121 121
 		$first = false;
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
includes/admin/dashboard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 * @since  2.2.3
18 18
 	 */
19 19
 	public static function init() {
20
-		if ( ! current_user_can( 'manage_options' ) ) {
20
+		if ( ! current_user_can( 'manage_options' )) {
21 21
 			return;
22 22
 		}
23 23
 
@@ -38,34 +38,34 @@  discard block
 block discarded – undo
38 38
 		$number = self::get_count();
39 39
 		$shares = ppp_get_shceduled_crons();
40 40
 
41
-		if ( ! empty( $shares ) ) {
41
+		if ( ! empty($shares)) {
42 42
 			$limited_shares = array_slice( $shares, 0, $number, true );
43 43
 			?>
44 44
 			<div id="future-tweets" class="activity-block">
45 45
 				<h4><?php _e( 'Post-Related shares', 'ppp-tweets' ); ?></h4>
46 46
 				<ul>
47 47
 				<?php
48
-				foreach ( $limited_shares as $key => $share ) {
48
+				foreach ($limited_shares as $key => $share) {
49 49
 					$ppp_data = $share;
50 50
 					$timestamp = $ppp_data['timestamp'];
51 51
 
52 52
 					$name_parts = explode( '_', $ppp_data['args'][1] );
53
-					$service    = isset( $name_parts[3] ) ? $name_parts[3] : 'tw';
54
-					$builder    = 'ppp_' . $service . '_build_share_message';
53
+					$service    = isset($name_parts[3]) ? $name_parts[3] : 'tw';
54
+					$builder    = 'ppp_'.$service.'_build_share_message';
55 55
 
56 56
 					$post_id    = $ppp_data['args'][0];
57
-					$date       = $timestamp + ( get_option( 'gmt_offset' ) * 3600 );
57
+					$date       = $timestamp + (get_option( 'gmt_offset' ) * 3600);
58 58
 					$content    = '';
59
-					if ( function_exists( $builder ) ) {
60
-						$content    = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false );
59
+					if (function_exists( $builder )) {
60
+						$content = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false );
61 61
 					}
62 62
 
63 63
 					$regex   = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@";
64 64
 					$content = preg_replace( $regex, '', $content );
65 65
 					?>
66 66
 					<li>
67
-						<span class="meta"><i class="dashicons icon-ppp-<?php echo $service; ?>"></i>&nbsp;<?php echo date_i18n( 'M jS, ' . get_option( 'time_format' ), $date ); ?></span>
68
-						<a href="<?php echo admin_url( 'post.php?post=' . $post_id . '&action=edit' ); ?>"><?php echo $content; ?></a>
67
+						<span class="meta"><i class="dashicons icon-ppp-<?php echo $service; ?>"></i>&nbsp;<?php echo date_i18n( 'M jS, '.get_option( 'time_format' ), $date ); ?></span>
68
+						<a href="<?php echo admin_url( 'post.php?post='.$post_id.'&action=edit' ); ?>"><?php echo $content; ?></a>
69 69
 					</li>
70 70
 				<?php } ?>
71 71
 				</ul>
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 			$recent_post    = $recent_posts[0];
88 88
 			$post_type      = get_post_type_object( $recent_post['post_type'] );
89 89
 			$post_type_name = $post_type->labels->singular_name;
90
-			$edit_url       = admin_url( 'post.php?post=' . $recent_post['ID'] . '&action=edit' );
90
+			$edit_url       = admin_url( 'post.php?post='.$recent_post['ID'].'&action=edit' );
91 91
 
92
-			switch( $recent_post['post_status'] ) {
92
+			switch ($recent_post['post_status']) {
93 93
 				case 'draft':
94
-					$relative_time = __( '<a href="%s">Configure them</a> for your draft ' . $post_type_name, 'ppp-txt' );
94
+					$relative_time = __( '<a href="%s">Configure them</a> for your draft '.$post_type_name, 'ppp-txt' );
95 95
 					break;
96 96
 				case 'future':
97
-					$relative_time = __( '<a href="%s">Schedule one</a> for your upcoming ' . $post_type_name, 'ppp-txt' );
97
+					$relative_time = __( '<a href="%s">Schedule one</a> for your upcoming '.$post_type_name, 'ppp-txt' );
98 98
 					break;
99 99
 				case 'publish':
100 100
 				default:
101
-					$relative_time = __( '<a href="%s">Schedule one</a> for your most recent ' . $post_type_name, 'ppp-txt' );
101
+					$relative_time = __( '<a href="%s">Schedule one</a> for your most recent '.$post_type_name, 'ppp-txt' );
102 102
 					break;
103 103
 
104 104
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @since  2.2.3
120 120
 	 */
121 121
 	public static function config() {
122
-		if ( ! empty( $_POST['number_of_tweets'] ) ) {
122
+		if ( ! empty($_POST['number_of_tweets'])) {
123 123
 			update_option( 'ppp_dashboard_twitter_count', absint( $_POST['number_of_tweets'] ) );
124 124
 		}
125 125
 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	private static function get_count() {
140 140
 		$stored_count = get_option( 'ppp_dashboard_shares_count' );
141 141
 
142
-		$stored_count = empty( $stored_count ) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count );
142
+		$stored_count = empty($stored_count) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count );
143 143
 
144
-		return ! empty( $stored_count ) ? $stored_count : 5;
144
+		return ! empty($stored_count) ? $stored_count : 5;
145 145
 	}
146 146
 
147 147
 }
148
-add_action('wp_dashboard_setup', array('PPP_Dashboard_Shares','init') );
148
+add_action( 'wp_dashboard_setup', array( 'PPP_Dashboard_Shares', 'init' ) );
Please login to merge, or discard this patch.
includes/admin/upgrades.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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 8
 function ppp_upgrade_notices() {
9 9
 
10
-	if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades' ) ) {
10
+	if (isset($_GET['page']) && ($_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades')) {
11 11
 		return; // Don't show notices on the upgrades page
12 12
 	}
13 13
 
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 
16 16
 	// Sequential Orders was the first stepped upgrade, so check if we have a stalled upgrade
17 17
 	$resume_upgrade = ppp_maybe_resume_upgrade();
18
-	if ( ! empty( $resume_upgrade ) ) {
18
+	if ( ! empty($resume_upgrade)) {
19 19
 
20 20
 		$resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) );
21 21
 		printf(
22
-			'<div class="error"><p>' . __( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ) . '</p></div>',
22
+			'<div class="error"><p>'.__( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ).'</p></div>',
23 23
 			esc_url( $resume_url )
24 24
 		);
25 25
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 		// Include all 'Stepped' upgrade process notices in this else statement,
29 29
 		// to avoid having a pending, and new upgrade suggested at the same time
30 30
 
31
-		if ( version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' ) ) {
31
+		if (version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' )) {
32 32
 			printf(
33
-				'<div class="notice notice-info"><p>' . __( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ) . '</p></div>',
33
+				'<div class="notice notice-info"><p>'.__( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ).'</p></div>',
34 34
 				esc_url( admin_url( 'index.php?page=ppp-upgrades&ppp-upgrade=upgrade_post_meta' ) )
35 35
 			);
36 36
 		}
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 	$upgrades_executed = false;
53 53
 
54 54
 	// We don't have a version yet, so we need to run the upgrader
55
-	if ( !$ppp_version && PPP_VERSION == '1.3' ) {
55
+	if ( ! $ppp_version && PPP_VERSION == '1.3') {
56 56
 		ppp_v13_upgrades();
57 57
 		$upgrades_executed = true;
58 58
 	}
59 59
 
60
-	if ( version_compare( $ppp_version, 2.1, '<' ) ) {
60
+	if (version_compare( $ppp_version, 2.1, '<' )) {
61 61
 		ppp_v21_upgrades();
62 62
 		$upgrades_executed = true;
63 63
 	}
64 64
 
65
-	if ( $upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' ) ) {
65
+	if ($upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' )) {
66 66
 		set_transient( '_ppp_activation_redirect', '1', 60 );
67 67
 		update_option( 'ppp_version', PPP_VERSION );
68 68
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
 	$doing_upgrade = get_option( 'ppp_doing_upgrade', false );
82 82
 
83
-	if ( empty( $doing_upgrade ) ) {
83
+	if (empty($doing_upgrade)) {
84 84
 		return false;
85 85
 	}
86 86
 
@@ -96,22 +96,22 @@  discard block
 block discarded – undo
96 96
  */
97 97
 function ppp_v13_upgrades() {
98 98
 	global $ppp_share_settings;
99
-	$uq_status = ( isset( $ppp_share_settings['ppp_unique_links'] ) && $ppp_share_settings['ppp_unique_links'] == '1' ) ? $ppp_share_settings['ppp_unique_links'] : 0;
100
-	$ga_status = ( isset( $ppp_share_settings['ppp_ga_tags'] ) && $ppp_share_settings['ppp_ga_tags'] == '1' ) ? $ppp_share_settings['ppp_ga_tags'] : 0;
99
+	$uq_status = (isset($ppp_share_settings['ppp_unique_links']) && $ppp_share_settings['ppp_unique_links'] == '1') ? $ppp_share_settings['ppp_unique_links'] : 0;
100
+	$ga_status = (isset($ppp_share_settings['ppp_ga_tags']) && $ppp_share_settings['ppp_ga_tags'] == '1') ? $ppp_share_settings['ppp_ga_tags'] : 0;
101 101
 
102
-	if ( $uq_status ) {
102
+	if ($uq_status) {
103 103
 		$ppp_share_settings['analytics'] = 'unique_links';
104
-		unset( $ppp_share_settings['ppp_unique_links'] );
105
-	} elseif ( $ga_status ) {
104
+		unset($ppp_share_settings['ppp_unique_links']);
105
+	} elseif ($ga_status) {
106 106
 		$ppp_share_settings['analytics'] = 'google_analytics';
107
-		unset( $ppp_share_settings['ppp_ga_tags'] );
107
+		unset($ppp_share_settings['ppp_ga_tags']);
108 108
 	}
109 109
 
110 110
 	update_option( 'ppp_share_settings', $ppp_share_settings );
111 111
 
112 112
 	global $ppp_options;
113 113
 	$ppp_options['default_text'] = '{post_title}';
114
-	$ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on');
114
+	$ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on' );
115 115
 
116 116
 	update_option( 'ppp_options', $ppp_options );
117 117
 }
@@ -133,29 +133,29 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function ppp_v22_postmeta_upgrade() {
135 135
 
136
-	if( ! current_user_can( 'manage_options' ) ) {
136
+	if ( ! current_user_can( 'manage_options' )) {
137 137
 		wp_die( __( 'You do not have permission to do upgrades', 'ppp-txt' ), __( 'Error', 'ppp-txt' ), array( 'response' => 403 ) );
138 138
 	}
139 139
 
140 140
 	ignore_user_abort( true );
141 141
 
142
-	if ( ! ini_get( 'safe_mode' ) ) {
143
-		@set_time_limit(0);
142
+	if ( ! ini_get( 'safe_mode' )) {
143
+		@set_time_limit( 0 );
144 144
 	}
145 145
 
146 146
 	global $wpdb;
147 147
 
148 148
 
149
-	$step   = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
149
+	$step   = isset($_GET['step']) ? absint( $_GET['step'] ) : 1;
150 150
 	$number = 25;
151
-	$offset = $step == 1 ? 0 : ( $step - 1 ) * $number;
151
+	$offset = $step == 1 ? 0 : ($step - 1) * $number;
152 152
 
153
-	if ( $step < 2 ) {
153
+	if ($step < 2) {
154 154
 		// Check if we have any payments before moving on
155 155
 		$sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' LIMIT 1";
156 156
 		$has_overrides = $wpdb->get_col( $sql );
157 157
 
158
-		if( empty( $has_overrides ) ) {
158
+		if (empty($has_overrides)) {
159 159
 			// We had no payments, just complete
160 160
 			update_option( 'ppp_version', preg_replace( '/[^0-9.].*/', '', PPP_VERSION ) );
161 161
 			ppp_set_upgrade_complete( 'upgrade_post_meta' );
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 		}
165 165
 	}
166 166
 
167
-	$total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
167
+	$total = isset($_GET['total']) ? absint( $_GET['total'] ) : false;
168 168
 
169
-	if ( empty( $total ) || $total <= 1 ) {
169
+	if (empty($total) || $total <= 1) {
170 170
 		$total_sql = "SELECT COUNT(post_id) as total FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data'";
171 171
 		$results   = $wpdb->get_row( $total_sql, 0 );
172 172
 
@@ -176,48 +176,48 @@  discard block
 block discarded – undo
176 176
 	$results       = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' ORDER BY meta_id DESC LIMIT %d,%d;", $offset, $number ) );
177 177
 	$new_post_meta = array();
178 178
 
179
-	if ( $results ) {
180
-		foreach ( $results as $result ) {
179
+	if ($results) {
180
+		foreach ($results as $result) {
181 181
 
182 182
 			$share_key     = 1;
183 183
 
184 184
 			$override_data = unserialize( $result->meta_value );
185 185
 
186
-			foreach ( $override_data as $day => $values ) {
186
+			foreach ($override_data as $day => $values) {
187 187
 
188
-				if ( ! isset( $values['enabled'] ) ) {
188
+				if ( ! isset($values['enabled'])) {
189 189
 					continue;
190 190
 				}
191 191
 
192
-				$text = ! empty( $values['text'] ) ? $values['text'] : '';
193
-				$time = ! empty( $values['time'] ) ? $values['time'] : '8:00am';
192
+				$text = ! empty($values['text']) ? $values['text'] : '';
193
+				$time = ! empty($values['time']) ? $values['time'] : '8:00am';
194 194
 
195 195
 				$post          = get_post( $result->post_id );
196 196
 				$days_ahead    = substr( $day, -1 );
197
-				$date          = date( 'm\/d\/Y', strtotime( $post->post_date . '+' . $days_ahead . ' days' ) );
197
+				$date          = date( 'm\/d\/Y', strtotime( $post->post_date.'+'.$days_ahead.' days' ) );
198 198
 				$image         = '';
199 199
 				$attachment_id = '';
200 200
 
201
-				if ( ! empty( $values['use_image'] ) ) {
201
+				if ( ! empty($values['use_image'])) {
202 202
 					$thumb_id  = get_post_thumbnail_id( $result->post_id );
203 203
 					$thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-tw-share-image', true );
204 204
 
205
-					if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) {
205
+					if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) {
206 206
 						$thumb_url = $thumb_url[0];
207 207
 					}
208 208
 
209
-					if ( ! empty( $thumb_id ) && ! empty( $thumb_url ) ) {
209
+					if ( ! empty($thumb_id) && ! empty($thumb_url)) {
210 210
 						$attachment_id = $thumb_id;
211 211
 						$image         = $thumb_url;
212 212
 					}
213 213
 				}
214 214
 
215
-				$new_post_meta[$share_key] = array (
215
+				$new_post_meta[$share_key] = array(
216 216
 					'date'          => $date,
217 217
 					'time'          => $time,
218 218
 					'text'          => $text,
219
-					'image'         => ! empty( $image ) ? $image : '',
220
-					'attachment_id' => ! empty( $attachment_id ) ? $attachment_id : ''
219
+					'image'         => ! empty($image) ? $image : '',
220
+					'attachment_id' => ! empty($attachment_id) ? $attachment_id : ''
221 221
 				);
222 222
 
223 223
 				$share_key++;
Please login to merge, or discard this patch.