WordPress.org

Plugin Directory

Changeset 726699


Ignore:
Timestamp:
06/14/13 15:36:45 (10 months ago)
Author:
joedolson
Message:

Update 2.6.8; tmhoauth bug fix, expose past Tweets on edited posts.

Location:
wp-to-twitter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-to-twitter/trunk/readme.txt

    r725083 r726699  
    5151 
    5252== Changelog == 
     53 
     54= 2.6.8 = 
     55 
     56* Filter post_with_media to only handle posts with attached media. (WP Tweets PRO) 
     57* Expose past and failed Tweets on edited posts when Tweeting edits disabled. 
    5358 
    5459= 2.6.7 = 
  • wp-to-twitter/trunk/wp-to-twitter.php

    r725083 r726699  
    44Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/ 
    55Description: Posts a Tweet when you update your WordPress blog or post to your blogroll, using your URL shortening service. Rich in features for customizing and promoting your Tweets. 
    6 Version: 2.6.7 
     6Version: 2.6.8 
    77Author: Joseph Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    5252 
    5353global $wpt_version,$jd_plugin_url; 
    54 $wpt_version = "2.6.7"; 
     54$wpt_version = "2.6.8"; 
    5555$plugin_dir = basename(dirname(__FILE__)); 
    5656load_plugin_textdomain( 'wp-to-twitter', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); 
     
    5858function wpt_pro_compatibility() { 
    5959    global $wptp_version; 
    60     $current_wptp_version = '1.5.0'; 
     60    $current_wptp_version = '1.5.1'; 
    6161    if ( version_compare( $wptp_version, $current_wptp_version, '<' ) ) { 
    6262        echo "<div class='error notice'><p class='upgrade'>".sprintf( __('The current version of WP Tweets PRO is <strong>%s</strong>. <a href="http://www.joedolson.com/articles/account/">Upgrade for best compatibility!</a>','wp-to-twitter'),$current_wptp_version )."</p></div>"; 
     
    689689} 
    690690 
     691function wpt_post_with_media( $post_ID ) { 
     692    return true; 
     693    if ( !function_exists( 'wpt_pro_exists' ) || get_option( 'wpt_media') != '1' ) {  
     694        return false;  
     695    } else { 
     696        if ( has_post_thumbnail( $post_ID ) || wpt_post_attachment( $post_ID ) ) { 
     697            return true; 
     698        } 
     699    } 
     700    return false;  
     701} 
     702 
    691703function jd_twit( $post_ID, $type='instant' ) { 
    692704    if ( WPT_DEBUG && function_exists( 'wpt_pro_exists' ) ) { 
     
    713725    if ( $test ) { // test switch: depend on default settings. 
    714726        $post_info = jd_post_info( $post_ID ); 
    715         $media = ( get_option( 'wpt_media' ) == '1' && function_exists( 'wpt_pro_exists' ) )?true:false; 
     727        $media = wpt_post_with_media( $post_ID ); 
    716728        if ( function_exists( 'wpt_pro_exists' ) && wpt_pro_exists() == true ) { 
    717729            $auth = ( get_option( 'wpt_cotweet_lock' ) == 'false' || !get_option('wpt_cotweet_lock') )?$post_info['authId']:get_option('wpt_cotweet_lock'); 
     
    987999            $post_id = $post->ID; 
    9881000        } 
     1001        $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true ); 
     1002        $failed_tweets = get_post_meta( $post_id, '_wpt_failed' ); 
    9891003        if ( $status == 'publish' && $wpt_settings[$type]['post-edited-update'] != 1 ) { 
    9901004            printf(__('Tweeting %s edits is disabled.','wp-to-twitter'), $type ); 
     1005            wpt_show_tweets( $previous_tweets, $failed_tweets ); 
    9911006        } else { 
    9921007            $jd_twitter = esc_attr( stripcslashes( get_post_meta($post_id, '_jd_twitter', true ) ) ); 
     
    9981013            } 
    9991014            if ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && get_option( 'jd_tweet_default_edit' ) == '1' ) { $jd_tweet_this = 'no'; } 
    1000             $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true ); 
    1001             $failed_tweets = get_post_meta( $post_id, '_wpt_failed' ); 
    10021015            ?> 
    10031016        <?php if ( current_user_can('update_core') && function_exists( 'wpt_pro_exists' ) ) { wpt_pro_compatibility(); } ?> 
     
    10691082        <?php _e("Tweets are no more than 140 characters; Twitter counts URLs as 20 or 21 characters. Template tags: <code>#url#</code>, <code>#title#</code>, <code>#post#</code>, <code>#category#</code>, <code>#date#</code>, <code>#modified#</code>, <code>#author#</code>, <code>#account#</code>, <code>#tags#</code>, or <code>#blog#</code>.", 'wp-to-twitter') ?>  
    10701083        </p> 
    1071         <?php } ?> 
    1072         <?php if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } ?> 
    1073         <?php if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) { ?> 
    1074         <hr> 
    1075         <p class='error'><em><?php _e('Previous Tweets','wp-to-twitter'); ?>:</em></p> 
    1076         <ul> 
    1077         <?php 
    1078         $hidden_fields = ''; 
    1079             if ( is_array( $previous_tweets ) ) { 
    1080                 foreach ( $previous_tweets as $previous_tweet ) { 
    1081                     if ( $previous_tweet != '' ) { 
    1082                         $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />"; 
    1083                         echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=".urlencode($previous_tweet)."'>Retweet this</a></li>"; 
    1084                     } 
    1085                 } 
    1086             } 
    1087         ?> 
    1088         </ul> 
    1089         <p class='error'><em><?php _e('Failed Tweets','wp-to-twitter'); ?>:</em></p> 
    1090         <ul> 
    1091         <?php 
    1092             $list = false; 
    1093             if ( is_array( $failed_tweets ) ) { 
    1094                 foreach ( $failed_tweets as $failed_tweet ) { 
    1095                     if ( !empty($failed_tweet) ) { 
    1096                         $ft = $failed_tweet['sentence']; 
    1097                         $reason = $failed_tweet['code']; 
    1098                         $error = $failed_tweet['error']; 
    1099                         $list = true; 
    1100                         echo "<li> <code>Error: $reason</code> $ft <a href='http://twitter.com/intent/tweet?text=".urlencode($ft)."'>Tweet this</a><br /><em>$error</em></li>"; 
    1101                     } 
    1102                 } 
    1103             } 
    1104             if ( !$list ) { echo "<li>".__('No failed tweets on this post.','wp-to-twitter')."</li>"; } 
    1105         ?> 
    1106         </ul> 
    1107         <?php echo "<div>".$hidden_fields."</div>"; } ?>     
     1084        <?php } 
     1085        wpt_show_tweets( $previous_tweets, $failed_tweets ); ?>  
    11081086        <p> 
    11091087        <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?> 
     
    11191097    } 
    11201098}  
     1099 
     1100function wpt_show_tweets( $previous_tweets, $failed_tweets ) { 
     1101    if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } 
     1102    if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) { ?> 
     1103    <hr> 
     1104    <p class='error'><em><?php _e('Previous Tweets','wp-to-twitter'); ?>:</em></p> 
     1105    <ul> 
     1106    <?php 
     1107    $hidden_fields = ''; 
     1108        if ( is_array( $previous_tweets ) ) { 
     1109            foreach ( $previous_tweets as $previous_tweet ) { 
     1110                if ( $previous_tweet != '' ) { 
     1111                    $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />"; 
     1112                    echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=".urlencode($previous_tweet)."'>Retweet this</a></li>"; 
     1113                } 
     1114            } 
     1115        } 
     1116    ?> 
     1117    </ul> 
     1118    <p class='error'><em><?php _e('Failed Tweets','wp-to-twitter'); ?>:</em></p> 
     1119    <ul> 
     1120    <?php 
     1121        $list = false; 
     1122        if ( is_array( $failed_tweets ) ) { 
     1123            foreach ( $failed_tweets as $failed_tweet ) { 
     1124                if ( !empty($failed_tweet) ) { 
     1125                    $ft = $failed_tweet['sentence']; 
     1126                    $reason = $failed_tweet['code']; 
     1127                    $error = $failed_tweet['error']; 
     1128                    $list = true; 
     1129                    echo "<li> <code>Error: $reason</code> $ft <a href='http://twitter.com/intent/tweet?text=".urlencode($ft)."'>Tweet this</a><br /><em>$error</em></li>"; 
     1130                } 
     1131            } 
     1132        } 
     1133        if ( !$list ) { echo "<li>".__('No failed tweets on this post.','wp-to-twitter')."</li>"; } 
     1134    ?> 
     1135    </ul> 
     1136    <?php 
     1137    echo "<div>".$hidden_fields."</div>"; 
     1138    } 
     1139} 
    11211140 
    11221141function wpt_admin_scripts( $hook ) { 
Note: See TracChangeset for help on using the changeset viewer.