Plugin Directory

Changeset 355373


Ignore:
Timestamp:
03/04/2011 07:15:04 PM (15 years ago)
Author:
0xTC
Message:
 
Location:
wp-tweet-button/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-tweet-button/trunk/readme.txt

    r346653 r355373  
    33Tags: twitter, tweet button, retweet, tweet, autotweet, WP Tweet Button, advanced, tweeting, social media, button, SEO, share, shortener, awe.sm, b2l.me, bit.ly, cli.gs, sl.ly, snipr, su.pr, tinyurl, analytics, google analytics, campaign, campaign tracking, auto tweeting, auto posts
    44Requires at least: 2.7.2
    5 Tested up to: 3.0.5
     5Tested up to: 3.1
    66Stable tag: trunk
    77Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6331357
     
    124124== Changelog ==
    125125
     126= 2.0.4 =
     127* Addresses issue related to related users.
     128* Addresses issue related to Transposh Translation and short URLs.
     129* Addresses issue related to links on main blog page.
     130
    126131= 2.0.3.3 =
    127132* Addresses issue where a single shortlinks is generated and saved for all posts on the main page.
  • wp-tweet-button/trunk/wp-tweet-button.php

    r346653 r355373  
    22/*
    33Plugin Name: WP Tweet Button
    4 Version: 2.0.3.3
     4Version: 2.0.4
    55Plugin URI: http://0xtc.com/plugins/wp-tweet-button
    66Description: The WordPress implementation of the official Twitter Tweet Button.
     
    158158        );
    159159    /**
    160     * The following array is used to extract data about shorteners and
    161     * their configuration.
     160    * The following array contains information on shorteners and
     161    * their required configuration.
    162162    */
    163163    var $shortenerdata = array(
     
    282282    * Auto-tweet provider URL.
    283283    */
    284    
    285284    var $wptbsrv = 'http://wptbsrv.0xtc.com/a/';
    286285
     
    369368
    370369    /**
    371     * This function reads individual settings
     370    * This function returns individual settings during runtime
    372371    */
    373372    function tw_get_option($optionname){
     
    376375
    377376    /**
    378     * This function sets individual settings
     377    * This function sets individual settings during runtime
    379378    */
    380379    function tw_set_option($optionname=null, $value=null){
     
    440439    */
    441440    function tw_get_text($entitydecode=false){
    442         global $post;
    443441        if(is_int($this->postid)) {
    444442            $post = get_post($this->postid);
    445443        } else {
    446             $this->postid = $post->ID;
    447         }
    448        
     444            global $post;
     445        }       
    449446        if (get_post_meta($post->ID, '_twitterrelated_custom_text', true)){
    450447            if ($entitydecode){
     
    640637    /**
    641638    * This function sets the readyState when the title is displayed.
    642     * This prevents that the tweet button isn't rendered in the header area.
     639    * It prevents that the tweet button is rendered in the header area.
    643640    */
    644641    function tw_set_placement_ready($title){
     
    725722        }
    726723        $text = null;
    727         if (get_post_meta($post->ID, '_twitterrelated', true)){
    728                 $text = get_post_meta($post->ID, '_twitterrelated', true);
    729         } elseif (get_post_meta($post->ID, 'twitterrelated', true)){
    730                 $text = get_post_meta($post->ID, 'twitterrelated', true);
     724        if  (get_post_meta($post->ID, '_twitterrelated', true)) {
     725                $text = ($urenc) ? urlencode(get_post_meta($post->ID, '_twitterrelated', true)) : get_post_meta($post->ID, '_twitterrelated', true);
     726                $text = str_replace('%2C','%E2%80%9A',$text);
     727                $text = str_replace('+','%20',$text);
     728                $text = str_replace('%3A',':',$text);
     729        } elseif
     730            (get_post_meta($post->ID, 'twitterrelated', true)){
     731                $text = ($urenc) ? urlencode(get_post_meta($post->ID, 'twitterrelated', true)) : get_post_meta($post->ID, 'twitterrelated', true);
    731732        } else {
    732733            if ($this->tw_get_option('tw_rec')) {
     
    746747        } else {
    747748            global $post;
    748             $this->postid = $post->ID;
    749749        }
    750750        $textprefix = null;
     
    777777        }
    778778        if ($this->tw_get_option('tw_url_samecount')=='1'){
    779             $button_data_counturl = 'data-counturl="'.$this->tw_get_long_url(false). '"';
     779            $button_data_counturl = 'data-counturl="'.$this->tw_get_long_url(false, false). '"';
    780780        } else {
    781781            $button_data_counturl=null;
     
    793793        } else {
    794794            global $post;
    795             $this->postid = $post->ID;
    796795        }
    797796        $textprefix =null;
     
    814813        }
    815814        if ($this->tw_get_option('tw_url_samecount')=='1'){
    816             $button .= '&counturl='.urlencode($this->tw_get_long_url(false));
     815            $button .= '&counturl='.urlencode($this->tw_get_long_url(false, false));
    817816        }
    818817        return $button;
     
    867866    */
    868867    //  hook: wp_tweet_button_long_url
    869     function tw_get_long_url($addtrack=false) {
     868    function tw_get_long_url($addtrack=false, $addlang=true) {
    870869        global $my_transposh_plugin;
    871870   
     
    882881        }
    883882       
    884         if (is_object($my_transposh_plugin)){
     883        if (is_object($my_transposh_plugin) && $addlang){
    885884            if ($my_transposh_plugin->target_language) {
    886885                $perms= transposh_utils::rewrite_url_lang_param($perms, $my_transposh_plugin->home_url, $my_transposh_plugin->enable_permalinks_rewrite, $my_transposh_plugin->target_language, $my_transposh_plugin->edit_mode);
     
    918917    // hook: wp_tweet_button_url
    919918    function tw_get_short_url() {
    920         global $post;
    921         $this->postid = $post->ID;
     919        global $my_transposh_plugin;
     920        if(is_int($this->postid)) {
     921            $post = get_post($this->postid);
     922        } else {
     923            global $post;
     924        }
    922925        $perms = $this->tw_get_long_url(true);
    923926        if ($perms == false) return false;
     
    970973            }
    971974
    972             if (($selectedshortener != get_post_meta($post->ID, '_activeshortener',true)) ||
    973                 (md5($perms) != get_post_meta($post->ID, '_twitterrelated_short_urlHash',true))) {
    974                 if (!(strstr($request_url,'http://' . $_SERVER['SERVER_NAME'])) && ($request_url != '')){
    975                     $fetch_url = trim($this->tw_nav_browse($request_url, $method, $POST_data));
     975            if (is_object($my_transposh_plugin)){
     976                if ($my_transposh_plugin->target_language) {
     977                    $langext = null;
     978                    $langext = $my_transposh_plugin->target_language;
     979                    $langarr = get_post_meta($post->ID, '_twitterrelated_short_url_lang',true);
     980                    if (!is_array($langarr)) $langarr =  array();
     981                    if (
     982                    //  ($selectedshortener.'_'.$langext != get_post_meta($post->ID, '_activeshortener',true)) ||
     983                        (md5($perms) != $langarr[$langext]['hash'])) {
     984                        if ($langext){
     985                            if (!(strstr($request_url,'http://' . $_SERVER['SERVER_NAME'])) && ($request_url != '')){
     986                                $fetch_url = trim($this->tw_nav_browse($request_url, $method, $POST_data));
     987                            }
     988                            $langarr[$langext]['url'] = $fetch_url;
     989                            $langarr[$langext]['hash'] = md5($perms);
     990                            if ( !empty( $fetch_url ) && ($fetch_url != $perms) && strstr($fetch_url,'http://') && (!strstr($perms,'preview=true'))) {
     991                                if (!update_post_meta($post->ID, '_activeshortener', $selectedshortener . '_'. $langext)) {
     992                                    add_post_meta($post->ID, '_activeshortener', $selectedshortener . '_'. $langext);
     993                                }
     994                                if (!update_post_meta($post->ID, '_twitterrelated_short_url_lang', $langarr)) {
     995                                    add_post_meta($post->ID, '_twitterrelated_short_url_lang', $langarr);
     996                                }
     997                            }
     998                        }
     999                    } else {
     1000                        $fetch_url = $langarr[$langext]['url'];
     1001                        if ($fetch_url ==''){
     1002                            $fetch_url = $perms;
     1003                        }
     1004                    }
    9761005                }
    977                 if ( !empty( $fetch_url ) && ($fetch_url != $perms) && strstr($fetch_url,'http://') && (!strstr($perms,'preview=true'))) {
    978                     if (!update_post_meta($post->ID, '_activeshortener', $selectedshortener )) {
    979                         add_post_meta($post->ID, '_activeshortener', $selectedshortener);
     1006            } else {
     1007                if (($selectedshortener != get_post_meta($post->ID, '_activeshortener',true)) ||
     1008                    (md5($perms) != get_post_meta($post->ID, '_twitterrelated_short_urlHash',true))) {
     1009                    if (!(strstr($request_url,'http://' . $_SERVER['SERVER_NAME'])) && ($request_url != '')){
     1010                        $fetch_url = trim($this->tw_nav_browse($request_url, $method, $POST_data));
    9801011                    }
    981                     if (!update_post_meta($post->ID, '_twitterrelated_short_url', $fetch_url)) {
    982                         add_post_meta($post->ID, '_twitterrelated_short_url', $fetch_url);
    983                     }
    984                     if (!update_post_meta($post->ID, '_twitterrelated_short_urlHash', md5($perms))) {
    985                         add_post_meta($post->ID, '_twitterrelated_short_urlHash', md5($perms));
     1012                    if ( !empty( $fetch_url ) && ($fetch_url != $perms) && strstr($fetch_url,'http://') && (!strstr($perms,'preview=true'))) {
     1013                        if (!update_post_meta($post->ID, '_activeshortener', $selectedshortener )) {
     1014                            add_post_meta($post->ID, '_activeshortener', $selectedshortener);
     1015                        }
     1016                        if (!update_post_meta($post->ID, '_twitterrelated_short_url', $fetch_url)) {
     1017                            add_post_meta($post->ID, '_twitterrelated_short_url', $fetch_url);
     1018                        }
     1019                        if (!update_post_meta($post->ID, '_twitterrelated_short_urlHash', md5($perms))) {
     1020                            add_post_meta($post->ID, '_twitterrelated_short_urlHash', md5($perms));
     1021                        }
    9861022                    }
    9871023                } else {
    988 //                  $fetch_url = $perms;
    989                 }
    990             } else {
    991                 $fetch_url = get_post_meta($post->ID, '_twitterrelated_short_url',true);
    992                 if ($fetch_url ==''){
    993                     $fetch_url = $perms;
     1024                    $fetch_url = get_post_meta($post->ID, '_twitterrelated_short_url'.$langext,true);
     1025                    if ($fetch_url ==''){
     1026                        $fetch_url = $perms;
     1027                    }
    9941028                }
    9951029            }
     
    10321066
    10331067        $button =   '<div class="tw_button"'.$StyleStrDiv.'>';
    1034         $button .=  '<a href="http://twitter.com/share'.$this->tw_build_options($bwdata).'" class="twitter-share-button" target="_blank" ' . $data . $relstr . $StyleStrBtn.'>'.$tw_text.'</a>';
     1068        $button .=  '<a href="http://twitter.com/share'.$this->tw_build_options($bwdata).'" class="twitter-share-button" ' . $data . $relstr . $StyleStrBtn.'>'.$tw_text.'</a>';
    10351069        $button .=  '</div>';
    10361070        $button = apply_filters( 'wp_tweet_button', $button );
     
    10971131    */
    10981132    function tweetbutton($post,$bwdata=false) {
     1133        global $post;
     1134        $post = get_post($this->postid);
     1135        $this->postid = $post->ID;
    10991136        if (isset($post->ID)){
    11001137            if (get_post_meta($post->ID, '_exclude_tweet_button', true)){
     
    17231760            if ($_POST['tw_clear_short_cache_post'] == '1') {
    17241761                delete_post_meta($thepost->ID, '_twitterrelated_short_url');
     1762                delete_post_meta($thepost->ID, '_twitterrelated_short_url_lang');
    17251763                delete_post_meta($thepost->ID, '_twitterrelated_short_urlHash');
    17261764                delete_post_meta($thepost->ID, '_activeshortener');
     
    17681806            $thepost = $post_id;
    17691807            $this->postid = $thepost->ID;
    1770         }
    1771        
     1808        }               
    17721809        if ($thepost->post_type == 'revision' || ($thepost->post_status != 'publish' && $thepost->post_status != 'future') || $thepost->post_password != '' ) return false;
    17731810        if (
     
    20062043
    20072044/**
    2008 * Other things...and stuff...
    2009 */
    2010 /**
    20112045* Class, exciting and new. Create one or even a few. Bugs, a coder's reward. Ruins flow and it comes back to you. Wordpress, soon will be making another run and Wordpress promises something for everyone....
    20122046*/ 
     
    20142048load_plugin_textdomain($wpTweetButton->txtdom,null,dirname( plugin_basename( __FILE__ ) ).'/lang/');
    20152049register_activation_hook( __FILE__, array(&$wpTweetButton, 'tw_activate'));
    2016 
    20172050?>
Note: See TracChangeset for help on using the changeset viewer.