Version Description
- updated the tweet length math to correctly parse text with non-standard characters. Thanks to WordPress forum user zachop at https://wordpress.org/support/topic/incorrect-handling-length-count-of-multi-byte-strings for the tip.
- various code cleanup issues, to make my code more readable and complaint with WordPress standards.
Download this release
Release Info
Developer | ben.meredith@gmail.com |
Plugin | Better Click To Tweet |
Version | 1.0 |
Comparing to | |
See all releases |
Code changes from version 0.4 to 1.0
- better-click-to-tweet.php +4 -4
- readme.txt +5 -1
better-click-to-tweet.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Better Click To Tweet
|
4 |
Description: Add click to tweet boxes to your WordPress posts, easily. This is a new, fully renovated version of the late "Click to Tweet" plugin by Todaymade. I overhauled the plugin using the shortcode API, and (perhaps most importantly) removed the "powered by" link.
|
5 |
-
Version: 0
|
6 |
Author: Ben Meredith
|
7 |
Author URI: http://benandjacq.com
|
8 |
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
@@ -16,11 +16,11 @@ function bctt_shorten( $input, $length, $ellipsis = true, $strip_html = true ) {
|
|
16 |
if ( $strip_html ) {
|
17 |
$input = strip_tags( $input );
|
18 |
}
|
19 |
-
if (
|
20 |
return $input;
|
21 |
}
|
22 |
-
$last_space =
|
23 |
-
$trimmed_text =
|
24 |
if ( $ellipsis ) {
|
25 |
$trimmed_text .= '…';
|
26 |
}
|
2 |
/*
|
3 |
Plugin Name: Better Click To Tweet
|
4 |
Description: Add click to tweet boxes to your WordPress posts, easily. This is a new, fully renovated version of the late "Click to Tweet" plugin by Todaymade. I overhauled the plugin using the shortcode API, and (perhaps most importantly) removed the "powered by" link.
|
5 |
+
Version: 1.0
|
6 |
Author: Ben Meredith
|
7 |
Author URI: http://benandjacq.com
|
8 |
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
16 |
if ( $strip_html ) {
|
17 |
$input = strip_tags( $input );
|
18 |
}
|
19 |
+
if ( mb_strlen( $input ) <= $length ) {
|
20 |
return $input;
|
21 |
}
|
22 |
+
$last_space = mb_strrpos( mb_substr( $input, 0, $length) , ' ');
|
23 |
+
$trimmed_text = mb_substr( $input, 0, $last_space );
|
24 |
if ( $ellipsis ) {
|
25 |
$trimmed_text .= '…';
|
26 |
}
|
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
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -65,6 +65,10 @@ Also from an end user perspective, I am more active in the support forums than J
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
68 |
= 0.4 =
|
69 |
* rescued 9 characters that were being stolen by some incorrect math in my tweet-generating function. (now tweets won't be truncated until they actually need to be).
|
70 |
|
4 |
Tags: click to tweet, twitter, tweet, twitter plugin, Twitter boxes, share, social media, post, posts, plugin, auto post
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.0 =
|
69 |
+
* updated the tweet length math to correctly parse text with non-standard characters. Thanks to WordPress forum user zachop at https://wordpress.org/support/topic/incorrect-handling-length-count-of-multi-byte-strings for the tip.
|
70 |
+
* various code cleanup issues, to make my code more readable and complaint with WordPress standards.
|
71 |
+
|
72 |
= 0.4 =
|
73 |
* rescued 9 characters that were being stolen by some incorrect math in my tweet-generating function. (now tweets won't be truncated until they actually need to be).
|
74 |
|