WordPress.org

Plugin Directory

Changeset 598486


Ignore:
Timestamp:
09/13/12 14:18:40 (19 months ago)
Author:
Otto42
Message:

entity fix from markjaquith, add fullurl for people who want it

File:
1 edited

Legend:

Unmodified
Added
Removed
  • simple-twitter-connect/trunk/stc-publish.php

    r414269 r598486  
    171171} 
    172172 
     173function stc_publish_send_tweet($status) { 
     174    $options = get_option('stc_options'); 
     175    $args=array(); 
     176    $args['status'] = $status; 
     177    $args['acc_token'] = $options['autotweet_token']; 
     178    $args['acc_secret'] = $options['autotweet_secret'];  
     179    $args = apply_filters('stc_publish_send_tweet', $args ); 
     180    $resp = stc_do_request('http://api.twitter.com/1/statuses/update',$args); 
     181} 
     182 
    173183function stc_get_default_tweet($id) { 
    174184    $options = get_option('stc_options'); 
     
    179189        $link = wp_get_shortlink($id); 
    180190    } 
     191    $fulllink = get_permalink($id); 
    181192     
    182193    if (empty($link)) { 
    183194        // no shortlink, try the full permalink 
    184         $link = get_permalink($id); 
     195        $link = $fulllink; 
    185196    } 
    186197     
     
    188199 
    189200    $output = $options['publish_text']; 
    190     $title = str_replace(' ',' ',get_the_title($id) );  
     201    $title = str_replace(' ',' ',get_the_title($id) ); 
    191202    $output = str_replace('%title%', $title, $output ); 
    192203    $output = str_replace('%url%', $link, $output ); 
    193  
     204     
     205    // fullurl added to stop some complaints. But it doesn't work well if your tweet becomes longer than 140. I do not recommend using it. 
     206    $output = str_replace('%fullurl%', $fulllink, $output ); 
     207 
     208    // decode html entities (although twitter's website displays them fine, some twitter clients don't) 
     209    $output = html_entity_decode( $output, ENT_QUOTES, 'UTF-8' ); 
     210     
    194211    $output = apply_filters('stc_publish_text', $output, $id); 
    195212 
    196213    return $output; 
    197214} 
     215 
     216// strip tags added as a filter because some people want to remove this filter sometimes 
    198217add_filter('stc_publish_text','strip_tags'); 
    199218 
Note: See TracChangeset for help on using the changeset viewer.