@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Checks to see if a session is set and it's appropriate to start one, and starts it if necessary |
| 10 | - * @return void |
|
| 10 | + * @return boolean |
|
| 11 | 11 | */ |
| 12 | 12 | function ppp_maybe_start_session() { |
| 13 | 13 | if( !class_exists( 'TwitterOAuth' ) ) { |
@@ -77,6 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Strips slashes and html_entities_decode for sending to the networks. |
| 80 | + * @param string $string |
|
| 80 | 81 | */ |
| 81 | 82 | function ppp_entities_and_slashes( $string ) { |
| 82 | 83 | return stripslashes( html_entity_decode( $string, ENT_COMPAT, 'UTF-8' ) ); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | * @return void |
| 11 | 11 | */ |
| 12 | 12 | function ppp_maybe_start_session() { |
| 13 | - if( !class_exists( 'TwitterOAuth' ) ) { |
|
| 14 | - require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' ); |
|
| 13 | + if ( ! class_exists( 'TwitterOAuth' )) { |
|
| 14 | + require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $ret = false; |
| 18 | - if ( ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) && ! isset( $_SESSION ) ) { |
|
| 18 | + if ((is_admin() || (defined( 'DOING_CRON' ) && DOING_CRON)) && ! isset($_SESSION)) { |
|
| 19 | 19 | $ret = session_start(); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | global $ppp_share_settings; |
| 31 | 31 | $result = false; |
| 32 | 32 | |
| 33 | - if ( isset( $ppp_share_settings['analytics'] ) && $ppp_share_settings['analytics'] !== 'none' ) { |
|
| 34 | - $result = true; |
|
| 33 | + if (isset($ppp_share_settings['analytics']) && $ppp_share_settings['analytics'] !== 'none') { |
|
| 34 | + $result = true; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | return apply_filters( 'ppp_is_link_tracking_enabled', $result ); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | function ppp_is_shortener_enabled() { |
| 73 | 73 | global $ppp_share_settings; |
| 74 | 74 | |
| 75 | - return ( isset( $ppp_share_settings['shortener'] ) && !empty( $ppp_share_settings['shortener'] ) && $ppp_share_settings != '-1' ); |
|
| 75 | + return (isset($ppp_share_settings['shortener']) && ! empty($ppp_share_settings['shortener']) && $ppp_share_settings != '-1'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | $post_types = get_post_types( $post_type_args, NULL, 'and' ); |
| 105 | 105 | |
| 106 | 106 | $unsupported_post_types = array( 'wp_log', 'attachment' ); |
| 107 | - foreach ( $unsupported_post_types as $unsupported_post_type ) { |
|
| 108 | - if ( array_key_exists( $unsupported_post_type, $post_types ) ) { |
|
| 109 | - unset( $post_types[ $unsupported_post_type ] ); |
|
| 107 | + foreach ($unsupported_post_types as $unsupported_post_type) { |
|
| 108 | + if (array_key_exists( $unsupported_post_type, $post_types )) { |
|
| 109 | + unset($post_types[$unsupported_post_type]); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -134,16 +134,16 @@ discard block |
||
| 134 | 134 | function ppp_should_save( $post_id, $post ) { |
| 135 | 135 | $ret = true; |
| 136 | 136 | |
| 137 | - if ( empty( $_POST ) ) { |
|
| 137 | + if (empty($_POST)) { |
|
| 138 | 138 | $ret = false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if ( wp_is_post_revision( $post_id ) ) { |
|
| 141 | + if (wp_is_post_revision( $post_id )) { |
|
| 142 | 142 | $ret = false; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | global $ppp_options; |
| 146 | - if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) || !array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
| 146 | + if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] ) || ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
| 147 | 147 | $ret = false; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | function ppp_set_uploads_dir() { |
| 160 | 160 | $upload_path = ppp_get_upload_path(); |
| 161 | 161 | |
| 162 | - if ( false === get_transient( 'ppp_check_protection_files' ) ) { |
|
| 162 | + if (false === get_transient( 'ppp_check_protection_files' )) { |
|
| 163 | 163 | |
| 164 | 164 | // Make sure the /ppp folder is created |
| 165 | 165 | wp_mkdir_p( $upload_path ); |
@@ -168,22 +168,22 @@ discard block |
||
| 168 | 168 | $rules = "Options -Indexes\n"; |
| 169 | 169 | $rules .= "deny from all\n"; |
| 170 | 170 | |
| 171 | - $htaccess_exists = file_exists( $upload_path . '/.htaccess' ); |
|
| 171 | + $htaccess_exists = file_exists( $upload_path.'/.htaccess' ); |
|
| 172 | 172 | |
| 173 | - if ( $htaccess_exists ) { |
|
| 174 | - $contents = @file_get_contents( $upload_path . '/.htaccess' ); |
|
| 175 | - if ( $contents !== $rules || ! $contents ) { |
|
| 173 | + if ($htaccess_exists) { |
|
| 174 | + $contents = @file_get_contents( $upload_path.'/.htaccess' ); |
|
| 175 | + if ($contents !== $rules || ! $contents) { |
|
| 176 | 176 | // Update the .htaccess rules if they don't match |
| 177 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
| 177 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
| 178 | 178 | } |
| 179 | - } elseif( wp_is_writable( $upload_path ) ) { |
|
| 179 | + } elseif (wp_is_writable( $upload_path )) { |
|
| 180 | 180 | // Create the file if it doesn't exist |
| 181 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
| 181 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // Top level blank index.php |
| 185 | - if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) { |
|
| 186 | - @file_put_contents( $upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.' ); |
|
| 185 | + if ( ! file_exists( $upload_path.'/index.php' ) && wp_is_writable( $upload_path )) { |
|
| 186 | + @file_put_contents( $upload_path.'/index.php', '<?php'.PHP_EOL.'// Silence is golden.' ); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Check for the files once per day |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | function ppp_get_upload_path() { |
| 202 | 202 | $wp_upload_dir = wp_upload_dir(); |
| 203 | - return $wp_upload_dir['basedir'] . '/ppp'; |
|
| 203 | + return $wp_upload_dir['basedir'].'/ppp'; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $completed_upgrades = get_option( 'ppp_completed_upgrades' ); |
| 215 | 215 | |
| 216 | - if ( false === $completed_upgrades ) { |
|
| 216 | + if (false === $completed_upgrades) { |
|
| 217 | 217 | $completed_upgrades = array(); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | function ppp_has_upgrade_completed( $upgrade_action = '' ) { |
| 232 | 232 | |
| 233 | - if ( empty( $upgrade_action ) ) { |
|
| 233 | + if (empty($upgrade_action)) { |
|
| 234 | 234 | return false; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | function ppp_set_upgrade_complete( $upgrade_action = '' ) { |
| 251 | 251 | |
| 252 | - if ( empty( $upgrade_action ) ) { |
|
| 252 | + if (empty($upgrade_action)) { |
|
| 253 | 253 | return false; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -274,48 +274,48 @@ discard block |
||
| 274 | 274 | $url = strtolower( trim( get_home_url( '/' ) ) ); |
| 275 | 275 | |
| 276 | 276 | // Need to get the host...so let's add the scheme so we can use parse_url |
| 277 | - if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) { |
|
| 278 | - $url = 'http://' . $url; |
|
| 277 | + if (false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' )) { |
|
| 278 | + $url = 'http://'.$url; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | $url_parts = parse_url( $url ); |
| 282 | - $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false; |
|
| 282 | + $host = ! empty($url_parts['host']) ? $url_parts['host'] : false; |
|
| 283 | 283 | |
| 284 | - if ( ! empty( $url ) && ! empty( $host ) ) { |
|
| 284 | + if ( ! empty($url) && ! empty($host)) { |
|
| 285 | 285 | |
| 286 | - if ( false !== ip2long( $host ) ) { |
|
| 287 | - if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) { |
|
| 286 | + if (false !== ip2long( $host )) { |
|
| 287 | + if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE )) { |
|
| 288 | 288 | $is_local_url = true; |
| 289 | 289 | } |
| 290 | - } else if ( 'localhost' === $host ) { |
|
| 290 | + } else if ('localhost' === $host) { |
|
| 291 | 291 | $is_local_url = true; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $check_tlds = apply_filters( 'ppp_validate_tlds', true ); |
| 295 | - if ( $check_tlds ) { |
|
| 295 | + if ($check_tlds) { |
|
| 296 | 296 | $tlds_to_check = apply_filters( 'ppp_url_tlds', array( |
| 297 | 297 | '.dev', '.local', '.test', |
| 298 | 298 | ) ); |
| 299 | 299 | |
| 300 | - foreach ( $tlds_to_check as $tld ) { |
|
| 301 | - if ( false !== strpos( $host, $tld ) ) { |
|
| 300 | + foreach ($tlds_to_check as $tld) { |
|
| 301 | + if (false !== strpos( $host, $tld )) { |
|
| 302 | 302 | $is_local_url = true; |
| 303 | 303 | continue; |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - if ( substr_count( $host, '.' ) > 1 ) { |
|
| 308 | + if (substr_count( $host, '.' ) > 1) { |
|
| 309 | 309 | $subdomains_to_check = apply_filters( 'ppp_url_subdomains', array( |
| 310 | 310 | 'dev.', '*.staging.', |
| 311 | 311 | ) ); |
| 312 | 312 | |
| 313 | - foreach ( $subdomains_to_check as $subdomain ) { |
|
| 313 | + foreach ($subdomains_to_check as $subdomain) { |
|
| 314 | 314 | |
| 315 | 315 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
| 316 | 316 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
| 317 | 317 | |
| 318 | - if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) { |
|
| 318 | + if (preg_match( '/^('.$subdomain.')/', $host )) { |
|
| 319 | 319 | $is_local_url = true; |
| 320 | 320 | continue; |
| 321 | 321 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( !defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Handles all twitter functions |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -if( !class_exists( 'PPP_Twitter' ) ) { |
|
| 14 | +if ( ! class_exists( 'PPP_Twitter' )) { |
|
| 15 | 15 | |
| 16 | 16 | class PPP_Twitter { |
| 17 | 17 | |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | * Handles to load twitter class |
| 30 | 30 | */ |
| 31 | 31 | public function ppp_load_twitter() { |
| 32 | - if( !class_exists( 'TwitterOAuth' ) ) { |
|
| 33 | - require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' ); |
|
| 32 | + if ( ! class_exists( 'TwitterOAuth' )) { |
|
| 33 | + require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | ppp_set_social_tokens(); |
| 37 | 37 | |
| 38 | - if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' ) ) { |
|
| 38 | + if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' )) { |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function revoke_access() { |
| 48 | 48 | global $ppp_social_settings; |
| 49 | 49 | |
| 50 | - unset( $ppp_social_settings['twitter'] ); |
|
| 50 | + unset($ppp_social_settings['twitter']); |
|
| 51 | 51 | |
| 52 | 52 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 53 | 53 | } |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | public function ppp_initialize_twitter() { |
| 60 | 60 | |
| 61 | 61 | //when user is going to logged in in twitter and verified successfully session will create |
| 62 | - if ( ! empty( $_REQUEST['oauth_verifier'] ) ) { |
|
| 62 | + if ( ! empty($_REQUEST['oauth_verifier'])) { |
|
| 63 | 63 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 64 | 64 | |
| 65 | 65 | //load twitter class |
| 66 | 66 | $twitter = $this->ppp_load_twitter(); |
| 67 | 67 | |
| 68 | 68 | //check twitter class is loaded or not |
| 69 | - if( ! $twitter ) { |
|
| 69 | + if ( ! $twitter) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | //session for verifier |
| 79 | 79 | $verifier['oauth_verifier'] = $_REQUEST['oauth_verifier']; |
| 80 | 80 | |
| 81 | - $_SESSION[ 'ppp_twt_user_cache' ] = $verifier; |
|
| 81 | + $_SESSION['ppp_twt_user_cache'] = $verifier; |
|
| 82 | 82 | |
| 83 | 83 | //getting user data from twitter |
| 84 | - $response = $this->twitter->get('account/verify_credentials'); |
|
| 84 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
| 85 | 85 | |
| 86 | 86 | //if user data get successfully |
| 87 | - if ( $response->id_str ) { |
|
| 87 | + if ($response->id_str) { |
|
| 88 | 88 | |
| 89 | 89 | $data['user'] = $response; |
| 90 | 90 | $data['user']->accessToken = $ppp_tw_access_token; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $this->ppp_load_twitter(); |
| 101 | 101 | |
| 102 | 102 | global $ppp_social_settings; |
| 103 | - if ( isset( $ppp_social_settings['twitter'] ) ) { |
|
| 103 | + if (isset($ppp_social_settings['twitter'])) { |
|
| 104 | 104 | |
| 105 | 105 | $this->twitter = new TwitterOAuth( |
| 106 | 106 | PPP_TW_CONSUMER_KEY, |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $ppp_social_settings['twitter']['user']->accessToken['oauth_token_secret'] |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - $response = $this->twitter->get('account/verify_credentials'); |
|
| 113 | - if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) { |
|
| 114 | - foreach ( $response->errors as $error ) { |
|
| 115 | - if ( $error->code == 89 ) { // Expired or revoked tokens |
|
| 116 | - unset( $ppp_social_settings['twitter'] ); |
|
| 112 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
| 113 | + if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) { |
|
| 114 | + foreach ($response->errors as $error) { |
|
| 115 | + if ($error->code == 89) { // Expired or revoked tokens |
|
| 116 | + unset($ppp_social_settings['twitter']); |
|
| 117 | 117 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 118 | 118 | |
| 119 | 119 | return array( 'error' => __( 'Post Promoter Pro has been removed from your Twitter account. Please reauthorize to continue promoting your content.', 'ppp-txt' ) ); |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | * Get auth url for twitter |
| 130 | 130 | * |
| 131 | 131 | */ |
| 132 | - public function ppp_get_twitter_auth_url ( $return_url = '' ) { |
|
| 132 | + public function ppp_get_twitter_auth_url( $return_url = '' ) { |
|
| 133 | 133 | |
| 134 | - if ( empty( $return_url ) ) { |
|
| 134 | + if (empty($return_url)) { |
|
| 135 | 135 | $return_url = admin_url( 'admin.php?page=ppp-social-settings' ); |
| 136 | 136 | } |
| 137 | 137 | //load twitter class |
| 138 | 138 | $twitter = $this->ppp_load_twitter(); |
| 139 | 139 | |
| 140 | 140 | //check twitter class is loaded or not |
| 141 | - if( !$twitter ) { |
|
| 141 | + if ( ! $twitter) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $request_token = $this->twitter->getRequestToken( 'oob' ); |
| 146 | 146 | |
| 147 | 147 | // If last connection failed don't display authorization link. |
| 148 | - switch( $this->twitter->http_code ) { |
|
| 148 | + switch ($this->twitter->http_code) { |
|
| 149 | 149 | |
| 150 | 150 | case 200: |
| 151 | 151 | $_SESSION['ppp_twt_oauth_token'] = $request_token['oauth_token']; |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function ppp_tweet( $message = '', $media = null ) { |
| 165 | - if ( empty( $message ) ) { |
|
| 165 | + if (empty($message)) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $verify = $this->ppp_verify_twitter_credentials(); |
| 170 | - if ( $verify === true ) { |
|
| 170 | + if ($verify === true) { |
|
| 171 | 171 | $args = array(); |
| 172 | - if ( ! empty( $media ) ) { |
|
| 172 | + if ( ! empty($media)) { |
|
| 173 | 173 | $endpoint = 'statuses/update_with_media'; |
| 174 | 174 | $args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) ); |
| 175 | 175 | } else { |
@@ -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,17 +83,17 @@ 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 .= '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="' . $tw_authurl . '" target="_blank"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a></span>'; |
|
| 92 | - $string .= '<span style="display:none;" id="tw-oob-pin-notice">' . __( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ) . '</span>'; |
|
| 93 | - $string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="' . wp_create_nonce( 'ppp-tw-pin' ) . '" /> <a href="#" class="button-secondary tw-oob-pin-submit">' . __( 'Submit', 'ppp-txt' ) . '</a><span class="spinner"></span></span>'; |
|
| 91 | + $string .= '<span id="tw-oob-auth-link-wrapper"><a id="tw-oob-auth-link" href="'.$tw_authurl.'" target="_blank"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a></span>'; |
|
| 92 | + $string .= '<span style="display:none;" id="tw-oob-pin-notice">'.__( 'You are being directed to Twitter to authenticate. When complete, return here and enter the PIN you were provided.', 'ppp-txt' ).'</span>'; |
|
| 93 | + $string .= '<span style="display:none;" id="tw-oob-pin-wrapper"><input type="text" size="10" placeholder="Enter your PIN" value="" id="tw-oob-pin" data-nonce="'.wp_create_nonce( 'ppp-tw-pin' ).'" /> <a href="#" class="button-secondary tw-oob-pin-submit">'.__( 'Submit', 'ppp-txt' ).'</a><span class="spinner"></span></span>'; |
|
| 94 | 94 | } else { |
| 95 | - $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> '; |
|
| 96 | - $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">' . __( 'Revoke Access via Twitter', 'ppp-txt' ) . '</a>'; |
|
| 95 | + $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> '; |
|
| 96 | + $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">'.__( 'Revoke Access via Twitter', 'ppp-txt' ).'</a>'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | return $string; |
@@ -106,16 +106,16 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | ppp_set_social_tokens(); |
| 108 | 108 | |
| 109 | - $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : ''; |
|
| 109 | + $nonce = isset($_POST['nonce']) ? sanitize_text_field( $_POST['nonce'] ) : ''; |
|
| 110 | 110 | $nonce_verified = wp_verify_nonce( $nonce, 'ppp-tw-pin' ); |
| 111 | 111 | |
| 112 | - if ( ! $nonce_verified ) { |
|
| 112 | + if ( ! $nonce_verified) { |
|
| 113 | 113 | wp_die(); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $pin = isset( $_POST['pin'] ) ? absint( $_POST['pin'] ) : false; |
|
| 116 | + $pin = isset($_POST['pin']) ? absint( $_POST['pin'] ) : false; |
|
| 117 | 117 | |
| 118 | - if ( empty( $pin ) ) { |
|
| 118 | + if (empty($pin)) { |
|
| 119 | 119 | wp_die(); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $twitter->ppp_initialize_twitter(); |
| 125 | 125 | $settings = get_option( 'ppp_social_settings', true ); |
| 126 | 126 | |
| 127 | - if ( ! empty( $settings['twitter']['user']->id ) ) { |
|
| 127 | + if ( ! empty($settings['twitter']['user']->id)) { |
|
| 128 | 128 | echo 1; |
| 129 | 129 | } else { |
| 130 | 130 | echo 0; |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | * @return void |
| 140 | 140 | */ |
| 141 | 141 | function ppp_capture_twitter_oauth() { |
| 142 | - if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) { |
|
| 142 | + if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { |
|
| 143 | 143 | $current_screen = get_current_screen(); |
| 144 | - if ( 'user-edit' === $current_screen->base ) { |
|
| 145 | - $user_id = ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; |
|
| 144 | + if ('user-edit' === $current_screen->base) { |
|
| 145 | + $user_id = ! empty($_GET['user_id']) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; |
|
| 146 | 146 | $twitter = new PPP_Twitter_User( $user_id ); |
| 147 | 147 | $twitter->init(); |
| 148 | - $redirect = admin_url( 'user-edit.php?updated=1&user_id=' . $user_id ); |
|
| 148 | + $redirect = admin_url( 'user-edit.php?updated=1&user_id='.$user_id ); |
|
| 149 | 149 | } else { |
| 150 | 150 | global $ppp_twitter_oauth; |
| 151 | 151 | $ppp_twitter_oauth->ppp_initialize_twitter(); |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | * @return void |
| 164 | 164 | */ |
| 165 | 165 | function ppp_disconnect_twitter() { |
| 166 | - if ( ! empty( $_GET['user_id'] ) ) { |
|
| 166 | + if ( ! empty($_GET['user_id'])) { |
|
| 167 | 167 | $user_id = (int) sanitize_text_field( $_GET['user_id'] ); |
| 168 | - if ( $user_id !== get_current_user_id() || ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
| 168 | + if ($user_id !== get_current_user_id() || ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
| 169 | 169 | wp_die( __( 'Unable to disconnect Twitter account', 'ppp-txt' ) ); |
| 170 | 170 | } |
| 171 | 171 | delete_user_meta( $user_id, '_ppp_twitter_data' ); |
| 172 | 172 | } else { |
| 173 | 173 | global $ppp_social_settings; |
| 174 | 174 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 175 | - if ( isset( $ppp_social_settings['twitter'] ) ) { |
|
| 176 | - unset( $ppp_social_settings['twitter'] ); |
|
| 175 | + if (isset($ppp_social_settings['twitter'])) { |
|
| 176 | + unset($ppp_social_settings['twitter']); |
|
| 177 | 177 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | global $ppp_options, $wp_logs, $wp_filter; |
| 205 | 205 | |
| 206 | 206 | $post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 207 | - $this_share = $post_meta[ $index ]; |
|
| 208 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; |
|
| 207 | + $this_share = $post_meta[$index]; |
|
| 208 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; |
|
| 209 | 209 | |
| 210 | 210 | $share_message = ppp_tw_build_share_message( $post_id, $name ); |
| 211 | 211 | |
| 212 | - if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { |
|
| 212 | + if (empty($attachment_id) && ! empty($this_share['image'])) { |
|
| 213 | 213 | $media = $this_share['image']; |
| 214 | 214 | } else { |
| 215 | 215 | $use_media = ppp_tw_use_media( $post_id, $index ); |
@@ -236,12 +236,12 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | update_post_meta( $log_entry, '_ppp_share_status', $status ); |
| 238 | 238 | |
| 239 | - if ( ! empty( $status->id_str ) ) { |
|
| 239 | + if ( ! empty($status->id_str)) { |
|
| 240 | 240 | $post = get_post( $post_id ); |
| 241 | 241 | $author_id = $post->post_author; |
| 242 | 242 | $author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true ); |
| 243 | 243 | |
| 244 | - if ( $author_rt ) { |
|
| 244 | + if ($author_rt) { |
|
| 245 | 245 | $twitter_user = new PPP_Twitter_User( $author_id ); |
| 246 | 246 | $twitter_user->retweet( $status->id_str ); |
| 247 | 247 | } |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | ); |
| 263 | 263 | $other_rt = get_users( $args ); |
| 264 | 264 | |
| 265 | - if ( $other_rt ){ |
|
| 266 | - foreach ( $other_rt as $user ) { |
|
| 265 | + if ($other_rt) { |
|
| 266 | + foreach ($other_rt as $user) { |
|
| 267 | 267 | $twitter_user = new PPP_Twitter_User( $user->ID ); |
| 268 | 268 | $twitter_user->retweet( $status->id_str ); |
| 269 | 269 | } |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) { |
| 284 | 284 | $share_content = ppp_tw_generate_share_content( $post_id, $name, $scheduled ); |
| 285 | 285 | |
| 286 | - if ( $include_link ) { |
|
| 286 | + if ($include_link) { |
|
| 287 | 287 | $share_link = ppp_generate_link( $post_id, $name, $scheduled ); |
| 288 | - $share_content = $share_content . ' ' . $share_link; |
|
| 288 | + $share_content = $share_content.' '.$share_link; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | return apply_filters( 'ppp_tw_build_share_message', $share_content ); |
@@ -299,22 +299,22 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
| 301 | 301 | global $ppp_options; |
| 302 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
| 302 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
| 303 | 303 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 304 | 304 | |
| 305 | - if ( ! empty( $ppp_tweets ) ) { |
|
| 305 | + if ( ! empty($ppp_tweets)) { |
|
| 306 | 306 | $name_array = explode( '_', $name ); |
| 307 | 307 | $index = $name_array[1]; |
| 308 | - if ( isset( $ppp_tweets[ $index ] ) ) { |
|
| 309 | - $share_content = $ppp_tweets[ $index ]['text']; |
|
| 308 | + if (isset($ppp_tweets[$index])) { |
|
| 309 | + $share_content = $ppp_tweets[$index]['text']; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // If an override was found, use it, otherwise try the default text content |
| 314 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
| 314 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
| 315 | 315 | |
| 316 | 316 | // If the content is still empty, just use the post title |
| 317 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
| 317 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
| 318 | 318 | |
| 319 | 319 | return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) ); |
| 320 | 320 | } |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | * @return bool Whether or not this tweet should contain a media post |
| 327 | 327 | */ |
| 328 | 328 | function ppp_tw_use_media( $post_id, $index ) { |
| 329 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
| 329 | + if (empty($post_id) || empty($index)) { |
|
| 330 | 330 | return false; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $share_data = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 334 | - $use_media = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false; |
|
| 334 | + $use_media = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false; |
|
| 335 | 335 | |
| 336 | 336 | return $use_media; |
| 337 | 337 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @return void |
| 343 | 343 | */ |
| 344 | 344 | function ppp_set_tw_token_constants( $social_tokens ) { |
| 345 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) { |
|
| 345 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) { |
|
| 346 | 346 | define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token ); |
| 347 | 347 | define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret ); |
| 348 | 348 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | */ |
| 381 | 381 | function ppp_tw_add_meta_tab( $tabs ) { |
| 382 | 382 | global $ppp_social_settings; |
| 383 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
| 383 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
| 384 | 384 | return $tabs; |
| 385 | 385 | } |
| 386 | 386 | |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | function ppp_tw_register_metabox_content( $content ) { |
| 399 | 399 | global $ppp_social_settings; |
| 400 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
| 400 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
| 401 | 401 | return $content; |
| 402 | 402 | } |
| 403 | 403 | |
@@ -456,16 +456,16 @@ discard block |
||
| 456 | 456 | <tbody> |
| 457 | 457 | <?php ppp_render_tweet_share_on_publish_row(); ?> |
| 458 | 458 | <?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?> |
| 459 | - <?php if ( ! empty( $tweets ) ) : ?> |
|
| 459 | + <?php if ( ! empty($tweets)) : ?> |
|
| 460 | 460 | |
| 461 | - <?php foreach ( $tweets as $key => $value ) : |
|
| 462 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
| 463 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
| 464 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
| 465 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
| 466 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
| 461 | + <?php foreach ($tweets as $key => $value) : |
|
| 462 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
| 463 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
| 464 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
| 465 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
| 466 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
| 467 | 467 | |
| 468 | - $args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); |
|
| 468 | + $args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); |
|
| 469 | 469 | ?> |
| 470 | 470 | |
| 471 | 471 | <?php ppp_render_tweet_row( $key, $args, $post->ID ); ?> |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | <?php endforeach; ?> |
| 475 | 475 | |
| 476 | 476 | <?php |
| 477 | - if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) { |
|
| 477 | + if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) { |
|
| 478 | 478 | $args = array( |
| 479 | 479 | 'date' => '', |
| 480 | 480 | 'time' => '', |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | <tr class="ppp-add-repeatable-wrapper"> |
| 498 | 498 | <td class="submit" colspan="4" style="float: none; clear:both; background:#fff;"> |
| 499 | 499 | <a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a> |
| 500 | - <?php if ( ! empty( $has_past_shares ) ) : ?> |
|
| 500 | + <?php if ( ! empty($has_past_shares)) : ?> |
|
| 501 | 501 | <a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a> |
| 502 | 502 | <?php endif; ?> |
| 503 | 503 | </td> |
@@ -523,38 +523,38 @@ discard block |
||
| 523 | 523 | */ |
| 524 | 524 | function ppp_render_tweet_share_on_publish_row() { |
| 525 | 525 | global $post, $ppp_share_settings; |
| 526 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 526 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 527 | 527 | |
| 528 | 528 | $ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true ); |
| 529 | 529 | |
| 530 | 530 | $ppp_share_on_publish = get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
| 531 | 531 | $show_share_on_publish = false; |
| 532 | 532 | |
| 533 | - $share_by_default = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['twitter'] ) ? false : true; |
|
| 533 | + $share_by_default = empty($ppp_share_settings['share_on_publish'][$post->post_type]['twitter']) ? false : true; |
|
| 534 | 534 | |
| 535 | - if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) { |
|
| 535 | + if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) { |
|
| 536 | 536 | $show_share_on_publish = true; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
| 540 | 540 | $ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
| 541 | 541 | |
| 542 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; |
|
| 542 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; |
|
| 543 | 543 | ?> |
| 544 | 544 | <tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row"> |
| 545 | 545 | <td colspan="2" class="ppp-on-plublish-date-column"> |
| 546 | - <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 ); ?> /> |
|
| 546 | + <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 ); ?> /> |
|
| 547 | 547 | <label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label> |
| 548 | 548 | </td> |
| 549 | 549 | |
| 550 | 550 | <td> |
| 551 | - <textarea <?php if ( $disabled ): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text"><?php echo esc_attr( $ppp_share_on_publish_text ); ?></textarea> |
|
| 552 | - <?php $length = ! empty( $ppp_share_on_publish_text ) ? strlen( $ppp_share_on_publish_text ) : 0; ?> |
|
| 551 | + <textarea <?php if ($disabled): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text"><?php echo esc_attr( $ppp_share_on_publish_text ); ?></textarea> |
|
| 552 | + <?php $length = ! empty($ppp_share_on_publish_text) ? strlen( $ppp_share_on_publish_text ) : 0; ?> |
|
| 553 | 553 | <span class="ppp-text-length"><?php echo $length; ?></span> |
| 554 | 554 | </td> |
| 555 | 555 | |
| 556 | 556 | <td style="width: 200px" colspan="2"> |
| 557 | - <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 ); ?>/> |
|
| 557 | + <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 ); ?>/> |
|
| 558 | 558 | <label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label> |
| 559 | 559 | </td> |
| 560 | 560 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | function ppp_render_tweet_row( $key, $args = array(), $post_id ) { |
| 574 | 574 | global $post, $has_past_shares; |
| 575 | 575 | |
| 576 | - if ( ! empty( $args['date'] ) && ! empty( $args['time'] ) ) { |
|
| 576 | + if ( ! empty($args['date']) && ! empty($args['time'])) { |
|
| 577 | 577 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
| 578 | 578 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
| 579 | 579 | } else { |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | $readonly = false; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
| 585 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
| 586 | - $shared = ! empty( $readonly ) ? 'past-share' : ''; |
|
| 584 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
| 585 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
| 586 | + $shared = ! empty($readonly) ? 'past-share' : ''; |
|
| 587 | 587 | |
| 588 | - if ( ! empty( $readonly ) ) { |
|
| 588 | + if ( ! empty($readonly)) { |
|
| 589 | 589 | $has_past_shares++; |
| 590 | 590 | } |
| 591 | 591 | ?> |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | <td> |
| 602 | 602 | <textarea class="ppp-tweet-text-repeatable" type="text" name="_ppp_tweets[<?php echo $key; ?>][text]" <?php echo $readonly; ?>><?php echo esc_attr( $args['text'] ); ?></textarea> |
| 603 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> |
|
| 603 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> |
|
| 604 | 604 | <span class="ppp-text-length"><?php echo $length; ?></span> |
| 605 | 605 | </td> |
| 606 | 606 | |
@@ -635,24 +635,24 @@ discard block |
||
| 635 | 635 | */ |
| 636 | 636 | function ppp_tw_save_post_meta_boxes( $post_id, $post ) { |
| 637 | 637 | |
| 638 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
| 638 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
| 639 | 639 | return; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - $ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
| 642 | + $ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
| 643 | 643 | |
| 644 | - $ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
| 645 | - $ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
| 646 | - $ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
| 644 | + $ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
| 645 | + $ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
| 646 | + $ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
| 647 | 647 | |
| 648 | 648 | |
| 649 | 649 | update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish ); |
| 650 | 650 | update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text ); |
| 651 | 651 | update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image ); |
| 652 | 652 | |
| 653 | - $tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array(); |
|
| 654 | - foreach ( $tweet_data as $index => $tweet ) { |
|
| 655 | - $tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] ); |
|
| 653 | + $tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array(); |
|
| 654 | + foreach ($tweet_data as $index => $tweet) { |
|
| 655 | + $tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] ); |
|
| 656 | 656 | } |
| 657 | 657 | update_post_meta( $post_id, '_ppp_tweets', $tweet_data ); |
| 658 | 658 | |
@@ -669,29 +669,29 @@ discard block |
||
| 669 | 669 | function ppp_tw_share_on_publish( $new_status, $old_status, $post ) { |
| 670 | 670 | global $ppp_options; |
| 671 | 671 | |
| 672 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
| 673 | - $from_post = isset( $_POST['_ppp_share_on_publish'] ); |
|
| 672 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
| 673 | + $from_post = isset($_POST['_ppp_share_on_publish']); |
|
| 674 | 674 | |
| 675 | - if ( empty( $from_meta ) && empty( $from_post ) ) { |
|
| 675 | + if (empty($from_meta) && empty($from_post)) { |
|
| 676 | 676 | return; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // Determine if we're seeing the share on publish in meta or $_POST |
| 680 | - if ( $from_meta && !$from_post ) { |
|
| 680 | + if ($from_meta && ! $from_post) { |
|
| 681 | 681 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
| 682 | 682 | $use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
| 683 | 683 | } else { |
| 684 | - $ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
| 685 | - $use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
| 684 | + $ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
| 685 | + $use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - $share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
| 688 | + $share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
| 689 | 689 | $share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) ); |
| 690 | - $name = 'sharedate_0_' . $post->ID; |
|
| 690 | + $name = 'sharedate_0_'.$post->ID; |
|
| 691 | 691 | $media = ppp_post_has_media( $post->ID, 'tw', $use_media ); |
| 692 | 692 | $share_link = ppp_generate_link( $post->ID, $name, true ); |
| 693 | 693 | |
| 694 | - $status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media ); |
|
| 694 | + $status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media ); |
|
| 695 | 695 | |
| 696 | 696 | $log_title = ppp_tw_build_share_message( $post->ID, $name, false, false ); |
| 697 | 697 | |
@@ -709,11 +709,11 @@ discard block |
||
| 709 | 709 | |
| 710 | 710 | $log_entry = WP_Logging::insert_log( $log_data, $log_meta ); |
| 711 | 711 | |
| 712 | - if ( ! empty( $status->id_str ) ) { |
|
| 712 | + if ( ! empty($status->id_str)) { |
|
| 713 | 713 | $author_id = $post->post_author; |
| 714 | 714 | $author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true ); |
| 715 | 715 | |
| 716 | - if ( $author_rt ) { |
|
| 716 | + if ($author_rt) { |
|
| 717 | 717 | $twitter_user = new PPP_Twitter_User( $author_id ); |
| 718 | 718 | $twitter_user->retweet( $status->id_str ); |
| 719 | 719 | } |
@@ -734,8 +734,8 @@ discard block |
||
| 734 | 734 | ); |
| 735 | 735 | $other_rt = get_users( $args ); |
| 736 | 736 | |
| 737 | - if ( $other_rt ){ |
|
| 738 | - foreach ( $other_rt as $user ) { |
|
| 737 | + if ($other_rt) { |
|
| 738 | + foreach ($other_rt as $user) { |
|
| 739 | 739 | $twitter_user = new PPP_Twitter_User( $user->ID ); |
| 740 | 740 | $twitter_user->retweet( $status->id_str ); |
| 741 | 741 | } |
@@ -756,20 +756,20 @@ discard block |
||
| 756 | 756 | function ppp_tw_generate_timestamps( $times, $post_id ) { |
| 757 | 757 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 758 | 758 | |
| 759 | - if ( empty( $ppp_tweets ) ) { |
|
| 759 | + if (empty($ppp_tweets)) { |
|
| 760 | 760 | $ppp_tweets = array(); |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | - foreach ( $ppp_tweets as $key => $data ) { |
|
| 764 | - if ( ! array_filter( $data ) ) { |
|
| 763 | + foreach ($ppp_tweets as $key => $data) { |
|
| 764 | + if ( ! array_filter( $data )) { |
|
| 765 | 765 | continue; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
| 769 | 769 | |
| 770 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
| 771 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw'; |
|
| 772 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw'; |
|
| 770 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
| 771 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw'; |
|
| 772 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw'; |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $ret = false; |
| 791 | 791 | |
| 792 | - if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) { |
|
| 792 | + if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) { |
|
| 793 | 793 | $ret = true; |
| 794 | 794 | } |
| 795 | 795 | |
@@ -804,13 +804,13 @@ discard block |
||
| 804 | 804 | */ |
| 805 | 805 | function ppp_tw_card_meta() { |
| 806 | 806 | |
| 807 | - if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) { |
|
| 807 | + if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) { |
|
| 808 | 808 | return; |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | global $post, $ppp_options; |
| 812 | 812 | |
| 813 | - if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
| 813 | + if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
| 814 | 814 | return; |
| 815 | 815 | } |
| 816 | 816 | |
@@ -828,20 +828,20 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | $return = ''; |
| 830 | 830 | |
| 831 | - if ( ! is_single() || ! ppp_tw_cards_enabled() ) { |
|
| 831 | + if ( ! is_single() || ! ppp_tw_cards_enabled()) { |
|
| 832 | 832 | return $return; |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | global $post, $ppp_social_settings; |
| 836 | 836 | |
| 837 | 837 | |
| 838 | - if ( empty( $post ) ) { |
|
| 838 | + if (empty($post)) { |
|
| 839 | 839 | return; |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | $elements = ppp_tw_default_meta_elements(); |
| 843 | - foreach ( $elements as $name => $content ) { |
|
| 844 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; |
|
| 843 | + foreach ($elements as $name => $content) { |
|
| 844 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | return apply_filters( 'ppp_tw_card_meta', $return ); |
@@ -861,15 +861,15 @@ discard block |
||
| 861 | 861 | $elements = array(); |
| 862 | 862 | |
| 863 | 863 | $image_url = ppp_post_has_media( $post->ID, 'tw', true ); |
| 864 | - if ( $image_url ) { |
|
| 864 | + if ($image_url) { |
|
| 865 | 865 | $elements['twitter:card'] = 'summary_large_image'; |
| 866 | 866 | $elements['twitter:image:src'] = $image_url; |
| 867 | 867 | |
| 868 | 868 | $thumb_id = ppp_get_attachment_id_from_image_url( $image_url ); |
| 869 | - if ( ! empty( $thumb_id ) ) { |
|
| 869 | + if ( ! empty($thumb_id)) { |
|
| 870 | 870 | $alt_text = ppp_get_attachment_alt_text( $thumb_id ); |
| 871 | 871 | // When adding media via the WP Uploader, any 'alt text' supplied will be used as the accessible alt text. |
| 872 | - if ( ! empty( $alt_text ) ) { |
|
| 872 | + if ( ! empty($alt_text)) { |
|
| 873 | 873 | $elements['twitter:image:alt'] = esc_attr( $alt_text ); |
| 874 | 874 | } |
| 875 | 875 | } |
@@ -877,15 +877,15 @@ discard block |
||
| 877 | 877 | $elements['twitter:card'] = 'summary'; |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - $elements['twitter:site'] = '@' . $ppp_social_settings['twitter']['user']->screen_name; |
|
| 880 | + $elements['twitter:site'] = '@'.$ppp_social_settings['twitter']['user']->screen_name; |
|
| 881 | 881 | $elements['twitter:title'] = esc_attr( strip_tags( $post->post_title ) ); |
| 882 | 882 | $elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() ); |
| 883 | 883 | |
| 884 | 884 | $author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true ); |
| 885 | - if ( ! empty( $author_twitter_handle ) ) { |
|
| 885 | + if ( ! empty($author_twitter_handle)) { |
|
| 886 | 886 | |
| 887 | - if ( strpos( $author_twitter_handle, '@' ) === false ) { |
|
| 888 | - $author_twitter_handle = '@' . $author_twitter_handle; |
|
| 887 | + if (strpos( $author_twitter_handle, '@' ) === false) { |
|
| 888 | + $author_twitter_handle = '@'.$author_twitter_handle; |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | $elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) ); |
@@ -904,13 +904,13 @@ discard block |
||
| 904 | 904 | function ppp_tw_get_card_description() { |
| 905 | 905 | global $post; |
| 906 | 906 | |
| 907 | - if ( ! is_single() || empty( $post ) ) { |
|
| 907 | + if ( ! is_single() || empty($post)) { |
|
| 908 | 908 | return false; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | $excerpt = $post->post_excerpt; |
| 912 | 912 | |
| 913 | - if ( empty( $excerpt ) ) { |
|
| 913 | + if (empty($excerpt)) { |
|
| 914 | 914 | $excerpt = ppp_tw_format_card_description( $post->post_content ); |
| 915 | 915 | } |
| 916 | 916 | |
@@ -928,10 +928,10 @@ discard block |
||
| 928 | 928 | $max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 ); |
| 929 | 929 | $excerpt = strip_tags( $excerpt ); |
| 930 | 930 | |
| 931 | - if ( strlen( $excerpt ) > $max_len ) { |
|
| 931 | + if (strlen( $excerpt ) > $max_len) { |
|
| 932 | 932 | $excerpt_pre = substr( $excerpt, 0, $max_len ); |
| 933 | 933 | $last_space = strrpos( $excerpt_pre, ' ' ); |
| 934 | - $excerpt = substr( $excerpt_pre, 0, $last_space ) . '...'; |
|
| 934 | + $excerpt = substr( $excerpt_pre, 0, $last_space ).'...'; |
|
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | return $excerpt; |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | */ |
| 947 | 947 | function ppp_tw_add_contact_method( $user_contactmethods ) { |
| 948 | 948 | |
| 949 | - if ( ! isset( $user_contactmethods['twitter'] ) ) { |
|
| 949 | + if ( ! isset($user_contactmethods['twitter'])) { |
|
| 950 | 950 | $user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' ); |
| 951 | 951 | } |
| 952 | 952 | // Returns the contact methods |
@@ -965,15 +965,15 @@ discard block |
||
| 965 | 965 | function ppp_tw_profile_settings( $user ) { |
| 966 | 966 | global $ppp_social_settings; |
| 967 | 967 | |
| 968 | - if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) { |
|
| 968 | + if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) { |
|
| 969 | 969 | return; |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | - if ( $user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
| 972 | + if ($user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
| 973 | 973 | return; |
| 974 | 974 | } |
| 975 | 975 | |
| 976 | - if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) { |
|
| 976 | + if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) { |
|
| 977 | 977 | return; |
| 978 | 978 | } |
| 979 | 979 | |
@@ -987,16 +987,16 @@ discard block |
||
| 987 | 987 | <?php |
| 988 | 988 | $twitter = new PPP_Twitter_User( get_current_user_id() ); |
| 989 | 989 | $tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true ); |
| 990 | - if ( empty( $tw_user ) ) { |
|
| 991 | - $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ); |
|
| 990 | + if (empty($tw_user)) { |
|
| 991 | + $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) ); |
|
| 992 | 992 | |
| 993 | - echo '<a target="_blank" href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 993 | + echo '<a target="_blank" href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 994 | 994 | } else { |
| 995 | 995 | $connected = true; |
| 996 | 996 | ?> |
| 997 | 997 | <p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p> |
| 998 | 998 | <p> |
| 999 | - <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> |
|
| 999 | + <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> |
|
| 1000 | 1000 | <a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a> |
| 1001 | 1001 | </p> |
| 1002 | 1002 | <?php |
@@ -1005,12 +1005,12 @@ discard block |
||
| 1005 | 1005 | </td> |
| 1006 | 1006 | </tr> |
| 1007 | 1007 | |
| 1008 | - <?php if ( $connected ) : ?> |
|
| 1008 | + <?php if ($connected) : ?> |
|
| 1009 | 1009 | <?php |
| 1010 | 1010 | $share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true ); |
| 1011 | - $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled' , true ); |
|
| 1011 | + $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled', true ); |
|
| 1012 | 1012 | $share_others_on_publish = get_user_meta( $user->ID, '_ppp_share_others_on_publish', true ); |
| 1013 | - $share_others_scheduled = get_user_meta( $user->ID, '_ppp_share_others_scheduled' , true ); |
|
| 1013 | + $share_others_scheduled = get_user_meta( $user->ID, '_ppp_share_others_scheduled', true ); |
|
| 1014 | 1014 | ?> |
| 1015 | 1015 | <tr> |
| 1016 | 1016 | <th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th> |
@@ -1058,19 +1058,19 @@ discard block |
||
| 1058 | 1058 | function ppp_tw_save_profile( $user_id ) { |
| 1059 | 1059 | global $ppp_social_settings; |
| 1060 | 1060 | |
| 1061 | - if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) { |
|
| 1061 | + if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) { |
|
| 1062 | 1062 | return; |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | - $share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false; |
|
| 1066 | - $share_scheduled = ! empty( $_POST['share_scheduled'] ) ? true : false; |
|
| 1067 | - $share_others_on_publish = ! empty( $_POST['share_others_on_publish'] ) ? true : false; |
|
| 1068 | - $share_others_scheduled = ! empty( $_POST['share_others_scheduled'] ) ? true : false; |
|
| 1065 | + $share_on_publish = ! empty($_POST['share_on_publish']) ? true : false; |
|
| 1066 | + $share_scheduled = ! empty($_POST['share_scheduled']) ? true : false; |
|
| 1067 | + $share_others_on_publish = ! empty($_POST['share_others_on_publish']) ? true : false; |
|
| 1068 | + $share_others_scheduled = ! empty($_POST['share_others_scheduled']) ? true : false; |
|
| 1069 | 1069 | |
| 1070 | 1070 | update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish ); |
| 1071 | - update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); |
|
| 1071 | + update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); |
|
| 1072 | 1072 | update_user_meta( $user_id, '_ppp_share_others_on_publish', $share_others_on_publish ); |
| 1073 | - update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled ); |
|
| 1073 | + update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled ); |
|
| 1074 | 1074 | |
| 1075 | 1075 | } |
| 1076 | 1076 | add_action( 'personal_options_update', 'ppp_tw_save_profile' ); |
@@ -1079,14 +1079,14 @@ discard block |
||
| 1079 | 1079 | function ppp_tw_calendar_on_publish_event( $events, $post_id ) { |
| 1080 | 1080 | $share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true ); |
| 1081 | 1081 | |
| 1082 | - if ( ! empty( $share_on_publish ) ) { |
|
| 1082 | + if ( ! empty($share_on_publish)) { |
|
| 1083 | 1083 | $share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true ); |
| 1084 | 1084 | $events[] = array( |
| 1085 | - 'id' => $post_id . '-share-on-publish', |
|
| 1086 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
| 1087 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 1088 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 1089 | - 'className' => 'ppp-calendar-item-tw cal-post-' . $post_id, |
|
| 1085 | + 'id' => $post_id.'-share-on-publish', |
|
| 1086 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
| 1087 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 1088 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 1089 | + 'className' => 'ppp-calendar-item-tw cal-post-'.$post_id, |
|
| 1090 | 1090 | 'belongsTo' => $post_id, |
| 1091 | 1091 | ); |
| 1092 | 1092 | } |
@@ -1097,9 +1097,9 @@ discard block |
||
| 1097 | 1097 | |
| 1098 | 1098 | function ppp_tw_get_post_shares( $items, $post_id ) { |
| 1099 | 1099 | $tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 1100 | - if ( empty( $tweets ) ) { return $items; } |
|
| 1100 | + if (empty($tweets)) { return $items; } |
|
| 1101 | 1101 | |
| 1102 | - foreach ( $tweets as $key => $tweet ) { |
|
| 1102 | + foreach ($tweets as $key => $tweet) { |
|
| 1103 | 1103 | $items[] = array( 'id' => $key, 'service' => 'tw' ); |
| 1104 | 1104 | } |
| 1105 | 1105 | return $items; |