Better Click To Tweet - Version 3.2.1

Version Description

  • fixed the truncation math given the new options to remove the url (as of 3.2) and via (as of 3.1), to correctly get back all those lost characters.
Download this release

Release Info

Developer ben.meredith@gmail.com
Plugin Icon 128x128 Better Click To Tweet
Version 3.2.1
Comparing to
See all releases

Code changes from version 3.2 to 3.2.1

Files changed (2) hide show
  1. better-click-to-tweet.php +17 -3
  2. readme.txt +7 -1
better-click-to-tweet.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: Better Click To Tweet
4
Description: The only Click To Tweet plugin to add translation support. The only Click To Tweet plugin to take into account your Twitter username's length in truncating long tweets, or to correctly take into account non-Roman characters. Simply put, as Click To Tweet plugins go, this one is, well, BETTER.
5
- Version: 3.2
6
Author: Ben Meredith
7
Author URI: http://benandjacq.com
8
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
@@ -35,12 +35,21 @@ function bctt_shortcode( $atts ) {
35
'via' => 'yes',
36
'url' => 'yes',
37
), $atts ) );
38
- $handle = get_option( 'bctt-twitter-handle' );
39
if ( !empty( $handle ) && $via != 'no' ) {
40
$handle_code = "&via=" . $handle . "&related=" . $handle;
41
} else {
42
$handle_code = '';
43
}
44
$text = $tweet;
45
if( $url != 'no' ){
46
if ( get_option('bctt-short-url') != false ) {
@@ -53,7 +62,12 @@ function bctt_shortcode( $atts ) {
53
$bcttURL = '';
54
}
55
$bcttBttn = sprintf( __( 'Click To Tweet', 'better-click-to-tweet' ) );
56
- $short = bctt_shorten( $text, ( 117 - (6 + mb_strlen( $handle ) ) ) );
57
if ( !is_feed() ) {
58
return "<div class='bctt-click-to-tweet'><span class='bctt-ctt-text'><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL."' target='_blank'>".$short."</a></span><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . "&url=" . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a></div>";} else {
59
return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a><br /><hr />";
2
/*
3
Plugin Name: Better Click To Tweet
4
Description: The only Click To Tweet plugin to add translation support. The only Click To Tweet plugin to take into account your Twitter username's length in truncating long tweets, or to correctly take into account non-Roman characters. Simply put, as Click To Tweet plugins go, this one is, well, BETTER.
5
+ Version: 3.2.1
6
Author: Ben Meredith
7
Author URI: http://benandjacq.com
8
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
35
'via' => 'yes',
36
'url' => 'yes',
37
), $atts ) );
38
+ $handle = get_option( 'bctt-twitter-handle' );
39
+ $handle_length = ( 6 + mb_strlen($handle));
40
+
41
if ( !empty( $handle ) && $via != 'no' ) {
42
$handle_code = "&via=" . $handle . "&related=" . $handle;
43
} else {
44
$handle_code = '';
45
}
46
+
47
+ if( $via != 'yes') {
48
+ $handle = '';
49
+ $handle_code = '';
50
+ $handle_length = 0;
51
+ }
52
+
53
$text = $tweet;
54
if( $url != 'no' ){
55
if ( get_option('bctt-short-url') != false ) {
62
$bcttURL = '';
63
}
64
$bcttBttn = sprintf( __( 'Click To Tweet', 'better-click-to-tweet' ) );
65
+ if( $url != 'no'){
66
+ $short = bctt_shorten( $text, ( 117 - ( $handle_length ) ) );
67
+ }
68
+ else {
69
+ $short = bctt_shorten( $text, ( 140 - ( $handle_length ) ) );
70
+ }
71
if ( !is_feed() ) {
72
return "<div class='bctt-click-to-tweet'><span class='bctt-ctt-text'><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL."' target='_blank'>".$short."</a></span><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . "&url=" . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a></div>";} else {
73
return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . urlencode($short) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'>" . $bcttBttn . "</a><br /><hr />";
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
Tags: click to tweet, twitter, tweet, twitter plugin, Twitter boxes, share, social media, post, posts, plugin, auto post, bitly, bit.ly, yourls, yourls.org
5
Requires at least: 3.8
6
Tested up to: 4.1
7
- Stable tag: 3.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -97,6 +97,9 @@ I want to maximize the usefulness of this plugin by translating it into multiple
97
98
== Changelog ==
99
100
= 3.2 =
101
* added the ability to leave off the url on a tweet-by-tweet basis (handwritten shortcodes only, the visual editor will not show it as an option on the popup window)
102
* code modifications for clarity.
@@ -142,6 +145,9 @@ I want to maximize the usefulness of this plugin by translating it into multiple
142
143
== Upgrade Notice ==
144
145
= 3.2 =
146
* added the ability to leave off the url on a tweet-by-tweet basis (handwritten shortcodes only, the visual editor will not show it as an option on the popup window)
147
4
Tags: click to tweet, twitter, tweet, twitter plugin, Twitter boxes, share, social media, post, posts, plugin, auto post, bitly, bit.ly, yourls, yourls.org
5
Requires at least: 3.8
6
Tested up to: 4.1
7
+ Stable tag: 3.2.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
97
98
== Changelog ==
99
100
+ = 3.2.1 =
101
+ * fixed the truncation math given the new options to remove the url (as of 3.2) and via (as of 3.1), to correctly get back all those lost characters.
102
+
103
= 3.2 =
104
* added the ability to leave off the url on a tweet-by-tweet basis (handwritten shortcodes only, the visual editor will not show it as an option on the popup window)
105
* code modifications for clarity.
145
146
== Upgrade Notice ==
147
148
+ = 3.2.1 =
149
+ * fixed the truncation math given the new options to remove the url (as of 3.2) and via (as of 3.1), to correctly get back all those lost characters.
150
+
151
= 3.2 =
152
* added the ability to leave off the url on a tweet-by-tweet basis (handwritten shortcodes only, the visual editor will not show it as an option on the popup window)
153