Version Description
- Change: Twitter help/configuration endpoint retired. Values changed to static.
- Change: Misc. UI updates.
- Bug fix: Re-query YOURLS endpoint if format throws no-match result.
- Allow enabling debugging without Pro.
- Log Tweet status IDs.
Download this release
Release Info
Developer | joedolson |
Plugin | WP to Twitter |
Version | 3.5.4 |
Comparing to | |
See all releases |
Code changes from version 3.5.3 to 3.5.4
- classes/class-wpt-search-tweets-widget.php +1 -1
- css/post-styles.css +1 -1
- readme.txt +10 -2
- wp-to-twitter-manager.php +35 -37
- wp-to-twitter-oauth.php +14 -14
- wp-to-twitter-shorteners.php +23 -12
- wp-to-twitter-users.php +2 -2
- wp-to-twitter.php +17 -13
- wpt-functions.php +6 -6
- wpt-truncate.php +5 -41
- wpt-widget.php +1 -1
classes/class-wpt-search-tweets-widget.php
CHANGED
@@ -131,7 +131,7 @@ class WPT_Search_Tweets_Widget extends WP_Widget {
|
|
131 |
|
132 |
<p>
|
133 |
<label for="<?php echo $this->get_field_id( 'result_type' ); ?>"><?php _e( 'Type of Results', 'wp-to-twitter' ); ?></label>
|
134 |
-
<select name="<?php echo $this->get_field_name( 'result_type' ); ?>" id="<?php echo $this->get_field_id( 'result_type' ); ?>"> <option
|
135 |
</select>
|
136 |
</p>
|
137 |
|
131 |
|
132 |
<p>
|
133 |
<label for="<?php echo $this->get_field_id( 'result_type' ); ?>"><?php _e( 'Type of Results', 'wp-to-twitter' ); ?></label>
|
134 |
+
<select name="<?php echo $this->get_field_name( 'result_type' ); ?>" id="<?php echo $this->get_field_id( 'result_type' ); ?>"> <option value='recent'<?php echo ( 'recent' === $instance['result_type'] ) ? ' selected="selected"' : ''; ?>><?php _e( 'Recent Tweets', 'wp-to-twitter' ); ?></option> <option value='popular'<?php echo ( 'popular' === $instance['result_type'] ) ? ' selected="selected"' : ''; ?>><?php _e( 'Popular Tweets', 'wp-to-twitter' ); ?></option> <option value='mixed'<?php echo ( 'mixed' === $instance['result_type'] ) ? ' selected="selected"' : ''; ?>><?php _e( 'Mixed', 'wp-to-twitter' ); ?></option>
|
135 |
</select>
|
136 |
</p>
|
137 |
|
css/post-styles.css
CHANGED
@@ -290,7 +290,7 @@ button.time div {
|
|
290 |
.toggle-btn-group:after {
|
291 |
content: "";
|
292 |
display: table;
|
293 |
-
clear: both;
|
294 |
}
|
295 |
|
296 |
.toggle-btn-group label {
|
290 |
.toggle-btn-group:after {
|
291 |
content: "";
|
292 |
display: table;
|
293 |
+
clear: both;
|
294 |
}
|
295 |
|
296 |
.toggle-btn-group label {
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Contributors: joedolson
|
|
3 |
Donate link: http://www.joedolson.com/donate/
|
4 |
Tags: twitter, microblogging, bitly, yourls, redirect, shortener, post, links, social, sharing, media, tweet
|
5 |
Requires at least: 4.9.8
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
Text Domain: wp-to-twitter
|
10 |
-
Stable tag: 3.5.
|
11 |
|
12 |
Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
|
13 |
|
@@ -64,6 +64,14 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
= 3.5.3 =
|
68 |
|
69 |
* Bug fix: Query to Twitter config endpoint should never run more than once a day.
|
3 |
Donate link: http://www.joedolson.com/donate/
|
4 |
Tags: twitter, microblogging, bitly, yourls, redirect, shortener, post, links, social, sharing, media, tweet
|
5 |
Requires at least: 4.9.8
|
6 |
+
Tested up to: 5.8
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
Text Domain: wp-to-twitter
|
10 |
+
Stable tag: 3.5.4
|
11 |
|
12 |
Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
|
13 |
|
64 |
|
65 |
== Changelog ==
|
66 |
|
67 |
+
= 3.5.4 =
|
68 |
+
|
69 |
+
* Change: Twitter help/configuration endpoint retired. Values changed to static.
|
70 |
+
* Change: Misc. UI updates.
|
71 |
+
* Bug fix: Re-query YOURLS endpoint if format throws no-match result.
|
72 |
+
* Allow enabling debugging without Pro.
|
73 |
+
* Log Tweet status IDs.
|
74 |
+
|
75 |
= 3.5.3 =
|
76 |
|
77 |
* Bug fix: Query to Twitter config endpoint should never run more than once a day.
|
wp-to-twitter-manager.php
CHANGED
@@ -80,8 +80,10 @@ function wpt_updated_settings() {
|
|
80 |
}
|
81 |
|
82 |
if ( isset( $_POST['submit-type'] ) && 'advanced' === $_POST['submit-type'] ) {
|
83 |
-
|
84 |
-
|
|
|
|
|
85 |
|
86 |
if ( isset( $_POST['wpt_rate_limiting'] ) && '1' !== get_option( 'wpt_rate_limiting' ) ) {
|
87 |
$extend = __( 'Rate Limiting is enabled. Default rate limits are set at 10 posts per category/term per hour. <a href="#special_cases">Edit global default</a> or edit individual terms to customize limits for each category or taxonomy term.', 'wp-to-twitter' );
|
@@ -92,22 +94,21 @@ function wpt_updated_settings() {
|
|
92 |
}
|
93 |
|
94 |
update_option( 'wpt_rate_limiting', ( isset( $_POST['wpt_rate_limiting'] ) ) ? 1 : 0 );
|
95 |
-
update_option( 'wpt_inline_edits', ( isset( $_POST['wpt_inline_edits'] ) ) ?
|
96 |
-
update_option( '
|
97 |
-
update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
|
98 |
update_option( 'wpt_default_rate_limit', ( isset( $_POST['wpt_default_rate_limit'] ) ? intval( $_POST['wpt_default_rate_limit'] ) : false ) );
|
99 |
-
update_option( 'jd_strip_nonan', ( isset( $_POST['jd_strip_nonan'] ) ) ?
|
100 |
-
update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
|
101 |
-
update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
|
102 |
-
update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
|
103 |
-
update_option( 'jd_max_tags', $_POST['jd_max_tags'] );
|
104 |
-
$use_cats = ( isset( $_POST['wpt_use_cats'] ) ) ?
|
105 |
update_option( 'wpt_use_cats', $use_cats );
|
106 |
update_option( 'wpt_tag_source', ( ( isset( $_POST['wpt_tag_source'] ) && 'slug' === $_POST['wpt_tag_source'] ) ? 'slug' : '' ) );
|
107 |
-
update_option( 'jd_max_characters', $_POST['jd_max_characters'] );
|
108 |
-
update_option( 'jd_replace_character', ( isset( $_POST['jd_replace_character'] ) ? $_POST['jd_replace_character'] : '' ) );
|
109 |
-
update_option( 'jd_date_format', $_POST['jd_date_format'] );
|
110 |
-
update_option( 'jd_dynamic_analytics', $_POST['jd-dynamic-analytics'] );
|
111 |
|
112 |
$twitter_analytics = ( isset( $_POST['twitter-analytics'] ) ) ? $_POST['twitter-analytics'] : 0;
|
113 |
if ( 1 === (int) $twitter_analytics ) {
|
@@ -124,8 +125,8 @@ function wpt_updated_settings() {
|
|
124 |
update_option( 'no-analytics', 1 );
|
125 |
}
|
126 |
|
127 |
-
update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
|
128 |
-
update_option( 'jd_individual_twitter_users', ( isset( $_POST['jd_individual_twitter_users'] ) ?
|
129 |
|
130 |
if ( isset( $_POST['wpt_caps'] ) ) {
|
131 |
$perms = $_POST['wpt_caps'];
|
@@ -146,9 +147,8 @@ function wpt_updated_settings() {
|
|
146 |
|
147 |
update_option( 'wpt_permit_feed_styles', ( isset( $_POST['wpt_permit_feed_styles'] ) ) ? 1 : 0 );
|
148 |
update_option( 'wp_debug_oauth', ( isset( $_POST['wp_debug_oauth'] ) ) ? 1 : 0 );
|
149 |
-
update_option( 'jd_donations', ( isset( $_POST['jd_donations'] ) ) ? 1 : 0 );
|
150 |
$wpt_truncation_order = $_POST['wpt_truncation_order'];
|
151 |
-
update_option( 'wpt_truncation_order', $wpt_truncation_order );
|
152 |
$message .= __( 'WP to Twitter Advanced Options Updated', 'wp-to-twitter' ) . '. ' . $extend;
|
153 |
}
|
154 |
|
@@ -162,6 +162,7 @@ function wpt_updated_settings() {
|
|
162 |
$keys = array();
|
163 |
$values = array();
|
164 |
foreach ( $_POST['wpt_post_types'] as $key => $value ) {
|
|
|
165 |
// using wp_encode_emoji allows me to save emoji in templates.
|
166 |
// ...but I haven't found a way to convert the saved emoji *back* to unicode.
|
167 |
// sending the HTML entity just yields a broken character on Twitter.
|
@@ -177,8 +178,8 @@ function wpt_updated_settings() {
|
|
177 |
|
178 |
$wpt_settings = array_combine( $keys, $values );
|
179 |
update_option( 'wpt_post_types', $wpt_settings );
|
180 |
-
update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
|
181 |
-
update_option( 'jd_twit_blogroll', ( isset( $_POST['jd_twit_blogroll'] ) ) ?
|
182 |
$message = wpt_select_shortener( $_POST );
|
183 |
$message .= __( 'WP to Twitter Options Updated', 'wp-to-twitter' );
|
184 |
$message = apply_filters( 'wpt_settings', $message, $_POST );
|
@@ -224,7 +225,7 @@ function wpt_update_settings() {
|
|
224 |
|
225 |
<?php
|
226 |
$default = ( '' === get_option( 'wtt_twitter_username', '' ) ) ? 'connection' : 'basic';
|
227 |
-
$current = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : $default;
|
228 |
if ( 'connection' === $current ) {
|
229 |
if ( function_exists( 'wtt_connect_oauth' ) ) {
|
230 |
wtt_connect_oauth();
|
@@ -349,7 +350,7 @@ function wpt_update_settings() {
|
|
349 |
continue;
|
350 |
} else {
|
351 |
?>
|
352 |
-
<div class='wptab wpt_types wpt_<?php echo $slug; ?>' aria-labelledby='tab_wpt_<?php echo $slug; ?>' role="tabpanel" id='wpt_<?php echo $slug; ?>'>
|
353 |
<?php
|
354 |
// share information about any usage of pre 2.8 category filters.
|
355 |
if ( ! function_exists( 'wpt_pro_exists' ) ) {
|
@@ -360,8 +361,8 @@ function wpt_update_settings() {
|
|
360 |
<fieldset>
|
361 |
<legend><?php _e( 'Tweet Templates', 'wp-to-twitter' ); ?></legend>
|
362 |
<p>
|
363 |
-
<input type="checkbox" name="wpt_post_types[<?php echo $slug; ?>][post-published-update]" id="<?php echo $slug; ?>-post-published-update" value="1" <?php echo wpt_checkbox( 'wpt_post_types', $slug, 'post-published-update' ); ?> />
|
364 |
-
<label for="<?php echo $slug; ?>-post-published-update"><strong>
|
365 |
<?php
|
366 |
// Translators: post type.
|
367 |
printf( __( 'Update when %s are published', 'wp-to-twitter' ), $name );
|
@@ -373,23 +374,23 @@ function wpt_update_settings() {
|
|
373 |
printf( __( 'Template for new %s', 'wp-to-twitter' ), $name );
|
374 |
?>
|
375 |
</label><br/>
|
376 |
-
<textarea class="wpt-template" name="wpt_post_types[<?php echo $slug; ?>][post-published-text]" id="<?php echo $slug; ?>-post-published-text" cols="60" rows="3"><?php echo ( isset( $wpt_settings[ $slug ] ) ) ? esc_attr( stripslashes( $wpt_settings[ $slug ]['post-published-text'] ) ) : ''; ?></textarea>
|
377 |
</p>
|
378 |
|
379 |
<p>
|
380 |
-
<input type="checkbox" name="wpt_post_types[<?php echo $slug; ?>][post-edited-update]" id="<?php echo $slug; ?>-post-edited-update" value="1" <?php echo wpt_checkbox( 'wpt_post_types', $slug, 'post-edited-update' ); ?> />
|
381 |
-
<label for="<?php echo $slug; ?>-post-edited-update"><strong>
|
382 |
<?php
|
383 |
// Translators: post type name.
|
384 |
printf( __( 'Update when %s are edited', 'wp-to-twitter' ), $name );
|
385 |
?>
|
386 |
-
</strong></label><br/><label for="<?php echo $slug; ?>-post-edited-text">
|
387 |
<?php
|
388 |
// Translators: post type name.
|
389 |
printf( __( 'Template for %1$s edits', 'wp-to-twitter' ), $name );
|
390 |
?>
|
391 |
</label><br/>
|
392 |
-
<textarea class="wpt-template" name="wpt_post_types[<?php echo $slug; ?>][post-edited-text]" id="<?php echo $slug; ?>-post-edited-text" cols="60" rows="3"><?php echo ( isset( $wpt_settings[ $slug ] ) ) ? esc_attr( stripslashes( $wpt_settings[ $slug ]['post-edited-text'] ) ) : ''; ?></textarea>
|
393 |
</p>
|
394 |
</fieldset>
|
395 |
<?php
|
@@ -416,7 +417,7 @@ function wpt_update_settings() {
|
|
416 |
<div>
|
417 |
<input type="hidden" name="submit-type" value="options" />
|
418 |
</div>
|
419 |
-
<input type="submit" name="submit" value="<?php
|
420 |
</div>
|
421 |
</form>
|
422 |
</div>
|
@@ -714,7 +715,7 @@ function wpt_update_settings() {
|
|
714 |
} else {
|
715 |
$label = '<code>#' . $k . '#</code>';
|
716 |
}
|
717 |
-
$inputs .= "<div class='wpt-truncate'><label for='$k-$v'>$label</label><br /><input type='number' size='3' value='$v' name='wpt_truncation_order[$k]' /></div> ";
|
718 |
}
|
719 |
?>
|
720 |
<fieldset>
|
@@ -746,9 +747,6 @@ function wpt_update_settings() {
|
|
746 |
<li>
|
747 |
<input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth" value="1" <?php echo wpt_checkbox( 'wp_debug_oauth' ); ?> /> <label for="wp_debug_oauth"><?php _e( 'Get Debugging Data for OAuth Connection', 'wp-to-twitter' ); ?></label>
|
748 |
</li>
|
749 |
-
<li>
|
750 |
-
<input type="checkbox" name="jd_donations" id="jd_donations" value="1" <?php echo wpt_checkbox( 'jd_donations' ); ?> /> <label for="jd_donations"><strong><?php _e( 'I made a donation, so stop whinging at me, please.', 'wp-to-twitter' ); ?></strong></label>
|
751 |
-
</li>
|
752 |
</ul>
|
753 |
</fieldset>
|
754 |
<div>
|
@@ -819,7 +817,7 @@ function wpt_sidebar() {
|
|
819 |
?>
|
820 |
<div class="inside resources">
|
821 |
<?php
|
822 |
-
if (
|
823 |
?>
|
824 |
<p class='cta'><?php _e( '<a href="http://www.wptweetspro.com/wp-tweets-pro">Get WP Tweets Pro</a>', 'wp-to-twitter' ); ?></p>
|
825 |
<?php
|
@@ -881,7 +879,7 @@ function wpt_sidebar() {
|
|
881 |
echo "<div>$nonce</div>";
|
882 |
?>
|
883 |
<p>
|
884 |
-
<input type="submit" name="submit" value="<?php
|
885 |
</p>
|
886 |
</form>
|
887 |
</div>
|
80 |
}
|
81 |
|
82 |
if ( isset( $_POST['submit-type'] ) && 'advanced' === $_POST['submit-type'] ) {
|
83 |
+
$default = ( isset( $_POST['jd_tweet_default'] ) ) ? sanitize_textarea_field( $_POST['jd_tweet_default'] ) : 0;
|
84 |
+
$default_edit = ( isset( $_POST['jd_tweet_default_edit'] ) ) ? sanitize_textarea_field( $_POST['jd_tweet_default_edit'] ) : 0;
|
85 |
+
update_option( 'jd_tweet_default', $default );
|
86 |
+
update_option( 'jd_tweet_default_edit', $default_edit );
|
87 |
|
88 |
if ( isset( $_POST['wpt_rate_limiting'] ) && '1' !== get_option( 'wpt_rate_limiting' ) ) {
|
89 |
$extend = __( 'Rate Limiting is enabled. Default rate limits are set at 10 posts per category/term per hour. <a href="#special_cases">Edit global default</a> or edit individual terms to customize limits for each category or taxonomy term.', 'wp-to-twitter' );
|
94 |
}
|
95 |
|
96 |
update_option( 'wpt_rate_limiting', ( isset( $_POST['wpt_rate_limiting'] ) ) ? 1 : 0 );
|
97 |
+
update_option( 'wpt_inline_edits', ( isset( $_POST['wpt_inline_edits'] ) ) ? 1 : 0 );
|
98 |
+
update_option( 'jd_twit_custom_url', sanitize_text_field( $_POST['jd_twit_custom_url'] ) );
|
|
|
99 |
update_option( 'wpt_default_rate_limit', ( isset( $_POST['wpt_default_rate_limit'] ) ? intval( $_POST['wpt_default_rate_limit'] ) : false ) );
|
100 |
+
update_option( 'jd_strip_nonan', ( isset( $_POST['jd_strip_nonan'] ) ) ? 1 : 0 );
|
101 |
+
update_option( 'jd_twit_prepend', sanitize_text_field( $_POST['jd_twit_prepend'] ) );
|
102 |
+
update_option( 'jd_twit_append', sanitize_text_field( $_POST['jd_twit_append'] ) );
|
103 |
+
update_option( 'jd_post_excerpt', (int) $_POST['jd_post_excerpt'] );
|
104 |
+
update_option( 'jd_max_tags', (int) $_POST['jd_max_tags'] );
|
105 |
+
$use_cats = ( isset( $_POST['wpt_use_cats'] ) ) ? 1 : 0;
|
106 |
update_option( 'wpt_use_cats', $use_cats );
|
107 |
update_option( 'wpt_tag_source', ( ( isset( $_POST['wpt_tag_source'] ) && 'slug' === $_POST['wpt_tag_source'] ) ? 'slug' : '' ) );
|
108 |
+
update_option( 'jd_max_characters', (int) $_POST['jd_max_characters'] );
|
109 |
+
update_option( 'jd_replace_character', ( isset( $_POST['jd_replace_character'] ) ? sanitize_text_field( $_POST['jd_replace_character'] ) : '' ) );
|
110 |
+
update_option( 'jd_date_format', sanitize_text_field( $_POST['jd_date_format'] ) );
|
111 |
+
update_option( 'jd_dynamic_analytics', sanitize_text_field( $_POST['jd-dynamic-analytics'] ) );
|
112 |
|
113 |
$twitter_analytics = ( isset( $_POST['twitter-analytics'] ) ) ? $_POST['twitter-analytics'] : 0;
|
114 |
if ( 1 === (int) $twitter_analytics ) {
|
125 |
update_option( 'no-analytics', 1 );
|
126 |
}
|
127 |
|
128 |
+
update_option( 'twitter-analytics-campaign', sanitize_text_field( $_POST['twitter-analytics-campaign'] ) );
|
129 |
+
update_option( 'jd_individual_twitter_users', ( isset( $_POST['jd_individual_twitter_users'] ) ? 1 : 0 ) );
|
130 |
|
131 |
if ( isset( $_POST['wpt_caps'] ) ) {
|
132 |
$perms = $_POST['wpt_caps'];
|
147 |
|
148 |
update_option( 'wpt_permit_feed_styles', ( isset( $_POST['wpt_permit_feed_styles'] ) ) ? 1 : 0 );
|
149 |
update_option( 'wp_debug_oauth', ( isset( $_POST['wp_debug_oauth'] ) ) ? 1 : 0 );
|
|
|
150 |
$wpt_truncation_order = $_POST['wpt_truncation_order'];
|
151 |
+
update_option( 'wpt_truncation_order', map_deep( $wpt_truncation_order, 'sanitize_text_field' ) );
|
152 |
$message .= __( 'WP to Twitter Advanced Options Updated', 'wp-to-twitter' ) . '. ' . $extend;
|
153 |
}
|
154 |
|
162 |
$keys = array();
|
163 |
$values = array();
|
164 |
foreach ( $_POST['wpt_post_types'] as $key => $value ) {
|
165 |
+
$value = map_deep( $value, 'sanitize_textarea_field' );
|
166 |
// using wp_encode_emoji allows me to save emoji in templates.
|
167 |
// ...but I haven't found a way to convert the saved emoji *back* to unicode.
|
168 |
// sending the HTML entity just yields a broken character on Twitter.
|
178 |
|
179 |
$wpt_settings = array_combine( $keys, $values );
|
180 |
update_option( 'wpt_post_types', $wpt_settings );
|
181 |
+
update_option( 'newlink-published-text', sanitize_text_field( $_POST['newlink-published-text'] ) );
|
182 |
+
update_option( 'jd_twit_blogroll', ( isset( $_POST['jd_twit_blogroll'] ) ) ? 1 : '' );
|
183 |
$message = wpt_select_shortener( $_POST );
|
184 |
$message .= __( 'WP to Twitter Options Updated', 'wp-to-twitter' );
|
185 |
$message = apply_filters( 'wpt_settings', $message, $_POST );
|
225 |
|
226 |
<?php
|
227 |
$default = ( '' === get_option( 'wtt_twitter_username', '' ) ) ? 'connection' : 'basic';
|
228 |
+
$current = ( isset( $_GET['tab'] ) ) ? sanitize_text_field( $_GET['tab'] ) : $default;
|
229 |
if ( 'connection' === $current ) {
|
230 |
if ( function_exists( 'wtt_connect_oauth' ) ) {
|
231 |
wtt_connect_oauth();
|
350 |
continue;
|
351 |
} else {
|
352 |
?>
|
353 |
+
<div class='wptab wpt_types wpt_<?php echo esc_attr( $slug ); ?>' aria-labelledby='tab_wpt_<?php echo esc_attr( $slug ); ?>' role="tabpanel" id='wpt_<?php echo esc_attr( $slug ); ?>'>
|
354 |
<?php
|
355 |
// share information about any usage of pre 2.8 category filters.
|
356 |
if ( ! function_exists( 'wpt_pro_exists' ) ) {
|
361 |
<fieldset>
|
362 |
<legend><?php _e( 'Tweet Templates', 'wp-to-twitter' ); ?></legend>
|
363 |
<p>
|
364 |
+
<input type="checkbox" name="wpt_post_types[<?php echo esc_attr( $slug ); ?>][post-published-update]" id="<?php echo esc_attr( $slug ); ?>-post-published-update" value="1" <?php echo wpt_checkbox( 'wpt_post_types', $slug, 'post-published-update' ); ?> />
|
365 |
+
<label for="<?php echo esc_attr( $slug ); ?>-post-published-update"><strong>
|
366 |
<?php
|
367 |
// Translators: post type.
|
368 |
printf( __( 'Update when %s are published', 'wp-to-twitter' ), $name );
|
374 |
printf( __( 'Template for new %s', 'wp-to-twitter' ), $name );
|
375 |
?>
|
376 |
</label><br/>
|
377 |
+
<textarea class="wpt-template" name="wpt_post_types[<?php echo esc_attr( $slug ); ?>][post-published-text]" id="<?php echo esc_attr( $slug ); ?>-post-published-text" cols="60" rows="3"><?php echo ( isset( $wpt_settings[ $slug ] ) ) ? esc_attr( stripslashes( $wpt_settings[ $slug ]['post-published-text'] ) ) : ''; ?></textarea>
|
378 |
</p>
|
379 |
|
380 |
<p>
|
381 |
+
<input type="checkbox" name="wpt_post_types[<?php echo esc_attr( $slug ); ?>][post-edited-update]" id="<?php echo esc_attr( $slug ); ?>-post-edited-update" value="1" <?php echo wpt_checkbox( 'wpt_post_types', $slug, 'post-edited-update' ); ?> />
|
382 |
+
<label for="<?php echo esc_attr( $slug ); ?>-post-edited-update"><strong>
|
383 |
<?php
|
384 |
// Translators: post type name.
|
385 |
printf( __( 'Update when %s are edited', 'wp-to-twitter' ), $name );
|
386 |
?>
|
387 |
+
</strong></label><br/><label for="<?php echo esc_attr( $slug ); ?>-post-edited-text">
|
388 |
<?php
|
389 |
// Translators: post type name.
|
390 |
printf( __( 'Template for %1$s edits', 'wp-to-twitter' ), $name );
|
391 |
?>
|
392 |
</label><br/>
|
393 |
+
<textarea class="wpt-template" name="wpt_post_types[<?php echo esc_attr( $slug ); ?>][post-edited-text]" id="<?php echo esc_attr( $slug ); ?>-post-edited-text" cols="60" rows="3"><?php echo ( isset( $wpt_settings[ $slug ] ) ) ? esc_attr( stripslashes( $wpt_settings[ $slug ]['post-edited-text'] ) ) : ''; ?></textarea>
|
394 |
</p>
|
395 |
</fieldset>
|
396 |
<?php
|
417 |
<div>
|
418 |
<input type="hidden" name="submit-type" value="options" />
|
419 |
</div>
|
420 |
+
<input type="submit" name="submit" value="<?php esc_attr_e( 'Save WP to Twitter Options', 'wp-to-twitter' ); ?>" class="button-primary" />
|
421 |
</div>
|
422 |
</form>
|
423 |
</div>
|
715 |
} else {
|
716 |
$label = '<code>#' . $k . '#</code>';
|
717 |
}
|
718 |
+
$inputs .= "<div class='wpt-truncate'><label for='" . esc_attr( "$k-$v" ) . "'>$label</label><br /><input type='number' size='3' value='" . esc_attr( $v ) . "' name='wpt_truncation_order[" . esc_attr( $k ) . "]' /></div> ";
|
719 |
}
|
720 |
?>
|
721 |
<fieldset>
|
747 |
<li>
|
748 |
<input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth" value="1" <?php echo wpt_checkbox( 'wp_debug_oauth' ); ?> /> <label for="wp_debug_oauth"><?php _e( 'Get Debugging Data for OAuth Connection', 'wp-to-twitter' ); ?></label>
|
749 |
</li>
|
|
|
|
|
|
|
750 |
</ul>
|
751 |
</fieldset>
|
752 |
<div>
|
817 |
?>
|
818 |
<div class="inside resources">
|
819 |
<?php
|
820 |
+
if ( ! function_exists( 'wpt_pro_exists' ) ) {
|
821 |
?>
|
822 |
<p class='cta'><?php _e( '<a href="http://www.wptweetspro.com/wp-tweets-pro">Get WP Tweets Pro</a>', 'wp-to-twitter' ); ?></p>
|
823 |
<?php
|
879 |
echo "<div>$nonce</div>";
|
880 |
?>
|
881 |
<p>
|
882 |
+
<input type="submit" name="submit" value="<?php esc_attr_e( 'Test WP to Twitter', 'wp-to-twitter' ); ?>" class="button-secondary" />
|
883 |
</p>
|
884 |
</form>
|
885 |
</div>
|
wp-to-twitter-oauth.php
CHANGED
@@ -116,10 +116,10 @@ function wpt_update_oauth_settings( $auth = false, $post = false ) {
|
|
116 |
&& ! empty( $post['wtt_oauth_token'] )
|
117 |
&& ! empty( $post['wtt_oauth_token_secret'] )
|
118 |
) {
|
119 |
-
$ack = trim( $post['wtt_app_consumer_key'] );
|
120 |
-
$acs = trim( $post['wtt_app_consumer_secret'] );
|
121 |
-
$ot = trim( $post['wtt_oauth_token'] );
|
122 |
-
$ots = trim( $post['wtt_oauth_token_secret'] );
|
123 |
if ( ! $auth ) {
|
124 |
// If values are filled with asterisks, do not update; these are masked values.
|
125 |
if ( stripos( $ack, '***' ) === false ) {
|
@@ -164,9 +164,9 @@ function wpt_update_oauth_settings( $auth = false, $post = false ) {
|
|
164 |
$error_information = '';
|
165 |
$decode = json_decode( $data );
|
166 |
if ( ! $auth ) {
|
167 |
-
update_option( 'wtt_twitter_username', stripslashes( $decode->screen_name ) );
|
168 |
} else {
|
169 |
-
update_user_meta( $auth, 'wtt_twitter_username', stripslashes( $decode->screen_name ) );
|
170 |
}
|
171 |
$oauth_hash = wtt_oauth_credentials_to_hash( $auth );
|
172 |
if ( ! $auth ) {
|
@@ -299,11 +299,11 @@ function wtt_connect_oauth( $auth = false ) {
|
|
299 |
<div class="tokens">
|
300 |
<p>
|
301 |
<label for="wtt_app_consumer_key">' . __( 'API Key', 'wp-to-twitter' ) . '</label>
|
302 |
-
<input type="text" size="45" name="wtt_app_consumer_key" id="wtt_app_consumer_key" value="' . wpt_mask_attr( $ack ) . '" />
|
303 |
</p>
|
304 |
<p>
|
305 |
<label for="wtt_app_consumer_secret">' . __( 'API Secret', 'wp-to-twitter' ) . '</label>
|
306 |
-
<input type="text" size="45" name="wtt_app_consumer_secret" id="wtt_app_consumer_secret" value="' . wpt_mask_attr( $acs ) . '" />
|
307 |
</p>
|
308 |
</div>
|
309 |
</li>
|
@@ -313,11 +313,11 @@ function wtt_connect_oauth( $auth = false ) {
|
|
313 |
<div class="tokens">
|
314 |
<p>
|
315 |
<label for="wtt_oauth_token">' . __( 'Access Token', 'wp-to-twitter' ) . '</label>
|
316 |
-
<input type="text" size="45" name="wtt_oauth_token" id="wtt_oauth_token" value="' . wpt_mask_attr( $ot ) . '" />
|
317 |
</p>
|
318 |
<p>
|
319 |
<label for="wtt_oauth_token_secret">' . __( 'Access Token Secret', 'wp-to-twitter' ) . '</label>
|
320 |
-
<input type="text" size="45" name="wtt_oauth_token_secret" id="wtt_oauth_token_secret" value="' . wpt_mask_attr( $ots ) . '" />
|
321 |
</p>
|
322 |
</div>
|
323 |
' . $submit . '
|
@@ -349,10 +349,10 @@ function wtt_connect_oauth( $auth = false ) {
|
|
349 |
<fieldset class="options">
|
350 |
<ul>
|
351 |
<li><strong class="auth_label">' . __( 'Twitter Username ', 'wp-to-twitter' ) . '</strong> <code class="auth_code"><a href="http://twitter.com/' . esc_attr( $uname ) . '">' . esc_attr( $uname ) . '</a></code></li>
|
352 |
-
<li><strong class="auth_label">' . __( 'API Key ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . wpt_mask_attr( $ack ) . '</code></li>
|
353 |
-
<li><strong class="auth_label">' . __( 'API Secret ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . wpt_mask_attr( $acs ) . '</code></li>
|
354 |
-
<li><strong class="auth_label">' . __( 'Access Token ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . wpt_mask_attr( $ot ) . '</code></li>
|
355 |
-
<li><strong class="auth_label">' . __( 'Access Token Secret ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . wpt_mask_attr( $ots ) . '</code></li>
|
356 |
</ul>
|
357 |
</fieldset>
|
358 |
<div>
|
116 |
&& ! empty( $post['wtt_oauth_token'] )
|
117 |
&& ! empty( $post['wtt_oauth_token_secret'] )
|
118 |
) {
|
119 |
+
$ack = sanitize_text_field( trim( $post['wtt_app_consumer_key'] ) );
|
120 |
+
$acs = sanitize_text_field( trim( $post['wtt_app_consumer_secret'] ) );
|
121 |
+
$ot = sanitize_text_field( trim( $post['wtt_oauth_token'] ) );
|
122 |
+
$ots = sanitize_text_field( trim( $post['wtt_oauth_token_secret'] ) );
|
123 |
if ( ! $auth ) {
|
124 |
// If values are filled with asterisks, do not update; these are masked values.
|
125 |
if ( stripos( $ack, '***' ) === false ) {
|
164 |
$error_information = '';
|
165 |
$decode = json_decode( $data );
|
166 |
if ( ! $auth ) {
|
167 |
+
update_option( 'wtt_twitter_username', sanitize_text_field( stripslashes( $decode->screen_name ) ) );
|
168 |
} else {
|
169 |
+
update_user_meta( $auth, 'wtt_twitter_username', sanitize_text_field( stripslashes( $decode->screen_name ) ) );
|
170 |
}
|
171 |
$oauth_hash = wtt_oauth_credentials_to_hash( $auth );
|
172 |
if ( ! $auth ) {
|
299 |
<div class="tokens">
|
300 |
<p>
|
301 |
<label for="wtt_app_consumer_key">' . __( 'API Key', 'wp-to-twitter' ) . '</label>
|
302 |
+
<input type="text" size="45" name="wtt_app_consumer_key" id="wtt_app_consumer_key" value="' . esc_attr( wpt_mask_attr( $ack ) ) . '" />
|
303 |
</p>
|
304 |
<p>
|
305 |
<label for="wtt_app_consumer_secret">' . __( 'API Secret', 'wp-to-twitter' ) . '</label>
|
306 |
+
<input type="text" size="45" name="wtt_app_consumer_secret" id="wtt_app_consumer_secret" value="' . esc_attr( wpt_mask_attr( $acs ) ) . '" />
|
307 |
</p>
|
308 |
</div>
|
309 |
</li>
|
313 |
<div class="tokens">
|
314 |
<p>
|
315 |
<label for="wtt_oauth_token">' . __( 'Access Token', 'wp-to-twitter' ) . '</label>
|
316 |
+
<input type="text" size="45" name="wtt_oauth_token" id="wtt_oauth_token" value="' . esc_attr( wpt_mask_attr( $ot ) ) . '" />
|
317 |
</p>
|
318 |
<p>
|
319 |
<label for="wtt_oauth_token_secret">' . __( 'Access Token Secret', 'wp-to-twitter' ) . '</label>
|
320 |
+
<input type="text" size="45" name="wtt_oauth_token_secret" id="wtt_oauth_token_secret" value="' . esc_attr( wpt_mask_attr( $ots ) ) . '" />
|
321 |
</p>
|
322 |
</div>
|
323 |
' . $submit . '
|
349 |
<fieldset class="options">
|
350 |
<ul>
|
351 |
<li><strong class="auth_label">' . __( 'Twitter Username ', 'wp-to-twitter' ) . '</strong> <code class="auth_code"><a href="http://twitter.com/' . esc_attr( $uname ) . '">' . esc_attr( $uname ) . '</a></code></li>
|
352 |
+
<li><strong class="auth_label">' . __( 'API Key ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . esc_attr( wpt_mask_attr( $ack ) ) . '</code></li>
|
353 |
+
<li><strong class="auth_label">' . __( 'API Secret ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . esc_attr( wpt_mask_attr( $acs ) ) . '</code></li>
|
354 |
+
<li><strong class="auth_label">' . __( 'Access Token ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . esc_attr( wpt_mask_attr( $ot ) ) . '</code></li>
|
355 |
+
<li><strong class="auth_label">' . __( 'Access Token Secret ', 'wp-to-twitter' ) . '</strong> <code class="auth_code">' . esc_attr( wpt_mask_attr( $ots ) ) . '</code></li>
|
356 |
</ul>
|
357 |
</fieldset>
|
358 |
<div>
|
wp-to-twitter-shorteners.php
CHANGED
@@ -303,6 +303,17 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
303 |
$token = get_option( 'yourlstoken' );
|
304 |
if ( $token ) {
|
305 |
$decoded = wpt_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&signature=$token" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
} else {
|
307 |
$decoded = wpt_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&username=$user&password=$pass" );
|
308 |
}
|
@@ -340,7 +351,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
340 |
$nonce = wp_nonce_field( 'wp-to-twitter-nonce', '_wpnonce', true, false );
|
341 |
$form_end = '<div>' . $nonce . '</div>
|
342 |
<p>
|
343 |
-
<input type="submit" name="submit" value="' .
|
344 |
</p>
|
345 |
</div>
|
346 |
</form>
|
@@ -350,13 +361,13 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
350 |
<div class="ui-sortable meta-box-sortables">
|
351 |
<div class="postbox">
|
352 |
<h3>
|
353 |
-
<span><?php
|
354 |
</h3>
|
355 |
|
356 |
<div class="inside">
|
357 |
<?php
|
358 |
if ( 7 === (int) $shortener ) {
|
359 |
-
echo '<p>' .
|
360 |
} elseif ( 2 === (int) $shortener ) {
|
361 |
if ( function_exists( 'wbitly_shorten_url' ) ) {
|
362 |
echo '<p>' . __( 'WP to Twitter supports Bit.ly shortened links via <a href="https://wordpress.org/plugins/codehaveli-bitly-url-shortener/">Codehaveli Bitly URL Shortener</a>. If you are having issues with Bit.ly URLs, please request support from <a href="https://wordpress.org/support/plugin/codehaveli-bitly-url-shortener/">the plugin support forums</a>.', 'wp-to-twitter' ) . '</p>';
|
@@ -469,15 +480,15 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
469 |
if ( isset( $post['submit-type'] ) && 'yourlsapi' === $post['submit-type'] ) {
|
470 |
$message = '';
|
471 |
if ( '' !== $post['yourlstoken'] && isset( $post['submit'] ) ) {
|
472 |
-
update_option( 'yourlstoken', trim( $post['yourlstoken'] ) );
|
473 |
delete_option( 'yourlsapi' );
|
474 |
delete_option( 'yourlslogin' );
|
475 |
$message .= __( 'YOURLS signature token updated.', 'wp-to-twitter' );
|
476 |
}
|
477 |
-
update_option( 'yourlsurl', trim( $post['yourlsurl'] ) );
|
478 |
// yourls path is deprecated.
|
479 |
if ( isset( $post['yourlspath'] ) && '' !== $post['yourlspath'] ) {
|
480 |
-
update_option( 'yourlspath', trim( $post['yourlspath'] ) );
|
481 |
if ( file_exists( $post['yourlspath'] ) ) {
|
482 |
$message .= ' ' . __( 'YOURLS local server path added. ', 'wp-to-twitter' );
|
483 |
} else {
|
@@ -485,7 +496,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
485 |
}
|
486 |
}
|
487 |
if ( '' !== $post['jd_keyword_format'] ) {
|
488 |
-
update_option( 'jd_keyword_format', $post['jd_keyword_format'] );
|
489 |
if ( '1' === $post['jd_keyword_format'] ) {
|
490 |
$message .= ' ' . __( 'YOURLS will use Post ID for short URL slug.', 'wp-to-twitter' );
|
491 |
} elseif ( '0' === $post['jd_keyword_format'] ) {
|
@@ -507,7 +518,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
507 |
|
508 |
if ( isset( $post['submit-type'] ) && 'joturlapi' === $post['submit-type'] ) {
|
509 |
if ( '' !== $post['joturlapi'] && isset( $post['submit'] ) ) {
|
510 |
-
update_option( 'joturlapi', trim( $post['joturlapi'] ) );
|
511 |
$message = __( 'jotURL private API Key Updated.', 'wp-to-twitter' );
|
512 |
} elseif ( isset( $post['clear'] ) ) {
|
513 |
update_option( 'joturlapi', '' );
|
@@ -516,7 +527,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
516 |
$message = __( "jotURL private API Key not added - <a href='https://www.joturl.com/reserved/api.html'>get one here</a>! A private API key is required to use the jotURL URL shortening service. ", 'wp-to-twitter' );
|
517 |
}
|
518 |
if ( '' !== $post['joturllogin'] && isset( $post['submit'] ) ) {
|
519 |
-
update_option( 'joturllogin', trim( $post['joturllogin'] ) );
|
520 |
$message .= __( 'jotURL public API Key Updated.', 'wp-to-twitter' );
|
521 |
} elseif ( isset( $post['clear'] ) ) {
|
522 |
update_option( 'joturllogin', '' );
|
@@ -529,14 +540,14 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
529 |
if ( substr( $v, 0, 1 ) === '&' || substr( $v, 0, 1 ) === '?' ) {
|
530 |
$v = substr( $v, 1 );
|
531 |
}
|
532 |
-
update_option( 'joturl_longurl_params', $v );
|
533 |
$message .= __( 'Long URL parameters added.', 'wp-to-twitter' );
|
534 |
} elseif ( isset( $post['clear'] ) ) {
|
535 |
update_option( 'joturl_longurl_params', '' );
|
536 |
$message = __( 'Long URL parameters deleted.', 'wp-to-twitter' );
|
537 |
}
|
538 |
if ( '' !== $post['joturl_domain'] && isset( $post['submit'] ) ) {
|
539 |
-
update_option( 'joturl_domain', $post['joturl_domain'] );
|
540 |
$message .= __( 'Custom jotURL domain saved.', 'wp-to-twitter' );
|
541 |
} elseif ( isset( $post['clear'] ) ) {
|
542 |
update_option( 'joturl_domain', '' );
|
@@ -547,7 +558,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
|
|
547 |
if ( substr( $v, 0, 1 ) === '&' || substr( $v, 0, 1 ) === '?' ) {
|
548 |
$v = substr( $v, 1 );
|
549 |
}
|
550 |
-
update_option( 'joturl_shorturl_params', $v );
|
551 |
$message .= __( 'Short URL parameters added.', 'wp-to-twitter' );
|
552 |
} elseif ( isset( $post['clear'] ) ) {
|
553 |
update_option( 'joturl_shorturl_params', '' );
|
303 |
$token = get_option( 'yourlstoken' );
|
304 |
if ( $token ) {
|
305 |
$decoded = wpt_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&signature=$token" );
|
306 |
+
if ( '404' === (string) $decoded ) {
|
307 |
+
$short_url = urldecode( $short_url );
|
308 |
+
if ( false === stripos( $short_url, 'https://' ) ) {
|
309 |
+
// Yourls will throw an error for mismatched protocol.
|
310 |
+
$short_url = str_replace( 'http://', 'https://', $short_url );
|
311 |
+
} else {
|
312 |
+
$short_url = str_replace( 'https://', 'http://', $short_url );
|
313 |
+
}
|
314 |
+
$short_url = urlencode( $short_url );
|
315 |
+
$decoded = wpt_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&signature=$token" );
|
316 |
+
}
|
317 |
} else {
|
318 |
$decoded = wpt_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&username=$user&password=$pass" );
|
319 |
}
|
351 |
$nonce = wp_nonce_field( 'wp-to-twitter-nonce', '_wpnonce', true, false );
|
352 |
$form_end = '<div>' . $nonce . '</div>
|
353 |
<p>
|
354 |
+
<input type="submit" name="submit" value="' . esc_attr__( 'Save URL Shortener Settings', 'wp-to-twitter' ) . '" class="button-primary" />
|
355 |
</p>
|
356 |
</div>
|
357 |
</form>
|
361 |
<div class="ui-sortable meta-box-sortables">
|
362 |
<div class="postbox">
|
363 |
<h3>
|
364 |
+
<span><?php esc_html_e( 'URL Shortener Account Settings', 'wp-to-twitter' ); ?></span>
|
365 |
</h3>
|
366 |
|
367 |
<div class="inside">
|
368 |
<?php
|
369 |
if ( 7 === (int) $shortener ) {
|
370 |
+
echo '<p>' . esc_html__( 'The Su.pr URL shortener was shut down when Stumbleupon closed doors in June 2018.', 'wp-to-twitter' ) . '</p>';
|
371 |
} elseif ( 2 === (int) $shortener ) {
|
372 |
if ( function_exists( 'wbitly_shorten_url' ) ) {
|
373 |
echo '<p>' . __( 'WP to Twitter supports Bit.ly shortened links via <a href="https://wordpress.org/plugins/codehaveli-bitly-url-shortener/">Codehaveli Bitly URL Shortener</a>. If you are having issues with Bit.ly URLs, please request support from <a href="https://wordpress.org/support/plugin/codehaveli-bitly-url-shortener/">the plugin support forums</a>.', 'wp-to-twitter' ) . '</p>';
|
480 |
if ( isset( $post['submit-type'] ) && 'yourlsapi' === $post['submit-type'] ) {
|
481 |
$message = '';
|
482 |
if ( '' !== $post['yourlstoken'] && isset( $post['submit'] ) ) {
|
483 |
+
update_option( 'yourlstoken', sanitize_text_field( trim( $post['yourlstoken'] ) ) );
|
484 |
delete_option( 'yourlsapi' );
|
485 |
delete_option( 'yourlslogin' );
|
486 |
$message .= __( 'YOURLS signature token updated.', 'wp-to-twitter' );
|
487 |
}
|
488 |
+
update_option( 'yourlsurl', sanitize_text_field( trim( $post['yourlsurl'] ) ) );
|
489 |
// yourls path is deprecated.
|
490 |
if ( isset( $post['yourlspath'] ) && '' !== $post['yourlspath'] ) {
|
491 |
+
update_option( 'yourlspath', sanitize_text_field( trim( $post['yourlspath'] ) ) );
|
492 |
if ( file_exists( $post['yourlspath'] ) ) {
|
493 |
$message .= ' ' . __( 'YOURLS local server path added. ', 'wp-to-twitter' );
|
494 |
} else {
|
496 |
}
|
497 |
}
|
498 |
if ( '' !== $post['jd_keyword_format'] ) {
|
499 |
+
update_option( 'jd_keyword_format', sanitize_text_field( $post['jd_keyword_format'] ) );
|
500 |
if ( '1' === $post['jd_keyword_format'] ) {
|
501 |
$message .= ' ' . __( 'YOURLS will use Post ID for short URL slug.', 'wp-to-twitter' );
|
502 |
} elseif ( '0' === $post['jd_keyword_format'] ) {
|
518 |
|
519 |
if ( isset( $post['submit-type'] ) && 'joturlapi' === $post['submit-type'] ) {
|
520 |
if ( '' !== $post['joturlapi'] && isset( $post['submit'] ) ) {
|
521 |
+
update_option( 'joturlapi', sanitize_text_field( trim( $post['joturlapi'] ) ) );
|
522 |
$message = __( 'jotURL private API Key Updated.', 'wp-to-twitter' );
|
523 |
} elseif ( isset( $post['clear'] ) ) {
|
524 |
update_option( 'joturlapi', '' );
|
527 |
$message = __( "jotURL private API Key not added - <a href='https://www.joturl.com/reserved/api.html'>get one here</a>! A private API key is required to use the jotURL URL shortening service. ", 'wp-to-twitter' );
|
528 |
}
|
529 |
if ( '' !== $post['joturllogin'] && isset( $post['submit'] ) ) {
|
530 |
+
update_option( 'joturllogin', sanitize_text_field( trim( $post['joturllogin'] ) ) );
|
531 |
$message .= __( 'jotURL public API Key Updated.', 'wp-to-twitter' );
|
532 |
} elseif ( isset( $post['clear'] ) ) {
|
533 |
update_option( 'joturllogin', '' );
|
540 |
if ( substr( $v, 0, 1 ) === '&' || substr( $v, 0, 1 ) === '?' ) {
|
541 |
$v = substr( $v, 1 );
|
542 |
}
|
543 |
+
update_option( 'joturl_longurl_params', sanitize_text_field( $v ) );
|
544 |
$message .= __( 'Long URL parameters added.', 'wp-to-twitter' );
|
545 |
} elseif ( isset( $post['clear'] ) ) {
|
546 |
update_option( 'joturl_longurl_params', '' );
|
547 |
$message = __( 'Long URL parameters deleted.', 'wp-to-twitter' );
|
548 |
}
|
549 |
if ( '' !== $post['joturl_domain'] && isset( $post['submit'] ) ) {
|
550 |
+
update_option( 'joturl_domain', sanitize_text_field( $post['joturl_domain'] ) );
|
551 |
$message .= __( 'Custom jotURL domain saved.', 'wp-to-twitter' );
|
552 |
} elseif ( isset( $post['clear'] ) ) {
|
553 |
update_option( 'joturl_domain', '' );
|
558 |
if ( substr( $v, 0, 1 ) === '&' || substr( $v, 0, 1 ) === '?' ) {
|
559 |
$v = substr( $v, 1 );
|
560 |
}
|
561 |
+
update_option( 'joturl_shorturl_params', sanitize_text_field( $v ) );
|
562 |
$message .= __( 'Short URL parameters added.', 'wp-to-twitter' );
|
563 |
} elseif ( isset( $post['clear'] ) ) {
|
564 |
update_option( 'joturl_shorturl_params', '' );
|
wp-to-twitter-users.php
CHANGED
@@ -110,8 +110,8 @@ function wpt_twitter_save_profile() {
|
|
110 |
$edit_id = $user_ID;
|
111 |
}
|
112 |
if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
|
113 |
-
$enable = ( isset( $_POST['wpt-enable-user'] ) ) ? $_POST['wpt-enable-user'] : '';
|
114 |
-
$username = ( isset( $_POST['wpt-username'] ) ) ? $_POST['wpt-username'] : '';
|
115 |
$wpt_remove = ( isset( $_POST['wpt-remove'] ) ) ? 'on' : '';
|
116 |
update_user_meta( $edit_id, 'wp-to-twitter-enable-user', $enable );
|
117 |
update_user_meta( $edit_id, 'wp-to-twitter-user-username', $username );
|
110 |
$edit_id = $user_ID;
|
111 |
}
|
112 |
if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
|
113 |
+
$enable = ( isset( $_POST['wpt-enable-user'] ) ) ? sanitize_text_field( $_POST['wpt-enable-user'] ) : '';
|
114 |
+
$username = ( isset( $_POST['wpt-username'] ) ) ? sanitize_text_field( $_POST['wpt-username'] ) : '';
|
115 |
$wpt_remove = ( isset( $_POST['wpt-remove'] ) ) ? 'on' : '';
|
116 |
update_user_meta( $edit_id, 'wp-to-twitter-enable-user', $enable );
|
117 |
update_user_meta( $edit_id, 'wp-to-twitter-user-username', $username );
|
wp-to-twitter.php
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
* License: GPL-2.0+
|
18 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
19 |
* Domain Path: lang
|
20 |
-
* Version: 3.5.
|
21 |
*/
|
22 |
|
23 |
/*
|
@@ -41,7 +41,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
41 |
exit;
|
42 |
}
|
43 |
|
44 |
-
define( 'WPT_DEBUG', false );
|
45 |
define( 'WPT_DEBUG_BY_EMAIL', false ); // Email debugging no longer default as of 3.3.0.
|
46 |
define( 'WPT_DEBUG_ADDRESS', get_option( 'admin_email' ) );
|
47 |
define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
|
@@ -64,7 +64,7 @@ require_once( plugin_dir_path( __FILE__ ) . 'wpt-widget.php' );
|
|
64 |
require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
|
65 |
|
66 |
global $wpt_version;
|
67 |
-
$wpt_version = '3.5.
|
68 |
|
69 |
add_action( 'init', 'wpt_load_textdomain' );
|
70 |
/**
|
@@ -161,7 +161,6 @@ function wptotwitter_activate() {
|
|
161 |
$contributor->add_cap( 'wpt_can_tweet' );
|
162 |
}
|
163 |
|
164 |
-
update_option( 'jd_twit_remote', '0' );
|
165 |
update_option( 'jd_post_excerpt', 30 );
|
166 |
// Use Google Analytics with Twitter.
|
167 |
update_option( 'twitter-analytics-campaign', 'twitter' );
|
@@ -514,6 +513,11 @@ function wpt_post_to_twitter( $twit, $auth = false, $id = false, $media = false
|
|
514 |
wpt_set_log( 'wpt_status_message', $id, $error );
|
515 |
} else {
|
516 |
do_action( 'wpt_tweet_posted', $connection, $id );
|
|
|
|
|
|
|
|
|
|
|
517 |
wpt_set_log( 'wpt_status_message', $id, $notice . __( 'Tweet sent successfully.', 'wp-to-twitter' ) );
|
518 |
}
|
519 |
|
@@ -810,7 +814,7 @@ function wpt_tweet( $post_ID, $type = 'instant', $post = null, $updated = null,
|
|
810 |
// create Tweet and ID whether current action is edit or new.
|
811 |
$ct = get_post_meta( $post_ID, '_jd_twitter', true );
|
812 |
if ( isset( $_POST['_jd_twitter'] ) && '' !== trim( $_POST['_jd_twitter'] ) ) {
|
813 |
-
$ct = $_POST['_jd_twitter'];
|
814 |
}
|
815 |
$custom_tweet = ( '' !== $ct ) ? stripcslashes( trim( $ct ) ) : '';
|
816 |
// if ops is set and equals 'publish', this is being edited. Otherwise, it's a new post.
|
@@ -986,9 +990,9 @@ function wpt_twit_link( $link_id ) {
|
|
986 |
wpt_check_version();
|
987 |
$thislinkprivate = $_POST['link_visible'];
|
988 |
if ( 'N' !== $thislinkprivate ) {
|
989 |
-
$thislinkname = stripslashes( $_POST['link_name'] );
|
990 |
-
$thispostlink = $_POST['link_url'];
|
991 |
-
$thislinkdescription = stripcslashes( $_POST['link_description'] );
|
992 |
$sentence = stripcslashes( get_option( 'newlink-published-text' ) );
|
993 |
$sentence = str_ireplace( '#title#', $thislinkname, $sentence );
|
994 |
$sentence = str_ireplace( '#description#', $thislinkdescription, $sentence );
|
@@ -1570,17 +1574,17 @@ function wpt_save_post( $id, $post ) {
|
|
1570 |
return $id;
|
1571 |
}
|
1572 |
if ( isset( $_POST['_yourls_keyword'] ) ) {
|
1573 |
-
$yourls = $_POST['_yourls_keyword'];
|
1574 |
$update = update_post_meta( $id, '_yourls_keyword', $yourls );
|
1575 |
}
|
1576 |
if ( isset( $_POST['_jd_twitter'] ) && '' !== $_POST['_jd_twitter'] ) {
|
1577 |
-
$twitter = $_POST['_jd_twitter'];
|
1578 |
$update = update_post_meta( $id, '_jd_twitter', $twitter );
|
1579 |
} elseif ( isset( $_POST['_jd_twitter'] ) && '' === $_POST['_jd_twitter'] ) {
|
1580 |
delete_post_meta( $id, '_jd_twitter' );
|
1581 |
}
|
1582 |
if ( isset( $_POST['_jd_wp_twitter'] ) && '' !== $_POST['_jd_wp_twitter'] ) {
|
1583 |
-
$wp_twitter = $_POST['_jd_wp_twitter'];
|
1584 |
$update = update_post_meta( $id, '_jd_wp_twitter', $wp_twitter );
|
1585 |
}
|
1586 |
if ( isset( $_POST['_jd_tweet_this'] ) ) {
|
@@ -1602,7 +1606,7 @@ function wpt_save_post( $id, $post ) {
|
|
1602 |
$update = apply_filters( 'wpt_insert_post', $_POST, $id );
|
1603 |
// WPT PRO.
|
1604 |
// only send debug data if post meta is updated.
|
1605 |
-
wpt_mail( 'Post Meta Processed', 'WP to Twitter post meta was updated' . print_r( $_POST, 1 ), $id ); // DEBUG.
|
1606 |
|
1607 |
if ( isset( $_POST['wpt-delete-debug'] ) && 'true' === $_POST['wpt-delete-debug'] ) {
|
1608 |
delete_post_meta( $id, '_wpt_debug_log' );
|
@@ -1890,7 +1894,7 @@ function wpt_debugging_enabled() {
|
|
1890 |
* Display promotion notice to admin users who have not donated or purchased WP Tweets PRO.
|
1891 |
*/
|
1892 |
function wpt_promotion_notice() {
|
1893 |
-
if ( current_user_can( 'activate_plugins' ) && '2' === get_option( 'wpt_promotion_scheduled' )
|
1894 |
$upgrade = 'http://www.wptweetspro.com/wp-tweets-pro/';
|
1895 |
$dismiss = admin_url( 'admin.php?page=wp-tweets-pro&dismiss=promotion' );
|
1896 |
// Translators: URL to upgrade.
|
17 |
* License: GPL-2.0+
|
18 |
* License URI: http://www.gnu.org/license/gpl-2.0.txt
|
19 |
* Domain Path: lang
|
20 |
+
* Version: 3.5.4
|
21 |
*/
|
22 |
|
23 |
/*
|
41 |
exit;
|
42 |
}
|
43 |
|
44 |
+
define( 'WPT_DEBUG', false );
|
45 |
define( 'WPT_DEBUG_BY_EMAIL', false ); // Email debugging no longer default as of 3.3.0.
|
46 |
define( 'WPT_DEBUG_ADDRESS', get_option( 'admin_email' ) );
|
47 |
define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
|
64 |
require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
|
65 |
|
66 |
global $wpt_version;
|
67 |
+
$wpt_version = '3.5.4';
|
68 |
|
69 |
add_action( 'init', 'wpt_load_textdomain' );
|
70 |
/**
|
161 |
$contributor->add_cap( 'wpt_can_tweet' );
|
162 |
}
|
163 |
|
|
|
164 |
update_option( 'jd_post_excerpt', 30 );
|
165 |
// Use Google Analytics with Twitter.
|
166 |
update_option( 'twitter-analytics-campaign', 'twitter' );
|
513 |
wpt_set_log( 'wpt_status_message', $id, $error );
|
514 |
} else {
|
515 |
do_action( 'wpt_tweet_posted', $connection, $id );
|
516 |
+
// Log the Tweet ID of the first Tweet for this post.
|
517 |
+
$has_tweet_id = get_post_meta( $id, '_wpt_tweet_id', true );
|
518 |
+
if ( ! $has_tweet_id ) {
|
519 |
+
update_post_meta( $id, '_wpt_tweet_id', $connection->body->id );
|
520 |
+
}
|
521 |
wpt_set_log( 'wpt_status_message', $id, $notice . __( 'Tweet sent successfully.', 'wp-to-twitter' ) );
|
522 |
}
|
523 |
|
814 |
// create Tweet and ID whether current action is edit or new.
|
815 |
$ct = get_post_meta( $post_ID, '_jd_twitter', true );
|
816 |
if ( isset( $_POST['_jd_twitter'] ) && '' !== trim( $_POST['_jd_twitter'] ) ) {
|
817 |
+
$ct = sanitize_textarea_field( $_POST['_jd_twitter'] );
|
818 |
}
|
819 |
$custom_tweet = ( '' !== $ct ) ? stripcslashes( trim( $ct ) ) : '';
|
820 |
// if ops is set and equals 'publish', this is being edited. Otherwise, it's a new post.
|
990 |
wpt_check_version();
|
991 |
$thislinkprivate = $_POST['link_visible'];
|
992 |
if ( 'N' !== $thislinkprivate ) {
|
993 |
+
$thislinkname = stripslashes( sanitize_text_field( $_POST['link_name'] ) );
|
994 |
+
$thispostlink = sanitize_text_field( $_POST['link_url'] );
|
995 |
+
$thislinkdescription = stripcslashes( sanitize_textarea_field( $_POST['link_description'] ) );
|
996 |
$sentence = stripcslashes( get_option( 'newlink-published-text' ) );
|
997 |
$sentence = str_ireplace( '#title#', $thislinkname, $sentence );
|
998 |
$sentence = str_ireplace( '#description#', $thislinkdescription, $sentence );
|
1574 |
return $id;
|
1575 |
}
|
1576 |
if ( isset( $_POST['_yourls_keyword'] ) ) {
|
1577 |
+
$yourls = sanitize_text_field( $_POST['_yourls_keyword'] );
|
1578 |
$update = update_post_meta( $id, '_yourls_keyword', $yourls );
|
1579 |
}
|
1580 |
if ( isset( $_POST['_jd_twitter'] ) && '' !== $_POST['_jd_twitter'] ) {
|
1581 |
+
$twitter = sanitize_textarea_field( $_POST['_jd_twitter'] );
|
1582 |
$update = update_post_meta( $id, '_jd_twitter', $twitter );
|
1583 |
} elseif ( isset( $_POST['_jd_twitter'] ) && '' === $_POST['_jd_twitter'] ) {
|
1584 |
delete_post_meta( $id, '_jd_twitter' );
|
1585 |
}
|
1586 |
if ( isset( $_POST['_jd_wp_twitter'] ) && '' !== $_POST['_jd_wp_twitter'] ) {
|
1587 |
+
$wp_twitter = sanitize_textarea_field( $_POST['_jd_wp_twitter'] );
|
1588 |
$update = update_post_meta( $id, '_jd_wp_twitter', $wp_twitter );
|
1589 |
}
|
1590 |
if ( isset( $_POST['_jd_tweet_this'] ) ) {
|
1606 |
$update = apply_filters( 'wpt_insert_post', $_POST, $id );
|
1607 |
// WPT PRO.
|
1608 |
// only send debug data if post meta is updated.
|
1609 |
+
wpt_mail( 'Post Meta Processed', 'WP to Twitter post meta was updated' . print_r( map_deep( $_POST, 'sanitize_textarea_field' ), 1 ), $id ); // DEBUG.
|
1610 |
|
1611 |
if ( isset( $_POST['wpt-delete-debug'] ) && 'true' === $_POST['wpt-delete-debug'] ) {
|
1612 |
delete_post_meta( $id, '_wpt_debug_log' );
|
1894 |
* Display promotion notice to admin users who have not donated or purchased WP Tweets PRO.
|
1895 |
*/
|
1896 |
function wpt_promotion_notice() {
|
1897 |
+
if ( current_user_can( 'activate_plugins' ) && '2' === get_option( 'wpt_promotion_scheduled' ) ) {
|
1898 |
$upgrade = 'http://www.wptweetspro.com/wp-tweets-pro/';
|
1899 |
$dismiss = admin_url( 'admin.php?page=wp-tweets-pro&dismiss=promotion' );
|
1900 |
// Translators: URL to upgrade.
|
wpt-functions.php
CHANGED
@@ -150,7 +150,7 @@ function wpt_settings_tabs() {
|
|
150 |
$output = '';
|
151 |
$username = get_option( 'wtt_twitter_username' );
|
152 |
$default = ( '' === $username || false === $username ) ? 'connection' : 'basic';
|
153 |
-
$current = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : $default;
|
154 |
$pro_text = ( function_exists( 'wpt_pro_exists' ) ) ? __( 'Pro Settings', 'wp-to-twitter' ) : __( 'Get WP Tweets PRO', 'wp-to-twitter' );
|
155 |
$pages = array(
|
156 |
'connection' => __( 'Twitter Connection', 'wp-to-twitter' ),
|
@@ -160,7 +160,7 @@ function wpt_settings_tabs() {
|
|
160 |
'support' => __( 'Get Help', 'wp-to-twitter' ),
|
161 |
'pro' => $pro_text,
|
162 |
);
|
163 |
-
if (
|
164 |
unset( $pages['pro'] );
|
165 |
}
|
166 |
|
@@ -189,11 +189,11 @@ function wpt_show_last_tweet() {
|
|
189 |
$post_ID = $log[0];
|
190 |
$post = get_post( $post_ID );
|
191 |
if ( is_object( $post ) ) {
|
192 |
-
$title = "<a href='" . get_edit_post_link( $post_ID ) . "'
|
193 |
} else {
|
194 |
$title = '(' . __( 'No post', 'wp-to-twitter' ) . ')';
|
195 |
}
|
196 |
-
$notice = $log[1];
|
197 |
echo "<div class='updated'><p><strong>" . __( 'Last Tweet', 'wp-to-twitter' ) . "</strong>: $title » $notice</p></div>";
|
198 |
}
|
199 |
}
|
@@ -250,7 +250,7 @@ function wpt_check_caps( $role, $cap ) {
|
|
250 |
* @return Checkbox HTML.
|
251 |
*/
|
252 |
function wpt_cap_checkbox( $role, $cap, $name ) {
|
253 |
-
return "<li><input type='checkbox' id='wpt_caps_{$role}_$cap' name='wpt_caps[$role][$cap]' value='on'" . wpt_check_caps( $role, $cap ) . " /> <label for='wpt_caps_{$role}_$cap'
|
254 |
}
|
255 |
|
256 |
/**
|
@@ -302,7 +302,7 @@ function wpt_show_debug() {
|
|
302 |
$date = date_i18n( 'Y-m-d H:i:s', $entry[0] );
|
303 |
$subject = $entry[1];
|
304 |
$body = $entry[2];
|
305 |
-
$records .= "<li><button type='button' class='toggle-debug button-secondary' aria-expanded='false'><strong>$date</strong>:<br
|
306 |
}
|
307 |
}
|
308 |
$script = "
|
150 |
$output = '';
|
151 |
$username = get_option( 'wtt_twitter_username' );
|
152 |
$default = ( '' === $username || false === $username ) ? 'connection' : 'basic';
|
153 |
+
$current = ( isset( $_GET['tab'] ) ) ? sanitize_text_field( $_GET['tab'] ) : $default;
|
154 |
$pro_text = ( function_exists( 'wpt_pro_exists' ) ) ? __( 'Pro Settings', 'wp-to-twitter' ) : __( 'Get WP Tweets PRO', 'wp-to-twitter' );
|
155 |
$pages = array(
|
156 |
'connection' => __( 'Twitter Connection', 'wp-to-twitter' ),
|
160 |
'support' => __( 'Get Help', 'wp-to-twitter' ),
|
161 |
'pro' => $pro_text,
|
162 |
);
|
163 |
+
if ( ! function_exists( 'wpt_pro_exists' ) ) {
|
164 |
unset( $pages['pro'] );
|
165 |
}
|
166 |
|
189 |
$post_ID = $log[0];
|
190 |
$post = get_post( $post_ID );
|
191 |
if ( is_object( $post ) ) {
|
192 |
+
$title = "<a href='" . esc_url( get_edit_post_link( $post_ID ) ) . "'>" . esc_html( $post->post_title ) . '</a>';
|
193 |
} else {
|
194 |
$title = '(' . __( 'No post', 'wp-to-twitter' ) . ')';
|
195 |
}
|
196 |
+
$notice = esc_html( $log[1] );
|
197 |
echo "<div class='updated'><p><strong>" . __( 'Last Tweet', 'wp-to-twitter' ) . "</strong>: $title » $notice</p></div>";
|
198 |
}
|
199 |
}
|
250 |
* @return Checkbox HTML.
|
251 |
*/
|
252 |
function wpt_cap_checkbox( $role, $cap, $name ) {
|
253 |
+
return "<li><input type='checkbox' id='wpt_caps_{$role}_$cap' name='wpt_caps[$role][$cap]' value='on'" . wpt_check_caps( $role, $cap ) . " /> <label for='wpt_caps_{$role}_$cap'>" . esc_html( $name ) . '</label></li>';
|
254 |
}
|
255 |
|
256 |
/**
|
302 |
$date = date_i18n( 'Y-m-d H:i:s', $entry[0] );
|
303 |
$subject = $entry[1];
|
304 |
$body = $entry[2];
|
305 |
+
$records .= "<li><button type='button' class='toggle-debug button-secondary' aria-expanded='false'><strong>$date</strong>:<br />" . esc_html( $subject ) . "</button><pre class='wpt-debug-details'>" . esc_html( $body ) . '</pre></li>';
|
306 |
}
|
307 |
}
|
308 |
$script = "
|
wpt-truncate.php
CHANGED
@@ -19,47 +19,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
* @return array of URL lengths and params.
|
20 |
*/
|
21 |
function wpt_max_length() {
|
22 |
-
$
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
if ( $connection ) {
|
28 |
-
$config = $connection->get( 'https://api.twitter.com/1.1/help/configuration.json' );
|
29 |
-
} else {
|
30 |
-
$config = json_encode(
|
31 |
-
array(
|
32 |
-
'http_length' => 23,
|
33 |
-
'https_length' => 23,
|
34 |
-
'reserved_chars' => 24,
|
35 |
-
)
|
36 |
-
);
|
37 |
-
}
|
38 |
-
}
|
39 |
-
$decoded = ( is_string( $config ) ) ? json_decode( $config ) : $config;
|
40 |
-
|
41 |
-
if ( is_object( $decoded ) && isset( $decoded->short_url_length ) ) {
|
42 |
-
$short_url_length = $decoded->short_url_length;
|
43 |
-
$short_url_https = $decoded->short_url_length_https;
|
44 |
-
$reserved_char = $decoded->characters_reserved_per_media;
|
45 |
-
$values = array(
|
46 |
-
'http_length' => $short_url_length,
|
47 |
-
'https_length' => $short_url_https,
|
48 |
-
'reserved_chars' => $reserved_char,
|
49 |
-
);
|
50 |
-
|
51 |
-
} else {
|
52 |
-
// if config query is invalid, use default values; these may become invalid.
|
53 |
-
$values = array(
|
54 |
-
'http_length' => 23,
|
55 |
-
'https_length' => 23,
|
56 |
-
'reserved_chars' => 24,
|
57 |
-
);
|
58 |
-
}
|
59 |
-
if ( $set_transient ) {
|
60 |
-
// Only set the transient after confirming valid values.
|
61 |
-
set_transient( 'wpt_twitter_config', $values, 60 * 60 * 24 );
|
62 |
-
}
|
63 |
|
64 |
$values['base_length'] = intval( ( get_option( 'wpt_tweet_length' ) ) ? get_option( 'wpt_tweet_length' ) : 140 ) - 1;
|
65 |
|
19 |
* @return array of URL lengths and params.
|
20 |
*/
|
21 |
function wpt_max_length() {
|
22 |
+
$values = array(
|
23 |
+
'http_length' => 23,
|
24 |
+
'https_length' => 23,
|
25 |
+
'reserved_chars' => 24,
|
26 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
$values['base_length'] = intval( ( get_option( 'wpt_tweet_length' ) ) ? get_option( 'wpt_tweet_length' ) : 140 ) - 1;
|
29 |
|
wpt-widget.php
CHANGED
@@ -42,7 +42,7 @@ function wpt_tweet_linkify( $text, $opts, $tweet ) {
|
|
42 |
foreach ( $media as $key => $image ) {
|
43 |
$media_urls[] = $image['url'];
|
44 |
$alt = isset( $tweet['extended_entities']['media'][ $key ]['ext_alt_text'] ) ? $tweet['extended_entities']['media'][ $key ]['ext_alt_text'] : '';
|
45 |
-
$text .= "<img src='$image[media_url_https]' alt='$alt' class='wpt-twitter-image' />";
|
46 |
|
47 |
}
|
48 |
}
|
42 |
foreach ( $media as $key => $image ) {
|
43 |
$media_urls[] = $image['url'];
|
44 |
$alt = isset( $tweet['extended_entities']['media'][ $key ]['ext_alt_text'] ) ? $tweet['extended_entities']['media'][ $key ]['ext_alt_text'] : '';
|
45 |
+
$text .= "<img src='" . esc_url( $image['media_url_https'] ) . "' alt='" . esc_attr( $alt ) . "' class='wpt-twitter-image' />";
|
46 |
|
47 |
}
|
48 |
}
|