WordPress.org

Plugin Directory

Changeset 635078


Ignore:
Timestamp:
12/06/12 20:43:10 (17 months ago)
Author:
joedolson
Message:

2.5.1 - bug fix

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

Legend:

Unmodified
Added
Removed
  • wp-to-twitter/trunk/functions.php

    r630944 r635078  
    249249    // server 
    250250    $php_version = phpversion(); 
    251      
    252     $curl_init = ( function_exists('curl_init') )?'yes':'no'; 
    253     $curl_exec = ( function_exists('curl_exec') )?'yes':'no'; 
    254      
     251 
    255252    // theme data 
    256253    if ( function_exists( 'wp_get_theme' ) ) { 
     
    284281==WP to Twitter== 
    285282Version: $version 
    286 Twitter username: $wtt_twitter_username 
     283Twitter username: http://twitter.com/$wtt_twitter_username 
    287284$license 
    288285 
     
    298295Server Software: $_SERVER[SERVER_SOFTWARE] 
    299296User Agent: $_SERVER[HTTP_USER_AGENT] 
    300 cURL Init: $curl_init 
    301 cURL Exec: $curl_exec 
    302297 
    303298==Theme:== 
  • wp-to-twitter/trunk/readme.txt

    r630944 r635078  
    3737Translations: 
    3838 
    39 Languages available: [visit the WP to Twitter translations page to see how complete these are](http://translate.joedolson.com/projects/wp-to-twitter). 
    40  
    41  
    42 * French: Francois-Xavier Benard 
    43 * Italian: Updated by [Gianni Diurno](http://www.gidibao.net) and [Aurelio De Rosa](http://www.audero.it) 
    44 * Dutch: [Rashid Niamat](http://niamatmediagroup.nl/) 
    45 * Brazilian Portugese: [Miriam de Paula](http://wpmidia.com.br) 
    46 * Lithuanian [Nata Strazda](http://www.designcontest.com) 
    47 * Simplified Chinese: [HostUCan](http://www.hostucan.com) 
    48 * Traditional Chinese: [HostUCan](http://www.hostucan.com) 
    49 * Belarussian: [Alex Alexandrov](http://www.webhostingrating.com) 
    50 * Ukrainian: [Alyona Lompar](http://www.webhostinggeeks.com 
    51 * Spanish: [David Gil Pérez](http://www.sohelet.com) 
    52 * Russian: [Burkov Boris](http://chernobog.ru) 
    53 * Estonian: [Raivo Ratsep](http://raivoratsep.com) 
    54 * Romanian: [Jibo](http://jibo.ro) 
    55 * Danish: [Rasmus Himmelstrup](http://seoanalyst.dk) 
    56 * Japanese: [kndb](http://blog.layer8.sh/) 
     39Visit the [WP to Twitter translations page](http://translate.joedolson.com/projects/wp-to-twitter) to see how complete these are. 
     40 
     41Languages available (in order of completeness): 
     42French, Italian, Dutch, Chinese, Portuguese, Japanese, Romanian, Danish, Estonian, Russian, Lithuanian, Belarusian, Ukrainian, German, Irish, Spanish, Turkish, Persian 
     43 
     44Translator Credits (in no particular order)*: 
     45[Ale Gonzalez](http://60rpm.tv/i), [Outshine Solutions](http://outshinesolutions.com), [Jakob Smith](http://www.omkalfatring.dk/),, [globus2008](http://wordpress.org/support/profile/globus2008), Frederic Escallier, Luud Heck, Wim Strijbos, [Daisuke Abe](http://www.alter-ego.jp/), [Alex](http://blog.sotvoril.ru/), Mehmet Koçali, Uwe Jonas, Florian Edelmann, Efva Nyberg, [Sabir Musta](http://mustaphasabir.altervista.org), Massimo Sgobino, Leonardo Kfoury, Alexandre Carvalho, Amir Khalilnejad, [Aurelio De Rosa](http://www.audero.it/), Bayram Dede, Dani Locasati, Dario Nunez, Dirk Ginader, Evren Erten, Flávio Pereira, Francois-Xavier Benard, [Gianni Diurno](http://www.gidibao.net), Giksi, Heinz Ochsner,  Kazuyuki Kumai, Liam Boogar, Maks, Mano, Massimo Sgobino, Mohsen Aghaei, Oscar, [Rashid Niamat](http://niamatmediagroup.nl/), Stefan Wikstrom, Thomas Meyer, Vedar Ozdemir, [Vikas Arora](http://www.wiznicworld.com), [Miriam de Paula](http://wpmidia.com.br), [Miriam de Paula](http://wpmidia.com.br), [HostUCan](http://www.hostucan.com), [Alex Alexandrov](http://www.webhostingrating.com), [Alyona Lompar](http://www.webhostinggeeks.com), [David Gil Pérez](http://www.sohelet.com), [Burkov Boris](http://chernobog.ru), [Raivo Ratsep](http://raivoratsep.com), [Jibo](http://jibo.ro), [Rasmus Himmelstrup](http://seoanalyst.dk), [kndb](http://blog.layer8.sh/) 
    5746 
    5847Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape! 
     
    6352 
    6453== Changelog == 
     54 
     55= 2.5.1 = 
     56 
     57* Removed hardcoding of /wp-content/ 
     58* Fixed truncation bug causing Tweets to be truncated when unnecessary. 
     59* Improved error messages. 
    6560 
    6661= 2.5.0 = 
     
    747742== Upgrade Notice == 
    748743 
    749 * 2.4.8 Broken #account# template tag. 
     744* 2.5.1 Should fix problem with some unnecessary truncation of Tweets. 
  • wp-to-twitter/trunk/wp-to-twitter-manager.php

    r630944 r635078  
    176176            print(' 
    177177                <div id="message" class="updated fade"> 
    178                     <p>'.__('WP to Twitter failed to connect with Twitter. Try enabling OAuth debugging.', 'wp-to-twitter').'</p> 
     178                    <p>'.__('WP to Twitter failed to connect with Twitter. Try <a href="#wpt_http">switching to an HTTP connection</a>.', 'wp-to-twitter').'</p> 
    179179                </div> 
    180180 
  • wp-to-twitter/trunk/wp-to-twitter-oauth.php

    r630944 r635078  
    2929} 
    3030    if ( !empty( $ack ) && !empty( $acs ) && !empty( $ot ) && !empty( $ots ) ) {     
    31         require_once( WP_PLUGIN_DIR . '/wp-to-twitter/jd_twitterOAuth.php' ); 
     31        require_once( plugin_dir_path(__FILE__).'/jd_twitterOAuth.php' ); 
    3232        $connection = new jd_TwitterOAuth( $ack,$acs,$ot,$ots ); 
    3333        $connection->useragent = 'WP to Twitter http://www.joedolson.com/articles/wp-to-twitter'; 
  • wp-to-twitter/trunk/wp-to-twitter.php

    r630944 r635078  
    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.5.0 
     6Version: 2.5.1 
    77Author: Joseph Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    3434    $wp_content_url = get_option( 'siteurl' ); 
    3535} 
    36 $wp_content_url .= '/wp-content'; 
    37 $wp_content_dir = ABSPATH . 'wp-content'; 
     36 
     37$wp_content_url = content_url(); 
     38$wp_content_dir = str_replace( '/plugins/wp-to-twitter','',plugin_dir_path( __FILE__ ) ); 
    3839 
    3940if ( defined('WP_CONTENT_URL') ) { 
     
    4647define( 'WPT_DEBUG',false ); 
    4748 
    48 $wp_plugin_url = $wp_content_url . '/plugins'; 
    49 $wp_plugin_dir = $wp_content_dir . '/plugins'; 
    50 $wpmu_plugin_url = $wp_content_url . '/mu-plugins'; 
    51 $wpmu_plugin_dir = $wp_content_dir . '/mu-plugins'; 
     49$wp_plugin_url = plugins_url(); 
    5250include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // required in order to access is_plugin_active() 
    5351 
     
    5654    add_action('admin_notices', create_function( '', "echo \"<div class='error'><p>$warning</p></div>\";" ) ); 
    5755} else { 
    58     require_once( $wp_plugin_dir . '/wp-to-twitter/wp-to-twitter-oauth.php' ); 
    59 } 
    60 require_once( $wp_plugin_dir . '/wp-to-twitter/wp-to-twitter-manager.php' ); 
    61 require_once( $wp_plugin_dir . '/wp-to-twitter/functions.php' ); 
     56    require_once( plugin_dir_path(__FILE__).'/wp-to-twitter-oauth.php' ); 
     57} 
     58require_once( plugin_dir_path(__FILE__).'/wp-to-twitter-manager.php' ); 
     59require_once( plugin_dir_path(__FILE__).'/functions.php' ); 
    6260 
    6361global $wpt_version,$jd_plugin_url; 
     
    460458    $post_sentence = str_ireplace( '#tags#', $tags, $post_sentence ); 
    461459    $post_sentence = str_ireplace( '#modified#', $modified, $post_sentence ); 
    462  
    463460    $url_strlen = mb_strlen( urldecode( fake_normalize( $thisposturl ) ), $encoding ); 
    464461    // check total length  
    465462    $str_length = mb_strlen( urldecode( fake_normalize( $post_sentence ) ), $encoding ); 
    466463    if ( $str_length < 140 ) { 
    467         if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = mb_substr( $post_sentence,0,139,$encoding ); }    
     464        if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = mb_substr( $post_sentence,0,140,$encoding ); } 
    468465    } else { 
    469466        // what is the excerpt supposed to be? 
     
    497494            $preferred = $length_array; 
    498495        } 
    499         $diff = $url_strlen - 20; 
     496        $diff = ( ($url_strlen - 20) > 0 )?$url_strlen-20:0; 
    500497        if ( $str_length > ( 140 + $diff ) ) { 
    501498            foreach($preferred AS $key=>$value) { 
     
    511508                        $new_value = ''; 
    512509                    } else if ( $key == 'tags' ) { 
    513                         // replaced, keeps the tags as such intact. 
    514510                        // remove any stray hash characters due to string truncation 
    515511                        // $new_value = str_replace( ' # ','',' '.mb_substr( $old_value,0,-( $trim ),$encoding ).' ');                        
     
    529525                    $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );                      
    530526                } else { 
    531                     if ( mb_strlen( fake_normalize ( $post_sentence ),$encoding ) > ( 140 + $diff ) ) { $post_sentence = mb_substr( $post_sentence,0,( 139 + $diff ),$encoding ); } 
     527                    if ( mb_strlen( fake_normalize ( $post_sentence ),$encoding ) > ( 140 + $diff ) ) { $post_sentence = mb_substr( $post_sentence,0,( 140 + $diff ),$encoding ); } 
    532528                } 
    533529            } 
     
    535531        // this is needed in case a tweet needs to be truncated outright and the truncation values aren't in the above. 
    536532        // 1) removes URL 2) checks length of remainder 3) Replaces URL 
    537         $temp_sentence = str_ireplace( $thisposturl, '#url#', $post_sentence ); 
    538         if ( mb_strlen( fake_normalize( $temp_sentence ) ) > 120 && $temp_sentence != $post_sentence ) {  
    539             $post_sentence = trim(mb_substr( $temp_sentence,0,120,$encoding )); 
    540             // it's possible to trim off the #url# part in this process. If that happens, put it back. 
    541             $sub_sentence = (strpos($sentence, '#url#')===false )?$post_sentence:$post_sentence .' '. $thisposturl; 
    542             $post_sentence = ( strpos($post_sentence,'#url#') === false )?$sub_sentence:str_ireplace( '#url#',$thisposturl,$post_sentence ); 
     533        if ( mb_strlen( fake_normalize( $post_sentence ) ) > 140 ) { 
     534            $temp_sentence = str_ireplace( $thisposturl, '#url#', $post_sentence ); 
     535            if ( mb_strlen( fake_normalize( $temp_sentence ) ) > 120 && $temp_sentence != $post_sentence ) {  
     536                $post_sentence = trim(mb_substr( $temp_sentence,0,120,$encoding )); 
     537                // it's possible to trim off the #url# part in this process. If that happens, put it back. 
     538                $sub_sentence = (strpos($sentence, '#url#')===false )?$post_sentence:$post_sentence .' '. $thisposturl; 
     539                $post_sentence = ( strpos($post_sentence,'#url#') === false )?$sub_sentence:str_ireplace( '#url#',$thisposturl,$post_sentence ); 
     540            } 
    543541        } 
    544542    } 
     
    16641662add_action( 'admin_head', 'jd_addTwitterAdminStyles' ); 
    16651663function jd_addTwitterAdminStyles() { 
    1666 global $wp_plugin_url, $wp_plugin_dir; 
    16671664    if ( isset($_GET['page']) && ( 1==1 || $_GET['page'] == "wp-to-twitter" || $_GET['page'] == "wp-to-twitter/wp-to-twitter.php" || $_GET['page'] == "wp-tweets-pro" || $_GET['page'] == "wp-to-twitter-schedule" || $_GET['page'] == "wp-to-twitter-tweets" || $_GET['page'] == "wp-to-twitter-errors" ) ) { 
    16681665        echo '<link type="text/css" rel="stylesheet" href="'.plugins_url('/wp-to-twitter/styles.css').'" />'; 
Note: See TracChangeset for help on using the changeset viewer.