WP to Twitter - Version 3.5.6

Version Description

  • Bug fix: Change in link to Twitter API error codes.
  • Bug fix: Restore sales page, accidentally removed in previous update.
  • Change: Option added to enable debugging from admin (in Advanced Settings.)
Download this release

Release Info

Developer joedolson
Plugin Icon 128x128 WP to Twitter
Version 3.5.6
Comparing to
See all releases

Code changes from version 3.5.5 to 3.5.6

css/post-styles.css CHANGED
@@ -136,6 +136,7 @@
136
  .wpt-debug-details {
137
  display: none;
138
  white-space: pre-wrap;
 
139
  }
140
 
141
  #wp2t-debug .wpt-debug-log button {
136
  .wpt-debug-details {
137
  display: none;
138
  white-space: pre-wrap;
139
+ padding: 10px;
140
  }
141
 
142
  #wp2t-debug .wpt-debug-log button {
css/styles.css CHANGED
@@ -226,12 +226,12 @@ label[for="wpt_license_key"] {
226
  display: inline-block;
227
  }
228
 
229
- .jcd-wide {
230
- width: 75%;
231
  }
232
 
233
- .jcd-narrow {
234
- width: 20%;
235
  }
236
 
237
  label[for='wpt_prepend_rt'], label[for='wpt_prepend_rt2'], label[for='wpt_prepend_rt3'] {
@@ -319,11 +319,11 @@ label[for='wpt_prepend_rt'], label[for='wpt_prepend_rt2'], label[for='wpt_prepen
319
  }
320
 
321
  @media (max-width: 782px) {
322
- .jcd-narrow {
323
  width: 100%;
324
  }
325
 
326
- .jcd-wide {
327
  width: 100%;
328
  }
329
 
226
  display: inline-block;
227
  }
228
 
229
+ #wp-to-twitter .jcd-wide {
230
+ width: 70%;
231
  }
232
 
233
+ #wp-to-twitter .jcd-narrow {
234
+ width: 25%;
235
  }
236
 
237
  label[for='wpt_prepend_rt'], label[for='wpt_prepend_rt2'], label[for='wpt_prepend_rt3'] {
319
  }
320
 
321
  @media (max-width: 782px) {
322
+ #wp-to-twitter .jcd-narrow {
323
  width: 100%;
324
  }
325
 
326
+ #wp-to-twitter .jcd-wide {
327
  width: 100%;
328
  }
329
 
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.8
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
- Stable tag: 3.5.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,12 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
67
  = 3.5.5 =
68
 
69
  * Change: Twitter app setup instructions updated.
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: 6.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
+ Stable tag: 3.5.6
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.6 =
68
+
69
+ * Bug fix: Change in link to Twitter API error codes.
70
+ * Bug fix: Restore sales page, accidentally removed in previous update.
71
+ * Change: Option added to enable debugging from admin (in Advanced Settings.)
72
+
73
  = 3.5.5 =
74
 
75
  * Change: Twitter app setup instructions updated.
wp-to-twitter-manager.php CHANGED
@@ -147,6 +147,7 @@ function wpt_updated_settings() {
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;
@@ -291,7 +292,7 @@ function wpt_update_settings() {
291
  </p>
292
  <h3><?php _e( 'Support WP to Twitter', 'wp-to-twitter' ); ?></h3>
293
  <p>
294
- <?php _e( 'The core WP to Twitter plug-in is free, and has been since 2008. WP Tweets Pro sales help keep this going, but they don\'t cover everything.', 'wp-to-twitter' ); ?>
295
  </p>
296
  <p>
297
  <?php
@@ -734,9 +735,9 @@ function wpt_update_settings() {
734
  </div>
735
  </div>
736
  <div class="ui-sortable meta-box-sortables">
737
- <div class="postbox">
738
- <h3><span><?php _e( 'Miscellaneous Settings', 'wp-to-twitter' ); ?></span></h3>
739
- <div class="inside">
740
  <fieldset>
741
  <legend class='screen-reader-text'><?php _e( 'Miscellaneous Settings', 'wp-to-twitter' ); ?></legend>
742
  <ul>
@@ -747,6 +748,9 @@ function wpt_update_settings() {
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>
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
+ update_option( 'wpt_debug_tweets', ( isset( $_POST['wpt_debug_tweets'] ) ) ? 1 : 0 );
151
  $wpt_truncation_order = $_POST['wpt_truncation_order'];
152
  update_option( 'wpt_truncation_order', map_deep( $wpt_truncation_order, 'sanitize_text_field' ) );
153
  $message .= __( 'WP to Twitter Advanced Options Updated', 'wp-to-twitter' ) . '. ' . $extend;
292
  </p>
293
  <h3><?php _e( 'Support WP to Twitter', 'wp-to-twitter' ); ?></h3>
294
  <p>
295
+ <?php _e( 'The core WP to Twitter plug-in is free, and has been since 2008. WP Tweets Pro sales help keep this going, but they don\'t cover all the costs of maintaining the plug-in. Purchasing a license helps ensure that I can continue to support this plug-in.', 'wp-to-twitter' ); ?>
296
  </p>
297
  <p>
298
  <?php
735
  </div>
736
  </div>
737
  <div class="ui-sortable meta-box-sortables">
738
+ <div class="postbox">
739
+ <h3><span><?php _e( 'Miscellaneous Settings', 'wp-to-twitter' ); ?></span></h3>
740
+ <div class="inside">
741
  <fieldset>
742
  <legend class='screen-reader-text'><?php _e( 'Miscellaneous Settings', 'wp-to-twitter' ); ?></legend>
743
  <ul>
748
  <li>
749
  <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>
750
  </li>
751
+ <li>
752
+ <input type="checkbox" name="wpt_debug_tweets" id="wpt_debug_tweets" value="1" <?php echo wpt_checkbox( 'wpt_debug_tweets' ); ?> /> <label for="wpt_debug_tweets"><?php _e( 'Enable WP to Twitter Debugging', 'wp-to-twitter' ); ?></label>
753
+ </li>
754
  </ul>
755
  </fieldset>
756
  <div>
wp-to-twitter-oauth.php CHANGED
@@ -154,7 +154,7 @@ function wpt_update_oauth_settings( $auth = false, $post = false ) {
154
  $data = $connection->get( 'https://api.twitter.com/1.1/account/verify_credentials.json' );
155
  if ( '200' !== (string) $connection->http_code ) {
156
  $data = json_decode( $data );
157
- $code = "<a href='https://dev.twitter.com/docs/error-codes-responses'>" . $data->errors[0]->code . '</a>';
158
  $error = $data->errors[0]->message;
159
  update_option( 'wpt_error', "$code: $error" );
160
  } else {
154
  $data = $connection->get( 'https://api.twitter.com/1.1/account/verify_credentials.json' );
155
  if ( '200' !== (string) $connection->http_code ) {
156
  $data = json_decode( $data );
157
+ $code = "<a href='https://developer.twitter.com/en/support/twitter-api/error-troubleshooting'>" . $data->errors[0]->code . '</a>';
158
  $error = $data->errors[0]->message;
159
  update_option( 'wpt_error', "$code: $error" );
160
  } else {
wp-to-twitter-shorteners.php CHANGED
@@ -63,16 +63,18 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
63
  } else {
64
  $campaign = get_option( 'twitter-analytics-campaign' );
65
  }
66
- $medium = urlencode( trim( apply_filters( 'wpt_utm_medium', 'twitter' ) ) );
67
- $source = urlencode( trim( apply_filters( 'wpt_utm_source', 'twitter' ) ) );
68
- $url = add_query_arg(
 
69
  array(
70
  'utm_campaign' => $campaign,
71
  'utm_medium' => $medium,
72
  'utm_source' => $source,
73
  ),
74
- $url
75
  );
 
76
  }
77
  $url = urldecode( trim( $url ) ); // prevent double-encoding.
78
  $encoded = urlencode( $url );
63
  } else {
64
  $campaign = get_option( 'twitter-analytics-campaign' );
65
  }
66
+ $medium = urlencode( trim( apply_filters( 'wpt_utm_medium', 'twitter' ) ) );
67
+ $source = urlencode( trim( apply_filters( 'wpt_utm_source', 'twitter' ) ) );
68
+ $tracking = apply_filters(
69
+ 'wpt_analytics_arguments',
70
  array(
71
  'utm_campaign' => $campaign,
72
  'utm_medium' => $medium,
73
  'utm_source' => $source,
74
  ),
75
+ $post_ID
76
  );
77
+ $url = add_query_arg( $tracking, $url );
78
  }
79
  $url = urldecode( trim( $url ) ); // prevent double-encoding.
80
  $encoded = urlencode( $url );
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.5
21
  */
22
 
23
  /*
@@ -41,7 +41,8 @@ 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 +65,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.5';
68
 
69
  add_action( 'init', 'wpt_load_textdomain' );
70
  /**
@@ -363,6 +364,7 @@ function wpt_post_to_twitter( $twit, $auth = false, $id = false, $media = false
363
  }
364
  }
365
  $api = 'https://api.twitter.com/1.1/statuses/update.json';
 
366
  $upload_api = 'https://upload.twitter.com/1.1/media/upload.json';
367
  $status = array(
368
  'status' => $twit,
@@ -507,6 +509,11 @@ function wpt_post_to_twitter( $twit, $auth = false, $id = false, $media = false
507
  wp_schedule_single_event( time() + ( 60 * 60 * 24 * 7 * 4 ), 'wpt_schedule_promotion_action' );
508
  update_option( 'wpt_promotion_scheduled', 1 );
509
  }
 
 
 
 
 
510
  }
511
  }
512
  if ( ! $return ) {
@@ -1606,7 +1613,7 @@ function wpt_save_post( $id, $post ) {
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' );
@@ -1645,8 +1652,9 @@ add_action( 'admin_head', 'wpt_admin_style' );
1645
  * Add stylesheets to WP to Twitter pages.
1646
  */
1647
  function wpt_admin_style() {
 
1648
  if ( isset( $_GET['page'] ) && ( 'wp-to-twitter' === $_GET['page'] || 'wp-tweets-pro' === $_GET['page'] || 'wp-to-twitter-schedule' === $_GET['page'] || 'wp-to-twitter-tweets' === $_GET['page'] || 'wp-to-twitter-errors' === $_GET['page'] ) ) {
1649
- wp_enqueue_style( 'wpt-styles', plugins_url( 'css/styles.css', __FILE__ ) );
1650
  }
1651
  }
1652
 
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.6
21
  */
22
 
23
  /*
41
  exit;
42
  }
43
 
44
+ $wpt_debug = get_option( 'wpt_debug_tweets', false );
45
+ define( 'WPT_DEBUG', $wpt_debug );
46
  define( 'WPT_DEBUG_BY_EMAIL', false ); // Email debugging no longer default as of 3.3.0.
47
  define( 'WPT_DEBUG_ADDRESS', get_option( 'admin_email' ) );
48
  define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
65
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
66
 
67
  global $wpt_version;
68
+ $wpt_version = '3.5.6';
69
 
70
  add_action( 'init', 'wpt_load_textdomain' );
71
  /**
364
  }
365
  }
366
  $api = 'https://api.twitter.com/1.1/statuses/update.json';
367
+ $api2 = 'https://api.twitter.com/2/tweets'; // For testing.
368
  $upload_api = 'https://upload.twitter.com/1.1/media/upload.json';
369
  $status = array(
370
  'status' => $twit,
509
  wp_schedule_single_event( time() + ( 60 * 60 * 24 * 7 * 4 ), 'wpt_schedule_promotion_action' );
510
  update_option( 'wpt_promotion_scheduled', 1 );
511
  }
512
+ if ( '3' === get_option( 'wpt_promotion_scheduled', '' ) ) {
513
+ // Schedule an additional promotion for 12 weeks after a successful Tweet following dismissal.
514
+ wp_schedule_single_event( time() + ( 60 * 60 * 24 * 7 * 12 ), 'wpt_schedule_promotion_action' );
515
+ update_option( 'wpt_promotion_scheduled', 1 );
516
+ }
517
  }
518
  }
519
  if ( ! $return ) {
1613
  $update = apply_filters( 'wpt_insert_post', $_POST, $id );
1614
  // WPT PRO.
1615
  // only send debug data if post meta is updated.
1616
+ wpt_mail( 'Post Meta Processed', 'WP to Twitter post meta was updated' . "\n\n" . print_r( map_deep( $_POST, 'sanitize_textarea_field' ), 1 ), $id ); // DEBUG.
1617
 
1618
  if ( isset( $_POST['wpt-delete-debug'] ) && 'true' === $_POST['wpt-delete-debug'] ) {
1619
  delete_post_meta( $id, '_wpt_debug_log' );
1652
  * Add stylesheets to WP to Twitter pages.
1653
  */
1654
  function wpt_admin_style() {
1655
+ global $wpt_version;
1656
  if ( isset( $_GET['page'] ) && ( 'wp-to-twitter' === $_GET['page'] || 'wp-tweets-pro' === $_GET['page'] || 'wp-to-twitter-schedule' === $_GET['page'] || 'wp-to-twitter-tweets' === $_GET['page'] || 'wp-to-twitter-errors' === $_GET['page'] ) ) {
1657
+ wp_enqueue_style( 'wpt-styles', plugins_url( 'css/styles.css', __FILE__ ), array(), $wpt_version );
1658
  }
1659
  }
1660
 
wpt-functions.php CHANGED
@@ -160,9 +160,6 @@ function wpt_settings_tabs() {
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
 
167
  $pages = apply_filters( 'wpt_settings_tabs_pages', $pages, $current );
168
  $admin_url = admin_url( 'admin.php?page=wp-tweets-pro' );
160
  'support' => __( 'Get Help', 'wp-to-twitter' ),
161
  'pro' => $pro_text,
162
  );
 
 
 
163
 
164
  $pages = apply_filters( 'wpt_settings_tabs_pages', $pages, $current );
165
  $admin_url = admin_url( 'admin.php?page=wp-tweets-pro' );