Version Description
- enhancement settings page now looks good on mobile. Before it looked a bit like someone was actively hitting it with a bat.
- enhancement added multiple action hooks to the settings page. This provides third party developers with the ability to add things to that page without hacking the core code.
- enhancement made the function enqueuing the front end styles DRYer.
- change the previous way (version 4.9) I had filtered the function enqueuing styles was throwing PHP warnings when I used it, so I introduced an options-based method for never enqueueing it in the first first place. Updated gist for that: http://benlikes.us/bcttgist2 This method will also pave the way for the most exciting update (for me) in the history of Better Click To Tweet:
- change introduced the first premium add-on (Premium Styles), and made some changes to the settings page to facilitate that. The goal is threefold: (1) Don't introduce the option to folks who have already replaced the custom stylesheet using the power user guide http://benlikes.us/7r or by dequeueing the stylesheet using this gist http://benlikes.us/bcttgist1 (2) Introduce the option to purchase custom styles in a non-sleazy way. (3) Um, introduce the option to my tens of thousands of happy users to pay me for something.
Download this release
Release Info
Developer | ben.meredith@gmail.com |
Plugin | Better Click To Tweet |
Version | 5.0 |
Comparing to | |
See all releases |
Code changes from version 4.10 to 5.0
- assets/css/bctt-admin.css +10 -0
- assets/css/bcttstyle.css +2 -0
- bctt_options.php +174 -110
- better-click-to-tweet.php +39 -23
- readme.txt +9 -1
assets/css/bctt-admin.css
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#post-box-container-1 {
|
2 |
+
float:right;
|
3 |
+
margin-right: -300px;
|
4 |
+
}
|
5 |
+
@media only screen and (max-width: 850px) {
|
6 |
+
#post-box-container-1 {
|
7 |
+
|
8 |
+
margin-right: 0;
|
9 |
+
}
|
10 |
+
}
|
assets/css/bcttstyle.css
CHANGED
@@ -30,6 +30,7 @@
|
|
30 |
text-transform: none !important;
|
31 |
word-wrap: break-word;
|
32 |
border-bottom: none !important;
|
|
|
33 |
}
|
34 |
|
35 |
.bctt-ctt-text a:hover {
|
@@ -39,6 +40,7 @@
|
|
39 |
|
40 |
a.bctt-ctt-btn {
|
41 |
border-bottom: none !important;
|
|
|
42 |
margin: 0;
|
43 |
padding: 18px 0 0 0;
|
44 |
position: relative;
|
30 |
text-transform: none !important;
|
31 |
word-wrap: break-word;
|
32 |
border-bottom: none !important;
|
33 |
+
box-shadow: none !important;
|
34 |
}
|
35 |
|
36 |
.bctt-ctt-text a:hover {
|
40 |
|
41 |
a.bctt-ctt-btn {
|
42 |
border-bottom: none !important;
|
43 |
+
box-shadow: none !important;
|
44 |
margin: 0;
|
45 |
padding: 18px 0 0 0;
|
46 |
position: relative;
|
bctt_options.php
CHANGED
@@ -10,16 +10,16 @@ include dirname( __FILE__ ) . '/assets/tinymce/bctt-tinymce.php';
|
|
10 |
|
11 |
// instantiate i18n encouragement module
|
12 |
$bctt_i18n = new yoast_i18n(
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
);
|
24 |
|
25 |
// Add Settings Link
|
@@ -28,7 +28,8 @@ add_action( 'admin_menu', 'bctt_admin_menu' );
|
|
28 |
|
29 |
function bctt_admin_menu() {
|
30 |
add_action( 'admin_init', 'bctt_register_settings', 100, 1 );
|
31 |
-
|
|
|
32 |
}
|
33 |
|
34 |
function bctt_register_settings() {
|
@@ -48,53 +49,173 @@ function bctt_validate_checkbox( $input ) {
|
|
48 |
}
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
function bctt_settings_page() {
|
52 |
if ( ! current_user_can( 'manage_options' ) ) {
|
53 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'better-click-to-tweet' ) );
|
54 |
-
}
|
|
|
|
|
|
|
55 |
|
56 |
<div class="wrap">
|
57 |
|
58 |
-
|
59 |
-
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
</div>
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
</div>
|
|
|
|
|
94 |
</div>
|
|
|
95 |
</div>
|
96 |
-
|
97 |
-
|
|
|
|
|
98 |
<div class="inside">
|
99 |
<p><?php $url2 = 'https://github.com/Benunc/better-click-to-tweet';
|
100 |
$link2 = sprintf( __( 'Are you a developer? I would love your help making this plugin better. Check out the <a href=%s>plugin on Github.</a>', 'better-click-to-tweet' ), esc_url( $url2 ) );
|
@@ -114,75 +235,18 @@ function bctt_settings_page() {
|
|
114 |
target="_blank"><?php _e( 'Click here to buy me a Coke to say thanks.', 'better-click-to-tweet' ); ?></a>
|
115 |
</p>
|
116 |
</div>
|
|
|
117 |
</div>
|
|
|
|
|
118 |
</div>
|
|
|
119 |
</div>
|
120 |
-
|
121 |
-
<div id="post-body-content" class="has-sidebar-content">
|
122 |
-
<div id="normal-sortables" class="meta-box-sortables">
|
123 |
-
<div class="postbox">
|
124 |
-
<div class="inside">
|
125 |
-
<h2 class="hndle"><?php _e( 'Instructions', 'better-click-to-tweet' ); ?></h2>
|
126 |
-
|
127 |
-
<p><?php /* translators: Treat "Better Click To Tweet" as a brand name, don't translate it */
|
128 |
-
_e( 'To add styled click-to-tweet quote boxes include the Better Click To Tweet shortcode in your post.', 'better-click-to-tweet' ); ?></p>
|
129 |
-
|
130 |
-
<p><?php _e( 'Here\'s how you format the shortcode:', 'better-click-to-tweet' ); ?></p>
|
131 |
-
<pre>[bctt tweet="<?php /* translators: This text shows up as a sample tweet in the instructions for how to use the plugin. */
|
132 |
-
_e( 'Meaningful, tweetable quote.', 'better-click-to-tweet' ); ?>"]</pre>
|
133 |
-
<p><?php /* translators: Also, treat "BCTT" as a brand name, don't translate it */
|
134 |
-
_e( 'If you are using the visual editor, click the BCTT birdie in the toolbar to add a pre-formatted shortcode to your post.', 'better-click-to-tweet' ); ?></p>
|
135 |
-
|
136 |
-
<p><?php _e( 'Tweet length is automatically shortened to 117 characters minus the length of your twitter name, to leave room for it and a link back to the post.', 'better-click-to-tweet' ); ?></p>
|
137 |
-
</div>
|
138 |
-
</div>
|
139 |
-
<div class="postbox">
|
140 |
-
<div class="inside">
|
141 |
-
<h2 class="hndle"><?php _e( 'Settings', 'better-click-to-tweet' ); ?></h2>
|
142 |
-
|
143 |
-
<p><?php _e( 'Enter your Twitter handle to add "via @yourhandle" to your tweets. Do not include the @ symbol.', 'better-click-to-tweet' ); ?></p>
|
144 |
-
|
145 |
-
<p><?php _e( 'Checking the box below will force the plugin to show the WordPress shortlink in place of the full URL. While this does not impact tweet character length, it is useful alongside plugins which customize the WordPress shortlink using services like bit.ly or yourls.org for tracking', 'better-click-to-tweet' ) ?> </p>
|
146 |
-
|
147 |
-
<form method="post" action="options.php" style="display: inline-block;">
|
148 |
-
<?php settings_fields( 'bctt_clicktotweet-options' ); ?>
|
149 |
-
|
150 |
-
<table class="form-table">
|
151 |
-
<tr valign="top">
|
152 |
-
<th style="width: 200px;">
|
153 |
-
<label><?php _ex( 'Your Twitter Handle', 'label for text input on settings screen', 'better-click-to-tweet' ); ?></label>
|
154 |
-
</th>
|
155 |
-
<td><input type="text" name="bctt-twitter-handle"
|
156 |
-
value="<?php echo get_option( 'bctt-twitter-handle' ); ?>"/></td>
|
157 |
-
</tr>
|
158 |
-
<tr valign="top">
|
159 |
-
<th style="width: 200px;">
|
160 |
-
<label><?php _ex( 'Use Short URL?', 'label for checkbox on settings screen', 'better-click-to-tweet' ); ?></label>
|
161 |
-
</th>
|
162 |
-
<td><input type="checkbox" name="bctt-short-url"
|
163 |
-
value="1" <?php if ( 1 == get_option( 'bctt-short-url' ) ) {
|
164 |
-
echo 'checked="checked"';
|
165 |
-
} ?>" />
|
166 |
-
</td>
|
167 |
-
</tr>
|
168 |
-
</table>
|
169 |
-
<br class="clear"/>
|
170 |
-
|
171 |
-
<p><input type="submit" class="button-primary"
|
172 |
-
value="<?php _e( 'Save Changes', 'better-click-to-tweet' ); ?>"/></p>
|
173 |
-
<br class="clear"/>
|
174 |
-
<em><?php $url = 'https://www.wpsteward.com';
|
175 |
-
$link = sprintf( __( 'An open source plugin by <a href=%s>Ben Meredith</a>', 'better-click-to-tweet' ), esc_url( $url ) );
|
176 |
-
echo $link; ?></em>
|
177 |
-
</form>
|
178 |
-
</div>
|
179 |
-
</div>
|
180 |
-
|
181 |
-
</div>
|
182 |
-
</div>
|
183 |
-
</div>
|
184 |
</div>
|
|
|
185 |
</div>
|
|
|
186 |
<?php
|
187 |
}
|
188 |
|
10 |
|
11 |
// instantiate i18n encouragement module
|
12 |
$bctt_i18n = new yoast_i18n(
|
13 |
+
array(
|
14 |
+
'textdomain' => 'better-click-to-tweet',
|
15 |
+
'project_slug' => '/wp-plugins/better-click-to-tweet/stable',
|
16 |
+
'plugin_name' => 'Better Click To Tweet',
|
17 |
+
'hook' => 'bctt_settings_top',
|
18 |
+
'glotpress_url' => 'https://translate.wordpress.org/',
|
19 |
+
'glotpress_name' => 'Translating WordPress',
|
20 |
+
'glotpress_logo' => 'https://plugins.svn.wordpress.org/better-click-to-tweet/assets/icon-256x256.png',
|
21 |
+
'register_url ' => 'https://translate.wordpress.org/projects/wp-plugins/better-click-to-tweet/',
|
22 |
+
)
|
23 |
);
|
24 |
|
25 |
// Add Settings Link
|
28 |
|
29 |
function bctt_admin_menu() {
|
30 |
add_action( 'admin_init', 'bctt_register_settings', 100, 1 );
|
31 |
+
add_menu_page( 'Better Click To Tweet Options', 'Better Click To Tweet', 'manage_options', 'better-click-to-tweet', null, 'dashicons-twitter' );
|
32 |
+
add_submenu_page('better-click-to-tweet', 'Better Click To Tweet Main Settings', 'Settings', 'manage_options', 'better-click-to-tweet', 'bctt_settings_page' );
|
33 |
}
|
34 |
|
35 |
function bctt_register_settings() {
|
49 |
}
|
50 |
}
|
51 |
|
52 |
+
function bctt_add_custom_style_option() {
|
53 |
+
$bctt_dequeued_with_custom_funtion = get_option( 'bctt_style_dequeued' );
|
54 |
+
|
55 |
+
$bctt_custom_style = get_option( 'bcct_custom_style_enqueued' );
|
56 |
+
|
57 |
+
if ( $bctt_dequeued_with_custom_funtion || $bctt_custom_style ) {
|
58 |
+
return true;
|
59 |
+
} else {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
function bctt_admin_styles() {
|
66 |
+
wp_register_style( 'bctt_admin_style', plugins_url( 'assets/css/bctt-admin.css', __FILE__ ) );
|
67 |
+
wp_enqueue_style( 'bctt_admin_style' );
|
68 |
+
}
|
69 |
+
|
70 |
function bctt_settings_page() {
|
71 |
if ( ! current_user_can( 'manage_options' ) ) {
|
72 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'better-click-to-tweet' ) );
|
73 |
+
}
|
74 |
+
|
75 |
+
bctt_admin_styles();
|
76 |
+
?>
|
77 |
|
78 |
<div class="wrap">
|
79 |
|
80 |
+
<h1 class="wp-heading-inline"><?php /* translators: Treat "Better Click To Tweet" as a brand name, don't translate it */
|
81 |
+
_e( 'Better Click To Tweet — a plugin by Ben Meredith', 'better-click-to-tweet' ); ?></h1>
|
82 |
|
83 |
+
<hr/>
|
84 |
+
<?php do_action( 'bctt_settings_top' ); ?>
|
85 |
+
|
86 |
+
|
87 |
+
<div id="poststuff">
|
88 |
+
<div id="post-body" class="metabox-holder columns-2 ">
|
89 |
+
<div id="post-body-content" style="position: relative;">
|
90 |
+
<div id="bctt_instructions" class="postbox ">
|
91 |
+
<h2><?php _e( 'Instructions', 'better-click-to-tweet' ); ?></h2>
|
92 |
+
<div class="inside">
|
93 |
+
|
94 |
+
<p><?php /* translators: Treat "Better Click To Tweet" as a brand name, don't translate it */
|
95 |
+
_e( 'To add styled click-to-tweet quote boxes include the Better Click To Tweet shortcode in your post.', 'better-click-to-tweet' ); ?></p>
|
96 |
+
|
97 |
+
<p><?php _e( 'Here\'s how you format the shortcode:', 'better-click-to-tweet' ); ?></p>
|
98 |
+
<pre>[bctt tweet="<?php /* translators: This text shows up as a sample tweet in the instructions for how to use the plugin. */
|
99 |
+
_e( 'Meaningful, tweetable quote.', 'better-click-to-tweet' ); ?>"]</pre>
|
100 |
+
<p><?php /* translators: Also, treat "BCTT" as a brand name, don't translate it */
|
101 |
+
_e( 'If you are using the visual editor, click the BCTT birdie in the toolbar to add a pre-formatted shortcode to your post.', 'better-click-to-tweet' ); ?></p>
|
102 |
+
|
103 |
+
<p><?php _e( 'Tweet length is automatically shortened to 117 characters minus the length of your twitter name, to leave room for it and a link back to the post.', 'better-click-to-tweet' ); ?></p>
|
104 |
+
</div>
|
105 |
+
<!--/inside-->
|
106 |
+
</div>
|
107 |
+
<!--/bctt_instructions-->
|
108 |
+
<?php do_action( 'bctt_instructions_bottom' ); ?>
|
109 |
+
<div class="postbox">
|
110 |
+
<h2><?php _e( 'Settings', 'better-click-to-tweet' ); ?></h2>
|
111 |
+
<div class="inside">
|
112 |
+
<div class="main">
|
113 |
+
<p><?php _e( 'Enter your Twitter handle to add "via @yourhandle" to your tweets. Do not include the @ symbol.', 'better-click-to-tweet' ); ?></p>
|
114 |
+
|
115 |
+
<p><?php _e( 'Checking the box below will force the plugin to show the WordPress shortlink in place of the full URL. While this does not impact tweet character length, it is useful alongside plugins which customize the WordPress shortlink using services like bit.ly or yourls.org for tracking', 'better-click-to-tweet' ) ?> </p>
|
116 |
+
|
117 |
+
<form method="post" action="options.php" style="">
|
118 |
+
<?php settings_fields( 'bctt_clicktotweet-options' ); ?>
|
119 |
+
|
120 |
+
<table class="form-table">
|
121 |
+
<tr valign="top">
|
122 |
+
<th style="width: 200px;">
|
123 |
+
<label><?php _ex( 'Your Twitter Handle', 'label for text input on settings screen', 'better-click-to-tweet' ); ?></label>
|
124 |
+
</th>
|
125 |
+
<td><input type="text" name="bctt-twitter-handle"
|
126 |
+
value="<?php echo get_option( 'bctt-twitter-handle' ); ?>"/>
|
127 |
+
</td>
|
128 |
+
<tr valign="top">
|
129 |
+
<th style="width: 200px;">
|
130 |
+
<label><?php _ex( 'Use Short URL?', 'label for checkbox on settings screen', 'better-click-to-tweet' ); ?></label>
|
131 |
+
</th>
|
132 |
+
<td><input type="checkbox" name="bctt-short-url"
|
133 |
+
value="1" <?php if ( 1 == get_option( 'bctt-short-url' ) ) {
|
134 |
+
echo 'checked="checked"';
|
135 |
+
} ?>" />
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
|
139 |
+
<?php if ( ! bctt_add_custom_style_option() ) { ?>
|
140 |
+
<tr valign="top">
|
141 |
+
<th style="width:200px;">
|
142 |
+
<label><?php _ex( 'Use Premium Styles?', 'label for checkbox on settings screen', 'better-click-to-tweet' ); ?></label>
|
143 |
+
</th>
|
144 |
+
<td><input type="checkbox" name="bctt-custom-style"
|
145 |
+
value="1" <?php if ( is_plugin_active( 'better-click-to-tweet-styles/better-click-to-tweet-premium-styles.php' ) ) {
|
146 |
+
echo 'checked="checked"';
|
147 |
+
} else {
|
148 |
+
echo 'disabled="disabled"';
|
149 |
+
} ?>" /> <span
|
150 |
+
style="font-size: .85em;"><em> <?php if ( ! is_plugin_active( 'better-click-to-tweet-styles/better-click-to-tweet-premium-styles.php' ) ) {
|
151 |
+
echo sprintf( __( 'Want Premium styles? Add the <a href=%s>Premium Styles add-on</a> today!', 'better-click-to-tweet' ), esc_url( 'http://benlikes.us/bcttpsdirect' ) );
|
152 |
+
} ?></em></span>
|
153 |
+
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<?php } ?>
|
157 |
+
</table>
|
158 |
+
<?php do_action( 'bctt_before_settings_submit' ); ?>
|
159 |
+
<br class="clear"/>
|
160 |
+
|
161 |
+
<p><input type="submit" class="button-primary"
|
162 |
+
value="<?php _e( 'Save Changes', 'better-click-to-tweet' ); ?>"/>
|
163 |
+
</p>
|
164 |
+
<br class="clear"/>
|
165 |
+
<em><?php $url = 'https://www.wpsteward.com';
|
166 |
+
$link = sprintf( __( 'An open source plugin by <a href=%s>Ben Meredith</a>', 'better-click-to-tweet' ), esc_url( $url ) );
|
167 |
+
echo $link; ?></em>
|
168 |
+
</form>
|
169 |
|
170 |
+
</div>
|
171 |
+
<!--/main-->
|
172 |
+
</div>
|
173 |
+
<!--/inside-->
|
174 |
+
</div>
|
175 |
+
<!--/postbox-->
|
176 |
+
</div>
|
177 |
+
<!--/post-body-content-->
|
178 |
+
<?php do_action( 'bctt_after_settings' ); ?>
|
179 |
+
|
180 |
+
<div id="post-box-container-1" class="post-box-container">
|
181 |
+
<div id="side-sortables" class="meta-box-sortables ui-sortable">
|
182 |
+
|
183 |
+
<div id="bctt-author" class="postbox " style="display:block;">
|
184 |
+
<h2><?php _e( 'About the Author', 'better-click-to-tweet' ); ?> </h2>
|
185 |
+
|
186 |
+
<div id="bctt_signup" class="inside">
|
187 |
+
<form
|
188 |
+
action="//benandjacq.us1.list-manage.com/subscribe/post?u=8f88921110b81f81744101f4d&id=bd909b5f89"
|
189 |
+
method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form"
|
190 |
+
class="validate" target="_blank" novalidate>
|
191 |
+
<div id="mc_embed_signup_scroll">
|
192 |
+
<p> <?php echo sprintf( __( 'This plugin is developed by <a href="%s">Ben Meredith</a>. I am a freelance developer specializing in <a href="%s">outrunning and outsmarting hackers</a>.', 'better-click-to-tweet' ), esc_url( 'https://www.wpsteward.com' ), esc_url( 'https://www.wpsteward.com/service-plans' ) ); ?></p>
|
193 |
+
<h4><?php _e( 'Sign up to receive my FREE web strategy guide', 'better-click-to-tweet' ); ?></h4>
|
194 |
+
|
195 |
+
<p><input type="email" value="" name="EMAIL" class="widefat" id="mce-EMAIL"
|
196 |
+
placeholder="<?php _ex( 'Your Email Address', 'placeholder text for input field', 'better-click-to-tweet' ); ?>">
|
197 |
+
<small><?php _e( 'No Spam. One-click unsubscribe in every message', 'better-click-to-tweet' ); ?></small>
|
198 |
+
</p>
|
199 |
+
<div style="position: absolute; left: -5000px;"><input type="text"
|
200 |
+
name="b_8f88921110b81f81744101f4d_bd909b5f89"
|
201 |
+
tabindex="-1" value="">
|
202 |
</div>
|
203 |
+
<p class="clear"><input type="submit" value="Subscribe" name="subscribe"
|
204 |
+
id="mc-embedded-subscribe" class="button-secondary"></p>
|
205 |
+
|
206 |
+
</div>
|
207 |
+
<!--/mc_embed_signup_scroll-->
|
208 |
+
</form>
|
209 |
</div>
|
210 |
+
<!--/bctt_signup-->
|
211 |
+
<?php do_action( 'bctt_author_box_bottom' ); ?>
|
212 |
</div>
|
213 |
+
<!--/bctt-author-->
|
214 |
</div>
|
215 |
+
<!--/side-sortables-->
|
216 |
+
|
217 |
+
<div id="side-sortables" class="meta-box-sortables ui-sortable">
|
218 |
+
<div id="bctt-contrib" class="postbox">
|
219 |
<div class="inside">
|
220 |
<p><?php $url2 = 'https://github.com/Benunc/better-click-to-tweet';
|
221 |
$link2 = sprintf( __( 'Are you a developer? I would love your help making this plugin better. Check out the <a href=%s>plugin on Github.</a>', 'better-click-to-tweet' ), esc_url( $url2 ) );
|
235 |
target="_blank"><?php _e( 'Click here to buy me a Coke to say thanks.', 'better-click-to-tweet' ); ?></a>
|
236 |
</p>
|
237 |
</div>
|
238 |
+
<!--/inside-->
|
239 |
</div>
|
240 |
+
<!--/donate-contrib-->
|
241 |
+
<?php do_action( 'bctt_contrib_bottom' ); ?>
|
242 |
</div>
|
243 |
+
<!--side-sortables-->
|
244 |
</div>
|
245 |
+
<!--/post-box-container-1-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
</div>
|
247 |
+
<!--/post-body-->
|
248 |
</div>
|
249 |
+
<!--/wrap-->
|
250 |
<?php
|
251 |
}
|
252 |
|
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:
|
6 |
Author: Ben Meredith
|
7 |
Author URI: https://www.wpsteward.com
|
8 |
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
@@ -89,17 +89,17 @@ function bctt_shortcode( $atts ) {
|
|
89 |
'url' => 'yes',
|
90 |
'nofollow' => 'no',
|
91 |
'prompt' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
|
92 |
-
), $atts, 'bctt'
|
93 |
-
|
94 |
//since 4.7: adds option to add in a per-box username to the tweet
|
95 |
if ( $atts['username'] != 'not-a-real-user' ) {
|
96 |
-
|
97 |
$handle = $atts['username'];
|
98 |
-
|
99 |
} else {
|
100 |
-
|
101 |
$handle = get_option( 'bctt-twitter-handle' );
|
102 |
-
|
103 |
}
|
104 |
|
105 |
if ( function_exists( 'mb_internal_encoding' ) ) {
|
@@ -121,7 +121,7 @@ function bctt_shortcode( $atts ) {
|
|
121 |
$handle_code = '';
|
122 |
|
123 |
}
|
124 |
-
|
125 |
if ( $atts['via'] != 'yes' ) {
|
126 |
|
127 |
$handle_code = '';
|
@@ -173,13 +173,13 @@ function bctt_shortcode( $atts ) {
|
|
173 |
|
174 |
}
|
175 |
|
176 |
-
$bctt_span_class
|
177 |
-
$bctt_text_span_class
|
178 |
-
$bctt_button_span_class = apply_filters('bctt_button_span_class', 'bctt-ctt-btn');
|
179 |
|
180 |
if ( ! is_feed() ) {
|
181 |
|
182 |
-
return "<span class='" . $bctt_span_class . "'><span class='" . $bctt_text_span_class . "'><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank'" . $rel . ">" . $short . " </a></span><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank' class='" . $bctt_button_span_class ."'" . $rel . ">" . $atts['prompt'] . "</a></span>";
|
183 |
} else {
|
184 |
|
185 |
return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'" . $rel . ">" . $atts['prompt'] . "</a><br /><hr />";
|
@@ -202,29 +202,41 @@ add_shortcode( 'bctt', 'bctt_shortcode' );
|
|
202 |
|
203 |
function bctt_scripts() {
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
$dir = wp_upload_dir();
|
206 |
|
207 |
$custom = file_exists( $dir['basedir'] . '/bcttstyle.css' );
|
208 |
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
|
213 |
-
|
214 |
|
215 |
-
|
216 |
|
217 |
-
|
218 |
|
219 |
-
|
220 |
-
|
|
|
221 |
|
222 |
|
223 |
}
|
224 |
|
225 |
-
;
|
226 |
|
227 |
-
add_action( 'wp_enqueue_scripts',
|
|
|
228 |
|
229 |
/*
|
230 |
* Delete options and shortcode on uninstall
|
@@ -238,6 +250,10 @@ function bctt_on_uninstall() {
|
|
238 |
|
239 |
delete_option( 'bctt-short-url' );
|
240 |
|
|
|
|
|
|
|
|
|
241 |
remove_shortcode( 'bctt' );
|
242 |
|
243 |
}
|
@@ -250,7 +266,7 @@ function bctt_options_link( $links ) {
|
|
250 |
|
251 |
$settingsText = sprintf( _x( 'Settings', 'text for the link on the plugins page', 'better-click-to-tweet' ) );
|
252 |
|
253 |
-
$settings_link = '<a href="
|
254 |
|
255 |
array_unshift( $links, $settings_link );
|
256 |
|
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.0
|
6 |
Author: Ben Meredith
|
7 |
Author URI: https://www.wpsteward.com
|
8 |
Plugin URI: https://wordpress.org/plugins/better-click-to-tweet/
|
89 |
'url' => 'yes',
|
90 |
'nofollow' => 'no',
|
91 |
'prompt' => sprintf( _x( 'Click To Tweet', 'Text for the box on the reader-facing box', 'better-click-to-tweet' ) )
|
92 |
+
), $atts, 'bctt' );
|
93 |
+
|
94 |
//since 4.7: adds option to add in a per-box username to the tweet
|
95 |
if ( $atts['username'] != 'not-a-real-user' ) {
|
96 |
+
|
97 |
$handle = $atts['username'];
|
98 |
+
|
99 |
} else {
|
100 |
+
|
101 |
$handle = get_option( 'bctt-twitter-handle' );
|
102 |
+
|
103 |
}
|
104 |
|
105 |
if ( function_exists( 'mb_internal_encoding' ) ) {
|
121 |
$handle_code = '';
|
122 |
|
123 |
}
|
124 |
+
|
125 |
if ( $atts['via'] != 'yes' ) {
|
126 |
|
127 |
$handle_code = '';
|
173 |
|
174 |
}
|
175 |
|
176 |
+
$bctt_span_class = apply_filters( 'bctt_span_class', 'bctt-click-to-tweet' );
|
177 |
+
$bctt_text_span_class = apply_filters( 'bctt_text_span_class', 'bctt-ctt-text' );
|
178 |
+
$bctt_button_span_class = apply_filters( 'bctt_button_span_class', 'bctt-ctt-btn' );
|
179 |
|
180 |
if ( ! is_feed() ) {
|
181 |
|
182 |
+
return "<span class='" . $bctt_span_class . "'><span class='" . $bctt_text_span_class . "'><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank'" . $rel . ">" . $short . " </a></span><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank' class='" . $bctt_button_span_class . "'" . $rel . ">" . $atts['prompt'] . "</a></span>";
|
183 |
} else {
|
184 |
|
185 |
return "<hr /><p><em>" . $short . "</em><br /><a href='https://twitter.com/intent/tweet?text=" . rawurlencode( html_entity_decode( $short ) ) . $handle_code . $bcttURL . "' target='_blank' class='bctt-ctt-btn'" . $rel . ">" . $atts['prompt'] . "</a><br /><hr />";
|
202 |
|
203 |
function bctt_scripts() {
|
204 |
|
205 |
+
if ( get_option( 'bctt_disable_css' ) ) {
|
206 |
+
add_option( 'bctt_style_dequeued', true );
|
207 |
+
foreach ( wp_load_alloptions() as $option => $value ) {
|
208 |
+
if ( strpos( $option, 'bcct_' ) === 0 ) {
|
209 |
+
delete_option( $option );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
return;
|
214 |
+
}
|
215 |
+
|
216 |
$dir = wp_upload_dir();
|
217 |
|
218 |
$custom = file_exists( $dir['basedir'] . '/bcttstyle.css' );
|
219 |
|
220 |
+
$tag = $custom ? 'bcct_custom_style' : 'bcct_style';
|
221 |
+
$antitag = $custom ? 'bcct_style' : 'bcct_custom_style';
|
222 |
+
$location = $custom ? $dir['baseurl'] . '/bcttstyle.css' : plugins_url( 'assets/css/styles.css', __FILE__ );
|
223 |
|
224 |
+
$version = $custom ? '1.0' : '3.0';
|
225 |
|
226 |
+
wp_register_style( $tag, $location, false, $version, 'all' );
|
227 |
|
228 |
+
wp_enqueue_style( $tag );
|
229 |
|
230 |
+
delete_option( 'bctt_style_dequeued' );
|
231 |
+
add_option( $tag . '_enqueued', true );
|
232 |
+
delete_option( $antitag . '_enqueued' );
|
233 |
|
234 |
|
235 |
}
|
236 |
|
|
|
237 |
|
238 |
+
add_action( 'wp_enqueue_scripts', 'bctt_scripts', 10 );
|
239 |
+
|
240 |
|
241 |
/*
|
242 |
* Delete options and shortcode on uninstall
|
250 |
|
251 |
delete_option( 'bctt-short-url' );
|
252 |
|
253 |
+
delete_option( 'bctt_disable_css' );
|
254 |
+
|
255 |
+
delete_option( 'bctt_style_enqueued' );
|
256 |
+
|
257 |
remove_shortcode( 'bctt' );
|
258 |
|
259 |
}
|
266 |
|
267 |
$settingsText = sprintf( _x( 'Settings', 'text for the link on the plugins page', 'better-click-to-tweet' ) );
|
268 |
|
269 |
+
$settings_link = '<a href="admin.php?page=better-click-to-tweet">' . $settingsText . '</a>';
|
270 |
|
271 |
array_unshift( $links, $settings_link );
|
272 |
|
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: 4.7
|
7 |
-
Stable tag:
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -103,6 +103,14 @@ Donations: http://benlikes.us/donate
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 4.10 =
|
107 |
* enhancement — added a 'prompt' shortcode attribute, so not you can change the words "Click To Tweet" on a per-box basis. Thanks to @apearlman on the Wordpress.org support forums for the suggestion!
|
108 |
* fix — changed the way the shortcode attributes are called, because my IDE kept throwing strange errors because the code wasn't clean enough.
|
4 |
Tags: click to tweet, twitter, tweet,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 5.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 5.0 =
|
107 |
+
* enhancement — settings page now looks good on mobile. Before it looked a bit like someone was actively hitting it with a bat.
|
108 |
+
* enhancement — added multiple action hooks to the settings page. This provides third party developers with the ability to add things to that page without hacking the core code.
|
109 |
+
* enhancement — made the function enqueuing the front end styles DRYer.
|
110 |
+
* change — the previous way (version 4.9) I had filtered the function enqueuing styles was throwing PHP warnings when I used it, so I introduced an options-based method for never enqueueing it in the first first place. Updated gist for that: http://benlikes.us/bcttgist2 This method will also pave the way for the most exciting update (for me) in the history of Better Click To Tweet:
|
111 |
+
* change — introduced the first premium add-on (Premium Styles), and made some changes to the settings page to facilitate that. The goal is threefold: (1) Don't introduce the option to folks who have already replaced the custom stylesheet using the power user guide http://benlikes.us/7r or by dequeueing the stylesheet using this gist http://benlikes.us/bcttgist1 (2) Introduce the option to purchase custom styles in a non-sleazy way. (3) Um, introduce the option to my tens of thousands of happy users to pay me for something.
|
112 |
+
|
113 |
+
|
114 |
= 4.10 =
|
115 |
* enhancement — added a 'prompt' shortcode attribute, so not you can change the words "Click To Tweet" on a per-box basis. Thanks to @apearlman on the Wordpress.org support forums for the suggestion!
|
116 |
* fix — changed the way the shortcode attributes are called, because my IDE kept throwing strange errors because the code wasn't clean enough.
|