@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @since 2.2.3 |
| 18 | 18 | */ |
| 19 | 19 | public static function init() { |
| 20 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
| 20 | + if ( ! current_user_can( 'manage_options' )) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -38,34 +38,34 @@ discard block |
||
| 38 | 38 | $number = self::get_count(); |
| 39 | 39 | $shares = ppp_get_shceduled_crons(); |
| 40 | 40 | |
| 41 | - if ( ! empty( $shares ) ) { |
|
| 41 | + if ( ! empty($shares)) { |
|
| 42 | 42 | $limited_shares = array_slice( $shares, 0, $number, true ); |
| 43 | 43 | ?> |
| 44 | 44 | <div id="future-tweets" class="activity-block"> |
| 45 | 45 | <h4><?php _e( 'Post-Related Tweets', 'ppp-tweets' ); ?></h4> |
| 46 | 46 | <ul> |
| 47 | 47 | <?php |
| 48 | - foreach ( $limited_shares as $key => $share ) { |
|
| 48 | + foreach ($limited_shares as $key => $share) { |
|
| 49 | 49 | $ppp_data = $share; |
| 50 | 50 | $timestamp = $ppp_data['timestamp']; |
| 51 | 51 | |
| 52 | 52 | $name_parts = explode( '_', $ppp_data['args'][1] ); |
| 53 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; |
|
| 54 | - $builder = 'ppp_' . $service . '_build_share_message'; |
|
| 53 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; |
|
| 54 | + $builder = 'ppp_'.$service.'_build_share_message'; |
|
| 55 | 55 | |
| 56 | 56 | $post_id = $ppp_data['args'][0]; |
| 57 | - $date = $timestamp + ( get_option( 'gmt_offset' ) * 3600 ); |
|
| 57 | + $date = $timestamp + (get_option( 'gmt_offset' ) * 3600); |
|
| 58 | 58 | $content = ''; |
| 59 | - if ( function_exists( $builder ) ) { |
|
| 60 | - $content = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false ); |
|
| 59 | + if (function_exists( $builder )) { |
|
| 60 | + $content = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $regex = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@"; |
| 64 | 64 | $content = preg_replace( $regex, '', $content ); |
| 65 | 65 | ?> |
| 66 | 66 | <li> |
| 67 | - <span class="meta"><?php echo date_i18n( 'M jS, ' . get_option( 'time_format' ), $date ); ?></span> |
|
| 68 | - <a href="<?php echo admin_url( 'post.php?post=' . $post_id . '&action=edit' ); ?>"><?php echo $content; ?></a> |
|
| 67 | + <span class="meta"><?php echo date_i18n( 'M jS, '.get_option( 'time_format' ), $date ); ?></span> |
|
| 68 | + <a href="<?php echo admin_url( 'post.php?post='.$post_id.'&action=edit' ); ?>"><?php echo $content; ?></a> |
|
| 69 | 69 | </li> |
| 70 | 70 | <?php } ?> |
| 71 | 71 | </ul> |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | $recent_post = $recent_posts[0]; |
| 88 | 88 | $post_type = get_post_type_object( $recent_post['post_type'] ); |
| 89 | 89 | $post_type_name = $post_type->labels->singular_name; |
| 90 | - $edit_url = admin_url( 'post.php?post=' . $recent_post['ID'] . '&action=edit' ); |
|
| 90 | + $edit_url = admin_url( 'post.php?post='.$recent_post['ID'].'&action=edit' ); |
|
| 91 | 91 | |
| 92 | - switch( $recent_post['post_status'] ) { |
|
| 92 | + switch ($recent_post['post_status']) { |
|
| 93 | 93 | case 'draft': |
| 94 | - $relative_time = __( '<a href="%s">Configure them</a> for your draft ' . $post_type_name, 'ppp-txt' ); |
|
| 94 | + $relative_time = __( '<a href="%s">Configure them</a> for your draft '.$post_type_name, 'ppp-txt' ); |
|
| 95 | 95 | break; |
| 96 | 96 | case 'future': |
| 97 | - $relative_time = __( '<a href="%s">Schedule one</a> for your upcoming ' . $post_type_name, 'ppp-txt' ); |
|
| 97 | + $relative_time = __( '<a href="%s">Schedule one</a> for your upcoming '.$post_type_name, 'ppp-txt' ); |
|
| 98 | 98 | break; |
| 99 | 99 | case 'publish': |
| 100 | 100 | default: |
| 101 | - $relative_time = __( '<a href="%s">Schedule one</a> for your most recent ' . $post_type_name, 'ppp-txt' ); |
|
| 101 | + $relative_time = __( '<a href="%s">Schedule one</a> for your most recent '.$post_type_name, 'ppp-txt' ); |
|
| 102 | 102 | break; |
| 103 | 103 | |
| 104 | 104 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @since 2.2.3 |
| 120 | 120 | */ |
| 121 | 121 | public static function config() { |
| 122 | - if ( ! empty( $_POST['number_of_tweets'] ) ) { |
|
| 122 | + if ( ! empty($_POST['number_of_tweets'])) { |
|
| 123 | 123 | update_option( 'ppp_dashboard_twitter_count', absint( $_POST['number_of_tweets'] ) ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | private static function get_count() { |
| 140 | 140 | $stored_count = get_option( 'ppp_dashboard_twitter_count' ); |
| 141 | 141 | |
| 142 | - $stored_count = empty( $stored_count ) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count ); |
|
| 142 | + $stored_count = empty($stored_count) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count ); |
|
| 143 | 143 | |
| 144 | - return ! empty( $stored_count ) ? $stored_count : 5; |
|
| 144 | + return ! empty($stored_count) ? $stored_count : 5; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | } |
| 148 | -add_action('wp_dashboard_setup', array('PPP_Dashboard_Tweets','init') ); |
|
| 148 | +add_action( 'wp_dashboard_setup', array( 'PPP_Dashboard_Tweets', 'init' ) ); |
|