WP to Twitter - Version 3.3.7

Version Description

  • Change: Remove replacement character setting unless in use for non-space character
  • Change: Capitalize each word in tags sent to Twitter (accessibility)
Download this release

Release Info

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

Code changes from version 3.3.6 to 3.3.7

classes/class-wpt-latest-tweets-widget.php CHANGED
@@ -181,6 +181,6 @@ class WPT_Latest_Tweets_Widget extends WP_Widget {
181
  <input id="<?php echo $this->get_field_id( 'cache' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'cache' ); ?>" value="1" />
182
  <label for="<?php echo $this->get_field_id( 'cache' ); ?>"><?php _e( 'Clear cache', 'wp-to-twitter' ); ?></label>
183
  </p>
184
- <?php
185
  }
186
  }
181
  <input id="<?php echo $this->get_field_id( 'cache' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'cache' ); ?>" value="1" />
182
  <label for="<?php echo $this->get_field_id( 'cache' ); ?>"><?php _e( 'Clear cache', 'wp-to-twitter' ); ?></label>
183
  </p>
184
+ <?php
185
  }
186
  }
classes/class-wpt-search-tweets-widget.php CHANGED
@@ -169,6 +169,6 @@ class WPT_Search_Tweets_Widget extends WP_Widget {
169
  <input id="<?php echo $this->get_field_id( 'source' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'source' ); ?>" value="1" <?php checked( $instance['source'] ); ?>/>
170
  <label for="<?php echo $this->get_field_id( 'source' ); ?>"><?php _e( 'Include Tweet source', 'wp-to-twitter' ); ?></label>
171
  </p>
172
- <?php
173
  }
174
  }
169
  <input id="<?php echo $this->get_field_id( 'source' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'source' ); ?>" value="1" <?php checked( $instance['source'] ); ?>/>
170
  <label for="<?php echo $this->get_field_id( 'source' ); ?>"><?php _e( 'Include Tweet source', 'wp-to-twitter' ); ?></label>
171
  </p>
172
+ <?php
173
  }
174
  }
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tested up to: 4.9
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
- Stable tag: 3.3.6
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
@@ -65,6 +65,11 @@ Check out my <a href="https://github.com/joedolson/plugin-extensions/tree/master
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
68
  = 3.3.6 =
69
 
70
  * Bug fix: Check for existing short URL should not run when parsing text of Tweets for URLs.
7
  Requires PHP: 5.3
8
  License: GPLv2 or later
9
  Text Domain: wp-to-twitter
10
+ Stable tag: 3.3.7
11
 
12
  Posts a Twitter update when you update your WordPress blog or add a link, with your chosen URL shortening service.
13
 
65
 
66
  == Changelog ==
67
 
68
+ = 3.3.7 =
69
+
70
+ * Change: Remove replacement character setting unless in use for non-space character
71
+ * Change: Capitalize each word in tags sent to Twitter (accessibility)
72
+
73
  = 3.3.6 =
74
 
75
  * Bug fix: Check for existing short URL should not run when parsing text of Tweets for URLs.
wp-to-twitter-manager.php CHANGED
@@ -232,7 +232,7 @@ function wpt_update_settings() {
232
  }
233
  } else {
234
  if ( ! function_exists( 'wpt_pro_exists' ) ) {
235
- ?>
236
  <div class="ui-sortable meta-box-sortables">
237
  <div class="postbox">
238
  <h3 class='wpt-upgrade'><span><strong><?php _e( 'Upgrade Now!', 'wp-to-twitter' ); ?></strong></span></h3>
@@ -286,12 +286,12 @@ function wpt_update_settings() {
286
  </div>
287
  </div>
288
  </div>
289
- <?php
290
  }
291
  }
292
  }
293
  if ( 'basic' == $current ) {
294
- ?>
295
  <div class="ui-sortable meta-box-sortables">
296
  <div class="postbox">
297
  <h3><span><?php _e( 'Status Update Templates', 'wp-to-twitter' ); ?></span></h3>
@@ -394,7 +394,7 @@ function wpt_update_settings() {
394
  }
395
  ?>
396
  </div>
397
- <?php
398
  }
399
  }
400
  ?>
@@ -440,9 +440,9 @@ function wpt_update_settings() {
440
  <li><?php _e( '<code>#tags#</code>: your tags modified into hashtags.', 'wp-to-twitter' ); ?></li>
441
  <?php
442
  if ( function_exists( 'wpt_pro_exists' ) && true == wpt_pro_exists() ) {
443
- ?>
444
  <li><?php _e( '<code>#reference#</code>: Used only in co-tweeting. @reference to main account when posted to author account, @reference to author account in post to main account.', 'wp-to-twitter' ); ?></li>
445
- <?php
446
  }
447
  ?>
448
  </ul>
@@ -459,14 +459,14 @@ function wpt_update_settings() {
459
  </div>
460
  </div>
461
  </div>
462
- <?php
463
  }
464
  if ( 'shortener' == $current ) {
465
  echo apply_filters( 'wpt_shortener_controls', '' );
466
  }
467
 
468
  if ( 'advanced' == $current ) {
469
- ?>
470
  <form method="post" action="">
471
  <div class="ui-sortable meta-box-sortables">
472
  <div class="postbox">
@@ -491,11 +491,16 @@ function wpt_update_settings() {
491
  <input type="checkbox" name="wpt_use_cats" id="wpt_use_cats" value="1" <?php checked( get_option( 'wpt_use_cats' ), '1' ); ?> />
492
  <label for="wpt_use_cats"><?php _e( 'Use categories instead of tags', 'wp-to-twitter' ); ?></label><br/>
493
  </p>
 
 
 
494
  <p>
495
  <label for="jd_replace_character"><?php _e( 'Spaces in tags replaced with:', 'wp-to-twitter' ); ?></label>
496
  <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo esc_attr( get_option( 'jd_replace_character' ) ); ?>" size="3"/>
497
  </p>
498
-
 
 
499
  <p>
500
  <label for="jd_max_tags"><?php _e( 'Maximum number of tags to include:', 'wp-to-twitter' ); ?></label>
501
  <input aria-describedby="jd_max_characters_label" type="text" name="jd_max_tags" id="jd_max_tags" value="<?php echo esc_attr( get_option( 'jd_max_tags' ) ); ?>" size="3"/>
@@ -572,10 +577,10 @@ function wpt_update_settings() {
572
  <label for="wpt_rate_limiting"><?php _e( 'Enable Rate Limiting', 'wp-to-twitter' ); ?></label><br/>
573
  <?php
574
  if ( get_option( 'wpt_rate_limiting' ) == 1 ) {
575
- ?>
576
  <input type="number" name="wpt_default_rate_limit" min="1" id="wpt_default_rate_limit" value="<?php echo wpt_default_rate_limit(); ?>" />
577
  <label for="wpt_default_rate_limit"><?php _e( 'Default Rate Limit per category per hour', 'wp-to-twitter' ); ?></label><br/>
578
- <?php
579
  }
580
  ?>
581
  </p>
@@ -745,17 +750,17 @@ function wpt_update_settings() {
745
  </div>
746
  </div>
747
  </div>
748
- <?php
749
  }
750
  if ( 'support' == $current ) {
751
- ?>
752
  <div class="postbox" id="get-support">
753
  <h3><span><?php _e( 'Get Plug-in Support', 'wp-to-twitter' ); ?></span></h3>
754
 
755
  <div class="inside">
756
  <?php
757
  if ( ! function_exists( 'wpt_pro_exists' ) ) {
758
- ?>
759
  <div class='wpt-support-me'>
760
  <p>
761
  <?php
@@ -764,13 +769,13 @@ function wpt_update_settings() {
764
  ?>
765
  </p>
766
  </div>
767
- <?php
768
  }
769
  wpt_get_support_form();
770
  ?>
771
  </div>
772
  </div>
773
- <?php
774
  }
775
  ?>
776
  </div>
@@ -793,21 +798,21 @@ function wpt_sidebar() {
793
  <div class="postbox">
794
  <?php
795
  if ( 'free' == $context ) {
796
- ?>
797
  <h3><span><strong><?php _e( 'Support WP to Twitter', 'wp-to-twitter' ); ?></strong></span></h3>
798
- <?php
799
  } else {
800
- ?>
801
  <h3><span><strong><?php _e( 'WP to Twitter Support', 'wp-to-twitter' ); ?></strong></span></h3>
802
- <?php
803
  }
804
  ?>
805
  <div class="inside resources">
806
  <?php
807
  if ( 1 != get_option( 'jd_donations' ) && ! function_exists( 'wpt_pro_exists' ) ) {
808
- ?>
809
  <p class='cta'><?php _e( '<a href="http://www.wptweetspro.com/wp-tweets-pro">Get WP Tweets Pro</a>', 'wp-to-twitter' ); ?></p>
810
- <?php
811
  }
812
  ?>
813
  <p>
@@ -875,7 +880,7 @@ function wpt_sidebar() {
875
 
876
  <?php
877
  if ( 1 == get_option( 'wpt_rate_limiting' ) ) {
878
- ?>
879
  <div class="ui-sortable meta-box-sortables">
880
  <div class="postbox">
881
  <h3><?php _e( 'Monitor Rate Limiting', 'wp-to-twitter' ); ?></h3>
@@ -885,11 +890,11 @@ function wpt_sidebar() {
885
  </div>
886
  </div>
887
  </div>
888
- <?php
889
  }
890
  ?>
891
  </div>
892
- <?php
893
  }
894
 
895
  /**
232
  }
233
  } else {
234
  if ( ! function_exists( 'wpt_pro_exists' ) ) {
235
+ ?>
236
  <div class="ui-sortable meta-box-sortables">
237
  <div class="postbox">
238
  <h3 class='wpt-upgrade'><span><strong><?php _e( 'Upgrade Now!', 'wp-to-twitter' ); ?></strong></span></h3>
286
  </div>
287
  </div>
288
  </div>
289
+ <?php
290
  }
291
  }
292
  }
293
  if ( 'basic' == $current ) {
294
+ ?>
295
  <div class="ui-sortable meta-box-sortables">
296
  <div class="postbox">
297
  <h3><span><?php _e( 'Status Update Templates', 'wp-to-twitter' ); ?></span></h3>
394
  }
395
  ?>
396
  </div>
397
+ <?php
398
  }
399
  }
400
  ?>
440
  <li><?php _e( '<code>#tags#</code>: your tags modified into hashtags.', 'wp-to-twitter' ); ?></li>
441
  <?php
442
  if ( function_exists( 'wpt_pro_exists' ) && true == wpt_pro_exists() ) {
443
+ ?>
444
  <li><?php _e( '<code>#reference#</code>: Used only in co-tweeting. @reference to main account when posted to author account, @reference to author account in post to main account.', 'wp-to-twitter' ); ?></li>
445
+ <?php
446
  }
447
  ?>
448
  </ul>
459
  </div>
460
  </div>
461
  </div>
462
+ <?php
463
  }
464
  if ( 'shortener' == $current ) {
465
  echo apply_filters( 'wpt_shortener_controls', '' );
466
  }
467
 
468
  if ( 'advanced' == $current ) {
469
+ ?>
470
  <form method="post" action="">
471
  <div class="ui-sortable meta-box-sortables">
472
  <div class="postbox">
491
  <input type="checkbox" name="wpt_use_cats" id="wpt_use_cats" value="1" <?php checked( get_option( 'wpt_use_cats' ), '1' ); ?> />
492
  <label for="wpt_use_cats"><?php _e( 'Use categories instead of tags', 'wp-to-twitter' ); ?></label><br/>
493
  </p>
494
+ <?php
495
+ if ( ! ( '[ ]' == get_option( 'jd_replace_character' ) || '' == get_option( 'jd_replace_character' ) ) ) {
496
+ ?>
497
  <p>
498
  <label for="jd_replace_character"><?php _e( 'Spaces in tags replaced with:', 'wp-to-twitter' ); ?></label>
499
  <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo esc_attr( get_option( 'jd_replace_character' ) ); ?>" size="3"/>
500
  </p>
501
+ <?php
502
+ }
503
+ ?>
504
  <p>
505
  <label for="jd_max_tags"><?php _e( 'Maximum number of tags to include:', 'wp-to-twitter' ); ?></label>
506
  <input aria-describedby="jd_max_characters_label" type="text" name="jd_max_tags" id="jd_max_tags" value="<?php echo esc_attr( get_option( 'jd_max_tags' ) ); ?>" size="3"/>
577
  <label for="wpt_rate_limiting"><?php _e( 'Enable Rate Limiting', 'wp-to-twitter' ); ?></label><br/>
578
  <?php
579
  if ( get_option( 'wpt_rate_limiting' ) == 1 ) {
580
+ ?>
581
  <input type="number" name="wpt_default_rate_limit" min="1" id="wpt_default_rate_limit" value="<?php echo wpt_default_rate_limit(); ?>" />
582
  <label for="wpt_default_rate_limit"><?php _e( 'Default Rate Limit per category per hour', 'wp-to-twitter' ); ?></label><br/>
583
+ <?php
584
  }
585
  ?>
586
  </p>
750
  </div>
751
  </div>
752
  </div>
753
+ <?php
754
  }
755
  if ( 'support' == $current ) {
756
+ ?>
757
  <div class="postbox" id="get-support">
758
  <h3><span><?php _e( 'Get Plug-in Support', 'wp-to-twitter' ); ?></span></h3>
759
 
760
  <div class="inside">
761
  <?php
762
  if ( ! function_exists( 'wpt_pro_exists' ) ) {
763
+ ?>
764
  <div class='wpt-support-me'>
765
  <p>
766
  <?php
769
  ?>
770
  </p>
771
  </div>
772
+ <?php
773
  }
774
  wpt_get_support_form();
775
  ?>
776
  </div>
777
  </div>
778
+ <?php
779
  }
780
  ?>
781
  </div>
798
  <div class="postbox">
799
  <?php
800
  if ( 'free' == $context ) {
801
+ ?>
802
  <h3><span><strong><?php _e( 'Support WP to Twitter', 'wp-to-twitter' ); ?></strong></span></h3>
803
+ <?php
804
  } else {
805
+ ?>
806
  <h3><span><strong><?php _e( 'WP to Twitter Support', 'wp-to-twitter' ); ?></strong></span></h3>
807
+ <?php
808
  }
809
  ?>
810
  <div class="inside resources">
811
  <?php
812
  if ( 1 != get_option( 'jd_donations' ) && ! function_exists( 'wpt_pro_exists' ) ) {
813
+ ?>
814
  <p class='cta'><?php _e( '<a href="http://www.wptweetspro.com/wp-tweets-pro">Get WP Tweets Pro</a>', 'wp-to-twitter' ); ?></p>
815
+ <?php
816
  }
817
  ?>
818
  <p>
880
 
881
  <?php
882
  if ( 1 == get_option( 'wpt_rate_limiting' ) ) {
883
+ ?>
884
  <div class="ui-sortable meta-box-sortables">
885
  <div class="postbox">
886
  <h3><?php _e( 'Monitor Rate Limiting', 'wp-to-twitter' ); ?></h3>
890
  </div>
891
  </div>
892
  </div>
893
+ <?php
894
  }
895
  ?>
896
  </div>
897
+ <?php
898
  }
899
 
900
  /**
wp-to-twitter-shorteners.php CHANGED
@@ -372,7 +372,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
372
  <div class="inside">
373
  <?php
374
  if ( 7 == $shortener ) {
375
- ?>
376
  <?php echo $form_start; ?>
377
  <p>
378
  <label
@@ -390,10 +390,10 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
390
  </div>
391
  <p><small><?php _e( "Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here!</a> You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter' ); ?></small></p>
392
  <?php echo $form_end; ?>
393
- <?php
394
  } elseif ( 2 == $shortener ) {
395
  echo $form_start;
396
- ?>
397
  <p>
398
  <label for="bitlylogin"><?php _e( 'Your Bit.ly username:', 'wp-to-twitter' ); ?></label>
399
  <input type="text" name="bitlylogin" id="bitlylogin" value="<?php echo esc_attr( get_option( 'bitlylogin' ) ); ?>"/>
@@ -408,29 +408,29 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
408
  <div>
409
  <input type="hidden" name="submit-type" value="bitlyapi"/>
410
  </div>
411
- <?php
412
- echo $form_end;
413
  } elseif ( 5 == $shortener || 6 == $shortener ) {
414
  echo $form_start;
415
  if ( 5 == $shortener ) {
416
- ?>
417
  <p>
418
  <label for="yourlspath"><?php _e( 'Path to your YOURLS config file', 'wp-to-twitter' ); ?></label><br/>
419
  <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php echo esc_attr( get_option( 'yourlspath' ) ); ?>"/><br/>
420
  <small><?php _e( 'Example:', 'wp-to-twitter' ); ?> <code>/home/username/www/www/yourls/user/config.php</code>
421
  </small>
422
  </p>
423
- <?php
424
  }
425
  if ( 6 == $shortener ) {
426
- ?>
427
  <p>
428
  <label for="yourlsurl"><?php _e( 'URI to the YOURLS API', 'wp-to-twitter' ); ?></label><br/>
429
  <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php echo esc_attr( get_option( 'yourlsurl' ) ); ?>"/><br/>
430
  <small><?php _e( 'Example:', 'wp-to-twitter' ); ?> <code>http://domain.com/yourls-api.php</code>
431
  </small>
432
  </p>
433
- <?php
434
  }
435
  ?>
436
  <p>
@@ -439,11 +439,11 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
439
  </p>
440
  <?php
441
  if ( get_option( 'yourlsapi' ) && get_option( 'yourlslogin' ) ) {
442
- ?>
443
  <p>
444
  <em><?php _e( 'Your YOURLS username and password are saved. If you add a signature token, that will be used for API calls and your username and password will be deleted from the database.', 'wp-to-twitter' ); ?></em>
445
  </p>
446
- <?php
447
  }
448
  ?>
449
  <p>
@@ -508,7 +508,7 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
508
  </div>
509
  </div>
510
  </div>
511
- <?php
512
  }
513
 
514
  /**
@@ -698,17 +698,17 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
698
  <option value="2" <?php selected( $shortener, '2' ); ?>>Bit.ly</option>
699
  <?php
700
  if ( 8 == $shortener ) { // if already selected, leave available.
701
- ?>
702
  <option value="8" <?php selected( $shortener, '8' ); ?>>Goo.gl</option>
703
- <?php
704
  }
705
  ?>
706
  <option value="7" <?php selected( $shortener, '7' ); ?>>Su.pr</option>
707
  <?php
708
  if ( 5 == $shortener ) { // if the user has already selected local server, leave available.
709
- ?>
710
  <option value="5" <?php selected( $shortener, '5' ); ?>><?php _e( 'YOURLS (this server)', 'wp-to-twitter' ); ?></option>
711
- <?php
712
  }
713
  ?>
714
  <option value="6" <?php selected( $shortener, '6' ); ?>><?php _e( 'YOURLS (remote server)', 'wp-to-twitter' ); ?></option>
@@ -720,12 +720,12 @@ if ( ! function_exists( 'wpt_shorten_url' ) ) {
720
  </select>
721
  <?php
722
  if ( 3 != $shortener ) {
723
- ?>
724
  <input type='checkbox' value='false' name='wpt_use_stored_urls' id='wpt_use_stored_urls' <?php checked( get_option( 'wpt_use_stored_urls' ), 'false' ); ?>> <label for='wpt_use_stored_urls'><?php _e( 'Always request a new short URL for Tweets', 'wp-to-twitter' ); ?></label>
725
- <?php
726
  }
727
  ?>
728
  </p>
729
- <?php
730
  }
731
  }
372
  <div class="inside">
373
  <?php
374
  if ( 7 == $shortener ) {
375
+ ?>
376
  <?php echo $form_start; ?>
377
  <p>
378
  <label
390
  </div>
391
  <p><small><?php _e( "Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here!</a> You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter' ); ?></small></p>
392
  <?php echo $form_end; ?>
393
+ <?php
394
  } elseif ( 2 == $shortener ) {
395
  echo $form_start;
396
+ ?>
397
  <p>
398
  <label for="bitlylogin"><?php _e( 'Your Bit.ly username:', 'wp-to-twitter' ); ?></label>
399
  <input type="text" name="bitlylogin" id="bitlylogin" value="<?php echo esc_attr( get_option( 'bitlylogin' ) ); ?>"/>
408
  <div>
409
  <input type="hidden" name="submit-type" value="bitlyapi"/>
410
  </div>
411
+ <?php
412
+ echo $form_end;
413
  } elseif ( 5 == $shortener || 6 == $shortener ) {
414
  echo $form_start;
415
  if ( 5 == $shortener ) {
416
+ ?>
417
  <p>
418
  <label for="yourlspath"><?php _e( 'Path to your YOURLS config file', 'wp-to-twitter' ); ?></label><br/>
419
  <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php echo esc_attr( get_option( 'yourlspath' ) ); ?>"/><br/>
420
  <small><?php _e( 'Example:', 'wp-to-twitter' ); ?> <code>/home/username/www/www/yourls/user/config.php</code>
421
  </small>
422
  </p>
423
+ <?php
424
  }
425
  if ( 6 == $shortener ) {
426
+ ?>
427
  <p>
428
  <label for="yourlsurl"><?php _e( 'URI to the YOURLS API', 'wp-to-twitter' ); ?></label><br/>
429
  <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php echo esc_attr( get_option( 'yourlsurl' ) ); ?>"/><br/>
430
  <small><?php _e( 'Example:', 'wp-to-twitter' ); ?> <code>http://domain.com/yourls-api.php</code>
431
  </small>
432
  </p>
433
+ <?php
434
  }
435
  ?>
436
  <p>
439
  </p>
440
  <?php
441
  if ( get_option( 'yourlsapi' ) && get_option( 'yourlslogin' ) ) {
442
+ ?>
443
  <p>
444
  <em><?php _e( 'Your YOURLS username and password are saved. If you add a signature token, that will be used for API calls and your username and password will be deleted from the database.', 'wp-to-twitter' ); ?></em>
445
  </p>
446
+ <?php
447
  }
448
  ?>
449
  <p>
508
  </div>
509
  </div>
510
  </div>
511
+ <?php
512
  }
513
 
514
  /**
698
  <option value="2" <?php selected( $shortener, '2' ); ?>>Bit.ly</option>
699
  <?php
700
  if ( 8 == $shortener ) { // if already selected, leave available.
701
+ ?>
702
  <option value="8" <?php selected( $shortener, '8' ); ?>>Goo.gl</option>
703
+ <?php
704
  }
705
  ?>
706
  <option value="7" <?php selected( $shortener, '7' ); ?>>Su.pr</option>
707
  <?php
708
  if ( 5 == $shortener ) { // if the user has already selected local server, leave available.
709
+ ?>
710
  <option value="5" <?php selected( $shortener, '5' ); ?>><?php _e( 'YOURLS (this server)', 'wp-to-twitter' ); ?></option>
711
+ <?php
712
  }
713
  ?>
714
  <option value="6" <?php selected( $shortener, '6' ); ?>><?php _e( 'YOURLS (remote server)', 'wp-to-twitter' ); ?></option>
720
  </select>
721
  <?php
722
  if ( 3 != $shortener ) {
723
+ ?>
724
  <input type='checkbox' value='false' name='wpt_use_stored_urls' id='wpt_use_stored_urls' <?php checked( get_option( 'wpt_use_stored_urls' ), 'false' ); ?>> <label for='wpt_use_stored_urls'><?php _e( 'Always request a new short URL for Tweets', 'wp-to-twitter' ); ?></label>
725
+ <?php
726
  }
727
  ?>
728
  </p>
729
+ <?php
730
  }
731
  }
wp-to-twitter-users.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User settings WP to Twitter
4
+ *
5
+ * @category Users
6
+ * @package WP to Twitter
7
+ * @author Joe Dolson
8
+ * @license GPLv2 or later
9
+ * @link https://www.joedolson.com/wp-to-twitter/
10
+ */
11
+
12
+ if ( '1' == get_option( 'jd_individual_twitter_users' ) ) {
13
+ add_action( 'show_user_profile', 'wpt_twitter_profile' );
14
+ add_action( 'edit_user_profile', 'wpt_twitter_profile' );
15
+ add_action( 'profile_update', 'wpt_twitter_save_profile' );
16
+ }
17
+
18
+ if ( ! defined( 'ABSPATH' ) ) {
19
+ exit;
20
+ }
21
+
22
+ /**
23
+ * Show user profile data on Edit User pages.
24
+ */
25
+ function wpt_twitter_profile() {
26
+ global $user_ID;
27
+ $current_user = wp_get_current_user();
28
+ $user_edit = ( isset( $_GET['user_id'] ) ) ? (int) $_GET['user_id'] : $user_ID;
29
+
30
+ $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user', true );
31
+ $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username', true );
32
+ $wpt_remove = get_user_meta( $user_edit, 'wpt-remove', true );
33
+ if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
34
+ ?>
35
+ <h3><?php _e( 'WP Tweets User Settings', 'wp-to-twitter' ); ?></h3>
36
+ <?php
37
+ if ( function_exists( 'wpt_connect_oauth_message' ) ) {
38
+ wpt_connect_oauth_message( $user_edit );
39
+ }
40
+ ?>
41
+ <table class="form-table">
42
+ <tr>
43
+ <th scope="row"><?php _e( 'Use My Twitter Username', 'wp-to-twitter' ); ?></th>
44
+ <td>
45
+ <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-3" value="mainAtTwitter"<?php checked( $is_enabled, 'mainAtTwitter' ); ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e( 'Tweet my posts with an @ reference to my username.', 'wp-to-twitter' ); ?></label><br/>
46
+ <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-4" value="mainAtTwitterPlus"<?php checked( $is_enabled, 'mainAtTwitterPlus' ); ?> /> <label for="wp-to-twitter-enable-user-4"><?php _e( 'Tweet my posts with an @ reference to both my username and to the main site username.', 'wp-to-twitter' ); ?></label>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <th scope="row">
51
+ <label for="wp-to-twitter-user-username"><?php _e( 'Your Twitter Username', 'wp-to-twitter' ); ?></label>
52
+ </th>
53
+ <td>
54
+ <input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>"/> <?php _e( 'Enter your own Twitter username.', 'wp-to-twitter' ); ?>
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <th scope="row">
59
+ <label for="wpt-remove"><?php _e( 'Hide account name in Tweets', 'wp-to-twitter' ); ?></label></th>
60
+ <td>
61
+ <input type="checkbox" name="wpt-remove" id="wpt-remove" value="on"<?php checked( 'on', $wpt_remove ); ?>/> <?php _e( 'Do not display my account in the #account# template tag.', 'wp-to-twitter' ); ?>
62
+ </td>
63
+ </tr>
64
+ <?php echo apply_filters( 'wpt_twitter_user_fields', $user_edit ); ?>
65
+ </table>
66
+ <?php
67
+ if ( function_exists( 'wpt_schedule_tweet' ) ) {
68
+ if ( function_exists( 'wtt_connect_oauth' ) ) {
69
+ wtt_connect_oauth( $user_edit );
70
+ }
71
+ }
72
+ } else {
73
+ // hidden fields. If function is enabled, but this user does not have privileges to edit.
74
+ ?>
75
+ <input type="hidden" name="wp-to-twitter-enable-user" value="<?php echo esc_attr( $is_enabled ); ?>" />
76
+ <input type="hidden" name="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>" />
77
+ <input type="hidden" name="wpt-remove" value="<?php echo esc_attr( $wpt_remove ); ?>" />
78
+ <?php
79
+ }
80
+ }
81
+
82
+ /**
83
+ * This compensates for an old error where the user ID is echoed directly into the page.
84
+ */
85
+ add_filter( 'wpt_twitter_user_fields', 'wpt_basic_user_fields', 100, 1 );
86
+ /**
87
+ * Return empty string if value is an integer.
88
+ *
89
+ * @param int $user_edit User ID.
90
+ *
91
+ * @return empty string.
92
+ */
93
+ function wpt_basic_user_fields( $user_edit ) {
94
+ if ( is_int( $user_edit ) ) {
95
+ return '';
96
+ }
97
+
98
+ return $user_edit;
99
+ }
100
+
101
+ /**
102
+ * Save user profile data
103
+ */
104
+ function wpt_twitter_save_profile() {
105
+ global $user_ID;
106
+ $current_user = wp_get_current_user();
107
+ if ( isset( $_POST['user_id'] ) ) {
108
+ $edit_id = (int) $_POST['user_id'];
109
+ } else {
110
+ $edit_id = $user_ID;
111
+ }
112
+ if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
113
+ $enable = ( isset( $_POST['wp-to-twitter-enable-user'] ) ) ? $_POST['wp-to-twitter-enable-user'] : '';
114
+ $username = ( isset( $_POST['wp-to-twitter-user-username'] ) ) ? $_POST['wp-to-twitter-user-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 );
118
+ update_user_meta( $edit_id, 'wpt-remove', $wpt_remove );
119
+ }
120
+ // WPT PRO.
121
+ apply_filters( 'wpt_save_user', $edit_id, $_POST );
122
+ }
123
+
124
+ add_action( 'admin_head', 'wpt_css' );
125
+ /**
126
+ * Output CSS governing styles for authorized users column.
127
+ */
128
+ function wpt_css() {
129
+ ?>
130
+ <style type="text/css">
131
+ th#wpt {
132
+ width: 60px;
133
+ }
134
+
135
+ .wpt_twitter .authorized {
136
+ padding: 1px 3px;
137
+ border-radius: 3px;
138
+ background: #070;
139
+ color: #fff;
140
+ }
141
+ </style>
142
+ <?php
143
+ }
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.3.6
21
  */
22
 
23
  /*
@@ -47,6 +47,7 @@ define( 'WPT_DEBUG_ADDRESS', get_option( 'admin_email' ) );
47
  define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
48
 
49
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-functions.php' );
 
50
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-oauth.php' );
51
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-shorteners.php' );
52
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-manager.php' );
@@ -56,7 +57,7 @@ require_once( plugin_dir_path( __FILE__ ) . 'wpt-widget.php' );
56
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
57
 
58
  global $wpt_version;
59
- $wpt_version = '3.3.6';
60
 
61
  add_action( 'init', 'wpt_load_textdomain' );
62
  /**
@@ -131,7 +132,6 @@ function wptotwitter_activate() {
131
  update_option( 'jd_strip_nonan', '0' );
132
  update_option( 'jd_max_tags', 3 );
133
  update_option( 'jd_max_characters', 15 );
134
- update_option( 'jd_replace_character', '' );
135
  $administrator = get_role( 'administrator' );
136
  if ( is_object( $administrator ) ) {
137
  // wpt_twitter_oauth is the general permission for editing user accounts.
@@ -494,7 +494,6 @@ function wpt_post_to_twitter( $twit, $auth = false, $id = false, $media = false
494
  }
495
  }
496
 
497
-
498
  /**
499
  * For servers without PEAR normalize installed, approximates normalization. With normalizer, executes normalization on string.
500
  *
@@ -1026,9 +1025,13 @@ function wpt_generate_hash_tags( $post_ID ) {
1026
  $search = '/[^\p{L}\p{N}\s]/u';
1027
  $replace = get_option( 'jd_replace_character' );
1028
  $replace = ( '[ ]' == $replace || '' == $replace ) ? '' : $replace;
1029
- $tag = str_ireplace( ' ', $replace, trim( $tag ) );
1030
- $tag = preg_replace( '/[\/]/', $replace, $tag ); // remove forward slashes.
1031
- $tag = ( '1' == $strip ) ? preg_replace( $search, $replace, $tag ) : $tag;
 
 
 
 
1032
 
1033
  switch ( $term_meta ) {
1034
  case 1:
@@ -1068,18 +1071,15 @@ function wpt_add_twitter_outer_box() {
1068
  wpt_check_version();
1069
  // add Twitter panel to post types where it's enabled.
1070
  $wpt_post_types = get_option( 'wpt_post_types' );
1071
- if ( function_exists( 'add_meta_box' ) ) {
1072
- if ( is_array( $wpt_post_types ) ) {
1073
- foreach ( $wpt_post_types as $key => $value ) {
1074
- if ( 1 == $value['post-published-update'] || 1 == $value['post-edited-update'] ) {
1075
- add_meta_box( 'wp2t', 'WP to Twitter', 'wpt_add_twitter_inner_box', $key, 'side' );
1076
- }
1077
  }
1078
  }
1079
  }
1080
  }
1081
 
1082
-
1083
  add_action( 'admin_menu', 'wpt_add_twitter_debug_box' );
1084
  /**
1085
  * Set up post meta box.
@@ -1089,12 +1089,10 @@ function wpt_add_twitter_debug_box() {
1089
  wpt_check_version();
1090
  // add Twitter panel to post types where it's enabled.
1091
  $wpt_post_types = get_option( 'wpt_post_types' );
1092
- if ( function_exists( 'add_meta_box' ) ) {
1093
- if ( is_array( $wpt_post_types ) ) {
1094
- foreach ( $wpt_post_types as $key => $value ) {
1095
- if ( 1 == $value['post-published-update'] || 1 == $value['post-edited-update'] ) {
1096
- add_meta_box( 'wp2t-debug', 'WP to Twitter Debugging', 'wpt_show_debug', $key, 'advanced' );
1097
- }
1098
  }
1099
  }
1100
  }
@@ -1149,7 +1147,7 @@ function wpt_add_twitter_inner_box( $post ) {
1149
  <button type='button' class='tweet button-primary' data-action='tweet'><span class='dashicons dashicons-twitter' aria-hidden='true'></span><?php _e( 'Tweet Now', 'wp-to-twitter' ); ?></button>
1150
  <?php
1151
  if ( function_exists( 'wpt_pro_exists' ) && wpt_pro_exists() ) {
1152
- ?>
1153
  <button type='button' class='tweet schedule button-secondary' data-action='schedule' disabled><?php _e( 'Schedule', 'wp-to-twitter' ); ?></button>
1154
  <button type='button' class='time button-secondary'>
1155
  <span class="dashicons dashicons-clock" aria-hidden="true"></span><span class="screen-reader-text"><?php _e( 'Set Date/Time', 'wp-to-twitter' ); ?></span>
@@ -1160,12 +1158,12 @@ function wpt_add_twitter_inner_box( $post ) {
1160
  <label for='wpt_time'><?php _e( 'Time', 'wp-to-twitter' ); ?></label>
1161
  <input type='text' value='<?php echo date_i18n( 'h:s a', current_time( 'timestamp' ) + 3600 ); ?>' class='wpt_time time' name='wpt_datetime' id='wpt_time'/>
1162
  </div>
1163
- <?php
1164
  }
1165
  ?>
1166
  <div class='wpt_log' aria-live='assertive'></div>
1167
  </div>
1168
- <?php
1169
  }
1170
  if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'manage_options' ) ) {
1171
  ?>
@@ -1195,9 +1193,9 @@ function wpt_add_twitter_inner_box( $post ) {
1195
  echo "<label for='yourls_keyword'>" . __( 'YOURLS Custom Keyword', 'wp-to-twitter' ) . "</label> <input type='text' name='_yourls_keyword' id='yourls_keyword' value='$custom_keyword' />";
1196
  }
1197
  } else {
1198
- ?>
1199
  <input type="hidden" name='_jd_twitter' value='<?php echo esc_attr( $tweet ); ?>'/>
1200
- <?php
1201
  }
1202
  ?>
1203
  <div class='wpt-options'>
@@ -1267,10 +1265,10 @@ function wpt_add_twitter_inner_box( $post ) {
1267
  }
1268
  ?>
1269
  </div>
1270
- <?php
1271
  }
1272
  if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'manage_options' ) ) {
1273
- ?>
1274
  <div class='wptab' id='notes' aria-labelledby='tab_notes' role='tabpanel'>
1275
  <p>
1276
  <?php
@@ -1279,7 +1277,7 @@ function wpt_add_twitter_inner_box( $post ) {
1279
  ?>
1280
  </p>
1281
  </div>
1282
- <?php
1283
  }
1284
  ?>
1285
  </div>
@@ -1288,16 +1286,16 @@ function wpt_add_twitter_inner_box( $post ) {
1288
  // "no" means 'Don't Tweet' (is checked)
1289
  $nochecked = ( 'no' == $tweet_this ) ? ' checked="checked"' : '';
1290
  $yeschecked = ( 'yes' == $tweet_this ) ? ' checked="checked"' : '';
1291
- ?>
1292
  <p class='toggle-btn-group'>
1293
  <input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /><label for="jtn"><?php _e( "Don't Tweet", 'wp-to-twitter' ); ?></label>
1294
  <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /><label for="jty"><?php _e( 'Tweet', 'wp-to-twitter' ); ?></label>
1295
  </p>
1296
- <?php
1297
  } else {
1298
- ?>
1299
  <input type='hidden' name='_jd_tweet_this' value='<?php echo $tweet_this; ?>'/>
1300
- <?php
1301
  }
1302
  wpt_show_tweets( $post_id );
1303
  ?>
@@ -1308,9 +1306,9 @@ function wpt_add_twitter_inner_box( $post ) {
1308
  <strong><a href="http://www.wptweetspro.com/wp-tweets-pro"><?php _e( 'Go Premium', 'wp-to-twitter' ); ?></a></strong> &raquo;
1309
  <?php
1310
  } else {
1311
- ?>
1312
  <a href="<?php echo esc_url( add_query_arg( 'tab', 'support', admin_url( 'admin.php?page=wp-tweets-pro' ) ) ); ?>#get-support"><?php _e( 'Get Support', 'wp-to-twitter' ); ?></a> &raquo;
1313
- <?php
1314
  }
1315
  ?>
1316
  </p>
@@ -1320,13 +1318,13 @@ function wpt_add_twitter_inner_box( $post ) {
1320
  }
1321
  ?>
1322
  </div>
1323
- <?php
1324
  } else {
1325
  // permissions: this user isn't allowed to Tweet.
1326
  _e( 'Your role does not have the ability to Post Tweets from this site.', 'wp-to-twitter' );
1327
- ?>
1328
  <input type='hidden' name='_jd_tweet_this' value='no'/>
1329
- <?php
1330
  }
1331
  }
1332
 
@@ -1343,7 +1341,7 @@ function wpt_show_tweets( $post_id ) {
1343
  $previous_tweets = array( 0 => $previous_tweets );
1344
  }
1345
  if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) {
1346
- ?>
1347
  <hr>
1348
  <p class='panel-toggle'>
1349
  <a href='#wpt_tweet_history' class='history-toggle'><span class='dashicons dashicons-plus' aria-hidden="true"></span><?php _e( 'View Tweet History', 'wp-to-twitter' ); ?></a>
@@ -1351,45 +1349,45 @@ function wpt_show_tweets( $post_id ) {
1351
  <div class='history'>
1352
  <p class='error'><em><?php _e( 'Previous Tweets', 'wp-to-twitter' ); ?>:</em></p>
1353
  <ul>
1354
- <?php
1355
- $has_history = false;
1356
- $hidden_fields = '';
1357
- if ( is_array( $previous_tweets ) ) {
1358
- foreach ( $previous_tweets as $previous_tweet ) {
1359
- if ( '' != $previous_tweet ) {
1360
- $has_history = true;
1361
- $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='" . esc_attr( $previous_tweet ) . "' />";
1362
- echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=" . urlencode( $previous_tweet ) . "'>Retweet this</a></li>";
 
1363
  }
1364
  }
1365
- }
1366
- ?>
1367
  </ul>
1368
- <?php
1369
- $list = false;
1370
- $error_list = '';
1371
- if ( is_array( $failed_tweets ) ) {
1372
- foreach ( $failed_tweets as $failed_tweet ) {
1373
- if ( ! empty( $failed_tweet ) ) {
1374
- $ft = $failed_tweet['sentence'];
1375
- $reason = $failed_tweet['code'];
1376
- $error = $failed_tweet['error'];
1377
- $list = true;
1378
- $error_list .= "<li> <code>Error: $reason</code> $ft <a href='http://twitter.com/intent/tweet?text=" . urlencode( $ft ) . "'>Tweet this</a><br /><em>$error</em></li>";
 
 
 
 
 
1379
  }
1380
  }
1381
- if ( true == $list ) {
1382
- echo "<p class='error'><em>" . __( 'Failed Tweets', 'wp-to-twitter' ) . ":</em></p>
1383
- <ul>$error_list</ul>";
1384
  }
1385
- }
1386
- echo '<div>' . $hidden_fields . '</div>';
1387
- if ( $has_history || $list ) {
1388
- echo "<p><input type='checkbox' name='wpt_clear_history' id='wptch' value='clear' /> <label for='wptch'>" . __( 'Delete Tweet History', 'wp-to-twitter' ) . '</label></p>';
1389
- }
1390
- ?>
1391
  </div>
1392
- <?php
1393
  }
1394
  }
1395
 
@@ -1582,108 +1580,6 @@ function wpt_save_post( $id ) {
1582
  }
1583
  }
1584
 
1585
- /**
1586
- * Show user profile data on Edit User pages.
1587
- */
1588
- function wpt_twitter_profile() {
1589
- global $user_ID;
1590
- $current_user = wp_get_current_user();
1591
- $user_edit = ( isset( $_GET['user_id'] ) ) ? (int) $_GET['user_id'] : $user_ID;
1592
-
1593
- $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user', true );
1594
- $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username', true );
1595
- $wpt_remove = get_user_meta( $user_edit, 'wpt-remove', true );
1596
- if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
1597
- ?>
1598
- <h3><?php _e( 'WP Tweets User Settings', 'wp-to-twitter' ); ?></h3>
1599
- <?php
1600
- if ( function_exists( 'wpt_connect_oauth_message' ) ) {
1601
- wpt_connect_oauth_message( $user_edit );
1602
- }
1603
- ?>
1604
- <table class="form-table">
1605
- <tr>
1606
- <th scope="row"><?php _e( 'Use My Twitter Username', 'wp-to-twitter' ); ?></th>
1607
- <td>
1608
- <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-3" value="mainAtTwitter"<?php checked( $is_enabled, 'mainAtTwitter' ); ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e( 'Tweet my posts with an @ reference to my username.', 'wp-to-twitter' ); ?></label><br/>
1609
- <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-4" value="mainAtTwitterPlus"<?php checked( $is_enabled, 'mainAtTwitterPlus' ); ?> /> <label for="wp-to-twitter-enable-user-4"><?php _e( 'Tweet my posts with an @ reference to both my username and to the main site username.', 'wp-to-twitter' ); ?></label>
1610
- </td>
1611
- </tr>
1612
- <tr>
1613
- <th scope="row">
1614
- <label for="wp-to-twitter-user-username"><?php _e( 'Your Twitter Username', 'wp-to-twitter' ); ?></label>
1615
- </th>
1616
- <td>
1617
- <input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>"/> <?php _e( 'Enter your own Twitter username.', 'wp-to-twitter' ); ?>
1618
- </td>
1619
- </tr>
1620
- <tr>
1621
- <th scope="row">
1622
- <label for="wpt-remove"><?php _e( 'Hide account name in Tweets', 'wp-to-twitter' ); ?></label></th>
1623
- <td>
1624
- <input type="checkbox" name="wpt-remove" id="wpt-remove" value="on"<?php checked( 'on', $wpt_remove ); ?>/> <?php _e( 'Do not display my account in the #account# template tag.', 'wp-to-twitter' ); ?>
1625
- </td>
1626
- </tr>
1627
- <?php echo apply_filters( 'wpt_twitter_user_fields', $user_edit ); ?>
1628
- </table>
1629
- <?php
1630
- if ( function_exists( 'wpt_schedule_tweet' ) ) {
1631
- if ( function_exists( 'wtt_connect_oauth' ) ) {
1632
- wtt_connect_oauth( $user_edit );
1633
- }
1634
- }
1635
- } else {
1636
- // hidden fields. If function is enabled, but this user does not have privileges to edit.
1637
- ?>
1638
- <input type="hidden" name="wp-to-twitter-enable-user" value="<?php echo esc_attr( $is_enabled ); ?>" />
1639
- <input type="hidden" name="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>" />
1640
- <input type="hidden" name="wpt-remove" value="<?php echo esc_attr( $wpt_remove ); ?>" />
1641
- <?php
1642
- }
1643
- }
1644
-
1645
- /**
1646
- * This compensates for an old error where the user ID is echoed directly into the page.
1647
- */
1648
- add_filter( 'wpt_twitter_user_fields', 'wpt_basic_user_fields', 100, 1 );
1649
- /**
1650
- * Return empty string if value is an integer.
1651
- *
1652
- * @param int $user_edit User ID.
1653
- *
1654
- * @return empty string.
1655
- */
1656
- function wpt_basic_user_fields( $user_edit ) {
1657
- if ( is_int( $user_edit ) ) {
1658
- return '';
1659
- }
1660
-
1661
- return $user_edit;
1662
- }
1663
-
1664
- /**
1665
- * Save user profile data
1666
- */
1667
- function wpt_twitter_save_profile() {
1668
- global $user_ID;
1669
- $current_user = wp_get_current_user();
1670
- if ( isset( $_POST['user_id'] ) ) {
1671
- $edit_id = (int) $_POST['user_id'];
1672
- } else {
1673
- $edit_id = $user_ID;
1674
- }
1675
- if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can( 'manage_options' ) ) {
1676
- $enable = ( isset( $_POST['wp-to-twitter-enable-user'] ) ) ? $_POST['wp-to-twitter-enable-user'] : '';
1677
- $username = ( isset( $_POST['wp-to-twitter-user-username'] ) ) ? $_POST['wp-to-twitter-user-username'] : '';
1678
- $wpt_remove = ( isset( $_POST['wpt-remove'] ) ) ? 'on' : '';
1679
- update_user_meta( $edit_id, 'wp-to-twitter-enable-user', $enable );
1680
- update_user_meta( $edit_id, 'wp-to-twitter-user-username', $username );
1681
- update_user_meta( $edit_id, 'wpt-remove', $wpt_remove );
1682
- }
1683
- // WPT PRO.
1684
- apply_filters( 'wpt_save_user', $edit_id, $_POST );
1685
- }
1686
-
1687
  add_action( 'init', 'wpt_old_admin_redirect' );
1688
  /**
1689
  * Send links to old admin to new admin page
@@ -1738,13 +1634,6 @@ function wpt_plugin_action( $links, $file ) {
1738
 
1739
  // Add Plugin Actions to WordPress.
1740
  add_filter( 'plugin_action_links', 'wpt_plugin_action', 10, 2 );
1741
-
1742
- if ( '1' == get_option( 'jd_individual_twitter_users' ) ) {
1743
- add_action( 'show_user_profile', 'wpt_twitter_profile' );
1744
- add_action( 'edit_user_profile', 'wpt_twitter_profile' );
1745
- add_action( 'profile_update', 'wpt_twitter_save_profile' );
1746
- }
1747
-
1748
  add_action( 'in_plugin_update_message-wp-to-twitter/wp-to-twitter.php', 'wpt_plugin_update_message' );
1749
  /**
1750
  * Parse plugin update info to display in update list.
@@ -1954,24 +1843,3 @@ function wpt_permit_feed_styles( $value ) {
1954
 
1955
  return $value;
1956
  }
1957
-
1958
- add_action( 'admin_head', 'wpt_css' );
1959
- /**
1960
- * Output CSS governing styles for authorized users column.
1961
- */
1962
- function wpt_css() {
1963
- ?>
1964
- <style type="text/css">
1965
- th#wpt {
1966
- width: 60px;
1967
- }
1968
-
1969
- .wpt_twitter .authorized {
1970
- padding: 1px 3px;
1971
- border-radius: 3px;
1972
- background: #070;
1973
- color: #fff;
1974
- }
1975
- </style>
1976
- <?php
1977
- }
17
  * License: GPL-2.0+
18
  * License URI: http://www.gnu.org/license/gpl-2.0.txt
19
  * Domain Path: lang
20
+ * Version: 3.3.7
21
  */
22
 
23
  /*
47
  define( 'WPT_FROM', 'From: \"' . get_option( 'blogname' ) . '\" <' . get_option( 'admin_email' ) . '>' );
48
 
49
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-functions.php' );
50
+ require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-users.php' );
51
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-oauth.php' );
52
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-shorteners.php' );
53
  require_once( plugin_dir_path( __FILE__ ) . 'wp-to-twitter-manager.php' );
57
  require_once( plugin_dir_path( __FILE__ ) . 'wpt-rate-limiting.php' );
58
 
59
  global $wpt_version;
60
+ $wpt_version = '3.3.7';
61
 
62
  add_action( 'init', 'wpt_load_textdomain' );
63
  /**
132
  update_option( 'jd_strip_nonan', '0' );
133
  update_option( 'jd_max_tags', 3 );
134
  update_option( 'jd_max_characters', 15 );
 
135
  $administrator = get_role( 'administrator' );
136
  if ( is_object( $administrator ) ) {
137
  // wpt_twitter_oauth is the general permission for editing user accounts.
494
  }
495
  }
496
 
 
497
  /**
498
  * For servers without PEAR normalize installed, approximates normalization. With normalizer, executes normalization on string.
499
  *
1025
  $search = '/[^\p{L}\p{N}\s]/u';
1026
  $replace = get_option( 'jd_replace_character' );
1027
  $replace = ( '[ ]' == $replace || '' == $replace ) ? '' : $replace;
1028
+ if ( false !== strpos( $tag, ' ' ) ) {
1029
+ // If multiple words, camelcase tag.
1030
+ $tag = ucwords( $tag );
1031
+ }
1032
+ $tag = str_ireplace( ' ', $replace, trim( $tag ) );
1033
+ $tag = preg_replace( '/[\/]/', $replace, $tag ); // remove forward slashes.
1034
+ $tag = ( '1' == $strip ) ? preg_replace( $search, $replace, $tag ) : $tag;
1035
 
1036
  switch ( $term_meta ) {
1037
  case 1:
1071
  wpt_check_version();
1072
  // add Twitter panel to post types where it's enabled.
1073
  $wpt_post_types = get_option( 'wpt_post_types' );
1074
+ if ( is_array( $wpt_post_types ) ) {
1075
+ foreach ( $wpt_post_types as $key => $value ) {
1076
+ if ( 1 == $value['post-published-update'] || 1 == $value['post-edited-update'] ) {
1077
+ add_meta_box( 'wp2t', 'WP to Twitter', 'wpt_add_twitter_inner_box', $key, 'side' );
 
 
1078
  }
1079
  }
1080
  }
1081
  }
1082
 
 
1083
  add_action( 'admin_menu', 'wpt_add_twitter_debug_box' );
1084
  /**
1085
  * Set up post meta box.
1089
  wpt_check_version();
1090
  // add Twitter panel to post types where it's enabled.
1091
  $wpt_post_types = get_option( 'wpt_post_types' );
1092
+ if ( is_array( $wpt_post_types ) ) {
1093
+ foreach ( $wpt_post_types as $key => $value ) {
1094
+ if ( 1 == $value['post-published-update'] || 1 == $value['post-edited-update'] ) {
1095
+ add_meta_box( 'wp2t-debug', 'WP to Twitter Debugging', 'wpt_show_debug', $key, 'advanced' );
 
 
1096
  }
1097
  }
1098
  }
1147
  <button type='button' class='tweet button-primary' data-action='tweet'><span class='dashicons dashicons-twitter' aria-hidden='true'></span><?php _e( 'Tweet Now', 'wp-to-twitter' ); ?></button>
1148
  <?php
1149
  if ( function_exists( 'wpt_pro_exists' ) && wpt_pro_exists() ) {
1150
+ ?>
1151
  <button type='button' class='tweet schedule button-secondary' data-action='schedule' disabled><?php _e( 'Schedule', 'wp-to-twitter' ); ?></button>
1152
  <button type='button' class='time button-secondary'>
1153
  <span class="dashicons dashicons-clock" aria-hidden="true"></span><span class="screen-reader-text"><?php _e( 'Set Date/Time', 'wp-to-twitter' ); ?></span>
1158
  <label for='wpt_time'><?php _e( 'Time', 'wp-to-twitter' ); ?></label>
1159
  <input type='text' value='<?php echo date_i18n( 'h:s a', current_time( 'timestamp' ) + 3600 ); ?>' class='wpt_time time' name='wpt_datetime' id='wpt_time'/>
1160
  </div>
1161
+ <?php
1162
  }
1163
  ?>
1164
  <div class='wpt_log' aria-live='assertive'></div>
1165
  </div>
1166
+ <?php
1167
  }
1168
  if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'manage_options' ) ) {
1169
  ?>
1193
  echo "<label for='yourls_keyword'>" . __( 'YOURLS Custom Keyword', 'wp-to-twitter' ) . "</label> <input type='text' name='_yourls_keyword' id='yourls_keyword' value='$custom_keyword' />";
1194
  }
1195
  } else {
1196
+ ?>
1197
  <input type="hidden" name='_jd_twitter' value='<?php echo esc_attr( $tweet ); ?>'/>
1198
+ <?php
1199
  }
1200
  ?>
1201
  <div class='wpt-options'>
1265
  }
1266
  ?>
1267
  </div>
1268
+ <?php
1269
  }
1270
  if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'manage_options' ) ) {
1271
+ ?>
1272
  <div class='wptab' id='notes' aria-labelledby='tab_notes' role='tabpanel'>
1273
  <p>
1274
  <?php
1277
  ?>
1278
  </p>
1279
  </div>
1280
+ <?php
1281
  }
1282
  ?>
1283
  </div>
1286
  // "no" means 'Don't Tweet' (is checked)
1287
  $nochecked = ( 'no' == $tweet_this ) ? ' checked="checked"' : '';
1288
  $yeschecked = ( 'yes' == $tweet_this ) ? ' checked="checked"' : '';
1289
+ ?>
1290
  <p class='toggle-btn-group'>
1291
  <input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /><label for="jtn"><?php _e( "Don't Tweet", 'wp-to-twitter' ); ?></label>
1292
  <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /><label for="jty"><?php _e( 'Tweet', 'wp-to-twitter' ); ?></label>
1293
  </p>
1294
+ <?php
1295
  } else {
1296
+ ?>
1297
  <input type='hidden' name='_jd_tweet_this' value='<?php echo $tweet_this; ?>'/>
1298
+ <?php
1299
  }
1300
  wpt_show_tweets( $post_id );
1301
  ?>
1306
  <strong><a href="http://www.wptweetspro.com/wp-tweets-pro"><?php _e( 'Go Premium', 'wp-to-twitter' ); ?></a></strong> &raquo;
1307
  <?php
1308
  } else {
1309
+ ?>
1310
  <a href="<?php echo esc_url( add_query_arg( 'tab', 'support', admin_url( 'admin.php?page=wp-tweets-pro' ) ) ); ?>#get-support"><?php _e( 'Get Support', 'wp-to-twitter' ); ?></a> &raquo;
1311
+ <?php
1312
  }
1313
  ?>
1314
  </p>
1318
  }
1319
  ?>
1320
  </div>
1321
+ <?php
1322
  } else {
1323
  // permissions: this user isn't allowed to Tweet.
1324
  _e( 'Your role does not have the ability to Post Tweets from this site.', 'wp-to-twitter' );
1325
+ ?>
1326
  <input type='hidden' name='_jd_tweet_this' value='no'/>
1327
+ <?php
1328
  }
1329
  }
1330
 
1341
  $previous_tweets = array( 0 => $previous_tweets );
1342
  }
1343
  if ( ! empty( $previous_tweets ) || ! empty( $failed_tweets ) ) {
1344
+ ?>
1345
  <hr>
1346
  <p class='panel-toggle'>
1347
  <a href='#wpt_tweet_history' class='history-toggle'><span class='dashicons dashicons-plus' aria-hidden="true"></span><?php _e( 'View Tweet History', 'wp-to-twitter' ); ?></a>
1349
  <div class='history'>
1350
  <p class='error'><em><?php _e( 'Previous Tweets', 'wp-to-twitter' ); ?>:</em></p>
1351
  <ul>
1352
+ <?php
1353
+ $has_history = false;
1354
+ $hidden_fields = '';
1355
+ if ( is_array( $previous_tweets ) ) {
1356
+ foreach ( $previous_tweets as $previous_tweet ) {
1357
+ if ( '' != $previous_tweet ) {
1358
+ $has_history = true;
1359
+ $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='" . esc_attr( $previous_tweet ) . "' />";
1360
+ echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=" . urlencode( $previous_tweet ) . "'>Retweet this</a></li>";
1361
+ }
1362
  }
1363
  }
1364
+ ?>
 
1365
  </ul>
1366
+ <?php
1367
+ $list = false;
1368
+ $error_list = '';
1369
+ if ( is_array( $failed_tweets ) ) {
1370
+ foreach ( $failed_tweets as $failed_tweet ) {
1371
+ if ( ! empty( $failed_tweet ) ) {
1372
+ $ft = $failed_tweet['sentence'];
1373
+ $reason = $failed_tweet['code'];
1374
+ $error = $failed_tweet['error'];
1375
+ $list = true;
1376
+ $error_list .= "<li> <code>Error: $reason</code> $ft <a href='http://twitter.com/intent/tweet?text=" . urlencode( $ft ) . "'>Tweet this</a><br /><em>$error</em></li>";
1377
+ }
1378
+ }
1379
+ if ( true == $list ) {
1380
+ echo "<p class='error'><em>" . __( 'Failed Tweets', 'wp-to-twitter' ) . ":</em></p>
1381
+ <ul>$error_list</ul>";
1382
  }
1383
  }
1384
+ echo '<div>' . $hidden_fields . '</div>';
1385
+ if ( $has_history || $list ) {
1386
+ echo "<p><input type='checkbox' name='wpt_clear_history' id='wptch' value='clear' /> <label for='wptch'>" . __( 'Delete Tweet History', 'wp-to-twitter' ) . '</label></p>';
1387
  }
1388
+ ?>
 
 
 
 
 
1389
  </div>
1390
+ <?php
1391
  }
1392
  }
1393
 
1580
  }
1581
  }
1582
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1583
  add_action( 'init', 'wpt_old_admin_redirect' );
1584
  /**
1585
  * Send links to old admin to new admin page
1634
 
1635
  // Add Plugin Actions to WordPress.
1636
  add_filter( 'plugin_action_links', 'wpt_plugin_action', 10, 2 );
 
 
 
 
 
 
 
1637
  add_action( 'in_plugin_update_message-wp-to-twitter/wp-to-twitter.php', 'wpt_plugin_update_message' );
1638
  /**
1639
  * Parse plugin update info to display in update list.
1843
 
1844
  return $value;
1845
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wpt-rate-limiting.php CHANGED
@@ -169,7 +169,7 @@ function wpt_edit_term_rate_limit( $term, $taxonomy ) {
169
  $t_id = $term->term_id;
170
  $limits = get_option( 'wpt_rate_limit' );
171
  $option_set = isset( $limits[ $t_id ] ) ? $limits[ $t_id ] : wpt_default_rate_limit( $t_id );
172
- ?>
173
  <tr class="form-field">
174
  <th valign="top" scope="row">
175
  <label for="wpt_rate_limit"><?php _e( 'Max Tweets per hour on this term', 'wp-tweets-pro' ); ?></label>
@@ -178,7 +178,7 @@ function wpt_edit_term_rate_limit( $term, $taxonomy ) {
178
  <input type='number' size='4' value='<?php echo esc_attr( $option_set ); ?>' name='wpt_rate_limit' id='wpt_rate_limit' />
179
  </td>
180
  </tr>
181
- <?php
182
  }
183
 
184
  /**
@@ -188,11 +188,11 @@ function wpt_edit_term_rate_limit( $term, $taxonomy ) {
188
  */
189
  function wpt_add_term_rate_limit( $term ) {
190
  $default = wpt_default_rate_limit();
191
- ?>
192
  <div class="form-field">
193
  <label for="wpt_rate_limit"><?php _e( 'Max Tweets per hour on this term', 'wp-tweets-pro' ); ?></label> <input type='number' value='<?php echo esc_attr( $default ); ?>' id='wpt_rate_limit' name='wpt_rate_limit' />
194
  </div>
195
- <?php
196
  }
197
 
198
  /**
169
  $t_id = $term->term_id;
170
  $limits = get_option( 'wpt_rate_limit' );
171
  $option_set = isset( $limits[ $t_id ] ) ? $limits[ $t_id ] : wpt_default_rate_limit( $t_id );
172
+ ?>
173
  <tr class="form-field">
174
  <th valign="top" scope="row">
175
  <label for="wpt_rate_limit"><?php _e( 'Max Tweets per hour on this term', 'wp-tweets-pro' ); ?></label>
178
  <input type='number' size='4' value='<?php echo esc_attr( $option_set ); ?>' name='wpt_rate_limit' id='wpt_rate_limit' />
179
  </td>
180
  </tr>
181
+ <?php
182
  }
183
 
184
  /**
188
  */
189
  function wpt_add_term_rate_limit( $term ) {
190
  $default = wpt_default_rate_limit();
191
+ ?>
192
  <div class="form-field">
193
  <label for="wpt_rate_limit"><?php _e( 'Max Tweets per hour on this term', 'wp-tweets-pro' ); ?></label> <input type='number' value='<?php echo esc_attr( $default ); ?>' id='wpt_rate_limit' name='wpt_rate_limit' />
194
  </div>
195
+ <?php
196
  }
197
 
198
  /**