GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#293)
by Chris
16:36 queued 14:25
created
includes/admin/admin-ajax.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	$date = sanitize_text_field( $_POST['date'] );
11 11
 	$time = sanitize_text_field( $_POST['time'] );
12 12
 
13
-	$offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense
13
+	$offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense
14 14
 
15 15
 	$share_time = explode( ':', $time );
16 16
 
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 	$minutes = (int) substr( $share_time[1], 0, 2 );
19 19
 	$ampm = strtolower( substr( $share_time[1], -2 ) );
20 20
 
21
-	if ( $ampm == 'pm' && $hours != 12 ) {
21
+	if ($ampm == 'pm' && $hours != 12) {
22 22
 		$hours = $hours + 12;
23 23
 	}
24 24
 
25
-	if ( $ampm == 'am' && $hours == 12 ) {
25
+	if ($ampm == 'am' && $hours == 12) {
26 26
 		$hours = 00;
27 27
 	}
28 28
 
Please login to merge, or discard this patch.
includes/admin/class-accounts-table.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
8
-if ( ! class_exists( 'WP_List_Table' ) ) {
9
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
8
+if ( ! class_exists( 'WP_List_Table' )) {
9
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
10 10
 }
11 11
 
12 12
 /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @return string              The Content to display
43 43
 	 */
44 44
 	public function column_default( $item, $column_name ) {
45
-		return $item[ $column_name ];
45
+		return $item[$column_name];
46 46
 	}
47 47
 
48 48
 	/**
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 
75 75
 		$accounts = apply_filters( 'ppp_register_social_service', array() );
76 76
 
77
-		foreach ( $accounts as $account ) {
77
+		foreach ($accounts as $account) {
78 78
 			$data[$account] = array(
79
-				'icon'    => apply_filters( 'ppp_account_list_icon-' . $account, '' ),
80
-				'avatar'  => apply_filters( 'ppp_account_list_avatar-' . $account, '' ),
81
-				'name'    => apply_filters( 'ppp_account_list_name-' . $account, '' ),
82
-				'actions' => apply_filters( 'ppp_account_list_actions-' . $account, '' ),
83
-				'extras'  => apply_filters( 'ppp_account_list_extras-' . $account, '' ),
79
+				'icon'    => apply_filters( 'ppp_account_list_icon-'.$account, '' ),
80
+				'avatar'  => apply_filters( 'ppp_account_list_avatar-'.$account, '' ),
81
+				'name'    => apply_filters( 'ppp_account_list_name-'.$account, '' ),
82
+				'actions' => apply_filters( 'ppp_account_list_actions-'.$account, '' ),
83
+				'extras'  => apply_filters( 'ppp_account_list_extras-'.$account, '' ),
84 84
 			);
85 85
 		}
86 86
 
Please login to merge, or discard this patch.
includes/admin/do-upgrades.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' )) exit;
14 14
 
15 15
 /**
16 16
  * Render Upgrades Screen
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
  * @return void
20 20
 */
21 21
 function ppp_upgrades_screen() {
22
-	$action = isset( $_GET['ppp-upgrade'] ) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : '';
23
-	$step   = isset( $_GET['step'] )        ? absint( $_GET['step'] )                     : 1;
24
-	$total  = isset( $_GET['total'] )       ? absint( $_GET['total'] )                    : false;
25
-	$custom = isset( $_GET['custom'] )      ? absint( $_GET['custom'] )                   : 0;
26
-	$number = isset( $_GET['number'] )      ? absint( $_GET['number'] )                   : 100;
27
-	$steps  = round( ( $total / $number ), 0 );
22
+	$action = isset($_GET['ppp-upgrade']) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : '';
23
+	$step   = isset($_GET['step']) ? absint( $_GET['step'] ) : 1;
24
+	$total  = isset($_GET['total']) ? absint( $_GET['total'] ) : false;
25
+	$custom = isset($_GET['custom']) ? absint( $_GET['custom'] ) : 0;
26
+	$number = isset($_GET['number']) ? absint( $_GET['number'] ) : 100;
27
+	$steps  = round( ($total / $number), 0 );
28 28
 
29 29
 	$doing_upgrade_args = array(
30 30
 		'page'        => 'ppp-upgrades',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	);
37 37
 
38 38
 	update_option( 'ppp_doing_upgrade', $doing_upgrade_args );
39
-	if ( $step > $steps ) {
39
+	if ($step > $steps) {
40 40
 		// Prevent a weird case where the estimate was off. Usually only a couple.
41 41
 		$steps = $step;
42 42
 	}
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	<div class="wrap">
45 45
 		<h1><?php _e( 'Post Promoter Pro - Upgrades', 'ppp-txt' ); ?></h1>
46 46
 
47
-		<?php if( ! empty( $action ) ) : ?>
47
+		<?php if ( ! empty($action)) : ?>
48 48
 
49 49
 			<div id="ppp-upgrade-status">
50 50
 				<p><?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?></p>
51 51
 
52
-				<?php if( ! empty( $total ) ) : ?>
52
+				<?php if ( ! empty($total)) : ?>
53 53
 					<p><strong><?php printf( __( 'Step %d of approximately %d running', 'ppp-txt' ), $step, $steps ); ?></strong></p>
54 54
 				<?php endif; ?>
55 55
 			</div>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( !defined( 'ABSPATH' ) ) exit;
13
+if ( !defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Render Upgrades Screen
@@ -57,11 +59,14 @@  discard block
 block discarded – undo
57 59
 				setTimeout(function() { document.location.href = "index.php?ppp_action=<?php echo $action; ?>&step=<?php echo $step; ?>&total=<?php echo $total; ?>&custom=<?php echo $custom; ?>"; }, 250);
58 60
 			</script>
59 61
 
60
-		<?php else : ?>
62
+		<?php else {
63
+	: ?>
61 64
 
62 65
 			<div id="ppp-upgrade-status">
63 66
 				<p>
64
-					<?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?>
67
+					<?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' );
68
+}
69
+?>
65 70
 				</p>
66 71
 			</div>
67 72
 			<script type="text/javascript">
Please login to merge, or discard this patch.
includes/admin/meta-boxes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 function ppp_register_meta_boxes() {
13 13
 	global $post, $ppp_options;
14 14
 
15
-	if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) ) {
15
+	if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] )) {
16 16
 		return;
17 17
 	}
18 18
 
19
-	foreach ( $ppp_options['post_types'] as $post_type => $value ) {
19
+	foreach ($ppp_options['post_types'] as $post_type => $value) {
20 20
 		add_meta_box( 'ppp_schedule_metabox', 'Post Promoter Pro', 'ppp_schedule_callback', $post_type, 'normal', 'high' );
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined( 'ABSPATH' )) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.2
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus') );
38
+		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39 39
 		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
40
+		add_action( 'admin_init', array( $this, 'welcome' ) );
41 41
 	}
42 42
 
43 43
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		remove_submenu_page( 'index.php', 'ppp-getting-started' );
82 82
 
83 83
 		// Badge for welcome page
84
-		$badge_url = PPP_URL . 'includes/images/ppp-badge.png';
84
+		$badge_url = PPP_URL.'includes/images/ppp-badge.png';
85 85
 		?>
86 86
 		<style type="text/css" media="screen">
87 87
 		/*<![CDATA[*/
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @return void
122 122
 	 */
123 123
 	public function tabs() {
124
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'ppp-about';
124
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'ppp-about';
125 125
 		?>
126 126
 		<h1 class="nav-tab-wrapper">
127 127
 			<a class="nav-tab <?php echo $selected == 'ppp-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'ppp-about' ), 'index.php' ) ) ); ?>">
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @return void
140 140
 	 */
141 141
 	public function about_screen() {
142
-		list( $display_version ) = explode( '-', PPP_VERSION );
142
+		list($display_version) = explode( '-', PPP_VERSION );
143 143
 		?>
144 144
 		<div class="wrap about-wrap">
145 145
 			<h1><?php printf( __( 'Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1>
@@ -149,59 +149,59 @@  discard block
 block discarded – undo
149 149
 			<?php $this->tabs(); ?>
150 150
 
151 151
 			<div class="changelog">
152
-				<h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' );?></h3>
152
+				<h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' ); ?></h3>
153 153
 
154 154
 				<div class="feature-section">
155 155
 
156
-					<img src="<?php echo PPP_URL . '/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/>
156
+					<img src="<?php echo PPP_URL.'/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/>
157 157
 
158
-					<h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' );?></h4>
159
-					<p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' );?></p>
160
-					<p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' );?></p>
158
+					<h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' ); ?></h4>
159
+					<p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' ); ?></p>
160
+					<p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' ); ?></p>
161 161
 
162 162
 				</div>
163 163
 			</div>
164 164
 
165 165
 			<div class="changelog">
166
-				<h3><?php _e( 'Twitter Cards Support', 'ppp-txt' );?></h3>
166
+				<h3><?php _e( 'Twitter Cards Support', 'ppp-txt' ); ?></h3>
167 167
 
168 168
 				<div class="feature-section">
169 169
 
170
-					<img src="<?php echo PPP_URL . '/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/>
170
+					<img src="<?php echo PPP_URL.'/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/>
171 171
 
172
-					<h4><?php _e( 'Increased visibility on Twitter','ppp-txt' );?></h4>
173
-					<p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' );?></p>
174
-					<p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' );?></p>
172
+					<h4><?php _e( 'Increased visibility on Twitter', 'ppp-txt' ); ?></h4>
173
+					<p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' ); ?></p>
174
+					<p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' ); ?></p>
175 175
 
176 176
 				</div>
177 177
 			</div>
178 178
 
179 179
 			<div class="changelog">
180
-				<h3><?php _e( 'Variable Twitter Images', 'ppp-txt' );?></h3>
180
+				<h3><?php _e( 'Variable Twitter Images', 'ppp-txt' ); ?></h3>
181 181
 
182 182
 				<div class="feature-section">
183 183
 
184
-					<h4><?php _e( 'Change the image attached to each Tweet','ppp-txt' );?></h4>
185
-					<p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' );?></p>
184
+					<h4><?php _e( 'Change the image attached to each Tweet', 'ppp-txt' ); ?></h4>
185
+					<p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' ); ?></p>
186 186
 
187 187
 				</div>
188 188
 			</div>
189 189
 
190 190
 			<div class="changelog">
191
-				<h3><?php _e( 'Additional Updates', 'ppp-txt' );?></h3>
191
+				<h3><?php _e( 'Additional Updates', 'ppp-txt' ); ?></h3>
192 192
 
193 193
 				<div class="feature-section col three-col">
194 194
 					<div>
195
-						<h4><?php _e( 'Updated image sizes', 'ppp-txt' );?></h4>
196
-						<p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' );?></p>
195
+						<h4><?php _e( 'Updated image sizes', 'ppp-txt' ); ?></h4>
196
+						<p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' ); ?></p>
197 197
 
198
-						<h4><?php _e( 'CSS Updates', 'ppp-txt' );?></h4>
199
-						<p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' );?></p>
198
+						<h4><?php _e( 'CSS Updates', 'ppp-txt' ); ?></h4>
199
+						<p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' ); ?></p>
200 200
 					</div>
201 201
 
202 202
 					<div class="last-feature">
203
-						<h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' );?></h4>
204
-						<p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' );?></p>
203
+						<h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' ); ?></h4>
204
+						<p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' ); ?></p>
205 205
 					</div>
206 206
 				</div>
207 207
 			</div>
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @return void
222 222
 	 */
223 223
 	public function getting_started_screen() {
224
-		list( $display_version ) = explode( '-', PPP_VERSION );
224
+		list($display_version) = explode( '-', PPP_VERSION );
225 225
 		?>
226 226
 		<div class="wrap about-wrap">
227 227
 			<h1><?php printf( __( 'Welcome to Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1>
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 	public function welcome() {
248 248
 
249 249
 		$version_level = explode( '.', PPP_VERSION );
250
-		if ( count( $version_level > 2 ) ) {
250
+		if (count( $version_level > 2 )) {
251 251
 			return;
252 252
 		}
253 253
 
254 254
 		// Bail if no activation redirect
255
-		if ( ! get_transient( '_ppp_activation_redirect' ) ) {
255
+		if ( ! get_transient( '_ppp_activation_redirect' )) {
256 256
 			return;
257 257
 		}
258 258
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		delete_transient( '_ppp_activation_redirect' );
261 261
 
262 262
 		// Bail if activating from network, or bulk
263
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
263
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
264 264
 			return;
265 265
 		}
266 266
 
Please login to merge, or discard this patch.
includes/libs/bitly.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( !defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
  * Handles all bitly functions
12 12
  *
13 13
  */
14
-if( !class_exists( 'PPP_Bitly' ) ) {
14
+if ( ! class_exists( 'PPP_Bitly' )) {
15 15
 
16 16
 	class PPP_Bitly {
17 17
 
18 18
 		var $bitly;
19 19
 
20
-		public function __construct(){
20
+		public function __construct() {
21 21
 			ppp_maybe_start_session();
22 22
 		}
23 23
 
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 		 * Handles to load twitter class
28 28
 		 */
29 29
 		public function ppp_load_bitly() {
30
-				if( !class_exists( 'Bitly' ) ) {
31
-					require_once ( PPP_PATH . '/includes/libs/bitly/bitly.php' );
30
+				if ( ! class_exists( 'Bitly' )) {
31
+					require_once (PPP_PATH.'/includes/libs/bitly/bitly.php');
32 32
 				}
33 33
 
34 34
 				ppp_set_social_tokens();
35 35
 
36
-				if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' ) ) {
36
+				if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' )) {
37 37
 					return false;
38 38
 				}
39 39
 
40 40
 				global $ppp_social_settings;
41 41
 
42
-				if ( isset( $ppp_social_settings['bitly'] ) ) {
43
-					if ( !defined( 'bitly_accesstoken' ) ) {
42
+				if (isset($ppp_social_settings['bitly'])) {
43
+					if ( ! defined( 'bitly_accesstoken' )) {
44 44
 						define( 'bitly_accesstoken', $ppp_social_settings['bitly']['access_token'] );
45 45
 					}
46 46
 					$this->bitly = new Bitly( bitly_clientid, bitly_secret, bitly_accesstoken );
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		public function revoke_access() {
55 55
 			global $ppp_social_settings;
56 56
 
57
-			unset( $ppp_social_settings['bitly'] );
57
+			unset($ppp_social_settings['bitly']);
58 58
 
59 59
 			update_option( 'ppp_social_settings', $ppp_social_settings );
60 60
 		}
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 		 * Get auth codes for Bitly
64 64
 		 *
65 65
 		 */
66
-		public function ppp_get_bitly_auth_url () {
66
+		public function ppp_get_bitly_auth_url() {
67 67
 			//load bitly class
68 68
 			$bitly = $this->ppp_load_bitly();
69 69
 
70 70
 			//check bitly class is loaded or not
71
-			if( !$bitly ) {
71
+			if ( ! $bitly) {
72 72
 				return false;
73 73
 			}
74 74
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 		}
78 78
 
79 79
 		public function ppp_make_bitly_link( $link = null ) {
80
-			if ( empty( $link ) ) {
80
+			if (empty($link)) {
81 81
 				return false;
82 82
 			}
83 83
 
84 84
 			$bitly = $this->ppp_load_bitly();
85 85
 
86
-			if ( !$bitly ) {
86
+			if ( ! $bitly) {
87 87
 				return false;
88 88
 			}
89 89
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		public function ppp_bitly_user_info() {
94 94
 			$bitly = $this->ppp_load_bitly();
95 95
 
96
-			if ( !$bitly ) {
96
+			if ( ! $bitly) {
97 97
 				return false;
98 98
 			}
99 99
 
Please login to merge, or discard this patch.
includes/libs/twitter-user.php 1 patch
Spacing   +23 added lines, -23 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
  * Handles all twitter functions
12 12
  *
13 13
  */
14
-if( !class_exists( 'PPP_Twitter_User' ) ) {
14
+if ( ! class_exists( 'PPP_Twitter_User' )) {
15 15
 
16 16
 	class PPP_Twitter_User {
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 			ppp_maybe_start_session();
20 20
 			$this->user_id = $_user_id;
21 21
 
22
-			if ( ! empty( $this->user_id ) ) {
22
+			if ( ! empty($this->user_id)) {
23 23
 				$this->verify_credentials();
24 24
 			}
25 25
 		}
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 		 * Handles to load twitter class
31 31
 		 */
32 32
 		public function load() {
33
-				if( !class_exists( 'TwitterOAuth' ) ) {
34
-					require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' );
33
+				if ( ! class_exists( 'TwitterOAuth' )) {
34
+					require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php');
35 35
 				}
36 36
 
37 37
 				ppp_set_social_tokens();
38 38
 
39
-				if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' ) ) {
39
+				if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' )) {
40 40
 					return false;
41 41
 				}
42 42
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		public function init() {
57 57
 
58 58
 			//when user is going to logged in in twitter and verified successfully session will create
59
-			if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) {
59
+			if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) {
60 60
 				$ppp_social_settings = get_option( 'ppp_social_settings' );
61 61
 
62 62
 				//load twitter class
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 
69 69
 				//session for verifier
70 70
 				$verifier['oauth_verifier']       = $_REQUEST['oauth_verifier'];
71
-				$_SESSION[ 'ppp_twt_user_cache' ] = $verifier;
71
+				$_SESSION['ppp_twt_user_cache'] = $verifier;
72 72
 
73 73
 				//getting user data from twitter
74 74
 				$response = $this->twitter->get( 'account/verify_credentials' );
75 75
 
76 76
 				//if user data get successfully
77
-				if ( $response->id_str ) {
77
+				if ($response->id_str) {
78 78
 
79 79
 					$data['user'] = $response;
80 80
 					$data['user']->accessToken = $ppp_tw_access_token;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			$this->load();
89 89
 
90 90
 			$user_settings = get_user_meta( $this->user_id, '_ppp_twitter_data', true );
91
-			if ( ! empty( $user_settings ) ) {
91
+			if ( ! empty($user_settings)) {
92 92
 
93 93
 				$this->twitter = new TwitterOAuth(
94 94
 					PPP_TW_CONSUMER_KEY,
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 					$user_settings['user']->accessToken['oauth_token_secret']
98 98
 				);
99 99
 
100
-				$response = $this->twitter->get('account/verify_credentials');
101
-				if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) {
102
-					foreach ( $response->errors as $error ) {
103
-						if ( $error->code == 89 ) { // Expired or revoked tokens
100
+				$response = $this->twitter->get( 'account/verify_credentials' );
101
+				if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) {
102
+					foreach ($response->errors as $error) {
103
+						if ($error->code == 89) { // Expired or revoked tokens
104 104
 
105 105
 							$this->revoke_access();
106 106
 
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 		 * Get auth url for twitter
118 118
 		 *
119 119
 		 */
120
-		public function get_auth_url ( $return_url = '' ) {
120
+		public function get_auth_url( $return_url = '' ) {
121 121
 
122
-			if ( empty( $return_url ) ) {
122
+			if (empty($return_url)) {
123 123
 				$return_url = admin_url( 'admin.php?page=ppp-social-settings' );
124 124
 			}
125 125
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			$request_token = $this->twitter->getRequestToken( $return_url );
129 129
 
130 130
 			// If last connection failed don't display authorization link.
131
-			switch( $this->twitter->http_code ) {
131
+			switch ($this->twitter->http_code) {
132 132
 				case 200:
133 133
 					$_SESSION['ppp_user_twt_oauth_token']        = $request_token['oauth_token'];
134 134
 					$_SESSION['ppp_user_twt_oauth_token_secret'] = $request_token['oauth_token_secret'];
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 		}
146 146
 
147 147
 		public function send_tweet( $message = '', $media = null ) {
148
-			if ( empty( $message ) ) {
148
+			if (empty($message)) {
149 149
 				return false;
150 150
 			}
151 151
 
152 152
 			$verify = $this->verify_credentials();
153
-			if ( $verify === true ) {
153
+			if ($verify === true) {
154 154
 				$args = array();
155
-				if ( ! empty( $media ) ) {
155
+				if ( ! empty($media)) {
156 156
 					$endpoint = 'statuses/update_with_media';
157 157
 					$args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) );
158 158
 				} else {
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 		}
168 168
 
169 169
 		public function retweet( $tweet_id ) {
170
-			if ( empty( $tweet_id ) ) {
170
+			if (empty($tweet_id)) {
171 171
 				return false;
172 172
 			}
173 173
 
174 174
 			$verify = $this->verify_credentials();
175
-			if ( $verify === true ) {
176
-				$endpoint = 'statuses/retweet/' . $tweet_id;
175
+			if ($verify === true) {
176
+				$endpoint = 'statuses/retweet/'.$tweet_id;
177 177
 
178 178
 				return $this->twitter->post( $endpoint, array(), true );
179 179
 			} else {
Please login to merge, or discard this patch.
includes/libs/twitter.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( !defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * Handles all twitter functions
12 12
  *
13 13
  */
14
-if( !class_exists( 'PPP_Twitter' ) ) {
14
+if ( ! class_exists( 'PPP_Twitter' )) {
15 15
 
16 16
 	class PPP_Twitter {
17 17
 
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 		 * Handles to load twitter class
30 30
 		 */
31 31
 		public function ppp_load_twitter() {
32
-				if( !class_exists( 'TwitterOAuth' ) ) {
33
-					require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' );
32
+				if ( ! class_exists( 'TwitterOAuth' )) {
33
+					require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php');
34 34
 				}
35 35
 
36 36
 				ppp_set_social_tokens();
37 37
 
38
-				if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' ) ) {
38
+				if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' )) {
39 39
 					return false;
40 40
 				}
41 41
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		public function revoke_access() {
48 48
 			global $ppp_social_settings;
49 49
 
50
-			unset( $ppp_social_settings['twitter'] );
50
+			unset($ppp_social_settings['twitter']);
51 51
 
52 52
 			update_option( 'ppp_social_settings', $ppp_social_settings );
53 53
 		}
@@ -59,32 +59,32 @@  discard block
 block discarded – undo
59 59
 		public function ppp_initialize_twitter() {
60 60
 
61 61
 			//when user is going to logged in in twitter and verified successfully session will create
62
-			if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) {
62
+			if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) {
63 63
 				$ppp_social_settings = get_option( 'ppp_social_settings' );
64 64
 
65 65
 				//load twitter class
66 66
 				$twitter = $this->ppp_load_twitter();
67 67
 
68 68
 				//check twitter class is loaded or not
69
-				if( !$twitter ) {
69
+				if ( ! $twitter) {
70 70
 					return false;
71 71
 				}
72 72
 
73 73
 				$this->twitter = new TwitterOAuth( PPP_TW_CONSUMER_KEY, PPP_TW_CONSUMER_SECRET, $_SESSION['ppp_twt_oauth_token'], $_SESSION['ppp_twt_oauth_token_secret'] );
74 74
 
75 75
 				// Request access tokens from twitter
76
-				$ppp_tw_access_token = $this->twitter->getAccessToken($_REQUEST['oauth_verifier']);
76
+				$ppp_tw_access_token = $this->twitter->getAccessToken( $_REQUEST['oauth_verifier'] );
77 77
 
78 78
 				//session for verifier
79 79
 				$verifier['oauth_verifier'] = $_REQUEST['oauth_verifier'];
80 80
 
81
-				$_SESSION[ 'ppp_twt_user_cache' ] = $verifier;
81
+				$_SESSION['ppp_twt_user_cache'] = $verifier;
82 82
 
83 83
 				//getting user data from twitter
84
-				$response = $this->twitter->get('account/verify_credentials');
84
+				$response = $this->twitter->get( 'account/verify_credentials' );
85 85
 
86 86
 				//if user data get successfully
87
-				if ( $response->id_str ) {
87
+				if ($response->id_str) {
88 88
 
89 89
 					$data['user'] = $response;
90 90
 					$data['user']->accessToken = $ppp_tw_access_token;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 			$this->ppp_load_twitter();
100 100
 
101 101
 			global $ppp_social_settings;
102
-			if ( isset( $ppp_social_settings['twitter'] ) ) {
102
+			if (isset($ppp_social_settings['twitter'])) {
103 103
 
104 104
 				$this->twitter = new TwitterOAuth(
105 105
 					PPP_TW_CONSUMER_KEY,
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 					$ppp_social_settings['twitter']['user']->accessToken['oauth_token_secret']
109 109
 				);
110 110
 
111
-				$response = $this->twitter->get('account/verify_credentials');
112
-				if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) {
113
-					foreach ( $response->errors as $error ) {
114
-						if ( $error->code == 89 ) { // Expired or revoked tokens
115
-							unset( $ppp_social_settings['twitter'] );
111
+				$response = $this->twitter->get( 'account/verify_credentials' );
112
+				if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) {
113
+					foreach ($response->errors as $error) {
114
+						if ($error->code == 89) { // Expired or revoked tokens
115
+							unset($ppp_social_settings['twitter']);
116 116
 							update_option( 'ppp_social_settings', $ppp_social_settings );
117 117
 
118 118
 							return array( 'error' => __( 'Post Promoter Pro has been removed from your Twitter account. Please reauthorize to continue promoting your content.', 'ppp-txt' ) );
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 		 * Get auth url for twitter
129 129
 		 *
130 130
 		 */
131
-		public function ppp_get_twitter_auth_url ( $return_url = '' ) {
131
+		public function ppp_get_twitter_auth_url( $return_url = '' ) {
132 132
 
133
-			if ( empty( $return_url ) ) {
133
+			if (empty($return_url)) {
134 134
 				$return_url = admin_url( 'admin.php?page=ppp-social-settings' );
135 135
 			}
136 136
 			//load twitter class
137 137
 			$twitter = $this->ppp_load_twitter();
138 138
 
139 139
 			//check twitter class is loaded or not
140
-			if( !$twitter ) {
140
+			if ( ! $twitter) {
141 141
 				return false;
142 142
 			}
143 143
 
144 144
 			$request_token = $this->twitter->getRequestToken( $return_url );
145 145
 
146 146
 			// If last connection failed don't display authorization link.
147
-			switch( $this->twitter->http_code ) {
147
+			switch ($this->twitter->http_code) {
148 148
 
149 149
 			case 200:
150 150
 				$_SESSION['ppp_twt_oauth_token']        = $request_token['oauth_token'];
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		public function ppp_tweet( $message = '', $media = null ) {
164
-			if ( empty( $message ) ) {
164
+			if (empty($message)) {
165 165
 				return false;
166 166
 			}
167 167
 
168 168
 			$verify = $this->ppp_verify_twitter_credentials();
169
-			if ( $verify === true ) {
169
+			if ($verify === true) {
170 170
 				$args = array();
171
-				if ( ! empty( $media ) ) {
171
+				if ( ! empty($media)) {
172 172
 					$endpoint = 'statuses/update_with_media';
173 173
 					$args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) );
174 174
 				} else {
Please login to merge, or discard this patch.
includes/wpme-functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @return void
12 12
  */
13 13
 function ppp_add_wpme_shortener( $selected_shortener ) {
14
-	if( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' ) ) { ?>
14
+	if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' )) { ?>
15 15
 		<option value="wpme" <?php selected( $selected_shortener, 'wpme', true ); ?>>WP.me</option>
16 16
 	<?php }
17 17
 }
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  * @return string      The link, after shortening through wp.me
41 41
  */
42 42
 function ppp_apply_wpme( $link ) {
43
-	if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' ) ) {
43
+	if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'shortlinks' )) {
44 44
 		$id = url_to_postid( $link );
45 45
 		$result = wpme_get_shortlink( $id );
46 46
 
47
-		if ( ! empty( $result ) ) {
47
+		if ( ! empty($result)) {
48 48
 			return $result;
49 49
 		} else {
50 50
 			return $link;
Please login to merge, or discard this patch.