| @@ -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, $time ) { | 
| 231 | 231 | $share_time = explode( ':', $time ); | 
| @@ -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 | |
| @@ -13,23 +13,23 @@ discard block | ||
| 13 | 13 | */ | 
| 14 | 14 |  function ppp_schedule_share( $post_id, $post ) { | 
| 15 | 15 | global $ppp_options; | 
| 16 | - $allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array(); | |
| 16 | + $allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array(); | |
| 17 | 17 | $allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types ); | 
| 18 | 18 | |
| 19 | -	if ( ! isset( $_POST['post_status'] ) || ! array_key_exists( $post->post_type, $allowed_post_types ) ) { | |
| 19 | +	if ( ! isset($_POST['post_status']) || ! array_key_exists( $post->post_type, $allowed_post_types )) { | |
| 20 | 20 | return; | 
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | 23 | ppp_remove_scheduled_shares( $post_id ); | 
| 24 | 24 | |
| 25 | - if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published | |
| 26 | - ( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post | |
| 27 | -		( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post | |
| 25 | + if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published | |
| 26 | + ($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post | |
| 27 | +		($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post | |
| 28 | 28 | global $ppp_options, $ppp_social_settings; | 
| 29 | 29 | |
| 30 | 30 | $timestamps = ppp_get_timestamps( $post_id ); | 
| 31 | 31 | |
| 32 | -		foreach ( $timestamps as $timestamp => $name ) { | |
| 32 | +		foreach ($timestamps as $timestamp => $name) { | |
| 33 | 33 | $timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 ); | 
| 34 | 34 | wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) ); | 
| 35 | 35 | } | 
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | |
| 49 | 49 | $current_item_shares = ppp_get_shceduled_crons( $post_id ); | 
| 50 | 50 | |
| 51 | -	foreach ( $current_item_shares as $share ) { | |
| 51 | +	foreach ($current_item_shares as $share) { | |
| 52 | 52 | wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) ); | 
| 53 | 53 | } | 
| 54 | 54 | |
| @@ -73,19 +73,19 @@ discard block | ||
| 73 | 73 | $all_crons = get_option( 'cron' ); | 
| 74 | 74 | $ppp_crons = array(); | 
| 75 | 75 | |
| 76 | -	foreach ( $all_crons as $timestamp => $cron ) { | |
| 77 | -		if ( ! isset( $cron['ppp_share_post_event'] ) ) { | |
| 76 | +	foreach ($all_crons as $timestamp => $cron) { | |
| 77 | +		if ( ! isset($cron['ppp_share_post_event'])) { | |
| 78 | 78 | continue; | 
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | -		foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) { | |
| 81 | +		foreach ($cron['ppp_share_post_event'] as $key => $single_event) { | |
| 82 | 82 | $name_parts = explode( '_', $single_event['args'][1] ); | 
| 83 | -			if ( false !== $post_id && $post_id != $name_parts[2] ) { | |
| 83 | +			if (false !== $post_id && $post_id != $name_parts[2]) { | |
| 84 | 84 | continue; | 
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | $single_event['timestamp'] = $timestamp; | 
| 88 | - $ppp_crons[ $key ] = $single_event; | |
| 88 | + $ppp_crons[$key] = $single_event; | |
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | 91 | } | 
| @@ -103,26 +103,26 @@ discard block | ||
| 103 | 103 | * | 
| 104 | 104 | */ | 
| 105 | 105 |  function ppp_has_cron_within( $time = 0, $within = 0 ) { | 
| 106 | -	if ( empty( $time ) ) { | |
| 106 | +	if (empty($time)) { | |
| 107 | 107 | $time = current_time( 'timestamp' ); | 
| 108 | 108 | } | 
| 109 | 109 | |
| 110 | -	if ( empty( $within ) ) { | |
| 110 | +	if (empty($within)) { | |
| 111 | 111 | $within = ppp_get_default_conflict_window(); | 
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 | $crons = ppp_get_shceduled_crons(); | 
| 115 | 115 | |
| 116 | -	if ( empty( $crons ) ) { | |
| 116 | +	if (empty($crons)) { | |
| 117 | 117 | return false; | 
| 118 | 118 | } | 
| 119 | 119 | |
| 120 | 120 | $scheduled_times = wp_list_pluck( $crons, 'timestamp' ); | 
| 121 | 121 | |
| 122 | 122 | $found_time = false; | 
| 123 | -	foreach ( $scheduled_times as $key => $scheduled_time ) { | |
| 123 | +	foreach ($scheduled_times as $key => $scheduled_time) { | |
| 124 | 124 | $found_time = ppp_is_time_within( $scheduled_time, $time, $within ); | 
| 125 | -		if ( $found_time ) { | |
| 125 | +		if ($found_time) { | |
| 126 | 126 | break; | 
| 127 | 127 | } | 
| 128 | 128 | } | 
| @@ -144,7 +144,7 @@ discard block | ||
| 144 | 144 | $min = $target_time - $within; | 
| 145 | 145 | $max = $target_time + $within; | 
| 146 | 146 | |
| 147 | - return ( ( $time >= $min ) && ( $time <= $max ) ); | |
| 147 | + return (($time >= $min) && ($time <= $max)); | |
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | 150 | /** | 
| @@ -212,7 +212,7 @@ discard block | ||
| 212 | 212 | */ | 
| 213 | 213 |  function ppp_unschedule_shares( $new_status, $old_status, $post ) { | 
| 214 | 214 | |
| 215 | -	if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) { | |
| 215 | +	if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) { | |
| 216 | 216 | ppp_remove_scheduled_shares( $post->ID ); | 
| 217 | 217 | } | 
| 218 | 218 | |
| @@ -233,15 +233,15 @@ discard block | ||
| 233 | 233 | $minutes = (int) substr( $share_time[1], 0, 2 ); | 
| 234 | 234 | $ampm = strtolower( substr( $share_time[1], -2 ) ); | 
| 235 | 235 | |
| 236 | -	if ( $ampm == 'pm' && $hours != 12 ) { | |
| 236 | +	if ($ampm == 'pm' && $hours != 12) { | |
| 237 | 237 | $hours = $hours + 12; | 
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | -	if ( $ampm == 'am' && $hours == 12 ) { | |
| 240 | +	if ($ampm == 'am' && $hours == 12) { | |
| 241 | 241 | $hours = 00; | 
| 242 | 242 | } | 
| 243 | 243 | |
| 244 | - $offset = (int) -( get_option( 'gmt_offset' ) ); | |
| 244 | + $offset = (int) -(get_option( 'gmt_offset' )); | |
| 245 | 245 | $hours = $hours + $offset; | 
| 246 | 246 | $date = explode( '/', $date ); | 
| 247 | 247 | $timestamp = mktime( $hours, $minutes, 0, $date[0], $date[1], $date[2] ); | 
| @@ -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 ) { | 
| @@ -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; | 
| @@ -83,13 +83,13 @@ discard block | ||
| 83 | 83 | */ | 
| 84 | 84 |  function ppp_fb_account_list_actions( $string = '' ) { | 
| 85 | 85 | |
| 86 | -	if ( ! ppp_facebook_enabled() ) { | |
| 86 | +	if ( ! ppp_facebook_enabled()) { | |
| 87 | 87 | global $ppp_facebook_oauth, $ppp_social_settings; | 
| 88 | 88 | $fb_authurl = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); | 
| 89 | 89 | |
| 90 | - $string .= '<a class="button-primary" href="' . $fb_authurl . '">' . __( 'Connect to Facebook', 'ppp-txt' ) . '</a>'; | |
| 90 | + $string .= '<a class="button-primary" href="'.$fb_authurl.'">'.__( 'Connect to Facebook', 'ppp-txt' ).'</a>'; | |
| 91 | 91 |  	} else { | 
| 92 | - $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> '; | |
| 92 | + $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 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | return $string; | 
| @@ -103,28 +103,28 @@ discard block | ||
| 103 | 103 | */ | 
| 104 | 104 |  function ppp_fb_account_list_extras( $string ) { | 
| 105 | 105 | |
| 106 | -	if ( ppp_facebook_enabled() ) { | |
| 106 | +	if (ppp_facebook_enabled()) { | |
| 107 | 107 | global $ppp_social_settings, $ppp_facebook_oauth, $ppp_options; | 
| 108 | 108 | $pages = $ppp_facebook_oauth->ppp_get_fb_user_pages( $ppp_social_settings['facebook']->access_token ); | 
| 109 | - $selected = isset( $ppp_social_settings['facebook']->page ) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; | |
| 109 | + $selected = isset($ppp_social_settings['facebook']->page) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; | |
| 110 | 110 | |
| 111 | -		if ( !empty( $pages ) ) { | |
| 112 | - $string = '<label>' . __( 'Publish as:', 'ppp-txt' ) . '</label><br />'; | |
| 111 | +		if ( ! empty($pages)) { | |
| 112 | + $string = '<label>'.__( 'Publish as:', 'ppp-txt' ).'</label><br />'; | |
| 113 | 113 | $string .= '<select id="fb-page">'; | 
| 114 | - $string .= '<option value="me">' . __( 'Me', 'ppp-txt' ) . '</option>'; | |
| 115 | -			foreach ( $pages as $page ) { | |
| 116 | - $value = $page->name . '|' . $page->access_token . '|' . $page->id; | |
| 117 | - $string .= '<option ' . selected( $value, $selected, false ) . ' value="' . $value . '">' . $page->name . '</option>'; | |
| 114 | + $string .= '<option value="me">'.__( 'Me', 'ppp-txt' ).'</option>'; | |
| 115 | +			foreach ($pages as $page) { | |
| 116 | + $value = $page->name.'|'.$page->access_token.'|'.$page->id; | |
| 117 | + $string .= '<option '.selected( $value, $selected, false ).' value="'.$value.'">'.$page->name.'</option>'; | |
| 118 | 118 | } | 
| 119 | 119 | $string .= '</select><span class="spinner"></span>'; | 
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | -		if ( ! empty( $ppp_options['enable_debug'] ) ) { | |
| 123 | - $days_left = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); | |
| 124 | - $refresh_in = absint( round( ( get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); | |
| 122 | +		if ( ! empty($ppp_options['enable_debug'])) { | |
| 123 | + $days_left = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); | |
| 124 | + $refresh_in = absint( round( (get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); | |
| 125 | 125 | |
| 126 | - $string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left ); | |
| 127 | - $string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); | |
| 126 | + $string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left ); | |
| 127 | + $string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); | |
| 128 | 128 | } | 
| 129 | 129 | } | 
| 130 | 130 | |
| @@ -138,7 +138,7 @@ discard block | ||
| 138 | 138 | * @return void | 
| 139 | 139 | */ | 
| 140 | 140 |  function ppp_set_fb_token_constants( $social_tokens ) { | 
| 141 | -	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'facebook' ) ) { | |
| 141 | +	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'facebook' )) { | |
| 142 | 142 | define( 'PPP_FB_APP_ID', $social_tokens->facebook->app_id ); | 
| 143 | 143 | define( 'PPP_FB_APP_SECRET', $social_tokens->facebook->app_secret ); | 
| 144 | 144 | } | 
| @@ -152,17 +152,17 @@ discard block | ||
| 152 | 152 |  function ppp_capture_facebook_oauth() { | 
| 153 | 153 | $should_capture = false; | 
| 154 | 154 | |
| 155 | -	if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) { | |
| 155 | +	if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) { | |
| 156 | 156 | // Local config | 
| 157 | 157 | $should_capture = true; | 
| 158 | 158 | } | 
| 159 | 159 | |
| 160 | -	if ( isset( $_REQUEST['fb_access_token'] ) ) { | |
| 160 | +	if (isset($_REQUEST['fb_access_token'])) { | |
| 161 | 161 | // Returning from remote config | 
| 162 | 162 | $should_capture = true; | 
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | -	if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) { | |
| 165 | +	if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) { | |
| 166 | 166 | global $ppp_facebook_oauth; | 
| 167 | 167 | $ppp_facebook_oauth->ppp_initialize_facebook(); | 
| 168 | 168 | wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) ); | 
| @@ -179,8 +179,8 @@ discard block | ||
| 179 | 179 |  function ppp_disconnect_facebook() { | 
| 180 | 180 | global $ppp_social_settings; | 
| 181 | 181 | $ppp_social_settings = get_option( 'ppp_social_settings' ); | 
| 182 | -	if ( isset( $ppp_social_settings['facebook'] ) ) { | |
| 183 | - unset( $ppp_social_settings['facebook'] ); | |
| 182 | +	if (isset($ppp_social_settings['facebook'])) { | |
| 183 | + unset($ppp_social_settings['facebook']); | |
| 184 | 184 | update_option( 'ppp_social_settings', $ppp_social_settings ); | 
| 185 | 185 | delete_option( '_ppp_facebook_refresh' ); | 
| 186 | 186 | } | 
| @@ -206,13 +206,13 @@ discard block | ||
| 206 | 206 | */ | 
| 207 | 207 |  function ppp_fb_execute_refresh() { | 
| 208 | 208 | |
| 209 | -	if ( ! ppp_facebook_enabled() ) { | |
| 209 | +	if ( ! ppp_facebook_enabled()) { | |
| 210 | 210 | return; | 
| 211 | 211 | } | 
| 212 | 212 | |
| 213 | 213 | $refresh_date = (int) get_option( '_ppp_facebook_refresh', true ); | 
| 214 | 214 | |
| 215 | -	if ( current_time( 'timestamp' ) > $refresh_date ) { | |
| 215 | +	if (current_time( 'timestamp' ) > $refresh_date) { | |
| 216 | 216 | add_action( 'admin_notices', 'ppp_facebook_refresh_notice' ); | 
| 217 | 217 | } | 
| 218 | 218 | } | 
| @@ -224,12 +224,12 @@ discard block | ||
| 224 | 224 | */ | 
| 225 | 225 |  function ppp_facebook_refresh_notice() { | 
| 226 | 226 | |
| 227 | -	if ( ! ppp_facebook_enabled() ) { | |
| 227 | +	if ( ! ppp_facebook_enabled()) { | |
| 228 | 228 | return; | 
| 229 | 229 | } | 
| 230 | 230 | |
| 231 | - $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb' . get_current_user_id() ); | |
| 232 | -	if ( false !== $has_dismissed ) { | |
| 231 | + $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb'.get_current_user_id() ); | |
| 232 | +	if (false !== $has_dismissed) { | |
| 233 | 233 | return; | 
| 234 | 234 | } | 
| 235 | 235 | |
| @@ -240,14 +240,14 @@ discard block | ||
| 240 | 240 | |
| 241 | 241 | $token = $ppp_social_settings['facebook']->access_token; | 
| 242 | 242 | $url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); | 
| 243 | - $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); | |
| 243 | + $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); | |
| 244 | 244 | |
| 245 | - $days_left = (int) round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ); | |
| 245 | + $days_left = (int) round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ); | |
| 246 | 246 | ?> | 
| 247 | 247 | <div class="notice notice-warning is-dismissible" data-service="fb"> | 
| 248 | - <?php if ( $days_left > 0 ): ?> | |
| 248 | + <?php if ($days_left > 0): ?> | |
| 249 | 249 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication expires in within %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p> | 
| 250 | - <?php elseif ( $days_left < 1 ): ?> | |
| 250 | + <?php elseif ($days_left < 1): ?> | |
| 251 | 251 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p> | 
| 252 | 252 | <?php endif; ?> | 
| 253 | 253 | </div> | 
| @@ -262,10 +262,10 @@ discard block | ||
| 262 | 262 | */ | 
| 263 | 263 |  function ppp_fb_dismiss_notice() { | 
| 264 | 264 | |
| 265 | - $nag = sanitize_key( $_POST[ 'nag' ] ); | |
| 265 | + $nag = sanitize_key( $_POST['nag'] ); | |
| 266 | 266 | |
| 267 | -	if ( $nag === $_POST[ 'nag' ] ) { | |
| 268 | - set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS ); | |
| 267 | +	if ($nag === $_POST['nag']) { | |
| 268 | + set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS ); | |
| 269 | 269 | } | 
| 270 | 270 | |
| 271 | 271 | |
| @@ -293,18 +293,18 @@ discard block | ||
| 293 | 293 | * @param string $name The name of the Cron | 
| 294 | 294 | * @return void | 
| 295 | 295 | */ | 
| 296 | -function ppp_fb_scheduled_share(  $post_id = 0, $index = 1, $name = ''  ) { | |
| 296 | +function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { | |
| 297 | 297 | global $ppp_options; | 
| 298 | 298 | |
| 299 | 299 | $link = ppp_generate_link( $post_id, $name ); | 
| 300 | 300 | |
| 301 | 301 | $post_meta = get_post_meta( $post_id, '_ppp_fb_shares', true ); | 
| 302 | - $this_share = $post_meta[ $index ]; | |
| 303 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; | |
| 302 | + $this_share = $post_meta[$index]; | |
| 303 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; | |
| 304 | 304 | |
| 305 | 305 | $share_message = ppp_fb_build_share_message( $post_id, $name ); | 
| 306 | 306 | |
| 307 | -	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { | |
| 307 | +	if (empty($attachment_id) && ! empty($this_share['image'])) { | |
| 308 | 308 | $media = $this_share['image']; | 
| 309 | 309 |  	} else { | 
| 310 | 310 | $use_media = ppp_fb_use_media( $post_id, $index ); | 
| @@ -361,7 +361,7 @@ discard block | ||
| 361 | 361 | */ | 
| 362 | 362 |  function ppp_fb_add_meta_tab( $tabs ) { | 
| 363 | 363 | global $ppp_social_settings; | 
| 364 | -	if ( ! ppp_facebook_enabled() ) { | |
| 364 | +	if ( ! ppp_facebook_enabled()) { | |
| 365 | 365 | return $tabs; | 
| 366 | 366 | } | 
| 367 | 367 | |
| @@ -378,7 +378,7 @@ discard block | ||
| 378 | 378 | */ | 
| 379 | 379 |  function ppp_fb_register_metabox_content( $content ) { | 
| 380 | 380 | global $ppp_social_settings; | 
| 381 | -	if ( ! ppp_facebook_enabled() ) { | |
| 381 | +	if ( ! ppp_facebook_enabled()) { | |
| 382 | 382 | return $content; | 
| 383 | 383 | } | 
| 384 | 384 | |
| @@ -394,7 +394,7 @@ discard block | ||
| 394 | 394 | */ | 
| 395 | 395 |  function ppp_fb_add_metabox_content( $post ) { | 
| 396 | 396 | global $ppp_options, $ppp_share_settings; | 
| 397 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 397 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 398 | 398 | |
| 399 | 399 | $ppp_fb_share_on_publish = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); | 
| 400 | 400 | $ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); | 
| @@ -403,9 +403,9 @@ discard block | ||
| 403 | 403 | |
| 404 | 404 | $show_share_on_publish = false; | 
| 405 | 405 | |
| 406 | - $share_by_default = empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? false : true; | |
| 406 | + $share_by_default = empty($ppp_share_settings['facebook']['share_on_publish']) ? false : true; | |
| 407 | 407 | |
| 408 | -	if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) { | |
| 408 | +	if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) { | |
| 409 | 409 | $show_share_on_publish = true; | 
| 410 | 410 | } | 
| 411 | 411 | |
| @@ -414,11 +414,11 @@ discard block | ||
| 414 | 414 | <div class="ppp-post-override-wrap"> | 
| 415 | 415 | <p><h3><?php _e( 'Share on Facebook', 'ppp-txt' ); ?></h3></p> | 
| 416 | 416 | <p> | 
| 417 | - <?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?> | |
| 417 | + <?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?> | |
| 418 | 418 | <label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook…', 'ppp-txt' ); ?></label> | 
| 419 | 419 | <select name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" class="ppp-toggle-share-on-publish"> | 
| 420 | - <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> | |
| 421 | - <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> | |
| 420 | + <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> | |
| 421 | + <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> | |
| 422 | 422 | <option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option> | 
| 423 | 423 | </select> | 
| 424 | 424 | </p> | 
| @@ -434,7 +434,7 @@ discard block | ||
| 434 | 434 | <th style="width: 10px;"></th> | 
| 435 | 435 | </tr> | 
| 436 | 436 | </thead> | 
| 437 | - <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> | |
| 437 | + <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> | |
| 438 | 438 | <?php | 
| 439 | 439 | $args = array( | 
| 440 | 440 | 'text' => $ppp_share_on_publish_title, | 
| @@ -445,18 +445,18 @@ discard block | ||
| 445 | 445 | ppp_render_fb_share_on_publish_row( $args ); | 
| 446 | 446 | ?> | 
| 447 | 447 | </tbody> | 
| 448 | - <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> | |
| 448 | + <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> | |
| 449 | 449 | <?php $shares = get_post_meta( $post->ID, '_ppp_fb_shares', true ); ?> | 
| 450 | - <?php if ( ! empty( $shares ) ) : ?> | |
| 450 | + <?php if ( ! empty($shares)) : ?> | |
| 451 | 451 | |
| 452 | - <?php foreach ( $shares as $key => $value ) : | |
| 453 | - $date = isset( $value['date'] ) ? $value['date'] : ''; | |
| 454 | - $time = isset( $value['time'] ) ? $value['time'] : ''; | |
| 455 | - $text = isset( $value['text'] ) ? $value['text'] : ''; | |
| 456 | - $image = isset( $value['image'] ) ? $value['image'] : ''; | |
| 457 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; | |
| 452 | + <?php foreach ($shares as $key => $value) : | |
| 453 | + $date = isset($value['date']) ? $value['date'] : ''; | |
| 454 | + $time = isset($value['time']) ? $value['time'] : ''; | |
| 455 | + $text = isset($value['text']) ? $value['text'] : ''; | |
| 456 | + $image = isset($value['image']) ? $value['image'] : ''; | |
| 457 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; | |
| 458 | 458 | |
| 459 | - $args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); | |
| 459 | + $args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); | |
| 460 | 460 | ?> | 
| 461 | 461 | |
| 462 | 462 | <?php ppp_render_fb_share_row( $key, $args, $post->ID ); ?> | 
| @@ -534,10 +534,10 @@ discard block | ||
| 534 | 534 |  function ppp_render_fb_share_row( $key, $args = array(), $post_id ) { | 
| 535 | 535 | global $post; | 
| 536 | 536 | |
| 537 | - $share_time = strtotime( $args['date'] . ' ' . $args['time'] ); | |
| 537 | + $share_time = strtotime( $args['date'].' '.$args['time'] ); | |
| 538 | 538 | $readonly = current_time( 'timestamp' ) > $share_time ? 'readonly="readonly" ' : ''; | 
| 539 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; | |
| 540 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; | |
| 539 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; | |
| 540 | + $hide = ! empty($readonly) ? 'display: none;' : ''; | |
| 541 | 541 | ?> | 
| 542 | 542 | <tr class="ppp-fb-wrapper ppp-repeatable-row ppp-repeatable-facebook scheduled-row" data-key="<?php echo esc_attr( $key ); ?>"> | 
| 543 | 543 | <td> | 
| @@ -567,7 +567,7 @@ discard block | ||
| 567 | 567 | </td> | 
| 568 | 568 | |
| 569 | 569 | <td> | 
| 570 | -			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 570 | + <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 571 | 571 | </td> | 
| 572 | 572 | |
| 573 | 573 | </tr> | 
| @@ -582,23 +582,23 @@ discard block | ||
| 582 | 582 | */ | 
| 583 | 583 |  function ppp_fb_save_post_meta_boxes( $post_id, $post ) { | 
| 584 | 584 | |
| 585 | -	if ( ! ppp_should_save( $post_id, $post ) ) { | |
| 585 | +	if ( ! ppp_should_save( $post_id, $post )) { | |
| 586 | 586 | return; | 
| 587 | 587 | } | 
| 588 | 588 | |
| 589 | - $ppp_fb_share_on_publish = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; | |
| 590 | - $ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; | |
| 591 | - $ppp_share_on_publish_image_url = ( isset( $_REQUEST['_ppp_fb_share_on_publish_image_url'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; | |
| 592 | - $ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; | |
| 589 | + $ppp_fb_share_on_publish = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; | |
| 590 | + $ppp_share_on_publish_title = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; | |
| 591 | + $ppp_share_on_publish_image_url = (isset($_REQUEST['_ppp_fb_share_on_publish_image_url'])) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; | |
| 592 | + $ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_fb_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; | |
| 593 | 593 | |
| 594 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); | |
| 595 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); | |
| 596 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); | |
| 594 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); | |
| 595 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); | |
| 596 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); | |
| 597 | 597 | update_post_meta( $post_id, '_ppp_fb_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id ); | 
| 598 | 598 | |
| 599 | - $fb_data = ( isset( $_REQUEST['_ppp_fb_shares'] ) && empty( $ppp_fb_share_on_publish ) ) ? $_REQUEST['_ppp_fb_shares'] : array(); | |
| 600 | -	foreach ( $fb_data as $index => $share ) { | |
| 601 | - $fb_data[ $index ]['text'] = sanitize_text_field( $share['text'] ); | |
| 599 | + $fb_data = (isset($_REQUEST['_ppp_fb_shares']) && empty($ppp_fb_share_on_publish)) ? $_REQUEST['_ppp_fb_shares'] : array(); | |
| 600 | +	foreach ($fb_data as $index => $share) { | |
| 601 | + $fb_data[$index]['text'] = sanitize_text_field( $share['text'] ); | |
| 602 | 602 | } | 
| 603 | 603 | |
| 604 | 604 | update_post_meta( $post_id, '_ppp_fb_shares', $fb_data ); | 
| @@ -616,9 +616,9 @@ discard block | ||
| 616 | 616 | global $ppp_options; | 
| 617 | 617 | |
| 618 | 618 | $from_meta = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); | 
| 619 | - $from_post = isset( $_POST['_ppp_fb_share_on_publish'] ) ? $_POST['_ppp_fb_share_on_publish'] : '0'; | |
| 619 | + $from_post = isset($_POST['_ppp_fb_share_on_publish']) ? $_POST['_ppp_fb_share_on_publish'] : '0'; | |
| 620 | 620 | |
| 621 | -	if ( '1' != $from_meta && '1' != $from_post ) { | |
| 621 | +	if ('1' != $from_meta && '1' != $from_post) { | |
| 622 | 622 | return; | 
| 623 | 623 | } | 
| 624 | 624 | |
| @@ -630,28 +630,28 @@ discard block | ||
| 630 | 630 | $image_url = ''; | 
| 631 | 631 | |
| 632 | 632 | // Determine if we're seeing the share on publish in meta or $_POST | 
| 633 | -	if ( $from_meta && ! $from_post ) { | |
| 634 | - $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); | |
| 633 | +	if ($from_meta && ! $from_post) { | |
| 634 | + $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); | |
| 635 | 635 | $attachment_id = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_attachment_id', true ); | 
| 636 | - $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); | |
| 636 | + $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); | |
| 637 | 637 |  	} else { | 
| 638 | - $title = isset( $_POST['_ppp_fb_share_on_publish_title'] ) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; | |
| 639 | - $attachment_id = isset( $_POST['_ppp_fb_share_on_publish_attachment_id'] ) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; | |
| 640 | - $image_url = isset( $_POST['_ppp_fb_share_on_publish_image_url'] ) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; | |
| 638 | + $title = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; | |
| 639 | + $attachment_id = isset($_POST['_ppp_fb_share_on_publish_attachment_id']) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; | |
| 640 | + $image_url = isset($_POST['_ppp_fb_share_on_publish_image_url']) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; | |
| 641 | 641 | } | 
| 642 | 642 | |
| 643 | 643 | $thumbnail = ''; | 
| 644 | -	if ( empty( $attachment_id ) && ! empty( $image_url ) ) { | |
| 644 | +	if (empty($attachment_id) && ! empty($image_url)) { | |
| 645 | 645 | $thumbnail = $image_url; | 
| 646 | 646 |  	} else { | 
| 647 | 647 | $thumbnail = ppp_post_has_media( $post->ID, 'fb', true, $attachment_id ); | 
| 648 | 648 | } | 
| 649 | 649 | |
| 650 | - $name = 'sharedate_0_' . $post->ID . '_fb'; | |
| 650 | + $name = 'sharedate_0_'.$post->ID.'_fb'; | |
| 651 | 651 | |
| 652 | - $default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; | |
| 652 | + $default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; | |
| 653 | 653 | // If an override was found, use it, otherwise try the default text content | 
| 654 | -	if ( empty( $title ) && empty( $default_title ) ) { | |
| 654 | +	if (empty($title) && empty($default_title)) { | |
| 655 | 655 | $title = get_the_title( $post->ID ); | 
| 656 | 656 | } | 
| 657 | 657 | |
| @@ -690,20 +690,20 @@ discard block | ||
| 690 | 690 |  function ppp_fb_generate_timestamps( $times, $post_id ) { | 
| 691 | 691 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); | 
| 692 | 692 | |
| 693 | -	if ( empty( $fb_shares ) ) { | |
| 693 | +	if (empty($fb_shares)) { | |
| 694 | 694 | $fb_shares = array(); | 
| 695 | 695 | } | 
| 696 | 696 | |
| 697 | -	foreach ( $fb_shares as $key => $data ) { | |
| 698 | -		if ( ! array_filter( $data ) ) { | |
| 697 | +	foreach ($fb_shares as $key => $data) { | |
| 698 | +		if ( ! array_filter( $data )) { | |
| 699 | 699 | continue; | 
| 700 | 700 | } | 
| 701 | 701 | |
| 702 | 702 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); | 
| 703 | 703 | |
| 704 | -		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future | |
| 705 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_fb'; | |
| 706 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_fb'; | |
| 704 | +		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future | |
| 705 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_fb'; | |
| 706 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_fb'; | |
| 707 | 707 | } | 
| 708 | 708 | |
| 709 | 709 | } | 
| @@ -753,20 +753,20 @@ discard block | ||
| 753 | 753 | */ | 
| 754 | 754 |  function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) { | 
| 755 | 755 | global $ppp_options; | 
| 756 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; | |
| 756 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; | |
| 757 | 757 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); | 
| 758 | 758 | |
| 759 | -	if ( $is_scheduled && ! empty( $fb_shares ) ) { | |
| 759 | +	if ($is_scheduled && ! empty($fb_shares)) { | |
| 760 | 760 | $name_array = explode( '_', $name ); | 
| 761 | 761 | $index = $name_array[1]; | 
| 762 | - $share_content = $fb_shares[ $index ]['text']; | |
| 762 | + $share_content = $fb_shares[$index]['text']; | |
| 763 | 763 | } | 
| 764 | 764 | |
| 765 | 765 | // If an override was found, use it, otherwise try the default text content | 
| 766 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; | |
| 766 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; | |
| 767 | 767 | |
| 768 | 768 | // If the content is still empty, just use the post title | 
| 769 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); | |
| 769 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); | |
| 770 | 770 | |
| 771 | 771 | return apply_filters( 'ppp_share_content_fb', $share_content, array( 'post_id' => $post_id ) ); | 
| 772 | 772 | } | 
| @@ -778,7 +778,7 @@ discard block | ||
| 778 | 778 | * @return bool Whether or not this tweet should contain a media post | 
| 779 | 779 | */ | 
| 780 | 780 |  function ppp_fb_use_media( $post_id, $index ) { | 
| 781 | -	if ( empty( $post_id ) || empty( $index ) ) { | |
| 781 | +	if (empty($post_id) || empty($index)) { | |
| 782 | 782 | return false; | 
| 783 | 783 | } | 
| 784 | 784 | |
| @@ -794,9 +794,9 @@ discard block | ||
| 794 | 794 | |
| 795 | 795 | ppp_set_social_tokens(); | 
| 796 | 796 | |
| 797 | - $account = isset( $_POST['account'] ) ? $_POST['account'] : false; | |
| 797 | + $account = isset($_POST['account']) ? $_POST['account'] : false; | |
| 798 | 798 | |
| 799 | -	if ( !empty( $account ) ) { | |
| 799 | +	if ( ! empty($account)) { | |
| 800 | 800 | $ppp_social_settings['facebook']->page = $account; | 
| 801 | 801 | |
| 802 | 802 | update_option( 'ppp_social_settings', $ppp_social_settings ); | 
| @@ -812,14 +812,14 @@ discard block | ||
| 812 | 812 |  function ppp_fb_calendar_on_publish_event( $events, $post_id ) { | 
| 813 | 813 | $share_on_publish = get_post_meta( $post_id, '_ppp_fb_share_on_publish', true ); | 
| 814 | 814 | |
| 815 | -	if ( ! empty( $share_on_publish ) ) { | |
| 815 | +	if ( ! empty($share_on_publish)) { | |
| 816 | 816 | $share_text = get_post_meta( $post_id, '_ppp_fb_share_on_publish_title', true ); | 
| 817 | 817 | $events[] = array( | 
| 818 | - 'id' => $post_id . '-share-on-publish', | |
| 819 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), | |
| 820 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), | |
| 821 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), | |
| 822 | - 'className' => 'ppp-calendar-item-fb cal-post-' . $post_id, | |
| 818 | + 'id' => $post_id.'-share-on-publish', | |
| 819 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), | |
| 820 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), | |
| 821 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), | |
| 822 | + 'className' => 'ppp-calendar-item-fb cal-post-'.$post_id, | |
| 823 | 823 | 'belongsTo' => $post_id, | 
| 824 | 824 | ); | 
| 825 | 825 | } | 
| @@ -830,9 +830,9 @@ discard block | ||
| 830 | 830 | |
| 831 | 831 |  function ppp_fb_get_post_shares( $items, $post_id ) { | 
| 832 | 832 | $shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); | 
| 833 | -	if ( empty( $shares ) ) { return $items; } | |
| 833 | +	if (empty($shares)) { return $items; } | |
| 834 | 834 | |
| 835 | -	foreach ( $shares as $key => $share ) { | |
| 835 | +	foreach ($shares as $key => $share) { | |
| 836 | 836 | $items[] = array( 'id' => $key, 'service' => 'fb' ); | 
| 837 | 837 | } | 
| 838 | 838 | return $items; | 
| @@ -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> | 
| @@ -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 ) { | 
| @@ -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; | 
| @@ -77,13 +77,13 @@ discard block | ||
| 77 | 77 | */ | 
| 78 | 78 |  function ppp_li_account_list_actions( $string = '' ) { | 
| 79 | 79 | |
| 80 | -	if ( ! ppp_linkedin_enabled() ) { | |
| 80 | +	if ( ! ppp_linkedin_enabled()) { | |
| 81 | 81 | global $ppp_linkedin_oauth, $ppp_social_settings; | 
| 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 | |
| 89 | 89 | return $string; | 
| @@ -96,14 +96,14 @@ discard block | ||
| 96 | 96 | * @return string The HTML for the LinkedIn Extras column | 
| 97 | 97 | */ | 
| 98 | 98 |  function ppp_li_account_list_extras( $string ) { | 
| 99 | -	if ( ppp_linkedin_enabled() ) { | |
| 99 | +	if (ppp_linkedin_enabled()) { | |
| 100 | 100 | global $ppp_social_settings, $ppp_options; | 
| 101 | -		if ( ! empty( $ppp_options['enable_debug'] ) ) { | |
| 102 | - $days_left = absint( round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); | |
| 103 | - $refresh_in = absint( round( ( get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); | |
| 101 | +		if ( ! empty($ppp_options['enable_debug'])) { | |
| 102 | + $days_left = absint( round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); | |
| 103 | + $refresh_in = absint( round( (get_option( '_ppp_linkedin_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); | |
| 104 | 104 | |
| 105 | - $string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left ); | |
| 106 | - $string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); | |
| 105 | + $string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left ); | |
| 106 | + $string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); | |
| 107 | 107 | } | 
| 108 | 108 | } | 
| 109 | 109 | |
| @@ -119,17 +119,17 @@ discard block | ||
| 119 | 119 |  function ppp_capture_linkedin_oauth() { | 
| 120 | 120 | $should_capture = false; | 
| 121 | 121 | |
| 122 | -	if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false ) { | |
| 122 | +	if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false) { | |
| 123 | 123 | // Local config | 
| 124 | 124 | $should_capture = true; | 
| 125 | 125 | } | 
| 126 | 126 | |
| 127 | -	if ( isset( $_REQUEST['li_access_token'] ) ) { | |
| 127 | +	if (isset($_REQUEST['li_access_token'])) { | |
| 128 | 128 | // Returning from remote config | 
| 129 | 129 | $should_capture = true; | 
| 130 | 130 | } | 
| 131 | 131 | |
| 132 | -	if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) { | |
| 132 | +	if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) { | |
| 133 | 133 | global $ppp_linkedin_oauth; | 
| 134 | 134 | $ppp_linkedin_oauth->ppp_initialize_linkedin(); | 
| 135 | 135 | wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) ); | 
| @@ -145,8 +145,8 @@ discard block | ||
| 145 | 145 |  function ppp_disconnect_linkedin() { | 
| 146 | 146 | global $ppp_social_settings; | 
| 147 | 147 | $ppp_social_settings = get_option( 'ppp_social_settings' ); | 
| 148 | -	if ( isset( $ppp_social_settings['linkedin'] ) ) { | |
| 149 | - unset( $ppp_social_settings['linkedin'] ); | |
| 148 | +	if (isset($ppp_social_settings['linkedin'])) { | |
| 149 | + unset($ppp_social_settings['linkedin']); | |
| 150 | 150 | update_option( 'ppp_social_settings', $ppp_social_settings ); | 
| 151 | 151 | delete_option( '_ppp_linkedin_refresh' ); | 
| 152 | 152 | } | 
| @@ -172,13 +172,13 @@ discard block | ||
| 172 | 172 | */ | 
| 173 | 173 |  function ppp_li_execute_refresh() { | 
| 174 | 174 | |
| 175 | -	if ( ! ppp_linkedin_enabled() ) { | |
| 175 | +	if ( ! ppp_linkedin_enabled()) { | |
| 176 | 176 | return; | 
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | 179 | $refresh_date = (int) get_option( '_ppp_linkedin_refresh', true ); | 
| 180 | 180 | |
| 181 | -	if ( current_time( 'timestamp' ) > $refresh_date ) { | |
| 181 | +	if (current_time( 'timestamp' ) > $refresh_date) { | |
| 182 | 182 | add_action( 'admin_notices', 'ppp_linkedin_refresh_notice' ); | 
| 183 | 183 | } | 
| 184 | 184 | } | 
| @@ -190,12 +190,12 @@ discard block | ||
| 190 | 190 | */ | 
| 191 | 191 |  function ppp_linkedin_refresh_notice() { | 
| 192 | 192 | |
| 193 | -	if ( ! ppp_linkedin_enabled() ) { | |
| 193 | +	if ( ! ppp_linkedin_enabled()) { | |
| 194 | 194 | return; | 
| 195 | 195 | } | 
| 196 | 196 | |
| 197 | - $has_dismissed = get_transient( 'ppp-dismiss-refresh-li' . get_current_user_id() ); | |
| 198 | -	if ( false !== $has_dismissed ) { | |
| 197 | + $has_dismissed = get_transient( 'ppp-dismiss-refresh-li'.get_current_user_id() ); | |
| 198 | +	if (false !== $has_dismissed) { | |
| 199 | 199 | return; | 
| 200 | 200 | } | 
| 201 | 201 | |
| @@ -206,14 +206,14 @@ discard block | ||
| 206 | 206 | |
| 207 | 207 | $token = $ppp_social_settings['linkedin']->access_token; | 
| 208 | 208 | $url = $ppp_linkedin_oauth->ppp_get_linkedin_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); | 
| 209 | - $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); | |
| 209 | + $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); | |
| 210 | 210 | |
| 211 | - $days_left = (int) round( ( $ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ); | |
| 211 | + $days_left = (int) round( ($ppp_social_settings['linkedin']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ); | |
| 212 | 212 | ?> | 
| 213 | 213 | <div class="notice notice-warning is-dismissible" data-service="li"> | 
| 214 | - <?php if ( $days_left > 0 ): ?> | |
| 214 | + <?php if ($days_left > 0): ?> | |
| 215 | 215 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication expires in within %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p> | 
| 216 | - <?php elseif ( $days_left < 1 ): ?> | |
| 216 | + <?php elseif ($days_left < 1): ?> | |
| 217 | 217 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your LinkedIn authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p> | 
| 218 | 218 | <?php endif; ?> | 
| 219 | 219 | </div> | 
| @@ -228,10 +228,10 @@ discard block | ||
| 228 | 228 | */ | 
| 229 | 229 |  function ppp_li_dismiss_notice() { | 
| 230 | 230 | |
| 231 | - $nag = sanitize_key( $_POST[ 'nag' ] ); | |
| 231 | + $nag = sanitize_key( $_POST['nag'] ); | |
| 232 | 232 | |
| 233 | -	if ( $nag === $_POST[ 'nag' ] ) { | |
| 234 | - set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS ); | |
| 233 | +	if ($nag === $_POST['nag']) { | |
| 234 | + set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS ); | |
| 235 | 235 | } | 
| 236 | 236 | |
| 237 | 237 | |
| @@ -244,7 +244,7 @@ discard block | ||
| 244 | 244 | * @return void | 
| 245 | 245 | */ | 
| 246 | 246 |  function ppp_set_li_token_constants( $social_tokens ) { | 
| 247 | -	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'linkedin' ) ) { | |
| 247 | +	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'linkedin' )) { | |
| 248 | 248 | define( 'LINKEDIN_KEY', $social_tokens->linkedin->api_key ); | 
| 249 | 249 | define( 'LINKEDIN_SECRET', $social_tokens->linkedin->secret_key ); | 
| 250 | 250 | } | 
| @@ -261,7 +261,7 @@ discard block | ||
| 261 | 261 | */ | 
| 262 | 262 |  function ppp_li_share( $title, $description, $link, $media ) { | 
| 263 | 263 | global $ppp_linkedin_oauth; | 
| 264 | - $args = array ( | |
| 264 | + $args = array( | |
| 265 | 265 | 'title' => ppp_entities_and_slashes( $title ), | 
| 266 | 266 | 'description' => ppp_entities_and_slashes( $description ), | 
| 267 | 267 | 'submitted-url' => $link, | 
| @@ -302,7 +302,7 @@ discard block | ||
| 302 | 302 | */ | 
| 303 | 303 |  function ppp_li_add_meta_tab( $tabs ) { | 
| 304 | 304 | global $ppp_social_settings; | 
| 305 | -	if ( ! ppp_linkedin_enabled() ) { | |
| 305 | +	if ( ! ppp_linkedin_enabled()) { | |
| 306 | 306 | return $tabs; | 
| 307 | 307 | } | 
| 308 | 308 | |
| @@ -319,7 +319,7 @@ discard block | ||
| 319 | 319 | */ | 
| 320 | 320 |  function ppp_li_register_metabox_content( $content ) { | 
| 321 | 321 | global $ppp_social_settings; | 
| 322 | -	if ( ! ppp_linkedin_enabled() ) { | |
| 322 | +	if ( ! ppp_linkedin_enabled()) { | |
| 323 | 323 | return $content; | 
| 324 | 324 | } | 
| 325 | 325 | |
| @@ -357,7 +357,7 @@ discard block | ||
| 357 | 357 | */ | 
| 358 | 358 |  function ppp_li_add_metabox_content( $post ) { | 
| 359 | 359 | global $ppp_options, $ppp_share_settings; | 
| 360 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 360 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 361 | 361 | |
| 362 | 362 | $ppp_li_share_on_publish = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true ); | 
| 363 | 363 | $ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true ); | 
| @@ -367,9 +367,9 @@ discard block | ||
| 367 | 367 | |
| 368 | 368 | $show_share_on_publish = false; | 
| 369 | 369 | |
| 370 | - $share_by_default = empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? false : true; | |
| 370 | + $share_by_default = empty($ppp_share_settings['linkedin']['share_on_publish']) ? false : true; | |
| 371 | 371 | |
| 372 | -	if ( $ppp_li_share_on_publish == '1' || ( $ppp_li_share_on_publish == '' && $share_by_default ) ) { | |
| 372 | +	if ($ppp_li_share_on_publish == '1' || ($ppp_li_share_on_publish == '' && $share_by_default)) { | |
| 373 | 373 | $show_share_on_publish = true; | 
| 374 | 374 | } | 
| 375 | 375 | ?> | 
| @@ -377,11 +377,11 @@ discard block | ||
| 377 | 377 | <div class="ppp-post-override-wrap"> | 
| 378 | 378 | <p><h3><?php _e( 'Share on LinkedIn', 'ppp-txt' ); ?></h3></p> | 
| 379 | 379 | <p> | 
| 380 | - <?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?> | |
| 380 | + <?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?> | |
| 381 | 381 | <label for="ppp_li_share_on_publish"><?php _e( 'Share this post on LinkedIn…', 'ppp-txt' ); ?></label> | 
| 382 | 382 | <select name="_ppp_li_share_on_publish" id="ppp_li_share_on_publish" class="ppp-toggle-share-on-publish"> | 
| 383 | - <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> | |
| 384 | - <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> | |
| 383 | + <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> | |
| 384 | + <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> | |
| 385 | 385 | <option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option> | 
| 386 | 386 | </select> | 
| 387 | 387 | </p> | 
| @@ -397,7 +397,7 @@ discard block | ||
| 397 | 397 | <th style="width: 10px;"></th> | 
| 398 | 398 | </tr> | 
| 399 | 399 | </thead> | 
| 400 | - <tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> | |
| 400 | + <tbody id="li-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> | |
| 401 | 401 | <?php | 
| 402 | 402 | $args = array( | 
| 403 | 403 | 'text' => $ppp_share_on_publish_title, | 
| @@ -409,19 +409,19 @@ discard block | ||
| 409 | 409 | ppp_render_li_share_on_publish_row( $args ); | 
| 410 | 410 | ?> | 
| 411 | 411 | </tbody> | 
| 412 | - <tbody id="li-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> | |
| 412 | + <tbody id="li-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> | |
| 413 | 413 | <?php $shares = get_post_meta( $post->ID, '_ppp_li_shares', true ); ?> | 
| 414 | - <?php if ( ! empty( $shares ) ) : ?> | |
| 414 | + <?php if ( ! empty($shares)) : ?> | |
| 415 | 415 | |
| 416 | - <?php foreach ( $shares as $key => $value ) : | |
| 417 | - $date = isset( $value['date'] ) ? $value['date'] : ''; | |
| 418 | - $time = isset( $value['time'] ) ? $value['time'] : ''; | |
| 419 | - $text = isset( $value['text'] ) ? $value['text'] : ''; | |
| 420 | - $desc = isset( $value['desc'] ) ? $value['desc'] : ''; | |
| 421 | - $image = isset( $value['image'] ) ? $value['image'] : ''; | |
| 422 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; | |
| 416 | + <?php foreach ($shares as $key => $value) : | |
| 417 | + $date = isset($value['date']) ? $value['date'] : ''; | |
| 418 | + $time = isset($value['time']) ? $value['time'] : ''; | |
| 419 | + $text = isset($value['text']) ? $value['text'] : ''; | |
| 420 | + $desc = isset($value['desc']) ? $value['desc'] : ''; | |
| 421 | + $image = isset($value['image']) ? $value['image'] : ''; | |
| 422 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; | |
| 423 | 423 | |
| 424 | - $args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text', 'desc', 'image','attachment_id' ), $value ); | |
| 424 | + $args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'desc', 'image', 'attachment_id' ), $value ); | |
| 425 | 425 | ?> | 
| 426 | 426 | |
| 427 | 427 | <?php ppp_render_li_share_row( $key, $args ); ?> | 
| @@ -457,7 +457,7 @@ discard block | ||
| 457 | 457 |  function ppp_render_li_share_on_publish_row( $args = array() ) { | 
| 458 | 458 | global $post; | 
| 459 | 459 | $readonly = $post->post_status !== 'publish' ? '' : 'readonly="readonly" '; | 
| 460 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; | |
| 460 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; | |
| 461 | 461 | ?> | 
| 462 | 462 | <tr class="ppp-li-wrapper ppp-repeatable-row on-publish-row"> | 
| 463 | 463 | <td colspan="2" class="ppp-on-plublish-date-column"> | 
| @@ -485,7 +485,7 @@ discard block | ||
| 485 | 485 | <tr> | 
| 486 | 486 | <td colspan="2"></td> | 
| 487 | 487 | <td colspan="3"> | 
| 488 | - <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> | |
| 488 | + <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> | |
| 489 | 489 | </td> | 
| 490 | 490 | </tr> | 
| 491 | 491 | <?php | 
| @@ -503,10 +503,10 @@ discard block | ||
| 503 | 503 |  function ppp_render_li_share_row( $key, $args = array() ) { | 
| 504 | 504 | global $post; | 
| 505 | 505 | |
| 506 | - $share_time = strtotime( $args['date'] . ' ' . $args['time'] ); | |
| 506 | + $share_time = strtotime( $args['date'].' '.$args['time'] ); | |
| 507 | 507 | $readonly = current_time( 'timestamp' ) > $share_time ? 'readonly="readonly" ' : ''; | 
| 508 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; | |
| 509 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; | |
| 508 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; | |
| 509 | + $hide = ! empty($readonly) ? 'display: none;' : ''; | |
| 510 | 510 | ?> | 
| 511 | 511 | <tr class="ppp-li-wrapper ppp-repeatable-row ppp-repeatable-linkedin scheduled-row" data-key="<?php echo esc_attr( $key ); ?>"> | 
| 512 | 512 | <td> | 
| @@ -536,7 +536,7 @@ discard block | ||
| 536 | 536 | </td> | 
| 537 | 537 | |
| 538 | 538 | <td> | 
| 539 | -			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="linkedin" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 539 | + <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="linkedin" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 540 | 540 | </td> | 
| 541 | 541 | |
| 542 | 542 | </tr> | 
| @@ -557,26 +557,26 @@ discard block | ||
| 557 | 557 | */ | 
| 558 | 558 |  function ppp_li_save_post_meta_boxes( $post_id, $post ) { | 
| 559 | 559 | |
| 560 | -	if ( ! ppp_should_save( $post_id, $post ) ) { | |
| 560 | +	if ( ! ppp_should_save( $post_id, $post )) { | |
| 561 | 561 | return; | 
| 562 | 562 | } | 
| 563 | 563 | |
| 564 | - $ppp_li_share_on_publish = ( isset( $_REQUEST['_ppp_li_share_on_publish'] ) ) ? $_REQUEST['_ppp_li_share_on_publish'] : '-1'; | |
| 565 | - $ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_li_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_title'] : ''; | |
| 566 | - $ppp_share_on_publish_desc = ( isset( $_REQUEST['_ppp_li_share_on_publish_desc'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : ''; | |
| 567 | - $ppp_share_on_publish_image_url = ( isset( $_REQUEST['_ppp_li_share_on_publish_image_url'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_image_url'] : ''; | |
| 568 | - $ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_li_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : ''; | |
| 564 | + $ppp_li_share_on_publish = (isset($_REQUEST['_ppp_li_share_on_publish'])) ? $_REQUEST['_ppp_li_share_on_publish'] : '-1'; | |
| 565 | + $ppp_share_on_publish_title = (isset($_REQUEST['_ppp_li_share_on_publish_title'])) ? $_REQUEST['_ppp_li_share_on_publish_title'] : ''; | |
| 566 | + $ppp_share_on_publish_desc = (isset($_REQUEST['_ppp_li_share_on_publish_desc'])) ? $_REQUEST['_ppp_li_share_on_publish_desc'] : ''; | |
| 567 | + $ppp_share_on_publish_image_url = (isset($_REQUEST['_ppp_li_share_on_publish_image_url'])) ? $_REQUEST['_ppp_li_share_on_publish_image_url'] : ''; | |
| 568 | + $ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_li_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_li_share_on_publish_attachment_id'] : ''; | |
| 569 | 569 | |
| 570 | - update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish ); | |
| 571 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title ); | |
| 572 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_desc', $ppp_share_on_publish_desc ); | |
| 573 | - update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url', $ppp_share_on_publish_image_url ); | |
| 570 | + update_post_meta( $post_id, '_ppp_li_share_on_publish', $ppp_li_share_on_publish ); | |
| 571 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_title', $ppp_share_on_publish_title ); | |
| 572 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_desc', $ppp_share_on_publish_desc ); | |
| 573 | + update_post_meta( $post_id, '_ppp_li_share_on_publish_image_url', $ppp_share_on_publish_image_url ); | |
| 574 | 574 | update_post_meta( $post_id, '_ppp_li_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id ); | 
| 575 | 575 | |
| 576 | - $li_data = ( isset( $_REQUEST['_ppp_li_shares'] ) && empty( $ppp_li_share_on_publish ) ) ? $_REQUEST['_ppp_li_shares'] : array(); | |
| 577 | -	foreach ( $li_data as $index => $share ) { | |
| 578 | - $li_data[ $index ]['text'] = sanitize_text_field( $share['text'] ); | |
| 579 | - $li_data[ $index ]['desc'] = sanitize_text_field( $share['desc'] ); | |
| 576 | + $li_data = (isset($_REQUEST['_ppp_li_shares']) && empty($ppp_li_share_on_publish)) ? $_REQUEST['_ppp_li_shares'] : array(); | |
| 577 | +	foreach ($li_data as $index => $share) { | |
| 578 | + $li_data[$index]['text'] = sanitize_text_field( $share['text'] ); | |
| 579 | + $li_data[$index]['desc'] = sanitize_text_field( $share['desc'] ); | |
| 580 | 580 | } | 
| 581 | 581 | |
| 582 | 582 | update_post_meta( $post_id, '_ppp_li_shares', $li_data ); | 
| @@ -593,9 +593,9 @@ discard block | ||
| 593 | 593 |  function ppp_li_share_on_publish( $new_status, $old_status, $post ) { | 
| 594 | 594 | global $ppp_options; | 
| 595 | 595 | $from_meta = get_post_meta( $post->ID, '_ppp_li_share_on_publish', true ); | 
| 596 | - $from_post = isset( $_POST['_ppp_li_share_on_publish'] ) ? $_POST['_ppp_li_share_on_publish']: '0'; | |
| 596 | + $from_post = isset($_POST['_ppp_li_share_on_publish']) ? $_POST['_ppp_li_share_on_publish'] : '0'; | |
| 597 | 597 | |
| 598 | -	if ( '1' != $from_meta && '1' != $from_post ) { | |
| 598 | +	if ('1' != $from_meta && '1' != $from_post) { | |
| 599 | 599 | return; | 
| 600 | 600 | } | 
| 601 | 601 | |
| @@ -608,30 +608,30 @@ discard block | ||
| 608 | 608 | $image_url = ''; | 
| 609 | 609 | |
| 610 | 610 | // Determine if we're seeing the share on publish in meta or $_POST | 
| 611 | -	if ( $from_meta && ! $from_post ) { | |
| 612 | - $title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title' , true ); | |
| 613 | - $desc = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc' , true ); | |
| 611 | +	if ($from_meta && ! $from_post) { | |
| 612 | + $title = get_post_meta( $post->ID, '_ppp_li_share_on_publish_title', true ); | |
| 613 | + $desc = get_post_meta( $post->ID, '_ppp_li_share_on_publish_desc', true ); | |
| 614 | 614 | $attachment_id = get_post_meta( $post->ID, '_ppp_li_share_on_publish_attachment_id', true ); | 
| 615 | - $image_url = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url' , true ); | |
| 615 | + $image_url = get_post_meta( $post->ID, '_ppp_li_share_on_publish_image_url', true ); | |
| 616 | 616 |  	} else { | 
| 617 | - $title = isset( $_POST['_ppp_li_share_on_publish_title'] ) ? $_POST['_ppp_li_share_on_publish_title'] : ''; | |
| 618 | - $desc = isset( $_POST['_ppp_li_share_on_publish_desc'] ) ? $_POST['_ppp_li_share_on_publish_desc'] : false; | |
| 619 | - $attachment_id = isset( $_POST['_ppp_li_share_on_publish_attachment_id'] ) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0; | |
| 620 | - $image_url = isset( $_POST['_ppp_li_share_on_publish_image_url'] ) ? $_POST['_ppp_li_share_on_publish_image_url'] : ''; | |
| 617 | + $title = isset($_POST['_ppp_li_share_on_publish_title']) ? $_POST['_ppp_li_share_on_publish_title'] : ''; | |
| 618 | + $desc = isset($_POST['_ppp_li_share_on_publish_desc']) ? $_POST['_ppp_li_share_on_publish_desc'] : false; | |
| 619 | + $attachment_id = isset($_POST['_ppp_li_share_on_publish_attachment_id']) ? $_POST['_ppp_li_share_on_publish_attachment_id'] : 0; | |
| 620 | + $image_url = isset($_POST['_ppp_li_share_on_publish_image_url']) ? $_POST['_ppp_li_share_on_publish_image_url'] : ''; | |
| 621 | 621 | } | 
| 622 | 622 | |
| 623 | 623 | $thumbnail = ''; | 
| 624 | -	if ( empty( $attachment_id ) && ! empty( $image_url ) ) { | |
| 624 | +	if (empty($attachment_id) && ! empty($image_url)) { | |
| 625 | 625 | $thumbnail = $image_url; | 
| 626 | 626 |  	} else { | 
| 627 | 627 | $thumbnail = ppp_post_has_media( $post->ID, 'li', true, $attachment_id ); | 
| 628 | 628 | } | 
| 629 | 629 | |
| 630 | - $name = 'sharedate_0_' . $post->ID . '_li'; | |
| 630 | + $name = 'sharedate_0_'.$post->ID.'_li'; | |
| 631 | 631 | |
| 632 | - $default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; | |
| 632 | + $default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; | |
| 633 | 633 | // If an override was found, use it, otherwise try the default text content | 
| 634 | -	if ( empty( $title ) && empty( $default_title ) ) { | |
| 634 | +	if (empty($title) && empty($default_title)) { | |
| 635 | 635 | $title = get_the_title( $post->ID ); | 
| 636 | 636 | } | 
| 637 | 637 | |
| @@ -665,18 +665,18 @@ discard block | ||
| 665 | 665 | * @param string $name The name of the Cron | 
| 666 | 666 | * @return void | 
| 667 | 667 | */ | 
| 668 | -function ppp_li_scheduled_share(  $post_id = 0, $index = 1, $name = ''  ) { | |
| 668 | +function ppp_li_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { | |
| 669 | 669 | global $ppp_options; | 
| 670 | 670 | |
| 671 | 671 | $link = ppp_generate_link( $post_id, $name ); | 
| 672 | 672 | |
| 673 | 673 | $post_meta = get_post_meta( $post_id, '_ppp_li_shares', true ); | 
| 674 | - $this_share = $post_meta[ $index ]; | |
| 675 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; | |
| 674 | + $this_share = $post_meta[$index]; | |
| 675 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; | |
| 676 | 676 | |
| 677 | 677 | $share_message = ppp_li_build_share_message( $post_id, $name ); | 
| 678 | 678 | |
| 679 | -	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { | |
| 679 | +	if (empty($attachment_id) && ! empty($this_share['image'])) { | |
| 680 | 680 | $media = $this_share['image']; | 
| 681 | 681 |  	} else { | 
| 682 | 682 | $use_media = ppp_li_use_media( $post_id, $index ); | 
| @@ -712,7 +712,7 @@ discard block | ||
| 712 | 712 | * @return bool Whether or not this tweet should contain a media post | 
| 713 | 713 | */ | 
| 714 | 714 |  function ppp_li_use_media( $post_id, $index ) { | 
| 715 | -	if ( empty( $post_id ) || empty( $index ) ) { | |
| 715 | +	if (empty($post_id) || empty($index)) { | |
| 716 | 716 | return false; | 
| 717 | 717 | } | 
| 718 | 718 | |
| @@ -745,20 +745,20 @@ discard block | ||
| 745 | 745 | */ | 
| 746 | 746 |  function ppp_li_generate_share_content( $post_id, $name, $is_scheduled = true ) { | 
| 747 | 747 | global $ppp_options; | 
| 748 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; | |
| 748 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; | |
| 749 | 749 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); | 
| 750 | 750 | |
| 751 | -	if ( $is_scheduled && ! empty( $li_shares ) ) { | |
| 751 | +	if ($is_scheduled && ! empty($li_shares)) { | |
| 752 | 752 | $name_array = explode( '_', $name ); | 
| 753 | 753 | $index = $name_array[1]; | 
| 754 | - $share_content = $li_shares[ $index ]['text']; | |
| 754 | + $share_content = $li_shares[$index]['text']; | |
| 755 | 755 | } | 
| 756 | 756 | |
| 757 | 757 | // If an override was found, use it, otherwise try the default text content | 
| 758 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; | |
| 758 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; | |
| 759 | 759 | |
| 760 | 760 | // If the content is still empty, just use the post title | 
| 761 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); | |
| 761 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); | |
| 762 | 762 | |
| 763 | 763 | return apply_filters( 'ppp_share_content_li', $share_content, array( 'post_id' => $post_id ) ); | 
| 764 | 764 | } | 
| @@ -775,8 +775,8 @@ discard block | ||
| 775 | 775 | $description = ''; | 
| 776 | 776 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); | 
| 777 | 777 | |
| 778 | -	if ( ! empty( $li_shares[ $index ] ) ) { | |
| 779 | - $description = ! empty( $li_shares[ $index ]['desc'] ) ? $li_shares[ $index ]['desc'] : ''; | |
| 778 | +	if ( ! empty($li_shares[$index])) { | |
| 779 | + $description = ! empty($li_shares[$index]['desc']) ? $li_shares[$index]['desc'] : ''; | |
| 780 | 780 | } | 
| 781 | 781 | |
| 782 | 782 | return $description; | 
| @@ -793,20 +793,20 @@ discard block | ||
| 793 | 793 |  function ppp_li_generate_timestamps( $times, $post_id ) { | 
| 794 | 794 | $li_shares = get_post_meta( $post_id, '_ppp_li_shares', true ); | 
| 795 | 795 | |
| 796 | -	if ( empty( $li_shares ) ) { | |
| 796 | +	if (empty($li_shares)) { | |
| 797 | 797 | $li_shares = array(); | 
| 798 | 798 | } | 
| 799 | 799 | |
| 800 | -	foreach ( $li_shares as $key => $data ) { | |
| 801 | -		if ( ! array_filter( $data ) ) { | |
| 800 | +	foreach ($li_shares as $key => $data) { | |
| 801 | +		if ( ! array_filter( $data )) { | |
| 802 | 802 | continue; | 
| 803 | 803 | } | 
| 804 | 804 | |
| 805 | 805 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); | 
| 806 | 806 | |
| 807 | -		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future | |
| 808 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_li'; | |
| 809 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_li'; | |
| 807 | +		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future | |
| 808 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_li'; | |
| 809 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_li'; | |
| 810 | 810 | } | 
| 811 | 811 | |
| 812 | 812 | } | 
| @@ -826,14 +826,14 @@ discard block | ||
| 826 | 826 |  function ppp_li_calendar_on_publish_event( $events, $post_id ) { | 
| 827 | 827 | $share_on_publish = get_post_meta( $post_id, '_ppp_li_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_li_share_on_publish_title', true ); | 
| 831 | 831 | $events[] = array( | 
| 832 | - 'id' => $post_id . '-share-on-publish', | |
| 833 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_li_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-li cal-post-' . $post_id, | |
| 832 | + 'id' => $post_id.'-share-on-publish', | |
| 833 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_li_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-li 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_li_get_post_shares( $items, $post_id ) { | 
| 846 | 846 | $shares = get_post_meta( $post_id, '_ppp_li_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' => 'li' ); | 
| 851 | 851 | } | 
| 852 | 852 | return $items; | 
| @@ -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> | 
| @@ -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,27 +27,27 @@ 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'; | |
| 40 | - include PPP_PATH . '/includes/libs/class-wp-logging.php'; | |
| 41 | - | |
| 42 | -			if ( is_admin() ) { | |
| 43 | - include PPP_PATH . '/includes/admin/upgrades.php'; | |
| 44 | - include PPP_PATH . '/includes/admin/do-upgrades.php'; | |
| 45 | - include PPP_PATH . '/includes/admin/actions.php'; | |
| 46 | - include PPP_PATH . '/includes/admin/admin-pages.php'; | |
| 47 | - include PPP_PATH . '/includes/admin/admin-ajax.php'; | |
| 48 | - include PPP_PATH . '/includes/admin/meta-boxes.php'; | |
| 49 | - include PPP_PATH . '/includes/admin/welcome.php'; | |
| 50 | - include PPP_PATH . '/includes/admin/dashboard.php'; | |
| 35 | + include PPP_PATH.'/includes/general-functions.php'; | |
| 36 | + include PPP_PATH.'/includes/share-functions.php'; | |
| 37 | + include PPP_PATH.'/includes/cron-functions.php'; | |
| 38 | + include PPP_PATH.'/includes/filters.php'; | |
| 39 | + include PPP_PATH.'/includes/libs/social-loader.php'; | |
| 40 | + include PPP_PATH.'/includes/libs/class-wp-logging.php'; | |
| 41 | + | |
| 42 | +			if (is_admin()) { | |
| 43 | + include PPP_PATH.'/includes/admin/upgrades.php'; | |
| 44 | + include PPP_PATH.'/includes/admin/do-upgrades.php'; | |
| 45 | + include PPP_PATH.'/includes/admin/actions.php'; | |
| 46 | + include PPP_PATH.'/includes/admin/admin-pages.php'; | |
| 47 | + include PPP_PATH.'/includes/admin/admin-ajax.php'; | |
| 48 | + include PPP_PATH.'/includes/admin/meta-boxes.php'; | |
| 49 | + include PPP_PATH.'/includes/admin/welcome.php'; | |
| 50 | + include PPP_PATH.'/includes/admin/dashboard.php'; | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 | register_activation_hook( PPP_FILE, array( $this, 'activation_setup' ) ); | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | * @access public | 
| 68 | 68 | */ | 
| 69 | 69 |  	public static function getInstance() { | 
| 70 | -		if ( !self::$ppp_instance ) { | |
| 70 | +		if ( ! self::$ppp_instance) { | |
| 71 | 71 | self::$ppp_instance = new PostPromoterPro(); | 
| 72 | 72 | } | 
| 73 | 73 | |
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | */ | 
| 93 | 93 |  	public function activation_setup() { | 
| 94 | 94 | // If the settings already exist, don't do this | 
| 95 | -		if ( get_option( 'ppp_options' ) ) { | |
| 95 | +		if (get_option( 'ppp_options' )) { | |
| 96 | 96 | return; | 
| 97 | 97 | } | 
| 98 | 98 | |
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | 112 |  	private function hooks() { | 
| 113 | -		if ( is_admin() ) { | |
| 113 | +		if (is_admin()) { | |
| 114 | 114 | add_action( 'admin_init', array( $this, 'ppp_register_settings' ) ); | 
| 115 | 115 | add_action( 'admin_init', 'ppp_upgrade_plugin', 1 ); | 
| 116 | 116 | |
| @@ -127,8 +127,8 @@ discard block | ||
| 127 | 127 | } | 
| 128 | 128 | |
| 129 | 129 | add_action( 'init', array( $this, 'get_actions' ) ); | 
| 130 | - add_action( 'save_post', 'ppp_schedule_share', 99, 2); | |
| 131 | - add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3); | |
| 130 | + add_action( 'save_post', 'ppp_schedule_share', 99, 2 ); | |
| 131 | + add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 ); | |
| 132 | 132 | add_action( 'init', 'ppp_add_image_sizes' ); | 
| 133 | 133 | add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 ); | 
| 134 | 134 | } | 
| @@ -151,15 +151,15 @@ discard block | ||
| 151 | 151 | |
| 152 | 152 | $allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook ); | 
| 153 | 153 | |
| 154 | -		if ( ! in_array( $hook, $allowed_pages ) ) { | |
| 154 | +		if ( ! in_array( $hook, $allowed_pages )) { | |
| 155 | 155 | return; | 
| 156 | 156 | } | 
| 157 | 157 | |
| 158 | 158 | wp_enqueue_script( 'jquery-ui-core' ); | 
| 159 | 159 | wp_enqueue_script( 'jquery-ui-datepicker' ); | 
| 160 | 160 | |
| 161 | - $jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js'; | |
| 162 | - wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); | |
| 161 | + $jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js'; | |
| 162 | + wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); | |
| 163 | 163 | wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true ); | 
| 164 | 164 | |
| 165 | 165 | } | 
| @@ -168,11 +168,11 @@ discard block | ||
| 168 | 168 | |
| 169 | 169 | // List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only | 
| 170 | 170 | // load ours if they don't exist | 
| 171 | -		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) { | |
| 171 | +		if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) { | |
| 172 | 172 | wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' ); | 
| 173 | 173 | } | 
| 174 | 174 | |
| 175 | - wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION ); | |
| 175 | + wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION ); | |
| 176 | 176 | wp_enqueue_style( 'ppp_admin_css' ); | 
| 177 | 177 | |
| 178 | 178 | } | 
| @@ -185,7 +185,7 @@ discard block | ||
| 185 | 185 | * @access public | 
| 186 | 186 | */ | 
| 187 | 187 |  	public function plugin_settings_links( $links, $file ) { | 
| 188 | -		if ( $file != PPP_FILE ) { | |
| 188 | +		if ($file != PPP_FILE) { | |
| 189 | 189 | return $links; | 
| 190 | 190 | } | 
| 191 | 191 | |
| @@ -279,22 +279,22 @@ discard block | ||
| 279 | 279 | */ | 
| 280 | 280 |  	public function plugin_updater() { | 
| 281 | 281 | |
| 282 | -		if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) { | |
| 282 | +		if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) { | |
| 283 | 283 | return; | 
| 284 | 284 | } | 
| 285 | 285 | |
| 286 | 286 | $license_key = trim( get_option( '_ppp_license_key' ) ); | 
| 287 | 287 | |
| 288 | -		if ( empty( $license_key ) ) { | |
| 288 | +		if (empty($license_key)) { | |
| 289 | 289 | add_action( 'admin_notices', array( $this, 'no_license_nag' ) ); | 
| 290 | 290 | return; | 
| 291 | 291 | } | 
| 292 | 292 | |
| 293 | 293 | // setup the updater | 
| 294 | 294 | $edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array( | 
| 295 | - 'version' => PPP_VERSION, // current version number | |
| 296 | - 'license' => $license_key, // license key (used get_option above to retrieve from DB) | |
| 297 | - 'item_name' => PPP_PLUGIN_NAME, // name of this plugin | |
| 295 | + 'version' => PPP_VERSION, // current version number | |
| 296 | + 'license' => $license_key, // license key (used get_option above to retrieve from DB) | |
| 297 | + 'item_name' => PPP_PLUGIN_NAME, // name of this plugin | |
| 298 | 298 | 'author' => 'Post Promoter Pro' // author of this plugin | 
| 299 | 299 | ) | 
| 300 | 300 | ); | 
| @@ -324,10 +324,10 @@ discard block | ||
| 324 | 324 | */ | 
| 325 | 325 |  	public function deactivate_license() { | 
| 326 | 326 | // listen for our activate button to be clicked | 
| 327 | -		if( isset( $_POST['ppp_license_deactivate'] ) ) { | |
| 327 | +		if (isset($_POST['ppp_license_deactivate'])) { | |
| 328 | 328 | |
| 329 | 329 | // run a quick security check | 
| 330 | -			if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) { | |
| 330 | +			if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) { | |
| 331 | 331 | return; | 
| 332 | 332 | } | 
| 333 | 333 | // get out if we didn't click the Activate button | 
| @@ -347,7 +347,7 @@ discard block | ||
| 347 | 347 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); | 
| 348 | 348 | |
| 349 | 349 | // make sure the response came back okay | 
| 350 | -			if ( is_wp_error( $response ) ) { | |
| 350 | +			if (is_wp_error( $response )) { | |
| 351 | 351 | return false; | 
| 352 | 352 | } | 
| 353 | 353 | |
| @@ -355,7 +355,7 @@ discard block | ||
| 355 | 355 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); | 
| 356 | 356 | |
| 357 | 357 | // $license_data->license will be either "deactivated" or "failed" | 
| 358 | -			if( $license_data->license == 'deactivated' ) { | |
| 358 | +			if ($license_data->license == 'deactivated') { | |
| 359 | 359 | delete_option( '_ppp_license_key_status' ); | 
| 360 | 360 | } | 
| 361 | 361 | |
| @@ -368,10 +368,10 @@ discard block | ||
| 368 | 368 | */ | 
| 369 | 369 |  	public function activate_license() { | 
| 370 | 370 | // listen for our activate button to be clicked | 
| 371 | -		if( isset( $_POST['ppp_license_activate'] ) ) { | |
| 371 | +		if (isset($_POST['ppp_license_activate'])) { | |
| 372 | 372 | |
| 373 | 373 | // run a quick security check | 
| 374 | -			if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) { | |
| 374 | +			if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) { | |
| 375 | 375 | return; | 
| 376 | 376 | } | 
| 377 | 377 | // get out if we didn't click the Activate button | 
| @@ -391,7 +391,7 @@ discard block | ||
| 391 | 391 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); | 
| 392 | 392 | |
| 393 | 393 | // make sure the response came back okay | 
| 394 | -			if ( is_wp_error( $response ) ) { | |
| 394 | +			if (is_wp_error( $response )) { | |
| 395 | 395 | return false; | 
| 396 | 396 | } | 
| 397 | 397 | |
| @@ -412,7 +412,7 @@ discard block | ||
| 412 | 412 | */ | 
| 413 | 413 |  	public function ppp_sanitize_license( $new ) { | 
| 414 | 414 | $old = get_option( '_ppp_license_key' ); | 
| 415 | -		if( $old && $old != $new ) { | |
| 415 | +		if ($old && $old != $new) { | |
| 416 | 416 | delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate | 
| 417 | 417 | } | 
| 418 | 418 | return $new; | 
| @@ -424,8 +424,8 @@ discard block | ||
| 424 | 424 | * @return void | 
| 425 | 425 | */ | 
| 426 | 426 |  	public function get_actions() { | 
| 427 | -		if ( isset( $_GET['ppp_action'] ) ) { | |
| 428 | - do_action( 'ppp_' . $_GET['ppp_action'], $_GET ); | |
| 427 | +		if (isset($_GET['ppp_action'])) { | |
| 428 | + do_action( 'ppp_'.$_GET['ppp_action'], $_GET ); | |
| 429 | 429 | } | 
| 430 | 430 | } | 
| 431 | 431 | |
| @@ -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,17 +107,17 @@ 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 | - $utm_string = strpos( $share_link, '?' ) ? '&' : '?' ; | |
| 114 | + $utm_string = strpos( $share_link, '?' ) ? '&' : '?'; | |
| 115 | 115 | $first = true; | 
| 116 | -	foreach ( $utm as $key => $value ) { | |
| 117 | -		if ( !$first ) { | |
| 116 | +	foreach ($utm as $key => $value) { | |
| 117 | +		if ( ! $first) { | |
| 118 | 118 | $utm_string .= '&'; | 
| 119 | 119 | } | 
| 120 | - $utm_string .= 'utm_' . $key . '=' . $value; | |
| 120 | + $utm_string .= 'utm_'.$key.'='.$value; | |
| 121 | 121 | $first = false; | 
| 122 | 122 | } | 
| 123 | 123 | |
| @@ -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_twitter_enabled() { | 
| 13 | 13 | global $ppp_social_settings; | 
| 14 | 14 | |
| 15 | -	if ( isset( $ppp_social_settings['twitter'] ) && !empty( $ppp_social_settings['twitter'] ) ) { | |
| 15 | +	if (isset($ppp_social_settings['twitter']) && ! empty($ppp_social_settings['twitter'])) { | |
| 16 | 16 | return true; | 
| 17 | 17 | } | 
| 18 | 18 | |
| @@ -50,10 +50,10 @@ discard block | ||
| 50 | 50 | */ | 
| 51 | 51 |  function ppp_tw_account_list_avatar( $string = '' ) { | 
| 52 | 52 | |
| 53 | -	if ( ppp_twitter_enabled() ) { | |
| 53 | +	if (ppp_twitter_enabled()) { | |
| 54 | 54 | global $ppp_social_settings; | 
| 55 | 55 | $avatar_url = $ppp_social_settings['twitter']['user']->profile_image_url_https; | 
| 56 | - $string .= '<img class="ppp-social-icon" src="' . $avatar_url . '" />'; | |
| 56 | + $string .= '<img class="ppp-social-icon" src="'.$avatar_url.'" />'; | |
| 57 | 57 | } | 
| 58 | 58 | |
| 59 | 59 | return $string; | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | */ | 
| 68 | 68 |  function ppp_tw_account_list_name( $string = '' ) { | 
| 69 | 69 | |
| 70 | -	if ( ppp_twitter_enabled() ) { | |
| 70 | +	if (ppp_twitter_enabled()) { | |
| 71 | 71 | global $ppp_social_settings; | 
| 72 | 72 | $string .= $ppp_social_settings['twitter']['user']->name; | 
| 73 | 73 | } | 
| @@ -83,15 +83,15 @@ discard block | ||
| 83 | 83 | */ | 
| 84 | 84 |  function ppp_tw_account_list_actions( $string = '' ) { | 
| 85 | 85 | |
| 86 | -	if ( ! ppp_twitter_enabled() ) { | |
| 86 | +	if ( ! ppp_twitter_enabled()) { | |
| 87 | 87 | global $ppp_twitter_oauth, $ppp_social_settings; | 
| 88 | 88 | $tw_auth = $ppp_twitter_oauth->ppp_verify_twitter_credentials(); | 
| 89 | 89 | $tw_authurl = $ppp_twitter_oauth->ppp_get_twitter_auth_url(); | 
| 90 | 90 | |
| 91 | - $string .= '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; | |
| 91 | + $string .= '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; | |
| 92 | 92 |  	} else { | 
| 93 | - $string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ) . '" >' . __( 'Disconnect from Twitter', 'ppp-txt' ) . '</a> '; | |
| 94 | - $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">' . __( 'Revoke Access via Twitter', 'ppp-txt' ) . '</a>'; | |
| 93 | + $string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ).'" >'.__( 'Disconnect from Twitter', 'ppp-txt' ).'</a> '; | |
| 94 | + $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">'.__( 'Revoke Access via Twitter', 'ppp-txt' ).'</a>'; | |
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | return $string; | 
| @@ -103,13 +103,13 @@ discard block | ||
| 103 | 103 | * @return void | 
| 104 | 104 | */ | 
| 105 | 105 |  function ppp_capture_twitter_oauth() { | 
| 106 | -	if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) { | |
| 106 | +	if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { | |
| 107 | 107 | $current_screen = get_current_screen(); | 
| 108 | -		if ( 'user-edit' === $current_screen->base ) { | |
| 109 | - $user_id = ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; | |
| 108 | +		if ('user-edit' === $current_screen->base) { | |
| 109 | + $user_id = ! empty($_GET['user_id']) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; | |
| 110 | 110 | $twitter = new PPP_Twitter_User( $user_id ); | 
| 111 | 111 | $twitter->init(); | 
| 112 | - $redirect = admin_url( 'user-edit.php?updated=1&user_id=' . $user_id ); | |
| 112 | + $redirect = admin_url( 'user-edit.php?updated=1&user_id='.$user_id ); | |
| 113 | 113 |  		} else { | 
| 114 | 114 | global $ppp_twitter_oauth; | 
| 115 | 115 | $ppp_twitter_oauth->ppp_initialize_twitter(); | 
| @@ -127,17 +127,17 @@ discard block | ||
| 127 | 127 | * @return void | 
| 128 | 128 | */ | 
| 129 | 129 |  function ppp_disconnect_twitter() { | 
| 130 | -	if ( ! empty( $_GET['user_id'] ) ) { | |
| 130 | +	if ( ! empty($_GET['user_id'])) { | |
| 131 | 131 | $user_id = (int) sanitize_text_field( $_GET['user_id'] ); | 
| 132 | -		if ( $user_id !== get_current_user_id() || ! current_user_can( 'manage_options' ) ) { | |
| 132 | +		if ($user_id !== get_current_user_id() || ! current_user_can( 'manage_options' )) { | |
| 133 | 133 | wp_die( __( 'Unable to disconnect Twitter account', 'ppp-txt' ) ); | 
| 134 | 134 | } | 
| 135 | 135 | delete_user_meta( $user_id, '_ppp_twitter_data' ); | 
| 136 | 136 |  	} else { | 
| 137 | 137 | global $ppp_social_settings; | 
| 138 | 138 | $ppp_social_settings = get_option( 'ppp_social_settings' ); | 
| 139 | -		if ( isset( $ppp_social_settings['twitter'] ) ) { | |
| 140 | - unset( $ppp_social_settings['twitter'] ); | |
| 139 | +		if (isset($ppp_social_settings['twitter'])) { | |
| 140 | + unset($ppp_social_settings['twitter']); | |
| 141 | 141 | update_option( 'ppp_social_settings', $ppp_social_settings ); | 
| 142 | 142 | } | 
| 143 | 143 | } | 
| @@ -168,12 +168,12 @@ discard block | ||
| 168 | 168 | global $ppp_options, $wp_logs, $wp_filter; | 
| 169 | 169 | |
| 170 | 170 | $post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 171 | - $this_share = $post_meta[ $index ]; | |
| 172 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; | |
| 171 | + $this_share = $post_meta[$index]; | |
| 172 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; | |
| 173 | 173 | |
| 174 | 174 | $share_message = ppp_tw_build_share_message( $post_id, $name ); | 
| 175 | 175 | |
| 176 | -	if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { | |
| 176 | +	if (empty($attachment_id) && ! empty($this_share['image'])) { | |
| 177 | 177 | $media = $this_share['image']; | 
| 178 | 178 |  	} else { | 
| 179 | 179 | $use_media = ppp_tw_use_media( $post_id, $index ); | 
| @@ -199,12 +199,12 @@ discard block | ||
| 199 | 199 | |
| 200 | 200 | update_post_meta( $log_entry, '_ppp_share_status', $status ); | 
| 201 | 201 | |
| 202 | -	if ( ! empty( $status->id_str ) ) { | |
| 202 | +	if ( ! empty($status->id_str)) { | |
| 203 | 203 | $post = get_post( $post_id ); | 
| 204 | 204 | $author_id = $post->post_author; | 
| 205 | 205 | $author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true ); | 
| 206 | 206 | |
| 207 | -		if ( $author_rt ) { | |
| 207 | +		if ($author_rt) { | |
| 208 | 208 | $twitter_user = new PPP_Twitter_User( $author_id ); | 
| 209 | 209 | $twitter_user->retweet( $status->id_str ); | 
| 210 | 210 | } | 
| @@ -224,9 +224,9 @@ discard block | ||
| 224 | 224 |  function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) { | 
| 225 | 225 | $share_content = ppp_tw_generate_share_content( $post_id, $name ); | 
| 226 | 226 | |
| 227 | -	if ( $include_link ) { | |
| 227 | +	if ($include_link) { | |
| 228 | 228 | $share_link = ppp_generate_link( $post_id, $name, $scheduled ); | 
| 229 | - $share_content = $share_content . ' ' . $share_link; | |
| 229 | + $share_content = $share_content.' '.$share_link; | |
| 230 | 230 | } | 
| 231 | 231 | |
| 232 | 232 | return apply_filters( 'ppp_tw_build_share_message', $share_content ); | 
| @@ -240,10 +240,10 @@ discard block | ||
| 240 | 240 | */ | 
| 241 | 241 |  function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) { | 
| 242 | 242 | global $ppp_options; | 
| 243 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; | |
| 243 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; | |
| 244 | 244 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 245 | 245 | |
| 246 | -	if ( $is_scheduled && ! empty( $ppp_tweets ) ) { | |
| 246 | +	if ($is_scheduled && ! empty($ppp_tweets)) { | |
| 247 | 247 | $ppp_post_override_data = get_post_meta( $post_id, '_ppp_post_override_data', true ); | 
| 248 | 248 | $name_array = explode( '_', $name ); | 
| 249 | 249 | $index = $name_array[1]; | 
| @@ -251,10 +251,10 @@ discard block | ||
| 251 | 251 | } | 
| 252 | 252 | |
| 253 | 253 | // If an override was found, use it, otherwise try the default text content | 
| 254 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; | |
| 254 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; | |
| 255 | 255 | |
| 256 | 256 | // If the content is still empty, just use the post title | 
| 257 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); | |
| 257 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); | |
| 258 | 258 | |
| 259 | 259 | return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) ); | 
| 260 | 260 | } | 
| @@ -266,12 +266,12 @@ discard block | ||
| 266 | 266 | * @return bool Whether or not this tweet should contain a media post | 
| 267 | 267 | */ | 
| 268 | 268 |  function ppp_tw_use_media( $post_id, $index ) { | 
| 269 | -	if ( empty( $post_id ) || empty( $index ) ) { | |
| 269 | +	if (empty($post_id) || empty($index)) { | |
| 270 | 270 | return false; | 
| 271 | 271 | } | 
| 272 | 272 | |
| 273 | 273 | $share_data = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 274 | - $use_media = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false; | |
| 274 | + $use_media = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false; | |
| 275 | 275 | |
| 276 | 276 | return $use_media; | 
| 277 | 277 | } | 
| @@ -282,7 +282,7 @@ discard block | ||
| 282 | 282 | * @return void | 
| 283 | 283 | */ | 
| 284 | 284 |  function ppp_set_tw_token_constants( $social_tokens ) { | 
| 285 | -	if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) { | |
| 285 | +	if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) { | |
| 286 | 286 | define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token ); | 
| 287 | 287 | define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret ); | 
| 288 | 288 | } | 
| @@ -320,7 +320,7 @@ discard block | ||
| 320 | 320 | */ | 
| 321 | 321 |  function ppp_tw_add_meta_tab( $tabs ) { | 
| 322 | 322 | global $ppp_social_settings; | 
| 323 | -	if ( !isset( $ppp_social_settings['twitter'] ) ) { | |
| 323 | +	if ( ! isset($ppp_social_settings['twitter'])) { | |
| 324 | 324 | return $tabs; | 
| 325 | 325 | } | 
| 326 | 326 | |
| @@ -337,7 +337,7 @@ discard block | ||
| 337 | 337 | */ | 
| 338 | 338 |  function ppp_tw_register_metabox_content( $content ) { | 
| 339 | 339 | global $ppp_social_settings; | 
| 340 | -	if ( !isset( $ppp_social_settings['twitter'] ) ) { | |
| 340 | +	if ( ! isset($ppp_social_settings['twitter'])) { | |
| 341 | 341 | return $content; | 
| 342 | 342 | } | 
| 343 | 343 | |
| @@ -396,16 +396,16 @@ discard block | ||
| 396 | 396 | <tbody> | 
| 397 | 397 | <?php ppp_render_tweet_share_on_publish_row(); ?> | 
| 398 | 398 | <?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?> | 
| 399 | - <?php if ( ! empty( $tweets ) ) : ?> | |
| 399 | + <?php if ( ! empty($tweets)) : ?> | |
| 400 | 400 | |
| 401 | - <?php foreach ( $tweets as $key => $value ) : | |
| 402 | - $date = isset( $value['date'] ) ? $value['date'] : ''; | |
| 403 | - $time = isset( $value['time'] ) ? $value['time'] : ''; | |
| 404 | - $text = isset( $value['text'] ) ? $value['text'] : ''; | |
| 405 | - $image = isset( $value['image'] ) ? $value['image'] : ''; | |
| 406 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; | |
| 401 | + <?php foreach ($tweets as $key => $value) : | |
| 402 | + $date = isset($value['date']) ? $value['date'] : ''; | |
| 403 | + $time = isset($value['time']) ? $value['time'] : ''; | |
| 404 | + $text = isset($value['text']) ? $value['text'] : ''; | |
| 405 | + $image = isset($value['image']) ? $value['image'] : ''; | |
| 406 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; | |
| 407 | 407 | |
| 408 | - $args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); | |
| 408 | + $args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); | |
| 409 | 409 | ?> | 
| 410 | 410 | |
| 411 | 411 | <?php ppp_render_tweet_row( $key, $args, $post->ID ); ?> | 
| @@ -414,7 +414,7 @@ discard block | ||
| 414 | 414 | <?php endforeach; ?> | 
| 415 | 415 | |
| 416 | 416 | <?php | 
| 417 | -									if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) { | |
| 417 | +									if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) { | |
| 418 | 418 | $args = array( | 
| 419 | 419 | 'date' => '', | 
| 420 | 420 | 'time' => '', | 
| @@ -437,7 +437,7 @@ discard block | ||
| 437 | 437 | <tr> | 
| 438 | 438 | <td class="submit" colspan="4" style="float: none; clear:both; background:#fff;"> | 
| 439 | 439 | <a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a> | 
| 440 | - <?php if ( ! empty( $has_past_shares ) ) : ?> | |
| 440 | + <?php if ( ! empty($has_past_shares)) : ?> | |
| 441 | 441 | <a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a> | 
| 442 | 442 | <?php endif; ?> | 
| 443 | 443 | </td> | 
| @@ -463,38 +463,38 @@ discard block | ||
| 463 | 463 | */ | 
| 464 | 464 |  function ppp_render_tweet_share_on_publish_row() { | 
| 465 | 465 | global $post, $ppp_share_settings; | 
| 466 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 466 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); | |
| 467 | 467 | |
| 468 | 468 | $ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true ); | 
| 469 | 469 | |
| 470 | 470 | $ppp_share_on_publish = get_post_meta( $post->ID, '_ppp_share_on_publish', true ); | 
| 471 | 471 | $show_share_on_publish = false; | 
| 472 | 472 | |
| 473 | - $share_by_default = empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? false : true; | |
| 473 | + $share_by_default = empty($ppp_share_settings['twitter']['share_on_publish']) ? false : true; | |
| 474 | 474 | |
| 475 | -	if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) { | |
| 475 | +	if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) { | |
| 476 | 476 | $show_share_on_publish = true; | 
| 477 | 477 | } | 
| 478 | 478 | |
| 479 | 479 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); | 
| 480 | 480 | $ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); | 
| 481 | 481 | |
| 482 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; | |
| 482 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; | |
| 483 | 483 | ?> | 
| 484 | 484 | <tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row"> | 
| 485 | 485 | <td colspan="2" class="ppp-on-plublish-date-column"> | 
| 486 | - <input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> /> | |
| 486 | + <input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> /> | |
| 487 | 487 |  <label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label> | 
| 488 | 488 | </td> | 
| 489 | 489 | |
| 490 | 490 | <td> | 
| 491 | - <input <?php if ( $disabled ): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" /> | |
| 492 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> | |
| 491 | + <input <?php if ($disabled): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" /> | |
| 492 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> | |
| 493 | 493 |  <span class="ppp-text-length"><?php echo $length; ?></span> | 
| 494 | 494 | </td> | 
| 495 | 495 | |
| 496 | 496 | <td style="width: 200px" colspan="2"> | 
| 497 | - <input class="ppp-tw-featured-image-input" <?php if ( $disabled ): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/> | |
| 497 | + <input class="ppp-tw-featured-image-input" <?php if ($disabled): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/> | |
| 498 | 498 |  <label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label> | 
| 499 | 499 | </td> | 
| 500 | 500 | |
| @@ -513,13 +513,13 @@ discard block | ||
| 513 | 513 |  function ppp_render_tweet_row( $key, $args = array(), $post_id ) { | 
| 514 | 514 | global $post, $has_past_shares; | 
| 515 | 515 | |
| 516 | - $share_time = strtotime( $args['date'] . ' ' . $args['time'] ); | |
| 516 | + $share_time = strtotime( $args['date'].' '.$args['time'] ); | |
| 517 | 517 | $readonly = current_time( 'timestamp' ) > $share_time ? 'readonly="readonly" ' : false; | 
| 518 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; | |
| 519 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; | |
| 520 | - $shared = ! empty( $readonly ) ? 'past-share' : ''; | |
| 518 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; | |
| 519 | + $hide = ! empty($readonly) ? 'display: none;' : ''; | |
| 520 | + $shared = ! empty($readonly) ? 'past-share' : ''; | |
| 521 | 521 | |
| 522 | -	if ( ! empty( $readonly ) ) { | |
| 522 | +	if ( ! empty($readonly)) { | |
| 523 | 523 | $has_past_shares++; | 
| 524 | 524 | } | 
| 525 | 525 | ?> | 
| @@ -534,7 +534,7 @@ discard block | ||
| 534 | 534 | |
| 535 | 535 | <td> | 
| 536 | 536 | <input <?php echo $readonly; ?>class="ppp-tweet-text-repeatable" type="text" name="_ppp_tweets[<?php echo $key; ?>][text]" value="<?php echo esc_attr( $args['text'] ); ?>" /> | 
| 537 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> | |
| 537 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> | |
| 538 | 538 |  <span class="ppp-text-length"><?php echo $length; ?></span> | 
| 539 | 539 | </td> | 
| 540 | 540 | |
| @@ -553,7 +553,7 @@ discard block | ||
| 553 | 553 | </td> | 
| 554 | 554 | |
| 555 | 555 | <td> | 
| 556 | -			<a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 556 | + <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">×</a> | |
| 557 | 557 | </td> | 
| 558 | 558 | |
| 559 | 559 | </tr> | 
| @@ -568,24 +568,24 @@ discard block | ||
| 568 | 568 | */ | 
| 569 | 569 |  function ppp_tw_save_post_meta_boxes( $post_id, $post ) { | 
| 570 | 570 | |
| 571 | -	if ( ! ppp_should_save( $post_id, $post ) ) { | |
| 571 | +	if ( ! ppp_should_save( $post_id, $post )) { | |
| 572 | 572 | return; | 
| 573 | 573 | } | 
| 574 | 574 | |
| 575 | - $ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0'; | |
| 575 | + $ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0'; | |
| 576 | 576 | |
| 577 | - $ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0'; | |
| 578 | - $ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; | |
| 579 | - $ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; | |
| 577 | + $ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0'; | |
| 578 | + $ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; | |
| 579 | + $ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; | |
| 580 | 580 | |
| 581 | 581 | |
| 582 | 582 | update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish ); | 
| 583 | 583 | update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text ); | 
| 584 | 584 | update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image ); | 
| 585 | 585 | |
| 586 | - $tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array(); | |
| 587 | -	foreach ( $tweet_data as $index => $tweet ) { | |
| 588 | - $tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] ); | |
| 586 | + $tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array(); | |
| 587 | +	foreach ($tweet_data as $index => $tweet) { | |
| 588 | + $tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] ); | |
| 589 | 589 | } | 
| 590 | 590 | update_post_meta( $post_id, '_ppp_tweets', $tweet_data ); | 
| 591 | 591 | |
| @@ -603,28 +603,28 @@ discard block | ||
| 603 | 603 | global $ppp_options; | 
| 604 | 604 | |
| 605 | 605 | $from_meta = get_post_meta( $post->ID, '_ppp_share_on_publish', true ); | 
| 606 | - $from_post = isset( $_POST['_ppp_share_on_publish'] ); | |
| 606 | + $from_post = isset($_POST['_ppp_share_on_publish']); | |
| 607 | 607 | |
| 608 | -	if ( empty( $from_meta ) && empty( $from_post ) ) { | |
| 608 | +	if (empty($from_meta) && empty($from_post)) { | |
| 609 | 609 | return; | 
| 610 | 610 | } | 
| 611 | 611 | |
| 612 | 612 | // Determine if we're seeing the share on publish in meta or $_POST | 
| 613 | -	if ( $from_meta && !$from_post ) { | |
| 613 | +	if ($from_meta && ! $from_post) { | |
| 614 | 614 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); | 
| 615 | 615 | $use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); | 
| 616 | 616 |  	} else { | 
| 617 | - $ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : ''; | |
| 618 | - $use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false; | |
| 617 | + $ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : ''; | |
| 618 | + $use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false; | |
| 619 | 619 | } | 
| 620 | 620 | |
| 621 | - $share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); | |
| 621 | + $share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); | |
| 622 | 622 | $share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) ); | 
| 623 | - $name = 'sharedate_0_' . $post->ID; | |
| 623 | + $name = 'sharedate_0_'.$post->ID; | |
| 624 | 624 | $media = ppp_post_has_media( $post->ID, 'tw', $use_media ); | 
| 625 | 625 | $share_link = ppp_generate_link( $post->ID, $name, true ); | 
| 626 | 626 | |
| 627 | - $status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media ); | |
| 627 | + $status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media ); | |
| 628 | 628 | |
| 629 | 629 | $log_title = ppp_tw_build_share_message( $post->ID, $name, false, false ); | 
| 630 | 630 | |
| @@ -641,11 +641,11 @@ discard block | ||
| 641 | 641 | |
| 642 | 642 | $log_entry = WP_Logging::insert_log( $log_data, $log_meta ); | 
| 643 | 643 | |
| 644 | -	if ( ! empty( $status->id_str ) ) { | |
| 644 | +	if ( ! empty($status->id_str)) { | |
| 645 | 645 | $author_id = $post->post_author; | 
| 646 | 646 | $author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true ); | 
| 647 | 647 | |
| 648 | -		if ( $author_rt ) { | |
| 648 | +		if ($author_rt) { | |
| 649 | 649 | $twitter_user = new PPP_Twitter_User( $author_id ); | 
| 650 | 650 | $twitter_user->retweet( $status->id_str ); | 
| 651 | 651 | } | 
| @@ -665,20 +665,20 @@ discard block | ||
| 665 | 665 |  function ppp_tw_generate_timestamps( $times, $post_id ) { | 
| 666 | 666 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 667 | 667 | |
| 668 | -	if ( empty( $ppp_tweets ) ) { | |
| 668 | +	if (empty($ppp_tweets)) { | |
| 669 | 669 | $ppp_tweets = array(); | 
| 670 | 670 | } | 
| 671 | 671 | |
| 672 | -	foreach ( $ppp_tweets as $key => $data ) { | |
| 673 | -		if ( ! array_filter( $data ) ) { | |
| 672 | +	foreach ($ppp_tweets as $key => $data) { | |
| 673 | +		if ( ! array_filter( $data )) { | |
| 674 | 674 | continue; | 
| 675 | 675 | } | 
| 676 | 676 | |
| 677 | 677 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); | 
| 678 | 678 | |
| 679 | -		if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future | |
| 680 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw'; | |
| 681 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw'; | |
| 679 | +		if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future | |
| 680 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw'; | |
| 681 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw'; | |
| 682 | 682 | } | 
| 683 | 683 | |
| 684 | 684 | } | 
| @@ -698,7 +698,7 @@ discard block | ||
| 698 | 698 | |
| 699 | 699 | $ret = false; | 
| 700 | 700 | |
| 701 | -	if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) { | |
| 701 | +	if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) { | |
| 702 | 702 | $ret = true; | 
| 703 | 703 | } | 
| 704 | 704 | |
| @@ -713,13 +713,13 @@ discard block | ||
| 713 | 713 | */ | 
| 714 | 714 |  function ppp_tw_card_meta() { | 
| 715 | 715 | |
| 716 | -	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) { | |
| 716 | +	if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) { | |
| 717 | 717 | return; | 
| 718 | 718 | } | 
| 719 | 719 | |
| 720 | 720 | global $post, $ppp_options; | 
| 721 | 721 | |
| 722 | -	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { | |
| 722 | +	if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { | |
| 723 | 723 | return; | 
| 724 | 724 | } | 
| 725 | 725 | |
| @@ -737,20 +737,20 @@ discard block | ||
| 737 | 737 | |
| 738 | 738 | $return = ''; | 
| 739 | 739 | |
| 740 | -	if ( ! is_single() || ! ppp_tw_cards_enabled() ) { | |
| 740 | +	if ( ! is_single() || ! ppp_tw_cards_enabled()) { | |
| 741 | 741 | return $return; | 
| 742 | 742 | } | 
| 743 | 743 | |
| 744 | 744 | global $post, $ppp_social_settings; | 
| 745 | 745 | |
| 746 | 746 | |
| 747 | -	if ( empty( $post ) ) { | |
| 747 | +	if (empty($post)) { | |
| 748 | 748 | return; | 
| 749 | 749 | } | 
| 750 | 750 | |
| 751 | 751 | $elements = ppp_tw_default_meta_elements(); | 
| 752 | -	foreach ( $elements as $name => $content ) { | |
| 753 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; | |
| 752 | +	foreach ($elements as $name => $content) { | |
| 753 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; | |
| 754 | 754 | } | 
| 755 | 755 | |
| 756 | 756 | return apply_filters( 'ppp_tw_card_meta', $return ); | 
| @@ -770,22 +770,22 @@ discard block | ||
| 770 | 770 | $elements = array(); | 
| 771 | 771 | |
| 772 | 772 | $image_url = ppp_post_has_media( $post->ID, 'tw', true ); | 
| 773 | -	if ( $image_url ) { | |
| 773 | +	if ($image_url) { | |
| 774 | 774 | $elements['twitter:card'] = 'summary_large_image'; | 
| 775 | 775 | $elements['twitter:image:src'] = $image_url; | 
| 776 | 776 |  	} else { | 
| 777 | 777 | $elements['twitter:card'] = 'summary'; | 
| 778 | 778 | } | 
| 779 | 779 | |
| 780 | - $elements['twitter:site'] = '@' . $ppp_social_settings['twitter']['user']->screen_name; | |
| 780 | + $elements['twitter:site'] = '@'.$ppp_social_settings['twitter']['user']->screen_name; | |
| 781 | 781 | $elements['twitter:title'] = esc_attr( strip_tags( $post->post_title ) ); | 
| 782 | 782 | $elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() ); | 
| 783 | 783 | |
| 784 | 784 | $author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true ); | 
| 785 | -	if ( ! empty( $author_twitter_handle ) ) { | |
| 785 | +	if ( ! empty($author_twitter_handle)) { | |
| 786 | 786 | |
| 787 | -		if ( strpos( $author_twitter_handle, '@' ) === false ) { | |
| 788 | - $author_twitter_handle = '@' . $author_twitter_handle; | |
| 787 | +		if (strpos( $author_twitter_handle, '@' ) === false) { | |
| 788 | + $author_twitter_handle = '@'.$author_twitter_handle; | |
| 789 | 789 | } | 
| 790 | 790 | |
| 791 | 791 | $elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) ); | 
| @@ -804,13 +804,13 @@ discard block | ||
| 804 | 804 |  function ppp_tw_get_card_description() { | 
| 805 | 805 | global $post; | 
| 806 | 806 | |
| 807 | -	if ( ! is_single() || empty( $post ) ) { | |
| 807 | +	if ( ! is_single() || empty($post)) { | |
| 808 | 808 | return false; | 
| 809 | 809 | } | 
| 810 | 810 | |
| 811 | 811 | $excerpt = $post->post_excerpt; | 
| 812 | 812 | |
| 813 | -	if ( empty( $excerpt ) ) { | |
| 813 | +	if (empty($excerpt)) { | |
| 814 | 814 | $excerpt = ppp_tw_format_card_description( $post->content ); | 
| 815 | 815 | } | 
| 816 | 816 | |
| @@ -828,10 +828,10 @@ discard block | ||
| 828 | 828 | $max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 ); | 
| 829 | 829 | $excerpt = strip_tags( $excerpt ); | 
| 830 | 830 | |
| 831 | -	if ( strlen( $excerpt ) > $max_len ) { | |
| 831 | +	if (strlen( $excerpt ) > $max_len) { | |
| 832 | 832 | $excerpt_pre = substr( $excerpt, 0, $max_len ); | 
| 833 | 833 | $last_space = strrpos( $excerpt_pre, ' ' ); | 
| 834 | - $excerpt = substr( $excerpt_pre, 0, $last_space ) . '...'; | |
| 834 | + $excerpt = substr( $excerpt_pre, 0, $last_space ).'...'; | |
| 835 | 835 | } | 
| 836 | 836 | |
| 837 | 837 | return $excerpt; | 
| @@ -846,7 +846,7 @@ discard block | ||
| 846 | 846 | */ | 
| 847 | 847 |  function ppp_tw_add_contact_method( $user_contactmethods ) { | 
| 848 | 848 | |
| 849 | -	if ( ! isset( $user_contactmethods['twitter'] ) ) { | |
| 849 | +	if ( ! isset($user_contactmethods['twitter'])) { | |
| 850 | 850 | $user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' ); | 
| 851 | 851 | } | 
| 852 | 852 | // Returns the contact methods | 
| @@ -864,11 +864,11 @@ discard block | ||
| 864 | 864 | */ | 
| 865 | 865 |  function ppp_tw_profile_settings( $user ) { | 
| 866 | 866 | |
| 867 | -	if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) { | |
| 867 | +	if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) { | |
| 868 | 868 | return; | 
| 869 | 869 | } | 
| 870 | 870 | |
| 871 | -	if ( $user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' ) ) { | |
| 871 | +	if ($user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' )) { | |
| 872 | 872 | return; | 
| 873 | 873 | } | 
| 874 | 874 | |
| @@ -882,16 +882,16 @@ discard block | ||
| 882 | 882 | <?php | 
| 883 | 883 | $twitter = new PPP_Twitter_User( get_current_user_id() ); | 
| 884 | 884 | $tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true ); | 
| 885 | -			if ( empty( $tw_user ) ) { | |
| 886 | - $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ); | |
| 885 | +			if (empty($tw_user)) { | |
| 886 | + $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) ); | |
| 887 | 887 | |
| 888 | - echo '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; | |
| 888 | + echo '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; | |
| 889 | 889 |  			} else { | 
| 890 | 890 | $connected = true; | 
| 891 | 891 | ?> | 
| 892 | 892 | <p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p> | 
| 893 | 893 | <p> | 
| 894 | - <a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id=' . $user->ID . '&ppp_social_disconnect=true&ppp_network=twitter&user_id=' . $user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>  | |
| 894 | + <a class="button-primary" href="<?php echo admin_url( 'user-edit.php?user_id='.$user->ID.'&ppp_social_disconnect=true&ppp_network=twitter&user_id='.$user->ID ); ?>" ><?php _e( 'Disconnect from Twitter', 'ppp-txt' ); ?></a>  | |
| 895 | 895 | <a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a> | 
| 896 | 896 | </p> | 
| 897 | 897 | <?php | 
| @@ -900,10 +900,10 @@ discard block | ||
| 900 | 900 | </td> | 
| 901 | 901 | </tr> | 
| 902 | 902 | |
| 903 | - <?php if ( $connected ) : ?> | |
| 903 | + <?php if ($connected) : ?> | |
| 904 | 904 | <?php | 
| 905 | 905 | $share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true ); | 
| 906 | - $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled' , true ); | |
| 906 | + $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled', true ); | |
| 907 | 907 | ?> | 
| 908 | 908 | <tr> | 
| 909 | 909 | <th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th> | 
| @@ -936,11 +936,11 @@ discard block | ||
| 936 | 936 | */ | 
| 937 | 937 |  function ppp_tw_save_profile( $user_id ) { | 
| 938 | 938 | |
| 939 | - $share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false; | |
| 940 | - $share_scheduled = ! empty( $_POST['share_scheduled'] ) ? true : false; | |
| 939 | + $share_on_publish = ! empty($_POST['share_on_publish']) ? true : false; | |
| 940 | + $share_scheduled = ! empty($_POST['share_scheduled']) ? true : false; | |
| 941 | 941 | |
| 942 | 942 | update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish ); | 
| 943 | - update_user_meta( $user_id, '_ppp_share_scheduled' , $share_scheduled ); | |
| 943 | + update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); | |
| 944 | 944 | |
| 945 | 945 | } | 
| 946 | 946 | add_action( 'personal_options_update', 'ppp_tw_save_profile' ); | 
| @@ -949,14 +949,14 @@ discard block | ||
| 949 | 949 |  function ppp_tw_calendar_on_publish_event( $events, $post_id ) { | 
| 950 | 950 | $share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true ); | 
| 951 | 951 | |
| 952 | -	if ( ! empty( $share_on_publish ) ) { | |
| 952 | +	if ( ! empty($share_on_publish)) { | |
| 953 | 953 | $share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true ); | 
| 954 | 954 | $events[] = array( | 
| 955 | - 'id' => $post_id . '-share-on-publish', | |
| 956 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), | |
| 957 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), | |
| 958 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), | |
| 959 | - 'className' => 'ppp-calendar-item-tw cal-post-' . $post_id, | |
| 955 | + 'id' => $post_id.'-share-on-publish', | |
| 956 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), | |
| 957 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), | |
| 958 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), | |
| 959 | + 'className' => 'ppp-calendar-item-tw cal-post-'.$post_id, | |
| 960 | 960 | 'belongsTo' => $post_id, | 
| 961 | 961 | ); | 
| 962 | 962 | } | 
| @@ -967,9 +967,9 @@ discard block | ||
| 967 | 967 | |
| 968 | 968 |  function ppp_tw_get_post_shares( $items, $post_id ) { | 
| 969 | 969 | $tweets = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 970 | -	if ( empty( $tweets ) ) { return $items; } | |
| 970 | +	if (empty($tweets)) { return $items; } | |
| 971 | 971 | |
| 972 | -	foreach ( $tweets as $key => $tweet ) { | |
| 972 | +	foreach ($tweets as $key => $tweet) { | |
| 973 | 973 | $items[] = array( 'id' => $key, 'service' => 'tw' ); | 
| 974 | 974 | } | 
| 975 | 975 | return $items; | 
| @@ -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 | |
| @@ -16,17 +16,17 @@ discard block | ||
| 16 | 16 | */ | 
| 17 | 17 |  function ppp_share_on_publish( $new_status, $old_status, $post ) { | 
| 18 | 18 | // don't publish password protected posts | 
| 19 | -	if ( '' !== $post->post_password ) { | |
| 19 | +	if ('' !== $post->post_password) { | |
| 20 | 20 | return; | 
| 21 | 21 | } | 
| 22 | 22 | |
| 23 | -	if ( $new_status == 'publish' && $old_status != 'publish' ) { | |
| 23 | +	if ($new_status == 'publish' && $old_status != 'publish') { | |
| 24 | 24 | global $ppp_options; | 
| 25 | 25 | |
| 26 | - $allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array(); | |
| 26 | + $allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array(); | |
| 27 | 27 | $allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types ); | 
| 28 | 28 | |
| 29 | -		if ( !isset( $post->post_status ) || !array_key_exists( $post->post_type, $allowed_post_types ) ) { | |
| 29 | +		if ( ! isset($post->post_status) || ! array_key_exists( $post->post_type, $allowed_post_types )) { | |
| 30 | 30 | return false; | 
| 31 | 31 | } | 
| 32 | 32 | |
| @@ -57,20 +57,20 @@ discard block | ||
| 57 | 57 | |
| 58 | 58 | // If we've already started to share this, don't share it again. | 
| 59 | 59 | // Compensates for wp-cron's race conditions | 
| 60 | -	if ( get_transient( 'ppp_sharing' . $name ) === 'true' ) { | |
| 60 | +	if (get_transient( 'ppp_sharing'.$name ) === 'true') { | |
| 61 | 61 | return; | 
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | // For 10 seconds, don't allow another share to go for this post | 
| 65 | - set_transient( 'ppp_sharing' . $name, 'true', 10 ); | |
| 65 | + set_transient( 'ppp_sharing'.$name, 'true', 10 ); | |
| 66 | 66 | |
| 67 | 67 | $name_parts = explode( '_', $name ); | 
| 68 | 68 | $index = $name_parts[1]; | 
| 69 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; | |
| 69 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; | |
| 70 | 70 | |
| 71 | 71 | // If we're fired on a cron, check for stale cron runs | 
| 72 | -	if ( defined( 'DOING_CRON' ) && DOING_CRON ) { | |
| 73 | -		switch( $service ) { | |
| 72 | +	if (defined( 'DOING_CRON' ) && DOING_CRON) { | |
| 73 | +		switch ($service) { | |
| 74 | 74 | case 'tw': | 
| 75 | 75 | $post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); | 
| 76 | 76 | break; | 
| @@ -85,20 +85,20 @@ discard block | ||
| 85 | 85 | } | 
| 86 | 86 | |
| 87 | 87 | $share_data = array(); | 
| 88 | -		if ( isset( $post_meta[ $index ] ) ) { | |
| 89 | - $share_data = $post_meta[ $index ]; | |
| 88 | +		if (isset($post_meta[$index])) { | |
| 89 | + $share_data = $post_meta[$index]; | |
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | 92 | $timestamp = ppp_generate_timestamp( $share_data['date'], $share_data['time'] ); | 
| 93 | 93 | |
| 94 | 94 | // If the current time is more than 60 minutes (filterable) overdue, don't fire the share | 
| 95 | 95 | $share_buffer = apply_filters( 'ppp_share_buffer', HOUR_IN_SECONDS ); | 
| 96 | -		if ( ( current_time( 'timestamp', 1 ) - $timestamp ) > $share_buffer ) { | |
| 96 | +		if ((current_time( 'timestamp', 1 ) - $timestamp) > $share_buffer) { | |
| 97 | 97 | return; | 
| 98 | 98 | } | 
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | - do_action( 'ppp_share_scheduled_' . $service, $post_id, $index, $name ); | |
| 101 | + do_action( 'ppp_share_scheduled_'.$service, $post_id, $index, $name ); | |
| 102 | 102 | |
| 103 | 103 | } | 
| 104 | 104 | |
| @@ -107,26 +107,26 @@ discard block | ||
| 107 | 107 | * @return void | 
| 108 | 108 | */ | 
| 109 | 109 |  function ppp_set_social_tokens() { | 
| 110 | - if ( ( defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' ) ) || | |
| 111 | - ( defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' ) ) || | |
| 112 | - ( defined( 'bitly_clientid' ) && defined( 'bitly_secret' ) ) || | |
| 113 | - ( defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' ) ) | |
| 110 | + if ((defined( 'PPP_TW_CONSUMER_KEY' ) && defined( 'PPP_TW_CONSUMER_SECRET' )) || | |
| 111 | + (defined( 'LINKEDIN_KEY' ) && defined( 'LINKEDIN_SECRET' )) || | |
| 112 | + (defined( 'bitly_clientid' ) && defined( 'bitly_secret' )) || | |
| 113 | + (defined( 'PPP_FB_APP_ID' ) && defined( 'PPP_FB_APP_SECRET' )) | |
| 114 | 114 |  	   ) { | 
| 115 | 115 | return; | 
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | 118 | $social_tokens = ppp_has_local_tokens(); | 
| 119 | 119 | |
| 120 | -	if ( false === $social_tokens ) { | |
| 120 | +	if (false === $social_tokens) { | |
| 121 | 121 | define( 'PPP_LOCAL_TOKENS', false ); | 
| 122 | 122 | $social_tokens = get_transient( 'ppp_social_tokens' ); | 
| 123 | 123 | |
| 124 | -		if ( ! $social_tokens ) { | |
| 124 | +		if ( ! $social_tokens) { | |
| 125 | 125 | $license = trim( get_option( '_ppp_license_key' ) ); | 
| 126 | - $url = PPP_STORE_URL . '/?ppp-get-tokens&ppp-license-key=' . $license . '&ver=' . md5( time() . $license ); | |
| 126 | + $url = PPP_STORE_URL.'/?ppp-get-tokens&ppp-license-key='.$license.'&ver='.md5( time().$license ); | |
| 127 | 127 | $response = wp_remote_get( $url, array( 'timeout' => 15, 'sslverify' => false ) ); | 
| 128 | 128 | |
| 129 | -			if ( is_wp_error( $response ) ) { | |
| 129 | +			if (is_wp_error( $response )) { | |
| 130 | 130 | return false; | 
| 131 | 131 | } | 
| 132 | 132 | |
| @@ -138,16 +138,16 @@ discard block | ||
| 138 | 138 | define( 'PPP_LOCAL_TOKENS', true ); | 
| 139 | 139 | delete_transient( 'ppp_social_tokens' ); | 
| 140 | 140 | |
| 141 | -		if ( isset( $social_tokens->options ) ) { | |
| 142 | -			foreach ( $social_tokens->options as $constant => $value ) { | |
| 141 | +		if (isset($social_tokens->options)) { | |
| 142 | +			foreach ($social_tokens->options as $constant => $value) { | |
| 143 | 143 | |
| 144 | 144 | $constant = strtoupper( $constant ); | 
| 145 | 145 | |
| 146 | -				if ( defined( $constant ) ) { | |
| 146 | +				if (defined( $constant )) { | |
| 147 | 147 | continue; | 
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | -				switch( $constant ) { | |
| 150 | +				switch ($constant) { | |
| 151 | 151 | |
| 152 | 152 | case 'NO_AUTO_UPDATE': | 
| 153 | 153 | // Avoid the call to the API to check for software updates | 
| @@ -160,7 +160,7 @@ discard block | ||
| 160 | 160 | } | 
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | -	if ( false === PPP_LOCAL_TOKENS && ! isset( $social_tokens->error ) && ( isset( $social_tokens->twitter ) || isset( $social_tokens->facebook ) || isset( $social_tokens->linkedin ) ) ) { | |
| 163 | +	if (false === PPP_LOCAL_TOKENS && ! isset($social_tokens->error) && (isset($social_tokens->twitter) || isset($social_tokens->facebook) || isset($social_tokens->linkedin))) { | |
| 164 | 164 | set_transient( 'ppp_social_tokens', $social_tokens, WEEK_IN_SECONDS ); | 
| 165 | 165 | } | 
| 166 | 166 | |
| @@ -173,22 +173,22 @@ discard block | ||
| 173 | 173 | */ | 
| 174 | 174 |  function ppp_has_local_tokens() { | 
| 175 | 175 | |
| 176 | - $token_file = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path() . '/ppp-social-tokens.json' ); | |
| 176 | + $token_file = apply_filters( 'ppp_local_social_token_path', ppp_get_upload_path().'/ppp-social-tokens.json' ); | |
| 177 | 177 | $local_tokens = false; | 
| 178 | 178 | |
| 179 | -	if ( ! file_exists( $token_file ) ) { | |
| 179 | +	if ( ! file_exists( $token_file )) { | |
| 180 | 180 | return $local_tokens; | 
| 181 | 181 | } | 
| 182 | 182 | |
| 183 | 183 | $local_tokens = json_decode( file_get_contents( $token_file ) ); | 
| 184 | 184 | |
| 185 | 185 | // Failed to parse as JSON | 
| 186 | -	if ( false === $local_tokens ) { | |
| 186 | +	if (false === $local_tokens) { | |
| 187 | 187 | return $local_tokens; | 
| 188 | 188 | } | 
| 189 | 189 | |
| 190 | 190 | // No social tokens found in the format we accept or it was empty | 
| 191 | -	if ( empty( $local_tokens ) || ( ! isset( $local_tokens->twitter ) || ! isset( $local_tokens->facebook ) || ! isset( $local_tokens->linkedin ) ) ) { | |
| 191 | +	if (empty($local_tokens) || ( ! isset($local_tokens->twitter) || ! isset($local_tokens->facebook) || ! isset($local_tokens->linkedin))) { | |
| 192 | 192 | return false; | 
| 193 | 193 | } | 
| 194 | 194 | |
| @@ -206,13 +206,13 @@ discard block | ||
| 206 | 206 | global $ppp_share_settings; | 
| 207 | 207 | $share_link = get_permalink( $post_id ); | 
| 208 | 208 | |
| 209 | -	if ( ppp_link_tracking_enabled() ) { | |
| 209 | +	if (ppp_link_tracking_enabled()) { | |
| 210 | 210 | $share_link = ppp_generate_link_tracking( $share_link, $post_id, $name ); | 
| 211 | 211 | } | 
| 212 | 212 | |
| 213 | -	if ( ppp_is_shortener_enabled() && $scheduled ) { | |
| 213 | +	if (ppp_is_shortener_enabled() && $scheduled) { | |
| 214 | 214 | $shortener_name = $ppp_share_settings['shortener']; | 
| 215 | - $share_link = apply_filters( 'ppp_apply_shortener-' . $shortener_name, $share_link ); | |
| 215 | + $share_link = apply_filters( 'ppp_apply_shortener-'.$shortener_name, $share_link ); | |
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 | |
| @@ -227,13 +227,13 @@ discard block | ||
| 227 | 227 | * @return string The URL to post, with proper analytics applied if necessary | 
| 228 | 228 | */ | 
| 229 | 229 |  function ppp_generate_link_tracking( $share_link, $post_id, $name ) { | 
| 230 | -	if ( ppp_link_tracking_enabled() ) { | |
| 230 | +	if (ppp_link_tracking_enabled()) { | |
| 231 | 231 | global $ppp_share_settings; | 
| 232 | 232 | $link_tracking_type = $ppp_share_settings['analytics']; | 
| 233 | 233 | |
| 234 | 234 | // Given the setting name, devs can extend this and apply a filter of ppp_analytics-[setting value] | 
| 235 | 235 | // to apply their own rules for link tracking | 
| 236 | - $share_link = apply_filters( 'ppp_analytics-' . $link_tracking_type, $share_link, $post_id, $name ); | |
| 236 | + $share_link = apply_filters( 'ppp_analytics-'.$link_tracking_type, $share_link, $post_id, $name ); | |
| 237 | 237 | } | 
| 238 | 238 | |
| 239 | 239 | $share_link = apply_filters( 'ppp_generate_link_tracking', $share_link, $post_id, $name ); | 
| @@ -249,14 +249,14 @@ discard block | ||
| 249 | 249 | * @return mixed If a thumbnail is found returns the URL, otherwise returns false | 
| 250 | 250 | */ | 
| 251 | 251 |  function ppp_post_has_media( $post_id, $network, $use_media, $attachment_id = false ) { | 
| 252 | -	if ( !$use_media || empty( $post_id ) || empty( $network ) ) { | |
| 252 | +	if ( ! $use_media || empty($post_id) || empty($network)) { | |
| 253 | 253 | return false; | 
| 254 | 254 | } | 
| 255 | 255 | |
| 256 | - $thumb_id = empty( $attachment_id ) ? get_post_thumbnail_id( $post_id ) : $attachment_id; | |
| 257 | - $thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-' . $network . '-share-image', true ); | |
| 256 | + $thumb_id = empty($attachment_id) ? get_post_thumbnail_id( $post_id ) : $attachment_id; | |
| 257 | + $thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-'.$network.'-share-image', true ); | |
| 258 | 258 | |
| 259 | -	if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) { | |
| 259 | +	if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) { | |
| 260 | 260 | return $thumb_url[0]; | 
| 261 | 261 | } | 
| 262 | 262 | |
| @@ -4,7 +4,7 @@ discard block | ||
| 4 | 4 | //set_site_transient( 'update_plugins', null ); | 
| 5 | 5 | |
| 6 | 6 | // Exit if accessed directly | 
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 7 | +if ( ! defined( 'ABSPATH' )) exit; | |
| 8 | 8 | |
| 9 | 9 | /** | 
| 10 | 10 | * Allows plugins to use their own update API. | 
| @@ -40,9 +40,9 @@ discard block | ||
| 40 | 40 | $this->name = plugin_basename( $_plugin_file ); | 
| 41 | 41 | $this->slug = basename( $_plugin_file, '.php' ); | 
| 42 | 42 | $this->version = $_api_data['version']; | 
| 43 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; | |
| 43 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; | |
| 44 | 44 | |
| 45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; | |
| 45 | + $edd_plugin_data[$this->slug] = $this->api_data; | |
| 46 | 46 | |
| 47 | 47 | // Set up hooks. | 
| 48 | 48 | $this->init(); | 
| @@ -60,8 +60,8 @@ discard block | ||
| 60 | 60 | |
| 61 | 61 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); | 
| 62 | 62 | add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); | 
| 63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 ); | |
| 64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); | |
| 63 | + remove_action( 'after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10, 2 ); | |
| 64 | + add_action( 'after_plugin_row_'.$this->name, array( $this, 'show_update_notification' ), 10, 2 ); | |
| 65 | 65 | add_action( 'admin_init', array( $this, 'show_changelog' ) ); | 
| 66 | 66 | |
| 67 | 67 | } | 
| @@ -83,30 +83,30 @@ discard block | ||
| 83 | 83 | |
| 84 | 84 | global $pagenow; | 
| 85 | 85 | |
| 86 | -		if ( ! is_object( $_transient_data ) ) { | |
| 86 | +		if ( ! is_object( $_transient_data )) { | |
| 87 | 87 | $_transient_data = new stdClass; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | -		if ( 'plugins.php' == $pagenow && is_multisite() ) { | |
| 90 | +		if ('plugins.php' == $pagenow && is_multisite()) { | |
| 91 | 91 | return $_transient_data; | 
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | -		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { | |
| 94 | +		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { | |
| 95 | 95 | return $_transient_data; | 
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); | 
| 99 | 99 | |
| 100 | -		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { | |
| 100 | +		if (false !== $version_info && is_object( $version_info ) && isset($version_info->new_version)) { | |
| 101 | 101 | |
| 102 | -			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { | |
| 102 | +			if (version_compare( $this->version, $version_info->new_version, '<' )) { | |
| 103 | 103 | |
| 104 | - $_transient_data->response[ $this->name ] = $version_info; | |
| 104 | + $_transient_data->response[$this->name] = $version_info; | |
| 105 | 105 | |
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | 108 | $_transient_data->last_checked = time(); | 
| 109 | - $_transient_data->checked[ $this->name ] = $this->version; | |
| 109 | + $_transient_data->checked[$this->name] = $this->version; | |
| 110 | 110 | |
| 111 | 111 | } | 
| 112 | 112 | |
| @@ -121,15 +121,15 @@ discard block | ||
| 121 | 121 | */ | 
| 122 | 122 |  	public function show_update_notification( $file, $plugin ) { | 
| 123 | 123 | |
| 124 | -		if( ! current_user_can( 'update_plugins' ) ) { | |
| 124 | +		if ( ! current_user_can( 'update_plugins' )) { | |
| 125 | 125 | return; | 
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | -		if( ! is_multisite() ) { | |
| 128 | +		if ( ! is_multisite()) { | |
| 129 | 129 | return; | 
| 130 | 130 | } | 
| 131 | 131 | |
| 132 | -		if ( $this->name != $file ) { | |
| 132 | +		if ($this->name != $file) { | |
| 133 | 133 | return; | 
| 134 | 134 | } | 
| 135 | 135 | |
| @@ -140,55 +140,55 @@ discard block | ||
| 140 | 140 | |
| 141 | 141 | $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); | 
| 142 | 142 | |
| 143 | -		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { | |
| 143 | +		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { | |
| 144 | 144 | |
| 145 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' ); | |
| 145 | + $cache_key = md5( 'edd_plugin_'.sanitize_key( $this->name ).'_version_info' ); | |
| 146 | 146 | $version_info = get_transient( $cache_key ); | 
| 147 | 147 | |
| 148 | -			if( false === $version_info ) { | |
| 148 | +			if (false === $version_info) { | |
| 149 | 149 | |
| 150 | 150 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); | 
| 151 | 151 | |
| 152 | 152 | set_transient( $cache_key, $version_info, 3600 ); | 
| 153 | 153 | } | 
| 154 | 154 | |
| 155 | -			if( ! is_object( $version_info ) ) { | |
| 155 | +			if ( ! is_object( $version_info )) { | |
| 156 | 156 | return; | 
| 157 | 157 | } | 
| 158 | 158 | |
| 159 | -			if( version_compare( $this->version, $version_info->new_version, '<' ) ) { | |
| 159 | +			if (version_compare( $this->version, $version_info->new_version, '<' )) { | |
| 160 | 160 | |
| 161 | - $update_cache->response[ $this->name ] = $version_info; | |
| 161 | + $update_cache->response[$this->name] = $version_info; | |
| 162 | 162 | |
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | 165 | $update_cache->last_checked = time(); | 
| 166 | - $update_cache->checked[ $this->name ] = $this->version; | |
| 166 | + $update_cache->checked[$this->name] = $this->version; | |
| 167 | 167 | |
| 168 | 168 | set_site_transient( 'update_plugins', $update_cache ); | 
| 169 | 169 | |
| 170 | 170 |  		} else { | 
| 171 | 171 | |
| 172 | - $version_info = $update_cache->response[ $this->name ]; | |
| 172 | + $version_info = $update_cache->response[$this->name]; | |
| 173 | 173 | |
| 174 | 174 | } | 
| 175 | 175 | |
| 176 | 176 | // Restore our filter | 
| 177 | 177 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); | 
| 178 | 178 | |
| 179 | -		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { | |
| 179 | +		if ( ! empty($update_cache->response[$this->name]) && version_compare( $this->version, $version_info->new_version, '<' )) { | |
| 180 | 180 | |
| 181 | 181 | // build a plugin list row, with update notification | 
| 182 | 182 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); | 
| 183 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; | |
| 183 | + echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">'; | |
| 184 | 184 | |
| 185 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); | |
| 185 | + $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911' ); | |
| 186 | 186 | |
| 187 | -			if ( empty( $version_info->download_link ) ) { | |
| 187 | +			if (empty($version_info->download_link)) { | |
| 188 | 188 | printf( | 
| 189 | 189 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ), | 
| 190 | 190 | esc_html( $version_info->name ), | 
| 191 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', | |
| 191 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', | |
| 192 | 192 | esc_html( $version_info->new_version ), | 
| 193 | 193 | '</a>' | 
| 194 | 194 | ); | 
| @@ -196,10 +196,10 @@ discard block | ||
| 196 | 196 | printf( | 
| 197 | 197 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ), | 
| 198 | 198 | esc_html( $version_info->name ), | 
| 199 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', | |
| 199 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', | |
| 200 | 200 | esc_html( $version_info->new_version ), | 
| 201 | 201 | '</a>', | 
| 202 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', | |
| 202 | + '<a href="'.esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ).$this->name, 'upgrade-plugin_'.$this->name ) ).'">', | |
| 203 | 203 | '</a>' | 
| 204 | 204 | ); | 
| 205 | 205 | } | 
| @@ -224,13 +224,13 @@ discard block | ||
| 224 | 224 |  	public function plugins_api_filter( $_data, $_action = '', $_args = null ) { | 
| 225 | 225 | |
| 226 | 226 | |
| 227 | -		if ( $_action != 'plugin_information' ) { | |
| 227 | +		if ($_action != 'plugin_information') { | |
| 228 | 228 | |
| 229 | 229 | return $_data; | 
| 230 | 230 | |
| 231 | 231 | } | 
| 232 | 232 | |
| 233 | -		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { | |
| 233 | +		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { | |
| 234 | 234 | |
| 235 | 235 | return $_data; | 
| 236 | 236 | |
| @@ -247,7 +247,7 @@ discard block | ||
| 247 | 247 | |
| 248 | 248 | $api_response = $this->api_request( 'plugin_information', $to_send ); | 
| 249 | 249 | |
| 250 | -		if ( false !== $api_response ) { | |
| 250 | +		if (false !== $api_response) { | |
| 251 | 251 | $_data = $api_response; | 
| 252 | 252 | } | 
| 253 | 253 | |
| @@ -264,7 +264,7 @@ discard block | ||
| 264 | 264 | */ | 
| 265 | 265 |  	public function http_request_args( $args, $url ) { | 
| 266 | 266 | // If it is an https request and we are performing a package download, disable ssl verification | 
| 267 | -		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { | |
| 267 | +		if (strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' )) { | |
| 268 | 268 | $args['sslverify'] = false; | 
| 269 | 269 | } | 
| 270 | 270 | return $args; | 
| @@ -287,19 +287,19 @@ discard block | ||
| 287 | 287 | |
| 288 | 288 | $data = array_merge( $this->api_data, $_data ); | 
| 289 | 289 | |
| 290 | -		if ( $data['slug'] != $this->slug ) { | |
| 290 | +		if ($data['slug'] != $this->slug) { | |
| 291 | 291 | return; | 
| 292 | 292 | } | 
| 293 | 293 | |
| 294 | -		if( $this->api_url == trailingslashit (home_url() ) ) { | |
| 294 | +		if ($this->api_url == trailingslashit( home_url() )) { | |
| 295 | 295 | return false; // Don't allow a plugin to ping itself | 
| 296 | 296 | } | 
| 297 | 297 | |
| 298 | 298 | $api_params = array( | 
| 299 | 299 | 'edd_action' => 'get_version', | 
| 300 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', | |
| 301 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, | |
| 302 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, | |
| 300 | + 'license' => ! empty($data['license']) ? $data['license'] : '', | |
| 301 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, | |
| 302 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, | |
| 303 | 303 | 'slug' => $data['slug'], | 
| 304 | 304 | 'author' => $data['author'], | 
| 305 | 305 | 'url' => home_url() | 
| @@ -307,11 +307,11 @@ discard block | ||
| 307 | 307 | |
| 308 | 308 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); | 
| 309 | 309 | |
| 310 | -		if ( ! is_wp_error( $request ) ) { | |
| 310 | +		if ( ! is_wp_error( $request )) { | |
| 311 | 311 | $request = json_decode( wp_remote_retrieve_body( $request ) ); | 
| 312 | 312 | } | 
| 313 | 313 | |
| 314 | -		if ( $request && isset( $request->sections ) ) { | |
| 314 | +		if ($request && isset($request->sections)) { | |
| 315 | 315 | $request->sections = maybe_unserialize( $request->sections ); | 
| 316 | 316 |  		} else { | 
| 317 | 317 | $request = false; | 
| @@ -324,32 +324,32 @@ discard block | ||
| 324 | 324 | |
| 325 | 325 | global $edd_plugin_data; | 
| 326 | 326 | |
| 327 | -		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { | |
| 327 | +		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { | |
| 328 | 328 | return; | 
| 329 | 329 | } | 
| 330 | 330 | |
| 331 | -		if( empty( $_REQUEST['plugin'] ) ) { | |
| 331 | +		if (empty($_REQUEST['plugin'])) { | |
| 332 | 332 | return; | 
| 333 | 333 | } | 
| 334 | 334 | |
| 335 | -		if( empty( $_REQUEST['slug'] ) ) { | |
| 335 | +		if (empty($_REQUEST['slug'])) { | |
| 336 | 336 | return; | 
| 337 | 337 | } | 
| 338 | 338 | |
| 339 | -		if( ! current_user_can( 'update_plugins' ) ) { | |
| 339 | +		if ( ! current_user_can( 'update_plugins' )) { | |
| 340 | 340 | wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) ); | 
| 341 | 341 | } | 
| 342 | 342 | |
| 343 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; | |
| 344 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' ); | |
| 343 | + $data = $edd_plugin_data[$_REQUEST['slug']]; | |
| 344 | + $cache_key = md5( 'edd_plugin_'.sanitize_key( $_REQUEST['plugin'] ).'_version_info' ); | |
| 345 | 345 | $version_info = get_transient( $cache_key ); | 
| 346 | 346 | |
| 347 | -		if( false === $version_info ) { | |
| 347 | +		if (false === $version_info) { | |
| 348 | 348 | |
| 349 | 349 | $api_params = array( | 
| 350 | 350 | 'edd_action' => 'get_version', | 
| 351 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, | |
| 352 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, | |
| 351 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, | |
| 352 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, | |
| 353 | 353 | 'slug' => $_REQUEST['slug'], | 
| 354 | 354 | 'author' => $data['author'], | 
| 355 | 355 | 'url' => home_url() | 
| @@ -357,11 +357,11 @@ discard block | ||
| 357 | 357 | |
| 358 | 358 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); | 
| 359 | 359 | |
| 360 | -			if ( ! is_wp_error( $request ) ) { | |
| 360 | +			if ( ! is_wp_error( $request )) { | |
| 361 | 361 | $version_info = json_decode( wp_remote_retrieve_body( $request ) ); | 
| 362 | 362 | } | 
| 363 | 363 | |
| 364 | -			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { | |
| 364 | +			if ( ! empty($version_info) && isset($version_info->sections)) { | |
| 365 | 365 | $version_info->sections = maybe_unserialize( $version_info->sections ); | 
| 366 | 366 |  			} else { | 
| 367 | 367 | $version_info = false; | 
| @@ -371,8 +371,8 @@ discard block | ||
| 371 | 371 | |
| 372 | 372 | } | 
| 373 | 373 | |
| 374 | -		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { | |
| 375 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; | |
| 374 | +		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { | |
| 375 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; | |
| 376 | 376 | } | 
| 377 | 377 | |
| 378 | 378 | exit; | 
| @@ -4,7 +4,9 @@ | ||
| 4 | 4 | //set_site_transient( 'update_plugins', null ); | 
| 5 | 5 | |
| 6 | 6 | // Exit if accessed directly | 
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; | |
| 7 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 8 | + exit; | |
| 9 | +} | |
| 8 | 10 | |
| 9 | 11 | /** | 
| 10 | 12 | * Allows plugins to use their own update API. |