Changeset 355373
- Timestamp:
- 03/04/2011 07:15:04 PM (15 years ago)
- Location:
- wp-tweet-button/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wp-tweet-button.php (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-tweet-button/trunk/readme.txt
r346653 r355373 3 3 Tags: 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 4 4 Requires at least: 2.7.2 5 Tested up to: 3. 0.55 Tested up to: 3.1 6 6 Stable tag: trunk 7 7 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6331357 … … 124 124 == Changelog == 125 125 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 126 131 = 2.0.3.3 = 127 132 * 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 2 2 /* 3 3 Plugin Name: WP Tweet Button 4 Version: 2.0. 3.34 Version: 2.0.4 5 5 Plugin URI: http://0xtc.com/plugins/wp-tweet-button 6 6 Description: The WordPress implementation of the official Twitter Tweet Button. … … 158 158 ); 159 159 /** 160 * The following array is used to extract data aboutshorteners and161 * their configuration.160 * The following array contains information on shorteners and 161 * their required configuration. 162 162 */ 163 163 var $shortenerdata = array( … … 282 282 * Auto-tweet provider URL. 283 283 */ 284 285 284 var $wptbsrv = 'http://wptbsrv.0xtc.com/a/'; 286 285 … … 369 368 370 369 /** 371 * This function re ads individual settings370 * This function returns individual settings during runtime 372 371 */ 373 372 function tw_get_option($optionname){ … … 376 375 377 376 /** 378 * This function sets individual settings 377 * This function sets individual settings during runtime 379 378 */ 380 379 function tw_set_option($optionname=null, $value=null){ … … 440 439 */ 441 440 function tw_get_text($entitydecode=false){ 442 global $post;443 441 if(is_int($this->postid)) { 444 442 $post = get_post($this->postid); 445 443 } else { 446 $this->postid = $post->ID; 447 } 448 444 global $post; 445 } 449 446 if (get_post_meta($post->ID, '_twitterrelated_custom_text', true)){ 450 447 if ($entitydecode){ … … 640 637 /** 641 638 * This function sets the readyState when the title is displayed. 642 * This prevents that the tweet button isn'trendered in the header area.639 * It prevents that the tweet button is rendered in the header area. 643 640 */ 644 641 function tw_set_placement_ready($title){ … … 725 722 } 726 723 $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); 731 732 } else { 732 733 if ($this->tw_get_option('tw_rec')) { … … 746 747 } else { 747 748 global $post; 748 $this->postid = $post->ID;749 749 } 750 750 $textprefix = null; … … 777 777 } 778 778 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). '"'; 780 780 } else { 781 781 $button_data_counturl=null; … … 793 793 } else { 794 794 global $post; 795 $this->postid = $post->ID;796 795 } 797 796 $textprefix =null; … … 814 813 } 815 814 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)); 817 816 } 818 817 return $button; … … 867 866 */ 868 867 // hook: wp_tweet_button_long_url 869 function tw_get_long_url($addtrack=false ) {868 function tw_get_long_url($addtrack=false, $addlang=true) { 870 869 global $my_transposh_plugin; 871 870 … … 882 881 } 883 882 884 if (is_object($my_transposh_plugin) ){883 if (is_object($my_transposh_plugin) && $addlang){ 885 884 if ($my_transposh_plugin->target_language) { 886 885 $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); … … 918 917 // hook: wp_tweet_button_url 919 918 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 } 922 925 $perms = $this->tw_get_long_url(true); 923 926 if ($perms == false) return false; … … 970 973 } 971 974 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 } 976 1005 } 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)); 980 1011 } 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 } 986 1022 } 987 1023 } 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 } 994 1028 } 995 1029 } … … 1032 1066 1033 1067 $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>'; 1035 1069 $button .= '</div>'; 1036 1070 $button = apply_filters( 'wp_tweet_button', $button ); … … 1097 1131 */ 1098 1132 function tweetbutton($post,$bwdata=false) { 1133 global $post; 1134 $post = get_post($this->postid); 1135 $this->postid = $post->ID; 1099 1136 if (isset($post->ID)){ 1100 1137 if (get_post_meta($post->ID, '_exclude_tweet_button', true)){ … … 1723 1760 if ($_POST['tw_clear_short_cache_post'] == '1') { 1724 1761 delete_post_meta($thepost->ID, '_twitterrelated_short_url'); 1762 delete_post_meta($thepost->ID, '_twitterrelated_short_url_lang'); 1725 1763 delete_post_meta($thepost->ID, '_twitterrelated_short_urlHash'); 1726 1764 delete_post_meta($thepost->ID, '_activeshortener'); … … 1768 1806 $thepost = $post_id; 1769 1807 $this->postid = $thepost->ID; 1770 } 1771 1808 } 1772 1809 if ($thepost->post_type == 'revision' || ($thepost->post_status != 'publish' && $thepost->post_status != 'future') || $thepost->post_password != '' ) return false; 1773 1810 if ( … … 2006 2043 2007 2044 /** 2008 * Other things...and stuff...2009 */2010 /**2011 2045 * 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.... 2012 2046 */ … … 2014 2048 load_plugin_textdomain($wpTweetButton->txtdom,null,dirname( plugin_basename( __FILE__ ) ).'/lang/'); 2015 2049 register_activation_hook( __FILE__, array(&$wpTweetButton, 'tw_activate')); 2016 2017 2050 ?>
Note: See TracChangeset
for help on using the changeset viewer.