Version Description
- fix resolve an error for folks running both WordPress 5.0 and PHP version 5.3.x
- fix changes to make the code more legible for humans. But only the total geeks.
Download this release
Release Info
Developer | ben.meredith@gmail.com |
Plugin | Better Click To Tweet |
Version | 5.6.4 |
Comparing to | |
See all releases |
Code changes from version 5.6.3 to 5.6.4
- assets/block/init.php +56 -50
- better-click-to-tweet.php +1 -1
- readme.txt +5 -1
assets/block/init.php
CHANGED
@@ -11,66 +11,72 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
11 |
|
12 |
// Enqueue Block assets
|
13 |
function bctt_block_editor_assets() {
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
|
27 |
// Hook assets to editor
|
28 |
-
add_action('enqueue_block_editor_assets', 'bctt_block_editor_assets');
|
29 |
|
30 |
// Server side rendering callback to output shortcode
|
31 |
-
register_block_type('bctt/clicktotweet',
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
|
63 |
// Callback function to render bctt on frontend
|
64 |
function bctt_block_callback( $attributes ) {
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
}
|
76 |
|
11 |
|
12 |
// Enqueue Block assets
|
13 |
function bctt_block_editor_assets() {
|
14 |
+
wp_enqueue_script( 'bctt-block-js', plugins_url( 'block/build/script.js', dirname( __FILE__ ) ), array(
|
15 |
+
'wp-i18n',
|
16 |
+
'wp-blocks',
|
17 |
+
'wp-components',
|
18 |
+
'wp-editor'
|
19 |
+
) );
|
20 |
+
if ( ! bctt_is_default_styles_dequeued() ) {
|
21 |
+
$stylesheet_url = bctt_get_stylesheet_url();
|
22 |
|
23 |
+
wp_enqueue_style( 'bctt-block-editor-css', $stylesheet_url, array(), 'all' );
|
24 |
+
}
|
25 |
+
// Add plugin options for block
|
26 |
+
$bctt_data = array(
|
27 |
+
'username' => get_option( 'bctt-twitter-handle' ),
|
28 |
+
);
|
29 |
+
wp_localize_script( 'bctt-block-js', 'bctt_options_js', $bctt_data );
|
30 |
}
|
31 |
|
32 |
// Hook assets to editor
|
33 |
+
add_action( 'enqueue_block_editor_assets', 'bctt_block_editor_assets' );
|
34 |
|
35 |
// Server side rendering callback to output shortcode
|
36 |
+
register_block_type( 'bctt/clicktotweet', array(
|
37 |
+
'render_callback' => 'bctt_block_callback',
|
38 |
+
'attributes' => array(
|
39 |
+
'tweet' => array(
|
40 |
+
'type' => 'string',
|
41 |
+
),
|
42 |
+
'username' => array(
|
43 |
+
'type' => 'string',
|
44 |
+
'default' => get_option( 'bctt-twitter-handle' )
|
45 |
+
),
|
46 |
+
'via' => array(
|
47 |
+
'type' => 'boolean',
|
48 |
+
'default' => true
|
49 |
+
),
|
50 |
+
'url' => array(
|
51 |
+
'type' => 'boolean',
|
52 |
+
'default' => true
|
53 |
+
),
|
54 |
+
'urlcustom' => array(
|
55 |
+
'type' => 'string'
|
56 |
+
),
|
57 |
+
'nofollow' => array(
|
58 |
+
'type' => 'boolean',
|
59 |
+
'default' => false
|
60 |
+
),
|
61 |
+
'prompt' => array(
|
62 |
+
'type' => 'string',
|
63 |
+
'default' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
|
64 |
+
),
|
65 |
+
),
|
66 |
+
)
|
67 |
+
);
|
68 |
|
69 |
// Callback function to render bctt on frontend
|
70 |
function bctt_block_callback( $attributes ) {
|
71 |
|
72 |
+
//echo var_dump($attributes);
|
73 |
+
//exit;
|
74 |
+
extract( $attributes );
|
75 |
|
76 |
+
$url = ( $url ? 'yes' : 'no' );
|
77 |
+
|
78 |
+
$shortcode_string = '[bctt tweet="%s" url="%s" via="%s" username="%s" nofollow="%s" prompt="%s"]';
|
79 |
+
|
80 |
+
return sprintf( $shortcode_string, $tweet, ( $urlcustom ? $urlcustom : $url ), ( $via ? 'yes' : 'no' ), $username, ( $nofollow ? 'yes' : 'no' ), $prompt );
|
81 |
}
|
82 |
|
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 simply and elegantly to your posts or pages. All the features of a premium plugin, for FREE!
|
5 |
-
* Version: 5.6.
|
6 |
* Author: Ben Meredith
|
7 |
* Author URI: https://www.betterclicktotweet.com
|
8 |
* Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
2 |
/**
|
3 |
* Plugin Name: Better Click To Tweet
|
4 |
* Description: Add Click to Tweet boxes simply and elegantly to your posts or pages. All the features of a premium plugin, for FREE!
|
5 |
+
* Version: 5.6.4
|
6 |
* Author: Ben Meredith
|
7 |
* Author URI: https://www.betterclicktotweet.com
|
8 |
* Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.wpsteward.com/donations/plugin-support/
|
|
4 |
Tags: click to tweet, twitter, tweet,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.0
|
7 |
-
Stable tag: 5.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -101,6 +101,10 @@ Donations: http://benlikes.us/donate
|
|
101 |
|
102 |
== Changelog ==
|
103 |
|
|
|
|
|
|
|
|
|
104 |
= 5.6.3 =
|
105 |
* fix — update language on the settings page about the tweet length (280 character support added earlier, this is updating the help text to reflect that)
|
106 |
* fix — tested up to WordPress 5.0
|
4 |
Tags: click to tweet, twitter, tweet,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.0
|
7 |
+
Stable tag: 5.6.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
101 |
|
102 |
== Changelog ==
|
103 |
|
104 |
+
= 5.6.4 =
|
105 |
+
* fix — resolve an error for folks running both WordPress 5.0 and PHP version 5.3.x
|
106 |
+
* fix — changes to make the code more legible for humans. But only the total geeks.
|
107 |
+
|
108 |
= 5.6.3 =
|
109 |
* fix — update language on the settings page about the tweet length (280 character support added earlier, this is updating the help text to reflect that)
|
110 |
* fix — tested up to WordPress 5.0
|