@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Register Facebook as a service |
24 | 24 | * @param array $services The Currently registered services |
25 | - * @return array The services with Facebook added |
|
25 | + * @return string[] The services with Facebook added |
|
26 | 26 | */ |
27 | 27 | function ppp_fb_register_service( $services = array() ) { |
28 | 28 | $services[] = 'fb'; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | /** |
191 | 191 | * Add query vars for Facebook |
192 | 192 | * @param array $vars Currenty Query Vars |
193 | - * @return array Query vars array with facebook added |
|
193 | + * @return string[] Query vars array with facebook added |
|
194 | 194 | */ |
195 | 195 | function ppp_fb_query_vars( $vars ) { |
196 | 196 | $vars[] = 'fb_access_token'; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * @since 2.3 |
749 | 749 | * @param int $post_id Post ID |
750 | 750 | * @param string $name The cron name |
751 | - * @param boolean $scheduled If the item is being fired by a schedule (default, true), or retrieved for display (false) |
|
751 | + * @param boolean $is_scheduled If the item is being fired by a schedule (default, true), or retrieved for display (false) |
|
752 | 752 | * @return string The formatted link to the post |
753 | 753 | */ |
754 | 754 | function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
@@ -464,9 +464,12 @@ |
||
464 | 464 | |
465 | 465 | <?php endforeach; ?> |
466 | 466 | |
467 | - <?php else: ?> |
|
467 | + <?php else { |
|
468 | + : ?> |
|
468 | 469 | |
469 | - <?php ppp_render_fb_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); ?> |
|
470 | + <?php ppp_render_fb_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); |
|
471 | +} |
|
472 | +?> |
|
470 | 473 | |
471 | 474 | <?php endif; ?> |
472 | 475 | </tbody> |
@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ppp_facebook_enabled() { |
13 | 13 | global $ppp_social_settings; |
14 | 14 | |
15 | - if ( isset( $ppp_social_settings['facebook'] ) && !empty( $ppp_social_settings['facebook'] ) ) { |
|
15 | + if (isset($ppp_social_settings['facebook']) && ! empty($ppp_social_settings['facebook'])) { |
|
16 | 16 | return true; |
17 | 17 | } |
18 | 18 | |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function ppp_fb_account_list_avatar( $string = '' ) { |
52 | 52 | |
53 | - if ( ppp_facebook_enabled() ) { |
|
53 | + if (ppp_facebook_enabled()) { |
|
54 | 54 | global $ppp_social_settings; |
55 | 55 | $avatar_url = $ppp_social_settings['facebook']->avatar; |
56 | - $string = '<img class="ppp-social-icon" src="' . $avatar_url . '" />'; |
|
56 | + $string = '<img class="ppp-social-icon" src="'.$avatar_url.'" />'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $string; |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function ppp_fb_account_list_name( $string = '' ) { |
69 | 69 | |
70 | - if ( ppp_facebook_enabled() ) { |
|
70 | + if (ppp_facebook_enabled()) { |
|
71 | 71 | global $ppp_social_settings; |
72 | - $string = $ppp_social_settings['facebook']->name; |
|
72 | + $string = $ppp_social_settings['facebook']->name; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $string; |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | function ppp_fb_account_list_actions( $string = '' ) { |
85 | 85 | global $ppp_facebook_oauth, $ppp_social_settings; |
86 | 86 | |
87 | - if ( ! ppp_facebook_enabled() ) { |
|
87 | + if ( ! ppp_facebook_enabled()) { |
|
88 | 88 | |
89 | 89 | $fb_authurl = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
90 | 90 | |
91 | - $string .= '<a class="button-primary" href="' . $fb_authurl . '">' . __( 'Connect to Facebook', 'ppp-txt' ) . '</a>'; |
|
91 | + $string .= '<a class="button-primary" href="'.$fb_authurl.'">'.__( 'Connect to Facebook', 'ppp-txt' ).'</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=facebook' ) . '" >' . __( 'Disconnect from Facebook', 'ppp-txt' ) . '</a> '; |
|
93 | + $string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=facebook' ).'" >'.__( 'Disconnect from Facebook', 'ppp-txt' ).'</a> '; |
|
94 | 94 | |
95 | 95 | $refresh_date = (int) get_option( '_ppp_facebook_refresh', true ); |
96 | 96 | |
97 | - if ( defined( 'PPP_FB_APP_ID' ) && current_time( 'timestamp' ) > $refresh_date ) { |
|
97 | + if (defined( 'PPP_FB_APP_ID' ) && current_time( 'timestamp' ) > $refresh_date) { |
|
98 | 98 | $token = $ppp_social_settings['facebook']->access_token; |
99 | 99 | $url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
100 | - $refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); |
|
100 | + $refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); |
|
101 | 101 | |
102 | - $string .= '<a class="button-secondary" href="' . $refresh_url . '" >' . __( 'Re-Authorize Facebook', 'ppp-txt' ) . '</a> '; |
|
102 | + $string .= '<a class="button-secondary" href="'.$refresh_url.'" >'.__( 'Re-Authorize Facebook', 'ppp-txt' ).'</a> '; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -114,27 +114,27 @@ discard block |
||
114 | 114 | */ |
115 | 115 | function ppp_fb_account_list_extras( $string ) { |
116 | 116 | |
117 | - if ( ppp_facebook_enabled() ) { |
|
117 | + if (ppp_facebook_enabled()) { |
|
118 | 118 | global $ppp_social_settings, $ppp_facebook_oauth, $ppp_options; |
119 | 119 | $pages = $ppp_facebook_oauth->ppp_get_fb_user_pages( $ppp_social_settings['facebook']->access_token ); |
120 | - $selected = isset( $ppp_social_settings['facebook']->page ) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; |
|
120 | + $selected = isset($ppp_social_settings['facebook']->page) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; |
|
121 | 121 | |
122 | - if ( !empty( $pages ) ) { |
|
123 | - $string = '<label>' . __( 'Publish as:', 'ppp-txt' ) . '</label><br />'; |
|
122 | + if ( ! empty($pages)) { |
|
123 | + $string = '<label>'.__( 'Publish as:', 'ppp-txt' ).'</label><br />'; |
|
124 | 124 | $string .= '<select id="fb-page">'; |
125 | - foreach ( $pages as $page ) { |
|
126 | - $value = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
127 | - $string .= '<option ' . selected( $value, $selected, false ) . ' value="' . $value . '">' . $page->name . '</option>'; |
|
125 | + foreach ($pages as $page) { |
|
126 | + $value = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
127 | + $string .= '<option '.selected( $value, $selected, false ).' value="'.$value.'">'.$page->name.'</option>'; |
|
128 | 128 | } |
129 | 129 | $string .= '</select><span class="spinner"></span>'; |
130 | 130 | } |
131 | 131 | |
132 | - if ( ! empty( $ppp_options['enable_debug'] ) ) { |
|
133 | - $days_left = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
134 | - $refresh_in = absint( round( ( get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
132 | + if ( ! empty($ppp_options['enable_debug'])) { |
|
133 | + $days_left = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
134 | + $refresh_in = absint( round( (get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
135 | 135 | |
136 | - $string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left ); |
|
137 | - $string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
136 | + $string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left ); |
|
137 | + $string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return void |
149 | 149 | */ |
150 | 150 | function ppp_set_fb_token_constants( $social_tokens ) { |
151 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'facebook' ) ) { |
|
151 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'facebook' )) { |
|
152 | 152 | define( 'PPP_FB_APP_ID', $social_tokens->facebook->app_id ); |
153 | 153 | define( 'PPP_FB_APP_SECRET', $social_tokens->facebook->app_secret ); |
154 | 154 | } |
@@ -162,17 +162,17 @@ discard block |
||
162 | 162 | function ppp_capture_facebook_oauth() { |
163 | 163 | $should_capture = false; |
164 | 164 | |
165 | - if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) { |
|
165 | + if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) { |
|
166 | 166 | // Local config |
167 | 167 | $should_capture = true; |
168 | 168 | } |
169 | 169 | |
170 | - if ( isset( $_REQUEST['fb_access_token'] ) ) { |
|
170 | + if (isset($_REQUEST['fb_access_token'])) { |
|
171 | 171 | // Returning from remote config |
172 | 172 | $should_capture = true; |
173 | 173 | } |
174 | 174 | |
175 | - if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) { |
|
175 | + if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) { |
|
176 | 176 | global $ppp_facebook_oauth; |
177 | 177 | $ppp_facebook_oauth->ppp_initialize_facebook(); |
178 | 178 | wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | function ppp_disconnect_facebook() { |
190 | 190 | global $ppp_social_settings; |
191 | 191 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
192 | - if ( isset( $ppp_social_settings['facebook'] ) ) { |
|
193 | - unset( $ppp_social_settings['facebook'] ); |
|
192 | + if (isset($ppp_social_settings['facebook'])) { |
|
193 | + unset($ppp_social_settings['facebook']); |
|
194 | 194 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
195 | 195 | delete_option( '_ppp_facebook_refresh' ); |
196 | 196 | } |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | */ |
217 | 217 | function ppp_fb_execute_refresh() { |
218 | 218 | |
219 | - if ( ! ppp_facebook_enabled() ) { |
|
219 | + if ( ! ppp_facebook_enabled()) { |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
223 | 223 | $refresh_date = (int) get_option( '_ppp_facebook_refresh', true ); |
224 | 224 | |
225 | - if ( ( empty( $_GET['page' ] ) || $_GET['page'] !== 'ppp-social-settings' ) && current_time( 'timestamp' ) > $refresh_date ) { |
|
225 | + if ((empty($_GET['page']) || $_GET['page'] !== 'ppp-social-settings') && current_time( 'timestamp' ) > $refresh_date) { |
|
226 | 226 | add_action( 'admin_notices', 'ppp_facebook_refresh_notice' ); |
227 | 227 | } |
228 | 228 | } |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | */ |
235 | 235 | function ppp_facebook_refresh_notice() { |
236 | 236 | |
237 | - if ( ! ppp_facebook_enabled() ) { |
|
237 | + if ( ! ppp_facebook_enabled()) { |
|
238 | 238 | return; |
239 | 239 | } |
240 | 240 | |
241 | - $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb' . get_current_user_id() ); |
|
242 | - if ( false !== $has_dismissed ) { |
|
241 | + $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb'.get_current_user_id() ); |
|
242 | + if (false !== $has_dismissed) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | |
251 | 251 | $token = $ppp_social_settings['facebook']->access_token; |
252 | 252 | $url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
253 | - $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); |
|
253 | + $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); |
|
254 | 254 | |
255 | - $days_left = (int) round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ); |
|
255 | + $days_left = (int) round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ); |
|
256 | 256 | ?> |
257 | 257 | <div class="notice notice-warning is-dismissible" data-service="fb"> |
258 | - <?php if ( $days_left > 0 ): ?> |
|
258 | + <?php if ($days_left > 0): ?> |
|
259 | 259 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication expires in %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p> |
260 | - <?php elseif ( $days_left < 1 ): ?> |
|
260 | + <?php elseif ($days_left < 1): ?> |
|
261 | 261 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p> |
262 | 262 | <?php endif; ?> |
263 | 263 | </div> |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | */ |
273 | 273 | function ppp_fb_dismiss_notice() { |
274 | 274 | |
275 | - $nag = sanitize_key( $_POST[ 'nag' ] ); |
|
275 | + $nag = sanitize_key( $_POST['nag'] ); |
|
276 | 276 | |
277 | - if ( $nag === $_POST[ 'nag' ] ) { |
|
278 | - set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS ); |
|
277 | + if ($nag === $_POST['nag']) { |
|
278 | + set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS ); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | |
@@ -303,18 +303,18 @@ discard block |
||
303 | 303 | * @param string $name The name of the Cron |
304 | 304 | * @return void |
305 | 305 | */ |
306 | -function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
306 | +function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
307 | 307 | global $ppp_options; |
308 | 308 | |
309 | 309 | $link = ppp_generate_link( $post_id, $name ); |
310 | 310 | |
311 | 311 | $post_meta = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
312 | - $this_share = $post_meta[ $index ]; |
|
313 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; |
|
312 | + $this_share = $post_meta[$index]; |
|
313 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; |
|
314 | 314 | |
315 | 315 | $share_message = ppp_fb_build_share_message( $post_id, $name ); |
316 | 316 | |
317 | - if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { |
|
317 | + if (empty($attachment_id) && ! empty($this_share['image'])) { |
|
318 | 318 | $media = $this_share['image']; |
319 | 319 | } else { |
320 | 320 | $use_media = ppp_fb_use_media( $post_id, $index ); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | function ppp_fb_add_meta_tab( $tabs ) { |
374 | 374 | global $ppp_social_settings; |
375 | - if ( ! ppp_facebook_enabled() ) { |
|
375 | + if ( ! ppp_facebook_enabled()) { |
|
376 | 376 | return $tabs; |
377 | 377 | } |
378 | 378 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | */ |
390 | 390 | function ppp_fb_register_metabox_content( $content ) { |
391 | 391 | global $ppp_social_settings; |
392 | - if ( ! ppp_facebook_enabled() ) { |
|
392 | + if ( ! ppp_facebook_enabled()) { |
|
393 | 393 | return $content; |
394 | 394 | } |
395 | 395 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | function ppp_fb_add_metabox_content( $post ) { |
407 | 407 | global $ppp_options, $ppp_share_settings; |
408 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
408 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
409 | 409 | |
410 | 410 | $ppp_fb_share_on_publish = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
411 | 411 | $ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | $show_share_on_publish = false; |
416 | 416 | |
417 | - $share_by_default = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['facebook'] ) ? false : true; |
|
417 | + $share_by_default = empty($ppp_share_settings['share_on_publish'][$post->post_type]['facebook']) ? false : true; |
|
418 | 418 | |
419 | - if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) { |
|
419 | + if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) { |
|
420 | 420 | $show_share_on_publish = true; |
421 | 421 | } |
422 | 422 | |
@@ -425,11 +425,11 @@ discard block |
||
425 | 425 | <div class="ppp-post-override-wrap"> |
426 | 426 | <p><h3><?php _e( 'Share on Facebook', 'ppp-txt' ); ?></h3></p> |
427 | 427 | <p> |
428 | - <?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?> |
|
428 | + <?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?> |
|
429 | 429 | <label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook…', 'ppp-txt' ); ?></label> |
430 | 430 | <select name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" class="ppp-toggle-share-on-publish"> |
431 | - <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
432 | - <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
431 | + <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
432 | + <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
433 | 433 | <option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option> |
434 | 434 | </select> |
435 | 435 | </p> |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <th style="width: 10px;"></th> |
446 | 446 | </tr> |
447 | 447 | </thead> |
448 | - <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
448 | + <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
449 | 449 | <?php |
450 | 450 | $args = array( |
451 | 451 | 'text' => $ppp_share_on_publish_title, |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | ppp_render_fb_share_on_publish_row( $args ); |
457 | 457 | ?> |
458 | 458 | </tbody> |
459 | - <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
459 | + <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
460 | 460 | <?php $shares = get_post_meta( $post->ID, '_ppp_fb_shares', true ); ?> |
461 | - <?php if ( ! empty( $shares ) ) : ?> |
|
461 | + <?php if ( ! empty($shares)) : ?> |
|
462 | 462 | |
463 | - <?php foreach ( $shares as $key => $value ) : |
|
464 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
465 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
466 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
467 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
468 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
463 | + <?php foreach ($shares as $key => $value) : |
|
464 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
465 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
466 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
467 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
468 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
469 | 469 | |
470 | - $args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); |
|
470 | + $args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); |
|
471 | 471 | ?> |
472 | 472 | |
473 | 473 | <?php ppp_render_fb_share_row( $key, $args, $post->ID ); ?> |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | |
548 | 548 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
549 | 549 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
550 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
551 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
550 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
551 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
552 | 552 | ?> |
553 | 553 | <tr class="ppp-fb-wrapper ppp-repeatable-row ppp-repeatable-facebook scheduled-row" data-key="<?php echo esc_attr( $key ); ?>"> |
554 | 554 | <td> |
@@ -593,23 +593,23 @@ discard block |
||
593 | 593 | */ |
594 | 594 | function ppp_fb_save_post_meta_boxes( $post_id, $post ) { |
595 | 595 | |
596 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
596 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
597 | 597 | return; |
598 | 598 | } |
599 | 599 | |
600 | - $ppp_fb_share_on_publish = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; |
|
601 | - $ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; |
|
602 | - $ppp_share_on_publish_image_url = ( isset( $_REQUEST['_ppp_fb_share_on_publish_image_url'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
603 | - $ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; |
|
600 | + $ppp_fb_share_on_publish = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; |
|
601 | + $ppp_share_on_publish_title = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; |
|
602 | + $ppp_share_on_publish_image_url = (isset($_REQUEST['_ppp_fb_share_on_publish_image_url'])) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
603 | + $ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_fb_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; |
|
604 | 604 | |
605 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); |
|
606 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); |
|
607 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
605 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); |
|
606 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); |
|
607 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
608 | 608 | update_post_meta( $post_id, '_ppp_fb_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id ); |
609 | 609 | |
610 | - $fb_data = ( isset( $_REQUEST['_ppp_fb_shares'] ) && empty( $ppp_fb_share_on_publish ) ) ? $_REQUEST['_ppp_fb_shares'] : array(); |
|
611 | - foreach ( $fb_data as $index => $share ) { |
|
612 | - $fb_data[ $index ]['text'] = sanitize_text_field( $share['text'] ); |
|
610 | + $fb_data = (isset($_REQUEST['_ppp_fb_shares']) && empty($ppp_fb_share_on_publish)) ? $_REQUEST['_ppp_fb_shares'] : array(); |
|
611 | + foreach ($fb_data as $index => $share) { |
|
612 | + $fb_data[$index]['text'] = sanitize_text_field( $share['text'] ); |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | update_post_meta( $post_id, '_ppp_fb_shares', $fb_data ); |
@@ -626,10 +626,10 @@ discard block |
||
626 | 626 | function ppp_fb_share_on_publish( $new_status, $old_status, $post ) { |
627 | 627 | global $ppp_options; |
628 | 628 | |
629 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
|
630 | - $from_post = isset( $_POST['_ppp_fb_share_on_publish'] ) ? $_POST['_ppp_fb_share_on_publish'] : '0'; |
|
629 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
|
630 | + $from_post = isset($_POST['_ppp_fb_share_on_publish']) ? $_POST['_ppp_fb_share_on_publish'] : '0'; |
|
631 | 631 | |
632 | - if ( '1' != $from_meta && '1' != $from_post ) { |
|
632 | + if ('1' != $from_meta && '1' != $from_post) { |
|
633 | 633 | return; |
634 | 634 | } |
635 | 635 | |
@@ -641,28 +641,28 @@ discard block |
||
641 | 641 | $image_url = ''; |
642 | 642 | |
643 | 643 | // Determine if we're seeing the share on publish in meta or $_POST |
644 | - if ( $from_meta && ! $from_post ) { |
|
645 | - $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
|
644 | + if ($from_meta && ! $from_post) { |
|
645 | + $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
|
646 | 646 | $attachment_id = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_attachment_id', true ); |
647 | - $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); |
|
647 | + $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); |
|
648 | 648 | } else { |
649 | - $title = isset( $_POST['_ppp_fb_share_on_publish_title'] ) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; |
|
650 | - $attachment_id = isset( $_POST['_ppp_fb_share_on_publish_attachment_id'] ) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; |
|
651 | - $image_url = isset( $_POST['_ppp_fb_share_on_publish_image_url'] ) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
649 | + $title = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; |
|
650 | + $attachment_id = isset($_POST['_ppp_fb_share_on_publish_attachment_id']) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; |
|
651 | + $image_url = isset($_POST['_ppp_fb_share_on_publish_image_url']) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | $thumbnail = ''; |
655 | - if ( empty( $attachment_id ) && ! empty( $image_url ) ) { |
|
655 | + if (empty($attachment_id) && ! empty($image_url)) { |
|
656 | 656 | $thumbnail = $image_url; |
657 | 657 | } else { |
658 | 658 | $thumbnail = ppp_post_has_media( $post->ID, 'fb', true, $attachment_id ); |
659 | 659 | } |
660 | 660 | |
661 | - $name = 'sharedate_0_' . $post->ID . '_fb'; |
|
661 | + $name = 'sharedate_0_'.$post->ID.'_fb'; |
|
662 | 662 | |
663 | - $default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
663 | + $default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
664 | 664 | // If an override was found, use it, otherwise try the default text content |
665 | - if ( empty( $title ) && empty( $default_title ) ) { |
|
665 | + if (empty($title) && empty($default_title)) { |
|
666 | 666 | $title = get_the_title( $post->ID ); |
667 | 667 | } |
668 | 668 | |
@@ -702,20 +702,20 @@ discard block |
||
702 | 702 | function ppp_fb_generate_timestamps( $times, $post_id ) { |
703 | 703 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
704 | 704 | |
705 | - if ( empty( $fb_shares ) ) { |
|
705 | + if (empty($fb_shares)) { |
|
706 | 706 | $fb_shares = array(); |
707 | 707 | } |
708 | 708 | |
709 | - foreach ( $fb_shares as $key => $data ) { |
|
710 | - if ( ! array_filter( $data ) ) { |
|
709 | + foreach ($fb_shares as $key => $data) { |
|
710 | + if ( ! array_filter( $data )) { |
|
711 | 711 | continue; |
712 | 712 | } |
713 | 713 | |
714 | 714 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
715 | 715 | |
716 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
717 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_fb'; |
|
718 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_fb'; |
|
716 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
717 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_fb'; |
|
718 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_fb'; |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | } |
@@ -765,22 +765,22 @@ discard block |
||
765 | 765 | */ |
766 | 766 | function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
767 | 767 | global $ppp_options; |
768 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
768 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
769 | 769 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
770 | 770 | |
771 | - if ( ! empty( $fb_shares ) ) { |
|
771 | + if ( ! empty($fb_shares)) { |
|
772 | 772 | $name_array = explode( '_', $name ); |
773 | 773 | $index = $name_array[1]; |
774 | - if ( isset( $fb_shares[ $index ] ) ) { |
|
775 | - $share_content = $fb_shares[ $index ]['text']; |
|
774 | + if (isset($fb_shares[$index])) { |
|
775 | + $share_content = $fb_shares[$index]['text']; |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
779 | 779 | // If an override was found, use it, otherwise try the default text content |
780 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
780 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
781 | 781 | |
782 | 782 | // If the content is still empty, just use the post title |
783 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
783 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
784 | 784 | |
785 | 785 | return apply_filters( 'ppp_share_content_fb', $share_content, array( 'post_id' => $post_id ) ); |
786 | 786 | } |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * @return bool Whether or not this tweet should contain a media post |
793 | 793 | */ |
794 | 794 | function ppp_fb_use_media( $post_id, $index ) { |
795 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
795 | + if (empty($post_id) || empty($index)) { |
|
796 | 796 | return false; |
797 | 797 | } |
798 | 798 | |
@@ -808,9 +808,9 @@ discard block |
||
808 | 808 | |
809 | 809 | ppp_set_social_tokens(); |
810 | 810 | |
811 | - $account = isset( $_POST['account'] ) ? $_POST['account'] : false; |
|
811 | + $account = isset($_POST['account']) ? $_POST['account'] : false; |
|
812 | 812 | |
813 | - if ( !empty( $account ) ) { |
|
813 | + if ( ! empty($account)) { |
|
814 | 814 | $ppp_social_settings['facebook']->page = $account; |
815 | 815 | |
816 | 816 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
@@ -826,14 +826,14 @@ discard block |
||
826 | 826 | function ppp_fb_calendar_on_publish_event( $events, $post_id ) { |
827 | 827 | $share_on_publish = get_post_meta( $post_id, '_ppp_fb_share_on_publish', true ); |
828 | 828 | |
829 | - if ( ! empty( $share_on_publish ) ) { |
|
829 | + if ( ! empty($share_on_publish)) { |
|
830 | 830 | $share_text = get_post_meta( $post_id, '_ppp_fb_share_on_publish_title', true ); |
831 | 831 | $events[] = array( |
832 | - 'id' => $post_id . '-share-on-publish', |
|
833 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), |
|
834 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
835 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
836 | - 'className' => 'ppp-calendar-item-fb cal-post-' . $post_id, |
|
832 | + 'id' => $post_id.'-share-on-publish', |
|
833 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), |
|
834 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
835 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
836 | + 'className' => 'ppp-calendar-item-fb cal-post-'.$post_id, |
|
837 | 837 | 'belongsTo' => $post_id, |
838 | 838 | ); |
839 | 839 | } |
@@ -844,9 +844,9 @@ discard block |
||
844 | 844 | |
845 | 845 | function ppp_fb_get_post_shares( $items, $post_id ) { |
846 | 846 | $shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
847 | - if ( empty( $shares ) ) { return $items; } |
|
847 | + if (empty($shares)) { return $items; } |
|
848 | 848 | |
849 | - foreach ( $shares as $key => $share ) { |
|
849 | + foreach ($shares as $key => $share) { |
|
850 | 850 | $items[] = array( 'id' => $key, 'service' => 'fb' ); |
851 | 851 | } |
852 | 852 | return $items; |
@@ -864,11 +864,11 @@ discard block |
||
864 | 864 | */ |
865 | 865 | function ppp_fb_clear_open_graph_cache( $post_id, $post_after, $post_before ) { |
866 | 866 | $post_types = ppp_allowed_post_types(); |
867 | - if ( ! in_array( $post_after->post_type, $post_types ) ) { |
|
867 | + if ( ! in_array( $post_after->post_type, $post_types )) { |
|
868 | 868 | return; |
869 | 869 | } |
870 | 870 | |
871 | - if ( 'publish' == $post_after->post_status ) { |
|
871 | + if ('publish' == $post_after->post_status) { |
|
872 | 872 | global $ppp_facebook_oauth; |
873 | 873 | |
874 | 874 | return $ppp_facebook_oauth->clear_og_cache( $post_id ); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @since 1.0 |
202 | 202 | * |
203 | 203 | * |
204 | - * @return array |
|
204 | + * @return boolean |
|
205 | 205 | */ |
206 | 206 | |
207 | 207 | private static function valid_type( $type ) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @uses wp_update_post() |
300 | 300 | * @uses update_post_meta() |
301 | 301 | * |
302 | - * @return bool True if successful, false otherwise |
|
302 | + * @return boolean|null True if successful, false otherwise |
|
303 | 303 | */ |
304 | 304 | public static function update_log( $log_data = array(), $log_meta = array() ) { |
305 | 305 |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @since 1.0 |
124 | 124 | * |
125 | 125 | * @return array |
126 | - */ |
|
126 | + */ |
|
127 | 127 | |
128 | 128 | private static function log_types() { |
129 | 129 | $terms = array( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @uses register_post_type() |
144 | 144 | * |
145 | 145 | * @return void |
146 | - */ |
|
146 | + */ |
|
147 | 147 | |
148 | 148 | public function register_post_type() { |
149 | 149 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @uses wp_insert_term() |
177 | 177 | * |
178 | 178 | * @return void |
179 | - */ |
|
179 | + */ |
|
180 | 180 | |
181 | 181 | public function register_taxonomy() { |
182 | 182 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * |
204 | 204 | * @return array |
205 | - */ |
|
205 | + */ |
|
206 | 206 | |
207 | 207 | private static function valid_type( $type ) { |
208 | 208 | return in_array( $type, self::log_types() ); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @uses self::insert_log() |
222 | 222 | * |
223 | 223 | * @return int The ID of the new log entry |
224 | - */ |
|
224 | + */ |
|
225 | 225 | |
226 | 226 | public static function add( $title = '', $message = '', $parent = 0, $type = null ) { |
227 | 227 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @uses sanitize_key() |
251 | 251 | * |
252 | 252 | * @return int The ID of the newly created log item |
253 | - */ |
|
253 | + */ |
|
254 | 254 | |
255 | 255 | public static function insert_log( $log_data = array(), $log_meta = array() ) { |
256 | 256 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @uses update_post_meta() |
301 | 301 | * |
302 | 302 | * @return bool True if successful, false otherwise |
303 | - */ |
|
303 | + */ |
|
304 | 304 | public static function update_log( $log_data = array(), $log_meta = array() ) { |
305 | 305 | |
306 | 306 | do_action( 'wp_pre_update_log', $log_id ); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @uses self::get_connected_logs() |
338 | 338 | * |
339 | 339 | * @return array |
340 | - */ |
|
340 | + */ |
|
341 | 341 | |
342 | 342 | public static function get_logs( $object_id = 0, $type = null, $paged = null ) { |
343 | 343 | return self::get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) ); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @uses self::valid_type() |
360 | 360 | * |
361 | 361 | * @return array / false |
362 | - */ |
|
362 | + */ |
|
363 | 363 | |
364 | 364 | public static function get_connected_logs( $args = array() ) { |
365 | 365 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @uses self::valid_type() |
408 | 408 | * |
409 | 409 | * @return int |
410 | - */ |
|
410 | + */ |
|
411 | 411 | |
412 | 412 | public static function get_log_count( $object_id = 0, $type = null, $meta_query = null ) { |
413 | 413 |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | * @uses $this->get_logs_to_prune() Returns array of posts via get_posts of logs to prune |
42 | 42 | * @uses $this->prune_old_logs() Deletes the logs that we don't want anymore |
43 | 43 | */ |
44 | - public function prune_logs(){ |
|
44 | + public function prune_logs() { |
|
45 | 45 | |
46 | 46 | $should_we_prune = apply_filters( 'wp_logging_should_we_prune', false ); |
47 | 47 | |
48 | - if ( $should_we_prune === false ){ |
|
48 | + if ($should_we_prune === false) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | 52 | $logs_to_prune = $this->get_logs_to_prune(); |
53 | 53 | |
54 | - if ( isset( $logs_to_prune ) && ! empty( $logs_to_prune ) ){ |
|
54 | + if (isset($logs_to_prune) && ! empty($logs_to_prune)) { |
|
55 | 55 | $this->prune_old_logs( $logs_to_prune ); |
56 | 56 | } |
57 | 57 | |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @filter wp_logging_force_delete_log Allows user to override the force delete setting which bypasses the trash |
71 | 71 | */ |
72 | - private function prune_old_logs( $logs ){ |
|
72 | + private function prune_old_logs( $logs ) { |
|
73 | 73 | |
74 | 74 | $force = apply_filters( 'wp_logging_force_delete_log', true ); |
75 | 75 | |
76 | - foreach( $logs as $l ){ |
|
76 | + foreach ($logs as $l) { |
|
77 | 77 | wp_delete_post( $l->ID, $force ); |
78 | 78 | } |
79 | 79 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @filter wp_logging_prune_when Users can change how long ago we are looking for logs to prune |
94 | 94 | * @filter wp_logging_prune_query_args Gives users access to change any query args for pruning |
95 | 95 | */ |
96 | - private function get_logs_to_prune(){ |
|
96 | + private function get_logs_to_prune() { |
|
97 | 97 | |
98 | 98 | $how_old = apply_filters( 'wp_logging_prune_when', '2 weeks ago' ); |
99 | 99 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | |
185 | 185 | $types = self::log_types(); |
186 | 186 | |
187 | - foreach ( $types as $type ) { |
|
188 | - if( ! term_exists( $type, 'wp_log_type' ) ) { |
|
187 | + foreach ($types as $type) { |
|
188 | + if ( ! term_exists( $type, 'wp_log_type' )) { |
|
189 | 189 | wp_insert_term( $type, 'wp_log_type' ); |
190 | 190 | } |
191 | 191 | } |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | $log_id = wp_insert_post( $args ); |
271 | 271 | |
272 | 272 | // set the log type, if any |
273 | - if( $log_data['log_type'] && self::valid_type( $log_data['log_type'] ) ) { |
|
273 | + if ($log_data['log_type'] && self::valid_type( $log_data['log_type'] )) { |
|
274 | 274 | wp_set_object_terms( $log_id, $log_data['log_type'], 'wp_log_type', false ); |
275 | 275 | } |
276 | 276 | |
277 | 277 | |
278 | 278 | // set log meta, if any |
279 | - if( $log_id && ! empty( $log_meta ) ) { |
|
280 | - foreach( (array) $log_meta as $key => $meta ) { |
|
281 | - update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
279 | + if ($log_id && ! empty($log_meta)) { |
|
280 | + foreach ((array) $log_meta as $key => $meta) { |
|
281 | + update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta ); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -316,10 +316,10 @@ discard block |
||
316 | 316 | // store the log entry |
317 | 317 | $log_id = wp_update_post( $args ); |
318 | 318 | |
319 | - if( $log_id && ! empty( $log_meta ) ) { |
|
320 | - foreach( (array) $log_meta as $key => $meta ) { |
|
321 | - if( ! empty( $meta ) ) |
|
322 | - update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
319 | + if ($log_id && ! empty($log_meta)) { |
|
320 | + foreach ((array) $log_meta as $key => $meta) { |
|
321 | + if ( ! empty($meta)) |
|
322 | + update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta ); |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | |
375 | 375 | $query_args = wp_parse_args( $args, $defaults ); |
376 | 376 | |
377 | - if( $query_args['log_type'] && self::valid_type( $query_args['log_type'] ) ) { |
|
377 | + if ($query_args['log_type'] && self::valid_type( $query_args['log_type'] )) { |
|
378 | 378 | |
379 | 379 | $query_args['tax_query'] = array( |
380 | 380 | array( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | $logs = get_posts( $query_args ); |
390 | 390 | |
391 | - if( $logs ) |
|
391 | + if ($logs) |
|
392 | 392 | return $logs; |
393 | 393 | |
394 | 394 | // no logs found |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | 'post_status' => 'publish' |
419 | 419 | ); |
420 | 420 | |
421 | - if( ! empty( $type ) && self::valid_type( $type ) ) { |
|
421 | + if ( ! empty($type) && self::valid_type( $type )) { |
|
422 | 422 | |
423 | 423 | $query_args['tax_query'] = array( |
424 | 424 | array( |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | |
431 | 431 | } |
432 | 432 | |
433 | - if( ! empty( $meta_query ) ) { |
|
433 | + if ( ! empty($meta_query)) { |
|
434 | 434 | $query_args['meta_query'] = $meta_query; |
435 | 435 | } |
436 | 436 |
@@ -318,8 +318,9 @@ discard block |
||
318 | 318 | |
319 | 319 | if( $log_id && ! empty( $log_meta ) ) { |
320 | 320 | foreach( (array) $log_meta as $key => $meta ) { |
321 | - if( ! empty( $meta ) ) |
|
322 | - update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
321 | + if( ! empty( $meta ) ) { |
|
322 | + update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
323 | + } |
|
323 | 324 | } |
324 | 325 | } |
325 | 326 | |
@@ -388,8 +389,9 @@ discard block |
||
388 | 389 | |
389 | 390 | $logs = get_posts( $query_args ); |
390 | 391 | |
391 | - if( $logs ) |
|
392 | - return $logs; |
|
392 | + if( $logs ) { |
|
393 | + return $logs; |
|
394 | + } |
|
393 | 395 | |
394 | 396 | // no logs found |
395 | 397 | return false; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Registers LinkedIn as a service |
24 | 24 | * @param array $services The registered servcies |
25 | - * @return array With LinkedIn added |
|
25 | + * @return string[] With LinkedIn added |
|
26 | 26 | */ |
27 | 27 | function ppp_li_register_service( $services = array() ) { |
28 | 28 | $services[] = 'li'; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * Add query vars for Linkedin |
158 | 158 | * @param array $vars Currenty Query Vars |
159 | - * @return array Query vars array with linkedin added |
|
159 | + * @return string[] Query vars array with linkedin added |
|
160 | 160 | */ |
161 | 161 | function ppp_li_query_vars( $vars ) { |
162 | 162 | $vars[] = 'li_access_token'; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * Add the content box for LinkedIn in the social media settings |
288 | 288 | * @param array $content The existing content blocks |
289 | - * @return array With LinkedIn |
|
289 | + * @return string[] With LinkedIn |
|
290 | 290 | */ |
291 | 291 | function ppp_li_register_admin_social_content( $content ) { |
292 | 292 | $content[] = 'li'; |
@@ -497,7 +497,6 @@ discard block |
||
497 | 497 | * @since 2.3 |
498 | 498 | * @param int $key The key in the array |
499 | 499 | * @param array $args Arguements for the current post's share data |
500 | - * @param int $post_id The post ID being edited |
|
501 | 500 | * @return void |
502 | 501 | */ |
503 | 502 | function ppp_render_li_share_row( $key, $args = array() ) { |
@@ -740,7 +739,7 @@ discard block |
||
740 | 739 | * @since 2.3 |
741 | 740 | * @param int $post_id Post ID |
742 | 741 | * @param string $name The cron name |
743 | - * @param boolean $scheduled If the item is being fired by a schedule (default, true), or retrieved for display (false) |
|
742 | + * @param boolean $is_scheduled If the item is being fired by a schedule (default, true), or retrieved for display (false) |
|
744 | 743 | * @return string The formatted link to the post |
745 | 744 | */ |
746 | 745 | function ppp_li_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
@@ -429,9 +429,12 @@ |
||
429 | 429 | |
430 | 430 | <?php endforeach; ?> |
431 | 431 | |
432 | - <?php else: ?> |
|
432 | + <?php else { |
|
433 | + : ?> |
|
433 | 434 | |
434 | - <?php ppp_render_li_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'desc' => '', 'image' => '', 'attachment_id' => '' ) ); ?> |
|
435 | + <?php ppp_render_li_share_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'desc' => '', 'image' => '', 'attachment_id' => '' ) ); |
|
436 | +} |
|
437 | +?> |
|
435 | 438 | |
436 | 439 | <?php endif; ?> |
437 | 440 | </tbody> |
@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ppp_linkedin_enabled() { |
13 | 13 | global $ppp_social_settings; |
14 | 14 | |
15 | - if ( isset( $ppp_social_settings['linkedin'] ) && !empty( $ppp_social_settings['linkedin'] ) ) { |
|
15 | + if (isset($ppp_social_settings['linkedin']) && ! empty($ppp_social_settings['linkedin'])) { |
|
16 | 16 | return true; |
17 | 17 | } |
18 | 18 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function ppp_li_account_list_name( $string = '' ) { |
62 | 62 | |
63 | - if ( ppp_linkedin_enabled() ) { |
|
63 | + if (ppp_linkedin_enabled()) { |
|
64 | 64 | global $ppp_social_settings; |
65 | - $string .= $ppp_social_settings['linkedin']->firstName . ' ' . $ppp_social_settings['linkedin']->lastName; |
|
66 | - $string .= '<br />' . $ppp_social_settings['linkedin']->headline; |
|
65 | + $string .= $ppp_social_settings['linkedin']->firstName.' '.$ppp_social_settings['linkedin']->lastName; |
|
66 | + $string .= '<br />'.$ppp_social_settings['linkedin']->headline; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $string; |
@@ -78,22 +78,22 @@ discard block |
||
78 | 78 | function ppp_li_account_list_actions( $string = '' ) { |
79 | 79 | global $ppp_linkedin_oauth, $ppp_social_settings; |
80 | 80 | |
81 | - if ( ! ppp_linkedin_enabled() ) { |
|
81 | + if ( ! ppp_linkedin_enabled()) { |
|
82 | 82 | $li_authurl = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
83 | 83 | |
84 | - $string .= '<a class="button-primary" href="' . $li_authurl . '">' . __( 'Connect to Linkedin', 'ppp-txt' ) . '</a>'; |
|
84 | + $string .= '<a class="button-primary" href="'.$li_authurl.'">'.__( 'Connect to Linkedin', 'ppp-txt' ).'</a>'; |
|
85 | 85 | } else { |
86 | - $string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=linkedin' ) . '" >' . __( 'Disconnect from Linkedin', 'ppp-txt' ) . '</a> '; |
|
86 | + $string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=linkedin' ).'" >'.__( 'Disconnect from Linkedin', 'ppp-txt' ).'</a> '; |
|
87 | 87 | |
88 | 88 | $refresh_date = (int) get_option( '_ppp_linkedin_refresh', true ); |
89 | 89 | |
90 | 90 | |
91 | - if ( defined( 'LINKEDIN_KEY' ) && current_time( 'timestamp' ) > $refresh_date ) { |
|
91 | + if (defined( 'LINKEDIN_KEY' ) && current_time( 'timestamp' ) > $refresh_date) { |
|
92 | 92 | $token = $ppp_social_settings['linkedin']->access_token; |
93 | 93 | $url = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
94 | - $refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); |
|
94 | + $refresh_url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); |
|
95 | 95 | |
96 | - $string .= '<a class="button-secondary" href="' . $refresh_url . '" >' . __( 'Re-Authorize Linkedin', 'ppp-txt' ) . '</a> '; |
|
96 | + $string .= '<a class="button-secondary" href="'.$refresh_url.'" >'.__( 'Re-Authorize Linkedin', 'ppp-txt' ).'</a> '; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | * @return string The HTML for the LinkedIn Extras column |
108 | 108 | */ |
109 | 109 | function ppp_li_account_list_extras( $string ) { |
110 | - if ( ppp_linkedin_enabled() ) { |
|
110 | + if (ppp_linkedin_enabled()) { |
|
111 | 111 | global $ppp_social_settings, $ppp_options; |
112 | - if ( ! empty( $ppp_options['enable_debug'] ) ) { |
|
113 | - $days_left = absint( round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
114 | - $refresh_in = absint( round( ( get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
112 | + if ( ! empty($ppp_options['enable_debug'])) { |
|
113 | + $days_left = absint( round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
114 | + $refresh_in = absint( round( (get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
115 | 115 | |
116 | - $string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left ); |
|
117 | - $string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
116 | + $string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left ); |
|
117 | + $string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | function ppp_capture_linkedin_oauth() { |
131 | 131 | $should_capture = false; |
132 | 132 | |
133 | - if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false ) { |
|
133 | + if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false) { |
|
134 | 134 | // Local config |
135 | 135 | $should_capture = true; |
136 | 136 | } |
137 | 137 | |
138 | - if ( isset( $_REQUEST['li_access_token'] ) ) { |
|
138 | + if (isset($_REQUEST['li_access_token'])) { |
|
139 | 139 | // Returning from remote config |
140 | 140 | $should_capture = true; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) { |
|
143 | + if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) { |
|
144 | 144 | global $ppp_linkedin_oauth; |
145 | 145 | $ppp_linkedin_oauth->ppp_initialize_linkedin(); |
146 | 146 | wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | function ppp_disconnect_linkedin() { |
157 | 157 | global $ppp_social_settings; |
158 | 158 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
159 | - if ( isset( $ppp_social_settings['linkedin'] ) ) { |
|
160 | - unset( $ppp_social_settings['linkedin'] ); |
|
159 | + if (isset($ppp_social_settings['linkedin'])) { |
|
160 | + unset($ppp_social_settings['linkedin']); |
|
161 | 161 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
162 | 162 | delete_option( '_ppp_linkedin_refresh' ); |
163 | 163 | } |
@@ -183,13 +183,13 @@ discard block |
||
183 | 183 | */ |
184 | 184 | function ppp_li_execute_refresh() { |
185 | 185 | |
186 | - if ( ! ppp_linkedin_enabled() ) { |
|
186 | + if ( ! ppp_linkedin_enabled()) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | 190 | $refresh_date = (int) get_option( '_ppp_linkedin_refresh', true ); |
191 | 191 | |
192 | - if ( ( empty( $_GET['page' ] ) || $_GET['page'] !== 'ppp-social-settings' ) && current_time( 'timestamp' ) > $refresh_date ) { |
|
192 | + if ((empty($_GET['page']) || $_GET['page'] !== 'ppp-social-settings') && current_time( 'timestamp' ) > $refresh_date) { |
|
193 | 193 | add_action( 'admin_notices', 'ppp_linkedin_refresh_notice' ); |
194 | 194 | } |
195 | 195 | } |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function ppp_linkedin_refresh_notice() { |
203 | 203 | |
204 | - if ( ! ppp_linkedin_enabled() ) { |
|
204 | + if ( ! ppp_linkedin_enabled()) { |
|
205 | 205 | return; |
206 | 206 | } |
207 | 207 | |
208 | - $has_dismissed = get_transient( 'ppp-dismiss-refresh-li' . get_current_user_id() ); |
|
209 | - if ( false !== $has_dismissed ) { |
|
208 | + $has_dismissed = get_transient( 'ppp-dismiss-refresh-li'.get_current_user_id() ); |
|
209 | + if (false !== $has_dismissed) { |
|
210 | 210 | return; |
211 | 211 | } |
212 | 212 | |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | |
218 | 218 | $token = $ppp_social_settings['linkedin']->access_token; |
219 | 219 | $url = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
220 | - $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); |
|
220 | + $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); |
|
221 | 221 | |
222 | - $days_left = (int) round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ); |
|
222 | + $days_left = (int) round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ); |
|
223 | 223 | ?> |
224 | 224 | <div class="notice notice-warning is-dismissible" data-service="li"> |
225 | - <?php if ( $days_left > 0 ): ?> |
|
225 | + <?php if ($days_left > 0): ?> |
|
226 | 226 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication expires in %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p> |
227 | - <?php elseif ( $days_left < 1 ): ?> |
|
227 | + <?php elseif ($days_left < 1): ?> |
|
228 | 228 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p> |
229 | 229 | <?php endif; ?> |
230 | 230 | </div> |
@@ -239,10 +239,10 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function ppp_li_dismiss_notice() { |
241 | 241 | |
242 | - $nag = sanitize_key( $_POST[ 'nag' ] ); |
|
242 | + $nag = sanitize_key( $_POST['nag'] ); |
|
243 | 243 | |
244 | - if ( $nag === $_POST[ 'nag' ] ) { |
|
245 | - set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS ); |
|
244 | + if ($nag === $_POST['nag']) { |
|
245 | + set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS ); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return void |
256 | 256 | */ |
257 | 257 | function ppp_set_li_token_constants( $social_tokens ) { |
258 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'linkedin' ) ) { |
|
258 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'linkedin' )) { |
|
259 | 259 | define( 'LINKEDIN_KEY', $social_tokens->linkedin->api_key ); |
260 | 260 | define( 'LINKEDIN_SECRET', $social_tokens->linkedin->secret_key ); |
261 | 261 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | function ppp_li_share( $title, $description, $link, $media ) { |
274 | 274 | global $ppp_linkedin_oauth; |
275 | - $args = array ( |
|
275 | + $args = array( |
|
276 | 276 | 'title' => ppp_entities_and_slashes( $title ), |
277 | 277 | 'description' => ppp_entities_and_slashes( $description ), |
278 | 278 | 'submitted-url' => $link, |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | function ppp_li_add_meta_tab( $tabs ) { |
315 | 315 | global $ppp_social_settings; |
316 | - if ( ! ppp_linkedin_enabled() ) { |
|
316 | + if ( ! ppp_linkedin_enabled()) { |
|
317 | 317 | return $tabs; |
318 | 318 | } |
319 | 319 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | function ppp_li_register_metabox_content( $content ) { |
332 | 332 | global $ppp_social_settings; |
333 | - if ( ! ppp_linkedin_enabled() ) { |
|
333 | + if ( ! ppp_linkedin_enabled()) { |
|
334 | 334 | return $content; |
335 | 335 | } |
336 | 336 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function ppp_li_add_metabox_content( $post ) { |
370 | 370 | global $ppp_options, $ppp_share_settings; |
371 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
371 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
372 | 372 | |
373 | 373 | $ppp_li_share_on_publish = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true ); |
374 | 374 | $ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true ); |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | |
379 | 379 | $show_share_on_publish = false; |
380 | 380 | |
381 | - $share_by_default = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['linkedin'] ) ? false : true; |
|
381 | + $share_by_default = empty($ppp_share_settings['share_on_publish'][$post->post_type]['linkedin']) ? false : true; |
|
382 | 382 | |
383 | - if ( $ppp_li_share_on_publish == '1' || ( $ppp_li_share_on_publish == '' && $share_by_default ) ) { |
|
383 | + if ($ppp_li_share_on_publish == '1' || ($ppp_li_share_on_publish == '' && $share_by_default)) { |
|
384 | 384 | $show_share_on_publish = true; |
385 | 385 | } |
386 | 386 | ?> |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | <div class="ppp-post-override-wrap"> |
389 | 389 | <p><h3><?php _e( 'Share on LinkedIn', 'ppp-txt' ); ?></h3></p> |
390 | 390 | <p> |
391 | - <?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?> |
|
391 | + <?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?> |
|
392 | 392 | <label for="ppp_li_share_on_publish"><?php _e( 'Share this post on LinkedIn…', 'ppp-txt' ); ?></label> |
393 | 393 | <select name="_ppp_li_share_on_publish" id="ppp_li_share_on_publish" class="ppp-toggle-share-on-publish"> |
394 | - <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
395 | - <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
394 | + <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
395 | + <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
396 | 396 | <option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option> |
397 | 397 | </select> |
398 | 398 | </p> |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | <th style="width: 10px;"></th> |
409 | 409 | </tr> |
410 | 410 | </thead> |
411 | - <tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
411 | + <tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
412 | 412 | <?php |
413 | 413 | $args = array( |
414 | 414 | 'text' => $ppp_share_on_publish_title, |
@@ -420,19 +420,19 @@ discard block |
||
420 | 420 | ppp_render_li_share_on_publish_row( $args ); |
421 | 421 | ?> |
422 | 422 | </tbody> |
423 | - <tbody id="li-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
423 | + <tbody id="li-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
424 | 424 | <?php $shares = get_post_meta( $post->ID, '_ppp_li_shares', true ); ?> |
425 | - <?php if ( ! empty( $shares ) ) : ?> |
|
425 | + <?php if ( ! empty($shares)) : ?> |
|
426 | 426 | |
427 | - <?php foreach ( $shares as $key => $value ) : |
|
428 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
429 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
430 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
431 | - $desc = isset( $value['desc'] ) ? $value['desc'] : ''; |
|
432 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
433 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
427 | + <?php foreach ($shares as $key => $value) : |
|
428 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
429 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
430 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
431 | + $desc = isset($value['desc']) ? $value['desc'] : ''; |
|
432 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
433 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
434 | 434 | |
435 | - $args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text', 'desc', 'image','attachment_id' ), $value ); |
|
435 | + $args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'desc', 'image', 'attachment_id' ), $value ); |
|
436 | 436 | ?> |
437 | 437 | |
438 | 438 | <?php ppp_render_li_share_row( $key, $args ); ?> |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | function ppp_render_li_share_on_publish_row( $args = array() ) { |
469 | 469 | global $post; |
470 | 470 | $readonly = $post->post_status !== 'publish' ? '' : 'readonly="readonly" '; |
471 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; |
|
471 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; |
|
472 | 472 | ?> |
473 | 473 | <tr class="ppp-li-wrapper ppp-repeatable-row on-publish-row"> |
474 | 474 | <td colspan="2" class="ppp-on-plublish-date-column"> |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | <tr> |
497 | 497 | <td colspan="2"></td> |
498 | 498 | <td colspan="3"> |
499 | - <textarea <?php if ( $disabled ): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc" placeholder="<?php _e( 'Link Description', 'ppp-txt' ); ?>"><?php echo esc_attr( $args['desc'] ); ?></textarea> |
|
499 | + <textarea <?php if ($disabled): ?>readonly<?php endif; ?> name="_ppp_li_share_on_publish_desc" placeholder="<?php _e( 'Link Description', 'ppp-txt' ); ?>"><?php echo esc_attr( $args['desc'] ); ?></textarea> |
|
500 | 500 | </td> |
501 | 501 | </tr> |
502 | 502 | <?php |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | |
517 | 517 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
518 | 518 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
519 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
520 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
519 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
520 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
521 | 521 | ?> |
522 | 522 | <tr class="ppp-li-wrapper ppp-repeatable-row ppp-repeatable-linkedin scheduled-row" data-key="<?php echo esc_attr( $key ); ?>"> |
523 | 523 | <td> |
@@ -568,26 +568,26 @@ discard block |
||
568 | 568 | */ |
569 | 569 | function ppp_li_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_li_share_on_publish = ( isset( $_REQUEST['_ppp_li_share_on_publish'] ) ) ? $_REQUEST['_ppp_li_share_on_publish'] : '-1'; |
|
576 | - $ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_li_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_title'] : ''; |
|
577 | - $ppp_share_on_publish_desc = ( isset( $_REQUEST['_ppp_li_share_on_publish_desc'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : ''; |
|
578 | - $ppp_share_on_publish_image_url = ( isset( $_REQUEST['_ppp_li_share_on_publish_image_url'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_image_url'] : ''; |
|
579 | - $ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_li_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : ''; |
|
575 | + $ppp_li_share_on_publish = (isset($_REQUEST['_ppp_li_share_on_publish'])) ? $_REQUEST['_ppp_li_share_on_publish'] : '-1'; |
|
576 | + $ppp_share_on_publish_title = (isset($_REQUEST['_ppp_li_share_on_publish_title'])) ? $_REQUEST['_ppp_li_share_on_publish_title'] : ''; |
|
577 | + $ppp_share_on_publish_desc = (isset($_REQUEST['_ppp_li_share_on_publish_desc'])) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : ''; |
|
578 | + $ppp_share_on_publish_image_url = (isset($_REQUEST['_ppp_li_share_on_publish_image_url'])) ? $_REQUEST['_ppp_li_share_on_publish_image_url'] : ''; |
|
579 | + $ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_li_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : ''; |
|
580 | 580 | |
581 | - update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish ); |
|
582 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title ); |
|
583 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_desc', $ppp_share_on_publish_desc ); |
|
584 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
581 | + update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish ); |
|
582 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title ); |
|
583 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_desc', $ppp_share_on_publish_desc ); |
|
584 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
585 | 585 | update_post_meta( $post_id, '_ppp_li_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id ); |
586 | 586 | |
587 | - $li_data = ( isset( $_REQUEST['_ppp_li_shares'] ) && empty( $ppp_li_share_on_publish ) ) ? $_REQUEST['_ppp_li_shares'] : array(); |
|
588 | - foreach ( $li_data as $index => $share ) { |
|
589 | - $li_data[ $index ]['text'] = sanitize_text_field( $share['text'] ); |
|
590 | - $li_data[ $index ]['desc'] = sanitize_text_field( $share['desc'] ); |
|
587 | + $li_data = (isset($_REQUEST['_ppp_li_shares']) && empty($ppp_li_share_on_publish)) ? $_REQUEST['_ppp_li_shares'] : array(); |
|
588 | + foreach ($li_data as $index => $share) { |
|
589 | + $li_data[$index]['text'] = sanitize_text_field( $share['text'] ); |
|
590 | + $li_data[$index]['desc'] = sanitize_text_field( $share['desc'] ); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | update_post_meta( $post_id, '_ppp_li_shares', $li_data ); |
@@ -603,10 +603,10 @@ discard block |
||
603 | 603 | */ |
604 | 604 | function ppp_li_share_on_publish( $new_status, $old_status, $post ) { |
605 | 605 | global $ppp_options; |
606 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_li_share_on_publish', true ); |
|
607 | - $from_post = isset( $_POST['_ppp_li_share_on_publish'] ) ? $_POST['_ppp_li_share_on_publish']: '0'; |
|
606 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_li_share_on_publish', true ); |
|
607 | + $from_post = isset($_POST['_ppp_li_share_on_publish']) ? $_POST['_ppp_li_share_on_publish'] : '0'; |
|
608 | 608 | |
609 | - if ( '1' != $from_meta && '1' != $from_post ) { |
|
609 | + if ('1' != $from_meta && '1' != $from_post) { |
|
610 | 610 | return; |
611 | 611 | } |
612 | 612 | |
@@ -619,30 +619,30 @@ discard block |
||
619 | 619 | $image_url = ''; |
620 | 620 | |
621 | 621 | // Determine if we're seeing the share on publish in meta or $_POST |
622 | - if ( $from_meta && ! $from_post ) { |
|
623 | - $title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title' , true ); |
|
624 | - $desc = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc' , true ); |
|
622 | + if ($from_meta && ! $from_post) { |
|
623 | + $title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true ); |
|
624 | + $desc = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc', true ); |
|
625 | 625 | $attachment_id = get_post_meta( $post->ID, '_ppp_li_share_on_publish_attachment_id', true ); |
626 | - $image_url = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url' , true ); |
|
626 | + $image_url = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url', true ); |
|
627 | 627 | } else { |
628 | - $title = isset( $_POST['_ppp_li_share_on_publish_title'] ) ? $_POST['_ppp_li_share_on_publish_title'] : ''; |
|
629 | - $desc = isset( $_POST['_ppp_li_share_on_publish_desc'] ) ? $_POST['_ppp_li_share_on_publish_desc'] : false; |
|
630 | - $attachment_id = isset( $_POST['_ppp_li_share_on_publish_attachment_id'] ) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0; |
|
631 | - $image_url = isset( $_POST['_ppp_li_share_on_publish_image_url'] ) ? $_POST['_ppp_li_share_on_publish_image_url'] : ''; |
|
628 | + $title = isset($_POST['_ppp_li_share_on_publish_title']) ? $_POST['_ppp_li_share_on_publish_title'] : ''; |
|
629 | + $desc = isset($_POST['_ppp_li_share_on_publish_desc']) ? $_POST['_ppp_li_share_on_publish_desc'] : false; |
|
630 | + $attachment_id = isset($_POST['_ppp_li_share_on_publish_attachment_id']) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0; |
|
631 | + $image_url = isset($_POST['_ppp_li_share_on_publish_image_url']) ? $_POST['_ppp_li_share_on_publish_image_url'] : ''; |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | $thumbnail = ''; |
635 | - if ( empty( $attachment_id ) && ! empty( $image_url ) ) { |
|
635 | + if (empty($attachment_id) && ! empty($image_url)) { |
|
636 | 636 | $thumbnail = $image_url; |
637 | 637 | } else { |
638 | 638 | $thumbnail = ppp_post_has_media( $post->ID, 'li', true, $attachment_id ); |
639 | 639 | } |
640 | 640 | |
641 | - $name = 'sharedate_0_' . $post->ID . '_li'; |
|
641 | + $name = 'sharedate_0_'.$post->ID.'_li'; |
|
642 | 642 | |
643 | - $default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
643 | + $default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
644 | 644 | // If an override was found, use it, otherwise try the default text content |
645 | - if ( empty( $title ) && empty( $default_title ) ) { |
|
645 | + if (empty($title) && empty($default_title)) { |
|
646 | 646 | $title = get_the_title( $post->ID ); |
647 | 647 | } |
648 | 648 | |
@@ -677,18 +677,18 @@ discard block |
||
677 | 677 | * @param string $name The name of the Cron |
678 | 678 | * @return void |
679 | 679 | */ |
680 | -function ppp_li_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
680 | +function ppp_li_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
681 | 681 | global $ppp_options; |
682 | 682 | |
683 | 683 | $link = ppp_generate_link( $post_id, $name ); |
684 | 684 | |
685 | 685 | $post_meta = get_post_meta( $post_id, '_ppp_li_shares', true ); |
686 | - $this_share = $post_meta[ $index ]; |
|
687 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; |
|
686 | + $this_share = $post_meta[$index]; |
|
687 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; |
|
688 | 688 | |
689 | 689 | $share_message = ppp_li_build_share_message( $post_id, $name ); |
690 | 690 | |
691 | - if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { |
|
691 | + if (empty($attachment_id) && ! empty($this_share['image'])) { |
|
692 | 692 | $media = $this_share['image']; |
693 | 693 | } else { |
694 | 694 | $use_media = ppp_li_use_media( $post_id, $index ); |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | * @return bool Whether or not this tweet should contain a media post |
726 | 726 | */ |
727 | 727 | function ppp_li_use_media( $post_id, $index ) { |
728 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
728 | + if (empty($post_id) || empty($index)) { |
|
729 | 729 | return false; |
730 | 730 | } |
731 | 731 | |
@@ -758,22 +758,22 @@ discard block |
||
758 | 758 | */ |
759 | 759 | function ppp_li_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
760 | 760 | global $ppp_options; |
761 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
761 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
762 | 762 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); |
763 | 763 | |
764 | - if ( ! empty( $li_shares ) ) { |
|
764 | + if ( ! empty($li_shares)) { |
|
765 | 765 | $name_array = explode( '_', $name ); |
766 | 766 | $index = $name_array[1]; |
767 | - if ( isset( $li_shares[ $index ] ) ) { |
|
768 | - $share_content = $li_shares[ $index ]['text']; |
|
767 | + if (isset($li_shares[$index])) { |
|
768 | + $share_content = $li_shares[$index]['text']; |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | 772 | // If an override was found, use it, otherwise try the default text content |
773 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
773 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
774 | 774 | |
775 | 775 | // If the content is still empty, just use the post title |
776 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
776 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
777 | 777 | |
778 | 778 | return apply_filters( 'ppp_share_content_li', $share_content, array( 'post_id' => $post_id ) ); |
779 | 779 | } |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | $description = ''; |
791 | 791 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); |
792 | 792 | |
793 | - if ( ! empty( $li_shares[ $index ] ) ) { |
|
794 | - $description = ! empty( $li_shares[ $index ]['desc'] ) ? $li_shares[ $index ]['desc'] : ''; |
|
793 | + if ( ! empty($li_shares[$index])) { |
|
794 | + $description = ! empty($li_shares[$index]['desc']) ? $li_shares[$index]['desc'] : ''; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | return $description; |
@@ -808,20 +808,20 @@ discard block |
||
808 | 808 | function ppp_li_generate_timestamps( $times, $post_id ) { |
809 | 809 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); |
810 | 810 | |
811 | - if ( empty( $li_shares ) ) { |
|
811 | + if (empty($li_shares)) { |
|
812 | 812 | $li_shares = array(); |
813 | 813 | } |
814 | 814 | |
815 | - foreach ( $li_shares as $key => $data ) { |
|
816 | - if ( ! array_filter( $data ) ) { |
|
815 | + foreach ($li_shares as $key => $data) { |
|
816 | + if ( ! array_filter( $data )) { |
|
817 | 817 | continue; |
818 | 818 | } |
819 | 819 | |
820 | 820 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
821 | 821 | |
822 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
823 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_li'; |
|
824 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_li'; |
|
822 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
823 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_li'; |
|
824 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_li'; |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | } |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | function ppp_li_calendar_on_publish_event( $events, $post_id ) { |
842 | 842 | $share_on_publish = get_post_meta( $post_id, '_ppp_li_share_on_publish', true ); |
843 | 843 | |
844 | - if ( ! empty( $share_on_publish ) ) { |
|
844 | + if ( ! empty($share_on_publish)) { |
|
845 | 845 | $share_text = get_post_meta( $post_id, '_ppp_li_share_on_publish_title', true ); |
846 | 846 | $events[] = array( |
847 | - 'id' => $post_id . '-share-on-publish', |
|
848 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_li_generate_share_content( $post_id, null, false ), |
|
849 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
850 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
851 | - 'className' => 'ppp-calendar-item-li cal-post-' . $post_id, |
|
847 | + 'id' => $post_id.'-share-on-publish', |
|
848 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_li_generate_share_content( $post_id, null, false ), |
|
849 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
850 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
851 | + 'className' => 'ppp-calendar-item-li cal-post-'.$post_id, |
|
852 | 852 | 'belongsTo' => $post_id, |
853 | 853 | ); |
854 | 854 | } |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | |
860 | 860 | function ppp_li_get_post_shares( $items, $post_id ) { |
861 | 861 | $shares = get_post_meta( $post_id, '_ppp_li_shares', true ); |
862 | - if ( empty( $shares ) ) { return $items; } |
|
862 | + if (empty($shares)) { return $items; } |
|
863 | 863 | |
864 | - foreach ( $shares as $key => $share ) { |
|
864 | + foreach ($shares as $key => $share) { |
|
865 | 865 | $items[] = array( 'id' => $key, 'service' => 'li' ); |
866 | 866 | } |
867 | 867 | return $items; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | /** |
322 | 322 | * Deactivates the license key |
323 | - * @return void |
|
323 | + * @return null|false |
|
324 | 324 | */ |
325 | 325 | public function deactivate_license() { |
326 | 326 | // listen for our activate button to be clicked |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | /** |
366 | 366 | * Activates the license key provided |
367 | - * @return void |
|
367 | + * @return null|false |
|
368 | 368 | */ |
369 | 369 | public function activate_license() { |
370 | 370 | // listen for our activate button to be clicked |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @since 2.3 |
436 | 436 | * @param array $log_types Array of log types |
437 | - * @return array |
|
437 | + * @return string[] |
|
438 | 438 | */ |
439 | 439 | public function register_log_type( $log_types ) { |
440 | 440 | $types[] = 'ppp_share'; |
@@ -16,9 +16,9 @@ discard block |
||
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,30 +27,30 @@ discard block |
||
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'; |
|
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 | 40 | |
41 | - if( ! class_exists( 'WP_Logging' ) ) { |
|
42 | - include PPP_PATH . '/includes/libs/class-wp-logging.php'; |
|
41 | + if ( ! class_exists( 'WP_Logging' )) { |
|
42 | + include PPP_PATH.'/includes/libs/class-wp-logging.php'; |
|
43 | 43 | } |
44 | 44 | |
45 | - if ( is_admin() ) { |
|
46 | - include PPP_PATH . '/includes/admin/upgrades.php'; |
|
47 | - include PPP_PATH . '/includes/admin/do-upgrades.php'; |
|
48 | - include PPP_PATH . '/includes/admin/actions.php'; |
|
49 | - include PPP_PATH . '/includes/admin/admin-pages.php'; |
|
50 | - include PPP_PATH . '/includes/admin/admin-ajax.php'; |
|
51 | - include PPP_PATH . '/includes/admin/meta-boxes.php'; |
|
52 | - include PPP_PATH . '/includes/admin/welcome.php'; |
|
53 | - include PPP_PATH . '/includes/admin/dashboard.php'; |
|
45 | + if (is_admin()) { |
|
46 | + include PPP_PATH.'/includes/admin/upgrades.php'; |
|
47 | + include PPP_PATH.'/includes/admin/do-upgrades.php'; |
|
48 | + include PPP_PATH.'/includes/admin/actions.php'; |
|
49 | + include PPP_PATH.'/includes/admin/admin-pages.php'; |
|
50 | + include PPP_PATH.'/includes/admin/admin-ajax.php'; |
|
51 | + include PPP_PATH.'/includes/admin/meta-boxes.php'; |
|
52 | + include PPP_PATH.'/includes/admin/welcome.php'; |
|
53 | + include PPP_PATH.'/includes/admin/dashboard.php'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $ppp_options = get_option( 'ppp_options' ); |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | $ppp_share_settings = get_option( 'ppp_share_settings' ); |
59 | 59 | |
60 | 60 | // Do some leg work on the social settings for Issue #257 |
61 | - if ( is_array( $ppp_share_settings ) && ! array_key_exists( 'share_on_publish', $ppp_share_settings ) ) { |
|
62 | - $tw_share_on_publish = ! empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? true : false; |
|
63 | - $fb_share_on_publish = ! empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? true : false; |
|
64 | - $li_share_on_publish = ! empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? true : false; |
|
61 | + if (is_array( $ppp_share_settings ) && ! array_key_exists( 'share_on_publish', $ppp_share_settings )) { |
|
62 | + $tw_share_on_publish = ! empty($ppp_share_settings['twitter']['share_on_publish']) ? true : false; |
|
63 | + $fb_share_on_publish = ! empty($ppp_share_settings['facebook']['share_on_publish']) ? true : false; |
|
64 | + $li_share_on_publish = ! empty($ppp_share_settings['linkedin']['share_on_publish']) ? true : false; |
|
65 | 65 | |
66 | 66 | unset( |
67 | 67 | $ppp_share_settings['twitter']['share_on_publish'], |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | $post_types = ppp_supported_post_types(); |
73 | - foreach ( $post_types as $key => $post_type ) { |
|
74 | - $ppp_share_settings['share_on_publish'][ $key ]['twitter'] = $tw_share_on_publish; |
|
75 | - $ppp_share_settings['share_on_publish'][ $key ]['facebook'] = $fb_share_on_publish; |
|
76 | - $ppp_share_settings['share_on_publish'][ $key ]['linkedin'] = $li_share_on_publish; |
|
73 | + foreach ($post_types as $key => $post_type) { |
|
74 | + $ppp_share_settings['share_on_publish'][$key]['twitter'] = $tw_share_on_publish; |
|
75 | + $ppp_share_settings['share_on_publish'][$key]['facebook'] = $fb_share_on_publish; |
|
76 | + $ppp_share_settings['share_on_publish'][$key]['linkedin'] = $li_share_on_publish; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | update_option( 'ppp_share_settings', $ppp_share_settings ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @access public |
91 | 91 | */ |
92 | 92 | public static function getInstance() { |
93 | - if ( !self::$ppp_instance ) { |
|
93 | + if ( ! self::$ppp_instance) { |
|
94 | 94 | self::$ppp_instance = new PostPromoterPro(); |
95 | 95 | } |
96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
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 | |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | add_action( 'admin_enqueue_scripts', array( $this, 'load_styles' ), 99999 ); |
126 | 126 | add_action( 'wp_trash_post', 'ppp_remove_scheduled_shares', 10, 1 ); |
127 | 127 | |
128 | - if ( ppp_is_dev_or_staging() ) { |
|
128 | + if (ppp_is_dev_or_staging()) { |
|
129 | 129 | add_action( 'admin_notices', array( $this, 'local_site_nag' ) ); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | 133 | add_action( 'init', array( $this, 'get_actions' ) ); |
134 | - add_action( 'wp_insert_post', 'ppp_schedule_share', 99, 2); |
|
135 | - add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3); |
|
134 | + add_action( 'wp_insert_post', 'ppp_schedule_share', 99, 2 ); |
|
135 | + add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 ); |
|
136 | 136 | add_action( 'init', 'ppp_add_image_sizes' ); |
137 | 137 | add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 ); |
138 | 138 | } |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | |
158 | 158 | $allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook ); |
159 | 159 | |
160 | - if ( ! in_array( $hook, $allowed_pages ) ) { |
|
160 | + if ( ! in_array( $hook, $allowed_pages )) { |
|
161 | 161 | return; |
162 | 162 | } |
163 | 163 | |
164 | 164 | wp_enqueue_script( 'jquery-ui-core' ); |
165 | 165 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
166 | 166 | |
167 | - $jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
168 | - wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
167 | + $jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
168 | + wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
169 | 169 | wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true ); |
170 | 170 | |
171 | 171 | } |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | |
177 | 177 | // List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only |
178 | 178 | // load ours if they don't exist |
179 | - if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) { |
|
179 | + if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) { |
|
180 | 180 | wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' ); |
181 | 181 | } |
182 | 182 | |
183 | - wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
183 | + wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
184 | 184 | wp_enqueue_style( 'ppp_admin_css' ); |
185 | 185 | |
186 | 186 | $sources = array_map( 'basename', (array) wp_list_pluck( $wp_styles->registered, 'src' ) ); |
187 | - if ( ! in_array( 'font-awesome.css', $sources ) || in_array( 'font-awesome.min.css', $sources ) ) { |
|
187 | + if ( ! in_array( 'font-awesome.css', $sources ) || in_array( 'font-awesome.min.css', $sources )) { |
|
188 | 188 | wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', false, null ); |
189 | 189 | wp_enqueue_style( 'font-awesome' ); |
190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @access public |
200 | 200 | */ |
201 | 201 | public function plugin_settings_links( $links, $file ) { |
202 | - if ( $file != PPP_FILE ) { |
|
202 | + if ($file != PPP_FILE) { |
|
203 | 203 | return $links; |
204 | 204 | } |
205 | 205 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @access public |
294 | 294 | */ |
295 | 295 | public function ppp_loaddomain() { |
296 | - load_plugin_textdomain( 'ppp-txt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
296 | + load_plugin_textdomain( 'ppp-txt', false, dirname( plugin_basename( __FILE__ ) ).'/languages/' ); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -302,24 +302,24 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public function plugin_updater() { |
304 | 304 | global $ppp_options; |
305 | - if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) { |
|
305 | + if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) { |
|
306 | 306 | return; |
307 | 307 | } |
308 | 308 | |
309 | 309 | $license_key = trim( get_option( '_ppp_license_key' ) ); |
310 | 310 | |
311 | - if ( empty( $license_key ) ) { |
|
311 | + if (empty($license_key)) { |
|
312 | 312 | add_action( 'admin_notices', array( $this, 'no_license_nag' ) ); |
313 | 313 | return; |
314 | 314 | } |
315 | 315 | |
316 | 316 | // setup the updater |
317 | 317 | $edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array( |
318 | - 'version' => PPP_VERSION, // current version number |
|
319 | - 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
320 | - 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
321 | - 'author' => 'Post Promoter Pro', // author of this plugin |
|
322 | - 'beta' => ! empty( $ppp_options['enable_betas'] ) ? true : false, // If we should install beta versions |
|
318 | + 'version' => PPP_VERSION, // current version number |
|
319 | + 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
320 | + 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
321 | + 'author' => 'Post Promoter Pro', // author of this plugin |
|
322 | + 'beta' => ! empty($ppp_options['enable_betas']) ? true : false, // If we should install beta versions |
|
323 | 323 | ) |
324 | 324 | ); |
325 | 325 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | public function local_site_nag() { |
350 | 350 | $dismissed = get_option( 'ppp_local_url_notice_dismissed' ); |
351 | - if ( ! empty( $dismissed ) ) { |
|
351 | + if ( ! empty($dismissed)) { |
|
352 | 352 | return; |
353 | 353 | } |
354 | 354 | ?> |
@@ -385,10 +385,10 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function deactivate_license() { |
387 | 387 | // listen for our activate button to be clicked |
388 | - if( isset( $_POST['ppp_license_deactivate'] ) ) { |
|
388 | + if (isset($_POST['ppp_license_deactivate'])) { |
|
389 | 389 | |
390 | 390 | // run a quick security check |
391 | - if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) { |
|
391 | + if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | // get out if we didn't click the Activate button |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
409 | 409 | |
410 | 410 | // make sure the response came back okay |
411 | - if ( is_wp_error( $response ) ) { |
|
411 | + if (is_wp_error( $response )) { |
|
412 | 412 | return false; |
413 | 413 | } |
414 | 414 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
417 | 417 | |
418 | 418 | // $license_data->license will be either "deactivated" or "failed" |
419 | - if( $license_data->license == 'deactivated' ) { |
|
419 | + if ($license_data->license == 'deactivated') { |
|
420 | 420 | delete_option( '_ppp_license_key_status' ); |
421 | 421 | } |
422 | 422 | |
@@ -429,10 +429,10 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function activate_license() { |
431 | 431 | // listen for our activate button to be clicked |
432 | - if( isset( $_POST['ppp_license_activate'] ) ) { |
|
432 | + if (isset($_POST['ppp_license_activate'])) { |
|
433 | 433 | |
434 | 434 | // run a quick security check |
435 | - if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) { |
|
435 | + if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) { |
|
436 | 436 | return; |
437 | 437 | } |
438 | 438 | // get out if we didn't click the Activate button |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
453 | 453 | |
454 | 454 | // make sure the response came back okay |
455 | - if ( is_wp_error( $response ) ) { |
|
455 | + if (is_wp_error( $response )) { |
|
456 | 456 | return false; |
457 | 457 | } |
458 | 458 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | public function ppp_sanitize_license( $new ) { |
475 | 475 | $old = get_option( '_ppp_license_key' ); |
476 | - if( $old && $old != $new ) { |
|
476 | + if ($old && $old != $new) { |
|
477 | 477 | delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate |
478 | 478 | } |
479 | 479 | return $new; |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | public function get_actions() { |
488 | - if ( isset( $_GET['ppp_action'] ) ) { |
|
489 | - do_action( 'ppp_' . $_GET['ppp_action'], $_GET ); |
|
488 | + if (isset($_GET['ppp_action'])) { |
|
489 | + do_action( 'ppp_'.$_GET['ppp_action'], $_GET ); |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | function post_promoter_pro_activation_setup() { |
522 | 522 | // If the settings already exist, don't do this |
523 | - if ( get_option( 'ppp_options' ) ) { |
|
523 | + if (get_option( 'ppp_options' )) { |
|
524 | 524 | return; |
525 | 525 | } |
526 | 526 |
@@ -177,8 +177,11 @@ |
||
177 | 177 | <?php $post = wp_get_recent_posts( array( 'numberposts' => 1 ) ); ?> |
178 | 178 | <?php if ( count( $post ) > 0 ) : ?> |
179 | 179 | <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false ); ?></code></small> |
180 | - <?php else : ?> |
|
181 | - <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); ?></em> |
|
180 | + <?php else { |
|
181 | + : ?> |
|
182 | + <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); |
|
183 | +} |
|
184 | +?></em> |
|
182 | 185 | <?php endif; ?> |
183 | 186 | </p> |
184 | 187 | </td> |
@@ -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 | |
@@ -27,18 +27,18 @@ discard block |
||
27 | 27 | <?php _e( 'License Key', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Enter your license key', 'ppp-txt' ); ?></span> |
28 | 28 | </th> |
29 | 29 | <td> |
30 | - <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if ( $status !== false && $status == 'valid' ) { ?> |
|
30 | + <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if ($status !== false && $status == 'valid') { ?> |
|
31 | 31 | <span style="color:green;"> <?php _e( 'active', 'ppp-txt' ); ?></span><?php } ?> |
32 | 32 | </td> |
33 | 33 | </tr> |
34 | 34 | |
35 | - <?php if ( false !== $license ) { ?> |
|
35 | + <?php if (false !== $license) { ?> |
|
36 | 36 | <tr valign="top"> |
37 | 37 | <th scope="row" valign="top"> |
38 | 38 | <?php _e( 'Activate License', 'ppp-txt' ); ?> |
39 | 39 | </th> |
40 | 40 | <td> |
41 | - <?php if ( $status !== false && $status == 'valid' ) { ?> |
|
41 | + <?php if ($status !== false && $status == 'valid') { ?> |
|
42 | 42 | <?php wp_nonce_field( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ); ?> |
43 | 43 | <input type="submit" class="button-secondary" name="ppp_license_deactivate" value="<?php _e( 'Deactivate License', 'ppp-txt' ); ?>"/> |
44 | 44 | <?php } else { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <span style="font-size: x-small;"><a href="#" onclick="jQuery('#ppp-text-helper').toggle(); return false;"><?php _e( 'Default Text Tips', 'ppp-txt' ); ?></a></span> |
55 | 55 | </th> |
56 | 56 | <td> |
57 | - <?php $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; ?> |
|
57 | + <?php $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; ?> |
|
58 | 58 | <input type="text" class="regular-text" name="ppp_options[default_text]" value="<?php echo $default_text; ?>" placeholder="Post Title will be used if empty" size="50" /> |
59 | 59 | <p id="ppp-text-helper" style="display: none"> |
60 | 60 | <small> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | <br /> |
65 | 65 | <?php _e( 'Possible Replacements:', 'ppp-txt' ); ?> |
66 | 66 | <br /> |
67 | - <?php foreach ( ppp_get_text_tokens() as $token ) : ?> |
|
67 | + <?php foreach (ppp_get_text_tokens() as $token) : ?> |
|
68 | 68 | <code>{<?php echo $token['token']; ?>}</code> - <?php echo $token['description']; ?><br /> |
69 | 69 | <?php endforeach; ?> |
70 | 70 | </small> |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | <th scope="row"><?php _e( 'Post Types', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'What post types do you want to schedule for?', 'ppp-txt' ); ?></span></th> |
77 | 77 | <td> |
78 | 78 | <?php $post_types = ppp_supported_post_types(); ?> |
79 | - <?php foreach ( $post_types as $post_type => $type_data ) : ?> |
|
80 | - <?php $value = ( isset( $ppp_options['post_types'] ) && isset( $ppp_options['post_types'][ $post_type ] ) ) ? true : false; ?> |
|
79 | + <?php foreach ($post_types as $post_type => $type_data) : ?> |
|
80 | + <?php $value = (isset($ppp_options['post_types']) && isset($ppp_options['post_types'][$post_type])) ? true : false; ?> |
|
81 | 81 | <input type="checkbox" name="ppp_options[post_types][<?php echo $post_type; ?>]" value="1" id="<?php echo $post_type; ?>" <?php checked( true, $value, true ); ?> /> |
82 | 82 | <label for="<?php echo $post_type; ?>"><?php echo $type_data->labels->name; ?></label></br /> |
83 | 83 | <?php endforeach; ?> |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | <th scope="row"><?php _e( 'Advanced', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Tools for troubleshooting and advanced usage', 'ppp-txt' ); ?></span></th> |
89 | 89 | <td> |
90 | 90 | <p> |
91 | - <?php $debug_enabled = isset( $ppp_options['enable_debug'] ) ? true : false; ?> |
|
91 | + <?php $debug_enabled = isset($ppp_options['enable_debug']) ? true : false; ?> |
|
92 | 92 | <input type="checkbox" name="ppp_options[enable_debug]" <?php checked( true, $debug_enabled, true ); ?> value="1" /> <?php _e( 'Enable Debug', 'ppp-txt' ); ?> |
93 | 93 | </p> |
94 | 94 | <p> |
95 | - <?php $betas_enabled = isset( $ppp_options['enable_betas'] ) ? true : false; ?> |
|
95 | + <?php $betas_enabled = isset($ppp_options['enable_betas']) ? true : false; ?> |
|
96 | 96 | <input type="checkbox" name="ppp_options[enable_betas]" <?php checked( true, $betas_enabled, true ); ?> value="1" /> <?php _e( 'Enable Beta Versions', 'ppp-txt' ); ?> |
97 | 97 | </p> |
98 | 98 | <p> |
99 | - <?php $delete_on_uninstall = isset( $ppp_options['delete_on_uninstall'] ) ? true : false; ?> |
|
99 | + <?php $delete_on_uninstall = isset($ppp_options['delete_on_uninstall']) ? true : false; ?> |
|
100 | 100 | <input type="checkbox" name="ppp_options[delete_on_uninstall]" <?php checked( true, $delete_on_uninstall, true ); ?> value="1" /> <?php _e( 'Delete All Data On Uninstall', 'ppp-txt' ); ?> |
101 | 101 | </p> |
102 | 102 | </td> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | <?php wp_nonce_field( 'ppp-share-settings' ); ?> |
133 | 133 | <h3><?php _e( 'Social Media Accounts', 'ppp-txt' ); ?></h3> |
134 | 134 | <?php |
135 | - require_once PPP_PATH . 'includes/admin/class-accounts-table.php'; |
|
135 | + require_once PPP_PATH.'includes/admin/class-accounts-table.php'; |
|
136 | 136 | |
137 | 137 | $accounts_table = new PPP_Accounts_Table(); |
138 | 138 | $accounts_table->prepare_items(); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $accounts_table->display(); |
141 | 141 | ?> |
142 | 142 | <table class="form-table"> |
143 | - <?php $analytics_option = isset( $ppp_share_settings['analytics'] ) ? $ppp_share_settings['analytics'] : 0; ?> |
|
143 | + <?php $analytics_option = isset($ppp_share_settings['analytics']) ? $ppp_share_settings['analytics'] : 0; ?> |
|
144 | 144 | <tr valign="top"> |
145 | 145 | <th scope="row" valign="top"> |
146 | 146 | <?php _e( 'Analytics', 'ppp-txt' ); ?></span> |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | <hr /> |
168 | 168 | <small><?php _e( 'Here is an example of what your link will look like', 'ppp-txt' ); ?>: <br /> |
169 | 169 | <?php $post = wp_get_recent_posts( array( 'numberposts' => 1 ) ); ?> |
170 | - <?php if ( count( $post ) > 0 ) : ?> |
|
171 | - <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false ); ?></code></small> |
|
170 | + <?php if (count( $post ) > 0) : ?> |
|
171 | + <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_'.$post[0]['ID'], false ); ?></code></small> |
|
172 | 172 | <?php else : ?> |
173 | 173 | <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); ?></em> |
174 | 174 | <?php endif; ?> |
@@ -183,34 +183,34 @@ discard block |
||
183 | 183 | </th> |
184 | 184 | <td id="ppp-share-on-publish-wrapper"> |
185 | 185 | <?php $supported_post_types = ppp_supported_post_types(); ?> |
186 | - <?php foreach ( $supported_post_types as $post_type => $post_type_details ) : ?> |
|
187 | - <?php if ( ppp_twitter_enabled() || ppp_facebook_enabled() || ppp_linkedin_enabled() ) : ?> |
|
186 | + <?php foreach ($supported_post_types as $post_type => $post_type_details) : ?> |
|
187 | + <?php if (ppp_twitter_enabled() || ppp_facebook_enabled() || ppp_linkedin_enabled()) : ?> |
|
188 | 188 | <?php |
189 | - $enabled_post_types = ppp_allowed_post_types(); |
|
190 | - if ( ! in_array( $post_type, $enabled_post_types ) ) { |
|
189 | + $enabled_post_types = ppp_allowed_post_types(); |
|
190 | + if ( ! in_array( $post_type, $enabled_post_types )) { |
|
191 | 191 | continue; |
192 | 192 | } |
193 | 193 | ?> |
194 | - <strong><?php echo $supported_post_types[ $post_type ]->label; ?></strong> |
|
194 | + <strong><?php echo $supported_post_types[$post_type]->label; ?></strong> |
|
195 | 195 | <?php endif; ?> |
196 | - <?php $post_type_settings = ! empty( $ppp_share_settings['share_on_publish'][ $post_type ] ) ? $ppp_share_settings['share_on_publish'][ $post_type ] : array(); ?> |
|
197 | - <?php if ( ppp_twitter_enabled() ) : ?> |
|
196 | + <?php $post_type_settings = ! empty($ppp_share_settings['share_on_publish'][$post_type]) ? $ppp_share_settings['share_on_publish'][$post_type] : array(); ?> |
|
197 | + <?php if (ppp_twitter_enabled()) : ?> |
|
198 | 198 | <p> |
199 | - <input type="checkbox" id="<?php echo $post_type; ?>-twitter-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['twitter'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][twitter]" /> |
|
199 | + <input type="checkbox" id="<?php echo $post_type; ?>-twitter-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['twitter']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][twitter]" /> |
|
200 | 200 | <label for="<?php echo $post_type; ?>-twitter-share-on-publish"><?php _e( 'Twitter', 'ppp-txt' ); ?></label> |
201 | 201 | </p> |
202 | 202 | <?php endif; ?> |
203 | 203 | |
204 | - <?php if ( ppp_facebook_enabled() ) : ?> |
|
204 | + <?php if (ppp_facebook_enabled()) : ?> |
|
205 | 205 | <p> |
206 | - <input type="checkbox" id="<?php echo $post_type; ?>-facebook-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['facebook'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][facebook]" /> |
|
206 | + <input type="checkbox" id="<?php echo $post_type; ?>-facebook-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['facebook']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][facebook]" /> |
|
207 | 207 | <label for="<?php echo $post_type; ?>-facebook-share-on-publish"><?php _e( 'Facebook', 'ppp-txt' ); ?></label> |
208 | 208 | </p> |
209 | 209 | <?php endif; ?> |
210 | 210 | |
211 | - <?php if ( ppp_linkedin_enabled() ) : ?> |
|
211 | + <?php if (ppp_linkedin_enabled()) : ?> |
|
212 | 212 | <p> |
213 | - <input type="checkbox" id="<?php echo $post_type; ?>-linkedin-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['linkedin'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][linkedin]" /> |
|
213 | + <input type="checkbox" id="<?php echo $post_type; ?>-linkedin-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['linkedin']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][linkedin]" /> |
|
214 | 214 | <label for="<?php echo $post_type; ?>-linkedin-share-on-publish"><?php _e( 'LinkedIn', 'ppp-txt' ); ?></label> |
215 | 215 | </p> |
216 | 216 | <?php endif; ?> |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | </tr> |
234 | 234 | |
235 | 235 | <?php |
236 | - $shortener = isset( $ppp_share_settings['shortener'] ) ? $ppp_share_settings['shortener'] : false; |
|
236 | + $shortener = isset($ppp_share_settings['shortener']) ? $ppp_share_settings['shortener'] : false; |
|
237 | 237 | ?> |
238 | 238 | <tr valign="top"> |
239 | 239 | <th scope="row" valign="top"> |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | <?php do_action( 'ppp_url_shorteners', $shortener ); ?> |
247 | 247 | </select> |
248 | 248 | </p> |
249 | - <?php if ( $shortener ) : ?> |
|
250 | - <?php do_action( 'ppp_shortener_settings-' . $shortener ); ?> |
|
249 | + <?php if ($shortener) : ?> |
|
250 | + <?php do_action( 'ppp_shortener_settings-'.$shortener ); ?> |
|
251 | 251 | <?php endif; ?> |
252 | 252 | </td> |
253 | 253 | </tr> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | .wp-list-table .column-content { width: 50%; } |
282 | 282 | </style> |
283 | 283 | <?php |
284 | - require_once PPP_PATH . 'includes/admin/class-schedule-table.php'; |
|
284 | + require_once PPP_PATH.'includes/admin/class-schedule-table.php'; |
|
285 | 285 | $schedule_table = new PPP_Schedule_Table(); |
286 | 286 | $schedule_table->prepare_items(); |
287 | 287 | ?> |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - Scheduled Shares', 'ppp-txt' ); ?></h1> |
290 | 290 | <?php $schedule_table->display() ?> |
291 | 291 | </div> |
292 | - <?php if ( ppp_is_shortener_enabled() ) : ?> |
|
292 | + <?php if (ppp_is_shortener_enabled()) : ?> |
|
293 | 293 | <p> |
294 | 294 | <small><?php _e( 'NOTICE: Schedule view does not show shortened links, they will be shortened at the time of sharing', 'ppp-txt' ); ?></small> |
295 | 295 | </p> |
@@ -308,24 +308,24 @@ discard block |
||
308 | 308 | <div class="wrap"> |
309 | 309 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - System Info', 'ppp-txt' ); ?></h1> |
310 | 310 | <textarea style="font-family: Menlo, Monaco, monospace; white-space: pre" onclick="this.focus();this.select()" readonly cols="150" rows="35"> |
311 | - SITE_URL: <?php echo site_url() . "\n"; ?> |
|
312 | - HOME_URL: <?php echo home_url() . "\n"; ?> |
|
311 | + SITE_URL: <?php echo site_url()."\n"; ?> |
|
312 | + HOME_URL: <?php echo home_url()."\n"; ?> |
|
313 | 313 | |
314 | - PPP Version: <?php echo PPP_VERSION . "\n"; ?> |
|
315 | - WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
|
314 | + PPP Version: <?php echo PPP_VERSION."\n"; ?> |
|
315 | + WordPress Version: <?php echo get_bloginfo( 'version' )."\n"; ?> |
|
316 | 316 | |
317 | 317 | PPP SETTINGS: |
318 | 318 | <?php |
319 | - foreach ( $ppp_options as $name => $value ) { |
|
320 | - if ( $value == false ) { |
|
319 | + foreach ($ppp_options as $name => $value) { |
|
320 | + if ($value == false) { |
|
321 | 321 | $value = 'false'; |
322 | 322 | } |
323 | 323 | |
324 | - if ( $value == '1' ) { |
|
324 | + if ($value == '1') { |
|
325 | 325 | $value = 'true'; |
326 | 326 | } |
327 | 327 | |
328 | - echo $name . ': ' . maybe_serialize( $value ) . "\n\t"; |
|
328 | + echo $name.': '.maybe_serialize( $value )."\n\t"; |
|
329 | 329 | } |
330 | 330 | ?> |
331 | 331 | |
@@ -334,65 +334,65 @@ discard block |
||
334 | 334 | $plugins = get_plugins(); |
335 | 335 | $active_plugins = get_option( 'active_plugins', array() ); |
336 | 336 | |
337 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
337 | + foreach ($plugins as $plugin_path => $plugin) { |
|
338 | 338 | // If the plugin isn't active, don't show it. |
339 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
339 | + if ( ! in_array( $plugin_path, $active_plugins )) { |
|
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n\t"; |
|
343 | + echo $plugin['Name']; ?>: <?php echo $plugin['Version']."\n\t"; |
|
344 | 344 | |
345 | 345 | } |
346 | 346 | ?> |
347 | 347 | |
348 | 348 | CURRENT THEME: |
349 | 349 | <?php |
350 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
351 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
352 | - echo $theme_data['Name'] . ': ' . $theme_data['Version']; |
|
350 | + if (get_bloginfo( 'version' ) < '3.4') { |
|
351 | + $theme_data = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
352 | + echo $theme_data['Name'].': '.$theme_data['Version']; |
|
353 | 353 | } else { |
354 | 354 | $theme_data = wp_get_theme(); |
355 | - echo $theme_data->Name . ': ' . $theme_data->Version; |
|
355 | + echo $theme_data->Name.': '.$theme_data->Version; |
|
356 | 356 | } |
357 | 357 | ?> |
358 | 358 | |
359 | 359 | |
360 | - Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
|
360 | + Multi-site: <?php echo is_multisite() ? 'Yes'."\n" : 'No'."\n" ?> |
|
361 | 361 | |
362 | 362 | ADVANCED INFO: |
363 | - PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
|
364 | - MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
|
365 | - Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
|
363 | + PHP Version: <?php echo PHP_VERSION."\n"; ?> |
|
364 | + MySQL Version: <?php echo $wpdb->db_version()."\n"; ?> |
|
365 | + Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE']."\n"; ?> |
|
366 | 366 | |
367 | - PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
|
368 | - PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
|
369 | - PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
|
367 | + PHP Memory Limit: <?php echo ini_get( 'memory_limit' )."\n"; ?> |
|
368 | + PHP Post Max Size: <?php echo ini_get( 'post_max_size' )."\n"; ?> |
|
369 | + PHP Time Limit: <?php echo ini_get( 'max_execution_time' )."\n"; ?> |
|
370 | 370 | |
371 | - WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
372 | - SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
371 | + WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
372 | + SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
373 | 373 | |
374 | - WP Table Prefix: <?php echo 'Length: '. strlen( $wpdb->prefix ); |
|
374 | + WP Table Prefix: <?php echo 'Length: '.strlen( $wpdb->prefix ); |
|
375 | 375 | echo ' Status:'; |
376 | - if ( strlen( $wpdb->prefix ) > 16 ) {echo ' ERROR: Too Long'; |
|
376 | + if (strlen( $wpdb->prefix ) > 16) {echo ' ERROR: Too Long'; |
|
377 | 377 | } else { echo ' Acceptable'; |
378 | 378 | } echo "\n"; ?> |
379 | 379 | |
380 | - Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?> |
|
381 | - Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
382 | - Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
380 | + Show On Front: <?php echo get_option( 'show_on_front' )."\n" ?> |
|
381 | + Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
382 | + Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
383 | 383 | |
384 | - Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
384 | + Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
385 | 385 | Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
386 | 386 | Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
387 | 387 | Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
388 | 388 | Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
389 | 389 | Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
390 | 390 | |
391 | - UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) { echo ini_get( 'upload_max_filesize' ); } ?><?php echo "\n"; ?> |
|
392 | - POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) { echo ini_get( 'post_max_size' ); } ?><?php echo "\n"; ?> |
|
391 | + UPLOAD_MAX_FILESIZE: <?php if (function_exists( 'phpversion' )) { echo ini_get( 'upload_max_filesize' ); } ?><?php echo "\n"; ?> |
|
392 | + POST_MAX_SIZE: <?php if (function_exists( 'phpversion' )) { echo ini_get( 'post_max_size' ); } ?><?php echo "\n"; ?> |
|
393 | 393 | WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
394 | - DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
|
395 | - FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
394 | + DISPLAY ERRORS: <?php echo (ini_get( 'display_errors' )) ? 'On ('.ini_get( 'display_errors' ).')' : 'N/A'; ?><?php echo "\n"; ?> |
|
395 | + FSOCKOPEN: <?php echo (function_exists( 'fsockopen' )) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
396 | 396 | </textarea> |
397 | 397 | </div> |
398 | 398 | <?php |
@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function ppp_bitly_enabled() { |
13 | 13 | global $ppp_social_settings; |
14 | 14 | |
15 | - if ( isset( $ppp_social_settings['bitly'] ) && !empty( $ppp_social_settings['bitly'] ) ) { |
|
15 | + if (isset($ppp_social_settings['bitly']) && ! empty($ppp_social_settings['bitly'])) { |
|
16 | 16 | return true; |
17 | 17 | } |
18 | 18 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | global $ppp_bitly_oauth, $ppp_social_settings; |
38 | 38 | ?> |
39 | 39 | <p> |
40 | - <?php if ( !ppp_bitly_enabled() ) : ?> |
|
40 | + <?php if ( ! ppp_bitly_enabled()) : ?> |
|
41 | 41 | <form autocomplete="off"> |
42 | 42 | <input id="bitly-username" name="ppp-bitly-username" autocomplete="off" type="text" value="" placeholder="Bit.ly Username" size="25" /><br /> |
43 | 43 | <input id="bitly-password" name="ppp-bitly-password" autocomplete="off" type="password" value="" placeholder="Bit.ly Password" size="25" /><br /> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <input type="hidden" id="bitly-redirect-url" value="<?php echo admin_url( 'admin.php?page=ppp-social-settings' ); ?>" /> |
49 | 49 | </form> |
50 | 50 | <?php endif; ?> |
51 | - <?php if ( ppp_bitly_enabled() ) : ?> |
|
51 | + <?php if (ppp_bitly_enabled()) : ?> |
|
52 | 52 | <div class="ppp-social-profile ppp-bitly-profile"> |
53 | 53 | <div class="ppp-bitly-info"> |
54 | 54 | <?php _e( 'Signed in as', 'ppp-txt' ); ?>:<br /><?php echo $ppp_social_settings['bitly']['login']; ?><br /> |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | function ppp_disconnect_bitly() { |
72 | 72 | global $ppp_social_settings; |
73 | 73 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
74 | - if ( isset( $ppp_social_settings['bitly'] ) ) { |
|
75 | - unset( $ppp_social_settings['bitly'] ); |
|
74 | + if (isset($ppp_social_settings['bitly'])) { |
|
75 | + unset($ppp_social_settings['bitly']); |
|
76 | 76 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | add_action( 'ppp_disconnect-bitly', 'ppp_disconnect_bitly', 10 ); |
80 | 80 | |
81 | 81 | function ppp_set_bitly_token_constants( $social_tokens ) { |
82 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'bitly' ) ) { |
|
82 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'bitly' )) { |
|
83 | 83 | define( 'bitly_clientid', $social_tokens->bitly->client_id ); |
84 | 84 | define( 'bitly_secret', $social_tokens->bitly->client_secret ); |
85 | 85 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $result = $ppp_bitly_oauth->ppp_make_bitly_link( $link ); |
98 | 98 | $result = json_decode( $result, true ); |
99 | 99 | |
100 | - if ( isset ( $result['status_code'] ) && $result['status_code'] == 200 ) { |
|
100 | + if (isset ($result['status_code']) && $result['status_code'] == 200) { |
|
101 | 101 | return $result['data']['url']; |
102 | 102 | } else { |
103 | 103 | return $link; |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | $url = 'https://api-ssl.bitly.com/oauth/access_token'; |
116 | 116 | $username = $_POST['username']; |
117 | 117 | $password = $_POST['password']; |
118 | - $headers = array( 'Authorization' => 'Basic ' . base64_encode( bitly_clientid . ':' . bitly_secret ) ); |
|
119 | - $body = 'grant_type=password&username=' . $username . '&password=' . $password; |
|
118 | + $headers = array( 'Authorization' => 'Basic '.base64_encode( bitly_clientid.':'.bitly_secret ) ); |
|
119 | + $body = 'grant_type=password&username='.$username.'&password='.$password; |
|
120 | 120 | $result = wp_remote_post( $url, array( 'headers' => $headers, 'body' => $body ) ); |
121 | 121 | $body = wp_remote_retrieve_body( $result ); |
122 | 122 | $data = json_decode( $body ); |
123 | 123 | |
124 | - if ( isset( $data->access_token ) ) { |
|
124 | + if (isset($data->access_token)) { |
|
125 | 125 | global $ppp_social_settings; |
126 | 126 | $ppp_social_settings['bitly']['access_token'] = $data->access_token; |
127 | 127 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
133 | 133 | echo 1; |
134 | - } elseif ( $data->status_txt == 'INVALID_LOGIN' ) { |
|
134 | + } elseif ($data->status_txt == 'INVALID_LOGIN') { |
|
135 | 135 | echo 'INVALID_LOGIN'; |
136 | 136 | } else { |
137 | 137 | echo 0; |
@@ -225,7 +225,7 @@ |
||
225 | 225 | * @since 2.3 |
226 | 226 | * @param string $date The Date |
227 | 227 | * @param string $time The time |
228 | - * @return long A timestamp |
|
228 | + * @return integer A timestamp |
|
229 | 229 | */ |
230 | 230 | function ppp_generate_timestamp( $date = false, $time = false ) { |
231 | 231 | // Just in case we need this, let's set it once |
@@ -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 | |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | function ppp_schedule_share( $post_id, $post ) { |
15 | 15 | $allowed_post_types = ppp_allowed_post_types(); |
16 | 16 | |
17 | - if ( ! isset( $_POST['post_status'] ) || ! in_array( $post->post_type, $allowed_post_types ) ) { |
|
17 | + if ( ! isset($_POST['post_status']) || ! in_array( $post->post_type, $allowed_post_types )) { |
|
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | 21 | ppp_remove_scheduled_shares( $post_id ); |
22 | 22 | |
23 | - if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published |
|
24 | - ( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post |
|
25 | - ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post |
|
23 | + if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published |
|
24 | + ($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post |
|
25 | + ($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post |
|
26 | 26 | |
27 | 27 | $timestamps = ppp_get_timestamps( $post_id ); |
28 | 28 | |
29 | - foreach ( $timestamps as $timestamp => $name ) { |
|
29 | + foreach ($timestamps as $timestamp => $name) { |
|
30 | 30 | $timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 ); |
31 | 31 | wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) ); |
32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_item_shares = ppp_get_shceduled_crons( $post_id ); |
47 | 47 | |
48 | - foreach ( $current_item_shares as $share ) { |
|
48 | + foreach ($current_item_shares as $share) { |
|
49 | 49 | wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) ); |
50 | 50 | } |
51 | 51 | |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | $all_crons = get_option( 'cron' ); |
71 | 71 | $ppp_crons = array(); |
72 | 72 | |
73 | - foreach ( $all_crons as $timestamp => $cron ) { |
|
74 | - if ( ! isset( $cron['ppp_share_post_event'] ) ) { |
|
73 | + foreach ($all_crons as $timestamp => $cron) { |
|
74 | + if ( ! isset($cron['ppp_share_post_event'])) { |
|
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | |
78 | - foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) { |
|
78 | + foreach ($cron['ppp_share_post_event'] as $key => $single_event) { |
|
79 | 79 | $name_parts = explode( '_', $single_event['args'][1] ); |
80 | - if ( false !== $post_id && $post_id != $name_parts[2] ) { |
|
80 | + if (false !== $post_id && $post_id != $name_parts[2]) { |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | |
84 | 84 | $single_event['timestamp'] = $timestamp; |
85 | - $ppp_crons[ $key ] = $single_event; |
|
85 | + $ppp_crons[$key] = $single_event; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | } |
@@ -111,26 +111,26 @@ discard block |
||
111 | 111 | * |
112 | 112 | */ |
113 | 113 | function ppp_has_cron_within( $time = 0, $within = 0 ) { |
114 | - if ( empty( $time ) ) { |
|
114 | + if (empty($time)) { |
|
115 | 115 | $time = current_time( 'timestamp' ); |
116 | 116 | } |
117 | 117 | |
118 | - if ( empty( $within ) ) { |
|
118 | + if (empty($within)) { |
|
119 | 119 | $within = ppp_get_default_conflict_window(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | $crons = ppp_get_shceduled_crons(); |
123 | 123 | |
124 | - if ( empty( $crons ) ) { |
|
124 | + if (empty($crons)) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $scheduled_times = wp_list_pluck( $crons, 'timestamp' ); |
129 | 129 | |
130 | 130 | $found_time = false; |
131 | - foreach ( $scheduled_times as $key => $scheduled_time ) { |
|
131 | + foreach ($scheduled_times as $key => $scheduled_time) { |
|
132 | 132 | $found_time = ppp_is_time_within( $scheduled_time, $time, $within ); |
133 | - if ( $found_time ) { |
|
133 | + if ($found_time) { |
|
134 | 134 | break; |
135 | 135 | } |
136 | 136 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $min = $target_time - $within; |
153 | 153 | $max = $target_time + $within; |
154 | 154 | |
155 | - return ( ( $time >= $min ) && ( $time <= $max ) ); |
|
155 | + return (($time >= $min) && ($time <= $max)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | function ppp_unschedule_shares( $new_status, $old_status, $post ) { |
222 | 222 | |
223 | - if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) { |
|
223 | + if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) { |
|
224 | 224 | ppp_remove_scheduled_shares( $post->ID ); |
225 | 225 | } |
226 | 226 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | // Just in case we need this, let's set it once |
240 | 240 | $current_time = current_time( 'timestamp' ); |
241 | 241 | |
242 | - if ( empty( $date ) ) { |
|
242 | + if (empty($date)) { |
|
243 | 243 | $date = date( 'm/d/Y', $current_time ); |
244 | 244 | } |
245 | 245 | |
246 | - if ( empty( $time ) ) { |
|
246 | + if (empty($time)) { |
|
247 | 247 | $time = date( 'h:ia', $current_time ); |
248 | 248 | } |
249 | 249 | |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
253 | 253 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
254 | 254 | |
255 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
255 | + if ($ampm == 'pm' && $hours != 12) { |
|
256 | 256 | $hours = $hours + 12; |
257 | 257 | } |
258 | 258 | |
259 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
259 | + if ($ampm == 'am' && $hours == 12) { |
|
260 | 260 | $hours = 00; |
261 | 261 | } |
262 | 262 | |
263 | - $offset = (int) -( get_option( 'gmt_offset' ) ); |
|
263 | + $offset = (int) -(get_option( 'gmt_offset' )); |
|
264 | 264 | $hours = $hours + $offset; |
265 | 265 | $date = explode( '/', $date ); |
266 | 266 | $timestamp = mktime( (int) $hours, (int) $minutes, 0, (int) $date[0], (int) $date[1], (int) $date[2] ); |
@@ -77,7 +77,7 @@ |
||
77 | 77 | * @uses api_request() |
78 | 78 | * |
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | - * @return array Modified update array with custom plugin data. |
|
80 | + * @return stdClass Modified update array with custom plugin data. |
|
81 | 81 | */ |
82 | 82 | public function check_update( $_transient_data ) { |
83 | 83 |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * Allows plugins to use their own update API. |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' )) exit; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Allows plugins to use their own update API. |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | $this->name = plugin_basename( $_plugin_file ); |
39 | 39 | $this->slug = basename( $_plugin_file, '.php' ); |
40 | 40 | $this->version = $_api_data['version']; |
41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
43 | + $this->cache_key = md5( serialize( $this->slug.$this->api_data['license'].$this->beta ) ); |
|
44 | 44 | |
45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
46 | 46 | |
47 | 47 | // Set up hooks. |
48 | 48 | $this->init(); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
62 | 62 | add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
63 | + remove_action( 'after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10 ); |
|
64 | + add_action( 'after_plugin_row_'.$this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
65 | 65 | add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
66 | 66 | |
67 | 67 | } |
@@ -83,37 +83,37 @@ discard block |
||
83 | 83 | |
84 | 84 | global $pagenow; |
85 | 85 | |
86 | - if ( ! is_object( $_transient_data ) ) { |
|
86 | + if ( ! is_object( $_transient_data )) { |
|
87 | 87 | $_transient_data = new stdClass; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
91 | 91 | return $_transient_data; |
92 | 92 | } |
93 | 93 | |
94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
95 | 95 | return $_transient_data; |
96 | 96 | } |
97 | 97 | |
98 | 98 | $version_info = $this->get_cached_version_info(); |
99 | 99 | |
100 | - if ( false === $version_info ) { |
|
100 | + if (false === $version_info) { |
|
101 | 101 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
102 | 102 | |
103 | 103 | $this->set_version_info_cache( $version_info ); |
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
107 | + if (false !== $version_info && is_object( $version_info ) && isset($version_info->new_version)) { |
|
108 | 108 | |
109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
109 | + if (version_compare( $this->version, $version_info->new_version, '<' )) { |
|
110 | 110 | |
111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
111 | + $_transient_data->response[$this->name] = $version_info; |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | 115 | $_transient_data->last_checked = current_time( 'timestamp' ); |
116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
116 | + $_transient_data->checked[$this->name] = $this->version; |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function show_update_notification( $file, $plugin ) { |
130 | 130 | |
131 | - if ( is_network_admin() ) { |
|
131 | + if (is_network_admin()) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
135 | + if ( ! current_user_can( 'update_plugins' )) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | - if( ! is_multisite() ) { |
|
139 | + if ( ! is_multisite()) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $this->name != $file ) { |
|
143 | + if ($this->name != $file) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
@@ -151,56 +151,56 @@ discard block |
||
151 | 151 | |
152 | 152 | $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
153 | 153 | |
154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
155 | 155 | |
156 | 156 | $version_info = $this->get_cached_version_info(); |
157 | 157 | |
158 | - if ( false === $version_info ) { |
|
158 | + if (false === $version_info) { |
|
159 | 159 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
160 | 160 | |
161 | 161 | $this->set_version_info_cache( $version_info ); |
162 | 162 | } |
163 | 163 | |
164 | - if ( ! is_object( $version_info ) ) { |
|
164 | + if ( ! is_object( $version_info )) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
168 | + if (version_compare( $this->version, $version_info->new_version, '<' )) { |
|
169 | 169 | |
170 | - $update_cache->response[ $this->name ] = $version_info; |
|
170 | + $update_cache->response[$this->name] = $version_info; |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | 174 | $update_cache->last_checked = current_time( 'timestamp' ); |
175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
175 | + $update_cache->checked[$this->name] = $this->version; |
|
176 | 176 | |
177 | 177 | set_site_transient( 'update_plugins', $update_cache ); |
178 | 178 | |
179 | 179 | } else { |
180 | 180 | |
181 | - $version_info = $update_cache->response[ $this->name ]; |
|
181 | + $version_info = $update_cache->response[$this->name]; |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | 185 | // Restore our filter |
186 | 186 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
187 | 187 | |
188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare( $this->version, $version_info->new_version, '<' )) { |
|
189 | 189 | |
190 | 190 | // build a plugin list row, with update notification |
191 | 191 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
196 | 196 | |
197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
197 | + $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911' ); |
|
198 | 198 | |
199 | - if ( empty( $version_info->download_link ) ) { |
|
199 | + if (empty($version_info->download_link)) { |
|
200 | 200 | printf( |
201 | 201 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ), |
202 | 202 | esc_html( $version_info->name ), |
203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
203 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', |
|
204 | 204 | esc_html( $version_info->new_version ), |
205 | 205 | '</a>' |
206 | 206 | ); |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | printf( |
209 | 209 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ), |
210 | 210 | esc_html( $version_info->name ), |
211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
211 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', |
|
212 | 212 | esc_html( $version_info->new_version ), |
213 | 213 | '</a>', |
214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
214 | + '<a href="'.esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ).$this->name, 'upgrade-plugin_'.$this->name ) ).'">', |
|
215 | 215 | '</a>' |
216 | 216 | ); |
217 | 217 | } |
@@ -234,13 +234,13 @@ discard block |
||
234 | 234 | */ |
235 | 235 | public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
236 | 236 | |
237 | - if ( $_action != 'plugin_information' ) { |
|
237 | + if ($_action != 'plugin_information') { |
|
238 | 238 | |
239 | 239 | return $_data; |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
244 | 244 | |
245 | 245 | return $_data; |
246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | |
258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
258 | + $cache_key = 'edd_api_request_'.md5( serialize( $this->slug.$this->api_data['license'].$this->beta ) ); |
|
259 | 259 | |
260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
261 | 261 | $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
262 | 262 | |
263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
264 | - if ( empty( $edd_api_request_transient ) ) { |
|
264 | + if (empty($edd_api_request_transient)) { |
|
265 | 265 | |
266 | 266 | $api_response = $this->api_request( 'plugin_information', $to_send ); |
267 | 267 | |
268 | 268 | // Expires in 3 hours |
269 | 269 | $this->set_version_info_cache( $api_response, $cache_key ); |
270 | 270 | |
271 | - if ( false !== $api_response ) { |
|
271 | + if (false !== $api_response) { |
|
272 | 272 | $_data = $api_response; |
273 | 273 | } |
274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
280 | + if (isset($_data->sections) && ! is_array( $_data->sections )) { |
|
281 | 281 | $new_sections = array(); |
282 | - foreach ( $_data->sections as $key => $key ) { |
|
283 | - $new_sections[ $key ] = $key; |
|
282 | + foreach ($_data->sections as $key => $key) { |
|
283 | + $new_sections[$key] = $key; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $_data->sections = $new_sections; |
287 | 287 | } |
288 | 288 | |
289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
290 | + if (isset($_data->banners) && ! is_array( $_data->banners )) { |
|
291 | 291 | $new_banners = array(); |
292 | - foreach ( $_data->banners as $key => $key ) { |
|
293 | - $new_banners[ $key ] = $key; |
|
292 | + foreach ($_data->banners as $key => $key) { |
|
293 | + $new_banners[$key] = $key; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $_data->banners = $new_banners; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function http_request_args( $args, $url ) { |
310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
311 | + if (strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' )) { |
|
312 | 312 | $args['sslverify'] = false; |
313 | 313 | } |
314 | 314 | return $args; |
@@ -331,44 +331,44 @@ discard block |
||
331 | 331 | |
332 | 332 | $data = array_merge( $this->api_data, $_data ); |
333 | 333 | |
334 | - if ( $data['slug'] != $this->slug ) { |
|
334 | + if ($data['slug'] != $this->slug) { |
|
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
338 | + if ($this->api_url == trailingslashit( home_url() )) { |
|
339 | 339 | return false; // Don't allow a plugin to ping itself |
340 | 340 | } |
341 | 341 | |
342 | 342 | $api_params = array( |
343 | 343 | 'edd_action' => 'get_version', |
344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
348 | 348 | 'slug' => $data['slug'], |
349 | 349 | 'author' => $data['author'], |
350 | 350 | 'url' => home_url(), |
351 | - 'beta' => ! empty( $data['beta'] ), |
|
351 | + 'beta' => ! empty($data['beta']), |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
355 | 355 | |
356 | - if ( ! is_wp_error( $request ) ) { |
|
356 | + if ( ! is_wp_error( $request )) { |
|
357 | 357 | $request = json_decode( wp_remote_retrieve_body( $request ) ); |
358 | 358 | } |
359 | 359 | |
360 | - if ( $request && isset( $request->sections ) ) { |
|
360 | + if ($request && isset($request->sections)) { |
|
361 | 361 | $request->sections = maybe_unserialize( $request->sections ); |
362 | 362 | } else { |
363 | 363 | $request = false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( $request && isset( $request->banners ) ) { |
|
366 | + if ($request && isset($request->banners)) { |
|
367 | 367 | $request->banners = maybe_unserialize( $request->banners ); |
368 | 368 | } |
369 | 369 | |
370 | - if( ! empty( $request->sections ) ) { |
|
371 | - foreach( $request->sections as $key => $section ) { |
|
370 | + if ( ! empty($request->sections)) { |
|
371 | + foreach ($request->sections as $key => $section) { |
|
372 | 372 | $request->$key = (array) $section; |
373 | 373 | } |
374 | 374 | } |
@@ -380,54 +380,54 @@ discard block |
||
380 | 380 | |
381 | 381 | global $edd_plugin_data; |
382 | 382 | |
383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
387 | + if (empty($_REQUEST['plugin'])) { |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | |
391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
391 | + if (empty($_REQUEST['slug'])) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
395 | + if ( ! current_user_can( 'update_plugins' )) { |
|
396 | 396 | wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) ); |
397 | 397 | } |
398 | 398 | |
399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
400 | + $beta = ! empty($data['beta']) ? true : false; |
|
401 | + $cache_key = md5( 'edd_plugin_'.sanitize_key( $_REQUEST['plugin'] ).'_'.$beta.'_version_info' ); |
|
402 | 402 | $version_info = $this->get_cached_version_info( $cache_key ); |
403 | 403 | |
404 | - if( false === $version_info ) { |
|
404 | + if (false === $version_info) { |
|
405 | 405 | |
406 | 406 | $api_params = array( |
407 | 407 | 'edd_action' => 'get_version', |
408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
410 | 410 | 'slug' => $_REQUEST['slug'], |
411 | 411 | 'author' => $data['author'], |
412 | 412 | 'url' => home_url(), |
413 | - 'beta' => ! empty( $data['beta'] ) |
|
413 | + 'beta' => ! empty($data['beta']) |
|
414 | 414 | ); |
415 | 415 | |
416 | 416 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
417 | 417 | |
418 | - if ( ! is_wp_error( $request ) ) { |
|
418 | + if ( ! is_wp_error( $request )) { |
|
419 | 419 | $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
420 | 420 | } |
421 | 421 | |
422 | 422 | |
423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
424 | 424 | $version_info->sections = maybe_unserialize( $version_info->sections ); |
425 | 425 | } else { |
426 | 426 | $version_info = false; |
427 | 427 | } |
428 | 428 | |
429 | - if( ! empty( $version_info ) ) { |
|
430 | - foreach( $version_info->sections as $key => $section ) { |
|
429 | + if ( ! empty($version_info)) { |
|
430 | + foreach ($version_info->sections as $key => $section) { |
|
431 | 431 | $version_info->$key = (array) $section; |
432 | 432 | } |
433 | 433 | } |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | |
437 | 437 | } |
438 | 438 | |
439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | exit; |
@@ -445,13 +445,13 @@ discard block |
||
445 | 445 | |
446 | 446 | public function get_cached_version_info( $cache_key = '' ) { |
447 | 447 | |
448 | - if( empty( $cache_key ) ) { |
|
448 | + if (empty($cache_key)) { |
|
449 | 449 | $cache_key = $this->cache_key; |
450 | 450 | } |
451 | 451 | |
452 | 452 | $cache = get_option( $cache_key ); |
453 | 453 | |
454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
454 | + if (empty($cache['timeout']) || current_time( 'timestamp' ) > $cache['timeout']) { |
|
455 | 455 | return false; // Cache is expired |
456 | 456 | } |
457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | |
462 | 462 | public function set_version_info_cache( $value = '', $cache_key = '' ) { |
463 | 463 | |
464 | - if( empty( $cache_key ) ) { |
|
464 | + if (empty($cache_key)) { |
|
465 | 465 | $cache_key = $this->cache_key; |
466 | 466 | } |
467 | 467 |
@@ -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 | |
@@ -28,8 +28,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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,19 +107,19 @@ discard block |
||
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 | 114 | $utm = apply_filters( 'ppp_utm_tags', $utm, $post_id, $name ); |
115 | 115 | |
116 | - $utm_string = strpos( $share_link, '?' ) ? '&' : '?' ; |
|
116 | + $utm_string = strpos( $share_link, '?' ) ? '&' : '?'; |
|
117 | 117 | $first = true; |
118 | - foreach ( $utm as $key => $value ) { |
|
119 | - if ( !$first ) { |
|
118 | + foreach ($utm as $key => $value) { |
|
119 | + if ( ! $first) { |
|
120 | 120 | $utm_string .= '&'; |
121 | 121 | } |
122 | - $utm_string .= 'utm_' . $key . '=' . $value; |
|
122 | + $utm_string .= 'utm_'.$key.'='.$value; |
|
123 | 123 | $first = false; |
124 | 124 | } |
125 | 125 |