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 (#175)
by Chris
04:24
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.
post-promoter-pro.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 define( 'PPP_STORE_URL', 'https://postpromoterpro.com' );
18 18
 define( 'PPP_PLUGIN_NAME', 'Post Promoter Pro' );
19
-if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) {
19
+if ( ! class_exists( 'EDD_SL_Plugin_Updater' )) {
20 20
 	// load our custom updater
21
-	include( PPP_PATH . '/includes/EDD_SL_Plugin_Updater.php' );
21
+	include(PPP_PATH.'/includes/EDD_SL_Plugin_Updater.php');
22 22
 }
23 23
 
24 24
 class PostPromoterPro {
@@ -27,27 +27,27 @@  discard block
 block discarded – undo
27 27
 	private function __construct() {
28 28
 		add_action( 'init', array( $this, 'ppp_loaddomain' ), 1 );
29 29
 
30
-		if ( ! is_callable( 'curl_init' ) ) {
30
+		if ( ! is_callable( 'curl_init' )) {
31 31
 			add_action( 'admin_notices', array( $this, 'no_curl' ) );
32 32
 		} else {
33 33
 			global $ppp_options, $ppp_social_settings, $ppp_share_settings;
34 34
 
35
-			include PPP_PATH . '/includes/general-functions.php';
36
-			include PPP_PATH . '/includes/share-functions.php';
37
-			include PPP_PATH . '/includes/cron-functions.php';
38
-			include PPP_PATH . '/includes/filters.php';
39
-			include PPP_PATH . '/includes/libs/social-loader.php';
40
-			include PPP_PATH . '/includes/libs/class-wp-logging.php';
41
-
42
-			if ( is_admin() ) {
43
-				include PPP_PATH . '/includes/admin/upgrades.php';
44
-				include PPP_PATH . '/includes/admin/do-upgrades.php';
45
-				include PPP_PATH . '/includes/admin/actions.php';
46
-				include PPP_PATH . '/includes/admin/admin-pages.php';
47
-				include PPP_PATH . '/includes/admin/admin-ajax.php';
48
-				include PPP_PATH . '/includes/admin/meta-boxes.php';
49
-				include PPP_PATH . '/includes/admin/welcome.php';
50
-				include PPP_PATH . '/includes/admin/dashboard.php';
35
+			include PPP_PATH.'/includes/general-functions.php';
36
+			include PPP_PATH.'/includes/share-functions.php';
37
+			include PPP_PATH.'/includes/cron-functions.php';
38
+			include PPP_PATH.'/includes/filters.php';
39
+			include PPP_PATH.'/includes/libs/social-loader.php';
40
+			include PPP_PATH.'/includes/libs/class-wp-logging.php';
41
+
42
+			if (is_admin()) {
43
+				include PPP_PATH.'/includes/admin/upgrades.php';
44
+				include PPP_PATH.'/includes/admin/do-upgrades.php';
45
+				include PPP_PATH.'/includes/admin/actions.php';
46
+				include PPP_PATH.'/includes/admin/admin-pages.php';
47
+				include PPP_PATH.'/includes/admin/admin-ajax.php';
48
+				include PPP_PATH.'/includes/admin/meta-boxes.php';
49
+				include PPP_PATH.'/includes/admin/welcome.php';
50
+				include PPP_PATH.'/includes/admin/dashboard.php';
51 51
 			}
52 52
 
53 53
 			register_activation_hook( PPP_FILE, array( $this, 'activation_setup' ) );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access public
68 68
 	 */
69 69
 	public static function getInstance() {
70
-		if ( !self::$ppp_instance ) {
70
+		if ( ! self::$ppp_instance) {
71 71
 			self::$ppp_instance = new PostPromoterPro();
72 72
 		}
73 73
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function activation_setup() {
94 94
 		// If the settings already exist, don't do this
95
-		if ( get_option( 'ppp_options' ) ) {
95
+		if (get_option( 'ppp_options' )) {
96 96
 			return;
97 97
 		}
98 98
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	private function hooks() {
113
-		if ( is_admin() ) {
113
+		if (is_admin()) {
114 114
 			add_action( 'admin_init', array( $this, 'ppp_register_settings' ) );
115 115
 			add_action( 'admin_init', 'ppp_upgrade_plugin', 1 );
116 116
 
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 		}
128 128
 
129 129
 		add_action( 'init', array( $this, 'get_actions' ) );
130
-		add_action( 'save_post', 'ppp_schedule_share', 99, 2);
131
-		add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3);
130
+		add_action( 'save_post', 'ppp_schedule_share', 99, 2 );
131
+		add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 );
132 132
 		add_action( 'init', 'ppp_add_image_sizes' );
133 133
 		add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 );
134 134
 	}
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
 
152 152
 		$allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook );
153 153
 
154
-		if ( ! in_array( $hook, $allowed_pages ) ) {
154
+		if ( ! in_array( $hook, $allowed_pages )) {
155 155
 			return;
156 156
 		}
157 157
 
158 158
 		wp_enqueue_script( 'jquery-ui-core' );
159 159
 		wp_enqueue_script( 'jquery-ui-datepicker' );
160 160
 
161
-		$jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js';
162
-		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
161
+		$jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js';
162
+		wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true );
163 163
 		wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true );
164 164
 
165 165
 	}
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 
169 169
 		// List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only
170 170
 		// load ours if they don't exist
171
-		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) {
171
+		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) {
172 172
 			wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' );
173 173
 		}
174 174
 
175
-		wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION );
175
+		wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION );
176 176
 		wp_enqueue_style( 'ppp_admin_css' );
177 177
 
178 178
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @access public
186 186
 	 */
187 187
 	public function plugin_settings_links( $links, $file ) {
188
-		if ( $file != PPP_FILE ) {
188
+		if ($file != PPP_FILE) {
189 189
 			return $links;
190 190
 		}
191 191
 
@@ -279,22 +279,22 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function plugin_updater() {
281 281
 
282
-		if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) {
282
+		if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) {
283 283
 			return;
284 284
 		}
285 285
 
286 286
 		$license_key = trim( get_option( '_ppp_license_key' ) );
287 287
 
288
-		if ( empty( $license_key ) ) {
288
+		if (empty($license_key)) {
289 289
 			add_action( 'admin_notices', array( $this, 'no_license_nag' ) );
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// setup the updater
294 294
 		$edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array(
295
-				'version'   => PPP_VERSION,         // current version number
296
-				'license'   => $license_key,        // license key (used get_option above to retrieve from DB)
297
-				'item_name' => PPP_PLUGIN_NAME,     // name of this plugin
295
+				'version'   => PPP_VERSION, // current version number
296
+				'license'   => $license_key, // license key (used get_option above to retrieve from DB)
297
+				'item_name' => PPP_PLUGIN_NAME, // name of this plugin
298 298
 				'author'    => 'Post Promoter Pro'  // author of this plugin
299 299
 			)
300 300
 		);
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function deactivate_license() {
326 326
 		// listen for our activate button to be clicked
327
-		if( isset( $_POST['ppp_license_deactivate'] ) ) {
327
+		if (isset($_POST['ppp_license_deactivate'])) {
328 328
 
329 329
 			// run a quick security check
330
-			if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) {
330
+			if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) {
331 331
 				return;
332 332
 			}
333 333
 			// get out if we didn't click the Activate button
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
348 348
 
349 349
 			// make sure the response came back okay
350
-			if ( is_wp_error( $response ) ) {
350
+			if (is_wp_error( $response )) {
351 351
 				return false;
352 352
 			}
353 353
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
356 356
 
357 357
 			// $license_data->license will be either "deactivated" or "failed"
358
-			if( $license_data->license == 'deactivated' ) {
358
+			if ($license_data->license == 'deactivated') {
359 359
 				delete_option( '_ppp_license_key_status' );
360 360
 			}
361 361
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	public function activate_license() {
370 370
 		// listen for our activate button to be clicked
371
-		if( isset( $_POST['ppp_license_activate'] ) ) {
371
+		if (isset($_POST['ppp_license_activate'])) {
372 372
 
373 373
 			// run a quick security check
374
-			if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) {
374
+			if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) {
375 375
 				return;
376 376
 			}
377 377
 			// get out if we didn't click the Activate button
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 			$response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
392 392
 
393 393
 			// make sure the response came back okay
394
-			if ( is_wp_error( $response ) ) {
394
+			if (is_wp_error( $response )) {
395 395
 				return false;
396 396
 			}
397 397
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public function ppp_sanitize_license( $new ) {
414 414
 		$old = get_option( '_ppp_license_key' );
415
-		if( $old && $old != $new ) {
415
+		if ($old && $old != $new) {
416 416
 			delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate
417 417
 		}
418 418
 		return $new;
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 	 * @return void
425 425
 	 */
426 426
 	public function get_actions() {
427
-		if ( isset( $_GET['ppp_action'] ) ) {
428
-			do_action( 'ppp_' . $_GET['ppp_action'], $_GET );
427
+		if (isset($_GET['ppp_action'])) {
428
+			do_action( 'ppp_'.$_GET['ppp_action'], $_GET );
429 429
 		}
430 430
 	}
431 431
 
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/twitter-functions.php 1 patch
Spacing   +118 added lines, -118 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
 	}
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	global $ppp_options, $wp_logs, $wp_filter;
169 169
 
170 170
 	$post_meta     = get_post_meta( $post_id, '_ppp_tweets', true );
171
-	$this_share    = $post_meta[ $index ];
172
-	$attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false;
171
+	$this_share    = $post_meta[$index];
172
+	$attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false;
173 173
 
174 174
 	$share_message = ppp_tw_build_share_message( $post_id, $name );
175 175
 
176
-	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) {
176
+	if (empty($attachment_id) && ! empty($this_share['image'])) {
177 177
 		$media = $this_share['image'];
178 178
 	} else {
179 179
 		$use_media = ppp_tw_use_media( $post_id, $index );
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 
200 200
 	update_post_meta( $log_entry, '_ppp_share_status', $status );
201 201
 
202
-	if ( ! empty( $status->id_str ) ) {
202
+	if ( ! empty($status->id_str)) {
203 203
 		$post      = get_post( $post_id );
204 204
 		$author_id = $post->post_author;
205 205
 		$author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true );
206 206
 
207
-		if ( $author_rt ) {
207
+		if ($author_rt) {
208 208
 			$twitter_user = new PPP_Twitter_User( $author_id );
209 209
 			$twitter_user->retweet( $status->id_str );
210 210
 		}
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) {
225 225
 	$share_content = ppp_tw_generate_share_content( $post_id, $name );
226 226
 
227
-	if ( $include_link ) {
227
+	if ($include_link) {
228 228
 		$share_link    = ppp_generate_link( $post_id, $name, $scheduled );
229
-		$share_content = $share_content . ' ' . $share_link;
229
+		$share_content = $share_content.' '.$share_link;
230 230
 	}
231 231
 
232 232
 	return apply_filters( 'ppp_tw_build_share_message', $share_content );
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) {
242 242
 	global $ppp_options;
243
-	$default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : '';
243
+	$default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : '';
244 244
 	$ppp_tweets   = get_post_meta( $post_id, '_ppp_tweets', true );
245 245
 
246
-	if ( $is_scheduled && ! empty( $ppp_tweets ) ) {
246
+	if ($is_scheduled && ! empty($ppp_tweets)) {
247 247
 		$ppp_post_override_data = get_post_meta( $post_id, '_ppp_post_override_data', true );
248 248
 		$name_array    = explode( '_', $name );
249 249
 		$index         = $name_array[1];
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 	}
252 252
 
253 253
 	// If an override was found, use it, otherwise try the default text content
254
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text;
254
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text;
255 255
 
256 256
 	// If the content is still empty, just use the post title
257
-	$share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id );
257
+	$share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id );
258 258
 
259 259
 	return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) );
260 260
 }
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
  * @return bool         Whether or not this tweet should contain a media post
267 267
  */
268 268
 function ppp_tw_use_media( $post_id, $index ) {
269
-	if ( empty( $post_id ) || empty( $index ) ) {
269
+	if (empty($post_id) || empty($index)) {
270 270
 		return false;
271 271
 	}
272 272
 
273 273
 	$share_data = get_post_meta( $post_id, '_ppp_tweets', true );
274
-	$use_media  = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false;
274
+	$use_media  = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false;
275 275
 
276 276
 	return $use_media;
277 277
 }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
  * @return void
283 283
  */
284 284
 function ppp_set_tw_token_constants( $social_tokens ) {
285
-	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) {
285
+	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) {
286 286
 		define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token );
287 287
 		define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret );
288 288
 	}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
  */
321 321
 function ppp_tw_add_meta_tab( $tabs ) {
322 322
 	global $ppp_social_settings;
323
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
323
+	if ( ! isset($ppp_social_settings['twitter'])) {
324 324
 		return $tabs;
325 325
 	}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
  */
338 338
 function ppp_tw_register_metabox_content( $content ) {
339 339
 	global $ppp_social_settings;
340
-	if ( !isset( $ppp_social_settings['twitter'] ) ) {
340
+	if ( ! isset($ppp_social_settings['twitter'])) {
341 341
 		return $content;
342 342
 	}
343 343
 
@@ -396,16 +396,16 @@  discard block
 block discarded – undo
396 396
 							<tbody>
397 397
 								<?php ppp_render_tweet_share_on_publish_row(); ?>
398 398
 								<?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?>
399
-								<?php if ( ! empty( $tweets ) ) : ?>
399
+								<?php if ( ! empty($tweets)) : ?>
400 400
 
401
-									<?php foreach ( $tweets as $key => $value ) :
402
-										$date          = isset( $value['date'] )          ? $value['date']          : '';
403
-										$time          = isset( $value['time'] )          ? $value['time']          : '';
404
-										$text          = isset( $value['text'] )          ? $value['text']          : '';
405
-										$image         = isset( $value['image'] )         ? $value['image']         : '';
406
-										$attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : '';
401
+									<?php foreach ($tweets as $key => $value) :
402
+										$date          = isset($value['date']) ? $value['date'] : '';
403
+										$time          = isset($value['time']) ? $value['time'] : '';
404
+										$text          = isset($value['text']) ? $value['text'] : '';
405
+										$image         = isset($value['image']) ? $value['image'] : '';
406
+										$attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : '';
407 407
 
408
-										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value );
408
+										$args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value );
409 409
 										?>
410 410
 
411 411
 										<?php ppp_render_tweet_row( $key, $args, $post->ID ); ?>
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 									<?php endforeach; ?>
415 415
 
416 416
 									<?php
417
-									if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) {
417
+									if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) {
418 418
 										$args = array(
419 419
 											'date'          => '',
420 420
 											'time'          => '',
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 								<tr>
438 438
 									<td class="submit" colspan="4" style="float: none; clear:both; background:#fff;">
439 439
 										<a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a>
440
-										<?php if ( ! empty( $has_past_shares ) ) : ?>
440
+										<?php if ( ! empty($has_past_shares)) : ?>
441 441
 											<a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a>
442 442
 										<?php endif; ?>
443 443
 									</td>
@@ -463,38 +463,38 @@  discard block
 block discarded – undo
463 463
  */
464 464
 function ppp_render_tweet_share_on_publish_row() {
465 465
 	global $post, $ppp_share_settings;
466
-	$default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
466
+	$default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' );
467 467
 
468 468
 	$ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true );
469 469
 
470 470
 	$ppp_share_on_publish  = get_post_meta( $post->ID, '_ppp_share_on_publish', true );
471 471
 	$show_share_on_publish = false;
472 472
 
473
-	$share_by_default      = empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? false : true;
473
+	$share_by_default      = empty($ppp_share_settings['twitter']['share_on_publish']) ? false : true;
474 474
 
475
-	if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) {
475
+	if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) {
476 476
 		$show_share_on_publish = true;
477 477
 	}
478 478
 
479 479
 	$ppp_share_on_publish_text          = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
480 480
 	$ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true );
481 481
 
482
-	$disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false;
482
+	$disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false;
483 483
 	?>
484 484
 	<tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row">
485 485
 		<td colspan="2" class="ppp-on-plublish-date-column">
486
-			<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 ); ?> />
486
+			<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 ); ?> />
487 487
 			&nbsp;<label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label>
488 488
 		</td>
489 489
 
490 490
 		<td>
491
-			<input <?php if ( $disabled ): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" />
492
-			<?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?>
491
+			<input <?php if ($disabled): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" />
492
+			<?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?>
493 493
 			&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
494 494
 		</td>
495 495
 
496 496
 		<td style="width: 200px" colspan="2">
497
-			<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 ); ?>/>
497
+			<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 ); ?>/>
498 498
 			&nbsp;<label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label>
499 499
 		</td>
500 500
 
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
 function ppp_render_tweet_row( $key, $args = array(), $post_id ) {
514 514
 	global $post, $has_past_shares;
515 515
 
516
-	$share_time     = strtotime( $args['date'] . ' ' . $args['time'] );
516
+	$share_time     = strtotime( $args['date'].' '.$args['time'] );
517 517
 	$readonly       = current_time( 'timestamp' ) > $share_time ? 'readonly="readonly" ' : false;
518
-	$no_date        = ! empty( $readonly ) ? ' hasDatepicker' : '';
519
-	$hide           = ! empty( $readonly ) ? 'display: none;' : '';
520
-	$shared         = ! empty( $readonly ) ? 'past-share' : '';
518
+	$no_date        = ! empty($readonly) ? ' hasDatepicker' : '';
519
+	$hide           = ! empty($readonly) ? 'display: none;' : '';
520
+	$shared         = ! empty($readonly) ? 'past-share' : '';
521 521
 
522
-	if ( ! empty( $readonly ) ) {
522
+	if ( ! empty($readonly)) {
523 523
 		$has_past_shares++;
524 524
 	}
525 525
 	?>
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 
535 535
 		<td>
536 536
 			<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'] ); ?>" />
537
-			<?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?>
537
+			<?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?>
538 538
 			&nbsp;<span class="ppp-text-length"><?php echo $length; ?></span>
539 539
 		</td>
540 540
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		</td>
554 554
 
555 555
 		<td>
556
-			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
556
+			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">&times;</a>
557 557
 		</td>
558 558
 
559 559
 	</tr>
@@ -568,24 +568,24 @@  discard block
 block discarded – undo
568 568
  */
569 569
 function ppp_tw_save_post_meta_boxes( $post_id, $post ) {
570 570
 
571
-	if ( ! ppp_should_save( $post_id, $post ) ) {
571
+	if ( ! ppp_should_save( $post_id, $post )) {
572 572
 		return;
573 573
 	}
574 574
 
575
-	$ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0';
575
+	$ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0';
576 576
 
577
-	$ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0';
578
-	$ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
579
-	$ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
577
+	$ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0';
578
+	$ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : '';
579
+	$ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : '';
580 580
 
581 581
 
582 582
 	update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish );
583 583
 	update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text );
584 584
 	update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image );
585 585
 
586
-	$tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array();
587
-	foreach ( $tweet_data as $index => $tweet ) {
588
-		$tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] );
586
+	$tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array();
587
+	foreach ($tweet_data as $index => $tweet) {
588
+		$tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] );
589 589
 	}
590 590
 	update_post_meta( $post_id, '_ppp_tweets', $tweet_data );
591 591
 
@@ -603,28 +603,28 @@  discard block
 block discarded – undo
603 603
 	global $ppp_options;
604 604
 
605 605
 	$from_meta = get_post_meta( $post->ID, '_ppp_share_on_publish', true );
606
-	$from_post = isset( $_POST['_ppp_share_on_publish'] );
606
+	$from_post = isset($_POST['_ppp_share_on_publish']);
607 607
 
608
-	if ( empty( $from_meta ) && empty( $from_post ) ) {
608
+	if (empty($from_meta) && empty($from_post)) {
609 609
 		return;
610 610
 	}
611 611
 
612 612
 	// Determine if we're seeing the share on publish in meta or $_POST
613
-	if ( $from_meta && !$from_post ) {
613
+	if ($from_meta && ! $from_post) {
614 614
 		$ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true );
615 615
 		$use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true );
616 616
 	} else {
617
-		$ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : '';
618
-		$use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false;
617
+		$ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : '';
618
+		$use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false;
619 619
 	}
620 620
 
621
-	$share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
621
+	$share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false );
622 622
 	$share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) );
623
-	$name = 'sharedate_0_' . $post->ID;
623
+	$name = 'sharedate_0_'.$post->ID;
624 624
 	$media = ppp_post_has_media( $post->ID, 'tw', $use_media );
625 625
 	$share_link = ppp_generate_link( $post->ID, $name, true );
626 626
 
627
-	$status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media );
627
+	$status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media );
628 628
 
629 629
 	$log_title = ppp_tw_build_share_message( $post->ID, $name, false, false );
630 630
 
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 
642 642
 	$log_entry = WP_Logging::insert_log( $log_data, $log_meta );
643 643
 
644
-	if ( ! empty( $status->id_str ) ) {
644
+	if ( ! empty($status->id_str)) {
645 645
 		$author_id = $post->post_author;
646 646
 		$author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true );
647 647
 
648
-		if ( $author_rt ) {
648
+		if ($author_rt) {
649 649
 			$twitter_user = new PPP_Twitter_User( $author_id );
650 650
 			$twitter_user->retweet( $status->id_str );
651 651
 		}
@@ -665,20 +665,20 @@  discard block
 block discarded – undo
665 665
 function ppp_tw_generate_timestamps( $times, $post_id ) {
666 666
 	$ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true );
667 667
 
668
-	if ( empty( $ppp_tweets ) ) {
668
+	if (empty($ppp_tweets)) {
669 669
 		$ppp_tweets = array();
670 670
 	}
671 671
 
672
-	foreach ( $ppp_tweets as $key => $data ) {
673
-		if ( ! array_filter( $data ) ) {
672
+	foreach ($ppp_tweets as $key => $data) {
673
+		if ( ! array_filter( $data )) {
674 674
 			continue;
675 675
 		}
676 676
 
677 677
 		$timestamp = ppp_generate_timestamp( $data['date'], $data['time'] );
678 678
 
679
-		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future
680
-			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw';
681
-			$times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw';
679
+		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future
680
+			$time_key           = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw';
681
+			$times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw';
682 682
 		}
683 683
 
684 684
 	}
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
 	$ret = false;
700 700
 
701
-	if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) {
701
+	if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) {
702 702
 		$ret = true;
703 703
 	}
704 704
 
@@ -713,13 +713,13 @@  discard block
 block discarded – undo
713 713
  */
714 714
 function ppp_tw_card_meta() {
715 715
 
716
-	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) {
716
+	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) {
717 717
 		return;
718 718
 	}
719 719
 
720 720
 	global $post, $ppp_options;
721 721
 
722
-	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) {
722
+	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) {
723 723
 		return;
724 724
 	}
725 725
 
@@ -737,20 +737,20 @@  discard block
 block discarded – undo
737 737
 
738 738
 	$return = '';
739 739
 
740
-	if ( ! is_single() || ! ppp_tw_cards_enabled() ) {
740
+	if ( ! is_single() || ! ppp_tw_cards_enabled()) {
741 741
 		return $return;
742 742
 	}
743 743
 
744 744
 	global $post, $ppp_social_settings;
745 745
 
746 746
 
747
-	if ( empty( $post ) ) {
747
+	if (empty($post)) {
748 748
 		return;
749 749
 	}
750 750
 
751 751
 	$elements = ppp_tw_default_meta_elements();
752
-	foreach ( $elements as $name => $content ) {
753
-		$return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n";
752
+	foreach ($elements as $name => $content) {
753
+		$return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n";
754 754
 	}
755 755
 
756 756
 	return apply_filters( 'ppp_tw_card_meta', $return );
@@ -770,22 +770,22 @@  discard block
 block discarded – undo
770 770
 	$elements = array();
771 771
 
772 772
 	$image_url = ppp_post_has_media( $post->ID, 'tw', true );
773
-	if ( $image_url ) {
773
+	if ($image_url) {
774 774
 		$elements['twitter:card']      = 'summary_large_image';
775 775
 		$elements['twitter:image:src'] = $image_url;
776 776
 	} else {
777 777
 		$elements['twitter:card'] = 'summary';
778 778
 	}
779 779
 
780
-	$elements['twitter:site']        = '@' . $ppp_social_settings['twitter']['user']->screen_name;
780
+	$elements['twitter:site']        = '@'.$ppp_social_settings['twitter']['user']->screen_name;
781 781
 	$elements['twitter:title']       = esc_attr( strip_tags( $post->post_title ) );
782 782
 	$elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() );
783 783
 
784 784
 	$author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true );
785
-	if ( ! empty( $author_twitter_handle ) ) {
785
+	if ( ! empty($author_twitter_handle)) {
786 786
 
787
-		if ( strpos( $author_twitter_handle, '@' ) === false ) {
788
-			$author_twitter_handle = '@' . $author_twitter_handle;
787
+		if (strpos( $author_twitter_handle, '@' ) === false) {
788
+			$author_twitter_handle = '@'.$author_twitter_handle;
789 789
 		}
790 790
 
791 791
 		$elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) );
@@ -804,13 +804,13 @@  discard block
 block discarded – undo
804 804
 function ppp_tw_get_card_description() {
805 805
 	global $post;
806 806
 
807
-	if ( ! is_single() || empty( $post ) ) {
807
+	if ( ! is_single() || empty($post)) {
808 808
 		return false;
809 809
 	}
810 810
 
811 811
 	$excerpt = $post->post_excerpt;
812 812
 
813
-	if ( empty( $excerpt ) ) {
813
+	if (empty($excerpt)) {
814 814
 		$excerpt = ppp_tw_format_card_description( $post->content );
815 815
 	}
816 816
 
@@ -828,10 +828,10 @@  discard block
 block discarded – undo
828 828
 	$max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 );
829 829
 	$excerpt = strip_tags( $excerpt );
830 830
 
831
-	if ( strlen( $excerpt ) > $max_len ) {
831
+	if (strlen( $excerpt ) > $max_len) {
832 832
 		$excerpt_pre = substr( $excerpt, 0, $max_len );
833 833
 		$last_space  = strrpos( $excerpt_pre, ' ' );
834
-		$excerpt     = substr( $excerpt_pre, 0, $last_space ) . '...';
834
+		$excerpt     = substr( $excerpt_pre, 0, $last_space ).'...';
835 835
 	}
836 836
 
837 837
 	return $excerpt;
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function ppp_tw_add_contact_method( $user_contactmethods ) {
848 848
 
849
-	if ( ! isset( $user_contactmethods['twitter'] ) ) {
849
+	if ( ! isset($user_contactmethods['twitter'])) {
850 850
 		$user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' );
851 851
 	}
852 852
 	// Returns the contact methods
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
  */
865 865
 function ppp_tw_profile_settings( $user ) {
866 866
 
867
-	if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) {
867
+	if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) {
868 868
 		return;
869 869
 	}
870 870
 
871
-	if ( $user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' ) ) {
871
+	if ($user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' )) {
872 872
 		return;
873 873
 	}
874 874
 
@@ -882,16 +882,16 @@  discard block
 block discarded – undo
882 882
 			<?php
883 883
 			$twitter = new PPP_Twitter_User( get_current_user_id() );
884 884
 			$tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true );
885
-			if ( empty( $tw_user ) ) {
886
-				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) );
885
+			if (empty($tw_user)) {
886
+				$tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) );
887 887
 
888
-				echo '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>';
888
+				echo '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>';
889 889
 			} else {
890 890
 				$connected = true;
891 891
 				?>
892 892
 				<p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p>
893 893
 				<p>
894
-					<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;
894
+					<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;
895 895
 					<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a>
896 896
 				</p>
897 897
 				<?php
@@ -900,10 +900,10 @@  discard block
 block discarded – undo
900 900
 			</td>
901 901
 		</tr>
902 902
 
903
-		<?php if ( $connected ) : ?>
903
+		<?php if ($connected) : ?>
904 904
 		<?php
905 905
 			$share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true );
906
-			$share_scheduled  = get_user_meta( $user->ID, '_ppp_share_scheduled' , true );
906
+			$share_scheduled  = get_user_meta( $user->ID, '_ppp_share_scheduled', true );
907 907
 		?>
908 908
 		<tr>
909 909
 			<th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th>
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
  */
937 937
 function ppp_tw_save_profile( $user_id ) {
938 938
 
939
-	$share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false;
940
-	$share_scheduled  = ! empty( $_POST['share_scheduled'] )  ? true : false;
939
+	$share_on_publish = ! empty($_POST['share_on_publish']) ? true : false;
940
+	$share_scheduled  = ! empty($_POST['share_scheduled']) ? true : false;
941 941
 
942 942
 	update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish );
943
-	update_user_meta( $user_id, '_ppp_share_scheduled' , $share_scheduled  );
943
+	update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled );
944 944
 
945 945
 }
946 946
 add_action( 'personal_options_update', 'ppp_tw_save_profile' );
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 function ppp_tw_calendar_on_publish_event( $events, $post_id ) {
950 950
 	$share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true );
951 951
 
952
-	if ( ! empty( $share_on_publish ) ) {
952
+	if ( ! empty($share_on_publish)) {
953 953
 		$share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true );
954 954
 		$events[] = array(
955
-			'id' => $post_id . '-share-on-publish',
956
-			'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ),
957
-			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
958
-			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ),
959
-			'className' => 'ppp-calendar-item-tw cal-post-' . $post_id,
955
+			'id' => $post_id.'-share-on-publish',
956
+			'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ),
957
+			'start'     => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
958
+			'end'       => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ),
959
+			'className' => 'ppp-calendar-item-tw cal-post-'.$post_id,
960 960
 			'belongsTo' => $post_id,
961 961
 		);
962 962
 	}
@@ -967,9 +967,9 @@  discard block
 block discarded – undo
967 967
 
968 968
 function ppp_tw_get_post_shares( $items, $post_id ) {
969 969
 	$tweets = get_post_meta( $post_id, '_ppp_tweets', true );
970
-	if ( empty( $tweets ) ) { return $items; }
970
+	if (empty($tweets)) { return $items; }
971 971
 
972
-	foreach ( $tweets as $key => $tweet ) {
972
+	foreach ($tweets as $key => $tweet) {
973 973
 		$items[] = array( 'id' => $key, 'service' => 'tw' );
974 974
 	}
975 975
 	return $items;
Please login to merge, or discard this patch.
includes/cron-functions.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
 
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function ppp_schedule_share( $post_id, $post ) {
15 15
 	global $ppp_options;
16
-	$allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array();
16
+	$allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array();
17 17
 	$allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types );
18 18
 
19
-	if ( ! isset( $_POST['post_status'] ) || ! array_key_exists( $post->post_type, $allowed_post_types ) ) {
19
+	if ( ! isset($_POST['post_status']) || ! array_key_exists( $post->post_type, $allowed_post_types )) {
20 20
 		return;
21 21
 	}
22 22
 
23 23
 	ppp_remove_scheduled_shares( $post_id );
24 24
 
25
-	if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published
26
-		( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post
27
-		( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post
25
+	if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published
26
+		($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post
27
+		($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post
28 28
 		global $ppp_options, $ppp_social_settings;
29 29
 
30 30
 		$timestamps = ppp_get_timestamps( $post_id );
31 31
 
32
-		foreach ( $timestamps as $timestamp => $name ) {
32
+		foreach ($timestamps as $timestamp => $name) {
33 33
 			$timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 );
34 34
 			wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) );
35 35
 		}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	$current_item_shares = ppp_get_shceduled_crons( $post_id );
50 50
 
51
-	foreach ( $current_item_shares as $share ) {
51
+	foreach ($current_item_shares as $share) {
52 52
 		wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) );
53 53
 	}
54 54
 
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
 	$all_crons = get_option( 'cron' );
74 74
 	$ppp_crons = array();
75 75
 
76
-	foreach ( $all_crons as $timestamp => $cron ) {
77
-		if ( ! isset( $cron['ppp_share_post_event'] ) ) {
76
+	foreach ($all_crons as $timestamp => $cron) {
77
+		if ( ! isset($cron['ppp_share_post_event'])) {
78 78
 			continue;
79 79
 		}
80 80
 
81
-		foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) {
81
+		foreach ($cron['ppp_share_post_event'] as $key => $single_event) {
82 82
 			$name_parts = explode( '_', $single_event['args'][1] );
83
-			if ( false !== $post_id && $post_id != $name_parts[2] ) {
83
+			if (false !== $post_id && $post_id != $name_parts[2]) {
84 84
 				continue;
85 85
 			}
86 86
 
87 87
 			$single_event['timestamp'] = $timestamp;
88
-			$ppp_crons[ $key ]         = $single_event;
88
+			$ppp_crons[$key]         = $single_event;
89 89
 		}
90 90
 
91 91
 	}
@@ -103,26 +103,26 @@  discard block
 block discarded – undo
103 103
  *
104 104
  */
105 105
 function ppp_has_cron_within( $time = 0, $within = 0 ) {
106
-	if ( empty( $time ) ) {
106
+	if (empty($time)) {
107 107
 		$time = current_time( 'timestamp' );
108 108
 	}
109 109
 
110
-	if ( empty( $within ) ) {
110
+	if (empty($within)) {
111 111
 		$within = ppp_get_default_conflict_window();
112 112
 	}
113 113
 
114 114
 	$crons = ppp_get_shceduled_crons();
115 115
 
116
-	if ( empty( $crons ) ) {
116
+	if (empty($crons)) {
117 117
 		return false;
118 118
 	}
119 119
 
120 120
 	$scheduled_times = wp_list_pluck( $crons, 'timestamp' );
121 121
 
122 122
 	$found_time = false;
123
-	foreach ( $scheduled_times as $key => $scheduled_time ) {
123
+	foreach ($scheduled_times as $key => $scheduled_time) {
124 124
 		$found_time = ppp_is_time_within( $scheduled_time, $time, $within );
125
-		if ( $found_time ) {
125
+		if ($found_time) {
126 126
 			break;
127 127
 		}
128 128
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	$min = $target_time - $within;
145 145
 	$max = $target_time + $within;
146 146
 
147
-	return ( ( $time >= $min ) && ( $time <= $max ) );
147
+	return (($time >= $min) && ($time <= $max));
148 148
 }
149 149
 
150 150
 /**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
  */
213 213
 function ppp_unschedule_shares( $new_status, $old_status, $post ) {
214 214
 
215
-	if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) {
215
+	if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) {
216 216
 		ppp_remove_scheduled_shares( $post->ID );
217 217
 	}
218 218
 
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 	$minutes    = (int) substr( $share_time[1], 0, 2 );
234 234
 	$ampm       = strtolower( substr( $share_time[1], -2 ) );
235 235
 
236
-	if ( $ampm == 'pm' && $hours != 12 ) {
236
+	if ($ampm == 'pm' && $hours != 12) {
237 237
 		$hours = $hours + 12;
238 238
 	}
239 239
 
240
-	if ( $ampm == 'am' && $hours == 12 ) {
240
+	if ($ampm == 'am' && $hours == 12) {
241 241
 		$hours = 00;
242 242
 	}
243 243
 
244
-	$offset    = (int) -( get_option( 'gmt_offset' ) );
244
+	$offset    = (int) -(get_option( 'gmt_offset' ));
245 245
 	$hours     = $hours + $offset;
246 246
 	$date      = explode( '/', $date );
247 247
 	$timestamp = mktime( $hours, $minutes, 0, $date[0], $date[1], $date[2] );
Please login to merge, or discard this patch.