GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 58a702...644603 )
by Chris
04:52
created
includes/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 	 * @uses api_request()
65 65
 	 *
66 66
 	 * @param array   $_transient_data Update array build by WordPress.
67
-	 * @return array Modified update array with custom plugin data.
67
+	 * @return stdClass Modified update array with custom plugin data.
68 68
 	 */
69 69
 	function check_update( $_transient_data ) {
70 70
 
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
51 51
 		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
52 52
 
53
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
53
+		add_action( 'after_plugin_row_'.$this->name, array( $this, 'show_update_notification' ), 10, 2 );
54 54
 	}
55 55
 
56 56
 	/**
@@ -70,30 +70,30 @@  discard block
 block discarded – undo
70 70
 
71 71
 		global $pagenow;
72 72
 
73
-		if( ! is_object( $_transient_data ) ) {
73
+		if ( ! is_object( $_transient_data )) {
74 74
 			$_transient_data = new stdClass;
75 75
 		}
76 76
 
77
-		if( 'plugins.php' == $pagenow && is_multisite() ) {
77
+		if ('plugins.php' == $pagenow && is_multisite()) {
78 78
 			return $_transient_data;
79 79
 		}
80 80
 
81
-		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
81
+		if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
82 82
 
83 83
 			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
84 84
 
85
-			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
85
+			if (false !== $version_info && is_object( $version_info ) && isset($version_info->new_version)) {
86 86
 
87 87
 				$this->did_check = true;
88 88
 
89
-				if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
89
+				if (version_compare( $this->version, $version_info->new_version, '<' )) {
90 90
 
91
-					$_transient_data->response[ $this->name ] = $version_info;
91
+					$_transient_data->response[$this->name] = $version_info;
92 92
 
93 93
 				}
94 94
 
95 95
 				$_transient_data->last_checked = time();
96
-				$_transient_data->checked[ $this->name ] = $this->version;
96
+				$_transient_data->checked[$this->name] = $this->version;
97 97
 
98 98
 			}
99 99
 
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function show_update_notification( $file, $plugin ) {
112 112
 
113
-		if( ! current_user_can( 'update_plugins' ) ) {
113
+		if ( ! current_user_can( 'update_plugins' )) {
114 114
 			return;
115 115
 		}
116 116
 
117
-		if( ! is_multisite() ) {
117
+		if ( ! is_multisite()) {
118 118
 			return;
119 119
 		}
120 120
 
121
-		if ( $this->name != $file ) {
121
+		if ($this->name != $file) {
122 122
 			return;
123 123
 		}
124 124
 
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 
128 128
 		$update_cache = get_site_transient( 'update_plugins' );
129 129
 
130
-		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
130
+		if ( ! is_object( $update_cache ) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
131 131
 
132
-			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
132
+			$cache_key    = md5( 'edd_plugin_'.sanitize_key( $this->name ).'_version_info' );
133 133
 			$version_info = get_transient( $cache_key );
134 134
 
135
-			if( false === $version_info ) {
135
+			if (false === $version_info) {
136 136
 
137 137
 				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
138 138
 
@@ -140,39 +140,39 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 
142 142
 
143
-			if( ! is_object( $version_info ) ) {
143
+			if ( ! is_object( $version_info )) {
144 144
 				return;
145 145
 			}
146 146
 
147
-			if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
147
+			if (version_compare( $this->version, $version_info->new_version, '<' )) {
148 148
 
149
-				$update_cache->response[ $this->name ] = $version_info;
149
+				$update_cache->response[$this->name] = $version_info;
150 150
 
151 151
 			}
152 152
 
153 153
 			$update_cache->last_checked = time();
154
-			$update_cache->checked[ $this->name ] = $this->version;
154
+			$update_cache->checked[$this->name] = $this->version;
155 155
 
156 156
 			set_site_transient( 'update_plugins', $update_cache );
157 157
 
158 158
 		} else {
159 159
 
160
-			$version_info = $update_cache->response[ $this->name ];
160
+			$version_info = $update_cache->response[$this->name];
161 161
 
162 162
 		}
163 163
 
164 164
 		// Restore our filter
165 165
 		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
166 166
 
167
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
167
+		if ( ! empty($update_cache->response[$this->name]) && version_compare( $this->version, $version_info->new_version, '<' )) {
168 168
 
169 169
 			// build a plugin list row, with update notification
170 170
 			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
171
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
171
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
172 172
 
173
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
173
+			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911' );
174 174
 
175
-			if ( empty( $version_info->download_link ) ) {
175
+			if (empty($version_info->download_link)) {
176 176
 				printf(
177 177
 					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
178 178
 					esc_html( $version_info->name ),
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 					esc_html( $version_info->name ),
186 186
 					esc_url( $changelog_link ),
187 187
 					esc_html( $version_info->new_version ),
188
-					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
188
+					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ).$this->name, 'upgrade-plugin_'.$this->name ) )
189 189
 				);
190 190
 			}
191 191
 
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
208 208
 
209 209
 
210
-		if ( $_action != 'plugin_information' ) {
210
+		if ($_action != 'plugin_information') {
211 211
 
212 212
 			return $_data;
213 213
 
214 214
 		}
215 215
 
216
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
216
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
217 217
 
218 218
 			return $_data;
219 219
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$api_response = $this->api_request( 'plugin_information', $to_send );
232 232
 
233
-		if ( false !== $api_response ) {
233
+		if (false !== $api_response) {
234 234
 			$_data = $api_response;
235 235
 		}
236 236
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	function http_request_args( $args, $url ) {
249 249
 		// If it is an https request and we are performing a package download, disable ssl verification
250
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
250
+		if (strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' )) {
251 251
 			$args['sslverify'] = false;
252 252
 		}
253 253
 		return $args;
@@ -270,21 +270,21 @@  discard block
 block discarded – undo
270 270
 
271 271
 		$data = array_merge( $this->api_data, $_data );
272 272
 
273
-		if ( $data['slug'] != $this->slug )
273
+		if ($data['slug'] != $this->slug)
274 274
 			return;
275 275
 
276
-		if ( empty( $data['license'] ) )
276
+		if (empty($data['license']))
277 277
 			return;
278 278
 
279
-		if( $this->api_url == home_url() ) {
279
+		if ($this->api_url == home_url()) {
280 280
 			return false; // Don't allow a plugin to ping itself
281 281
 		}
282 282
 
283 283
 		$api_params = array(
284 284
 			'edd_action' => 'get_version',
285 285
 			'license'    => $data['license'],
286
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
287
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
286
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
287
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
288 288
 			'slug'       => $data['slug'],
289 289
 			'author'     => $data['author'],
290 290
 			'url'        => home_url()
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
294 294
 
295
-		if ( ! is_wp_error( $request ) ) {
295
+		if ( ! is_wp_error( $request )) {
296 296
 			$request = json_decode( wp_remote_retrieve_body( $request ) );
297 297
 		}
298 298
 
299
-		if ( $request && isset( $request->sections ) ) {
299
+		if ($request && isset($request->sections)) {
300 300
 			$request->sections = maybe_unserialize( $request->sections );
301 301
 		} else {
302 302
 			$request = false;
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
 	public function show_changelog() {
309 309
 
310 310
 
311
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
311
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
312 312
 			return;
313 313
 		}
314 314
 
315
-		if( empty( $_REQUEST['plugin'] ) ) {
315
+		if (empty($_REQUEST['plugin'])) {
316 316
 			return;
317 317
 		}
318 318
 
319
-		if( empty( $_REQUEST['slug'] ) ) {
319
+		if (empty($_REQUEST['slug'])) {
320 320
 			return;
321 321
 		}
322 322
 
323
-		if( ! current_user_can( 'update_plugins' ) ) {
323
+		if ( ! current_user_can( 'update_plugins' )) {
324 324
 			wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
325 325
 		}
326 326
 
327 327
 		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
328 328
 
329
-		if( $response && isset( $response->sections['changelog'] ) ) {
330
-			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
329
+		if ($response && isset($response->sections['changelog'])) {
330
+			echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
331 331
 		}
332 332
 
333 333
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -270,11 +270,13 @@
 block discarded – undo
270 270
 
271 271
 		$data = array_merge( $this->api_data, $_data );
272 272
 
273
-		if ( $data['slug'] != $this->slug )
274
-			return;
273
+		if ( $data['slug'] != $this->slug ) {
274
+					return;
275
+		}
275 276
 
276
-		if ( empty( $data['license'] ) )
277
-			return;
277
+		if ( empty( $data['license'] ) ) {
278
+					return;
279
+		}
278 280
 
279 281
 		if( $this->api_url == home_url() ) {
280 282
 			return false; // Don't allow a plugin to ping itself
Please login to merge, or discard this patch.
includes/facebook-functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Register 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';
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 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,7 +224,7 @@  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
 
@@ -235,14 +235,14 @@  discard block
 block discarded – undo
235 235
 
236 236
 	$token = $ppp_social_settings['facebook']->access_token;
237 237
 	$url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
238
-	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
238
+	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
239 239
 
240
-	$days_left = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
240
+	$days_left = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
241 241
 	?>
242 242
 	<div class="update-nag">
243
-		<?php if ( $days_left > 0 ): ?>
243
+		<?php if ($days_left > 0): ?>
244 244
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication expires in within %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p>
245
-		<?php elseif ( $days_left < 1 ): ?>
245
+		<?php elseif ($days_left < 1): ?>
246 246
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p>
247 247
 		<?php endif; ?>
248 248
 	</div>
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  */
278 278
 function ppp_fb_add_meta_tab( $tabs ) {
279 279
 	global $ppp_social_settings;
280
-	if ( ! ppp_facebook_enabled() ) {
280
+	if ( ! ppp_facebook_enabled()) {
281 281
 		return $tabs;
282 282
 	}
283 283
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
  */
295 295
 function ppp_fb_register_metabox_content( $content ) {
296 296
 	global $ppp_social_settings;
297
-	if ( ! ppp_facebook_enabled() ) {
297
+	if ( ! ppp_facebook_enabled()) {
298 298
 		return $content;
299 299
 	}
300 300
 
@@ -310,33 +310,33 @@  discard block
 block discarded – undo
310 310
  */
311 311
 function ppp_fb_add_metabox_content( $post ) {
312 312
 	global $ppp_options, $ppp_share_settings;
313
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
313
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
314 314
 
315 315
 	$ppp_fb_share_on_publish = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
316 316
 	$ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
317 317
 
318 318
 	$show_share_on_publish = false;
319 319
 
320
-	$share_by_default      = empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? false : true;
320
+	$share_by_default      = empty($ppp_share_settings['facebook']['share_on_publish']) ? false : true;
321 321
 
322
-	if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) {
322
+	if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) {
323 323
 		$show_share_on_publish = true;
324 324
 	}
325 325
 
326 326
 	?>
327 327
 	<p>
328
-	<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
329
-	<input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
328
+	<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
329
+	<input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
330 330
 		<label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook at the time of publishing?', 'ppp-txt' ); ?></label>
331
-		<p class="ppp_share_on_publish_text"<?php if ( false === $show_share_on_publish ) : ?> style="display: none;"<?php endif; ?>>
331
+		<p class="ppp_share_on_publish_text"<?php if (false === $show_share_on_publish) : ?> style="display: none;"<?php endif; ?>>
332 332
 			<?php _e( 'Link Message', 'ppp-txt' ); ?>:<br />
333 333
 				<input
334
-				<?php if ( $disabled ): ?>readonly<?php endif; ?>
334
+				<?php if ($disabled): ?>readonly<?php endif; ?>
335 335
 				class="ppp-share-text"
336 336
 				type="text"
337 337
 				placeholder="<?php echo esc_attr( $default_text ); ?>"
338 338
 				name="_ppp_fb_share_on_publish_title"
339
-				<?php if ( isset( $ppp_share_on_publish_title ) ) {?>value="<?php echo esc_attr( $ppp_share_on_publish_title ); ?>"<?php ;}?>
339
+				<?php if (isset($ppp_share_on_publish_title)) {?>value="<?php echo esc_attr( $ppp_share_on_publish_title ); ?>"<?php; }?>
340 340
 			/>
341 341
 				<span id="ppp-fb-image">
342 342
 					<br /><br />
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function ppp_fb_save_post_meta_boxes( $post_id, $post ) {
359 359
 
360
-	if ( ! ppp_should_save( $post_id, $post ) ) {
360
+	if ( ! ppp_should_save( $post_id, $post )) {
361 361
 		return;
362 362
 	}
363 363
 
364
-	$ppp_fb_share_on_publish = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish'] : '0';
365
-	$ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : '';
364
+	$ppp_fb_share_on_publish = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '0';
365
+	$ppp_share_on_publish_title = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : '';
366 366
 
367 367
 	update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish );
368 368
 	update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title );
@@ -379,37 +379,37 @@  discard block
 block discarded – undo
379 379
 function ppp_fb_share_on_publish( $new_status, $old_status, $post ) {
380 380
 	global $ppp_options;
381 381
 	$from_meta = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true );
382
-	$from_post = isset( $_POST['_ppp_fb_share_on_publish'] );
382
+	$from_post = isset($_POST['_ppp_fb_share_on_publish']);
383 383
 
384
-	if ( empty( $from_meta ) && empty( $from_post ) ) {
384
+	if (empty($from_meta) && empty($from_post)) {
385 385
 		return;
386 386
 	}
387 387
 
388 388
 	// Determine if we're seeing the share on publish in meta or $_POST
389
-	if ( $from_meta && !$from_post ) {
389
+	if ($from_meta && ! $from_post) {
390 390
 		$ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true );
391 391
 	} else {
392
-		$ppp_share_on_publish_title = isset( $_POST['_ppp_fb_share_on_publish_title'] ) ? $_POST['_ppp_fb_share_on_publish_title'] : '';
392
+		$ppp_share_on_publish_title = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : '';
393 393
 	}
394 394
 
395 395
 	$thumbnail = ppp_post_has_media( $post->ID, 'fb', true );
396 396
 
397
-	$name = 'sharedate_0_' . $post->ID . '_fb';
397
+	$name = 'sharedate_0_'.$post->ID.'_fb';
398 398
 
399
-	$default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
399
+	$default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
400 400
 	// If an override was found, use it, otherwise try the default text content
401
-	$share_title = ( isset( $ppp_share_on_publish_title ) && !empty( $ppp_share_on_publish_title ) ) ? $ppp_share_on_publish_title : $default_title;
401
+	$share_title = (isset($ppp_share_on_publish_title) && ! empty($ppp_share_on_publish_title)) ? $ppp_share_on_publish_title : $default_title;
402 402
 
403 403
 	// If the content is still empty, just use the post title
404
-	$share_title = ( isset( $share_title ) && !empty( $share_title ) ) ? $share_title : get_the_title( $post->ID );
404
+	$share_title = (isset($share_title) && ! empty($share_title)) ? $share_title : get_the_title( $post->ID );
405 405
 
406 406
 	$share_title = apply_filters( 'ppp_share_content', $share_title, array( 'post_id' => $post->ID ) );
407 407
 	$share_link = ppp_generate_link( $post->ID, $name, true );
408 408
 
409 409
 	$status['facebook'] = ppp_fb_share( $share_link, $share_title, $thumbnail );
410 410
 
411
-	if ( isset( $ppp_options['enable_debug'] ) && $ppp_options['enable_debug'] == '1' ) {
412
-		update_post_meta( $post->ID, '_ppp-' . $name . '-status', $status );
411
+	if (isset($ppp_options['enable_debug']) && $ppp_options['enable_debug'] == '1') {
412
+		update_post_meta( $post->ID, '_ppp-'.$name.'-status', $status );
413 413
 	}
414 414
 }
415 415
 add_action( 'ppp_share_on_publish', 'ppp_fb_share_on_publish', 10, 3 );
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 
425 425
 	ppp_set_social_tokens();
426 426
 
427
-	$account = isset( $_POST['account'] ) ? $_POST['account'] : false;
427
+	$account = isset($_POST['account']) ? $_POST['account'] : false;
428 428
 
429
-	if ( !empty( $account ) ) {
429
+	if ( ! empty($account)) {
430 430
 		$ppp_social_settings['facebook']->page = $account;
431 431
 
432 432
 		update_option( 'ppp_social_settings', $ppp_social_settings );
Please login to merge, or discard this patch.
includes/general-functions.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 /**
9 9
  * Checks to see if a session is set and it's appropriate to start one, and starts it if necessary
10
- * @return void
10
+ * @return boolean
11 11
  */
12 12
 function ppp_maybe_start_session() {
13 13
 	$ret = false;
@@ -73,6 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 /**
75 75
  * Strips slashes and html_entities_decode for sending to the networks.
76
+ * @param string $string
76 77
  */
77 78
 function ppp_entities_and_slashes( $string ) {
78 79
 	return stripslashes( html_entity_decode( $string, ENT_COMPAT, 'UTF-8' ) );
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function ppp_maybe_start_session() {
13 13
 	$ret = false;
14
-	if ( ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) && !isset( $_SESSION ) && !defined( 'DOING_AJAX' ) ) {
14
+	if ((is_admin() || (defined( 'DOING_CRON' ) && DOING_CRON)) && ! isset($_SESSION) && ! defined( 'DOING_AJAX' )) {
15 15
 		$ret = session_start();
16 16
 	}
17 17
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	global $ppp_share_settings;
27 27
 	$result = false;
28 28
 
29
-	if ( isset( $ppp_share_settings['analytics'] ) && $ppp_share_settings['analytics'] !== 'none' ) {
30
-		$result =  true;
29
+	if (isset($ppp_share_settings['analytics']) && $ppp_share_settings['analytics'] !== 'none') {
30
+		$result = true;
31 31
 	}
32 32
 
33 33
 	return apply_filters( 'ppp_is_link_tracking_enabled', $result );
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 function ppp_is_shortener_enabled() {
69 69
 	global $ppp_share_settings;
70 70
 
71
-	return ( isset( $ppp_share_settings['shortener'] ) && !empty( $ppp_share_settings['shortener'] ) && $ppp_share_settings != '-1' );
71
+	return (isset($ppp_share_settings['shortener']) && ! empty($ppp_share_settings['shortener']) && $ppp_share_settings != '-1');
72 72
 }
73 73
 
74 74
 /**
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
 function ppp_should_save( $post_id, $post ) {
108 108
 	$ret = true;
109 109
 
110
-	if ( empty( $_POST ) ) {
110
+	if (empty($_POST)) {
111 111
 		$ret = false;
112 112
 	}
113 113
 
114
-	if ( wp_is_post_revision( $post_id ) ) {
114
+	if (wp_is_post_revision( $post_id )) {
115 115
 		$ret = false;
116 116
 	}
117 117
 
118 118
 	global $ppp_options;
119
-	if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) || !array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) {
119
+	if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] ) || ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) {
120 120
 		$ret = false;
121 121
 	}
122 122
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 function ppp_set_uploads_dir() {
133 133
 	$upload_path = ppp_get_upload_path();
134 134
 
135
-	if ( false === get_transient( 'ppp_check_protection_files' ) ) {
135
+	if (false === get_transient( 'ppp_check_protection_files' )) {
136 136
 
137 137
 		// Make sure the /ppp folder is created
138 138
 		wp_mkdir_p( $upload_path );
@@ -141,22 +141,22 @@  discard block
 block discarded – undo
141 141
 		$rules  = "Options -Indexes\n";
142 142
 		$rules .= "deny from all\n";
143 143
 
144
-		$htaccess_exists = file_exists( $upload_path . '/.htaccess' );
144
+		$htaccess_exists = file_exists( $upload_path.'/.htaccess' );
145 145
 
146
-		if ( $htaccess_exists ) {
147
-			$contents = @file_get_contents( $upload_path . '/.htaccess' );
148
-			if ( $contents !== $rules || ! $contents ) {
146
+		if ($htaccess_exists) {
147
+			$contents = @file_get_contents( $upload_path.'/.htaccess' );
148
+			if ($contents !== $rules || ! $contents) {
149 149
 				// Update the .htaccess rules if they don't match
150
-				@file_put_contents( $upload_path . '/.htaccess', $rules );
150
+				@file_put_contents( $upload_path.'/.htaccess', $rules );
151 151
 			}
152
-		} elseif( wp_is_writable( $upload_path ) ) {
152
+		} elseif (wp_is_writable( $upload_path )) {
153 153
 			// Create the file if it doesn't exist
154
-			@file_put_contents( $upload_path . '/.htaccess', $rules );
154
+			@file_put_contents( $upload_path.'/.htaccess', $rules );
155 155
 		}
156 156
 
157 157
 		// Top level blank index.php
158
-		if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) {
159
-			@file_put_contents( $upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.' );
158
+		if ( ! file_exists( $upload_path.'/index.php' ) && wp_is_writable( $upload_path )) {
159
+			@file_put_contents( $upload_path.'/index.php', '<?php'.PHP_EOL.'// Silence is golden.' );
160 160
 		}
161 161
 
162 162
 		// Check for the files once per day
@@ -173,5 +173,5 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function ppp_get_upload_path() {
175 175
 	$wp_upload_dir = wp_upload_dir();
176
-	return $wp_upload_dir['basedir'] . '/ppp';
176
+	return $wp_upload_dir['basedir'].'/ppp';
177 177
 }
Please login to merge, or discard this patch.
includes/linkedin-functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * 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';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 /**
264 264
  * Add the content box for LinkedIn in the social media settings
265 265
  * @param  array $content The existing content blocks
266
- * @return array          With LinkedIn
266
+ * @return string[]          With LinkedIn
267 267
  */
268 268
 function ppp_li_register_admin_social_content( $content ) {
269 269
 	$content[] = 'li';
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 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,7 +190,7 @@  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
 
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 
202 202
 	$token = $ppp_social_settings['linkedin']->access_token;
203 203
 	$url = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) );
204
-	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url );
204
+	$url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url );
205 205
 
206
-	$days_left = absint( round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) );
206
+	$days_left = absint( round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) );
207 207
 	?>
208 208
 	<div class="update-nag">
209
-		<?php if ( $days_left > 0 ): ?>
209
+		<?php if ($days_left > 0): ?>
210 210
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication expires in within %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p>
211
-		<?php elseif ( $days_left < 1 ): ?>
211
+		<?php elseif ($days_left < 1): ?>
212 212
 			<p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p>
213 213
 		<?php endif; ?>
214 214
 	</div>
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
  * @return void
222 222
  */
223 223
 function ppp_set_li_token_constants( $social_tokens ) {
224
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'linkedin' ) ) {
224
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'linkedin' )) {
225 225
 		define( 'LINKEDIN_KEY', $social_tokens->linkedin->api_key );
226 226
 		define( 'LINKEDIN_SECRET', $social_tokens->linkedin->secret_key );
227 227
 	}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  */
239 239
 function ppp_li_share( $title, $description, $link, $media ) {
240 240
 	global $ppp_linkedin_oauth;
241
-	$args = array (
241
+	$args = array(
242 242
 		'title' => ppp_entities_and_slashes( $title ),
243 243
 		'description' => ppp_entities_and_slashes( $description ),
244 244
 		'submitted-url' => $link,
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
  */
280 280
 function ppp_li_add_meta_tab( $tabs ) {
281 281
 	global $ppp_social_settings;
282
-	if ( ! ppp_linkedin_enabled() ) {
282
+	if ( ! ppp_linkedin_enabled()) {
283 283
 		return $tabs;
284 284
 	}
285 285
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  */
297 297
 function ppp_li_register_metabox_content( $content ) {
298 298
 	global $ppp_social_settings;
299
-	if ( ! ppp_linkedin_enabled() ) {
299
+	if ( ! ppp_linkedin_enabled()) {
300 300
 		return $content;
301 301
 	}
302 302
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
  */
322 322
 function ppp_li_add_metabox_content( $post ) {
323 323
 	global $ppp_options, $ppp_share_settings;
324
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
324
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
325 325
 
326 326
 	$ppp_li_share_on_publish = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true );
327 327
 	$ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true );
@@ -329,32 +329,32 @@  discard block
 block discarded – undo
329 329
 
330 330
 	$show_share_on_publish = false;
331 331
 
332
-	$share_by_default      = empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? false : true;
332
+	$share_by_default      = empty($ppp_share_settings['linkedin']['share_on_publish']) ? false : true;
333 333
 
334
-	if ( $ppp_li_share_on_publish == '1' || ( $ppp_li_share_on_publish == '' && $share_by_default ) ) {
334
+	if ($ppp_li_share_on_publish == '1' || ($ppp_li_share_on_publish == '' && $share_by_default)) {
335 335
 		$show_share_on_publish = true;
336 336
 	}
337 337
 	?>
338 338
 	<p>
339
-	<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
340
-	<input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_li_share_on_publish" id="ppp_li_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
339
+	<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
340
+	<input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_li_share_on_publish" id="ppp_li_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
341 341
 		<label for="ppp_li_share_on_publish"><?php _e( 'Share this post on LinkedIn at the time of publishing?', 'ppp-txt' ); ?></label>
342
-		<p class="ppp_share_on_publish_text"<?php if ( false === $show_share_on_publish ) : ?> style="display: none;"<?php endif; ?>
342
+		<p class="ppp_share_on_publish_text"<?php if (false === $show_share_on_publish) : ?> style="display: none;"<?php endif; ?>
343 343
 				<span class="left" id="ppp-li-image">
344 344
 					<?php echo get_the_post_thumbnail( $post->ID, 'ppp-li-share-image', array( 'class' => 'left' ) ); ?>
345 345
 				</span>
346 346
 				<?php _e( 'Link Title', 'ppp-txt' ); ?>:<br />
347 347
 				<input
348
-				<?php if ( $disabled ): ?>readonly<?php endif; ?>
348
+				<?php if ($disabled): ?>readonly<?php endif; ?>
349 349
 				class="ppp-share-text"
350 350
 				type="text"
351 351
 				placeholder="<?php echo esc_attr( $default_text ); ?>"
352 352
 				name="_ppp_li_share_on_publish_title"
353
-				<?php if ( isset( $ppp_share_on_publish_title ) ) {?>value="<?php echo esc_attr( $ppp_share_on_publish_title ); ?>"<?php ;}?>
353
+				<?php if (isset($ppp_share_on_publish_title)) {?>value="<?php echo esc_attr( $ppp_share_on_publish_title ); ?>"<?php; }?>
354 354
 			/>
355 355
 			<br />
356 356
 			<?php _e( 'Link Description', 'ppp-txt' ); ?>:<br />
357
-			<textarea <?php if ( $disabled ): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc"><?php echo esc_attr( $ppp_share_on_publish_desc ); ?></textarea>
357
+			<textarea <?php if ($disabled): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc"><?php echo esc_attr( $ppp_share_on_publish_desc ); ?></textarea>
358 358
 			<br /><?php _e( 'Note: If set, the Featured image will be attached to this share', 'ppp-txt' ); ?>
359 359
 		</p>
360 360
 	</p>
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
  */
371 371
 function ppp_li_save_post_meta_boxes( $post_id, $post ) {
372 372
 
373
-	if ( ! ppp_should_save( $post_id, $post ) ) {
373
+	if ( ! ppp_should_save( $post_id, $post )) {
374 374
 		return;
375 375
 	}
376 376
 
377
-	$ppp_li_share_on_publish = ( isset( $_REQUEST['_ppp_li_share_on_publish'] ) ) ? $_REQUEST['_ppp_li_share_on_publish'] : '0';
378
-	$ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_li_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_title'] : '';
379
-	$ppp_share_on_publish_desc = ( isset( $_REQUEST['_ppp_li_share_on_publish_desc'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : '';
377
+	$ppp_li_share_on_publish = (isset($_REQUEST['_ppp_li_share_on_publish'])) ? $_REQUEST['_ppp_li_share_on_publish'] : '0';
378
+	$ppp_share_on_publish_title = (isset($_REQUEST['_ppp_li_share_on_publish_title'])) ? $_REQUEST['_ppp_li_share_on_publish_title'] : '';
379
+	$ppp_share_on_publish_desc = (isset($_REQUEST['_ppp_li_share_on_publish_desc'])) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : '';
380 380
 
381 381
 	update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish );
382 382
 	update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title );
@@ -396,39 +396,39 @@  discard block
 block discarded – undo
396 396
 function ppp_li_share_on_publish( $new_status, $old_status, $post ) {
397 397
 	global $ppp_options;
398 398
 	$from_meta = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true );
399
-	$from_post = isset( $_POST['_ppp_li_share_on_publish'] );
399
+	$from_post = isset($_POST['_ppp_li_share_on_publish']);
400 400
 
401
-	if ( empty( $from_meta ) && empty( $from_post ) ) {
401
+	if (empty($from_meta) && empty($from_post)) {
402 402
 		return;
403 403
 	}
404 404
 
405 405
 	// Determine if we're seeing the share on publish in meta or $_POST
406
-	if ( $from_meta && !$from_post ) {
406
+	if ($from_meta && ! $from_post) {
407 407
 		$ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true );
408 408
 		$ppp_share_on_publish_desc = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc', true );
409 409
 	} else {
410
-		$ppp_share_on_publish_title = isset( $_POST['_ppp_li_share_on_publish_title'] ) ? $_POST['_ppp_li_share_on_publish_title'] : '';
411
-		$ppp_share_on_publish_desc = isset( $_POST['_ppp_li_share_on_publish_desc'] ) ? $_POST['_ppp_li_share_on_publish_desc'] : false;
410
+		$ppp_share_on_publish_title = isset($_POST['_ppp_li_share_on_publish_title']) ? $_POST['_ppp_li_share_on_publish_title'] : '';
411
+		$ppp_share_on_publish_desc = isset($_POST['_ppp_li_share_on_publish_desc']) ? $_POST['_ppp_li_share_on_publish_desc'] : false;
412 412
 	}
413 413
 
414 414
 	$thumbnail = ppp_post_has_media( $post->ID, 'li', true );
415 415
 
416
-	$name = 'sharedate_0_' . $post->ID . '_li';
416
+	$name = 'sharedate_0_'.$post->ID.'_li';
417 417
 
418
-	$default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
418
+	$default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
419 419
 	// If an override was found, use it, otherwise try the default text content
420
-	$share_title = ( isset( $ppp_share_on_publish_title ) && !empty( $ppp_share_on_publish_title ) ) ? $ppp_share_on_publish_title : $default_title;
420
+	$share_title = (isset($ppp_share_on_publish_title) && ! empty($ppp_share_on_publish_title)) ? $ppp_share_on_publish_title : $default_title;
421 421
 
422 422
 	// If the content is still empty, just use the post title
423
-	$share_title = ( isset( $share_title ) && !empty( $share_title ) ) ? $share_title : get_the_title( $post->ID );
423
+	$share_title = (isset($share_title) && ! empty($share_title)) ? $share_title : get_the_title( $post->ID );
424 424
 
425 425
 	$share_title = apply_filters( 'ppp_share_content', $share_title, array( 'post_id' => $post->ID ) );
426 426
 	$share_link = ppp_generate_link( $post->ID, $name, true );
427 427
 
428 428
 	$status['linkedin'] = ppp_li_share( $share_title, $ppp_share_on_publish_desc, $share_link, $thumbnail );
429 429
 
430
-	if ( isset( $ppp_options['enable_debug'] ) && $ppp_options['enable_debug'] == '1' ) {
431
-		update_post_meta( $post->ID, '_ppp-' . $name . '-status', $status );
430
+	if (isset($ppp_options['enable_debug']) && $ppp_options['enable_debug'] == '1') {
431
+		update_post_meta( $post->ID, '_ppp-'.$name.'-status', $status );
432 432
 	}
433 433
 }
434 434
 add_action( 'ppp_share_on_publish', 'ppp_li_share_on_publish', 10, 3 );
Please login to merge, or discard this patch.
includes/share-functions.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @param string $old_status The old status of the poast
13 13
  * @param  object $post      The Post Object
14 14
  *
15
- * @return void
15
+ * @return null|boolean
16 16
  */
17 17
 function ppp_share_on_publish( $new_status, $old_status, $post ) {
18 18
 	// don't publish password protected posts
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
 /**
139 139
  * Get the Social Share Tokens from the API
140
- * @return void
140
+ * @return null|false
141 141
  */
142 142
 function ppp_set_social_tokens() {
143 143
 	if ( ( defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' ) ) ||
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@
 block discarded – undo
141 141
  */
142 142
 function ppp_set_social_tokens() {
143 143
 	if ( ( defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' ) ) ||
144
-	     ( defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' ) ) ||
145
-	     ( defined( 'bitly_clientid' ) && defined( 'bitly_secret' ) ) ||
146
-	     ( defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ) )
144
+		 ( defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' ) ) ||
145
+		 ( defined( 'bitly_clientid' ) && defined( 'bitly_secret' ) ) ||
146
+		 ( defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ) )
147 147
 	   ) {
148 148
 		return;
149 149
 	}
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 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
 
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function ppp_share_on_publish( $new_status, $old_status, $post ) {
18 18
 	// don't publish password protected posts
19
-	if ( '' !== $post->post_password ) {
19
+	if ('' !== $post->post_password) {
20 20
 		return;
21 21
 	}
22 22
 
23
-	if ( $new_status == 'publish' && $old_status != 'publish' ) {
23
+	if ($new_status == 'publish' && $old_status != 'publish') {
24 24
 		global $ppp_options;
25 25
 
26
-		$allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array();
26
+		$allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array();
27 27
 		$allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types );
28 28
 
29
-		if ( !isset( $post->post_status ) || !array_key_exists( $post->post_type, $allowed_post_types ) ) {
29
+		if ( ! isset($post->post_status) || ! array_key_exists( $post->post_type, $allowed_post_types )) {
30 30
 			return false;
31 31
 		}
32 32
 
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
  */
44 44
 function ppp_get_timestamps( $post_id ) {
45 45
 	// Make the timestamp in the users' timezone, b/c that makes more sense
46
-	$offset = (int) -( get_option( 'gmt_offset' ) );
46
+	$offset = (int) -(get_option( 'gmt_offset' ));
47 47
 
48 48
 	$ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true );
49 49
 
50
-	if ( empty( $ppp_tweets ) ) {
50
+	if (empty($ppp_tweets)) {
51 51
 		$ppp_tweets = array();
52 52
 	}
53 53
 
54 54
 	$times = array();
55
-	foreach ( $ppp_tweets as $key => $data ) {
56
-		if ( ! array_filter( $data ) ) {
55
+	foreach ($ppp_tweets as $key => $data) {
56
+		if ( ! array_filter( $data )) {
57 57
 			continue;
58 58
 		}
59 59
 
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		$minutes = (int) substr( $share_time[1], 0, 2 );
63 63
 		$ampm = strtolower( substr( $share_time[1], -2 ) );
64 64
 
65
-		if ( $ampm == 'pm' && $hours != 12 ) {
65
+		if ($ampm == 'pm' && $hours != 12) {
66 66
 			$hours = $hours + 12;
67 67
 		}
68 68
 
69
-		if ( $ampm == 'am' && $hours == 12 ) {
69
+		if ($ampm == 'am' && $hours == 12) {
70 70
 			$hours = 00;
71 71
 		}
72 72
 
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 		$date      = explode( '/', $data['date'] );
75 75
 		$timestamp = mktime( $hours, $minutes, 0, $date[0], $date[1], $date[2] );
76 76
 
77
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
78
-			$times[strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) )] = 'sharedate_' . $key . '_' . $post_id;
77
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
78
+			$times[strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) )] = 'sharedate_'.$key.'_'.$post_id;
79 79
 		}
80 80
 
81 81
 	}
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 
95 95
 	// If we've already started to share this, don't share it again.
96 96
 	// Compensates for wp-cron's race conditions
97
-	if ( get_transient( 'ppp_sharing' . $name ) === 'true' ) {
97
+	if (get_transient( 'ppp_sharing'.$name ) === 'true') {
98 98
 		return;
99 99
 	}
100 100
 
101 101
 	// For 60 seconds, don't allow another share to go for this post
102
-	set_transient( 'ppp_sharing' . $name, 'true', 60 );
102
+	set_transient( 'ppp_sharing'.$name, 'true', 60 );
103 103
 
104 104
 	$share_message = ppp_tw_build_share_message( $post_id, $name );
105 105
 
106 106
 	$name_parts    = explode( '_', $name );
107 107
 	$post_meta     = get_post_meta( $post_id, '_ppp_tweets', true );
108 108
 	$this_share    = $post_meta[$name_parts[1]];
109
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
109
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
110 110
 
111
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
111
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
112 112
 		$media = $this_share['image'];
113 113
 	} else {
114 114
 		$media = ppp_post_has_media( $post_id, 'tw', ppp_tw_use_media( $post_id, $name_parts[1] ), $attachment_id );
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 
119 119
 	$status['twitter'] = ppp_send_tweet( $share_message, $post_id, $media );
120 120
 
121
-	if ( ! empty( $status['twitter']->id_str ) ) {
121
+	if ( ! empty($status['twitter']->id_str)) {
122 122
 		$post      = get_post( $post_id );
123 123
 		$author_id = $post->post_author;
124 124
 		$author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true );
125 125
 
126
-		if ( $author_rt ) {
126
+		if ($author_rt) {
127 127
 			$twitter_user = new PPP_Twitter_User( $author_id );
128 128
 			$twitter_user->retweet( $status['twitter']->id_str );
129 129
 		}
130 130
 
131 131
 	}
132 132
 
133
-	if ( isset( $ppp_options['enable_debug'] ) && $ppp_options['enable_debug'] == '1' ) {
134
-		update_post_meta( $post_id, '_ppp-' . $name . '-status', $status );
133
+	if (isset($ppp_options['enable_debug']) && $ppp_options['enable_debug'] == '1') {
134
+		update_post_meta( $post_id, '_ppp-'.$name.'-status', $status );
135 135
 	}
136 136
 }
137 137
 
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
  * @return void
141 141
  */
142 142
 function ppp_set_social_tokens() {
143
-	if ( ( defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' ) ) ||
144
-	     ( defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' ) ) ||
145
-	     ( defined( 'bitly_clientid' ) && defined( 'bitly_secret' ) ) ||
146
-	     ( defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ) )
143
+	if ((defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' )) ||
144
+	     (defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' )) ||
145
+	     (defined( 'bitly_clientid' ) && defined( 'bitly_secret' )) ||
146
+	     (defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ))
147 147
 	   ) {
148 148
 		return;
149 149
 	}
150 150
 
151 151
 	$social_tokens = ppp_has_local_tokens();
152 152
 
153
-	if ( false === $social_tokens ) {
153
+	if (false === $social_tokens) {
154 154
 		define( 'PPP_LOCAL_TOKENS', false );
155 155
 		$social_tokens = get_transient( 'ppp_social_tokens' );
156 156
 
157
-		if ( ! $social_tokens ) {
157
+		if ( ! $social_tokens) {
158 158
 			$license = trim( get_option( '_ppp_license_key' ) );
159
-			$url = PPP_STORE_URL . '/?ppp-get-tokens&ppp-license-key=' . $license . '&ver=' . md5( time() . $license );
159
+			$url = PPP_STORE_URL.'/?ppp-get-tokens&ppp-license-key='.$license.'&ver='.md5( time().$license );
160 160
 			$response = wp_remote_get( $url, array( 'timeout' => 15, 'sslverify' => false ) );
161 161
 
162
-			if ( is_wp_error( $response ) ) {
162
+			if (is_wp_error( $response )) {
163 163
 				return false;
164 164
 			}
165 165
 
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 		define( 'PPP_LOCAL_TOKENS', true );
172 172
 		delete_transient( 'ppp_social_tokens' );
173 173
 
174
-		if ( isset( $social_tokens->options ) ) {
175
-			foreach ( $social_tokens->options as $constant => $value ) {
174
+		if (isset($social_tokens->options)) {
175
+			foreach ($social_tokens->options as $constant => $value) {
176 176
 
177 177
 				$constant = strtoupper( $constant );
178 178
 
179
-				if ( defined( $constant ) ) {
179
+				if (defined( $constant )) {
180 180
 					continue;
181 181
 				}
182 182
 
183
-				switch( $constant ) {
183
+				switch ($constant) {
184 184
 
185 185
 					case 'NO_AUTO_UPDATE':
186 186
 						// Avoid the call to the API to check for software updates
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		}
194 194
 	}
195 195
 
196
-	if ( false === PPP_LOCAL_TOKENS && ! isset( $social_tokens->error ) && ( isset( $social_tokens->twitter ) || isset( $social_tokens->facebook ) || isset( $social_tokens->linkedin ) ) ) {
196
+	if (false === PPP_LOCAL_TOKENS && ! isset($social_tokens->error) && (isset($social_tokens->twitter) || isset($social_tokens->facebook) || isset($social_tokens->linkedin))) {
197 197
 		set_transient( 'ppp_social_tokens', $social_tokens, WEEK_IN_SECONDS );
198 198
 	}
199 199
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function ppp_has_local_tokens() {
208 208
 
209
-	$token_file   = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path() . '/ppp-social-tokens.json' );
209
+	$token_file   = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path().'/ppp-social-tokens.json' );
210 210
 	$local_tokens = false;
211 211
 
212
-	if ( ! file_exists( $token_file ) ) {
212
+	if ( ! file_exists( $token_file )) {
213 213
 		return $local_tokens;
214 214
 	}
215 215
 
216 216
 	$local_tokens = json_decode( file_get_contents( $token_file ) );
217 217
 
218 218
 	// Failed to parse as JSON
219
-	if ( false === $local_tokens ) {
219
+	if (false === $local_tokens) {
220 220
 		return $local_tokens;
221 221
 	}
222 222
 
223 223
 	// No social tokens found in the format we accept or it was empty
224
-	if ( empty( $local_tokens ) || ( ! isset( $local_tokens->twitter ) || ! isset( $local_tokens->facebook ) || ! isset( $local_tokens->linkedin ) ) ) {
224
+	if (empty($local_tokens) || ( ! isset($local_tokens->twitter) || ! isset($local_tokens->facebook) || ! isset($local_tokens->linkedin))) {
225 225
 		return false;
226 226
 	}
227 227
 
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 	global $ppp_share_settings;
240 240
 	$share_link = get_permalink( $post_id );
241 241
 
242
-	if ( ppp_link_tracking_enabled() ) {
242
+	if (ppp_link_tracking_enabled()) {
243 243
 		$share_link = ppp_generate_link_tracking( $share_link, $post_id, $name );
244 244
 	}
245 245
 
246
-	if ( ppp_is_shortener_enabled() && $scheduled ) {
246
+	if (ppp_is_shortener_enabled() && $scheduled) {
247 247
 		$shortener_name = $ppp_share_settings['shortener'];
248
-		$share_link = apply_filters( 'ppp_apply_shortener-' . $shortener_name, $share_link );
248
+		$share_link = apply_filters( 'ppp_apply_shortener-'.$shortener_name, $share_link );
249 249
 	}
250 250
 
251 251
 
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
  * @return string             The URL to post, with proper analytics applied if necessary
261 261
  */
262 262
 function ppp_generate_link_tracking( $share_link, $post_id, $name ) {
263
-	if ( ppp_link_tracking_enabled() ) {
263
+	if (ppp_link_tracking_enabled()) {
264 264
 		global $ppp_share_settings;
265 265
 		$link_tracking_type = $ppp_share_settings['analytics'];
266 266
 
267 267
 		// Given the setting name, devs can extend this and apply a filter of ppp_analytics-[setting value]
268 268
 		// to apply their own rules for link tracking
269
-		$share_link = apply_filters( 'ppp_analytics-' . $link_tracking_type, $share_link, $post_id, $name );
269
+		$share_link = apply_filters( 'ppp_analytics-'.$link_tracking_type, $share_link, $post_id, $name );
270 270
 	}
271 271
 
272 272
 	$share_link = apply_filters( 'ppp_generate_link_tracking', $share_link, $post_id, $name );
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
  * @return mixed             If a thumbnail is found returns the URL, otherwise returns false
283 283
  */
284 284
 function ppp_post_has_media( $post_id, $network, $use_media, $attachment_id = false ) {
285
-	if ( !$use_media || empty( $post_id ) || empty( $network ) ) {
285
+	if ( ! $use_media || empty($post_id) || empty($network)) {
286 286
 		return false;
287 287
 	}
288 288
 
289
-	$thumb_id = empty( $attachment_id ) ? get_post_thumbnail_id( $post_id ) : $attachment_id;
290
-	$thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-' . $network . '-share-image', true );
289
+	$thumb_id = empty($attachment_id) ? get_post_thumbnail_id( $post_id ) : $attachment_id;
290
+	$thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-'.$network.'-share-image', true );
291 291
 
292
-	if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) {
292
+	if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) {
293 293
 		return $thumb_url[0];
294 294
 	}
295 295
 
Please login to merge, or discard this patch.
includes/twitter-functions.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * Register Twitter as a servcie
24 24
  * @param  array $services The registered services
25
- * @return array           With Twitter added
25
+ * @return string[]           With Twitter added
26 26
  */
27 27
 function ppp_tw_register_service( $services = array() ) {
28 28
 	$services[] = 'tw';
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 /**
241 241
  * Register the Twitter connection area for the Social Media Accounts section
242 242
  * @param  array $content The existing content tokens
243
- * @return array          The content tokens with Twitter added
243
+ * @return string[]          The content tokens with Twitter added
244 244
  */
245 245
 function ppp_tw_register_admin_social_content( $content ) {
246 246
 	$content[] = 'tw';
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function ppp_twitter_enabled() {
13 13
 	global $ppp_social_settings;
14 14
 
15
-	if ( isset( $ppp_social_settings['twitter'] ) && !empty( $ppp_social_settings['twitter'] ) ) {
15
+	if (isset($ppp_social_settings['twitter']) && ! empty($ppp_social_settings['twitter'])) {
16 16
 		return true;
17 17
 	}
18 18
 
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function ppp_tw_account_list_avatar( $string = '' ) {
52 52
 
53
-	if ( ppp_twitter_enabled() ) {
53
+	if (ppp_twitter_enabled()) {
54 54
 		global $ppp_social_settings;
55 55
 		$avatar_url = $ppp_social_settings['twitter']['user']->profile_image_url_https;
56
-		$string .= '<img class="ppp-social-icon" src="' . $avatar_url . '" />';
56
+		$string .= '<img class="ppp-social-icon" src="'.$avatar_url.'" />';
57 57
 	}
58 58
 
59 59
 	return $string;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function ppp_tw_account_list_name( $string = '' ) {
69 69
 
70
-	if ( ppp_twitter_enabled() ) {
70
+	if (ppp_twitter_enabled()) {
71 71
 		global $ppp_social_settings;
72 72
 		$string .= $ppp_social_settings['twitter']['user']->name;
73 73
 	}
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function ppp_tw_account_list_actions( $string = '' ) {
85 85
 
86
-	if ( ! ppp_twitter_enabled() ) {
86
+	if ( ! ppp_twitter_enabled()) {
87 87
 		global $ppp_twitter_oauth, $ppp_social_settings;
88 88
 		$tw_auth = $ppp_twitter_oauth->ppp_verify_twitter_credentials();
89 89
 		$tw_authurl = $ppp_twitter_oauth->ppp_get_twitter_auth_url();
90 90
 
91
-		$string .= '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>';
91
+		$string .= '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>';
92 92
 	} else {
93
-		$string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ) . '" >' . __( 'Disconnect from Twitter', 'ppp-txt' ) . '</a>&nbsp;';
94
-		$string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">' . __( 'Revoke Access via Twitter', 'ppp-txt' ) . '</a>';
93
+		$string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ).'" >'.__( 'Disconnect from Twitter', 'ppp-txt' ).'</a>&nbsp;';
94
+		$string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">'.__( 'Revoke Access via Twitter', 'ppp-txt' ).'</a>';
95 95
 	}
96 96
 
97 97
 	return $string;
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
  * @return void
104 104
  */
105 105
 function ppp_capture_twitter_oauth() {
106
-	if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) {
106
+	if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) {
107 107
 		$current_screen = get_current_screen();
108
-		if ( 'user-edit' === $current_screen->base ) {
109
-			$user_id = ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false;
108
+		if ('user-edit' === $current_screen->base) {
109
+			$user_id = ! empty($_GET['user_id']) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false;
110 110
 			$twitter = new PPP_Twitter_User( $user_id );
111 111
 			$twitter->init();
112
-			$redirect = admin_url( 'user-edit.php?updated=1&user_id=' . $user_id );
112
+			$redirect = admin_url( 'user-edit.php?updated=1&user_id='.$user_id );
113 113
 		} else {
114 114
 			global $ppp_twitter_oauth;
115 115
 			$ppp_twitter_oauth->ppp_initialize_twitter();
@@ -127,17 +127,17 @@  discard block
 block discarded – undo
127 127
  * @return void
128 128
  */
129 129
 function ppp_disconnect_twitter() {
130
-	if ( ! empty( $_GET['user_id'] ) ) {
130
+	if ( ! empty($_GET['user_id'])) {
131 131
 		$user_id = (int) sanitize_text_field( $_GET['user_id'] );
132
-		if ( $user_id !== get_current_user_id() || ! current_user_can( 'manage_options' ) ) {
132
+		if ($user_id !== get_current_user_id() || ! current_user_can( 'manage_options' )) {
133 133
 			wp_die( __( 'Unable to disconnect Twitter account', 'ppp-txt' ) );
134 134
 		}
135 135
 		delete_user_meta( $user_id, '_ppp_twitter_data' );
136 136
 	} else {
137 137
 		global $ppp_social_settings;
138 138
 		$ppp_social_settings = get_option( 'ppp_social_settings' );
139
-		if ( isset( $ppp_social_settings['twitter'] ) ) {
140
-			unset( $ppp_social_settings['twitter'] );
139
+		if (isset($ppp_social_settings['twitter'])) {
140
+			unset($ppp_social_settings['twitter']);
141 141
 			update_option( 'ppp_social_settings', $ppp_social_settings );
142 142
 		}
143 143
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	$share_content = ppp_tw_generate_share_content( $post_id, $name );
166 166
 	$share_link    = ppp_generate_link( $post_id, $name, $scheduled );
167 167
 
168
-	return apply_filters( 'ppp_tw_build_share_message', $share_content . ' ' . $share_link );
168
+	return apply_filters( 'ppp_tw_build_share_message', $share_content.' '.$share_link );
169 169
 }
170 170
 
171 171
 /**
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) {
178 178
 	global $ppp_options;
179
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
179
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
180 180
 	$ppp_tweets   = get_post_meta( $post_id, '_ppp_tweets', true );
181 181
 
182
-	if ( $is_scheduled && ! empty( $ppp_tweets ) ) {
182
+	if ($is_scheduled && ! empty($ppp_tweets)) {
183 183
 		$ppp_post_override_data = get_post_meta( $post_id, '_ppp_post_override_data', true );
184 184
 		$name_array    = explode( '_', $name );
185 185
 		$index         = $name_array[1];
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	// If an override was found, use it, otherwise try the default text content
190
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
190
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
191 191
 
192 192
 	// If the content is still empty, just use the post title
193
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
193
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
194 194
 
195 195
 	return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) );
196 196
 }
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
  * @return bool         Whether or not this tweet should contain a media post
203 203
  */
204 204
 function ppp_tw_use_media( $post_id, $index ) {
205
-	if ( empty( $post_id ) || empty( $index ) ) {
205
+	if (empty($post_id) || empty($index)) {
206 206
 		return false;
207 207
 	}
208 208
 
209 209
 	$share_data = get_post_meta( $post_id, '_ppp_tweets', true );
210
-	$use_media  = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false;
210
+	$use_media  = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false;
211 211
 
212 212
 	return $use_media;
213 213
 }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
  * @return void
219 219
  */
220 220
 function ppp_set_tw_token_constants( $social_tokens ) {
221
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) {
221
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) {
222 222
 		define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token );
223 223
 		define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret );
224 224
 	}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
  */
257 257
 function ppp_tw_add_meta_tab( $tabs ) {
258 258
 	global $ppp_social_settings;
259
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
259
+	if ( ! isset($ppp_social_settings['twitter'])) {
260 260
 		return $tabs;
261 261
 	}
262 262
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function ppp_tw_register_metabox_content( $content ) {
275 275
 	global $ppp_social_settings;
276
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
276
+	if ( ! isset($ppp_social_settings['twitter'])) {
277 277
 		return $content;
278 278
 	}
279 279
 
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function ppp_tw_add_metabox_content( $post ) {
301 301
 	global $ppp_options, $ppp_share_settings;
302
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
302
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
303 303
 
304 304
 	$ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true );
305 305
 
306 306
 	$ppp_share_on_publish  = get_post_meta( $post->ID, '_ppp_share_on_publish', true );
307 307
 	$show_share_on_publish = false;
308 308
 
309
-	$share_by_default      = empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? false : true;
309
+	$share_by_default      = empty($ppp_share_settings['twitter']['share_on_publish']) ? false : true;
310 310
 
311
-	if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) {
311
+	if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) {
312 312
 		$show_share_on_publish = true;
313 313
 	}
314 314
 	$ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 	?>
317 317
 		<p>
318 318
 			<p>
319
-			<?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?>
320
-			<input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
319
+			<?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?>
320
+			<input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> />&nbsp;
321 321
 				<label for="ppp_share_on_publish"><?php _e( 'Tweet this post at the time of publishing?', 'ppp-txt' ); ?></label>
322
-				<p class="ppp_share_on_publish_text"<?php if ( false === $show_share_on_publish ) : ?> style="display: none;"<?php endif; ?>>
322
+				<p class="ppp_share_on_publish_text"<?php if (false === $show_share_on_publish) : ?> style="display: none;"<?php endif; ?>>
323 323
 						<input
324
-						<?php if ( $disabled ): ?>readonly<?php endif; ?>
324
+						<?php if ($disabled): ?>readonly<?php endif; ?>
325 325
 						class="ppp-share-text"
326 326
 						type="text"
327 327
 						placeholder="<?php echo esc_attr( $default_text ); ?>"
328 328
 						name="_ppp_share_on_publish_text"
329
-						<?php if ( isset( $ppp_share_on_publish_text ) ) {?>value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>"<?php ;}?>
330
-						<?php $length = ! empty($ppp_share_on_publish_text ) ? strlen( $ppp_share_on_publish_text ) : 0; ?>
329
+						<?php if (isset($ppp_share_on_publish_text)) {?>value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>"<?php; }?>
330
+						<?php $length = ! empty($ppp_share_on_publish_text) ? strlen( $ppp_share_on_publish_text ) : 0; ?>
331 331
 					/>&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
332 332
 					<br />
333 333
 					<span>
334
-						<input class="ppp-tw-featured-image-input" <?php if ( $disabled ): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/>
334
+						<input class="ppp-tw-featured-image-input" <?php if ($disabled): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/>
335 335
 						&nbsp;<label for="ppp-share-on-publish-image"><?php _e( 'Attach Featured Image In Tweet', 'ppp-txt' ); ?></label>
336 336
 					</span>
337 337
 				</p>
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 							</thead>
354 354
 							<tbody>
355 355
 								<?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?>
356
-								<?php if ( ! empty( $tweets ) ) : ?>
356
+								<?php if ( ! empty($tweets)) : ?>
357 357
 
358
-									<?php foreach ( $tweets as $key => $value ) :
359
-										$date          = isset( $value['date'] )          ? $value['date']          : '';
360
-										$time          = isset( $value['time'] )          ? $value['time']          : '';
361
-										$text          = isset( $value['text'] )          ? $value['text']          : '';
362
-										$image         = isset( $value['image'] )         ? $value['image']         : '';
363
-										$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
358
+									<?php foreach ($tweets as $key => $value) :
359
+										$date          = isset($value['date']) ? $value['date'] : '';
360
+										$time          = isset($value['time']) ? $value['time'] : '';
361
+										$text          = isset($value['text']) ? $value['text'] : '';
362
+										$image         = isset($value['image']) ? $value['image'] : '';
363
+										$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
364 364
 
365
-										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value );
365
+										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value );
366 366
 										?>
367 367
 
368 368
 										<?php ppp_render_tweet_row( $key, $args, $post->ID ); ?>
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 function ppp_render_tweet_row( $key, $args = array(), $post_id ) {
398 398
 	global $post;
399 399
 
400
-	$share_time     = strtotime( $args['date'] . ' ' . $args['time'] );
400
+	$share_time     = strtotime( $args['date'].' '.$args['time'] );
401 401
 	$readonly       = current_time( 'timestamp' ) > $share_time ? 'readonly="readonly" ' : false;
402
-	$no_date        = ! empty( $readonly ) ? ' hasDatepicker' : '';
403
-	$hide           = ! empty( $readonly ) ? 'display: none;' : '';
402
+	$no_date        = ! empty($readonly) ? ' hasDatepicker' : '';
403
+	$hide           = ! empty($readonly) ? 'display: none;' : '';
404 404
 	?>
405 405
 	<tr class="ppp-tweet-wrapper ppp-repeatable-row" data-key="<?php echo esc_attr( $key ); ?>">
406 406
 		<td>
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
 		<td>
415 415
 			<input <?php echo $readonly; ?>class="ppp-tweet-text-repeatable" type="text" name="_ppp_tweets[<?php echo $key; ?>][text]" value="<?php echo esc_attr( $args['text'] ); ?>" />
416
-			<?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?>
416
+			<?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?>
417 417
 			&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
418 418
 		</td>
419 419
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		</td>
433 433
 
434 434
 		<td>
435
-			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="tweet" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
435
+			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="tweet" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
436 436
 		</td>
437 437
 
438 438
 	</tr>
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
  */
448 448
 function ppp_tw_save_post_meta_boxes( $post_id, $post ) {
449 449
 
450
-	if ( ! ppp_should_save( $post_id, $post ) ) {
450
+	if ( ! ppp_should_save( $post_id, $post )) {
451 451
 		return;
452 452
 	}
453 453
 
454
-	$ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0';
454
+	$ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0';
455 455
 
456
-	$ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0';
457
-	$ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
458
-	$ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
456
+	$ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0';
457
+	$ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
458
+	$ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
459 459
 
460 460
 
461 461
 	update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish );
462 462
 	update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text );
463 463
 	update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image );
464 464
 
465
-	$tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array();
466
-	foreach ( $tweet_data as $index => $tweet ) {
467
-		$tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] );
465
+	$tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array();
466
+	foreach ($tweet_data as $index => $tweet) {
467
+		$tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] );
468 468
 	}
469 469
 	update_post_meta( $post_id, '_ppp_tweets', $tweet_data );
470 470
 
@@ -482,34 +482,34 @@  discard block
 block discarded – undo
482 482
 	global $ppp_options;
483 483
 
484 484
 	$from_meta = get_post_meta( $post->ID, '_ppp_share_on_publish', true );
485
-	$from_post = isset( $_POST['_ppp_share_on_publish'] );
485
+	$from_post = isset($_POST['_ppp_share_on_publish']);
486 486
 
487
-	if ( empty( $from_meta ) && empty( $from_post ) ) {
487
+	if (empty($from_meta) && empty($from_post)) {
488 488
 		return;
489 489
 	}
490 490
 
491 491
 	// Determine if we're seeing the share on publish in meta or $_POST
492
-	if ( $from_meta && !$from_post ) {
492
+	if ($from_meta && ! $from_post) {
493 493
 		$ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
494 494
 		$use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true );
495 495
 	} else {
496
-		$ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : '';
497
-		$use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false;
496
+		$ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : '';
497
+		$use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false;
498 498
 	}
499 499
 
500
-	$share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
500
+	$share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
501 501
 	$share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) );
502
-	$name = 'sharedate_0_' . $post->ID;
502
+	$name = 'sharedate_0_'.$post->ID;
503 503
 	$media = ppp_post_has_media( $post->ID, 'tw', $use_media );
504 504
 	$share_link = ppp_generate_link( $post->ID, $name, true );
505 505
 
506
-	$status['twitter'] = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media );
506
+	$status['twitter'] = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media );
507 507
 
508
-	if ( ! empty( $status['twitter']->id_str ) ) {
508
+	if ( ! empty($status['twitter']->id_str)) {
509 509
 		$author_id = $post->post_author;
510 510
 		$author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true );
511 511
 
512
-		if ( $author_rt ) {
512
+		if ($author_rt) {
513 513
 			$twitter_user = new PPP_Twitter_User( $author_id );
514 514
 			$twitter_user->retweet( $status['twitter']->id_str );
515 515
 		}
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	}
518 518
 
519 519
 
520
-	if ( isset( $ppp_options['enable_debug'] ) && $ppp_options['enable_debug'] == '1' ) {
521
-		update_post_meta( $post->ID, '_ppp-' . $name . '-status', $status );
520
+	if (isset($ppp_options['enable_debug']) && $ppp_options['enable_debug'] == '1') {
521
+		update_post_meta( $post->ID, '_ppp-'.$name.'-status', $status );
522 522
 	}
523 523
 }
524 524
 add_action( 'ppp_share_on_publish', 'ppp_tw_share_on_publish', 10, 3 );
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
  */
535 535
 function ppp_tw_unschedule_shares( $new_status, $old_status, $post ) {
536 536
 
537
-	if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) {
537
+	if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) {
538 538
 		ppp_remove_scheduled_shares( $post->ID );
539 539
 	}
540 540
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 	$ret = false;
554 554
 
555
-	if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) {
555
+	if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) {
556 556
 		$ret = true;
557 557
 	}
558 558
 
@@ -567,13 +567,13 @@  discard block
 block discarded – undo
567 567
  */
568 568
 function ppp_tw_card_meta() {
569 569
 
570
-	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) {
570
+	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) {
571 571
 		return;
572 572
 	}
573 573
 
574 574
 	global $post, $ppp_options;
575 575
 
576
-	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) {
576
+	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) {
577 577
 		return;
578 578
 	}
579 579
 
@@ -591,20 +591,20 @@  discard block
 block discarded – undo
591 591
 
592 592
 	$return = '';
593 593
 
594
-	if ( ! is_single() || ! ppp_tw_cards_enabled() ) {
594
+	if ( ! is_single() || ! ppp_tw_cards_enabled()) {
595 595
 		return $return;
596 596
 	}
597 597
 
598 598
 	global $post, $ppp_social_settings;
599 599
 
600 600
 
601
-	if ( empty( $post ) ) {
601
+	if (empty($post)) {
602 602
 		return;
603 603
 	}
604 604
 
605 605
 	$elements = ppp_tw_default_meta_elements();
606
-	foreach ( $elements as $name => $content ) {
607
-		$return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n";
606
+	foreach ($elements as $name => $content) {
607
+		$return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n";
608 608
 	}
609 609
 
610 610
 	return apply_filters( 'ppp_tw_card_meta', $return );
@@ -624,22 +624,22 @@  discard block
 block discarded – undo
624 624
 	$elements = array();
625 625
 
626 626
 	$image_url = ppp_post_has_media( $post->ID, 'tw', true );
627
-	if ( $image_url ) {
627
+	if ($image_url) {
628 628
 		$elements['twitter:card']      = 'summary_large_image';
629 629
 		$elements['twitter:image:src'] = $image_url;
630 630
 	} else {
631 631
 		$elements['twitter:card'] = 'summary';
632 632
 	}
633 633
 
634
-	$elements['twitter:site']        = '@' . $ppp_social_settings['twitter']['user']->screen_name;
634
+	$elements['twitter:site']        = '@'.$ppp_social_settings['twitter']['user']->screen_name;
635 635
 	$elements['twitter:title']       = esc_attr( strip_tags( $post->post_title ) );
636 636
 	$elements['twitter:description'] = esc_attr( strip_tags( ppp_tw_get_card_description() ) );
637 637
 
638 638
 	$author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true );
639
-	if ( ! empty( $author_twitter_handle ) ) {
639
+	if ( ! empty($author_twitter_handle)) {
640 640
 
641
-		if ( strpos( $author_twitter_handle, '@' ) === false ) {
642
-			$author_twitter_handle = '@' . $author_twitter_handle;
641
+		if (strpos( $author_twitter_handle, '@' ) === false) {
642
+			$author_twitter_handle = '@'.$author_twitter_handle;
643 643
 		}
644 644
 
645 645
 		$elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) );
@@ -658,17 +658,17 @@  discard block
 block discarded – undo
658 658
 function ppp_tw_get_card_description() {
659 659
 	global $post;
660 660
 
661
-	if ( ! is_single() || empty( $post ) ) {
661
+	if ( ! is_single() || empty($post)) {
662 662
 		return false;
663 663
 	}
664 664
 
665 665
 	$excerpt = $post->post_excerpt;
666 666
 	$max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 );
667 667
 
668
-	if ( empty( $excerpt ) ) {
668
+	if (empty($excerpt)) {
669 669
 		$excerpt_pre = substr( $post->post_content, 0, $max_len );
670 670
 		$last_space  = strrpos( $excerpt_pre, ' ' );
671
-		$excerpt     = substr( $excerpt_pre, 0, $last_space ) . '...';
671
+		$excerpt     = substr( $excerpt_pre, 0, $last_space ).'...';
672 672
 	}
673 673
 
674 674
 	return apply_filters( 'ppp_tw_card_desc', $excerpt );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
  */
684 684
 function ppp_tw_add_contact_method( $user_contactmethods ) {
685 685
 
686
-	if ( ! isset( $user_contactmethods['twitter'] ) ) {
686
+	if ( ! isset($user_contactmethods['twitter'])) {
687 687
 		$user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' );
688 688
 	}
689 689
 	// Returns the contact methods
@@ -699,11 +699,11 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function ppp_tw_profile_settings( $user ) {
701 701
 
702
-	if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) {
702
+	if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) {
703 703
 		return;
704 704
 	}
705 705
 
706
-	if ( $user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' ) ) {
706
+	if ($user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' )) {
707 707
 		return;
708 708
 	}
709 709
 
@@ -717,16 +717,16 @@  discard block
 block discarded – undo
717 717
 			<?php
718 718
 			$twitter = new PPP_Twitter_User( get_current_user_id() );
719 719
 			$tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true );
720
-			if ( empty( $tw_user ) ) {
721
-				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) );
720
+			if (empty($tw_user)) {
721
+				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) );
722 722
 
723
-				echo '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>';
723
+				echo '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>';
724 724
 			} else {
725 725
 				$connected = true;
726 726
 				?>
727 727
 				<p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p>
728 728
 				<p>
729
-					<a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id=' . $user->ID . '&ppp_social_disconnect=true&ppp_network=twitter&user_id=' . $user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>&nbsp;
729
+					<a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id='.$user->ID.'&ppp_social_disconnect=true&ppp_network=twitter&user_id='.$user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>&nbsp;
730 730
 					<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a>
731 731
 				</p>
732 732
 				<?php
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 			</td>
736 736
 		</tr>
737 737
 
738
-		<?php if ( $connected ) : ?>
738
+		<?php if ($connected) : ?>
739 739
 		<?php
740 740
 			$share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true );
741
-			$share_scheduled  = get_user_meta( $user->ID, '_ppp_share_scheduled' , true );
741
+			$share_scheduled  = get_user_meta( $user->ID, '_ppp_share_scheduled', true );
742 742
 		?>
743 743
 		<tr>
744 744
 			<th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th>
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
  */
770 770
 function ppp_tw_save_profile( $user_id ) {
771 771
 
772
-	$share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false;
773
-	$share_scheduled  = ! empty( $_POST['share_scheduled'] )  ? true : false;
772
+	$share_on_publish = ! empty($_POST['share_on_publish']) ? true : false;
773
+	$share_scheduled  = ! empty($_POST['share_scheduled']) ? true : false;
774 774
 
775 775
 	update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish );
776
-	update_user_meta( $user_id, '_ppp_share_scheduled' , $share_scheduled  );
776
+	update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled );
777 777
 
778 778
 }
779 779
 add_action( 'personal_options_update', 'ppp_tw_save_profile' );
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -370,9 +370,12 @@
 block discarded – undo
370 370
 
371 371
 									<?php endforeach; ?>
372 372
 
373
-								<?php else: ?>
373
+								<?php else {
374
+	: ?>
374 375
 
375
-									<?php ppp_render_tweet_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); ?>
376
+									<?php ppp_render_tweet_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 );
377
+}
378
+?>
376 379
 
377 380
 								<?php endif; ?>
378 381
 
Please login to merge, or discard this patch.
post-promoter-pro.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
 	/**
293 293
 	 * Deactivates the license key
294
-	 * @return void
294
+	 * @return null|false
295 295
 	 */
296 296
 	public function deactivate_license() {
297 297
 		// listen for our activate button to be clicked
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
 	/**
337 337
 	 * Activates the license key provided
338
-	 * @return void
338
+	 * @return null|false
339 339
 	 */
340 340
 	public function activate_license() {
341 341
 		// listen for our activate button to be clicked
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -181,43 +181,43 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function ppp_setup_admin_menu() {
183 183
 		add_menu_page( __( 'Post Promoter', 'ppp-txt' ),
184
-		               __( 'Post Promoter', 'ppp-txt' ),
185
-		               apply_filters( 'ppp_manage_role', 'administrator' ),
186
-		               'ppp-options',
187
-		               'ppp_admin_page'
188
-		             );
184
+					   __( 'Post Promoter', 'ppp-txt' ),
185
+					   apply_filters( 'ppp_manage_role', 'administrator' ),
186
+					   'ppp-options',
187
+					   'ppp_admin_page'
188
+					 );
189 189
 
190 190
 		add_submenu_page( 'ppp-options',
191
-			              __( 'Social Settings', 'ppp-txt' ),
192
-			              __( 'Social Settings', 'ppp-txt' ),
193
-			              'manage_options',
194
-			              'ppp-social-settings',
195
-			              'ppp_display_social'
196
-			            );
191
+						  __( 'Social Settings', 'ppp-txt' ),
192
+						  __( 'Social Settings', 'ppp-txt' ),
193
+						  'manage_options',
194
+						  'ppp-social-settings',
195
+						  'ppp_display_social'
196
+						);
197 197
 
198 198
 		add_submenu_page( 'ppp-options',
199
-			              __( 'Schedule', 'ppp-txt' ),
200
-			              __( 'Schedule', 'ppp-txt' ),
201
-			              'manage_options',
202
-			              'ppp-schedule-info',
203
-			              'ppp_display_schedule'
204
-			            );
199
+						  __( 'Schedule', 'ppp-txt' ),
200
+						  __( 'Schedule', 'ppp-txt' ),
201
+						  'manage_options',
202
+						  'ppp-schedule-info',
203
+						  'ppp_display_schedule'
204
+						);
205 205
 
206 206
 		add_submenu_page( 'ppp-options',
207
-			              __( 'System Info', 'ppp-txt' ),
208
-			              __( 'System Info', 'ppp-txt' ),
209
-			              'manage_options',
210
-			              'ppp-system-info',
211
-			              'ppp_display_sysinfo'
212
-			            );
207
+						  __( 'System Info', 'ppp-txt' ),
208
+						  __( 'System Info', 'ppp-txt' ),
209
+						  'manage_options',
210
+						  'ppp-system-info',
211
+						  'ppp_display_sysinfo'
212
+						);
213 213
 
214 214
 		add_submenu_page( null,
215
-			              __( 'PPP Upgrades', 'ppp-txt' ),
216
-			              __( 'PPP Upgrades', 'ppp-txt' ),
217
-			              'manage_options',
218
-			              'ppp-upgrades',
219
-			              'ppp_upgrades_screen'
220
-			            );
215
+						  __( 'PPP Upgrades', 'ppp-txt' ),
216
+						  __( 'PPP Upgrades', 'ppp-txt' ),
217
+						  'manage_options',
218
+						  'ppp-upgrades',
219
+						  'ppp_upgrades_screen'
220
+						);
221 221
 
222 222
 	}
223 223
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 		<div class="updated">
281 281
 			<p>
282 282
 				<?php printf(
283
-			         __( 'Post Promoter Pro requires your license key to work, please <a href="%s">enter it now</a>.', 'ppp-txt' ),
284
-			              admin_url( 'admin.php?page=ppp-options' )
285
-			         );
286
-			    ?>
283
+					 __( 'Post Promoter Pro requires your license key to work, please <a href="%s">enter it now</a>.', 'ppp-txt' ),
284
+						  admin_url( 'admin.php?page=ppp-options' )
285
+					 );
286
+				?>
287 287
 			</p>
288 288
 		</div>
289 289
 		<?php
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 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,7 +27,7 @@  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
 			register_activation_hook( PPP_FILE, array( $this, 'activation_setup' ) );
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 			$ppp_social_settings = get_option( 'ppp_social_settings' );
38 38
 			$ppp_share_settings  = get_option( 'ppp_share_settings' );
39 39
 
40
-			include PPP_PATH . '/includes/general-functions.php';
41
-			include PPP_PATH . '/includes/share-functions.php';
42
-			include PPP_PATH . '/includes/cron-functions.php';
43
-			include PPP_PATH . '/includes/filters.php';
44
-			include PPP_PATH . '/includes/libs/social-loader.php';
45
-
46
-			if ( is_admin() ) {
47
-				include PPP_PATH . '/includes/admin/upgrades.php';
48
-				include PPP_PATH . '/includes/admin/do-upgrades.php';
49
-				include PPP_PATH . '/includes/admin/actions.php';
50
-				include PPP_PATH . '/includes/admin/admin-pages.php';
51
-				include PPP_PATH . '/includes/admin/admin-ajax.php';
52
-				include PPP_PATH . '/includes/admin/meta-boxes.php';
53
-				include PPP_PATH . '/includes/admin/welcome.php';
54
-				include PPP_PATH . '/includes/admin/dashboard.php';
40
+			include PPP_PATH.'/includes/general-functions.php';
41
+			include PPP_PATH.'/includes/share-functions.php';
42
+			include PPP_PATH.'/includes/cron-functions.php';
43
+			include PPP_PATH.'/includes/filters.php';
44
+			include PPP_PATH.'/includes/libs/social-loader.php';
45
+
46
+			if (is_admin()) {
47
+				include PPP_PATH.'/includes/admin/upgrades.php';
48
+				include PPP_PATH.'/includes/admin/do-upgrades.php';
49
+				include PPP_PATH.'/includes/admin/actions.php';
50
+				include PPP_PATH.'/includes/admin/admin-pages.php';
51
+				include PPP_PATH.'/includes/admin/admin-ajax.php';
52
+				include PPP_PATH.'/includes/admin/meta-boxes.php';
53
+				include PPP_PATH.'/includes/admin/welcome.php';
54
+				include PPP_PATH.'/includes/admin/dashboard.php';
55 55
 
56 56
 				add_action( 'admin_init', array( $this, 'ppp_register_settings' ) );
57 57
 				add_action( 'admin_init', 'ppp_upgrade_plugin', 1 );
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			add_action( 'init', array( $this, 'get_actions' ) );
72
-			add_action( 'save_post', 'ppp_schedule_share', 11, 2);
73
-			add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3);
72
+			add_action( 'save_post', 'ppp_schedule_share', 11, 2 );
73
+			add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 );
74 74
 			add_action( 'init', 'ppp_add_image_sizes' );
75 75
 		}
76 76
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @access public
83 83
 	 */
84 84
 	public static function getInstance() {
85
-		if ( !self::$ppp_instance ) {
85
+		if ( ! self::$ppp_instance) {
86 86
 			self::$ppp_instance = new PostPromoterPro();
87 87
 		}
88 88
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function activation_setup() {
109 109
 		// If the settings already exist, don't do this
110
-		if ( get_option( 'ppp_options' ) ) {
110
+		if (get_option( 'ppp_options' )) {
111 111
 			return;
112 112
 		}
113 113
 
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
 	 * @access public
130 130
 	 */
131 131
 	public function load_custom_scripts( $hook ) {
132
-		if ( 'toplevel_page_ppp-options' != $hook
132
+		if ('toplevel_page_ppp-options' != $hook
133 133
 			  && 'post-promoter_page_ppp-social-settings' != $hook
134 134
 			  && 'post-new.php' != $hook
135
-			  && 'post.php' != $hook ) {
135
+			  && 'post.php' != $hook) {
136 136
 					return;
137 137
 		}
138 138
 
139 139
 		wp_enqueue_script( 'jquery-ui-core' );
140 140
 		wp_enqueue_script( 'jquery-ui-datepicker' );
141 141
 
142
-		$jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js';
143
-		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
142
+		$jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js';
143
+		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
144 144
 		wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true );
145 145
 	}
146 146
 
147 147
 	public function load_styles( $hook ) {
148
-		wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION );
148
+		wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION );
149 149
 		wp_enqueue_style( 'ppp_admin_css' );
150 150
 
151 151
 		// List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only
152 152
 		// load ours if they don't exist
153
-		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) {
153
+		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) {
154 154
 			wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' );
155 155
 		}
156 156
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @access public
164 164
 	 */
165 165
 	public function plugin_settings_links( $links, $file ) {
166
-		if ( $file != PPP_FILE ) {
166
+		if ($file != PPP_FILE) {
167 167
 			return $links;
168 168
 		}
169 169
 
@@ -250,22 +250,22 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function plugin_updater() {
252 252
 
253
-		if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) {
253
+		if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) {
254 254
 			return;
255 255
 		}
256 256
 
257 257
 		$license_key = trim( get_option( '_ppp_license_key' ) );
258 258
 
259
-		if ( empty( $license_key ) ) {
259
+		if (empty($license_key)) {
260 260
 			add_action( 'admin_notices', array( $this, 'no_license_nag' ) );
261 261
 			return;
262 262
 		}
263 263
 
264 264
 		// setup the updater
265 265
 		$edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array(
266
-				'version'   => PPP_VERSION,         // current version number
267
-				'license'   => $license_key,        // license key (used get_option above to retrieve from DB)
268
-				'item_name' => PPP_PLUGIN_NAME,     // name of this plugin
266
+				'version'   => PPP_VERSION, // current version number
267
+				'license'   => $license_key, // license key (used get_option above to retrieve from DB)
268
+				'item_name' => PPP_PLUGIN_NAME, // name of this plugin
269 269
 				'author'    => 'Post Promoter Pro'  // author of this plugin
270 270
 			)
271 271
 		);
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	public function deactivate_license() {
297 297
 		// listen for our activate button to be clicked
298
-		if( isset( $_POST['ppp_license_deactivate'] ) ) {
298
+		if (isset($_POST['ppp_license_deactivate'])) {
299 299
 
300 300
 			// run a quick security check
301
-			if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) {
301
+			if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) {
302 302
 				return;
303 303
 			}
304 304
 			// get out if we didn't click the Activate button
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
319 319
 
320 320
 			// make sure the response came back okay
321
-			if ( is_wp_error( $response ) ) {
321
+			if (is_wp_error( $response )) {
322 322
 				return false;
323 323
 			}
324 324
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
327 327
 
328 328
 			// $license_data->license will be either "deactivated" or "failed"
329
-			if( $license_data->license == 'deactivated' ) {
329
+			if ($license_data->license == 'deactivated') {
330 330
 				delete_option( '_ppp_license_key_status' );
331 331
 			}
332 332
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function activate_license() {
341 341
 		// listen for our activate button to be clicked
342
-		if( isset( $_POST['ppp_license_activate'] ) ) {
342
+		if (isset($_POST['ppp_license_activate'])) {
343 343
 
344 344
 			// run a quick security check
345
-		 	if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) {
345
+		 	if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) {
346 346
 		 		return;
347 347
 		 	}
348 348
 		 	// get out if we didn't click the Activate button
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
363 363
 
364 364
 			// make sure the response came back okay
365
-			if ( is_wp_error( $response ) ) {
365
+			if (is_wp_error( $response )) {
366 366
 				return false;
367 367
 			}
368 368
 
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
 	 */
384 384
 	public function ppp_sanitize_license( $new ) {
385 385
 		$old = get_option( '_ppp_license_key' );
386
-		if( $old && $old != $new ) {
386
+		if ($old && $old != $new) {
387 387
 			delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate
388 388
 		}
389 389
 		return $new;
390 390
 	}
391 391
 
392 392
 	public function get_actions() {
393
-		if ( isset( $_GET['ppp_action'] ) ) {
394
-			do_action( 'ppp_' . $_GET['ppp_action'], $_GET );
393
+		if (isset($_GET['ppp_action'])) {
394
+			do_action( 'ppp_'.$_GET['ppp_action'], $_GET );
395 395
 		}
396 396
 	}
397 397
 }
Please login to merge, or discard this patch.
includes/admin/actions.php 1 patch
Spacing   +34 added lines, -34 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
 
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function ppp_disconnect_social() {
16 16
 
17
-	if ( isset( $_GET['ppp_social_disconnect'] ) && isset( $_GET['ppp_network'] ) ) {
17
+	if (isset($_GET['ppp_social_disconnect']) && isset($_GET['ppp_network'])) {
18 18
 
19
-		if ( ! current_user_can( 'manage_options' ) ) {
19
+		if ( ! current_user_can( 'manage_options' )) {
20 20
 			wp_die( __( 'You do not have permission to view this page', 'ppp-txt' ) );
21 21
 		}
22 22
 
23 23
 		$network = $_GET['ppp_network'];
24
-		do_action( 'ppp_disconnect-' . $network );
24
+		do_action( 'ppp_disconnect-'.$network );
25 25
 	}
26 26
 }
27 27
 add_action( 'admin_init', 'ppp_disconnect_social', 10 );
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
 	$tabs = apply_filters( 'ppp_metabox_tabs', array() );
37 37
 	$i = 0;
38
-	foreach ( $tabs as $key => $values ) {
39
-		if ( $i === 0 ) {
38
+	foreach ($tabs as $key => $values) {
39
+		if ($i === 0) {
40 40
 			$visibleKey = $key;
41 41
 			$class = 'tabs';
42 42
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		}
45 45
 
46 46
 		?><li class="<?php echo $class; ?>"><a href="#<?php echo $key; ?>"><?php
47
-		if ( $values['class'] !== false ) {
47
+		if ($values['class'] !== false) {
48 48
 			?>
49 49
 			<span class="dashicons <?php echo $values['class']; ?>"></span>&nbsp;
50 50
 			<?php
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	$tabs = apply_filters( 'ppp_admin_tabs', array() );
66 66
 	$i = 0;
67 67
 	?><h2 id="ppp-social-connect-tabs" class="nav-tab-wrapper"><?php
68
-	foreach ( $tabs as $key => $values ) {
69
-		if ( $i === 0 ) {
68
+	foreach ($tabs as $key => $values) {
69
+		if ($i === 0) {
70 70
 			$visibleSettingTab = $key;
71 71
 			$class = ' nav-tab-active';
72 72
 		} else {
73 73
 			$class = '';
74 74
 		}
75 75
 		?><a class="nav-tab<?php echo $class; ?>" href='#<?php echo $key; ?>'><?php
76
-		if ( $values['class'] !== false ) {
76
+		if ($values['class'] !== false) {
77 77
 			?>
78 78
 			<span class="dashicons <?php echo $values['class']; ?>"></span>&nbsp;
79 79
 			<?php
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
 function ppp_generate_metabox_content( $post ) {
95 95
 	global $visibleKey;
96 96
 	$tab_content = apply_filters( 'ppp_metabox_content', array() );
97
-	if ( empty( $tab_content ) ) {
97
+	if (empty($tab_content)) {
98 98
 		printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) );
99 99
 	} else {
100
-		foreach ( $tab_content as $service ) {
101
-			$hidden = ( $visibleKey == $service ) ? '' : ' hidden';
100
+		foreach ($tab_content as $service) {
101
+			$hidden = ($visibleKey == $service) ? '' : ' hidden';
102 102
 			?>
103 103
 			<div class="wp-tab-panel tabs-panel<?php echo $hidden; ?>" id="<?php echo $service; ?>">
104
-				<?php do_action( 'ppp_generate_metabox_content-' . $service, $post ); ?>
104
+				<?php do_action( 'ppp_generate_metabox_content-'.$service, $post ); ?>
105 105
 			</div>
106 106
 			<?php
107 107
 		}
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 function ppp_generate_social_account_content() {
117 117
 	global $visibleSettingTab;
118 118
 	$tab_content = apply_filters( 'ppp_admin_social_content', array() );
119
-	if ( empty( $tab_content ) ) {
119
+	if (empty($tab_content)) {
120 120
 		printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) );
121 121
 	} else {
122
-		foreach ( $tab_content as $service ) {
123
-			$hidden = ( $visibleSettingTab == $service ) ? '' : ' hidden';
122
+		foreach ($tab_content as $service) {
123
+			$hidden = ($visibleSettingTab == $service) ? '' : ' hidden';
124 124
 			?>
125 125
 			<div class="ppp-social-connect<?php echo $hidden; ?>" id="<?php echo $service; ?>">
126
-				<?php do_action( 'ppp_connect_display-' . $service ); ?>
126
+				<?php do_action( 'ppp_connect_display-'.$service ); ?>
127 127
 			</div>
128 128
 			<?php
129 129
 		}
@@ -136,30 +136,30 @@  discard block
 block discarded – undo
136 136
  * @return void
137 137
  */
138 138
 function ppp_list_view_maybe_take_action() {
139
-	if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'ppp-schedule-info' ) {
139
+	if ( ! isset($_GET['page']) || $_GET['page'] !== 'ppp-schedule-info') {
140 140
 		return;
141 141
 	}
142 142
 
143
-	if ( ! isset( $_GET['action'] ) ) {
143
+	if ( ! isset($_GET['action'])) {
144 144
 		return;
145 145
 	}
146 146
 
147 147
 	// Get the necessary info for the actions
148
-	$post_id = isset( $_GET['post_id'] ) ? $_GET['post_id'] : 0;
149
-	$name    = isset( $_GET['name'] ) ? $_GET['name'] : '';
150
-	$index   = isset( $_GET['index'] ) ? $_GET['index'] : 0;
151
-	$delete  = isset( $_GET['delete_too'] ) ? true : false;
148
+	$post_id = isset($_GET['post_id']) ? $_GET['post_id'] : 0;
149
+	$name    = isset($_GET['name']) ? $_GET['name'] : '';
150
+	$index   = isset($_GET['index']) ? $_GET['index'] : 0;
151
+	$delete  = isset($_GET['delete_too']) ? true : false;
152 152
 
153
-	switch( $_GET['action'] ) {
153
+	switch ($_GET['action']) {
154 154
 		case 'delete_item':
155
-			if ( ! empty( $post_id ) && ! empty( $name ) || empty( $index ) ) {
156
-				ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron
155
+			if ( ! empty($post_id) && ! empty($name) || empty($index)) {
156
+				ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron
157 157
 
158 158
 				// Remove the item from postmeta if it exists.
159 159
 				$current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true );
160 160
 
161
-				if ( isset( $current_post_meta[$index] ) ) {
162
-					unset( $current_post_meta[$index] );
161
+				if (isset($current_post_meta[$index])) {
162
+					unset($current_post_meta[$index]);
163 163
 					update_post_meta( $post_id, '_ppp_tweets', $current_post_meta );
164 164
 				}
165 165
 
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 			}
169 169
 			break;
170 170
 		case 'share_now':
171
-			if ( ! empty( $post_id ) && ! empty( $name ) ) {
171
+			if ( ! empty($post_id) && ! empty($name)) {
172 172
 				ppp_share_post( $post_id, $name );
173 173
 
174
-				if ( $delete && ! empty( $index ) ) {
175
-					ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron
174
+				if ($delete && ! empty($index)) {
175
+					ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron
176 176
 
177 177
 					// Remove the item from postmeta if it exists.
178 178
 					$current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true );
179 179
 
180
-					if ( isset( $current_post_meta[$index] ) ) {
181
-						unset( $current_post_meta[$index] );
180
+					if (isset($current_post_meta[$index])) {
181
+						unset($current_post_meta[$index]);
182 182
 						update_post_meta( $post_id, '_ppp_tweets', $current_post_meta );
183 183
 					}
184 184
 
Please login to merge, or discard this patch.
includes/admin/admin-ajax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	$date = sanitize_text_field( $_POST['date'] );
11 11
 	$time = sanitize_text_field( $_POST['time'] );
12 12
 
13
-	$offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense
13
+	$offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense
14 14
 
15 15
 	$share_time = explode( ':', $time );
16 16
 
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 	$minutes = (int) substr( $share_time[1], 0, 2 );
19 19
 	$ampm = strtolower( substr( $share_time[1], -2 ) );
20 20
 
21
-	if ( $ampm == 'pm' && $hours != 12 ) {
21
+	if ($ampm == 'pm' && $hours != 12) {
22 22
 		$hours = $hours + 12;
23 23
 	}
24 24
 
25
-	if ( $ampm == 'am' && $hours == 12 ) {
25
+	if ($ampm == 'am' && $hours == 12) {
26 26
 		$hours = 00;
27 27
 	}
28 28
 
Please login to merge, or discard this patch.