Better Click To Tweet - Version 5.6.4

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 Icon 128x128 Better Click To Tweet
Version 5.6.4
Comparing to
See all releases

Code changes from version 5.6.3 to 5.6.4

Files changed (3) hide show
  1. assets/block/init.php +56 -50
  2. better-click-to-tweet.php +1 -1
  3. 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
- wp_enqueue_script('bctt-block-js', plugins_url('block/build/script.js', dirname(__FILE__)), array( 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-editor' ));
15
- if ( ! bctt_is_default_styles_dequeued() ) {
16
- $stylesheet_url = bctt_get_stylesheet_url();
 
 
 
 
 
17
 
18
- wp_enqueue_style( 'bctt-block-editor-css', $stylesheet_url, array(), 'all' );
19
- }
20
- // Add plugin options for block
21
- $bctt_data = array(
22
- 'username' => get_option( 'bctt-twitter-handle' ),
23
- );
24
- wp_localize_script( 'bctt-block-js', 'bctt_options_js', $bctt_data );
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
- 'render_callback' => 'bctt_block_callback',
33
- 'attributes' => array(
34
- 'tweet' => array(
35
- 'type' => 'string',
36
- ),
37
- 'username' => array(
38
- 'type' => 'string',
39
- 'default' => get_option( 'bctt-twitter-handle' )
40
- ),
41
- 'via' => array(
42
- 'type' => 'boolean',
43
- 'default' => true
44
- ),
45
- 'url' => array(
46
- 'type' => 'boolean',
47
- 'default' => true
48
- ),
49
- 'urlcustom' => array(
50
- 'type' => 'string'
51
- ),
52
- 'nofollow' => array(
53
- 'type' => 'boolean',
54
- 'default' => false
55
- ),
56
- 'prompt' => array(
57
- 'type' => 'string',
58
- 'default' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
59
- ),
60
- ),
61
- ]);
 
62
 
63
  // Callback function to render bctt on frontend
64
  function bctt_block_callback( $attributes ) {
65
 
66
- //echo var_dump($attributes);
67
- //exit;
68
- extract( $attributes );
69
 
70
- $url = ($url ? 'yes' : 'no');
71
-
72
- $shortcode_string = '[bctt tweet="%s" url="%s" via="%s" username="%s" nofollow="%s" prompt="%s"]';
73
-
74
- return sprintf( $shortcode_string, $tweet, ($urlcustom ? $urlcustom : $url), ( $via ? 'yes' : 'no' ), $username, ( $nofollow ? 'yes' : 'no' ), $prompt);
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.3
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.3
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