WP to Twitter - Version 3.4.10

Version Description

  • Feature: ability to add mentions in tags to be parsed with @ instead of #.
  • Feature: Add support for Hum URL shortener
  • Improve install process for 3rd-party plugin URL shorteners.
  • Use Full post modified & publish dates in debugging info. (Including seconds.)
Download this release

Release Info

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

Code changes from version 3.4.9 to 3.4.10

Files changed (3) hide show
  1. readme.txt +8 -1
  2. wp-to-twitter-shorteners.php +18 -1
  3. wp-to-twitter.php +14 -5
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tested up to: 5.5
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
- Stable tag: 3.4.9
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
@@ -63,6 +63,13 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
66
  = 3.4.9 =
67
 
68
  * Clear a couple PHP notices.
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
+ Stable tag: 3.4.10
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
63
 
64
  == Changelog ==
65
 
66
+ = 3.4.10 =
67
+
68
+ * Feature: ability to add mentions in tags to be parsed with @ instead of #.
69
+ * Feature: Add support for <a href="https://wordpress.org/plugins/hum/">Hum URL shortener</a>
70
+ * Improve install process for 3rd-party plugin URL shorteners.
71
+ * Use Full post modified & publish dates in debugging info. (Including seconds.)
72
+
73
  = 3.4.9 =
74
 
75
  * Clear a couple PHP notices.
wp-to-twitter-shorteners.php CHANGED
@@ -223,6 +223,15 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
223
  }
224
  }
225
  break;
 
 
 
 
 
 
 
 
 
226
  default:
227
  $shrink = $url;
228
  }
@@ -590,7 +599,14 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
590
  function wpt_pick_shortener() {
591
  $shortener = (string) get_option( 'jd_shortener' );
592
  if ( '2' === $shortener && ! function_exists( 'wbitly_shorten_url' ) ) {
593
- echo '<p>' . __( 'Bit.ly support is provided via the <a href="https://wordpress.org/plugins/codehaveli-bitly-url-shortener/">Codehaveli Bitly URL Shortener</a> plug-in, available from WordPress.org', 'wp-to-twitter' ) . '</p>';
 
 
 
 
 
 
 
594
  }
595
  ?>
596
  <p>
@@ -608,6 +624,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
608
  ?>
609
  <option value="6" <?php selected( $shortener, '6' ); ?>><?php _e( 'YOURLS (remote server)', 'wp-to-twitter' ); ?></option>
610
  <option value="10" <?php selected( $shortener, '10' ); ?>>jotURL</option>
 
611
  <?php
612
  // Add a custom shortener.
613
  echo apply_filters( 'wpt_choose_shortener', '', $shortener );
223
  }
224
  }
225
  break;
226
+ case 11:
227
+ // Hum URL shortener.
228
+ if ( class_exists( 'Hum' ) && method_exists( 'Hum', 'get_shortlink' ) ) {
229
+ $hum = new Hum;
230
+ $shrink = $hum->get_shortlink( $url, $post_ID, 'post', true );
231
+ } else {
232
+ $shrink = $url;
233
+ }
234
+ break;
235
  default:
236
  $shrink = $url;
237
  }
599
  function wpt_pick_shortener() {
600
  $shortener = (string) get_option( 'jd_shortener' );
601
  if ( '2' === $shortener && ! function_exists( 'wbitly_shorten_url' ) ) {
602
+ $install_bitly = admin_url( 'plugin-install.php?s=codehaveli+bitly+url+shortener&tab=search&type=term' );
603
+ // Translators: search URL to find Bit.ly plug-in.
604
+ echo '<p>' . sprintf( __( 'Bit.ly support is provided via the <a href="https://wordpress.org/plugins/codehaveli-bitly-url-shortener/">Codehaveli Bitly URL Shortener</a> (<a href="%s">Install</a>) plug-in, available from WordPress.org', 'wp-to-twitter' ), $install_bitly ) . '</p>';
605
+ }
606
+ if ( '11' === $shortener && ! class_exists( 'Hum' ) ) {
607
+ $install_hum = admin_url( 'plugin-install.php?s=hum+url+shortener+norris&tab=search&type=term' );
608
+ // Translators: search URL to find Hum plug-in.
609
+ echo '<p>' . sprintf( __( 'Hum is a custom shortener plug-in. Support is provided via the <a href="https://wordpress.org/plugins/hum/">Hum URL Shortener</a> (<a href="%s">Install</a>) plug-in, available from WordPress.org', 'wp-to-twitter' ), $install_hum ) . '</p>';
610
  }
611
  ?>
612
  <p>
624
  ?>
625
  <option value="6" <?php selected( $shortener, '6' ); ?>><?php _e( 'YOURLS (remote server)', 'wp-to-twitter' ); ?></option>
626
  <option value="10" <?php selected( $shortener, '10' ); ?>>jotURL</option>
627
+ <option value="11" <?php selected( $shortener, '11' ); ?>>Hum</option>
628
  <?php
629
  // Add a custom shortener.
630
  echo apply_filters( 'wpt_choose_shortener', '', $shortener );
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.4.9
21
  */
22
 
23
  /*
@@ -57,7 +57,7 @@ require_once( plugin_dir_path( __FILE__ ) . 'wpt-widget.php' );
57
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
58
 
59
  global $wpt_version;
60
- $wpt_version = '3.4.9';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
@@ -812,13 +812,13 @@ function wpt_tweet( $post_ID, $type = 'instant' ) {
812
  return false;
813
  }
814
  }
815
- wpt_mail( '4b: Post action is edit', 'This event was a post edit action, not a post publication.' . "\n" . 'Modified Date: ' . $post_info['postModified'] . "\n\n" . 'Publication date:' . $post_info['postDate'], $post_ID ); // DEBUG.
816
  if ( '1' === (string) $post_type_settings[ $post_type ]['post-edited-update'] ) {
817
  $nptext = stripcslashes( $post_type_settings[ $post_type ]['post-edited-text'] );
818
  $oldpost = true;
819
  }
820
  } else {
821
- wpt_mail( '4c: Post action is publish', 'This event was a post publish action.' . "\n" . 'Modified Date: ' . $post_info['postModified'] . "\n\n" . 'Publication date:' . $post_info['postDate'], $post_ID ); // DEBUG.
822
  if ( '1' === (string) $post_type_settings[ $post_type ]['post-published-update'] ) {
823
  $nptext = stripcslashes( $post_type_settings[ $post_type ]['post-published-text'] );
824
  $newpost = true;
@@ -1038,10 +1038,19 @@ function wpt_generate_hash_tags( $post_ID ) {
1038
  $t_id = $value->term_id;
1039
  $term_meta = get_option( "wpt_taxonomy_$t_id" );
1040
  }
1041
- if ( 'slug' === get_option( 'wpt_tag_source' ) ) {
 
 
 
 
 
1042
  $tag = $value->slug;
1043
  } else {
1044
  $tag = $value->name;
 
 
 
 
1045
  }
1046
  $strip = get_option( 'jd_strip_nonan' );
1047
  $search = '/[^\p{L}\p{N}\s]/u';
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
+ * Version: 3.4.10
21
  */
22
 
23
  /*
57
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
58
 
59
  global $wpt_version;
60
+ $wpt_version = '3.4.10';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
812
  return false;
813
  }
814
  }
815
+ wpt_mail( '4b: Post action is edit', 'This event was a post edit action, not a post publication.' . "\n" . 'Modified Date: ' . $post_info['_postModified'] . "\n\n" . 'Publication date:' . $post_info['_postDate'], $post_ID ); // DEBUG.
816
  if ( '1' === (string) $post_type_settings[ $post_type ]['post-edited-update'] ) {
817
  $nptext = stripcslashes( $post_type_settings[ $post_type ]['post-edited-text'] );
818
  $oldpost = true;
819
  }
820
  } else {
821
+ wpt_mail( '4c: Post action is publish', 'This event was a post publish action.' . "\n" . 'Modified Date: ' . $post_info['_postModified'] . "\n\n" . 'Publication date:' . $post_info['_postDate'], $post_ID ); // DEBUG.
822
  if ( '1' === (string) $post_type_settings[ $post_type ]['post-published-update'] ) {
823
  $nptext = stripcslashes( $post_type_settings[ $post_type ]['post-published-text'] );
824
  $newpost = true;
1038
  $t_id = $value->term_id;
1039
  $term_meta = get_option( "wpt_taxonomy_$t_id" );
1040
  }
1041
+ $source = get_option( 'wpt_tag_source' );
1042
+ if ( 'slug' === $source ) {
1043
+ // If the tag has an '@' symbol as the first character, assume it is a mention unless set.
1044
+ if ( 0 === stripos( $value->name, '@' ) && ! $term_meta ) {
1045
+ $term_meta = 5;
1046
+ }
1047
  $tag = $value->slug;
1048
  } else {
1049
  $tag = $value->name;
1050
+ // If the tag has an '@' symbol as the first character, assume it is a mention unless set.
1051
+ if ( 0 === stripos( $value->name, '@' ) && ! $term_meta ) {
1052
+ $term_meta = 4;
1053
+ }
1054
  }
1055
  $strip = get_option( 'jd_strip_nonan' );
1056
  $search = '/[^\p{L}\p{N}\s]/u';