WP to Twitter - Version 1.4.0

Version Description

  • Added support for the Bit.ly URL shortening service.
  • Added option to not use URL shortening.
  • Added option to add tags to end of status update as hashtag references.
  • Fixed a bug where the #url# shortcode failed when editing posts.
  • Reduced some redundant code.
  • Converted version notes to new Changelog format.
Download this release

Release Info

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

Code changes from version 1.3.7 to 1.4.0

Files changed (4) hide show
  1. readme.txt +61 -33
  2. wp-to-twitter-manager.php +129 -47
  3. wp-to-twitter.php +148 -81
  4. wp-to-twitter.pot +190 -94
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate.php
4
  Tags: twitter, microblogging, cligs, redirect, shortener, post, links
5
  Requires at least: 2.5
6
- Tested up to: 2.8
7
  Stable tag: trunk
8
 
9
  Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using the Cligs URL shortening service.
@@ -12,12 +12,6 @@ Posts a Twitter status update when you update your WordPress blog or post to you
12
 
13
  The WP-to-Twitter plugin posts a Twitter status update from your WordPress blog using the Cli.gs URL shortening service to provide a link back to your post from Twitter.
14
 
15
- **New in version 1.3.7**:
16
-
17
- * Revised interface to take advantage of features added in versions 2.5 and 2.7. You can now drag and drop the WP to Twitter configuration panel in Post and Page authoring pages.
18
- * Fixed bug where post titles were not Tweeted when using the "Press This" bookmarklet
19
- * Security bug fix.
20
-
21
  If you have a Cli.gs API key, the shortened URL will also be filed in your Cli.gs account so that you can track statistics for the shortened URL.
22
 
23
  The plugin can send a default message for updating or editing posts or pages, but also allows you to write a custom Tweet for your post which says whatever you want. By default, the shortened URL from Cli.gs is appended to the end of your message, so you should keep that in mind when writing your custom Tweet.
@@ -26,31 +20,50 @@ Any status update you write which is longer than the available space will automa
26
 
27
  This plugin is based loosely on the Twitter Updater plugin by [Jonathan Dingman](http://www.firesidemedia.net/dev/), which he adapted from a plugin by Victoria Chan. Other contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Baccega](http://www.andreabaccega.com).
28
 
29
- == Version Notes ==
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- **New in version 1.3.5**:
32
 
33
  * Bug fix: when "Send link to Twitter" is disabled, Twitter status and shortcodes were not parsed correctly.
34
 
35
- **New in version 1.3.4**:
36
 
37
  * Bug fix: html tags in titles are stripped from tweets
38
  * Bug fix: thanks to [Andrea Baccega](http://www.andreabaccega.com), some problems related to WP 2.7.1 should be fixed.
39
  * Added optional prepend/append text fields.
40
 
41
- **New in version 1.3.3**:
42
 
43
  * Added support for shortcodes in custom Tweet fields.
44
  * Bug fix when #url# is the first element in a Tweet string.
45
  * Minor interface changes.
46
 
47
- **New in version 1.3.2**:
48
 
49
  * Added a #url# shortcode so you can decide where your short URL will appear in the tweet.
50
  * Couple small bug fixes.
51
  * Small changes to the settings page.
52
 
53
- **New in version 1.3.1**:
54
 
55
  * Modification for multiple authors with independent Twitter accounts -- there are now three options:
56
 
@@ -61,27 +74,42 @@ This plugin is based loosely on the Twitter Updater plugin by [Jonathan Dingman]
61
  * Added an option to enable or disable Tweeting of Pages when edited.
62
  * **Fixed scheduled posting and posting from QuickPress, so both of these options will now be Tweeted.**
63
 
64
- New in version 1.3.0: Support for multiple authors with independent Twitter & Cligs accounts. Other minor textual revisions, addition of API availability check in the Settings panel. Bugfixes: If editing a post by XMLRPC, you could not disable tweeting your edits. FIXED.
 
 
 
 
 
 
 
 
 
 
65
 
66
- New in version 1.2.8: Bug fix to 1.2.7.
 
67
 
68
- New in version 1.2.7:
69
- - Uses the Snoopy class to retrieve information from Cligs and to post Twitter updates. Hopefully this will solve a variety of issues.
70
- - Added an option to track traffic from your Tweeted Posts using Google Analytics (Thanks to [Joost](http://yoast.com/twitter-analytics/))
71
 
72
- New in version 1.2.6:
73
- - Bugfix with XMLRPC publishing -- controls to disable XMLRPC publishing now work correctly.
74
- - Bugfix with error reporting and clearing.
75
- - Added the option to supply an alternate URL along with your post, to be tweeted in place of the WP permalink.
76
 
77
- New in version 1.2.5:
78
- - Support for publishing via XMLRPC
79
- - Corrected a couple minor bugs
80
- - Added internationalization support
81
 
82
- New in version 1.2.0:
83
- - option to post your new blogroll links to Twitter, using the description field as your status update text.
84
- - option to decide on a post level whether or not that blog post should be posted to Twitter
 
 
 
 
 
 
 
 
 
 
85
 
86
  == Installation ==
87
 
@@ -119,13 +147,13 @@ Well, there isn't much I can do about that - but the plugin will check and see w
119
 
120
  No. They're private.
121
 
122
- = What are the changes between version 1.1 and 1.2? =
123
 
124
- There are several additional functions available in version 1.2. First, you can now post links you add to your blogroll to Twitter. Second, you can configure whether or not you want to Tweet posts on an individual basis. Third, you can globally set whether you'd rather have posts default to be Tweeted or NOT to be Tweeted, depending on whether you're more likely to want to Tweet most posts but not all or Tweet only the occasional post.
125
 
126
- = I can't see the settings page! =
127
 
128
- There�s an unresolved bug which effects some servers which causes the WP-to-Twitter settings page to fail. You can get around this problem by commenting out lines 145 - 190 in wp-to-twitter/wp-to-twitter-manager.php. (Version 1.3.4.)
129
 
130
  == Screenshots ==
131
 
3
  Donate link: http://www.joedolson.com/donate.php
4
  Tags: twitter, microblogging, cligs, redirect, shortener, post, links
5
  Requires at least: 2.5
6
+ Tested up to: 2.8.2
7
  Stable tag: trunk
8
 
9
  Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using the Cligs URL shortening service.
12
 
13
  The WP-to-Twitter plugin posts a Twitter status update from your WordPress blog using the Cli.gs URL shortening service to provide a link back to your post from Twitter.
14
 
 
 
 
 
 
 
15
  If you have a Cli.gs API key, the shortened URL will also be filed in your Cli.gs account so that you can track statistics for the shortened URL.
16
 
17
  The plugin can send a default message for updating or editing posts or pages, but also allows you to write a custom Tweet for your post which says whatever you want. By default, the shortened URL from Cli.gs is appended to the end of your message, so you should keep that in mind when writing your custom Tweet.
20
 
21
  This plugin is based loosely on the Twitter Updater plugin by [Jonathan Dingman](http://www.firesidemedia.net/dev/), which he adapted from a plugin by Victoria Chan. Other contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Baccega](http://www.andreabaccega.com).
22
 
23
+ == Changelog ==
24
+
25
+ = 1.4.0 =
26
+
27
+ * Added support for the Bit.ly URL shortening service.
28
+ * Added option to not use URL shortening.
29
+ * Added option to add tags to end of status update as hashtag references.
30
+ * Fixed a bug where the #url# shortcode failed when editing posts.
31
+ * Reduced some redundant code.
32
+ * Converted version notes to new Changelog format.
33
+
34
+ = 1.3.7 =
35
+
36
+ * Revised interface to take advantage of features added in versions 2.5 and 2.7. You can now drag and drop the WP to Twitter configuration panel in Post and Page authoring pages.
37
+ * Fixed bug where post titles were not Tweeted when using the "Press This" bookmarklet
38
+ * Security bug fix.
39
+
40
+ = 1.3.6 =
41
+
42
+ *Bug fix release.
43
 
44
+ = 1.3.5 =
45
 
46
  * Bug fix: when "Send link to Twitter" is disabled, Twitter status and shortcodes were not parsed correctly.
47
 
48
+ = 1.3.4 =
49
 
50
  * Bug fix: html tags in titles are stripped from tweets
51
  * Bug fix: thanks to [Andrea Baccega](http://www.andreabaccega.com), some problems related to WP 2.7.1 should be fixed.
52
  * Added optional prepend/append text fields.
53
 
54
+ = 1.3.3 =
55
 
56
  * Added support for shortcodes in custom Tweet fields.
57
  * Bug fix when #url# is the first element in a Tweet string.
58
  * Minor interface changes.
59
 
60
+ = 1.3.2 =
61
 
62
  * Added a #url# shortcode so you can decide where your short URL will appear in the tweet.
63
  * Couple small bug fixes.
64
  * Small changes to the settings page.
65
 
66
+ = 1.3.1 =
67
 
68
  * Modification for multiple authors with independent Twitter accounts -- there are now three options:
69
 
74
  * Added an option to enable or disable Tweeting of Pages when edited.
75
  * **Fixed scheduled posting and posting from QuickPress, so both of these options will now be Tweeted.**
76
 
77
+ = 1.3.0 =
78
+
79
+ *Support for multiple authors with independent Twitter & Cligs accounts.
80
+ *Other minor textual revisions, addition of API availability check in the Settings panel.
81
+ *Bugfixes: If editing a post by XMLRPC, you could not disable tweeting your edits. FIXED.
82
+
83
+ = 1.2.8 =
84
+
85
+ *Bug fix to 1.2.7.
86
+
87
+ = 1.2.7 =
88
 
89
+ *Uses the Snoopy class to retrieve information from Cligs and to post Twitter updates. Hopefully this will solve a variety of issues.
90
+ *Added an option to track traffic from your Tweeted Posts using Google Analytics (Thanks to [Joost](http://yoast.com/twitter-analytics/))
91
 
92
+ = 1.2.6 =
 
 
93
 
94
+ *Bugfix with XMLRPC publishing -- controls to disable XMLRPC publishing now work correctly.
95
+ *Bugfix with error reporting and clearing.
96
+ *Added the option to supply an alternate URL along with your post, to be tweeted in place of the WP permalink.
 
97
 
98
+ = 1.2.5 =
 
 
 
99
 
100
+ *Support for publishing via XMLRPC
101
+ *Corrected a couple minor bugs
102
+ *Added internationalization support
103
+
104
+ = 1.2.0 =
105
+
106
+ *option to post your new blogroll links to Twitter, using the description field as your status update text.
107
+ *option to decide on a post level whether or not that blog post should be posted to Twitter
108
+ *option to set a global default 'to Tweet or not to Tweet.'
109
+
110
+ = 1.1.0 =
111
+
112
+ *Update to use cURL as an option to fetch information from the Cli.gs API.
113
 
114
  == Installation ==
115
 
147
 
148
  No. They're private.
149
 
150
+ = I can't see the settings page! =
151
 
152
+ There�s an unresolved bug which effects some servers which causes the WP-to-Twitter settings page to fail. You can get around this problem by commenting out lines 191 - 256 in wp-to-twitter/wp-to-twitter-manager.php. (Version 1.4.0.)
153
 
154
+ = Scheduled posting doesn't work. What's wrong? =
155
 
156
+ Only posts which you scheduled or edited *after* installing the plugin will be Tweeted. Any future posts written before installing the plugin will be ignored by WP to Twitter.
157
 
158
  == Screenshots ==
159
 
wp-to-twitter-manager.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  //update_option( 'twitterInitialised', '0' );
3
  // FUNCTION to see if checkboxes should be checked
 
4
  function jd_checkCheckbox( $theFieldname ) {
5
  if( get_option( $theFieldname ) == '1'){
6
  echo 'checked="checked"';
@@ -15,6 +16,8 @@
15
  update_option( 'newpost-published-text', 'New post: #title# (#url#)' );
16
  update_option( 'newpost-published-showlink', '1' );
17
  update_option( 'jd_twit_quickpress', '1' );
 
 
18
 
19
  update_option( 'oldpost-edited-update', '1' );
20
  update_option( 'oldpost-edited-text', 'Post Edited: #title# (#url#)' );
@@ -38,7 +41,7 @@
38
  // Error checking
39
  update_option( 'jd_functions_checked','0' );
40
  update_option( 'wp_twitter_failure','0' );
41
- update_option( 'wp_cligs_failure','0' );
42
 
43
  // Blogroll options
44
  update_option ('jd-use-link-title','0' );
@@ -51,7 +54,7 @@
51
  // Note that default options are set.
52
  update_option( 'twitterInitialised', '1' );
53
 
54
- $message = __("Set your Twitter login information and Cli.gs API to use this plugin! ");
55
  }
56
  if( get_option( 'twitterInitialised') == '1' && get_option( 'twitterpw' ) == "" ) {
57
  $message .= __("Please add your Twitter password. ");
@@ -59,14 +62,14 @@
59
 
60
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
61
  update_option( 'wp_twitter_failure','0' );
62
- update_option( 'wp_cligs_failure','0' );
63
  $message = __("WP to Twitter Errors Cleared");
64
  }
65
 
66
  // Error messages on failures
67
- if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
68
- if ( get_option( 'wp_cligs_failure' ) == '1' ) {
69
- $wp_to_twitter_failure .= "<p>" . __("Cli.gs request failed! We couldn't shrink that URL, so we attached the normal URL to your Tweet. Check the <a href='http://blog.cli.gs'>Cli.gs blog</a> to see if there are any known issues. ") . "</p>";
70
  }
71
 
72
  if ( get_option( 'wp_twitter_failure' ) == '1' ) {
@@ -93,9 +96,10 @@ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure'
93
  update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
94
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
95
  update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
96
-
97
  update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
98
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
 
99
 
100
 
101
  if ( $_POST['jd-use-link-field'] == '2' ) {
@@ -106,6 +110,28 @@ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure'
106
  update_option( 'jd-use-link-title', '1' );
107
  update_option( 'jd-use-link-description', '0' );
108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
110
  update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
111
 
@@ -136,6 +162,25 @@ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure'
136
  } else {
137
  $message = __("Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</a>! ");
138
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
 
141
  // Check whether the server has supported for needed functions.
@@ -146,12 +191,17 @@ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure'
146
  if ( get_option('jd-functions-checked') == '0') {
147
  $cligs_checker = new Snoopy;
148
  $twit_checker = new Snoopy;
 
149
  $testurl = urlencode("http://www.joedolson.com/articles/wp-to-twitter/");
150
 
151
  $cligs_checker->fetchtext( "http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1" );
 
 
 
152
  $twit_checker->fetch( "http://twitter.com/help/test.json" );
153
  $wp_twitter_error = TRUE;
154
  $wp_cligs_error = TRUE;
 
155
  if ( strlen(getfilefromurl("http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1")) == 20 || strlen($cligs_checker->results) == 20 ) {
156
  $wp_cligs_error = FALSE;
157
  $message .= __("Successfully contacted the Cli.gs API. ");
@@ -159,6 +209,21 @@ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure'
159
  } else {
160
  $message .=__("Failed to contact the Cli.gs API. ");
161
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  if ( $twit_checker->results == "\"ok\"" || getfilefromurl("http://twitter.com/help/test.xml") == "<ok>true</ok>" ) {
163
  $wp_twitter_error = FALSE;
164
  $message .= __("Successfully contacted the Twitter API. ");
@@ -208,24 +273,26 @@ echo "</p></div>";
208
  <?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, or <code>#url#</code> for the post URL! Given the character limit for Twitter, you may not want to include your blog title."); ?>
209
  </p>
210
 
211
- <?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) { ?>
212
  <div class="error">
213
  <p>
214
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
215
  _e("One or more of your last posts has failed to send it's status update to Twitter. Your Tweet has been saved in the custom meta data for your post, and you can re-Tweet it at your leisure.");
216
  }
217
- if ( get_option( 'wp_cligs_failure' ) == '1' ) {
218
- _e("The query to the Cli.gs API failed, and your URL was not shrunk. The normal post URL was attached to your Tweet.");
219
  }
220
  echo $wp_to_twitter_failure;
221
  ?>
222
  </p>
223
  </div>
224
  <form method="post" action="">
 
 
225
  <div>
226
  <input type="hidden" name="submit-type" value="clear-error" />
227
  </div>
228
- <p><input type="submit" name="submit" value="<?php _e("Clear 'WP to Twitter' Error"); ?>" /> <strong><?php _e("Why are you seeing this field?"); ?></strong>
229
  </p>
230
  </form>
231
  <?php
@@ -233,6 +300,8 @@ echo "</p></div>";
233
  ?>
234
 
235
  <form method="post" action="">
 
 
236
  <div>
237
  <fieldset>
238
  <legend><?php _e("Wordpress to Twitter Publishing Options"); ?></legend>
@@ -246,11 +315,7 @@ echo "</p></div>";
246
  </p>
247
  <p>
248
  <input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
249
- <label for="newpost-published-update"><strong><?php _e("Update Twitter when a new post is published"); ?></strong></label>
250
- </p>
251
- <p>
252
- <label for="newpost-published-text"><?php _e("Text for this Twitter update"); ?></label><br />
253
- <input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo(get_option('newpost-published-text')) ?>" />
254
  &nbsp;&nbsp;
255
  <input type="checkbox" name="newpost-published-showlink" id="newpost-published-showlink" value="1" <?php jd_checkCheckbox('newpost-published-showlink')?> />
256
  <label for="newpost-published-showlink"><?php _e("Provide link to blog?"); ?></label>
@@ -258,27 +323,18 @@ echo "</p></div>";
258
 
259
  <p>
260
  <input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
261
- <label for="oldpost-edited-update"><strong><?php _e("Update Twitter when an old post has been edited"); ?></strong></label>
262
- </p>
263
- <p>
264
- <label for="oldpost-edited-text">Text for this Twitter update</label><br />
265
- <input type="text" name="oldpost-edited-text" id="oldpost-edited-text" size="60" maxlength="120" value="<?php echo(get_option('oldpost-edited-text')) ?>" />
266
  &nbsp;&nbsp;
267
  <input type="checkbox" name="oldpost-edited-showlink" id="oldpost-edited-showlink" value="1" <?php jd_checkCheckbox('oldpost-edited-showlink')?> />
268
  <label for="oldpost-edited-showlink"><?php _e("Provide link to blog?"); ?></label>
269
  </p>
270
-
271
  <p>
272
- <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
273
- <label for="oldpost-edited-update"><strong><?php _e("Update Twitter when you post a Blogroll link"); ?></strong></label>
274
  </p>
275
  <p>
276
- <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"); ?></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"); ?></label>
277
- </p>
278
-
279
- <p>
280
- <label for="newlink-published-text"><?php _e("Text for this Twitter update (used if above choice isn't available.)"); ?></label><br />
281
- <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo(get_option('newlink-published-text')) ?>" />
282
  </p>
283
 
284
  <p>
@@ -296,50 +352,51 @@ echo "</p></div>";
296
  </p>
297
 
298
  <p>
299
- <label for="jd_twit_prepend"><?php _e("Custom text to be prepended on every Tweet"); ?></label><br />
300
- <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="60" maxlength="20" value="<?php echo(get_option('jd_twit_prepend')) ?>" />
301
  </p>
302
 
303
  <p>
304
- <label for="jd_twit_append"><?php _e("Custom text to be appended on every Tweet"); ?></label><br />
305
- <input type="text" name="jd_twit_append" id="jd_twit_append" size="60" maxlength="20" value="<?php echo(get_option('jd_twit_append')) ?>" />
306
  </p>
307
 
308
  <p>
309
- <label for="jd_twit_custom_url"><?php _e("Custom field containing an alternate URL to be shortened and Tweeted."); ?></label><br />
310
- <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="60" maxlength="120" value="<?php echo(get_option('jd_twit_custom_url')) ?>" /><br />
311
  <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."); ?></small>
312
  </p>
313
- <p>
314
- <label for="twitter-analytics-campaign"><?php _e("Campaign identifier for Google Analytics"); ?></label><br />
315
- <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="60" maxlength="120" value="<?php echo(get_option('twitter-analytics-campaign')) ?>" /><br />
316
- <small><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here."); ?></small>
317
- </p>
318
  <p>
319
  <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
320
- <label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter"); ?></strong></label>
 
 
321
  </p>
 
322
  <p>
323
  <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
324
  <label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts"); ?></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.'); ?></small>
325
  </p>
326
 
 
 
 
 
327
  <div>
328
  <input type="hidden" name="submit-type" value="options" />
329
  </div>
330
  <input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options"); ?>" class="button-primary" />
331
  </fieldset>
332
-
333
  </div>
334
  </form>
335
 
336
  <h2 class="twitter"><?php _e("Your Twitter account details"); ?></h2>
337
 
338
  <form method="post" action="" >
 
 
339
  <div>
340
  <p>
341
  <label for="twitterlogin"><?php _e("Your Twitter username:"); ?></label>
342
- <input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo(get_option('twitterlogin')) ?>" />
343
  </p>
344
  <p>
345
  <label for="twitterpw"><?php _e("Your Twitter password:"); ?></label>
@@ -353,10 +410,12 @@ echo "</p></div>";
353
  <h2 class="cligs"><?php _e("Your Cli.gs account details"); ?></h2>
354
 
355
  <form method="post" action="">
 
 
356
  <div>
357
  <p>
358
  <label for="cligsapi"><?php _e("Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"); ?></label>
359
- <input type="text" name="cligsapi" id="cligsapi" size="40" value="<?php echo(get_option('cligsapi')) ?>" />
360
  </p>
361
  <div>
362
  <input type="hidden" name="submit-type" value="cligsapi" />
@@ -364,14 +423,37 @@ echo "</p></div>";
364
  <p><input type="submit" name="submit" value="Save Cli.gs API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Cli.gs API Key" />&raquo; <small><?php _e("Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/api/'>Get one free here</a>!<br />You'll need an API key in order to associate the Cligs you create with your Cligs account."); ?></small></p>
365
  </div>
366
  </form>
367
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  </div>
369
 
370
  <form method="post" action="">
 
 
371
  <div>
372
  <input type="hidden" name="submit-type" value="check-support" />
373
  <p>
374
- <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 Cli.gs API calls to work.</small>
375
  </p>
376
  </div>
377
  </form>
1
  <?php
2
  //update_option( 'twitterInitialised', '0' );
3
  // FUNCTION to see if checkboxes should be checked
4
+
5
  function jd_checkCheckbox( $theFieldname ) {
6
  if( get_option( $theFieldname ) == '1'){
7
  echo 'checked="checked"';
16
  update_option( 'newpost-published-text', 'New post: #title# (#url#)' );
17
  update_option( 'newpost-published-showlink', '1' );
18
  update_option( 'jd_twit_quickpress', '1' );
19
+ update_option( 'jd_shortener', '0' );
20
+ update_option( 'use_tags_as_hashtags', '0' );
21
 
22
  update_option( 'oldpost-edited-update', '1' );
23
  update_option( 'oldpost-edited-text', 'Post Edited: #title# (#url#)' );
41
  // Error checking
42
  update_option( 'jd_functions_checked','0' );
43
  update_option( 'wp_twitter_failure','0' );
44
+ update_option( 'wp_url_failure','0' );
45
 
46
  // Blogroll options
47
  update_option ('jd-use-link-title','0' );
54
  // Note that default options are set.
55
  update_option( 'twitterInitialised', '1' );
56
 
57
+ $message = __("Set your Twitter login information and URL shortener API information to use this plugin!");
58
  }
59
  if( get_option( 'twitterInitialised') == '1' && get_option( 'twitterpw' ) == "" ) {
60
  $message .= __("Please add your Twitter password. ");
62
 
63
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
64
  update_option( 'wp_twitter_failure','0' );
65
+ update_option( 'wp_url_failure','0' );
66
  $message = __("WP to Twitter Errors Cleared");
67
  }
68
 
69
  // Error messages on failures
70
+ if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) {
71
+ if ( get_option( 'wp_url_failure' ) == '1' ) {
72
+ $wp_to_twitter_failure .= "<p>" . __("URL shortener request failed! We couldn't shrink that URL, so we attached the normal URL to your Tweet. Check with your URL shortening provider to see if there are any known issues. [<a href=\"http://blog.cli.gs\">Cli.gs Blog</a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]") . "</p>";
73
  }
74
 
75
  if ( get_option( 'wp_twitter_failure' ) == '1' ) {
96
  update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
97
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
98
  update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
99
+ update_option( 'use_tags_as_hashtags', $_POST['use_tags_as_hashtags'] );
100
  update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
101
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
102
+ update_option( 'jd_shortener', $_POST['jd_shortener'] );
103
 
104
 
105
  if ( $_POST['jd-use-link-field'] == '2' ) {
110
  update_option( 'jd-use-link-title', '1' );
111
  update_option( 'jd-use-link-description', '0' );
112
  }
113
+ switch ($_POST['jd_shortener']) {
114
+ case 1:
115
+ update_option( 'jd-use-cligs', '1' );
116
+ update_option( 'jd-use-bitly', '0' );
117
+ update_option( 'jd-use-none', '0' );
118
+ break;
119
+ case 2:
120
+ update_option( 'jd-use-cligs', '0' );
121
+ update_option( 'jd-use-bitly', '1' );
122
+ update_option( 'jd-use-none', '0' );
123
+ break;
124
+ case 3:
125
+ update_option( 'jd-use-cligs', '0' );
126
+ update_option( 'jd-use-bitly', '0' );
127
+ update_option( 'jd-use-none', '1' );
128
+ break;
129
+ default:
130
+ update_option( 'jd-use-cligs', '1' );
131
+ update_option( 'jd-use-bitly', '0' );
132
+ update_option( 'jd-use-none', '0' );
133
+ }
134
+
135
  update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
136
  update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
137
 
162
  } else {
163
  $message = __("Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</a>! ");
164
  }
165
+ } else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'bitlyapi' ) {
166
+ if ( $_POST['bitlyapi'] != '' && isset( $_POST['submit'] ) ) {
167
+ update_option( 'bitlyapi',trim($_POST['bitlyapi']) );
168
+ $message = __("Bit.ly API Key Updated.");
169
+ } else if ( isset( $_POST['clear'] ) ) {
170
+ update_option( 'bitlyapi','' );
171
+ $message = __("Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. ");
172
+ } else {
173
+ $message = __("Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</a>! ");
174
+ }
175
+ if ( $_POST['bitlylogin'] != '' && isset( $_POST['submit'] ) ) {
176
+ update_option( 'bitlylogin',$_POST['bitlylogin'] );
177
+ $message .= __(" Bit.ly User Login Updated.");
178
+ } else if ( isset( $_POST['clear'] ) ) {
179
+ update_option( 'bitlylogin','' );
180
+ $message = __("Bit.ly User Login deleted. You cannot use the Bit.ly API without providing your username. ");
181
+ } else {
182
+ $message = __("Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! ");
183
+ }
184
  }
185
 
186
  // Check whether the server has supported for needed functions.
191
  if ( get_option('jd-functions-checked') == '0') {
192
  $cligs_checker = new Snoopy;
193
  $twit_checker = new Snoopy;
194
+ $bitly_checker = new Snoopy;
195
  $testurl = urlencode("http://www.joedolson.com/articles/wp-to-twitter/");
196
 
197
  $cligs_checker->fetchtext( "http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1" );
198
+ $bitlylogin = get_option( 'bitlylogin' );
199
+ $bitlyapi = get_option( 'bitlyapi' );
200
+ $bitly_checker->fetch( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
201
  $twit_checker->fetch( "http://twitter.com/help/test.json" );
202
  $wp_twitter_error = TRUE;
203
  $wp_cligs_error = TRUE;
204
+ $wp_bitly_error = TRUE;
205
  if ( strlen(getfilefromurl("http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1")) == 20 || strlen($cligs_checker->results) == 20 ) {
206
  $wp_cligs_error = FALSE;
207
  $message .= __("Successfully contacted the Cli.gs API. ");
209
  } else {
210
  $message .=__("Failed to contact the Cli.gs API. ");
211
  }
212
+ $decoded = json_decode($bitly_checker->results,TRUE);
213
+ $bitly_decoded = $decoded['statusCode'];
214
+ if ( $bitly_decoded == "OK" ) {
215
+ $wp_bitly_error = FALSE;
216
+ $message .= __("Successfully contacted the Bit.ly API. ");
217
+ //$message .= "Bit.ly: $bitly_decoded";
218
+ //$message .= $bitly_decoded;
219
+ } else {
220
+ $message .=__("Failed to contact the Bit.ly API. ");
221
+ //$message .= "Bit.ly: $bitly_decoded";
222
+ $message .= "<pre>http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1</pre>";
223
+ //echo "<pre>";
224
+ //print_r($decoded);
225
+ //echo "</pre>";
226
+ }
227
  if ( $twit_checker->results == "\"ok\"" || getfilefromurl("http://twitter.com/help/test.xml") == "<ok>true</ok>" ) {
228
  $wp_twitter_error = FALSE;
229
  $message .= __("Successfully contacted the Twitter API. ");
273
  <?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, or <code>#url#</code> for the post URL! Given the character limit for Twitter, you may not want to include your blog title."); ?>
274
  </p>
275
 
276
+ <?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) { ?>
277
  <div class="error">
278
  <p>
279
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
280
  _e("One or more of your last posts has failed to send it's status update to Twitter. Your Tweet has been saved in the custom meta data for your post, and you can re-Tweet it at your leisure.");
281
  }
282
+ if ( get_option( 'wp_url_failure' ) == '1' ) {
283
+ _e("The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet.");
284
  }
285
  echo $wp_to_twitter_failure;
286
  ?>
287
  </p>
288
  </div>
289
  <form method="post" action="">
290
+
291
+
292
  <div>
293
  <input type="hidden" name="submit-type" value="clear-error" />
294
  </div>
295
+ <p><input type="submit" name="submit" value="<?php _e("Clear 'WP to Twitter' Error Messages"); ?>" />
296
  </p>
297
  </form>
298
  <?php
300
  ?>
301
 
302
  <form method="post" action="">
303
+
304
+
305
  <div>
306
  <fieldset>
307
  <legend><?php _e("Wordpress to Twitter Publishing Options"); ?></legend>
315
  </p>
316
  <p>
317
  <input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
318
+ <label for="newpost-published-update"><strong><?php _e("Update when a post is published"); ?></strong></label> <label for="newpost-published-text"><br /><?php _e("Text for new post updates:"); ?></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' ) ) ) ?>" />
 
 
 
 
319
  &nbsp;&nbsp;
320
  <input type="checkbox" name="newpost-published-showlink" id="newpost-published-showlink" value="1" <?php jd_checkCheckbox('newpost-published-showlink')?> />
321
  <label for="newpost-published-showlink"><?php _e("Provide link to blog?"); ?></label>
323
 
324
  <p>
325
  <input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
326
+ <label for="oldpost-edited-update"><strong><?php _e("Update when a post is edited"); ?></strong></label><br /><label for="oldpost-edited-text"><?php _e("Text for editing updates:"); ?></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' ) ) ) ?>" />
 
 
 
 
327
  &nbsp;&nbsp;
328
  <input type="checkbox" name="oldpost-edited-showlink" id="oldpost-edited-showlink" value="1" <?php jd_checkCheckbox('oldpost-edited-showlink')?> />
329
  <label for="oldpost-edited-showlink"><?php _e("Provide link to blog?"); ?></label>
330
  </p>
 
331
  <p>
332
+ <input type="checkbox" name="use_tags_as_hashtags" id="use_tags_as_hashtags" value="1" <?php jd_checkCheckbox('use_tags_as_hashtags')?> />
333
+ <label for="use_tags_as_hashtags"><strong><?php _e("Add tags as hashtags on Tweets"); ?></strong></label>
334
  </p>
335
  <p>
336
+ <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
337
+ <label for="oldpost-edited-update"><strong><?php _e("Update Twitter when you post a Blogroll link"); ?></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"); ?></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"); ?></label><br /><label for="newlink-published-text"><?php _e("Text for new link updates (used if title/description isn't available.):"); ?></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' ) ) ) ?>" />
 
 
 
 
338
  </p>
339
 
340
  <p>
352
  </p>
353
 
354
  <p>
355
+ <label for="jd_twit_prepend"><?php _e("Custom text prepended to Tweets:"); ?></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' ) ) ) ?>" />
 
356
  </p>
357
 
358
  <p>
359
+ <label for="jd_twit_append"><?php _e("Custom text appended to Tweets:"); ?></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' ) ) ) ?>" />
 
360
  </p>
361
 
362
  <p>
363
+ <label for="jd_twit_custom_url"><?php _e("Custom field for an alternate URL to be shortened and Tweeted:"); ?></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 />
 
364
  <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."); ?></small>
365
  </p>
 
 
 
 
 
366
  <p>
367
  <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
368
+ <label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter"); ?></strong></label><br />
369
+ <label for="twitter-analytics-campaign"><?php _e("Campaign identifier for Google Analytics:"); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br />
370
+ <small><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here."); ?></small>
371
  </p>
372
+
373
  <p>
374
  <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
375
  <label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts"); ?></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.'); ?></small>
376
  </p>
377
 
378
+
379
+ <p>
380
+ <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."); ?></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."); ?></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."); ?></label>
381
+ </p>
382
  <div>
383
  <input type="hidden" name="submit-type" value="options" />
384
  </div>
385
  <input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options"); ?>" class="button-primary" />
386
  </fieldset>
387
+
388
  </div>
389
  </form>
390
 
391
  <h2 class="twitter"><?php _e("Your Twitter account details"); ?></h2>
392
 
393
  <form method="post" action="" >
394
+
395
+
396
  <div>
397
  <p>
398
  <label for="twitterlogin"><?php _e("Your Twitter username:"); ?></label>
399
+ <input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo ( attribute_escape( get_option( 'twitterlogin' ) ) ) ?>" />
400
  </p>
401
  <p>
402
  <label for="twitterpw"><?php _e("Your Twitter password:"); ?></label>
410
  <h2 class="cligs"><?php _e("Your Cli.gs account details"); ?></h2>
411
 
412
  <form method="post" action="">
413
+
414
+
415
  <div>
416
  <p>
417
  <label for="cligsapi"><?php _e("Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"); ?></label>
418
+ <input type="text" name="cligsapi" id="cligsapi" size="40" value="<?php echo ( attribute_escape( get_option( 'cligsapi' ) ) ) ?>" />
419
  </p>
420
  <div>
421
  <input type="hidden" name="submit-type" value="cligsapi" />
423
  <p><input type="submit" name="submit" value="Save Cli.gs API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Cli.gs API Key" />&raquo; <small><?php _e("Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/api/'>Get one free here</a>!<br />You'll need an API key in order to associate the Cligs you create with your Cligs account."); ?></small></p>
424
  </div>
425
  </form>
426
+
427
+
428
+ <h2 class="bitly"><?php _e("Your Bit.ly account details"); ?></h2>
429
+
430
+ <form method="post" action="">
431
+
432
+ <div>
433
+ <p>
434
+ <label for="bitlylogin"><?php _e("Your Bit.ly username:"); ?></label>
435
+ <input type="text" name="bitlylogin" id="bitlylogin" value="<?php echo ( attribute_escape( get_option( 'bitlylogin' ) ) ) ?>" />
436
+ </p>
437
+ <p>
438
+ <label for="bitlyapi"><?php _e("Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"); ?></label>
439
+ <input type="text" name="bitlyapi" id="bitlyapi" size="40" value="<?php echo ( attribute_escape( get_option( 'bitlyapi' ) ) ) ?>" />
440
+ </p>
441
+
442
+ <div>
443
+ <input type="hidden" name="submit-type" value="bitlyapi" />
444
+ </div>
445
+ <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>
446
+ </div>
447
+ </form>
448
  </div>
449
 
450
  <form method="post" action="">
451
+
452
+
453
  <div>
454
  <input type="hidden" name="submit-type" value="check-support" />
455
  <p>
456
+ <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>
457
  </p>
458
  </div>
459
  </form>
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.3.7
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
@@ -25,11 +25,12 @@ Author URI: http://www.joedolson.com/
25
  */
26
  // Reporting E_NOTICE can be good too (to report uninitialized
27
  // variables or catch variable name misspellings ...)
 
28
  global $wp_version,$version,$jd_plugin_url;
29
 
30
  define('JDWP_API_POST_STATUS', 'http://twitter.com/statuses/update.json');
31
 
32
- $version = "1.3.7";
33
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
34
 
35
  require_once( ABSPATH.WPINC.'/class-snoopy.php' );
@@ -183,24 +184,29 @@ $at_append = "";
183
  $title_length = strlen( $thisposttitle );
184
  $blog_length = strlen( $thisblogtitle );
185
  if ( ( ( $twit_length + $title_length ) - 7 ) < 140 ) {
186
- $sentence = str_replace( '#title#', $thisposttitle, $sentence );
187
  $twit_length = strlen( $sentence );
188
  } else {
189
  $thisposttitle = substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . "...";
190
- $sentence = str_replace ( '#title#', $thisposttitle, $sentence );
191
  $twit_length = strlen( $sentence );
192
  }
193
  if ( ( ( $twit_length + $blog_length ) - 6 ) < 140 ) {
194
- $sentence = str_replace ( '#blog#',$thisblogtitle,$sentence );
195
  $twit_length = strlen( $sentence );
196
  } else {
197
  $thisblogtitle = substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . "...";
198
- $sentence = str_replace ( '#blog#',$thisblogtitle,$sentence );
199
  }
200
  return $sentence;
201
  }
202
 
203
- function jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi ) {
 
 
 
 
 
204
  $snoopy = new Snoopy;
205
 
206
  if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
@@ -214,25 +220,44 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi ) {
214
  }
215
  // Generate and grab the clig using the Cli.gs API
216
  // cURL alternative contributed by Thor Erik (http://thorerik.net)
217
- if ( $snoopy->fetchtext( "http://cli.gs/api/v1/cligs/create?t=snoopy&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi ) ) {
218
- $shrink = $snoopy->results;
219
- } else {
220
- $shrink = @file_get_contents( "http://cli.gs/api/v1/cligs/create?t=fgc&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
221
- }
222
- if ( $shrink === FALSE ) {
223
- $shrink = getfilefromurl( "http://cli.gs/api/v1/cligs/create?t=gffu&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
224
- }
225
- if ( stristr( $shrink, "http://" ) === FALSE ) {
226
- $shrink = FALSE;
227
  }
228
- if ( $shrink === FALSE) {
229
- update_option('wp_cligs_failure','1');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  $shrink = $thispostlink;
231
  }
232
  return $shrink;
233
  }
234
 
235
- function jd_twit( $post_ID ) {
 
236
 
237
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
238
  if ( $jd_tweet_this == "yes" ) {
@@ -248,8 +273,7 @@ function jd_twit( $post_ID ) {
248
  $sentence = '';
249
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
250
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
251
-
252
- if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft')) {
253
  // publish new post
254
  if ( get_option( 'newpost-published-update' ) == '1' ) {
255
  $sentence = stripcslashes( get_option( 'newpost-published-text' ) );
@@ -261,18 +285,18 @@ function jd_twit( $post_ID ) {
261
  }
262
 
263
  //$sentence = $sentence . " " . $shrink;
264
- if ( strpos( $sentence, "#url#" ) === FALSE ) {
265
  $sentence = $sentence . " " . $shrink;
266
  } else {
267
- $sentence = str_replace( "#url#", $shrink, $sentence );
268
  }
269
 
270
  if ( $customTweet != "" ) {
271
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
272
- if ( strpos( $customTweet, "#url#" ) === FALSE ) {
273
  $sentence = $customTweet . " " . $shrink;
274
  } else {
275
- $sentence = str_replace( "#url#", $shrink, $customTweet );
276
  }
277
  } else {
278
  $sentence = $customTweet;
@@ -280,53 +304,59 @@ function jd_twit( $post_ID ) {
280
  }
281
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
282
  // Stores the posts CLIG in a custom field for later use as needed.
283
- add_post_meta ( $post_ID, 'wp_jd_clig', $shrink );
284
- /* This is for testing. Creates a post meta field containing the Cli.gs API request string
285
- //add_post_meta($post_ID, 'post_cligs_text',"http://cli.gs/api/v1/cligs/create?url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi."&appid=WP-to-Twitter"); */
286
  } else {
287
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
288
  }
289
  }
290
- } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish'){
291
  // if this is an old post and editing updates are enabled
292
- if ( get_option( 'oldpost-edited-update') == '1' || get_option( 'jd_twit_edited_pages' ) == '1' ) {
293
  $sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
294
  if ( get_option( 'oldpost-edited-showlink') == '1') {
295
  if ( $oldClig != '' ) {
296
  $old_post_link = $oldClig;
297
  } else {
298
- $old_post_link = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
299
- add_post_meta ( $post_ID, 'wp_jd_clig', $old_post_link );
300
  }
301
- }
302
- $sentence = $sentence . " " . $old_post_link;
 
 
 
 
 
303
 
304
  if ( $customTweet != "" ) {
305
  if ( get_option( 'oldpost-edited-showlink') == '1' ) {
306
- if ( strpos( $customTweet, "#url#" ) === FALSE ) {
307
  $sentence = $customTweet . " " . $old_post_link;
308
  } else {
309
- $sentence = str_replace( "#url#", $old_post_link, $customTweet );
310
  }
311
  } else {
312
  $sentence = $customTweet;
313
  }
314
  }
315
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
316
-
317
- }
318
  }
319
 
320
- if ( $sentence != '' ) {
321
- $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
322
- if ($sendToTwitter === FALSE) {
323
- add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
324
- update_option('wp_twitter_failure','1');
325
- }
 
 
 
 
326
  }
327
-
328
- return $post_ID;
329
  }
 
330
  }
331
 
332
  // Add Tweets on links in Blogroll
@@ -337,7 +367,6 @@ global $version;
337
  $thislinkname = urlencode( stripcslashes( $_POST['link_name'] ) );
338
  $thispostlink = urlencode( $_POST['link_url'] ) ;
339
  $thislinkdescription = urlencode( stripcslashes( $_POST['link_description'] ) );
340
- $cligsapi = get_option( 'cligsapi' );
341
  $sentence = '';
342
 
343
  # || (get_option( 'jd-use-link-title' ) == '1' && $thislinkname == '')
@@ -355,12 +384,12 @@ global $version;
355
  }
356
  // Generate and grab the clig using the Cli.gs API
357
  // cURL alternative contributed by Thor Erik (http://thorerik.net)
358
- $shrink = jd_shorten_link( $thispostlink, $thislinkname, $cligsapi );
359
 
360
- if ( strpos($sentence,"#url#") === FALSE ) {
361
  $sentence = $sentence . " " . $shrink;
362
  } else {
363
- $sentence = str_replace("#url#",$shrink,$sentence);
364
  }
365
  if ( $sentence != '' ) {
366
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
@@ -384,20 +413,20 @@ function jd_twit_future( $post_ID ) {
384
  $post_status = $get_post_info->post_status;
385
 
386
  if ( $jd_tweet_this == "yes" ) {
 
387
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
388
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
389
  $authID = $get_post_info->post_author;
390
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
391
- $cligsapi = get_option( 'cligsapi' );
392
  $sentence = '';
393
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
394
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
395
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
396
- $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
397
- if ( strpos($sentence,"#url#") === FALSE ) {
398
  $sentence = $sentence . " " . $shrink;
399
  } else {
400
- $sentence = str_replace("#url#",$shrink,$sentence);
401
  }
402
  if ( $customTweet != "" ) {
403
  // Get the custom Tweet message if it's been supplied. Truncate it to fit if necessary.
@@ -411,20 +440,24 @@ function jd_twit_future( $post_ID ) {
411
  }
412
  }
413
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
414
- if ( strpos( $customTweet, "#url#" ) === FALSE ) {
415
  $sentence = $customTweet . " " . $shrink;
416
  } else {
417
- $sentence = str_replace( "#url#", $shrink, $customTweet );
418
  }
419
  } else {
420
  $sentence = $customTweet;
421
  }
422
  }
423
- $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID ); // Stores the posts CLIG in a custom field for later use as needed.
424
- add_post_meta( $post_ID, 'wp_jd_clig', $shrink );
425
- } else {
 
426
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
427
  }
 
 
 
428
  if ( $sentence != '' ) {
429
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
430
  if ($sendToTwitter === FALSE) {
@@ -447,23 +480,25 @@ function jd_twit_quickpress( $post_ID ) {
447
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
448
  $authID = $get_post_info->post_author;
449
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
450
- $cligsapi = get_option( 'cligsapi' );
451
  $sentence = '';
452
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
453
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
454
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
455
- $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
456
- if ( strpos($sentence,"#url#") === FALSE ) {
457
  $sentence = $sentence . " " . $shrink;
458
  } else {
459
- $sentence = str_replace("#url#",$shrink,$sentence);
460
  }
461
  $sentence = jd_truncate_tweet($sentence, $thisposttitle, $thisblogtitle, $authID);
462
  // Stores the posts CLIG in a custom field for later use as needed.
463
- add_post_meta( $post_ID, 'wp_jd_clig', $shrink );
464
  } else {
465
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
466
  }
 
 
 
467
  if ( $sentence != '' ) {
468
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
469
  if ($sendToTwitter === FALSE) {
@@ -477,8 +512,8 @@ function jd_twit_quickpress( $post_ID ) {
477
  // HANDLES xmlrpc POSTS
478
  function jd_twit_xmlrpc( $post_ID ) {
479
  $get_post_info = get_post( $post_ID );
480
- $post_status = $get_post_info->post_status;
481
-
482
  if ( get_option('oldpost-edited-update') != 1 && get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != '' ) {
483
  return;
484
  } else {
@@ -487,24 +522,27 @@ function jd_twit_xmlrpc( $post_ID ) {
487
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
488
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
489
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
490
- $cligsapi = get_option( 'cligsapi' );
491
  $sentence = '';
492
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
493
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
494
- $shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
495
- if ( strpos($sentence,"#url#") === FALSE) {
496
  $sentence = $sentence . " " . $shrink;
497
  } else {
498
- $sentence = str_replace("#url#",$shrink,$sentence);
499
  }
500
  // Check the length of the tweet and truncate parts as necessary.
501
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
502
  // Stores the posts CLIG in a custom field for later use as needed.
503
- add_post_meta ( $post_ID, 'wp_jd_clig', $shrink );
504
  } else {
505
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
506
  }
 
 
 
507
  if ( $sentence != '' ) {
 
508
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
509
  if ($sendToTwitter === FALSE) {
510
  add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
@@ -518,6 +556,37 @@ function jd_twit_xmlrpc( $post_ID ) {
518
  // NEW IF ADD
519
  add_action('admin_menu','jd_add_twitter_outer_box');
520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
521
  function jd_add_twitter_old_box() {
522
  ?>
523
 
@@ -561,13 +630,13 @@ cntfield.value = field.value.length;
561
  <p>
562
  <label for="jd_twitter"><?php _e('Twitter Post', 'wp-to-twitter') ?></label><br /><textarea style="width:95%;" name="jd_twitter" id="jd_twitter" rows="2" cols="60"
563
  onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
564
- onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo $jd_twitter ?></textarea>
565
  </p>
566
- <p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo strlen( $description); ?>" />
567
  <?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>, or <code>#blog#</code> to insert the shortened URL, post title, or blog name into the Tweet.', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter') ?></a> &raquo;
568
  </p>
569
  <p>
570
- <input type="checkbox" name="jd_tweet_this" value="no"<?php echo $jd_selected; ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post."); ?></label>
571
  </p>
572
  <?php if ($jd_clig != "") { ?>
573
  <p>
@@ -630,7 +699,7 @@ function jd_twitter_profile() {
630
  </tr>
631
  <tr>
632
  <th scope="row"><label for="wp-to-twitter-user-username"><?php _e('Your Twitter Username'); ?></label></th>
633
- <td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo $twitter_username; ?>" /> <?php _e('Enter your own Twitter username.'); ?></td>
634
  </tr>
635
  <tr>
636
  <th scope="row"><label for="wp-to-twitter-user-password"><?php _e('Your Twitter Password'); ?></label></th>
@@ -665,7 +734,7 @@ function jd_addTwitterAdminStyles() {
665
  <style type=\"text/css\">
666
  <!--
667
  #wp-to-twitter h2 {
668
- background: #fff url(http://dev.joedolson.com/wp-2.7/wp-content/plugins/wp-to-twitter/wp-to-twitter-logo.png) right center no-repeat;
669
  padding: 16px 2px;
670
  margin: 25px 0;
671
  border: 1px solid #ddd;
@@ -691,13 +760,11 @@ border: none;
691
  .floatright {
692
  float: right;
693
  }
694
- .cligs {
695
- background: #fff url($wp_to_twitter_directory/cligs.png) right 50% no-repeat;
696
  padding: 2px!important;
697
  margin-top: 1.5em!important;
698
  }
699
  .twitter {
700
- background: url($wp_to_twitter_directory/twitter.png) right 50% no-repeat;
701
  padding: 2px!important;
702
  margin-top: 1.5em!important;
703
  }
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.0
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
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
  define('JDWP_API_POST_STATUS', 'http://twitter.com/statuses/update.json');
32
 
33
+ $version = "1.4.0";
34
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
35
 
36
  require_once( ABSPATH.WPINC.'/class-snoopy.php' );
184
  $title_length = strlen( $thisposttitle );
185
  $blog_length = strlen( $thisblogtitle );
186
  if ( ( ( $twit_length + $title_length ) - 7 ) < 140 ) {
187
+ $sentence = str_ireplace( '#title#', $thisposttitle, $sentence );
188
  $twit_length = strlen( $sentence );
189
  } else {
190
  $thisposttitle = substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . "...";
191
+ $sentence = str_ireplace ( '#title#', $thisposttitle, $sentence );
192
  $twit_length = strlen( $sentence );
193
  }
194
  if ( ( ( $twit_length + $blog_length ) - 6 ) < 140 ) {
195
+ $sentence = str_ireplace ( '#blog#',$thisblogtitle,$sentence );
196
  $twit_length = strlen( $sentence );
197
  } else {
198
  $thisblogtitle = substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . "...";
199
+ $sentence = str_ireplace ( '#blog#',$thisblogtitle,$sentence );
200
  }
201
  return $sentence;
202
  }
203
 
204
+ function jd_shorten_link( $thispostlink, $thisposttitle ) {
205
+
206
+ $cligsapi = get_option( 'cligsapi' );
207
+ $bitlyapi = get_option( 'bitlyapi' );
208
+ $bitlylogin = get_option( 'bitlylogin' );
209
+
210
  $snoopy = new Snoopy;
211
 
212
  if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
220
  }
221
  // Generate and grab the clig using the Cli.gs API
222
  // cURL alternative contributed by Thor Erik (http://thorerik.net)
223
+ switch ( get_option( 'jd_shortener' ) ) {
224
+ case 0:
225
+ case 1:
226
+ if ( $snoopy->fetchtext( "http://cli.gs/api/v1/cligs/create?t=snoopy&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi ) ) {
227
+ $shrink = trim($snoopy->results);
228
+ } else {
229
+ $shrink = @file_get_contents( "http://cli.gs/api/v1/cligs/create?t=fgc&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
 
 
 
230
  }
231
+ if ( $shrink === FALSE ) {
232
+ $shrink = getfilefromurl( "http://cli.gs/api/v1/cligs/create?t=gffu&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
233
+ }
234
+ break;
235
+ case 2:
236
+ if ( $snoopy->fetch( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" ) ) {
237
+ $shrink = $snoopy->results;
238
+ } else {
239
+ $shrink = @file_get_contents( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
240
+ }
241
+ if ( $shrink === FALSE ) {
242
+ $shrink = getfilefromurl( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
243
+ }
244
+
245
+ $decoded = json_decode($shrink,TRUE);
246
+ $shrink = $decoded['results'][urldecode($thispostlink)]['shortUrl'];
247
+ //die(print_r($decoded['results'][urldecode($thispostlink)]));
248
+ break;
249
+ case 3:
250
+ $shrink = $thispostlink;
251
+ }
252
+ if ( $shrink === FALSE || ( stristr( $shrink, "http://" ) === FALSE )) {
253
+ update_option( 'wp_url_failure','1' );
254
  $shrink = $thispostlink;
255
  }
256
  return $shrink;
257
  }
258
 
259
+
260
+ function jd_twit( $post_ID ) {
261
 
262
  $jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
263
  if ( $jd_tweet_this == "yes" ) {
273
  $sentence = '';
274
  $customTweet = stripcslashes( $_POST['jd_twitter'] );
275
  $oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
276
+ if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft')) {
 
277
  // publish new post
278
  if ( get_option( 'newpost-published-update' ) == '1' ) {
279
  $sentence = stripcslashes( get_option( 'newpost-published-text' ) );
285
  }
286
 
287
  //$sentence = $sentence . " " . $shrink;
288
+ if ( stripos( $sentence, "#url#" ) === FALSE ) {
289
  $sentence = $sentence . " " . $shrink;
290
  } else {
291
+ $sentence = str_ireplace( "#url#", $shrink, $sentence );
292
  }
293
 
294
  if ( $customTweet != "" ) {
295
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
296
+ if ( stripos( $customTweet, "#url#" ) === FALSE ) {
297
  $sentence = $customTweet . " " . $shrink;
298
  } else {
299
+ $sentence = str_ireplace( "#url#", $shrink, $customTweet );
300
  }
301
  } else {
302
  $sentence = $customTweet;
304
  }
305
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
306
  // Stores the posts CLIG in a custom field for later use as needed.
307
+ store_url( $post_ID, $shrink );
308
+
 
309
  } else {
310
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
311
  }
312
  }
313
+ } else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish') {
314
  // if this is an old post and editing updates are enabled
315
+ if ( get_option( 'oldpost-edited-update') == '1' || get_option( 'jd_twit_edited_pages' ) == '1' ) {
316
  $sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
317
  if ( get_option( 'oldpost-edited-showlink') == '1') {
318
  if ( $oldClig != '' ) {
319
  $old_post_link = $oldClig;
320
  } else {
321
+ $old_post_link = jd_shorten_link( $thispostlink, $thisposttitle );
 
322
  }
323
+ store_url( $post_ID, $old_post_link );
324
+
325
+ if ( stripos( $sentence, "#url#" ) === FALSE ) {
326
+ $sentence = $sentence . " " . $old_post_link;
327
+ } else {
328
+ $sentence = str_ireplace( "#url#", $old_post_link, $sentence );
329
+ }
330
 
331
  if ( $customTweet != "" ) {
332
  if ( get_option( 'oldpost-edited-showlink') == '1' ) {
333
+ if ( stripos( $customTweet, "#url#" ) === FALSE ) {
334
  $sentence = $customTweet . " " . $old_post_link;
335
  } else {
336
+ $sentence = str_ireplace( "#url#", $old_post_link, $customTweet );
337
  }
338
  } else {
339
  $sentence = $customTweet;
340
  }
341
  }
342
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
343
+ }
 
344
  }
345
 
346
+ }
347
+ if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
348
+ $sentence = $sentence . " " . generate_hash_tags( $post_ID );
349
+ }
350
+
351
+ if ( $sentence != '' ) {
352
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
353
+ if ( $sendToTwitter === FALSE ) {
354
+ add_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
355
+ update_option( 'wp_twitter_failure','1' );
356
  }
357
+ }
 
358
  }
359
+ return $post_ID;
360
  }
361
 
362
  // Add Tweets on links in Blogroll
367
  $thislinkname = urlencode( stripcslashes( $_POST['link_name'] ) );
368
  $thispostlink = urlencode( $_POST['link_url'] ) ;
369
  $thislinkdescription = urlencode( stripcslashes( $_POST['link_description'] ) );
 
370
  $sentence = '';
371
 
372
  # || (get_option( 'jd-use-link-title' ) == '1' && $thislinkname == '')
384
  }
385
  // Generate and grab the clig using the Cli.gs API
386
  // cURL alternative contributed by Thor Erik (http://thorerik.net)
387
+ $shrink = jd_shorten_link( $thispostlink, $thislinkname );
388
 
389
+ if ( stripos($sentence,"#url#") === FALSE ) {
390
  $sentence = $sentence . " " . $shrink;
391
  } else {
392
+ $sentence = str_ireplace("#url#",$shrink,$sentence);
393
  }
394
  if ( $sentence != '' ) {
395
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
413
  $post_status = $get_post_info->post_status;
414
 
415
  if ( $jd_tweet_this == "yes" ) {
416
+
417
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
418
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
419
  $authID = $get_post_info->post_author;
420
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
 
421
  $sentence = '';
422
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
423
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
424
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
425
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
426
+ if ( stripos($sentence,"#url#") === FALSE ) {
427
  $sentence = $sentence . " " . $shrink;
428
  } else {
429
+ $sentence = str_ireplace("#url#",$shrink,$sentence);
430
  }
431
  if ( $customTweet != "" ) {
432
  // Get the custom Tweet message if it's been supplied. Truncate it to fit if necessary.
440
  }
441
  }
442
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
443
+ if ( stripos( $customTweet, "#url#" ) === FALSE ) {
444
  $sentence = $customTweet . " " . $shrink;
445
  } else {
446
+ $sentence = str_ireplace( "#url#", $shrink, $customTweet );
447
  }
448
  } else {
449
  $sentence = $customTweet;
450
  }
451
  }
452
+ $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
453
+ // Stores the post's short URL in a custom field for later use as needed.
454
+ store_url($post_ID, $shrink);
455
+ } else {
456
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
457
  }
458
+ if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
459
+ $sentence = $sentence . " " . generate_hash_tags( $post_ID );
460
+ }
461
  if ( $sentence != '' ) {
462
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
463
  if ($sendToTwitter === FALSE) {
480
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
481
  $authID = $get_post_info->post_author;
482
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
 
483
  $sentence = '';
484
  $customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
485
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
486
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
487
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
488
+ if ( stripos($sentence,"#url#") === FALSE ) {
489
  $sentence = $sentence . " " . $shrink;
490
  } else {
491
+ $sentence = str_ireplace("#url#",$shrink,$sentence);
492
  }
493
  $sentence = jd_truncate_tweet($sentence, $thisposttitle, $thisblogtitle, $authID);
494
  // Stores the posts CLIG in a custom field for later use as needed.
495
+ store_url($post_ID, $shrink);
496
  } else {
497
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
498
  }
499
+ if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
500
+ $sentence = $sentence . " " . generate_hash_tags( $post_ID );
501
+ }
502
  if ( $sentence != '' ) {
503
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
504
  if ($sendToTwitter === FALSE) {
512
  // HANDLES xmlrpc POSTS
513
  function jd_twit_xmlrpc( $post_ID ) {
514
  $get_post_info = get_post( $post_ID );
515
+ $post_status = $get_post_info->post_status;
516
+
517
  if ( get_option('oldpost-edited-update') != 1 && get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != '' ) {
518
  return;
519
  } else {
522
  $thispostlink = urlencode( external_or_permalink( $post_ID ) );
523
  $thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
524
  $thisblogtitle = urlencode( get_bloginfo( 'name' ) );
 
525
  $sentence = '';
526
  $sentence = stripcslashes(get_option( 'newpost-published-text' ));
527
  if ( get_option( 'newpost-published-showlink' ) == '1' ) {
528
+ $shrink = jd_shorten_link( $thispostlink, $thisposttitle );
529
+ if ( stripos($sentence,"#url#") === FALSE) {
530
  $sentence = $sentence . " " . $shrink;
531
  } else {
532
+ $sentence = str_ireplace("#url#",$shrink,$sentence);
533
  }
534
  // Check the length of the tweet and truncate parts as necessary.
535
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
536
  // Stores the posts CLIG in a custom field for later use as needed.
537
+ store_url($post_ID, $shrink);
538
  } else {
539
  $sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
540
  }
541
+ if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
542
+ $sentence = $sentence . " " . generate_hash_tags( $post_ID );
543
+ }
544
  if ( $sentence != '' ) {
545
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
546
  $sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
547
  if ($sendToTwitter === FALSE) {
548
  add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
556
  // NEW IF ADD
557
  add_action('admin_menu','jd_add_twitter_outer_box');
558
 
559
+ function store_url($post_ID, $url) {
560
+ if ( get_option( 'jd_shortener' ) == 0 || get_option( 'jd_shortener' ) == 1) {
561
+ if ( get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != $url ) {
562
+ add_post_meta ( $post_ID, 'wp_jd_clig', $url );
563
+ }
564
+ } elseif ( get_option( 'jd_shortener' ) == 2 ) {
565
+ if ( get_post_meta ( $post_ID, 'wp_jd_bitly', TRUE ) != $url ) {
566
+ add_post_meta ( $post_ID, 'wp_jd_bitly', $url );
567
+ }
568
+ }
569
+ }
570
+
571
+ function generate_hash_tags($post_ID) {
572
+ if ( version_compare( $wp_version,"2.8",">=" )) {
573
+ $tags = $_POST['tax_input']['post_tag'] . "," . $_POST['newtag']['post_tag'];
574
+ } else {
575
+ $tags = $_POST['tags_input'];
576
+ }
577
+ $tags = explode(",",$tags);
578
+ foreach ($tags as $value) {
579
+ $value = trim($value);
580
+ if ($value != "Add new tag") {
581
+ $hashtags .= "#$value ";
582
+ }
583
+ }
584
+ if (strlen($hashtags) <= 1) {
585
+ $hashtags = "";
586
+ }
587
+ return $hashtags;
588
+ }
589
+
590
  function jd_add_twitter_old_box() {
591
  ?>
592
 
630
  <p>
631
  <label for="jd_twitter"><?php _e('Twitter Post', 'wp-to-twitter') ?></label><br /><textarea style="width:95%;" name="jd_twitter" id="jd_twitter" rows="2" cols="60"
632
  onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
633
+ onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo attribute_escape( $jd_twitter ); ?></textarea>
634
  </p>
635
+ <p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo attribute_escape( strlen( $description) ); ?>" />
636
  <?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>, or <code>#blog#</code> to insert the shortened URL, post title, or blog name into the Tweet.', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter') ?></a> &raquo;
637
  </p>
638
  <p>
639
+ <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."); ?></label>
640
  </p>
641
  <?php if ($jd_clig != "") { ?>
642
  <p>
699
  </tr>
700
  <tr>
701
  <th scope="row"><label for="wp-to-twitter-user-username"><?php _e('Your Twitter Username'); ?></label></th>
702
+ <td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo attribute_escape( $twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.'); ?></td>
703
  </tr>
704
  <tr>
705
  <th scope="row"><label for="wp-to-twitter-user-password"><?php _e('Your Twitter Password'); ?></label></th>
734
  <style type=\"text/css\">
735
  <!--
736
  #wp-to-twitter h2 {
737
+ background: #fff url($wp_to_twitter_directory/wp-to-twitter-logo.png) right center no-repeat;
738
  padding: 16px 2px;
739
  margin: 25px 0;
740
  border: 1px solid #ddd;
760
  .floatright {
761
  float: right;
762
  }
763
+ .cligs, .bitly {
 
764
  padding: 2px!important;
765
  margin-top: 1.5em!important;
766
  }
767
  .twitter {
 
768
  padding: 2px!important;
769
  margin-top: 1.5em!important;
770
  }
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-06-02 18:29+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,114 +16,155 @@ msgstr ""
16
  "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
- #: wp-to-twitter-manager.php:54
20
- msgid "Set your Twitter login information and Cli.gs API to use this plugin! "
 
 
21
  msgstr ""
22
 
23
- #: wp-to-twitter-manager.php:57
24
  msgid "Please add your Twitter password. "
25
  msgstr ""
26
 
27
- #: wp-to-twitter-manager.php:63
28
  msgid "WP to Twitter Errors Cleared"
29
  msgstr ""
30
 
31
- #: wp-to-twitter-manager.php:69
32
  msgid ""
33
- "Cli.gs request failed! We couldn't shrink that URL, so we attached the "
34
- "normal URL to your Tweet. Check the <a href='http://blog.cli.gs'>Cli.gs "
35
- "blog</a> to see if there are any known issues. "
 
36
  msgstr ""
37
 
38
- #: wp-to-twitter-manager.php:73
39
  msgid ""
40
  "Sorry! I couldn't get in touch with the Twitter servers to post your new "
41
  "blog post. Your tweet has been stored in a custom field attached to the "
42
  "post, so you can Tweet it manually if you wish! "
43
  msgstr ""
44
 
45
- #: wp-to-twitter-manager.php:75
46
  msgid ""
47
  "Sorry! I couldn't get in touch with the Twitter servers to post your "
48
  "<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
49
  msgstr ""
50
 
51
- #: wp-to-twitter-manager.php:125
52
  msgid "Twitter login and password updated. "
53
  msgstr ""
54
 
55
- #: wp-to-twitter-manager.php:127
56
  msgid "You need to provide your twitter login and password! "
57
  msgstr ""
58
 
59
- #: wp-to-twitter-manager.php:132
60
  msgid "Cligs API Key Updated"
61
  msgstr ""
62
 
63
- #: wp-to-twitter-manager.php:135
64
  msgid ""
65
  "Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be "
66
  "associated with your account. "
67
  msgstr ""
68
 
69
- #: wp-to-twitter-manager.php:137
70
  msgid ""
71
  "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</"
72
  "a>! "
73
  msgstr ""
74
 
75
- #: wp-to-twitter-manager.php:157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  msgid "Successfully contacted the Cli.gs API. "
77
  msgstr ""
78
 
79
- #: wp-to-twitter-manager.php:160
80
  msgid "Failed to contact the Cli.gs API. "
81
  msgstr ""
82
 
83
- #: wp-to-twitter-manager.php:164
 
 
 
 
 
 
 
 
84
  msgid "Successfully contacted the Twitter API. "
85
  msgstr ""
86
 
87
- #: wp-to-twitter-manager.php:166
88
  msgid "Failed to contact the Twitter API. "
89
  msgstr ""
90
 
91
- #: wp-to-twitter-manager.php:170
92
  msgid ""
93
  "Your server appears to support the required PHP functions and classes for WP "
94
  "to Twitter to function."
95
  msgstr ""
96
 
97
- #: wp-to-twitter-manager.php:175
98
  msgid "Your server does not support <code>fputs</code>."
99
  msgstr ""
100
 
101
- #: wp-to-twitter-manager.php:179
102
  msgid ""
103
  "Your server does not support <code>file_get_contents</code> or <code>cURL</"
104
  "code> functions."
105
  msgstr ""
106
 
107
- #: wp-to-twitter-manager.php:183
108
  msgid "Your server does not support <code>Snoopy</code>."
109
  msgstr ""
110
 
111
- #: wp-to-twitter-manager.php:186
112
  msgid ""
113
  "Your server does not appear to support the required PHP functions and "
114
  "classes for WP to Twitter to function. You can try it anyway - these tests "
115
  "aren't perfect - but no guarantees."
116
  msgstr ""
117
 
118
- #: wp-to-twitter-manager.php:195
119
  msgid "This plugin may not work in your server environment."
120
  msgstr ""
121
 
122
- #: wp-to-twitter-manager.php:206
123
  msgid "WP to Twitter Options"
124
  msgstr ""
125
 
126
- #: wp-to-twitter-manager.php:208
127
  msgid ""
128
  "For any update field, you can use the codes <code>#title#</code> for the "
129
  "title of your blog post, <code>#blog#</code> for the title of your blog, or "
@@ -131,180 +172,209 @@ msgid ""
131
  "you may not want to include your blog title."
132
  msgstr ""
133
 
134
- #: wp-to-twitter-manager.php:215
135
  msgid ""
136
  "One or more of your last posts has failed to send it's status update to "
137
  "Twitter. Your Tweet has been saved in the custom meta data for your post, "
138
  "and you can re-Tweet it at your leisure."
139
  msgstr ""
140
 
141
- #: wp-to-twitter-manager.php:218
142
  msgid ""
143
- "The query to the Cli.gs API failed, and your URL was not shrunk. The normal "
144
- "post URL was attached to your Tweet."
145
- msgstr ""
146
-
147
- #: wp-to-twitter-manager.php:228
148
- msgid "Clear 'WP to Twitter' Error"
149
  msgstr ""
150
 
151
- #: wp-to-twitter-manager.php:228
152
- msgid "Why are you seeing this field?"
153
  msgstr ""
154
 
155
- #: wp-to-twitter-manager.php:238
156
  msgid "Wordpress to Twitter Publishing Options"
157
  msgstr ""
158
 
159
- #: wp-to-twitter-manager.php:241
160
  msgid "Update Twitter when new Wordpress Pages are published"
161
  msgstr ""
162
 
163
- #: wp-to-twitter-manager.php:245
164
  msgid "Update Twitter when WordPress Pages are edited"
165
  msgstr ""
166
 
167
- #: wp-to-twitter-manager.php:249
168
- msgid "Update Twitter when a new post is published"
169
  msgstr ""
170
 
171
- #: wp-to-twitter-manager.php:252
172
- msgid "Text for this Twitter update"
173
  msgstr ""
174
 
175
- #: wp-to-twitter-manager.php:256 wp-to-twitter-manager.php:268
176
  msgid "Provide link to blog?"
177
  msgstr ""
178
 
179
- #: wp-to-twitter-manager.php:261
180
- msgid "Update Twitter when an old post has been edited"
181
  msgstr ""
182
 
183
- #: wp-to-twitter-manager.php:273
 
 
 
 
 
 
 
 
184
  msgid "Update Twitter when you post a Blogroll link"
185
  msgstr ""
186
 
187
- #: wp-to-twitter-manager.php:276
188
  msgid "Use <strong>link title</strong> for Twitter updates"
189
  msgstr ""
190
 
191
- #: wp-to-twitter-manager.php:276
192
  msgid "Use <strong>link description</strong> for Twitter updates"
193
  msgstr ""
194
 
195
- #: wp-to-twitter-manager.php:280
196
- msgid "Text for this Twitter update (used if above choice isn't available.)"
197
  msgstr ""
198
 
199
- #: wp-to-twitter-manager.php:286
200
  msgid "Set default Tweet status to 'No.'"
201
  msgstr ""
202
 
203
- #: wp-to-twitter-manager.php:287
204
  msgid ""
205
  "Twitter updates can be set on a post by post basis. By default, posts WILL "
206
  "be posted to Twitter. Check this to change the default to NO."
207
  msgstr ""
208
 
209
- #: wp-to-twitter-manager.php:291
210
  msgid ""
211
  "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
212
  msgstr ""
213
 
214
- #: wp-to-twitter-manager.php:295
215
  msgid "Update Twitter when a post is published using QuickPress"
216
  msgstr ""
217
 
218
- #: wp-to-twitter-manager.php:299
219
- msgid "Custom text to be prepended on every Tweet"
220
  msgstr ""
221
 
222
- #: wp-to-twitter-manager.php:304
223
- msgid "Custom text to be appended on every Tweet"
224
  msgstr ""
225
 
226
- #: wp-to-twitter-manager.php:309
227
- msgid "Custom field containing an alternate URL to be shortened and Tweeted."
228
  msgstr ""
229
 
230
- #: wp-to-twitter-manager.php:311
231
  msgid ""
232
  "You can use a custom field to send Cli.gs and Twitter an alternate URL from "
233
  "the permalink provided by WordPress. The value is the name of the custom "
234
  "field you're using to add an external URL."
235
  msgstr ""
236
 
237
- #: wp-to-twitter-manager.php:314
238
- msgid "Campaign identifier for Google Analytics"
239
  msgstr ""
240
 
241
- #: wp-to-twitter-manager.php:316
 
 
 
 
242
  msgid ""
243
  "You can track the response from Twitter using Google Analytics by defining a "
244
  "campaign identifier here."
245
  msgstr ""
246
 
247
- #: wp-to-twitter-manager.php:320
248
- msgid "Use Google Analytics with WP-to-Twitter"
249
- msgstr ""
250
-
251
- #: wp-to-twitter-manager.php:324
252
  msgid "Authors have individual Twitter accounts"
253
  msgstr ""
254
 
255
- #: wp-to-twitter-manager.php:324
256
  msgid ""
257
  "Each author can set their own Twitter username and password in their user "
258
  "profile. Their posts will be sent to their own Twitter accounts."
259
  msgstr ""
260
 
261
- #: wp-to-twitter-manager.php:330
 
 
 
 
 
 
 
 
 
 
 
 
262
  msgid "Save WP->Twitter Options"
263
  msgstr ""
264
 
265
- #: wp-to-twitter-manager.php:336
266
  msgid "Your Twitter account details"
267
  msgstr ""
268
 
269
- #: wp-to-twitter-manager.php:341
270
  msgid "Your Twitter username:"
271
  msgstr ""
272
 
273
- #: wp-to-twitter-manager.php:345
274
  msgid "Your Twitter password:"
275
  msgstr ""
276
 
277
- #: wp-to-twitter-manager.php:349
278
  msgid "Save Twitter Login Info"
279
  msgstr ""
280
 
281
- #: wp-to-twitter-manager.php:349
282
  msgid ""
283
  "&raquo; <small>Don't have a Twitter account? <a href='http://www.twitter."
284
  "com'>Get one for free here</a>"
285
  msgstr ""
286
 
287
- #: wp-to-twitter-manager.php:353
288
  msgid "Your Cli.gs account details"
289
  msgstr ""
290
 
291
- #: wp-to-twitter-manager.php:358
292
  msgid ""
293
  "Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
294
  msgstr ""
295
 
296
- #: wp-to-twitter-manager.php:364
297
  msgid ""
298
  "Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/"
299
  "api/'>Get one free here</a>!<br />You'll need an API key in order to "
300
  "associate the Cligs you create with your Cligs account."
301
  msgstr ""
302
 
303
- #: wp-to-twitter-manager.php:382
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  msgid "Need help?"
305
  msgstr ""
306
 
307
- #: wp-to-twitter-manager.php:383
308
  msgid ""
309
  "Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to "
310
  "Twitter plugin page</a>."
@@ -312,15 +382,15 @@ msgstr ""
312
 
313
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
314
  #. Plugin Name of an extension
315
- #: wp-to-twitter.php:525
316
  msgid "WP to Twitter"
317
  msgstr ""
318
 
319
- #: wp-to-twitter.php:560
320
  msgid "Twitter Post"
321
  msgstr ""
322
 
323
- #: wp-to-twitter.php:565
324
  msgid ""
325
  " characters.<br />Twitter posts are a maximum of 140 characters; if your Cli."
326
  "gs URL is appended to the end of your document, you have 119 characters "
@@ -329,31 +399,57 @@ msgid ""
329
  "into the Tweet."
330
  msgstr ""
331
 
332
- #: wp-to-twitter.php:565
333
  msgid "Get Support"
334
  msgstr ""
335
 
336
- #: wp-to-twitter.php:568
337
  msgid "Don't Tweet this post."
338
  msgstr ""
339
 
340
- #: wp-to-twitter.php:620
341
  msgid "WP to Twitter User Settings"
342
  msgstr ""
343
 
344
- #: wp-to-twitter.php:624
345
  msgid "Use My Twitter Account"
346
  msgstr ""
347
 
348
- #: wp-to-twitter.php:630
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  msgid "Your Twitter Username"
350
  msgstr ""
351
 
352
- #: wp-to-twitter.php:634
 
 
 
 
353
  msgid "Your Twitter Password"
354
  msgstr ""
355
 
356
- #: wp-to-twitter.php:713
 
 
 
 
357
  msgid "Settings"
358
  msgstr ""
359
 
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-08-01 21:09+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
+ #: wp-to-twitter-manager.php:57
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:60
26
  msgid "Please add your Twitter password. "
27
  msgstr ""
28
 
29
+ #: wp-to-twitter-manager.php:66
30
  msgid "WP to Twitter Errors Cleared"
31
  msgstr ""
32
 
33
+ #: wp-to-twitter-manager.php:72
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 "
37
+ "if there are any known issues. [<a href=\"http://blog.cli.gs\">Cli.gs Blog</"
38
+ "a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]"
39
  msgstr ""
40
 
41
+ #: wp-to-twitter-manager.php:76
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:78
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. "
52
  msgstr ""
53
 
54
+ #: wp-to-twitter-manager.php:151
55
  msgid "Twitter login and password updated. "
56
  msgstr ""
57
 
58
+ #: wp-to-twitter-manager.php:153
59
  msgid "You need to provide your twitter login and password! "
60
  msgstr ""
61
 
62
+ #: wp-to-twitter-manager.php:158
63
  msgid "Cligs API Key Updated"
64
  msgstr ""
65
 
66
+ #: wp-to-twitter-manager.php:161
67
  msgid ""
68
  "Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be "
69
  "associated with your account. "
70
  msgstr ""
71
 
72
+ #: wp-to-twitter-manager.php:163
73
  msgid ""
74
  "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</"
75
  "a>! "
76
  msgstr ""
77
 
78
+ #: wp-to-twitter-manager.php:168
79
+ msgid "Bit.ly API Key Updated."
80
+ msgstr ""
81
+
82
+ #: wp-to-twitter-manager.php:171
83
+ msgid ""
84
+ "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
85
+ msgstr ""
86
+
87
+ #: wp-to-twitter-manager.php:173
88
+ msgid ""
89
+ "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</"
90
+ "a>! "
91
+ msgstr ""
92
+
93
+ #: wp-to-twitter-manager.php:177
94
+ msgid " Bit.ly User Login Updated."
95
+ msgstr ""
96
+
97
+ #: wp-to-twitter-manager.php:180
98
+ msgid ""
99
+ "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing "
100
+ "your username. "
101
+ msgstr ""
102
+
103
+ #: wp-to-twitter-manager.php:182
104
+ msgid ""
105
+ "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
106
+ msgstr ""
107
+
108
+ #: wp-to-twitter-manager.php:207
109
  msgid "Successfully contacted the Cli.gs API. "
110
  msgstr ""
111
 
112
+ #: wp-to-twitter-manager.php:210
113
  msgid "Failed to contact the Cli.gs API. "
114
  msgstr ""
115
 
116
+ #: wp-to-twitter-manager.php:216
117
+ msgid "Successfully contacted the Bit.ly API. "
118
+ msgstr ""
119
+
120
+ #: wp-to-twitter-manager.php:220
121
+ msgid "Failed to contact the Bit.ly API. "
122
+ msgstr ""
123
+
124
+ #: wp-to-twitter-manager.php:229
125
  msgid "Successfully contacted the Twitter API. "
126
  msgstr ""
127
 
128
+ #: wp-to-twitter-manager.php:231
129
  msgid "Failed to contact the Twitter API. "
130
  msgstr ""
131
 
132
+ #: wp-to-twitter-manager.php:235
133
  msgid ""
134
  "Your server appears to support the required PHP functions and classes for WP "
135
  "to Twitter to function."
136
  msgstr ""
137
 
138
+ #: wp-to-twitter-manager.php:240
139
  msgid "Your server does not support <code>fputs</code>."
140
  msgstr ""
141
 
142
+ #: wp-to-twitter-manager.php:244
143
  msgid ""
144
  "Your server does not support <code>file_get_contents</code> or <code>cURL</"
145
  "code> functions."
146
  msgstr ""
147
 
148
+ #: wp-to-twitter-manager.php:248
149
  msgid "Your server does not support <code>Snoopy</code>."
150
  msgstr ""
151
 
152
+ #: wp-to-twitter-manager.php:251
153
  msgid ""
154
  "Your server does not appear to support the required PHP functions and "
155
  "classes for WP to Twitter to function. You can try it anyway - these tests "
156
  "aren't perfect - but no guarantees."
157
  msgstr ""
158
 
159
+ #: wp-to-twitter-manager.php:260
160
  msgid "This plugin may not work in your server environment."
161
  msgstr ""
162
 
163
+ #: wp-to-twitter-manager.php:271
164
  msgid "WP to Twitter Options"
165
  msgstr ""
166
 
167
+ #: wp-to-twitter-manager.php:273
168
  msgid ""
169
  "For any update field, you can use the codes <code>#title#</code> for the "
170
  "title of your blog post, <code>#blog#</code> for the title of your blog, or "
172
  "you may not want to include your blog title."
173
  msgstr ""
174
 
175
+ #: wp-to-twitter-manager.php:280
176
  msgid ""
177
  "One or more of your last posts has failed to send it's status update to "
178
  "Twitter. Your Tweet has been saved in the custom meta data for your post, "
179
  "and you can re-Tweet it at your leisure."
180
  msgstr ""
181
 
182
+ #: wp-to-twitter-manager.php:283
183
  msgid ""
184
+ "The query to the URL shortener API failed, and your URL was not shrunk. The "
185
+ "full post URL was attached to your Tweet."
 
 
 
 
186
  msgstr ""
187
 
188
+ #: wp-to-twitter-manager.php:295
189
+ msgid "Clear 'WP to Twitter' Error Messages"
190
  msgstr ""
191
 
192
+ #: wp-to-twitter-manager.php:307
193
  msgid "Wordpress to Twitter Publishing Options"
194
  msgstr ""
195
 
196
+ #: wp-to-twitter-manager.php:310
197
  msgid "Update Twitter when new Wordpress Pages are published"
198
  msgstr ""
199
 
200
+ #: wp-to-twitter-manager.php:314
201
  msgid "Update Twitter when WordPress Pages are edited"
202
  msgstr ""
203
 
204
+ #: wp-to-twitter-manager.php:318
205
+ msgid "Update when a post is published"
206
  msgstr ""
207
 
208
+ #: wp-to-twitter-manager.php:318
209
+ msgid "Text for new post updates:"
210
  msgstr ""
211
 
212
+ #: wp-to-twitter-manager.php:321 wp-to-twitter-manager.php:329
213
  msgid "Provide link to blog?"
214
  msgstr ""
215
 
216
+ #: wp-to-twitter-manager.php:326
217
+ msgid "Update when a post is edited"
218
  msgstr ""
219
 
220
+ #: wp-to-twitter-manager.php:326
221
+ msgid "Text for editing updates:"
222
+ msgstr ""
223
+
224
+ #: wp-to-twitter-manager.php:333
225
+ msgid "Add tags as hashtags on Tweets"
226
+ msgstr ""
227
+
228
+ #: wp-to-twitter-manager.php:337
229
  msgid "Update Twitter when you post a Blogroll link"
230
  msgstr ""
231
 
232
+ #: wp-to-twitter-manager.php:337
233
  msgid "Use <strong>link title</strong> for Twitter updates"
234
  msgstr ""
235
 
236
+ #: wp-to-twitter-manager.php:337
237
  msgid "Use <strong>link description</strong> for Twitter updates"
238
  msgstr ""
239
 
240
+ #: wp-to-twitter-manager.php:337
241
+ msgid "Text for new link updates (used if title/description isn't available.):"
242
  msgstr ""
243
 
244
+ #: wp-to-twitter-manager.php:342
245
  msgid "Set default Tweet status to 'No.'"
246
  msgstr ""
247
 
248
+ #: wp-to-twitter-manager.php:343
249
  msgid ""
250
  "Twitter updates can be set on a post by post basis. By default, posts WILL "
251
  "be posted to Twitter. Check this to change the default to NO."
252
  msgstr ""
253
 
254
+ #: wp-to-twitter-manager.php:347
255
  msgid ""
256
  "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
257
  msgstr ""
258
 
259
+ #: wp-to-twitter-manager.php:351
260
  msgid "Update Twitter when a post is published using QuickPress"
261
  msgstr ""
262
 
263
+ #: wp-to-twitter-manager.php:355
264
+ msgid "Custom text prepended to Tweets:"
265
  msgstr ""
266
 
267
+ #: wp-to-twitter-manager.php:359
268
+ msgid "Custom text appended to Tweets:"
269
  msgstr ""
270
 
271
+ #: wp-to-twitter-manager.php:363
272
+ msgid "Custom field for an alternate URL to be shortened and Tweeted:"
273
  msgstr ""
274
 
275
+ #: wp-to-twitter-manager.php:364
276
  msgid ""
277
  "You can use a custom field to send Cli.gs and Twitter an alternate URL from "
278
  "the permalink provided by WordPress. The value is the name of the custom "
279
  "field you're using to add an external URL."
280
  msgstr ""
281
 
282
+ #: wp-to-twitter-manager.php:368
283
+ msgid "Use Google Analytics with WP-to-Twitter"
284
  msgstr ""
285
 
286
+ #: wp-to-twitter-manager.php:369
287
+ msgid "Campaign identifier for Google Analytics:"
288
+ msgstr ""
289
+
290
+ #: wp-to-twitter-manager.php:370
291
  msgid ""
292
  "You can track the response from Twitter using Google Analytics by defining a "
293
  "campaign identifier here."
294
  msgstr ""
295
 
296
+ #: wp-to-twitter-manager.php:375
 
 
 
 
297
  msgid "Authors have individual Twitter accounts"
298
  msgstr ""
299
 
300
+ #: wp-to-twitter-manager.php:375
301
  msgid ""
302
  "Each author can set their own Twitter username and password in their user "
303
  "profile. Their posts will be sent to their own Twitter accounts."
304
  msgstr ""
305
 
306
+ #: wp-to-twitter-manager.php:380
307
+ msgid "Use <strong>Cli.gs</strong> for my URL shortener."
308
+ msgstr ""
309
+
310
+ #: wp-to-twitter-manager.php:380
311
+ msgid "Use <strong>Bit.ly</strong> for my URL shortener."
312
+ msgstr ""
313
+
314
+ #: wp-to-twitter-manager.php:380
315
+ msgid "Don't shorten URLs."
316
+ msgstr ""
317
+
318
+ #: wp-to-twitter-manager.php:385
319
  msgid "Save WP->Twitter Options"
320
  msgstr ""
321
 
322
+ #: wp-to-twitter-manager.php:391
323
  msgid "Your Twitter account details"
324
  msgstr ""
325
 
326
+ #: wp-to-twitter-manager.php:398
327
  msgid "Your Twitter username:"
328
  msgstr ""
329
 
330
+ #: wp-to-twitter-manager.php:402
331
  msgid "Your Twitter password:"
332
  msgstr ""
333
 
334
+ #: wp-to-twitter-manager.php:406
335
  msgid "Save Twitter Login Info"
336
  msgstr ""
337
 
338
+ #: wp-to-twitter-manager.php:406
339
  msgid ""
340
  "&raquo; <small>Don't have a Twitter account? <a href='http://www.twitter."
341
  "com'>Get one for free here</a>"
342
  msgstr ""
343
 
344
+ #: wp-to-twitter-manager.php:410
345
  msgid "Your Cli.gs account details"
346
  msgstr ""
347
 
348
+ #: wp-to-twitter-manager.php:417
349
  msgid ""
350
  "Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
351
  msgstr ""
352
 
353
+ #: wp-to-twitter-manager.php:423
354
  msgid ""
355
  "Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/"
356
  "api/'>Get one free here</a>!<br />You'll need an API key in order to "
357
  "associate the Cligs you create with your Cligs account."
358
  msgstr ""
359
 
360
+ #: wp-to-twitter-manager.php:428
361
+ msgid "Your Bit.ly account details"
362
+ msgstr ""
363
+
364
+ #: wp-to-twitter-manager.php:434
365
+ msgid "Your Bit.ly username:"
366
+ msgstr ""
367
+
368
+ #: wp-to-twitter-manager.php:438
369
+ msgid ""
370
+ "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
371
+ msgstr ""
372
+
373
+ #: wp-to-twitter-manager.php:464
374
  msgid "Need help?"
375
  msgstr ""
376
 
377
+ #: wp-to-twitter-manager.php:465
378
  msgid ""
379
  "Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to "
380
  "Twitter plugin page</a>."
382
 
383
  #. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
384
  #. Plugin Name of an extension
385
+ #: wp-to-twitter.php:596
386
  msgid "WP to Twitter"
387
  msgstr ""
388
 
389
+ #: wp-to-twitter.php:631
390
  msgid "Twitter Post"
391
  msgstr ""
392
 
393
+ #: wp-to-twitter.php:636
394
  msgid ""
395
  " characters.<br />Twitter posts are a maximum of 140 characters; if your Cli."
396
  "gs URL is appended to the end of your document, you have 119 characters "
399
  "into the Tweet."
400
  msgstr ""
401
 
402
+ #: wp-to-twitter.php:636
403
  msgid "Get Support"
404
  msgstr ""
405
 
406
+ #: wp-to-twitter.php:639
407
  msgid "Don't Tweet this post."
408
  msgstr ""
409
 
410
+ #: wp-to-twitter.php:691
411
  msgid "WP to Twitter User Settings"
412
  msgstr ""
413
 
414
+ #: wp-to-twitter.php:695
415
  msgid "Use My Twitter Account"
416
  msgstr ""
417
 
418
+ #: wp-to-twitter.php:696
419
+ msgid ""
420
+ "Select this option if you would like your posts to be Tweeted into your own "
421
+ "Twitter account with no @ references."
422
+ msgstr ""
423
+
424
+ #: wp-to-twitter.php:697
425
+ msgid ""
426
+ "Tweet my posts into my Twitter account with an @ reference to the site's "
427
+ "main Twitter account."
428
+ msgstr ""
429
+
430
+ #: wp-to-twitter.php:698
431
+ msgid ""
432
+ "Tweet my posts into the main site Twitter account with an @ reference to my "
433
+ "username. (Password not required with this option.)"
434
+ msgstr ""
435
+
436
+ #: wp-to-twitter.php:701
437
  msgid "Your Twitter Username"
438
  msgstr ""
439
 
440
+ #: wp-to-twitter.php:702
441
+ msgid "Enter your own Twitter username."
442
+ msgstr ""
443
+
444
+ #: wp-to-twitter.php:705
445
  msgid "Your Twitter Password"
446
  msgstr ""
447
 
448
+ #: wp-to-twitter.php:706
449
+ msgid "Enter your own Twitter password."
450
+ msgstr ""
451
+
452
+ #: wp-to-twitter.php:784
453
  msgid "Settings"
454
  msgstr ""
455