WordPress.org

Plugin Directory

Changeset 599366


Ignore:
Timestamp:
09/15/12 18:24:35 (20 months ago)
Author:
joedolson
Message:

Truncation bug fix, other minor changes

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

Legend:

Unmodified
Added
Removed
  • wp-to-twitter/trunk/js/jquery.charcount.js

    r573294 r599366  
    3434            var count = $(obj).val().length; 
    3535             
    36             var urlcount = $(obj).val().indexOf('#url#') > -1 ? 14 : 0; 
     36            var urlcount = $(obj).val().indexOf('#url#') > -1 ? 15 : 0; 
    3737            var titlecount = $(obj).val().indexOf('#title#') > -1 ? ($('#title').val().length-7) : 0; 
    3838            var namecount = $(obj).val().indexOf('#blog#') > -1 ? ($('#wp-admin-bar-site-name').val().length-6) : 0; 
  • wp-to-twitter/trunk/readme.txt

    r592691 r599366  
    44Tags: twitter, microblogging, su.pr, bitly, yourls, redirect, shortener, post, links 
    55Requires at least: 2.9.2 (partial) 
    6 Tested up to: 3.4.1 
     6Tested up to: 3.4.2 
    77License: GPLv2 or later 
    88Stable tag: trunk 
     
    6161== Changelog == 
    6262 
     63= 2.4.10 = 
     64 
     65* Bug fix: Error in truncation routine left tweets 2 characters too long when truncating. 
     66* Change: minor tweak to administrative UI. 
     67* Added: check of read-write status of application when posting. 
     68 
    6369= 2.4.9 = 
    6470 
  • wp-to-twitter/trunk/wp-to-twitter-manager.php

    r592691 r599366  
    197197    if ( isset( $_POST['submit-type'] ) && $_POST['submit-type'] == 'advanced' ) { 
    198198        update_option( 'jd_tweet_default', ( isset( $_POST['jd_tweet_default'] ) )?$_POST['jd_tweet_default']:0 ); 
    199         update_option( 'jd_tweet_default', ( isset( $_POST['jd_tweet_default'] ) )?$_POST['jd_tweet_default']:0 );       
     199        update_option( 'jd_tweet_defaultedit', ( isset( $_POST['jd_tweet_default_edit'] ) )?$_POST['jd_tweet_default_edit']:0 );         
    200200        update_option( 'wpt_inline_edits', ( isset( $_POST['wpt_inline_edits'] ) )?$_POST['wpt_inline_edits']:0 );       
    201201        update_option( 'jd_twit_remote',( isset( $_POST['jd_twit_remote'] ) )?$_POST['jd_twit_remote']:0 ); 
     
    465465    <div>    
    466466        <input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary button-side" />   
    467             <?php  
     467            <fieldset>   
     468            <legend><?php _e("Choose your short URL service (account settings below)",'wp-to-twitter' ); ?></legend> 
     469            <p> 
     470            <select name="jd_shortener" id="jd_shortener"> 
     471                <option value="3" <?php jd_checkSelect('jd_shortener','3'); ?>><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></option> 
     472                <option value="7" <?php jd_checkSelect('jd_shortener','7'); ?>><?php _e("Use Su.pr for my URL shortener.", 'wp-to-twitter'); ?></option>  
     473                <option value="2" <?php jd_checkSelect('jd_shortener','2'); ?>><?php _e("Use Bit.ly for my URL shortener.", 'wp-to-twitter'); ?></option> 
     474                <option value="8" <?php jd_checkSelect('jd_shortener','8'); ?>><?php _e("Use Goo.gl as a URL shortener.", 'wp-to-twitter'); ?></option>                  
     475                <option value="5" <?php jd_checkSelect('jd_shortener','5'); ?>><?php _e("YOURLS (installed on this server)", 'wp-to-twitter'); ?></option> 
     476                <option value="6" <?php jd_checkSelect('jd_shortener','6'); ?>><?php _e("YOURLS (installed on a remote server)", 'wp-to-twitter'); ?></option>       
     477                <option value="4" <?php jd_checkSelect('jd_shortener','4'); ?>><?php _e("Use WordPress as a URL shortener.", 'wp-to-twitter'); ?></option>  
     478                <?php if ( function_exists( 'twitter_link' ) ) { ?><option value="9" <?php jd_checkSelect('jd_shortener','9'); ?>><?php _e("Use Twitter Friendly Links.", 'wp-to-twitter'); ?></option><?php } ?> 
     479            </select> 
     480            </p> 
     481            </fieldset> 
     482        <?php  
    468483            $post_types = get_post_types( array('public'=>true), 'names' ); 
    469484            $wpt_settings = get_option('wpt_post_types'); 
     
    510525            </p> 
    511526            </fieldset> 
    512             <fieldset>   
    513             <legend><?php _e("Choose your short URL service (account settings below)",'wp-to-twitter' ); ?></legend> 
    514             <p> 
    515             <select name="jd_shortener" id="jd_shortener"> 
    516                 <option value="3" <?php jd_checkSelect('jd_shortener','3'); ?>><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></option> 
    517                 <option value="7" <?php jd_checkSelect('jd_shortener','7'); ?>><?php _e("Use Su.pr for my URL shortener.", 'wp-to-twitter'); ?></option>  
    518                 <option value="2" <?php jd_checkSelect('jd_shortener','2'); ?>><?php _e("Use Bit.ly for my URL shortener.", 'wp-to-twitter'); ?></option> 
    519                 <option value="8" <?php jd_checkSelect('jd_shortener','8'); ?>><?php _e("Use Goo.gl as a URL shortener.", 'wp-to-twitter'); ?></option>                  
    520                 <option value="5" <?php jd_checkSelect('jd_shortener','5'); ?>><?php _e("YOURLS (installed on this server)", 'wp-to-twitter'); ?></option> 
    521                 <option value="6" <?php jd_checkSelect('jd_shortener','6'); ?>><?php _e("YOURLS (installed on a remote server)", 'wp-to-twitter'); ?></option>       
    522                 <option value="4" <?php jd_checkSelect('jd_shortener','4'); ?>><?php _e("Use WordPress as a URL shortener.", 'wp-to-twitter'); ?></option>  
    523                 <?php if ( function_exists( 'twitter_link' ) ) { ?><option value="9" <?php jd_checkSelect('jd_shortener','9'); ?>><?php _e("Use Twitter Friendly Links.", 'wp-to-twitter'); ?></option><?php } ?> 
    524             </select> 
    525             </p> 
    526             </fieldset> 
     527 
    527528                <div> 
    528529        <input type="hidden" name="submit-type" value="options" /> 
     
    538539<h3><?php _e('<abbr title="Uniform Resource Locator">URL</abbr> Shortener Account Settings','wp-to-twitter'); ?></h3> 
    539540    <div class="inside"> 
     541        <?php if ( get_option('jd_shortener') == 7 ) { ?> 
    540542        <div class="panel"> 
    541543        <h4 class="supr"><span><?php _e("Your Su.pr account details", 'wp-to-twitter'); ?> <?php _e('(optional)','wp-to-twitter'); ?></span></h4> 
     
    558560    </form> 
    559561    </div> 
     562    <?php } else if ( get_option('jd_shortener') == 2 ) { ?> 
    560563    <div class="panel"> 
    561 <h4 class="bitly"><span><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></span></h4> 
    562     <form method="post" action=""> 
    563     <div> 
    564         <p> 
    565         <label for="bitlylogin"><?php _e("Your Bit.ly username:", 'wp-to-twitter'); ?></label> 
    566         <input type="text" name="bitlylogin" id="bitlylogin" value="<?php echo ( esc_attr( get_option( 'bitlylogin' ) ) ) ?>" /> 
    567         <br /><small><?php _e('This must be a standard Bit.ly account. Your Twitter or Facebook log-in will not work.','wp-to-twitter'); ?></small></p>  
    568         <p> 
    569         <label for="bitlyapi"><?php _e("Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter'); ?></label> 
    570         <input type="text" name="bitlyapi" id="bitlyapi" size="40" value="<?php echo ( esc_attr( get_option( 'bitlyapi' ) ) ) ?>" /> 
    571         </p> 
    572  
     564    <h4 class="bitly"><span><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></span></h4> 
     565        <form method="post" action=""> 
    573566        <div> 
    574         <input type="hidden" name="submit-type" value="bitlyapi" /> 
    575         </div> 
    576     <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false);  echo "<div>$nonce</div>"; ?>     
    577         <p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p> 
     567            <p> 
     568            <label for="bitlylogin"><?php _e("Your Bit.ly username:", 'wp-to-twitter'); ?></label> 
     569            <input type="text" name="bitlylogin" id="bitlylogin" value="<?php echo ( esc_attr( get_option( 'bitlylogin' ) ) ) ?>" /> 
     570            <br /><small><?php _e('This must be a standard Bit.ly account. Your Twitter or Facebook log-in will not work.','wp-to-twitter'); ?></small></p>  
     571            <p> 
     572            <label for="bitlyapi"><?php _e("Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter'); ?></label> 
     573            <input type="text" name="bitlyapi" id="bitlyapi" size="40" value="<?php echo ( esc_attr( get_option( 'bitlyapi' ) ) ) ?>" /> 
     574            </p> 
     575            <p><a href="http://bitly.com/a/your_api_key"><?php _e('View your Bit.ly username and API key','wp-to-twitter'); ?></a></p> 
     576            <div> 
     577            <input type="hidden" name="submit-type" value="bitlyapi" /> 
     578            </div> 
     579        <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false);  echo "<div>$nonce</div>"; ?>     
     580            <p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p> 
     581        </div> 
     582        </form>  
    578583    </div> 
    579     </form>  
    580 </div> 
    581 <div class="panel"> 
    582 <h4 class="yourls"><span><?php _e("Your YOURLS account details", 'wp-to-twitter'); ?></span></h4> 
    583     <form method="post" action=""> 
    584     <div> 
    585         <p> 
    586         <label for="yourlspath"><?php _e('Path to your YOURLS config file (Local installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php echo ( esc_attr( get_option( 'yourlspath' ) ) ); ?>"/> 
    587         <small><?php _e('Example:','wp-to-twitter'); ?> <code>/home/username/www/www/yourls/includes/config.php</code></small> 
    588         </p>                 
    589         <p> 
    590         <label for="yourlsurl"><?php _e('URI to the YOURLS API (Remote installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php echo ( esc_attr( get_option( 'yourlsurl' ) ) ); ?>"/> 
    591         <small><?php _e('Example:','wp-to-twitter'); ?> <code>http://domain.com/yourls-api.php</code></small> 
    592         </p> 
    593         <p> 
    594         <label for="yourlslogin"><?php _e("Your YOURLS username:", 'wp-to-twitter'); ?></label> 
    595         <input type="text" name="yourlslogin" id="yourlslogin" size="30" value="<?php echo ( esc_attr( get_option( 'yourlslogin' ) ) ) ?>" /> 
    596         </p>     
    597         <p> 
    598         <label for="yourlsapi"><?php _e("Your YOURLS password:", 'wp-to-twitter'); ?> <?php if ( get_option( 'yourlsapi' ) != '') { _e("<em>Saved</em>",'wp-to-twitter'); } ?></label> 
    599         <input type="password" name="yourlsapi" id="yourlsapi" size="30" value="" /> 
    600         </p> 
    601         <p> 
    602         <input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php jd_checkSelect( 'jd_keyword_format',1,'checkbox' ); ?> />       <label for="jd_keyword_id"><?php _e("Post ID for YOURLS url slug.",'wp-to-twitter'); ?></label><br /> 
    603         <input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php jd_checkSelect( 'jd_keyword_format',2,'checkbox' ); ?> />      <label for="jd_keyword"><?php _e("Custom keyword for YOURLS url slug.",'wp-to-twitter'); ?></label><br /> 
    604         <input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php jd_checkSelect( 'jd_keyword_format',0,'checkbox' ); ?> /> <label for="jd_keyword_default"><?php _e("Default: sequential URL numbering.",'wp-to-twitter'); ?></label> 
    605         </p> 
     584    <?php } else if ( get_option('jd_shortener') == 5 || get_option('jd_shortener') == 6 ) { ?> 
     585    <div class="panel"> 
     586    <h4 class="yourls"><span><?php _e("Your YOURLS account details", 'wp-to-twitter'); ?></span></h4> 
     587        <form method="post" action=""> 
    606588        <div> 
    607         <input type="hidden" name="submit-type" value="yourlsapi" /> 
    608         </div> 
    609     <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false);  echo "<div>$nonce</div>"; ?>     
    610         <p><input type="submit" name="submit" value="<?php _e('Save YOURLS Account Info','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear YOURLS password','wp-to-twitter'); ?>" /><br /><small><?php _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p> 
    611     </div> 
    612     </form>      
    613     </div> 
    614      
    615 </div> 
     589            <p> 
     590            <label for="yourlspath"><?php _e('Path to your YOURLS config file (Local installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php echo ( esc_attr( get_option( 'yourlspath' ) ) ); ?>"/> 
     591            <small><?php _e('Example:','wp-to-twitter'); ?> <code>/home/username/www/www/yourls/includes/config.php</code></small> 
     592            </p>                 
     593            <p> 
     594            <label for="yourlsurl"><?php _e('URI to the YOURLS API (Remote installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php echo ( esc_attr( get_option( 'yourlsurl' ) ) ); ?>"/> 
     595            <small><?php _e('Example:','wp-to-twitter'); ?> <code>http://domain.com/yourls-api.php</code></small> 
     596            </p> 
     597            <p> 
     598            <label for="yourlslogin"><?php _e("Your YOURLS username:", 'wp-to-twitter'); ?></label> 
     599            <input type="text" name="yourlslogin" id="yourlslogin" size="30" value="<?php echo ( esc_attr( get_option( 'yourlslogin' ) ) ) ?>" /> 
     600            </p>     
     601            <p> 
     602            <label for="yourlsapi"><?php _e("Your YOURLS password:", 'wp-to-twitter'); ?> <?php if ( get_option( 'yourlsapi' ) != '') { _e("<em>Saved</em>",'wp-to-twitter'); } ?></label> 
     603            <input type="password" name="yourlsapi" id="yourlsapi" size="30" value="" /> 
     604            </p> 
     605            <p> 
     606            <input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php jd_checkSelect( 'jd_keyword_format',1,'checkbox' ); ?> />       <label for="jd_keyword_id"><?php _e("Post ID for YOURLS url slug.",'wp-to-twitter'); ?></label><br /> 
     607            <input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php jd_checkSelect( 'jd_keyword_format',2,'checkbox' ); ?> />      <label for="jd_keyword"><?php _e("Custom keyword for YOURLS url slug.",'wp-to-twitter'); ?></label><br /> 
     608            <input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php jd_checkSelect( 'jd_keyword_format',0,'checkbox' ); ?> /> <label for="jd_keyword_default"><?php _e("Default: sequential URL numbering.",'wp-to-twitter'); ?></label> 
     609            </p> 
     610            <div> 
     611            <input type="hidden" name="submit-type" value="yourlsapi" /> 
     612            </div> 
     613        <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false);  echo "<div>$nonce</div>"; ?>     
     614            <p><input type="submit" name="submit" value="<?php _e('Save YOURLS Account Info','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear YOURLS password','wp-to-twitter'); ?>" /><br /><small><?php _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p> 
     615        </div> 
     616        </form>      
     617        </div> 
     618    <?php } else { ?> 
     619    <?php _e('Your shortener does not require any account settings.','wp-to-twitter'); ?> 
     620    <?php } ?> 
     621        </div> 
    616622</div> 
    617623</div> 
  • wp-to-twitter/trunk/wp-to-twitter-oauth.php

    r582467 r599366  
    3737    } 
    3838} 
    39  
    4039// convert credentials to md5 hash 
    4140function wtt_oauth_credentials_to_hash( $auth=false ) { 
  • wp-to-twitter/trunk/wp-to-twitter.php

    r592691 r599366  
    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 chosen URL shortening service. Rich in features for customizing and promoting your Tweets. 
    6 Version: 2.4.9 
     6Version: 2.4.10 
    77Author: Joseph Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    5858 
    5959global $wpt_version,$jd_plugin_url,$jdwp_api_post_status; 
    60 $wpt_version = "2.4.9"; 
     60$wpt_version = "2.4.10"; 
    6161$plugin_dir = basename(dirname(__FILE__)); 
    6262load_plugin_textdomain( 'wp-to-twitter', false, dirname( plugin_basename( __FILE__ ) ) ); 
     
    270270        } else if ( wtt_oauth_test( false ) && ( $connection = wtt_oauth_connection( false ) ) ) { 
    271271            $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter' ) ); 
    272             $http_code = ($connection)?$connection->http_code:'failed';      
     272            $http_code = ($connection)?$connection->http_code:'failed';  
    273273        } 
    274274        if ( $connection ) { 
     275            if ( $connection->http_header['x-access-level'] != 'read-write' ) { $supplement = __('Your Twitter application does not have read and write permissions. Go to <a href="%s">your Twitter apps</a> to modify these settings.','wp-to-twitter'); } else { $supplement = ''; } 
    275276            switch ($http_code) { 
    276277                case '200': 
     
    309310                    break; 
    310311            } 
     312            $error .= ($supplement != '')?" $supplement":''; 
    311313            // debugging 
    312314            //wp_mail('joe@joedolson.com','Response code',"$http_code $error" ); 
     
    435437            $preferred = $length_array; 
    436438        } 
    437         $diff = $url_strlen - 19; 
     439        $diff = $url_strlen - 20; 
    438440        if ( $str_length > ( 140 + $diff ) ) { 
    439441            foreach($preferred AS $key=>$value) { 
     
    474476        // 1) removes URL 2) checks length of remainder 3) Replaces URL 
    475477        $temp_sentence = str_ireplace( $thisposturl, '#url#', $post_sentence ); 
    476         if ( mb_strlen( fake_normalize( $temp_sentence ) ) > 127 ) {  
    477             $post_sentence = trim(mb_substr( $temp_sentence,0,127,$encoding )); 
     478        if ( mb_strlen( fake_normalize( $temp_sentence ) ) > 125 ) {  
     479            $post_sentence = trim(mb_substr( $temp_sentence,0,125,$encoding )); 
    478480            $post_sentence = ( strpos($post_sentence,'#url#') === false )?$post_sentence .' '. $thisposturl:str_ireplace( '#url#',$thisposturl,$post_sentence ); 
    479481        } 
Note: See TracChangeset for help on using the changeset viewer.