Better Click To Tweet - Version 3.2

Version Description

  • 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)
  • code modifications for clarity.
Download this release

Release Info

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

Code changes from version 3.1 to 3.2

Files changed (2) hide show
  1. better-click-to-tweet.php +15 -10
  2. readme.txt +8 -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.1
6
  Author: Ben Meredith
7
  Author URI: http://benandjacq.com
8
  Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
@@ -32,7 +32,8 @@ function bctt_shorten( $input, $length, $ellipsis = true, $strip_html = true ) {
32
  function bctt_shortcode( $atts ) {
33
  extract( shortcode_atts( array(
34
  'tweet' => '',
35
- 'via' => 'true',
 
36
  ), $atts ) );
37
  $handle = get_option( 'bctt-twitter-handle' );
38
  if ( !empty( $handle ) && $via != 'no' ) {
@@ -41,17 +42,21 @@ function bctt_shortcode( $atts ) {
41
  $handle_code = '';
42
  }
43
  $text = $tweet;
44
- if ( get_option('bctt-short-url') != false ) {
45
- $bcttURL = wp_get_shortlink();
46
- }
47
- else {
48
- $bcttURL = get_permalink();
49
- }
 
 
 
 
50
  $bcttBttn = sprintf( __( 'Click To Tweet', 'better-click-to-tweet' ) );
51
  $short = bctt_shorten( $text, ( 117 - (6 + mb_strlen( $handle ) ) ) );
52
  if ( !is_feed() ) {
53
- return "<div class='bctt-click-to-tweet'><span class='bctt-ctt-text'><a href='https://twitter.com/intent/tweet?text=".urlencode($short).$handle_code."&url=".$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 {
54
- return "<hr /><p><em>".$short."</em><br /><a href='https://twitter.com/intent/tweet?text=".urlencode($short).$handle_code."&url=".$bcttURL."' target='_blank' class='bctt-ctt-btn'>".$bcttBttn."</a><br /><hr />";
55
  };
56
  }
57
 
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/
32
  function bctt_shortcode( $atts ) {
33
  extract( shortcode_atts( array(
34
  'tweet' => '',
35
+ 'via' => 'yes',
36
+ 'url' => 'yes',
37
  ), $atts ) );
38
  $handle = get_option( 'bctt-twitter-handle' );
39
  if ( !empty( $handle ) && $via != 'no' ) {
42
  $handle_code = '';
43
  }
44
  $text = $tweet;
45
+ if( $url != 'no' ){
46
+ if ( get_option('bctt-short-url') != false ) {
47
+ $bcttURL = '&url=' . wp_get_shortlink();
48
+ }
49
+ else {
50
+ $bcttURL = '&url=' . get_permalink();
51
+ }
52
+ } else {
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 />";
60
  };
61
  }
62
 
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -97,6 +97,10 @@ I want to maximize the usefulness of this plugin by translating it into multiple
97
 
98
  == Changelog ==
99
 
 
 
 
 
100
  = 3.1 =
101
  * added the ability to leave off the `via @YourTwitterName` on a tweet-by-tweet basis.
102
  * complete overhaul of the javascript file to enable that functionality without having to mess with hand-coding the shortcode.
@@ -138,6 +142,9 @@ I want to maximize the usefulness of this plugin by translating it into multiple
138
 
139
  == Upgrade Notice ==
140
 
 
 
 
141
  = 3.1 =
142
  * Added ability to leave off the via @YourTwitterName
143
 
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
 
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.
103
+
104
  = 3.1 =
105
  * added the ability to leave off the `via @YourTwitterName` on a tweet-by-tweet basis.
106
  * complete overhaul of the javascript file to enable that functionality without having to mess with hand-coding the shortcode.
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
+
148
  = 3.1 =
149
  * Added ability to leave off the via @YourTwitterName
150