@@ -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 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | <?php _e( 'License Key', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Enter your license key', 'ppp-txt' ); ?></span> |
| 27 | 27 | </th> |
| 28 | 28 | <td> |
| 29 | - <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if( $status !== false && $status == 'valid' ) { ?> |
|
| 29 | + <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if ($status !== false && $status == 'valid') { ?> |
|
| 30 | 30 | <span style="color:green;"> <?php _e( 'active', 'ppp-txt' ); ?></span><?php } ?> |
| 31 | 31 | </td> |
| 32 | 32 | </tr> |
| 33 | 33 | |
| 34 | - <?php if( false !== $license ) { ?> |
|
| 34 | + <?php if (false !== $license) { ?> |
|
| 35 | 35 | <tr valign="top"> |
| 36 | 36 | <th scope="row" valign="top"> |
| 37 | 37 | <?php _e( 'Activate License', 'ppp-txt' ); ?> |
| 38 | 38 | </th> |
| 39 | 39 | <td> |
| 40 | - <?php if( $status !== false && $status == 'valid' ) { ?> |
|
| 40 | + <?php if ($status !== false && $status == 'valid') { ?> |
|
| 41 | 41 | <?php wp_nonce_field( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ); ?> |
| 42 | 42 | <input type="submit" class="button-secondary" name="ppp_license_deactivate" value="<?php _e( 'Deactivate License', 'ppp-txt' ); ?>"/> |
| 43 | 43 | <?php } else { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | <span style="font-size: x-small;"><a href="#" onclick="jQuery('#ppp-text-helper').toggle(); return false;"><?php _e( 'Default Text Tips', 'ppp-txt' ); ?></a></span> |
| 54 | 54 | </th> |
| 55 | 55 | <td> |
| 56 | - <?php $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; ?> |
|
| 56 | + <?php $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; ?> |
|
| 57 | 57 | <input type="text" class="regular-text" name="ppp_options[default_text]" value="<?php echo $default_text; ?>" placeholder="Post Title will be used if empty" size="50" /> |
| 58 | 58 | <p id="ppp-text-helper" style="display: none"> |
| 59 | 59 | <small> |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | <br /> |
| 64 | 64 | <?php _e( 'Possible Replacements:', 'ppp-txt' ); ?> |
| 65 | 65 | <br /> |
| 66 | - <?php foreach( ppp_get_text_tokens() as $token ): ?> |
|
| 66 | + <?php foreach (ppp_get_text_tokens() as $token): ?> |
|
| 67 | 67 | <code>{<?php echo $token['token']; ?>}</code> - <?php echo $token['description']; ?><br /> |
| 68 | 68 | <?php endforeach; ?> |
| 69 | 69 | </small> |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | <th scope="row"><?php _e( 'Post Types', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'What post types do you want to schedule for?', 'ppp-txt' ); ?></span></th> |
| 76 | 76 | <td> |
| 77 | 77 | <?php $post_types = ppp_supported_post_types(); ?> |
| 78 | - <?php foreach ( $post_types as $post_type => $type_data ): ?> |
|
| 79 | - <?php $value = ( isset( $ppp_options['post_types'] ) && isset( $ppp_options['post_types'][$post_type] ) ) ? true : false; ?> |
|
| 78 | + <?php foreach ($post_types as $post_type => $type_data): ?> |
|
| 79 | + <?php $value = (isset($ppp_options['post_types']) && isset($ppp_options['post_types'][$post_type])) ? true : false; ?> |
|
| 80 | 80 | <input type="checkbox" name="ppp_options[post_types][<?php echo $post_type; ?>]" value="1" id="<?php echo $post_type; ?>" <?php checked( true, $value, true ); ?> /> |
| 81 | 81 | <label for="<?php echo $post_type; ?>"><?php echo $type_data->labels->name; ?></label></br /> |
| 82 | 82 | <?php endforeach; ?> |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | <th scope="row"><?php _e( 'Advanced', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Tools for troubleshooting and advanced usage', 'ppp-txt' ); ?></span></th> |
| 88 | 88 | <td> |
| 89 | 89 | <p> |
| 90 | - <?php $debug_enabled = isset( $ppp_options['enable_debug'] ) ? true : false; ?> |
|
| 90 | + <?php $debug_enabled = isset($ppp_options['enable_debug']) ? true : false; ?> |
|
| 91 | 91 | <input type="checkbox" name="ppp_options[enable_debug]" <?php checked( true, $debug_enabled, true ); ?> value="1" /> <?php _e( 'Enable Debug', 'ppp-txt' ); ?> |
| 92 | 92 | </p> |
| 93 | 93 | <p> |
| 94 | - <?php $delete_on_uninstall = isset( $ppp_options['delete_on_uninstall'] ) ? true : false; ?> |
|
| 94 | + <?php $delete_on_uninstall = isset($ppp_options['delete_on_uninstall']) ? true : false; ?> |
|
| 95 | 95 | <input type="checkbox" name="ppp_options[delete_on_uninstall]" <?php checked( true, $delete_on_uninstall, true ); ?> value="1" /> <?php _e( 'Delete All Data On Uninstall', 'ppp-txt' ); ?> |
| 96 | 96 | </p> |
| 97 | 97 | </td> |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | <?php wp_nonce_field( 'ppp-share-settings' ); ?> |
| 127 | 127 | <h3><?php _e( 'Social Media Accounts', 'ppp-txt' ); ?></h3> |
| 128 | 128 | <?php |
| 129 | - require_once PPP_PATH . 'includes/admin/class-accounts-table.php'; |
|
| 129 | + require_once PPP_PATH.'includes/admin/class-accounts-table.php'; |
|
| 130 | 130 | |
| 131 | 131 | $accounts_table = new PPP_Accounts_Table(); |
| 132 | 132 | $accounts_table->prepare_items(); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $accounts_table->display(); |
| 135 | 135 | ?> |
| 136 | 136 | <table class="form-table"> |
| 137 | - <?php $analytics_option = isset( $ppp_share_settings['analytics'] ) ? $ppp_share_settings['analytics'] : 0; ?> |
|
| 137 | + <?php $analytics_option = isset($ppp_share_settings['analytics']) ? $ppp_share_settings['analytics'] : 0; ?> |
|
| 138 | 138 | <tr valign="top"> |
| 139 | 139 | <th scope="row" valign="top"> |
| 140 | 140 | <?php _e( 'Analytics', 'ppp-txt' ); ?></span> |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | <hr /> |
| 174 | 174 | <small><?php _e( 'Here is an example of what your link will look like', 'ppp-txt' ); ?>: <br /> |
| 175 | 175 | <?php $post = wp_get_recent_posts( array( 'numberposts' => 1 ) ); ?> |
| 176 | - <?php if( count( $post ) > 0 ): ?> |
|
| 177 | - <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false ); ?></code></small> |
|
| 176 | + <?php if (count( $post ) > 0): ?> |
|
| 177 | + <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_'.$post[0]['ID'], false ); ?></code></small> |
|
| 178 | 178 | <?php else: ?> |
| 179 | 179 | <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); ?></em> |
| 180 | 180 | <?php endif; ?> |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | </tr> |
| 184 | 184 | |
| 185 | 185 | <?php |
| 186 | - $tw_sop = ! empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? true : false; |
|
| 187 | - $fb_sop = ! empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? true : false; |
|
| 188 | - $li_sop = ! empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? true : false; |
|
| 186 | + $tw_sop = ! empty($ppp_share_settings['twitter']['share_on_publish']) ? true : false; |
|
| 187 | + $fb_sop = ! empty($ppp_share_settings['facebook']['share_on_publish']) ? true : false; |
|
| 188 | + $li_sop = ! empty($ppp_share_settings['linkedin']['share_on_publish']) ? true : false; |
|
| 189 | 189 | ?> |
| 190 | 190 | <tr valign="top"> |
| 191 | 191 | <th scope="row" valign="top"> |
@@ -193,21 +193,21 @@ discard block |
||
| 193 | 193 | <small><em><?php _e( 'Enabled sharing on publish by default', 'ppp-txt' ); ?></em></small> |
| 194 | 194 | </th> |
| 195 | 195 | <td id="ppp-share-on-publish-wrapper"> |
| 196 | - <?php if ( ppp_twitter_enabled() ) : ?> |
|
| 196 | + <?php if (ppp_twitter_enabled()) : ?> |
|
| 197 | 197 | <p> |
| 198 | 198 | <input type="checkbox" id="twitter-share-on-publish" value="1" <?php checked( true, $tw_sop, true ); ?> name="ppp_share_settings[twitter][share_on_publish]" /> |
| 199 | 199 | <label for="twitter-share-on-publish"><?php _e( 'Twitter', 'ppp-txt' ); ?></label> |
| 200 | 200 | </p> |
| 201 | 201 | <?php endif; ?> |
| 202 | 202 | |
| 203 | - <?php if ( ppp_facebook_enabled() ) : ?> |
|
| 203 | + <?php if (ppp_facebook_enabled()) : ?> |
|
| 204 | 204 | <p> |
| 205 | 205 | <input type="checkbox" id="facebook-share-on-publish" value="1" <?php checked( true, $fb_sop, true ); ?> name="ppp_share_settings[facebook][share_on_publish]" /> |
| 206 | 206 | <label for="facebook-share-on-publish"><?php _e( 'Facebook', 'ppp-txt' ); ?></label> |
| 207 | 207 | </p> |
| 208 | 208 | <?php endif; ?> |
| 209 | 209 | |
| 210 | - <?php if ( ppp_linkedin_enabled() ) : ?> |
|
| 210 | + <?php if (ppp_linkedin_enabled()) : ?> |
|
| 211 | 211 | <p> |
| 212 | 212 | <input type="checkbox" id="linkedin-share-on-publish" value="1" <?php checked( true, $li_sop, true ); ?> name="ppp_share_settings[linkedin][share_on_publish]" /> |
| 213 | 213 | <label for="linkedin-share-on-publish"><?php _e( 'LinkedIn', 'ppp-txt' ); ?></label> |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | </tr> |
| 235 | 235 | |
| 236 | 236 | <?php |
| 237 | - $shortener = isset( $ppp_share_settings['shortener'] ) ? $ppp_share_settings['shortener'] : false; |
|
| 237 | + $shortener = isset($ppp_share_settings['shortener']) ? $ppp_share_settings['shortener'] : false; |
|
| 238 | 238 | ?> |
| 239 | 239 | <tr valign="top"> |
| 240 | 240 | <th scope="row" valign="top"> |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | <?php do_action( 'ppp_url_shorteners', $shortener ); ?> |
| 248 | 248 | </select> |
| 249 | 249 | </p> |
| 250 | - <?php if ( $shortener ) : ?> |
|
| 251 | - <?php do_action( 'ppp_shortener_settings-' . $shortener ); ?> |
|
| 250 | + <?php if ($shortener) : ?> |
|
| 251 | + <?php do_action( 'ppp_shortener_settings-'.$shortener ); ?> |
|
| 252 | 252 | <?php endif; ?> |
| 253 | 253 | </td> |
| 254 | 254 | </tr> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | .wp-list-table .column-content { width: 50%; } |
| 282 | 282 | </style> |
| 283 | 283 | <?php |
| 284 | - require_once PPP_PATH . 'includes/admin/class-schedule-table.php'; |
|
| 284 | + require_once PPP_PATH.'includes/admin/class-schedule-table.php'; |
|
| 285 | 285 | $schedule_table = new PPP_Schedule_Table(); |
| 286 | 286 | $schedule_table->prepare_items(); |
| 287 | 287 | ?> |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - Scheduled Shares', 'ppp-txt' ); ?></h1> |
| 290 | 290 | <?php $schedule_table->display() ?> |
| 291 | 291 | </div> |
| 292 | - <?php if ( ppp_is_shortener_enabled() ): ?> |
|
| 292 | + <?php if (ppp_is_shortener_enabled()): ?> |
|
| 293 | 293 | <p> |
| 294 | 294 | <small><?php _e( 'NOTICE: Schedule view does not show shortened links, they will be shortened at the time of sharing', 'ppp-txt' ); ?></small> |
| 295 | 295 | </p> |
@@ -307,24 +307,24 @@ discard block |
||
| 307 | 307 | <div class="wrap"> |
| 308 | 308 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - System Info', 'ppp-txt' ); ?></h1> |
| 309 | 309 | <textarea style="font-family: Menlo, Monaco, monospace; white-space: pre" onclick="this.focus();this.select()" readonly cols="150" rows="35"> |
| 310 | - SITE_URL: <?php echo site_url() . "\n"; ?> |
|
| 311 | - HOME_URL: <?php echo home_url() . "\n"; ?> |
|
| 310 | + SITE_URL: <?php echo site_url()."\n"; ?> |
|
| 311 | + HOME_URL: <?php echo home_url()."\n"; ?> |
|
| 312 | 312 | |
| 313 | - PPP Version: <?php echo PPP_VERSION . "\n"; ?> |
|
| 314 | - WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
|
| 313 | + PPP Version: <?php echo PPP_VERSION."\n"; ?> |
|
| 314 | + WordPress Version: <?php echo get_bloginfo( 'version' )."\n"; ?> |
|
| 315 | 315 | |
| 316 | 316 | PPP SETTINGS: |
| 317 | 317 | <?php |
| 318 | - foreach ( $ppp_options as $name => $value ) { |
|
| 319 | - if ( $value == false ) { |
|
| 318 | + foreach ($ppp_options as $name => $value) { |
|
| 319 | + if ($value == false) { |
|
| 320 | 320 | $value = 'false'; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if ( $value == '1' ) { |
|
| 323 | + if ($value == '1') { |
|
| 324 | 324 | $value = 'true'; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - echo $name . ': ' . maybe_serialize( $value ) . "\n\t"; |
|
| 327 | + echo $name.': '.maybe_serialize( $value )."\n\t"; |
|
| 328 | 328 | } |
| 329 | 329 | ?> |
| 330 | 330 | |
@@ -333,61 +333,61 @@ discard block |
||
| 333 | 333 | $plugins = get_plugins(); |
| 334 | 334 | $active_plugins = get_option( 'active_plugins', array() ); |
| 335 | 335 | |
| 336 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 336 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 337 | 337 | // If the plugin isn't active, don't show it. |
| 338 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
| 338 | + if ( ! in_array( $plugin_path, $active_plugins )) { |
|
| 339 | 339 | continue; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n\t"; |
|
| 342 | + echo $plugin['Name']; ?>: <?php echo $plugin['Version']."\n\t"; |
|
| 343 | 343 | |
| 344 | 344 | } |
| 345 | 345 | ?> |
| 346 | 346 | |
| 347 | 347 | CURRENT THEME: |
| 348 | 348 | <?php |
| 349 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
| 350 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
| 351 | - echo $theme_data['Name'] . ': ' . $theme_data['Version']; |
|
| 349 | + if (get_bloginfo( 'version' ) < '3.4') { |
|
| 350 | + $theme_data = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
| 351 | + echo $theme_data['Name'].': '.$theme_data['Version']; |
|
| 352 | 352 | } else { |
| 353 | 353 | $theme_data = wp_get_theme(); |
| 354 | - echo $theme_data->Name . ': ' . $theme_data->Version; |
|
| 354 | + echo $theme_data->Name.': '.$theme_data->Version; |
|
| 355 | 355 | } |
| 356 | 356 | ?> |
| 357 | 357 | |
| 358 | 358 | |
| 359 | - Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
|
| 359 | + Multi-site: <?php echo is_multisite() ? 'Yes'."\n" : 'No'."\n" ?> |
|
| 360 | 360 | |
| 361 | 361 | ADVANCED INFO: |
| 362 | - PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
|
| 363 | - MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
|
| 364 | - Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
|
| 362 | + PHP Version: <?php echo PHP_VERSION."\n"; ?> |
|
| 363 | + MySQL Version: <?php echo $wpdb->db_version()."\n"; ?> |
|
| 364 | + Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE']."\n"; ?> |
|
| 365 | 365 | |
| 366 | - PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
|
| 367 | - PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
|
| 368 | - PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
|
| 366 | + PHP Memory Limit: <?php echo ini_get( 'memory_limit' )."\n"; ?> |
|
| 367 | + PHP Post Max Size: <?php echo ini_get( 'post_max_size' )."\n"; ?> |
|
| 368 | + PHP Time Limit: <?php echo ini_get( 'max_execution_time' )."\n"; ?> |
|
| 369 | 369 | |
| 370 | - WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
| 371 | - SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
| 370 | + WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
| 371 | + SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
| 372 | 372 | |
| 373 | - WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo " Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?> |
|
| 373 | + WP Table Prefix: <?php echo "Length: ".strlen( $wpdb->prefix ); echo " Status:"; if (strlen( $wpdb->prefix ) > 16) {echo " ERROR: Too Long"; } else {echo " Acceptable"; } echo "\n"; ?> |
|
| 374 | 374 | |
| 375 | - Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?> |
|
| 376 | - Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
| 377 | - Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
| 375 | + Show On Front: <?php echo get_option( 'show_on_front' )."\n" ?> |
|
| 376 | + Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
| 377 | + Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
| 378 | 378 | |
| 379 | - Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
| 379 | + Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
| 380 | 380 | Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
| 381 | 381 | Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
| 382 | 382 | Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
| 383 | 383 | Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
| 384 | 384 | Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
| 385 | 385 | |
| 386 | - UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) echo ini_get( 'upload_max_filesize' ); ?><?php echo "\n"; ?> |
|
| 387 | - POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) echo ini_get( 'post_max_size' ); ?><?php echo "\n"; ?> |
|
| 386 | + UPLOAD_MAX_FILESIZE: <?php if (function_exists( 'phpversion' )) echo ini_get( 'upload_max_filesize' ); ?><?php echo "\n"; ?> |
|
| 387 | + POST_MAX_SIZE: <?php if (function_exists( 'phpversion' )) echo ini_get( 'post_max_size' ); ?><?php echo "\n"; ?> |
|
| 388 | 388 | WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
| 389 | - DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
|
| 390 | - FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
| 389 | + DISPLAY ERRORS: <?php echo (ini_get( 'display_errors' )) ? 'On ('.ini_get( 'display_errors' ).')' : 'N/A'; ?><?php echo "\n"; ?> |
|
| 390 | + FSOCKOPEN: <?php echo (function_exists( 'fsockopen' )) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
| 391 | 391 | </textarea> |
| 392 | 392 | </div> |
| 393 | 393 | <?php |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | function ppp_upgrade_notices() { |
| 9 | 9 | |
| 10 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades' ) ) { |
|
| 10 | + if (isset($_GET['page']) && ($_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades')) { |
|
| 11 | 11 | return; // Don't show notices on the upgrades page |
| 12 | 12 | } |
| 13 | 13 | |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | // Sequential Orders was the first stepped upgrade, so check if we have a stalled upgrade |
| 17 | 17 | $resume_upgrade = ppp_maybe_resume_upgrade(); |
| 18 | - if ( ! empty( $resume_upgrade ) ) { |
|
| 18 | + if ( ! empty($resume_upgrade)) { |
|
| 19 | 19 | |
| 20 | 20 | $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
| 21 | 21 | printf( |
| 22 | - '<div class="error"><p>' . __( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
| 22 | + '<div class="error"><p>'.__( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ).'</p></div>', |
|
| 23 | 23 | esc_url( $resume_url ) |
| 24 | 24 | ); |
| 25 | 25 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | // Include all 'Stepped' upgrade process notices in this else statement, |
| 29 | 29 | // to avoid having a pending, and new upgrade suggested at the same time |
| 30 | 30 | |
| 31 | - if ( version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' ) ) { |
|
| 31 | + if (version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' )) { |
|
| 32 | 32 | printf( |
| 33 | - '<div class="notice notice-info"><p>' . __( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
| 33 | + '<div class="notice notice-info"><p>'.__( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ).'</p></div>', |
|
| 34 | 34 | esc_url( admin_url( 'index.php?page=ppp-upgrades&ppp-upgrade=upgrade_post_meta' ) ) |
| 35 | 35 | ); |
| 36 | 36 | } |
@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | $upgrades_executed = false; |
| 53 | 53 | |
| 54 | 54 | // We don't have a version yet, so we need to run the upgrader |
| 55 | - if ( !$ppp_version && PPP_VERSION == '1.3' ) { |
|
| 55 | + if ( ! $ppp_version && PPP_VERSION == '1.3') { |
|
| 56 | 56 | ppp_v13_upgrades(); |
| 57 | 57 | $upgrades_executed = true; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( version_compare( $ppp_version, 2.1, '<' ) ) { |
|
| 60 | + if (version_compare( $ppp_version, 2.1, '<' )) { |
|
| 61 | 61 | ppp_v21_upgrades(); |
| 62 | 62 | $upgrades_executed = true; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ( $upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' ) ) { |
|
| 65 | + if ($upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' )) { |
|
| 66 | 66 | set_transient( '_ppp_activation_redirect', '1', 60 ); |
| 67 | 67 | update_option( 'ppp_version', PPP_VERSION ); |
| 68 | 68 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $doing_upgrade = get_option( 'ppp_doing_upgrade', false ); |
| 82 | 82 | |
| 83 | - if ( empty( $doing_upgrade ) ) { |
|
| 83 | + if (empty($doing_upgrade)) { |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -96,22 +96,22 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function ppp_v13_upgrades() { |
| 98 | 98 | global $ppp_share_settings; |
| 99 | - $uq_status = ( isset( $ppp_share_settings['ppp_unique_links'] ) && $ppp_share_settings['ppp_unique_links'] == '1' ) ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
| 100 | - $ga_status = ( isset( $ppp_share_settings['ppp_ga_tags'] ) && $ppp_share_settings['ppp_ga_tags'] == '1' ) ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
| 99 | + $uq_status = (isset($ppp_share_settings['ppp_unique_links']) && $ppp_share_settings['ppp_unique_links'] == '1') ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
| 100 | + $ga_status = (isset($ppp_share_settings['ppp_ga_tags']) && $ppp_share_settings['ppp_ga_tags'] == '1') ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
| 101 | 101 | |
| 102 | - if ( $uq_status ) { |
|
| 102 | + if ($uq_status) { |
|
| 103 | 103 | $ppp_share_settings['analytics'] = 'unique_links'; |
| 104 | - unset( $ppp_share_settings['ppp_unique_links'] ); |
|
| 105 | - } elseif ( $ga_status ) { |
|
| 104 | + unset($ppp_share_settings['ppp_unique_links']); |
|
| 105 | + } elseif ($ga_status) { |
|
| 106 | 106 | $ppp_share_settings['analytics'] = 'google_analytics'; |
| 107 | - unset( $ppp_share_settings['ppp_ga_tags'] ); |
|
| 107 | + unset($ppp_share_settings['ppp_ga_tags']); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | update_option( 'ppp_share_settings', $ppp_share_settings ); |
| 111 | 111 | |
| 112 | 112 | global $ppp_options; |
| 113 | 113 | $ppp_options['default_text'] = '{post_title}'; |
| 114 | - $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on'); |
|
| 114 | + $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on' ); |
|
| 115 | 115 | |
| 116 | 116 | update_option( 'ppp_options', $ppp_options ); |
| 117 | 117 | } |
@@ -133,29 +133,29 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function ppp_v22_postmeta_upgrade() { |
| 135 | 135 | |
| 136 | - if( ! current_user_can( 'manage_options' ) ) { |
|
| 136 | + if ( ! current_user_can( 'manage_options' )) { |
|
| 137 | 137 | wp_die( __( 'You do not have permission to do upgrades', 'ppp-txt' ), __( 'Error', 'ppp-txt' ), array( 'response' => 403 ) ); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | ignore_user_abort( true ); |
| 141 | 141 | |
| 142 | - if ( ! ini_get( 'safe_mode' ) ) { |
|
| 143 | - @set_time_limit(0); |
|
| 142 | + if ( ! ini_get( 'safe_mode' )) { |
|
| 143 | + @set_time_limit( 0 ); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | global $wpdb; |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 149 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
| 150 | 150 | $number = 25; |
| 151 | - $offset = $step == 1 ? 0 : ( $step - 1 ) * $number; |
|
| 151 | + $offset = $step == 1 ? 0 : ($step - 1) * $number; |
|
| 152 | 152 | |
| 153 | - if ( $step < 2 ) { |
|
| 153 | + if ($step < 2) { |
|
| 154 | 154 | // Check if we have any payments before moving on |
| 155 | 155 | $sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' LIMIT 1"; |
| 156 | 156 | $has_overrides = $wpdb->get_col( $sql ); |
| 157 | 157 | |
| 158 | - if( empty( $has_overrides ) ) { |
|
| 158 | + if (empty($has_overrides)) { |
|
| 159 | 159 | // We had no payments, just complete |
| 160 | 160 | update_option( 'ppp_version', preg_replace( '/[^0-9.].*/', '', PPP_VERSION ) ); |
| 161 | 161 | ppp_set_upgrade_complete( 'upgrade_post_meta' ); |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
| 167 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
| 168 | 168 | |
| 169 | - if ( empty( $total ) || $total <= 1 ) { |
|
| 169 | + if (empty($total) || $total <= 1) { |
|
| 170 | 170 | $total_sql = "SELECT COUNT(post_id) as total FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data'"; |
| 171 | 171 | $results = $wpdb->get_row( $total_sql, 0 ); |
| 172 | 172 | |
@@ -176,48 +176,48 @@ discard block |
||
| 176 | 176 | $results = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' ORDER BY meta_id DESC LIMIT %d,%d;", $offset, $number ) ); |
| 177 | 177 | $new_post_meta = array(); |
| 178 | 178 | |
| 179 | - if ( $results ) { |
|
| 180 | - foreach ( $results as $result ) { |
|
| 179 | + if ($results) { |
|
| 180 | + foreach ($results as $result) { |
|
| 181 | 181 | |
| 182 | 182 | $share_key = 1; |
| 183 | 183 | |
| 184 | 184 | $override_data = unserialize( $result->meta_value ); |
| 185 | 185 | |
| 186 | - foreach ( $override_data as $day => $values ) { |
|
| 186 | + foreach ($override_data as $day => $values) { |
|
| 187 | 187 | |
| 188 | - if ( ! isset( $values['enabled'] ) ) { |
|
| 188 | + if ( ! isset($values['enabled'])) { |
|
| 189 | 189 | continue; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $text = ! empty( $values['text'] ) ? $values['text'] : ''; |
|
| 193 | - $time = ! empty( $values['time'] ) ? $values['time'] : '8:00am'; |
|
| 192 | + $text = ! empty($values['text']) ? $values['text'] : ''; |
|
| 193 | + $time = ! empty($values['time']) ? $values['time'] : '8:00am'; |
|
| 194 | 194 | |
| 195 | 195 | $post = get_post( $result->post_id ); |
| 196 | 196 | $days_ahead = substr( $day, -1 ); |
| 197 | - $date = date( 'm\/d\/Y', strtotime( $post->post_date . '+' . $days_ahead . ' days' ) ); |
|
| 197 | + $date = date( 'm\/d\/Y', strtotime( $post->post_date.'+'.$days_ahead.' days' ) ); |
|
| 198 | 198 | $image = ''; |
| 199 | 199 | $attachment_id = ''; |
| 200 | 200 | |
| 201 | - if ( ! empty( $values['use_image'] ) ) { |
|
| 201 | + if ( ! empty($values['use_image'])) { |
|
| 202 | 202 | $thumb_id = get_post_thumbnail_id( $result->post_id ); |
| 203 | 203 | $thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-tw-share-image', true ); |
| 204 | 204 | |
| 205 | - if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) { |
|
| 205 | + if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) { |
|
| 206 | 206 | $thumb_url = $thumb_url[0]; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if ( ! empty( $thumb_id ) && ! empty( $thumb_url ) ) { |
|
| 209 | + if ( ! empty($thumb_id) && ! empty($thumb_url)) { |
|
| 210 | 210 | $attachment_id = $thumb_id; |
| 211 | 211 | $image = $thumb_url; |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $new_post_meta[$share_key] = array ( |
|
| 215 | + $new_post_meta[$share_key] = array( |
|
| 216 | 216 | 'date' => $date, |
| 217 | 217 | 'time' => $time, |
| 218 | 218 | 'text' => $text, |
| 219 | - 'image' => ! empty( $image ) ? $image : '', |
|
| 220 | - 'attachment_id' => ! empty( $attachment_id ) ? $attachment_id : '' |
|
| 219 | + 'image' => ! empty($image) ? $image : '', |
|
| 220 | + 'attachment_id' => ! empty($attachment_id) ? $attachment_id : '' |
|
| 221 | 221 | ); |
| 222 | 222 | |
| 223 | 223 | $share_key++; |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * @uses $this->get_logs_to_prune() Returns array of posts via get_posts of logs to prune |
| 42 | 42 | * @uses $this->prune_old_logs() Deletes the logs that we don't want anymore |
| 43 | 43 | */ |
| 44 | - public function prune_logs(){ |
|
| 44 | + public function prune_logs() { |
|
| 45 | 45 | |
| 46 | 46 | $should_we_prune = apply_filters( 'wp_logging_should_we_prune', false ); |
| 47 | 47 | |
| 48 | - if ( $should_we_prune === false ){ |
|
| 48 | + if ($should_we_prune === false) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $logs_to_prune = $this->get_logs_to_prune(); |
| 53 | 53 | |
| 54 | - if ( isset( $logs_to_prune ) && ! empty( $logs_to_prune ) ){ |
|
| 54 | + if (isset($logs_to_prune) && ! empty($logs_to_prune)) { |
|
| 55 | 55 | $this->prune_old_logs( $logs_to_prune ); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @filter wp_logging_force_delete_log Allows user to override the force delete setting which bypasses the trash |
| 71 | 71 | */ |
| 72 | - private function prune_old_logs( $logs ){ |
|
| 72 | + private function prune_old_logs( $logs ) { |
|
| 73 | 73 | |
| 74 | 74 | $force = apply_filters( 'wp_logging_force_delete_log', true ); |
| 75 | 75 | |
| 76 | - foreach( $logs as $l ){ |
|
| 76 | + foreach ($logs as $l) { |
|
| 77 | 77 | wp_delete_post( $l->ID, $force ); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @filter wp_logging_prune_when Users can change how long ago we are looking for logs to prune |
| 94 | 94 | * @filter wp_logging_prune_query_args Gives users access to change any query args for pruning |
| 95 | 95 | */ |
| 96 | - private function get_logs_to_prune(){ |
|
| 96 | + private function get_logs_to_prune() { |
|
| 97 | 97 | |
| 98 | 98 | $how_old = apply_filters( 'wp_logging_prune_when', '2 weeks ago' ); |
| 99 | 99 | |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $types = self::log_types(); |
| 186 | 186 | |
| 187 | - foreach ( $types as $type ) { |
|
| 188 | - if( ! term_exists( $type, 'wp_log_type' ) ) { |
|
| 187 | + foreach ($types as $type) { |
|
| 188 | + if ( ! term_exists( $type, 'wp_log_type' )) { |
|
| 189 | 189 | wp_insert_term( $type, 'wp_log_type' ); |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -270,15 +270,15 @@ discard block |
||
| 270 | 270 | $log_id = wp_insert_post( $args ); |
| 271 | 271 | |
| 272 | 272 | // set the log type, if any |
| 273 | - if( $log_data['log_type'] && self::valid_type( $log_data['log_type'] ) ) { |
|
| 273 | + if ($log_data['log_type'] && self::valid_type( $log_data['log_type'] )) { |
|
| 274 | 274 | wp_set_object_terms( $log_id, $log_data['log_type'], 'wp_log_type', false ); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | // set log meta, if any |
| 279 | - if( $log_id && ! empty( $log_meta ) ) { |
|
| 280 | - foreach( (array) $log_meta as $key => $meta ) { |
|
| 281 | - update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
| 279 | + if ($log_id && ! empty($log_meta)) { |
|
| 280 | + foreach ((array) $log_meta as $key => $meta) { |
|
| 281 | + update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta ); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | // store the log entry |
| 317 | 317 | $log_id = wp_update_post( $args ); |
| 318 | 318 | |
| 319 | - if( $log_id && ! empty( $log_meta ) ) { |
|
| 320 | - foreach( (array) $log_meta as $key => $meta ) { |
|
| 321 | - if( ! empty( $meta ) ) |
|
| 322 | - update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta ); |
|
| 319 | + if ($log_id && ! empty($log_meta)) { |
|
| 320 | + foreach ((array) $log_meta as $key => $meta) { |
|
| 321 | + if ( ! empty($meta)) |
|
| 322 | + update_post_meta( $log_id, '_wp_log_'.sanitize_key( $key ), $meta ); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $query_args = wp_parse_args( $args, $defaults ); |
| 376 | 376 | |
| 377 | - if( $query_args['log_type'] && self::valid_type( $query_args['log_type'] ) ) { |
|
| 377 | + if ($query_args['log_type'] && self::valid_type( $query_args['log_type'] )) { |
|
| 378 | 378 | |
| 379 | 379 | $query_args['tax_query'] = array( |
| 380 | 380 | array( |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $logs = get_posts( $query_args ); |
| 390 | 390 | |
| 391 | - if( $logs ) |
|
| 391 | + if ($logs) |
|
| 392 | 392 | return $logs; |
| 393 | 393 | |
| 394 | 394 | // no logs found |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | 'post_status' => 'publish' |
| 419 | 419 | ); |
| 420 | 420 | |
| 421 | - if( ! empty( $type ) && self::valid_type( $type ) ) { |
|
| 421 | + if ( ! empty($type) && self::valid_type( $type )) { |
|
| 422 | 422 | |
| 423 | 423 | $query_args['tax_query'] = array( |
| 424 | 424 | array( |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - if( ! empty( $meta_query ) ) { |
|
| 433 | + if ( ! empty($meta_query)) { |
|
| 434 | 434 | $query_args['meta_query'] = $meta_query; |
| 435 | 435 | } |
| 436 | 436 | |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | define( 'PPP_STORE_URL', 'https://postpromoterpro.com' ); |
| 18 | 18 | define( 'PPP_PLUGIN_NAME', 'Post Promoter Pro' ); |
| 19 | -if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 19 | +if ( ! class_exists( 'EDD_SL_Plugin_Updater' )) { |
|
| 20 | 20 | // load our custom updater |
| 21 | - include( PPP_PATH . '/includes/EDD_SL_Plugin_Updater.php' ); |
|
| 21 | + include(PPP_PATH.'/includes/EDD_SL_Plugin_Updater.php'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | class PostPromoterPro { |
@@ -27,33 +27,33 @@ discard block |
||
| 27 | 27 | private function __construct() { |
| 28 | 28 | add_action( 'init', array( $this, 'ppp_loaddomain' ), 1 ); |
| 29 | 29 | |
| 30 | - if ( ! is_callable( 'curl_init' ) ) { |
|
| 30 | + if ( ! is_callable( 'curl_init' )) { |
|
| 31 | 31 | add_action( 'admin_notices', array( $this, 'no_curl' ) ); |
| 32 | 32 | } else { |
| 33 | 33 | global $ppp_options, $ppp_social_settings, $ppp_share_settings; |
| 34 | 34 | |
| 35 | - include PPP_PATH . '/includes/general-functions.php'; |
|
| 36 | - include PPP_PATH . '/includes/share-functions.php'; |
|
| 37 | - include PPP_PATH . '/includes/cron-functions.php'; |
|
| 38 | - include PPP_PATH . '/includes/filters.php'; |
|
| 39 | - include PPP_PATH . '/includes/libs/social-loader.php'; |
|
| 35 | + include PPP_PATH.'/includes/general-functions.php'; |
|
| 36 | + include PPP_PATH.'/includes/share-functions.php'; |
|
| 37 | + include PPP_PATH.'/includes/cron-functions.php'; |
|
| 38 | + include PPP_PATH.'/includes/filters.php'; |
|
| 39 | + include PPP_PATH.'/includes/libs/social-loader.php'; |
|
| 40 | 40 | |
| 41 | - if( ! class_exists( 'WP_Logging' ) ) { |
|
| 42 | - include PPP_PATH . '/includes/libs/class-wp-logging.php'; |
|
| 41 | + if ( ! class_exists( 'WP_Logging' )) { |
|
| 42 | + include PPP_PATH.'/includes/libs/class-wp-logging.php'; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ( is_admin() ) { |
|
| 46 | - include PPP_PATH . '/includes/admin/upgrades.php'; |
|
| 47 | - include PPP_PATH . '/includes/admin/do-upgrades.php'; |
|
| 48 | - include PPP_PATH . '/includes/admin/actions.php'; |
|
| 49 | - include PPP_PATH . '/includes/admin/admin-pages.php'; |
|
| 50 | - include PPP_PATH . '/includes/admin/admin-ajax.php'; |
|
| 51 | - include PPP_PATH . '/includes/admin/meta-boxes.php'; |
|
| 52 | - include PPP_PATH . '/includes/admin/welcome.php'; |
|
| 53 | - include PPP_PATH . '/includes/admin/dashboard.php'; |
|
| 45 | + if (is_admin()) { |
|
| 46 | + include PPP_PATH.'/includes/admin/upgrades.php'; |
|
| 47 | + include PPP_PATH.'/includes/admin/do-upgrades.php'; |
|
| 48 | + include PPP_PATH.'/includes/admin/actions.php'; |
|
| 49 | + include PPP_PATH.'/includes/admin/admin-pages.php'; |
|
| 50 | + include PPP_PATH.'/includes/admin/admin-ajax.php'; |
|
| 51 | + include PPP_PATH.'/includes/admin/meta-boxes.php'; |
|
| 52 | + include PPP_PATH.'/includes/admin/welcome.php'; |
|
| 53 | + include PPP_PATH.'/includes/admin/dashboard.php'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - include PPP_PATH . '/install.php'; |
|
| 56 | + include PPP_PATH.'/install.php'; |
|
| 57 | 57 | |
| 58 | 58 | $ppp_options = get_option( 'ppp_options' ); |
| 59 | 59 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @access public |
| 71 | 71 | */ |
| 72 | 72 | public static function getInstance() { |
| 73 | - if ( !self::$ppp_instance ) { |
|
| 73 | + if ( ! self::$ppp_instance) { |
|
| 74 | 74 | self::$ppp_instance = new PostPromoterPro(); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | private function hooks() { |
| 93 | - if ( is_admin() ) { |
|
| 93 | + if (is_admin()) { |
|
| 94 | 94 | add_action( 'admin_init', array( $this, 'ppp_register_settings' ) ); |
| 95 | 95 | add_action( 'admin_init', 'ppp_upgrade_plugin', 1 ); |
| 96 | 96 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | add_action( 'init', array( $this, 'get_actions' ) ); |
| 110 | - add_action( 'save_post', 'ppp_schedule_share', 99, 2); |
|
| 111 | - add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3); |
|
| 110 | + add_action( 'save_post', 'ppp_schedule_share', 99, 2 ); |
|
| 111 | + add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 ); |
|
| 112 | 112 | add_action( 'init', 'ppp_add_image_sizes' ); |
| 113 | 113 | add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 ); |
| 114 | 114 | } |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook ); |
| 133 | 133 | |
| 134 | - if ( ! in_array( $hook, $allowed_pages ) ) { |
|
| 134 | + if ( ! in_array( $hook, $allowed_pages )) { |
|
| 135 | 135 | return; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | wp_enqueue_script( 'jquery-ui-core' ); |
| 139 | 139 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 140 | 140 | |
| 141 | - $jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
| 142 | - wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
| 141 | + $jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
| 142 | + wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
| 143 | 143 | wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true ); |
| 144 | 144 | |
| 145 | 145 | } |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only |
| 150 | 150 | // load ours if they don't exist |
| 151 | - if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) { |
|
| 151 | + if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) { |
|
| 152 | 152 | wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' ); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
| 155 | + wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
| 156 | 156 | wp_enqueue_style( 'ppp_admin_css' ); |
| 157 | 157 | |
| 158 | 158 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @access public |
| 166 | 166 | */ |
| 167 | 167 | public function plugin_settings_links( $links, $file ) { |
| 168 | - if ( $file != PPP_FILE ) { |
|
| 168 | + if ($file != PPP_FILE) { |
|
| 169 | 169 | return $links; |
| 170 | 170 | } |
| 171 | 171 | |
@@ -259,22 +259,22 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function plugin_updater() { |
| 261 | 261 | |
| 262 | - if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) { |
|
| 262 | + if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) { |
|
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $license_key = trim( get_option( '_ppp_license_key' ) ); |
| 267 | 267 | |
| 268 | - if ( empty( $license_key ) ) { |
|
| 268 | + if (empty($license_key)) { |
|
| 269 | 269 | add_action( 'admin_notices', array( $this, 'no_license_nag' ) ); |
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | // setup the updater |
| 274 | 274 | $edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array( |
| 275 | - 'version' => PPP_VERSION, // current version number |
|
| 276 | - 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
| 277 | - 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
| 275 | + 'version' => PPP_VERSION, // current version number |
|
| 276 | + 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
| 277 | + 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
| 278 | 278 | 'author' => 'Post Promoter Pro' // author of this plugin |
| 279 | 279 | ) |
| 280 | 280 | ); |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function deactivate_license() { |
| 306 | 306 | // listen for our activate button to be clicked |
| 307 | - if( isset( $_POST['ppp_license_deactivate'] ) ) { |
|
| 307 | + if (isset($_POST['ppp_license_deactivate'])) { |
|
| 308 | 308 | |
| 309 | 309 | // run a quick security check |
| 310 | - if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) { |
|
| 310 | + if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) { |
|
| 311 | 311 | return; |
| 312 | 312 | } |
| 313 | 313 | // get out if we didn't click the Activate button |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
| 328 | 328 | |
| 329 | 329 | // make sure the response came back okay |
| 330 | - if ( is_wp_error( $response ) ) { |
|
| 330 | + if (is_wp_error( $response )) { |
|
| 331 | 331 | return false; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
| 336 | 336 | |
| 337 | 337 | // $license_data->license will be either "deactivated" or "failed" |
| 338 | - if( $license_data->license == 'deactivated' ) { |
|
| 338 | + if ($license_data->license == 'deactivated') { |
|
| 339 | 339 | delete_option( '_ppp_license_key_status' ); |
| 340 | 340 | } |
| 341 | 341 | |
@@ -348,10 +348,10 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | public function activate_license() { |
| 350 | 350 | // listen for our activate button to be clicked |
| 351 | - if( isset( $_POST['ppp_license_activate'] ) ) { |
|
| 351 | + if (isset($_POST['ppp_license_activate'])) { |
|
| 352 | 352 | |
| 353 | 353 | // run a quick security check |
| 354 | - if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) { |
|
| 354 | + if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) { |
|
| 355 | 355 | return; |
| 356 | 356 | } |
| 357 | 357 | // get out if we didn't click the Activate button |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
| 372 | 372 | |
| 373 | 373 | // make sure the response came back okay |
| 374 | - if ( is_wp_error( $response ) ) { |
|
| 374 | + if (is_wp_error( $response )) { |
|
| 375 | 375 | return false; |
| 376 | 376 | } |
| 377 | 377 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | */ |
| 393 | 393 | public function ppp_sanitize_license( $new ) { |
| 394 | 394 | $old = get_option( '_ppp_license_key' ); |
| 395 | - if( $old && $old != $new ) { |
|
| 395 | + if ($old && $old != $new) { |
|
| 396 | 396 | delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate |
| 397 | 397 | } |
| 398 | 398 | return $new; |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | * @return void |
| 405 | 405 | */ |
| 406 | 406 | public function get_actions() { |
| 407 | - if ( isset( $_GET['ppp_action'] ) ) { |
|
| 408 | - do_action( 'ppp_' . $_GET['ppp_action'], $_GET ); |
|
| 407 | + if (isset($_GET['ppp_action'])) { |
|
| 408 | + do_action( 'ppp_'.$_GET['ppp_action'], $_GET ); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined( 'ABSPATH' )) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | function post_promoter_pro_activation_setup() { |
| 12 | 12 | // If the settings already exist, don't do this |
| 13 | - if ( get_option( 'ppp_options' ) ) { |
|
| 13 | + if (get_option( 'ppp_options' )) { |
|
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function ppp_twitter_enabled() { |
| 13 | 13 | global $ppp_social_settings; |
| 14 | 14 | |
| 15 | - if ( isset( $ppp_social_settings['twitter'] ) && !empty( $ppp_social_settings['twitter'] ) ) { |
|
| 15 | + if (isset($ppp_social_settings['twitter']) && ! empty($ppp_social_settings['twitter'])) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function ppp_tw_account_list_avatar( $string = '' ) { |
| 52 | 52 | |
| 53 | - if ( ppp_twitter_enabled() ) { |
|
| 53 | + if (ppp_twitter_enabled()) { |
|
| 54 | 54 | global $ppp_social_settings; |
| 55 | 55 | $avatar_url = $ppp_social_settings['twitter']['user']->profile_image_url_https; |
| 56 | - $string .= '<img class="ppp-social-icon" src="' . $avatar_url . '" />'; |
|
| 56 | + $string .= '<img class="ppp-social-icon" src="'.$avatar_url.'" />'; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $string; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function ppp_tw_account_list_name( $string = '' ) { |
| 69 | 69 | |
| 70 | - if ( ppp_twitter_enabled() ) { |
|
| 70 | + if (ppp_twitter_enabled()) { |
|
| 71 | 71 | global $ppp_social_settings; |
| 72 | 72 | $string .= $ppp_social_settings['twitter']['user']->name; |
| 73 | 73 | } |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function ppp_tw_account_list_actions( $string = '' ) { |
| 85 | 85 | |
| 86 | - if ( ! ppp_twitter_enabled() ) { |
|
| 86 | + if ( ! ppp_twitter_enabled()) { |
|
| 87 | 87 | global $ppp_twitter_oauth, $ppp_social_settings; |
| 88 | 88 | $tw_auth = $ppp_twitter_oauth->ppp_verify_twitter_credentials(); |
| 89 | 89 | $tw_authurl = $ppp_twitter_oauth->ppp_get_twitter_auth_url(); |
| 90 | 90 | |
| 91 | - $string .= '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 91 | + $string .= '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 92 | 92 | } else { |
| 93 | - $string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ) . '" >' . __( 'Disconnect from Twitter', 'ppp-txt' ) . '</a> '; |
|
| 94 | - $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">' . __( 'Revoke Access via Twitter', 'ppp-txt' ) . '</a>'; |
|
| 93 | + $string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=twitter' ).'" >'.__( 'Disconnect from Twitter', 'ppp-txt' ).'</a> '; |
|
| 94 | + $string .= '<a class="button-secondary" href="https://twitter.com/settings/applications" target="blank">'.__( 'Revoke Access via Twitter', 'ppp-txt' ).'</a>'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $string; |
@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | * @return void |
| 104 | 104 | */ |
| 105 | 105 | function ppp_capture_twitter_oauth() { |
| 106 | - if ( isset( $_REQUEST['oauth_verifier'] ) && isset( $_REQUEST['oauth_token'] ) ) { |
|
| 106 | + if (isset($_REQUEST['oauth_verifier']) && isset($_REQUEST['oauth_token'])) { |
|
| 107 | 107 | $current_screen = get_current_screen(); |
| 108 | - if ( 'user-edit' === $current_screen->base ) { |
|
| 109 | - $user_id = ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; |
|
| 108 | + if ('user-edit' === $current_screen->base) { |
|
| 109 | + $user_id = ! empty($_GET['user_id']) && is_numeric( $_GET['user_id'] ) ? $_GET['user_id'] : false; |
|
| 110 | 110 | $twitter = new PPP_Twitter_User( $user_id ); |
| 111 | 111 | $twitter->init(); |
| 112 | - $redirect = admin_url( 'user-edit.php?updated=1&user_id=' . $user_id ); |
|
| 112 | + $redirect = admin_url( 'user-edit.php?updated=1&user_id='.$user_id ); |
|
| 113 | 113 | } else { |
| 114 | 114 | global $ppp_twitter_oauth; |
| 115 | 115 | $ppp_twitter_oauth->ppp_initialize_twitter(); |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | 129 | function ppp_disconnect_twitter() { |
| 130 | - if ( ! empty( $_GET['user_id'] ) ) { |
|
| 130 | + if ( ! empty($_GET['user_id'])) { |
|
| 131 | 131 | $user_id = (int) sanitize_text_field( $_GET['user_id'] ); |
| 132 | - if ( $user_id !== get_current_user_id() || ! current_user_can( 'manage_options' ) ) { |
|
| 132 | + if ($user_id !== get_current_user_id() || ! current_user_can( 'manage_options' )) { |
|
| 133 | 133 | wp_die( __( 'Unable to disconnect Twitter account', 'ppp-txt' ) ); |
| 134 | 134 | } |
| 135 | 135 | delete_user_meta( $user_id, '_ppp_twitter_data' ); |
| 136 | 136 | } else { |
| 137 | 137 | global $ppp_social_settings; |
| 138 | 138 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 139 | - if ( isset( $ppp_social_settings['twitter'] ) ) { |
|
| 140 | - unset( $ppp_social_settings['twitter'] ); |
|
| 139 | + if (isset($ppp_social_settings['twitter'])) { |
|
| 140 | + unset($ppp_social_settings['twitter']); |
|
| 141 | 141 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | global $ppp_options, $wp_logs, $wp_filter; |
| 169 | 169 | |
| 170 | 170 | $post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 171 | - $this_share = $post_meta[ $index ]; |
|
| 172 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; |
|
| 171 | + $this_share = $post_meta[$index]; |
|
| 172 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; |
|
| 173 | 173 | |
| 174 | 174 | $share_message = ppp_tw_build_share_message( $post_id, $name ); |
| 175 | 175 | |
| 176 | - if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { |
|
| 176 | + if (empty($attachment_id) && ! empty($this_share['image'])) { |
|
| 177 | 177 | $media = $this_share['image']; |
| 178 | 178 | } else { |
| 179 | 179 | $use_media = ppp_tw_use_media( $post_id, $index ); |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | update_post_meta( $log_entry, '_ppp_share_status', $status ); |
| 201 | 201 | |
| 202 | - if ( ! empty( $status->id_str ) ) { |
|
| 202 | + if ( ! empty($status->id_str)) { |
|
| 203 | 203 | $post = get_post( $post_id ); |
| 204 | 204 | $author_id = $post->post_author; |
| 205 | 205 | $author_rt = get_user_meta( $author_id, '_ppp_share_scheduled', true ); |
| 206 | 206 | |
| 207 | - if ( $author_rt ) { |
|
| 207 | + if ($author_rt) { |
|
| 208 | 208 | $twitter_user = new PPP_Twitter_User( $author_id ); |
| 209 | 209 | $twitter_user->retweet( $status->id_str ); |
| 210 | 210 | } |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | function ppp_tw_build_share_message( $post_id, $name, $scheduled = true, $include_link = true ) { |
| 225 | 225 | $share_content = ppp_tw_generate_share_content( $post_id, $name ); |
| 226 | 226 | |
| 227 | - if ( $include_link ) { |
|
| 227 | + if ($include_link) { |
|
| 228 | 228 | $share_link = ppp_generate_link( $post_id, $name, $scheduled ); |
| 229 | - $share_content = $share_content . ' ' . $share_link; |
|
| 229 | + $share_content = $share_content.' '.$share_link; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | return apply_filters( 'ppp_tw_build_share_message', $share_content ); |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | function ppp_tw_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
| 242 | 242 | global $ppp_options; |
| 243 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
| 243 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
| 244 | 244 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 245 | 245 | |
| 246 | - if ( $is_scheduled && ! empty( $ppp_tweets ) ) { |
|
| 246 | + if ($is_scheduled && ! empty($ppp_tweets)) { |
|
| 247 | 247 | $ppp_post_override_data = get_post_meta( $post_id, '_ppp_post_override_data', true ); |
| 248 | 248 | $name_array = explode( '_', $name ); |
| 249 | 249 | $index = $name_array[1]; |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // If an override was found, use it, otherwise try the default text content |
| 254 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
| 254 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
| 255 | 255 | |
| 256 | 256 | // If the content is still empty, just use the post title |
| 257 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
| 257 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
| 258 | 258 | |
| 259 | 259 | return apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post_id ) ); |
| 260 | 260 | } |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | * @return bool Whether or not this tweet should contain a media post |
| 267 | 267 | */ |
| 268 | 268 | function ppp_tw_use_media( $post_id, $index ) { |
| 269 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
| 269 | + if (empty($post_id) || empty($index)) { |
|
| 270 | 270 | return false; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | $share_data = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 274 | - $use_media = ! empty( $share_data[$index]['attachment_id'] ) || ! empty( $share_data[$index]['image'] ) ? true : false; |
|
| 274 | + $use_media = ! empty($share_data[$index]['attachment_id']) || ! empty($share_data[$index]['image']) ? true : false; |
|
| 275 | 275 | |
| 276 | 276 | return $use_media; |
| 277 | 277 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return void |
| 283 | 283 | */ |
| 284 | 284 | function ppp_set_tw_token_constants( $social_tokens ) { |
| 285 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'twitter' ) ) { |
|
| 285 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'twitter' )) { |
|
| 286 | 286 | define( 'PPP_TW_CONSUMER_KEY', $social_tokens->twitter->consumer_token ); |
| 287 | 287 | define( 'PPP_TW_CONSUMER_SECRET', $social_tokens->twitter->consumer_secret ); |
| 288 | 288 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | function ppp_tw_add_meta_tab( $tabs ) { |
| 322 | 322 | global $ppp_social_settings; |
| 323 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
| 323 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
| 324 | 324 | return $tabs; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | function ppp_tw_register_metabox_content( $content ) { |
| 339 | 339 | global $ppp_social_settings; |
| 340 | - if ( !isset( $ppp_social_settings['twitter'] ) ) { |
|
| 340 | + if ( ! isset($ppp_social_settings['twitter'])) { |
|
| 341 | 341 | return $content; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -396,16 +396,16 @@ discard block |
||
| 396 | 396 | <tbody> |
| 397 | 397 | <?php ppp_render_tweet_share_on_publish_row(); ?> |
| 398 | 398 | <?php $tweets = get_post_meta( $post->ID, '_ppp_tweets', true ); ?> |
| 399 | - <?php if ( ! empty( $tweets ) ) : ?> |
|
| 399 | + <?php if ( ! empty($tweets)) : ?> |
|
| 400 | 400 | |
| 401 | - <?php foreach ( $tweets as $key => $value ) : |
|
| 402 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
| 403 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
| 404 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
| 405 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
| 406 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
| 401 | + <?php foreach ($tweets as $key => $value) : |
|
| 402 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
| 403 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
| 404 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
| 405 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
| 406 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
| 407 | 407 | |
| 408 | - $args = apply_filters( 'ppp_tweet_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); |
|
| 408 | + $args = apply_filters( 'ppp_tweet_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); |
|
| 409 | 409 | ?> |
| 410 | 410 | |
| 411 | 411 | <?php ppp_render_tweet_row( $key, $args, $post->ID ); ?> |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | <?php endforeach; ?> |
| 415 | 415 | |
| 416 | 416 | <?php |
| 417 | - if ( ! empty( $has_past_shares ) && count ( $tweets ) == $has_past_shares ) { |
|
| 417 | + if ( ! empty($has_past_shares) && count( $tweets ) == $has_past_shares) { |
|
| 418 | 418 | $args = array( |
| 419 | 419 | 'date' => '', |
| 420 | 420 | 'time' => '', |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | <tr> |
| 438 | 438 | <td class="submit" colspan="4" style="float: none; clear:both; background:#fff;"> |
| 439 | 439 | <a class="button-secondary ppp-add-repeatable" style="margin: 6px 0;"><?php _e( 'Add New Tweet', 'ppp-txt' ); ?></a> |
| 440 | - <?php if ( ! empty( $has_past_shares ) ) : ?> |
|
| 440 | + <?php if ( ! empty($has_past_shares)) : ?> |
|
| 441 | 441 | <a class="button-secondary ppp-view-all" style="margin: 6px 0;"><?php _e( 'Toggle Past Tweets', 'ppp-txt' ); ?></a> |
| 442 | 442 | <?php endif; ?> |
| 443 | 443 | </td> |
@@ -463,38 +463,38 @@ discard block |
||
| 463 | 463 | */ |
| 464 | 464 | function ppp_render_tweet_share_on_publish_row() { |
| 465 | 465 | global $post, $ppp_share_settings; |
| 466 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 466 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 467 | 467 | |
| 468 | 468 | $ppp_post_exclude = get_post_meta( $post->ID, '_ppp_post_exclude', true ); |
| 469 | 469 | |
| 470 | 470 | $ppp_share_on_publish = get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
| 471 | 471 | $show_share_on_publish = false; |
| 472 | 472 | |
| 473 | - $share_by_default = empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? false : true; |
|
| 473 | + $share_by_default = empty($ppp_share_settings['twitter']['share_on_publish']) ? false : true; |
|
| 474 | 474 | |
| 475 | - if ( $ppp_share_on_publish == '1' || ( $ppp_share_on_publish == '' && $share_by_default ) ) { |
|
| 475 | + if ($ppp_share_on_publish == '1' || ($ppp_share_on_publish == '' && $share_by_default)) { |
|
| 476 | 476 | $show_share_on_publish = true; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
| 480 | 480 | $ppp_share_on_publish_include_image = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
| 481 | 481 | |
| 482 | - $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; |
|
| 482 | + $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; |
|
| 483 | 483 | ?> |
| 484 | 484 | <tr class="ppp-tweet-wrapper ppp-repeatable-row on-publish-row"> |
| 485 | 485 | <td colspan="2" class="ppp-on-plublish-date-column"> |
| 486 | - <input <?php if ( $disabled ): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> /> |
|
| 486 | + <input <?php if ($disabled): ?>readonly<?php endif; ?> type="checkbox" name="_ppp_share_on_publish" id="ppp_share_on_publish" value="1" <?php checked( true, $show_share_on_publish, true ); ?> /> |
|
| 487 | 487 | <label for="ppp_share_on_publish"><?php _e( 'Tweet On Publish', 'ppp-txt' ); ?></label> |
| 488 | 488 | </td> |
| 489 | 489 | |
| 490 | 490 | <td> |
| 491 | - <input <?php if ( $disabled ): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" /> |
|
| 492 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> |
|
| 491 | + <input <?php if ($disabled): ?>readonly<?php endif; ?> class="ppp-tweet-text-repeatable" type="text" name="_ppp_share_on_publish_text" value="<?php echo esc_attr( $ppp_share_on_publish_text ); ?>" /> |
|
| 492 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> |
|
| 493 | 493 | <span class="ppp-text-length"><?php echo $length; ?></span> |
| 494 | 494 | </td> |
| 495 | 495 | |
| 496 | 496 | <td style="width: 200px" colspan="2"> |
| 497 | - <input class="ppp-tw-featured-image-input" <?php if ( $disabled ): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/> |
|
| 497 | + <input class="ppp-tw-featured-image-input" <?php if ($disabled): ?>readonly<?php endif; ?> id="ppp-share-on-publish-image" type="checkbox" name="_ppp_share_on_publish_include_image" value="1" <?php checked( '1', $ppp_share_on_publish_include_image, true ); ?>/> |
|
| 498 | 498 | <label for="ppp-share-on-publish-image"><?php _e( 'Featured Image', 'ppp-txt' ); ?></label> |
| 499 | 499 | </td> |
| 500 | 500 | |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | function ppp_render_tweet_row( $key, $args = array(), $post_id ) { |
| 514 | 514 | global $post, $has_past_shares; |
| 515 | 515 | |
| 516 | - if ( ! empty( $args['date'] ) && ! empty( $args['time'] ) ) { |
|
| 516 | + if ( ! empty($args['date']) && ! empty($args['time'])) { |
|
| 517 | 517 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
| 518 | 518 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
| 519 | 519 | } else { |
@@ -521,11 +521,11 @@ discard block |
||
| 521 | 521 | $readonly = false; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
| 525 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
| 526 | - $shared = ! empty( $readonly ) ? 'past-share' : ''; |
|
| 524 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
| 525 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
| 526 | + $shared = ! empty($readonly) ? 'past-share' : ''; |
|
| 527 | 527 | |
| 528 | - if ( ! empty( $readonly ) ) { |
|
| 528 | + if ( ! empty($readonly)) { |
|
| 529 | 529 | $has_past_shares++; |
| 530 | 530 | } |
| 531 | 531 | ?> |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | |
| 541 | 541 | <td> |
| 542 | 542 | <input <?php echo $readonly; ?>class="ppp-tweet-text-repeatable" type="text" name="_ppp_tweets[<?php echo $key; ?>][text]" value="<?php echo esc_attr( $args['text'] ); ?>" /> |
| 543 | - <?php $length = ! empty( $args['text'] ) ? strlen( $args['text'] ) : 0; ?> |
|
| 543 | + <?php $length = ! empty($args['text']) ? strlen( $args['text'] ) : 0; ?> |
|
| 544 | 544 | <span class="ppp-text-length"><?php echo $length; ?></span> |
| 545 | 545 | </td> |
| 546 | 546 | |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | </td> |
| 560 | 560 | |
| 561 | 561 | <td> |
| 562 | - <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">×</a> |
|
| 562 | + <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="twitter" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">×</a> |
|
| 563 | 563 | </td> |
| 564 | 564 | |
| 565 | 565 | </tr> |
@@ -574,24 +574,24 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | function ppp_tw_save_post_meta_boxes( $post_id, $post ) { |
| 576 | 576 | |
| 577 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
| 577 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
| 578 | 578 | return; |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - $ppp_post_exclude = ( isset( $_REQUEST['_ppp_post_exclude'] ) ) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
| 581 | + $ppp_post_exclude = (isset($_REQUEST['_ppp_post_exclude'])) ? $_REQUEST['_ppp_post_exclude'] : '0'; |
|
| 582 | 582 | |
| 583 | - $ppp_share_on_publish = ( isset( $_REQUEST['_ppp_share_on_publish'] ) ) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
| 584 | - $ppp_share_on_publish_text = ( isset( $_REQUEST['_ppp_share_on_publish_text'] ) ) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
| 585 | - $ppp_share_on_publish_include_image = ( isset( $_REQUEST['_ppp_share_on_publish_include_image'] ) ) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
| 583 | + $ppp_share_on_publish = (isset($_REQUEST['_ppp_share_on_publish'])) ? $_REQUEST['_ppp_share_on_publish'] : '0'; |
|
| 584 | + $ppp_share_on_publish_text = (isset($_REQUEST['_ppp_share_on_publish_text'])) ? $_REQUEST['_ppp_share_on_publish_text'] : ''; |
|
| 585 | + $ppp_share_on_publish_include_image = (isset($_REQUEST['_ppp_share_on_publish_include_image'])) ? $_REQUEST['_ppp_share_on_publish_include_image'] : ''; |
|
| 586 | 586 | |
| 587 | 587 | |
| 588 | 588 | update_post_meta( $post_id, '_ppp_share_on_publish', $ppp_share_on_publish ); |
| 589 | 589 | update_post_meta( $post_id, '_ppp_share_on_publish_text', $ppp_share_on_publish_text ); |
| 590 | 590 | update_post_meta( $post_id, '_ppp_share_on_publish_include_image', $ppp_share_on_publish_include_image ); |
| 591 | 591 | |
| 592 | - $tweet_data = isset( $_REQUEST['_ppp_tweets'] ) ? $_REQUEST['_ppp_tweets'] : array(); |
|
| 593 | - foreach ( $tweet_data as $index => $tweet ) { |
|
| 594 | - $tweet_data[ $index ]['text'] = sanitize_text_field( $tweet['text'] ); |
|
| 592 | + $tweet_data = isset($_REQUEST['_ppp_tweets']) ? $_REQUEST['_ppp_tweets'] : array(); |
|
| 593 | + foreach ($tweet_data as $index => $tweet) { |
|
| 594 | + $tweet_data[$index]['text'] = sanitize_text_field( $tweet['text'] ); |
|
| 595 | 595 | } |
| 596 | 596 | update_post_meta( $post_id, '_ppp_tweets', $tweet_data ); |
| 597 | 597 | |
@@ -608,29 +608,29 @@ discard block |
||
| 608 | 608 | function ppp_tw_share_on_publish( $new_status, $old_status, $post ) { |
| 609 | 609 | global $ppp_options; |
| 610 | 610 | |
| 611 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
| 612 | - $from_post = isset( $_POST['_ppp_share_on_publish'] ); |
|
| 611 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_share_on_publish', true ); |
|
| 612 | + $from_post = isset($_POST['_ppp_share_on_publish']); |
|
| 613 | 613 | |
| 614 | - if ( empty( $from_meta ) && empty( $from_post ) ) { |
|
| 614 | + if (empty($from_meta) && empty($from_post)) { |
|
| 615 | 615 | return; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | // Determine if we're seeing the share on publish in meta or $_POST |
| 619 | - if ( $from_meta && !$from_post ) { |
|
| 619 | + if ($from_meta && ! $from_post) { |
|
| 620 | 620 | $ppp_share_on_publish_text = get_post_meta( $post->ID, '_ppp_share_on_publish_text', true ); |
| 621 | 621 | $use_media = get_post_meta( $post->ID, '_ppp_share_on_publish_include_image', true ); |
| 622 | 622 | } else { |
| 623 | - $ppp_share_on_publish_text = isset( $_POST['_ppp_share_on_publish_text'] ) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
| 624 | - $use_media = isset( $_POST['_ppp_share_on_publish_include_image'] ) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
| 623 | + $ppp_share_on_publish_text = isset($_POST['_ppp_share_on_publish_text']) ? $_POST['_ppp_share_on_publish_text'] : ''; |
|
| 624 | + $use_media = isset($_POST['_ppp_share_on_publish_include_image']) ? $_POST['_ppp_share_on_publish_include_image'] : false; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - $share_content = ( !empty( $ppp_share_on_publish_text ) ) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
| 627 | + $share_content = ( ! empty($ppp_share_on_publish_text)) ? $ppp_share_on_publish_text : ppp_tw_generate_share_content( $post->ID, null, false ); |
|
| 628 | 628 | $share_content = apply_filters( 'ppp_share_content', $share_content, array( 'post_id' => $post->ID ) ); |
| 629 | - $name = 'sharedate_0_' . $post->ID; |
|
| 629 | + $name = 'sharedate_0_'.$post->ID; |
|
| 630 | 630 | $media = ppp_post_has_media( $post->ID, 'tw', $use_media ); |
| 631 | 631 | $share_link = ppp_generate_link( $post->ID, $name, true ); |
| 632 | 632 | |
| 633 | - $status = ppp_send_tweet( $share_content . ' ' . $share_link, $post->ID, $media ); |
|
| 633 | + $status = ppp_send_tweet( $share_content.' '.$share_link, $post->ID, $media ); |
|
| 634 | 634 | |
| 635 | 635 | $log_title = ppp_tw_build_share_message( $post->ID, $name, false, false ); |
| 636 | 636 | |
@@ -647,11 +647,11 @@ discard block |
||
| 647 | 647 | |
| 648 | 648 | $log_entry = WP_Logging::insert_log( $log_data, $log_meta ); |
| 649 | 649 | |
| 650 | - if ( ! empty( $status->id_str ) ) { |
|
| 650 | + if ( ! empty($status->id_str)) { |
|
| 651 | 651 | $author_id = $post->post_author; |
| 652 | 652 | $author_rt = get_user_meta( $author_id, '_ppp_share_on_publish', true ); |
| 653 | 653 | |
| 654 | - if ( $author_rt ) { |
|
| 654 | + if ($author_rt) { |
|
| 655 | 655 | $twitter_user = new PPP_Twitter_User( $author_id ); |
| 656 | 656 | $twitter_user->retweet( $status->id_str ); |
| 657 | 657 | } |
@@ -671,20 +671,20 @@ discard block |
||
| 671 | 671 | function ppp_tw_generate_timestamps( $times, $post_id ) { |
| 672 | 672 | $ppp_tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 673 | 673 | |
| 674 | - if ( empty( $ppp_tweets ) ) { |
|
| 674 | + if (empty($ppp_tweets)) { |
|
| 675 | 675 | $ppp_tweets = array(); |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - foreach ( $ppp_tweets as $key => $data ) { |
|
| 679 | - if ( ! array_filter( $data ) ) { |
|
| 678 | + foreach ($ppp_tweets as $key => $data) { |
|
| 679 | + if ( ! array_filter( $data )) { |
|
| 680 | 680 | continue; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
| 684 | 684 | |
| 685 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
| 686 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_tw'; |
|
| 687 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_tw'; |
|
| 685 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
| 686 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_tw'; |
|
| 687 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_tw'; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | } |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | $ret = false; |
| 706 | 706 | |
| 707 | - if ( ! empty( $ppp_share_settings['twitter']['cards_enabled'] ) ) { |
|
| 707 | + if ( ! empty($ppp_share_settings['twitter']['cards_enabled'])) { |
|
| 708 | 708 | $ret = true; |
| 709 | 709 | } |
| 710 | 710 | |
@@ -719,13 +719,13 @@ discard block |
||
| 719 | 719 | */ |
| 720 | 720 | function ppp_tw_card_meta() { |
| 721 | 721 | |
| 722 | - if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled() ) { |
|
| 722 | + if ( ! is_single() || ! ppp_twitter_enabled() || ! ppp_tw_cards_enabled()) { |
|
| 723 | 723 | return; |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | global $post, $ppp_options; |
| 727 | 727 | |
| 728 | - if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
| 728 | + if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
| 729 | 729 | return; |
| 730 | 730 | } |
| 731 | 731 | |
@@ -743,20 +743,20 @@ discard block |
||
| 743 | 743 | |
| 744 | 744 | $return = ''; |
| 745 | 745 | |
| 746 | - if ( ! is_single() || ! ppp_tw_cards_enabled() ) { |
|
| 746 | + if ( ! is_single() || ! ppp_tw_cards_enabled()) { |
|
| 747 | 747 | return $return; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | global $post, $ppp_social_settings; |
| 751 | 751 | |
| 752 | 752 | |
| 753 | - if ( empty( $post ) ) { |
|
| 753 | + if (empty($post)) { |
|
| 754 | 754 | return; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | $elements = ppp_tw_default_meta_elements(); |
| 758 | - foreach ( $elements as $name => $content ) { |
|
| 759 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; |
|
| 758 | + foreach ($elements as $name => $content) { |
|
| 759 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; |
|
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | return apply_filters( 'ppp_tw_card_meta', $return ); |
@@ -776,22 +776,22 @@ discard block |
||
| 776 | 776 | $elements = array(); |
| 777 | 777 | |
| 778 | 778 | $image_url = ppp_post_has_media( $post->ID, 'tw', true ); |
| 779 | - if ( $image_url ) { |
|
| 779 | + if ($image_url) { |
|
| 780 | 780 | $elements['twitter:card'] = 'summary_large_image'; |
| 781 | 781 | $elements['twitter:image:src'] = $image_url; |
| 782 | 782 | } else { |
| 783 | 783 | $elements['twitter:card'] = 'summary'; |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - $elements['twitter:site'] = '@' . $ppp_social_settings['twitter']['user']->screen_name; |
|
| 786 | + $elements['twitter:site'] = '@'.$ppp_social_settings['twitter']['user']->screen_name; |
|
| 787 | 787 | $elements['twitter:title'] = esc_attr( strip_tags( $post->post_title ) ); |
| 788 | 788 | $elements['twitter:description'] = esc_attr( ppp_tw_get_card_description() ); |
| 789 | 789 | |
| 790 | 790 | $author_twitter_handle = get_user_meta( $post->post_author, 'twitter', true ); |
| 791 | - if ( ! empty( $author_twitter_handle ) ) { |
|
| 791 | + if ( ! empty($author_twitter_handle)) { |
|
| 792 | 792 | |
| 793 | - if ( strpos( $author_twitter_handle, '@' ) === false ) { |
|
| 794 | - $author_twitter_handle = '@' . $author_twitter_handle; |
|
| 793 | + if (strpos( $author_twitter_handle, '@' ) === false) { |
|
| 794 | + $author_twitter_handle = '@'.$author_twitter_handle; |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | $elements['twitter:creator'] = esc_attr( strip_tags( $author_twitter_handle ) ); |
@@ -810,13 +810,13 @@ discard block |
||
| 810 | 810 | function ppp_tw_get_card_description() { |
| 811 | 811 | global $post; |
| 812 | 812 | |
| 813 | - if ( ! is_single() || empty( $post ) ) { |
|
| 813 | + if ( ! is_single() || empty($post)) { |
|
| 814 | 814 | return false; |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | $excerpt = $post->post_excerpt; |
| 818 | 818 | |
| 819 | - if ( empty( $excerpt ) ) { |
|
| 819 | + if (empty($excerpt)) { |
|
| 820 | 820 | $excerpt = ppp_tw_format_card_description( $post->post_content ); |
| 821 | 821 | } |
| 822 | 822 | |
@@ -834,10 +834,10 @@ discard block |
||
| 834 | 834 | $max_len = apply_filters( 'ppp_tw_cart_desc_length', 200 ); |
| 835 | 835 | $excerpt = strip_tags( $excerpt ); |
| 836 | 836 | |
| 837 | - if ( strlen( $excerpt ) > $max_len ) { |
|
| 837 | + if (strlen( $excerpt ) > $max_len) { |
|
| 838 | 838 | $excerpt_pre = substr( $excerpt, 0, $max_len ); |
| 839 | 839 | $last_space = strrpos( $excerpt_pre, ' ' ); |
| 840 | - $excerpt = substr( $excerpt_pre, 0, $last_space ) . '...'; |
|
| 840 | + $excerpt = substr( $excerpt_pre, 0, $last_space ).'...'; |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | return $excerpt; |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | */ |
| 853 | 853 | function ppp_tw_add_contact_method( $user_contactmethods ) { |
| 854 | 854 | |
| 855 | - if ( ! isset( $user_contactmethods['twitter'] ) ) { |
|
| 855 | + if ( ! isset($user_contactmethods['twitter'])) { |
|
| 856 | 856 | $user_contactmethods['twitter'] = __( 'Twitter', 'ppp-txt' ); |
| 857 | 857 | } |
| 858 | 858 | // Returns the contact methods |
@@ -870,11 +870,11 @@ discard block |
||
| 870 | 870 | */ |
| 871 | 871 | function ppp_tw_profile_settings( $user ) { |
| 872 | 872 | |
| 873 | - if ( $user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' ) ) { |
|
| 873 | + if ($user->ID == get_current_user_id() && ! current_user_can( 'edit_posts' )) { |
|
| 874 | 874 | return; |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if ( $user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' ) ) { |
|
| 877 | + if ($user->ID !== get_current_user_id() && ! current_user_can( 'manage_options' )) { |
|
| 878 | 878 | return; |
| 879 | 879 | } |
| 880 | 880 | |
@@ -888,16 +888,16 @@ discard block |
||
| 888 | 888 | <?php |
| 889 | 889 | $twitter = new PPP_Twitter_User( get_current_user_id() ); |
| 890 | 890 | $tw_user = get_user_meta( $user->ID, '_ppp_twitter_data', true ); |
| 891 | - if ( empty( $tw_user ) ) { |
|
| 892 | - $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id=' . $user->ID ) ); |
|
| 891 | + if (empty($tw_user)) { |
|
| 892 | + $tw_authurl = $twitter->get_auth_url( admin_url( 'user-edit.php?user_id='.$user->ID ) ); |
|
| 893 | 893 | |
| 894 | - echo '<a href="' . $tw_authurl . '"><img src="' . PPP_URL . '/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 894 | + echo '<a href="'.$tw_authurl.'"><img src="'.PPP_URL.'/includes/images/sign-in-with-twitter-gray.png" /></a>'; |
|
| 895 | 895 | } else { |
| 896 | 896 | $connected = true; |
| 897 | 897 | ?> |
| 898 | 898 | <p><strong><?php _e( 'Signed in as', 'ppp-txt' ); ?>: </strong><?php echo $tw_user['user']->screen_name; ?></p> |
| 899 | 899 | <p> |
| 900 | - <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> |
|
| 900 | + <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> |
|
| 901 | 901 | <a class="button-secondary" href="https://twitter.com/settings/applications" target="blank"><?php _e( 'Revoke Access via Twitter', 'ppp-txt' ); ?></a> |
| 902 | 902 | </p> |
| 903 | 903 | <?php |
@@ -906,10 +906,10 @@ discard block |
||
| 906 | 906 | </td> |
| 907 | 907 | </tr> |
| 908 | 908 | |
| 909 | - <?php if ( $connected ) : ?> |
|
| 909 | + <?php if ($connected) : ?> |
|
| 910 | 910 | <?php |
| 911 | 911 | $share_on_publish = get_user_meta( $user->ID, '_ppp_share_on_publish', true ); |
| 912 | - $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled' , true ); |
|
| 912 | + $share_scheduled = get_user_meta( $user->ID, '_ppp_share_scheduled', true ); |
|
| 913 | 913 | ?> |
| 914 | 914 | <tr> |
| 915 | 915 | <th><?php _e( 'Sharing Options', 'ppp-txt' ); ?></th> |
@@ -942,11 +942,11 @@ discard block |
||
| 942 | 942 | */ |
| 943 | 943 | function ppp_tw_save_profile( $user_id ) { |
| 944 | 944 | |
| 945 | - $share_on_publish = ! empty( $_POST['share_on_publish'] ) ? true : false; |
|
| 946 | - $share_scheduled = ! empty( $_POST['share_scheduled'] ) ? true : false; |
|
| 945 | + $share_on_publish = ! empty($_POST['share_on_publish']) ? true : false; |
|
| 946 | + $share_scheduled = ! empty($_POST['share_scheduled']) ? true : false; |
|
| 947 | 947 | |
| 948 | 948 | update_user_meta( $user_id, '_ppp_share_on_publish', $share_on_publish ); |
| 949 | - update_user_meta( $user_id, '_ppp_share_scheduled' , $share_scheduled ); |
|
| 949 | + update_user_meta( $user_id, '_ppp_share_scheduled', $share_scheduled ); |
|
| 950 | 950 | |
| 951 | 951 | } |
| 952 | 952 | add_action( 'personal_options_update', 'ppp_tw_save_profile' ); |
@@ -955,14 +955,14 @@ discard block |
||
| 955 | 955 | function ppp_tw_calendar_on_publish_event( $events, $post_id ) { |
| 956 | 956 | $share_on_publish = get_post_meta( $post_id, '_ppp_share_on_publish', true ); |
| 957 | 957 | |
| 958 | - if ( ! empty( $share_on_publish ) ) { |
|
| 958 | + if ( ! empty($share_on_publish)) { |
|
| 959 | 959 | $share_text = get_post_meta( $post_id, '_ppp_share_on_publish_text', true ); |
| 960 | 960 | $events[] = array( |
| 961 | - 'id' => $post_id . '-share-on-publish', |
|
| 962 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
| 963 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 964 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 965 | - 'className' => 'ppp-calendar-item-tw cal-post-' . $post_id, |
|
| 961 | + 'id' => $post_id.'-share-on-publish', |
|
| 962 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_tw_generate_share_content( $post_id, null, false ), |
|
| 963 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 964 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 965 | + 'className' => 'ppp-calendar-item-tw cal-post-'.$post_id, |
|
| 966 | 966 | 'belongsTo' => $post_id, |
| 967 | 967 | ); |
| 968 | 968 | } |
@@ -973,9 +973,9 @@ discard block |
||
| 973 | 973 | |
| 974 | 974 | function ppp_tw_get_post_shares( $items, $post_id ) { |
| 975 | 975 | $tweets = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 976 | - if ( empty( $tweets ) ) { return $items; } |
|
| 976 | + if (empty($tweets)) { return $items; } |
|
| 977 | 977 | |
| 978 | - foreach ( $tweets as $key => $tweet ) { |
|
| 978 | + foreach ($tweets as $key => $tweet) { |
|
| 979 | 979 | $items[] = array( 'id' => $key, 'service' => 'tw' ); |
| 980 | 980 | } |
| 981 | 981 | return $items; |
@@ -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 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -13,23 +13,23 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | function ppp_schedule_share( $post_id, $post ) { |
| 15 | 15 | global $ppp_options; |
| 16 | - $allowed_post_types = isset( $ppp_options['post_types'] ) ? $ppp_options['post_types'] : array(); |
|
| 16 | + $allowed_post_types = isset($ppp_options['post_types']) ? $ppp_options['post_types'] : array(); |
|
| 17 | 17 | $allowed_post_types = apply_filters( 'ppp_schedule_share_post_types', $allowed_post_types ); |
| 18 | 18 | |
| 19 | - if ( ! isset( $_POST['post_status'] ) || ! array_key_exists( $post->post_type, $allowed_post_types ) ) { |
|
| 19 | + if ( ! isset($_POST['post_status']) || ! array_key_exists( $post->post_type, $allowed_post_types )) { |
|
| 20 | 20 | return; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | ppp_remove_scheduled_shares( $post_id ); |
| 24 | 24 | |
| 25 | - if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published |
|
| 26 | - ( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post |
|
| 27 | - ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post |
|
| 25 | + if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published |
|
| 26 | + ($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post |
|
| 27 | + ($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post |
|
| 28 | 28 | global $ppp_options, $ppp_social_settings; |
| 29 | 29 | |
| 30 | 30 | $timestamps = ppp_get_timestamps( $post_id ); |
| 31 | 31 | |
| 32 | - foreach ( $timestamps as $timestamp => $name ) { |
|
| 32 | + foreach ($timestamps as $timestamp => $name) { |
|
| 33 | 33 | $timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 ); |
| 34 | 34 | wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) ); |
| 35 | 35 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $current_item_shares = ppp_get_shceduled_crons( $post_id ); |
| 50 | 50 | |
| 51 | - foreach ( $current_item_shares as $share ) { |
|
| 51 | + foreach ($current_item_shares as $share) { |
|
| 52 | 52 | wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) ); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | $all_crons = get_option( 'cron' ); |
| 74 | 74 | $ppp_crons = array(); |
| 75 | 75 | |
| 76 | - foreach ( $all_crons as $timestamp => $cron ) { |
|
| 77 | - if ( ! isset( $cron['ppp_share_post_event'] ) ) { |
|
| 76 | + foreach ($all_crons as $timestamp => $cron) { |
|
| 77 | + if ( ! isset($cron['ppp_share_post_event'])) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) { |
|
| 81 | + foreach ($cron['ppp_share_post_event'] as $key => $single_event) { |
|
| 82 | 82 | $name_parts = explode( '_', $single_event['args'][1] ); |
| 83 | - if ( false !== $post_id && $post_id != $name_parts[2] ) { |
|
| 83 | + if (false !== $post_id && $post_id != $name_parts[2]) { |
|
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $single_event['timestamp'] = $timestamp; |
| 88 | - $ppp_crons[ $key ] = $single_event; |
|
| 88 | + $ppp_crons[$key] = $single_event; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | } |
@@ -103,26 +103,26 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | */ |
| 105 | 105 | function ppp_has_cron_within( $time = 0, $within = 0 ) { |
| 106 | - if ( empty( $time ) ) { |
|
| 106 | + if (empty($time)) { |
|
| 107 | 107 | $time = current_time( 'timestamp' ); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( empty( $within ) ) { |
|
| 110 | + if (empty($within)) { |
|
| 111 | 111 | $within = ppp_get_default_conflict_window(); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $crons = ppp_get_shceduled_crons(); |
| 115 | 115 | |
| 116 | - if ( empty( $crons ) ) { |
|
| 116 | + if (empty($crons)) { |
|
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $scheduled_times = wp_list_pluck( $crons, 'timestamp' ); |
| 121 | 121 | |
| 122 | 122 | $found_time = false; |
| 123 | - foreach ( $scheduled_times as $key => $scheduled_time ) { |
|
| 123 | + foreach ($scheduled_times as $key => $scheduled_time) { |
|
| 124 | 124 | $found_time = ppp_is_time_within( $scheduled_time, $time, $within ); |
| 125 | - if ( $found_time ) { |
|
| 125 | + if ($found_time) { |
|
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | $min = $target_time - $within; |
| 145 | 145 | $max = $target_time + $within; |
| 146 | 146 | |
| 147 | - return ( ( $time >= $min ) && ( $time <= $max ) ); |
|
| 147 | + return (($time >= $min) && ($time <= $max)); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function ppp_unschedule_shares( $new_status, $old_status, $post ) { |
| 214 | 214 | |
| 215 | - if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) { |
|
| 215 | + if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) { |
|
| 216 | 216 | ppp_remove_scheduled_shares( $post->ID ); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | // Just in case we need this, let's set it once |
| 232 | 232 | $current_time = current_time( 'timestamp' ); |
| 233 | 233 | |
| 234 | - if ( empty( $date ) ) { |
|
| 234 | + if (empty($date)) { |
|
| 235 | 235 | $date = date( 'm/d/Y', $current_time ); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if ( empty( $time ) ) { |
|
| 238 | + if (empty($time)) { |
|
| 239 | 239 | $time = date( 'h:ia', $current_time ); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,15 +244,15 @@ discard block |
||
| 244 | 244 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
| 245 | 245 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
| 246 | 246 | |
| 247 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
| 247 | + if ($ampm == 'pm' && $hours != 12) { |
|
| 248 | 248 | $hours = $hours + 12; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
| 251 | + if ($ampm == 'am' && $hours == 12) { |
|
| 252 | 252 | $hours = 00; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $offset = (int) -( get_option( 'gmt_offset' ) ); |
|
| 255 | + $offset = (int) -(get_option( 'gmt_offset' )); |
|
| 256 | 256 | $hours = $hours + $offset; |
| 257 | 257 | $date = explode( '/', $date ); |
| 258 | 258 | $timestamp = mktime( (int) $hours, (int) $minutes, 0, (int) $date[0], (int) $date[1], (int) $date[2] ); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function ppp_facebook_enabled() { |
| 13 | 13 | global $ppp_social_settings; |
| 14 | 14 | |
| 15 | - if ( isset( $ppp_social_settings['facebook'] ) && !empty( $ppp_social_settings['facebook'] ) ) { |
|
| 15 | + if (isset($ppp_social_settings['facebook']) && ! empty($ppp_social_settings['facebook'])) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function ppp_fb_account_list_avatar( $string = '' ) { |
| 52 | 52 | |
| 53 | - if ( ppp_facebook_enabled() ) { |
|
| 53 | + if (ppp_facebook_enabled()) { |
|
| 54 | 54 | global $ppp_social_settings; |
| 55 | 55 | $avatar_url = $ppp_social_settings['facebook']->avatar; |
| 56 | - $string = '<img class="ppp-social-icon" src="' . $avatar_url . '" />'; |
|
| 56 | + $string = '<img class="ppp-social-icon" src="'.$avatar_url.'" />'; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | return $string; |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | function ppp_fb_account_list_name( $string = '' ) { |
| 69 | 69 | |
| 70 | - if ( ppp_facebook_enabled() ) { |
|
| 70 | + if (ppp_facebook_enabled()) { |
|
| 71 | 71 | global $ppp_social_settings; |
| 72 | - $string = $ppp_social_settings['facebook']->name; |
|
| 72 | + $string = $ppp_social_settings['facebook']->name; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return $string; |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function ppp_fb_account_list_actions( $string = '' ) { |
| 85 | 85 | |
| 86 | - if ( ! ppp_facebook_enabled() ) { |
|
| 86 | + if ( ! ppp_facebook_enabled()) { |
|
| 87 | 87 | global $ppp_facebook_oauth, $ppp_social_settings; |
| 88 | 88 | $fb_authurl = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 89 | 89 | |
| 90 | - $string .= '<a class="button-primary" href="' . $fb_authurl . '">' . __( 'Connect to Facebook', 'ppp-txt' ) . '</a>'; |
|
| 90 | + $string .= '<a class="button-primary" href="'.$fb_authurl.'">'.__( 'Connect to Facebook', 'ppp-txt' ).'</a>'; |
|
| 91 | 91 | } else { |
| 92 | - $string .= '<a class="button-primary" href="' . admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=facebook' ) . '" >' . __( 'Disconnect from Facebook', 'ppp-txt' ) . '</a> '; |
|
| 92 | + $string .= '<a class="button-primary" href="'.admin_url( 'admin.php?page=ppp-social-settings&ppp_social_disconnect=true&ppp_network=facebook' ).'" >'.__( 'Disconnect from Facebook', 'ppp-txt' ).'</a> '; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $string; |
@@ -103,28 +103,28 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | function ppp_fb_account_list_extras( $string ) { |
| 105 | 105 | |
| 106 | - if ( ppp_facebook_enabled() ) { |
|
| 106 | + if (ppp_facebook_enabled()) { |
|
| 107 | 107 | global $ppp_social_settings, $ppp_facebook_oauth, $ppp_options; |
| 108 | 108 | $pages = $ppp_facebook_oauth->ppp_get_fb_user_pages( $ppp_social_settings['facebook']->access_token ); |
| 109 | - $selected = isset( $ppp_social_settings['facebook']->page ) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; |
|
| 109 | + $selected = isset($ppp_social_settings['facebook']->page) ? stripslashes( $ppp_social_settings['facebook']->page ) : 'me'; |
|
| 110 | 110 | |
| 111 | - if ( !empty( $pages ) ) { |
|
| 112 | - $string = '<label>' . __( 'Publish as:', 'ppp-txt' ) . '</label><br />'; |
|
| 111 | + if ( ! empty($pages)) { |
|
| 112 | + $string = '<label>'.__( 'Publish as:', 'ppp-txt' ).'</label><br />'; |
|
| 113 | 113 | $string .= '<select id="fb-page">'; |
| 114 | - $string .= '<option value="me">' . __( 'Me', 'ppp-txt' ) . '</option>'; |
|
| 115 | - foreach ( $pages as $page ) { |
|
| 116 | - $value = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
| 117 | - $string .= '<option ' . selected( $value, $selected, false ) . ' value="' . $value . '">' . $page->name . '</option>'; |
|
| 114 | + $string .= '<option value="me">'.__( 'Me', 'ppp-txt' ).'</option>'; |
|
| 115 | + foreach ($pages as $page) { |
|
| 116 | + $value = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
| 117 | + $string .= '<option '.selected( $value, $selected, false ).' value="'.$value.'">'.$page->name.'</option>'; |
|
| 118 | 118 | } |
| 119 | 119 | $string .= '</select><span class="spinner"></span>'; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( ! empty( $ppp_options['enable_debug'] ) ) { |
|
| 123 | - $days_left = absint( round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
| 124 | - $refresh_in = absint( round( ( get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ) ); |
|
| 122 | + if ( ! empty($ppp_options['enable_debug'])) { |
|
| 123 | + $days_left = absint( round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
| 124 | + $refresh_in = absint( round( (get_option( '_ppp_facebook_refresh' ) - current_time( 'timestamp' )) / DAY_IN_SECONDS ) ); |
|
| 125 | 125 | |
| 126 | - $string .= '<br />' . sprintf( __( 'Token expires in %s days' , 'ppp-txt' ), $days_left ); |
|
| 127 | - $string .= '<br />' . sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
| 126 | + $string .= '<br />'.sprintf( __( 'Token expires in %s days', 'ppp-txt' ), $days_left ); |
|
| 127 | + $string .= '<br />'.sprintf( __( 'Refresh notice in %s days', 'ppp-txt' ), $refresh_in ); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return void |
| 139 | 139 | */ |
| 140 | 140 | function ppp_set_fb_token_constants( $social_tokens ) { |
| 141 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'facebook' ) ) { |
|
| 141 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'facebook' )) { |
|
| 142 | 142 | define( 'PPP_FB_APP_ID', $social_tokens->facebook->app_id ); |
| 143 | 143 | define( 'PPP_FB_APP_SECRET', $social_tokens->facebook->app_secret ); |
| 144 | 144 | } |
@@ -152,17 +152,17 @@ discard block |
||
| 152 | 152 | function ppp_capture_facebook_oauth() { |
| 153 | 153 | $should_capture = false; |
| 154 | 154 | |
| 155 | - if ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) { |
|
| 155 | + if (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) { |
|
| 156 | 156 | // Local config |
| 157 | 157 | $should_capture = true; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ( isset( $_REQUEST['fb_access_token'] ) ) { |
|
| 160 | + if (isset($_REQUEST['fb_access_token'])) { |
|
| 161 | 161 | // Returning from remote config |
| 162 | 162 | $should_capture = true; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( $should_capture && ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'ppp-social-settings' ) ) { |
|
| 165 | + if ($should_capture && (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ppp-social-settings')) { |
|
| 166 | 166 | global $ppp_facebook_oauth; |
| 167 | 167 | $ppp_facebook_oauth->ppp_initialize_facebook(); |
| 168 | 168 | wp_redirect( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | function ppp_disconnect_facebook() { |
| 180 | 180 | global $ppp_social_settings; |
| 181 | 181 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 182 | - if ( isset( $ppp_social_settings['facebook'] ) ) { |
|
| 183 | - unset( $ppp_social_settings['facebook'] ); |
|
| 182 | + if (isset($ppp_social_settings['facebook'])) { |
|
| 183 | + unset($ppp_social_settings['facebook']); |
|
| 184 | 184 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 185 | 185 | delete_option( '_ppp_facebook_refresh' ); |
| 186 | 186 | } |
@@ -206,13 +206,13 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | function ppp_fb_execute_refresh() { |
| 208 | 208 | |
| 209 | - if ( ! ppp_facebook_enabled() ) { |
|
| 209 | + if ( ! ppp_facebook_enabled()) { |
|
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $refresh_date = (int) get_option( '_ppp_facebook_refresh', true ); |
| 214 | 214 | |
| 215 | - if ( current_time( 'timestamp' ) > $refresh_date ) { |
|
| 215 | + if (current_time( 'timestamp' ) > $refresh_date) { |
|
| 216 | 216 | add_action( 'admin_notices', 'ppp_facebook_refresh_notice' ); |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -224,12 +224,12 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | function ppp_facebook_refresh_notice() { |
| 226 | 226 | |
| 227 | - if ( ! ppp_facebook_enabled() ) { |
|
| 227 | + if ( ! ppp_facebook_enabled()) { |
|
| 228 | 228 | return; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb' . get_current_user_id() ); |
|
| 232 | - if ( false !== $has_dismissed ) { |
|
| 231 | + $has_dismissed = get_transient( 'ppp-dismiss-refresh-fb'.get_current_user_id() ); |
|
| 232 | + if (false !== $has_dismissed) { |
|
| 233 | 233 | return; |
| 234 | 234 | } |
| 235 | 235 | |
@@ -240,14 +240,14 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | $token = $ppp_social_settings['facebook']->access_token; |
| 242 | 242 | $url = $ppp_facebook_oauth->ppp_get_facebook_auth_url( admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 243 | - $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token=' . $token, $url ); |
|
| 243 | + $url = str_replace( '?ppp-social-auth', '?ppp-social-auth&ppp-refresh=true&access_token='.$token, $url ); |
|
| 244 | 244 | |
| 245 | - $days_left = (int) round( ( $ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' ) ) / DAY_IN_SECONDS ); |
|
| 245 | + $days_left = (int) round( ($ppp_social_settings['facebook']->expires_on - current_time( 'timestamp' )) / DAY_IN_SECONDS ); |
|
| 246 | 246 | ?> |
| 247 | 247 | <div class="notice notice-warning is-dismissible" data-service="fb"> |
| 248 | - <?php if ( $days_left > 0 ): ?> |
|
| 248 | + <?php if ($days_left > 0): ?> |
|
| 249 | 249 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication expires in %d days. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $days_left, $url ); ?></p> |
| 250 | - <?php elseif ( $days_left < 1 ): ?> |
|
| 250 | + <?php elseif ($days_left < 1): ?> |
|
| 251 | 251 | <p><strong>Post Promoter Pro: </strong><?php printf( __( 'Your Facebook authentication has expired. Please <a href="%s">refresh access</a>.', 'ppp-txt' ), $url ); ?></p> |
| 252 | 252 | <?php endif; ?> |
| 253 | 253 | </div> |
@@ -262,10 +262,10 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | function ppp_fb_dismiss_notice() { |
| 264 | 264 | |
| 265 | - $nag = sanitize_key( $_POST[ 'nag' ] ); |
|
| 265 | + $nag = sanitize_key( $_POST['nag'] ); |
|
| 266 | 266 | |
| 267 | - if ( $nag === $_POST[ 'nag' ] ) { |
|
| 268 | - set_transient( $nag . get_current_user_id(), true, DAY_IN_SECONDS ); |
|
| 267 | + if ($nag === $_POST['nag']) { |
|
| 268 | + set_transient( $nag.get_current_user_id(), true, DAY_IN_SECONDS ); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | |
@@ -293,18 +293,18 @@ discard block |
||
| 293 | 293 | * @param string $name The name of the Cron |
| 294 | 294 | * @return void |
| 295 | 295 | */ |
| 296 | -function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
| 296 | +function ppp_fb_scheduled_share( $post_id = 0, $index = 1, $name = '' ) { |
|
| 297 | 297 | global $ppp_options; |
| 298 | 298 | |
| 299 | 299 | $link = ppp_generate_link( $post_id, $name ); |
| 300 | 300 | |
| 301 | 301 | $post_meta = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
| 302 | - $this_share = $post_meta[ $index ]; |
|
| 303 | - $attachment_id = isset( $this_share['attachment_id'] ) ? $this_share['attachment_id'] : false; |
|
| 302 | + $this_share = $post_meta[$index]; |
|
| 303 | + $attachment_id = isset($this_share['attachment_id']) ? $this_share['attachment_id'] : false; |
|
| 304 | 304 | |
| 305 | 305 | $share_message = ppp_fb_build_share_message( $post_id, $name ); |
| 306 | 306 | |
| 307 | - if ( empty( $attachment_id ) && ! empty( $this_share['image'] ) ) { |
|
| 307 | + if (empty($attachment_id) && ! empty($this_share['image'])) { |
|
| 308 | 308 | $media = $this_share['image']; |
| 309 | 309 | } else { |
| 310 | 310 | $use_media = ppp_fb_use_media( $post_id, $index ); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | function ppp_fb_add_meta_tab( $tabs ) { |
| 363 | 363 | global $ppp_social_settings; |
| 364 | - if ( ! ppp_facebook_enabled() ) { |
|
| 364 | + if ( ! ppp_facebook_enabled()) { |
|
| 365 | 365 | return $tabs; |
| 366 | 366 | } |
| 367 | 367 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | */ |
| 379 | 379 | function ppp_fb_register_metabox_content( $content ) { |
| 380 | 380 | global $ppp_social_settings; |
| 381 | - if ( ! ppp_facebook_enabled() ) { |
|
| 381 | + if ( ! ppp_facebook_enabled()) { |
|
| 382 | 382 | return $content; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function ppp_fb_add_metabox_content( $post ) { |
| 396 | 396 | global $ppp_options, $ppp_share_settings; |
| 397 | - $default_text = !empty( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 397 | + $default_text = ! empty($ppp_options['default_text']) ? $ppp_options['default_text'] : __( 'Social Text', 'ppp-txt' ); |
|
| 398 | 398 | |
| 399 | 399 | $ppp_fb_share_on_publish = get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
| 400 | 400 | $ppp_share_on_publish_title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | $show_share_on_publish = false; |
| 405 | 405 | |
| 406 | - $share_by_default = empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? false : true; |
|
| 406 | + $share_by_default = empty($ppp_share_settings['facebook']['share_on_publish']) ? false : true; |
|
| 407 | 407 | |
| 408 | - if ( $ppp_fb_share_on_publish == '1' || ( $ppp_fb_share_on_publish == '' && $share_by_default ) ) { |
|
| 408 | + if ($ppp_fb_share_on_publish == '1' || ($ppp_fb_share_on_publish == '' && $share_by_default)) { |
|
| 409 | 409 | $show_share_on_publish = true; |
| 410 | 410 | } |
| 411 | 411 | |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | <div class="ppp-post-override-wrap"> |
| 415 | 415 | <p><h3><?php _e( 'Share on Facebook', 'ppp-txt' ); ?></h3></p> |
| 416 | 416 | <p> |
| 417 | - <?php $disabled = ( $post->post_status === 'publish' && time() > strtotime( $post->post_date ) ) ? true : false; ?> |
|
| 417 | + <?php $disabled = ($post->post_status === 'publish' && time() > strtotime( $post->post_date )) ? true : false; ?> |
|
| 418 | 418 | <label for="ppp_fb_share_on_publish"><?php _e( 'Share this post on Facebook…', 'ppp-txt' ); ?></label> |
| 419 | 419 | <select name="_ppp_fb_share_on_publish" id="ppp_fb_share_on_publish" class="ppp-toggle-share-on-publish"> |
| 420 | - <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
| 421 | - <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ( $disabled ): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
| 420 | + <option value="-1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'Do not share this post', 'ppp-txt' ); ?></option> |
|
| 421 | + <option value="1" <?php selected( true, $show_share_on_publish, true ); ?><?php if ($disabled): ?>disabled<?php endif; ?>><?php _e( 'When this post is published', 'ppp-txt' ); ?></option> |
|
| 422 | 422 | <option value="0" <?php selected( false, $show_share_on_publish, true ); ?>><?php _e( 'After this post is published', 'ppp-txt' ); ?></option> |
| 423 | 423 | </select> |
| 424 | 424 | </p> |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | <th style="width: 10px;"></th> |
| 435 | 435 | </tr> |
| 436 | 436 | </thead> |
| 437 | - <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if ( false === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
| 437 | + <tbody id="fb-share-on-publish" class="ppp-share-on-publish" <?php if (false === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
| 438 | 438 | <?php |
| 439 | 439 | $args = array( |
| 440 | 440 | 'text' => $ppp_share_on_publish_title, |
@@ -445,18 +445,18 @@ discard block |
||
| 445 | 445 | ppp_render_fb_share_on_publish_row( $args ); |
| 446 | 446 | ?> |
| 447 | 447 | </tbody> |
| 448 | - <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if ( true === $show_share_on_publish ) : echo 'style="display: none;"'; endif; ?>> |
|
| 448 | + <tbody id="fb-schedule-share" class="ppp-schedule-share" <?php if (true === $show_share_on_publish) : echo 'style="display: none;"'; endif; ?>> |
|
| 449 | 449 | <?php $shares = get_post_meta( $post->ID, '_ppp_fb_shares', true ); ?> |
| 450 | - <?php if ( ! empty( $shares ) ) : ?> |
|
| 450 | + <?php if ( ! empty($shares)) : ?> |
|
| 451 | 451 | |
| 452 | - <?php foreach ( $shares as $key => $value ) : |
|
| 453 | - $date = isset( $value['date'] ) ? $value['date'] : ''; |
|
| 454 | - $time = isset( $value['time'] ) ? $value['time'] : ''; |
|
| 455 | - $text = isset( $value['text'] ) ? $value['text'] : ''; |
|
| 456 | - $image = isset( $value['image'] ) ? $value['image'] : ''; |
|
| 457 | - $attachment_id = isset( $value['attachment_id'] ) ? $value['attachment_id'] : ''; |
|
| 452 | + <?php foreach ($shares as $key => $value) : |
|
| 453 | + $date = isset($value['date']) ? $value['date'] : ''; |
|
| 454 | + $time = isset($value['time']) ? $value['time'] : ''; |
|
| 455 | + $text = isset($value['text']) ? $value['text'] : ''; |
|
| 456 | + $image = isset($value['image']) ? $value['image'] : ''; |
|
| 457 | + $attachment_id = isset($value['attachment_id']) ? $value['attachment_id'] : ''; |
|
| 458 | 458 | |
| 459 | - $args = apply_filters( 'ppp_fb_row_args', compact( 'date','time','text','image','attachment_id' ), $value ); |
|
| 459 | + $args = apply_filters( 'ppp_fb_row_args', compact( 'date', 'time', 'text', 'image', 'attachment_id' ), $value ); |
|
| 460 | 460 | ?> |
| 461 | 461 | |
| 462 | 462 | <?php ppp_render_fb_share_row( $key, $args, $post->ID ); ?> |
@@ -536,8 +536,8 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | $share_time = ppp_generate_timestamp( $args['date'], $args['time'] ); |
| 538 | 538 | $readonly = ppp_generate_timestamp() > $share_time ? 'readonly="readonly" ' : false; |
| 539 | - $no_date = ! empty( $readonly ) ? ' hasDatepicker' : ''; |
|
| 540 | - $hide = ! empty( $readonly ) ? 'display: none;' : ''; |
|
| 539 | + $no_date = ! empty($readonly) ? ' hasDatepicker' : ''; |
|
| 540 | + $hide = ! empty($readonly) ? 'display: none;' : ''; |
|
| 541 | 541 | ?> |
| 542 | 542 | <tr class="ppp-fb-wrapper ppp-repeatable-row ppp-repeatable-facebook scheduled-row" data-key="<?php echo esc_attr( $key ); ?>"> |
| 543 | 543 | <td> |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | </td> |
| 568 | 568 | |
| 569 | 569 | <td> |
| 570 | - <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url('/images/xit.gif'); ?>) no-repeat;<?php echo $hide; ?>">×</a> |
|
| 570 | + <a href="#" class="ppp-repeatable-row ppp-remove-repeatable" data-type="facebook" style="background: url(<?php echo admin_url( '/images/xit.gif' ); ?>) no-repeat;<?php echo $hide; ?>">×</a> |
|
| 571 | 571 | </td> |
| 572 | 572 | |
| 573 | 573 | </tr> |
@@ -582,23 +582,23 @@ discard block |
||
| 582 | 582 | */ |
| 583 | 583 | function ppp_fb_save_post_meta_boxes( $post_id, $post ) { |
| 584 | 584 | |
| 585 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
| 585 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
| 586 | 586 | return; |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - $ppp_fb_share_on_publish = ( isset( $_REQUEST['_ppp_fb_share_on_publish'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; |
|
| 590 | - $ppp_share_on_publish_title = ( isset( $_REQUEST['_ppp_fb_share_on_publish_title'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; |
|
| 591 | - $ppp_share_on_publish_image_url = ( isset( $_REQUEST['_ppp_fb_share_on_publish_image_url'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
| 592 | - $ppp_share_on_publish_attachment_id = ( isset( $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] ) ) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; |
|
| 589 | + $ppp_fb_share_on_publish = (isset($_REQUEST['_ppp_fb_share_on_publish'])) ? $_REQUEST['_ppp_fb_share_on_publish'] : '-1'; |
|
| 590 | + $ppp_share_on_publish_title = (isset($_REQUEST['_ppp_fb_share_on_publish_title'])) ? $_REQUEST['_ppp_fb_share_on_publish_title'] : ''; |
|
| 591 | + $ppp_share_on_publish_image_url = (isset($_REQUEST['_ppp_fb_share_on_publish_image_url'])) ? $_REQUEST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
| 592 | + $ppp_share_on_publish_attachment_id = (isset($_REQUEST['_ppp_fb_share_on_publish_attachment_id'])) ? $_REQUEST['_ppp_fb_share_on_publish_attachment_id'] : ''; |
|
| 593 | 593 | |
| 594 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); |
|
| 595 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); |
|
| 596 | - update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
| 594 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish', $ppp_fb_share_on_publish ); |
|
| 595 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_title', $ppp_share_on_publish_title ); |
|
| 596 | + update_post_meta( $post_id, '_ppp_fb_share_on_publish_image_url', $ppp_share_on_publish_image_url ); |
|
| 597 | 597 | update_post_meta( $post_id, '_ppp_fb_share_on_publish_attachment_id', $ppp_share_on_publish_attachment_id ); |
| 598 | 598 | |
| 599 | - $fb_data = ( isset( $_REQUEST['_ppp_fb_shares'] ) && empty( $ppp_fb_share_on_publish ) ) ? $_REQUEST['_ppp_fb_shares'] : array(); |
|
| 600 | - foreach ( $fb_data as $index => $share ) { |
|
| 601 | - $fb_data[ $index ]['text'] = sanitize_text_field( $share['text'] ); |
|
| 599 | + $fb_data = (isset($_REQUEST['_ppp_fb_shares']) && empty($ppp_fb_share_on_publish)) ? $_REQUEST['_ppp_fb_shares'] : array(); |
|
| 600 | + foreach ($fb_data as $index => $share) { |
|
| 601 | + $fb_data[$index]['text'] = sanitize_text_field( $share['text'] ); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | update_post_meta( $post_id, '_ppp_fb_shares', $fb_data ); |
@@ -615,10 +615,10 @@ discard block |
||
| 615 | 615 | function ppp_fb_share_on_publish( $new_status, $old_status, $post ) { |
| 616 | 616 | global $ppp_options; |
| 617 | 617 | |
| 618 | - $from_meta = ! empty( $_POST['ppp_post_edit'] ) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
|
| 619 | - $from_post = isset( $_POST['_ppp_fb_share_on_publish'] ) ? $_POST['_ppp_fb_share_on_publish'] : '0'; |
|
| 618 | + $from_meta = ! empty($_POST['ppp_post_edit']) ? false : get_post_meta( $post->ID, '_ppp_fb_share_on_publish', true ); |
|
| 619 | + $from_post = isset($_POST['_ppp_fb_share_on_publish']) ? $_POST['_ppp_fb_share_on_publish'] : '0'; |
|
| 620 | 620 | |
| 621 | - if ( '1' != $from_meta && '1' != $from_post ) { |
|
| 621 | + if ('1' != $from_meta && '1' != $from_post) { |
|
| 622 | 622 | return; |
| 623 | 623 | } |
| 624 | 624 | |
@@ -630,28 +630,28 @@ discard block |
||
| 630 | 630 | $image_url = ''; |
| 631 | 631 | |
| 632 | 632 | // Determine if we're seeing the share on publish in meta or $_POST |
| 633 | - if ( $from_meta && ! $from_post ) { |
|
| 634 | - $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
|
| 633 | + if ($from_meta && ! $from_post) { |
|
| 634 | + $title = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_title', true ); |
|
| 635 | 635 | $attachment_id = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_attachment_id', true ); |
| 636 | - $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); |
|
| 636 | + $image_url = get_post_meta( $post->ID, '_ppp_fb_share_on_publish_image_url', true ); |
|
| 637 | 637 | } else { |
| 638 | - $title = isset( $_POST['_ppp_fb_share_on_publish_title'] ) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; |
|
| 639 | - $attachment_id = isset( $_POST['_ppp_fb_share_on_publish_attachment_id'] ) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; |
|
| 640 | - $image_url = isset( $_POST['_ppp_fb_share_on_publish_image_url'] ) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
| 638 | + $title = isset($_POST['_ppp_fb_share_on_publish_title']) ? $_POST['_ppp_fb_share_on_publish_title'] : ''; |
|
| 639 | + $attachment_id = isset($_POST['_ppp_fb_share_on_publish_attachment_id']) ? $_POST['_ppp_fb_share_on_publish_attachment_id'] : 0; |
|
| 640 | + $image_url = isset($_POST['_ppp_fb_share_on_publish_image_url']) ? $_POST['_ppp_fb_share_on_publish_image_url'] : ''; |
|
| 641 | 641 | } |
| 642 | 642 | |
| 643 | 643 | $thumbnail = ''; |
| 644 | - if ( empty( $attachment_id ) && ! empty( $image_url ) ) { |
|
| 644 | + if (empty($attachment_id) && ! empty($image_url)) { |
|
| 645 | 645 | $thumbnail = $image_url; |
| 646 | 646 | } else { |
| 647 | 647 | $thumbnail = ppp_post_has_media( $post->ID, 'fb', true, $attachment_id ); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | - $name = 'sharedate_0_' . $post->ID . '_fb'; |
|
| 650 | + $name = 'sharedate_0_'.$post->ID.'_fb'; |
|
| 651 | 651 | |
| 652 | - $default_title = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
| 652 | + $default_title = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
| 653 | 653 | // If an override was found, use it, otherwise try the default text content |
| 654 | - if ( empty( $title ) && empty( $default_title ) ) { |
|
| 654 | + if (empty($title) && empty($default_title)) { |
|
| 655 | 655 | $title = get_the_title( $post->ID ); |
| 656 | 656 | } |
| 657 | 657 | |
@@ -690,20 +690,20 @@ discard block |
||
| 690 | 690 | function ppp_fb_generate_timestamps( $times, $post_id ) { |
| 691 | 691 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
| 692 | 692 | |
| 693 | - if ( empty( $fb_shares ) ) { |
|
| 693 | + if (empty($fb_shares)) { |
|
| 694 | 694 | $fb_shares = array(); |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - foreach ( $fb_shares as $key => $data ) { |
|
| 698 | - if ( ! array_filter( $data ) ) { |
|
| 697 | + foreach ($fb_shares as $key => $data) { |
|
| 698 | + if ( ! array_filter( $data )) { |
|
| 699 | 699 | continue; |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | $timestamp = ppp_generate_timestamp( $data['date'], $data['time'] ); |
| 703 | 703 | |
| 704 | - if ( $timestamp > current_time( 'timestamp', 1 ) ) { // Make sure the timestamp we're getting is in the future |
|
| 705 | - $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp , true ) ) . '_fb'; |
|
| 706 | - $times[ $time_key ] = 'sharedate_' . $key . '_' . $post_id . '_fb'; |
|
| 704 | + if ($timestamp > current_time( 'timestamp', 1 )) { // Make sure the timestamp we're getting is in the future |
|
| 705 | + $time_key = strtotime( date_i18n( 'd-m-Y H:i:s', $timestamp, true ) ).'_fb'; |
|
| 706 | + $times[$time_key] = 'sharedate_'.$key.'_'.$post_id.'_fb'; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | } |
@@ -753,20 +753,20 @@ discard block |
||
| 753 | 753 | */ |
| 754 | 754 | function ppp_fb_generate_share_content( $post_id, $name, $is_scheduled = true ) { |
| 755 | 755 | global $ppp_options; |
| 756 | - $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; |
|
| 756 | + $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; |
|
| 757 | 757 | $fb_shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
| 758 | 758 | |
| 759 | - if ( $is_scheduled && ! empty( $fb_shares ) ) { |
|
| 759 | + if ($is_scheduled && ! empty($fb_shares)) { |
|
| 760 | 760 | $name_array = explode( '_', $name ); |
| 761 | 761 | $index = $name_array[1]; |
| 762 | - $share_content = $fb_shares[ $index ]['text']; |
|
| 762 | + $share_content = $fb_shares[$index]['text']; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | // If an override was found, use it, otherwise try the default text content |
| 766 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : $default_text; |
|
| 766 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : $default_text; |
|
| 767 | 767 | |
| 768 | 768 | // If the content is still empty, just use the post title |
| 769 | - $share_content = ( isset( $share_content ) && !empty( $share_content ) ) ? $share_content : get_the_title( $post_id ); |
|
| 769 | + $share_content = (isset($share_content) && ! empty($share_content)) ? $share_content : get_the_title( $post_id ); |
|
| 770 | 770 | |
| 771 | 771 | return apply_filters( 'ppp_share_content_fb', $share_content, array( 'post_id' => $post_id ) ); |
| 772 | 772 | } |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | * @return bool Whether or not this tweet should contain a media post |
| 779 | 779 | */ |
| 780 | 780 | function ppp_fb_use_media( $post_id, $index ) { |
| 781 | - if ( empty( $post_id ) || empty( $index ) ) { |
|
| 781 | + if (empty($post_id) || empty($index)) { |
|
| 782 | 782 | return false; |
| 783 | 783 | } |
| 784 | 784 | |
@@ -794,9 +794,9 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | ppp_set_social_tokens(); |
| 796 | 796 | |
| 797 | - $account = isset( $_POST['account'] ) ? $_POST['account'] : false; |
|
| 797 | + $account = isset($_POST['account']) ? $_POST['account'] : false; |
|
| 798 | 798 | |
| 799 | - if ( !empty( $account ) ) { |
|
| 799 | + if ( ! empty($account)) { |
|
| 800 | 800 | $ppp_social_settings['facebook']->page = $account; |
| 801 | 801 | |
| 802 | 802 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
@@ -812,14 +812,14 @@ discard block |
||
| 812 | 812 | function ppp_fb_calendar_on_publish_event( $events, $post_id ) { |
| 813 | 813 | $share_on_publish = get_post_meta( $post_id, '_ppp_fb_share_on_publish', true ); |
| 814 | 814 | |
| 815 | - if ( ! empty( $share_on_publish ) ) { |
|
| 815 | + if ( ! empty($share_on_publish)) { |
|
| 816 | 816 | $share_text = get_post_meta( $post_id, '_ppp_fb_share_on_publish_title', true ); |
| 817 | 817 | $events[] = array( |
| 818 | - 'id' => $post_id . '-share-on-publish', |
|
| 819 | - 'title' => ( ! empty( $share_text ) ) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), |
|
| 820 | - 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 821 | - 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ) . ' ' . get_the_time( null, $post_id ) ) + 1 ), |
|
| 822 | - 'className' => 'ppp-calendar-item-fb cal-post-' . $post_id, |
|
| 818 | + 'id' => $post_id.'-share-on-publish', |
|
| 819 | + 'title' => ( ! empty($share_text)) ? $share_text : ppp_fb_generate_share_content( $post_id, null, false ), |
|
| 820 | + 'start' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 821 | + 'end' => date_i18n( 'Y-m-d/TH:i:s', strtotime( get_the_date( null, $post_id ).' '.get_the_time( null, $post_id ) ) + 1 ), |
|
| 822 | + 'className' => 'ppp-calendar-item-fb cal-post-'.$post_id, |
|
| 823 | 823 | 'belongsTo' => $post_id, |
| 824 | 824 | ); |
| 825 | 825 | } |
@@ -830,9 +830,9 @@ discard block |
||
| 830 | 830 | |
| 831 | 831 | function ppp_fb_get_post_shares( $items, $post_id ) { |
| 832 | 832 | $shares = get_post_meta( $post_id, '_ppp_fb_shares', true ); |
| 833 | - if ( empty( $shares ) ) { return $items; } |
|
| 833 | + if (empty($shares)) { return $items; } |
|
| 834 | 834 | |
| 835 | - foreach ( $shares as $key => $share ) { |
|
| 835 | + foreach ($shares as $key => $share) { |
|
| 836 | 836 | $items[] = array( 'id' => $key, 'service' => 'fb' ); |
| 837 | 837 | } |
| 838 | 838 | return $items; |