@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Exit if accessed directly |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if ( ! defined( 'ABSPATH' )) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | */ |
15 | 15 | function ppp_disconnect_social() { |
16 | 16 | |
17 | - if ( isset( $_GET['ppp_social_disconnect'] ) && isset( $_GET['ppp_network'] ) ) { |
|
17 | + if (isset($_GET['ppp_social_disconnect']) && isset($_GET['ppp_network'])) { |
|
18 | 18 | |
19 | - if ( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
19 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
20 | 20 | wp_die( __( 'You do not have permission to view this page', 'ppp-txt' ) ); |
21 | 21 | } |
22 | 22 | |
23 | 23 | $network = $_GET['ppp_network']; |
24 | - do_action( 'ppp_disconnect-' . $network ); |
|
24 | + do_action( 'ppp_disconnect-'.$network ); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | add_action( 'admin_init', 'ppp_disconnect_social', 10 ); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | $tabs = apply_filters( 'ppp_metabox_tabs', array() ); |
37 | 37 | $i = 0; |
38 | - foreach ( $tabs as $key => $values ) { |
|
39 | - if ( $i === 0 ) { |
|
38 | + foreach ($tabs as $key => $values) { |
|
39 | + if ($i === 0) { |
|
40 | 40 | $visibleKey = $key; |
41 | 41 | $class = 'tabs'; |
42 | 42 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | ?><li class="<?php echo $class; ?>"><a href="#<?php echo $key; ?>"><?php |
47 | - if ( $values['class'] !== false ) { |
|
47 | + if ($values['class'] !== false) { |
|
48 | 48 | ?> |
49 | 49 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
50 | 50 | <?php |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | $tabs = apply_filters( 'ppp_admin_tabs', array() ); |
66 | 66 | $i = 0; |
67 | 67 | ?><h2 id="ppp-social-connect-tabs" class="nav-tab-wrapper"><?php |
68 | - foreach ( $tabs as $key => $values ) { |
|
69 | - if ( $i === 0 ) { |
|
68 | + foreach ($tabs as $key => $values) { |
|
69 | + if ($i === 0) { |
|
70 | 70 | $visibleSettingTab = $key; |
71 | 71 | $class = ' nav-tab-active'; |
72 | 72 | } else { |
73 | 73 | $class = ''; |
74 | 74 | } |
75 | 75 | ?><a class="nav-tab<?php echo $class; ?>" href='#<?php echo $key; ?>'><?php |
76 | - if ( $values['class'] !== false ) { |
|
76 | + if ($values['class'] !== false) { |
|
77 | 77 | ?> |
78 | 78 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
79 | 79 | <?php |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | function ppp_generate_metabox_content( $post ) { |
95 | 95 | global $visibleKey; |
96 | 96 | $tab_content = apply_filters( 'ppp_metabox_content', array() ); |
97 | - if ( empty( $tab_content ) ) { |
|
97 | + if (empty($tab_content)) { |
|
98 | 98 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
99 | 99 | } else { |
100 | - foreach ( $tab_content as $service ) { |
|
101 | - $hidden = ( $visibleKey == $service ) ? '' : ' hidden'; |
|
100 | + foreach ($tab_content as $service) { |
|
101 | + $hidden = ($visibleKey == $service) ? '' : ' hidden'; |
|
102 | 102 | ?> |
103 | 103 | <div class="wp-tab-panel tabs-panel<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
104 | - <?php do_action( 'ppp_generate_metabox_content-' . $service, $post ); ?> |
|
104 | + <?php do_action( 'ppp_generate_metabox_content-'.$service, $post ); ?> |
|
105 | 105 | </div> |
106 | 106 | <?php |
107 | 107 | } |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | function ppp_generate_social_account_content() { |
117 | 117 | global $visibleSettingTab; |
118 | 118 | $tab_content = apply_filters( 'ppp_admin_social_content', array() ); |
119 | - if ( empty( $tab_content ) ) { |
|
119 | + if (empty($tab_content)) { |
|
120 | 120 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
121 | 121 | } else { |
122 | - foreach ( $tab_content as $service ) { |
|
123 | - $hidden = ( $visibleSettingTab == $service ) ? '' : ' hidden'; |
|
122 | + foreach ($tab_content as $service) { |
|
123 | + $hidden = ($visibleSettingTab == $service) ? '' : ' hidden'; |
|
124 | 124 | ?> |
125 | 125 | <div class="ppp-social-connect<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
126 | - <?php do_action( 'ppp_connect_display-' . $service ); ?> |
|
126 | + <?php do_action( 'ppp_connect_display-'.$service ); ?> |
|
127 | 127 | </div> |
128 | 128 | <?php |
129 | 129 | } |
@@ -136,30 +136,30 @@ discard block |
||
136 | 136 | * @return void |
137 | 137 | */ |
138 | 138 | function ppp_list_view_maybe_take_action() { |
139 | - if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'ppp-schedule-info' ) { |
|
139 | + if ( ! isset($_GET['page']) || $_GET['page'] !== 'ppp-schedule-info') { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | - if ( ! isset( $_GET['action'] ) ) { |
|
143 | + if ( ! isset($_GET['action'])) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Get the necessary info for the actions |
148 | - $post_id = isset( $_GET['post_id'] ) ? $_GET['post_id'] : 0; |
|
149 | - $name = isset( $_GET['name'] ) ? $_GET['name'] : ''; |
|
150 | - $index = isset( $_GET['index'] ) ? $_GET['index'] : 0; |
|
151 | - $delete = isset( $_GET['delete_too'] ) ? true : false; |
|
148 | + $post_id = isset($_GET['post_id']) ? $_GET['post_id'] : 0; |
|
149 | + $name = isset($_GET['name']) ? $_GET['name'] : ''; |
|
150 | + $index = isset($_GET['index']) ? $_GET['index'] : 0; |
|
151 | + $delete = isset($_GET['delete_too']) ? true : false; |
|
152 | 152 | |
153 | - switch( $_GET['action'] ) { |
|
153 | + switch ($_GET['action']) { |
|
154 | 154 | case 'delete_item': |
155 | - if ( ! empty( $post_id ) && ! empty( $name ) || empty( $index ) ) { |
|
156 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
155 | + if ( ! empty($post_id) && ! empty($name) || empty($index)) { |
|
156 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
157 | 157 | |
158 | 158 | // Remove the item from postmeta if it exists. |
159 | 159 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
160 | 160 | |
161 | - if ( isset( $current_post_meta[$index] ) ) { |
|
162 | - unset( $current_post_meta[$index] ); |
|
161 | + if (isset($current_post_meta[$index])) { |
|
162 | + unset($current_post_meta[$index]); |
|
163 | 163 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
164 | 164 | } |
165 | 165 | |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | } |
169 | 169 | break; |
170 | 170 | case 'share_now': |
171 | - if ( ! empty( $post_id ) && ! empty( $name ) ) { |
|
171 | + if ( ! empty($post_id) && ! empty($name)) { |
|
172 | 172 | ppp_share_post( $post_id, $name ); |
173 | 173 | |
174 | - if ( $delete && ! empty( $index ) ) { |
|
175 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
174 | + if ($delete && ! empty($index)) { |
|
175 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
176 | 176 | |
177 | 177 | // Remove the item from postmeta if it exists. |
178 | 178 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
179 | 179 | |
180 | - if ( isset( $current_post_meta[$index] ) ) { |
|
181 | - unset( $current_post_meta[$index] ); |
|
180 | + if (isset($current_post_meta[$index])) { |
|
181 | + unset($current_post_meta[$index]); |
|
182 | 182 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
183 | 183 | } |
184 | 184 |
@@ -1,33 +1,33 @@ |
||
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(); |
32 | 32 | |
33 | -include_once( PPP_PATH . '/includes/pinterest-functions.php' ); |
|
33 | +include_once(PPP_PATH.'/includes/pinterest-functions.php'); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined( 'ABSPATH' )) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @since 1.2 |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
33 | + add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
34 | 34 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
35 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
35 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | remove_submenu_page( 'index.php', 'ppp-getting-started' ); |
77 | 77 | |
78 | 78 | // Badge for welcome page |
79 | - $badge_url = PPP_URL . 'includes/images/ppp-badge.png'; |
|
79 | + $badge_url = PPP_URL.'includes/images/ppp-badge.png'; |
|
80 | 80 | ?> |
81 | 81 | <style type="text/css" media="screen"> |
82 | 82 | /*<![CDATA[*/ |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | */ |
118 | 118 | public function tabs() { |
119 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'ppp-about'; |
|
119 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'ppp-about'; |
|
120 | 120 | ?> |
121 | 121 | <h1 class="nav-tab-wrapper"> |
122 | 122 | <a class="nav-tab <?php echo $selected == 'ppp-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'ppp-about' ), 'index.php' ) ) ); ?>"> |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return void |
135 | 135 | */ |
136 | 136 | public function about_screen() { |
137 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
137 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
138 | 138 | ?> |
139 | 139 | <div class="wrap about-wrap"> |
140 | 140 | <h1><?php printf( __( 'Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -144,59 +144,59 @@ discard block |
||
144 | 144 | <?php $this->tabs(); ?> |
145 | 145 | |
146 | 146 | <div class="changelog"> |
147 | - <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' );?></h3> |
|
147 | + <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' ); ?></h3> |
|
148 | 148 | |
149 | 149 | <div class="feature-section"> |
150 | 150 | |
151 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
151 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
152 | 152 | |
153 | - <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' );?></h4> |
|
154 | - <p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' );?></p> |
|
155 | - <p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' );?></p> |
|
153 | + <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' ); ?></h4> |
|
154 | + <p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' ); ?></p> |
|
155 | + <p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' ); ?></p> |
|
156 | 156 | |
157 | 157 | </div> |
158 | 158 | </div> |
159 | 159 | |
160 | 160 | <div class="changelog"> |
161 | - <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' );?></h3> |
|
161 | + <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' ); ?></h3> |
|
162 | 162 | |
163 | 163 | <div class="feature-section"> |
164 | 164 | |
165 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
165 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
166 | 166 | |
167 | - <h4><?php _e( 'Increased visibility on Twitter','ppp-txt' );?></h4> |
|
168 | - <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' );?></p> |
|
169 | - <p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' );?></p> |
|
167 | + <h4><?php _e( 'Increased visibility on Twitter', 'ppp-txt' ); ?></h4> |
|
168 | + <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' ); ?></p> |
|
169 | + <p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' ); ?></p> |
|
170 | 170 | |
171 | 171 | </div> |
172 | 172 | </div> |
173 | 173 | |
174 | 174 | <div class="changelog"> |
175 | - <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' );?></h3> |
|
175 | + <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' ); ?></h3> |
|
176 | 176 | |
177 | 177 | <div class="feature-section"> |
178 | 178 | |
179 | - <h4><?php _e( 'Change the image attached to each Tweet','ppp-txt' );?></h4> |
|
180 | - <p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' );?></p> |
|
179 | + <h4><?php _e( 'Change the image attached to each Tweet', 'ppp-txt' ); ?></h4> |
|
180 | + <p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' ); ?></p> |
|
181 | 181 | |
182 | 182 | </div> |
183 | 183 | </div> |
184 | 184 | |
185 | 185 | <div class="changelog"> |
186 | - <h3><?php _e( 'Additional Updates', 'ppp-txt' );?></h3> |
|
186 | + <h3><?php _e( 'Additional Updates', 'ppp-txt' ); ?></h3> |
|
187 | 187 | |
188 | 188 | <div class="feature-section col three-col"> |
189 | 189 | <div> |
190 | - <h4><?php _e( 'Updated image sizes', 'ppp-txt' );?></h4> |
|
191 | - <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' );?></p> |
|
190 | + <h4><?php _e( 'Updated image sizes', 'ppp-txt' ); ?></h4> |
|
191 | + <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' ); ?></p> |
|
192 | 192 | |
193 | - <h4><?php _e( 'CSS Updates', 'ppp-txt' );?></h4> |
|
194 | - <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' );?></p> |
|
193 | + <h4><?php _e( 'CSS Updates', 'ppp-txt' ); ?></h4> |
|
194 | + <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' ); ?></p> |
|
195 | 195 | </div> |
196 | 196 | |
197 | 197 | <div class="last-feature"> |
198 | - <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' );?></h4> |
|
199 | - <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' );?></p> |
|
198 | + <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' ); ?></h4> |
|
199 | + <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' ); ?></p> |
|
200 | 200 | </div> |
201 | 201 | </div> |
202 | 202 | </div> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @return void |
217 | 217 | */ |
218 | 218 | public function getting_started_screen() { |
219 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
219 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
220 | 220 | ?> |
221 | 221 | <div class="wrap about-wrap"> |
222 | 222 | <h1><?php printf( __( 'Welcome to Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | public function welcome() { |
243 | 243 | |
244 | 244 | $version_level = explode( '.', PPP_VERSION ); |
245 | - if ( count( $version_level ) > 2 ) { |
|
245 | + if (count( $version_level ) > 2) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | 249 | // Bail if no activation redirect |
250 | - if ( ! get_transient( '_ppp_activation_redirect' ) ) { |
|
250 | + if ( ! get_transient( '_ppp_activation_redirect' )) { |
|
251 | 251 | return; |
252 | 252 | } |
253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | delete_transient( '_ppp_activation_redirect' ); |
256 | 256 | |
257 | 257 | // Bail if activating from network, or bulk |
258 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
258 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
259 | 259 | return; |
260 | 260 | } |
261 | 261 |
@@ -1,7 +1,7 @@ discard block |
||
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 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function ppp_pt_save_post_meta_boxes( $post_id, $post ) { |
86 | 86 | |
87 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
87 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | - if ( ! isset( $_POST['_ppp_pinterest_data'] ) || ! is_array( $_POST['_ppp_pinterest_data'] ) ) { |
|
91 | + if ( ! isset($_POST['_ppp_pinterest_data']) || ! is_array( $_POST['_ppp_pinterest_data'] )) { |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | */ |
106 | 106 | function ppp_pt_open_graph_meta() { |
107 | 107 | |
108 | - if ( ! is_single() ) { |
|
108 | + if ( ! is_single()) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
112 | 112 | global $post, $ppp_options; |
113 | 113 | |
114 | - if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
114 | + if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | |
130 | 130 | $return = ''; |
131 | 131 | |
132 | - if ( ! is_single() ) { |
|
132 | + if ( ! is_single()) { |
|
133 | 133 | return $return; |
134 | 134 | } |
135 | 135 | |
136 | 136 | global $post; |
137 | 137 | |
138 | 138 | |
139 | - if ( empty( $post ) ) { |
|
139 | + if (empty($post)) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $elements = ppp_pt_default_meta_elements(); |
144 | - foreach ( $elements as $name => $content ) { |
|
145 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; |
|
144 | + foreach ($elements as $name => $content) { |
|
145 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return apply_filters( 'ppp_pt_og_data', $return ); |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | $elements = array(); |
163 | 163 | $pinterest_data = get_post_meta( $post->ID, '_ppp_pt_media', true ); |
164 | 164 | |
165 | - if ( ! empty( $pinterest_data['image'] ) ) { |
|
165 | + if ( ! empty($pinterest_data['image'])) { |
|
166 | 166 | $elements['og:image'] = $pinterest_data['image']; |
167 | 167 | |
168 | - $thumb_id = ! empty( $pinterest_data['attachment_id'] ) ? (int) $pinterest_data['attachment_id'] : ppp_get_attachment_id_from_image_url( $pinterest_data['image'] ) ; |
|
168 | + $thumb_id = ! empty($pinterest_data['attachment_id']) ? (int) $pinterest_data['attachment_id'] : ppp_get_attachment_id_from_image_url( $pinterest_data['image'] ); |
|
169 | 169 | |
170 | - if ( ! empty( $thumb_id ) ) { |
|
170 | + if ( ! empty($thumb_id)) { |
|
171 | 171 | $alt_text = ppp_get_attachment_alt_text( $thumb_id ); |
172 | 172 | // When adding media via the WP Uploader, any 'alt text' supplied will be used as the accessible alt text. |
173 | - if ( ! empty( $alt_text ) ) { |
|
173 | + if ( ! empty($alt_text)) { |
|
174 | 174 | $elements['og:image:alt'] = esc_attr( $alt_text ); |
175 | 175 | } |
176 | 176 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | /** |
9 | 9 | * Checks to see if a session is set and it's appropriate to start one, and starts it if necessary |
10 | - * @return void |
|
10 | + * @return boolean |
|
11 | 11 | */ |
12 | 12 | function ppp_maybe_start_session() { |
13 | 13 | if( !class_exists( 'TwitterOAuth' ) ) { |
@@ -77,6 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Strips slashes and html_entities_decode for sending to the networks. |
80 | + * @param string $string |
|
80 | 81 | */ |
81 | 82 | function ppp_entities_and_slashes( $string ) { |
82 | 83 | return stripslashes( html_entity_decode( $string, ENT_COMPAT, 'UTF-8' ) ); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | * @return void |
11 | 11 | */ |
12 | 12 | function ppp_maybe_start_session() { |
13 | - if( !class_exists( 'TwitterOAuth' ) ) { |
|
14 | - require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' ); |
|
13 | + if ( ! class_exists( 'TwitterOAuth' )) { |
|
14 | + require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php'); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | $ret = false; |
18 | - if ( ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) && session_status() == PHP_SESSION_NONE && ! headers_sent() ) { |
|
18 | + if ((is_admin() || (defined( 'DOING_CRON' ) && DOING_CRON)) && session_status() == PHP_SESSION_NONE && ! headers_sent()) { |
|
19 | 19 | $ret = session_start(); |
20 | 20 | } |
21 | 21 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | global $ppp_share_settings; |
31 | 31 | $result = false; |
32 | 32 | |
33 | - if ( isset( $ppp_share_settings['analytics'] ) && $ppp_share_settings['analytics'] !== 'none' ) { |
|
34 | - $result = true; |
|
33 | + if (isset($ppp_share_settings['analytics']) && $ppp_share_settings['analytics'] !== 'none') { |
|
34 | + $result = true; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return apply_filters( 'ppp_is_link_tracking_enabled', $result ); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | function ppp_is_shortener_enabled() { |
73 | 73 | global $ppp_share_settings; |
74 | 74 | |
75 | - return ( isset( $ppp_share_settings['shortener'] ) && !empty( $ppp_share_settings['shortener'] ) && $ppp_share_settings != '-1' ); |
|
75 | + return (isset($ppp_share_settings['shortener']) && ! empty($ppp_share_settings['shortener']) && $ppp_share_settings != '-1'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | $post_types = get_post_types( $post_type_args, NULL, 'and' ); |
105 | 105 | |
106 | 106 | $unsupported_post_types = array( 'wp_log', 'attachment' ); |
107 | - foreach ( $unsupported_post_types as $unsupported_post_type ) { |
|
108 | - if ( array_key_exists( $unsupported_post_type, $post_types ) ) { |
|
109 | - unset( $post_types[ $unsupported_post_type ] ); |
|
107 | + foreach ($unsupported_post_types as $unsupported_post_type) { |
|
108 | + if (array_key_exists( $unsupported_post_type, $post_types )) { |
|
109 | + unset($post_types[$unsupported_post_type]); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -134,16 +134,16 @@ discard block |
||
134 | 134 | function ppp_should_save( $post_id, $post ) { |
135 | 135 | $ret = true; |
136 | 136 | |
137 | - if ( empty( $_POST ) ) { |
|
137 | + if (empty($_POST)) { |
|
138 | 138 | $ret = false; |
139 | 139 | } |
140 | 140 | |
141 | - if ( wp_is_post_revision( $post_id ) ) { |
|
141 | + if (wp_is_post_revision( $post_id )) { |
|
142 | 142 | $ret = false; |
143 | 143 | } |
144 | 144 | |
145 | 145 | global $ppp_options; |
146 | - if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) || !array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
146 | + if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] ) || ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
147 | 147 | $ret = false; |
148 | 148 | } |
149 | 149 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | function ppp_set_uploads_dir() { |
160 | 160 | $upload_path = ppp_get_upload_path(); |
161 | 161 | |
162 | - if ( false === get_transient( 'ppp_check_protection_files' ) ) { |
|
162 | + if (false === get_transient( 'ppp_check_protection_files' )) { |
|
163 | 163 | |
164 | 164 | // Make sure the /ppp folder is created |
165 | 165 | wp_mkdir_p( $upload_path ); |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | $rules = "Options -Indexes\n"; |
169 | 169 | $rules .= "deny from all\n"; |
170 | 170 | |
171 | - $htaccess_exists = file_exists( $upload_path . '/.htaccess' ); |
|
171 | + $htaccess_exists = file_exists( $upload_path.'/.htaccess' ); |
|
172 | 172 | |
173 | - if ( $htaccess_exists ) { |
|
174 | - $contents = @file_get_contents( $upload_path . '/.htaccess' ); |
|
175 | - if ( $contents !== $rules || ! $contents ) { |
|
173 | + if ($htaccess_exists) { |
|
174 | + $contents = @file_get_contents( $upload_path.'/.htaccess' ); |
|
175 | + if ($contents !== $rules || ! $contents) { |
|
176 | 176 | // Update the .htaccess rules if they don't match |
177 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
177 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
178 | 178 | } |
179 | - } elseif( wp_is_writable( $upload_path ) ) { |
|
179 | + } elseif (wp_is_writable( $upload_path )) { |
|
180 | 180 | // Create the file if it doesn't exist |
181 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
181 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // Top level blank index.php |
185 | - if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) { |
|
186 | - @file_put_contents( $upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.' ); |
|
185 | + if ( ! file_exists( $upload_path.'/index.php' ) && wp_is_writable( $upload_path )) { |
|
186 | + @file_put_contents( $upload_path.'/index.php', '<?php'.PHP_EOL.'// Silence is golden.' ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Check for the files once per day |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | function ppp_get_upload_path() { |
202 | 202 | $wp_upload_dir = wp_upload_dir(); |
203 | - return $wp_upload_dir['basedir'] . '/ppp'; |
|
203 | + return $wp_upload_dir['basedir'].'/ppp'; |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | $completed_upgrades = get_option( 'ppp_completed_upgrades' ); |
215 | 215 | |
216 | - if ( false === $completed_upgrades ) { |
|
216 | + if (false === $completed_upgrades) { |
|
217 | 217 | $completed_upgrades = array(); |
218 | 218 | } |
219 | 219 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | function ppp_has_upgrade_completed( $upgrade_action = '' ) { |
232 | 232 | |
233 | - if ( empty( $upgrade_action ) ) { |
|
233 | + if (empty($upgrade_action)) { |
|
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | function ppp_set_upgrade_complete( $upgrade_action = '' ) { |
251 | 251 | |
252 | - if ( empty( $upgrade_action ) ) { |
|
252 | + if (empty($upgrade_action)) { |
|
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | |
@@ -274,48 +274,48 @@ discard block |
||
274 | 274 | $url = strtolower( trim( get_home_url( '/' ) ) ); |
275 | 275 | |
276 | 276 | // Need to get the host...so let's add the scheme so we can use parse_url |
277 | - if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) { |
|
278 | - $url = 'http://' . $url; |
|
277 | + if (false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' )) { |
|
278 | + $url = 'http://'.$url; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | $url_parts = parse_url( $url ); |
282 | - $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false; |
|
282 | + $host = ! empty($url_parts['host']) ? $url_parts['host'] : false; |
|
283 | 283 | |
284 | - if ( ! empty( $url ) && ! empty( $host ) ) { |
|
284 | + if ( ! empty($url) && ! empty($host)) { |
|
285 | 285 | |
286 | - if ( false !== ip2long( $host ) ) { |
|
287 | - if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) { |
|
286 | + if (false !== ip2long( $host )) { |
|
287 | + if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE )) { |
|
288 | 288 | $is_local_url = true; |
289 | 289 | } |
290 | - } else if ( 'localhost' === $host ) { |
|
290 | + } else if ('localhost' === $host) { |
|
291 | 291 | $is_local_url = true; |
292 | 292 | } |
293 | 293 | |
294 | 294 | $check_tlds = apply_filters( 'ppp_validate_tlds', true ); |
295 | - if ( $check_tlds ) { |
|
295 | + if ($check_tlds) { |
|
296 | 296 | $tlds_to_check = apply_filters( 'ppp_url_tlds', array( |
297 | 297 | '.dev', '.local', '.test' |
298 | 298 | ) ); |
299 | 299 | |
300 | - foreach ( $tlds_to_check as $tld ) { |
|
301 | - if ( false !== strpos( $host, $tld ) ) { |
|
300 | + foreach ($tlds_to_check as $tld) { |
|
301 | + if (false !== strpos( $host, $tld )) { |
|
302 | 302 | $is_local_url = true; |
303 | 303 | continue; |
304 | 304 | } |
305 | 305 | } |
306 | 306 | } |
307 | 307 | |
308 | - if ( substr_count( $host, '.' ) > 1 ) { |
|
308 | + if (substr_count( $host, '.' ) > 1) { |
|
309 | 309 | $subdomains_to_check = apply_filters( 'ppp_url_subdomains', array( |
310 | 310 | 'dev.', '*.staging.', |
311 | 311 | ) ); |
312 | 312 | |
313 | - foreach ( $subdomains_to_check as $subdomain ) { |
|
313 | + foreach ($subdomains_to_check as $subdomain) { |
|
314 | 314 | |
315 | 315 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
316 | 316 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
317 | 317 | |
318 | - if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) { |
|
318 | + if (preg_match( '/^('.$subdomain.')/', $host )) { |
|
319 | 319 | $is_local_url = true; |
320 | 320 | continue; |
321 | 321 | } |
@@ -1,7 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'] ) ) { |
|
59 | + if (isset($_REQUEST['oauth_verifier'])) { |
|
60 | 60 | |
61 | 61 | //load twitter class |
62 | 62 | $twitter = $this->load(); |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | |
68 | 68 | //session for verifier |
69 | 69 | $verifier['oauth_verifier'] = $_REQUEST['oauth_verifier']; |
70 | - $_SESSION[ 'ppp_twt_user_cache' ] = $verifier; |
|
70 | + $_SESSION['ppp_twt_user_cache'] = $verifier; |
|
71 | 71 | |
72 | 72 | //getting user data from twitter |
73 | 73 | $response = $this->twitter->get( 'account/verify_credentials' ); |
74 | 74 | |
75 | 75 | //if user data get successfully |
76 | - if ( $response->id_str ) { |
|
76 | + if ($response->id_str) { |
|
77 | 77 | $data['user'] = $response; |
78 | 78 | $data['user']->accessToken = $ppp_tw_access_token; |
79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->load(); |
87 | 87 | |
88 | 88 | $user_settings = get_user_meta( $this->user_id, '_ppp_twitter_data', true ); |
89 | - if ( ! empty( $user_settings ) ) { |
|
89 | + if ( ! empty($user_settings)) { |
|
90 | 90 | |
91 | 91 | $this->twitter = new TwitterOAuth( |
92 | 92 | PPP_TW_CONSUMER_KEY, |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | $user_settings['user']->accessToken['oauth_token_secret'] |
96 | 96 | ); |
97 | 97 | |
98 | - $response = $this->twitter->get('account/verify_credentials'); |
|
99 | - if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) { |
|
100 | - foreach ( $response->errors as $error ) { |
|
101 | - if ( $error->code == 89 ) { // Expired or revoked tokens |
|
98 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
99 | + if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) { |
|
100 | + foreach ($response->errors as $error) { |
|
101 | + if ($error->code == 89) { // Expired or revoked tokens |
|
102 | 102 | |
103 | 103 | $this->revoke_access(); |
104 | 104 | |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | * Get auth url for twitter |
116 | 116 | * |
117 | 117 | */ |
118 | - public function get_auth_url ( $return_url = '' ) { |
|
118 | + public function get_auth_url( $return_url = '' ) { |
|
119 | 119 | |
120 | - if ( empty( $return_url ) ) { |
|
120 | + if (empty($return_url)) { |
|
121 | 121 | $return_url = admin_url( 'admin.php?page=ppp-social-settings' ); |
122 | 122 | } |
123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $request_token = $this->twitter->getRequestToken( 'oob' ); |
127 | 127 | |
128 | 128 | // If last connection failed don't display authorization link. |
129 | - switch( $this->twitter->http_code ) { |
|
129 | + switch ($this->twitter->http_code) { |
|
130 | 130 | case 200: |
131 | 131 | $_SESSION['ppp_user_twt_oauth_token'] = $request_token['oauth_token']; |
132 | 132 | $_SESSION['ppp_user_twt_oauth_token_secret'] = $request_token['oauth_token_secret']; |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | public function send_tweet( $message = '', $media = null ) { |
146 | - if ( empty( $message ) ) { |
|
146 | + if (empty($message)) { |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $verify = $this->verify_credentials(); |
151 | - if ( $verify === true ) { |
|
151 | + if ($verify === true) { |
|
152 | 152 | $args = array(); |
153 | - if ( ! empty( $media ) ) { |
|
153 | + if ( ! empty($media)) { |
|
154 | 154 | $endpoint = 'statuses/update_with_media'; |
155 | 155 | $args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) ); |
156 | 156 | } else { |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | public function retweet( $tweet_id ) { |
168 | - if ( empty( $tweet_id ) ) { |
|
168 | + if (empty($tweet_id)) { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | |
172 | 172 | $verify = $this->verify_credentials(); |
173 | - if ( $verify === true ) { |
|
174 | - $endpoint = 'statuses/retweet/' . $tweet_id; |
|
173 | + if ($verify === true) { |
|
174 | + $endpoint = 'statuses/retweet/'.$tweet_id; |
|
175 | 175 | |
176 | 176 | return $this->twitter->post( $endpoint, array(), true ); |
177 | 177 | } else { |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
8 | 8 | function ppp_upgrade_notices() { |
9 | 9 | |
10 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades' ) ) { |
|
10 | + if (isset($_GET['page']) && ($_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades')) { |
|
11 | 11 | return; // Don't show notices on the upgrades page |
12 | 12 | } |
13 | 13 | |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | // Sequential Orders was the first stepped upgrade, so check if we have a stalled upgrade |
17 | 17 | $resume_upgrade = ppp_maybe_resume_upgrade(); |
18 | - if ( ! empty( $resume_upgrade ) ) { |
|
18 | + if ( ! empty($resume_upgrade)) { |
|
19 | 19 | |
20 | 20 | $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
21 | 21 | printf( |
22 | - '<div class="error"><p>' . __( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
22 | + '<div class="error"><p>'.__( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ).'</p></div>', |
|
23 | 23 | esc_url( $resume_url ) |
24 | 24 | ); |
25 | 25 | |
@@ -28,16 +28,16 @@ discard block |
||
28 | 28 | // Include all 'Stepped' upgrade process notices in this else statement, |
29 | 29 | // to avoid having a pending, and new upgrade suggested at the same time |
30 | 30 | |
31 | - if ( version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' ) ) { |
|
31 | + if (version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' )) { |
|
32 | 32 | printf( |
33 | - '<div class="notice notice-info"><p>' . __( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
33 | + '<div class="notice notice-info"><p>'.__( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ).'</p></div>', |
|
34 | 34 | esc_url( admin_url( 'index.php?page=ppp-upgrades&ppp-upgrade=upgrade_post_meta' ) ) |
35 | 35 | ); |
36 | 36 | } |
37 | 37 | |
38 | - if ( version_compare( $ppp_version, '2.3.19', '<' ) || ! ppp_has_upgrade_completed( 'fix_scheduled_shares_2319' ) ) { |
|
38 | + if (version_compare( $ppp_version, '2.3.19', '<' ) || ! ppp_has_upgrade_completed( 'fix_scheduled_shares_2319' )) { |
|
39 | 39 | printf( |
40 | - '<div class="notice notice-info"><p>' . __( 'Post Promoter Pro needs to fix an issue with scheduled shares, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
40 | + '<div class="notice notice-info"><p>'.__( 'Post Promoter Pro needs to fix an issue with scheduled shares, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ).'</p></div>', |
|
41 | 41 | esc_url( admin_url( 'index.php?page=ppp-upgrades&ppp-upgrade=fix_scheduled_shares_2319' ) ) |
42 | 42 | ); |
43 | 43 | } |
@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | $upgrades_executed = false; |
60 | 60 | |
61 | 61 | // We don't have a version yet, so we need to run the upgrader |
62 | - if ( !$ppp_version && PPP_VERSION == '1.3' ) { |
|
62 | + if ( ! $ppp_version && PPP_VERSION == '1.3') { |
|
63 | 63 | ppp_v13_upgrades(); |
64 | 64 | $upgrades_executed = true; |
65 | 65 | } |
66 | 66 | |
67 | - if ( version_compare( $ppp_version, 2.1, '<' ) ) { |
|
67 | + if (version_compare( $ppp_version, 2.1, '<' )) { |
|
68 | 68 | ppp_v21_upgrades(); |
69 | 69 | $upgrades_executed = true; |
70 | 70 | } |
71 | 71 | |
72 | - if ( $upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' ) ) { |
|
72 | + if ($upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' )) { |
|
73 | 73 | set_transient( '_ppp_activation_redirect', '1', 60 ); |
74 | 74 | update_option( 'ppp_version', PPP_VERSION ); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $doing_upgrade = get_option( 'ppp_doing_upgrade', false ); |
89 | 89 | |
90 | - if ( empty( $doing_upgrade ) ) { |
|
90 | + if (empty($doing_upgrade)) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
@@ -103,22 +103,22 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function ppp_v13_upgrades() { |
105 | 105 | global $ppp_share_settings; |
106 | - $uq_status = ( isset( $ppp_share_settings['ppp_unique_links'] ) && $ppp_share_settings['ppp_unique_links'] == '1' ) ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
107 | - $ga_status = ( isset( $ppp_share_settings['ppp_ga_tags'] ) && $ppp_share_settings['ppp_ga_tags'] == '1' ) ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
106 | + $uq_status = (isset($ppp_share_settings['ppp_unique_links']) && $ppp_share_settings['ppp_unique_links'] == '1') ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
107 | + $ga_status = (isset($ppp_share_settings['ppp_ga_tags']) && $ppp_share_settings['ppp_ga_tags'] == '1') ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
108 | 108 | |
109 | - if ( $uq_status ) { |
|
109 | + if ($uq_status) { |
|
110 | 110 | $ppp_share_settings['analytics'] = 'unique_links'; |
111 | - unset( $ppp_share_settings['ppp_unique_links'] ); |
|
112 | - } elseif ( $ga_status ) { |
|
111 | + unset($ppp_share_settings['ppp_unique_links']); |
|
112 | + } elseif ($ga_status) { |
|
113 | 113 | $ppp_share_settings['analytics'] = 'google_analytics'; |
114 | - unset( $ppp_share_settings['ppp_ga_tags'] ); |
|
114 | + unset($ppp_share_settings['ppp_ga_tags']); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | update_option( 'ppp_share_settings', $ppp_share_settings ); |
118 | 118 | |
119 | 119 | global $ppp_options; |
120 | 120 | $ppp_options['default_text'] = '{post_title}'; |
121 | - $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on'); |
|
121 | + $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on' ); |
|
122 | 122 | |
123 | 123 | update_option( 'ppp_options', $ppp_options ); |
124 | 124 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | function ppp_v22_postmeta_upgrade() { |
142 | 142 | |
143 | - if( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
143 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
144 | 144 | wp_die( __( 'You do not have permission to do upgrades', 'ppp-txt' ), __( 'Error', 'ppp-txt' ), array( 'response' => 403 ) ); |
145 | 145 | } |
146 | 146 | |
@@ -149,16 +149,16 @@ discard block |
||
149 | 149 | global $wpdb; |
150 | 150 | |
151 | 151 | |
152 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
152 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
153 | 153 | $number = 25; |
154 | - $offset = $step == 1 ? 0 : ( $step - 1 ) * $number; |
|
154 | + $offset = $step == 1 ? 0 : ($step - 1) * $number; |
|
155 | 155 | |
156 | - if ( $step < 2 ) { |
|
156 | + if ($step < 2) { |
|
157 | 157 | // Check if we have any payments before moving on |
158 | 158 | $sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' LIMIT 1"; |
159 | 159 | $has_overrides = $wpdb->get_col( $sql ); |
160 | 160 | |
161 | - if( empty( $has_overrides ) ) { |
|
161 | + if (empty($has_overrides)) { |
|
162 | 162 | // We had no payments, just complete |
163 | 163 | update_option( 'ppp_version', preg_replace( '/[^0-9.].*/', '', PPP_VERSION ) ); |
164 | 164 | ppp_set_upgrade_complete( 'upgrade_post_meta' ); |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
170 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
171 | 171 | |
172 | - if ( empty( $total ) || $total <= 1 ) { |
|
172 | + if (empty($total) || $total <= 1) { |
|
173 | 173 | $total_sql = "SELECT COUNT(post_id) as total FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data'"; |
174 | 174 | $results = $wpdb->get_row( $total_sql, 0 ); |
175 | 175 | |
@@ -179,48 +179,48 @@ discard block |
||
179 | 179 | $results = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' ORDER BY meta_id DESC LIMIT %d,%d;", $offset, $number ) ); |
180 | 180 | $new_post_meta = array(); |
181 | 181 | |
182 | - if ( $results ) { |
|
183 | - foreach ( $results as $result ) { |
|
182 | + if ($results) { |
|
183 | + foreach ($results as $result) { |
|
184 | 184 | |
185 | 185 | $share_key = 1; |
186 | 186 | |
187 | 187 | $override_data = unserialize( $result->meta_value ); |
188 | 188 | |
189 | - foreach ( $override_data as $day => $values ) { |
|
189 | + foreach ($override_data as $day => $values) { |
|
190 | 190 | |
191 | - if ( ! isset( $values['enabled'] ) ) { |
|
191 | + if ( ! isset($values['enabled'])) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | |
195 | - $text = ! empty( $values['text'] ) ? $values['text'] : ''; |
|
196 | - $time = ! empty( $values['time'] ) ? $values['time'] : '8:00am'; |
|
195 | + $text = ! empty($values['text']) ? $values['text'] : ''; |
|
196 | + $time = ! empty($values['time']) ? $values['time'] : '8:00am'; |
|
197 | 197 | |
198 | 198 | $post = get_post( $result->post_id ); |
199 | 199 | $days_ahead = substr( $day, -1 ); |
200 | - $date = date( 'm\/d\/Y', strtotime( $post->post_date . '+' . $days_ahead . ' days' ) ); |
|
200 | + $date = date( 'm\/d\/Y', strtotime( $post->post_date.'+'.$days_ahead.' days' ) ); |
|
201 | 201 | $image = ''; |
202 | 202 | $attachment_id = ''; |
203 | 203 | |
204 | - if ( ! empty( $values['use_image'] ) ) { |
|
204 | + if ( ! empty($values['use_image'])) { |
|
205 | 205 | $thumb_id = get_post_thumbnail_id( $result->post_id ); |
206 | 206 | $thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-tw-share-image', true ); |
207 | 207 | |
208 | - if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) { |
|
208 | + if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) { |
|
209 | 209 | $thumb_url = $thumb_url[0]; |
210 | 210 | } |
211 | 211 | |
212 | - if ( ! empty( $thumb_id ) && ! empty( $thumb_url ) ) { |
|
212 | + if ( ! empty($thumb_id) && ! empty($thumb_url)) { |
|
213 | 213 | $attachment_id = $thumb_id; |
214 | 214 | $image = $thumb_url; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - $new_post_meta[$share_key] = array ( |
|
218 | + $new_post_meta[$share_key] = array( |
|
219 | 219 | 'date' => $date, |
220 | 220 | 'time' => $time, |
221 | 221 | 'text' => $text, |
222 | - 'image' => ! empty( $image ) ? $image : '', |
|
223 | - 'attachment_id' => ! empty( $attachment_id ) ? $attachment_id : '' |
|
222 | + 'image' => ! empty($image) ? $image : '', |
|
223 | + 'attachment_id' => ! empty($attachment_id) ? $attachment_id : '' |
|
224 | 224 | ); |
225 | 225 | |
226 | 226 | $share_key++; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | function ppp_fix_scheduled_shares_2319() { |
257 | 257 | |
258 | - if( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
258 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
259 | 259 | wp_die( __( 'You do not have permission to do upgrades', 'ppp-txt' ), __( 'Error', 'ppp-txt' ), array( 'response' => 403 ) ); |
260 | 260 | } |
261 | 261 | |
@@ -264,16 +264,16 @@ discard block |
||
264 | 264 | global $wpdb; |
265 | 265 | |
266 | 266 | |
267 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
267 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
268 | 268 | $number = 25; |
269 | - $offset = $step == 1 ? 0 : ( $step - 1 ) * $number; |
|
269 | + $offset = $step == 1 ? 0 : ($step - 1) * $number; |
|
270 | 270 | |
271 | - if ( $step < 2 ) { |
|
271 | + if ($step < 2) { |
|
272 | 272 | // Check if we have any payments before moving on |
273 | 273 | $sql = "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key IN ( '_ppp_tweets', '_ppp_fb_shares', '_ppp_li_shares' ) LIMIT 1"; |
274 | 274 | $has_shares = $wpdb->get_col( $sql ); |
275 | 275 | |
276 | - if( empty( $has_shares ) ) { |
|
276 | + if (empty($has_shares)) { |
|
277 | 277 | // We had no payments, just complete |
278 | 278 | update_option( 'ppp_version', preg_replace( '/[^0-9.].*/', '', PPP_VERSION ) ); |
279 | 279 | ppp_set_upgrade_complete( 'fix_scheduled_shares_2319' ); |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
285 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
285 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
286 | 286 | |
287 | - if ( empty( $total ) || $total <= 1 ) { |
|
287 | + if (empty($total) || $total <= 1) { |
|
288 | 288 | $total_sql = "SELECT COUNT( DISTINCT post_id ) as total FROM $wpdb->postmeta WHERE meta_key IN ( '_ppp_tweets', '_ppp_fb_shares', '_ppp_li_shares' )"; |
289 | 289 | $results = $wpdb->get_row( $total_sql, 0 ); |
290 | 290 | |
@@ -293,19 +293,19 @@ discard block |
||
293 | 293 | |
294 | 294 | $results = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key IN ( '_ppp_tweets', '_ppp_fb_shares', '_ppp_li_shares' ) ORDER BY post_id DESC LIMIT %d,%d;", $offset, $number ) ); |
295 | 295 | |
296 | - if ( $results ) { |
|
296 | + if ($results) { |
|
297 | 297 | $allowed_post_types = ppp_allowed_post_types(); |
298 | 298 | |
299 | - foreach ( $results as $result ) { |
|
299 | + foreach ($results as $result) { |
|
300 | 300 | $post = get_post( $result->post_id ); |
301 | - if ( ! in_array( $post->post_type, $allowed_post_types ) ) { |
|
301 | + if ( ! in_array( $post->post_type, $allowed_post_types )) { |
|
302 | 302 | continue; |
303 | 303 | } |
304 | 304 | |
305 | 305 | ppp_remove_scheduled_shares( $result->post_id ); |
306 | 306 | $timestamps = ppp_get_timestamps( $result->post_id ); |
307 | 307 | |
308 | - foreach ( $timestamps as $timestamp => $name ) { |
|
308 | + foreach ($timestamps as $timestamp => $name) { |
|
309 | 309 | $timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 ); |
310 | 310 | wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $result->post_id, $name ) ); |
311 | 311 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( !defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | * Handles all facebook functions |
12 | 12 | * |
13 | 13 | */ |
14 | -if( !class_exists( 'PPP_Facebook' ) ) { |
|
14 | +if ( ! class_exists( 'PPP_Facebook' )) { |
|
15 | 15 | |
16 | 16 | class PPP_Facebook { |
17 | 17 | |
18 | 18 | var $facebook; |
19 | 19 | |
20 | - public function __construct(){ |
|
20 | + public function __construct() { |
|
21 | 21 | ppp_maybe_start_session(); |
22 | 22 | } |
23 | 23 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | public function ppp_load_facebook() { |
31 | 31 | |
32 | 32 | |
33 | - if( !class_exists( 'Facebook' ) ) { |
|
34 | - require_once ( PPP_PATH . '/includes/libs/facebook/facebook.php' ); |
|
33 | + if ( ! class_exists( 'Facebook' )) { |
|
34 | + require_once (PPP_PATH.'/includes/libs/facebook/facebook.php'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | ppp_set_social_tokens(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'appId' => PPP_FB_APP_ID, |
41 | 41 | 'secret' => PPP_FB_APP_SECRET, |
42 | 42 | 'cookie' => true |
43 | - )); |
|
43 | + ) ); |
|
44 | 44 | |
45 | 45 | return true; |
46 | 46 | |
@@ -55,70 +55,70 @@ discard block |
||
55 | 55 | $facebook = $this->ppp_load_facebook(); |
56 | 56 | |
57 | 57 | //when user is going to logged in and verified successfully session will create |
58 | - if ( isset( $_REQUEST['fb_access_token'] ) && isset( $_REQUEST['expires_in'] ) ) { |
|
58 | + if (isset($_REQUEST['fb_access_token']) && isset($_REQUEST['expires_in'])) { |
|
59 | 59 | |
60 | 60 | $access_token = $_REQUEST['fb_access_token']; |
61 | 61 | $expires_in = $_REQUEST['expires_in']; |
62 | 62 | |
63 | - } elseif ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) { |
|
64 | - $access_code = isset( $_GET['code'] ) ? $_GET['code'] : false; |
|
63 | + } elseif (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) { |
|
64 | + $access_code = isset($_GET['code']) ? $_GET['code'] : false; |
|
65 | 65 | |
66 | - if ( empty( $access_code ) ) { |
|
66 | + if (empty($access_code)) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - $params = '?client_id=' . PPP_FB_APP_ID; |
|
71 | - $params .= '&client_secret=' . PPP_FB_APP_SECRET; |
|
72 | - $params .= '&code=' . $access_code; |
|
73 | - $params .= '&redirect_uri=' . admin_url( 'admin.php?page=ppp-social-settings' ); |
|
74 | - $url = 'https://graph.facebook.com/oauth/access_token' . $params; |
|
70 | + $params = '?client_id='.PPP_FB_APP_ID; |
|
71 | + $params .= '&client_secret='.PPP_FB_APP_SECRET; |
|
72 | + $params .= '&code='.$access_code; |
|
73 | + $params .= '&redirect_uri='.admin_url( 'admin.php?page=ppp-social-settings' ); |
|
74 | + $url = 'https://graph.facebook.com/oauth/access_token'.$params; |
|
75 | 75 | |
76 | 76 | parse_str( wp_remote_retrieve_body( wp_remote_post( $url ) ), $result ); |
77 | 77 | |
78 | - $access_token = ! empty( $result['access_token'] ) ? $result['access_token'] : false; |
|
79 | - $expires_in = ! empty( $result['expires'] ) ? $result['expires'] : false; |
|
78 | + $access_token = ! empty($result['access_token']) ? $result['access_token'] : false; |
|
79 | + $expires_in = ! empty($result['expires']) ? $result['expires'] : false; |
|
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | - if ( ! empty( $access_token ) ) { |
|
83 | + if ( ! empty($access_token)) { |
|
84 | 84 | global $ppp_social_settings; |
85 | 85 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
86 | 86 | |
87 | 87 | //check facebook class is loaded or not |
88 | - if( !$facebook ) { |
|
88 | + if ( ! $facebook) { |
|
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $data = new stdClass(); |
93 | 93 | $data->access_token = $access_token; |
94 | 94 | |
95 | - $expires_in = empty( $expires_in ) ? 60 * 24 * 60 * 60 : $expires_in; // days * hours * minutes * seconds |
|
95 | + $expires_in = empty($expires_in) ? 60 * 24 * 60 * 60 : $expires_in; // days * hours * minutes * seconds |
|
96 | 96 | $data->expires_on = current_time( 'timestamp' ) + $expires_in; |
97 | 97 | |
98 | - update_option( '_ppp_facebook_refresh', current_time( 'timestamp' ) + round( $expires_in/1.25 ) ); |
|
98 | + update_option( '_ppp_facebook_refresh', current_time( 'timestamp' ) + round( $expires_in / 1.25 ) ); |
|
99 | 99 | |
100 | 100 | // Now that we have a valid auth, get some user info |
101 | 101 | $user_info = $this->ppp_get_fb_user( $data->access_token ); |
102 | 102 | |
103 | - if ( $user_info ) { |
|
104 | - if ( !empty( $user_info->name ) ) { |
|
103 | + if ($user_info) { |
|
104 | + if ( ! empty($user_info->name)) { |
|
105 | 105 | $data->name = $user_info->name; |
106 | 106 | } else { |
107 | - $parsed_name = $user_info->first_name . ' ' . $user_info->last_name; |
|
107 | + $parsed_name = $user_info->first_name.' '.$user_info->last_name; |
|
108 | 108 | $data->name = $parsed_name; |
109 | 109 | } |
110 | 110 | $data->userid = $user_info->id; |
111 | 111 | $data->avatar = $this->ppp_fb_get_profile_picture( array( 'type' => 'square' ), $data->userid ); |
112 | 112 | |
113 | - if ( ! empty( $ppp_social_settings['facebook']->page ) ) { |
|
113 | + if ( ! empty($ppp_social_settings['facebook']->page)) { |
|
114 | 114 | $current_page = $ppp_social_settings['facebook']->page; |
115 | 115 | $page_parts = explode( '|', $current_page ); |
116 | 116 | |
117 | 117 | $pages = $this->ppp_get_fb_user_pages( $data->access_token ); |
118 | 118 | |
119 | - foreach ( $pages as $page ) { |
|
120 | - if ( $page->id == $page_parts[2] ) { |
|
121 | - $data->page = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
119 | + foreach ($pages as $page) { |
|
120 | + if ($page->id == $page_parts[2]) { |
|
121 | + $data->page = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
122 | 122 | continue; |
123 | 123 | } |
124 | 124 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | - $url = remove_query_arg( array( 'fb_access_token' , 'expires_in' ) ); |
|
134 | + $url = remove_query_arg( array( 'fb_access_token', 'expires_in' ) ); |
|
135 | 135 | wp_redirect( $url ); |
136 | 136 | die(); |
137 | 137 | } |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | $facebook = $this->ppp_load_facebook(); |
150 | 150 | |
151 | 151 | //check facebook class is exis or not |
152 | - if( !$facebook ) { |
|
152 | + if ( ! $facebook) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | |
156 | 156 | global $ppp_social_settings; |
157 | - $user = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me?access_token=' . $access_token ) ) ); |
|
157 | + $user = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me?access_token='.$access_token ) ) ); |
|
158 | 158 | |
159 | 159 | return $user; |
160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $facebook = $this->ppp_load_facebook(); |
167 | 167 | |
168 | 168 | // check facebook cleast is exists or not |
169 | - if( !$facebook ) { |
|
169 | + if ( ! $facebook) { |
|
170 | 170 | return false; |
171 | 171 | } |
172 | 172 | |
@@ -174,20 +174,20 @@ discard block |
||
174 | 174 | $facebook_settings = $ppp_social_settings['facebook']; |
175 | 175 | |
176 | 176 | |
177 | - if ( ! isset( $facebook_settings->available_pages ) || |
|
178 | - ! isset( $facebook_settings->pages_last_updated ) || |
|
179 | - $facebook_settings->pages_last_updated < current_time( 'timestamp' ) ) { |
|
177 | + if ( ! isset($facebook_settings->available_pages) || |
|
178 | + ! isset($facebook_settings->pages_last_updated) || |
|
179 | + $facebook_settings->pages_last_updated < current_time( 'timestamp' )) { |
|
180 | 180 | |
181 | - $all_pages = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me/accounts?access_token=' . $access_token ) ) ); |
|
181 | + $all_pages = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me/accounts?access_token='.$access_token ) ) ); |
|
182 | 182 | $pages = array(); |
183 | 183 | |
184 | - if ( !empty( $all_pages ) ) { |
|
185 | - foreach ( $all_pages->data as $page ) { |
|
186 | - if ( in_array( 'CREATE_CONTENT', $page->tasks ) ) { |
|
184 | + if ( ! empty($all_pages)) { |
|
185 | + foreach ($all_pages->data as $page) { |
|
186 | + if (in_array( 'CREATE_CONTENT', $page->tasks )) { |
|
187 | 187 | $pages[] = $page; |
188 | 188 | |
189 | - if ( ! empty( $ppp_social_settings['facebook']->page ) && strpos( $ppp_social_settings['facebook']->page, $page->id ) ) { |
|
190 | - $ppp_social_settings['facebook']->page = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
189 | + if ( ! empty($ppp_social_settings['facebook']->page) && strpos( $ppp_social_settings['facebook']->page, $page->id )) { |
|
190 | + $ppp_social_settings['facebook']->page = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $pages = (object) $pages; |
200 | 200 | $ppp_social_settings['facebook']->available_pages = $pages; |
201 | - $ppp_social_settings['facebook']->pages_last_updated = current_time( 'timestamp' ) + ( HOUR_IN_SECONDS / 4 ); |
|
201 | + $ppp_social_settings['facebook']->pages_last_updated = current_time( 'timestamp' ) + (HOUR_IN_SECONDS / 4); |
|
202 | 202 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
203 | 203 | } else { |
204 | 204 | $pages = $facebook_settings->available_pages; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $facebook = $this->ppp_load_facebook(); |
221 | 221 | |
222 | 222 | //check facebook class is exis or not |
223 | - if( !$facebook ) { |
|
223 | + if ( ! $facebook) { |
|
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
@@ -231,27 +231,27 @@ discard block |
||
231 | 231 | * Get auth url for facebook |
232 | 232 | * |
233 | 233 | */ |
234 | - public function ppp_get_facebook_auth_url ( $return_url ) { |
|
234 | + public function ppp_get_facebook_auth_url( $return_url ) { |
|
235 | 235 | |
236 | 236 | //load facebook class |
237 | 237 | $facebook = $this->ppp_load_facebook(); |
238 | 238 | |
239 | 239 | //check facebook class is exis or not |
240 | - if( !$facebook ) { |
|
240 | + if ( ! $facebook) { |
|
241 | 241 | return false; |
242 | 242 | } |
243 | 243 | |
244 | - if ( ! PPP_LOCAL_TOKENS ) { |
|
244 | + if ( ! PPP_LOCAL_TOKENS) { |
|
245 | 245 | $base_url = 'https://postpromoterpro.com/?ppp-social-auth'; |
246 | - $url = $base_url . '&ppp-service=fb&ppp-license-key=' . trim( get_option( '_ppp_license_key' ) ); |
|
246 | + $url = $base_url.'&ppp-service=fb&ppp-license-key='.trim( get_option( '_ppp_license_key' ) ); |
|
247 | 247 | $url .= '&nocache'; |
248 | - $url .= '&return_url=' . esc_url( $return_url ); |
|
248 | + $url .= '&return_url='.esc_url( $return_url ); |
|
249 | 249 | } else { |
250 | 250 | $url = 'https://graph.facebook.com/oauth/authorize?'; |
251 | - $url .= 'client_id=' . PPP_FB_APP_ID; |
|
251 | + $url .= 'client_id='.PPP_FB_APP_ID; |
|
252 | 252 | $url .= '&scope=public_profile,publish_actions,manage_pages,publish_pages'; |
253 | 253 | $url .= '&state=ppp-local-keys-fb'; |
254 | - $url .= '&redirect_uri=' . esc_url( $return_url ) . '&nocache'; |
|
254 | + $url .= '&redirect_uri='.esc_url( $return_url ).'&nocache'; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return $url; |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | * Getting the the profile image of the connected Facebook user. |
264 | 264 | * |
265 | 265 | */ |
266 | - public function ppp_fb_get_profile_picture( $args=array(), $user ) { |
|
266 | + public function ppp_fb_get_profile_picture( $args = array(), $user ) { |
|
267 | 267 | |
268 | - if( isset( $args['type'] ) && !empty( $args['type'] ) ) { |
|
268 | + if (isset($args['type']) && ! empty($args['type'])) { |
|
269 | 269 | $type = $args['type']; |
270 | 270 | } else { |
271 | 271 | $type = 'large'; |
272 | 272 | } |
273 | - $url = 'https://graph.facebook.com/' . $user . '/picture?type=' . $type; |
|
273 | + $url = 'https://graph.facebook.com/'.$user.'/picture?type='.$type; |
|
274 | 274 | return $url; |
275 | 275 | } |
276 | 276 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | global $ppp_social_settings; |
279 | 279 | $facebook_settings = $ppp_social_settings['facebook']; |
280 | 280 | |
281 | - if ( !isset( $facebook_settings->page ) || strtolower( $facebook_settings->page ) === 'me' ) { |
|
281 | + if ( ! isset($facebook_settings->page) || strtolower( $facebook_settings->page ) === 'me') { |
|
282 | 282 | $account = 'me'; |
283 | 283 | $access_token = $facebook_settings->access_token; |
284 | 284 | } else { |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $access_token = $page_info[1]; |
288 | 288 | } |
289 | 289 | |
290 | - $url = 'https://graph.facebook.com/' . $account . '/feed?access_token=' . $access_token; |
|
290 | + $url = 'https://graph.facebook.com/'.$account.'/feed?access_token='.$access_token; |
|
291 | 291 | $args = array( 'link' => $link, 'message' => $message ); |
292 | - if ( !empty( $image ) ) { |
|
292 | + if ( ! empty($image)) { |
|
293 | 293 | $args['picture'] = $image; |
294 | 294 | } |
295 | 295 | $results = json_decode( wp_remote_retrieve_body( wp_remote_post( $url, array( 'body' => $args ) ) ) ); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | public function ppp_get_data_from_url( $url ) { |
309 | 309 | |
310 | 310 | //Use wp_remote_post and wp_remote_get |
311 | - $data = wp_remote_retrieve_body( wp_remote_get( $url ) ); |
|
311 | + $data = wp_remote_retrieve_body( wp_remote_get( $url ) ); |
|
312 | 312 | |
313 | 313 | return $data; |
314 | 314 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function clear_og_cache( $post_id ) { |
322 | 322 | $post_url = get_permalink( $post_id ); |
323 | - if ( ! empty( $post_url ) ) { |
|
323 | + if ( ! empty($post_url)) { |
|
324 | 324 | $args = array( 'body' => array( 'id' => $post_url, 'scrape' => true ) ); |
325 | 325 | $response = json_decode( wp_remote_retrieve_body( wp_remote_post( 'https://graph.facebook.com/', $args ) ) ); |
326 | 326 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $date = sanitize_text_field( $_POST['date'] ); |
11 | 11 | $time = sanitize_text_field( $_POST['time'] ); |
12 | 12 | |
13 | - $offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
13 | + $offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
14 | 14 | |
15 | 15 | $share_time = explode( ':', $time ); |
16 | 16 | |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
19 | 19 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
20 | 20 | |
21 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
21 | + if ($ampm == 'pm' && $hours != 12) { |
|
22 | 22 | $hours = $hours + 12; |
23 | 23 | } |
24 | 24 | |
25 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
25 | + if ($ampm == 'am' && $hours == 12) { |
|
26 | 26 | $hours = 00; |
27 | 27 | } |
28 | 28 | |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | } |
39 | 39 | add_action( 'wp_ajax_ppp_has_schedule_conflict', 'ppp_check_for_schedule_conflict' ); |
40 | 40 | |
41 | -add_action( 'wp_ajax_ppp_local_url_notice_dismiss', function() { |
|
41 | +add_action( 'wp_ajax_ppp_local_url_notice_dismiss', function () { |
|
42 | 42 | $error_message = __( 'There was an error dismissing the local URL notice. Please try again.', 'ppp-txt' ); |
43 | - if( ! wp_verify_nonce( $_POST['nonce'], 'ppp_local_url_notice_nonce' ) || ! current_user_can( post_promoter_pro()->get_manage_capability() ) ) { |
|
43 | + if ( ! wp_verify_nonce( $_POST['nonce'], 'ppp_local_url_notice_nonce' ) || ! current_user_can( post_promoter_pro()->get_manage_capability() )) { |
|
44 | 44 | wp_send_json_error( array( |
45 | 45 | 'error' => $error_message, |
46 | 46 | ) ); |
47 | 47 | } |
48 | 48 | $updated = update_option( 'ppp_local_url_notice_dismissed', true ); |
49 | - if( $updated === false ) { |
|
49 | + if ($updated === false) { |
|
50 | 50 | wp_send_json_error( array( |
51 | 51 | 'error' => $error_message, |
52 | 52 | ) ); |