Version Description
- added the ability to leave off the
via @YourTwitterName
on a tweet-by-tweet basis. - complete overhaul of the javascript file to enable that functionality without having to mess with hand-coding the shortcode.
Download this release
Release Info
Developer | ben.meredith@gmail.com |
Plugin | Better Click To Tweet |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.1
- assets/js/bctt_clicktotweet_plugin.js +57 -4
- bctt_options.php +2 -2
- better-click-to-tweet.php +10 -9
- readme.txt +10 -1
assets/js/bctt_clicktotweet_plugin.js
CHANGED
@@ -5,8 +5,9 @@
|
|
5 |
title: 'Add Tweetable Text',
|
6 |
image: url.replace("/js", "") + '/img/birdy_button.png',
|
7 |
onclick: function() {
|
8 |
-
|
9 |
-
|
|
|
10 |
}
|
11 |
});
|
12 |
},
|
@@ -19,9 +20,61 @@
|
|
19 |
author: 'Ben Meredith',
|
20 |
authorurl: 'http://benandjacq.com/',
|
21 |
infourl: 'http://benandjacq.com/better-click-to-tweet',
|
22 |
-
version: "
|
23 |
};
|
24 |
}
|
25 |
});
|
26 |
tinymce.PluginManager.add('bctt_clicktotweet', tinymce.plugins.bctt_clicktotweet);
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
title: 'Add Tweetable Text',
|
6 |
image: url.replace("/js", "") + '/img/birdy_button.png',
|
7 |
onclick: function() {
|
8 |
+
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
|
9 |
+
W = W - 10;
|
10 |
+
tb_show( 'Better Click To Tweet Shortcode Generator', '#TB_inline?width=' + W + '&height=auto' + '&inlineId=bctt-form' );
|
11 |
}
|
12 |
});
|
13 |
},
|
20 |
author: 'Ben Meredith',
|
21 |
authorurl: 'http://benandjacq.com/',
|
22 |
infourl: 'http://benandjacq.com/better-click-to-tweet',
|
23 |
+
version: "2.0"
|
24 |
};
|
25 |
}
|
26 |
});
|
27 |
tinymce.PluginManager.add('bctt_clicktotweet', tinymce.plugins.bctt_clicktotweet);
|
28 |
+
|
29 |
+
|
30 |
+
jQuery(function(){
|
31 |
+
// creates a form to be displayed everytime the button is clicked
|
32 |
+
var form = jQuery('<div id="bctt-form"><table id="bctt-table" class="form-table">\
|
33 |
+
<tr>\
|
34 |
+
<th><label for="bctt-tweet">Tweetable Quote</label></th>\
|
35 |
+
<td><p><textarea cols="70" id="bctt-tweet" name="tweet" /></p>\
|
36 |
+
<small>Enter the Tweet. Text will be automatically truncated to provide space for the link back to the post and (optional) your Twitter user name. </small></td>\
|
37 |
+
</tr>\
|
38 |
+
<tr>\
|
39 |
+
<th><label for="bctt-via">Include "via"?</label></th>\
|
40 |
+
<td><p><input type="radio" name="viamark" id="via" value="yes" checked />Yes\
|
41 |
+
<input type="radio" name="viamark" id="via" value="no" />No</br /></p>\
|
42 |
+
<small>Do you wand to add \"via @YourTwitterName\" to this tweet?</small></td>\
|
43 |
+
</tr>\
|
44 |
+
</table>\
|
45 |
+
<p class="submit">\
|
46 |
+
<input type="button" id="bctt-submit" class="button-primary" value="Insert Tweet" name="submit" />\
|
47 |
+
</p>\
|
48 |
+
</div>');
|
49 |
+
|
50 |
+
var table = form.find('table');
|
51 |
+
form.appendTo('body').hide();
|
52 |
+
|
53 |
+
// handles the click event of the submit button
|
54 |
+
form.find('#bctt-submit').click(function(){
|
55 |
+
// defines the options and their default values
|
56 |
+
|
57 |
+
var shortcode = '[bctt';
|
58 |
+
|
59 |
+
var value = table.find('#bctt-tweet').val();
|
60 |
+
|
61 |
+
if ( value != '' ) {
|
62 |
+
shortcode += ' tweet="' + value + '"';
|
63 |
+
}
|
64 |
+
|
65 |
+
var viaChoice = table.find('input[name="viamark"]:checked').val();
|
66 |
+
|
67 |
+
if ( viaChoice == "no" ) {
|
68 |
+
shortcode += ' via="no"';
|
69 |
+
}
|
70 |
+
|
71 |
+
shortcode += ']';
|
72 |
+
|
73 |
+
// inserts the shortcode into the active editor
|
74 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
|
75 |
+
|
76 |
+
// closes Thickbox
|
77 |
+
tb_remove();
|
78 |
+
});
|
79 |
+
});
|
80 |
+
})();
|
bctt_options.php
CHANGED
@@ -40,8 +40,8 @@ function bctt_admin_menu() {
|
|
40 |
}
|
41 |
|
42 |
function bctt_register_settings() {
|
43 |
-
register_setting('bctt_clicktotweet-options', 'bctt-twitter-handle', 'bctt_validate_settings');
|
44 |
-
|
45 |
}
|
46 |
|
47 |
function bctt_validate_settings($input) {
|
40 |
}
|
41 |
|
42 |
function bctt_register_settings() {
|
43 |
+
register_setting( 'bctt_clicktotweet-options', 'bctt-twitter-handle', 'bctt_validate_settings');
|
44 |
+
register_setting( 'bctt_clicktotweet-options', 'bctt-short-url', 'bctt_validate_checkbox' );
|
45 |
}
|
46 |
|
47 |
function bctt_validate_settings($input) {
|
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.
|
6 |
Author: Ben Meredith
|
7 |
Author URI: http://benandjacq.com
|
8 |
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
@@ -29,16 +29,17 @@ function bctt_shorten( $input, $length, $ellipsis = true, $strip_html = true ) {
|
|
29 |
return $trimmed_text;
|
30 |
};
|
31 |
|
32 |
-
function bctt_shortcode( $atts
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
36 |
} else {
|
37 |
-
$handle_code =
|
38 |
}
|
39 |
-
extract( shortcode_atts( array(
|
40 |
-
'tweet' => '$content'
|
41 |
-
), $atts ) );
|
42 |
$text = $tweet;
|
43 |
if ( get_option('bctt-short-url') != false ) {
|
44 |
$bcttURL = wp_get_shortlink();
|
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/
|
29 |
return $trimmed_text;
|
30 |
};
|
31 |
|
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' ) {
|
39 |
+
$handle_code = "&via=" . $handle . "&related=" . $handle;
|
40 |
} else {
|
41 |
+
$handle_code = '';
|
42 |
}
|
|
|
|
|
|
|
43 |
$text = $tweet;
|
44 |
if ( get_option('bctt-short-url') != false ) {
|
45 |
$bcttURL = wp_get_shortlink();
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -50,6 +50,8 @@ Better Click To Tweet enables you to create beautiful Click To Tweet boxes in yo
|
|
50 |
|
51 |
Then, wherever you want to insert a Click to Tweet quote, use a shortcode in the format `[bctt tweet="xxxxxxxxxxxx"]` replacing the xxxxxxx with your tweetable quote.
|
52 |
|
|
|
|
|
53 |
In the visual editor, you can click the blue birdy icon in the toolbar and a correctly formatted shortcode will be inserted in your text. For more info or clarifications, start a [support thread](https://wordpress.org/support/plugin/better-click-to-tweet "support forum"). I'll actively answer.
|
54 |
|
55 |
= How does the URL shortener functionality work? =
|
@@ -95,6 +97,10 @@ I want to maximize the usefulness of this plugin by translating it into multiple
|
|
95 |
|
96 |
== Changelog ==
|
97 |
|
|
|
|
|
|
|
|
|
98 |
= 3.0 =
|
99 |
* added option to use WordPress shortlink in place of full URL.
|
100 |
* further refinement of the math used in calculating tweet truncation length.
|
@@ -132,6 +138,9 @@ I want to maximize the usefulness of this plugin by translating it into multiple
|
|
132 |
|
133 |
== Upgrade Notice ==
|
134 |
|
|
|
|
|
|
|
135 |
= 2.0.3 =
|
136 |
* CSS update for "Click to Tweet" text being underlined in some themes.
|
137 |
|
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 |
|
50 |
|
51 |
Then, wherever you want to insert a Click to Tweet quote, use a shortcode in the format `[bctt tweet="xxxxxxxxxxxx"]` replacing the xxxxxxx with your tweetable quote.
|
52 |
|
53 |
+
As of version 3.1, you can leave off the "via @YourHandle" on a tweet-by-tweet basis by including using a shortcode in the format of `[bctt tweet="xxxxxxxxxxx" via="no"]`
|
54 |
+
|
55 |
In the visual editor, you can click the blue birdy icon in the toolbar and a correctly formatted shortcode will be inserted in your text. For more info or clarifications, start a [support thread](https://wordpress.org/support/plugin/better-click-to-tweet "support forum"). I'll actively answer.
|
56 |
|
57 |
= How does the URL shortener functionality work? =
|
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.
|
103 |
+
|
104 |
= 3.0 =
|
105 |
* added option to use WordPress shortlink in place of full URL.
|
106 |
* further refinement of the math used in calculating tweet truncation length.
|
138 |
|
139 |
== Upgrade Notice ==
|
140 |
|
141 |
+
= 3.1 =
|
142 |
+
* Added ability to leave off the via @YourTwitterName
|
143 |
+
|
144 |
= 2.0.3 =
|
145 |
* CSS update for "Click to Tweet" text being underlined in some themes.
|
146 |
|