WordPress.org

Plugin Directory

Changeset 718938


Ignore:
Timestamp:
05/27/13 16:00:14 (11 months ago)
Author:
joedolson
Message:

Bug fixes, removal of comment tweeting. Italian update.

Location:
wp-to-twitter/trunk
Files:
8 added
11 edited

Legend:

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

    r546609 r718938  
    11<?php 
    22// vim: foldmethod=marker 
     3if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    34 
    45if (!class_exists('WPOAuthException')) { 
  • wp-to-twitter/trunk/lang/wp-to-twitter-it_IT.po

    r705719 r718938  
    33msgid "" 
    44msgstr "" 
    5 "PO-Revision-Date: 2013-04-30 01:38:13+0000\n" 
     5"PO-Revision-Date: 2013-05-27 15:51:47+0000\n" 
    66"MIME-Version: 1.0\n" 
    77"Content-Type: text/plain; charset=UTF-8\n" 
     
    2525#: wp-to-twitter-shorteners.php:381 
    2626msgid "Parameters to add to the long URL (before shortening):" 
    27 msgstr "Parametri da aggiungere all'URL lungo (prima di abbreviarlo):" 
     27msgstr "Parametri da aggiungere alla URL lunga (prima di accorciarla):" 
    2828 
    2929#: wp-to-twitter-shorteners.php:381 
    3030msgid "Parameters to add to the short URL (after shortening):" 
    31 msgstr "Parametri da aggiungere all'URL breve (dopo averlo abbreviato):" 
     31msgstr "Parametri da aggiungere alla URL breve (dopo averla accorciata):" 
    3232 
    3333#: wp-to-twitter-shorteners.php:382 
     
    4545#: wp-to-twitter-shorteners.php:386 
    4646msgid "A jotURL public and private API key is required to shorten URLs via the jotURL API and WP to Twitter." 
    47 msgstr "Una chiave pubblica e privata per le API di jotURL è richiesta per abbreviare gli URL tramite le API di jotURL e WP to Twitter." 
     47msgstr "Una chiave pubblica e privata per le API di jotURL è richiesta per accorciare le URL tramite le API di jotURL e WP to Twitter." 
    4848 
    4949#: wp-to-twitter-shorteners.php:481 
     
    5757#: wp-to-twitter-shorteners.php:486 
    5858msgid "jotURL private API Key not added - <a href='https://www.joturl.com/reserved/api.html'>get one here</a>! A private API key is required to use the jotURL URL shortening service. " 
    59 msgstr "Chiave privata per le API di jotURL non aggiunta - <a href='https://www.joturl.com/reserved/api.html'>recuperane una qua</a>! Una chiave privata è richiesta per usare il servizio di abbreviazione URL di jotURL." 
     59msgstr "Chiave privata per le API di jotURL non aggiunta - <a href='https://www.joturl.com/reserved/api.html'>recuperane una qua</a>! Una chiave privata è richiesta per usare il servizio di accorciamento URL di jotURL." 
    6060 
    6161#: wp-to-twitter-shorteners.php:490 
     
    6565#: wp-to-twitter-shorteners.php:493 
    6666msgid "jotURL public API Key deleted. You cannot use the jotURL API without providing your public API Key. " 
    67 msgstr "Chiave per le API pubblica di jotURL cancellata. Non puoi usare le API di jotURL senza fornire la tua chiave pubblica per le API." 
     67msgstr "Chiave pubblica per le API di jotURL cancellata. Non puoi usare le API di jotURL senza fornire la tua chiave pubblica per le API." 
    6868 
    6969#: wp-to-twitter-shorteners.php:495 
     
    8989#: wp-to-twitter-shorteners.php:527 
    9090msgid "You must add your jotURL public and private API key in order to shorten URLs with jotURL." 
    91 msgstr "Devi aggiungere la tua chiave pubblica e privata per le API di jotURL per abbreviare gli URL tramite il servizio di jotURL." 
     91msgstr "Devi aggiungere la tua chiave pubblica e privata per le API di jotURL per accorciare le URL tramite il servizio di jotURL." 
    9292 
    9393#: wp-to-twitter-manager.php:526 
     
    109109#: wp-to-twitter-manager.php:588 
    110110msgid "The order in which items will be abbreviated or removed from your Tweet if the Tweet is too long to send to Twitter." 
    111 msgstr "L'ordine in cui gli elementi saranno abbreviati o rimossi dal tuo Tweet se è troppo lungo per essere inviata a Twitter." 
     111msgstr "L'ordine in cui gli elementi saranno abbreviati o rimossi dal tuo Tweet se quest'ultimo è troppo lungo per essere inviata a Twitter." 
    112112 
    113113#: wp-to-twitter-manager.php:641 
     
    173173#: wp-to-twitter-shorteners.php:545 
    174174msgid "Choose a short URL service (account settings below)" 
    175 msgstr "Scegli un servizio di abbreviazione degli URL (impostazioni dell'account di seguito)" 
     175msgstr "Scegli un servizio di accorciamento delle URL (impostazioni dell'account di seguito)" 
    176176 
    177177#: wp-to-twitter-shorteners.php:551 
     
    313313#: wp-to-twitter-shorteners.php:391 
    314314msgid "Your shortener does not require any account settings." 
    315 msgstr "Il tuo abbreviatore di URL non richiede alcun impostazione." 
     315msgstr "Il tuo accorciatore di URL non richiede alcuna impostazione." 
    316316 
    317317#: wp-to-twitter.php:288 
     
    373373#: wp-to-twitter-manager.php:687 
    374374msgid "Disable global URL shortener error messages." 
    375 msgstr "Disattiva i messaggi di errore abbreviatore URL globale." 
     375msgstr "Disattiva i messaggi di errore globali generati accorciando la URL." 
    376376 
    377377#: wp-to-twitter-manager.php:688 
     
    413413#: wp-to-twitter-manager.php:732 
    414414msgid "Check whether your server supports <a href=\"http://www.joedolson.com/articles/wp-to-twitter/\">WP to Twitter's</a> queries to the Twitter and URL shortening APIs. This test will send a status update to Twitter and shorten a URL using your selected methods." 
    415 msgstr "Utilizzare nel caso in cui il tuo server supportasse le query di <a href=\"http://www.joedolson.com/articles/wp-to-twitter/\">WP to Twitter</a> per Twitter e per le API per l'abbreviazione degli URL. Questo test invierà a Twitter un aggiornamento dello stato e renderà breve l'URL utilizzando il metodo da te selezionato." 
     415msgstr "Utilizzare nel caso in cui il tuo server supporti le query di <a href=\"http://www.joedolson.com/articles/wp-to-twitter/\">WP to Twitter</a> per Twitter e per le API di accorciamento URL. Questo test invierà a Twitter un aggiornamento dello stato e accorcerà la URL utilizzando il metodo da te selezionato." 
    416416 
    417417#: wp-to-twitter-manager.php:750 
     
    759759 
    760760msgid "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." 
    761 msgstr "Invia un Tweet quanto aggiorni il tuo blog WordPress o il tuo blogroll usando il servizio di abbreviazione URL di tua scelta. Ricco di funzioni per la personalizzazione e la promozione dei tuoi Tweet." 
     761msgstr "Invia un Tweet quanto aggiorni il tuo blog WordPress o il tuo blogroll usando il servizio di accorciamento URL di tua scelta. Ricco di funzioni per la personalizzazione e la promozione dei tuoi Tweet." 
    762762 
    763763msgid "Joseph Dolson" 
     
    789789#: wp-to-twitter-manager.php:39 
    790790msgid "No error information is available for your shortener." 
    791 msgstr "Nessuna informazione di errore disponibile per il tuo abbreviatore." 
     791msgstr "Nessuna informazione di errore disponibile per il servizio di accorciamento URL da te scelto." 
    792792 
    793793#: wp-to-twitter-manager.php:41 
     
    845845#: wp-to-twitter-shorteners.php:523 
    846846msgid "You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly." 
    847 msgstr "E' necessario che tu inserisca i dati per il login e la chiave API di Bit.ly in modo da potere abbreviare gli URL con Bit.ly." 
     847msgstr "E' necessario che tu inserisca i dati per il login e la chiave API di Bit.ly in modo da potere accorciare le URL con Bit.ly." 
    848848 
    849849#: wp-to-twitter-shorteners.php:531 
    850850msgid "You must add your YOURLS remote URL, login, and password in order to shorten URLs with a remote installation of YOURLS." 
    851 msgstr "E' necessario che tu inserisca il tuo URL remoto a YOURLS, il login e la password in modo da potere abbreviare gli URL attraverso la tua installazione remota di YOURLS." 
     851msgstr "E' necessario che tu inserisca il tuo URL remoto a YOURLS, il login e la password in modo da potere accorciare le URL attraverso la tua installazione remota di YOURLS." 
    852852 
    853853#: wp-to-twitter-shorteners.php:535 
    854854msgid "You must add your YOURLS server path in order to shorten URLs with a remote installation of YOURLS." 
    855 msgstr "E' necessario che tu inserisca il percorso al server del tuo YOURLS in modo da potere abbreviare gli URL attraverso la tua installazione remota di YOURLS." 
     855msgstr "E' necessario che tu inserisca il percorso al server del tuo YOURLS in modo da potere accorciare le URL attraverso la tua installazione remota di YOURLS." 
    856856 
    857857#: wp-to-twitter-manager.php:382 
     
    961961#: wp-to-twitter-manager.php:423 
    962962msgid "<p>The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet. Check with your URL shortening provider to see if there are any known issues.</p>" 
    963 msgstr "<p>La richiesta alle API per il servizio di abbreviazione degli URL è fallita e quindi il tuo URL non è stato abbreviato. L'url esteso al tuo post è stato allegato al tuo Tweet. Contatta il tuo fornitore di URL abbreviati per verificare se ci sono problemi col servizio.</p>" 
     963msgstr "<p>La richiesta alle API per il servizio di accorciamento delle URL è fallita e quindi la tua URL non è stata accorciata. La URL lunga è stata usata per il tuo Tweet. Contatta il tuo servizio di accorciamento URL per verificare se ci sono problemi.</p>" 
    964964 
    965965#: wp-to-twitter-manager.php:429 
     
    10131013#: wp-to-twitter-shorteners.php:291 
    10141014msgid "<abbr title=\"Uniform Resource Locator\">URL</abbr> Shortener Account Settings" 
    1015 msgstr "Impostazione account abbreviatore <abbr title=\"Uniform Resource Locator\">URL</abbr>" 
     1015msgstr "Impostazione account per il servizio di accorciamento di <abbr title=\"Uniform Resource Locator\">URL</abbr>" 
    10161016 
    10171017#: wp-to-twitter-shorteners.php:295 
     
    11051105#: wp-to-twitter-shorteners.php:369 
    11061106msgid "A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter." 
    1107 msgstr "E' necessario il nome utente e la password di affinché possano essere abbreviati gli URL via l'API remoto di YOURLS e di WP to Twitter." 
     1107msgstr "Nome utente e password sono necessari per accorciare le URL attraverso le API di YOURLS e di WP to Twitter." 
    11081108 
    11091109#: wp-to-twitter-manager.php:518 
     
    11531153#: wp-to-twitter-manager.php:557 
    11541154msgid "Custom field for an alternate URL to be shortened and Tweeted:" 
    1155 msgstr "Campo personalizzato riferito ad un URL alternativo da abbreviare ed inviare a Twitter:" 
     1155msgstr "Campo personalizzato per inserire una URL alternativa da accorciare e inviare a Twitter:" 
    11561156 
    11571157#: wp-to-twitter-manager.php:594 
  • wp-to-twitter/trunk/readme.txt

    r705728 r718938  
    3434* Scheduled Tweet management 
    3535* Co-Tweet to site and author Twitter accounts 
     36* Preview and Tweet comments 
    3637* [and more!](http://www.joedolson.com/articles/wp-tweets-pro/) 
    3738 
     
    5051 
    5152== Changelog == 
     53 
     54= 2.6.6 = 
     55 
     56* Improved & removed feature: Tweet comments. Moved to WP Tweets PRO. 
     57* Improved view: post edit screen when Tweeting edits is disabled. 
     58* Added filter: wpt_custom_shortcode. Args: $post_ID, custom field name. Filter output from [[your_custom_field]]. 
     59* Changed twitter analytics options to radio selector. 
     60* Bug fix: disable inline edit Tweets did not also disable bulk edit Tweets 
     61* Bug fix: URL re-fetch issue with jotURL. 
     62* Updated Italian translation. 
    5263 
    5364= 2.6.5 = 
     
    819830== Upgrade Notice == 
    820831 
    821 * 2.6.0 Bug fixes, new translations, WP Tweets PRO features. 
     832* 2.6.6 Tweeting comments improved and moved into WP Tweets PRO upgrade. 
  • wp-to-twitter/trunk/styles.css

    r690784 r718938  
    2121#wp-to-twitter .indent { margin-left: 30px; } 
    2222#wp-to-twitter .flattr { float: right; } 
     23.wpt_image { padding-left: 20px; background: url(image.png) left 50% no-repeat; display: block; } 
  • wp-to-twitter/trunk/wp-to-twitter-manager.php

    r691330 r718938  
    11<?php 
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
     3 
    24// FUNCTION to see if checkboxes should be checked 
    35function jd_checkCheckbox( $theFieldname,$sub1=false,$sub2='' ) { 
     
    114116        update_option( 'jd_twit_blogroll', '1'); 
    115117        update_option( 'newlink-published-text', 'New link: #title# #url#' ); 
    116         update_option( 'comment-published-update', 0 ); 
    117         update_option( 'comment-published-text', 'New comment: #title# #url#' );                 
    118118        update_option( 'limit_categories','0' ); 
    119119        update_option( 'jd_shortener', '1' ); 
     
    142142        update_option( 'twitter-analytics-campaign', 'twitter' ); 
    143143        update_option( 'use-twitter-analytics', '0' ); 
    144         update_option( 'jd_dynamic_analytics','0' );         
     144        update_option( 'jd_dynamic_analytics','0' ); 
     145        update_option( 'no-analytics', 1 ); 
    145146        update_option( 'use_dynamic_analytics','category' );             
    146147        // Use custom external URLs to point elsewhere.  
     
    217218        update_option( 'jd_date_format',$_POST['jd_date_format'] );  
    218219        update_option( 'jd_dynamic_analytics',$_POST['jd-dynamic-analytics'] );      
    219         update_option( 'use_dynamic_analytics',( isset( $_POST['use-dynamic-analytics'] ) )?$_POST['use-dynamic-analytics']:0 );         
    220         update_option( 'use-twitter-analytics', ( isset( $_POST['use-twitter-analytics'] ) )?$_POST['use-twitter-analytics']:0 ); 
     220         
     221        $twitter_analytics = ( isset($_POST['twitter-analytics']) )?$_POST['twitter-analytics']:0; 
     222        if ( $twitter_analytics == 1 ) { 
     223            update_option( 'use_dynamic_analytics', 0 ); 
     224            update_option( 'use-twitter-analytics', 1 ); 
     225            update_option( 'no-analytics', 0 );          
     226        } else if ( $twitter_analytics == 2 ) { 
     227            update_option( 'use_dynamic_analytics', 1 ); 
     228            update_option( 'use-twitter-analytics', 0 ); 
     229            update_option( 'no-analytics', 1 ); 
     230        } else { 
     231            update_option( 'use_dynamic_analytics', 0 ); 
     232            update_option( 'use-twitter-analytics', 0 ); 
     233            update_option( 'no-analytics', 1 ); 
     234        } 
     235         
    221236        update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] ); 
    222237        update_option( 'jd_individual_twitter_users', ( isset( $_POST['jd_individual_twitter_users']  )? $_POST['jd_individual_twitter_users']:0 ) ); 
     
    375390        update_option( 'newlink-published-text', $_POST['newlink-published-text'] ); 
    376391        update_option( 'jd_twit_blogroll',(isset($_POST['jd_twit_blogroll']) )?$_POST['jd_twit_blogroll']:"" ); 
    377         update_option( 'comment-published-text', $_POST['comment-published-text'] ); 
    378         update_option( 'comment-published-update',(isset($_POST['comment-published-update']) )?$_POST['comment-published-update']:"" );  
    379  
    380         $message = wpt_select_shortener( $_POST ); 
    381          
     392        $message = wpt_select_shortener( $_POST );   
    382393        $message .= __( 'WP to Twitter Options Updated' , 'wp-to-twitter'); 
    383394    } 
     
    406417<div class="wrap" id="wp-to-twitter"> 
    407418<?php wpt_marginal_function(); ?> 
     419<?php wpt_commments_removed(); ?> 
    408420<?php if ( $message ) { ?> 
    409421<div id="message" class="updated fade"><?php echo $message; ?></div> 
     
    483495                    } 
    484496                }  
    485             ?> 
    486             <fieldset class="comments"> 
    487             <legend><?php _e('Settings for Comments','wp-to-twitter'); ?></legend> 
    488             <p> 
    489                 <input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php echo jd_checkCheckbox('comment-published-update')?> /> 
    490                 <label for="comment-published-update"><strong><?php _e("Update Twitter when new comments are posted", 'wp-to-twitter'); ?></strong></label><br />                
    491                 <label for="comment-published-text"><?php _e("Text for new comments:", 'wp-to-twitter'); ?></label> <input aria-labelledby="comment-published-text-label" type="text" class="wpt-template" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php echo ( esc_attr( stripslashes( get_option( 'comment-published-text' ) ) ) ); ?>" /> 
    492             </p> 
    493             <p id='comment-published-text-label'><?php _e('In addition to standard template tags, comments can use <code>#commenter#</code> to post the commenter\'s name in the Tweet. <em>Use this at your own risk</em>, as it lets anybody who can post a comment on your site post a phrase in your Twitter stream.','wp-to-twitter'); ?> 
    494             </fieldset>                  
     497            ?>               
    495498            <fieldset> 
    496499            <legend><?php _e('Settings for Links','wp-to-twitter'); ?></legend> 
     
    619622        <fieldset> 
    620623        <legend><?php _e( "Google Analytics Settings",'wp-to-twitter' ); ?></legend> 
    621                 <p><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.","wp-to-twitter"); ?></p> 
    622                  
    623             <p> 
    624                 <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php echo jd_checkCheckbox('use-twitter-analytics')?> /> 
     624                <p><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.","wp-to-twitter"); ?></p>  
     625            <p> 
     626                <input type="radio" name="twitter-analytics" id="use-twitter-analytics" value="1" <?php echo jd_checkCheckbox('use-twitter-analytics')?> /> 
    625627                <label for="use-twitter-analytics"><?php _e("Use a Static Identifier with WP-to-Twitter", 'wp-to-twitter'); ?></label><br /> 
    626628                <label for="twitter-analytics-campaign"><?php _e("Static Campaign identifier for Google Analytics:", 'wp-to-twitter'); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( esc_attr( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br /> 
    627629            </p> 
    628630            <p> 
    629                 <input type="checkbox" name="use-dynamic-analytics" id="use-dynamic-analytics" value="1" <?php echo jd_checkCheckbox('use_dynamic_analytics')?> /> 
     631                <input type="radio" name="twitter-analytics" id="use-dynamic-analytics" value="2" <?php echo jd_checkCheckbox('use_dynamic_analytics')?> /> 
    630632                <label for="use-dynamic-analytics"><?php _e("Use a dynamic identifier with Google Analytics and WP-to-Twitter", 'wp-to-twitter'); ?></label><br /> 
    631633            <label for="jd-dynamic-analytics"><?php _e("What dynamic identifier would you like to use?","wp-to-twitter"); ?></label>  
     
    636638                    <option value="post_author"<?php echo jd_checkSelect( 'jd_dynamic_analytics','post_author'); ?>><?php _e("Author","wp-to-twitter"); ?></option> 
    637639                </select><br /> 
     640            </p> 
     641            <p> 
     642                <input type="radio" name="twitter-analytics" id="no-analytics" value="3" <?php echo jd_checkCheckbox('no-analytics'); ?> /> <label for="no-analytics"><?php _e("No Analytics", 'wp-to-twitter'); ?></label> 
    638643            </p> 
    639644        </fieldset> 
     
    784789            <p><?php _e('Extra features with the PRO upgrade:','wp-to-twitter'); ?></p> 
    785790            <ul> 
    786                 <li><?php _e('Users can post to their own Twitter accounts','wp-to-twitter'); ?></li> 
    787                 <li><?php _e('Set a timer to send your Tweet minutes or hours after you publish the post','wp-to-twitter'); ?></li> 
    788                 <li><?php _e('Automatically re-send Tweets at an assigned time after publishing','wp-to-twitter'); ?></li> 
     791                <li><?php _e('Allow users to post to their own Twitter accounts','wp-to-twitter'); ?></li> 
     792                <li><?php _e('Set a timer to send your Tweet minutes or hours after you publish','wp-to-twitter'); ?></li> 
     793                <li><?php _e('Automatically re-send Tweets after publishing','wp-to-twitter'); ?></li> 
     794                <li><?php _e('Send Tweets for approved comments','wp-to-twitter'); ?></li> 
    789795            </ul> 
    790796             
  • wp-to-twitter/trunk/wp-to-twitter-oauth.php

    r690784 r718938  
    11<?php 
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
     3 
    24// function to test credentials 
    35function wtt_oauth_test( $auth=false, $context='' ) { 
  • wp-to-twitter/trunk/wp-to-twitter-shorteners.php

    r696109 r718938  
    33//jd_expand_url 
    44//jd_expand_yourl 
     5if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    56 
    67if ( !function_exists( 'jd_shorten_link' ) ) { // prep work for future plug-in replacement. 
    7  
    88    add_filter( 'wptt_shorten_link','jd_shorten_link', 10, 4 ); 
    99 
  • wp-to-twitter/trunk/wp-to-twitter.php

    r705728 r718938  
    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.5 
     6Version: 2.6.6 
    77Author: Joseph Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    2525*/ 
     26if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    2627 
    2728if ('wp-to-twitter.php' == basename($_SERVER['SCRIPT_FILENAME'])) { die ('<h2>Direct File Access Prohibited</h2>');} 
     
    4546    require_once( plugin_dir_path(__FILE__).'/wp-to-twitter-oauth.php' ); 
    4647} 
     48 
    4749require_once( plugin_dir_path(__FILE__).'/wp-to-twitter-shorteners.php' ); 
    4850require_once( plugin_dir_path(__FILE__).'/wp-to-twitter-manager.php' ); 
     
    5052 
    5153global $wpt_version,$jd_plugin_url; 
    52 $wpt_version = "2.6.5"; 
     54$wpt_version = "2.6.6"; 
    5355$plugin_dir = basename(dirname(__FILE__)); 
    5456load_plugin_textdomain( 'wp-to-twitter', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); 
     
    5658function wpt_pro_compatibility() { 
    5759    global $wptp_version; 
    58     $current_wptp_version = '1.4.1'; 
     60    $current_wptp_version = '1.5.0'; 
    5961    if ( version_compare( $wptp_version, $current_wptp_version, '<' ) ) { 
    60         echo "<div class='error notice'><p class='upgrade'>".sprintf( __('The current version of WP Tweets PRO is <strong>%s</strong>. Upgrade for best compatibility!','wp-to-twitter'),$current_wptp_version )."</p></div>"; 
     62        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>"; 
    6163    } 
    6264} 
     
    7476    } 
    7577} 
    76  // check for OAuth configuration 
     78 
     79function wpt_commments_removed() { 
     80    if ( isset($_GET['dismiss']) ) { 
     81        update_option( 'wpt_dismissed', 'true' ); 
     82    } 
     83    if ( get_option( 'comment-published-update' ) == 1 && !function_exists( 'wpt_pro_exists' ) && get_option( 'wpt_dismissed' ) != 'true' ) { 
     84        $update_notice = sprintf( __('Tweeting of comments has been moved to <a href="%1$s">WP Tweets PRO</a>. You will need to upgrade in order to Tweet comments. <a href="%2$s">Dismiss</a>'), 'http://www.joedolson.com/articles/wp-tweets-pro/', admin_url( "options-general.php?page=wp-to-twitter/wp-to-twitter.php&dismiss=true" ) ); 
     85        if ( is_admin() ) { 
     86            echo "<div class='updated'><p>".($update_notice)."</p></div>"; 
     87        } 
     88    } 
     89} 
     90 
     91// check for OAuth configuration 
    7792function wpt_check_oauth( $auth=false ) { 
    7893    if ( !function_exists('wtt_oauth_test') ) { 
     
    255270 
    256271// This function performs the API post to Twitter 
    257 function jd_doTwitterAPIPost( $twit, $auth=false, $id=false ) { 
     272function jd_doTwitterAPIPost( $twit, $auth=false, $id=false, $media=false ) { 
    258273    if ( !wpt_check_oauth( $auth )  ) {  
    259274            wpt_saves_error( $id, $auth, $twit, __('This account is not authorized to post to Twitter.','wp-tweets-pro'), '401', time() ); 
     
    276291    } else { 
    277292        $protocol = ( get_option( 'wpt_http' ) == '1' )?'http:':'https:'; 
    278         $jdwp_api_post_status = "$protocol//api.twitter.com/1.1/statuses/update.json"; 
     293        if ( $media ) { 
     294            $jdwp_api_post_status = "$protocol//api.twitter.com/1.1/statuses/update_with_media.json";        
     295        } else { 
     296            $jdwp_api_post_status = "$protocol//api.twitter.com/1.1/statuses/update.json"; 
     297        } 
    279298        if ( wtt_oauth_test( $auth ) && ( $connection = wtt_oauth_connection( $auth ) ) ) { 
    280             $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true', 'lang'=>'de' ) ); 
     299            if ( $media ) { 
     300                $connection->media( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true', 'id'=>$id ) );           
     301            } else { 
     302                $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true' ) ); 
     303            } 
    281304            $http_code = ($connection)?$connection->http_code:'failed'; 
    282305        } else if ( wtt_oauth_test( false ) && ( $connection = wtt_oauth_connection( false ) ) ) { 
    283             $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true'   ) ); 
     306            if ( $media ) { 
     307                $connection->media( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true', 'id'=>$id ) );           
     308            } else { 
     309                $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter', 'include_entities' => 'true'   ) ); 
     310            } 
    284311            $http_code = ($connection)?$connection->http_code:'failed';  
    285312        } 
     
    344371                $_POST['_jd_wp_twitter'] = $jwt; 
    345372                update_post_meta( $id,'_jd_wp_twitter', $jwt ); 
     373                if ( !function_exists( 'wpt_pro_exists' ) ) { 
     374                    // schedule a one-time promotional box for 4 weeks after first successful Tweet. Experiment... 
     375                    if ( get_option( 'wpt_promotion_scheduled' ) == false ) { 
     376                        wp_schedule_single_event( time()+(60*60*24*7*4), 'wpt_schedule_promotion_action' ); 
     377                        update_option( 'wpt_promotion_scheduled', 1 ); 
     378                    } 
     379                } 
    346380            } 
    347381            if ( !$return ) { 
     
    374408    $post = get_post( $post_ID ); 
    375409     
    376     if ($postinfo['shortUrl'] != '') { 
     410    if ( $postinfo['shortUrl'] != '' ) { 
    377411        $shrink = $postinfo['shortUrl']; 
    378412    } else { 
     
    641675    if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_url', true );} 
    642676    if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_goo', true );} 
     677    if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_joturl', true );}   
    643678    if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_target', true );} 
    644679    return $jd_short; 
     
    663698    $sentence = ''; 
    664699    if ( get_option('wpt_inline_edits') != 1 ) { 
    665         if ( isset($_POST['_inline_edit']) ) { return; } 
     700        if ( isset($_POST['_inline_edit']) || isset( $_REQUEST['bulk_edit'] ) ) { return; } 
    666701    } else { 
    667         if ( isset($_POST['_inline_edit']) ) { $is_inline_edit = true; } 
     702        if ( isset($_POST['_inline_edit']) || isset( $_REQUEST['bulk_edit'] ) ) { $is_inline_edit = true; } 
    668703    } 
    669704    if ( WPT_DEBUG && function_exists( 'wpt_pro_exists' ) ) { 
     
    677712    if ( $test ) { // test switch: depend on default settings. 
    678713        $post_info = jd_post_info( $post_ID ); 
     714        $media = ( get_option( 'wpt_media' ) == '1' && function_exists( 'wpt_pro_exists' ) )?true:false; 
    679715        if ( function_exists( 'wpt_pro_exists' ) && wpt_pro_exists() == true ) { 
    680716            $auth = ( get_option( 'wpt_cotweet_lock' ) == 'false' || !get_option('wpt_cotweet_lock') )?$post_info['authId']:get_option('wpt_cotweet_lock'); 
     
    770806                        $auth = ( get_option( 'jd_individual_twitter_users' ) != 1 || !$auth_verified )?false:$auth; 
    771807                        if ( $post_info['wpt_delay_tweet'] == 0 || $post_info['wpt_delay_tweet'] == '' || $post_info['wpt_no_delay'] == 'on' ) { 
    772                             $tweet = jd_doTwitterAPIPost( $sentence, $auth, $post_ID ); 
     808                            $tweet = jd_doTwitterAPIPost( $sentence, $auth, $post_ID, $media ); 
    773809                            if ( $post_info['wpt_cotweet'] == 1 && $auth_verified ) { 
    774                                 $tweet2 = jd_doTwitterAPIPost( $sentence2, false, $post_ID );                
     810                                $tweet2 = jd_doTwitterAPIPost( $sentence2, false, $post_ID, $media );                
    775811                            } 
    776812                        } else { 
     
    830866                        } 
    831867                    } else { 
    832                         $tweet = jd_doTwitterAPIPost( $sentence, false, $post_ID ); 
     868                        $tweet = jd_doTwitterAPIPost( $sentence, false, $post_ID, $media ); 
    833869                    } 
    834870                    // END WPT PRO // 
     
    875911        return; 
    876912    } 
    877 } 
    878  
    879 // Add comment Tweet function from Luis Nobrega 
    880 function jd_twit_comment( $comment_id, $approved ) {     
    881     $_t = get_comment( $comment_id ); 
    882     $post_ID = $_t->comment_post_ID; 
    883     $commenter = $_t->comment_author; 
    884     $jd_tweet_this = get_post_meta( $post_ID, '_jd_tweet_this', TRUE ); 
    885     if ( $jd_tweet_this != 'no' && $_t->comment_approved == 1 ) { // comments only tweeted on posts which are tweeted 
    886         $post_info = jd_post_info( $post_ID ); 
    887         $sentence = ''; 
    888         $sentence = stripcslashes( get_option( 'comment-published-text' ) ); 
    889         $sentence = jd_truncate_tweet( $sentence, $post_info, $post_ID ); 
    890         $sentence = str_replace("#commenter#",$commenter,$sentence); 
    891         if ( $sentence != '' ) { 
    892             $tweet = jd_doTwitterAPIPost( $sentence, false, $post_ID ); 
    893         } 
    894     } 
    895     return $post_ID; 
    896913} 
    897914 
     
    955972            $status = $post->post_status; 
    956973            $post_id = $post->ID; 
    957         }  
    958         $jd_twitter = esc_attr( stripcslashes( get_post_meta($post_id, '_jd_twitter', true ) ) ); 
    959         $jd_twitter = apply_filters( 'wpt_user_text', $jd_twitter, $status ); 
    960         $jd_template = ( $status == 'publish' )?$wpt_settings[$type]['post-edited-text']:$wpt_settings[$type]['post-published-text']; 
    961         $jd_tweet_this = get_post_meta( $post_id, '_jd_tweet_this', true ); 
    962         if ( $jd_tweet_this == '' ) {  
    963             $jd_tweet_this = (get_option( 'jd_tweet_default' ) == '1' )?'no':'yes';  
    964         } 
    965         if ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && get_option( 'jd_tweet_default_edit' ) == '1' ) { $jd_tweet_this = 'no'; } 
    966         $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true ); 
    967         $failed_tweets = get_post_meta( $post_id, '_wpt_failed' ); 
     974        } 
     975        if ( $status == 'publish' && $wpt_settings[$type]['post-edited-update'] != 1 ) { 
     976            printf(__('Tweeting %s edits is disabled.','wp-to-twitter'), $type ); 
     977        } else { 
     978            $jd_twitter = esc_attr( stripcslashes( get_post_meta($post_id, '_jd_twitter', true ) ) ); 
     979            $jd_twitter = apply_filters( 'wpt_user_text', $jd_twitter, $status ); 
     980            $jd_template = ( $status == 'publish' )?$wpt_settings[$type]['post-edited-text']:$wpt_settings[$type]['post-published-text']; 
     981            $jd_tweet_this = get_post_meta( $post_id, '_jd_tweet_this', true ); 
     982            if ( $jd_tweet_this == '' ) {  
     983                $jd_tweet_this = (get_option( 'jd_tweet_default' ) == '1' )?'no':'yes';  
     984            } 
     985            if ( isset( $_GET['action'] ) && $_GET['action'] == 'edit' && get_option( 'jd_tweet_default_edit' ) == '1' ) { $jd_tweet_this = 'no'; } 
     986            $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true ); 
     987            $failed_tweets = get_post_meta( $post_id, '_wpt_failed' ); 
     988            ?> 
     989        <?php if ( current_user_can('update_core') && function_exists( 'wpt_pro_exists' ) ) { wpt_pro_compatibility(); } ?> 
     990        <?php if ( current_user_can('update_core') && !function_exists( 'wpt_pro_exists' ) ) { ?> <strong><a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Upgrade to WP Tweets Pro!', 'wp-to-twitter', 'wp-to-twitter') ?></a></strong> <?php } ?> 
     991        <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can('update_core') ) { ?> 
     992        <p class='jtw'> 
     993        <label for="jtw"><?php _e("Custom Twitter Post", 'wp-to-twitter', 'wp-to-twitter') ?></label><br /><textarea class="attachmentlinks" name="_jd_twitter" id="jtw" rows="2" cols="60"><?php echo esc_attr( $jd_twitter ); ?></textarea> 
     994        </p> 
     995        <?php 
     996            $jd_expanded = $jd_template; 
     997                if ( get_option( 'jd_twit_prepend' ) != "" ) { 
     998                    $jd_expanded = "<span title='".__('Your prepended Tweet text; not part of your template.','wp-to-twitter')."'>".stripslashes( get_option( 'jd_twit_prepend' )) . "</span> " . $jd_expanded; 
     999                } 
     1000                if ( get_option( 'jd_twit_append' ) != "" ) { 
     1001                    $jd_expanded = $jd_expanded . " <span title='".__('Your appended Tweet text; not part of your template.','wp-to-twitter')."'>" . stripslashes(get_option( 'jd_twit_append' ))."</span>"; 
     1002                } 
     1003                /* $turl = ( $status = "publish" )?wpt_short_url( $post_id ):'http://t.co/example1'; 
     1004                $search = array( '#url#','#title#','#reference#','#post#','#category#','#date#','#modified#','#author#','#account#','#tags#','#blog#' ); 
     1005                $replace = array(  
     1006                    '<span class="tw_url">'.$turl.'</span>', 
     1007                    '<span class="tw_title">#title#</span>', 
     1008                    '<span class="tw_post">#post#</span>', 
     1009                    '<span class="tw_reference">#reference#</span>', 
     1010                    '<span class="tw_category">#category#</span>', 
     1011                    '<span class="tw_date">#date#</span>', 
     1012                    '<span class="tw_modified">#modified#</span>', 
     1013                    '<span class="tw_author">#author#</span>', 
     1014                    '<span class="tw_tags">#tags#</span>', 
     1015                    get_bloginfo('blogname') ); 
     1016                $jd_expanded = str_replace( $search, $replace, $jd_expanded ); */ ?> 
     1017        <p class='template'><?php _e('Your template:','wp-to-twitter'); ?> <code><?php echo stripcslashes( $jd_expanded ); ?></code></p> 
     1018 
     1019        <?php  
     1020            if ( get_option('jd_keyword_format') == 2 ) { 
     1021                $custom_keyword = get_post_meta( $post_id, '_yourls_keyword', true ); 
     1022                echo "<label for='yourls_keyword'>".__('YOURLS Custom Keyword','wp-to-twitter')."</label> <input type='text' name='_yourls_keyword' id='yourls_keyword' value='$custom_keyword' />"; 
     1023            } 
    9681024        ?> 
    969     <?php if ( current_user_can('update_core') && function_exists( 'wpt_pro_exists' ) ) { wpt_pro_compatibility(); } ?> 
    970     <?php if ( current_user_can('update_core') && !function_exists( 'wpt_pro_exists' ) ) { ?> <strong><a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Upgrade to WP Tweets Pro!', 'wp-to-twitter', 'wp-to-twitter') ?></a></strong> <?php } ?> 
    971     <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can('update_core') ) { ?> 
    972     <p class='jtw'> 
    973     <label for="jtw"><?php _e("Custom Twitter Post", 'wp-to-twitter', 'wp-to-twitter') ?></label><br /><textarea class="attachmentlinks" name="_jd_twitter" id="jtw" rows="2" cols="60"><?php echo esc_attr( $jd_twitter ); ?></textarea> 
    974     </p> 
    975     <?php 
    976         $jd_expanded = $jd_template; 
    977             if ( get_option( 'jd_twit_prepend' ) != "" ) { 
    978                 $jd_expanded = "<span title='".__('Your prepended Tweet text; not part of your template.','wp-to-twitter')."'>".stripslashes( get_option( 'jd_twit_prepend' )) . "</span> " . $jd_expanded; 
    979             } 
    980             if ( get_option( 'jd_twit_append' ) != "" ) { 
    981                 $jd_expanded = $jd_expanded . " <span title='".__('Your appended Tweet text; not part of your template.','wp-to-twitter')."'>" . stripslashes(get_option( 'jd_twit_append' ))."</span>"; 
    982             } 
    983             /* $turl = ( $status = "publish" )?wpt_short_url( $post_id ):'http://t.co/example1'; 
    984             $search = array( '#url#','#title#','#reference#','#post#','#category#','#date#','#modified#','#author#','#account#','#tags#','#blog#' ); 
    985             $replace = array(  
    986                 '<span class="tw_url">'.$turl.'</span>', 
    987                 '<span class="tw_title">#title#</span>', 
    988                 '<span class="tw_post">#post#</span>', 
    989                 '<span class="tw_reference">#reference#</span>', 
    990                 '<span class="tw_category">#category#</span>', 
    991                 '<span class="tw_date">#date#</span>', 
    992                 '<span class="tw_modified">#modified#</span>', 
    993                 '<span class="tw_author">#author#</span>', 
    994                 '<span class="tw_tags">#tags#</span>', 
    995                 get_bloginfo('blogname') ); 
    996             $jd_expanded = str_replace( $search, $replace, $jd_expanded ); */ ?> 
    997     <p class='template'><?php _e('Your template:','wp-to-twitter'); ?> <code><?php echo stripcslashes( $jd_expanded ); ?></code></p> 
    998  
    999     <?php  
    1000         if ( get_option('jd_keyword_format') == 2 ) { 
    1001             $custom_keyword = get_post_meta( $post_id, '_yourls_keyword', true ); 
    1002             echo "<label for='yourls_keyword'>".__('YOURLS Custom Keyword','wp-to-twitter')."</label> <input type='text' name='_yourls_keyword' id='yourls_keyword' value='$custom_keyword' />"; 
    1003         } 
    1004     ?> 
    1005     <?php } else { ?> 
    1006     <input type="hidden" name='_jd_twitter' value='<?php echo esc_attr($jd_twitter); ?>' /> 
    1007     <?php } ?> 
    1008     <?php if ( current_user_can( 'wpt_twitter_switch' ) || current_user_can('update_core') ) { ?> 
    1009     <?php 
    1010         // "no" means 'Don't Tweet' (is checked) 
    1011         $nochecked = ( $jd_tweet_this == 'no' )?' checked="checked"':''; 
    1012         $yeschecked = ( $jd_tweet_this == 'yes' )?' checked="checked"':''; 
    1013     ?> 
    1014     <p><input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /> <label for="jtn"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label> <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /> <label for="jty"><?php _e("Tweet this post.", 'wp-to-twitter'); ?></label></p> 
    1015     <?php } else { ?> 
    1016         <input type='hidden' name='_jd_tweet_this' value='<?php echo $jd_tweet_this; ?>' /> 
    1017     <?php } ?> 
    1018     <?php /* WPT PRO */ ?> 
    1019     <?php  
    1020     if ( function_exists('wpt_pro_exists') && wpt_pro_exists() == true  && ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'update_core' ) ) ) {  
    1021         wpt_schedule_values( $post_id );  
    1022     } ?> 
    1023     <?php /* WPT PRO */ ?> 
    1024     <?php if ( !current_user_can( 'wpt_twitter_custom' ) && !current_user_can( 'update_core' ) ) { ?> 
    1025     <div> 
    1026     <p><?php _e('Access to customizing WP to Twitter values is not allowed for your user role.','wp-to-twitter'); ?></p> 
    1027     <?php  
    1028     if ( function_exists('wpt_pro_exists') && wpt_pro_exists() == true ) {  
    1029         wpt_schedule_values( $post_id, 'hidden' );  
    1030     } ?> 
    1031     </div> 
    1032     <?php } ?> 
    1033     <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'update_core' ) ) { ?> 
    1034     <p> 
    1035     <?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') ?>  
    1036     </p> 
    1037     <?php } ?> 
    1038     <?php if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } ?> 
    1039     <?php if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) { ?> 
    1040     <hr> 
    1041     <p class='error'><strong><?php _e('Previous Tweets','wp-to-twitter'); ?>:</strong></p> 
    1042     <ul> 
    1043     <?php 
    1044     $hidden_fields = ''; 
    1045         if ( is_array( $previous_tweets ) ) { 
    1046             foreach ( $previous_tweets as $previous_tweet ) { 
    1047                 if ( $previous_tweet != '' ) { 
    1048                     $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />"; 
    1049                     echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=".urlencode($previous_tweet)."'>Retweet this</a></li>"; 
    1050                 } 
    1051             } 
    1052         } 
    1053     ?> 
    1054     </ul> 
    1055     <p class='error'><strong><?php _e('Failed Tweets','wp-to-twitter'); ?>:</strong></p> 
    1056     <ul> 
    1057     <?php 
    1058         $list = false; 
    1059         if ( is_array( $failed_tweets ) ) { 
    1060             foreach ( $failed_tweets as $failed_tweet ) { 
    1061                 if ( !empty($failed_tweet) ) { 
    1062                     $ft = $failed_tweet['sentence']; 
    1063                     $reason = $failed_tweet['code']; 
    1064                     $error = $failed_tweet['error']; 
    1065                     $list = true; 
    1066                     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>"; 
    1067                 } 
    1068             } 
    1069         } 
    1070         if ( !$list ) { echo "<li>".__('No failed tweets on this post.','wp-to-twitter')."</li>"; } 
    1071     ?> 
    1072     </ul> 
    1073     <?php echo "<div>".$hidden_fields."</div>"; } ?>     
    1074     <p> 
    1075     <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?> 
    1076     <a target="_blank" href="<?php echo admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &bull; <strong><a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Upgrade to WP Tweets Pro', 'wp-to-twitter', 'wp-to-twitter') ?></a></strong> &raquo; 
    1077     <?php } else { ?> 
    1078     <a target="_blank" href="<?php echo admin_url('admin.php?page=wp-tweets-pro'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo; 
    1079     <?php } ?> 
    1080     </p> 
    1081     <?php  
     1025        <?php } else { ?> 
     1026        <input type="hidden" name='_jd_twitter' value='<?php echo esc_attr($jd_twitter); ?>' /> 
     1027        <?php } ?> 
     1028        <?php if ( current_user_can( 'wpt_twitter_switch' ) || current_user_can('update_core') ) { ?> 
     1029        <?php 
     1030            // "no" means 'Don't Tweet' (is checked) 
     1031            $nochecked = ( $jd_tweet_this == 'no' )?' checked="checked"':''; 
     1032            $yeschecked = ( $jd_tweet_this == 'yes' )?' checked="checked"':''; 
     1033        ?> 
     1034        <p><input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /> <label for="jtn"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label> <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /> <label for="jty"><?php _e("Tweet this post.", 'wp-to-twitter'); ?></label></p> 
     1035        <?php } else { ?> 
     1036            <input type='hidden' name='_jd_tweet_this' value='<?php echo $jd_tweet_this; ?>' /> 
     1037        <?php } ?> 
     1038        <?php /* WPT PRO */ ?> 
     1039        <?php  
     1040        if ( function_exists('wpt_pro_exists') && wpt_pro_exists() == true  && ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'update_core' ) ) ) {  
     1041            wpt_schedule_values( $post_id );  
     1042        } ?> 
     1043        <?php /* WPT PRO */ ?> 
     1044        <?php if ( !current_user_can( 'wpt_twitter_custom' ) && !current_user_can( 'update_core' ) ) { ?> 
     1045        <div> 
     1046        <p><?php _e('Access to customizing WP to Twitter values is not allowed for your user role.','wp-to-twitter'); ?></p> 
     1047        <?php  
     1048        if ( function_exists('wpt_pro_exists') && wpt_pro_exists() == true ) {  
     1049            wpt_schedule_values( $post_id, 'hidden' );  
     1050        } ?> 
     1051        </div> 
     1052        <?php } ?> 
     1053        <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'update_core' ) ) { ?> 
     1054        <p> 
     1055        <?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') ?>  
     1056        </p> 
     1057        <?php } ?> 
     1058        <?php if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } ?> 
     1059        <?php if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) { ?> 
     1060        <hr> 
     1061        <p class='error'><em><?php _e('Previous Tweets','wp-to-twitter'); ?>:</em></p> 
     1062        <ul> 
     1063        <?php 
     1064        $hidden_fields = ''; 
     1065            if ( is_array( $previous_tweets ) ) { 
     1066                foreach ( $previous_tweets as $previous_tweet ) { 
     1067                    if ( $previous_tweet != '' ) { 
     1068                        $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />"; 
     1069                        echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=".urlencode($previous_tweet)."'>Retweet this</a></li>"; 
     1070                    } 
     1071                } 
     1072            } 
     1073        ?> 
     1074        </ul> 
     1075        <p class='error'><em><?php _e('Failed Tweets','wp-to-twitter'); ?>:</em></p> 
     1076        <ul> 
     1077        <?php 
     1078            $list = false; 
     1079            if ( is_array( $failed_tweets ) ) { 
     1080                foreach ( $failed_tweets as $failed_tweet ) { 
     1081                    if ( !empty($failed_tweet) ) { 
     1082                        $ft = $failed_tweet['sentence']; 
     1083                        $reason = $failed_tweet['code']; 
     1084                        $error = $failed_tweet['error']; 
     1085                        $list = true; 
     1086                        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>"; 
     1087                    } 
     1088                } 
     1089            } 
     1090            if ( !$list ) { echo "<li>".__('No failed tweets on this post.','wp-to-twitter')."</li>"; } 
     1091        ?> 
     1092        </ul> 
     1093        <?php echo "<div>".$hidden_fields."</div>"; } ?>     
     1094        <p> 
     1095        <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?> 
     1096        <a target="_blank" href="<?php echo admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &bull; <strong><a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Upgrade to WP Tweets Pro', 'wp-to-twitter', 'wp-to-twitter') ?></a></strong> &raquo; 
     1097        <?php } else { ?> 
     1098        <a target="_blank" href="<?php echo admin_url('admin.php?page=wp-tweets-pro'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo; 
     1099        <?php } ?> 
     1100        </p> 
     1101        <?php  
     1102        } 
    10821103    } else { // permissions: this user isn't allowed to Tweet; 
    10831104        _e('Your role does not have the ability to Post Tweets from this site.','wp-to-twitter'); ?> <input type='hidden' name='_jd_tweet_this' value='no' /> <?php 
     
    12151236            $shortcode = "$value"; 
    12161237            $field = str_replace($params, "", $shortcode); 
    1217             $custom = strip_tags(get_post_meta( $post_ID, $field, TRUE )); 
     1238            $custom = apply_filters( 'wpt_custom_shortcode',strip_tags(get_post_meta( $post_ID, $field, TRUE )), $post_ID, $field ); 
    12181239            $sentence = str_replace( $shortcode, $custom, $sentence ); 
    12191240        } 
     
    12231244    } 
    12241245} 
    1225      
     1246 
    12261247function jd_twitter_save_profile(){ 
    12271248    global $user_ID; 
     
    12411262    apply_filters( 'wpt_save_user', $edit_id, $_POST ); 
    12421263} 
     1264 
    12431265function jd_list_categories() { 
    12441266    $selected = ""; 
     
    12581280        foreach ($categories AS $cat) { 
    12591281            if (is_array($tweet_categories)) { 
    1260                 if (in_array($cat->term_id,$tweet_categories)) { 
     1282                if ( in_array( $cat->term_id,$tweet_categories ) ) { 
    12611283                    $selected = " checked=\"checked\""; 
    12621284                } else { 
     
    12851307add_action( 'admin_head', 'jd_addTwitterAdminStyles' ); 
    12861308function jd_addTwitterAdminStyles() { 
    1287     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" ) ) { 
     1309    if ( isset($_GET['page']) && ( $_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" ) ) { 
    12881310        echo '<link type="text/css" rel="stylesheet" href="'.plugins_url('/wp-to-twitter/styles.css').'" />'; 
    12891311    } 
     
    13531375    } 
    13541376} 
     1377add_action( 'wpt_schedule_promotion_action', 'wpt_schedule_promotion' ); 
     1378function wpt_schedule_promotion() { 
     1379    if ( !function_exists( 'wpt_pro_exists' ) && get_option( 'wpt_promotion_scheduled' ) == 1 ) { 
     1380        update_option( 'wpt_promotion_scheduled', 2 ); 
     1381    } 
     1382} 
     1383 
     1384function wpt_dismiss_promotion() { 
     1385    if ( isset($_GET['dismiss']) && $_GET['dismiss'] == 'promotion' ) { 
     1386        update_option( 'wpt_promotion_scheduled', 3 );  
     1387        delete_option( 'wpt_promotion_scheduled' ); 
     1388    } 
     1389}    
     1390wpt_dismiss_promotion();  
     1391 
     1392add_action( 'admin_notices', 'wpt_promotion_notice' ); 
     1393function wpt_promotion_notice() { 
     1394    if ( current_user_can( 'activate_plugins' ) && get_option( 'wpt_promotion_scheduled' ) == 2 ) { 
     1395        $upgrade = "http://www.joedolson.com/articles/wp-tweets-pro/"; 
     1396        $dismiss = admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php&dismiss=promotion'); 
     1397        echo "<div class='updated fade'><p>".sprintf( __("I hope you've enjoyed <strong>WP to Twitter</strong>! Take a look at <a href='%s'>upgrading to WP Tweets PRO</a> for advanced Tweeting with WordPress! <a href='%s'>Dismiss</a>",'wp-to-twitter'), $upgrade, $dismiss )."</p></div>"; 
     1398    } 
     1399} 
    13551400 
    13561401function wpt_twit_future( $id ) { 
     
    13821427    add_action( 'publish_phone', 'wpt_twit_xmlrpc' ); // to add later    
    13831428} 
    1384 if ( get_option('comment-published-update') == 1 ) { 
    1385     add_action( 'comment_post', 'jd_twit_comment', 10, 2 ); 
    1386 } 
     1429 
    13871430add_action( 'admin_menu', 'jd_addTwitterAdminPages' ); 
  • wp-to-twitter/trunk/wpt-functions.php

    r705719 r718938  
    33// These functions don't perform any WP to Twitter actions, but are sometimes called for when  
    44// support for primary functions is lacking. 
     5if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    56 
    67if ( version_compare( $wp_version,"2.9.3",">" )) { 
     
    143144} 
    144145 
     146/**  
     147* Gets the first attachment for the supplied post. 
     148*  
     149* @param type $post_ID The post ID 
     150* @return An Attachment ID. 
     151*/ 
     152function wpt_post_attachment($post_ID) { 
     153    if ( has_post_thumbnail( $post_ID ) ) { 
     154        $attachment = get_post_thumbnail_id( $post_ID ); 
     155        return $attachment; 
     156    } else { 
     157        $args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_status' => 'published', 'post_parent' => $post_ID, 'post_mime_type'=>'image' );  
     158        $attachments = get_posts($args); 
     159        if ($attachments) { 
     160            return $attachments[0]->ID; //Return the first attachment. 
     161        } else { 
     162            return null; 
     163        } 
     164    } 
     165} 
     166 
    145167function wpt_get_support_form() { 
    146168global $current_user, $wpt_version; 
  • wp-to-twitter/trunk/wpt_twitter_oauth.php

    r690784 r718938  
    88 
    99/* Load WPOAuth lib. You can find it at http://WPOAuth.net */ 
     10if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
     11 
    1012require_once('WP_OAuth.php'); 
     13/* Load tmhOAuth for Media uploads: https://github.com/themattharris/tmhOAuth */ 
     14require_once('tmhOAuth/tmhOAuth.php'); 
     15require_once('tmhOAuth/tmhUtilities.php'); 
    1116 
    1217if (!class_exists('jd_TwitterOAuth')) { 
     
    150155    return $response; 
    151156  }   
     157   
     158  
     159  /** 
     160   * Handles a status update that includes an image. 
     161   * @param type $url 
     162   * @param type $args 
     163   * @return boolean 
     164   */ 
     165  function handleMediaRequest($url, $args = array()) { 
     166        $tmhOAuth = new tmhOAuth(array( 
     167                'consumer_key'    => $this->consumer->key, 
     168                'consumer_secret' => $this->consumer->secret, 
     169                'user_token'      => $this->token->key, 
     170                'user_secret'     => $this->token->secret, 
     171        )); 
     172        $attachment = wpt_post_attachment($args['id']); 
     173        if ($attachment == null) return false; 
     174        $img_medium = wp_get_attachment_image_src($attachment,'medium'); 
     175        $image = ".." . wp_make_link_relative($img_medium[0]);          
     176         
     177        $code = $tmhOAuth->request( 
     178            'POST', 
     179             $url, 
     180             array( 
     181              'media[]'  => "@{$image};type=image/jpeg;filename={$image}", 
     182              'status'   => $args['status'], 
     183             ), 
     184             true, // use auth 
     185             true  // multipart 
     186        ); 
     187        $response = $tmhOAuth->response['response']; 
     188        if ( is_wp_error( $response ) ) return false; 
     189         
     190        $this->http_code = $code;  
     191        $this->last_api_call = $url; 
     192        $this->format = 'json';  
     193        $this->http_header = $response; 
     194    return $response; 
     195  } 
     196   
    152197  /** 
    153198   * Format and sign an WPOAuth / API request 
    154199   */ 
    155200  function WPOAuthRequest($url, $args = array(), $method = NULL) { 
     201   
     202    //Handle media requests using tmhOAuth library. 
     203    if ($method == 'MEDIA') { 
     204      return $this->handleMediaRequest($url,$args); 
     205    }     
     206   
    156207    if (empty($method)) $method = empty($args) ? "GET" : "POST"; 
    157208    $req = WPOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $args); 
Note: See TracChangeset for help on using the changeset viewer.