GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#208)
by Dan
21:20
created
includes/libs/social-loader.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@
 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
-include_once( PPP_PATH . '/includes/wpme-functions.php' );
8
+include_once(PPP_PATH.'/includes/wpme-functions.php');
9 9
 
10 10
 global $ppp_twitter_oauth;
11
-include_once( PPP_PATH . '/includes/twitter-functions.php' );
12
-require_once( PPP_PATH . '/includes/libs/twitter.php');
11
+include_once(PPP_PATH.'/includes/twitter-functions.php');
12
+require_once(PPP_PATH.'/includes/libs/twitter.php');
13 13
 $ppp_twitter_oauth = new PPP_Twitter();
14 14
 
15 15
 // Also include the user specific Twitter Class ( separate for now )
16
-require_once( PPP_PATH . '/includes/libs/twitter-user.php' );
16
+require_once(PPP_PATH.'/includes/libs/twitter-user.php');
17 17
 
18 18
 global $ppp_facebook_oauth;
19
-include_once( PPP_PATH . '/includes/facebook-functions.php' );
20
-require_once( PPP_PATH . '/includes/libs/facebook.php');
19
+include_once(PPP_PATH.'/includes/facebook-functions.php');
20
+require_once(PPP_PATH.'/includes/libs/facebook.php');
21 21
 $ppp_facebook_oauth = new PPP_Facebook();
22 22
 
23 23
 global $ppp_bitly_oauth;
24
-include_once( PPP_PATH . '/includes/bitly-functions.php' );
25
-require_once( PPP_PATH . '/includes/libs/bitly.php' );
24
+include_once(PPP_PATH.'/includes/bitly-functions.php');
25
+require_once(PPP_PATH.'/includes/libs/bitly.php');
26 26
 $ppp_bitly_oauth = new PPP_Bitly();
27 27
 
28 28
 global $ppp_linkedin_oauth;
29
-include_once( PPP_PATH . '/includes/linkedin-functions.php' );
30
-require_once( PPP_PATH . '/includes/libs/linkedin.php' );
29
+include_once(PPP_PATH.'/includes/linkedin-functions.php');
30
+require_once(PPP_PATH.'/includes/libs/linkedin.php');
31 31
 $ppp_linkedin_oauth = new PPP_Linkedin();
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.
uninstall.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Exit if accessed directly
3
-if ( ! defined( 'ABSPATH' ) ) {
3
+if ( ! defined( 'ABSPATH' )) {
4 4
 	exit;
5 5
 }
6 6
 
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 $options = get_option( 'ppp_options' );
13 13
 
14
-if ( isset( $options['delete_on_uninstall'] ) ) {
14
+if (isset($options['delete_on_uninstall'])) {
15 15
 	require_once 'includes/cron-functions.php';
16 16
 
17 17
 	$crons = ppp_get_shceduled_crons();
18
-	foreach( $crons as $cron ) {
18
+	foreach ($crons as $cron) {
19 19
 		$ppp_data   = $cron['ppp_share_post_event'];
20 20
 		$array_keys = array_keys( $ppp_data );
21 21
 		$hash_key   = $array_keys[0];
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) {
4
+if ( ! defined( 'ABSPATH' )) {
5 5
 	exit;
6 6
 }
7 7
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function ppp_replace_text_tokens( $string, $args = array() ) {
30 30
 	$tokens = wp_list_pluck( ppp_get_text_tokens(), 'token' );
31
-	foreach ( $tokens as $key => $token ) {
32
-		$string = apply_filters( 'ppp_replace_token-' . $token, $string, $args );
31
+	foreach ($tokens as $key => $token) {
32
+		$string = apply_filters( 'ppp_replace_token-'.$token, $string, $args );
33 33
 	}
34 34
 
35 35
 	return $string;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @return string         The string with the token {post_title} replaced
44 44
  */
45 45
 function ppp_post_title_token( $string, $args ) {
46
-	if ( !isset( $args['post_id'] ) ) {
46
+	if ( ! isset($args['post_id'])) {
47 47
 		return $string;
48 48
 	}
49 49
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function ppp_generate_unique_link( $share_link, $post_id, $name ) {
73 73
 	$name_parts = explode( '_', $name );
74
-	$share_link .= strpos( $share_link, '?' ) ? '&' : '?' ;
74
+	$share_link .= strpos( $share_link, '?' ) ? '&' : '?';
75 75
 
76 76
 	$query_string_var = apply_filters( 'ppp_query_string_var', 'ppp' );
77 77
 
78
-	$share_link .= $query_string_var . '=' . $post_id . '-' . $name_parts[1];
78
+	$share_link .= $query_string_var.'='.$post_id.'-'.$name_parts[1];
79 79
 
80 80
 	return $share_link;
81 81
 }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
  */
91 91
 function ppp_generate_google_utm_link( $share_link, $post_id, $name ) {
92 92
 	$name_parts = explode( '_', $name );
93
-	$service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw';
93
+	$service = isset($name_parts[3]) ? $name_parts[3] : 'tw';
94 94
 
95
-	switch( $service ) {
95
+	switch ($service) {
96 96
 		case 'li':
97 97
 			$network = 'LinkedIn';
98 98
 			break;
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 
108 108
 	$utm['source']   = $network;
109 109
 	$utm['medium']   = 'social';
110
-	$utm['term']     =  ppp_get_post_slug_by_id( $post_id );
110
+	$utm['term']     = ppp_get_post_slug_by_id( $post_id );
111 111
 	$utm['content']  = $name_parts[1]; // The day after publishing
112 112
 	$utm['campaign'] = 'PostPromoterPro';
113 113
 
114
-	$utm_string  = strpos( $share_link, '?' ) ? '&' : '?' ;
114
+	$utm_string = strpos( $share_link, '?' ) ? '&' : '?';
115 115
 	$first = true;
116
-	foreach ( $utm as $key => $value ) {
117
-		if ( !$first ) {
116
+	foreach ($utm as $key => $value) {
117
+		if ( ! $first) {
118 118
 			$utm_string .= '&';
119 119
 		}
120
-		$utm_string .= 'utm_' . $key . '=' . $value;
120
+		$utm_string .= 'utm_'.$key.'='.$value;
121 121
 		$first = false;
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
includes/share-functions.php 1 patch
Spacing   +40 added lines, -40 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
 
@@ -57,20 +57,20 @@  discard block
 block discarded – undo
57 57
 
58 58
 	// If we've already started to share this, don't share it again.
59 59
 	// Compensates for wp-cron's race conditions
60
-	if ( get_transient( 'ppp_sharing' . $name ) === 'true' ) {
60
+	if (get_transient( 'ppp_sharing'.$name ) === 'true') {
61 61
 		return;
62 62
 	}
63 63
 
64 64
 	// For 10 seconds, don't allow another share to go for this post
65
-	set_transient( 'ppp_sharing' . $name, 'true', 10 );
65
+	set_transient( 'ppp_sharing'.$name, 'true', 10 );
66 66
 
67 67
 	$name_parts = explode( '_', $name );
68 68
 	$index      = $name_parts[1];
69
-	$service    = isset( $name_parts[3] ) ? $name_parts[3] : 'tw';
69
+	$service    = isset($name_parts[3]) ? $name_parts[3] : 'tw';
70 70
 
71 71
 	// If we're fired on a cron, check for stale cron runs
72
-	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
73
-		switch( $service ) {
72
+	if (defined( 'DOING_CRON' ) && DOING_CRON) {
73
+		switch ($service) {
74 74
 			case 'tw':
75 75
 				$post_meta = get_post_meta( $post_id, '_ppp_tweets', true );
76 76
 				break;
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		$share_data = array();
88
-		if ( isset( $post_meta[ $index ] ) ) {
89
-			$share_data = $post_meta[ $index ];
88
+		if (isset($post_meta[$index])) {
89
+			$share_data = $post_meta[$index];
90 90
 		}
91 91
 
92 92
 		$timestamp = ppp_generate_timestamp( $share_data['date'], $share_data['time'] );
93 93
 
94 94
 		// If the current time is more than 60 minutes (filterable) overdue, don't fire the share
95 95
 		$share_buffer = apply_filters( 'ppp_share_buffer', HOUR_IN_SECONDS );
96
-		if ( ( current_time( 'timestamp', 1 ) - $timestamp ) > $share_buffer ) {
96
+		if ((current_time( 'timestamp', 1 ) - $timestamp) > $share_buffer) {
97 97
 			return;
98 98
 		}
99 99
 	}
100 100
 
101
-	do_action( 'ppp_share_scheduled_' . $service, $post_id, $index, $name );
101
+	do_action( 'ppp_share_scheduled_'.$service, $post_id, $index, $name );
102 102
 
103 103
 }
104 104
 
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
  * @return void
108 108
  */
109 109
 function ppp_set_social_tokens() {
110
-	if ( ( defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' ) ) ||
111
-	     ( defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' ) ) ||
112
-	     ( defined( 'bitly_clientid' ) && defined( 'bitly_secret' ) ) ||
113
-	     ( defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ) )
110
+	if ((defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' )) ||
111
+	     (defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' )) ||
112
+	     (defined( 'bitly_clientid' ) && defined( 'bitly_secret' )) ||
113
+	     (defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ))
114 114
 	   ) {
115 115
 		return;
116 116
 	}
117 117
 
118 118
 	$social_tokens = ppp_has_local_tokens();
119 119
 
120
-	if ( false === $social_tokens ) {
120
+	if (false === $social_tokens) {
121 121
 		define( 'PPP_LOCAL_TOKENS', false );
122 122
 		$social_tokens = get_transient( 'ppp_social_tokens' );
123 123
 
124
-		if ( ! $social_tokens ) {
124
+		if ( ! $social_tokens) {
125 125
 			$license = trim( get_option( '_ppp_license_key' ) );
126
-			$url = PPP_STORE_URL . '/?ppp-get-tokens&ppp-license-key=' . $license . '&ver=' . md5( time() . $license );
126
+			$url = PPP_STORE_URL.'/?ppp-get-tokens&ppp-license-key='.$license.'&ver='.md5( time().$license );
127 127
 			$response = wp_remote_get( $url, array( 'timeout' => 15, 'sslverify' => false ) );
128 128
 
129
-			if ( is_wp_error( $response ) ) {
129
+			if (is_wp_error( $response )) {
130 130
 				return false;
131 131
 			}
132 132
 
@@ -138,16 +138,16 @@  discard block
 block discarded – undo
138 138
 		define( 'PPP_LOCAL_TOKENS', true );
139 139
 		delete_transient( 'ppp_social_tokens' );
140 140
 
141
-		if ( isset( $social_tokens->options ) ) {
142
-			foreach ( $social_tokens->options as $constant => $value ) {
141
+		if (isset($social_tokens->options)) {
142
+			foreach ($social_tokens->options as $constant => $value) {
143 143
 
144 144
 				$constant = strtoupper( $constant );
145 145
 
146
-				if ( defined( $constant ) ) {
146
+				if (defined( $constant )) {
147 147
 					continue;
148 148
 				}
149 149
 
150
-				switch( $constant ) {
150
+				switch ($constant) {
151 151
 
152 152
 					case 'NO_AUTO_UPDATE':
153 153
 						// Avoid the call to the API to check for software updates
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		}
161 161
 	}
162 162
 
163
-	if ( false === PPP_LOCAL_TOKENS && ! isset( $social_tokens->error ) && ( isset( $social_tokens->twitter ) || isset( $social_tokens->facebook ) || isset( $social_tokens->linkedin ) ) ) {
163
+	if (false === PPP_LOCAL_TOKENS && ! isset($social_tokens->error) && (isset($social_tokens->twitter) || isset($social_tokens->facebook) || isset($social_tokens->linkedin))) {
164 164
 		set_transient( 'ppp_social_tokens', $social_tokens, WEEK_IN_SECONDS );
165 165
 	}
166 166
 
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function ppp_has_local_tokens() {
175 175
 
176
-	$token_file   = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path() . '/ppp-social-tokens.json' );
176
+	$token_file   = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path().'/ppp-social-tokens.json' );
177 177
 	$local_tokens = false;
178 178
 
179
-	if ( ! file_exists( $token_file ) ) {
179
+	if ( ! file_exists( $token_file )) {
180 180
 		return $local_tokens;
181 181
 	}
182 182
 
183 183
 	$local_tokens = json_decode( file_get_contents( $token_file ) );
184 184
 
185 185
 	// Failed to parse as JSON
186
-	if ( false === $local_tokens ) {
186
+	if (false === $local_tokens) {
187 187
 		return $local_tokens;
188 188
 	}
189 189
 
190 190
 	// No social tokens found in the format we accept or it was empty
191
-	if ( empty( $local_tokens ) || ( ! isset( $local_tokens->twitter ) || ! isset( $local_tokens->facebook ) || ! isset( $local_tokens->linkedin ) ) ) {
191
+	if (empty($local_tokens) || ( ! isset($local_tokens->twitter) || ! isset($local_tokens->facebook) || ! isset($local_tokens->linkedin))) {
192 192
 		return false;
193 193
 	}
194 194
 
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
 	global $ppp_share_settings;
207 207
 	$share_link = get_permalink( $post_id );
208 208
 
209
-	if ( ppp_link_tracking_enabled() ) {
209
+	if (ppp_link_tracking_enabled()) {
210 210
 		$share_link = ppp_generate_link_tracking( $share_link, $post_id, $name );
211 211
 	}
212 212
 
213
-	if ( ppp_is_shortener_enabled() && $scheduled ) {
213
+	if (ppp_is_shortener_enabled() && $scheduled) {
214 214
 		$shortener_name = $ppp_share_settings['shortener'];
215
-		$share_link = apply_filters( 'ppp_apply_shortener-' . $shortener_name, $share_link );
215
+		$share_link = apply_filters( 'ppp_apply_shortener-'.$shortener_name, $share_link );
216 216
 	}
217 217
 
218 218
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
  * @return string             The URL to post, with proper analytics applied if necessary
228 228
  */
229 229
 function ppp_generate_link_tracking( $share_link, $post_id, $name ) {
230
-	if ( ppp_link_tracking_enabled() ) {
230
+	if (ppp_link_tracking_enabled()) {
231 231
 		global $ppp_share_settings;
232 232
 		$link_tracking_type = $ppp_share_settings['analytics'];
233 233
 
234 234
 		// Given the setting name, devs can extend this and apply a filter of ppp_analytics-[setting value]
235 235
 		// to apply their own rules for link tracking
236
-		$share_link = apply_filters( 'ppp_analytics-' . $link_tracking_type, $share_link, $post_id, $name );
236
+		$share_link = apply_filters( 'ppp_analytics-'.$link_tracking_type, $share_link, $post_id, $name );
237 237
 	}
238 238
 
239 239
 	$share_link = apply_filters( 'ppp_generate_link_tracking', $share_link, $post_id, $name );
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
  * @return mixed             If a thumbnail is found returns the URL, otherwise returns false
250 250
  */
251 251
 function ppp_post_has_media( $post_id, $network, $use_media, $attachment_id = false ) {
252
-	if ( !$use_media || empty( $post_id ) || empty( $network ) ) {
252
+	if ( ! $use_media || empty($post_id) || empty($network)) {
253 253
 		return false;
254 254
 	}
255 255
 
256
-	$thumb_id = empty( $attachment_id ) ? get_post_thumbnail_id( $post_id ) : $attachment_id;
257
-	$thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-' . $network . '-share-image', true );
256
+	$thumb_id = empty($attachment_id) ? get_post_thumbnail_id( $post_id ) : $attachment_id;
257
+	$thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-'.$network.'-share-image', true );
258 258
 
259
-	if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) {
259
+	if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) {
260 260
 		return $thumb_url[0];
261 261
 	}
262 262
 
Please login to merge, or discard this patch.
includes/EDD_SL_Plugin_Updater.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly
7
-if ( ! defined( 'ABSPATH' ) ) exit;
7
+if ( ! defined( 'ABSPATH' )) exit;
8 8
 
9 9
 /**
10 10
  * Allows plugins to use their own update API.
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		$this->name        = plugin_basename( $_plugin_file );
41 41
 		$this->slug        = basename( $_plugin_file, '.php' );
42 42
 		$this->version     = $_api_data['version'];
43
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
43
+		$this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false;
44 44
 
45
-		$edd_plugin_data[ $this->slug ] = $this->api_data;
45
+		$edd_plugin_data[$this->slug] = $this->api_data;
46 46
 
47 47
 		// Set up hooks.
48 48
 		$this->init();
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
 		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
62 62
 		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
63
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
64
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
63
+		remove_action( 'after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10, 2 );
64
+		add_action( 'after_plugin_row_'.$this->name, array( $this, 'show_update_notification' ), 10, 2 );
65 65
 		add_action( 'admin_init', array( $this, 'show_changelog' ) );
66 66
 
67 67
 	}
@@ -83,30 +83,30 @@  discard block
 block discarded – undo
83 83
 
84 84
 		global $pagenow;
85 85
 
86
-		if ( ! is_object( $_transient_data ) ) {
86
+		if ( ! is_object( $_transient_data )) {
87 87
 			$_transient_data = new stdClass;
88 88
 		}
89 89
 
90
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
90
+		if ('plugins.php' == $pagenow && is_multisite()) {
91 91
 			return $_transient_data;
92 92
 		}
93 93
 
94
-		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
94
+		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
95 95
 			return $_transient_data;
96 96
 		}
97 97
 
98 98
 		$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
99 99
 
100
-		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
100
+		if (false !== $version_info && is_object( $version_info ) && isset($version_info->new_version)) {
101 101
 
102
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
102
+			if (version_compare( $this->version, $version_info->new_version, '<' )) {
103 103
 
104
-				$_transient_data->response[ $this->name ] = $version_info;
104
+				$_transient_data->response[$this->name] = $version_info;
105 105
 
106 106
 			}
107 107
 
108 108
 			$_transient_data->last_checked           = time();
109
-			$_transient_data->checked[ $this->name ] = $this->version;
109
+			$_transient_data->checked[$this->name] = $this->version;
110 110
 
111 111
 		}
112 112
 
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function show_update_notification( $file, $plugin ) {
123 123
 
124
-		if( ! current_user_can( 'update_plugins' ) ) {
124
+		if ( ! current_user_can( 'update_plugins' )) {
125 125
 			return;
126 126
 		}
127 127
 
128
-		if( ! is_multisite() ) {
128
+		if ( ! is_multisite()) {
129 129
 			return;
130 130
 		}
131 131
 
132
-		if ( $this->name != $file ) {
132
+		if ($this->name != $file) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -140,55 +140,55 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
142 142
 
143
-		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
143
+		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
144 144
 
145
-			$cache_key    = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' );
145
+			$cache_key    = md5( 'edd_plugin_'.sanitize_key( $this->name ).'_version_info' );
146 146
 			$version_info = get_transient( $cache_key );
147 147
 
148
-			if( false === $version_info ) {
148
+			if (false === $version_info) {
149 149
 
150 150
 				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
151 151
 
152 152
 				set_transient( $cache_key, $version_info, 3600 );
153 153
 			}
154 154
 
155
-			if( ! is_object( $version_info ) ) {
155
+			if ( ! is_object( $version_info )) {
156 156
 				return;
157 157
 			}
158 158
 
159
-			if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
159
+			if (version_compare( $this->version, $version_info->new_version, '<' )) {
160 160
 
161
-				$update_cache->response[ $this->name ] = $version_info;
161
+				$update_cache->response[$this->name] = $version_info;
162 162
 
163 163
 			}
164 164
 
165 165
 			$update_cache->last_checked = time();
166
-			$update_cache->checked[ $this->name ] = $this->version;
166
+			$update_cache->checked[$this->name] = $this->version;
167 167
 
168 168
 			set_site_transient( 'update_plugins', $update_cache );
169 169
 
170 170
 		} else {
171 171
 
172
-			$version_info = $update_cache->response[ $this->name ];
172
+			$version_info = $update_cache->response[$this->name];
173 173
 
174 174
 		}
175 175
 
176 176
 		// Restore our filter
177 177
 		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
178 178
 
179
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
179
+		if ( ! empty($update_cache->response[$this->name]) && version_compare( $this->version, $version_info->new_version, '<' )) {
180 180
 
181 181
 			// build a plugin list row, with update notification
182 182
 			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
183
-			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
183
+			echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
184 184
 
185
-			$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' );
185
+			$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' );
186 186
 
187
-			if ( empty( $version_info->download_link ) ) {
187
+			if (empty($version_info->download_link)) {
188 188
 				printf(
189 189
 					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
190 190
 					esc_html( $version_info->name ),
191
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
191
+					'<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">',
192 192
 					esc_html( $version_info->new_version ),
193 193
 					'</a>'
194 194
 				);
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 				printf(
197 197
 					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
198 198
 					esc_html( $version_info->name ),
199
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
199
+					'<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">',
200 200
 					esc_html( $version_info->new_version ),
201 201
 					'</a>',
202
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
202
+					'<a href="'.esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ).$this->name, 'upgrade-plugin_'.$this->name ) ).'">',
203 203
 					'</a>'
204 204
 				);
205 205
 			}
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
225 225
 
226 226
 
227
-		if ( $_action != 'plugin_information' ) {
227
+		if ($_action != 'plugin_information') {
228 228
 
229 229
 			return $_data;
230 230
 
231 231
 		}
232 232
 
233
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
233
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
234 234
 
235 235
 			return $_data;
236 236
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 		$api_response = $this->api_request( 'plugin_information', $to_send );
249 249
 
250
-		if ( false !== $api_response ) {
250
+		if (false !== $api_response) {
251 251
 			$_data = $api_response;
252 252
 		}
253 253
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public function http_request_args( $args, $url ) {
266 266
 		// If it is an https request and we are performing a package download, disable ssl verification
267
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
267
+		if (strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' )) {
268 268
 			$args['sslverify'] = false;
269 269
 		}
270 270
 		return $args;
@@ -287,19 +287,19 @@  discard block
 block discarded – undo
287 287
 
288 288
 		$data = array_merge( $this->api_data, $_data );
289 289
 
290
-		if ( $data['slug'] != $this->slug ) {
290
+		if ($data['slug'] != $this->slug) {
291 291
 			return;
292 292
 		}
293 293
 
294
-		if( $this->api_url == trailingslashit (home_url() ) ) {
294
+		if ($this->api_url == trailingslashit( home_url() )) {
295 295
 			return false; // Don't allow a plugin to ping itself
296 296
 		}
297 297
 
298 298
 		$api_params = array(
299 299
 			'edd_action' => 'get_version',
300
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
301
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
302
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
300
+			'license'    => ! empty($data['license']) ? $data['license'] : '',
301
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
302
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
303 303
 			'slug'       => $data['slug'],
304 304
 			'author'     => $data['author'],
305 305
 			'url'        => home_url()
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 
308 308
 		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
309 309
 
310
-		if ( ! is_wp_error( $request ) ) {
310
+		if ( ! is_wp_error( $request )) {
311 311
 			$request = json_decode( wp_remote_retrieve_body( $request ) );
312 312
 		}
313 313
 
314
-		if ( $request && isset( $request->sections ) ) {
314
+		if ($request && isset($request->sections)) {
315 315
 			$request->sections = maybe_unserialize( $request->sections );
316 316
 		} else {
317 317
 			$request = false;
@@ -324,32 +324,32 @@  discard block
 block discarded – undo
324 324
 
325 325
 		global $edd_plugin_data;
326 326
 
327
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
327
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
328 328
 			return;
329 329
 		}
330 330
 
331
-		if( empty( $_REQUEST['plugin'] ) ) {
331
+		if (empty($_REQUEST['plugin'])) {
332 332
 			return;
333 333
 		}
334 334
 
335
-		if( empty( $_REQUEST['slug'] ) ) {
335
+		if (empty($_REQUEST['slug'])) {
336 336
 			return;
337 337
 		}
338 338
 
339
-		if( ! current_user_can( 'update_plugins' ) ) {
339
+		if ( ! current_user_can( 'update_plugins' )) {
340 340
 			wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
341 341
 		}
342 342
 
343
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
344
-		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
343
+		$data         = $edd_plugin_data[$_REQUEST['slug']];
344
+		$cache_key    = md5( 'edd_plugin_'.sanitize_key( $_REQUEST['plugin'] ).'_version_info' );
345 345
 		$version_info = get_transient( $cache_key );
346 346
 
347
-		if( false === $version_info ) {
347
+		if (false === $version_info) {
348 348
 
349 349
 			$api_params = array(
350 350
 				'edd_action' => 'get_version',
351
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
352
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
351
+				'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
352
+				'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
353 353
 				'slug'       => $_REQUEST['slug'],
354 354
 				'author'     => $data['author'],
355 355
 				'url'        => home_url()
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 
358 358
 			$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
359 359
 
360
-			if ( ! is_wp_error( $request ) ) {
360
+			if ( ! is_wp_error( $request )) {
361 361
 				$version_info = json_decode( wp_remote_retrieve_body( $request ) );
362 362
 			}
363 363
 
364
-			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
364
+			if ( ! empty($version_info) && isset($version_info->sections)) {
365 365
 				$version_info->sections = maybe_unserialize( $version_info->sections );
366 366
 			} else {
367 367
 				$version_info = false;
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 
372 372
 		}
373 373
 
374
-		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
375
-			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
374
+		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) {
375
+			echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>';
376 376
 		}
377 377
 
378 378
 		exit;
Please login to merge, or discard this patch.
includes/general-functions.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
  */
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
 /**
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	$post_types = get_post_types( $post_type_args, NULL, 'and' );
102 102
 
103 103
 	$unsupported_post_types = array( 'wp_log', 'attachment' );
104
-	foreach ( $unsupported_post_types as $unsupported_post_type ) {
105
-		if ( array_key_exists( $unsupported_post_type, $post_types ) ) {
106
-			unset( $post_types[ $unsupported_post_type ] );
104
+	foreach ($unsupported_post_types as $unsupported_post_type) {
105
+		if (array_key_exists( $unsupported_post_type, $post_types )) {
106
+			unset($post_types[$unsupported_post_type]);
107 107
 		}
108 108
 	}
109 109
 
@@ -131,16 +131,16 @@  discard block
 block discarded – undo
131 131
 function ppp_should_save( $post_id, $post ) {
132 132
 	$ret = true;
133 133
 
134
-	if ( empty( $_POST ) ) {
134
+	if (empty($_POST)) {
135 135
 		$ret = false;
136 136
 	}
137 137
 
138
-	if ( wp_is_post_revision( $post_id ) ) {
138
+	if (wp_is_post_revision( $post_id )) {
139 139
 		$ret = false;
140 140
 	}
141 141
 
142 142
 	global $ppp_options;
143
-	if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) || !array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) {
143
+	if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] ) || ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) {
144 144
 		$ret = false;
145 145
 	}
146 146
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 function ppp_set_uploads_dir() {
157 157
 	$upload_path = ppp_get_upload_path();
158 158
 
159
-	if ( false === get_transient( 'ppp_check_protection_files' ) ) {
159
+	if (false === get_transient( 'ppp_check_protection_files' )) {
160 160
 
161 161
 		// Make sure the /ppp folder is created
162 162
 		wp_mkdir_p( $upload_path );
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
 		$rules  = "Options -Indexes\n";
166 166
 		$rules .= "deny from all\n";
167 167
 
168
-		$htaccess_exists = file_exists( $upload_path . '/.htaccess' );
168
+		$htaccess_exists = file_exists( $upload_path.'/.htaccess' );
169 169
 
170
-		if ( $htaccess_exists ) {
171
-			$contents = @file_get_contents( $upload_path . '/.htaccess' );
172
-			if ( $contents !== $rules || ! $contents ) {
170
+		if ($htaccess_exists) {
171
+			$contents = @file_get_contents( $upload_path.'/.htaccess' );
172
+			if ($contents !== $rules || ! $contents) {
173 173
 				// Update the .htaccess rules if they don't match
174
-				@file_put_contents( $upload_path . '/.htaccess', $rules );
174
+				@file_put_contents( $upload_path.'/.htaccess', $rules );
175 175
 			}
176
-		} elseif( wp_is_writable( $upload_path ) ) {
176
+		} elseif (wp_is_writable( $upload_path )) {
177 177
 			// Create the file if it doesn't exist
178
-			@file_put_contents( $upload_path . '/.htaccess', $rules );
178
+			@file_put_contents( $upload_path.'/.htaccess', $rules );
179 179
 		}
180 180
 
181 181
 		// Top level blank index.php
182
-		if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) {
183
-			@file_put_contents( $upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.' );
182
+		if ( ! file_exists( $upload_path.'/index.php' ) && wp_is_writable( $upload_path )) {
183
+			@file_put_contents( $upload_path.'/index.php', '<?php'.PHP_EOL.'// Silence is golden.' );
184 184
 		}
185 185
 
186 186
 		// Check for the files once per day
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function ppp_get_upload_path() {
199 199
 	$wp_upload_dir = wp_upload_dir();
200
-	return $wp_upload_dir['basedir'] . '/ppp';
200
+	return $wp_upload_dir['basedir'].'/ppp';
201 201
 }
202 202
 
203 203
 /**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
 	$completed_upgrades = get_option( 'ppp_completed_upgrades' );
212 212
 
213
-	if ( false === $completed_upgrades ) {
213
+	if (false === $completed_upgrades) {
214 214
 		$completed_upgrades = array();
215 215
 	}
216 216
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
  */
228 228
 function ppp_has_upgrade_completed( $upgrade_action = '' ) {
229 229
 
230
-	if ( empty( $upgrade_action ) ) {
230
+	if (empty($upgrade_action)) {
231 231
 		return false;
232 232
 	}
233 233
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
  */
247 247
 function ppp_set_upgrade_complete( $upgrade_action = '' ) {
248 248
 
249
-	if ( empty( $upgrade_action ) ) {
249
+	if (empty($upgrade_action)) {
250 250
 		return false;
251 251
 	}
252 252
 
Please login to merge, or discard this patch.