WP to Twitter - Version 1.5.1

Version Description

  • Because that's what I get for making last minute changes.
Download this release

Release Info

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

Code changes from version 1.4.11 to 1.5.1

functions.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // This file contains secondary functions supporting WP to Twitter
3
+ // These functions don't perform any WP to Twitter actions, but are sometimes called for when
4
+ // support for primary functions is lacking.
5
+
6
+ if ( !class_exists('SERVICES_JSON') ) {
7
+ require_once( WP_PLUGIN_DIR.'/wp-to-twitter/json.class.php' );
8
+ }
9
+ if (!function_exists('json_encode')) {
10
+ function json_encode($data) {
11
+ $json = new Services_JSON();
12
+ return( $json->encode($data) );
13
+ }
14
+ }
15
+ if (!function_exists('json_decode')) {
16
+ function json_decode($data) {
17
+ $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE );
18
+ return( $json->decode($data) );
19
+ }
20
+ }
21
+ if (!function_exists('mb_strlen')) {
22
+ function mb_strlen($data) {
23
+ return strlen($data);
24
+ }
25
+ }
26
+
27
+ // str_ireplace substitution for PHP4
28
+ if ( !function_exists( 'str_ireplace' ) ) {
29
+ function str_ireplace( $needle, $str, $haystack ) {
30
+ $needle = preg_quote( $needle, '/' );
31
+ return preg_replace( "/$needle/i", $str, $haystack );
32
+ }
33
+ }
34
+ // str_split substitution for PHP4
35
+ if( !function_exists( 'str_split' ) ) {
36
+ function str_split( $string,$string_length=1 ) {
37
+ if( strlen( $string )>$string_length || !$string_length ) {
38
+ do {
39
+ $c = strlen($string);
40
+ $parts[] = substr($string,0,$string_length);
41
+ $string = substr($string,$string_length);
42
+ } while($string !== false);
43
+ } else {
44
+ $parts = array($string);
45
+ }
46
+ return $parts;
47
+ }
48
+ }
49
+ // mb_substr_replace substition for PHP4
50
+ if ( !function_exists( 'mb_substr_replace' ) ) {
51
+ function mb_substr_replace( $string, $replacement, $start, $length = null, $encoding = null ) {
52
+ if ( extension_loaded( 'mbstring' ) === true ) {
53
+ $string_length = (is_null($encoding) === true) ? mb_strlen($string) : mb_strlen($string, $encoding);
54
+ if ( $start < 0 ) {
55
+ $start = max(0, $string_length + $start);
56
+ } else if ( $start > $string_length ) {
57
+ $start = $string_length;
58
+ }
59
+ if ( $length < 0 ) {
60
+ $length = max( 0, $string_length - $start + $length );
61
+ } else if ( ( is_null( $length ) === true ) || ( $length > $string_length ) ) {
62
+ $length = $string_length;
63
+ }
64
+ if ( ( $start + $length ) > $string_length) {
65
+ $length = $string_length - $start;
66
+ }
67
+ if ( is_null( $encoding ) === true) {
68
+ return mb_substr( $string, 0, $start ) . $replacement . mb_substr( $string, $start + $length, $string_length - $start - $length );
69
+ }
70
+ return mb_substr( $string, 0, $start, $encoding ) . $replacement . mb_substr( $string, $start + $length, $string_length - $start - $length, $encoding );
71
+ }
72
+ return ( is_null( $length ) === true ) ? substr_replace( $string, $replacement, $start ) : substr_replace( $string, $replacement, $start, $length );
73
+ }
74
+ }
75
+
76
+ // cURL query contributed by Thor Erik (http://thorerik.net)
77
+ function getfilefromurl($url) {
78
+ if ( function_exists( 'curl_init' ) ) {
79
+ $ch = curl_init();
80
+ curl_setopt( $ch, CURLOPT_HEADER, 0 );
81
+ curl_setopt( $ch, CURLOPT_VERBOSE, 0 );
82
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
83
+ curl_setopt( $ch, CURLOPT_URL, $url );
84
+ $output = curl_exec( $ch );
85
+ curl_close( $ch );
86
+ return $output;
87
+ } else {
88
+ return FALSE;
89
+ }
90
+ }
91
+ function print_settings() {
92
+ echo "<div class=\"settings\">";
93
+ echo "<strong>Raw Settings Output:</strong>";
94
+ echo "<pre>";
95
+ echo get_option( 'newpost-published-update' );echo " : ";echo get_option( 'newpost-published-text' );echo " : ";echo get_option( 'newpost-published-showlink' );
96
+ echo "<br />";
97
+ echo get_option( 'oldpost-edited-update' );echo " : ";echo get_option( 'oldpost-edited-text' );echo " : ";echo get_option( 'oldpost-edited-showlink' );
98
+ echo "<br />";
99
+ echo get_option( 'jd_twit_pages' );echo " : ";echo get_option( 'newpage-published-text' );
100
+ echo "<br />";
101
+ echo get_option( 'jd_twit_edited_pages' );echo " : ";echo get_option( 'oldpage-edited-text' );
102
+ echo "<br />[";
103
+ echo get_option( 'use_tags_as_hashtags' );echo " | ";echo get_option( 'jd_max_tags' );echo " | ";echo get_option( 'jd_max_characters' );echo "]<br />";
104
+ echo get_option( 'jd_twit_blogroll' );echo " : ";echo get_option( 'newlink-published-text' );echo " : ";echo get_option( 'jd-use-link-title' );echo " : ";echo get_option( 'jd-use-link-description' );
105
+ echo "<br />";
106
+ echo get_option( 'jd_post_excerpt' );
107
+ echo "<br />[";echo get_option( 'jd_twit_prepend' );echo " | ";echo get_option( 'jd_twit_append' );echo "]<br />";
108
+ echo get_option( 'jd_twit_custom_url' );
109
+ echo "<br />[";echo get_option( 'jd_tweet_default' );echo " | ";echo get_option( 'jd_twit_remote' );echo " | ";echo get_option( 'jd_twit_quickpress' );echo "]<br />[";
110
+ echo get_option( 'use-twitter-analytics' );echo " : ";echo get_option( 'twitter-analytics-campaign' );echo "]<br />Individuals:";
111
+ echo get_option( 'jd_individual_twitter_users' );
112
+ echo "<br />[";echo get_option( 'jd-use-cligs' );echo " | ";echo get_option( 'jd-use-bitly' );echo " | ";echo get_option( 'jd-use-none' );echo "]<br />";
113
+ // Use custom external URLs to point elsewhere.
114
+ echo get_option( 'twitterlogin' );
115
+ echo "<br />";
116
+ if ( get_option('twitterpw') != "") {
117
+ _e( "Twitter Password Saved",'wp-to-twitter' );
118
+ } else {
119
+ _e( "Twitter Password Not Saved",'wp-to-twitter' );
120
+ }
121
+ echo "<br />[";echo get_option( 'cligsapi' );echo " | ";echo get_option( 'bitlylogin' );echo " | ";echo get_option( 'bitlyapi' );
122
+ echo "]<br />";
123
+ echo "[";echo get_option( 'jd-functions-checked' );echo " | ";echo get_option( 'wp_twitter_failure' );echo " | ";echo get_option( 'wp_cligs_failure' );echo " | ";echo get_option( 'wp_url_failure' );echo " | ";echo get_option( 'wp_bitly_failure' );echo " | ";echo get_option( 'twitterInitialised' );echo " | ";echo get_option( 'wp_cligs_failure' );echo " | ";echo get_option( 'jd_shortener' );echo "]</pre>";
124
+
125
+ echo "<p>";
126
+ _e( "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Hide</a>] If you're experiencing trouble, please copy these settings into any request for support.",'wp-to-twitter');
127
+ echo "</p></div>";
128
+ }
129
+ ?>
readme.txt CHANGED
@@ -22,6 +22,20 @@ This plugin is based loosely on the Twitter Updater plugin by [Jonathan Dingman]
22
 
23
  == Changelog ==
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  = 1.4.11 =
26
 
27
  * Fixed a bug which allowed editing of posts to be tweeted if status updates on editing Pages were permitted.
@@ -194,6 +208,10 @@ If Twitter isn't available, you'll get a message telling you that there's been a
194
 
195
  If Cli.gs isn't available, your tweet will be sent using it's normal post permalink. You'll also get an error message letting you know that there was a problem contacting Cli.gs.
196
 
 
 
 
 
197
  = What if my server doesn't support the methods you use to contact these other sites? =
198
 
199
  Well, there isn't much I can do about that - but the plugin will check and see whether or not the needed methods work. If they don't, you will find a warning message on your settings page.
22
 
23
  == Changelog ==
24
 
25
+ = 1.5.1 =
26
+
27
+ * Because that's what I get for making last minute changes.
28
+
29
+ = 1.5.0 =
30
+
31
+ * Due to a large number of problems in the 1.4.x series, I'm launching a significant revision to the base code earlier than initially planned. This is because many of these features were already in development, and it's simply too much work to maintain both branches of the code.
32
+ * Added option to export settings in plain text for troubleshooting.
33
+ * Simplified some aspects of the settings page.
34
+ * Added custom text options for WordPress Pages to match support for Posts.
35
+ * Improved tags as hashtags handling.
36
+ * Added the ability to use custom shortcodes to access information in custom fields.
37
+ * Improved some error messages to clarify certain issues.
38
+
39
  = 1.4.11 =
40
 
41
  * Fixed a bug which allowed editing of posts to be tweeted if status updates on editing Pages were permitted.
208
 
209
  If Cli.gs isn't available, your tweet will be sent using it's normal post permalink. You'll also get an error message letting you know that there was a problem contacting Cli.gs.
210
 
211
+ = Why do my Twitter status updates show up labeled as "From WP to Twitter"? =
212
+
213
+ Twitter.com allows API applications to register themselves with the service, so they can provide information about the source of your Tweet. WP to Twitter is a registered user agent with Twitter.com. The same effect is seen if you use any other registered Twitter client.
214
+
215
  = What if my server doesn't support the methods you use to contact these other sites? =
216
 
217
  Well, there isn't much I can do about that - but the plugin will check and see whether or not the needed methods work. If they don't, you will find a warning message on your settings page.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
uninstall.php CHANGED
@@ -12,18 +12,13 @@ delete_option( 'oldpost-edited-showlink' );
12
 
13
  delete_option( 'jd_twit_pages' );
14
  delete_option( 'jd_twit_edited_pages' );
 
 
15
 
16
  delete_option( 'jd_twit_remote' );
17
 
18
  delete_option( 'jd_post_excerpt' );
19
 
20
- // Use Google Analytics with Twitter
21
- delete_option( 'twitter-analytics-campaign' );
22
- delete_option( 'use-twitter-analytics' );
23
-
24
- // Use custom external URLs to point elsewhere.
25
- delete_option( 'jd_twit_custom_url' );
26
-
27
  // Cligs API
28
  delete_option( 'cligsapi' );
29
 
@@ -56,15 +51,17 @@ delete_option( 'jd-use-none' );
56
 
57
  // Special Options
58
  delete_option( 'jd_twit_prepend' );
 
59
  delete_option( 'jd_twit_remote' );
60
  delete_option( 'twitter-analytics-campaign' );
61
  delete_option( 'use-twitter-analytics' );
62
  delete_option( 'jd_twit_custom_url' );
63
  delete_option( 'jd_shortener' );
64
- delete_option( 'jd_twit_append' );
65
  delete_option( 'jd_individual_twitter_users' );
66
  delete_option( 'use_tags_as_hashtags' );
67
-
 
68
  // Bitly Settings
69
  delete_option( 'bitlylogin' );
70
  delete_option( 'jd-use-bitly' );
12
 
13
  delete_option( 'jd_twit_pages' );
14
  delete_option( 'jd_twit_edited_pages' );
15
+ delete_option( 'oldpage-edited-text' );
16
+ delete_option( 'newpage-published-text' );
17
 
18
  delete_option( 'jd_twit_remote' );
19
 
20
  delete_option( 'jd_post_excerpt' );
21
 
 
 
 
 
 
 
 
22
  // Cligs API
23
  delete_option( 'cligsapi' );
24
 
51
 
52
  // Special Options
53
  delete_option( 'jd_twit_prepend' );
54
+ delete_option( 'jd_twit_append' );
55
  delete_option( 'jd_twit_remote' );
56
  delete_option( 'twitter-analytics-campaign' );
57
  delete_option( 'use-twitter-analytics' );
58
  delete_option( 'jd_twit_custom_url' );
59
  delete_option( 'jd_shortener' );
60
+
61
  delete_option( 'jd_individual_twitter_users' );
62
  delete_option( 'use_tags_as_hashtags' );
63
+ delete_option('jd_max_tags');
64
+ delete_option('jd_max_characters');
65
  // Bitly Settings
66
  delete_option( 'bitlylogin' );
67
  delete_option( 'jd-use-bitly' );
wp-to-twitter-manager.php CHANGED
@@ -8,6 +8,7 @@
8
  $wp_twitter_error = FALSE;
9
  $wp_cligs_error = FALSE;
10
  $message = "";
 
11
  //SETS DEFAULT OPTIONS
12
  if ( get_option( 'twitterInitialised') != '1' ) {
13
  update_option( 'newpost-published-update', '1' );
@@ -16,6 +17,8 @@
16
  update_option( 'jd_twit_quickpress', '1' );
17
  update_option( 'jd_shortener', '0' );
18
  update_option( 'use_tags_as_hashtags', '0' );
 
 
19
 
20
  update_option( 'oldpost-edited-update', '1' );
21
  update_option( 'oldpost-edited-text', 'Post Edited: #title# (#url#)' );
@@ -23,6 +26,8 @@
23
 
24
  update_option( 'jd_twit_pages','0' );
25
  update_option( 'jd_twit_edited_pages','0' );
 
 
26
 
27
  update_option( 'jd_twit_remote', '0' );
28
  update_option( 'jd_post_excerpt', 30 );
@@ -42,8 +47,6 @@
42
  update_option( 'wp_url_failure','0' );
43
 
44
  // Blogroll options
45
- update_option ('jd-use-link-title','0' );
46
- update_option( 'jd-use-link-description','1' );
47
  update_option( 'newlink-published-text', 'New link posted: ' );
48
  update_option( 'jd_twit_blogroll', '1');
49
 
@@ -52,6 +55,8 @@
52
  // Note that default options are set.
53
  update_option( 'twitterInitialised', '1' );
54
 
 
 
55
  $message = __("Set your Twitter login information and URL shortener API information to use this plugin!", 'wp-to-twitter');
56
  }
57
  if ( get_option( 'twitterInitialised') == '1' && get_option( 'jd_post_excerpt' ) == "" ) {
@@ -87,13 +92,13 @@
87
  // UPDATE OPTIONS
88
  update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
89
  update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
90
- update_option( 'newpost-published-showlink', $_POST['newpost-published-showlink'] );
91
  update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
92
  update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
93
  update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
94
- update_option( 'oldpost-edited-showlink', $_POST['oldpost-edited-showlink'] );
95
  update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
96
  update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] );
 
 
97
  update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
98
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
99
  update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
@@ -102,14 +107,9 @@
102
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
103
  update_option( 'jd_shortener', $_POST['jd_shortener'] );
104
  update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
105
-
106
- if ( $_POST['jd-use-link-field'] == '2' ) {
107
- update_option( 'jd-use-link-description', '1' );
108
- update_option( 'jd-use-link-title', '0' );
109
- } else if ( $_POST['jd-use-link-field'] == '1' ) {
110
- update_option( 'jd-use-link-title', '1' );
111
- update_option( 'jd-use-link-description', '0' );
112
- }
113
 
114
  switch ($_POST['jd_shortener']) {
115
  case 1:
@@ -135,17 +135,15 @@
135
 
136
  if ( get_option( 'jd-use-bitly' ) == 1 && ( get_option( 'bitlylogin' ) == "" || get_option( 'bitlyapi' ) == "" ) ) {
137
  $message .= __( 'You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly.' , 'wp-to-twitter');
 
138
  }
139
 
140
- update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
141
  update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
142
-
143
  update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
144
  update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
145
-
146
  update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
147
 
148
- $message = __( 'WP to Twitter Options Updated' , 'wp-to-twitter');
149
 
150
  }
151
 
@@ -180,7 +178,7 @@
180
  update_option( 'bitlyapi','' );
181
  $message = __("Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. ", 'wp-to-twitter');
182
  } else {
183
- $message = __("Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</a>! ", 'wp-to-twitter');
184
  }
185
  if ( $_POST['bitlylogin'] != '' && isset( $_POST['submit'] ) ) {
186
  update_option( 'bitlylogin',$_POST['bitlylogin'] );
@@ -217,7 +215,9 @@
217
 
218
  if ( $run_Snoopy_test == TRUE ) {
219
  $cligs_checker->fetchtext( "http://cli.gs/api/v1/cligs/create?url=$testurl&appid=WP-to-Twitter&key=" );
220
- $bitly_checker->fetch( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
 
 
221
  $twit_checker->fetch( "http://twitter.com/help/test.json" );
222
 
223
  if ( trim($cligs_checker->results) == "Please specify a valid URL to shorten.") {
@@ -228,16 +228,19 @@
228
  $message .=__("<li>Successfully contacted the Cli.gs API via Snoopy and created a shortened link.</li>", 'wp-to-twitter');
229
  $wp_cligs_error = FALSE;
230
  }
231
-
232
- $decoded = json_decode($bitly_checker->results,TRUE);
233
- $bitly_decoded = $decoded['statusCode'];
234
 
235
- if ( $bitly_decoded == "OK" ) {
236
- $wp_bitly_error = FALSE;
237
- $message .= __("<li>Successfully contacted the Bit.ly API via Snoopy.</li>", 'wp-to-twitter');
238
- } else {
239
- $message .=__("<li>Failed to contact the Bit.ly API via Snoopy.</li>", 'wp-to-twitter');
240
- }
 
 
 
241
  if ( $twit_checker->results == "\"ok\"" ) {
242
  $wp_twitter_error = FALSE;
243
  $message .= __("<li>Successfully contacted the Twitter API via Snoopy.</li>", 'wp-to-twitter');
@@ -295,7 +298,7 @@
295
  ?>
296
  <?php if ( $wp_twitter_error == TRUE || ( $wp_cligs_error == TRUE && $wp_bitly_error == TRUE ) ) {
297
  echo "<div class='error'><p>";
298
- _e("This plugin may not work in your server environment.", 'wp-to-twitter');
299
  echo "</p></div>";
300
  }
301
  ?>
@@ -306,9 +309,30 @@ echo "</p></div>";
306
 
307
  <div class="wrap" id="wp-to-twitter">
308
 
 
 
 
 
309
  <h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  <p>
311
- <?php _e("For any update field, you can use the codes <code>#title#</code> for the title of your blog post, <code>#blog#</code> for the title of your blog, <code>#post#</code> for a short excerpt of the post content or <code>#url#</code> for the post URL (shortened or not, depending on your preferences.)", 'wp-to-twitter'); ?>
312
  </p>
313
 
314
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) { ?>
@@ -335,47 +359,57 @@ echo "</p></div>";
335
  </form>
336
  <?php
337
  }
338
- ?>
339
-
340
  <form method="post" action="">
341
-
342
-
343
  <div>
344
  <fieldset>
345
- <legend><?php _e("Wordpress to Twitter Publishing Options", 'wp-to-twitter'); ?></legend>
346
-
347
  <p>
348
  <input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
349
- <label for="newpost-published-update"><strong><?php _e("Update when a post is published", 'wp-to-twitter'); ?></strong></label> <label for="newpost-published-text"><br /><?php _e("Text for new post updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option( 'newpost-published-text' ) ) ) ?>" />
350
- &nbsp;&nbsp;
351
- <input type="checkbox" name="newpost-published-showlink" id="newpost-published-showlink" value="1" <?php jd_checkCheckbox('newpost-published-showlink')?> />
352
- <label for="newpost-published-showlink"><?php _e("Provide link to blog?", 'wp-to-twitter'); ?></label>
353
  </p>
354
-
355
  <p>
356
  <input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
357
- <label for="oldpost-edited-update"><strong><?php _e("Update when a post is edited", 'wp-to-twitter'); ?></strong></label><br /><label for="oldpost-edited-text"><?php _e("Text for editing updates:", 'wp-to-twitter'); ?></label> <input type="text" name="oldpost-edited-text" id="oldpost-edited-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option('oldpost-edited-text' ) ) ) ?>" />
358
- &nbsp;&nbsp;
359
- <input type="checkbox" name="oldpost-edited-showlink" id="oldpost-edited-showlink" value="1" <?php jd_checkCheckbox('oldpost-edited-showlink')?> />
360
- <label for="oldpost-edited-showlink"><?php _e("Provide link to blog?", 'wp-to-twitter'); ?></label>
361
  </p>
362
- <p>
363
- <input type="checkbox" name="use_tags_as_hashtags" id="use_tags_as_hashtags" value="1" <?php jd_checkCheckbox('use_tags_as_hashtags')?> />
364
- <label for="use_tags_as_hashtags"><strong><?php _e("Add tags as hashtags on Tweets", 'wp-to-twitter'); ?></strong></label>
365
- </p>
366
  <p>
367
  <input type="checkbox" name="jd_twit_pages" id="jd_twit_pages" value="1" <?php jd_checkCheckbox('jd_twit_pages')?> />
368
- <label for="jd_twit_pages"><strong><?php _e("Update Twitter when new Wordpress Pages are published", 'wp-to-twitter'); ?></strong></label>
369
  </p>
370
  <p>
371
  <input type="checkbox" name="jd_twit_edited_pages" id="jd_twit_edited_pages" value="1" <?php jd_checkCheckbox('jd_twit_edited_pages')?> />
372
- <label for="jd_twit_edited_pages"><strong><?php _e("Update Twitter when WordPress Pages are edited", 'wp-to-twitter'); ?></strong></label>
 
 
 
 
 
 
 
 
373
  </p>
374
  <p>
375
  <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
376
- <label for="oldpost-edited-update"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br /><input type="radio" name="jd-use-link-field" id="jd-use-link-title" value="1" <?php jd_checkCheckbox('jd-use-link-title')?> /> <label for="jd-use-link-title"><?php _e("Use <strong>link title</strong> for Twitter updates", 'wp-to-twitter'); ?></label> <input type="radio" name="jd-use-link-field" id="jd-use-link-description" value="2" <?php jd_checkCheckbox('jd-use-link-description')?> /> <label for="jd-use-link-description"><?php _e("Use <strong>link description</strong> for Twitter updates", 'wp-to-twitter'); ?></label><br /><label for="newlink-published-text"><?php _e("Text for new link updates (used if title/description isn't available.):", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'newlink-published-text' ) ) ) ?>" />
 
 
377
  </p>
378
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  <p>
380
  <input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
381
  <label for="jd_tweet_default"><strong><?php _e("Set default Tweet status to 'No.'", 'wp-to-twitter'); ?></strong></label><br />
@@ -389,23 +423,9 @@ echo "</p></div>";
389
  <input type="checkbox" name="jd_twit_quickpress" id="jd_twit_quickpress" value="1" <?php jd_checkCheckbox('jd_twit_quickpress')?> />
390
  <label for="jd_twit_quickpress"><strong><?php _e("Update Twitter when a post is published using QuickPress", 'wp-to-twitter'); ?></strong></label>
391
  </p>
392
-
393
- <p>
394
- <label for="jd_post_excerpt"><?php _e("Length of post excerpt (in characters):", 'wp-to-twitter'); ?></label> <input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php echo ( attribute_escape( get_option( 'jd_post_excerpt' ) ) ) ?>" /> <small><?php _e("By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead.", 'wp-to-twitter'); ?></small>
395
- </p>
396
-
397
- <p>
398
- <label for="jd_twit_prepend"><?php _e("Custom text prepended to Tweets:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_prepend' ) ) ) ?>" />
399
- </p>
400
-
401
- <p>
402
- <label for="jd_twit_append"><?php _e("Custom text appended to Tweets:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_append" id="jd_twit_append" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_append' ) ) ) ?>" />
403
- </p>
404
-
405
- <p>
406
- <label for="jd_twit_custom_url"><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
407
- <small><?php _e("You can use a custom field to send Cli.gs and Twitter an alternate URL from the permalink provided by WordPress. The value is the name of the custom field you're using to add an external URL.", 'wp-to-twitter'); ?></small>
408
- </p>
409
  <p>
410
  <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
411
  <label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter", 'wp-to-twitter'); ?></strong></label><br />
@@ -417,7 +437,9 @@ echo "</p></div>";
417
  <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
418
  <label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></strong></label><br /><small><?php _e('Each author can set their own Twitter username and password in their user profile. Their posts will be sent to their own Twitter accounts.', 'wp-to-twitter'); ?></small>
419
  </p>
420
-
 
 
421
 
422
  <p>
423
  <input type="radio" name="jd_shortener" id="jd_shortener_cligs" value="1" <?php jd_checkCheckbox('jd-use-cligs')?>/> <label for="jd_shortener_cligs"><?php _e("Use <strong>Cli.gs</strong> for my URL shortener.", 'wp-to-twitter'); ?></label> <input type="radio" name="jd_shortener" id="jd_shortener_bitly" value="2" <?php jd_checkCheckbox('jd-use-bitly')?> /> <label for="jd_shortener_bitly"><?php _e("Use <strong>Bit.ly</strong> for my URL shortener.", 'wp-to-twitter'); ?></label> <input type="radio" name="jd_shortener" id="jd_shortener_none" value="3" <?php jd_checkCheckbox('jd-use-none')?> /> <label for="jd_shortener_none"><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></label>
@@ -469,7 +491,6 @@ echo "</p></div>";
469
 
470
 
471
  <h2 class="bitly"><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></h2>
472
-
473
  <form method="post" action="">
474
 
475
  <div>
@@ -485,23 +506,21 @@ echo "</p></div>";
485
  <div>
486
  <input type="hidden" name="submit-type" value="bitlyapi" />
487
  </div>
488
- <p><input type="submit" name="submit" value="Save Bit.ly API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Bit.ly API Key" /></p>
489
  </div>
490
  </form>
491
- </div>
492
 
493
  <form method="post" action="">
494
-
495
-
496
- <div>
497
  <input type="hidden" name="submit-type" value="check-support" />
498
  <p>
499
- <input type="submit" name="submit" value="Check Support Level" class="button-primary" /> <small>Check whether your server supports the functions required for the Twitter and URL shortening API calls to work.</small>
500
  </p>
501
- </div>
502
  </form>
503
 
504
-
505
 
506
  <div class="wrap">
507
  <h3><?php _e("Need help?", 'wp-to-twitter'); ?></h3>
8
  $wp_twitter_error = FALSE;
9
  $wp_cligs_error = FALSE;
10
  $message = "";
11
+
12
  //SETS DEFAULT OPTIONS
13
  if ( get_option( 'twitterInitialised') != '1' ) {
14
  update_option( 'newpost-published-update', '1' );
17
  update_option( 'jd_twit_quickpress', '1' );
18
  update_option( 'jd_shortener', '0' );
19
  update_option( 'use_tags_as_hashtags', '0' );
20
+ update_option('jd_max_tags',5);
21
+ update_option('jd_max_characters',15);
22
 
23
  update_option( 'oldpost-edited-update', '1' );
24
  update_option( 'oldpost-edited-text', 'Post Edited: #title# (#url#)' );
26
 
27
  update_option( 'jd_twit_pages','0' );
28
  update_option( 'jd_twit_edited_pages','0' );
29
+ update_option( 'newpage-published-text','New page: #title# (#url#)' );
30
+ update_option( 'oldpage-edited-text','Page edited: #title# (#url#)' );
31
 
32
  update_option( 'jd_twit_remote', '0' );
33
  update_option( 'jd_post_excerpt', 30 );
47
  update_option( 'wp_url_failure','0' );
48
 
49
  // Blogroll options
 
 
50
  update_option( 'newlink-published-text', 'New link posted: ' );
51
  update_option( 'jd_twit_blogroll', '1');
52
 
55
  // Note that default options are set.
56
  update_option( 'twitterInitialised', '1' );
57
 
58
+
59
+
60
  $message = __("Set your Twitter login information and URL shortener API information to use this plugin!", 'wp-to-twitter');
61
  }
62
  if ( get_option( 'twitterInitialised') == '1' && get_option( 'jd_post_excerpt' ) == "" ) {
92
  // UPDATE OPTIONS
93
  update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
94
  update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
 
95
  update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
96
  update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
97
  update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
 
98
  update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
99
  update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] );
100
+ update_option( 'newpage-published-text', $_POST['newpage-published-text'] );
101
+ update_option( 'oldpage-edited-text', $_POST['oldpage-edited-text'] );
102
  update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
103
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
104
  update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
107
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
108
  update_option( 'jd_shortener', $_POST['jd_shortener'] );
109
  update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
110
+ update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
111
+ update_option('jd_max_tags',$_POST['jd_max_tags']);
112
+ update_option('jd_max_characters',$_POST['jd_max_characters']);
 
 
 
 
 
113
 
114
  switch ($_POST['jd_shortener']) {
115
  case 1:
135
 
136
  if ( get_option( 'jd-use-bitly' ) == 1 && ( get_option( 'bitlylogin' ) == "" || get_option( 'bitlyapi' ) == "" ) ) {
137
  $message .= __( 'You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly.' , 'wp-to-twitter');
138
+ $message .= "<br />";
139
  }
140
 
 
141
  update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
 
142
  update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
143
  update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
 
144
  update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
145
 
146
+ $message .= __( 'WP to Twitter Options Updated' , 'wp-to-twitter');
147
 
148
  }
149
 
178
  update_option( 'bitlyapi','' );
179
  $message = __("Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. ", 'wp-to-twitter');
180
  } else {
181
+ $message = __("Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</a>! An API key is required to use the Bit.ly URL shortening service.", 'wp-to-twitter');
182
  }
183
  if ( $_POST['bitlylogin'] != '' && isset( $_POST['submit'] ) ) {
184
  update_option( 'bitlylogin',$_POST['bitlylogin'] );
215
 
216
  if ( $run_Snoopy_test == TRUE ) {
217
  $cligs_checker->fetchtext( "http://cli.gs/api/v1/cligs/create?url=$testurl&appid=WP-to-Twitter&key=" );
218
+ if ($bitlyapi != "") {
219
+ $bitly_checker->fetch( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
220
+ }
221
  $twit_checker->fetch( "http://twitter.com/help/test.json" );
222
 
223
  if ( trim($cligs_checker->results) == "Please specify a valid URL to shorten.") {
228
  $message .=__("<li>Successfully contacted the Cli.gs API via Snoopy and created a shortened link.</li>", 'wp-to-twitter');
229
  $wp_cligs_error = FALSE;
230
  }
231
+ if ($bitlyapi != "") {
232
+ $decoded = json_decode($bitly_checker->results,TRUE);
233
+ $bitly_decoded = $decoded['statusCode'];
234
 
235
+ if ( $bitly_decoded == "OK" ) {
236
+ $wp_bitly_error = FALSE;
237
+ $message .= __("<li>Successfully contacted the Bit.ly API via Snoopy.</li>", 'wp-to-twitter');
238
+ } else {
239
+ $message .=__("<li>Failed to contact the Bit.ly API via Snoopy.</li>", 'wp-to-twitter');
240
+ }
241
+ } else {
242
+ $message .= __("<li>Cannot check the Bit.ly API without a valid API key.</li>", 'wp-to-twitter');
243
+ }
244
  if ( $twit_checker->results == "\"ok\"" ) {
245
  $wp_twitter_error = FALSE;
246
  $message .= __("<li>Successfully contacted the Twitter API via Snoopy.</li>", 'wp-to-twitter');
298
  ?>
299
  <?php if ( $wp_twitter_error == TRUE || ( $wp_cligs_error == TRUE && $wp_bitly_error == TRUE ) ) {
300
  echo "<div class='error'><p>";
301
+ _e("This plugin may not fully work in your server environment. The plugin failed to contact both a URL shortener API and the Twitter service API.", 'wp-to-twitter');
302
  echo "</p></div>";
303
  }
304
  ?>
309
 
310
  <div class="wrap" id="wp-to-twitter">
311
 
312
+ <?php if (isset($_GET['export']) && $_GET['export'] == "settings") {
313
+ print_settings();
314
+ } ?>
315
+
316
  <h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
317
+
318
+ <div class="resources">
319
+ <ul>
320
+ <li><a href="http://www.joedolson.com/articles/wp-to-twitter/support/"><?php _e("Get Support",'wp-to-twitter'); ?></a></li>
321
+ <li><a href="?page=wp-to-twitter/wp-to-twitter.php&amp;export=settings"><?php _e("Export Settings",'wp-to-twitter'); ?></a></li>
322
+ <li><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
323
+ <div>
324
+ <input type="hidden" name="cmd" value="_s-xclick" />
325
+ <input type="hidden" name="hosted_button_id" value="8490399" />
326
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate" />
327
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
328
+ </div>
329
+ </form></li>
330
+ </ul>
331
+
332
+ </div>
333
+
334
  <p>
335
+ <?php _e("For any post update field, you can use the codes <code>#title#</code> for the title of your blog post, <code>#blog#</code> for the title of your blog, <code>#post#</code> for a short excerpt of the post content or <code>#url#</code> for the post URL (shortened or not, depending on your preferences.) You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code>", 'wp-to-twitter'); ?>
336
  </p>
337
 
338
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) { ?>
359
  </form>
360
  <?php
361
  }
362
+ ?>
 
363
  <form method="post" action="">
 
 
364
  <div>
365
  <fieldset>
366
+ <legend><?php _e("Set what should be in a Tweet", 'wp-to-twitter'); ?></legend>
 
367
  <p>
368
  <input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
369
+ <label for="newpost-published-update"><strong><?php _e("Update when a post is published", 'wp-to-twitter'); ?></strong></label> <label for="newpost-published-text"><br /><?php _e("Text for new post updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option( 'newpost-published-text' ) ) ); ?>" />
 
 
 
370
  </p>
371
+
372
  <p>
373
  <input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
374
+ <label for="oldpost-edited-update"><strong><?php _e("Update when a post is edited", 'wp-to-twitter'); ?></strong></label><br /><label for="oldpost-edited-text"><?php _e("Text for editing updates:", 'wp-to-twitter'); ?></label> <input type="text" name="oldpost-edited-text" id="oldpost-edited-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option('oldpost-edited-text' ) ) ); ?>" />
 
 
 
375
  </p>
 
 
 
 
376
  <p>
377
  <input type="checkbox" name="jd_twit_pages" id="jd_twit_pages" value="1" <?php jd_checkCheckbox('jd_twit_pages')?> />
378
+ <label for="jd_twit_pages"><strong><?php _e("Update Twitter when new Wordpress Pages are published", 'wp-to-twitter'); ?></strong></label><br /><label for="newpage-published-text"><?php _e("Text for new page updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newpage-published-text" id="newpage-published-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option('newpage-published-text' ) ) ); ?>" />
379
  </p>
380
  <p>
381
  <input type="checkbox" name="jd_twit_edited_pages" id="jd_twit_edited_pages" value="1" <?php jd_checkCheckbox('jd_twit_edited_pages')?> />
382
+ <label for="jd_twit_edited_pages"><strong><?php _e("Update Twitter when WordPress Pages are edited", 'wp-to-twitter'); ?></strong></label><br /><label for="oldpage-edited-text"><?php _e("Text for page edit updates:", 'wp-to-twitter'); ?></label> <input type="text" name="oldpage-edited-text" id="oldpage-edited-text" size="60" maxlength="120" value="<?php echo( attribute_escape( get_option('oldpage-edited-text' ) ) ) . $insert_edit_url; ?>" />
383
+ </p>
384
+ <p>
385
+ <input type="checkbox" name="use_tags_as_hashtags" id="use_tags_as_hashtags" value="1" <?php jd_checkCheckbox('use_tags_as_hashtags')?> />
386
+ <label for="use_tags_as_hashtags"><strong><?php _e("Add tags as hashtags on Tweets", 'wp-to-twitter'); ?></strong></label>
387
+ <br />
388
+ <label for="jd_max_tags"><?php _e("Maximum number of tags to include:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_tags" id="jd_max_tags" value="<?php echo attribute_escape( get_option('jd_max_tags') ); ?>" size="3" />
389
+ <label for="jd_max_characters"><?php _e("Maximum length in characters for included tags:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_characters" id="jd_max_characters" value="<?php echo attribute_escape( get_option('jd_max_characters') ); ?>" size="3" /><br />
390
+ <small><?php _e("These options allow you to restrict the length and number of WordPress tags sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow any and all tags.",'wp-to-twitter'); ?></small>
391
  </p>
392
  <p>
393
  <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
394
+ <label for="jd_twit_blogroll"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br />
395
+
396
+ <label for="newlink-published-text"><?php _e("Text for new link updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'newlink-published-text' ) ) ); ?>" /><br /><small><?php _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.','wp-to-twitter'); ?></small>
397
  </p>
398
+ <p>
399
+ <label for="jd_post_excerpt"><strong><?php _e("Length of post excerpt (in characters):", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php echo ( attribute_escape( get_option( 'jd_post_excerpt' ) ) ) ?>" /> <small><?php _e("By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead.", 'wp-to-twitter'); ?></small>
400
+ </p>
401
+
402
+ <p>
403
+ <label for="jd_twit_prepend"><strong><?php _e("Custom text before Tweets:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_prepend' ) ) ) ?>" />
404
+ <label for="jd_twit_append"><strong><?php _e("Custom text after Tweets:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_append" id="jd_twit_append" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_append' ) ) ) ?>" />
405
+ </p>
406
+ <p>
407
+ <label for="jd_twit_custom_url"><strong><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
408
+ <small><?php _e("You can use a custom field to send Cli.gs and Twitter an alternate URL from the permalink provided by WordPress. The value is the name of the custom field you're using to add an external URL.", 'wp-to-twitter'); ?></small>
409
+ </p>
410
+ </fieldset>
411
+ <fieldset>
412
+ <legend><?php _e( "Special Cases when WordPress should send a Tweet",'wp-to-twitter' ); ?></legend>
413
  <p>
414
  <input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
415
  <label for="jd_tweet_default"><strong><?php _e("Set default Tweet status to 'No.'", 'wp-to-twitter'); ?></strong></label><br />
423
  <input type="checkbox" name="jd_twit_quickpress" id="jd_twit_quickpress" value="1" <?php jd_checkCheckbox('jd_twit_quickpress')?> />
424
  <label for="jd_twit_quickpress"><strong><?php _e("Update Twitter when a post is published using QuickPress", 'wp-to-twitter'); ?></strong></label>
425
  </p>
426
+ </fieldset>
427
+ <fieldset>
428
+ <legend><?php _e( "Special Fields",'wp-to-twitter' ); ?></legend>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  <p>
430
  <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
431
  <label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter", 'wp-to-twitter'); ?></strong></label><br />
437
  <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
438
  <label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></strong></label><br /><small><?php _e('Each author can set their own Twitter username and password in their user profile. Their posts will be sent to their own Twitter accounts.', 'wp-to-twitter'); ?></small>
439
  </p>
440
+ </fieldset>
441
+ <fieldset>
442
+ <legend><?php _e("Set your preferred URL Shortener",'wp-to-twitter' ); ?></legend>
443
 
444
  <p>
445
  <input type="radio" name="jd_shortener" id="jd_shortener_cligs" value="1" <?php jd_checkCheckbox('jd-use-cligs')?>/> <label for="jd_shortener_cligs"><?php _e("Use <strong>Cli.gs</strong> for my URL shortener.", 'wp-to-twitter'); ?></label> <input type="radio" name="jd_shortener" id="jd_shortener_bitly" value="2" <?php jd_checkCheckbox('jd-use-bitly')?> /> <label for="jd_shortener_bitly"><?php _e("Use <strong>Bit.ly</strong> for my URL shortener.", 'wp-to-twitter'); ?></label> <input type="radio" name="jd_shortener" id="jd_shortener_none" value="3" <?php jd_checkCheckbox('jd-use-none')?> /> <label for="jd_shortener_none"><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></label>
491
 
492
 
493
  <h2 class="bitly"><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></h2>
 
494
  <form method="post" action="">
495
 
496
  <div>
506
  <div>
507
  <input type="hidden" name="submit-type" value="bitlyapi" />
508
  </div>
509
+ <p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
510
  </div>
511
  </form>
512
+
513
 
514
  <form method="post" action="">
515
+ <fieldset>
 
 
516
  <input type="hidden" name="submit-type" value="check-support" />
517
  <p>
518
+ <input type="submit" name="submit" value="<?php _e('Check Support','wp-to-twitter'); ?>" class="button-primary" /> <small><?php _e('Check whether your server supports WP to Twitter\'s queries to the Twitter and URL shortening APIs.','wp-to-twitter'); ?></small>
519
  </p>
520
+ </fieldset>
521
  </form>
522
 
523
+ </div>
524
 
525
  <div class="wrap">
526
  <h3><?php _e("Need help?", 'wp-to-twitter'); ?></h3>
wp-to-twitter.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP to Twitter
4
  Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
5
  Description: Updates Twitter when you create a new blog post or add to your blogroll using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account with the name of your post as the title.
6
- Version: 1.4.11
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
@@ -23,52 +23,62 @@ Author URI: http://www.joedolson.com/
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
- // Reporting E_NOTICE can be good too (to report uninitialized
27
- // variables or catch variable name misspellings ...)
28
-
29
  global $wp_version,$version,$jd_plugin_url;
30
 
31
  $plugin_dir = basename(dirname(__FILE__));
32
  load_plugin_textdomain( 'wp-to-twitter', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
33
 
34
-
35
  define('JDWP_API_POST_STATUS', 'http://twitter.com/statuses/update.json');
36
 
37
- $version = "1.4.11";
38
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
 
39
 
40
  if ( !defined( 'WP_PLUGIN_DIR' ) ) {
41
  define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
42
  }
43
  require_once( ABSPATH.WPINC.'/class-snoopy.php' );
44
 
45
- if ( !class_exists('SERVICES_JSON') ) {
46
- require_once( WP_PLUGIN_DIR.'/wp-to-twitter/json.class.php' );
47
- }
48
- if (!function_exists('json_encode')) {
49
- function json_encode($data) {
50
- $json = new Services_JSON();
51
- return( $json->encode($data) );
52
- }
53
- }
54
- if (!function_exists('json_decode')) {
55
- function json_decode($data) {
56
- $json = new Services_JSON( SERVICES_JSON_LOOSE_TYPE );
57
- return( $json->decode($data) );
58
- }
59
- }
60
- if (!function_exists('mb_strlen')) {
61
- function mb_strlen($data) {
62
- return strlen($data);
63
- }
64
- }
65
-
66
  $exit_msg='WP to Twitter requires WordPress 2.5 or a more recent version. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update your WordPress version!</a>';
67
 
68
  if ( version_compare( $wp_version,"2.5","<" )) {
69
  exit ($exit_msg);
70
  }
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  // Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
73
  function external_or_permalink( $post_ID ) {
74
  $wtb_extlink_custom_field = get_option('jd_twit_custom_url');
@@ -77,84 +87,7 @@ function external_or_permalink( $post_ID ) {
77
  return ( $ex_link ) ? $ex_link : $perma_link;
78
  }
79
 
80
- if ( !function_exists( 'str_ireplace' ) ) {
81
- function str_ireplace( $needle, $str, $haystack ) {
82
- $needle = preg_quote( $needle, '/' );
83
- return preg_replace( "/$needle/i", $str, $haystack );
84
- }
85
- }
86
-
87
- if ( function_exists( 'mb_substr_replace' ) === false ) {
88
- function mb_substr_replace( $string, $replacement, $start, $length = null, $encoding = null ) {
89
- if ( extension_loaded( 'mbstring' ) === true ) {
90
- $string_length = (is_null($encoding) === true) ? mb_strlen($string) : mb_strlen($string, $encoding);
91
- if ( $start < 0 ) {
92
- $start = max(0, $string_length + $start);
93
- } else if ( $start > $string_length ) {
94
- $start = $string_length;
95
- }
96
- if ( $length < 0 ) {
97
- $length = max( 0, $string_length - $start + $length );
98
- } else if ( ( is_null( $length ) === true ) || ( $length > $string_length ) ) {
99
- $length = $string_length;
100
- }
101
- if ( ( $start + $length ) > $string_length) {
102
- $length = $string_length - $start;
103
- }
104
- if ( is_null( $encoding ) === true) {
105
- return mb_substr( $string, 0, $start ) . $replacement . mb_substr( $string, $start + $length, $string_length - $start - $length );
106
- }
107
- return mb_substr( $string, 0, $start, $encoding ) . $replacement . mb_substr( $string, $start + $length, $string_length - $start - $length, $encoding );
108
- }
109
- return ( is_null( $length ) === true ) ? substr_replace( $string, $replacement, $start ) : substr_replace( $string, $replacement, $start, $length );
110
- }
111
- }
112
-
113
- // This function used to perform the API post to Twitter and now serves as a fallback.
114
- function jd_old_doTwitterAPIPost( $twit, $authID=FALSE, $twitterURI="/statuses/update.xml" ) {
115
- $host = 'twitter.com';
116
- $port = 80;
117
- $fp = @fsockopen($host, $port, $err_num, $err_msg, 10);
118
-
119
- //check if user login details have been entered on admin page
120
- if ($authID === FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
121
- $thisLoginDetails = get_option( 'twitterlogin_encrypted' );
122
- } else {
123
- if ( ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'true' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userTwitter' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) && get_usermeta( $authID, 'wp-to-twitter-encrypted' )!="" ) {
124
- $thisLoginDetails = get_usermeta( $authID, 'wp-to-twitter-encrypted' );
125
- } else {
126
- $thisLoginDetails = get_option( 'twitterlogin_encrypted' );
127
- }
128
- }
129
-
130
- if ( $thisLoginDetails != '' ) {
131
- if ( !is_resource($fp) ) {
132
- #echo "$err_msg ($err_num)<br>\n"; // Fail Silently, but you could turn these back on...
133
- return FALSE;
134
- } else {
135
- if (!fputs( $fp, "POST $twitterURI HTTP/1.1\r\n" )) {
136
- return FALSE;
137
- }
138
- fputs( $fp, "Authorization: Basic ".$thisLoginDetails."\r\n" );
139
- fputs( $fp, "User-Agent: ".$agent."\n" );
140
- fputs( $fp, "Host: $host\n" );
141
- fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
142
- fputs( $fp, "Content-length: ".mb_strlen( $twit )."\n" );
143
- fputs( $fp, "Connection: close\n\n" );
144
- fputs( $fp, $twit );
145
- for ( $i = 1; $i < 10; $i++ ) {
146
- $reply = fgets( $fp, 256 );
147
- }
148
- fclose( $fp );
149
- return TRUE;
150
- }
151
- } else {
152
- // no username/password: return an empty string
153
- return FALSE;
154
- }
155
- }
156
-
157
- // This function performs the API post to Twitter
158
  function jd_doTwitterAPIPost( $twit, $authID=FALSE ) {
159
  global $version, $jd_plugin_url;
160
  //check if user login details have been entered on admin page
@@ -211,39 +144,65 @@ function jd_doTwitterAPIPost( $twit, $authID=FALSE ) {
211
  }
212
  }
213
  }
 
 
 
 
 
214
 
215
- // cURL query contributed by Thor Erik (http://thorerik.net)
216
- function getfilefromurl($url) {
217
- if ( function_exists( 'curl_init' ) ) {
218
- $ch = curl_init();
219
- curl_setopt( $ch, CURLOPT_HEADER, 0 );
220
- curl_setopt( $ch, CURLOPT_VERBOSE, 0 );
221
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
222
- curl_setopt( $ch, CURLOPT_URL, $url );
223
- $output = curl_exec( $ch );
224
- curl_close( $ch );
225
- return $output;
226
  } else {
227
- return FALSE;
 
 
 
 
228
  }
229
- }
230
 
231
- function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID=FALSE ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
  $sentence = trim($sentence);
234
  $thisposttitle = trim($thisposttitle);
235
  $thisblogtitle = trim($thisblogtitle);
236
  $thispostexcerpt = trim($thispostexcerpt);
237
- // Rewrite this function.
238
-
239
- /* Logic: assemble tweet, check length. If under 140, return.
240
- If over 140, check each element in tweet according to the user-selected priority list (least important first.) After each element is checked, re-assemble and check length. If OK, return; if still too long, truncate next element, until tweet is appropriate length. Much simpler process...
241
- */
242
 
243
- if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) {
244
- $at_append = "@" . get_option('twitterlogin');
245
- } else if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'mainAtTwitter' ) {
246
- $at_append = "@" . get_usermeta( $authID, 'wp-to-twitter-user-username' );
 
 
 
 
247
  } else {
248
  $at_append = "";
249
  }
@@ -260,42 +219,67 @@ $at_append = "";
260
  if ( mb_substr( $thispostexcerpt, -1 ) != "." && mb_substr( $thispostexcerpt, -1 ) != "?" && mb_substr( $thispostexcerpt, -1 ) != "!" ) {
261
  $thispostexcerpt = $thispostexcerpt . "...";
262
  }
263
- $twit_length = mb_strlen( $sentence );
264
- $title_length = mb_strlen( $thisposttitle );
265
- $blog_length = mb_strlen( $thisblogtitle );
266
- $excerpt_length = mb_strlen( $thispostexcerpt );
267
- if ( ( ( $twit_length + $title_length ) - 7 ) < 140 ) {
268
- $sentence = str_ireplace( '#title#', $thisposttitle, $sentence );
269
- $twit_length = mb_strlen( $sentence );
270
- $twit_length = mb_strlen( $sentence );
271
- } else {
272
- $thisposttitle = mb_substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . "...";
273
- $sentence = str_ireplace ( '#title#', $thisposttitle, $sentence );
274
- $twit_length = mb_strlen( $sentence );
275
- }
276
- if ( ( ( $twit_length + $blog_length ) - 6 ) < 140 ) {
277
- $sentence = str_ireplace ( '#blog#',$thisblogtitle,$sentence );
278
- $twit_length = mb_strlen( $sentence );
279
  } else {
280
- $thisblogtitle = mb_substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . "...";
281
- $sentence = str_ireplace ( '#blog#',$thisblogtitle,$sentence );
282
  }
283
- if ( ( ( $twit_length + $excerpt_length ) - 6 ) < 140 ) {
284
- $sentence = str_ireplace ( '#post#',$thispostexcerpt,$sentence );
285
- $twit_length = mb_strlen( $sentence );
286
- } else {
287
- $thispostexcerpt = mb_substr( $thispostexcerpt, 0, ( 140-( $twit_length-3 ) ) ) . "...";
288
- $sentence = str_ireplace ( '#post#',$thispostexcerpt,$sentence );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  }
290
- return $sentence;
291
  }
292
 
293
  function jd_shorten_link( $thispostlink, $thisposttitle ) {
294
-
295
  $cligsapi = get_option( 'cligsapi' );
296
  $bitlyapi = get_option( 'bitlyapi' );
297
  $bitlylogin = get_option( 'bitlylogin' );
298
-
299
  $snoopy = new Snoopy;
300
 
301
  if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
@@ -356,7 +340,6 @@ function jd_expand_url( $short_url ) {
356
  return $url;
357
  }
358
 
359
-
360
  function jd_twit( $post_ID ) {
361
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
362
  if ( $jd_tweet_this == "yes" ) {
@@ -378,86 +361,49 @@ function jd_twit( $post_ID ) {
378
  $sentence = '';
379
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
380
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
381
- if ( $_POST['originalaction'] == 'post' ) {
382
  // publish new post
383
  if ( get_option( 'newpost-published-update' ) == '1' ) {
 
 
 
384
  $sentence = stripcslashes( get_option( 'newpost-published-text' ) );
385
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
386
- if ($oldClig != '') {
387
- $shrink = $oldClig;
388
- } else {
389
- $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
390
- }
391
-
392
- //$sentence = $sentence . " " . $shrink;
393
- if ( stripos( $sentence, "#url#" ) === FALSE ) {
394
- $sentence = $sentence . " " . $shrink;
395
- } else {
396
- $sentence = str_ireplace( "#url#", $shrink, $sentence );
397
- }
398
-
399
- if ( $customTweet != "" ) {
400
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
401
- if ( stripos( $customTweet, "#url#" ) === FALSE ) {
402
- $sentence = $customTweet . " " . $shrink;
403
- } else {
404
- $sentence = str_ireplace( "#url#", $shrink, $customTweet );
405
- }
406
- } else {
407
- $sentence = $customTweet;
408
- }
409
- }
410
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
411
- // Stores the posts CLIG in a custom field for later use as needed.
412
- store_url( $post_ID, $shrink );
413
-
414
  } else {
415
- $sentence = str_ireplace( "#url#", "", $sentence );
416
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
 
417
  }
 
 
418
  }
419
- } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish' && ( get_option( 'oldpost-edited-update') == '1' ) ) {
420
  // if this is an old post and editing updates are enabled
421
- $sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
422
- if ( get_option( 'oldpost-edited-showlink') == '1') {
 
 
 
 
423
  if ( $oldClig != '' ) {
424
  $old_post_link = $oldClig;
425
  } else {
426
  $old_post_link = jd_shorten_link( $thispostlink, $thisposttitle );
427
- }
428
- store_url( $post_ID, $old_post_link );
429
-
430
- if ( stripos( $sentence, "#url#" ) === FALSE ) {
431
- $sentence = $sentence . " " . $old_post_link;
432
- } else {
433
- $sentence = str_ireplace( "#url#", $old_post_link, $sentence );
434
- }
435
-
436
- if ( $customTweet != "" ) {
437
- if ( get_option( 'oldpost-edited-showlink') == '1' ) {
438
- if ( stripos( $customTweet, "#url#" ) === FALSE ) {
439
- $sentence = $customTweet . " " . $old_post_link;
440
- } else {
441
- $sentence = str_ireplace( "#url#", $old_post_link, $customTweet );
442
- }
443
- } else {
444
- $sentence = $customTweet;
445
  }
446
  }
447
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
448
- } else {
449
- $sentence = str_ireplace( "#url#", "", $sentence );
450
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
451
- }
452
- }
453
-
454
  if ( $sentence != '' ) {
455
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
456
  $sentence = $sentence . " " . generate_hash_tags( $_POST );
457
  }
458
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
459
  if ( $sendToTwitter === FALSE ) {
460
- add_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
461
  update_option( 'wp_twitter_failure','1' );
462
  }
463
  }
@@ -465,8 +411,7 @@ function jd_twit( $post_ID ) {
465
  return $post_ID;
466
  }
467
 
468
- function jd_twit_page( $post_ID ) {
469
-
470
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
471
  if ( $jd_tweet_this == "yes" ) {
472
  $get_post_info = get_post( $post_ID );
@@ -487,93 +432,52 @@ function jd_twit_page( $post_ID ) {
487
  $sentence = '';
488
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
489
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
490
- //if ( ($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft') ) {
491
- if ( $_POST['originalaction'] == 'post' ) {
492
  // publish new post
493
  if ( get_option( 'jd_twit_pages' ) == '1' ) {
494
- $sentence = stripcslashes( get_option( 'newpost-published-text' ) );
495
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
 
 
 
496
  if ($oldClig != '') {
497
  $shrink = $oldClig;
498
  } else {
499
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
500
- }
501
-
502
- //$sentence = $sentence . " " . $shrink;
503
- if ( stripos( $sentence, "#url#" ) === FALSE ) {
504
- $sentence = $sentence . " " . $shrink;
505
- } else {
506
- $sentence = str_ireplace( "#url#", $shrink, $sentence );
507
- }
508
-
509
- if ( $customTweet != "" ) {
510
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
511
- if ( stripos( $customTweet, "#url#" ) === FALSE ) {
512
- $sentence = $customTweet . " " . $shrink;
513
- } else {
514
- $sentence = str_ireplace( "#url#", $shrink, $customTweet );
515
- }
516
- } else {
517
- $sentence = $customTweet;
518
- }
519
- }
520
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
521
  // Stores the posts CLIG in a custom field for later use as needed.
522
- store_url( $post_ID, $shrink );
523
-
524
- } else {
525
- $sentence = str_ireplace( "#url#", "", $sentence );
526
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
527
  }
 
 
528
  }
529
- } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish' && ( get_option( 'jd_twit_edited_pages') == '1' ) ) {
530
- // if this is an old post and editing updates are enabled
531
- $sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
532
- if ( get_option( 'oldpost-edited-showlink') == '1') {
533
- if ( $oldClig != '' ) {
534
- $old_post_link = $oldClig;
535
- } else {
536
- $old_post_link = jd_shorten_link( $thispostlink, $thisposttitle );
537
- }
538
- store_url( $post_ID, $old_post_link );
539
-
540
- if ( stripos( $sentence, "#url#" ) === FALSE ) {
541
- $sentence = $sentence . " " . $old_post_link;
542
  } else {
543
- $sentence = str_ireplace( "#url#", $old_post_link, $sentence );
544
- }
545
-
546
- if ( $customTweet != "" ) {
547
- if ( get_option( 'oldpost-edited-showlink') == '1' ) {
548
- if ( stripos( $customTweet, "#url#" ) === FALSE ) {
549
- $sentence = $customTweet . " " . $old_post_link;
550
- } else {
551
- $sentence = str_ireplace( "#url#", $old_post_link, $customTweet );
552
- }
553
  } else {
554
- $sentence = $customTweet;
555
  }
556
- }
557
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
558
- } else {
559
- $sentence = str_ireplace( "#url#", "", $sentence );
560
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
561
- }
562
  }
563
-
564
  if ( $sentence != '' ) {
565
- if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
566
- $sentence = $sentence . " " . generate_hash_tags( $_POST );
567
- }
568
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
569
  if ( $sendToTwitter === FALSE ) {
570
- add_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
571
  update_option( 'wp_twitter_failure','1' );
572
  }
573
  }
574
  }
575
  return $post_ID;
576
- } // end twit pages
577
 
578
  // Add Tweets on links in Blogroll
579
  function jd_twit_link( $link_ID ) {
@@ -583,25 +487,23 @@ global $version;
583
  $thislinkname = urlencode( stripcslashes( $_POST['link_name'] ) );
584
  $thispostlink = urlencode( $_POST['link_url'] ) ;
585
  $thislinkdescription = urlencode( stripcslashes( $_POST['link_description'] ) );
586
- $sentence = '';
587
 
588
- # || (get_option( 'jd-use-link-title' ) == '1' && $thislinkname == '')
589
- if ( (get_option( 'jd-use-link-description' ) == '1' && $thislinkdescription == '') ) {
590
- $sentence = stripcslashes( get_option( 'newlink-published-text' ) );
591
- } else {
592
- if ( get_option( 'jd-use-link-description' ) == '1' && get_option ( 'jd-use-link-title' ) == '0' ) {
593
- $sentence = $thislinkdescription;
594
- } else if ( get_option( 'jd-use-link-description' ) == '0' && get_option ( 'jd-use-link-title' ) == '1' ) {
595
- $sentence = $thislinkname;
596
- }
597
  }
598
- if (mb_strlen( $sentence ) > 120) {
 
 
 
 
599
  $sentence = mb_substr($sentence,0,116) . '...';
600
- }
601
- // Generate and grab the clig using the Cli.gs API
602
- // cURL alternative contributed by Thor Erik (http://thorerik.net)
603
- $shrink = jd_shorten_link( $thispostlink, $thislinkname );
604
-
605
  if ( stripos($sentence,"#url#") === FALSE ) {
606
  $sentence = $sentence . " " . $shrink;
607
  } else {
@@ -612,7 +514,7 @@ global $version;
612
  if ($sendToTwitter === FALSE) {
613
  update_option('wp_twitter_failure','2');
614
  }
615
- }
616
  return $link_ID;
617
  } else {
618
  return '';
@@ -626,7 +528,7 @@ function jd_twit_future( $post_ID ) {
626
  $get_post_info = get_post( $post_ID );
627
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE );
628
  $post_status = $get_post_info->post_status;
629
-
630
  if ( $jd_tweet_this == "yes" ) {
631
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
632
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
@@ -637,46 +539,18 @@ function jd_twit_future( $post_ID ) {
637
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
638
  } else {
639
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_excerpt), 0, $excerpt_length );
640
- }
641
  $sentence = '';
642
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
643
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
644
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
645
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
646
- if ( stripos($sentence,"#url#") === FALSE ) {
647
- $sentence = $sentence . " " . $shrink;
648
- } else {
649
- $sentence = str_ireplace("#url#",$shrink,$sentence);
650
- }
651
- if ( $customTweet != "" ) {
652
- // Get the custom Tweet message if it's been supplied. Truncate it to fit if necessary.
653
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
654
- if ( ( mb_strlen( $customTweet ) + 21) > 140 ) {
655
- $customTweet = mb_substr( $customTweet, 0, 119 );
656
- }
657
- } else {
658
- if ( mb_strlen( $customTweet ) > 140 ) {
659
- $customTweet = mb_substr( $customTweet, 0, 140 );
660
- }
661
- }
662
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
663
- if ( stripos( $customTweet, "#url#" ) === FALSE ) {
664
- $sentence = $customTweet . " " . $shrink;
665
- } else {
666
- $sentence = str_ireplace( "#url#", $shrink, $customTweet );
667
- }
668
- } else {
669
- $sentence = $customTweet;
670
- }
671
- }
672
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
673
- // Stores the post's short URL in a custom field for later use as needed.
674
- store_url($post_ID, $shrink);
675
- } else {
676
- $sentence = str_ireplace( "#url#", "", $sentence );
677
-
678
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
679
- }
680
 
681
  if ( $sentence != '' ) {
682
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
@@ -695,46 +569,33 @@ function jd_twit_future( $post_ID ) {
695
  // Tweet from QuickPress (no custom fields, so can't control whether to tweet.)
696
  function jd_twit_quickpress( $post_ID ) {
697
  $post_ID = $post_ID->ID;
698
-
699
  $get_post_info = get_post( $post_ID );
700
  $post_status = $get_post_info->post_status;
701
-
702
- $thispostlink = urlencode( external_or_permalink( $post_ID ) );
703
- $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
704
- $authID = $get_post_info->post_author;
705
- $excerpt_length = get_option( 'jd_post_excerpt' );
706
  if ( trim( $get_post_info->post_excerpt ) == "" ) {
707
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
708
  } else {
709
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_excerpt), 0, $excerpt_length );
710
- }
711
- $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
712
- $sentence = '';
713
- $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
714
- $sentence = stripcslashes(get_option( 'newpost-published-text' ));
715
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
716
- $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
717
- if ( stripos($sentence,"#url#") === FALSE ) {
718
- $sentence = $sentence . " " . $shrink;
719
- } else {
720
- $sentence = str_ireplace("#url#",$shrink,$sentence);
721
- }
722
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
723
- // Stores the posts CLIG in a custom field for later use as needed.
724
- store_url($post_ID, $shrink);
725
- } else {
726
- $sentence = str_ireplace( "#url#", "", $sentence );
727
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
728
- }
729
-
730
  if ( $sentence != '' ) {
731
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
732
  $sentence = $sentence . " " . generate_hash_tags( $_POST );
733
  }
734
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
735
  if ($sendToTwitter === FALSE) {
736
- add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
737
- update_option( 'wp_twitter_failure','1' );
738
  }
739
  }
740
  return $post_ID;
@@ -744,9 +605,8 @@ function jd_twit_quickpress( $post_ID ) {
744
  function jd_twit_xmlrpc( $post_ID ) {
745
  $get_post_info = get_post( $post_ID );
746
  $post_status = $get_post_info->post_status;
747
-
748
  if ( get_option('oldpost-edited-update') != 1 && get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != '' ) {
749
- return;
750
  } else {
751
  if ( get_option('jd_tweet_default') != '1' && get_option('jd_twit_remote') == '1' ) {
752
  $authID = $get_post_info->post_author;
@@ -761,21 +621,12 @@ function jd_twit_xmlrpc( $post_ID ) {
761
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
762
  $sentence = '';
763
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
764
- if ( get_option( 'newpost-published-showlink' ) == '1' ) {
765
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
766
- if ( stripos($sentence,"#url#") === FALSE) {
767
- $sentence = $sentence . " " . $shrink;
768
- } else {
769
- $sentence = str_ireplace("#url#",$shrink,$sentence);
770
- }
771
- // Check the length of the tweet and truncate parts as necessary.
772
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
773
- // Stores the posts CLIG in a custom field for later use as needed.
774
- store_url($post_ID, $shrink);
775
- } else {
776
- $sentence = str_ireplace( "#url#", "", $sentence );
777
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $authID );
778
- }
779
 
780
  if ( $sentence != '' ) {
781
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
@@ -792,37 +643,57 @@ function jd_twit_xmlrpc( $post_ID ) {
792
  return $post_ID;
793
  }
794
  } // END jd_twit_xmlrpc
795
- // NEW IF ADD
 
796
  add_action('admin_menu','jd_add_twitter_outer_box');
797
 
798
  function store_url($post_ID, $url) {
799
  if ( get_option( 'jd_shortener' ) == 0 || get_option( 'jd_shortener' ) == 1) {
800
  if ( get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != $url ) {
801
- add_post_meta ( $post_ID, 'wp_jd_clig', $url );
802
  }
803
  } elseif ( get_option( 'jd_shortener' ) == 2 ) {
804
  if ( get_post_meta ( $post_ID, 'wp_jd_bitly', TRUE ) != $url ) {
805
- add_post_meta ( $post_ID, 'wp_jd_bitly', $url );
806
  }
807
  }
808
  $target = jd_expand_url( $url );
809
- add_post_meta( $post_ID, 'wp_jd_target', $target );
810
  }
811
 
812
  function generate_hash_tags( $post ) {
813
  global $wp_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
814
  if ( version_compare( $wp_version,"2.8",">=" ) ) {
815
  $tags = $post['tax_input']['post_tag'] . "," . $post['newtag']['post_tag'];
816
  } else {
817
  $tags = $post['tags_input'];
818
  }
 
819
  $tags = explode( ",",$tags );
 
 
 
820
  foreach ( $tags as $value ) {
821
  $value = str_ireplace( " ","_",trim( $value ) );
822
  if ( $value != __( "Add_new_tag" , 'wp-to-twitter') && $value != "" ) {
823
  $newtag = "#$value";
824
- if ( mb_strlen( $newtag ) > 2 ) {
 
825
  $hashtags .= "$newtag ";
 
826
  }
827
  }
828
  }
@@ -885,7 +756,7 @@ cntfield.value = field.value.length;
885
  onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo attribute_escape( $jd_twitter ); ?></textarea>
886
  </p>
887
  <p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo attribute_escape( mb_strlen( $description) ); ?>" />
888
- <?php _e(' characters.<br />Twitter posts are a maximum of 140 characters; if your Cli.gs URL is appended to the end of your document, you have 119 characters available. You can use <code>#url#</code>, <code>#title#</code>, <code>#post#</code> or <code>#blog#</code> to insert the shortened URL, post title, a post excerpt or blog name into the Tweet.', 'wp-to-twitter', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo;
889
  </p>
890
  <p>
891
  <input type="checkbox" name="jd_tweet_this" value="no"<?php echo attribute_escape( $jd_selected ); ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label>
@@ -916,16 +787,13 @@ function jd_add_twitter_outer_box() {
916
  function post_jd_twitter( $id ) {
917
  $jd_twitter = $_POST[ 'jd_twitter' ];
918
  if (isset($jd_twitter) && !empty($jd_twitter)) {
919
- delete_post_meta( $id, 'jd_twitter' );
920
- add_post_meta( $id, 'jd_twitter', $jd_twitter );
921
  }
922
  $jd_tweet_this = $_POST[ 'jd_tweet_this' ];
923
  if ($jd_tweet_this == 'no') {
924
- delete_post_meta( $id, 'jd_tweet_this' );
925
- add_post_meta( $id, 'jd_tweet_this', 'no');
926
  } else {
927
- delete_post_meta( $id, 'jd_tweet_this' );
928
- add_post_meta( $id, 'jd_tweet_this', 'yes');
929
  }
930
  }
931
 
@@ -960,6 +828,23 @@ function jd_twitter_profile() {
960
  </table>
961
  <?php
962
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
963
 
964
  function jd_twitter_save_profile(){
965
  global $user_ID;
@@ -995,15 +880,17 @@ border: 1px solid #ddd;
995
  border-radius: 3px;
996
  }
997
  #wp-to-twitter fieldset {
998
- margin: 0;
999
- padding:0;
1000
- border: none;
1001
- }
1002
- #wp-to-twitter form p {
1003
  background: #eaf3fa;
1004
- padding: 10px 5px;
1005
- margin: 4px 0;
1006
- border: 1px solid #eee;
 
 
 
 
 
 
 
1007
  }
1008
  #wp-to-twitter form .error p {
1009
  background: none;
@@ -1020,6 +907,33 @@ margin-top: 1.5em!important;
1020
  padding: 2px!important;
1021
  margin-top: 1.5em!important;
1022
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1023
  -->
1024
  </style>";
1025
  }
@@ -1028,7 +942,7 @@ function jd_wp_Twitter_manage_page() {
1028
  if ( file_exists ( dirname(__FILE__).'/wp-to-twitter-manager.php' )) {
1029
  include( dirname(__FILE__).'/wp-to-twitter-manager.php' );
1030
  } else {
1031
- echo "<p>Couldn't locate the settings page.</p>";
1032
  }
1033
  }
1034
  function plugin_action($links, $file) {
@@ -1048,7 +962,7 @@ if ( get_option( 'jd_individual_twitter_users')=='1') {
1048
  }
1049
 
1050
  if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
1051
- add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>';_e('There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message.'); echo '</p></div>';" ) );
1052
  }
1053
  if ( get_option( 'jd_twit_pages' )=='1' ) {
1054
  add_action( 'publish_page', 'jd_twit_page' );
@@ -1078,4 +992,7 @@ if ( get_option( 'jd_twit_remote' ) == '1' ) {
1078
  }
1079
  add_action( 'save_post','post_jd_twitter' );
1080
  add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
 
 
 
1081
  ?>
3
  Plugin Name: WP to Twitter
4
  Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
5
  Description: Updates Twitter when you create a new blog post or add to your blogroll using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account with the name of your post as the title.
6
+ Version: 1.5.1
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
 
 
 
26
  global $wp_version,$version,$jd_plugin_url;
27
 
28
  $plugin_dir = basename(dirname(__FILE__));
29
  load_plugin_textdomain( 'wp-to-twitter', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
30
 
 
31
  define('JDWP_API_POST_STATUS', 'http://twitter.com/statuses/update.json');
32
 
33
+ $version = "1.5.1";
34
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
35
+ $jd_donate_url = "http://www.joedolson.com/donate.php";
36
 
37
  if ( !defined( 'WP_PLUGIN_DIR' ) ) {
38
  define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
39
  }
40
  require_once( ABSPATH.WPINC.'/class-snoopy.php' );
41
 
42
+ // Check whether a supported version is in use.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  $exit_msg='WP to Twitter requires WordPress 2.5 or a more recent version. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update your WordPress version!</a>';
44
 
45
  if ( version_compare( $wp_version,"2.5","<" )) {
46
  exit ($exit_msg);
47
  }
48
 
49
+ // include service functions
50
+ require_once( WP_PLUGIN_DIR . '/wp-to-twitter/functions.php' );
51
+
52
+ function wptotwitter_activate() {
53
+ if ( get_option( 'jd-use-link-description' ) == 1 || get_option( 'jd-use-link-description' ) == 0 ) {
54
+ delete_option( 'jd-use-link-description' );
55
+ update_option( 'newlink-published-text', "New Link Posted: #description#" );
56
+ }
57
+ if ( get_option( 'jd-use-link-title' ) == 0 || get_option( 'jd-use-link-title' ) == 1 ) {
58
+ delete_option( 'jd-use-link-title' );
59
+ update_option( 'newlink-published-text', "New Link Posted: #title#" );
60
+ }
61
+ if ( get_option( 'newpost-published-showlink' ) == 1 ) {
62
+ delete_option( 'newpost-published-showlink' );
63
+ $update = get_option( 'newpost-published-text' ) . " #url#";
64
+ update_option( 'newpost-published-text', $update );
65
+ }
66
+ if (get_option( 'oldpost-edited-showlink' ) == 1 ) {
67
+ delete_option( 'oldpost-edited-showlink' );
68
+ $update = get_option( 'oldpost-edited-text' ) . " #url#";
69
+ update_option( 'oldpost-edited-text', $update );
70
+ }
71
+ if ( get_option( 'jd_post_excerpt' ) == "" ) {
72
+ update_option( 'jd_post_excerpt', 25 );
73
+ }
74
+ if ( get_option( 'jd_max_tags' ) == "" ) {
75
+ update_option( 'jd_max_tags', 3 );
76
+ }
77
+ if (get_option( 'jd_max_characters' ) == "" ) {
78
+ update_option( 'jd_max_characters', 5 );
79
+ }
80
+ }
81
+
82
  // Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
83
  function external_or_permalink( $post_ID ) {
84
  $wtb_extlink_custom_field = get_option('jd_twit_custom_url');
87
  return ( $ex_link ) ? $ex_link : $perma_link;
88
  }
89
 
90
+ // This function performs the primary API post to Twitter
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  function jd_doTwitterAPIPost( $twit, $authID=FALSE ) {
92
  global $version, $jd_plugin_url;
93
  //check if user login details have been entered on admin page
144
  }
145
  }
146
  }
147
+ // This function used to perform the API post to Twitter and now serves as a fallback.
148
+ function jd_old_doTwitterAPIPost( $twit, $authID=FALSE, $twitterURI="/statuses/update.xml" ) {
149
+ $host = 'twitter.com';
150
+ $port = 80;
151
+ $fp = @fsockopen($host, $port, $err_num, $err_msg, 10);
152
 
153
+ //check if user login details have been entered on admin page
154
+ if ($authID === FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
155
+ $thisLoginDetails = get_option( 'twitterlogin_encrypted' );
 
 
 
 
 
 
 
 
156
  } else {
157
+ if ( ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'true' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userTwitter' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) && get_usermeta( $authID, 'wp-to-twitter-encrypted' )!="" ) {
158
+ $thisLoginDetails = get_usermeta( $authID, 'wp-to-twitter-encrypted' );
159
+ } else {
160
+ $thisLoginDetails = get_option( 'twitterlogin_encrypted' );
161
+ }
162
  }
 
163
 
164
+ if ( $thisLoginDetails != '' ) {
165
+ if ( !is_resource($fp) ) {
166
+ #echo "$err_msg ($err_num)<br>\n"; // Fail Silently, but you could turn these back on...
167
+ return FALSE;
168
+ } else {
169
+ if (!fputs( $fp, "POST $twitterURI HTTP/1.1\r\n" )) {
170
+ return FALSE;
171
+ }
172
+ fputs( $fp, "Authorization: Basic ".$thisLoginDetails."\r\n" );
173
+ fputs( $fp, "User-Agent: ".$agent."\n" );
174
+ fputs( $fp, "Host: $host\n" );
175
+ fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
176
+ fputs( $fp, "Content-length: ".mb_strlen( $twit )."\n" );
177
+ fputs( $fp, "Connection: close\n\n" );
178
+ fputs( $fp, $twit );
179
+ for ( $i = 1; $i < 10; $i++ ) {
180
+ $reply = fgets( $fp, 256 );
181
+ }
182
+ fclose( $fp );
183
+ return TRUE;
184
+ }
185
+ } else {
186
+ return FALSE; // no username/password: return an empty string
187
+ }
188
+ }
189
+
190
+ function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $thisposturl, $authID=FALSE ) {
191
 
192
  $sentence = trim($sentence);
193
  $thisposttitle = trim($thisposttitle);
194
  $thisblogtitle = trim($thisblogtitle);
195
  $thispostexcerpt = trim($thispostexcerpt);
196
+ $thisposturl = trim($thisposturl);
 
 
 
 
197
 
198
+ if ( get_option( 'jd_individual_twitter_users' ) == 1 ) {
199
+ if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) {
200
+ $at_append = "@" . get_option('twitterlogin');
201
+ } else if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'mainAtTwitter' ) {
202
+ $at_append = "@" . get_usermeta( $authID, 'wp-to-twitter-user-username' );
203
+ } else {
204
+ $at_append = "";
205
+ }
206
  } else {
207
  $at_append = "";
208
  }
219
  if ( mb_substr( $thispostexcerpt, -1 ) != "." && mb_substr( $thispostexcerpt, -1 ) != "?" && mb_substr( $thispostexcerpt, -1 ) != "!" ) {
220
  $thispostexcerpt = $thispostexcerpt . "...";
221
  }
222
+ $post_sentence = $sentence;
223
+ if ( stripos( $post_sentence, "#url#") === FALSE ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  } else {
225
+ $post_sentence = str_ireplace( "#url#", $thisposturl, $sentence );
 
226
  }
227
+ $post_sentence = str_ireplace( '#title#', $thisposttitle, $post_sentence );
228
+ $post_sentence = str_ireplace ( '#blog#',$thisblogtitle,$post_sentence );
229
+ $post_sentence = str_ireplace ( '#post#',$thispostexcerpt,$post_sentence );
230
+
231
+ $str_length = mb_strlen( $post_sentence );
232
+
233
+ switch ($str_length) {
234
+ case $str_length <= 140:
235
+ $sentence = $post_sentence;
236
+ break;
237
+ case $str_length > 140:
238
+ $post_sentence = $sentence;
239
+ $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
240
+ $post_sentence = str_ireplace( '#title#', $thisposttitle, $post_sentence );
241
+ $post_sentence = str_ireplace ( '#blog#',$thisblogtitle,$post_sentence );
242
+ $post_sentence = str_ireplace ( '#post#','',$post_sentence );
243
+ if ( mb_strlen ( $post_sentence ) <= 140 ) {
244
+ $sentence = $post_sentence;
245
+ } else {
246
+ $post_sentence = $sentence;
247
+ $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
248
+ $post_sentence = str_ireplace( '#title#', $thisposttitle, $post_sentence );
249
+ $post_sentence = str_ireplace ( '#blog#','',$post_sentence );
250
+ $post_sentence = str_ireplace ( '#post#','',$post_sentence );
251
+ if ( mb_strlen ( $post_sentence ) <= 140 ) {
252
+ $sentence = $post_sentence;
253
+ } else {
254
+ $post_sentence = $sentence;
255
+ $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
256
+ $post_sentence = str_ireplace( '#title#', '', $post_sentence );
257
+ $post_sentence = str_ireplace ( '#blog#','',$post_sentence );
258
+ $post_sentence = str_ireplace ( '#post#','',$post_sentence );
259
+ if ( mb_strlen ( $post_sentence ) <= 140 ) {
260
+ $sentence = $post_sentence;
261
+ } else {
262
+ // If, by some miracle, this is still too long after all that, move the URL to the front and just chop of the end of the status update.
263
+ $post_sentence = $sentence;
264
+ $post_sentence = str_ireplace( '#url#', '', $post_sentence );
265
+ $post_sentence = str_ireplace( '#title#', '', $post_sentence );
266
+ $post_sentence = str_ireplace ( '#blog#','',$post_sentence );
267
+ $post_sentence = str_ireplace ( '#post#','',$post_sentence );
268
+ $post_sentence = $thisposturl . ' ' . $post_sentence;
269
+ $post_sentence = mb_substr( $post_sentence, 0, 137 ) . "...";
270
+ $sentence = $post_sentence;
271
+ }
272
+ }
273
+ }
274
+ break;
275
  }
276
+ return $sentence;
277
  }
278
 
279
  function jd_shorten_link( $thispostlink, $thisposttitle ) {
 
280
  $cligsapi = get_option( 'cligsapi' );
281
  $bitlyapi = get_option( 'bitlyapi' );
282
  $bitlylogin = get_option( 'bitlylogin' );
 
283
  $snoopy = new Snoopy;
284
 
285
  if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
340
  return $url;
341
  }
342
 
 
343
  function jd_twit( $post_ID ) {
344
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
345
  if ( $jd_tweet_this == "yes" ) {
361
  $sentence = '';
362
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
363
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
364
+ if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft')) {
365
  // publish new post
366
  if ( get_option( 'newpost-published-update' ) == '1' ) {
367
+ if ($customTweet != "") {
368
+ $sentence = $customTweet;
369
+ } else {
370
  $sentence = stripcslashes( get_option( 'newpost-published-text' ) );
371
+ }
372
+ if ($oldClig != '') {
373
+ $shrink = $oldClig;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  } else {
375
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
376
+ // Stores the posts CLIG in a custom field for later use as needed.
377
+ store_url( $post_ID, $shrink );
378
  }
379
+ $sentence = custom_shortcodes( $sentence, $post_ID );
380
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
381
  }
382
+ } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish') {
383
  // if this is an old post and editing updates are enabled
384
+ if ( get_option( 'oldpost-edited-update') == '1' ) {
385
+ if ($customTweet != "") {
386
+ $sentence = $customTweet;
387
+ } else {
388
+ $sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
389
+ }
390
  if ( $oldClig != '' ) {
391
  $old_post_link = $oldClig;
392
  } else {
393
  $old_post_link = jd_shorten_link( $thispostlink, $thisposttitle );
394
+ store_url( $post_ID, $old_post_link );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  }
396
  }
397
+ $sentence = custom_shortcodes( $sentence, $post_ID );
398
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $old_post_link, $authID );
399
+ }
 
 
 
 
400
  if ( $sentence != '' ) {
401
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
402
  $sentence = $sentence . " " . generate_hash_tags( $_POST );
403
  }
404
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
405
  if ( $sendToTwitter === FALSE ) {
406
+ update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
407
  update_option( 'wp_twitter_failure','1' );
408
  }
409
  }
411
  return $post_ID;
412
  }
413
 
414
+ function jd_twit_page( $post_ID ) {
 
415
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
416
  if ( $jd_tweet_this == "yes" ) {
417
  $get_post_info = get_post( $post_ID );
432
  $sentence = '';
433
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
434
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
435
+ if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft')) {
 
436
  // publish new post
437
  if ( get_option( 'jd_twit_pages' ) == '1' ) {
438
+ if ($customTweet != "") {
439
+ $sentence = $customTweet;
440
+ } else {
441
+ $sentence = stripcslashes( get_option( 'newpage-published-text' ) );
442
+ }
443
  if ($oldClig != '') {
444
  $shrink = $oldClig;
445
  } else {
446
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  // Stores the posts CLIG in a custom field for later use as needed.
448
+ store_url( $post_ID, $shrink );
 
 
 
 
449
  }
450
+ $sentence = custom_shortcodes( $sentence, $post_ID );
451
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
452
  }
453
+ } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish') {
454
+ // if this is an old page and editing updates are enabled
455
+ if ( get_option( 'jd_twit_edited_pages' ) == '1' ) {
456
+ if ($customTweet != "") {
457
+ $sentence = $customTweet;
 
 
 
 
 
 
 
 
458
  } else {
459
+ $sentence = stripcslashes( get_option( 'oldpage-edited-text' ) );
460
+ }
461
+ if ($oldClig != '') {
462
+ $shrink = $oldClig;
 
 
 
 
 
 
463
  } else {
464
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
465
  }
466
+ store_url( $post_ID, $shrink );
467
+ $sentence = custom_shortcodes( $sentence, $post_ID );
468
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
469
+ }
 
 
470
  }
 
471
  if ( $sentence != '' ) {
 
 
 
472
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
473
  if ( $sendToTwitter === FALSE ) {
474
+ update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
475
  update_option( 'wp_twitter_failure','1' );
476
  }
477
  }
478
  }
479
  return $post_ID;
480
+ } // page tweet end
481
 
482
  // Add Tweets on links in Blogroll
483
  function jd_twit_link( $link_ID ) {
487
  $thislinkname = urlencode( stripcslashes( $_POST['link_name'] ) );
488
  $thispostlink = urlencode( $_POST['link_url'] ) ;
489
  $thislinkdescription = urlencode( stripcslashes( $_POST['link_description'] ) );
490
+ $sentence = stripcslashes( get_option( 'newlink-published-text' ) );
491
 
492
+ if ( get_option( 'jd-use-link-description' ) == '1' || get_option ( 'jd-use-link-title' ) == '1' ) {
493
+ if ( get_option( 'jd-use-link-description' ) == '1' && get_option ( 'jd-use-link-title' ) == '0' ) {
494
+ $sentence = $sentence . ' ' . $thislinkdescription;
495
+ } else if ( get_option( 'jd-use-link-description' ) == '0' && get_option ( 'jd-use-link-title' ) == '1' ) {
496
+ $sentence = $sentence . ' ' . $thislinkname;
 
 
 
 
497
  }
498
+ } else {
499
+ $sentence = str_ireplace("#title#",$thislinkname,$sentence);
500
+ $sentence = str_ireplace("#description#",$thislinkdescription,$sentence);
501
+ }
502
+ if (mb_strlen( $sentence ) > 120) {
503
  $sentence = mb_substr($sentence,0,116) . '...';
504
+ }
505
+ // Generate and grab the clig using the Cli.gs API
506
+ $shrink = jd_shorten_link( $thispostlink, $thislinkname );
 
 
507
  if ( stripos($sentence,"#url#") === FALSE ) {
508
  $sentence = $sentence . " " . $shrink;
509
  } else {
514
  if ($sendToTwitter === FALSE) {
515
  update_option('wp_twitter_failure','2');
516
  }
517
+ }
518
  return $link_ID;
519
  } else {
520
  return '';
528
  $get_post_info = get_post( $post_ID );
529
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE );
530
  $post_status = $get_post_info->post_status;
531
+
532
  if ( $jd_tweet_this == "yes" ) {
533
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
534
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
539
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
540
  } else {
541
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_excerpt), 0, $excerpt_length );
542
+ }
543
  $sentence = '';
544
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
545
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
 
546
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
547
+ // Stores the post's short URL in a custom field for later use as needed.
548
+ store_url($post_ID, $shrink);
549
+ if ( $customTweet != "" ) {
550
+ $sentence = $customTweet;
551
+ }
552
+ $sentence = custom_shortcodes( $sentence, $post_ID );
553
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
 
555
  if ( $sentence != '' ) {
556
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
569
  // Tweet from QuickPress (no custom fields, so can't control whether to tweet.)
570
  function jd_twit_quickpress( $post_ID ) {
571
  $post_ID = $post_ID->ID;
 
572
  $get_post_info = get_post( $post_ID );
573
  $post_status = $get_post_info->post_status;
574
+ $thispostlink = urlencode( external_or_permalink( $post_ID ) );
575
+ $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
576
+ $authID = $get_post_info->post_author;
577
+ $excerpt_length = get_option( 'jd_post_excerpt' );
 
578
  if ( trim( $get_post_info->post_excerpt ) == "" ) {
579
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
580
  } else {
581
  $thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_excerpt), 0, $excerpt_length );
582
+ }
583
+ $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
584
+ $sentence = '';
585
+ $sentence = stripcslashes(get_option( 'newpost-published-text' ));
586
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
587
+ // Stores the posts CLIG in a custom field for later use as needed.
588
+ store_url($post_ID, $shrink);
589
+ $sentence = custom_shortcodes( $sentence, $post_ID );
590
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
 
 
 
 
 
 
 
 
 
 
 
591
  if ( $sentence != '' ) {
592
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
593
  $sentence = $sentence . " " . generate_hash_tags( $_POST );
594
  }
595
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
596
  if ($sendToTwitter === FALSE) {
597
+ add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
598
+ update_option( 'wp_twitter_failure','1' );
599
  }
600
  }
601
  return $post_ID;
605
  function jd_twit_xmlrpc( $post_ID ) {
606
  $get_post_info = get_post( $post_ID );
607
  $post_status = $get_post_info->post_status;
 
608
  if ( get_option('oldpost-edited-update') != 1 && get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != '' ) {
609
+ return;
610
  } else {
611
  if ( get_option('jd_tweet_default') != '1' && get_option('jd_twit_remote') == '1' ) {
612
  $authID = $get_post_info->post_author;
621
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
622
  $sentence = '';
623
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
 
624
  $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
625
+ // Stores the posts CLIG in a custom field for later use as needed.
626
+ store_url($post_ID, $shrink);
627
+ // Check the length of the tweet and truncate parts as necessary.
628
+ $sentence = custom_shortcodes( $sentence, $post_ID );
629
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $shrink, $authID );
 
 
 
 
 
 
 
 
630
 
631
  if ( $sentence != '' ) {
632
  if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
643
  return $post_ID;
644
  }
645
  } // END jd_twit_xmlrpc
646
+
647
+
648
  add_action('admin_menu','jd_add_twitter_outer_box');
649
 
650
  function store_url($post_ID, $url) {
651
  if ( get_option( 'jd_shortener' ) == 0 || get_option( 'jd_shortener' ) == 1) {
652
  if ( get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != $url ) {
653
+ update_post_meta ( $post_ID, 'wp_jd_clig', $url );
654
  }
655
  } elseif ( get_option( 'jd_shortener' ) == 2 ) {
656
  if ( get_post_meta ( $post_ID, 'wp_jd_bitly', TRUE ) != $url ) {
657
+ update_post_meta ( $post_ID, 'wp_jd_bitly', $url );
658
  }
659
  }
660
  $target = jd_expand_url( $url );
661
+ update_post_meta( $post_ID, 'wp_jd_target', $target );
662
  }
663
 
664
  function generate_hash_tags( $post ) {
665
  global $wp_version;
666
+
667
+ $max_tags = get_option( 'jd_max_tags' );
668
+ $max_characters = get_option( 'jd_max_characters' );
669
+
670
+ if ($max_characters == 0 || $max_characters == "") {
671
+ $max_characters = 100;
672
+ } else {
673
+ $max_characters = $max_characters + 1;
674
+ }
675
+ if ($max_tags == 0 || $max_tags == "") {
676
+ $max_tags = 100;
677
+ }
678
+ //tax_input[post_tag]=failed&newtag[post_tag]=Add+new+tag
679
  if ( version_compare( $wp_version,"2.8",">=" ) ) {
680
  $tags = $post['tax_input']['post_tag'] . "," . $post['newtag']['post_tag'];
681
  } else {
682
  $tags = $post['tags_input'];
683
  }
684
+ //print_r($tags);
685
  $tags = explode( ",",$tags );
686
+ $tags = array_unique($tags);
687
+
688
+ $i = 1;
689
  foreach ( $tags as $value ) {
690
  $value = str_ireplace( " ","_",trim( $value ) );
691
  if ( $value != __( "Add_new_tag" , 'wp-to-twitter') && $value != "" ) {
692
  $newtag = "#$value";
693
+ if ( mb_strlen( $newtag ) > 2 && (mb_strlen( $newtag ) <= $max_characters) && ($i <= $max_tags) ) {
694
+ //if ( mb_strlen( $newtag ) > 2 ) {
695
  $hashtags .= "$newtag ";
696
+ $i++;
697
  }
698
  }
699
  }
756
  onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo attribute_escape( $jd_twitter ); ?></textarea>
757
  </p>
758
  <p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo attribute_escape( mb_strlen( $description) ); ?>" />
759
+ <?php _e(' characters.<br />Twitter posts are a maximum of 140 characters; if your Cli.gs URL is appended to the end of your document, you have 119 characters available. You can use <code>#url#</code>, <code>#title#</code>, <code>#post#</code> or <code>#blog#</code> to insert the shortened URL, post title, a post excerpt or blog name into the Tweet.', 'wp-to-twitter', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Make a Donation', 'wp-to-twitter', 'wp-to-twitter') ?></a> &bull; <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo;
760
  </p>
761
  <p>
762
  <input type="checkbox" name="jd_tweet_this" value="no"<?php echo attribute_escape( $jd_selected ); ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label>
787
  function post_jd_twitter( $id ) {
788
  $jd_twitter = $_POST[ 'jd_twitter' ];
789
  if (isset($jd_twitter) && !empty($jd_twitter)) {
790
+ update_post_meta( $id, 'jd_twitter', $jd_twitter );
 
791
  }
792
  $jd_tweet_this = $_POST[ 'jd_tweet_this' ];
793
  if ($jd_tweet_this == 'no') {
794
+ update_post_meta( $id, 'jd_tweet_this', 'no');
 
795
  } else {
796
+ update_post_meta( $id, 'jd_tweet_this', 'yes');
 
797
  }
798
  }
799
 
828
  </table>
829
  <?php
830
  }
831
+
832
+ function custom_shortcodes( $sentence, $post_ID ) {
833
+ $pattern = '/\[\[.*\]\]/';
834
+ $params = array(0=>"[[",1=>"]]");
835
+ preg_match($pattern,$sentence, $matches);
836
+ if ($matches) {
837
+ foreach ($matches as $value) {
838
+ $shortcode = "$value";
839
+ $field = str_replace($params, "", $shortcode);
840
+ $custom = get_post_meta( $post_ID, $field, TRUE );
841
+ $sentence = str_replace( $shortcode, $custom, $sentence );
842
+ }
843
+ return $sentence;
844
+ } else {
845
+ return $sentence;
846
+ }
847
+ }
848
 
849
  function jd_twitter_save_profile(){
850
  global $user_ID;
880
  border-radius: 3px;
881
  }
882
  #wp-to-twitter fieldset {
 
 
 
 
 
883
  background: #eaf3fa;
884
+ padding: 10px;
885
+ border: 1px solid #ccc;
886
+ -moz-border-radius: 5px;
887
+ -webkit-border-radius: 5px;
888
+ border-radius: 5px;
889
+ margin: 5px 0;
890
+ }
891
+ #wp-to-twitter form {
892
+ clear: right;
893
+ max-width: 800px;
894
  }
895
  #wp-to-twitter form .error p {
896
  background: none;
907
  padding: 2px!important;
908
  margin-top: 1.5em!important;
909
  }
910
+ legend {
911
+ font-weight: 700;
912
+ font-size: 1.4em;
913
+ padding: 0 6px;
914
+ border-left: 2px solid #ccc;
915
+ border-right: 2px solid #ccc;
916
+ }
917
+ .resources {
918
+ float: right;
919
+ border: 1px solid #aaa;
920
+ padding: 10px 10px 0;
921
+ margin-left: 10px;
922
+ -moz-border-radius: 5px;
923
+ -webkit-border-radius: 5px;
924
+ border-radius: 5px;
925
+ background: #fff;
926
+ text-align: center;
927
+ }
928
+ #wp-to-twitter .resources form {
929
+ margin: 0;
930
+ }
931
+ .settings {
932
+ margin: 25px 0;
933
+ background: #fff;
934
+ padding: 10px;
935
+ border: 1px solid #000;
936
+ }
937
  -->
938
  </style>";
939
  }
942
  if ( file_exists ( dirname(__FILE__).'/wp-to-twitter-manager.php' )) {
943
  include( dirname(__FILE__).'/wp-to-twitter-manager.php' );
944
  } else {
945
+ _e( '<p>Couldn\'t locate the settings page.</p>', 'wp-to-twitter' );
946
  }
947
  }
948
  function plugin_action($links, $file) {
962
  }
963
 
964
  if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
965
+ add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>';_e('There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message.','wp-to-twitter'); echo '</p></div>';" ) );
966
  }
967
  if ( get_option( 'jd_twit_pages' )=='1' ) {
968
  add_action( 'publish_page', 'jd_twit_page' );
992
  }
993
  add_action( 'save_post','post_jd_twitter' );
994
  add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
995
+
996
+ register_activation_hook( __FILE__, 'wptotwitter_activate' );
997
+
998
  ?>
wp-to-twitter.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
11
- "POT-Creation-Date: 2009-09-16 18:42+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,21 +16,36 @@ msgstr ""
16
  "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
- #: wp-to-twitter-manager.php:55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid ""
21
  "Set your Twitter login information and URL shortener API information to use "
22
  "this plugin!"
23
  msgstr ""
24
 
25
- #: wp-to-twitter-manager.php:61
26
  msgid "Please add your Twitter password. "
27
  msgstr ""
28
 
29
- #: wp-to-twitter-manager.php:67
30
  msgid "WP to Twitter Errors Cleared"
31
  msgstr ""
32
 
33
- #: wp-to-twitter-manager.php:73
34
  msgid ""
35
  "URL shortener request failed! We couldn't shrink that URL, so we attached "
36
  "the normal URL to your Tweet. Check with your URL shortening provider to see "
@@ -38,14 +53,14 @@ msgid ""
38
  "a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]"
39
  msgstr ""
40
 
41
- #: wp-to-twitter-manager.php:77
42
  msgid ""
43
  "Sorry! I couldn't get in touch with the Twitter servers to post your new "
44
  "blog post. Your tweet has been stored in a custom field attached to the "
45
  "post, so you can Tweet it manually if you wish! "
46
  msgstr ""
47
 
48
- #: wp-to-twitter-manager.php:79
49
  msgid ""
50
  "Sorry! I couldn't get in touch with the Twitter servers to post your "
51
  "<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
@@ -57,60 +72,60 @@ msgid ""
57
  "ly."
58
  msgstr ""
59
 
60
- #: wp-to-twitter-manager.php:148
61
  msgid "WP to Twitter Options Updated"
62
  msgstr ""
63
 
64
- #: wp-to-twitter-manager.php:158
65
  msgid "Twitter login and password updated. "
66
  msgstr ""
67
 
68
- #: wp-to-twitter-manager.php:160
69
  msgid "You need to provide your twitter login and password! "
70
  msgstr ""
71
 
72
- #: wp-to-twitter-manager.php:167
73
  msgid "Cligs API Key Updated"
74
  msgstr ""
75
 
76
- #: wp-to-twitter-manager.php:170
77
  msgid ""
78
  "Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be "
79
  "associated with your account. "
80
  msgstr ""
81
 
82
- #: wp-to-twitter-manager.php:172
83
  msgid ""
84
  "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</"
85
  "a>! "
86
  msgstr ""
87
 
88
- #: wp-to-twitter-manager.php:178
89
  msgid "Bit.ly API Key Updated."
90
  msgstr ""
91
 
92
- #: wp-to-twitter-manager.php:181
93
  msgid ""
94
  "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
95
  msgstr ""
96
 
97
- #: wp-to-twitter-manager.php:183
98
  msgid ""
99
  "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</"
100
- "a>! "
101
  msgstr ""
102
 
103
- #: wp-to-twitter-manager.php:187
104
  msgid " Bit.ly User Login Updated."
105
  msgstr ""
106
 
107
- #: wp-to-twitter-manager.php:190
108
  msgid ""
109
  "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing "
110
  "your username. "
111
  msgstr ""
112
 
113
- #: wp-to-twitter-manager.php:192
114
  msgid ""
115
  "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
116
  msgstr ""
@@ -133,317 +148,388 @@ msgid ""
133
  "link.</li>"
134
  msgstr ""
135
 
136
- #: wp-to-twitter-manager.php:237 wp-to-twitter-manager.php:259
137
  msgid "<li>Successfully contacted the Bit.ly API via Snoopy.</li>"
138
  msgstr ""
139
 
140
- #: wp-to-twitter-manager.php:239 wp-to-twitter-manager.php:261
141
  msgid "<li>Failed to contact the Bit.ly API via Snoopy.</li>"
142
  msgstr ""
143
 
144
- #: wp-to-twitter-manager.php:243
 
 
 
 
145
  msgid "<li>Successfully contacted the Twitter API via Snoopy.</li>"
146
  msgstr ""
147
 
148
- #: wp-to-twitter-manager.php:245
149
  msgid "<li>Failed to contact the Twitter API via Snoopy.</li>"
150
  msgstr ""
151
 
152
- #: wp-to-twitter-manager.php:251
153
  msgid "<li>Successfully contacted the Twitter API via cURL.</li>"
154
  msgstr ""
155
 
156
- #: wp-to-twitter-manager.php:253
157
  msgid "<li>Failed to contact the Twitter API via cURL.</li>"
158
  msgstr ""
159
 
160
- #: wp-to-twitter-manager.php:265
161
  msgid "<li>Successfully contacted the Cli.gs API via Snoopy.</li>"
162
  msgstr ""
163
 
164
- #: wp-to-twitter-manager.php:268
165
  msgid "<li>Failed to contact the Cli.gs API via Snoopy.</li>"
166
  msgstr ""
167
 
168
- #: wp-to-twitter-manager.php:273
169
  msgid ""
170
  "<li><strong>Your server should run WP to Twitter successfully.</strong></li>"
171
  msgstr ""
172
 
173
- #: wp-to-twitter-manager.php:278
174
  msgid "<li>Your server does not support <code>fputs</code>.</li>"
175
  msgstr ""
176
 
177
- #: wp-to-twitter-manager.php:282
178
  msgid ""
179
  "<li>Your server does not support <code>file_get_contents</code> or "
180
  "<code>cURL</code> functions.</li>"
181
  msgstr ""
182
 
183
- #: wp-to-twitter-manager.php:286
184
  msgid "<li>Your server does not support <code>Snoopy</code>.</li>"
185
  msgstr ""
186
 
187
- #: wp-to-twitter-manager.php:289
188
  msgid ""
189
  "<li><strong>Your server does not appear to support the required PHP "
190
  "functions and classes for WP to Twitter to function.</strong> You can try it "
191
  "anyway - these tests aren't perfect - but no guarantees.</li>"
192
  msgstr ""
193
 
194
- #: wp-to-twitter-manager.php:298
195
- msgid "This plugin may not work in your server environment."
 
 
196
  msgstr ""
197
 
198
- #: wp-to-twitter-manager.php:309
199
  msgid "WP to Twitter Options"
200
  msgstr ""
201
 
202
- #: wp-to-twitter-manager.php:311
 
 
 
 
 
 
 
 
203
  msgid ""
204
- "For any update field, you can use the codes <code>#title#</code> for the "
205
- "title of your blog post, <code>#blog#</code> for the title of your blog, "
206
  "<code>#post#</code> for a short excerpt of the post content or <code>#url#</"
207
- "code> for the post URL (shortened or not, depending on your preferences.)"
 
 
 
 
208
  msgstr ""
209
 
210
- #: wp-to-twitter-manager.php:318
211
  msgid ""
212
  "One or more of your last posts has failed to send it's status update to "
213
  "Twitter. Your Tweet has been saved in the custom meta data for your post, "
214
  "and you can re-Tweet it at your leisure."
215
  msgstr ""
216
 
217
- #: wp-to-twitter-manager.php:321
218
  msgid ""
219
  "The query to the URL shortener API failed, and your URL was not shrunk. The "
220
  "full post URL was attached to your Tweet."
221
  msgstr ""
222
 
223
- #: wp-to-twitter-manager.php:333
224
  msgid "Clear 'WP to Twitter' Error Messages"
225
  msgstr ""
226
 
227
- #: wp-to-twitter-manager.php:345
228
- msgid "Wordpress to Twitter Publishing Options"
229
  msgstr ""
230
 
231
- #: wp-to-twitter-manager.php:349
232
  msgid "Update when a post is published"
233
  msgstr ""
234
 
235
- #: wp-to-twitter-manager.php:349
236
  msgid "Text for new post updates:"
237
  msgstr ""
238
 
239
- #: wp-to-twitter-manager.php:352 wp-to-twitter-manager.php:360
240
- msgid "Provide link to blog?"
241
- msgstr ""
242
-
243
- #: wp-to-twitter-manager.php:357
244
  msgid "Update when a post is edited"
245
  msgstr ""
246
 
247
- #: wp-to-twitter-manager.php:357
248
  msgid "Text for editing updates:"
249
  msgstr ""
250
 
251
- #: wp-to-twitter-manager.php:364
252
- msgid "Add tags as hashtags on Tweets"
253
  msgstr ""
254
 
255
- #: wp-to-twitter-manager.php:368
256
- msgid "Update Twitter when new Wordpress Pages are published"
257
  msgstr ""
258
 
259
- #: wp-to-twitter-manager.php:372
260
  msgid "Update Twitter when WordPress Pages are edited"
261
  msgstr ""
262
 
263
- #: wp-to-twitter-manager.php:376
264
- msgid "Update Twitter when you post a Blogroll link"
265
  msgstr ""
266
 
267
- #: wp-to-twitter-manager.php:376
268
- msgid "Use <strong>link title</strong> for Twitter updates"
269
  msgstr ""
270
 
271
- #: wp-to-twitter-manager.php:376
272
- msgid "Use <strong>link description</strong> for Twitter updates"
273
  msgstr ""
274
 
275
- #: wp-to-twitter-manager.php:376
276
- msgid "Text for new link updates (used if title/description isn't available.):"
277
  msgstr ""
278
 
279
- #: wp-to-twitter-manager.php:381
280
- msgid "Set default Tweet status to 'No.'"
 
 
 
281
  msgstr ""
282
 
283
- #: wp-to-twitter-manager.php:382
284
- msgid ""
285
- "Twitter updates can be set on a post by post basis. By default, posts WILL "
286
- "be posted to Twitter. Check this to change the default to NO."
287
  msgstr ""
288
 
289
- #: wp-to-twitter-manager.php:386
290
- msgid ""
291
- "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
292
  msgstr ""
293
 
294
- #: wp-to-twitter-manager.php:390
295
- msgid "Update Twitter when a post is published using QuickPress"
 
 
296
  msgstr ""
297
 
298
- #: wp-to-twitter-manager.php:394
299
  msgid "Length of post excerpt (in characters):"
300
  msgstr ""
301
 
302
- #: wp-to-twitter-manager.php:394
303
  msgid ""
304
  "By default, extracted from the post itself. If you use the 'Excerpt' field, "
305
  "that will be used instead."
306
  msgstr ""
307
 
308
- #: wp-to-twitter-manager.php:398
309
- msgid "Custom text prepended to Tweets:"
310
  msgstr ""
311
 
312
- #: wp-to-twitter-manager.php:402
313
- msgid "Custom text appended to Tweets:"
314
  msgstr ""
315
 
316
- #: wp-to-twitter-manager.php:406
317
  msgid "Custom field for an alternate URL to be shortened and Tweeted:"
318
  msgstr ""
319
 
320
- #: wp-to-twitter-manager.php:407
321
  msgid ""
322
  "You can use a custom field to send Cli.gs and Twitter an alternate URL from "
323
  "the permalink provided by WordPress. The value is the name of the custom "
324
  "field you're using to add an external URL."
325
  msgstr ""
326
 
327
- #: wp-to-twitter-manager.php:411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
  msgid "Use Google Analytics with WP-to-Twitter"
329
  msgstr ""
330
 
331
- #: wp-to-twitter-manager.php:412
332
  msgid "Campaign identifier for Google Analytics:"
333
  msgstr ""
334
 
335
- #: wp-to-twitter-manager.php:413
336
  msgid ""
337
  "You can track the response from Twitter using Google Analytics by defining a "
338
  "campaign identifier here."
339
  msgstr ""
340
 
341
- #: wp-to-twitter-manager.php:418
342
  msgid "Authors have individual Twitter accounts"
343
  msgstr ""
344
 
345
- #: wp-to-twitter-manager.php:418
346
  msgid ""
347
  "Each author can set their own Twitter username and password in their user "
348
  "profile. Their posts will be sent to their own Twitter accounts."
349
  msgstr ""
350
 
351
- #: wp-to-twitter-manager.php:423
 
 
 
 
352
  msgid "Use <strong>Cli.gs</strong> for my URL shortener."
353
  msgstr ""
354
 
355
- #: wp-to-twitter-manager.php:423
356
  msgid "Use <strong>Bit.ly</strong> for my URL shortener."
357
  msgstr ""
358
 
359
- #: wp-to-twitter-manager.php:423
360
  msgid "Don't shorten URLs."
361
  msgstr ""
362
 
363
- #: wp-to-twitter-manager.php:428
364
  msgid "Save WP->Twitter Options"
365
  msgstr ""
366
 
367
- #: wp-to-twitter-manager.php:434
368
  msgid "Your Twitter account details"
369
  msgstr ""
370
 
371
- #: wp-to-twitter-manager.php:441
372
  msgid "Your Twitter username:"
373
  msgstr ""
374
 
375
- #: wp-to-twitter-manager.php:445
376
  msgid "Your Twitter password:"
377
  msgstr ""
378
 
379
- #: wp-to-twitter-manager.php:445
380
  msgid "(<em>Saved</em>)"
381
  msgstr ""
382
 
383
- #: wp-to-twitter-manager.php:449
384
  msgid "Save Twitter Login Info"
385
  msgstr ""
386
 
387
- #: wp-to-twitter-manager.php:449
388
  msgid ""
389
  "&raquo; <small>Don't have a Twitter account? <a href='http://www.twitter."
390
  "com'>Get one for free here</a>"
391
  msgstr ""
392
 
393
- #: wp-to-twitter-manager.php:453
394
  msgid "Your Cli.gs account details"
395
  msgstr ""
396
 
397
- #: wp-to-twitter-manager.php:460
398
  msgid ""
399
  "Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
400
  msgstr ""
401
 
402
- #: wp-to-twitter-manager.php:466
403
  msgid ""
404
  "Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/"
405
  "api/'>Get one free here</a>!<br />You'll need an API key in order to "
406
  "associate the Cligs you create with your Cligs account."
407
  msgstr ""
408
 
409
- #: wp-to-twitter-manager.php:471
410
  msgid "Your Bit.ly account details"
411
  msgstr ""
412
 
413
- #: wp-to-twitter-manager.php:477
414
  msgid "Your Bit.ly username:"
415
  msgstr ""
416
 
417
- #: wp-to-twitter-manager.php:481
418
  msgid ""
419
  "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
420
  msgstr ""
421
 
422
- #: wp-to-twitter-manager.php:507
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  msgid "Need help?"
424
  msgstr ""
425
 
426
- #: wp-to-twitter-manager.php:508
427
  msgid ""
428
  "Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to "
429
  "Twitter plugin page</a>."
430
  msgstr ""
431
 
432
- #: wp-to-twitter.php:822
433
  msgid "Add_new_tag"
434
  msgstr ""
435
 
436
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
437
  #. Plugin Name of an extension
438
- #: wp-to-twitter.php:842
439
  msgid "WP to Twitter"
440
  msgstr ""
441
 
442
- #: wp-to-twitter.php:883
443
  msgid "Twitter Post"
444
  msgstr ""
445
 
446
- #: wp-to-twitter.php:888
447
  msgid ""
448
  " characters.<br />Twitter posts are a maximum of 140 characters; if your Cli."
449
  "gs URL is appended to the end of your document, you have 119 characters "
@@ -452,57 +538,61 @@ msgid ""
452
  "title, a post excerpt or blog name into the Tweet."
453
  msgstr ""
454
 
455
- #: wp-to-twitter.php:888
456
- msgid "Get Support"
457
  msgstr ""
458
 
459
- #: wp-to-twitter.php:891
460
  msgid "Don't Tweet this post."
461
  msgstr ""
462
 
463
- #: wp-to-twitter.php:943
464
  msgid "WP to Twitter User Settings"
465
  msgstr ""
466
 
467
- #: wp-to-twitter.php:947
468
  msgid "Use My Twitter Account"
469
  msgstr ""
470
 
471
- #: wp-to-twitter.php:948
472
  msgid ""
473
  "Select this option if you would like your posts to be Tweeted into your own "
474
  "Twitter account with no @ references."
475
  msgstr ""
476
 
477
- #: wp-to-twitter.php:949
478
  msgid ""
479
  "Tweet my posts into my Twitter account with an @ reference to the site's "
480
  "main Twitter account."
481
  msgstr ""
482
 
483
- #: wp-to-twitter.php:950
484
  msgid ""
485
  "Tweet my posts into the main site Twitter account with an @ reference to my "
486
  "username. (Password not required with this option.)"
487
  msgstr ""
488
 
489
- #: wp-to-twitter.php:953
490
  msgid "Your Twitter Username"
491
  msgstr ""
492
 
493
- #: wp-to-twitter.php:954
494
  msgid "Enter your own Twitter username."
495
  msgstr ""
496
 
497
- #: wp-to-twitter.php:957
498
  msgid "Your Twitter Password"
499
  msgstr ""
500
 
501
- #: wp-to-twitter.php:958
502
  msgid "Enter your own Twitter password."
503
  msgstr ""
504
 
505
- #: wp-to-twitter.php:1036
 
 
 
 
506
  msgid "Settings"
507
  msgstr ""
508
 
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
11
+ "POT-Creation-Date: 2009-09-26 22:40+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
  "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
+ #: functions.php:117
20
+ msgid "Twitter Password Saved"
21
+ msgstr ""
22
+
23
+ #: functions.php:119
24
+ msgid "Twitter Password Not Saved"
25
+ msgstr ""
26
+
27
+ #: functions.php:126
28
+ msgid ""
29
+ "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Hide</"
30
+ "a>] If you're experiencing trouble, please copy these settings into any "
31
+ "request for support."
32
+ msgstr ""
33
+
34
+ #: wp-to-twitter-manager.php:60
35
  msgid ""
36
  "Set your Twitter login information and URL shortener API information to use "
37
  "this plugin!"
38
  msgstr ""
39
 
40
+ #: wp-to-twitter-manager.php:66
41
  msgid "Please add your Twitter password. "
42
  msgstr ""
43
 
44
+ #: wp-to-twitter-manager.php:72
45
  msgid "WP to Twitter Errors Cleared"
46
  msgstr ""
47
 
48
+ #: wp-to-twitter-manager.php:78
49
  msgid ""
50
  "URL shortener request failed! We couldn't shrink that URL, so we attached "
51
  "the normal URL to your Tweet. Check with your URL shortening provider to see "
53
  "a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]"
54
  msgstr ""
55
 
56
+ #: wp-to-twitter-manager.php:82
57
  msgid ""
58
  "Sorry! I couldn't get in touch with the Twitter servers to post your new "
59
  "blog post. Your tweet has been stored in a custom field attached to the "
60
  "post, so you can Tweet it manually if you wish! "
61
  msgstr ""
62
 
63
+ #: wp-to-twitter-manager.php:84
64
  msgid ""
65
  "Sorry! I couldn't get in touch with the Twitter servers to post your "
66
  "<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
72
  "ly."
73
  msgstr ""
74
 
75
+ #: wp-to-twitter-manager.php:146
76
  msgid "WP to Twitter Options Updated"
77
  msgstr ""
78
 
79
+ #: wp-to-twitter-manager.php:156
80
  msgid "Twitter login and password updated. "
81
  msgstr ""
82
 
83
+ #: wp-to-twitter-manager.php:158
84
  msgid "You need to provide your twitter login and password! "
85
  msgstr ""
86
 
87
+ #: wp-to-twitter-manager.php:165
88
  msgid "Cligs API Key Updated"
89
  msgstr ""
90
 
91
+ #: wp-to-twitter-manager.php:168
92
  msgid ""
93
  "Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be "
94
  "associated with your account. "
95
  msgstr ""
96
 
97
+ #: wp-to-twitter-manager.php:170
98
  msgid ""
99
  "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</"
100
  "a>! "
101
  msgstr ""
102
 
103
+ #: wp-to-twitter-manager.php:176
104
  msgid "Bit.ly API Key Updated."
105
  msgstr ""
106
 
107
+ #: wp-to-twitter-manager.php:179
108
  msgid ""
109
  "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
110
  msgstr ""
111
 
112
+ #: wp-to-twitter-manager.php:181
113
  msgid ""
114
  "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</"
115
+ "a>! An API key is required to use the Bit.ly URL shortening service."
116
  msgstr ""
117
 
118
+ #: wp-to-twitter-manager.php:185
119
  msgid " Bit.ly User Login Updated."
120
  msgstr ""
121
 
122
+ #: wp-to-twitter-manager.php:188
123
  msgid ""
124
  "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing "
125
  "your username. "
126
  msgstr ""
127
 
128
+ #: wp-to-twitter-manager.php:190
129
  msgid ""
130
  "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
131
  msgstr ""
148
  "link.</li>"
149
  msgstr ""
150
 
151
+ #: wp-to-twitter-manager.php:237 wp-to-twitter-manager.php:262
152
  msgid "<li>Successfully contacted the Bit.ly API via Snoopy.</li>"
153
  msgstr ""
154
 
155
+ #: wp-to-twitter-manager.php:239 wp-to-twitter-manager.php:264
156
  msgid "<li>Failed to contact the Bit.ly API via Snoopy.</li>"
157
  msgstr ""
158
 
159
+ #: wp-to-twitter-manager.php:242
160
+ msgid "<li>Cannot check the Bit.ly API without a valid API key.</li>"
161
+ msgstr ""
162
+
163
+ #: wp-to-twitter-manager.php:246
164
  msgid "<li>Successfully contacted the Twitter API via Snoopy.</li>"
165
  msgstr ""
166
 
167
+ #: wp-to-twitter-manager.php:248
168
  msgid "<li>Failed to contact the Twitter API via Snoopy.</li>"
169
  msgstr ""
170
 
171
+ #: wp-to-twitter-manager.php:254
172
  msgid "<li>Successfully contacted the Twitter API via cURL.</li>"
173
  msgstr ""
174
 
175
+ #: wp-to-twitter-manager.php:256
176
  msgid "<li>Failed to contact the Twitter API via cURL.</li>"
177
  msgstr ""
178
 
179
+ #: wp-to-twitter-manager.php:268
180
  msgid "<li>Successfully contacted the Cli.gs API via Snoopy.</li>"
181
  msgstr ""
182
 
183
+ #: wp-to-twitter-manager.php:271
184
  msgid "<li>Failed to contact the Cli.gs API via Snoopy.</li>"
185
  msgstr ""
186
 
187
+ #: wp-to-twitter-manager.php:276
188
  msgid ""
189
  "<li><strong>Your server should run WP to Twitter successfully.</strong></li>"
190
  msgstr ""
191
 
192
+ #: wp-to-twitter-manager.php:281
193
  msgid "<li>Your server does not support <code>fputs</code>.</li>"
194
  msgstr ""
195
 
196
+ #: wp-to-twitter-manager.php:285
197
  msgid ""
198
  "<li>Your server does not support <code>file_get_contents</code> or "
199
  "<code>cURL</code> functions.</li>"
200
  msgstr ""
201
 
202
+ #: wp-to-twitter-manager.php:289
203
  msgid "<li>Your server does not support <code>Snoopy</code>.</li>"
204
  msgstr ""
205
 
206
+ #: wp-to-twitter-manager.php:292
207
  msgid ""
208
  "<li><strong>Your server does not appear to support the required PHP "
209
  "functions and classes for WP to Twitter to function.</strong> You can try it "
210
  "anyway - these tests aren't perfect - but no guarantees.</li>"
211
  msgstr ""
212
 
213
+ #: wp-to-twitter-manager.php:301
214
+ msgid ""
215
+ "This plugin may not fully work in your server environment. The plugin failed "
216
+ "to contact both a URL shortener API and the Twitter service API."
217
  msgstr ""
218
 
219
+ #: wp-to-twitter-manager.php:316
220
  msgid "WP to Twitter Options"
221
  msgstr ""
222
 
223
+ #: wp-to-twitter-manager.php:320 wp-to-twitter.php:759
224
+ msgid "Get Support"
225
+ msgstr ""
226
+
227
+ #: wp-to-twitter-manager.php:321
228
+ msgid "Export Settings"
229
+ msgstr ""
230
+
231
+ #: wp-to-twitter-manager.php:335
232
  msgid ""
233
+ "For any post update field, you can use the codes <code>#title#</code> for "
234
+ "the title of your blog post, <code>#blog#</code> for the title of your blog, "
235
  "<code>#post#</code> for a short excerpt of the post content or <code>#url#</"
236
+ "code> for the post URL (shortened or not, depending on your preferences.) "
237
+ "You can also create custom shortcodes to access WordPress custom fields. Use "
238
+ "doubled square brackets surrounding the name of your custom field to add the "
239
+ "value of that custom field to your status update. Example: <code>"
240
+ "[[custom_field]]</code>"
241
  msgstr ""
242
 
243
+ #: wp-to-twitter-manager.php:342
244
  msgid ""
245
  "One or more of your last posts has failed to send it's status update to "
246
  "Twitter. Your Tweet has been saved in the custom meta data for your post, "
247
  "and you can re-Tweet it at your leisure."
248
  msgstr ""
249
 
250
+ #: wp-to-twitter-manager.php:345
251
  msgid ""
252
  "The query to the URL shortener API failed, and your URL was not shrunk. The "
253
  "full post URL was attached to your Tweet."
254
  msgstr ""
255
 
256
+ #: wp-to-twitter-manager.php:357
257
  msgid "Clear 'WP to Twitter' Error Messages"
258
  msgstr ""
259
 
260
+ #: wp-to-twitter-manager.php:366
261
+ msgid "Set what should be in a Tweet"
262
  msgstr ""
263
 
264
+ #: wp-to-twitter-manager.php:369
265
  msgid "Update when a post is published"
266
  msgstr ""
267
 
268
+ #: wp-to-twitter-manager.php:369
269
  msgid "Text for new post updates:"
270
  msgstr ""
271
 
272
+ #: wp-to-twitter-manager.php:374
 
 
 
 
273
  msgid "Update when a post is edited"
274
  msgstr ""
275
 
276
+ #: wp-to-twitter-manager.php:374
277
  msgid "Text for editing updates:"
278
  msgstr ""
279
 
280
+ #: wp-to-twitter-manager.php:378
281
+ msgid "Update Twitter when new Wordpress Pages are published"
282
  msgstr ""
283
 
284
+ #: wp-to-twitter-manager.php:378
285
+ msgid "Text for new page updates:"
286
  msgstr ""
287
 
288
+ #: wp-to-twitter-manager.php:382
289
  msgid "Update Twitter when WordPress Pages are edited"
290
  msgstr ""
291
 
292
+ #: wp-to-twitter-manager.php:382
293
+ msgid "Text for page edit updates:"
294
  msgstr ""
295
 
296
+ #: wp-to-twitter-manager.php:386
297
+ msgid "Add tags as hashtags on Tweets"
298
  msgstr ""
299
 
300
+ #: wp-to-twitter-manager.php:388
301
+ msgid "Maximum number of tags to include:"
302
  msgstr ""
303
 
304
+ #: wp-to-twitter-manager.php:389
305
+ msgid "Maximum length in characters for included tags:"
306
  msgstr ""
307
 
308
+ #: wp-to-twitter-manager.php:390
309
+ msgid ""
310
+ "These options allow you to restrict the length and number of WordPress tags "
311
+ "sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow "
312
+ "any and all tags."
313
  msgstr ""
314
 
315
+ #: wp-to-twitter-manager.php:394
316
+ msgid "Update Twitter when you post a Blogroll link"
 
 
317
  msgstr ""
318
 
319
+ #: wp-to-twitter-manager.php:396
320
+ msgid "Text for new link updates:"
 
321
  msgstr ""
322
 
323
+ #: wp-to-twitter-manager.php:396
324
+ msgid ""
325
+ "Available shortcodes: <code>#url#</code>, <code>#title#</code>, and "
326
+ "<code>#description#</code>."
327
  msgstr ""
328
 
329
+ #: wp-to-twitter-manager.php:399
330
  msgid "Length of post excerpt (in characters):"
331
  msgstr ""
332
 
333
+ #: wp-to-twitter-manager.php:399
334
  msgid ""
335
  "By default, extracted from the post itself. If you use the 'Excerpt' field, "
336
  "that will be used instead."
337
  msgstr ""
338
 
339
+ #: wp-to-twitter-manager.php:403
340
+ msgid "Custom text before Tweets:"
341
  msgstr ""
342
 
343
+ #: wp-to-twitter-manager.php:404
344
+ msgid "Custom text after Tweets:"
345
  msgstr ""
346
 
347
+ #: wp-to-twitter-manager.php:407
348
  msgid "Custom field for an alternate URL to be shortened and Tweeted:"
349
  msgstr ""
350
 
351
+ #: wp-to-twitter-manager.php:408
352
  msgid ""
353
  "You can use a custom field to send Cli.gs and Twitter an alternate URL from "
354
  "the permalink provided by WordPress. The value is the name of the custom "
355
  "field you're using to add an external URL."
356
  msgstr ""
357
 
358
+ #: wp-to-twitter-manager.php:412
359
+ msgid "Special Cases when WordPress should send a Tweet"
360
+ msgstr ""
361
+
362
+ #: wp-to-twitter-manager.php:415
363
+ msgid "Set default Tweet status to 'No.'"
364
+ msgstr ""
365
+
366
+ #: wp-to-twitter-manager.php:416
367
+ msgid ""
368
+ "Twitter updates can be set on a post by post basis. By default, posts WILL "
369
+ "be posted to Twitter. Check this to change the default to NO."
370
+ msgstr ""
371
+
372
+ #: wp-to-twitter-manager.php:420
373
+ msgid ""
374
+ "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
375
+ msgstr ""
376
+
377
+ #: wp-to-twitter-manager.php:424
378
+ msgid "Update Twitter when a post is published using QuickPress"
379
+ msgstr ""
380
+
381
+ #: wp-to-twitter-manager.php:428
382
+ msgid "Special Fields"
383
+ msgstr ""
384
+
385
+ #: wp-to-twitter-manager.php:431
386
  msgid "Use Google Analytics with WP-to-Twitter"
387
  msgstr ""
388
 
389
+ #: wp-to-twitter-manager.php:432
390
  msgid "Campaign identifier for Google Analytics:"
391
  msgstr ""
392
 
393
+ #: wp-to-twitter-manager.php:433
394
  msgid ""
395
  "You can track the response from Twitter using Google Analytics by defining a "
396
  "campaign identifier here."
397
  msgstr ""
398
 
399
+ #: wp-to-twitter-manager.php:438
400
  msgid "Authors have individual Twitter accounts"
401
  msgstr ""
402
 
403
+ #: wp-to-twitter-manager.php:438
404
  msgid ""
405
  "Each author can set their own Twitter username and password in their user "
406
  "profile. Their posts will be sent to their own Twitter accounts."
407
  msgstr ""
408
 
409
+ #: wp-to-twitter-manager.php:442
410
+ msgid "Set your preferred URL Shortener"
411
+ msgstr ""
412
+
413
+ #: wp-to-twitter-manager.php:445
414
  msgid "Use <strong>Cli.gs</strong> for my URL shortener."
415
  msgstr ""
416
 
417
+ #: wp-to-twitter-manager.php:445
418
  msgid "Use <strong>Bit.ly</strong> for my URL shortener."
419
  msgstr ""
420
 
421
+ #: wp-to-twitter-manager.php:445
422
  msgid "Don't shorten URLs."
423
  msgstr ""
424
 
425
+ #: wp-to-twitter-manager.php:450
426
  msgid "Save WP->Twitter Options"
427
  msgstr ""
428
 
429
+ #: wp-to-twitter-manager.php:456
430
  msgid "Your Twitter account details"
431
  msgstr ""
432
 
433
+ #: wp-to-twitter-manager.php:463
434
  msgid "Your Twitter username:"
435
  msgstr ""
436
 
437
+ #: wp-to-twitter-manager.php:467
438
  msgid "Your Twitter password:"
439
  msgstr ""
440
 
441
+ #: wp-to-twitter-manager.php:467
442
  msgid "(<em>Saved</em>)"
443
  msgstr ""
444
 
445
+ #: wp-to-twitter-manager.php:471
446
  msgid "Save Twitter Login Info"
447
  msgstr ""
448
 
449
+ #: wp-to-twitter-manager.php:471
450
  msgid ""
451
  "&raquo; <small>Don't have a Twitter account? <a href='http://www.twitter."
452
  "com'>Get one for free here</a>"
453
  msgstr ""
454
 
455
+ #: wp-to-twitter-manager.php:475
456
  msgid "Your Cli.gs account details"
457
  msgstr ""
458
 
459
+ #: wp-to-twitter-manager.php:482
460
  msgid ""
461
  "Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
462
  msgstr ""
463
 
464
+ #: wp-to-twitter-manager.php:488
465
  msgid ""
466
  "Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/"
467
  "api/'>Get one free here</a>!<br />You'll need an API key in order to "
468
  "associate the Cligs you create with your Cligs account."
469
  msgstr ""
470
 
471
+ #: wp-to-twitter-manager.php:493
472
  msgid "Your Bit.ly account details"
473
  msgstr ""
474
 
475
+ #: wp-to-twitter-manager.php:498
476
  msgid "Your Bit.ly username:"
477
  msgstr ""
478
 
479
+ #: wp-to-twitter-manager.php:502
480
  msgid ""
481
  "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
482
  msgstr ""
483
 
484
+ #: wp-to-twitter-manager.php:509
485
+ msgid "Save Bit.ly API Key"
486
+ msgstr ""
487
+
488
+ #: wp-to-twitter-manager.php:509
489
+ msgid "Clear Bit.ly API Key"
490
+ msgstr ""
491
+
492
+ #: wp-to-twitter-manager.php:509
493
+ msgid ""
494
+ "A Bit.ly API key and username is required to shorten URLs via the Bit.ly API "
495
+ "and WP to Twitter."
496
+ msgstr ""
497
+
498
+ #: wp-to-twitter-manager.php:518
499
+ msgid "Check Support"
500
+ msgstr ""
501
+
502
+ #: wp-to-twitter-manager.php:518
503
+ msgid ""
504
+ "Check whether your server supports WP to Twitter's queries to the Twitter "
505
+ "and URL shortening APIs."
506
+ msgstr ""
507
+
508
+ #: wp-to-twitter-manager.php:526
509
  msgid "Need help?"
510
  msgstr ""
511
 
512
+ #: wp-to-twitter-manager.php:527
513
  msgid ""
514
  "Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to "
515
  "Twitter plugin page</a>."
516
  msgstr ""
517
 
518
+ #: wp-to-twitter.php:691
519
  msgid "Add_new_tag"
520
  msgstr ""
521
 
522
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
523
  #. Plugin Name of an extension
524
+ #: wp-to-twitter.php:713
525
  msgid "WP to Twitter"
526
  msgstr ""
527
 
528
+ #: wp-to-twitter.php:754
529
  msgid "Twitter Post"
530
  msgstr ""
531
 
532
+ #: wp-to-twitter.php:759
533
  msgid ""
534
  " characters.<br />Twitter posts are a maximum of 140 characters; if your Cli."
535
  "gs URL is appended to the end of your document, you have 119 characters "
538
  "title, a post excerpt or blog name into the Tweet."
539
  msgstr ""
540
 
541
+ #: wp-to-twitter.php:759
542
+ msgid "Make a Donation"
543
  msgstr ""
544
 
545
+ #: wp-to-twitter.php:762
546
  msgid "Don't Tweet this post."
547
  msgstr ""
548
 
549
+ #: wp-to-twitter.php:811
550
  msgid "WP to Twitter User Settings"
551
  msgstr ""
552
 
553
+ #: wp-to-twitter.php:815
554
  msgid "Use My Twitter Account"
555
  msgstr ""
556
 
557
+ #: wp-to-twitter.php:816
558
  msgid ""
559
  "Select this option if you would like your posts to be Tweeted into your own "
560
  "Twitter account with no @ references."
561
  msgstr ""
562
 
563
+ #: wp-to-twitter.php:817
564
  msgid ""
565
  "Tweet my posts into my Twitter account with an @ reference to the site's "
566
  "main Twitter account."
567
  msgstr ""
568
 
569
+ #: wp-to-twitter.php:818
570
  msgid ""
571
  "Tweet my posts into the main site Twitter account with an @ reference to my "
572
  "username. (Password not required with this option.)"
573
  msgstr ""
574
 
575
+ #: wp-to-twitter.php:821
576
  msgid "Your Twitter Username"
577
  msgstr ""
578
 
579
+ #: wp-to-twitter.php:822
580
  msgid "Enter your own Twitter username."
581
  msgstr ""
582
 
583
+ #: wp-to-twitter.php:825
584
  msgid "Your Twitter Password"
585
  msgstr ""
586
 
587
+ #: wp-to-twitter.php:826
588
  msgid "Enter your own Twitter password."
589
  msgstr ""
590
 
591
+ #: wp-to-twitter.php:945
592
+ msgid "<p>Couldn't locate the settings page.</p>"
593
+ msgstr ""
594
+
595
+ #: wp-to-twitter.php:950
596
  msgid "Settings"
597
  msgstr ""
598