@@ -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 | $ret = false; |
@@ -73,6 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Strips slashes and html_entities_decode for sending to the networks. |
76 | + * @param string $string |
|
76 | 77 | */ |
77 | 78 | function ppp_entities_and_slashes( $string ) { |
78 | 79 | 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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | function ppp_maybe_start_session() { |
13 | 13 | $ret = false; |
14 | - if ( ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) && !isset( $_SESSION ) && !defined( 'DOING_AJAX' ) ) { |
|
14 | + if ((is_admin() || (defined( 'DOING_CRON' ) && DOING_CRON)) && ! isset($_SESSION) && ! defined( 'DOING_AJAX' )) { |
|
15 | 15 | $ret = session_start(); |
16 | 16 | } |
17 | 17 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | global $ppp_share_settings; |
27 | 27 | $result = false; |
28 | 28 | |
29 | - if ( isset( $ppp_share_settings['analytics'] ) && $ppp_share_settings['analytics'] !== 'none' ) { |
|
30 | - $result = true; |
|
29 | + if (isset($ppp_share_settings['analytics']) && $ppp_share_settings['analytics'] !== 'none') { |
|
30 | + $result = true; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | return apply_filters( 'ppp_is_link_tracking_enabled', $result ); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | function ppp_is_shortener_enabled() { |
69 | 69 | global $ppp_share_settings; |
70 | 70 | |
71 | - return ( isset( $ppp_share_settings['shortener'] ) && !empty( $ppp_share_settings['shortener'] ) && $ppp_share_settings != '-1' ); |
|
71 | + return (isset($ppp_share_settings['shortener']) && ! empty($ppp_share_settings['shortener']) && $ppp_share_settings != '-1'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | $post_types = get_post_types( $post_type_args, NULL, 'and' ); |
101 | 101 | |
102 | 102 | $unsupported_post_types = array( 'wp_log', 'attachment' ); |
103 | - foreach ( $unsupported_post_types as $unsupported_post_type ) { |
|
104 | - if ( array_key_exists( $unsupported_post_type, $post_types ) ) { |
|
105 | - unset( $post_types[ $unsupported_post_type ] ); |
|
103 | + foreach ($unsupported_post_types as $unsupported_post_type) { |
|
104 | + if (array_key_exists( $unsupported_post_type, $post_types )) { |
|
105 | + unset($post_types[$unsupported_post_type]); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | function ppp_should_save( $post_id, $post ) { |
131 | 131 | $ret = true; |
132 | 132 | |
133 | - if ( empty( $_POST ) ) { |
|
133 | + if (empty($_POST)) { |
|
134 | 134 | $ret = false; |
135 | 135 | } |
136 | 136 | |
137 | - if ( wp_is_post_revision( $post_id ) ) { |
|
137 | + if (wp_is_post_revision( $post_id )) { |
|
138 | 138 | $ret = false; |
139 | 139 | } |
140 | 140 | |
141 | 141 | global $ppp_options; |
142 | - if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) || !array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
142 | + if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] ) || ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
143 | 143 | $ret = false; |
144 | 144 | } |
145 | 145 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | function ppp_set_uploads_dir() { |
156 | 156 | $upload_path = ppp_get_upload_path(); |
157 | 157 | |
158 | - if ( false === get_transient( 'ppp_check_protection_files' ) ) { |
|
158 | + if (false === get_transient( 'ppp_check_protection_files' )) { |
|
159 | 159 | |
160 | 160 | // Make sure the /ppp folder is created |
161 | 161 | wp_mkdir_p( $upload_path ); |
@@ -164,22 +164,22 @@ discard block |
||
164 | 164 | $rules = "Options -Indexes\n"; |
165 | 165 | $rules .= "deny from all\n"; |
166 | 166 | |
167 | - $htaccess_exists = file_exists( $upload_path . '/.htaccess' ); |
|
167 | + $htaccess_exists = file_exists( $upload_path.'/.htaccess' ); |
|
168 | 168 | |
169 | - if ( $htaccess_exists ) { |
|
170 | - $contents = @file_get_contents( $upload_path . '/.htaccess' ); |
|
171 | - if ( $contents !== $rules || ! $contents ) { |
|
169 | + if ($htaccess_exists) { |
|
170 | + $contents = @file_get_contents( $upload_path.'/.htaccess' ); |
|
171 | + if ($contents !== $rules || ! $contents) { |
|
172 | 172 | // Update the .htaccess rules if they don't match |
173 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
173 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
174 | 174 | } |
175 | - } elseif( wp_is_writable( $upload_path ) ) { |
|
175 | + } elseif (wp_is_writable( $upload_path )) { |
|
176 | 176 | // Create the file if it doesn't exist |
177 | - @file_put_contents( $upload_path . '/.htaccess', $rules ); |
|
177 | + @file_put_contents( $upload_path.'/.htaccess', $rules ); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | // Top level blank index.php |
181 | - if ( ! file_exists( $upload_path . '/index.php' ) && wp_is_writable( $upload_path ) ) { |
|
182 | - @file_put_contents( $upload_path . '/index.php', '<?php' . PHP_EOL . '// Silence is golden.' ); |
|
181 | + if ( ! file_exists( $upload_path.'/index.php' ) && wp_is_writable( $upload_path )) { |
|
182 | + @file_put_contents( $upload_path.'/index.php', '<?php'.PHP_EOL.'// Silence is golden.' ); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | // Check for the files once per day |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | function ppp_get_upload_path() { |
198 | 198 | $wp_upload_dir = wp_upload_dir(); |
199 | - return $wp_upload_dir['basedir'] . '/ppp'; |
|
199 | + return $wp_upload_dir['basedir'].'/ppp'; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | |
210 | 210 | $completed_upgrades = get_option( 'ppp_completed_upgrades' ); |
211 | 211 | |
212 | - if ( false === $completed_upgrades ) { |
|
212 | + if (false === $completed_upgrades) { |
|
213 | 213 | $completed_upgrades = array(); |
214 | 214 | } |
215 | 215 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function ppp_has_upgrade_completed( $upgrade_action = '' ) { |
228 | 228 | |
229 | - if ( empty( $upgrade_action ) ) { |
|
229 | + if (empty($upgrade_action)) { |
|
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function ppp_set_upgrade_complete( $upgrade_action = '' ) { |
247 | 247 | |
248 | - if ( empty( $upgrade_action ) ) { |
|
248 | + if (empty($upgrade_action)) { |
|
249 | 249 | return false; |
250 | 250 | } |
251 | 251 | |
@@ -270,48 +270,48 @@ discard block |
||
270 | 270 | $url = strtolower( trim( get_home_url( '/' ) ) ); |
271 | 271 | |
272 | 272 | // Need to get the host...so let's add the scheme so we can use parse_url |
273 | - if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) { |
|
274 | - $url = 'http://' . $url; |
|
273 | + if (false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' )) { |
|
274 | + $url = 'http://'.$url; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | $url_parts = parse_url( $url ); |
278 | - $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false; |
|
278 | + $host = ! empty($url_parts['host']) ? $url_parts['host'] : false; |
|
279 | 279 | |
280 | - if ( ! empty( $url ) && ! empty( $host ) ) { |
|
280 | + if ( ! empty($url) && ! empty($host)) { |
|
281 | 281 | |
282 | - if ( false !== ip2long( $host ) ) { |
|
283 | - if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) { |
|
282 | + if (false !== ip2long( $host )) { |
|
283 | + if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE )) { |
|
284 | 284 | $is_local_url = true; |
285 | 285 | } |
286 | - } else if ( 'localhost' === $host ) { |
|
286 | + } else if ('localhost' === $host) { |
|
287 | 287 | $is_local_url = true; |
288 | 288 | } |
289 | 289 | |
290 | 290 | $check_tlds = apply_filters( 'ppp_validate_tlds', true ); |
291 | - if ( $check_tlds ) { |
|
291 | + if ($check_tlds) { |
|
292 | 292 | $tlds_to_check = apply_filters( 'ppp_url_tlds', array( |
293 | 293 | '.dev', '.local', '.test', |
294 | 294 | ) ); |
295 | 295 | |
296 | - foreach ( $tlds_to_check as $tld ) { |
|
297 | - if ( false !== strpos( $host, $tld ) ) { |
|
296 | + foreach ($tlds_to_check as $tld) { |
|
297 | + if (false !== strpos( $host, $tld )) { |
|
298 | 298 | $is_local_url = true; |
299 | 299 | continue; |
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | - if ( substr_count( $host, '.' ) > 1 ) { |
|
304 | + if (substr_count( $host, '.' ) > 1) { |
|
305 | 305 | $subdomains_to_check = apply_filters( 'ppp_url_subdomains', array( |
306 | 306 | 'dev.', '*.staging.', |
307 | 307 | ) ); |
308 | 308 | |
309 | - foreach ( $subdomains_to_check as $subdomain ) { |
|
309 | + foreach ($subdomains_to_check as $subdomain) { |
|
310 | 310 | |
311 | 311 | $subdomain = str_replace( '.', '(.)', $subdomain ); |
312 | 312 | $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); |
313 | 313 | |
314 | - if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) { |
|
314 | + if (preg_match( '/^('.$subdomain.')/', $host )) { |
|
315 | 315 | $is_local_url = true; |
316 | 316 | continue; |
317 | 317 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Register Twitter as a servcie |
24 | 24 | * @param array $services The registered services |
25 | - * @return array With Twitter added |
|
25 | + * @return string[] With Twitter added |
|
26 | 26 | */ |
27 | 27 | function ppp_tw_register_service( $services = array() ) { |
28 | 28 | $services[] = 'tw'; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * Register the Twitter connection area for the Social Media Accounts section |
242 | 242 | * @param array $content The existing content tokens |
243 | - * @return array The content tokens with Twitter added |
|
243 | + * @return string[] The content tokens with Twitter added |
|
244 | 244 | */ |
245 | 245 | function ppp_tw_register_admin_social_content( $content ) { |
246 | 246 | $content[] = 'tw'; |
@@ -429,9 +429,12 @@ |
||
429 | 429 | } |
430 | 430 | ?> |
431 | 431 | |
432 | - <?php else: ?> |
|
432 | + <?php else { |
|
433 | + : ?> |
|
433 | 434 | |
434 | - <?php ppp_render_tweet_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); ?> |
|
435 | + <?php ppp_render_tweet_row( 1, array( 'date' => '', 'time' => '', 'text' => '', 'image' => '', 'attachment_id' => '' ), $post->ID, 1 ); |
|
436 | +} |
|
437 | +?> |
|
435 | 438 | |
436 | 439 | <?php endif; ?> |
437 | 440 |
@@ -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( PostPromoterPro::get_manage_capability() ) ) { |
|
132 | + if ($user_id !== get_current_user_id() || ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
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 ); |
@@ -200,12 +200,12 @@ discard block |
||
200 | 200 | |
201 | 201 | update_post_meta( $log_entry, '_ppp_share_status', $status ); |
202 | 202 | |
203 | - if ( ! empty( $status->id_str ) ) { |
|
203 | + if ( ! empty($status->id_str)) { |
|
204 | 204 | $post = get_post( $post_id ); |
205 | 205 | $author_id = $post->post_author; |
206 | 206 | $author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true ); |
207 | 207 | |
208 | - if ( $author_rt ) { |
|
208 | + if ($author_rt) { |
|
209 | 209 | $twitter_user = new PPP_Twitter_User( $author_id ); |
210 | 210 | $twitter_user->retweet( $status->id_str ); |
211 | 211 | } |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | ); |
227 | 227 | $other_rt = get_users( $args ); |
228 | 228 | |
229 | - if ( $other_rt ){ |
|
230 | - foreach ( $other_rt as $user ) { |
|
229 | + if ($other_rt) { |
|
230 | + foreach ($other_rt as $user) { |
|
231 | 231 | $twitter_user = new PPP_Twitter_User( $user->ID ); |
232 | 232 | $twitter_user->retweet( $status->id_str ); |
233 | 233 | } |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) { |
248 | 248 | $share_content = ppp_tw_generate_share_content( $post_id, $name, $scheduled ); |
249 | 249 | |
250 | - if ( $include_link ) { |
|
250 | + if ($include_link) { |
|
251 | 251 | $share_link = ppp_generate_link( $post_id, $name, $scheduled ); |
252 | - $share_content = $share_content . ' ' . $share_link; |
|
252 | + $share_content = $share_content.' '.$share_link; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return apply_filters( 'ppp_tw_build_share_message', $share_content ); |
@@ -263,22 +263,22 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
265 | 265 | global $ppp_options; |
266 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
266 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
267 | 267 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
268 | 268 | |
269 | - if ( ! empty( $ppp_tweets ) ) { |
|
269 | + if ( ! empty($ppp_tweets)) { |
|
270 | 270 | $name_array = explode( '_', $name ); |
271 | 271 | $index = $name_array[1]; |
272 | - if ( isset( $ppp_tweets[ $index ] ) ) { |
|
273 | - $share_content = $ppp_tweets[ $index ]['text']; |
|
272 | + if (isset($ppp_tweets[$index])) { |
|
273 | + $share_content = $ppp_tweets[$index]['text']; |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | 277 | // If an override was found, use it, otherwise try the default text content |
278 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
278 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
279 | 279 | |
280 | 280 | // If the content is still empty, just use the post title |
281 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
281 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
282 | 282 | |
283 | 283 | return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) ); |
284 | 284 | } |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | * @return bool Whether or not this tweet should contain a media post |
291 | 291 | */ |
292 | 292 | function ppp_tw_use_media( $post_id, $index ) { |
293 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
293 | + if (empty($post_id) || empty($index)) { |
|
294 | 294 | return false; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $share_data = get_post_meta( $post_id, '_ppp_tweets', true ); |
298 | - $use_media = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false; |
|
298 | + $use_media = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false; |
|
299 | 299 | |
300 | 300 | return $use_media; |
301 | 301 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @return void |
307 | 307 | */ |
308 | 308 | function ppp_set_tw_token_constants( $social_tokens ) { |
309 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) { |
|
309 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) { |
|
310 | 310 | define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token ); |
311 | 311 | define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret ); |
312 | 312 | } |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | function ppp_tw_add_meta_tab( $tabs ) { |
346 | 346 | global $ppp_social_settings; |
347 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
347 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
348 | 348 | return $tabs; |
349 | 349 | } |
350 | 350 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | function ppp_tw_register_metabox_content( $content ) { |
363 | 363 | global $ppp_social_settings; |
364 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
364 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
365 | 365 | return $content; |
366 | 366 | } |
367 | 367 | |
@@ -420,16 +420,16 @@ discard block |
||
420 | 420 | <tbody> |
421 | 421 | <?php ppp_render_tweet_share_on_publish_row(); ?> |
422 | 422 | <?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?> |
423 | - <?php if ( ! empty( $tweets ) ) : ?> |
|
423 | + <?php if ( ! empty($tweets)) : ?> |
|
424 | 424 | |
425 | - <?php foreach ( $tweets as $key => $value ) : |
|
426 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
427 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
428 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
429 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
430 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
425 | + <?php foreach ($tweets as $key => $value) : |
|
426 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
427 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
428 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
429 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
430 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
431 | 431 | |
432 | - $args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); |
|
432 | + $args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); |
|
433 | 433 | ?> |
434 | 434 | |
435 | 435 | <?php ppp_render_tweet_row( $key, $args, $post->ID ); ?> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | <?php endforeach; ?> |
439 | 439 | |
440 | 440 | <?php |
441 | - if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) { |
|
441 | + if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) { |
|
442 | 442 | $args = array( |
443 | 443 | 'date' => '', |
444 | 444 | 'time' => '', |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | <tr class="ppp-add-repeatable-wrapper"> |
462 | 462 | <td class="submit" colspan="4" style="float: none; clear:both; background:#fff;"> |
463 | 463 | <a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a> |
464 | - <?php if ( ! empty( $has_past_shares ) ) : ?> |
|
464 | + <?php if ( ! empty($has_past_shares)) : ?> |
|
465 | 465 | <a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a> |
466 | 466 | <?php endif; ?> |
467 | 467 | </td> |
@@ -487,38 +487,38 @@ discard block |
||
487 | 487 | */ |
488 | 488 | function ppp_render_tweet_share_on_publish_row() { |
489 | 489 | global $post, $ppp_share_settings; |
490 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
490 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
491 | 491 | |
492 | 492 | $ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true ); |
493 | 493 | |
494 | 494 | $ppp_share_on_publish = get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
495 | 495 | $show_share_on_publish = false; |
496 | 496 | |
497 | - $share_by_default = empty( $ppp_share_settings['share_on_publish'][ $post->post_type ]['twitter'] ) ? false : true; |
|
497 | + $share_by_default = empty($ppp_share_settings['share_on_publish'][$post->post_type]['twitter']) ? false : true; |
|
498 | 498 | |
499 | - if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) { |
|
499 | + if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) { |
|
500 | 500 | $show_share_on_publish = true; |
501 | 501 | } |
502 | 502 | |
503 | 503 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
504 | 504 | $ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
505 | 505 | |
506 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; |
|
506 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; |
|
507 | 507 | ?> |
508 | 508 | <tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row"> |
509 | 509 | <td colspan="2" class="ppp-on-plublish-date-column"> |
510 | - <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 ); ?> /> |
|
510 | + <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 ); ?> /> |
|
511 | 511 | <label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label> |
512 | 512 | </td> |
513 | 513 | |
514 | 514 | <td> |
515 | - <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> |
|
516 | - <?php $length = ! empty( $ppp_share_on_publish_text ) ? strlen( $ppp_share_on_publish_text ) : 0; ?> |
|
515 | + <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> |
|
516 | + <?php $length = ! empty($ppp_share_on_publish_text) ? strlen( $ppp_share_on_publish_text ) : 0; ?> |
|
517 | 517 | <span class="ppp-text-length"><?php echo $length; ?></span> |
518 | 518 | </td> |
519 | 519 | |
520 | 520 | <td style="width: 200px" colspan="2"> |
521 | - <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 ); ?>/> |
|
521 | + <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 ); ?>/> |
|
522 | 522 | <label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label> |
523 | 523 | </td> |
524 | 524 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | function ppp_render_tweet_row( $key, $args = array(), $post_id ) { |
538 | 538 | global $post, $has_past_shares; |
539 | 539 | |
540 | - if ( ! empty( $args['date'] ) && ! empty( $args['time'] ) ) { |
|
540 | + if ( ! empty($args['date']) && ! empty($args['time'])) { |
|
541 | 541 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
542 | 542 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
543 | 543 | } else { |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | $readonly = false; |
546 | 546 | } |
547 | 547 | |
548 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
549 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
550 | - $shared = ! empty( $readonly ) ? 'past-share' : ''; |
|
548 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
549 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
550 | + $shared = ! empty($readonly) ? 'past-share' : ''; |
|
551 | 551 | |
552 | - if ( ! empty( $readonly ) ) { |
|
552 | + if ( ! empty($readonly)) { |
|
553 | 553 | $has_past_shares++; |
554 | 554 | } |
555 | 555 | ?> |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | <td> |
566 | 566 | <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> |
567 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> |
|
567 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> |
|
568 | 568 | <span class="ppp-text-length"><?php echo $length; ?></span> |
569 | 569 | </td> |
570 | 570 | |
@@ -599,24 +599,24 @@ discard block |
||
599 | 599 | */ |
600 | 600 | function ppp_tw_save_post_meta_boxes( $post_id, $post ) { |
601 | 601 | |
602 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
602 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
603 | 603 | return; |
604 | 604 | } |
605 | 605 | |
606 | - $ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
606 | + $ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
607 | 607 | |
608 | - $ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
609 | - $ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
610 | - $ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
608 | + $ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
609 | + $ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
610 | + $ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
611 | 611 | |
612 | 612 | |
613 | 613 | update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish ); |
614 | 614 | update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text ); |
615 | 615 | update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image ); |
616 | 616 | |
617 | - $tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array(); |
|
618 | - foreach ( $tweet_data as $index => $tweet ) { |
|
619 | - $tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] ); |
|
617 | + $tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array(); |
|
618 | + foreach ($tweet_data as $index => $tweet) { |
|
619 | + $tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] ); |
|
620 | 620 | } |
621 | 621 | update_post_meta( $post_id, '_ppp_tweets', $tweet_data ); |
622 | 622 | |
@@ -633,29 +633,29 @@ discard block |
||
633 | 633 | function ppp_tw_share_on_publish( $new_status, $old_status, $post ) { |
634 | 634 | global $ppp_options; |
635 | 635 | |
636 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
637 | - $from_post = isset( $_POST['_ppp_share_on_publish'] ); |
|
636 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
637 | + $from_post = isset($_POST['_ppp_share_on_publish']); |
|
638 | 638 | |
639 | - if ( empty( $from_meta ) && empty( $from_post ) ) { |
|
639 | + if (empty($from_meta) && empty($from_post)) { |
|
640 | 640 | return; |
641 | 641 | } |
642 | 642 | |
643 | 643 | // Determine if we're seeing the share on publish in meta or $_POST |
644 | - if ( $from_meta && !$from_post ) { |
|
644 | + if ($from_meta && ! $from_post) { |
|
645 | 645 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
646 | 646 | $use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
647 | 647 | } else { |
648 | - $ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
649 | - $use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
648 | + $ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
649 | + $use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
650 | 650 | } |
651 | 651 | |
652 | - $share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
652 | + $share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
653 | 653 | $share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) ); |
654 | - $name = 'sharedate_0_' . $post->ID; |
|
654 | + $name = 'sharedate_0_'.$post->ID; |
|
655 | 655 | $media = ppp_post_has_media( $post->ID, 'tw', $use_media ); |
656 | 656 | $share_link = ppp_generate_link( $post->ID, $name, true ); |
657 | 657 | |
658 | - $status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media ); |
|
658 | + $status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media ); |
|
659 | 659 | |
660 | 660 | $log_title = ppp_tw_build_share_message( $post->ID, $name, false, false ); |
661 | 661 | |
@@ -673,11 +673,11 @@ discard block |
||
673 | 673 | |
674 | 674 | $log_entry = WP_Logging::insert_log( $log_data, $log_meta ); |
675 | 675 | |
676 | - if ( ! empty( $status->id_str ) ) { |
|
676 | + if ( ! empty($status->id_str)) { |
|
677 | 677 | $author_id = $post->post_author; |
678 | 678 | $author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true ); |
679 | 679 | |
680 | - if ( $author_rt ) { |
|
680 | + if ($author_rt) { |
|
681 | 681 | $twitter_user = new PPP_Twitter_User( $author_id ); |
682 | 682 | $twitter_user->retweet( $status->id_str ); |
683 | 683 | } |
@@ -698,8 +698,8 @@ discard block |
||
698 | 698 | ); |
699 | 699 | $other_rt = get_users( $args ); |
700 | 700 | |
701 | - if ( $other_rt ){ |
|
702 | - foreach ( $other_rt as $user ) { |
|
701 | + if ($other_rt) { |
|
702 | + foreach ($other_rt as $user) { |
|
703 | 703 | $twitter_user = new PPP_Twitter_User( $user->ID ); |
704 | 704 | $twitter_user->retweet( $status->id_str ); |
705 | 705 | } |
@@ -720,20 +720,20 @@ discard block |
||
720 | 720 | function ppp_tw_generate_timestamps( $times, $post_id ) { |
721 | 721 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
722 | 722 | |
723 | - if ( empty( $ppp_tweets ) ) { |
|
723 | + if (empty($ppp_tweets)) { |
|
724 | 724 | $ppp_tweets = array(); |
725 | 725 | } |
726 | 726 | |
727 | - foreach ( $ppp_tweets as $key => $data ) { |
|
728 | - if ( ! array_filter( $data ) ) { |
|
727 | + foreach ($ppp_tweets as $key => $data) { |
|
728 | + if ( ! array_filter( $data )) { |
|
729 | 729 | continue; |
730 | 730 | } |
731 | 731 | |
732 | 732 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
733 | 733 | |
734 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
735 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw'; |
|
736 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw'; |
|
734 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
735 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw'; |
|
736 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw'; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | } |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | $ret = false; |
755 | 755 | |
756 | - if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) { |
|
756 | + if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) { |
|
757 | 757 | $ret = true; |
758 | 758 | } |
759 | 759 | |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | */ |
769 | 769 | function ppp_tw_card_meta() { |
770 | 770 | |
771 | - if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) { |
|
771 | + if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) { |
|
772 | 772 | return; |
773 | 773 | } |
774 | 774 | |
775 | 775 | global $post, $ppp_options; |
776 | 776 | |
777 | - if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
777 | + if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
778 | 778 | return; |
779 | 779 | } |
780 | 780 | |
@@ -792,20 +792,20 @@ discard block |
||
792 | 792 | |
793 | 793 | $return = ''; |
794 | 794 | |
795 | - if ( ! is_single() || ! ppp_tw_cards_enabled() ) { |
|
795 | + if ( ! is_single() || ! ppp_tw_cards_enabled()) { |
|
796 | 796 | return $return; |
797 | 797 | } |
798 | 798 | |
799 | 799 | global $post, $ppp_social_settings; |
800 | 800 | |
801 | 801 | |
802 | - if ( empty( $post ) ) { |
|
802 | + if (empty($post)) { |
|
803 | 803 | return; |
804 | 804 | } |
805 | 805 | |
806 | 806 | $elements = ppp_tw_default_meta_elements(); |
807 | - foreach ( $elements as $name => $content ) { |
|
808 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; |
|
807 | + foreach ($elements as $name => $content) { |
|
808 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | return apply_filters( 'ppp_tw_card_meta', $return ); |
@@ -825,15 +825,15 @@ discard block |
||
825 | 825 | $elements = array(); |
826 | 826 | |
827 | 827 | $image_url = ppp_post_has_media( $post->ID, 'tw', true ); |
828 | - if ( $image_url ) { |
|
828 | + if ($image_url) { |
|
829 | 829 | $elements['twitter:card'] = 'summary_large_image'; |
830 | 830 | $elements['twitter:image:src'] = $image_url; |
831 | 831 | |
832 | 832 | $thumb_id = ppp_get_attachment_id_from_image_url( $image_url ); |
833 | - if ( ! empty( $thumb_id ) ) { |
|
833 | + if ( ! empty($thumb_id)) { |
|
834 | 834 | $alt_text = ppp_get_attachment_alt_text( $thumb_id ); |
835 | 835 | // When adding media via the WP Uploader, any 'alt text' supplied will be used as the accessible alt text. |
836 | - if ( ! empty( $alt_text ) ) { |
|
836 | + if ( ! empty($alt_text)) { |
|
837 | 837 | $elements['twitter:image:alt'] = esc_attr( $alt_text ); |
838 | 838 | } |
839 | 839 | } |
@@ -841,15 +841,15 @@ discard block |
||
841 | 841 | $elements['twitter:card'] = 'summary'; |
842 | 842 | } |
843 | 843 | |
844 | - $elements['twitter:site'] = '@' . $ppp_social_settings['twitter']['user']->screen_name; |
|
844 | + $elements['twitter:site'] = '@'.$ppp_social_settings['twitter']['user']->screen_name; |
|
845 | 845 | $elements['twitter:title'] = esc_attr( strip_tags( $post->post_title ) ); |
846 | 846 | $elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() ); |
847 | 847 | |
848 | 848 | $author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true ); |
849 | - if ( ! empty( $author_twitter_handle ) ) { |
|
849 | + if ( ! empty($author_twitter_handle)) { |
|
850 | 850 | |
851 | - if ( strpos( $author_twitter_handle, '@' ) === false ) { |
|
852 | - $author_twitter_handle = '@' . $author_twitter_handle; |
|
851 | + if (strpos( $author_twitter_handle, '@' ) === false) { |
|
852 | + $author_twitter_handle = '@'.$author_twitter_handle; |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | $elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) ); |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | function ppp_tw_get_card_description() { |
869 | 869 | global $post; |
870 | 870 | |
871 | - if ( ! is_single() || empty( $post ) ) { |
|
871 | + if ( ! is_single() || empty($post)) { |
|
872 | 872 | return false; |
873 | 873 | } |
874 | 874 | |
875 | 875 | $excerpt = $post->post_excerpt; |
876 | 876 | |
877 | - if ( empty( $excerpt ) ) { |
|
877 | + if (empty($excerpt)) { |
|
878 | 878 | $excerpt = ppp_tw_format_card_description( $post->post_content ); |
879 | 879 | } |
880 | 880 | |
@@ -892,10 +892,10 @@ discard block |
||
892 | 892 | $max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 ); |
893 | 893 | $excerpt = strip_tags( $excerpt ); |
894 | 894 | |
895 | - if ( strlen( $excerpt ) > $max_len ) { |
|
895 | + if (strlen( $excerpt ) > $max_len) { |
|
896 | 896 | $excerpt_pre = substr( $excerpt, 0, $max_len ); |
897 | 897 | $last_space = strrpos( $excerpt_pre, ' ' ); |
898 | - $excerpt = substr( $excerpt_pre, 0, $last_space ) . '...'; |
|
898 | + $excerpt = substr( $excerpt_pre, 0, $last_space ).'...'; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | return $excerpt; |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | */ |
911 | 911 | function ppp_tw_add_contact_method( $user_contactmethods ) { |
912 | 912 | |
913 | - if ( ! isset( $user_contactmethods['twitter'] ) ) { |
|
913 | + if ( ! isset($user_contactmethods['twitter'])) { |
|
914 | 914 | $user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' ); |
915 | 915 | } |
916 | 916 | // Returns the contact methods |
@@ -929,15 +929,15 @@ discard block |
||
929 | 929 | function ppp_tw_profile_settings( $user ) { |
930 | 930 | global $ppp_social_settings; |
931 | 931 | |
932 | - if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) { |
|
932 | + if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) { |
|
933 | 933 | return; |
934 | 934 | } |
935 | 935 | |
936 | - if ( $user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
936 | + if ($user->ID !== get_current_user_id() && ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
937 | 937 | return; |
938 | 938 | } |
939 | 939 | |
940 | - if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) { |
|
940 | + if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) { |
|
941 | 941 | return; |
942 | 942 | } |
943 | 943 | |
@@ -951,16 +951,16 @@ discard block |
||
951 | 951 | <?php |
952 | 952 | $twitter = new PPP_Twitter_User( get_current_user_id() ); |
953 | 953 | $tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true ); |
954 | - if ( empty( $tw_user ) ) { |
|
955 | - $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ); |
|
954 | + if (empty($tw_user)) { |
|
955 | + $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) ); |
|
956 | 956 | |
957 | - echo '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
957 | + echo '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
958 | 958 | } else { |
959 | 959 | $connected = true; |
960 | 960 | ?> |
961 | 961 | <p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p> |
962 | 962 | <p> |
963 | - <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> |
|
963 | + <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> |
|
964 | 964 | <a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a> |
965 | 965 | </p> |
966 | 966 | <?php |
@@ -969,12 +969,12 @@ discard block |
||
969 | 969 | </td> |
970 | 970 | </tr> |
971 | 971 | |
972 | - <?php if ( $connected ) : ?> |
|
972 | + <?php if ($connected) : ?> |
|
973 | 973 | <?php |
974 | 974 | $share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true ); |
975 | - $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled' , true ); |
|
975 | + $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled', true ); |
|
976 | 976 | $share_others_on_publish = get_user_meta( $user->ID, '_ppp_share_others_on_publish', true ); |
977 | - $share_others_scheduled = get_user_meta( $user->ID, '_ppp_share_others_scheduled' , true ); |
|
977 | + $share_others_scheduled = get_user_meta( $user->ID, '_ppp_share_others_scheduled', true ); |
|
978 | 978 | ?> |
979 | 979 | <tr> |
980 | 980 | <th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th> |
@@ -1022,19 +1022,19 @@ discard block |
||
1022 | 1022 | function ppp_tw_save_profile( $user_id ) { |
1023 | 1023 | global $ppp_social_settings; |
1024 | 1024 | |
1025 | - if ( ! isset( $ppp_social_settings['twitter'] ) || is_null( $ppp_social_settings['twitter'] ) ) { |
|
1025 | + if ( ! isset($ppp_social_settings['twitter']) || is_null( $ppp_social_settings['twitter'] )) { |
|
1026 | 1026 | return; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - $share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false; |
|
1030 | - $share_scheduled = ! empty( $_POST['share_scheduled'] ) ? true : false; |
|
1031 | - $share_others_on_publish = ! empty( $_POST['share_others_on_publish'] ) ? true : false; |
|
1032 | - $share_others_scheduled = ! empty( $_POST['share_others_scheduled'] ) ? true : false; |
|
1029 | + $share_on_publish = ! empty($_POST['share_on_publish']) ? true : false; |
|
1030 | + $share_scheduled = ! empty($_POST['share_scheduled']) ? true : false; |
|
1031 | + $share_others_on_publish = ! empty($_POST['share_others_on_publish']) ? true : false; |
|
1032 | + $share_others_scheduled = ! empty($_POST['share_others_scheduled']) ? true : false; |
|
1033 | 1033 | |
1034 | 1034 | update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish ); |
1035 | - update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); |
|
1035 | + update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); |
|
1036 | 1036 | update_user_meta( $user_id, '_ppp_share_others_on_publish', $share_others_on_publish ); |
1037 | - update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled ); |
|
1037 | + update_user_meta( $user_id, '_ppp_share_others_scheduled', $share_others_scheduled ); |
|
1038 | 1038 | |
1039 | 1039 | } |
1040 | 1040 | add_action( 'personal_options_update', 'ppp_tw_save_profile' ); |
@@ -1043,14 +1043,14 @@ discard block |
||
1043 | 1043 | function ppp_tw_calendar_on_publish_event( $events, $post_id ) { |
1044 | 1044 | $share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true ); |
1045 | 1045 | |
1046 | - if ( ! empty( $share_on_publish ) ) { |
|
1046 | + if ( ! empty($share_on_publish)) { |
|
1047 | 1047 | $share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true ); |
1048 | 1048 | $events[] = array( |
1049 | - 'id' => $post_id . '-share-on-publish', |
|
1050 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
1051 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
1052 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
1053 | - 'className' => 'ppp-calendar-item-tw cal-post-' . $post_id, |
|
1049 | + 'id' => $post_id.'-share-on-publish', |
|
1050 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
1051 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
1052 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
1053 | + 'className' => 'ppp-calendar-item-tw cal-post-'.$post_id, |
|
1054 | 1054 | 'belongsTo' => $post_id, |
1055 | 1055 | ); |
1056 | 1056 | } |
@@ -1061,9 +1061,9 @@ discard block |
||
1061 | 1061 | |
1062 | 1062 | function ppp_tw_get_post_shares( $items, $post_id ) { |
1063 | 1063 | $tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
1064 | - if ( empty( $tweets ) ) { return $items; } |
|
1064 | + if (empty($tweets)) { return $items; } |
|
1065 | 1065 | |
1066 | - foreach ( $tweets as $key => $tweet ) { |
|
1066 | + foreach ($tweets as $key => $tweet) { |
|
1067 | 1067 | $items[] = array( 'id' => $key, 'service' => 'tw' ); |
1068 | 1068 | } |
1069 | 1069 | 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 | |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $date = sanitize_text_field( $_POST['date'] ); |
11 | 11 | $time = sanitize_text_field( $_POST['time'] ); |
12 | 12 | |
13 | - $offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
13 | + $offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
14 | 14 | |
15 | 15 | $share_time = explode( ':', $time ); |
16 | 16 | |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
19 | 19 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
20 | 20 | |
21 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
21 | + if ($ampm == 'pm' && $hours != 12) { |
|
22 | 22 | $hours = $hours + 12; |
23 | 23 | } |
24 | 24 | |
25 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
25 | + if ($ampm == 'am' && $hours == 12) { |
|
26 | 26 | $hours = 00; |
27 | 27 | } |
28 | 28 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
8 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
9 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
8 | +if ( ! class_exists( 'WP_List_Table' )) { |
|
9 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return string The Content to display |
43 | 43 | */ |
44 | 44 | public function column_default( $item, $column_name ) { |
45 | - return $item[ $column_name ]; |
|
45 | + return $item[$column_name]; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | |
75 | 75 | $accounts = apply_filters( 'ppp_register_social_service', array() ); |
76 | 76 | |
77 | - foreach ( $accounts as $account ) { |
|
77 | + foreach ($accounts as $account) { |
|
78 | 78 | $data[$account] = array( |
79 | - 'icon' => apply_filters( 'ppp_account_list_icon-' . $account, '' ), |
|
80 | - 'avatar' => apply_filters( 'ppp_account_list_avatar-' . $account, '' ), |
|
81 | - 'name' => apply_filters( 'ppp_account_list_name-' . $account, '' ), |
|
82 | - 'actions' => apply_filters( 'ppp_account_list_actions-' . $account, '' ), |
|
83 | - 'extras' => apply_filters( 'ppp_account_list_extras-' . $account, '' ), |
|
79 | + 'icon' => apply_filters( 'ppp_account_list_icon-'.$account, '' ), |
|
80 | + 'avatar' => apply_filters( 'ppp_account_list_avatar-'.$account, '' ), |
|
81 | + 'name' => apply_filters( 'ppp_account_list_name-'.$account, '' ), |
|
82 | + 'actions' => apply_filters( 'ppp_account_list_actions-'.$account, '' ), |
|
83 | + 'extras' => apply_filters( 'ppp_account_list_extras-'.$account, '' ), |
|
84 | 84 | ); |
85 | 85 | } |
86 | 86 |
@@ -43,21 +43,21 @@ |
||
43 | 43 | */ |
44 | 44 | public function column_default( $item, $column_name ) { |
45 | 45 | switch ( $column_name ) { |
46 | - case 'date': |
|
47 | - case 'post_title': |
|
48 | - return $item[ $column_name ]; |
|
49 | - case 'content': |
|
50 | - $content = $item[ $column_name ]; |
|
51 | - return $content; |
|
52 | - case 'image': |
|
53 | - if ( ! empty( $item['image_url'] ) ) { |
|
54 | - $content = '<img src="' . $item['image_url'] . '" />'; |
|
55 | - } else { |
|
56 | - $content = __( 'None', 'ppp-txt' ); |
|
57 | - } |
|
58 | - return $content; |
|
59 | - default: |
|
60 | - return; |
|
46 | + case 'date': |
|
47 | + case 'post_title': |
|
48 | + return $item[ $column_name ]; |
|
49 | + case 'content': |
|
50 | + $content = $item[ $column_name ]; |
|
51 | + return $content; |
|
52 | + case 'image': |
|
53 | + if ( ! empty( $item['image_url'] ) ) { |
|
54 | + $content = '<img src="' . $item['image_url'] . '" />'; |
|
55 | + } else { |
|
56 | + $content = __( 'None', 'ppp-txt' ); |
|
57 | + } |
|
58 | + return $content; |
|
59 | + default: |
|
60 | + return; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
8 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
9 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
8 | +if ( ! class_exists( 'WP_List_Table' )) { |
|
9 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | * @return string The Content to display |
43 | 43 | */ |
44 | 44 | public function column_default( $item, $column_name ) { |
45 | - switch ( $column_name ) { |
|
45 | + switch ($column_name) { |
|
46 | 46 | case 'date': |
47 | 47 | case 'post_title': |
48 | - return $item[ $column_name ]; |
|
48 | + return $item[$column_name]; |
|
49 | 49 | case 'content': |
50 | - $content = $item[ $column_name ]; |
|
50 | + $content = $item[$column_name]; |
|
51 | 51 | return $content; |
52 | 52 | case 'image': |
53 | - if ( ! empty( $item['image_url'] ) ) { |
|
54 | - $content = '<img src="' . $item['image_url'] . '" />'; |
|
53 | + if ( ! empty($item['image_url'])) { |
|
54 | + $content = '<img src="'.$item['image_url'].'" />'; |
|
55 | 55 | } else { |
56 | 56 | $content = __( 'None', 'ppp-txt' ); |
57 | 57 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | * @return string The HTML to display for this column. |
83 | 83 | */ |
84 | 84 | public function column_post_title( $item ) { |
85 | - $item_name = $item['name'] . '_' . $item['service']; |
|
85 | + $item_name = $item['name'].'_'.$item['service']; |
|
86 | 86 | $actions = array( |
87 | - 'edit' => sprintf( __( '<a href="%s">Edit</a>', 'ppp-txt' ), admin_url( 'post.php?post=' . $item['post_id'] . '&action=edit#ppp_schedule_metabox' ) ), |
|
88 | - 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=delete_item&post_id=' . $item['post_id'] . '&name=' . $item_name . '&index=' . $item['index'] ) ), |
|
89 | - 'share' => sprintf( __( '<a href="%s">Share Now</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id=' . $item['post_id'] . '&name=' . $item_name ) ), |
|
90 | - 'share_delete' => sprintf( __( '<a href="%s">Share Now & Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id=' . $item['post_id'] . '&name=' . $item_name . '&index=' . $item['index'] . '&delete_too=true' ) ), |
|
87 | + 'edit' => sprintf( __( '<a href="%s">Edit</a>', 'ppp-txt' ), admin_url( 'post.php?post='.$item['post_id'].'&action=edit#ppp_schedule_metabox' ) ), |
|
88 | + 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=delete_item&post_id='.$item['post_id'].'&name='.$item_name.'&index='.$item['index'] ) ), |
|
89 | + 'share' => sprintf( __( '<a href="%s">Share Now</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id='.$item['post_id'].'&name='.$item_name ) ), |
|
90 | + 'share_delete' => sprintf( __( '<a href="%s">Share Now & Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id='.$item['post_id'].'&name='.$item_name.'&index='.$item['index'].'&delete_too=true' ) ), |
|
91 | 91 | ); |
92 | 92 | |
93 | - return sprintf( '<span class="dashicons icon-ppp-' . $item['service'] . '"></span> %1$s %2$s', $item['post_title'], $this->row_actions( $actions ) ); |
|
93 | + return sprintf( '<span class="dashicons icon-ppp-'.$item['service'].'"></span> %1$s %2$s', $item['post_title'], $this->row_actions( $actions ) ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | * @return string The HTML to display the date |
100 | 100 | */ |
101 | 101 | public function column_date( $item ) { |
102 | - $date = date_i18n( get_option('date_format') . ' @ ' . get_option('time_format'), $item['date'] ); |
|
103 | - if ( $item['conflict'] ) { |
|
104 | - $date .= '<br /><small style="color: red">' . __( 'Warning: Multiple items scheduled at this time.', 'ppp-txt' ) . '</small>'; |
|
102 | + $date = date_i18n( get_option( 'date_format' ).' @ '.get_option( 'time_format' ), $item['date'] ); |
|
103 | + if ($item['conflict']) { |
|
104 | + $date .= '<br /><small style="color: red">'.__( 'Warning: Multiple items scheduled at this time.', 'ppp-txt' ).'</small>'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $date; |
@@ -123,48 +123,48 @@ discard block |
||
123 | 123 | $crons = ppp_get_shceduled_crons(); |
124 | 124 | |
125 | 125 | $cron_tally = array(); |
126 | - foreach ( $crons as $key => $cron ) { |
|
126 | + foreach ($crons as $key => $cron) { |
|
127 | 127 | $ppp_data = $cron; |
128 | 128 | $timestamp = $ppp_data['timestamp']; |
129 | 129 | |
130 | - $cron_tally[$timestamp] = isset( $cron_tally[$timestamp] ) ? $cron_tally[$timestamp] + 1 : 1; |
|
130 | + $cron_tally[$timestamp] = isset($cron_tally[$timestamp]) ? $cron_tally[$timestamp] + 1 : 1; |
|
131 | 131 | |
132 | 132 | $name_parts = explode( '_', $ppp_data['args'][1] ); |
133 | 133 | $post_id = $ppp_data['args'][0]; |
134 | 134 | $index = $name_parts[1]; |
135 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; |
|
136 | - $builder = 'ppp_' . $service . '_build_share_message'; |
|
137 | - $post_meta = apply_filters( 'ppp_get_scheduled_items_' . $service, array(), $post_id ); |
|
135 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; |
|
136 | + $builder = 'ppp_'.$service.'_build_share_message'; |
|
137 | + $post_meta = apply_filters( 'ppp_get_scheduled_items_'.$service, array(), $post_id ); |
|
138 | 138 | $image_url = ''; |
139 | 139 | |
140 | - if ( ! empty( $post_meta[$index]['attachment_id'] ) ) { |
|
141 | - $image_url = ppp_post_has_media( $post_id, $service, true, $post_meta[ $index ]['attachment_id'] ); |
|
142 | - } elseif ( ! empty( $post_meta[ $index ]['image'] ) ) { |
|
143 | - $image_url = $post_meta[ $index ]['image']; |
|
140 | + if ( ! empty($post_meta[$index]['attachment_id'])) { |
|
141 | + $image_url = ppp_post_has_media( $post_id, $service, true, $post_meta[$index]['attachment_id'] ); |
|
142 | + } elseif ( ! empty($post_meta[$index]['image'])) { |
|
143 | + $image_url = $post_meta[$index]['image']; |
|
144 | 144 | } |
145 | 145 | |
146 | - $conflict = $cron_tally[ $timestamp ] > 1 ? true : false; |
|
146 | + $conflict = $cron_tally[$timestamp] > 1 ? true : false; |
|
147 | 147 | |
148 | - $data[ $key ] = array( |
|
148 | + $data[$key] = array( |
|
149 | 149 | 'post_id' => $post_id, |
150 | 150 | 'post_title' => get_the_title( $post_id ), |
151 | 151 | 'service' => $service, |
152 | 152 | 'index' => $index, |
153 | - 'date' => $timestamp + ( get_option( 'gmt_offset' ) * 3600 ), |
|
153 | + 'date' => $timestamp + (get_option( 'gmt_offset' ) * 3600), |
|
154 | 154 | 'content' => function_exists( $builder ) ? $builder( $post_id, $ppp_data['args'][1], false ) : '', |
155 | - 'name' => 'sharedate_' . $index . '_' . $post_id, |
|
155 | + 'name' => 'sharedate_'.$index.'_'.$post_id, |
|
156 | 156 | 'conflict' => $conflict, |
157 | 157 | ); |
158 | 158 | |
159 | - if ( ! empty( $image_url ) ) { |
|
160 | - $data[ $key ]['image_url'] = $image_url; |
|
159 | + if ( ! empty($image_url)) { |
|
160 | + $data[$key]['image_url'] = $image_url; |
|
161 | 161 | } |
162 | 162 | |
163 | - $description_function = 'ppp_' . $service . '_get_share_description'; |
|
164 | - if ( function_exists( $description_function ) ) { |
|
163 | + $description_function = 'ppp_'.$service.'_get_share_description'; |
|
164 | + if (function_exists( $description_function )) { |
|
165 | 165 | $description = $description_function( $post_id, $index ); |
166 | - if ( ! empty( $description ) ) { |
|
167 | - $data[ $key ]['content'] .= '<br />' . $description; |
|
166 | + if ( ! empty($description)) { |
|
167 | + $data[$key]['content'] .= '<br />'.$description; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | |
173 | 173 | $total_items = count( $data ); |
174 | 174 | |
175 | - $offset = isset( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
175 | + $offset = isset($_GET['paged']) ? $_GET['paged'] : 1; |
|
176 | 176 | |
177 | - $data = array_slice( $data, ( $offset - 1 ) * $per_page, $per_page, true ); |
|
177 | + $data = array_slice( $data, ($offset - 1) * $per_page, $per_page, true ); |
|
178 | 178 | $this->items = $data; |
179 | 179 | |
180 | 180 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' )) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Render Upgrades Screen |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * @return void |
20 | 20 | */ |
21 | 21 | function ppp_upgrades_screen() { |
22 | - $action = isset( $_GET['ppp-upgrade'] ) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : ''; |
|
23 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
24 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
25 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
26 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
27 | - $steps = round( ( $total / $number ), 0 ); |
|
22 | + $action = isset($_GET['ppp-upgrade']) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : ''; |
|
23 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
24 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
25 | + $custom = isset($_GET['custom']) ? absint( $_GET['custom'] ) : 0; |
|
26 | + $number = isset($_GET['number']) ? absint( $_GET['number'] ) : 100; |
|
27 | + $steps = round( ($total / $number), 0 ); |
|
28 | 28 | |
29 | 29 | $doing_upgrade_args = array( |
30 | 30 | 'page' => 'ppp-upgrades', |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | ); |
37 | 37 | |
38 | 38 | update_option( 'ppp_doing_upgrade', $doing_upgrade_args ); |
39 | - if ( $step > $steps ) { |
|
39 | + if ($step > $steps) { |
|
40 | 40 | // Prevent a weird case where the estimate was off. Usually only a couple. |
41 | 41 | $steps = $step; |
42 | 42 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | <div class="wrap"> |
45 | 45 | <h1><?php _e( 'Post Promoter Pro - Upgrades', 'ppp-txt' ); ?></h1> |
46 | 46 | |
47 | - <?php if( ! empty( $action ) ) : ?> |
|
47 | + <?php if ( ! empty($action)) : ?> |
|
48 | 48 | |
49 | 49 | <div id="ppp-upgrade-status"> |
50 | 50 | <p><?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?></p> |
51 | 51 | |
52 | - <?php if( ! empty( $total ) ) : ?> |
|
52 | + <?php if ( ! empty($total)) : ?> |
|
53 | 53 | <p><strong><?php printf( __( 'Step %d of approximately %d running', 'ppp-txt' ), $step, $steps ); ?></strong></p> |
54 | 54 | <?php endif; ?> |
55 | 55 | </div> |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( !defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Render Upgrades Screen |
@@ -57,11 +59,14 @@ discard block |
||
57 | 59 | setTimeout(function() { document.location.href = "index.php?ppp_action=<?php echo $action; ?>&step=<?php echo $step; ?>&total=<?php echo $total; ?>&custom=<?php echo $custom; ?>"; }, 250); |
58 | 60 | </script> |
59 | 61 | |
60 | - <?php else : ?> |
|
62 | + <?php else { |
|
63 | + : ?> |
|
61 | 64 | |
62 | 65 | <div id="ppp-upgrade-status"> |
63 | 66 | <p> |
64 | - <?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?> |
|
67 | + <?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); |
|
68 | +} |
|
69 | +?> |
|
65 | 70 | </p> |
66 | 71 | </div> |
67 | 72 | <script type="text/javascript"> |
@@ -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,11 +12,11 @@ discard block |
||
12 | 12 | function ppp_register_meta_boxes() { |
13 | 13 | global $post, $ppp_options; |
14 | 14 | |
15 | - if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) ) { |
|
15 | + if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] )) { |
|
16 | 16 | return; |
17 | 17 | } |
18 | 18 | |
19 | - foreach ( $ppp_options['post_types'] as $post_type => $value ) { |
|
19 | + foreach ($ppp_options['post_types'] as $post_type => $value) { |
|
20 | 20 | add_meta_box( 'ppp_schedule_metabox', 'Post Promoter Pro', 'ppp_schedule_callback', $post_type, 'normal', 'high' ); |
21 | 21 | } |
22 | 22 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( !defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | * Handles all bitly functions |
12 | 12 | * |
13 | 13 | */ |
14 | -if( !class_exists( 'PPP_Bitly' ) ) { |
|
14 | +if ( ! class_exists( 'PPP_Bitly' )) { |
|
15 | 15 | |
16 | 16 | class PPP_Bitly { |
17 | 17 | |
18 | 18 | var $bitly; |
19 | 19 | |
20 | - public function __construct(){ |
|
20 | + public function __construct() { |
|
21 | 21 | ppp_maybe_start_session(); |
22 | 22 | } |
23 | 23 | |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | * Handles to load twitter class |
28 | 28 | */ |
29 | 29 | public function ppp_load_bitly() { |
30 | - if( !class_exists( 'Bitly' ) ) { |
|
31 | - require_once ( PPP_PATH . '/includes/libs/bitly/bitly.php' ); |
|
30 | + if ( ! class_exists( 'Bitly' )) { |
|
31 | + require_once (PPP_PATH.'/includes/libs/bitly/bitly.php'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | ppp_set_social_tokens(); |
35 | 35 | |
36 | - if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' ) ) { |
|
36 | + if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' )) { |
|
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | |
40 | 40 | global $ppp_social_settings; |
41 | 41 | |
42 | - if ( isset( $ppp_social_settings['bitly'] ) ) { |
|
43 | - if ( !defined( 'bitly_accesstoken' ) ) { |
|
42 | + if (isset($ppp_social_settings['bitly'])) { |
|
43 | + if ( ! defined( 'bitly_accesstoken' )) { |
|
44 | 44 | define( 'bitly_accesstoken', $ppp_social_settings['bitly']['access_token'] ); |
45 | 45 | } |
46 | 46 | $this->bitly = new Bitly( bitly_clientid, bitly_secret, bitly_accesstoken ); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function revoke_access() { |
55 | 55 | global $ppp_social_settings; |
56 | 56 | |
57 | - unset( $ppp_social_settings['bitly'] ); |
|
57 | + unset($ppp_social_settings['bitly']); |
|
58 | 58 | |
59 | 59 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
60 | 60 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * Get auth codes for Bitly |
64 | 64 | * |
65 | 65 | */ |
66 | - public function ppp_get_bitly_auth_url () { |
|
66 | + public function ppp_get_bitly_auth_url() { |
|
67 | 67 | //load bitly class |
68 | 68 | $bitly = $this->ppp_load_bitly(); |
69 | 69 | |
70 | 70 | //check bitly class is loaded or not |
71 | - if( !$bitly ) { |
|
71 | + if ( ! $bitly) { |
|
72 | 72 | return false; |
73 | 73 | } |
74 | 74 | |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function ppp_make_bitly_link( $link = null ) { |
80 | - if ( empty( $link ) ) { |
|
80 | + if (empty($link)) { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | |
84 | 84 | $bitly = $this->ppp_load_bitly(); |
85 | 85 | |
86 | - if ( !$bitly ) { |
|
86 | + if ( ! $bitly) { |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function ppp_bitly_user_info() { |
94 | 94 | $bitly = $this->ppp_load_bitly(); |
95 | 95 | |
96 | - if ( !$bitly ) { |
|
96 | + if ( ! $bitly) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( !defined( 'ABSPATH' ) ) { |
|
4 | +if ( ! defined( 'ABSPATH' )) { |
|
5 | 5 | exit; |
6 | 6 | } |
7 | 7 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * Handles all twitter functions |
12 | 12 | * |
13 | 13 | */ |
14 | -if( !class_exists( 'PPP_Twitter_User' ) ) { |
|
14 | +if ( ! class_exists( 'PPP_Twitter_User' )) { |
|
15 | 15 | |
16 | 16 | class PPP_Twitter_User { |
17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | ppp_maybe_start_session(); |
20 | 20 | $this->user_id = $_user_id; |
21 | 21 | |
22 | - if ( ! empty( $this->user_id ) ) { |
|
22 | + if ( ! empty($this->user_id)) { |
|
23 | 23 | $this->verify_credentials(); |
24 | 24 | } |
25 | 25 | } |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * Handles to load twitter class |
31 | 31 | */ |
32 | 32 | public function load() { |
33 | - if( !class_exists( 'TwitterOAuth' ) ) { |
|
34 | - require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' ); |
|
33 | + if ( ! class_exists( 'TwitterOAuth' )) { |
|
34 | + require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | ppp_set_social_tokens(); |
38 | 38 | |
39 | - if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' ) ) { |
|
39 | + if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' )) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function init() { |
57 | 57 | |
58 | 58 | //when user is going to logged in in twitter and verified successfully session will create |
59 | - if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) { |
|
59 | + if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { |
|
60 | 60 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
61 | 61 | |
62 | 62 | //load twitter class |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | |
69 | 69 | //session for verifier |
70 | 70 | $verifier['oauth_verifier'] = $_REQUEST['oauth_verifier']; |
71 | - $_SESSION[ 'ppp_twt_user_cache' ] = $verifier; |
|
71 | + $_SESSION['ppp_twt_user_cache'] = $verifier; |
|
72 | 72 | |
73 | 73 | //getting user data from twitter |
74 | 74 | $response = $this->twitter->get( 'account/verify_credentials' ); |
75 | 75 | |
76 | 76 | //if user data get successfully |
77 | - if ( $response->id_str ) { |
|
77 | + if ($response->id_str) { |
|
78 | 78 | |
79 | 79 | $data['user'] = $response; |
80 | 80 | $data['user']->accessToken = $ppp_tw_access_token; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->load(); |
89 | 89 | |
90 | 90 | $user_settings = get_user_meta( $this->user_id, '_ppp_twitter_data', true ); |
91 | - if ( ! empty( $user_settings ) ) { |
|
91 | + if ( ! empty($user_settings)) { |
|
92 | 92 | |
93 | 93 | $this->twitter = new TwitterOAuth( |
94 | 94 | PPP_TW_CONSUMER_KEY, |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $user_settings['user']->accessToken['oauth_token_secret'] |
98 | 98 | ); |
99 | 99 | |
100 | - $response = $this->twitter->get('account/verify_credentials'); |
|
101 | - if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) { |
|
102 | - foreach ( $response->errors as $error ) { |
|
103 | - if ( $error->code == 89 ) { // Expired or revoked tokens |
|
100 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
101 | + if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) { |
|
102 | + foreach ($response->errors as $error) { |
|
103 | + if ($error->code == 89) { // Expired or revoked tokens |
|
104 | 104 | |
105 | 105 | $this->revoke_access(); |
106 | 106 | |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | * Get auth url for twitter |
118 | 118 | * |
119 | 119 | */ |
120 | - public function get_auth_url ( $return_url = '' ) { |
|
120 | + public function get_auth_url( $return_url = '' ) { |
|
121 | 121 | |
122 | - if ( empty( $return_url ) ) { |
|
122 | + if (empty($return_url)) { |
|
123 | 123 | $return_url = admin_url( 'admin.php?page=ppp-social-settings' ); |
124 | 124 | } |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $request_token = $this->twitter->getRequestToken( $return_url ); |
129 | 129 | |
130 | 130 | // If last connection failed don't display authorization link. |
131 | - switch( $this->twitter->http_code ) { |
|
131 | + switch ($this->twitter->http_code) { |
|
132 | 132 | case 200: |
133 | 133 | $_SESSION['ppp_user_twt_oauth_token'] = $request_token['oauth_token']; |
134 | 134 | $_SESSION['ppp_user_twt_oauth_token_secret'] = $request_token['oauth_token_secret']; |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | public function send_tweet( $message = '', $media = null ) { |
148 | - if ( empty( $message ) ) { |
|
148 | + if (empty($message)) { |
|
149 | 149 | return false; |
150 | 150 | } |
151 | 151 | |
152 | 152 | $verify = $this->verify_credentials(); |
153 | - if ( $verify === true ) { |
|
153 | + if ($verify === true) { |
|
154 | 154 | $args = array(); |
155 | - if ( ! empty( $media ) ) { |
|
155 | + if ( ! empty($media)) { |
|
156 | 156 | $endpoint = 'statuses/update_with_media'; |
157 | 157 | $args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) ); |
158 | 158 | } else { |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | public function retweet( $tweet_id ) { |
170 | - if ( empty( $tweet_id ) ) { |
|
170 | + if (empty($tweet_id)) { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
174 | 174 | $verify = $this->verify_credentials(); |
175 | - if ( $verify === true ) { |
|
176 | - $endpoint = 'statuses/retweet/' . $tweet_id; |
|
175 | + if ($verify === true) { |
|
176 | + $endpoint = 'statuses/retweet/'.$tweet_id; |
|
177 | 177 | |
178 | 178 | return $this->twitter->post( $endpoint, array(), true ); |
179 | 179 | } else { |