WP to Twitter - Version 2.4.5

Version Description

  • Added #modified# to use post modified date in templates.
  • Corrected unstripped slashes for template preview in WP to Twitter post box
  • Character count for custom tweet text was incorrect on initial load in edit mode.
  • Replaced character counter with a more Twitter-like character counter (counting down.)
  • Removed JavaScript from post box so that WP to Twitter box is properly draggable.
  • Added ampersand to normalizer function
  • Updated Brazilian Portuguese translation
Download this release

Release Info

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

Code changes from version 2.3.18 to 2.4.5

WP_OAuth.php CHANGED
@@ -383,8 +383,8 @@ class WPOAuthRequest {
383
  $parts = parse_url($this->http_url);
384
 
385
  $port = @$parts['port'];
386
- $scheme = $parts['scheme'];
387
- $host = $parts['host'];
388
  $path = @$parts['path'];
389
 
390
  $port or $port = ($scheme == 'https') ? '443' : '80';
383
  $parts = parse_url($this->http_url);
384
 
385
  $port = @$parts['port'];
386
+ $scheme = @$parts['scheme'];
387
+ $host = @$parts['host'];
388
  $path = @$parts['path'];
389
 
390
  $port or $port = ($scheme == 'https') ? '443' : '80';
functions.php CHANGED
@@ -234,6 +234,9 @@ global $current_user, $wpt_version;
234
  get_currentuserinfo();
235
  $request = '';
236
  // send fields for WP to Twitter
 
 
 
237
  $version = $wpt_version;
238
  $wtt_twitter_username = get_option('wtt_twitter_username');
239
  // send fields for all plugins
@@ -249,12 +252,20 @@ get_currentuserinfo();
249
  $curl_exec = ( function_exists('curl_exec') )?'yes':'no';
250
 
251
  // theme data
252
- $theme_path = get_stylesheet_directory().'/style.css';
 
 
 
 
 
 
 
253
  $theme = get_theme_data($theme_path);
254
  $theme_name = $theme['Name'];
255
- $theme_uri = $theme['URI'];
256
  $theme_parent = $theme['Template'];
257
  $theme_version = $theme['Version'];
 
258
  // plugin data
259
  $plugins = get_plugins();
260
  $plugins_string = '';
@@ -269,9 +280,10 @@ get_currentuserinfo();
269
  }
270
  $data = "
271
  ================ Installation Data ====================
272
- ==WP to Twitter:==
273
  Version: $version
274
  Twitter username: $wtt_twitter_username
 
275
 
276
  ==WordPress:==
277
  Version: $wp_version
@@ -302,7 +314,8 @@ $plugins_string
302
  $request = ( !empty($_POST['support_request']) )?stripslashes($_POST['support_request']):false;
303
  $has_donated = ( $_POST['has_donated'] == 'on')?"Donor":"No donation";
304
  $has_read_faq = ( $_POST['has_read_faq'] == 'on')?"Read FAQ":false;
305
- $subject = "WP to Twitter support request. $has_donated";
 
306
  $message = $request ."\n\n". $data;
307
  $from = "From: \"$current_user->display_name\" <$current_user->user_email>\r\n";
308
 
@@ -312,7 +325,6 @@ $plugins_string
312
  echo "<div class='message error'><p>".__('Please describe your problem. I\'m not psychic.','wp-to-twitter')."</p></div>";
313
  } else {
314
  wp_mail( "plugins@joedolson.com",$subject,$message,$from );
315
-
316
  if ( $has_donated == 'Donor' || $has_purchased == 'Purchaser' ) {
317
  echo "<div class='message updated'><p>".__('Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.','wp-to-twitter')."</p></div>";
318
  } else {
@@ -320,14 +332,25 @@ $plugins_string
320
  }
321
  }
322
  }
323
-
 
 
324
  echo "
325
- <form method='post' action='".admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php')."'>
326
  <div><input type='hidden' name='_wpnonce' value='".wp_create_nonce('wp-to-twitter-nonce')."' /></div>
327
- <div>
 
 
 
 
 
 
 
328
  <p>".
329
  __('<strong>Please note</strong>: I do keep records of those who have donated, but if your donation came from somebody other than your account at this web site, you must note this in your message.','wp-to-twitter')
330
- ."</p>
 
 
331
  <p>
332
  <code>".__('From:','wp-to-twitter')." \"$current_user->display_name\" &lt;$current_user->user_email&gt;</code>
333
  </p>
@@ -335,7 +358,7 @@ $plugins_string
335
  <input type='checkbox' name='has_read_faq' id='has_read_faq' value='on' /> <label for='has_read_faq'>".__('I have read <a href="http://www.joedolson.com/articles/wp-to-twitter/support-2/">the FAQ for this plug-in</a>.','wp-to-twitter')." <span>(required)</span></label>
336
  </p>
337
  <p>
338
- <input type='checkbox' name='has_donated' id='has_donated' value='on' /> <label for='has_donated'>".__('I have <a href="http://www.joedolson.com/donate.php">made a donation to help support this plug-in</a>.','wp-to-twitter')."</label>
339
  </p>
340
  <p>
341
  <label for='support_request'>Support Request:</label><br /><textarea name='support_request' id='support_request' cols='80' rows='10'>".stripslashes($request)."</textarea>
234
  get_currentuserinfo();
235
  $request = '';
236
  // send fields for WP to Twitter
237
+ $license = ( get_option('wpt_license_key') != '' )?get_option('wpt_license_key'):'none';
238
+ $license = "License Key: ".$license;
239
+
240
  $version = $wpt_version;
241
  $wtt_twitter_username = get_option('wtt_twitter_username');
242
  // send fields for all plugins
252
  $curl_exec = ( function_exists('curl_exec') )?'yes':'no';
253
 
254
  // theme data
255
+ if ( function_exists( 'wp_get_theme' ) ) {
256
+ $theme = wp_get_theme();
257
+ $theme_name = $theme->Name;
258
+ $theme_uri = $theme->ThemeURI;
259
+ $theme_parent = $theme->Template;
260
+ $theme_version = $theme->Version;
261
+ } else {
262
+ $theme_path = get_stylesheet_directory().'/style.css';
263
  $theme = get_theme_data($theme_path);
264
  $theme_name = $theme['Name'];
265
+ $theme_uri = $theme['ThemeURI'];
266
  $theme_parent = $theme['Template'];
267
  $theme_version = $theme['Version'];
268
+ }
269
  // plugin data
270
  $plugins = get_plugins();
271
  $plugins_string = '';
280
  }
281
  $data = "
282
  ================ Installation Data ====================
283
+ ==WP to Twitter==
284
  Version: $version
285
  Twitter username: $wtt_twitter_username
286
+ $license
287
 
288
  ==WordPress:==
289
  Version: $wp_version
314
  $request = ( !empty($_POST['support_request']) )?stripslashes($_POST['support_request']):false;
315
  $has_donated = ( $_POST['has_donated'] == 'on')?"Donor":"No donation";
316
  $has_read_faq = ( $_POST['has_read_faq'] == 'on')?"Read FAQ":false;
317
+ if ( function_exists( 'wpt_pro_exists' ) ) { $pro = " PRO"; } else { $pro = ''; }
318
+ $subject = "WP to Twitter$pro support request. $has_donated";
319
  $message = $request ."\n\n". $data;
320
  $from = "From: \"$current_user->display_name\" <$current_user->user_email>\r\n";
321
 
325
  echo "<div class='message error'><p>".__('Please describe your problem. I\'m not psychic.','wp-to-twitter')."</p></div>";
326
  } else {
327
  wp_mail( "plugins@joedolson.com",$subject,$message,$from );
 
328
  if ( $has_donated == 'Donor' || $has_purchased == 'Purchaser' ) {
329
  echo "<div class='message updated'><p>".__('Thank you for supporting the continuing development of this plug-in! I\'ll get back to you as soon as I can.','wp-to-twitter')."</p></div>";
330
  } else {
332
  }
333
  }
334
  }
335
+ if ( function_exists( 'wpt_pro_exists' ) ) { $checked="checked='checked'"; } else { $checked=''; }
336
+ $admin_url = ( is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') )?admin_url('admin.php?page=wp-tweets-pro'):admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
337
+
338
  echo "
339
+ <form method='post' action='$admin_url'>
340
  <div><input type='hidden' name='_wpnonce' value='".wp_create_nonce('wp-to-twitter-nonce')."' /></div>
341
+ <div>";
342
+ if ( function_exists( 'wpt_pro_exists' ) ) {
343
+ echo "
344
+ <p>".
345
+ __('Please include your license key in your support request.','wp-to-twitter')
346
+ ."</p>";
347
+ } else {
348
+ echo "
349
  <p>".
350
  __('<strong>Please note</strong>: I do keep records of those who have donated, but if your donation came from somebody other than your account at this web site, you must note this in your message.','wp-to-twitter')
351
+ ."</p>";
352
+ }
353
+ echo "
354
  <p>
355
  <code>".__('From:','wp-to-twitter')." \"$current_user->display_name\" &lt;$current_user->user_email&gt;</code>
356
  </p>
358
  <input type='checkbox' name='has_read_faq' id='has_read_faq' value='on' /> <label for='has_read_faq'>".__('I have read <a href="http://www.joedolson.com/articles/wp-to-twitter/support-2/">the FAQ for this plug-in</a>.','wp-to-twitter')." <span>(required)</span></label>
359
  </p>
360
  <p>
361
+ <input type='checkbox' name='has_donated' id='has_donated' value='on' $checked /> <label for='has_donated'>".__('I have <a href="http://www.joedolson.com/donate.php">made a donation to help support this plug-in</a>.','wp-to-twitter')."</label>
362
  </p>
363
  <p>
364
  <label for='support_request'>Support Request:</label><br /><textarea name='support_request' id='support_request' cols='80' rows='10'>".stripslashes($request)."</textarea>
gpl.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
jd_twitterOAuth.php CHANGED
@@ -2,63 +2,56 @@
2
  /*
3
  * Abraham Williams (abraham@abrah.am) http://abrah.am
4
  *
5
- * The first PHP Library to support OAuth for Twitter's REST API.
 
6
  */
7
 
8
- /* Load OAuth lib. You can find it at http://oauth.net */
9
  require_once('WP_OAuth.php');
10
 
11
  if (!class_exists('jd_TwitterOAuth')) {
12
 
13
  /**
14
- * Twitter OAuth class
15
  */
16
  class jd_TwitterOAuth {
17
- /* Contains the last HTTP status code returned. */
18
  public $http_code;
19
  /* Contains the last API call. */
20
  public $url;
21
  /* Set up the API root URL. */
22
- public $host = "https://api.twitter.com/1/";
23
  /* Set timeout default. */
24
- public $timeout = 30;
25
- /* Set connect timeout. */
26
- public $connecttimeout = 30;
27
- /* Verify SSL Cert. */
28
- public $ssl_verifypeer = FALSE;
29
- /* Respons format. */
30
  public $format = 'json';
31
  /* Decode returned json data. */
32
  public $decode_json = false;
33
- /* Contains the last HTTP headers returned. */
34
- public $http_info;
35
- /* Set the useragnet. */
36
- public $useragent = 'TwitterOAuth v0.2.0-beta2';
37
- /* Immediately retry the API call if the response was not successful. */
38
- //public $retry = TRUE;
39
 
40
  /**
41
  * Set API URLS
42
  */
43
- function accessTokenURL() { return 'https://api.twitter.com/oauth/access_token'; }
44
- function authenticateURL() { return 'https://api.twitter.com/oauth/authenticate'; }
45
- function authorizeURL() { return 'https://api.twitter.com/oauth/authorize'; }
46
- function requestTokenURL() { return 'https://api.twitter.com/oauth/request_token'; }
47
 
48
  /**
49
  * Debug helpers
50
  */
51
- function lastStatusCode() { return $this->http_status; }
52
  function lastAPICall() { return $this->last_api_call; }
53
 
54
  /**
55
- * construct TwitterOAuth object
56
  */
57
- function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) {
58
  $this->sha1_method = new WPOAuthSignatureMethod_HMAC_SHA1();
59
  $this->consumer = new WPOAuthConsumer($consumer_key, $consumer_secret);
60
- if (!empty($oauth_token) && !empty($oauth_token_secret)) {
61
- $this->token = new WPOAuthConsumer($oauth_token, $oauth_token_secret);
62
  } else {
63
  $this->token = NULL;
64
  }
@@ -68,178 +61,115 @@ class jd_TwitterOAuth {
68
  /**
69
  * Get a request_token from Twitter
70
  *
71
- * @returns a key/value array containing oauth_token and oauth_token_secret
72
  */
73
- function getRequestToken($oauth_callback = NULL) {
74
- $parameters = array();
75
- if (!empty($oauth_callback)) {
76
- $parameters['oauth_callback'] = $oauth_callback;
77
- }
78
- $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
79
- $token = WPOAuthUtil::parse_parameters($request);
80
- $this->token = new WPOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
81
  return $token;
82
  }
83
 
84
  /**
85
- * Get the authorize URL
86
  *
87
- * @returns a string
88
  */
89
- function getAuthorizeURL($token, $sign_in_with_twitter = TRUE) {
90
- if (is_array($token)) {
91
- $token = $token['oauth_token'];
92
- }
93
- if (empty($sign_in_with_twitter)) {
94
- return $this->authorizeURL() . "?oauth_token={$token}";
95
- } else {
96
- return $this->authenticateURL() . "?oauth_token={$token}";
97
  }
 
98
  }
99
 
100
  /**
101
- * Exchange request token and secret for an access token and
102
- * secret, to sign API calls.
103
  *
104
- * @returns array("oauth_token" => "the-access-token",
105
- * "oauth_token_secret" => "the-access-secret",
106
- * "user_id" => "9436992",
107
- * "screen_name" => "abraham")
108
  */
109
- function getAccessToken($oauth_verifier = FALSE) {
110
- $parameters = array();
111
- if (!empty($oauth_verifier)) {
112
- $parameters['oauth_verifier'] = $oauth_verifier;
113
- }
114
- $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters);
115
- $token = WPOAuthUtil::parse_parameters($request);
116
- $this->token = new WPOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
117
- return $token;
118
  }
119
 
120
- /**
121
- * One time exchange of username and password for access token and secret.
122
- *
123
- * @returns array("oauth_token" => "the-access-token",
124
- * "oauth_token_secret" => "the-access-secret",
125
- * "user_id" => "9436992",
126
- * "screen_name" => "abraham",
127
- * "x_auth_expires" => "0")
128
- */
129
- function getXAuthToken($username, $password) {
130
- $parameters = array();
131
- $parameters['x_auth_username'] = $username;
132
- $parameters['x_auth_password'] = $password;
133
- $parameters['x_auth_mode'] = 'client_auth';
134
- $request = $this->oAuthRequest($this->accessTokenURL(), 'POST', $parameters);
135
- $token = WPOAuthUtil::parse_parameters($request);
136
- $this->token = new WPOAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);
137
- return $token;
138
- }
139
 
140
  /**
141
- * GET wrapper for oAuthRequest.
 
 
142
  */
143
- function get($url, $parameters = array()) {
144
- $response = $this->oAuthRequest($url, 'GET', $parameters);
145
- if ($this->format === 'json' && $this->decode_json) {
146
- return json_decode($response);
147
- }
148
- return $response;
149
  }
150
 
151
  /**
152
- * POST wrapper for oAuthRequest.
 
 
 
 
153
  */
154
- function post($url, $parameters = array()) {
155
- $response = $this->oAuthRequest($url, 'POST', $parameters);
 
 
 
 
 
 
 
 
 
156
  if ($this->format === 'json' && $this->decode_json) {
157
  return json_decode($response);
158
  }
159
  return $response;
160
  }
161
-
162
- /**
163
- * DELETE wrapper for oAuthReqeust.
164
- */
165
- function delete($url, $parameters = array()) {
166
- $response = $this->oAuthRequest($url, 'DELETE', $parameters);
167
  if ($this->format === 'json' && $this->decode_json) {
168
  return json_decode($response);
169
  }
170
  return $response;
171
- }
172
-
173
  /**
174
- * Format and sign an OAuth / API request
175
  */
176
- function oAuthRequest($url, $method, $parameters) {
177
- if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
178
- $url = "{$this->host}{$url}.{$this->format}";
179
- }
180
- $request = WPOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters);
181
- $request->sign_request($this->sha1_method, $this->consumer, $this->token);
 
 
182
  switch ($method) {
183
- case 'GET':
184
- return $this->http($request->to_url(), 'GET');
185
- default:
186
- return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
 
 
 
 
 
187
  }
188
- }
189
 
190
- /**
191
- * Make an HTTP request
192
- *
193
- * @return API results
194
- */
195
- function http($url, $method, $postfields = NULL) {
196
- $this->http_info = array();
197
- $ci = curl_init();
198
- /* Curl settings */
199
- curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
200
- curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
201
- curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
202
- curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
203
- curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
204
- curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
205
- curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
206
- curl_setopt($ci, CURLOPT_HEADER, FALSE);
207
 
208
- switch ($method) {
209
- case 'POST':
210
- curl_setopt($ci, CURLOPT_POST, TRUE);
211
- if (!empty($postfields)) {
212
- curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
213
- }
214
- break;
215
- case 'DELETE':
216
- curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
217
- if (!empty($postfields)) {
218
- $url = "{$url}?{$postfields}";
219
- }
220
- }
221
-
222
- curl_setopt($ci, CURLOPT_URL, $url);
223
- $response = curl_exec($ci);
224
- $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
225
- $this->http_info = array_merge($this->http_info, curl_getinfo($ci));
226
- $this->url = $url;
227
- curl_close ($ci);
228
- return $response;
229
- }
230
-
231
- /**
232
- * Get the header info to store.
233
- */
234
- function getHeader($ch, $header) {
235
- $i = strpos($header, ':');
236
- if (!empty($i)) {
237
- $key = str_replace('-', '_', strtolower(substr($header, 0, $i)));
238
- $value = trim(substr($header, $i + 2));
239
- $this->http_header[$key] = $value;
240
- }
241
- return strlen($header);
242
- }
243
  }
244
-
245
- } // class_exists check
2
  /*
3
  * Abraham Williams (abraham@abrah.am) http://abrah.am
4
  *
5
+ * The first PHP Library to support WPOAuth for Twitter's REST API.
6
+ *
7
  */
8
 
9
+ /* Load WPOAuth lib. You can find it at http://WPOAuth.net */
10
  require_once('WP_OAuth.php');
11
 
12
  if (!class_exists('jd_TwitterOAuth')) {
13
 
14
  /**
15
+ * Twitter WPOAuth class
16
  */
17
  class jd_TwitterOAuth {
18
+ /* Contains the last HTTP status code returned */
19
  public $http_code;
20
  /* Contains the last API call. */
21
  public $url;
22
  /* Set up the API root URL. */
23
+ public $host = "http://api.twitter.com/1/";
24
  /* Set timeout default. */
 
 
 
 
 
 
25
  public $format = 'json';
26
  /* Decode returned json data. */
27
  public $decode_json = false;
28
+ /* Contains the last API call */
29
+ private $last_api_call;
30
+ /* containe the header */
31
+ public $http_header;
 
 
32
 
33
  /**
34
  * Set API URLS
35
  */
36
+ function accessTokenURL() { return "http://api.twitter.com/oauth/access_token"; }
37
+ function authenticateURL() { return "http://api.twitter.com/oauth/authenticate"; }
38
+ function authorizeURL() { return "http://api.twitter.com/oauth/authorize"; }
39
+ function requestTokenURL() { return "http://api.twitter.com/oauth/request_token"; }
40
 
41
  /**
42
  * Debug helpers
43
  */
44
+ function lastStatusCode() { return $this->http_code; }
45
  function lastAPICall() { return $this->last_api_call; }
46
 
47
  /**
48
+ * construct TwitterWPOAuth object
49
  */
50
+ function __construct($consumer_key, $consumer_secret, $WPOAuth_token = NULL, $WPOAuth_token_secret = NULL) {
51
  $this->sha1_method = new WPOAuthSignatureMethod_HMAC_SHA1();
52
  $this->consumer = new WPOAuthConsumer($consumer_key, $consumer_secret);
53
+ if (!empty($WPOAuth_token) && !empty($WPOAuth_token_secret)) {
54
+ $this->token = new WPOAuthConsumer($WPOAuth_token, $WPOAuth_token_secret);
55
  } else {
56
  $this->token = NULL;
57
  }
61
  /**
62
  * Get a request_token from Twitter
63
  *
64
+ * @returns a key/value array containing WPOAuth_token and WPOAuth_token_secret
65
  */
66
+ function getRequestToken() {
67
+ $r = $this->WPOAuthRequest($this->requestTokenURL());
68
+ $token = $this->WPOAuthParseResponse($r);
69
+ $this->token = new WPOAuthConsumer($token['WPOAuth_token'], $token['WPOAuth_token_secret']);
 
 
 
 
70
  return $token;
71
  }
72
 
73
  /**
74
+ * Parse a URL-encoded WPOAuth response
75
  *
76
+ * @return a key/value array
77
  */
78
+ function WPOAuthParseResponse($responseString) {
79
+ $r = array();
80
+ foreach (explode('&', $responseString) as $param) {
81
+ $pair = explode('=', $param, 2);
82
+ if (count($pair) != 2) continue;
83
+ $r[urldecode($pair[0])] = urldecode($pair[1]);
 
 
84
  }
85
+ return $r;
86
  }
87
 
88
  /**
89
+ * Get the authorize URL
 
90
  *
91
+ * @returns a string
 
 
 
92
  */
93
+ function getAuthorizeURL($token) {
94
+ if (is_array($token)) $token = $token['WPOAuth_token'];
95
+ return $this->authorizeURL() . '?WPOAuth_token=' . $token;
 
 
 
 
 
 
96
  }
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  /**
100
+ * Get the authenticate URL
101
+ *
102
+ * @returns a string
103
  */
104
+ function getAuthenticateURL($token) {
105
+ if (is_array($token)) $token = $token['WPOAuth_token'];
106
+ return $this->authenticateURL() . '?WPOAuth_token=' . $token;
 
 
 
107
  }
108
 
109
  /**
110
+ * Exchange the request token and secret for an access token and
111
+ * secret, to sign API calls.
112
+ *
113
+ * @returns array("WPOAuth_token" => the access token,
114
+ * "WPOAuth_token_secret" => the access secret)
115
  */
116
+ function getAccessToken($token = NULL) {
117
+ $r = $this->WPOAuthRequest($this->accessTokenURL());
118
+ $token = $this->WPOAuthParseResponse($r);
119
+ $this->token = new WPOAuthConsumer($token['WPOAuth_token'], $token['WPOAuth_token_secret']);
120
+ return $token;
121
+ }
122
+ /**
123
+ * Wrapper for POST requests
124
+ */
125
+ function post($url, $parameters = array()) {
126
+ $response = $this->WPOAuthRequest( $url,$parameters,'POST' );
127
  if ($this->format === 'json' && $this->decode_json) {
128
  return json_decode($response);
129
  }
130
  return $response;
131
  }
132
+ /**
133
+ * Wrapper for GET requests
134
+ */
135
+ function get($url, $parameters = array()) {
136
+ $response = $this->WPOAuthRequest( $url,$parameters,'GET' );
 
137
  if ($this->format === 'json' && $this->decode_json) {
138
  return json_decode($response);
139
  }
140
  return $response;
141
+ }
 
142
  /**
143
+ * Format and sign an WPOAuth / API request
144
  */
145
+ function WPOAuthRequest($url, $args = array(), $method = NULL) {
146
+ if (empty($method)) $method = empty($args) ? "GET" : "POST";
147
+ $req = WPOAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $args);
148
+ $req->sign_request($this->sha1_method, $this->consumer, $this->token);
149
+
150
+ $response = false;
151
+ $url = null;
152
+
153
  switch ($method) {
154
+ case 'GET':
155
+ $url = $req->to_url();
156
+ $response = wp_remote_get( $url );
157
+ break;
158
+ case 'POST':
159
+ $url = $req->get_normalized_http_url();
160
+ $args = wp_parse_args($req->to_postdata());
161
+ $response = wp_remote_post( $url, array('body'=>$args));
162
+ break;
163
  }
 
164
 
165
+ if ( is_wp_error( $response ) ) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
+ $this->http_code = $response['response']['code'];
168
+ $this->last_api_call = $url;
169
+ $this->format = 'json';
170
+ $this->http_header = $response['headers'];
171
+
172
+ return $response['body'];
173
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
+ }
 
js/jquery.charcount.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Character Count Plugin - jQuery plugin
3
+ * Dynamic character count for text areas and input fields
4
+ * written by Alen Grakalic
5
+ * http://cssglobe.com/
6
+ *
7
+ * Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
8
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
9
+ * and GPL (GPL-LICENSE.txt) licenses.
10
+ *
11
+ * Built for jQuery library
12
+ * http://jquery.com
13
+ *
14
+ */
15
+
16
+ (function($) {
17
+
18
+ $.fn.charCount = function(options){
19
+
20
+ // default configuration properties
21
+ var defaults = {
22
+ allowed: 140,
23
+ warning: 25,
24
+ css: 'counter',
25
+ counterElement: 'span',
26
+ cssWarning: 'warning',
27
+ cssExceeded: 'exceeded',
28
+ counterText: ''
29
+ };
30
+
31
+ var options = $.extend(defaults, options);
32
+
33
+ function calculate(obj){
34
+ var count = $(obj).val().length;
35
+ var available = options.allowed - count;
36
+ if(available <= options.warning && available >= 0){
37
+ $(obj).next().addClass(options.cssWarning);
38
+ } else {
39
+ $(obj).next().removeClass(options.cssWarning);
40
+ }
41
+ if(available < 0){
42
+ $(obj).next().addClass(options.cssExceeded);
43
+ } else {
44
+ $(obj).next().removeClass(options.cssExceeded);
45
+ }
46
+ $(obj).next().html(options.counterText + available);
47
+ };
48
+
49
+ this.each(function() {
50
+ $(this).after('<'+ options.counterElement +' class="' + options.css + '">'+ options.counterText +'</'+ options.counterElement +'>');
51
+ calculate(this);
52
+ $(this).keyup(function(){calculate(this)});
53
+ $(this).change(function(){calculate(this)});
54
+ });
55
+
56
+ };
57
+
58
+ })(jQuery);
logo.png ADDED
Binary file
readme.txt CHANGED
@@ -3,10 +3,10 @@ Contributors: joedolson
3
  Donate link: http://www.joedolson.com/donate.php
4
  Tags: twitter, microblogging, su.pr, bitly, yourls, redirect, shortener, post, links
5
  Requires at least: 2.9.2 (partial)
6
- Tested up to: 3.4-alpha
7
  Stable tag: trunk
8
 
9
- Posts a Twitter update when you update your WordPress blog or post to your blogroll, using your chosen URL shortening service. Requires PHP 5 and cURL.
10
 
11
  == Description ==
12
 
@@ -23,9 +23,11 @@ Additional features include:
23
 
24
  Any status update you write which is longer than the available space will be truncated by the plugin. This applies to both default messages and to your custom messages.
25
 
 
 
26
  Translations:
27
 
28
- * Brazilian Portugese: [Miriam de Paula](http://wpmidia.com.br) [2.3.17]
29
  * Italian: [Gianni Diurno](http://www.gidibao.net) [2.3.14]
30
  * Lithuanian [Nata Strazda](http://www.designcontest.com) [2.3.8]
31
  * Simplified Chinese: [HostUCan](http://www.hostucan.com) [2.3.8]
@@ -49,15 +51,66 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  = 2.3.18 =
53
 
54
  * Bug fix: resolved case where new backdated posts were treated as edits.
55
- * Some changes to tweet truncating routines to avoid modifying the URL during truncation.
56
 
57
  = 2.3.17 =
58
 
59
- * Bug fix: Custom tweet text not sent for custom post types if the post was not saved prior to publishing.
60
- * Bug fix: Scheduled posts would not tweet if certain plug-ins were installed, due to modifications of post dates.
61
 
62
  = 2.3.16 =
63
 
@@ -72,7 +125,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
72
  * Added reminder of your template format to WP to Twitter custom box
73
  * Moved tags from an option to a template tag.
74
  * Fixed bug where shortcodes were not stripped from post excerpts
75
- * Bug fix: If a scheduled post was edited once, without changing publishing time, custom tweet text was lost.
76
  * Added support for the app_publish_post hook
77
  * Bug fix: XMLRPC published edits to Twitter when post updates on edit disabled
78
 
@@ -89,11 +142,11 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
89
 
90
  * Links added in link manager were getting run through the manual WP link shortener
91
  * Added appropriate normalizer call for PHP versions above 5
92
- * Adjustment to tweet truncation to hopefully avoid runaway truncating.
93
  * Added a new FAQ to my web site about character counting.
94
  * Fixed URL wrapper error with fopen()
95
- * Bug fix: Switched 'tweet this post' checkbox to a radio selector for simpler logic.
96
- * Now saving all past tweets for each post.
97
 
98
  = 2.3.11 =
99
 
@@ -111,9 +164,9 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
111
  * Fixed issue with category detection
112
  * Changed one function name to a non-generic name.
113
  * Modified remote URL calls; should fix problem contacting Bit.ly
114
- * Added template tag #commenter# available in comment tweet template. Use with caution.
115
  * Added plug-in support request form.
116
- * Fixed bug where custom tweet text was over written in a quick edit
117
  * Fixed "Don't Tweet this Post' checkbox
118
  * Added Goo.gl as an additional URL shortener.
119
  * Added custom keyword option for YOURLS shortener.
@@ -124,8 +177,8 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
124
 
125
  = 2.3.7 =
126
 
127
- * Double tweeting problem fixed.
128
- * Missing custom tweets fixed.
129
  * Revised WordPress version support notes.
130
  * I hope.
131
 
@@ -145,7 +198,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
145
  * Re-wrote instructions for connecting to OAuth to reflect redesigned Twitter Apps registration process
146
  * Code clean-up to remove some redundancies
147
  * Bug fixes:
148
- - Occasional double tweeting on future post seems to be fixed.
149
  - Tweeting on edits/quick edits when not checked
150
  * Added Ukrainian translation
151
 
@@ -163,13 +216,13 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
163
 
164
  = 2.3.1 =
165
 
166
- * Added version check and update cycle into tweet routine
167
 
168
  = 2.3.0 =
169
 
170
  * Added support for custom post types.
171
- * Added support for tweeting when comments are posted.
172
- * Bug fix: results of checking/unchecking 'Don't tweet this' box not consistent.
173
  * Added Japanese translation. [kndb](http://blog.layer8.sh/)
174
 
175
  = 2.2.12 =
@@ -193,12 +246,12 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
193
  * Added cURL check.
194
  * Due to ongoing problems with Cli.gs, removed that URL shortening service and replaced with Su.pr
195
  * Changed default shortening to 'no shortening'
196
- * Saves every tweet into post meta on save; adds link to re-post status update in WP to Twitter post box.
197
  * Revised error messages to increase detail.
198
 
199
  = 2.2.8 =
200
 
201
- * Enhancement: protect against duplicate tweets
202
  * Bug fix: hash tag replacement with spaces problematic if alphanumeric limit also set
203
  * Bug fix: issue with scheduled posts posting when 'Do not Tweet' checked.
204
  * Added Danish translation by Rasmus Himmelstrup
@@ -363,7 +416,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
363
  = 2.0.0 =
364
 
365
  * Fixed bug introduced in WordPress 2.9 where logged in users could only edit their own profiles and associated issues.
366
- * Fixed bug which caused #url# to repeatedly be added to the end of tweet texts on reactivation or upgrade.
367
  * Fixed bug which generated shortener API error messages when no URL shortener was used.
368
  * Fixed bug which prevented display of URL on edit screen if no URL shortener was used.
369
  * Added Spanish translation courtesy of [David Gil P&eacute;rez](http://www.sohelet.com)
@@ -409,7 +462,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
409
  = 1.5.2 =
410
 
411
  * Minor code cleanup
412
- * Fixed uncommon bug where draft posts would not tweet when published.
413
  * Fixed bug where #title# shortcode wouldn't work due to prior URL encoding. (Also covers some other obscure bugs.) Thanks to [Daniel Chcouri](http://www.anarchy.co.il) for the great catch.
414
  * Added new shortcode (#category#) to fetch the first post category.
415
  * Provided a substitute function for hosts not supportin mb_substr().
@@ -432,9 +485,9 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
432
 
433
  = 1.4.11 =
434
 
435
- * Fixed a bug which allowed editing of posts to be tweeted if status updates on editing Pages were permitted.
436
  * Fixed a bug in the support check routine which caused all Cli.gs tests to fail.
437
- * Streamlined logic controlling whether a new or edited item should be tweeted.
438
  * Added Italian translation. Thanks to [Gianni Diurno](http://www.gidibao.net)!
439
 
440
  = 1.4.10 =
@@ -510,7 +563,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
510
 
511
  = 1.3.4 =
512
 
513
- * Bug fix: html tags in titles are stripped from tweets
514
  * Bug fix: thanks to [Andrea Baccega](http://www.andreabaccega.com), some problems related to WP 2.7.1 should be fixed.
515
  * Added optional prepend/append text fields.
516
 
@@ -522,7 +575,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
522
 
523
  = 1.3.2 =
524
 
525
- * Added a #url# shortcode so you can decide where your short URL will appear in the tweet.
526
  * Couple small bug fixes.
527
  * Small changes to the settings page.
528
 
@@ -541,7 +594,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
541
 
542
  *Support for multiple authors with independent Twitter &amp; Cligs accounts.
543
  *Other minor textual revisions, addition of API availability check in the Settings panel.
544
- *Bugfixes: If editing a post by XMLRPC, you could not disable tweeting your edits. FIXED.
545
 
546
  = 1.2.8 =
547
 
@@ -556,7 +609,7 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
556
 
557
  *Bugfix with XMLRPC publishing -- controls to disable XMLRPC publishing now work correctly.
558
  *Bugfix with error reporting and clearing.
559
- *Added the option to supply an alternate URL along with your post, to be tweeted in place of the WP permalink.
560
 
561
  = 1.2.5 =
562
 
@@ -578,11 +631,9 @@ Contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Ba
578
 
579
  1. Upload the `wp-to-twitter` folder to your `/wp-content/plugins/` directory
580
  2. Activate the plugin using the `Plugins` menu in WordPress
581
- 3. Go to Settings > WP->Twitter
582
- 4. Adjust the WP->Twitter Options as you prefer them.
583
- 5. Supply your Twitter username and login.
584
- 6. **Optional**: Configure your choice of URL shortener. Default is to use the Su.pr URL shortener from Stumbleupon as a short URL.
585
- 7. That's it! You're all set.
586
 
587
  == Frequently Asked Questions ==
588
 
@@ -592,7 +643,7 @@ Right here: [WP to Twitter FAQ](http://www.joedolson.com/articles/wp-to-twitter/
592
 
593
  = How can I help you make WP to Twitter a better plug-in? =
594
 
595
- Writing and maintaining a plug-in is a lot of work. You can help me by providing detailed support requests (which saves me time), or by providing financial support via my [plug-in donations page](http://www.joedolson.com/donate.php). Believe me, any small donation really makes a difference!
596
 
597
  == Screenshots ==
598
 
@@ -602,4 +653,4 @@ Writing and maintaining a plug-in is a lot of work. You can help me by providing
602
 
603
  == Upgrade Notice ==
604
 
605
- * 2.3.17 Bug fixes for scheduled posts in combination with certain plug-ins; custom tweet text for custom post types with instant publish
3
  Donate link: http://www.joedolson.com/donate.php
4
  Tags: twitter, microblogging, su.pr, bitly, yourls, redirect, shortener, post, links
5
  Requires at least: 2.9.2 (partial)
6
+ Tested up to: 3.4
7
  Stable tag: trunk
8
 
9
+ Posts a Twitter update when you update your WordPress blog or post to your blogroll, using your chosen URL shortening service. Requires PHP 5.
10
 
11
  == Description ==
12
 
23
 
24
  Any status update you write which is longer than the available space will be truncated by the plugin. This applies to both default messages and to your custom messages.
25
 
26
+ Upgrade to [WP Tweets Pro](http://www.joedolson.com/articles/wp-tweets-pro/) to gain additional features.
27
+
28
  Translations:
29
 
30
+ * Brazilian Portugese: [Miriam de Paula](http://wpmidia.com.br) [2.4.4]
31
  * Italian: [Gianni Diurno](http://www.gidibao.net) [2.3.14]
32
  * Lithuanian [Nata Strazda](http://www.designcontest.com) [2.3.8]
33
  * Simplified Chinese: [HostUCan](http://www.hostucan.com) [2.3.8]
51
 
52
  == Changelog ==
53
 
54
+ = 2.4.5 =
55
+
56
+ * Added #modified# to use post modified date in templates.
57
+ * Corrected unstripped slashes for template preview in WP to Twitter post box
58
+ * Character count for custom tweet text was incorrect on initial load in edit mode.
59
+ * Replaced character counter with a more Twitter-like character counter (counting down.)
60
+ * Removed JavaScript from post box so that WP to Twitter box is properly draggable.
61
+ * Added ampersand to normalizer function
62
+ * Updated Brazilian Portuguese translation
63
+
64
+ = 2.4.4 =
65
+
66
+ * Bug fix: Truncation error if no crucial elements are truncatable
67
+ * Bug fix: Unclosed if/else caused empty Settings link on plugins page.
68
+ * Bug fix: "Post on XMLRPC" option must not be selected if using WP Tweets Pro with XML RPC
69
+ * Bug fix: Windows Live Writer (and perhaps other apps) send entity-converted characters on XMLRPC post; need to decode entities in text before sending to Twitter.
70
+ * Bug fix/change: Provides option to switch to http connections to Twitter if https connection returns SSL errors.
71
+
72
+ = 2.4.3 =
73
+
74
+ * Bug fix: In some cases, Administrators were not granted permissions to add custom tweets and other capability restricted tasks.
75
+ * MAJOR bug fix: broke an element of the authorization routine which caused an early exit out of posting to Twitter for some users.
76
+ * Settings link on plugins listing incorrect if WP Tweets Pro enabled.
77
+
78
+ = 2.4.2 =
79
+
80
+ * 2.4.1 had an error in the upgrade routine which broke the upgrade.
81
+
82
+ = 2.4.1 =
83
+
84
+ * I had mistakenly restricted WP Tweets PRO administrators from setting their own accounts, which was a problem for sites with multiple admin-level authors.
85
+ * Revised permissions model to use custom capability to control access to user accounts rather than default capabilities.
86
+ * Also switched to custom capability to control access to custom tweet options.
87
+ * URL to settings page pointed to wrong location if WP Tweets PRO was installed before configuring WP to Twitter.
88
+ * Support request form submitted to invalid URL if WP Tweets PRO installed.
89
+ * If append or prepend fields were in use, they were duplicated in Tweets on reposts.
90
+ * Added option so that users can be allowed to toggle the Tweet/Don't Tweet custom option without being able to edit other permissions.
91
+
92
+ = 2.4.0 =
93
+
94
+ * Bug fix/change: Twitter automatically shortens all URLs sent. As a result, all URLs are by definition 19 characters for the purpose of Tweeting. WP to Twitter now measures the value of the #url# tag as 19 characters, regardless of actual length.
95
+ * Category limiting can now either mean "tweet checked categories" or "don't tweet checked categories".
96
+ * Option to hide custom tweet box and options based on user roles.
97
+ * User role permissions now support custom roles
98
+ * Ability to determine the sequence in which fields are truncated or removed from Tweets if they exceed status length limits.
99
+ * Replace cURL requirement with WP_HTTP wrapper.
100
+ * Significant re-write of underlying code.
101
+ * Redesign of settings pages.
102
+ * Significant text revisions.
103
+ * Release of [WP Tweets Pro](http://www.joedolson.com/articles/wp-tweets-pro/), a pro upgrade to WP to Twitter.
104
+
105
  = 2.3.18 =
106
 
107
  * Bug fix: resolved case where new backdated posts were treated as edits.
108
+ * Some changes to Tweet truncating routines to avoid modifying the URL during truncation.
109
 
110
  = 2.3.17 =
111
 
112
+ * Bug fix: Custom Tweet text not sent for custom post types if the post was not saved prior to publishing.
113
+ * Bug fix: Scheduled posts would not Tweet if certain plug-ins were installed, due to modifications of post dates.
114
 
115
  = 2.3.16 =
116
 
125
  * Added reminder of your template format to WP to Twitter custom box
126
  * Moved tags from an option to a template tag.
127
  * Fixed bug where shortcodes were not stripped from post excerpts
128
+ * Bug fix: If a scheduled post was edited once, without changing publishing time, custom Tweet text was lost.
129
  * Added support for the app_publish_post hook
130
  * Bug fix: XMLRPC published edits to Twitter when post updates on edit disabled
131
 
142
 
143
  * Links added in link manager were getting run through the manual WP link shortener
144
  * Added appropriate normalizer call for PHP versions above 5
145
+ * Adjustment to Tweet truncation to hopefully avoid runaway truncating.
146
  * Added a new FAQ to my web site about character counting.
147
  * Fixed URL wrapper error with fopen()
148
+ * Bug fix: Switched 'Tweet this post' checkbox to a radio selector for simpler logic.
149
+ * Now saving all past Tweets for each post.
150
 
151
  = 2.3.11 =
152
 
164
  * Fixed issue with category detection
165
  * Changed one function name to a non-generic name.
166
  * Modified remote URL calls; should fix problem contacting Bit.ly
167
+ * Added template tag #commenter# available in comment Tweet template. Use with caution.
168
  * Added plug-in support request form.
169
+ * Fixed bug where custom Tweet text was over written in a quick edit
170
  * Fixed "Don't Tweet this Post' checkbox
171
  * Added Goo.gl as an additional URL shortener.
172
  * Added custom keyword option for YOURLS shortener.
177
 
178
  = 2.3.7 =
179
 
180
+ * Double Tweeting problem fixed.
181
+ * Missing custom Tweets fixed.
182
  * Revised WordPress version support notes.
183
  * I hope.
184
 
198
  * Re-wrote instructions for connecting to OAuth to reflect redesigned Twitter Apps registration process
199
  * Code clean-up to remove some redundancies
200
  * Bug fixes:
201
+ - Occasional double Tweeting on future post seems to be fixed.
202
  - Tweeting on edits/quick edits when not checked
203
  * Added Ukrainian translation
204
 
216
 
217
  = 2.3.1 =
218
 
219
+ * Added version check and update cycle into Tweet routine
220
 
221
  = 2.3.0 =
222
 
223
  * Added support for custom post types.
224
+ * Added support for Tweeting when comments are posted.
225
+ * Bug fix: results of checking/unchecking 'Don't Tweet this' box not consistent.
226
  * Added Japanese translation. [kndb](http://blog.layer8.sh/)
227
 
228
  = 2.2.12 =
246
  * Added cURL check.
247
  * Due to ongoing problems with Cli.gs, removed that URL shortening service and replaced with Su.pr
248
  * Changed default shortening to 'no shortening'
249
+ * Saves every Tweet into post meta on save; adds link to re-post status update in WP to Twitter post box.
250
  * Revised error messages to increase detail.
251
 
252
  = 2.2.8 =
253
 
254
+ * Enhancement: protect against duplicate Tweets
255
  * Bug fix: hash tag replacement with spaces problematic if alphanumeric limit also set
256
  * Bug fix: issue with scheduled posts posting when 'Do not Tweet' checked.
257
  * Added Danish translation by Rasmus Himmelstrup
416
  = 2.0.0 =
417
 
418
  * Fixed bug introduced in WordPress 2.9 where logged in users could only edit their own profiles and associated issues.
419
+ * Fixed bug which caused #url# to repeatedly be added to the end of Tweet texts on reactivation or upgrade.
420
  * Fixed bug which generated shortener API error messages when no URL shortener was used.
421
  * Fixed bug which prevented display of URL on edit screen if no URL shortener was used.
422
  * Added Spanish translation courtesy of [David Gil P&eacute;rez](http://www.sohelet.com)
462
  = 1.5.2 =
463
 
464
  * Minor code cleanup
465
+ * Fixed uncommon bug where draft posts would not Tweet when published.
466
  * Fixed bug where #title# shortcode wouldn't work due to prior URL encoding. (Also covers some other obscure bugs.) Thanks to [Daniel Chcouri](http://www.anarchy.co.il) for the great catch.
467
  * Added new shortcode (#category#) to fetch the first post category.
468
  * Provided a substitute function for hosts not supportin mb_substr().
485
 
486
  = 1.4.11 =
487
 
488
+ * Fixed a bug which allowed editing of posts to be Tweeted if status updates on editing Pages were permitted.
489
  * Fixed a bug in the support check routine which caused all Cli.gs tests to fail.
490
+ * Streamlined logic controlling whether a new or edited item should be Tweeted.
491
  * Added Italian translation. Thanks to [Gianni Diurno](http://www.gidibao.net)!
492
 
493
  = 1.4.10 =
563
 
564
  = 1.3.4 =
565
 
566
+ * Bug fix: html tags in titles are stripped from Tweets
567
  * Bug fix: thanks to [Andrea Baccega](http://www.andreabaccega.com), some problems related to WP 2.7.1 should be fixed.
568
  * Added optional prepend/append text fields.
569
 
575
 
576
  = 1.3.2 =
577
 
578
+ * Added a #url# shortcode so you can decide where your short URL will appear in the Tweet.
579
  * Couple small bug fixes.
580
  * Small changes to the settings page.
581
 
594
 
595
  *Support for multiple authors with independent Twitter &amp; Cligs accounts.
596
  *Other minor textual revisions, addition of API availability check in the Settings panel.
597
+ *Bugfixes: If editing a post by XMLRPC, you could not disable Tweeting your edits. FIXED.
598
 
599
  = 1.2.8 =
600
 
609
 
610
  *Bugfix with XMLRPC publishing -- controls to disable XMLRPC publishing now work correctly.
611
  *Bugfix with error reporting and clearing.
612
+ *Added the option to supply an alternate URL along with your post, to be Tweeted in place of the WP permalink.
613
 
614
  = 1.2.5 =
615
 
631
 
632
  1. Upload the `wp-to-twitter` folder to your `/wp-content/plugins/` directory
633
  2. Activate the plugin using the `Plugins` menu in WordPress
634
+ 3. Go to Settings > WP to Twitter
635
+ 4. Adjust the WP to Twitter Options as you prefer them.
636
+ 5. Create a Twitter application at Twitter and Configure your OAuth setup keys
 
 
637
 
638
  == Frequently Asked Questions ==
639
 
643
 
644
  = How can I help you make WP to Twitter a better plug-in? =
645
 
646
+ Writing and maintaining a plug-in is a lot of work. You can help me by providing detailed support requests (which saves me time), or by providing financial support, either via my [plug-in donations page](http://www.joedolson.com/donate.php) or by [upgrading to WP Tweets Pro](http://www.joedolson.com/articles/wp-tweets-pro/). Believe me, any small donation really makes a difference!
647
 
648
  == Screenshots ==
649
 
653
 
654
  == Upgrade Notice ==
655
 
656
+ * 2.4.4 Various bug fixes.
styles.css CHANGED
@@ -2,7 +2,7 @@
2
  #wp-to-twitter .jd-settings {clear: both;}
3
  #wp-to-twitter form .error p {background: none;border: none;}
4
  legend {font-weight: 700;font-size: 1.2em;padding: 6px 0;}
5
- .resources {float: right;border: 1px solid #aaa;padding: 10px 10px 0;margin-left: 10px;margin-bottom: 10px;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;background: #fff;text-align: center;}
6
  #wp-to-twitter .resources form {margin: 0;}
7
  .settings {margin: 25px 0;background: #fff;padding: 10px;border: 1px solid #000;}
8
  #wp-to-twitter .panel {border-bottom: 1px solid #ddd;padding: 0 5px;margin: 0 5px;}
@@ -13,5 +13,8 @@ legend {font-weight: 700;font-size: 1.2em;padding: 6px 0;}
13
  #wp-to-twitter .tokens label { width: 13em; display: block; float: left; margin-top:5px;}
14
  #wp-to-twitter .categories ul { -moz-column-count: 3; -moz-column-gap: 20px; -webkit-column-count: 3; -webkit-column-gap: 20px; margin: 0 0 20px; padding: 0; }
15
  #wp-to-twitter .categories li { list-style-type: none; margin: 3px 0; padding: 0;}
16
- #wp-to-twitter .inside .wpt_types { float: left; width: 40%; }
17
- #wp-to-twitter .inside .comments { clear: both;}
 
 
 
2
  #wp-to-twitter .jd-settings {clear: both;}
3
  #wp-to-twitter form .error p {background: none;border: none;}
4
  legend {font-weight: 700;font-size: 1.2em;padding: 6px 0;}
5
+ #wp-to-twitter .resources {background: url(logo.png) 50% 5px no-repeat; padding-top: 70px;}
6
  #wp-to-twitter .resources form {margin: 0;}
7
  .settings {margin: 25px 0;background: #fff;padding: 10px;border: 1px solid #000;}
8
  #wp-to-twitter .panel {border-bottom: 1px solid #ddd;padding: 0 5px;margin: 0 5px;}
13
  #wp-to-twitter .tokens label { width: 13em; display: block; float: left; margin-top:5px;}
14
  #wp-to-twitter .categories ul { -moz-column-count: 3; -moz-column-gap: 20px; -webkit-column-count: 3; -webkit-column-gap: 20px; margin: 0 0 20px; padding: 0; }
15
  #wp-to-twitter .categories li { list-style-type: none; margin: 3px 0; padding: 0;}
16
+ #wp-to-twitter .inside .wpt_types { float: left; width: 45%; }
17
+ #wp-to-twitter .inside .comments { clear: both;}
18
+ #wp-to-twitter .postbox { margin: 10px 10px 0 0; }
19
+ #wp-to-twitter .meta-box-sortables { min-height: 0; }
20
+ .wp-tweets-notes { float: right; width: 30%; min-width: 175px; }
twitter.png DELETED
Binary file
uninstall.php CHANGED
@@ -63,16 +63,11 @@ delete_option( 'bitlyapi' );
63
 
64
  // twitter compatible api
65
  delete_option( 'jd_api_post_status' );
66
- delete_option( 'jd-twitter-service-name' );
67
- delete_option( 'jd-twitter-char-limit' );
68
- delete_option( 'jd_use_both_services' );
69
- delete_option( 'x-pw' );
70
- delete_option( 'x-login' );
71
  delete_option('app_consumer_key');
72
  delete_option('app_consumer_secret');
73
  delete_option('oauth_token');
74
  delete_option('oauth_token_secret');
75
-
76
  //dymamic analytics
77
  delete_option( 'jd_dynamic_analytics' );
78
  delete_option( 'use_dynamic_analytics' );
@@ -87,5 +82,7 @@ delete_option( 'yourlslogin' );
87
  delete_option( 'jd_replace_character' );
88
  delete_option( 'jd_date_format' );
89
  delete_option( 'jd_keyword_format' );
90
-
 
 
91
  }
63
 
64
  // twitter compatible api
65
  delete_option( 'jd_api_post_status' );
 
 
 
 
 
66
  delete_option('app_consumer_key');
67
  delete_option('app_consumer_secret');
68
  delete_option('oauth_token');
69
  delete_option('oauth_token_secret');
70
+
71
  //dymamic analytics
72
  delete_option( 'jd_dynamic_analytics' );
73
  delete_option( 'use_dynamic_analytics' );
82
  delete_option( 'jd_replace_character' );
83
  delete_option( 'jd_date_format' );
84
  delete_option( 'jd_keyword_format' );
85
+ //Version
86
+ delete_option( 'wp_to_twitter_version' );
87
+ delete_option( 'wpt_authentication_missing' );
88
  }
wp-to-twitter-logo.png DELETED
Binary file
wp-to-twitter-manager.php CHANGED
@@ -1,33 +1,96 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  wpt_check_version();
 
 
 
 
 
3
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
4
  update_option( 'wp_twitter_failure','0' );
5
  update_option( 'wp_url_failure','0' );
 
6
  $message = __("WP to Twitter Errors Cleared", 'wp-to-twitter');
7
  }
8
 
9
  if ( isset($_POST['oauth_settings'] ) ) {
10
- $oauth_message = jd_update_oauth_settings();
11
- }
12
- // FUNCTION to see if checkboxes should be checked
13
- function jd_checkCheckbox( $theFieldname,$sub1=false,$sub2='' ) {
14
- if ($sub1) {
15
- $setting = get_option($theFieldname);
16
- $value = ( $sub2 != '' )?$setting[$sub1][$sub2]:$setting[$sub1];
17
- if ( $value == 1 ) {
18
- echo 'checked="checked"';
19
- return;
20
- }
21
- }
22
- if( get_option( $theFieldname ) == '1'){
23
- echo 'checked="checked"';
24
- }
25
- }
26
- function jd_checkSelect( $theFieldname, $theValue, $type='select' ) {
27
- if( get_option( $theFieldname ) == $theValue ) {
28
- echo ( $type == 'select' )?'selected="selected"':'checked="checked"';
29
- }
30
  }
 
31
  $wp_twitter_error = FALSE;
32
  $wp_supr_error = FALSE;
33
  $wp_bitly_error = FALSE;
@@ -60,7 +123,13 @@
60
  update_option('jd_max_tags',3);
61
  update_option('jd_max_characters',15);
62
  update_option('jd_replace_character','_');
63
- update_option('wtt_user_permissions','manage_options');
 
 
 
 
 
 
64
  update_option( 'jd_twit_remote', '0' );
65
  update_option( 'jd_post_excerpt', 30 );
66
  // Use Google Analytics with Twitter
@@ -125,30 +194,92 @@
125
  }
126
 
127
  if ( isset( $_POST['submit-type'] ) && $_POST['submit-type'] == 'advanced' ) {
128
- update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
129
- update_option( 'wpt_inline_edits', $_POST['wpt_inline_edits'] );
130
- update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
131
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
132
- update_option( 'jd_strip_nonan', $_POST['jd_strip_nonan'] );
133
  update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
134
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
135
  update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
136
- update_option('jd_max_tags',$_POST['jd_max_tags']);
137
- update_option('jd_max_characters',$_POST['jd_max_characters']);
138
- update_option('jd_replace_character',$_POST['jd_replace_character']);
139
  update_option( 'jd_date_format',$_POST['jd_date_format'] );
140
  update_option( 'jd_dynamic_analytics',$_POST['jd-dynamic-analytics'] );
141
- update_option( 'use_dynamic_analytics',$_POST['use-dynamic-analytics'] );
142
- update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
143
  update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
144
  update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
145
  $wtt_user_permissions = $_POST['wtt_user_permissions'];
146
- update_option('wtt_user_permissions',$wtt_user_permissions);
147
- update_option( 'disable_url_failure' , $_POST['disable_url_failure'] );
148
- update_option( 'disable_twitter_failure' , $_POST['disable_twitter_failure'] );
149
- update_option( 'disable_oauth_notice' , $_POST['disable_oauth_notice'] );
150
- update_option( 'wp_debug_oauth' , $_POST['wp_debug_oauth'] );
151
- update_option( 'jd_donations' , $_POST['jd_donations'] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  $message .= __( 'WP to Twitter Advanced Options Updated' , 'wp-to-twitter');
153
  }
154
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) {
@@ -186,6 +317,7 @@
186
  }
187
 
188
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'setcategories' ) {
 
189
  if ( is_array($_POST['categories'])) {
190
  $categories = $_POST['categories'];
191
  update_option('limit_categories','1');
@@ -280,140 +412,54 @@
280
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'check-support' ) {
281
  $message = jd_check_functions();
282
  }
283
-
284
- function jd_check_functions() {
285
- $message = "<div class='update'><ul>";
286
- // grab or set necessary variables
287
- $testurl = get_bloginfo( 'url' );
288
- $shortener = get_option( 'jd_shortener' );
289
- $title = urlencode( 'Your blog home' );
290
- $shrink = jd_shorten_link( $testurl, $title, false, 'true' );
291
- $api_url = $jdwp_api_post_status;
292
- $yourls_URL = "";
293
- if ($shrink == FALSE) {
294
- if ($shortener == 1) {
295
- $error = htmlentities( get_option('wp_supr_error') );
296
- } else if ( $shortener == 2 ) {
297
- $error = htmlentities( get_option('wp_bitly_error') );
298
- } else {
299
- $error = _('No error information is available for your shortener.','wp-to-twitter');
300
- }
301
- $message .= __("<li class=\"error\"><strong>WP to Twitter was unable to contact your selected URL shortening service.</strong></li>",'wp-to-twitter');
302
- $message .= "<li><code>$error</code></li>";
303
- } else {
304
- $message .= __("<li><strong>WP to Twitter successfully contacted your selected URL shortening service.</strong> The following link should point to your blog homepage:",'wp-to-twitter');
305
- $message .= " <a href='$shrink'>$shrink</a></li>";
306
- }
307
- //check twitter credentials
308
- if ( wtt_oauth_test() ) {
309
- $rand = rand(1000000,9999999);
310
- $testpost = jd_doTwitterAPIPost( "This is a test of WP to Twitter. $shrink ($rand)" );
311
- if ($testpost) {
312
- $message .= __("<li><strong>WP to Twitter successfully submitted a status update to Twitter.</strong></li>",'wp-to-twitter');
313
- } else {
314
- $error = get_option('jd_status_message');
315
- $message .= __("<li class=\"error\"><strong>WP to Twitter failed to submit an update to Twitter.</strong></li>",'wp-to-twitter');
316
- $message .= "<li class=\"error\">$error</li>";
317
- }
318
- } else {
319
- $message .= "<strong>"._e('You have not connected WordPress to Twitter.','wp-to-twitter')."</strong> ";
320
- }
321
- // If everything's OK, there's no reason to do this again.
322
- if ($testpost == FALSE && $shrink == FALSE ) {
323
- $message .= __("<li class=\"error\"><strong>Your server does not appear to support the required methods for WP to Twitter to function.</strong> You can try it anyway - these tests aren't perfect.</li>", 'wp-to-twitter');
324
- } else {
325
- }
326
- if ( $testpost && $shrink ) {
327
- $message .= __("<li><strong>Your server should run WP to Twitter successfully.</strong></li>", 'wp-to-twitter');
328
- }
329
- $message .= "</ul>
330
- </div>";
331
- return $message;
332
- }
333
  ?>
334
  <div class="wrap" id="wp-to-twitter">
335
  <?php wpt_marginal_function(); ?>
336
  <?php if ( $message ) { ?>
337
  <div id="message" class="updated fade"><?php echo $message; ?></div>
338
  <?php } ?>
339
- <div id="dropmessage" class="updated" style="display:none;"></div>
340
- <?php if (isset($_GET['export']) && $_GET['export'] == "settings") {
341
- print_settings();
342
- } ?>
343
- <h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
344
- <?php $wp_to_twitter_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) ); ?>
345
- <div class="resources">
346
- <img src="<?php echo $wp_to_twitter_directory; ?>/wp-to-twitter-logo.png" alt="WP to Twitter" />
347
- <p>
348
- <a href="?page=wp-to-twitter/wp-to-twitter.php&amp;export=settings"><?php _e("View Settings",'wp-to-twitter'); ?></a><?php if ( get_option('jd_donations') != 1 ) { ?> &middot; <a href="http://www.joedolson.com/donate.php"><strong><?php _e("Make a Donation",'wp-to-twitter'); ?></strong></a><?php } ?> &middot; <a href="<?php echo admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>#get-support"><?php _e("Get Support",'wp-to-twitter'); ?></a>
349
- </p>
350
- <?php if ( get_option('jd_donations') != 1 ) { ?>
351
- <div>
352
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
353
- <div>
354
- <input type="hidden" name="cmd" value="_s-xclick" />
355
- <input type="hidden" name="hosted_button_id" value="8490399" />
356
- <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="Donate" />
357
- <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
358
- </div>
359
- </form>
360
- </div>
361
- <?php } ?>
362
- <?php if ( get_option('jd_donations') != 1 ) { ?>
363
- <div class="ads">
364
- <p><?php _e('<strong>Notice</strong>: I can no longer provide help with WP to Twitter without your support. My apologies.','wp-to-twitter'); ?></p>
365
- </div>
366
- <?php } ?>
367
- </div>
368
-
369
- <p><?php _e("Shortcodes available in post update templates:", 'wp-to-twitter'); ?></p>
370
- <ul>
371
- <li><?php _e("<code>#title#</code>: the title of your blog post", 'wp-to-twitter'); ?></li>
372
- <li><?php _e("<code>#blog#</code>: the title of your blog", 'wp-to-twitter'); ?></li>
373
- <li><?php _e("<code>#post#</code>: a short excerpt of the post content", 'wp-to-twitter'); ?></li>
374
- <li><?php _e("<code>#category#</code>: the first selected category for the post", 'wp-to-twitter'); ?></li>
375
- <li><?php _e("<code>#date#</code>: the post date", 'wp-to-twitter'); ?></li>
376
- <li><?php _e("<code>#url#</code>: the post URL", 'wp-to-twitter'); ?></li>
377
- <li><?php _e("<code>#author#</code>: the post author",'wp-to-twitter'); ?></li>
378
- <li><?php _e("<code>#account#</code>: the twitter @reference for the account (or the author, if author settings are enabled and set.)",'wp-to-twitter'); ?></li>
379
- <li><?php _e("<code>#tags#</code>: your tags modified into hashtags. See options in the Advanced Settings section, below.",'wp-to-twitter'); ?></li>
380
- </ul>
381
- <p><?php _e("You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code></p>", 'wp-to-twitter'); ?>
382
-
383
  <?php if ( get_option( 'wp_twitter_failure' ) != '0' || get_option( 'wp_url_failure' ) == '1' ) { ?>
384
  <div class="error">
385
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
386
- _e("<p>One or more of your last posts has failed to send it's status update to Twitter. Your Tweet has been saved in your post custom fields, and you can re-Tweet it at your leisure.</p>", 'wp-to-twitter');
387
- echo "<p><strong>".get_option( 'jd_status_message' )."</strong></p>";
 
 
388
  }
389
  if ( get_option( 'wp_twitter_failure' ) == '2') {
390
- echo "<p>";
391
- _e("Sorry! I couldn't get in touch with the Twitter servers to post your <strong>new link</strong>! You'll have to post it manually, I'm afraid. ", 'wp-to-twitter');
392
- echo "</p>";
393
  }
394
  if ( get_option( 'wp_url_failure' ) == '1' ) {
395
  _e("<p>The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet. Check with your URL shortening provider to see if there are any known issues.</p>", 'wp-to-twitter');
396
- }
397
- ?>
 
 
 
 
 
398
  </div>
399
- <form method="post" action="">
400
- <div><input type="hidden" name="submit-type" value="clear-error" /></div>
401
- <p><input type="submit" name="submit" value="<?php _e("Clear 'WP to Twitter' Error Messages", 'wp-to-twitter'); ?>" class="button-primary" /></p>
402
- </form>
403
  <?php
404
  }
405
- ?>
406
- <div class="jd-settings" id="poststuff">
 
 
 
 
 
 
407
 
408
  <?php if (function_exists('wtt_connect_oauth') ) { wtt_connect_oauth(); } ?>
409
 
 
410
  <div class="ui-sortable meta-box-sortables">
411
  <div class="postbox">
412
-
413
 
414
  <h3><?php _e('Basic Settings','wp-to-twitter'); ?></h3>
415
  <div class="inside">
416
  <form method="post" action="">
 
417
  <div>
418
  <input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary button-side" />
419
  <?php
@@ -432,12 +478,12 @@ print_settings();
432
  <fieldset class='wpt_types'>
433
  <legend><?php _e("Settings for type '$type'",'wp-to-twitter' ); ?></legend>
434
  <p>
435
- <input type="checkbox" name="wpt_post_types[<?php echo $type; ?>][post-published-update]" id="<?php echo $type; ?>-post-published-update" value="1" <?php jd_checkCheckbox('wpt_post_types',$type,'post-published-update')?> />
436
- <label for="<?php echo $type; ?>-post-published-update"><strong><?php _e("Update when $word $type is published", 'wp-to-twitter'); ?></strong></label> <label for="<?php echo $type; ?>-post-published-text"><br /><?php _e("Text for new $type updates:", 'wp-to-twitter'); ?></label><br /><input type="text" name="wpt_post_types[<?php echo $type; ?>][post-published-text]" id="<?php echo $type; ?>-post-published-text" size="60" maxlength="120" value="<?php echo( esc_attr( stripslashes( $wpt_settings[$type]['post-published-text'] ) ) ); ?>" />
437
  </p>
438
  <p>
439
- <input type="checkbox" name="wpt_post_types[<?php echo $type; ?>][post-edited-update]" id="<?php echo $type; ?>-post-edited-update" value="1" <?php jd_checkCheckbox('wpt_post_types',$type,'post-edited-update')?> />
440
- <label for="<?php echo $type; ?>-post-edited-update"><strong><?php _e("Update when $word $type is edited", 'wp-to-twitter'); ?></strong></label><br /><label for="<?php echo $type; ?>-post-edited-text"><?php _e("Text for $type editing updates:", 'wp-to-twitter'); ?></label><br /><input type="text" name="wpt_post_types[<?php echo $type; ?>][post-edited-text]" id="<?php echo $type; ?>-post-edited-text" size="60" maxlength="120" value="<?php echo( esc_attr( stripslashes( $wpt_settings[$type]['post-edited-text'] ) ) ); ?>" />
441
  </p>
442
  </fieldset>
443
  <?php
@@ -447,7 +493,7 @@ print_settings();
447
  <fieldset class="comments">
448
  <legend><?php _e('Settings for Comments','wp-to-twitter'); ?></legend>
449
  <p>
450
- <input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php jd_checkCheckbox('comment-published-update')?> />
451
  <label for="comment-published-update"><strong><?php _e("Update Twitter when new comments are posted", 'wp-to-twitter'); ?></strong></label><br />
452
  <label for="comment-published-text"><?php _e("Text for new comments:", 'wp-to-twitter'); ?></label> <input type="text" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php echo ( esc_attr( stripslashes( get_option( 'comment-published-text' ) ) ) ); ?>" />
453
  </p>
@@ -456,7 +502,7 @@ print_settings();
456
  <fieldset>
457
  <legend><?php _e('Settings for Links','wp-to-twitter'); ?></legend>
458
  <p>
459
- <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
460
  <label for="jd_twit_blogroll"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br />
461
  <label for="newlink-published-text"><?php _e("Text for new link updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( esc_attr( stripslashes( get_option( 'newlink-published-text' ) ) ) ); ?>" /><br /><small><?php _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.','wp-to-twitter'); ?></small>
462
  </p>
@@ -507,6 +553,7 @@ print_settings();
507
  <div>
508
  <input type="hidden" name="submit-type" value="suprapi" />
509
  </div>
 
510
  <p><input type="submit" name="submit" value="Save Su.pr API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Su.pr API Key" />&raquo; <small><?php _e("Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</a>!<br />You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter'); ?></small></p>
511
  </div>
512
  </form>
@@ -527,6 +574,7 @@ print_settings();
527
  <div>
528
  <input type="hidden" name="submit-type" value="bitlyapi" />
529
  </div>
 
530
  <p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
531
  </div>
532
  </form>
@@ -555,11 +603,11 @@ print_settings();
555
  <input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php jd_checkSelect( 'jd_keyword_format',1,'checkbox' ); ?> /> <label for="jd_keyword_id"><?php _e("Post ID for YOURLS url slug.",'wp-to-twitter'); ?></label><br />
556
  <input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php jd_checkSelect( 'jd_keyword_format',2,'checkbox' ); ?> /> <label for="jd_keyword"><?php _e("Custom keyword for YOURLS url slug.",'wp-to-twitter'); ?></label><br />
557
  <input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php jd_checkSelect( 'jd_keyword_format',0,'checkbox' ); ?> /> <label for="jd_keyword_default"><?php _e("Default: sequential URL numbering.",'wp-to-twitter'); ?></label>
558
- <?php echo get_option('jd_keyword_format'); ?>
559
  </p>
560
  <div>
561
  <input type="hidden" name="submit-type" value="yourlsapi" />
562
  </div>
 
563
  <p><input type="submit" name="submit" value="<?php _e('Save YOURLS Account Info','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear YOURLS password','wp-to-twitter'); ?>" /><br /><small><?php _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
564
  </div>
565
  </form>
@@ -571,16 +619,16 @@ print_settings();
571
 
572
  <div class="ui-sortable meta-box-sortables">
573
  <div class="postbox">
574
-
575
  <h3><?php _e('Advanced Settings','wp-to-twitter'); ?></h3>
576
  <div class="inside">
577
  <form method="post" action="">
578
  <div>
 
579
  <input type="submit" name="submit" value="<?php _e("Save Advanced WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary button-side" />
580
  <fieldset>
581
  <legend><?php _e("Advanced Tweet settings","wp-to-twitter"); ?></legend>
582
  <p>
583
- <input type="checkbox" name="jd_strip_nonan" id="jd_strip_nonan" value="1" <?php jd_checkCheckbox('jd_strip_nonan'); ?> /> <label for="jd_strip_nonan"><?php _e("Strip nonalphanumeric characters from tags",'wp-to-twitter'); ?></label><br />
584
  <label for="jd_replace_character"><?php _e("Spaces in tags replaced with:",'wp-to-twitter'); ?></label> <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo esc_attr( get_option('jd_replace_character') ); ?>" size="3" /><br />
585
 
586
  <small><?php _e("Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> to remove spaces entirely.",'wp-to-twitter'); ?></small>
@@ -605,24 +653,58 @@ print_settings();
605
  <p>
606
  <label for="jd_twit_custom_url"><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( esc_attr( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
607
  <small><?php _e("You can use a custom field to send an alternate URL for your post. The value is the name of a custom field containing your external URL.", 'wp-to-twitter'); ?></small>
608
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
609
  </fieldset>
610
  <fieldset>
611
  <legend><?php _e( "Special Cases when WordPress should send a Tweet",'wp-to-twitter' ); ?></legend>
612
  <p>
613
- <input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
614
- <label for="jd_tweet_default"><?php _e("Do not post status updates by default", 'wp-to-twitter'); ?></label><br />
615
  <small><?php _e("By default, all posts meeting other requirements will be posted to Twitter. Check this to change your setting.", 'wp-to-twitter'); ?></small>
616
  </p>
617
  <p>
618
- <input type="checkbox" name="wpt_inline_edits" id="wpt_inline_edits" value="1" <?php jd_checkCheckbox('wpt_inline_edits')?> />
619
  <label for="wpt_inline_edits"><?php _e("Allow status updates from Quick Edit", 'wp-to-twitter'); ?></label><br />
620
- <small><?php _e("If checked, all posts edited individually or in bulk through the Quick Edit feature will be tweeted.", 'wp-to-twitter'); ?></small>
621
 
622
  </p>
 
 
 
 
 
 
 
623
  <p>
624
- <input type="checkbox" name="jd_twit_remote" id="jd_twit_remote" value="1" <?php jd_checkCheckbox('jd_twit_remote')?> />
625
  <label for="jd_twit_remote"><?php _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)", 'wp-to-twitter'); ?></label><br />
 
626
  </p>
627
  </fieldset>
628
  <fieldset>
@@ -630,12 +712,12 @@ print_settings();
630
  <p><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.","wp-to-twitter"); ?></p>
631
 
632
  <p>
633
- <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
634
  <label for="use-twitter-analytics"><?php _e("Use a Static Identifier with WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
635
  <label for="twitter-analytics-campaign"><?php _e("Static Campaign identifier for Google Analytics:", 'wp-to-twitter'); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( esc_attr( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br />
636
  </p>
637
  <p>
638
- <input type="checkbox" name="use-dynamic-analytics" id="use-dynamic-analytics" value="1" <?php jd_checkCheckbox('use_dynamic_analytics')?> />
639
  <label for="use-dynamic-analytics"><?php _e("Use a dynamic identifier with Google Analytics and WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
640
  <label for="jd-dynamic-analytics"><?php _e("What dynamic identifier would you like to use?","wp-to-twitter"); ?></label>
641
  <select name="jd-dynamic-analytics" id="jd-dynamic-analytics">
@@ -646,31 +728,51 @@ print_settings();
646
  </select><br />
647
  </p>
648
  </fieldset>
649
- <fieldset>
650
  <legend><?php _e('Individual Authors','wp-to-twitter'); ?></legend>
651
  <p>
652
- <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
653
  <label for="jd_individual_twitter_users"><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></label><br /><small><?php _e('Authors can add their username in their user profile. This feature can only add an @reference to the author. The @reference is placed using the <code>#account#</code> shortcode, which will pick up the main account if user accounts are not enabled.', 'wp-to-twitter'); ?></small>
654
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
655
  <p>
656
  <label for="wtt_user_permissions"><?php _e('Choose the lowest user group that can add their Twitter information','wp-to-twitter'); ?></label> <select id="wtt_user_permissions" name="wtt_user_permissions">
657
- <option value="read"<?php echo wtt_option_selected(get_option('wtt_user_permissions'),'read','option'); ?>><?php _e('Subscriber','wp-to-twitter')?></option>
658
- <option value="edit_posts"<?php echo wtt_option_selected(get_option('wtt_user_permissions'),'edit_posts','option'); ?>><?php _e('Contributor','wp-to-twitter')?></option>
659
- <option value="publish_posts"<?php echo wtt_option_selected(get_option('wtt_user_permissions'),'publish_posts','option'); ?>><?php _e('Author','wp-to-twitter')?></option>
660
- <option value="moderate_comments"<?php echo wtt_option_selected(get_option('wtt_user_permissions'),'moderate_comments','option'); ?>><?php _e('Editor','wp-to-twitter')?></option>
661
- <option value="manage_options"<?php echo wtt_option_selected(get_option('wtt_user_permissions'),'manage_options','option'); ?>><?php _e('Administrator','wp-to-twitter')?></option>
 
 
 
 
 
 
662
  </select>
663
  </p>
664
  </fieldset>
665
  <fieldset>
666
  <legend><?php _e('Disable Error Messages','wp-to-twitter'); ?></legend>
667
  <ul>
668
- <li><input type="checkbox" name="disable_url_failure" id="disable_url_failure" value="1" <?php jd_checkCheckbox('disable_url_failure')?> /> <label for="disable_url_failure"><?php _e("Disable global URL shortener error messages.", 'wp-to-twitter'); ?></label></li>
669
- <li><input type="checkbox" name="disable_twitter_failure" id="disable_twitter_failure" value="1" <?php jd_checkCheckbox('disable_twitter_failure')?> /> <label for="disable_twitter_failure"><?php _e("Disable global Twitter API error messages.", 'wp-to-twitter'); ?></label></li>
670
- <li><input type="checkbox" name="disable_oauth_notice" id="disable_oauth_notice" value="1" <?php jd_checkCheckbox('disable_oauth_notice')?> /> <label for="disable_oauth_notice"><?php _e("Disable notification to implement OAuth", 'wp-to-twitter'); ?></label></li>
671
- <li><input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth" value="1" <?php jd_checkCheckbox('wp_debug_oauth')?> />
672
  <label for="wp_debug_oauth"><?php _e("Get Debugging Data for OAuth Connection", 'wp-to-twitter'); ?></label></li>
673
- <li><input type="checkbox" name="jd_donations" id="jd_donations" value="1" <?php jd_checkCheckbox('jd_donations')?> />
 
 
674
  <label for="jd_donations"><strong><?php _e("I made a donation, so stop whinging at me, please.", 'wp-to-twitter'); ?></strong></label></li>
675
  </ul>
676
  </fieldset>
@@ -684,39 +786,110 @@ print_settings();
684
  </div>
685
  </div>
686
  <div class="ui-sortable meta-box-sortables">
687
- <div class="postbox categories">
688
  <h3><?php _e('Limit Updating Categories','wp-to-twitter'); ?></h3>
689
- <div class="inside">
690
- <p>
691
- <?php _e('Select which blog categories will be Tweeted. Uncheck all categories to disable category limits.','wp-to-twitter'); ?>
692
- <?php
693
- if ( get_option('limit_categories') == '0' ) {
694
- _e('<em>Category limits are disabled.</em>','wp-to-twitter');
695
- }
696
- ?>
697
- </p>
698
- <?php jd_list_categories(); ?>
699
 
 
700
  </div>
701
- </div>
702
- </div>
703
 
704
  <div class="postbox" id="get-support">
705
  <h3><?php _e('Get Plug-in Support','wp-to-twitter'); ?></h3>
706
- <div class="inside">
707
- <p><?php _e('Support requests without a donation will not be answered, but will be treated as bug reports.','wp-to-twitter'); ?></p>
708
- <?php wpt_get_support_form(); ?>
709
- </div>
710
- </div>
 
 
711
 
712
  <form method="post" action="">
713
  <fieldset>
714
  <input type="hidden" name="submit-type" value="check-support" />
 
715
  <p>
716
- <input type="submit" name="submit" value="<?php _e('Check Support','wp-to-twitter'); ?>" class="button-primary" /> <small><?php _e('Check whether your server supports <a href="http://www.joedolson.com/articles/wp-to-twitter/">WP to Twitter\'s</a> queries to the Twitter and URL shortening APIs. This test will send a status update to Twitter and shorten a URL using your selected methods.','wp-to-twitter'); ?></small>
717
  </p>
718
  </fieldset>
719
  </form>
720
  </div>
721
  </div>
722
- <?php global $wp_version;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+ // FUNCTION to see if checkboxes should be checked
3
+ function jd_checkCheckbox( $theFieldname,$sub1=false,$sub2='' ) {
4
+ if ( $sub1 ) {
5
+ $setting = get_option($theFieldname);
6
+ if ( isset( $setting[$sub1] ) ) {
7
+ $value = ( $sub2 != '' )?$setting[$sub1][$sub2]:$setting[$sub1];
8
+ } else {
9
+ $value = 0;
10
+ }
11
+ if ( $value == 1 ) {
12
+ return 'checked="checked"';
13
+ }
14
+ }
15
+ if( get_option( $theFieldname ) == '1'){
16
+ return 'checked="checked"';
17
+ }
18
+ }
19
+ function jd_checkSelect( $theFieldname, $theValue, $type='select' ) {
20
+ if( get_option( $theFieldname ) == $theValue ) {
21
+ echo ( $type == 'select' )?'selected="selected"':'checked="checked"';
22
+ }
23
+ }
24
+
25
+
26
+ function jd_check_functions() {
27
+ $message = "<div class='update'><ul>";
28
+ // grab or set necessary variables
29
+ $testurl = get_bloginfo( 'url' );
30
+ $shortener = get_option( 'jd_shortener' );
31
+ $title = urlencode( 'Your blog home' );
32
+ $shrink = jd_shorten_link( $testurl, $title, false, 'true' );
33
+ $api_url = $jdwp_api_post_status;
34
+ $yourls_URL = "";
35
+ if ($shrink == FALSE) {
36
+ if ($shortener == 1) {
37
+ $error = htmlentities( get_option('wp_supr_error') );
38
+ } else if ( $shortener == 2 ) {
39
+ $error = htmlentities( get_option('wp_bitly_error') );
40
+ } else {
41
+ $error = _('No error information is available for your shortener.','wp-to-twitter');
42
+ }
43
+ $message .= __("<li class=\"error\"><strong>WP to Twitter was unable to contact your selected URL shortening service.</strong></li>",'wp-to-twitter');
44
+ $message .= "<li><code>$error</code></li>";
45
+ } else {
46
+ $message .= __("<li><strong>WP to Twitter successfully contacted your selected URL shortening service.</strong> The following link should point to your blog homepage:",'wp-to-twitter');
47
+ $message .= " <a href='$shrink'>$shrink</a></li>";
48
+ }
49
+ //check twitter credentials
50
+ if ( wtt_oauth_test() ) {
51
+ $rand = rand(1000000,9999999);
52
+ $testpost = jd_doTwitterAPIPost( "This is a test of WP to Twitter. $shrink ($rand)" );
53
+ if ($testpost) {
54
+ $message .= __("<li><strong>WP to Twitter successfully submitted a status update to Twitter.</strong></li>",'wp-to-twitter');
55
+ } else {
56
+ $error = get_option('jd_status_message');
57
+ $message .= __("<li class=\"error\"><strong>WP to Twitter failed to submit an update to Twitter.</strong></li>",'wp-to-twitter');
58
+ $message .= "<li class=\"error\">$error</li>";
59
+ }
60
+ } else {
61
+ $message .= "<strong>"._e('You have not connected WordPress to Twitter.','wp-to-twitter')."</strong> ";
62
+ }
63
+ // If everything's OK, there's no reason to do this again.
64
+ if ($testpost == FALSE && $shrink == FALSE ) {
65
+ $message .= __("<li class=\"error\"><strong>Your server does not appear to support the required methods for WP to Twitter to function.</strong> You can try it anyway - these tests aren't perfect.</li>", 'wp-to-twitter');
66
+ } else {
67
+ }
68
+ if ( $testpost && $shrink ) {
69
+ $message .= __("<li><strong>Your server should run WP to Twitter successfully.</strong></li>", 'wp-to-twitter');
70
+ }
71
+ $message .= "</ul>
72
+ </div>";
73
+ return $message;
74
+ }
75
+
76
+ function wpt_update_settings() {
77
  wpt_check_version();
78
+ if ( !empty($_POST) ) {
79
+ $nonce=$_REQUEST['_wpnonce'];
80
+ if (! wp_verify_nonce($nonce,'wp-to-twitter-nonce') ) die("Security check failed");
81
+ }
82
+
83
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
84
  update_option( 'wp_twitter_failure','0' );
85
  update_option( 'wp_url_failure','0' );
86
+ update_option( 'jd_status_message','');
87
  $message = __("WP to Twitter Errors Cleared", 'wp-to-twitter');
88
  }
89
 
90
  if ( isset($_POST['oauth_settings'] ) ) {
91
+ $oauth_message = jd_update_oauth_settings( false, $_POST );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
93
+
94
  $wp_twitter_error = FALSE;
95
  $wp_supr_error = FALSE;
96
  $wp_bitly_error = FALSE;
123
  update_option('jd_max_tags',3);
124
  update_option('jd_max_characters',15);
125
  update_option('jd_replace_character','_');
126
+ update_option('wtt_user_permissions','administrator');
127
+ $administrator = get_role('administrator');
128
+ $administrator->add_cap('wpt_twitter_oauth');
129
+ $administrator->add_cap('wpt_twitter_custom');
130
+ $administrator->add_cap('wpt_twitter_switch');
131
+ update_option('wtt_show_custom_tweet','administrator');
132
+
133
  update_option( 'jd_twit_remote', '0' );
134
  update_option( 'jd_post_excerpt', 30 );
135
  // Use Google Analytics with Twitter
194
  }
195
 
196
  if ( isset( $_POST['submit-type'] ) && $_POST['submit-type'] == 'advanced' ) {
197
+ update_option( 'jd_tweet_default', ( isset( $_POST['jd_tweet_default'] ) )?$_POST['jd_tweet_default']:0 );
198
+ update_option( 'wpt_inline_edits', ( isset( $_POST['wpt_inline_edits'] ) )?$_POST['wpt_inline_edits']:0 );
199
+ update_option( 'jd_twit_remote',( isset( $_POST['jd_twit_remote'] ) )?$_POST['jd_twit_remote']:0 );
200
  update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
201
+ update_option( 'jd_strip_nonan', ( isset( $_POST['jd_strip_nonan'] ) )?$_POST['jd_strip_nonan']:0 );
202
  update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
203
  update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
204
  update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
205
+ update_option( 'jd_max_tags',$_POST['jd_max_tags']);
206
+ update_option( 'jd_max_characters',$_POST['jd_max_characters']);
207
+ update_option( 'jd_replace_character',$_POST['jd_replace_character']);
208
  update_option( 'jd_date_format',$_POST['jd_date_format'] );
209
  update_option( 'jd_dynamic_analytics',$_POST['jd-dynamic-analytics'] );
210
+ update_option( 'use_dynamic_analytics',( isset( $_POST['use-dynamic-analytics'] ) )?$_POST['use-dynamic-analytics']:0 );
211
+ update_option( 'use-twitter-analytics', ( isset( $_POST['use-twitter-analytics'] ) )?$_POST['use-twitter-analytics']:0 );
212
  update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
213
  update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
214
  $wtt_user_permissions = $_POST['wtt_user_permissions'];
215
+ $prev = get_option('wtt_user_permissions');
216
+ if ( $wtt_user_permissions != $prev ) {
217
+ $subscriber = get_role('subscriber'); $subscriber->remove_cap('wpt_twitter_oauth');
218
+ $contributor = get_role('contributor'); $contributor->remove_cap('wpt_twitter_oauth');
219
+ $author = get_role('author'); $author->remove_cap('wpt_twitter_oauth');
220
+ $editor = get_role('editor'); $editor->remove_cap('wpt_twitter_oauth');
221
+ switch ( $wtt_user_permissions ) {
222
+ case 'subscriber': $subscriber->add_cap('wpt_twitter_oauth'); $contributor->add_cap('wpt_twitter_oauth'); $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
223
+ case 'contributor': $contributor->add_cap('wpt_twitter_oauth'); $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
224
+ case 'author': $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
225
+ case 'editor':$editor->add_cap('wpt_twitter_oauth'); break;
226
+ default:
227
+ $role = get_role( $wtt_user_permissions );
228
+ $role->add_cap('wpt_twitter_oauth');
229
+ break;
230
+ }
231
+ }
232
+ update_option( 'wtt_user_permissions',$wtt_user_permissions);
233
+
234
+ $wtt_show_custom_tweet = $_POST['wtt_show_custom_tweet'];
235
+ $prev = get_option('wtt_show_custom_tweet');
236
+ if ( $wtt_show_custom_tweet != $prev ) {
237
+ $subscriber = get_role('subscriber'); $subscriber->remove_cap('wpt_twitter_custom');
238
+ $contributor = get_role('contributor'); $contributor->remove_cap('wpt_twitter_custom');
239
+ $author = get_role('author'); $author->remove_cap('wpt_twitter_custom');
240
+ $editor = get_role('editor'); $editor->remove_cap('wpt_twitter_custom');
241
+ switch ( $wtt_show_custom_tweet ) {
242
+ case 'subscriber': $subscriber->add_cap('wpt_twitter_custom'); $contributor->add_cap('wpt_twitter_custom'); $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
243
+ case 'contributor': $contributor->add_cap('wpt_twitter_custom'); $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
244
+ case 'author': $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
245
+ case 'editor':$editor->add_cap('wpt_twitter_custom'); break;
246
+ default:
247
+ $role = get_role( $wtt_show_custom_tweet );
248
+ $role->add_cap('wpt_twitter_custom');
249
+ break;
250
+ }
251
+ }
252
+ update_option( 'wtt_show_custom_tweet',$wtt_show_custom_tweet);
253
+
254
+ $wpt_twitter_switch = $_POST['wpt_twitter_switch'];
255
+ $prev = get_option('wpt_twitter_switch');
256
+ if ( $wpt_twitter_switch != $prev ) {
257
+ $subscriber = get_role('subscriber'); $subscriber->remove_cap('wpt_twitter_switch');
258
+ $contributor = get_role('contributor'); $contributor->remove_cap('wpt_twitter_switch');
259
+ $author = get_role('author'); $author->remove_cap('wpt_twitter_switch');
260
+ $editor = get_role('editor'); $editor->remove_cap('wpt_twitter_switch');
261
+ switch ( $wpt_twitter_switch ) {
262
+ case 'subscriber': $subscriber->add_cap('wpt_twitter_switch'); $contributor->add_cap('wpt_twitter_switch'); $author->add_cap('wpt_twitter_switch'); $editor->add_cap('wpt_twitter_switch'); break;
263
+ case 'contributor': $contributor->add_cap('wpt_twitter_switch'); $author->add_cap('wpt_twitter_switch'); $editor->add_cap('wpt_twitter_switch'); break;
264
+ case 'author': $author->add_cap('wpt_twitter_switch'); $editor->add_cap('wpt_twitter_switch'); break;
265
+ case 'editor':$editor->add_cap('wpt_twitter_switch'); break;
266
+ default:
267
+ $role = get_role( $wpt_twitter_switch );
268
+ $role->add_cap('wpt_twitter_switch');
269
+ break;
270
+ }
271
+ }
272
+ update_option( 'wpt_twitter_switch',$wpt_twitter_switch);
273
+
274
+ update_option( 'disable_url_failure' , ( isset( $_POST['disable_url_failure'] ) )?$_POST['disable_url_failure']:0 );
275
+ update_option( 'disable_twitter_failure' , ( isset( $_POST['disable_twitter_failure'] ) )?$_POST['disable_twitter_failure']:0 );
276
+ update_option( 'disable_oauth_notice' , ( isset( $_POST['disable_oauth_notice'] ) )?$_POST['disable_oauth_notice']:0 );
277
+ update_option( 'wp_debug_oauth' , ( isset( $_POST['wp_debug_oauth'] ) )?$_POST['wp_debug_oauth']:0 );
278
+ update_option( 'wpt_http' , ( isset( $_POST['wpt_http'] ) )?$_POST['wpt_http']:0 );
279
+
280
+ update_option( 'jd_donations' , ( isset( $_POST['jd_donations'] ) )?$_POST['jd_donations']:0 );
281
+ $wpt_truncation_order = $_POST['wpt_truncation_order'];
282
+ update_option( 'wpt_truncation_order', $wpt_truncation_order );
283
  $message .= __( 'WP to Twitter Advanced Options Updated' , 'wp-to-twitter');
284
  }
285
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) {
317
  }
318
 
319
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'setcategories' ) {
320
+ if ( isset($_POST['jd_twit_cats']) ) { update_option('jd_twit_cats',1); } else { update_option('jd_twit_cats',0); }
321
  if ( is_array($_POST['categories'])) {
322
  $categories = $_POST['categories'];
323
  update_option('limit_categories','1');
412
  if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'check-support' ) {
413
  $message = jd_check_functions();
414
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
415
  ?>
416
  <div class="wrap" id="wp-to-twitter">
417
  <?php wpt_marginal_function(); ?>
418
  <?php if ( $message ) { ?>
419
  <div id="message" class="updated fade"><?php echo $message; ?></div>
420
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
  <?php if ( get_option( 'wp_twitter_failure' ) != '0' || get_option( 'wp_url_failure' ) == '1' ) { ?>
422
  <div class="error">
423
  <?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
424
+ _e("<p>One or more of your last posts has failed to send a status update to Twitter. The Tweet has been saved, and you can re-Tweet it at your leisure.</p>", 'wp-to-twitter');
425
+ }
426
+ if ( get_option( 'jd_status_message' ) != '' ) {
427
+ echo "<p><strong>".get_option( 'jd_status_message' )."</strong></p>";
428
  }
429
  if ( get_option( 'wp_twitter_failure' ) == '2') {
430
+ echo "<p>".__("Sorry! I couldn't get in touch with the Twitter servers to post your <strong>new link</strong>! You'll have to post it manually, I'm afraid. ", 'wp-to-twitter')."</p>";
 
 
431
  }
432
  if ( get_option( 'wp_url_failure' ) == '1' ) {
433
  _e("<p>The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet. Check with your URL shortening provider to see if there are any known issues.</p>", 'wp-to-twitter');
434
+ } ?>
435
+ <?php $admin_url = ( is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') )?admin_url('admin.php?page=wp-tweets-pro'):admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>
436
+ <form method="post" action="<?php echo $admin_url; ?>">
437
+ <div><input type="hidden" name="submit-type" value="clear-error" /></div>
438
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
439
+ <p><input type="submit" name="submit" value="<?php _e("Clear 'WP to Twitter' Error Messages", 'wp-to-twitter'); ?>" class="button-primary" /></p>
440
+ </form>
441
  </div>
 
 
 
 
442
  <?php
443
  }
444
+ ?>
445
+ <?php if (isset($_GET['export']) && $_GET['export'] == "settings") { print_settings(); } ?>
446
+ <h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
447
+ <div id="wpt_settings_page" class="postbox-container" style="width: 70%">
448
+
449
+ <?php $wp_to_twitter_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) ); ?>
450
+
451
+ <div class="metabox-holder">
452
 
453
  <?php if (function_exists('wtt_connect_oauth') ) { wtt_connect_oauth(); } ?>
454
 
455
+ <?php if (function_exists( 'wpt_pro_functions' ) ) { wpt_pro_functions(); } ?>
456
  <div class="ui-sortable meta-box-sortables">
457
  <div class="postbox">
 
458
 
459
  <h3><?php _e('Basic Settings','wp-to-twitter'); ?></h3>
460
  <div class="inside">
461
  <form method="post" action="">
462
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
463
  <div>
464
  <input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary button-side" />
465
  <?php
478
  <fieldset class='wpt_types'>
479
  <legend><?php _e("Settings for type '$type'",'wp-to-twitter' ); ?></legend>
480
  <p>
481
+ <input type="checkbox" name="wpt_post_types[<?php echo $type; ?>][post-published-update]" id="<?php echo $type; ?>-post-published-update" value="1" <?php echo jd_checkCheckbox('wpt_post_types',$type,'post-published-update')?> />
482
+ <label for="<?php echo $type; ?>-post-published-update"><strong><?php _e("Update when $word $type is published", 'wp-to-twitter'); ?></strong></label> <label for="<?php echo $type; ?>-post-published-text"><br /><?php _e("Text for new $type updates:", 'wp-to-twitter'); ?></label><br /><input type="text" name="wpt_post_types[<?php echo $type; ?>][post-published-text]" id="<?php echo $type; ?>-post-published-text" size="60" maxlength="120" value="<?php if ( isset( $wpt_settings[$type] ) ) { echo esc_attr( stripslashes( $wpt_settings[$type]['post-published-text'] ) ); } ?>" />
483
  </p>
484
  <p>
485
+ <input type="checkbox" name="wpt_post_types[<?php echo $type; ?>][post-edited-update]" id="<?php echo $type; ?>-post-edited-update" value="1" <?php echo jd_checkCheckbox('wpt_post_types',$type,'post-edited-update')?> />
486
+ <label for="<?php echo $type; ?>-post-edited-update"><strong><?php _e("Update when $word $type is edited", 'wp-to-twitter'); ?></strong></label><br /><label for="<?php echo $type; ?>-post-edited-text"><?php _e("Text for $type editing updates:", 'wp-to-twitter'); ?></label><br /><input type="text" name="wpt_post_types[<?php echo $type; ?>][post-edited-text]" id="<?php echo $type; ?>-post-edited-text" size="60" maxlength="120" value="<?php if ( isset( $wpt_settings[$type] ) ) { echo esc_attr( stripslashes( $wpt_settings[$type]['post-edited-text'] ) ); } ?>" />
487
  </p>
488
  </fieldset>
489
  <?php
493
  <fieldset class="comments">
494
  <legend><?php _e('Settings for Comments','wp-to-twitter'); ?></legend>
495
  <p>
496
+ <input type="checkbox" name="comment-published-update" id="comment-published-update" value="1" <?php echo jd_checkCheckbox('comment-published-update')?> />
497
  <label for="comment-published-update"><strong><?php _e("Update Twitter when new comments are posted", 'wp-to-twitter'); ?></strong></label><br />
498
  <label for="comment-published-text"><?php _e("Text for new comments:", 'wp-to-twitter'); ?></label> <input type="text" name="comment-published-text" id="comment-published-text" size="60" maxlength="120" value="<?php echo ( esc_attr( stripslashes( get_option( 'comment-published-text' ) ) ) ); ?>" />
499
  </p>
502
  <fieldset>
503
  <legend><?php _e('Settings for Links','wp-to-twitter'); ?></legend>
504
  <p>
505
+ <input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php echo jd_checkCheckbox('jd_twit_blogroll')?> />
506
  <label for="jd_twit_blogroll"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br />
507
  <label for="newlink-published-text"><?php _e("Text for new link updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( esc_attr( stripslashes( get_option( 'newlink-published-text' ) ) ) ); ?>" /><br /><small><?php _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.','wp-to-twitter'); ?></small>
508
  </p>
553
  <div>
554
  <input type="hidden" name="submit-type" value="suprapi" />
555
  </div>
556
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
557
  <p><input type="submit" name="submit" value="Save Su.pr API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Su.pr API Key" />&raquo; <small><?php _e("Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</a>!<br />You'll need an API key in order to associate the URLs you create with your Su.pr account.", 'wp-to-twitter'); ?></small></p>
558
  </div>
559
  </form>
574
  <div>
575
  <input type="hidden" name="submit-type" value="bitlyapi" />
576
  </div>
577
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
578
  <p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
579
  </div>
580
  </form>
603
  <input type="radio" name="jd_keyword_format" id="jd_keyword_id" value="1" <?php jd_checkSelect( 'jd_keyword_format',1,'checkbox' ); ?> /> <label for="jd_keyword_id"><?php _e("Post ID for YOURLS url slug.",'wp-to-twitter'); ?></label><br />
604
  <input type="radio" name="jd_keyword_format" id="jd_keyword" value="2" <?php jd_checkSelect( 'jd_keyword_format',2,'checkbox' ); ?> /> <label for="jd_keyword"><?php _e("Custom keyword for YOURLS url slug.",'wp-to-twitter'); ?></label><br />
605
  <input type="radio" name="jd_keyword_format" id="jd_keyword_default" value="0" <?php jd_checkSelect( 'jd_keyword_format',0,'checkbox' ); ?> /> <label for="jd_keyword_default"><?php _e("Default: sequential URL numbering.",'wp-to-twitter'); ?></label>
 
606
  </p>
607
  <div>
608
  <input type="hidden" name="submit-type" value="yourlsapi" />
609
  </div>
610
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
611
  <p><input type="submit" name="submit" value="<?php _e('Save YOURLS Account Info','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear YOURLS password','wp-to-twitter'); ?>" /><br /><small><?php _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
612
  </div>
613
  </form>
619
 
620
  <div class="ui-sortable meta-box-sortables">
621
  <div class="postbox">
 
622
  <h3><?php _e('Advanced Settings','wp-to-twitter'); ?></h3>
623
  <div class="inside">
624
  <form method="post" action="">
625
  <div>
626
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
627
  <input type="submit" name="submit" value="<?php _e("Save Advanced WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary button-side" />
628
  <fieldset>
629
  <legend><?php _e("Advanced Tweet settings","wp-to-twitter"); ?></legend>
630
  <p>
631
+ <input type="checkbox" name="jd_strip_nonan" id="jd_strip_nonan" value="1" <?php echo jd_checkCheckbox('jd_strip_nonan'); ?> /> <label for="jd_strip_nonan"><?php _e("Strip nonalphanumeric characters from tags",'wp-to-twitter'); ?></label><br />
632
  <label for="jd_replace_character"><?php _e("Spaces in tags replaced with:",'wp-to-twitter'); ?></label> <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo esc_attr( get_option('jd_replace_character') ); ?>" size="3" /><br />
633
 
634
  <small><?php _e("Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> to remove spaces entirely.",'wp-to-twitter'); ?></small>
653
  <p>
654
  <label for="jd_twit_custom_url"><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( esc_attr( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
655
  <small><?php _e("You can use a custom field to send an alternate URL for your post. The value is the name of a custom field containing your external URL.", 'wp-to-twitter'); ?></small>
656
+ </p>
657
+ <?php
658
+ $inputs = '';
659
+ $default_order = array(
660
+ 'excerpt'=>0,
661
+ 'title'=>1,
662
+ 'date'=>2,
663
+ 'category'=>3,
664
+ 'blogname'=>4,
665
+ 'author'=>5,
666
+ 'account'=>6,
667
+ 'tags'=>7 );
668
+ $preferred_order = get_option( 'wpt_truncation_order' );
669
+ if ( is_array( $preferred_order ) ) { $default_order = $preferred_order; }
670
+ asort($default_order);
671
+ foreach ( $default_order as $k=>$v ) {
672
+ $label = ucfirst($k);
673
+ $inputs .= "<input type='text' size='2' value='$v' name='wpt_truncation_order[$k]' /> <label for='$k-$v'>$label</label><br />";
674
+ }
675
+ ?>
676
+ <fieldset>
677
+ <legend><?php _e('Preferred status update truncation sequence','wp-to-twitter'); ?></legend>
678
+ <p>
679
+ <?php echo $inputs; ?>
680
+ <small><?php _e('This is the order in which items will be abbreviated or removed from your status update if it is too long to send to Twitter.','wp-to-twitter'); ?></small>
681
+ </p>
682
+ </fieldset>
683
  </fieldset>
684
  <fieldset>
685
  <legend><?php _e( "Special Cases when WordPress should send a Tweet",'wp-to-twitter' ); ?></legend>
686
  <p>
687
+ <input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php echo jd_checkCheckbox('jd_tweet_default')?> />
688
+ <label for="jd_tweet_default"><?php _e("Do not post Tweets by default", 'wp-to-twitter'); ?></label><br />
689
  <small><?php _e("By default, all posts meeting other requirements will be posted to Twitter. Check this to change your setting.", 'wp-to-twitter'); ?></small>
690
  </p>
691
  <p>
692
+ <input type="checkbox" name="wpt_inline_edits" id="wpt_inline_edits" value="1" <?php echo jd_checkCheckbox('wpt_inline_edits')?> />
693
  <label for="wpt_inline_edits"><?php _e("Allow status updates from Quick Edit", 'wp-to-twitter'); ?></label><br />
694
+ <small><?php _e("If checked, all posts edited individually or in bulk through the Quick Edit feature will be Tweeted.", 'wp-to-twitter'); ?></small>
695
 
696
  </p>
697
+ <?php if ( function_exists( 'wpt_pro_exists') && get_option( 'wpt_delay_tweets' ) > 0 ) {
698
+ $r_disabled = " disabled='disabled'";
699
+ $r_message = "<em>".__('Delaying tweets with WP Tweets PRO moves Tweeting to an publishing-independent action.','wp-to-twitter' )."</em>";
700
+ } else {
701
+ $r_disabled = '';
702
+ $r_message = '';
703
+ } ?>
704
  <p>
705
+ <input type="checkbox"<?php echo $r_disabled; ?> name="jd_twit_remote" id="jd_twit_remote" value="1" <?php echo jd_checkCheckbox('jd_twit_remote')?> />
706
  <label for="jd_twit_remote"><?php _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)", 'wp-to-twitter'); ?></label><br />
707
+ <?php echo $r_message; ?>
708
  </p>
709
  </fieldset>
710
  <fieldset>
712
  <p><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.","wp-to-twitter"); ?></p>
713
 
714
  <p>
715
+ <input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php echo jd_checkCheckbox('use-twitter-analytics')?> />
716
  <label for="use-twitter-analytics"><?php _e("Use a Static Identifier with WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
717
  <label for="twitter-analytics-campaign"><?php _e("Static Campaign identifier for Google Analytics:", 'wp-to-twitter'); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( esc_attr( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br />
718
  </p>
719
  <p>
720
+ <input type="checkbox" name="use-dynamic-analytics" id="use-dynamic-analytics" value="1" <?php echo jd_checkCheckbox('use_dynamic_analytics')?> />
721
  <label for="use-dynamic-analytics"><?php _e("Use a dynamic identifier with Google Analytics and WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
722
  <label for="jd-dynamic-analytics"><?php _e("What dynamic identifier would you like to use?","wp-to-twitter"); ?></label>
723
  <select name="jd-dynamic-analytics" id="jd-dynamic-analytics">
728
  </select><br />
729
  </p>
730
  </fieldset>
731
+ <fieldset id="indauthors">
732
  <legend><?php _e('Individual Authors','wp-to-twitter'); ?></legend>
733
  <p>
734
+ <input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php echo jd_checkCheckbox('jd_individual_twitter_users')?> />
735
  <label for="jd_individual_twitter_users"><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></label><br /><small><?php _e('Authors can add their username in their user profile. This feature can only add an @reference to the author. The @reference is placed using the <code>#account#</code> shortcode, which will pick up the main account if user accounts are not enabled.', 'wp-to-twitter'); ?></small>
736
  </p>
737
+ <?php
738
+ global $wp_roles;
739
+ $roles = $wp_roles->get_names();
740
+ $options = '';
741
+ $permissions = '';
742
+ $switcher = '';
743
+ foreach ( $roles as $role=>$rolename ) {
744
+ $permissions .= ($role !='subscriber')?"<option value='$role'".wtt_option_selected(get_option('wtt_user_permissions'),$role,'option').">$rolename</option>\n":'';
745
+ $options .= ($role !='subscriber')?"<option value='$role'".wtt_option_selected(get_option('wtt_show_custom_tweet'),$role,'option').">$rolename</option>\n":'';
746
+ $switcher .= ($role !='subscriber')?"<option value='$role'".wtt_option_selected(get_option('wpt_twitter_switch'),$role,'option').">$rolename</option>\n":'';
747
+ }
748
+ ?>
749
  <p>
750
  <label for="wtt_user_permissions"><?php _e('Choose the lowest user group that can add their Twitter information','wp-to-twitter'); ?></label> <select id="wtt_user_permissions" name="wtt_user_permissions">
751
+ <?php echo $permissions; ?>
752
+ </select>
753
+ </p>
754
+ <p>
755
+ <label for="wtt_show_custom_tweet"><?php _e('Choose the lowest user group that can see the Custom Tweet options when posting','wp-to-twitter'); ?></label> <select id="wtt_show_custom_tweet" name="wtt_show_custom_tweet">
756
+ <?php echo $options; ?>
757
+ </select>
758
+ </p>
759
+ <p>
760
+ <label for="wpt_twitter_switch"><?php _e('User groups above this can toggle the Tweet/Don\'t Tweet option, but not see other custom tweet options.','wp-to-twitter'); ?></label> <select id="wpt_twitter_switch" name="wpt_twitter_switch">
761
+ <?php echo $switcher; ?>
762
  </select>
763
  </p>
764
  </fieldset>
765
  <fieldset>
766
  <legend><?php _e('Disable Error Messages','wp-to-twitter'); ?></legend>
767
  <ul>
768
+ <li><input type="checkbox" name="disable_url_failure" id="disable_url_failure" value="1" <?php echo jd_checkCheckbox('disable_url_failure')?> /> <label for="disable_url_failure"><?php _e("Disable global URL shortener error messages.", 'wp-to-twitter'); ?></label></li>
769
+ <li><input type="checkbox" name="disable_twitter_failure" id="disable_twitter_failure" value="1" <?php echo jd_checkCheckbox('disable_twitter_failure')?> /> <label for="disable_twitter_failure"><?php _e("Disable global Twitter API error messages.", 'wp-to-twitter'); ?></label></li>
770
+ <li><input type="checkbox" name="disable_oauth_notice" id="disable_oauth_notice" value="1" <?php echo jd_checkCheckbox('disable_oauth_notice')?> /> <label for="disable_oauth_notice"><?php _e("Disable notification to implement OAuth", 'wp-to-twitter'); ?></label></li>
771
+ <li><input type="checkbox" name="wp_debug_oauth" id="wp_debug_oauth" value="1" <?php echo jd_checkCheckbox('wp_debug_oauth')?> />
772
  <label for="wp_debug_oauth"><?php _e("Get Debugging Data for OAuth Connection", 'wp-to-twitter'); ?></label></li>
773
+ <li><input type="checkbox" name="wpt_http" id="wpt_http" value="1" <?php echo jd_checkCheckbox('wpt_http')?> />
774
+ <label for="wpt_http"><?php _e("Switch to <code>http</code> connection. (Default is https)", 'wp-to-twitter'); ?></label></li>
775
+ <li><input type="checkbox" name="jd_donations" id="jd_donations" value="1" <?php echo jd_checkCheckbox('jd_donations')?> />
776
  <label for="jd_donations"><strong><?php _e("I made a donation, so stop whinging at me, please.", 'wp-to-twitter'); ?></strong></label></li>
777
  </ul>
778
  </fieldset>
786
  </div>
787
  </div>
788
  <div class="ui-sortable meta-box-sortables">
789
+ <div class="postbox categories">
790
  <h3><?php _e('Limit Updating Categories','wp-to-twitter'); ?></h3>
791
+ <div class="inside">
792
+ <p>
793
+ <?php _e('If no categories are checked, limiting by category will be ignored, and all categories will be Tweeted.','wp-to-twitter'); ?>
794
+ <?php if ( get_option('limit_categories') == '0' ) { _e('<em>Category limits are disabled.</em>','wp-to-twitter'); } ?>
795
+ </p>
796
+ <?php jd_list_categories(); ?>
 
 
 
 
797
 
798
+ </div>
799
  </div>
800
+ </div>
 
801
 
802
  <div class="postbox" id="get-support">
803
  <h3><?php _e('Get Plug-in Support','wp-to-twitter'); ?></h3>
804
+ <div class="inside">
805
+ <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?>
806
+ <p><?php _e('Support requests without a donation will not be answered, but will be treated as bug reports.','wp-to-twitter'); ?></p>
807
+ <?php } ?>
808
+ <?php wpt_get_support_form(); ?>
809
+ </div>
810
+ </div>
811
 
812
  <form method="post" action="">
813
  <fieldset>
814
  <input type="hidden" name="submit-type" value="check-support" />
815
+ <?php $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false); echo "<div>$nonce</div>"; ?>
816
  <p>
817
+ <input type="submit" name="submit" value="<?php _e('Check Support','wp-to-twitter'); ?>" class="button-primary" /> <?php _e('Check whether your server supports <a href="http://www.joedolson.com/articles/wp-to-twitter/">WP to Twitter\'s</a> queries to the Twitter and URL shortening APIs. This test will send a status update to Twitter and shorten a URL using your selected methods.','wp-to-twitter'); ?>
818
  </p>
819
  </fieldset>
820
  </form>
821
  </div>
822
  </div>
823
+ <div class="postbox-container" style="width:20%">
824
+ <div class="metabox-holder">
825
+ <div class="ui-sortable meta-box-sortables">
826
+ <div class="postbox">
827
+ <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?>
828
+ <h3><strong><?php _e('Support WP to Twitter','wp-to-twitter'); ?></strong></h3>
829
+ <?php } else { ?>
830
+ <h3><strong><?php _e('WP to Twitter Support','wp-to-twitter'); ?></strong></h3>
831
+ <?php } ?>
832
+ <div class="inside resources">
833
+ <ul>
834
+ <li><a href="?page=wp-to-twitter/wp-to-twitter.php&amp;export=settings"><?php _e("View Settings",'wp-to-twitter'); ?></a></li>
835
+ <?php if ( function_exists( 'wpt_pro_exists' ) ) { $support = admin_url('admin.php?page=wp-tweets-pro'); } else { $support = admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');} ?>
836
+ <li><a href="<?php echo $support; ?>#get-support"><?php _e("Get Support",'wp-to-twitter'); ?></a></li>
837
+ </ul>
838
+ <?php if ( get_option('jd_donations') != 1 && !function_exists( 'wpt_pro_exists' ) ) { ?>
839
+ <div>
840
+ <p><?php _e('<a href="http://www.joedolson.com/donate.php">Make a donation today!</a> Every donation counts - donate $2, $10, or $100 and help me keep this plug-in running!','wp-to-twitter'); ?></p>
841
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
842
+ <div>
843
+ <input type="hidden" name="cmd" value="_s-xclick" />
844
+ <input type="hidden" name="hosted_button_id" value="8490399" />
845
+ <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="Donate" />
846
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
847
+ </div>
848
+ </form>
849
+ </div>
850
+ <?php } ?>
851
+ </div>
852
+ </div>
853
+ </div>
854
+ <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?>
855
+ <div class="ui-sortable meta-box-sortables">
856
+ <div class="postbox">
857
+ <h3><strong><?php _e('Upgrade Now!','wp-to-twitter'); ?></strong></h3>
858
+ <div class="inside purchase">
859
+ <strong><a href="http://www.joedolson.com/articles/wp-tweets-pro/"><?php _e('Upgrade to <strong>WP Tweets PRO</strong> for more control!','wp-to-twitter'); ?></a></strong>
860
+ <p><?php _e('Extra features with the PRO upgrade:','wp-to-twitter'); ?></p>
861
+ <ul>
862
+ <li><?php _e('Users can post to their own Twitter accounts','wp-to-twitter'); ?></li>
863
+ <li><?php _e('Set a timer to send your Tweet minutes or hours after you publish the post','wp-to-twitter'); ?></li>
864
+ <li><?php _e('Automatically re-send Tweets at an assigned time after publishing','wp-to-twitter'); ?></li>
865
+ </ul>
866
+
867
+ </div>
868
+ </div>
869
+ </div>
870
+ <?php } ?>
871
+ <div class="ui-sortable meta-box-sortables">
872
+ <div class="postbox">
873
+ <h3><?php _e('Shortcodes','wp-to-twitter'); ?></h3>
874
+ <div class="inside">
875
+ <p><?php _e("Available in post update templates:", 'wp-to-twitter'); ?></p>
876
+ <ul>
877
+ <li><?php _e("<code>#title#</code>: the title of your blog post", 'wp-to-twitter'); ?></li>
878
+ <li><?php _e("<code>#blog#</code>: the title of your blog", 'wp-to-twitter'); ?></li>
879
+ <li><?php _e("<code>#post#</code>: a short excerpt of the post content", 'wp-to-twitter'); ?></li>
880
+ <li><?php _e("<code>#category#</code>: the first selected category for the post", 'wp-to-twitter'); ?></li>
881
+ <li><?php _e("<code>#date#</code>: the post date", 'wp-to-twitter'); ?></li>
882
+ <li><?php _e("<code>#modified</code>: the post modified date", 'wp-to-twitter'); ?></li>
883
+ <li><?php _e("<code>#url#</code>: the post URL", 'wp-to-twitter'); ?></li>
884
+ <li><?php _e("<code>#author#</code>: the post author",'wp-to-twitter'); ?></li>
885
+ <li><?php _e("<code>#account#</code>: the twitter @reference for the account (or the author, if author settings are enabled and set.)",'wp-to-twitter'); ?></li>
886
+ <li><?php _e("<code>#tags#</code>: your tags modified into hashtags. See options in the Advanced Settings section, below.",'wp-to-twitter'); ?></li>
887
+ </ul>
888
+ <p><?php _e("You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code></p>", 'wp-to-twitter'); ?>
889
+ </div>
890
+ </div>
891
+ </div>
892
+ </div>
893
+ </div>
894
+ </div>
895
+ <?php global $wp_version; }
wp-to-twitter-oauth.php CHANGED
@@ -1,198 +1,283 @@
1
  <?php
2
- // function to test credentials
3
- function wtt_oauth_test() {
4
- return ( wtt_oauth_credentials_to_hash() == get_option('wtt_oauth_hash') );
5
- }
6
- // function to make connection
7
- function wtt_oauth_connection() {
8
- $ack = get_option('app_consumer_key');
9
- $acs = get_option('app_consumer_secret');
10
- $ot = get_option('oauth_token');
11
- $ots = get_option('oauth_token_secret');
12
 
13
- if ( !empty( $ack ) && !empty( $acs ) && !empty( $ot ) && !empty( $ots ) ) {
14
- require_once( WP_PLUGIN_DIR . '/wp-to-twitter/jd_twitterOAuth.php' );
15
- $connection = new jd_TwitterOAuth(
16
- get_option('app_consumer_key'),
17
- get_option('app_consumer_secret'),
18
- get_option('oauth_token'),
19
- get_option('oauth_token_secret')
20
- );
21
- $connection->useragent = 'WP to Twitter http://www.joedolson.com/articles/wp-to-twitter';
22
- return $connection;
 
 
23
  }
24
- else {
25
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
- }
28
 
29
  // convert credentials to md5 hash
30
- function wtt_oauth_credentials_to_hash() {
31
- $hash = md5(get_option('app_consumer_key').get_option('app_consumer_secret').get_option('oauth_token').get_option('oauth_token_secret'));
 
 
 
 
32
  return $hash;
33
  }
34
  // response to settings updates
35
- function jd_update_oauth_settings() {
36
- switch ( $_POST['oauth_settings'] ) {
37
  case 'wtt_oauth_test':
38
- if (!wp_verify_nonce($_POST['_wpnonce'], 'wtt_oauth_test')) {
39
  wp_die('Oops, please try again.');
40
  }
41
  $auth_test = false;
42
- if ( !empty($_POST['wtt_app_consumer_key'])
43
- && !empty($_POST['wtt_app_consumer_secret'])
44
- && !empty($_POST['wtt_oauth_token'])
45
- && !empty($_POST['wtt_oauth_token_secret'])
46
  ) {
47
- update_option('app_consumer_key',trim($_POST['wtt_app_consumer_key']));
48
- update_option('app_consumer_secret',trim($_POST['wtt_app_consumer_secret']));
49
- update_option('oauth_token',trim($_POST['wtt_oauth_token']));
50
- update_option('oauth_token_secret',trim($_POST['wtt_oauth_token_secret']));
51
-
52
- $message = 'fail';
53
-
54
- if ($connection = wtt_oauth_connection()) {
55
- $data = $connection->get('account/verify_credentials');
 
 
 
 
 
 
 
 
 
 
56
  if ($connection->http_code == '200') {
 
57
  $decode = json_decode($data);
58
- update_option('wtt_twitter_username', stripslashes($decode->screen_name));
59
- $oauth_hash = wtt_oauth_credentials_to_hash();
60
- update_option('wtt_oauth_hash', $oauth_hash);
 
 
 
 
 
 
 
 
61
  $message = 'success';
62
  delete_option( 'wpt_curl_error' );
63
  } else if ( $connection->http_code == 0 ) {
64
- $error_information = __("WP to Twitter was unable to make a connection to Twitter. Verify with your host that your server has cURL support and <code>curl_exec()</code> commands are enabled.",'wp-to-twitter');
65
- update_option( 'wpt_curl_error',$error_information);
66
  } else {
67
  $error_information = array("http_code"=>$connection->http_code,"status"=>$connection->http_header['status']);
68
  $error_code = __("Twitter response: http_code $error_information[http_code] - $error_information[status]",'wp-to-twitter');
69
  update_option( 'wpt_curl_error',$error_code );
70
  }
71
  if ( get_option('wp_debug_oauth') == '1' ) {
72
- echo "<pre><strong>Summary Connection Response:</strong><br />";
73
- print_r($error_information);
74
- echo "<br /><strong>Account Verification Data:</strong><br />";
75
- print_r($data);
76
- echo "<br /><strong>Full Connection Response:</strong><br />";
77
- print_r($connection);
78
- echo "</pre>";
79
  }
80
  }
 
 
81
  }
82
  if ( $message == 'failed' && ( time() < strtotime( $connection->http_header['date'] )-300 || time() > strtotime( $connection->http_header['date'] )+300 ) ) {
83
  $message = 'nosync';
84
- }
85
  return $message;
86
  break;
87
  case 'wtt_twitter_disconnect':
88
- if (!wp_verify_nonce($_POST['_wpnonce'], 'wtt_twitter_disconnect')) {
89
  wp_die('Oops, please try again.');
90
  }
91
- update_option('app_consumer_key', '');
92
- update_option('app_consumer_secret', '');
93
- update_option('oauth_token', '');
94
- update_option('oauth_token_secret', '');
 
 
 
 
 
 
 
95
  $message = "cleared";
96
  return $message;
97
  break;
98
  }
 
99
  }
100
 
101
  // connect or disconnect form
102
- function wtt_connect_oauth() {
103
- echo '<div class="ui-sortable meta-box-sortables">';
104
- echo '<div class="postbox">';
105
- echo '<div class="handlediv" title="Click to toggle"><br/></div>';
 
106
  $server_time = date( DATE_COOKIE );
107
-
108
- $response = wp_remote_get( "https://api.twitter.com/1/");
109
  if ( is_wp_error( $response ) ) {
110
- $date = __('There was an error querying Twitter\'s servers.','wp-to-twitter');
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  } else {
112
  $date = date( DATE_COOKIE, strtotime($response['headers']['date']) );
 
113
  }
 
 
 
114
 
115
- if ( !wtt_oauth_test() ) {
 
 
 
 
 
 
116
  print('
117
  <h3>'.__('Connect to Twitter','wp-to-twitter').'</h3>
118
- <div class="inside">
119
- <p>'.__('Your server time:','wp-to-twitter').' <code>'.$server_time.'</code><br />'.__("Twitter's server time:").' <code>'.$date.'</code>.<br />'.__( 'If these times are not within 5 minutes of each other, your server will not be able to connect to Twitter.','wp-to-twitter').'</p>
120
- <p>'.__('The process to set up OAuth authentication for your web site is needlessly laborious. However, this is the method available. Note that you will not add your Twitter username or password to WP to Twitter; they are not used in OAuth authentication.', 'wp-to-twitter').'</p>
121
- <form action="" method="post">
 
 
 
 
122
  <fieldset class="options">
123
  <h4>'.__('1. Register this site as an application on ', 'wp-to-twitter') . '<a href="http://dev.twitter.com/apps/new" target="_blank">'.__('Twitter\'s application registration page','wp-to-twitter').'</a></h4>
124
  <ul>
125
- <li>'.__('If you\'re not currently logged in, log-in with the Twitter username and password which you want associated with this site' , 'wp-to-twitter').'</li>
126
- <li>'.__('Your Application\'s Name will be what shows up after "via" in your twitter stream. Your application name cannot include the word "Twitter." Use the name of your web site.' , 'wp-to-twitter').'</li>
127
- <li>'.__('Your Application Description can be whatever you want.','wp-to-twitter').'</li>
128
  <li>'.__('The WebSite and Callback URL should be ' , 'wp-to-twitter').'<strong>'. get_bloginfo( 'url' ) .'</strong></li>
129
  </ul>
130
- <p>'.__('Agree to the Developer Rules of the Road and continue.','wp-to-twitter').'</p>
131
- <h4>'.__('2. Switch to "Settings" tab in Twitter apps','wp-to-twitter').'</h4>
132
  <ul>
133
  <li>'.__('Select "Read and Write" for the Application Type' , 'wp-to-twitter').'</li>
134
  <li>'.__('Update the application settings' , 'wp-to-twitter').'</li>
135
- <li>'.__('Return to Details tab and create your access token. Refresh page to view your access tokens.','wp-to-twitter').'</li>
136
- </ul>
137
  <p><em>'.__('Once you have registered your site as an application, you will be provided with four keys.' , 'wp-to-twitter').'</em></p>
138
  <h4>'.__('3. Copy and paste your consumer key and consumer secret into the fields below' , 'wp-to-twitter').'</h4>
139
  <div class="tokens">
140
  <p>
141
  <label for="wtt_app_consumer_key">'.__('Twitter Consumer Key', 'wp-to-twitter').'</label>
142
- <input type="text" size="45" name="wtt_app_consumer_key" id="wtt_app_consumer_key" value="'.esc_attr( get_option('app_consumer_key') ).'" />
143
  </p>
144
  <p>
145
  <label for="wtt_app_consumer_secret">'.__('Twitter Consumer Secret', 'wp-to-twitter').'</label>
146
- <input type="text" size="45" name="wtt_app_consumer_secret" id="wtt_app_consumer_secret" value="'.esc_attr( get_option('app_consumer_secret') ).'" />
147
  </p>
148
  </div>
149
  <h4>'.__('4. Copy and paste your Access Token and Access Token Secret into the fields below','wp-to-twitter').'</h4>
150
- <p>'.__('If the Access level reported for your Access Token is not "Read and write", you need to go back to step 2 and generate a new Access Token.','wp-to-twitter').'</p>
151
  <div class="tokens">
152
  <p>
153
  <label for="wtt_oauth_token">'.__('Access Token', 'wp-to-twitter').'</label>
154
- <input type="text" size="45" name="wtt_oauth_token" id="wtt_oauth_token" value="'.esc_attr( get_option('oauth_token') ).'" />
155
  </p>
156
  <p>
157
  <label for="wtt_oauth_token_secret">'.__('Access Token Secret', 'wp-to-twitter').'</label>
158
- <input type="text" size="45" name="wtt_oauth_token_secret" id="wtt_oauth_token_secret" value="'.esc_attr( get_option('oauth_token_secret') ).'" />
159
  </p>
160
  </div>
161
  </fieldset>
162
- <p class="submit">
163
- <input type="submit" name="submit" class="button-primary" value="'.__('Connect to Twitter', 'wp-to-twitter').'" />
164
- </p>
165
  <input type="hidden" name="oauth_settings" value="wtt_oauth_test" class="hidden" style="display: none;" />
166
- '.wp_nonce_field('wtt_oauth_test', '_wpnonce', true, false).wp_referer_field(false).'
167
- </form>
168
  </div>
169
  ');
170
- }
171
- else if ( wtt_oauth_test() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  print('
173
  <h3>'.__('Disconnect from Twitter','wp-to-twitter').'</h3>
174
- <div class="inside">
175
- <form action="" method="post">
176
  <div id="wtt_authentication_display">
177
- <p>'.__('<strong>Troubleshooting tip:</strong> Connected, but getting a notice that your Authentication credentials are missing or incorrect? Check whether your Access token has read and write permission. If not, you\'ll need to create a new token.','wp-to-twitter').'</p>
178
  <fieldset class="options">
179
  <ul>
180
- <li><strong class="auth_label">'.__('Twitter Username ', 'wp-to-twitter').'</strong> <code class="auth_code">'.get_option('wtt_twitter_username').'</code></li>
181
- <li><strong class="auth_label">'.__('Consumer Key ', 'wp-to-twitter').'</strong> <code class="auth_code">'.get_option('app_consumer_key').'</code></li>
182
- <li><strong class="auth_label">'.__('Consumer Secret ', 'wp-to-twitter').'</strong> <code class="auth_code">'.get_option('app_consumer_secret').'</code></li>
183
- <li><strong class="auth_label">'.__('Access Token ', 'wp-to-twitter').'</strong> <code class="auth_code">'.get_option('oauth_token').'</code></li>
184
- <li><strong class="auth_label">'.__('Access Token Secret ', 'wp-to-twitter').'</strong> <code class="auth_code">'.get_option('oauth_token_secret').'</code></li>
185
  </ul>
186
  </fieldset>
187
  <div>
188
- <input type="submit" name="submit" class="button-primary" value="'.__('Disconnect Your WordPress and Twitter Account', 'wp-to-twitter').'" />
189
- <input type="hidden" name="oauth_settings" value="wtt_twitter_disconnect" class="hidden" style="display: none;" />
190
- '.wp_nonce_field('wtt_twitter_disconnect', '_wpnonce', true, false).wp_referer_field(false).'
191
  </div>
192
  </div>
193
- </form>
194
- <p>'.__('Your server time:','wp-to-twitter').' <code>'.$server_time.'</code>.<br />'.__('Twitter\'s current server time: ','wp-to-twitter').'<code>'.$date.'</code>.</p><p> '.__( 'If these times are not within 5 minutes of each other, your server could lose its connection with Twitter.','wp-to-twitter').'</p></div>');
 
 
 
 
 
 
195
  }
196
- echo "</div>";
197
- echo "</div>";
198
  }
1
  <?php
2
+ // WPT PRO: Apply contextual usage so that all functions can be used by independent users. //
 
 
 
 
 
 
 
 
 
3
 
4
+ // function to test credentials
5
+ function wtt_oauth_test( $auth=false, $context='' ) {
6
+ if ( !$auth ) {
7
+ return ( wtt_oauth_credentials_to_hash() == get_option('wtt_oauth_hash') );
8
+ } else {
9
+ $return = ( wtt_oauth_credentials_to_hash( $auth ) == get_user_meta( $auth,'wtt_oauth_hash',true ) );
10
+ if ( !$return && $context != 'verify' ) {
11
+ return ( wtt_oauth_credentials_to_hash() == get_option('wtt_oauth_hash') );
12
+ } else {
13
+ return $return;
14
+ }
15
+ }
16
  }
17
+ // function to make connection
18
+ function wtt_oauth_connection( $auth=false ) {
19
+ if ( !$auth ) {
20
+ $ack = get_option('app_consumer_key');
21
+ $acs = get_option('app_consumer_secret');
22
+ $ot = get_option('oauth_token');
23
+ $ots = get_option('oauth_token_secret');
24
+ } else {
25
+ $ack = get_user_meta( $auth,'app_consumer_key',true);
26
+ $acs = get_user_meta( $auth,'app_consumer_secret',true);
27
+ $ot = get_user_meta( $auth,'oauth_token',true);
28
+ $ots = get_user_meta( $auth,'oauth_token_secret',true);
29
+ }
30
+ if ( !empty( $ack ) && !empty( $acs ) && !empty( $ot ) && !empty( $ots ) ) {
31
+ require_once( WP_PLUGIN_DIR . '/wp-to-twitter/jd_twitterOAuth.php' );
32
+ $connection = new jd_TwitterOAuth( $ack,$acs,$ot,$ots );
33
+ $connection->useragent = 'WP to Twitter http://www.joedolson.com/articles/wp-to-twitter';
34
+ return $connection;
35
+ } else {
36
+ return false;
37
+ }
38
  }
 
39
 
40
  // convert credentials to md5 hash
41
+ function wtt_oauth_credentials_to_hash( $auth=false ) {
42
+ if ( !$auth ) {
43
+ $hash = md5(get_option('app_consumer_key').get_option('app_consumer_secret').get_option('oauth_token').get_option('oauth_token_secret'));
44
+ } else {
45
+ $hash = md5( get_user_meta( $auth,'app_consumer_key',true ). get_user_meta( $auth,'app_consumer_secret',true ). get_user_meta( $auth,'oauth_token',true ). get_user_meta( $auth,'oauth_token_secret',true ) );
46
+ }
47
  return $hash;
48
  }
49
  // response to settings updates
50
+ function jd_update_oauth_settings( $auth=false, $post=false ) {
51
+ switch ( $post['oauth_settings'] ) {
52
  case 'wtt_oauth_test':
53
+ if ( !wp_verify_nonce( $post['_wpnonce'], 'wp-to-twitter-nonce' ) && !$auth ) {
54
  wp_die('Oops, please try again.');
55
  }
56
  $auth_test = false;
57
+ if ( !empty($post['wtt_app_consumer_key'])
58
+ && !empty($post['wtt_app_consumer_secret'])
59
+ && !empty($post['wtt_oauth_token'])
60
+ && !empty($post['wtt_oauth_token_secret'])
61
  ) {
62
+ $ack = trim($post['wtt_app_consumer_key']);
63
+ $acs = trim($post['wtt_app_consumer_secret']);
64
+ $ot = trim($post['wtt_oauth_token']);
65
+ $ots =trim($post['wtt_oauth_token_secret']);
66
+ if ( !$auth ) {
67
+ update_option('app_consumer_key',$ack);
68
+ update_option('app_consumer_secret',$acs);
69
+ update_option('oauth_token',$ot);
70
+ update_option('oauth_token_secret',$ots);
71
+ } else {
72
+ update_user_meta( $auth,'app_consumer_key',$ack);
73
+ update_user_meta( $auth,'app_consumer_secret',$acs);
74
+ update_user_meta( $auth,'oauth_token',$ot);
75
+ update_user_meta( $auth,'oauth_token_secret',$ots);
76
+ }
77
+ $message = 'failed';
78
+ if ( $connection = wtt_oauth_connection( $auth ) ) {
79
+ $protocol = ( get_option( 'wpt_http' ) == '1' )?'http:':'https:';
80
+ $data = $connection->get($protocol.'//api.twitter.com/1/account/verify_credentials.json');
81
  if ($connection->http_code == '200') {
82
+ $error_information = '';
83
  $decode = json_decode($data);
84
+ if ( !$auth ) {
85
+ update_option( 'wtt_twitter_username', stripslashes( $decode->screen_name ) );
86
+ } else {
87
+ update_user_meta( $auth,'wtt_twitter_username', stripslashes( $decode->screen_name ) );
88
+ }
89
+ $oauth_hash = wtt_oauth_credentials_to_hash( $auth );
90
+ if ( !$auth ) {
91
+ update_option( 'wtt_oauth_hash', $oauth_hash );
92
+ } else {
93
+ update_user_meta( $auth,'wtt_oauth_hash',$oauth_hash );
94
+ }
95
  $message = 'success';
96
  delete_option( 'wpt_curl_error' );
97
  } else if ( $connection->http_code == 0 ) {
98
+ $error_information = __("WP to Twitter was unable to establish a connection to Twitter.",'wp-to-twitter');
99
+ update_option( 'wpt_curl_error',$error_information );
100
  } else {
101
  $error_information = array("http_code"=>$connection->http_code,"status"=>$connection->http_header['status']);
102
  $error_code = __("Twitter response: http_code $error_information[http_code] - $error_information[status]",'wp-to-twitter');
103
  update_option( 'wpt_curl_error',$error_code );
104
  }
105
  if ( get_option('wp_debug_oauth') == '1' ) {
106
+ echo "<pre><strong>Summary Connection Response:</strong><br />";
107
+ print_r($error_information);
108
+ echo "<br /><strong>Account Verification Data:</strong><br />";
109
+ print_r($data);
110
+ echo "<br /><strong>Full Connection Response:</strong><br />";
111
+ print_r($connection);
112
+ echo "</pre>";
113
  }
114
  }
115
+ } else {
116
+ $message = "nodata";
117
  }
118
  if ( $message == 'failed' && ( time() < strtotime( $connection->http_header['date'] )-300 || time() > strtotime( $connection->http_header['date'] )+300 ) ) {
119
  $message = 'nosync';
120
+ }
121
  return $message;
122
  break;
123
  case 'wtt_twitter_disconnect':
124
+ if ( !wp_verify_nonce($post['_wpnonce'], 'wp-to-twitter-nonce') && !$auth ) {
125
  wp_die('Oops, please try again.');
126
  }
127
+ if ( !$auth ) {
128
+ update_option('app_consumer_key', '');
129
+ update_option('app_consumer_secret', '');
130
+ update_option('oauth_token', '');
131
+ update_option('oauth_token_secret', '');
132
+ } else {
133
+ delete_user_meta( $auth, 'app_consumer_key' );
134
+ delete_user_meta( $auth, 'app_consumer_secret' );
135
+ delete_user_meta( $auth, 'oauth_token' );
136
+ delete_user_meta( $auth, 'oauth_token_secret' );
137
+ }
138
  $message = "cleared";
139
  return $message;
140
  break;
141
  }
142
+ return "Nothing";
143
  }
144
 
145
  // connect or disconnect form
146
+ function wtt_connect_oauth( $auth=false ) {
147
+ if ( !$auth ) {
148
+ echo '<div class="ui-sortable meta-box-sortables">';
149
+ echo '<div class="postbox">';
150
+ }
151
  $server_time = date( DATE_COOKIE );
152
+ $protocol = ( get_option( 'wpt_http' ) == '1' )?'http:':'https:';
153
+ $response = wp_remote_get( "$protocol//api.twitter.com/1/" );
154
  if ( is_wp_error( $response ) ) {
155
+ $warning = '';
156
+ $error = $response->errors;
157
+ if ( is_array( $error ) ) {
158
+ $warning = "<ul>";
159
+ foreach ( $error as $k=>$e ) {
160
+ foreach ( $e as $v ) {
161
+ $warning .= "<li>".$v."</li>";
162
+ }
163
+ }
164
+ $warning .= "</ul>";
165
+ }
166
+ if ( strpos( $warning, 'SSL' ) !== false ) { $ssl = __("SSL Problems? Try <a href='#wpt_http'>switching to <code>http</code> queries</a>.<br />",'wp-to-twitter'); } else { $ssl = __('Error Message:','wp-to-twitter'); }
167
+ $date = __("There was an error querying Twitter's servers",'wp-to-twitter');
168
+ $errors = "<p>".$ssl.$warning."</p>";
169
  } else {
170
  $date = date( DATE_COOKIE, strtotime($response['headers']['date']) );
171
+ $errors = '';
172
  }
173
+ $class = ( $auth )?'wpt-profile':'wpt-settings';
174
+ $form = ( !$auth )?'<form action="" method="post">':'';
175
+ $nonce = ( !$auth )?wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false).'</form>':'';
176
 
177
+ if ( !wtt_oauth_test( $auth,'verify' ) ) {
178
+ $ack = ( !$auth )?esc_attr( get_option('app_consumer_key') ):esc_attr( get_user_meta( $auth,'app_consumer_key', true ) );
179
+ $acs = ( !$auth )?esc_attr( get_option('app_consumer_secret') ):esc_attr( get_user_meta( $auth,'app_consumer_secret', true ) );
180
+ $ot = ( !$auth )?esc_attr( get_option('oauth_token') ):esc_attr( get_user_meta( $auth,'oauth_token', true ) );
181
+ $ots = ( !$auth )?esc_attr( get_option('oauth_token_secret') ):esc_attr( get_user_meta( $auth,'oauth_token_secret', true ) );
182
+
183
+ $submit = ( !$auth )?'<p class="submit"><input type="submit" name="submit" class="button-primary" value="'.__('Connect to Twitter', 'wp-to-twitter').'" /></p>':'';
184
  print('
185
  <h3>'.__('Connect to Twitter','wp-to-twitter').'</h3>
186
+ <div class="inside '.$class.'">
187
+ <div class="notes">
188
+ <h4>'.__('WP to Twitter Set-up','wp-to-twitter').'</h4>
189
+ <p>'.__('Your server time:','wp-to-twitter').' <code>'.$server_time.'</code> '.__("Twitter's time:").' <code>'.$date.'</code>.'.__( 'If these timestamps are not within 5 minutes of each other, your server will not connect to Twitter.','wp-to-twitter').'</p>
190
+ '.$errors.'
191
+ <p>'.__('<em>Note</em>: you will not add your Twitter user information to WP to Twitter; it is not used in this authentication method.', 'wp-to-twitter').'</p>
192
+ </div>
193
+ '.$form.'
194
  <fieldset class="options">
195
  <h4>'.__('1. Register this site as an application on ', 'wp-to-twitter') . '<a href="http://dev.twitter.com/apps/new" target="_blank">'.__('Twitter\'s application registration page','wp-to-twitter').'</a></h4>
196
  <ul>
197
+ <li>'.__('If you\'re not currently logged in to Twitter, log-in to the account you want associated with this site' , 'wp-to-twitter').'</li>
198
+ <li>'.__('Your Application\'s Name will show up after "via" in your twitter stream. Your application name cannot include the word "Twitter."' , 'wp-to-twitter').'</li>
199
+ <li>'.__('Your Application Description can be anything.','wp-to-twitter').'</li>
200
  <li>'.__('The WebSite and Callback URL should be ' , 'wp-to-twitter').'<strong>'. get_bloginfo( 'url' ) .'</strong></li>
201
  </ul>
202
+ <p><em>'.__('Agree to the Developer Rules of the Road and continue.','wp-to-twitter').'</em></p>
203
+ <h4>'.__('2. Switch to the "Settings" tab in Twitter apps','wp-to-twitter').'</h4>
204
  <ul>
205
  <li>'.__('Select "Read and Write" for the Application Type' , 'wp-to-twitter').'</li>
206
  <li>'.__('Update the application settings' , 'wp-to-twitter').'</li>
207
+ <li>'.__('Return to the Details tab and create your access token. Refresh page to view your access tokens.','wp-to-twitter').'</li>
208
+ </ul>
209
  <p><em>'.__('Once you have registered your site as an application, you will be provided with four keys.' , 'wp-to-twitter').'</em></p>
210
  <h4>'.__('3. Copy and paste your consumer key and consumer secret into the fields below' , 'wp-to-twitter').'</h4>
211
  <div class="tokens">
212
  <p>
213
  <label for="wtt_app_consumer_key">'.__('Twitter Consumer Key', 'wp-to-twitter').'</label>
214
+ <input type="text" size="45" name="wtt_app_consumer_key" id="wtt_app_consumer_key" value="'.$ack.'" />
215
  </p>
216
  <p>
217
  <label for="wtt_app_consumer_secret">'.__('Twitter Consumer Secret', 'wp-to-twitter').'</label>
218
+ <input type="text" size="45" name="wtt_app_consumer_secret" id="wtt_app_consumer_secret" value="'.$acs.'" />
219
  </p>
220
  </div>
221
  <h4>'.__('4. Copy and paste your Access Token and Access Token Secret into the fields below','wp-to-twitter').'</h4>
222
+ <p>'.__('If the Access level for your Access Token is not "<em>Read and write</em>", you must return to step 2 and generate a new Access Token.','wp-to-twitter').'</p>
223
  <div class="tokens">
224
  <p>
225
  <label for="wtt_oauth_token">'.__('Access Token', 'wp-to-twitter').'</label>
226
+ <input type="text" size="45" name="wtt_oauth_token" id="wtt_oauth_token" value="'.$ot.'" />
227
  </p>
228
  <p>
229
  <label for="wtt_oauth_token_secret">'.__('Access Token Secret', 'wp-to-twitter').'</label>
230
+ <input type="text" size="45" name="wtt_oauth_token_secret" id="wtt_oauth_token_secret" value="'.$ots.'" />
231
  </p>
232
  </div>
233
  </fieldset>
234
+ '.$submit.'
 
 
235
  <input type="hidden" name="oauth_settings" value="wtt_oauth_test" class="hidden" style="display: none;" />
236
+ '.$nonce.'
 
237
  </div>
238
  ');
239
+ } else if ( wtt_oauth_test( $auth ) ) {
240
+ $ack = ( !$auth )?esc_attr( get_option('app_consumer_key') ):esc_attr( get_user_meta( $auth,'app_consumer_key', true ) );
241
+ $acs = ( !$auth )?esc_attr( get_option('app_consumer_secret') ):esc_attr( get_user_meta( $auth,'app_consumer_secret', true ) );
242
+ $ot = ( !$auth )?esc_attr( get_option('oauth_token') ):esc_attr( get_user_meta( $auth,'oauth_token', true ) );
243
+ $ots = ( !$auth )?esc_attr( get_option('oauth_token_secret') ):esc_attr( get_user_meta( $auth,'oauth_token_secret', true ) );
244
+ $uname = ( !$auth )?esc_attr( get_option('wtt_twitter_username') ):esc_attr( get_user_meta( $auth,'wtt_twitter_username', true ) );
245
+ $nonce = ( !$auth )?wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false).'</form>':'';
246
+ if ( !$auth ) {
247
+ $submit = '
248
+ <input type="submit" name="submit" class="button-primary" value="'.__('Disconnect Your WordPress and Twitter Account', 'wp-to-twitter').'" />
249
+ <input type="hidden" name="oauth_settings" value="wtt_twitter_disconnect" class="hidden" />
250
+ ';
251
+ } else {
252
+ $submit = '<input type="checkbox" name="oauth_settings" value="wtt_twitter_disconnect" id="disconnect" /> <label for="disconnect">'.__('Disconnect your WordPress and Twitter Account','wp-to-twitter').'</label>';
253
+ }
254
+ $warning = ( get_option('wpt_authentication_missing') == 'true' )?'<p>'.__('<strong>Troubleshooting tip:</strong> Connected, but getting a notice that your Authentication credentials are missing or incorrect? Check whether your Access token has read and write permission. If not, you\'ll need to create a new token.','wp-to-twitter').'</p>':'';
255
+
256
  print('
257
  <h3>'.__('Disconnect from Twitter','wp-to-twitter').'</h3>
258
+ <div class="inside '.$class.'">
259
+ '.$form.'
260
  <div id="wtt_authentication_display">
 
261
  <fieldset class="options">
262
  <ul>
263
+ <li><strong class="auth_label">'.__('Twitter Username ', 'wp-to-twitter').'</strong> <code class="auth_code">'.$uname.'</code></li>
264
+ <li><strong class="auth_label">'.__('Consumer Key ', 'wp-to-twitter').'</strong> <code class="auth_code">'.$ack.'</code></li>
265
+ <li><strong class="auth_label">'.__('Consumer Secret ', 'wp-to-twitter').'</strong> <code class="auth_code">'.$acs.'</code></li>
266
+ <li><strong class="auth_label">'.__('Access Token ', 'wp-to-twitter').'</strong> <code class="auth_code">'.$ot.'</code></li>
267
+ <li><strong class="auth_label">'.__('Access Token Secret ', 'wp-to-twitter').'</strong> <code class="auth_code">'.$ots.'</code></li>
268
  </ul>
269
  </fieldset>
270
  <div>
271
+ '.$submit.'
 
 
272
  </div>
273
  </div>
274
+ '.$nonce.'
275
+ <p>'.__('Your server time:','wp-to-twitter').' <code>'.$server_time.'</code>.<br />'.__('Twitter\'s current server time: ','wp-to-twitter').'<code>'.$date.'</code>.</p>
276
+ '.$errors.'
277
+ <p> '.__( 'If these times are not within 5 minutes of each other, your server could lose its connection with Twitter.','wp-to-twitter').'</p></div>');
278
+ }
279
+ if ( !$auth ) {
280
+ echo "</div>";
281
+ echo "</div>";
282
  }
 
 
283
  }
wp-to-twitter.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: WP to Twitter
4
  Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
5
- Description: Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using your chosen URL shortening service. Rich in features for customizing and promoting your Tweets.
6
- Version: 2.3.18
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
@@ -23,7 +23,6 @@ Author URI: http://www.joedolson.com/
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
-
27
  if ( version_compare( get_bloginfo( 'version' ) , '3.0' , '<' ) && is_ssl() ) {
28
  $wp_content_url = str_replace( 'http://' , 'https://' , get_option( 'siteurl' ) );
29
  } else {
@@ -38,32 +37,29 @@ if ( defined('WP_CONTENT_URL') ) {
38
  if ( defined('WP_CONTENT_DIR') ) {
39
  $wp_content_dir = constant('WP_CONTENT_DIR');
40
  }
 
 
41
 
42
- $wp_plugin_url = $wp_content_url . '/plugins';
43
- $wp_plugin_dir = $wp_content_dir . '/plugins';
44
- $wpmu_plugin_url = $wp_content_url . '/mu-plugins';
45
- $wpmu_plugin_dir = $wp_content_dir . '/mu-plugins';
46
-
47
- if ( version_compare( phpversion(), '5.0', '<' ) || ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) ) {
48
- $warning = __('WP to Twitter requires PHP version 5 or above with cURL support. Please upgrade PHP or install cURL to run WP to Twitter.','wp-to-twitter' );
49
  add_action('admin_notices', create_function( '', "echo \"<div class='error'><p>$warning</p></div>\";" ) );
50
-
51
  } else {
52
  require_once( $wp_plugin_dir . '/wp-to-twitter/wp-to-twitter-oauth.php' );
53
  }
54
-
55
  // include service functions
56
  require_once( $wp_plugin_dir . '/wp-to-twitter/functions.php' );
57
 
58
  global $wp_version,$wpt_version,$jd_plugin_url,$jdwp_api_post_status;
59
- $wpt_version = "2.3.18";
60
  $plugin_dir = basename(dirname(__FILE__));
61
  load_plugin_textdomain( 'wp-to-twitter', false, dirname( plugin_basename( __FILE__ ) ) );
62
 
63
- $jdwp_api_post_status = "https://api.twitter.com/1/statuses/update.json";
 
64
 
65
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
66
- $jd_donate_url = "http://www.joedolson.com/donate.php";
67
 
68
  function wpt_marginal_function() {
69
  global $wp_version;
@@ -75,21 +71,19 @@ $exit_msg=__('WP to Twitter requires WordPress 2.9.2 or a more recent version, b
75
  }
76
  }
77
  // check for OAuth configuration
78
- function wpt_check_oauth() {
79
  if ( !function_exists('wtt_oauth_test') ) {
80
  $oauth = false;
81
  } else {
82
- $oauth = wtt_oauth_test();
83
  }
84
  return $oauth;
85
  }
86
  if ( !wpt_check_oauth() && get_option('disable_oauth_notice') != '1' ) {
87
- $message = sprintf(__("Twitter requires authentication by OAuth. You will need to <a href='%s'>update your settings</a> to complete installation of WP to Twitter.", 'wp-to-twitter'), admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'));
88
- if ( get_option('wpt_curl_error') != '' ) {
89
- $message .= get_option('wpt_curl_error');
90
- }
91
  add_action('admin_notices', create_function( "", "if ( ! current_user_can( 'manage_options' ) ) { return; } else {
92
- echo \"<div class='error'><p>$message</p></div>\";}" ) );
93
  }
94
 
95
  function wpt_check_version() {
@@ -106,20 +100,20 @@ $prev_version = get_option( 'wp_to_twitter_version' );
106
  // this is a switch to plan for future versions
107
  $upgrade = version_compare( $prev_version,"2.2.9","<" );
108
  if ($upgrade) {
109
- delete_option( 'x-twitterlogin' );
110
- delete_option( 'twitterlogin' );
111
- delete_option( 'twitterpw' );
112
- delete_option( 'jd-use-link-title' );
113
- delete_option( 'jd-use-link-description' );
114
- delete_option( 'jd_use_both_services' );
115
- delete_option( 'jd-twitter-service-name' );
116
- delete_option( 'jd_api_post_status' );
117
- delete_option( 'jd-twitter-char-limit' );
118
- delete_option( 'x-twitterpw' );
119
- delete_option( 'x_jd_api_post_status' );
120
- delete_option( 'cligsapi' );
121
- delete_option( 'cligslogin' );
122
- delete_option( 'wp_cligs_error' );
123
  }
124
  $upgrade = version_compare( $prev_version, "2.3.1","<" );
125
  if ($upgrade) {
@@ -179,10 +173,58 @@ $upgrade = version_compare( $prev_version, "2.3.15","<" );
179
  }
180
  delete_option( 'use_tags_as_hashtags' );
181
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  update_option( 'wp_to_twitter_version',$wpt_version );
183
  }
184
 
185
- // Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
186
  function external_or_permalink( $post_ID ) {
187
  $ex_link = false;
188
  $wtb_extlink_custom_field = get_option('jd_twit_custom_url');
@@ -194,105 +236,117 @@ function external_or_permalink( $post_ID ) {
194
  }
195
 
196
  // This function performs the API post to Twitter
197
- function jd_doTwitterAPIPost( $twit ) {
198
- // prevent duplicate tweets
199
- if ( !wpt_check_oauth() ) { return true; } // exit silently if not authorized
200
- $check = get_option('jd_last_tweet');
201
- if ( $check == $twit ) {
 
202
  return true;
203
  } else {
204
  global $jdwp_api_post_status;
205
- if ( $twit == '' ) {
206
- return FALSE;
207
- } else {
208
- if ( wtt_oauth_test() && ( $connection = wtt_oauth_connection() ) ) {
209
- $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter' ) );
210
- $http_code = ($connection)?$connection->http_code:'failed';
211
- /*
212
- echo "<pre>";
213
- print_r($connection);
214
- echo "</pre>";
215
- */
216
- switch ($http_code) {
217
- case '200':
218
- $return = true;
219
- $error = __("200 OK: Success!",'wp-to-twitter');
220
- break;
221
- case '400':
222
- $return = false;
223
- $error = __("400 Bad Request: The request was invalid. This is the status code returned during rate limiting.",'wp-to-twitter');
224
- break;
225
- case '401':
226
- $return = false;
227
- $error = __("401 Unauthorized: Authentication credentials were missing or incorrect.",'wp-to-twitter');
228
- break;
229
- case '403':
230
- $return = false;
231
- $error = __("403 Forbidden: The request is understood, but it has been refused. This code is used when requests are understood, but are denied by Twitter. Reasons can include: Too many tweets created in a short time or the same tweet text was submitted twice in a row, among others. This is not an error by WP to Twitter.",'wp-to-twitter');
232
- break;
233
- case '500':
234
- $return = false;
235
- $error = __("500 Internal Server Error: Something is broken at Twitter.",'wp-to-twitter');
236
- break;
237
- case '503':
238
- $return = false;
239
- $error = __("503 Service Unavailable: The Twitter servers are up, but overloaded with requests - Please try again later.",'wp-to-twitter');
240
- break;
241
- case '502':
242
- $return = false;
243
- $error = __("502 Bad Gateway: Twitter is down or being upgraded.",'wp-to-twitter');
244
- break;
245
- default:
246
- $return = false;
247
- $error = __("<strong>Code $http_code</strong>: Twitter did not return a recognized response code.",'wp-to-twitter');
248
- break;
249
- }
250
- update_option( 'jd_last_tweet',$twit );
 
 
 
251
  update_option( 'jd_status_message',$error );
252
- return $return;
253
  } else {
254
- update_option( 'jd_status_message',__('No Twitter OAuth connection found.','wp-to-twitter') );
255
  }
 
 
 
256
  }
257
  }
258
  }
259
 
260
  function fake_normalize( $string ) {
261
  if ( version_compare( PHP_VERSION, '5.0.0', '>=' ) && function_exists('normalizer_normalize') ) {
 
262
  return normalizer_normalize( $string );
263
  } else {
264
- return preg_replace( '~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
265
  }
266
  }
267
 
268
-
269
- function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $thisposturl, $thispostcategory, $thisdate, $post_ID, $authID=FALSE ) {
270
- $sentence = trim($sentence);
271
  // generate all template variable values
272
- $thisposttitle = trim($thisposttitle);
273
- $thisblogtitle = trim($thisblogtitle);
274
- $thispostexcerpt = trim($thispostexcerpt);
 
275
  $thisposturl = trim($thisposturl);
276
- $thispostcategory = trim($thispostcategory);
277
  $post = get_post( $post_ID );
278
  $thisauthor = get_the_author_meta( 'display_name',$post->post_author );
279
  $thistags = generate_hash_tags( $post_ID );
280
-
 
 
281
  if ( get_option( 'jd_individual_twitter_users' ) == 1 ) {
282
- if ( get_user_meta( $authID, 'wp-to-twitter-enable-user',true ) == 'mainAtTwitter' ) {
283
- $thisaccount = "@" . stripcslashes(get_user_meta( $authID, 'wp-to-twitter-user-username',true ));
284
- } else if ( get_user_meta( $authID, 'wp-to-twitter-enable-user',true ) == 'mainAtTwitterPlus' ) {
285
- $thisaccount = "@" . stripcslashes(get_user_meta( $authID, 'wp-to-twitter-user-username',true ) . ' @' . get_option( 'wtt_twitter_username' ));
 
 
286
  }
287
- } else {
288
- $thisaccount = "@".get_option('wtt_twitter_username');
289
  }
290
- if ( get_option( 'jd_twit_prepend' ) != "" && $sentence != '' ) {
291
- $sentence = get_option( 'jd_twit_prepend' ) . " " . $sentence;
292
- }
293
- if ( get_option( 'jd_twit_append' ) != "" && $sentence != '' ) {
294
- $sentence = $sentence . " " . get_option( 'jd_twit_append' );
 
 
295
  }
 
296
  // create full unconditional post sentence - prior to truncation
297
  $post_sentence = str_ireplace( '#account#', $thisaccount, $sentence );
298
  $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
@@ -303,53 +357,76 @@ function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispost
303
  $post_sentence = str_ireplace( '#date#', $thisdate, $post_sentence );
304
  $post_sentence = str_ireplace( '#author#', $thisauthor, $post_sentence );
305
  $post_sentence = str_ireplace( '#tags#', $thistags, $post_sentence );
 
306
 
 
307
  // check total length
308
- $str_length = mb_strlen( urldecode( fake_normalize( $post_sentence ) ) );
309
  if ( $str_length < 140 ) {
310
- if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = substr( $post_sentence,0,139 ); }
311
- return $post_sentence;
312
  } else {
313
 
314
  // what is the excerpt supposed to be?
315
  $length = get_option( 'jd_post_excerpt' );
316
  // build an array of variable names and the number of characters in that variable.
317
  $length_array = array();
318
- $length_array['thispostexcerpt'] = mb_strlen(fake_normalize($thispostexcerpt));
319
- $length_array['thisposttitle'] = mb_strlen(fake_normalize($thisposttitle));
320
- $length_array['thisdate'] = mb_strlen(fake_normalize($thisdate));
321
- $length_array['thispostcategory'] = mb_strlen(fake_normalize($thispostcategory));
322
- $length_array['thisblogtitle'] = mb_strlen(fake_normalize($thisblogtitle));
323
- $length_array['thisauthor'] = mb_strlen(fake_normalize($thisauthor));
324
- $length_array['thisaccount'] = mb_strlen(fake_normalize($thisaccount));
325
- $length_array['thistags'] = mb_strlen(fake_normalize($thistags));
326
  // if the total length is too long, truncate items until the length is appropriate.
327
  // truncation is in order of items which can most afford to be truncated. URL is never truncated.
328
- if ( $str_length > 140 ) {
329
- foreach($length_array AS $key=>$value) {
330
- $str_length = mb_strlen( urldecode( fake_normalize( trim( $post_sentence ) ) ) );
331
- if ( $str_length > 140 ) {
332
- $trim = $str_length - 140;
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  $old_value = ${$key};
334
  // prevent URL from being modified
335
  $post_sentence = str_ireplace( $thisposturl, '#url#', $post_sentence );
336
  // modify the value and replace old with new
337
- $new_value = mb_substr( $old_value,0,-( $trim ) );
 
 
 
 
 
 
 
 
338
  $post_sentence = str_ireplace( $old_value,$new_value,$post_sentence );
339
  // put URL back before checking length
340
  $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
341
  } else {
342
- if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = substr( $post_sentence,0,139 ); }
343
- return $post_sentence;
344
  }
345
  }
346
  }
347
- if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = substr( $post_sentence,0,139 ); }
 
348
  }
349
  return $post_sentence;
350
  }
351
-
352
  function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='false' ) {
 
 
353
  $suprapi = trim ( get_option( 'suprapi' ) );
354
  $suprlogin = trim ( get_option( 'suprlogin' ) );
355
  $bitlyapi = trim ( get_option( 'bitlyapi' ) );
@@ -362,32 +439,32 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='fa
362
  $campaign_type = get_option('jd_dynamic_analytics');
363
  if ($campaign_type == "post_category" && $testmode != 'link' ) {
364
  $category = get_the_category( $post_ID );
365
- $this_campaign = $category[0]->cat_name;
366
  } else if ($campaign_type == "post_ID") {
367
- $this_campaign = $post_ID;
368
  } else if ($campaign_type == "post_title" && $testmode != 'link' ) {
369
  $post = get_post( $post_ID );
370
- $this_campaign = $post->post_title;
371
  } else {
372
  if ( $testmode != 'link' ) {
373
  $post = get_post( $post_ID );
374
  $post_author = $post->post_author;
375
- $this_campaign = get_the_author_meta( 'user_login',$post_author );
376
  } else {
377
  $post_author = '';
378
- $this_campaign = '';
379
  }
380
  }
381
  } else {
382
- $this_campaign = get_option('twitter-analytics-campaign');
383
  }
384
- $this_campaign = urlencode($this_campaign);
385
  if ( strpos( $thispostlink,"%3F" ) === FALSE || strpos( $thispostlink,"?" ) === FALSE ) {
386
  $thispostlink .= "?";
387
  } else {
388
  $thispostlink .= "&";
389
  }
390
- $thispostlink .= "utm_campaign=$this_campaign&utm_medium=twitter&utm_source=twitter";
391
  }
392
  }
393
  $thispostlink = urldecode(trim($thispostlink));
@@ -396,17 +473,17 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='fa
396
  // custom word setting
397
  $keyword_format = ( get_option( 'jd_keyword_format' ) == '1' )?$post_ID:'';
398
  $keyword_format = ( get_option( 'jd_keyword_format' ) == '2' )?get_post_meta( $post_ID,'_yourls_keyword',true ):$keyword_format;
399
- $error = '';
400
  // Generate and grab the short url
401
  switch ( get_option( 'jd_shortener' ) ) {
402
  case 0:
403
  case 1:
404
- $shrink = urldecode($thispostlink);
405
  break;
406
  case 2: // updated to v3 3/31/2010
407
- $decoded = jd_remote_json( "http://api.bit.ly/v3/shorten?longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&format=json" );
 
408
  if ($decoded) {
409
- if ( $decoded['status_code'] != 200 ) {
410
  $shrink = $decoded;
411
  $error = $decoded['status_txt'];
412
  } else {
@@ -419,7 +496,7 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='fa
419
  if ( !is_valid_url($shrink) ) { $shrink = false; update_option( 'wp_bitly_error',$error ); }
420
  break;
421
  case 3:
422
- $shrink = urldecode($thispostlink);
423
  break;
424
  case 4:
425
  if ( $testmode == 'link' ) {
@@ -434,42 +511,42 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='fa
434
  }
435
  break;
436
  case 5:
437
- // local YOURLS installation
438
- $thispostlink = urldecode($thispostlink);
439
- global $yourls_reserved_URL;
440
- define('YOURLS_INSTALLING', true); // Pretend we're installing YOURLS to bypass test for install or upgrade
441
- define('YOURLS_FLOOD_DELAY_SECONDS', 0); // Disable flood check
442
- $opath = get_option( 'yourlspath' );
443
- $ypath = str_replace( 'user','includes', $opath );
444
- if ( file_exists( dirname( $ypath ).'/load-yourls.php' ) ) { // YOURLS 1.4+
445
- global $ydb;
446
- require_once( dirname( $ypath ).'/load-yourls.php' );
447
- if ( function_exists( 'yourls_add_new_link' ) ) {
448
- $yourls_result = yourls_add_new_link( $thispostlink, $keyword_format );
449
- } else {
450
- $yourls_result = $thispostlink;
451
- }
452
- } else { // YOURLS 1.3
453
- require_once( get_option( 'yourlspath' ) );
454
- $yourls_db = new wpdb( YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST );
455
- $yourls_result = yourls_add_new_link( $thispostlink, $keyword_format, $yourls_db );
456
- }
457
- if ($yourls_result) {
458
- $shrink = $yourls_result['shorturl'];
459
  } else {
460
- $shrink = false;
461
  }
 
 
 
 
 
 
 
 
 
 
462
  break;
463
  case 6:
464
- // remote YOURLS installation
465
- $api_url = sprintf( get_option('yourlsurl') . '?username=%s&password=%s&url=%s&format=json&action=shorturl&keyword=%s',
466
- $yourlslogin, $yourlsapi, $thispostlink, $keyword_format );
467
- $json = jd_remote_json( $api_url, false );
468
- if ($json) {
469
- $shrink = $json->shorturl;
470
- } else {
471
- $shrink = false;
472
- }
473
  break;
474
  case 7:
475
  if ( $suprapi != '') {
@@ -518,8 +595,8 @@ function jd_expand_url( $short_url ) {
518
  $decoded = jd_remote_json("http://api.longurl.org/v2/expand?format=json&url=" . $short_url );
519
  $url = $decoded['long-url'];
520
  return $url;
 
521
  }
522
-
523
  function jd_expand_yourl( $short_url, $remote ) {
524
  if ( $remote == 6 ) {
525
  $short_url = urlencode( $short_url );
@@ -550,8 +627,12 @@ function jd_expand_yourl( $short_url, $remote ) {
550
  function in_allowed_category( $array ) {
551
  $allowed_categories = get_option( 'tweet_categories' );
552
  if ( is_array( $array ) && is_array( $allowed_categories ) ) {
553
- $common = @array_intersect( $array,$allowed_categories );
554
- return ( count( $common ) >= 1 )?true:false;
 
 
 
 
555
  } else {
556
  return true;
557
  }
@@ -561,6 +642,7 @@ function jd_post_info( $post_ID ) {
561
  $get_post_info = get_post( $post_ID );
562
  $category_ids = false;
563
  $values = array();
 
564
  // get post author
565
  $values['authId'] = $get_post_info->post_author;
566
  $postdate = $get_post_info->post_date;
@@ -571,8 +653,9 @@ function jd_post_info( $post_ID ) {
571
  $values['_postDate'] = $altdate;
572
  $values['postDate'] = $thisdate;
573
  $moddate = $get_post_info->post_modified;
574
- $moddate = mysql2date( $altformat,$moddate );
575
  $values['_postModified'] = $moddate;
 
576
  // get first category
577
  $category = null;
578
  $categories = get_the_category( $post_ID );
@@ -590,20 +673,44 @@ function jd_post_info( $post_ID ) {
590
  $values['categoryIds'] = $category_ids;
591
  $values['category'] = $category;
592
  $excerpt_length = get_option( 'jd_post_excerpt' );
593
- $values['postExcerpt'] = ( trim( $get_post_info->post_excerpt ) == "" )?@mb_substr( strip_tags( strip_shortcodes( $get_post_info->post_content ) ), 0, $excerpt_length ):@mb_substr( strip_tags( strip_shortcodes( $get_post_info->post_excerpt ) ), 0, $excerpt_length );
 
 
 
 
 
 
 
 
 
594
  $thisposttitle = stripcslashes( strip_tags( $get_post_info->post_title ) );
595
  if ($thisposttitle == "") {
596
  $thisposttitle = stripcslashes( strip_tags( $_POST['title'] ) );
597
  }
598
- $values['postTitle'] = $thisposttitle;
 
599
  $values['postLink'] = external_or_permalink( $post_ID );
600
  $values['blogTitle'] = get_bloginfo( 'name' );
601
  $values['shortUrl'] = get_post_meta( $post_ID, '_wp_jd_clig', TRUE );
602
  $values['postStatus'] = $get_post_info->post_status;
603
  $values['postType'] = $get_post_info->post_type;
 
604
  return $values;
605
  }
606
-
 
 
 
 
 
 
 
 
 
 
 
 
 
607
 
608
  function jd_get_post_meta( $post_ID, $value, $boolean ) {
609
  $return = get_post_meta( $post_ID, "_$value", TRUE );
@@ -631,15 +738,15 @@ function jd_twit( $post_ID ) {
631
  if ( $new == 0 && ( isset( $_POST['edit_date'] ) && $_POST['edit_date'] == 1 && !isset( $_POST['save'] ) ) ) { $new = 1; }
632
  // post modified = updated? // postdate == published? therefore: posts which have been updated after creation (scheduled, updated in draft) may not turn up as new. // postStatus == future
633
  $post_type_settings = get_option('wpt_post_types');
634
- $post_types = array_keys($post_type_settings);
635
  if ( in_array( $post_type, $post_types ) ) {
636
  $sentence = '';
637
  $cT = get_post_meta( $post_ID, '_jd_twitter', true );
638
  if ( isset( $_POST['_jd_twitter'] ) && $_POST['_jd_twitter'] != '' ) { $cT = $_POST['_jd_twitter']; }
639
  $customTweet = ( $cT != '' )?stripcslashes( trim( $cT ) ):'';
640
- // excluded post statuses that should never be tweeted
641
  if ( $post_info['postStatus'] != 'draft' && $post_info['postStatus'] != 'auto-draft' && $post_info['postStatus'] != 'private' && $post_info['postStatus'] != 'inherit' && $post_info['postStatus'] != 'trash' ) {
642
- // && $post_info['postStatus'] != 'pending'
643
  // if ops is set and equals 'publish', this is being edited. Otherwise, it's a new post.
644
  if ( ( $new == 0 && $post_info['postStatus'] != 'future' ) || $is_inline_edit == true ) {
645
  // if this is an old post and editing updates are enabled
@@ -654,7 +761,7 @@ function jd_twit( $post_ID ) {
654
  }
655
  }
656
  }
657
- if ( $newpost || $oldpost ) {
658
  $sentence = ( $customTweet != "" ) ? $customTweet : $nptext;
659
  if ($post_info['shortUrl'] != '') {
660
  $shrink = $post_info['shortUrl'];
@@ -662,12 +769,62 @@ function jd_twit( $post_ID ) {
662
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
663
  store_url( $post_ID, $shrink );
664
  }
665
- $sentence = custom_shortcodes( $sentence, $post_ID );
666
- $sentence = jd_truncate_tweet( $sentence, $post_info['postTitle'], $post_info['blogTitle'], $post_info['postExcerpt'], $shrink, $post_info['category'], $post_info['postDate'], $post_ID, $post_info['authId'] );
 
 
 
 
667
  }
668
  if ( $sentence != '' ) {
669
- if ( get_option('limit_categories') == '0' || in_allowed_category( $post_info['categoryIds'] ) ) {
670
- $sendToTwitter = jd_doTwitterAPIPost( $sentence );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
671
  $jwt = get_post_meta( $post_ID, '_jd_wp_twitter', true );
672
  if ( !is_array( $jwt ) ){ $jwt=array(); }
673
  $jwt[] = urldecode( $sentence );
@@ -685,6 +842,7 @@ function jd_twit( $post_ID ) {
685
  return $post_ID;
686
  }
687
 
 
688
  // Add Tweets on links in Blogroll
689
  function jd_twit_link( $link_ID ) {
690
  wpt_check_version();
@@ -702,21 +860,24 @@ function jd_twit_link( $link_ID ) {
702
  $sentence = mb_substr($sentence,0,116) . '...';
703
  }
704
  $shrink = jd_shorten_link( $thispostlink, $thislinkname, $link_ID, 'link' );
705
- $sentence = ( stripos($sentence,"#url#") === FALSE )?$sentence . " " . $shrink:str_ireplace("#url#",$shrink,$sentence);
 
 
 
 
706
  if ( $sentence != '' ) {
707
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
708
- if ( $sendToTwitter == false ) {
709
- update_option('wp_twitter_failure','2');
710
- }
711
  }
712
  return $link_ID;
713
  } else {
714
- return '';
715
  }
716
  }
717
  // HANDLES xmlrpc POSTS
718
  function jd_twit_xmlrpc( $post_ID ) {
719
  wpt_check_version();
 
720
  $post_info = jd_post_info( $post_ID );
721
  $post_type = $post_info['postType'];
722
  $settings = get_option('wpt_post_types');
@@ -741,14 +902,48 @@ function jd_twit_xmlrpc( $post_ID ) {
741
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
742
  // Stores the short URL in a custom field for later use as needed.
743
  store_url($post_ID, $shrink);
744
- // Check the length of the tweet and truncate parts as necessary.
745
- $sentence = custom_shortcodes( $sentence, $post_ID );
746
- $sentence = jd_truncate_tweet( $sentence, $post_info['postTitle'], $post_info['blogTitle'], $post_info['postExcerpt'], $shrink, $post_info['category'], $post_info['postDate'], $post_ID, $post_info['authId'] );
747
  if ( $sentence != '' ) {
748
- if ( get_option('limit_categories') == '0' || in_allowed_category( $post_info['categoryIds'] ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
749
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
750
  $jwt = get_post_meta( $post_ID, '_jd_wp_twitter', true );
751
- if ( !is_array( $jwt ) ){ $jwt=array(); }
752
  $jwt[] = urldecode( $sentence );
753
  update_post_meta( $post_ID,'_jd_wp_twitter', $jwt );
754
  if ($sendToTwitter == false ) {
@@ -761,12 +956,12 @@ function jd_twit_xmlrpc( $post_ID ) {
761
  }
762
  } // END jd_twit_xmlrpc
763
 
764
- // Add comment tweet based on function from Luis Nobrega
765
  function jd_twit_comment( $comment_id, $approved ) {
766
  $_t = get_comment( $comment_id );
767
  $post_ID = $_t->comment_post_ID;
768
  $commenter = $_t->comment_author;
769
- $jd_tweet_this = get_post_meta( $post_ID, '_jd_tweet_this', TRUE);
770
  if ( $jd_tweet_this != 'no' && $_t->comment_approved == 1 ) { // comments only tweeted on posts which are tweeted
771
  $post_info = jd_post_info( $post_ID );
772
  $sentence = '';
@@ -777,7 +972,7 @@ function jd_twit_comment( $comment_id, $approved ) {
777
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
778
  store_url( $post_ID, $shrink );
779
  }
780
- $sentence = jd_truncate_tweet( $sentence, $post_info['postTitle'], $post_info['blogTitle'], $post_info['postExcerpt'], $shrink, $post_info['category'], $post_info['postDate'], $post_ID, $post_info['authId'] );
781
  $sentence = str_replace("#commenter#",$commenter,$sentence);
782
  if ( $sentence != '' ) {
783
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
@@ -791,21 +986,24 @@ add_action('admin_menu','jd_add_twitter_outer_box');
791
  function store_url($post_ID, $url) {
792
  $shortener = get_option( 'jd_shortener' );
793
  switch ($shortener) {
794
- case 0: case 1: $ext = '_wp';$target = jd_expand_url( $url );break;
795
- case 2: $ext = '_bitly';$target = jd_expand_url( $url );break;
796
- case 3: $ext = '_url';$target = $url;break;
797
- case 4: $ext = '_wp';$target = $url;break;
798
- case 5: case 6: $ext = '_yourls';$target = jd_expand_yourl( $url, $shortener );break;
799
- case 7: $ext = '_supr';$target = jd_expand_url( $url ); break;
800
- case 8: $ext = '_goo';$target = jd_expand_url( $url ); break;
801
- default:$ext = '_ind';$target = $url;
802
  }
803
  if ( get_post_meta ( $post_ID, "_wp_jd$ext", TRUE ) != $url ) {
804
  update_post_meta ( $post_ID, "_wp_jd$ext", $url );
805
  }
806
- if ( get_post_meta ( $post_ID, "_wp_jd_target", TRUE ) != $target ) {
807
- update_post_meta( $post_ID, '_wp_jd_target', $target );
808
- }
 
 
 
809
  }
810
 
811
  function generate_hash_tags( $post_ID ) {
@@ -813,60 +1011,54 @@ function generate_hash_tags( $post_ID ) {
813
  $max_tags = get_option( 'jd_max_tags' );
814
  $max_characters = get_option( 'jd_max_characters' );
815
  $max_characters = ( $max_characters == 0 || $max_characters == "" )?100:$max_characters + 1;
816
- if ($max_tags == 0 || $max_tags == "") {
817
- $max_tags = 100;
818
- }
819
- $tags = get_the_tags( $post_ID );
820
  if ( $tags > 0 ) {
821
- $i = 1;
822
  foreach ( $tags as $value ) {
823
  $tag = $value->name;
824
  $replace = get_option( 'jd_replace_character' );
825
  $strip = get_option( 'jd_strip_nonan' );
826
  $search = "/[^a-zA-Z0-9]/";
827
- if ($replace == "[ ]") { $replace = ""; }
828
  $tag = str_ireplace( " ",$replace,trim( $tag ) );
829
- if ($strip == '1') { $tag = preg_replace( $search, $replace, $tag ); }
830
- if ($replace == "" || !$replace) { $replace = "_"; }
831
- $newtag = "#$tag";
832
- if ( mb_strlen( $newtag ) > 2 && (mb_strlen( $newtag ) <= $max_characters) && ($i <= $max_tags) ) {
833
  $hashtags .= "$newtag ";
834
  $i++;
835
- }
836
  }
837
  }
838
  $hashtags = trim( $hashtags );
839
- if ( mb_strlen( $hashtags ) <= 1 ) {
840
- $hashtags = "";
841
- }
842
  return $hashtags;
843
  }
844
 
845
  function jd_add_twitter_old_box() {
846
  ?>
847
-
848
  <div class="dbx-b-ox-wrapper">
849
- <fieldset id="twitdiv" class="dbx-box">
850
- <div class="dbx-h-andle-wrapper">
851
- <h3 class="dbx-handle"><?php _e('WP to Twitter', 'wp-to-twitter', 'wp-to-twitter') ?></h3>
852
- </div>
853
- <div class="dbx-c-ontent-wrapper">
854
- <div class="dbx-content">
855
- <?php
856
- jd_add_twitter_inner_box();
857
- ?>
858
- </div>
859
- </fieldset>
860
  </div>
861
  <?php
862
  }
863
 
864
  function jd_add_twitter_inner_box() {
 
865
  $post_length = 140;
866
  $wpt_settings = get_option('wpt_post_types');
867
- global $post, $jd_plugin_url, $jd_donate_url;
868
  $post_id = $post;
869
- if (is_object($post_id)) {
870
  $type = $post_id->post_type;
871
  $status = $post_id->post_status;
872
  $post_id = $post_id->ID;
@@ -883,63 +1075,40 @@ global $post, $jd_plugin_url, $jd_donate_url;
883
  $jd_tweet_this = get_post_meta( $post_id, '_jd_tweet_this', true );
884
  if ( $jd_tweet_this == '' ) { $jd_tweet_this = (get_option( 'jd_tweet_default' ) == '1' )?'no':'yes'; }
885
  $jd_short = get_post_meta( $post_id, '_wp_jd_clig', true );
886
- $shortener = "Cli.gs";
887
- if ( $jd_short == "" ) {
888
- $jd_short = get_post_meta( $post_id, '_wp_jd_supr', true );
889
- $shortener = "Su.pr";
890
- }
891
- if ( $jd_short == "" ) {
892
- $jd_short = get_post_meta( $post_id, '_wp_jd_ind', true );
893
- $shortener = "other";
894
- }
895
- if ( $jd_short == "" ) {
896
- $jd_short = get_post_meta( $post_id, '_wp_jd_bitly', true );
897
- $shortener = "Bit.ly";
898
- }
899
- if ( $jd_short == "" ) {
900
- $jd_short = get_post_meta( $post_id, '_wp_jd_wp', true );
901
- $shortener = "WordPress";
902
- }
903
- if ( $jd_short == "" ) {
904
- $jd_short = get_post_meta( $post_id, '_wp_jd_yourls', true );
905
- $shortener = "YOURLS";
906
- }
907
- if ( $jd_short == "" ) {
908
- $jd_direct = get_post_meta( $post_id, '_wp_jd_url', true );
909
- }
910
  $jd_expansion = get_post_meta( $post_id, '_wp_jd_target', true );
911
  $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true );
912
  ?>
913
- <script type="text/javascript">
914
- <!-- Begin
915
- function countChars(field,cntfield) {
916
- cntfield.value = field.value.length;
917
- }
918
- // End -->
919
- </script>
920
  <?php if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } ?>
921
  <?php if ( ! empty( $previous_tweets ) ) { ?>
922
 
923
  <p class='error'><strong><?php _e('Previous Tweets','wp-to-twitter'); ?>:</strong></p>
924
  <ul>
925
  <?php
 
926
  foreach ( $previous_tweets as $previous_tweet ) {
927
  if ( $previous_tweet != '' ) {
928
  $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />";
929
- echo "<li>$previous_tweet <a href='http://twitter.com/?status=$previous_tweet'>Retweet this</a></li>";
930
  }
931
  }
932
  ?>
933
  </ul>
934
  <?php echo "<div>".$hidden_fields."</div>"; } ?>
935
- <p>
936
- <label for="jtw"><?php _e("Custom Twitter Post", 'wp-to-twitter', 'wp-to-twitter') ?></label><br /><textarea class="attachmentlinks" name="_jd_twitter" id="jtw" rows="2" cols="60" onKeyDown="countChars(document.post.jtw,document.post.twitlength)" onKeyUp="countChars(document.post.jtw,document.post.twitlength)"><?php echo esc_attr( $jd_twitter ); ?></textarea>
 
937
  </p>
938
- <p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo esc_attr( mb_strlen( $description) ); ?>" />
939
- <?php $minus_length = $post_length - 21; ?>
940
- <?php _e(" characters.<br />Twitter posts are a maximum of $post_length characters; if your short URL is included in your update, you have about $minus_length characters available. You can use <code>#url#</code>, <code>#title#</code>, <code>#post#</code>, <code>#category#</code>, <code>#date#</code>, <code>#author#</code>, <code>#account#</code>, <code>#tags#</code>, or <code>#blog#</code> to insert the shortened URL, post title, a post excerpt, the first category selected, the post date, the post author, the twitter @reference, tags as hashtags, or blog name into the Tweet.", 'wp-to-twitter', 'wp-to-twitter') ?>
941
  </p>
942
- <p><?php _e('Your template:','wp-to-twitter'); ?> <code><?php echo $jd_template; ?></code></p>
943
 
944
  <?php
945
  if ( get_option('jd_keyword_format') == 2 ) {
@@ -948,24 +1117,47 @@ cntfield.value = field.value.length;
948
  }
949
  ?>
950
  <p>
951
- <a target="__blank" href="<?php echo admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &bull; <a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Make a Donation', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo;
 
 
 
 
952
  </p>
 
 
953
  <?php
954
  // "no" means 'Don't Tweet' (is checked)
955
  $nochecked = ( $jd_tweet_this == 'no' )?' checked="checked"':'';
956
  $yeschecked = ( $jd_tweet_this == 'yes' )?' checked="checked"':'';
957
-
958
  ?>
959
- <p>
960
- <input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /> <label for="jtn"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label> <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /> <label for="jty"><?php _e("Tweet this post.", 'wp-to-twitter'); ?></label>
961
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
962
  <p>
963
  <?php
964
  $this_post = get_post($post_id);
965
  $post_status = $this_post->post_status;
966
  if ($post_status == 'publish') {
967
  if ( $jd_short != "" ) {
968
- _e("The previously-posted $shortener URL for this post is <code>$jd_short</code>, which points to <code>$jd_expansion</code>.", 'wp-to-twitter');
969
  } else {
970
  _e("This URL is direct and has not been shortened: ","wp-to-twitter"); echo "<code>$jd_direct</code>";
971
  }
@@ -997,9 +1189,40 @@ function jd_fix_post_meta( $post_id ) {
997
  }
998
  }
999
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
  // Post the Custom Tweet into the post meta table
1001
  function post_jd_twitter( $id ) {
1002
- if ( isset($_POST['_inline_edit']) ) { return; }
 
1003
  // update meta data to new format
1004
  if ( get_post_meta ( $id, "_jd_post_meta_fixed", true ) != 'true' ) {
1005
  jd_fix_post_meta( $id );
@@ -1025,27 +1248,27 @@ function post_jd_twitter( $id ) {
1025
  update_post_meta( $id, '_jd_tweet_this', $jd_tweet_default );
1026
  }
1027
  }
 
 
 
1028
  }
1029
 
1030
  function jd_twitter_profile() {
1031
  global $user_ID;
1032
  get_currentuserinfo();
1033
- if ( current_user_can( get_option('wtt_user_permissions') ) ) {
1034
- if ( isset($_GET['user_id']) ) {
1035
- $user_edit = (int) $_GET['user_id'];
1036
- } else {
1037
- $user_edit = $user_ID;
1038
- }
1039
  $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user',true );
1040
  $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username',true );
1041
  ?>
1042
- <h3><?php _e('WP to Twitter User Settings', 'wp-to-twitter'); ?></h3>
1043
-
1044
  <table class="form-table">
1045
  <tr>
1046
  <th scope="row"><?php _e("Use My Twitter Username", 'wp-to-twitter'); ?></th>
1047
  <td><input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-3" value="mainAtTwitter"<?php if ($is_enabled == "mainAtTwitter") { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e("Tweet my posts with an @ reference to my username.", 'wp-to-twitter'); ?></label><br />
1048
- <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-4" value="mainAtTwitterPlus"<?php if ($is_enabled == "mainAtTwitterPlus") { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e("Tweet my posts with an @ reference to both my username and to the main site username.", 'wp-to-twitter'); ?></label>
1049
  </td>
1050
  </tr>
1051
  <tr>
@@ -1053,6 +1276,11 @@ function jd_twitter_profile() {
1053
  <td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.', 'wp-to-twitter'); ?></td>
1054
  </tr>
1055
  </table>
 
 
 
 
 
1056
  <?php
1057
  }
1058
  }
@@ -1077,19 +1305,29 @@ function custom_shortcodes( $sentence, $post_ID ) {
1077
  function jd_twitter_save_profile(){
1078
  global $user_ID;
1079
  get_currentuserinfo();
1080
- if ( isset($_POST['user_id']) ) {
1081
  $edit_id = (int) $_POST['user_id'];
1082
  } else {
1083
  $edit_id = $user_ID;
1084
  }
1085
  update_user_meta($edit_id ,'wp-to-twitter-enable-user' , $_POST['wp-to-twitter-enable-user'] );
1086
  update_user_meta($edit_id ,'wp-to-twitter-user-username' , $_POST['wp-to-twitter-user-username'] );
 
 
1087
  }
1088
  function jd_list_categories() {
1089
  $selected = "";
1090
  $categories = get_categories('hide_empty=0');
 
1091
  $input = "<form action=\"\" method=\"post\">
1092
- <fieldset><legend>".__('Check the categories you want to tweet:','wp-to-twitter')."</legend>
 
 
 
 
 
 
 
1093
  <ul>\n";
1094
  $tweet_categories = get_option( 'tweet_categories' );
1095
  foreach ($categories AS $cat) {
@@ -1104,6 +1342,7 @@ function jd_list_categories() {
1104
  }
1105
  $input .= " </ul>
1106
  </fieldset>
 
1107
  <div>
1108
  <input type=\"hidden\" name=\"submit-type\" value=\"setcategories\" />
1109
  <input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"".__('Set Categories','wp-to-twitter')."\" />
@@ -1114,32 +1353,27 @@ function jd_list_categories() {
1114
 
1115
  // Add the administrative settings to the "Settings" menu.
1116
  function jd_addTwitterAdminPages() {
1117
- if ( function_exists( 'add_submenu_page' ) ) {
1118
- $plugin_page = add_options_page( 'WP to Twitter', 'WP to Twitter', 'manage_options', __FILE__, 'jd_wp_Twitter_manage_page' );
1119
  add_action( 'admin_head-'. $plugin_page, 'jd_addTwitterAdminStyles' );
1120
  }
1121
- }
 
1122
  function jd_addTwitterAdminStyles() {
1123
  global $wp_plugin_url, $wp_plugin_dir;
1124
- if ( $_GET['page'] == "wp-to-twitter/wp-to-twitter.php" ) {
1125
  echo '<link type="text/css" rel="stylesheet" href="'.$wp_plugin_url.'/wp-to-twitter/styles.css" />';
1126
  }
1127
- }
1128
- // Include the Manager page
1129
- function jd_wp_Twitter_manage_page() {
1130
- if ( file_exists ( dirname(__FILE__).'/wp-to-twitter-manager.php' )) {
1131
- include( dirname(__FILE__).'/wp-to-twitter-manager.php' );
1132
- } else {
1133
- _e( '<p>Couldn\'t locate the settings page.</p>', 'wp-to-twitter' );
1134
- }
1135
  }
 
1136
  function jd_plugin_action($links, $file) {
1137
- if ($file == plugin_basename(dirname(__FILE__).'/wp-to-twitter.php'))
1138
- $links[] = "<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>" . __('Settings', 'wp-to-twitter', 'wp-to-twitter') . "</a>";
 
 
1139
  return $links;
1140
  }
1141
  //Add Plugin Actions to WordPress
1142
-
1143
  add_filter('plugin_action_links', 'jd_plugin_action', -10, 2);
1144
 
1145
  if ( get_option( 'jd_individual_twitter_users')=='1') {
@@ -1162,15 +1396,17 @@ if ( get_option( 'disable_twitter_failure' ) != '1' ) {
1162
  add_action( 'in_plugin_update_message-wp-to-twitter/wp-to-twitter.php', 'wpt_plugin_update_message' );
1163
  function wpt_plugin_update_message() {
1164
  global $wpt_version;
 
1165
  define('WPT_PLUGIN_README_URL', 'http://svn.wp-plugins.org/wp-to-twitter/trunk/readme.txt');
1166
  $response = wp_remote_get( WPT_PLUGIN_README_URL, array ('user-agent' => 'WordPress/WP to Twitter' . $wpt_version . '; ' . get_bloginfo( 'url' ) ) );
1167
  if ( ! is_wp_error( $response ) || is_array( $response ) ) {
1168
  $data = $response['body'];
1169
  $bits=explode('== Upgrade Notice ==',$data);
1170
- echo '<div id="mc-upgrade"><p><strong style="color:#c22;">Upgrade Notes:</strong> '.nl2br(trim($bits[1])).'</p></div>';
1171
  } else {
1172
  printf(__('<br /><strong>Note:</strong> Please review the <a class="thickbox" href="%1$s">changelog</a> before upgrading.','wp-to-twitter'),'plugin-install.php?tab=plugin-information&amp;plugin=wp-to-twitter&amp;TB_iframe=true&amp;width=640&amp;height=594');
1173
- }
 
1174
  }
1175
 
1176
  add_action( 'save_post','post_jd_twitter', 10 );
2
  /*
3
  Plugin Name: WP to Twitter
4
  Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
5
+ Description: Posts a Tweet when you update your WordPress blog or post to your blogroll, using your chosen URL shortening service. Rich in features for customizing and promoting your Tweets.
6
+ Version: 2.4.5
7
  Author: Joseph Dolson
8
  Author URI: http://www.joedolson.com/
9
  */
23
  along with this program; if not, write to the Free Software
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
 
26
  if ( version_compare( get_bloginfo( 'version' ) , '3.0' , '<' ) && is_ssl() ) {
27
  $wp_content_url = str_replace( 'http://' , 'https://' , get_option( 'siteurl' ) );
28
  } else {
37
  if ( defined('WP_CONTENT_DIR') ) {
38
  $wp_content_dir = constant('WP_CONTENT_DIR');
39
  }
40
+ $wp_plugin_url = $wp_content_url . '/plugins';$wp_plugin_dir = $wp_content_dir . '/plugins';$wpmu_plugin_url = $wp_content_url . '/mu-plugins';$wpmu_plugin_dir = $wp_content_dir . '/mu-plugins';
41
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // required in order to access is_plugin_active()
42
 
43
+ if ( version_compare( phpversion(), '5.0', '<' ) ) {
44
+ $warning = __('WP to Twitter requires PHP version 5 or above. Please upgrade PHP to run WP to Twitter.','wp-to-twitter' );
 
 
 
 
 
45
  add_action('admin_notices', create_function( '', "echo \"<div class='error'><p>$warning</p></div>\";" ) );
 
46
  } else {
47
  require_once( $wp_plugin_dir . '/wp-to-twitter/wp-to-twitter-oauth.php' );
48
  }
49
+ require_once( $wp_plugin_dir . '/wp-to-twitter/wp-to-twitter-manager.php' );
50
  // include service functions
51
  require_once( $wp_plugin_dir . '/wp-to-twitter/functions.php' );
52
 
53
  global $wp_version,$wpt_version,$jd_plugin_url,$jdwp_api_post_status;
54
+ $wpt_version = "2.4.5";
55
  $plugin_dir = basename(dirname(__FILE__));
56
  load_plugin_textdomain( 'wp-to-twitter', false, dirname( plugin_basename( __FILE__ ) ) );
57
 
58
+ $protocol = ( get_option( 'wpt_http' ) == '1' )?'http:':'https:';
59
+ $jdwp_api_post_status = "$protocol//api.twitter.com/1/statuses/update.json";
60
 
61
  $jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
62
+ $jd_donate_url = "http://www.joedolson.com/articles/wp-tweets-pro/";
63
 
64
  function wpt_marginal_function() {
65
  global $wp_version;
71
  }
72
  }
73
  // check for OAuth configuration
74
+ function wpt_check_oauth( $auth=false ) {
75
  if ( !function_exists('wtt_oauth_test') ) {
76
  $oauth = false;
77
  } else {
78
+ $oauth = wtt_oauth_test( $auth );
79
  }
80
  return $oauth;
81
  }
82
  if ( !wpt_check_oauth() && get_option('disable_oauth_notice') != '1' ) {
83
+ $admin_url = ( is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') )?admin_url('admin.php?page=wp-tweets-pro'):admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
84
+ $message = sprintf(__("Twitter requires authentication by OAuth. You will need to <a href='%s'>update your settings</a> to complete installation of WP to Twitter.", 'wp-to-twitter'), $admin_url );
 
 
85
  add_action('admin_notices', create_function( "", "if ( ! current_user_can( 'manage_options' ) ) { return; } else {
86
+ echo \"<div class='error'><p>$message</p></div>\";}" ) );
87
  }
88
 
89
  function wpt_check_version() {
100
  // this is a switch to plan for future versions
101
  $upgrade = version_compare( $prev_version,"2.2.9","<" );
102
  if ($upgrade) {
103
+ delete_option( 'x-twitterlogin' );
104
+ delete_option( 'twitterlogin' );
105
+ delete_option( 'twitterpw' );
106
+ delete_option( 'jd-use-link-title' );
107
+ delete_option( 'jd-use-link-description' );
108
+ delete_option( 'jd_use_both_services' );
109
+ delete_option( 'jd-twitter-service-name' );
110
+ delete_option( 'jd_api_post_status' );
111
+ delete_option( 'jd-twitter-char-limit' );
112
+ delete_option( 'x-twitterpw' );
113
+ delete_option( 'x_jd_api_post_status' );
114
+ delete_option( 'cligsapi' );
115
+ delete_option( 'cligslogin' );
116
+ delete_option( 'wp_cligs_error' );
117
  }
118
  $upgrade = version_compare( $prev_version, "2.3.1","<" );
119
  if ($upgrade) {
173
  }
174
  delete_option( 'use_tags_as_hashtags' );
175
  }
176
+ $upgrade = version_compare( $prev_version, "2.4.0","<" );
177
+ if ( $upgrade ) {
178
+ $perms = get_option('wtt_user_permissions');
179
+ switch( $perms ) {
180
+ case 'read':$update = 'subscriber'; break;
181
+ case 'edit_posts':$update = 'contributor'; break;
182
+ case 'publish_posts':$update = 'author'; break;
183
+ case 'moderate_comments':$update = 'editor'; break;
184
+ case 'manage_options':$update = 'administrator'; break;
185
+ default:$update = 'administrator';
186
+ }
187
+ update_option( 'wtt_user_permissions',$update );
188
+ }
189
+ $upgrade = version_compare( $prev_version, "2.4.1","<" );
190
+ $subscriber = get_role('subscriber');
191
+ $contributor = get_role('contributor');
192
+ $author = get_role('author');
193
+ $editor = get_role('editor');
194
+ $administrator = get_role('administrator');
195
+ $administrator->add_cap('wpt_twitter_oauth');
196
+ $administrator->add_cap('wpt_twitter_custom');
197
+ $administrator->add_cap('wpt_twitter_switch');
198
+ switch ( get_option('wtt_user_permissions') ) {
199
+ case 'subscriber': $subscriber->add_cap('wpt_twitter_oauth'); $contributor->add_cap('wpt_twitter_oauth'); $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
200
+ case 'contributor': $contributor->add_cap('wpt_twitter_oauth'); $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
201
+ case 'author': $author->add_cap('wpt_twitter_oauth'); $editor->add_cap('wpt_twitter_oauth'); break;
202
+ case 'editor':$editor->add_cap('wpt_twitter_oauth'); break;
203
+ case 'administrator': break;
204
+ default:
205
+ $role = get_role( get_option('wtt_user_permissions') );
206
+ if ( is_object($role) ) {
207
+ $role->add_cap('wpt_twitter_oauth');
208
+ }
209
+ break;
210
+ }
211
+ switch ( get_option('wtt_show_custom_tweet') ) {
212
+ case 'subscriber': $subscriber->add_cap('wpt_twitter_custom'); $contributor->add_cap('wpt_twitter_custom'); $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
213
+ case 'contributor': $contributor->add_cap('wpt_twitter_custom'); $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
214
+ case 'author': $author->add_cap('wpt_twitter_custom'); $editor->add_cap('wpt_twitter_custom'); break;
215
+ case 'editor':$editor->add_cap('wpt_twitter_custom'); break;
216
+ case 'administrator': break;
217
+ default:
218
+ $role = get_role( get_option('wtt_show_custom_tweet') );
219
+ if ( is_object($role) ) {
220
+ $role->add_cap('wpt_twitter_custom');
221
+ }
222
+ break;
223
+ }
224
  update_option( 'wp_to_twitter_version',$wpt_version );
225
  }
226
 
227
+ // Function checks for an alternate URL to be Tweeted. Contribution by Bill Berry.
228
  function external_or_permalink( $post_ID ) {
229
  $ex_link = false;
230
  $wtb_extlink_custom_field = get_option('jd_twit_custom_url');
236
  }
237
 
238
  // This function performs the API post to Twitter
239
+ function jd_doTwitterAPIPost( $twit, $auth=false ) {
240
+ // prevent duplicate Tweets
241
+ if ( !wpt_check_oauth( $auth ) ) { return true; } // exit silently if not authorized
242
+
243
+ $check = ( !$auth )?get_option('jd_last_tweet'):get_user_meta( $auth, 'wpt_last_tweet', true ); // get user's last tweet
244
+ if ( $check == $twit || $twit == '' || !$twit ) {
245
  return true;
246
  } else {
247
  global $jdwp_api_post_status;
248
+ if ( wtt_oauth_test( $auth ) && ( $connection = wtt_oauth_connection( $auth ) ) ) {
249
+ $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter' ) );
250
+ $http_code = ($connection)?$connection->http_code:'failed';
251
+ } else if ( wtt_oauth_test( false ) && ( $connection = wtt_oauth_connection( false ) ) ) {
252
+ $connection->post( $jdwp_api_post_status, array( 'status' => $twit, 'source' => 'wp-to-twitter' ) );
253
+ $http_code = ($connection)?$connection->http_code:'failed';
254
+ }
255
+ if ( $connection ) {
256
+ switch ($http_code) {
257
+ case '200':
258
+ $return = true;
259
+ $error = __("200 OK: Success!",'wp-to-twitter');
260
+ delete_option('wpt_authentication_missing');
261
+ break;
262
+ case '400':
263
+ $return = false;
264
+ $error = __("400 Bad Request: The request was invalid. This is the status code returned during rate limiting.",'wp-to-twitter');
265
+ break;
266
+ case '401':
267
+ $return = false;
268
+ $error = __("401 Unauthorized: Authentication credentials were missing or incorrect.",'wp-to-twitter');
269
+ update_option( 'wpt_authentication_missing','true');
270
+ break;
271
+ case '403':
272
+ $return = false;
273
+ $error = __("403 Forbidden: The request is understood, but it has been refused. This code is used when requests are understood, but are denied by Twitter. Reasons can include: Too many Tweets created in a short time or the same Tweet was submitted twice in a row, among others. This is not an error by WP to Twitter.",'wp-to-twitter');
274
+ break;
275
+ case '500':
276
+ $return = false;
277
+ $error = __("500 Internal Server Error: Something is broken at Twitter.",'wp-to-twitter');
278
+ break;
279
+ case '503':
280
+ $return = false;
281
+ $error = __("503 Service Unavailable: The Twitter servers are up, but overloaded with requests - Please try again later.",'wp-to-twitter');
282
+ break;
283
+ case '502':
284
+ $return = false;
285
+ $error = __("502 Bad Gateway: Twitter is down or being upgraded.",'wp-to-twitter');
286
+ break;
287
+ default:
288
+ $return = false;
289
+ $error = __("<strong>Code $http_code</strong>: Twitter did not return a recognized response code.",'wp-to-twitter');
290
+ break;
291
+ }
292
+ // debugging
293
+ //wp_mail('joe@joedolson.com','Response code',"$http_code $error" );
294
+ // end debugging
295
+ $update = ( !$auth )?update_option( 'jd_last_tweet',$twit ):update_user_meta( $auth, 'wpt_last_tweet',$twit );
296
+ if ( !$return ) {
297
  update_option( 'jd_status_message',$error );
 
298
  } else {
299
+ delete_option( 'jd_status_message' );
300
  }
301
+ return $return;
302
+ } else {
303
+ update_option( 'jd_status_message',__('No Twitter OAuth connection found.','wp-to-twitter') );
304
  }
305
  }
306
  }
307
 
308
  function fake_normalize( $string ) {
309
  if ( version_compare( PHP_VERSION, '5.0.0', '>=' ) && function_exists('normalizer_normalize') ) {
310
+ if ( normalizer_is_normalized( $string ) ) { return $string; }
311
  return normalizer_normalize( $string );
312
  } else {
313
+ return preg_replace( '~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|mp);~i', '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) );
314
  }
315
  }
316
 
317
+ function jd_truncate_tweet( $sentence, $postinfo, $thisposturl, $post_ID, $retweet=false ) {
318
+ $sentence = trim(custom_shortcodes( $sentence, $post_ID ));
 
319
  // generate all template variable values
320
+ $auth = $postinfo['authId'];
321
+ $thisposttitle = trim( apply_filters( 'wpt_status', $postinfo['postTitle'], $post_ID, 'title' ) );
322
+ $thisblogtitle = trim($postinfo['blogTitle']);
323
+ $thispostexcerpt = trim( apply_filters( 'wpt_status', $postinfo['postExcerpt'], $post_ID, 'post' ) );
324
  $thisposturl = trim($thisposturl);
325
+ $thispostcategory = trim($postinfo['category']);
326
  $post = get_post( $post_ID );
327
  $thisauthor = get_the_author_meta( 'display_name',$post->post_author );
328
  $thistags = generate_hash_tags( $post_ID );
329
+ $thisaccount = "@".get_option('wtt_twitter_username');
330
+ $thisdate = trim($postinfo['postDate']);
331
+ $altdate = trim($postinfo['postModified']);
332
  if ( get_option( 'jd_individual_twitter_users' ) == 1 ) {
333
+ if ( get_user_meta( $auth, 'wtt_twitter_username', true ) == '' ) {
334
+ if ( get_user_meta( $auth, 'wp-to-twitter-enable-user',true ) == 'mainAtTwitter' ) {
335
+ $thisaccount = "@" . stripcslashes(get_user_meta( $auth, 'wp-to-twitter-user-username',true ));
336
+ } else if ( get_user_meta( $auth, 'wp-to-twitter-enable-user',true ) == 'mainAtTwitterPlus' ) {
337
+ $thisaccount = "@" . stripcslashes(get_user_meta( $auth, 'wp-to-twitter-user-username',true ) . ' @' . get_option( 'wtt_twitter_username' ));
338
+ }
339
  }
 
 
340
  }
341
+ if ( !$retweet ) {
342
+ if ( get_option( 'jd_twit_prepend' ) != "" && $sentence != '' ) {
343
+ $sentence = get_option( 'jd_twit_prepend' ) . " " . $sentence;
344
+ }
345
+ if ( get_option( 'jd_twit_append' ) != "" && $sentence != '' ) {
346
+ $sentence = $sentence . " " . get_option( 'jd_twit_append' );
347
+ }
348
  }
349
+ $encoding = get_option('blog_charset');
350
  // create full unconditional post sentence - prior to truncation
351
  $post_sentence = str_ireplace( '#account#', $thisaccount, $sentence );
352
  $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
357
  $post_sentence = str_ireplace( '#date#', $thisdate, $post_sentence );
358
  $post_sentence = str_ireplace( '#author#', $thisauthor, $post_sentence );
359
  $post_sentence = str_ireplace( '#tags#', $thistags, $post_sentence );
360
+ $post_sentence = str_ireplace( '#modified#', $altdate, $post_sentence );
361
 
362
+ $url_strlen = mb_strlen( urldecode( fake_normalize( $thisposturl ) ), $encoding );
363
  // check total length
364
+ $str_length = mb_strlen( urldecode( fake_normalize( $post_sentence ) ), $encoding );
365
  if ( $str_length < 140 ) {
366
+ if ( mb_strlen( fake_normalize ( $post_sentence ) ) > 140 ) { $post_sentence = mb_substr( $post_sentence,0,139,$encoding ); }
 
367
  } else {
368
 
369
  // what is the excerpt supposed to be?
370
  $length = get_option( 'jd_post_excerpt' );
371
  // build an array of variable names and the number of characters in that variable.
372
  $length_array = array();
373
+ $length_array['excerpt'] = mb_strlen(fake_normalize($thispostexcerpt),$encoding);
374
+ $length_array['title'] = mb_strlen(fake_normalize($thisposttitle),$encoding);
375
+ $length_array['date'] = mb_strlen(fake_normalize($thisdate),$encoding);
376
+ $length_array['category'] = mb_strlen(fake_normalize($thispostcategory),$encoding);
377
+ $length_array['blogname'] = mb_strlen(fake_normalize($thisblogtitle),$encoding);
378
+ $length_array['author'] = mb_strlen(fake_normalize($thisauthor),$encoding);
379
+ $length_array['account'] = mb_strlen(fake_normalize($thisaccount),$encoding);
380
+ $length_array['tags'] = mb_strlen(fake_normalize($thistags),$encoding);
381
  // if the total length is too long, truncate items until the length is appropriate.
382
  // truncation is in order of items which can most afford to be truncated. URL is never truncated.
383
+ // Twitter has made their t.co shortener automatic and mandatory; this has some weird effects on
384
+ // character counting prior to posting. All URLS are automatically 19 characters. Period.
385
+ $order = get_option( 'wpt_truncation_order' );
386
+ if ( is_array( $order ) ) {
387
+ asort($order);
388
+ $preferred = array();
389
+ foreach ( $order as $k=>$v ) {
390
+ $preferred[$k] = $length_array[$k];
391
+ }
392
+ } else {
393
+ $preferred = $length_array;
394
+ }
395
+ $diff = $url_strlen - 19;
396
+ if ( $str_length > ( 140 + $diff ) ) {
397
+ foreach($preferred AS $key=>$value) {
398
+ $str_length = mb_strlen( urldecode( fake_normalize( trim( $post_sentence ) ) ),$encoding );
399
+ if ( $str_length > ( 140 + $diff ) ) {
400
+ $trim = $str_length - ( 140 + $diff );
401
  $old_value = ${$key};
402
  // prevent URL from being modified
403
  $post_sentence = str_ireplace( $thisposturl, '#url#', $post_sentence );
404
  // modify the value and replace old with new
405
+ if ( $key == 'account' || $key == 'author' || $key == 'category' || $key == 'date' ) {
406
+ // these elements make no sense if truncated, so remove them entirely.
407
+ $new_value = '';
408
+ } else if ( $key == 'tags' ) {
409
+ // remove any stray hash characters due to string truncation
410
+ $new_value = str_replace( ' # ','',' '.mb_substr( $old_value,0,-( $trim ),$encoding ).' ');
411
+ } else {
412
+ $new_value = mb_substr( $old_value,0,-( $trim ),$encoding );
413
+ }
414
  $post_sentence = str_ireplace( $old_value,$new_value,$post_sentence );
415
  // put URL back before checking length
416
  $post_sentence = str_ireplace( '#url#', $thisposturl, $post_sentence );
417
  } else {
418
+ if ( mb_strlen( fake_normalize ( $post_sentence ),$encoding ) > ( 140 + $diff ) ) { $post_sentence = mb_substr( $post_sentence,0,( 139 + $diff ),$encoding ); }
 
419
  }
420
  }
421
  }
422
+ // this is needed in case a tweet needs to be truncated outright and the truncation values aren't in the above.
423
+ if ( mb_strlen( fake_normalize( $post_sentence ) ) > 140 ) { $post_sentence = mb_substr( $post_sentence,0,139,$encoding ); }
424
  }
425
  return $post_sentence;
426
  }
 
427
  function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID, $testmode='false' ) {
428
+ // filter link before sending to shortener or adding analytics
429
+ $thispostlink = apply_filters('wpt_shorten_link',$thispostlink,$post_ID );
430
  $suprapi = trim ( get_option( 'suprapi' ) );
431
  $suprlogin = trim ( get_option( 'suprlogin' ) );
432
  $bitlyapi = trim ( get_option( 'bitlyapi' ) );
439
  $campaign_type = get_option('jd_dynamic_analytics');
440
  if ($campaign_type == "post_category" && $testmode != 'link' ) {
441
  $category = get_the_category( $post_ID );
442
+ $campaign = $category[0]->cat_name;
443
  } else if ($campaign_type == "post_ID") {
444
+ $campaign = $post_ID;
445
  } else if ($campaign_type == "post_title" && $testmode != 'link' ) {
446
  $post = get_post( $post_ID );
447
+ $campaign = $post->post_title;
448
  } else {
449
  if ( $testmode != 'link' ) {
450
  $post = get_post( $post_ID );
451
  $post_author = $post->post_author;
452
+ $campaign = get_the_author_meta( 'user_login',$post_author );
453
  } else {
454
  $post_author = '';
455
+ $campaign = '';
456
  }
457
  }
458
  } else {
459
+ $campaign = get_option('twitter-analytics-campaign');
460
  }
461
+ $campaign = urlencode($campaign);
462
  if ( strpos( $thispostlink,"%3F" ) === FALSE || strpos( $thispostlink,"?" ) === FALSE ) {
463
  $thispostlink .= "?";
464
  } else {
465
  $thispostlink .= "&";
466
  }
467
+ $thispostlink .= "utm_campaign=$campaign&utm_medium=twitter&utm_source=twitter";
468
  }
469
  }
470
  $thispostlink = urldecode(trim($thispostlink));
473
  // custom word setting
474
  $keyword_format = ( get_option( 'jd_keyword_format' ) == '1' )?$post_ID:'';
475
  $keyword_format = ( get_option( 'jd_keyword_format' ) == '2' )?get_post_meta( $post_ID,'_yourls_keyword',true ):$keyword_format;
 
476
  // Generate and grab the short url
477
  switch ( get_option( 'jd_shortener' ) ) {
478
  case 0:
479
  case 1:
480
+ $shrink = urldecode($thispostlink);
481
  break;
482
  case 2: // updated to v3 3/31/2010
483
+ $decoded = jd_remote_json( "http://api.bit.ly/v3/shorten?longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&format=json" );
484
+ $error = '';
485
  if ($decoded) {
486
+ if ($decoded['status_code'] != 200) {
487
  $shrink = $decoded;
488
  $error = $decoded['status_txt'];
489
  } else {
496
  if ( !is_valid_url($shrink) ) { $shrink = false; update_option( 'wp_bitly_error',$error ); }
497
  break;
498
  case 3:
499
+ $shrink = urldecode($thispostlink);
500
  break;
501
  case 4:
502
  if ( $testmode == 'link' ) {
511
  }
512
  break;
513
  case 5:
514
+ // local YOURLS installation
515
+ $thispostlink = urldecode($thispostlink);
516
+ global $yourls_reserved_URL;
517
+ define('YOURLS_INSTALLING', true); // Pretend we're installing YOURLS to bypass test for install or upgrade
518
+ define('YOURLS_FLOOD_DELAY_SECONDS', 0); // Disable flood check
519
+ $opath = get_option( 'yourlspath' );
520
+ $ypath = str_replace( 'user','includes', $opath );
521
+ if ( file_exists( dirname( $ypath ).'/load-yourls.php' ) ) { // YOURLS 1.4+
522
+ global $ydb;
523
+ require_once( dirname( $ypath ).'/load-yourls.php' );
524
+ if ( function_exists( 'yourls_add_new_link' ) ) {
525
+ $yourls_result = yourls_add_new_link( $thispostlink, $keyword_format );
 
 
 
 
 
 
 
 
 
 
526
  } else {
527
+ $yourls_result = $thispostlink;
528
  }
529
+ } else { // YOURLS 1.3
530
+ require_once( get_option( 'yourlspath' ) );
531
+ $yourls_db = new wpdb( YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST );
532
+ $yourls_result = yourls_add_new_link( $thispostlink, $keyword_format, $yourls_db );
533
+ }
534
+ if ($yourls_result) {
535
+ $shrink = $yourls_result['shorturl'];
536
+ } else {
537
+ $shrink = false;
538
+ }
539
  break;
540
  case 6:
541
+ // remote YOURLS installation
542
+ $api_url = sprintf( get_option('yourlsurl') . '?username=%s&password=%s&url=%s&format=json&action=shorturl&keyword=%s',
543
+ $yourlslogin, $yourlsapi, $thispostlink, $keyword_format );
544
+ $json = jd_remote_json( $api_url, false );
545
+ if ($json) {
546
+ $shrink = $json->shorturl;
547
+ } else {
548
+ $shrink = false;
549
+ }
550
  break;
551
  case 7:
552
  if ( $suprapi != '') {
595
  $decoded = jd_remote_json("http://api.longurl.org/v2/expand?format=json&url=" . $short_url );
596
  $url = $decoded['long-url'];
597
  return $url;
598
+ //return $short_url;
599
  }
 
600
  function jd_expand_yourl( $short_url, $remote ) {
601
  if ( $remote == 6 ) {
602
  $short_url = urlencode( $short_url );
627
  function in_allowed_category( $array ) {
628
  $allowed_categories = get_option( 'tweet_categories' );
629
  if ( is_array( $array ) && is_array( $allowed_categories ) ) {
630
+ $common = @array_intersect( $array,$allowed_categories );
631
+ if ( count( $common ) >= 1 ) {
632
+ return true;
633
+ } else {
634
+ return false;
635
+ }
636
  } else {
637
  return true;
638
  }
642
  $get_post_info = get_post( $post_ID );
643
  $category_ids = false;
644
  $values = array();
645
+ $values['id'] = $post_ID;
646
  // get post author
647
  $values['authId'] = $get_post_info->post_author;
648
  $postdate = $get_post_info->post_date;
653
  $values['_postDate'] = $altdate;
654
  $values['postDate'] = $thisdate;
655
  $moddate = $get_post_info->post_modified;
656
+ $moddate = mysql2date( $altformat,$moddate );
657
  $values['_postModified'] = $moddate;
658
+ $values['postModified'] = mysql2date( $dateformat,$moddate );
659
  // get first category
660
  $category = null;
661
  $categories = get_the_category( $post_ID );
673
  $values['categoryIds'] = $category_ids;
674
  $values['category'] = $category;
675
  $excerpt_length = get_option( 'jd_post_excerpt' );
676
+ $post_excerpt = ( trim( $get_post_info->post_excerpt ) == "" )?@mb_substr( strip_tags( strip_shortcodes( $get_post_info->post_content ) ), 0, $excerpt_length ):@mb_substr( strip_tags( strip_shortcodes( $get_post_info->post_excerpt ) ), 0, $excerpt_length );
677
+ $values['postExcerpt'] = html_entity_decode( $post_excerpt, ENT_COMPAT, get_option('blog_charset') );
678
+ /* vestigial qtrans support
679
+ // Want to deal with this later, when I have time to provide full support. Don't see the point in just providing support for titles.
680
+ if ( function_exists( 'something from qtranslate' ) ) {
681
+ $thisposttitle = wpt_qtranslate( $get_post_info->post_title);
682
+ if ($thisposttitle == "") {
683
+ $thisposttitle = wpt_qtranslate( $_POST['title'] ) ;
684
+ }
685
+ } else { */
686
  $thisposttitle = stripcslashes( strip_tags( $get_post_info->post_title ) );
687
  if ($thisposttitle == "") {
688
  $thisposttitle = stripcslashes( strip_tags( $_POST['title'] ) );
689
  }
690
+ /* } */
691
+ $values['postTitle'] = html_entity_decode( $thisposttitle, ENT_COMPAT, get_option('blog_charset') );
692
  $values['postLink'] = external_or_permalink( $post_ID );
693
  $values['blogTitle'] = get_bloginfo( 'name' );
694
  $values['shortUrl'] = get_post_meta( $post_ID, '_wp_jd_clig', TRUE );
695
  $values['postStatus'] = $get_post_info->post_status;
696
  $values['postType'] = $get_post_info->post_type;
697
+ $values = apply_filters( 'wpt_post_info',$values, $post_ID );
698
  return $values;
699
  }
700
+ /*
701
+ function wpt_qtranslate( $string ) {
702
+ $regex='/(<!--:[a-z]+-->)(.*)(<!--:-->)/U';
703
+ preg_match_all($regex,$string,$matches,PREG_PATTERN_ORDER);
704
+ $counter=0;
705
+ $result="";
706
+ if (empty($matches[0])) { return stripcslashes( strip_tags( $string ) ); }
707
+ while ( $counter < count($matches[0]) ) {
708
+ $result .= $matches[1][$counter] . stripcslashes( strip_tags( $matches[2][$counter] ) ) . $matches[3][$counter];
709
+ $counter++;
710
+ }
711
+ return $result;
712
+ }
713
+ */
714
 
715
  function jd_get_post_meta( $post_ID, $value, $boolean ) {
716
  $return = get_post_meta( $post_ID, "_$value", TRUE );
738
  if ( $new == 0 && ( isset( $_POST['edit_date'] ) && $_POST['edit_date'] == 1 && !isset( $_POST['save'] ) ) ) { $new = 1; }
739
  // post modified = updated? // postdate == published? therefore: posts which have been updated after creation (scheduled, updated in draft) may not turn up as new. // postStatus == future
740
  $post_type_settings = get_option('wpt_post_types');
741
+ $post_types = array_keys($post_type_settings);
742
  if ( in_array( $post_type, $post_types ) ) {
743
  $sentence = '';
744
  $cT = get_post_meta( $post_ID, '_jd_twitter', true );
745
  if ( isset( $_POST['_jd_twitter'] ) && $_POST['_jd_twitter'] != '' ) { $cT = $_POST['_jd_twitter']; }
746
  $customTweet = ( $cT != '' )?stripcslashes( trim( $cT ) ):'';
747
+ // excluded post statuses that should never be tweeted
748
  if ( $post_info['postStatus'] != 'draft' && $post_info['postStatus'] != 'auto-draft' && $post_info['postStatus'] != 'private' && $post_info['postStatus'] != 'inherit' && $post_info['postStatus'] != 'trash' ) {
749
+ // && $post_info['postStatus'] != 'pending'
750
  // if ops is set and equals 'publish', this is being edited. Otherwise, it's a new post.
751
  if ( ( $new == 0 && $post_info['postStatus'] != 'future' ) || $is_inline_edit == true ) {
752
  // if this is an old post and editing updates are enabled
761
  }
762
  }
763
  }
764
+ if ($newpost || $oldpost) {
765
  $sentence = ( $customTweet != "" ) ? $customTweet : $nptext;
766
  if ($post_info['shortUrl'] != '') {
767
  $shrink = $post_info['shortUrl'];
769
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
770
  store_url( $post_ID, $shrink );
771
  }
772
+ $sentence = jd_truncate_tweet( $sentence, $post_info, $shrink, $post_ID );
773
+ /* vestigial qtrans support
774
+ $regex="/<!--:[a-z]+-->(.*)<!--:-->/U";
775
+ //Return all the languages in the posttitle
776
+ preg_match_all($regex,$jd_post_info['postTitle'],$matches,PREG_PATTERN_ORDER);
777
+ */
778
  }
779
  if ( $sentence != '' ) {
780
+ if ( get_option('jd_twit_cats') == '1' ) {
781
+ $continue = ( !in_allowed_category( $post_info['categoryIds'] ) )?true:false;
782
+ } else {
783
+ $continue = ( in_allowed_category( $post_info['categoryIds'] ) )?true:false;
784
+ }
785
+ if ( get_option('limit_categories') == '0' ) { $continue = true; }
786
+ if ( $continue ) {
787
+ // WPT PRO //
788
+ if ( function_exists( 'wpt_pro_exists' ) ) {
789
+ $auth = $post_info['authId'];
790
+ $user = get_userdata( $auth );
791
+ $auth_verified = wtt_oauth_test( $auth,'verify' );
792
+ if ( $post_info['wpt_delay_tweet'] == 0 || $post_info['wpt_no_delay'] == 'on' ) {
793
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence, $auth );
794
+ if ( $post_info['wpt_cotweet'] == 1 && $auth_verified ) {
795
+ $offset = rand(60,240); // delay co-tweet by 1-4 minutes.
796
+ wp_schedule_single_event( time()+$offset, 'wpt_schedule_tweet_action', array( 'id'=>false, 'sentence'=>$sentence, 'rt'=>0 ) );
797
+ }
798
+ } else {
799
+ $time = ( (int) $post_info['wpt_delay_tweet'] )*60;
800
+ wp_schedule_single_event( time()+$time, 'wpt_schedule_tweet_action', array( 'id'=>$auth, 'sentence'=>$sentence, 'rt'=>0 ) );
801
+ if ( $post_info['wpt_cotweet'] == 1 && $auth_verified ) {
802
+ $offset = rand(60,240); // delay co-tweet by 1-4 minutes.
803
+ wp_schedule_single_event( time()+$time+$offset, 'wpt_schedule_tweet_action', array( 'id'=>false, 'sentence'=>$sentence, 'rt'=>0 ) );
804
+ }
805
+ $sendToTwitter = true;
806
+ }
807
+ if ( $post_info['wpt_retweet_after'] != 0 && $post_info['wpt_no_repost'] != 'on' ) {
808
+ $repeat = $post_info['wpt_retweet_repeat'];
809
+ for ( $i=1;$i<=$repeat;$i++ ) {
810
+ if ( $i == 1 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
811
+ if ( $i == 2 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt2' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
812
+ if ( $i == 3 ) { $retweet = $sentence; }
813
+ if ( $i == 4 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
814
+ $time = ($post_info['wpt_retweet_after'])*(60*60)*$i;
815
+ wp_schedule_single_event( time()+$time, 'wpt_schedule_tweet_action', array( 'id'=>$auth, 'sentence'=>$retweet, 'rt'=>$i ) );
816
+ if ( $post_info['wpt_cotweet'] == 1 && $auth_verified ) {
817
+ $offset = rand(60,240); // delay each co-tweet by 1-4 minutes
818
+ wp_schedule_single_event( time()+$time+$offset, 'wpt_schedule_tweet_action', array( 'id'=>false, 'sentence'=>$sentence, 'rt'=>$i ) );
819
+ }
820
+ $sendToTwitter = true;
821
+ if ( $i == 4 ) { break; }
822
+ }
823
+ }
824
+ } else {
825
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence );
826
+ }
827
+ // END WPT PRO //
828
  $jwt = get_post_meta( $post_ID, '_jd_wp_twitter', true );
829
  if ( !is_array( $jwt ) ){ $jwt=array(); }
830
  $jwt[] = urldecode( $sentence );
842
  return $post_ID;
843
  }
844
 
845
+
846
  // Add Tweets on links in Blogroll
847
  function jd_twit_link( $link_ID ) {
848
  wpt_check_version();
860
  $sentence = mb_substr($sentence,0,116) . '...';
861
  }
862
  $shrink = jd_shorten_link( $thispostlink, $thislinkname, $link_ID, 'link' );
863
+ if ( stripos($sentence,"#url#") === FALSE ) {
864
+ $sentence = $sentence . " " . $shrink;
865
+ } else {
866
+ $sentence = str_ireplace("#url#",$shrink,$sentence);
867
+ }
868
  if ( $sentence != '' ) {
869
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
870
+ if ( $sendToTwitter == false ) { update_option('wp_twitter_failure','2'); }
 
 
871
  }
872
  return $link_ID;
873
  } else {
874
+ return;
875
  }
876
  }
877
  // HANDLES xmlrpc POSTS
878
  function jd_twit_xmlrpc( $post_ID ) {
879
  wpt_check_version();
880
+
881
  $post_info = jd_post_info( $post_ID );
882
  $post_type = $post_info['postType'];
883
  $settings = get_option('wpt_post_types');
902
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
903
  // Stores the short URL in a custom field for later use as needed.
904
  store_url($post_ID, $shrink);
905
+ // Check the length of the Tweet and truncate parts as necessary.
906
+ $sentence = jd_truncate_tweet( $sentence, $post_info, $shrink, $post_ID );
 
907
  if ( $sentence != '' ) {
908
+ if ( get_option('jd_twit_cats') == '1' ) {
909
+ $continue = ( !in_allowed_category( $post_info['categoryIds'] ) )?true:false;
910
+ } else {
911
+ $continue = ( in_allowed_category( $post_info['categoryIds'] ) )?true:false;
912
+ }
913
+ if ( get_option('limit_categories') == '0' ) { $continue = true; }
914
+ if ( $continue ) {
915
+ // WPT PRO //
916
+ if ( function_exists( 'wpt_pro_exists' ) ) {
917
+ $auth = $post_info['authId'];
918
+ $user = get_userdata( $auth );
919
+ //if ( user_can( $user, 'update_core' ) ) { $auth = false; } // This is the super admin. No, it's not.
920
+ if ( $post_info['wpt_delay_tweet'] == 0 || $post_info['wpt_no_delay'] == 'on' ) {
921
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence, $auth );
922
+ } else {
923
+ $time = ( (int) $post_info['wpt_delay_tweet'] )*60;
924
+ wp_schedule_single_event( time()+$time, 'wpt_schedule_tweet_action', array( 'id'=>$auth, 'sentence'=>$sentence, 'rt'=>0 ) );
925
+ $sendToTwitter = true;
926
+ }
927
+ if ( $post_info['wpt_retweet_after'] != 0 && $post_info['wpt_no_repost'] != 'on' ) {
928
+ $repeat = $post_info['wpt_retweet_repeat'];
929
+ for ( $i=1;$i<=$repeat;$i++ ) {
930
+ if ( $i == 1 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
931
+ if ( $i == 2 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt2' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
932
+ if ( $i == 3 ) { $retweet = $sentence; }
933
+ if ( $i == 4 ) { $retweet = jd_truncate_tweet( trim( get_option( 'wpt_prepend_rt' ).' '.$sentence ), $post_info, $shrink, $post_ID,true ); }
934
+ $time = ($post_info['wpt_retweet_after'])*(60*60)*$i;
935
+ wp_schedule_single_event( time()+$time, 'wpt_schedule_tweet_action', array( 'id'=>$auth, 'sentence'=>$retweet, 'rt'=>$i ) );
936
+ $sendToTwitter = true;
937
+ if ( $i == 4 ) { break; }
938
+ }
939
+ }
940
+ } else {
941
+ $sendToTwitter = jd_doTwitterAPIPost( $sentence );
942
+ }
943
+ // END WPT PRO //
944
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
945
  $jwt = get_post_meta( $post_ID, '_jd_wp_twitter', true );
946
+ if ( !is_array( $jwt ) ){ $jwt=array(); }
947
  $jwt[] = urldecode( $sentence );
948
  update_post_meta( $post_ID,'_jd_wp_twitter', $jwt );
949
  if ($sendToTwitter == false ) {
956
  }
957
  } // END jd_twit_xmlrpc
958
 
959
+ // Add comment Tweet function from Luis Nobrega
960
  function jd_twit_comment( $comment_id, $approved ) {
961
  $_t = get_comment( $comment_id );
962
  $post_ID = $_t->comment_post_ID;
963
  $commenter = $_t->comment_author;
964
+ $jd_tweet_this = get_post_meta( $post_ID, '_jd_tweet_this', TRUE );
965
  if ( $jd_tweet_this != 'no' && $_t->comment_approved == 1 ) { // comments only tweeted on posts which are tweeted
966
  $post_info = jd_post_info( $post_ID );
967
  $sentence = '';
972
  $shrink = jd_shorten_link( $post_info['postLink'], $post_info['postTitle'], $post_ID );
973
  store_url( $post_ID, $shrink );
974
  }
975
+ $sentence = jd_truncate_tweet( $sentence, $post_info, $shrink, $post_ID );
976
  $sentence = str_replace("#commenter#",$commenter,$sentence);
977
  if ( $sentence != '' ) {
978
  $sendToTwitter = jd_doTwitterAPIPost( $sentence );
986
  function store_url($post_ID, $url) {
987
  $shortener = get_option( 'jd_shortener' );
988
  switch ($shortener) {
989
+ case 0: case 1: $ext = '_wp';break;
990
+ case 2: $ext = '_bitly';break;
991
+ case 3: $ext = '_url';break;
992
+ case 4: $ext = '_wp';break;
993
+ case 5: case 6: $ext = '_yourls';break;
994
+ case 7: $ext = '_supr'; break;
995
+ case 8: $ext = '_goo'; break;
996
+ default:$ext = '_ind';
997
  }
998
  if ( get_post_meta ( $post_ID, "_wp_jd$ext", TRUE ) != $url ) {
999
  update_post_meta ( $post_ID, "_wp_jd$ext", $url );
1000
  }
1001
+ switch ( $shortener ) {
1002
+ case 0: case 1: case 2: case 7: case 8: $target = jd_expand_url( $url );break;
1003
+ case 5: case 6: $target = jd_expand_yourl( $url, $shortener );break;
1004
+ default: $target = $url;
1005
+ }
1006
+ update_post_meta( $post_ID, '_wp_jd_target', $target );
1007
  }
1008
 
1009
  function generate_hash_tags( $post_ID ) {
1011
  $max_tags = get_option( 'jd_max_tags' );
1012
  $max_characters = get_option( 'jd_max_characters' );
1013
  $max_characters = ( $max_characters == 0 || $max_characters == "" )?100:$max_characters + 1;
1014
+ if ($max_tags == 0 || $max_tags == "") { $max_tags = 100; }
1015
+ $tags = get_the_tags( $post_ID );
 
 
1016
  if ( $tags > 0 ) {
1017
+ $i = 1;
1018
  foreach ( $tags as $value ) {
1019
  $tag = $value->name;
1020
  $replace = get_option( 'jd_replace_character' );
1021
  $strip = get_option( 'jd_strip_nonan' );
1022
  $search = "/[^a-zA-Z0-9]/";
1023
+ if ($replace == "[ ]") { $replace = ""; }
1024
  $tag = str_ireplace( " ",$replace,trim( $tag ) );
1025
+ if ($strip == '1') { $tag = preg_replace( $search, $replace, $tag ); }
1026
+ if ($replace == "" || !$replace) { $replace = "_"; }
1027
+ $newtag = "#$tag";
1028
+ if ( mb_strlen( $newtag ) > 2 && (mb_strlen( $newtag ) <= $max_characters) && ($i <= $max_tags) ) {
1029
  $hashtags .= "$newtag ";
1030
  $i++;
1031
+ }
1032
  }
1033
  }
1034
  $hashtags = trim( $hashtags );
1035
+ if ( mb_strlen( $hashtags ) <= 1 ) { $hashtags = ""; }
 
 
1036
  return $hashtags;
1037
  }
1038
 
1039
  function jd_add_twitter_old_box() {
1040
  ?>
 
1041
  <div class="dbx-b-ox-wrapper">
1042
+ <fieldset id="twitdiv" class="dbx-box">
1043
+ <div class="dbx-h-andle-wrapper">
1044
+ <h3 class="dbx-handle"><?php _e('WP Tweets', 'wp-to-twitter', 'wp-to-twitter') ?></h3>
1045
+ </div>
1046
+ <div class="dbx-c-ontent-wrapper">
1047
+ <div class="dbx-content">
1048
+ <?php jd_add_twitter_inner_box(); ?>
1049
+ </div>
1050
+ </div>
1051
+ </fieldset>
 
1052
  </div>
1053
  <?php
1054
  }
1055
 
1056
  function jd_add_twitter_inner_box() {
1057
+ global $post, $jd_plugin_url, $jd_donate_url;
1058
  $post_length = 140;
1059
  $wpt_settings = get_option('wpt_post_types');
 
1060
  $post_id = $post;
1061
+ if ( is_object( $post_id ) ) {
1062
  $type = $post_id->post_type;
1063
  $status = $post_id->post_status;
1064
  $post_id = $post_id->ID;
1075
  $jd_tweet_this = get_post_meta( $post_id, '_jd_tweet_this', true );
1076
  if ( $jd_tweet_this == '' ) { $jd_tweet_this = (get_option( 'jd_tweet_default' ) == '1' )?'no':'yes'; }
1077
  $jd_short = get_post_meta( $post_id, '_wp_jd_clig', true );
1078
+ $sht = "Cli.gs";
1079
+ if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_supr', true ); $sht = "Su.pr"; }
1080
+ if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_ind', true ); $sht = "other"; }
1081
+ if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_bitly', true );$sht = "Bit.ly";}
1082
+ if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_wp', true ); $sht = "WordPress";}
1083
+ if ( $jd_short == "" ) {$jd_short = get_post_meta( $post_id, '_wp_jd_yourls', true );$sht = "YOURLS";}
1084
+ if ( $jd_short == "" ) {$jd_direct = get_post_meta( $post_id, '_wp_jd_url', true );}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1085
  $jd_expansion = get_post_meta( $post_id, '_wp_jd_target', true );
1086
  $previous_tweets = get_post_meta ( $post_id, '_jd_wp_twitter', true );
1087
  ?>
 
 
 
 
 
 
 
1088
  <?php if ( !is_array( $previous_tweets ) && $previous_tweets != '' ) { $previous_tweets = array( 0=>$previous_tweets ); } ?>
1089
  <?php if ( ! empty( $previous_tweets ) ) { ?>
1090
 
1091
  <p class='error'><strong><?php _e('Previous Tweets','wp-to-twitter'); ?>:</strong></p>
1092
  <ul>
1093
  <?php
1094
+ $hidden_fields = '';
1095
  foreach ( $previous_tweets as $previous_tweet ) {
1096
  if ( $previous_tweet != '' ) {
1097
  $hidden_fields .= "<input type='hidden' name='_jd_wp_twitter[]' value='".esc_attr($previous_tweet)."' />";
1098
+ echo "<li>$previous_tweet <a href='http://twitter.com/intent/tweet?text=$previous_tweet'>Retweet this</a></li>";
1099
  }
1100
  }
1101
  ?>
1102
  </ul>
1103
  <?php echo "<div>".$hidden_fields."</div>"; } ?>
1104
+ <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can('update_core') ) { ?>
1105
+ <p class='jtw'>
1106
+ <label for="jtw"><?php _e("Custom Twitter Post", 'wp-to-twitter', 'wp-to-twitter') ?></label><br /><textarea class="attachmentlinks" name="_jd_twitter" id="jtw" rows="2" cols="60"><?php echo esc_attr( $jd_twitter ); ?></textarea>
1107
  </p>
1108
+ <?php $minus_length = $post_length - 19; ?>
1109
+ <?php _e("Twitter posts are a maximum of $post_length characters; if your URL is included in your update, you have $minus_length characters available. Use <code>#url#</code>, <code>#title#</code>, <code>#post#</code>, <code>#category#</code>, <code>#date#</code>, <code>#modified#</code>, <code>#author#</code>, <code>#account#</code>, <code>#tags#</code>, or <code>#blog#</code> to insert the shortened URL, post title, a post excerpt, the first category selected, the post date, the post modified date, the post author, the twitter @reference, tags as hashtags, or blog name into the Tweet.", 'wp-to-twitter', 'wp-to-twitter') ?>
 
1110
  </p>
1111
+ <p><?php _e('Your template:','wp-to-twitter'); ?> <code><?php echo stripcslashes( $jd_template ); ?></code></p>
1112
 
1113
  <?php
1114
  if ( get_option('jd_keyword_format') == 2 ) {
1117
  }
1118
  ?>
1119
  <p>
1120
+ <?php if ( !function_exists( 'wpt_pro_exists' ) ) { ?>
1121
+ <a target="_blank" href="<?php echo admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &bull; <a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Upgrade to WP Tweets Pro', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo;
1122
+ <?php } else { ?>
1123
+ <a target="_blank" href="<?php echo admin_url('admin.php?page=wp-tweets-pro'); ?>#get-support"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> &raquo;
1124
+ <?php } ?>
1125
  </p>
1126
+ <?php } ?>
1127
+ <?php if ( current_user_can( 'wpt_twitter_custom' ) || current_user_can( 'wpt_twitter_switch' ) || current_user_can('update_core') ) { ?>
1128
  <?php
1129
  // "no" means 'Don't Tweet' (is checked)
1130
  $nochecked = ( $jd_tweet_this == 'no' )?' checked="checked"':'';
1131
  $yeschecked = ( $jd_tweet_this == 'yes' )?' checked="checked"':'';
 
1132
  ?>
1133
+ <p><input type="radio" name="_jd_tweet_this" value="no" id="jtn"<?php echo $nochecked; ?> /> <label for="jtn"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label> <input type="radio" name="_jd_tweet_this" value="yes" id="jty"<?php echo $yeschecked; ?> /> <label for="jty"><?php _e("Tweet this post.", 'wp-to-twitter'); ?></label></p>
1134
+ <?php } ?>
1135
+ <?php /* WPT PRO */ ?>
1136
+ <?php
1137
+ if ( function_exists('wpt_pro_exists') ) {
1138
+ wpt_schedule_values( $post_id );
1139
+ } ?>
1140
+ <?php /* WPT PRO */ ?>
1141
+ <?php if ( !current_user_can( 'wpt_twitter_custom' ) || !current_user_can( 'wpt_twitter_switch' ) ) { ?>
1142
+ <div>
1143
+ <p><?php _e('Access to customizing WP to Twitter values is not allowed for your user role.','wp-to-twitter'); ?></p>
1144
+ <?php if ( !current_user_can( 'wpt_twitter_switch' ) ) { ?>
1145
+ <input type="hidden" name='_jd_tweet_this' value='<?php echo $jd_tweet_this; ?>' />
1146
+ <?php } ?>
1147
+ <input type="hidden" name='_jd_twitter' value='' />
1148
+ <?php
1149
+ if ( function_exists('wpt_pro_exists') ) {
1150
+ wpt_schedule_values( $post_id, 'hidden' );
1151
+ } ?>
1152
+ </div>
1153
+ <?php } ?>
1154
  <p>
1155
  <?php
1156
  $this_post = get_post($post_id);
1157
  $post_status = $this_post->post_status;
1158
  if ($post_status == 'publish') {
1159
  if ( $jd_short != "" ) {
1160
+ _e("The previously-posted $sht URL for this post is <code>$jd_short</code>, which points to <code>$jd_expansion</code>.", 'wp-to-twitter');
1161
  } else {
1162
  _e("This URL is direct and has not been shortened: ","wp-to-twitter"); echo "<code>$jd_direct</code>";
1163
  }
1189
  }
1190
  }
1191
 
1192
+ function wpt_admin_scripts( $hook ) {
1193
+ if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
1194
+ wp_enqueue_script( 'charCount', plugins_url( 'wp-to-twitter/js/jquery.charcount.js'), array('jquery') );
1195
+ }
1196
+ }
1197
+ add_action( 'admin_enqueue_scripts', 'wpt_admin_scripts', 10, 1 );
1198
+
1199
+ function wpt_admin_script( $hook ) {
1200
+ global $current_screen;
1201
+ if ( $current_screen->base == 'post' ) {
1202
+ echo "
1203
+ <script type='text/javascript'>
1204
+ jQuery(document).ready(function(\$){
1205
+ //default usage
1206
+ \$('#jtw').charCount( { counterText: '".__('Characters left: ','wp-to-twitter')."' } );
1207
+ });
1208
+ </script>
1209
+ <style type='text/css'>
1210
+ #wptotwitter_div .jtw{ position: relative; margin-top: 1em;}
1211
+ #wptotwitter_div .counter{
1212
+ position:absolute;right:4%;top:0;
1213
+ font-size:1.4em;font-weight:700;color:#666;
1214
+ }
1215
+ #wptotwitter_div .warning{color:#700;}
1216
+ #wptotwitter_div .exceeded{color:#e00;}
1217
+ </style>";
1218
+ }
1219
+ }
1220
+ add_action( 'admin_head', 'wpt_admin_script' );
1221
+
1222
  // Post the Custom Tweet into the post meta table
1223
  function post_jd_twitter( $id ) {
1224
+ if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) { return $id; }
1225
+ if ( isset($_POST['_inline_edit']) ) { return $id; }
1226
  // update meta data to new format
1227
  if ( get_post_meta ( $id, "_jd_post_meta_fixed", true ) != 'true' ) {
1228
  jd_fix_post_meta( $id );
1248
  update_post_meta( $id, '_jd_tweet_this', $jd_tweet_default );
1249
  }
1250
  }
1251
+ // WPT PRO //
1252
+ apply_filters( 'wpt_insert_post', $_POST, $id );
1253
+ // WPT PRO //
1254
  }
1255
 
1256
  function jd_twitter_profile() {
1257
  global $user_ID;
1258
  get_currentuserinfo();
1259
+ if ( current_user_can( 'wpt_twitter_oauth' ) || current_user_can('update_core') ) {
1260
+ $user_edit = ( isset($_GET['user_id']) )?(int) $_GET['user_id']:$user_ID;
1261
+
 
 
 
1262
  $is_enabled = get_user_meta( $user_edit, 'wp-to-twitter-enable-user',true );
1263
  $twitter_username = get_user_meta( $user_edit, 'wp-to-twitter-user-username',true );
1264
  ?>
1265
+ <h3><?php _e('WP Tweets User Settings', 'wp-to-twitter'); ?></h3>
1266
+ <?php if ( function_exists('wpt_connect_oauth_message') ) { wpt_connect_oauth_message( $user_edit ); } ?>
1267
  <table class="form-table">
1268
  <tr>
1269
  <th scope="row"><?php _e("Use My Twitter Username", 'wp-to-twitter'); ?></th>
1270
  <td><input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-3" value="mainAtTwitter"<?php if ($is_enabled == "mainAtTwitter") { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e("Tweet my posts with an @ reference to my username.", 'wp-to-twitter'); ?></label><br />
1271
+ <input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-4" value="mainAtTwitterPlus"<?php if ($is_enabled == "mainAtTwitterPlus") { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user-3"><?php _e("Tweet my posts with an @ reference to both my username and to the main site username.", 'wp-to-twitter'); ?></label>
1272
  </td>
1273
  </tr>
1274
  <tr>
1276
  <td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo esc_attr( $twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.', 'wp-to-twitter'); ?></td>
1277
  </tr>
1278
  </table>
1279
+ <?php if ( function_exists('wpt_schedule_tweet') ) { ?>
1280
+ <?php if ( function_exists('wtt_connect_oauth') ) { wtt_connect_oauth( $user_edit ); } ?>
1281
+ <?php if ( user_can( $user_edit, 'update_core' ) ) { echo "<p><em>".__('Note: if all site administrators have set-up their own Twitter accounts, the primary site account (as set on the settings page) is not required, and won\'t be used.','wp-to-twitter').'</em></p>'; } ?>
1282
+ <?php } ?>
1283
+
1284
  <?php
1285
  }
1286
  }
1305
  function jd_twitter_save_profile(){
1306
  global $user_ID;
1307
  get_currentuserinfo();
1308
+ if ( isset($_POST['user_id']) ) {
1309
  $edit_id = (int) $_POST['user_id'];
1310
  } else {
1311
  $edit_id = $user_ID;
1312
  }
1313
  update_user_meta($edit_id ,'wp-to-twitter-enable-user' , $_POST['wp-to-twitter-enable-user'] );
1314
  update_user_meta($edit_id ,'wp-to-twitter-user-username' , $_POST['wp-to-twitter-user-username'] );
1315
+ //WPT PRO
1316
+ apply_filters( 'wpt_save_user', $edit_id, $_POST );
1317
  }
1318
  function jd_list_categories() {
1319
  $selected = "";
1320
  $categories = get_categories('hide_empty=0');
1321
+ $nonce = wp_nonce_field('wp-to-twitter-nonce', '_wpnonce', true, false).wp_referer_field(false);
1322
  $input = "<form action=\"\" method=\"post\">
1323
+ <div>$nonce</div>
1324
+ <fieldset><legend>".__('Check off categories to tweet','wp-to-twitter')."</legend>";
1325
+ $input .= '
1326
+ <p>
1327
+ <input type="checkbox" name="jd_twit_cats" id="jd_twit_cats" value="1"'.jd_checkCheckbox('jd_twit_cats').' />
1328
+ <label for="jd_twit_cats">'.__("Do not tweet posts in checked categories (Reverses default behavior)", 'wp-to-twitter').'</label>
1329
+ </p>';
1330
+ $input .= "
1331
  <ul>\n";
1332
  $tweet_categories = get_option( 'tweet_categories' );
1333
  foreach ($categories AS $cat) {
1342
  }
1343
  $input .= " </ul>
1344
  </fieldset>
1345
+ <p>".__('Limits are exclusive. If a post is in one category which should be posted and one category that should not, it will not be posted.','wp-to-twitter')."</p>
1346
  <div>
1347
  <input type=\"hidden\" name=\"submit-type\" value=\"setcategories\" />
1348
  <input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"".__('Set Categories','wp-to-twitter')."\" />
1353
 
1354
  // Add the administrative settings to the "Settings" menu.
1355
  function jd_addTwitterAdminPages() {
1356
+ if ( function_exists( 'add_options_page' ) && !function_exists( 'wpt_pro_functions') ) {
1357
+ $plugin_page = add_options_page( 'WP to Twitter', 'WP to Twitter', 'manage_options', __FILE__, 'wpt_update_settings' );
1358
  add_action( 'admin_head-'. $plugin_page, 'jd_addTwitterAdminStyles' );
1359
  }
1360
+ }
1361
+
1362
  function jd_addTwitterAdminStyles() {
1363
  global $wp_plugin_url, $wp_plugin_dir;
1364
+ if ( $_GET['page'] == "wp-to-twitter" || $_GET['page'] == "wp-to-twitter/wp-to-twitter.php" || $_GET['page'] == "wp-tweets-pro" ) {
1365
  echo '<link type="text/css" rel="stylesheet" href="'.$wp_plugin_url.'/wp-to-twitter/styles.css" />';
1366
  }
 
 
 
 
 
 
 
 
1367
  }
1368
+
1369
  function jd_plugin_action($links, $file) {
1370
+ if ( $file == plugin_basename(dirname(__FILE__).'/wp-to-twitter.php') ) {
1371
+ $admin_url = ( is_plugin_active('wp-tweets-pro/wpt-pro-functions.php') )?admin_url('admin.php?page=wp-tweets-pro'):admin_url('options-general.php?page=wp-to-twitter/wp-to-twitter.php');
1372
+ $links[] = "<a href='$admin_url'>" . __('Settings', 'wp-to-twitter', 'wp-to-twitter') . "</a>";
1373
+ }
1374
  return $links;
1375
  }
1376
  //Add Plugin Actions to WordPress
 
1377
  add_filter('plugin_action_links', 'jd_plugin_action', -10, 2);
1378
 
1379
  if ( get_option( 'jd_individual_twitter_users')=='1') {
1396
  add_action( 'in_plugin_update_message-wp-to-twitter/wp-to-twitter.php', 'wpt_plugin_update_message' );
1397
  function wpt_plugin_update_message() {
1398
  global $wpt_version;
1399
+ $note = '';
1400
  define('WPT_PLUGIN_README_URL', 'http://svn.wp-plugins.org/wp-to-twitter/trunk/readme.txt');
1401
  $response = wp_remote_get( WPT_PLUGIN_README_URL, array ('user-agent' => 'WordPress/WP to Twitter' . $wpt_version . '; ' . get_bloginfo( 'url' ) ) );
1402
  if ( ! is_wp_error( $response ) || is_array( $response ) ) {
1403
  $data = $response['body'];
1404
  $bits=explode('== Upgrade Notice ==',$data);
1405
+ $note = '<div id="wpt-upgrade"><p><strong style="color:#c22;">Upgrade Notes:</strong> '.nl2br(trim($bits[1])).'</p></div>';
1406
  } else {
1407
  printf(__('<br /><strong>Note:</strong> Please review the <a class="thickbox" href="%1$s">changelog</a> before upgrading.','wp-to-twitter'),'plugin-install.php?tab=plugin-information&amp;plugin=wp-to-twitter&amp;TB_iframe=true&amp;width=640&amp;height=594');
1408
+ }
1409
+ echo $note;
1410
  }
1411
 
1412
  add_action( 'save_post','post_jd_twitter', 10 );
wp-to-twitter.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the WP to Twitter package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP to Twitter 2.3.17\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
7
- "POT-Creation-Date: 2012-03-06 21:27:16+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -19,382 +19,312 @@ msgid ""
19
  "request for support."
20
  msgstr ""
21
 
22
- #: functions.php:310
23
  msgid ""
24
  "Please read the FAQ and other Help documents before making a support request."
25
  msgstr ""
26
 
27
- #: functions.php:312
28
  msgid "Please describe your problem. I'm not psychic."
29
  msgstr ""
30
 
31
- #: functions.php:317
32
  msgid ""
33
  "Thank you for supporting the continuing development of this plug-in! I'll "
34
  "get back to you as soon as I can."
35
  msgstr ""
36
 
37
- #: functions.php:319
38
  msgid ""
39
  "I cannot provide free support, but will treat your request as a bug report, "
40
  "and will incorporate any permanent solutions I discover into the plug-in."
41
  msgstr ""
42
 
43
- #: functions.php:329
 
 
 
 
44
  msgid ""
45
  "<strong>Please note</strong>: I do keep records of those who have donated, "
46
  "but if your donation came from somebody other than your account at this web "
47
  "site, you must note this in your message."
48
  msgstr ""
49
 
50
- #: functions.php:332
51
  msgid "From:"
52
  msgstr ""
53
 
54
- #: functions.php:335
55
  msgid ""
56
  "I have read <a href=\"http://www.joedolson.com/articles/wp-to-twitter/"
57
  "support-2/\">the FAQ for this plug-in</a>."
58
  msgstr ""
59
 
60
- #: functions.php:338
61
  msgid ""
62
  "I have <a href=\"http://www.joedolson.com/donate.php\">made a donation to "
63
  "help support this plug-in</a>."
64
  msgstr ""
65
 
66
- #: functions.php:344
67
  msgid "Send Support Request"
68
  msgstr ""
69
 
70
- #: functions.php:347
71
  msgid ""
72
  "The following additional information will be sent with your support request:"
73
  msgstr ""
74
 
75
- #: wp-to-twitter-manager.php:6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  msgid "WP to Twitter Errors Cleared"
77
  msgstr ""
78
 
79
- #: wp-to-twitter-manager.php:93
80
  msgid "WP to Twitter is now connected with Twitter."
81
  msgstr ""
82
 
83
- #: wp-to-twitter-manager.php:100
84
  msgid ""
85
  "WP to Twitter failed to connect with Twitter. Try enabling OAuth debugging."
86
  msgstr ""
87
 
88
- #: wp-to-twitter-manager.php:107
89
  msgid "OAuth Authentication Data Cleared."
90
  msgstr ""
91
 
92
- #: wp-to-twitter-manager.php:114
93
  msgid ""
94
  "OAuth Authentication Failed. Your server time is not in sync with the "
95
  "Twitter servers. Talk to your hosting service to see what can be done."
96
  msgstr ""
97
 
98
- #: wp-to-twitter-manager.php:121
99
  msgid "OAuth Authentication response not understood."
100
  msgstr ""
101
 
102
- #: wp-to-twitter-manager.php:152
103
  msgid "WP to Twitter Advanced Options Updated"
104
  msgstr ""
105
 
106
- #: wp-to-twitter-manager.php:174
107
  msgid ""
108
  "You must add your Bit.ly login and API key in order to shorten URLs with Bit."
109
  "ly."
110
  msgstr ""
111
 
112
- #: wp-to-twitter-manager.php:178
113
  msgid ""
114
  "You must add your YOURLS remote URL, login, and password in order to shorten "
115
  "URLs with a remote installation of YOURLS."
116
  msgstr ""
117
 
118
- #: wp-to-twitter-manager.php:182
119
  msgid ""
120
  "You must add your YOURLS server path in order to shorten URLs with a remote "
121
  "installation of YOURLS."
122
  msgstr ""
123
 
124
- #: wp-to-twitter-manager.php:185
125
  msgid "WP to Twitter Options Updated"
126
  msgstr ""
127
 
128
- #: wp-to-twitter-manager.php:193
129
  msgid "Category limits updated."
130
  msgstr ""
131
 
132
- #: wp-to-twitter-manager.php:197
133
  msgid "Category limits unset."
134
  msgstr ""
135
 
136
- #: wp-to-twitter-manager.php:204
137
  msgid "YOURLS password updated. "
138
  msgstr ""
139
 
140
- #: wp-to-twitter-manager.php:207
141
  msgid ""
142
  "YOURLS password deleted. You will be unable to use your remote YOURLS "
143
  "account to create short URLS."
144
  msgstr ""
145
 
146
- #: wp-to-twitter-manager.php:209
147
  msgid "Failed to save your YOURLS password! "
148
  msgstr ""
149
 
150
- #: wp-to-twitter-manager.php:213
151
  msgid "YOURLS username added. "
152
  msgstr ""
153
 
154
- #: wp-to-twitter-manager.php:217
155
  msgid "YOURLS API url added. "
156
  msgstr ""
157
 
158
- #: wp-to-twitter-manager.php:220
159
  msgid "YOURLS API url removed. "
160
  msgstr ""
161
 
162
- #: wp-to-twitter-manager.php:225
163
  msgid "YOURLS local server path added. "
164
  msgstr ""
165
 
166
- #: wp-to-twitter-manager.php:227
167
  msgid "The path to your YOURLS installation is not correct. "
168
  msgstr ""
169
 
170
- #: wp-to-twitter-manager.php:231
171
  msgid "YOURLS local server path removed. "
172
  msgstr ""
173
 
174
- #: wp-to-twitter-manager.php:236
175
  msgid "YOURLS will use Post ID for short URL slug."
176
  msgstr ""
177
 
178
- #: wp-to-twitter-manager.php:238
179
  msgid "YOURLS will use your custom keyword for short URL slug."
180
  msgstr ""
181
 
182
- #: wp-to-twitter-manager.php:242
183
  msgid "YOURLS will not use Post ID for the short URL slug."
184
  msgstr ""
185
 
186
- #: wp-to-twitter-manager.php:250
187
  msgid "Su.pr API Key and Username Updated"
188
  msgstr ""
189
 
190
- #: wp-to-twitter-manager.php:254
191
  msgid ""
192
  "Su.pr API Key and username deleted. Su.pr URLs created by WP to Twitter will "
193
  "no longer be associated with your account. "
194
  msgstr ""
195
 
196
- #: wp-to-twitter-manager.php:256
197
  msgid "Su.pr API Key not added - <a href='http://su.pr/'>get one here</a>! "
198
  msgstr ""
199
 
200
- #: wp-to-twitter-manager.php:262
201
  msgid "Bit.ly API Key Updated."
202
  msgstr ""
203
 
204
- #: wp-to-twitter-manager.php:265
205
  msgid ""
206
  "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
207
  msgstr ""
208
 
209
- #: wp-to-twitter-manager.php:267
210
  msgid ""
211
  "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</"
212
  "a>! An API key is required to use the Bit.ly URL shortening service."
213
  msgstr ""
214
 
215
- #: wp-to-twitter-manager.php:271
216
  msgid " Bit.ly User Login Updated."
217
  msgstr ""
218
 
219
- #: wp-to-twitter-manager.php:274
220
  msgid ""
221
  "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing "
222
  "your username. "
223
  msgstr ""
224
 
225
- #: wp-to-twitter-manager.php:276
226
  msgid ""
227
  "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
228
  msgstr ""
229
 
230
- #: wp-to-twitter-manager.php:299
231
- msgid "No error information is available for your shortener."
232
- msgstr ""
233
-
234
- #: wp-to-twitter-manager.php:301
235
- msgid ""
236
- "<li class=\"error\"><strong>WP to Twitter was unable to contact your "
237
- "selected URL shortening service.</strong></li>"
238
- msgstr ""
239
-
240
- #: wp-to-twitter-manager.php:304
241
- msgid ""
242
- "<li><strong>WP to Twitter successfully contacted your selected URL "
243
- "shortening service.</strong> The following link should point to your blog "
244
- "homepage:"
245
- msgstr ""
246
-
247
- #: wp-to-twitter-manager.php:312
248
- msgid ""
249
- "<li><strong>WP to Twitter successfully submitted a status update to Twitter."
250
- "</strong></li>"
251
- msgstr ""
252
-
253
- #: wp-to-twitter-manager.php:315
254
- msgid ""
255
- "<li class=\"error\"><strong>WP to Twitter failed to submit an update to "
256
- "Twitter.</strong></li>"
257
- msgstr ""
258
-
259
- #: wp-to-twitter-manager.php:319
260
- msgid "You have not connected WordPress to Twitter."
261
- msgstr ""
262
-
263
- #: wp-to-twitter-manager.php:323
264
- msgid ""
265
- "<li class=\"error\"><strong>Your server does not appear to support the "
266
- "required methods for WP to Twitter to function.</strong> You can try it "
267
- "anyway - these tests aren't perfect.</li>"
268
- msgstr ""
269
-
270
- #: wp-to-twitter-manager.php:327
271
  msgid ""
272
- "<li><strong>Your server should run WP to Twitter successfully.</strong></li>"
273
- msgstr ""
274
-
275
- #: wp-to-twitter-manager.php:343
276
- msgid "WP to Twitter Options"
277
- msgstr ""
278
-
279
- #: wp-to-twitter-manager.php:348
280
- msgid "Pledge to new features"
281
- msgstr ""
282
-
283
- #: wp-to-twitter-manager.php:349 wp-to-twitter.php:956
284
- msgid "Make a Donation"
285
- msgstr ""
286
-
287
- #: wp-to-twitter-manager.php:349
288
- msgid "View Settings"
289
- msgstr ""
290
-
291
- #: wp-to-twitter-manager.php:349 wp-to-twitter.php:956
292
- msgid "Get Support"
293
- msgstr ""
294
-
295
- #: wp-to-twitter-manager.php:365
296
- msgid ""
297
- "<strong>Notice</strong>: I can no longer provide help with WP to Twitter "
298
- "without your support. My apologies."
299
- msgstr ""
300
-
301
- #: wp-to-twitter-manager.php:370
302
- msgid "Shortcodes available in post update templates:"
303
- msgstr ""
304
-
305
- #: wp-to-twitter-manager.php:372
306
- msgid "<code>#title#</code>: the title of your blog post"
307
- msgstr ""
308
-
309
- #: wp-to-twitter-manager.php:373
310
- msgid "<code>#blog#</code>: the title of your blog"
311
- msgstr ""
312
-
313
- #: wp-to-twitter-manager.php:374
314
- msgid "<code>#post#</code>: a short excerpt of the post content"
315
- msgstr ""
316
-
317
- #: wp-to-twitter-manager.php:375
318
- msgid "<code>#category#</code>: the first selected category for the post"
319
- msgstr ""
320
-
321
- #: wp-to-twitter-manager.php:376
322
- msgid "<code>#date#</code>: the post date"
323
- msgstr ""
324
-
325
- #: wp-to-twitter-manager.php:377
326
- msgid "<code>#url#</code>: the post URL"
327
- msgstr ""
328
-
329
- #: wp-to-twitter-manager.php:378
330
- msgid "<code>#author#</code>: the post author"
331
- msgstr ""
332
-
333
- #: wp-to-twitter-manager.php:379
334
- msgid ""
335
- "<code>#account#</code>: the twitter @reference for the account (or the "
336
- "author, if author settings are enabled and set.)"
337
- msgstr ""
338
-
339
- #: wp-to-twitter-manager.php:380
340
- msgid ""
341
- "<code>#tags#</code>: your tags modified into hashtags. See options in the "
342
- "Advanced Settings section, below."
343
  msgstr ""
344
 
345
- #: wp-to-twitter-manager.php:382
346
- msgid ""
347
- "You can also create custom shortcodes to access WordPress custom fields. Use "
348
- "doubled square brackets surrounding the name of your custom field to add the "
349
- "value of that custom field to your status update. Example: <code>"
350
- "[[custom_field]]</code></p>"
351
- msgstr ""
352
-
353
- #: wp-to-twitter-manager.php:387
354
- msgid ""
355
- "<p>One or more of your last posts has failed to send it's status update to "
356
- "Twitter. Your Tweet has been saved in your post custom fields, and you can "
357
- "re-Tweet it at your leisure.</p>"
358
- msgstr ""
359
-
360
- #: wp-to-twitter-manager.php:392
361
  msgid ""
362
  "Sorry! I couldn't get in touch with the Twitter servers to post your "
363
  "<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
364
  msgstr ""
365
 
366
- #: wp-to-twitter-manager.php:396
367
  msgid ""
368
  "<p>The query to the URL shortener API failed, and your URL was not shrunk. "
369
  "The full post URL was attached to your Tweet. Check with your URL shortening "
370
  "provider to see if there are any known issues.</p>"
371
  msgstr ""
372
 
373
- #: wp-to-twitter-manager.php:402
374
  msgid "Clear 'WP to Twitter' Error Messages"
375
  msgstr ""
376
 
377
- #: wp-to-twitter-manager.php:415
 
 
 
 
378
  msgid "Basic Settings"
379
  msgstr ""
380
 
381
- #: wp-to-twitter-manager.php:419 wp-to-twitter-manager.php:483
382
  msgid "Save WP->Twitter Options"
383
  msgstr ""
384
 
385
- #: wp-to-twitter-manager.php:449
386
  msgid "Settings for Comments"
387
  msgstr ""
388
 
389
- #: wp-to-twitter-manager.php:452
390
  msgid "Update Twitter when new comments are posted"
391
  msgstr ""
392
 
393
- #: wp-to-twitter-manager.php:453
394
  msgid "Text for new comments:"
395
  msgstr ""
396
 
397
- #: wp-to-twitter-manager.php:455
398
  msgid ""
399
  "In addition to the above short tags, comment templates can use "
400
  "<code>#commenter#</code> to post the commenter's provided name in the Tweet. "
@@ -403,289 +333,305 @@ msgid ""
403
  "their choice in your Twitter stream."
404
  msgstr ""
405
 
406
- #: wp-to-twitter-manager.php:458
407
  msgid "Settings for Links"
408
  msgstr ""
409
 
410
- #: wp-to-twitter-manager.php:461
411
  msgid "Update Twitter when you post a Blogroll link"
412
  msgstr ""
413
 
414
- #: wp-to-twitter-manager.php:462
415
  msgid "Text for new link updates:"
416
  msgstr ""
417
 
418
- #: wp-to-twitter-manager.php:462
419
  msgid ""
420
  "Available shortcodes: <code>#url#</code>, <code>#title#</code>, and "
421
  "<code>#description#</code>."
422
  msgstr ""
423
 
424
- #: wp-to-twitter-manager.php:466
425
  msgid "Choose your short URL service (account settings below)"
426
  msgstr ""
427
 
428
- #: wp-to-twitter-manager.php:469
429
  msgid "Don't shorten URLs."
430
  msgstr ""
431
 
432
- #: wp-to-twitter-manager.php:470
433
  msgid "Use Su.pr for my URL shortener."
434
  msgstr ""
435
 
436
- #: wp-to-twitter-manager.php:471
437
  msgid "Use Bit.ly for my URL shortener."
438
  msgstr ""
439
 
440
- #: wp-to-twitter-manager.php:472
441
  msgid "Use Goo.gl as a URL shortener."
442
  msgstr ""
443
 
444
- #: wp-to-twitter-manager.php:473
445
  msgid "YOURLS (installed on this server)"
446
  msgstr ""
447
 
448
- #: wp-to-twitter-manager.php:474
449
  msgid "YOURLS (installed on a remote server)"
450
  msgstr ""
451
 
452
- #: wp-to-twitter-manager.php:475
453
  msgid "Use WordPress as a URL shortener."
454
  msgstr ""
455
 
456
- #: wp-to-twitter-manager.php:477
457
  msgid ""
458
  "Using WordPress as a URL shortener will send URLs to Twitter in the default "
459
  "URL format for WordPress: <code>http://domain.com/wpdir/?p=123</code>. "
460
  "Google Analytics is not available when using WordPress shortened URLs."
461
  msgstr ""
462
 
463
- #: wp-to-twitter-manager.php:492
464
  msgid ""
465
  "<abbr title=\"Uniform Resource Locator\">URL</abbr> Shortener Account "
466
  "Settings"
467
  msgstr ""
468
 
469
- #: wp-to-twitter-manager.php:496
470
  msgid "Your Su.pr account details"
471
  msgstr ""
472
 
473
- #: wp-to-twitter-manager.php:501
474
  msgid "Your Su.pr Username:"
475
  msgstr ""
476
 
477
- #: wp-to-twitter-manager.php:505
478
  msgid ""
479
  "Your Su.pr <abbr title='application programming interface'>API</abbr> Key:"
480
  msgstr ""
481
 
482
- #: wp-to-twitter-manager.php:511
483
  msgid ""
484
  "Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</"
485
  "a>!<br />You'll need an API key in order to associate the URLs you create "
486
  "with your Su.pr account."
487
  msgstr ""
488
 
489
- #: wp-to-twitter-manager.php:516
490
  msgid "Your Bit.ly account details"
491
  msgstr ""
492
 
493
- #: wp-to-twitter-manager.php:520
494
  msgid "Your Bit.ly username:"
495
  msgstr ""
496
 
497
- #: wp-to-twitter-manager.php:522
498
  msgid ""
499
  "This must be a standard Bit.ly account. Your Twitter or Facebook log-in will "
500
  "not work."
501
  msgstr ""
502
 
503
- #: wp-to-twitter-manager.php:524
504
  msgid ""
505
  "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
506
  msgstr ""
507
 
508
- #: wp-to-twitter-manager.php:531
509
  msgid "Save Bit.ly API Key"
510
  msgstr ""
511
 
512
- #: wp-to-twitter-manager.php:531
513
  msgid "Clear Bit.ly API Key"
514
  msgstr ""
515
 
516
- #: wp-to-twitter-manager.php:531
517
  msgid ""
518
  "A Bit.ly API key and username is required to shorten URLs via the Bit.ly API "
519
  "and WP to Twitter."
520
  msgstr ""
521
 
522
- #: wp-to-twitter-manager.php:536
523
  msgid "Your YOURLS account details"
524
  msgstr ""
525
 
526
- #: wp-to-twitter-manager.php:540
527
  msgid "Path to your YOURLS config file (Local installations)"
528
  msgstr ""
529
 
530
- #: wp-to-twitter-manager.php:541 wp-to-twitter-manager.php:545
531
  msgid "Example:"
532
  msgstr ""
533
 
534
- #: wp-to-twitter-manager.php:544
535
  msgid "URI to the YOURLS API (Remote installations)"
536
  msgstr ""
537
 
538
- #: wp-to-twitter-manager.php:548
539
  msgid "Your YOURLS username:"
540
  msgstr ""
541
 
542
- #: wp-to-twitter-manager.php:552
543
  msgid "Your YOURLS password:"
544
  msgstr ""
545
 
546
- #: wp-to-twitter-manager.php:552
547
  msgid "<em>Saved</em>"
548
  msgstr ""
549
 
550
- #: wp-to-twitter-manager.php:556
551
  msgid "Post ID for YOURLS url slug."
552
  msgstr ""
553
 
554
- #: wp-to-twitter-manager.php:557
555
  msgid "Custom keyword for YOURLS url slug."
556
  msgstr ""
557
 
558
- #: wp-to-twitter-manager.php:558
559
  msgid "Default: sequential URL numbering."
560
  msgstr ""
561
 
562
- #: wp-to-twitter-manager.php:564
563
  msgid "Save YOURLS Account Info"
564
  msgstr ""
565
 
566
- #: wp-to-twitter-manager.php:564
567
  msgid "Clear YOURLS password"
568
  msgstr ""
569
 
570
- #: wp-to-twitter-manager.php:564
571
  msgid ""
572
  "A YOURLS password and username is required to shorten URLs via the remote "
573
  "YOURLS API and WP to Twitter."
574
  msgstr ""
575
 
576
- #: wp-to-twitter-manager.php:576
577
  msgid "Advanced Settings"
578
  msgstr ""
579
 
580
- #: wp-to-twitter-manager.php:580 wp-to-twitter-manager.php:681
581
  msgid "Save Advanced WP->Twitter Options"
582
  msgstr ""
583
 
584
- #: wp-to-twitter-manager.php:582
585
  msgid "Advanced Tweet settings"
586
  msgstr ""
587
 
588
- #: wp-to-twitter-manager.php:584
589
  msgid "Strip nonalphanumeric characters from tags"
590
  msgstr ""
591
 
592
- #: wp-to-twitter-manager.php:585
593
  msgid "Spaces in tags replaced with:"
594
  msgstr ""
595
 
596
- #: wp-to-twitter-manager.php:587
597
  msgid ""
598
  "Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> "
599
  "to remove spaces entirely."
600
  msgstr ""
601
 
602
- #: wp-to-twitter-manager.php:590
603
  msgid "Maximum number of tags to include:"
604
  msgstr ""
605
 
606
- #: wp-to-twitter-manager.php:591
607
  msgid "Maximum length in characters for included tags:"
608
  msgstr ""
609
 
610
- #: wp-to-twitter-manager.php:592
611
  msgid ""
612
  "These options allow you to restrict the length and number of WordPress tags "
613
  "sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow "
614
  "any and all tags."
615
  msgstr ""
616
 
617
- #: wp-to-twitter-manager.php:595
618
  msgid "Length of post excerpt (in characters):"
619
  msgstr ""
620
 
621
- #: wp-to-twitter-manager.php:595
622
  msgid ""
623
  "By default, extracted from the post itself. If you use the 'Excerpt' field, "
624
  "that will be used instead."
625
  msgstr ""
626
 
627
- #: wp-to-twitter-manager.php:598
628
  msgid "WP to Twitter Date Formatting:"
629
  msgstr ""
630
 
631
- #: wp-to-twitter-manager.php:599
632
  msgid ""
633
  "Default is from your general settings. <a href='http://codex.wordpress.org/"
634
  "Formatting_Date_and_Time'>Date Formatting Documentation</a>."
635
  msgstr ""
636
 
637
- #: wp-to-twitter-manager.php:603
638
  msgid "Custom text before all Tweets:"
639
  msgstr ""
640
 
641
- #: wp-to-twitter-manager.php:604
642
  msgid "Custom text after all Tweets:"
643
  msgstr ""
644
 
645
- #: wp-to-twitter-manager.php:607
646
  msgid "Custom field for an alternate URL to be shortened and Tweeted:"
647
  msgstr ""
648
 
649
- #: wp-to-twitter-manager.php:608
650
  msgid ""
651
  "You can use a custom field to send an alternate URL for your post. The value "
652
  "is the name of a custom field containing your external URL."
653
  msgstr ""
654
 
655
- #: wp-to-twitter-manager.php:612
 
 
 
 
 
 
 
 
 
 
656
  msgid "Special Cases when WordPress should send a Tweet"
657
  msgstr ""
658
 
659
- #: wp-to-twitter-manager.php:615
660
- msgid "Do not post status updates by default"
661
  msgstr ""
662
 
663
- #: wp-to-twitter-manager.php:616
664
  msgid ""
665
  "By default, all posts meeting other requirements will be posted to Twitter. "
666
  "Check this to change your setting."
667
  msgstr ""
668
 
669
- #: wp-to-twitter-manager.php:620
670
  msgid "Allow status updates from Quick Edit"
671
  msgstr ""
672
 
673
- #: wp-to-twitter-manager.php:621
674
  msgid ""
675
  "If checked, all posts edited individually or in bulk through the Quick Edit "
676
- "feature will be tweeted."
 
 
 
 
 
 
677
  msgstr ""
678
 
679
- #: wp-to-twitter-manager.php:626
680
  msgid ""
681
  "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
682
  msgstr ""
683
 
684
- #: wp-to-twitter-manager.php:630
685
  msgid "Google Analytics Settings"
686
  msgstr ""
687
 
688
- #: wp-to-twitter-manager.php:631
689
  msgid ""
690
  "You can track the response from Twitter using Google Analytics by defining a "
691
  "campaign identifier here. You can either define a static identifier or a "
@@ -695,47 +641,47 @@ msgid ""
695
  "additional variable."
696
  msgstr ""
697
 
698
- #: wp-to-twitter-manager.php:635
699
  msgid "Use a Static Identifier with WP-to-Twitter"
700
  msgstr ""
701
 
702
- #: wp-to-twitter-manager.php:636
703
  msgid "Static Campaign identifier for Google Analytics:"
704
  msgstr ""
705
 
706
- #: wp-to-twitter-manager.php:640
707
  msgid "Use a dynamic identifier with Google Analytics and WP-to-Twitter"
708
  msgstr ""
709
 
710
- #: wp-to-twitter-manager.php:641
711
  msgid "What dynamic identifier would you like to use?"
712
  msgstr ""
713
 
714
- #: wp-to-twitter-manager.php:643
715
  msgid "Category"
716
  msgstr ""
717
 
718
- #: wp-to-twitter-manager.php:644
719
  msgid "Post ID"
720
  msgstr ""
721
 
722
- #: wp-to-twitter-manager.php:645
723
  msgid "Post Title"
724
  msgstr ""
725
 
726
- #: wp-to-twitter-manager.php:646 wp-to-twitter-manager.php:660
727
  msgid "Author"
728
  msgstr ""
729
 
730
- #: wp-to-twitter-manager.php:651
731
  msgid "Individual Authors"
732
  msgstr ""
733
 
734
- #: wp-to-twitter-manager.php:654
735
  msgid "Authors have individual Twitter accounts"
736
  msgstr ""
737
 
738
- #: wp-to-twitter-manager.php:654
739
  msgid ""
740
  "Authors can add their username in their user profile. This feature can only "
741
  "add an @reference to the author. The @reference is placed using the "
@@ -743,79 +689,79 @@ msgid ""
743
  "user accounts are not enabled."
744
  msgstr ""
745
 
746
- #: wp-to-twitter-manager.php:657
747
  msgid "Choose the lowest user group that can add their Twitter information"
748
  msgstr ""
749
 
750
- #: wp-to-twitter-manager.php:658
751
- msgid "Subscriber"
752
- msgstr ""
753
-
754
- #: wp-to-twitter-manager.php:659
755
- msgid "Contributor"
756
- msgstr ""
757
-
758
- #: wp-to-twitter-manager.php:661
759
- msgid "Editor"
760
  msgstr ""
761
 
762
- #: wp-to-twitter-manager.php:662
763
- msgid "Administrator"
 
 
764
  msgstr ""
765
 
766
- #: wp-to-twitter-manager.php:667
767
  msgid "Disable Error Messages"
768
  msgstr ""
769
 
770
- #: wp-to-twitter-manager.php:669
771
  msgid "Disable global URL shortener error messages."
772
  msgstr ""
773
 
774
- #: wp-to-twitter-manager.php:670
775
  msgid "Disable global Twitter API error messages."
776
  msgstr ""
777
 
778
- #: wp-to-twitter-manager.php:671
779
  msgid "Disable notification to implement OAuth"
780
  msgstr ""
781
 
782
- #: wp-to-twitter-manager.php:673
783
  msgid "Get Debugging Data for OAuth Connection"
784
  msgstr ""
785
 
786
- #: wp-to-twitter-manager.php:675
 
 
 
 
787
  msgid "I made a donation, so stop whinging at me, please."
788
  msgstr ""
789
 
790
- #: wp-to-twitter-manager.php:689
791
  msgid "Limit Updating Categories"
792
  msgstr ""
793
 
794
- #: wp-to-twitter-manager.php:692
795
  msgid ""
796
- "Select which blog categories will be Tweeted. Uncheck all categories to "
797
- "disable category limits."
798
  msgstr ""
799
 
800
- #: wp-to-twitter-manager.php:695
801
  msgid "<em>Category limits are disabled.</em>"
802
  msgstr ""
803
 
804
- #: wp-to-twitter-manager.php:706
805
  msgid "Get Plug-in Support"
806
  msgstr ""
807
 
808
- #: wp-to-twitter-manager.php:708
809
  msgid ""
810
  "Support requests without a donation will not be answered, but will be "
811
  "treated as bug reports."
812
  msgstr ""
813
 
814
- #: wp-to-twitter-manager.php:717
815
  msgid "Check Support"
816
  msgstr ""
817
 
818
- #: wp-to-twitter-manager.php:717
819
  msgid ""
820
  "Check whether your server supports <a href=\"http://www.joedolson.com/"
821
  "articles/wp-to-twitter/\">WP to Twitter's</a> queries to the Twitter and URL "
@@ -823,138 +769,258 @@ msgid ""
823
  "a URL using your selected methods."
824
  msgstr ""
825
 
826
- #: wp-to-twitter-oauth.php:64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
827
  msgid ""
828
- "WP to Twitter was unable to make a connection to Twitter. Verify with your "
829
- "host that your server has cURL support and <code>curl_exec()</code> commands "
830
- "are enabled."
831
  msgstr ""
832
 
833
- #: wp-to-twitter-oauth.php:110
834
- msgid "There was an error querying Twitter's servers."
835
  msgstr ""
836
 
837
- #: wp-to-twitter-oauth.php:117 wp-to-twitter-oauth.php:163
 
 
 
 
838
  msgid "Connect to Twitter"
839
  msgstr ""
840
 
841
- #: wp-to-twitter-oauth.php:119 wp-to-twitter-oauth.php:194
 
 
 
 
842
  msgid "Your server time:"
843
  msgstr ""
844
 
845
- #: wp-to-twitter-oauth.php:119
846
- msgid "Twitter's server time:"
847
  msgstr ""
848
 
849
- #: wp-to-twitter-oauth.php:119
850
  msgid ""
851
- "If these times are not within 5 minutes of each other, your server will not "
852
- "be able to connect to Twitter."
853
  msgstr ""
854
 
855
- #: wp-to-twitter-oauth.php:120
856
  msgid ""
857
- "The process to set up OAuth authentication for your web site is needlessly "
858
- "laborious. However, this is the method available. Note that you will not add "
859
- "your Twitter username or password to WP to Twitter; they are not used in "
860
- "OAuth authentication."
861
  msgstr ""
862
 
863
- #: wp-to-twitter-oauth.php:123
864
  msgid "1. Register this site as an application on "
865
  msgstr ""
866
 
867
- #: wp-to-twitter-oauth.php:123
868
  msgid "Twitter's application registration page"
869
  msgstr ""
870
 
871
- #: wp-to-twitter-oauth.php:125
872
  msgid ""
873
- "If you're not currently logged in, log-in with the Twitter username and "
874
- "password which you want associated with this site"
875
  msgstr ""
876
 
877
- #: wp-to-twitter-oauth.php:126
878
  msgid ""
879
- "Your Application's Name will be what shows up after \"via\" in your twitter "
880
- "stream. Your application name cannot include the word \"Twitter.\" Use the "
881
- "name of your web site."
882
  msgstr ""
883
 
884
- #: wp-to-twitter-oauth.php:127
885
- msgid "Your Application Description can be whatever you want."
886
  msgstr ""
887
 
888
- #: wp-to-twitter-oauth.php:128
889
  msgid "The WebSite and Callback URL should be "
890
  msgstr ""
891
 
892
- #: wp-to-twitter-oauth.php:130
893
  msgid "Agree to the Developer Rules of the Road and continue."
894
  msgstr ""
895
 
896
- #: wp-to-twitter-oauth.php:131
897
- msgid "2. Switch to \"Settings\" tab in Twitter apps"
898
  msgstr ""
899
 
900
- #: wp-to-twitter-oauth.php:133
901
  msgid "Select \"Read and Write\" for the Application Type"
902
  msgstr ""
903
 
904
- #: wp-to-twitter-oauth.php:134
905
  msgid "Update the application settings"
906
  msgstr ""
907
 
908
- #: wp-to-twitter-oauth.php:135
909
  msgid ""
910
- "Return to Details tab and create your access token. Refresh page to view "
911
  "your access tokens."
912
  msgstr ""
913
 
914
- #: wp-to-twitter-oauth.php:137
915
  msgid ""
916
  "Once you have registered your site as an application, you will be provided "
917
  "with four keys."
918
  msgstr ""
919
 
920
- #: wp-to-twitter-oauth.php:138
921
  msgid ""
922
  "3. Copy and paste your consumer key and consumer secret into the fields below"
923
  msgstr ""
924
 
925
- #: wp-to-twitter-oauth.php:141
926
  msgid "Twitter Consumer Key"
927
  msgstr ""
928
 
929
- #: wp-to-twitter-oauth.php:145
930
  msgid "Twitter Consumer Secret"
931
  msgstr ""
932
 
933
- #: wp-to-twitter-oauth.php:149
934
  msgid ""
935
  "4. Copy and paste your Access Token and Access Token Secret into the fields "
936
  "below"
937
  msgstr ""
938
 
939
- #: wp-to-twitter-oauth.php:150
940
  msgid ""
941
- "If the Access level reported for your Access Token is not \"Read and write"
942
- "\", you need to go back to step 2 and generate a new Access Token."
943
  msgstr ""
944
 
945
- #: wp-to-twitter-oauth.php:153
946
  msgid "Access Token"
947
  msgstr ""
948
 
949
- #: wp-to-twitter-oauth.php:157
950
  msgid "Access Token Secret"
951
  msgstr ""
952
 
953
- #: wp-to-twitter-oauth.php:173
954
- msgid "Disconnect from Twitter"
955
  msgstr ""
956
 
957
- #: wp-to-twitter-oauth.php:177
 
 
 
 
958
  msgid ""
959
  "<strong>Troubleshooting tip:</strong> Connected, but getting a notice that "
960
  "your Authentication credentials are missing or incorrect? Check whether your "
@@ -962,47 +1028,47 @@ msgid ""
962
  "new token."
963
  msgstr ""
964
 
965
- #: wp-to-twitter-oauth.php:180
 
 
 
 
966
  msgid "Twitter Username "
967
  msgstr ""
968
 
969
- #: wp-to-twitter-oauth.php:181
970
  msgid "Consumer Key "
971
  msgstr ""
972
 
973
- #: wp-to-twitter-oauth.php:182
974
  msgid "Consumer Secret "
975
  msgstr ""
976
 
977
- #: wp-to-twitter-oauth.php:183
978
  msgid "Access Token "
979
  msgstr ""
980
 
981
- #: wp-to-twitter-oauth.php:184
982
  msgid "Access Token Secret "
983
  msgstr ""
984
 
985
- #: wp-to-twitter-oauth.php:188
986
- msgid "Disconnect Your WordPress and Twitter Account"
987
- msgstr ""
988
-
989
- #: wp-to-twitter-oauth.php:194
990
  msgid "Twitter's current server time: "
991
  msgstr ""
992
 
993
- #: wp-to-twitter-oauth.php:194
994
  msgid ""
995
  "If these times are not within 5 minutes of each other, your server could "
996
  "lose its connection with Twitter."
997
  msgstr ""
998
 
999
- #: wp-to-twitter.php:48
1000
  msgid ""
1001
- "WP to Twitter requires PHP version 5 or above with cURL support. Please "
1002
- "upgrade PHP or install cURL to run WP to Twitter."
1003
  msgstr ""
1004
 
1005
- #: wp-to-twitter.php:70
1006
  msgid ""
1007
  "WP to Twitter requires WordPress 2.9.2 or a more recent version, but some "
1008
  "features will not work below 3.0.6. <a href=\"http://codex.wordpress.org/"
@@ -1010,133 +1076,161 @@ msgid ""
1010
  "Twitter with all features!</a>"
1011
  msgstr ""
1012
 
1013
- #: wp-to-twitter.php:87
1014
  msgid ""
1015
- "Twitter requires authentication by OAuth. You will need to <a href='%"
1016
- "s'>update your settings</a> to complete installation of WP to Twitter."
1017
  msgstr ""
1018
 
1019
- #: wp-to-twitter.php:219
1020
  msgid "200 OK: Success!"
1021
  msgstr ""
1022
 
1023
- #: wp-to-twitter.php:223
1024
  msgid ""
1025
  "400 Bad Request: The request was invalid. This is the status code returned "
1026
  "during rate limiting."
1027
  msgstr ""
1028
 
1029
- #: wp-to-twitter.php:227
1030
  msgid "401 Unauthorized: Authentication credentials were missing or incorrect."
1031
  msgstr ""
1032
 
1033
- #: wp-to-twitter.php:231
1034
  msgid ""
1035
  "403 Forbidden: The request is understood, but it has been refused. This code "
1036
  "is used when requests are understood, but are denied by Twitter. Reasons can "
1037
- "include: Too many tweets created in a short time or the same tweet text was "
1038
  "submitted twice in a row, among others. This is not an error by WP to "
1039
  "Twitter."
1040
  msgstr ""
1041
 
1042
- #: wp-to-twitter.php:235
1043
  msgid "500 Internal Server Error: Something is broken at Twitter."
1044
  msgstr ""
1045
 
1046
- #: wp-to-twitter.php:239
1047
  msgid ""
1048
  "503 Service Unavailable: The Twitter servers are up, but overloaded with "
1049
  "requests - Please try again later."
1050
  msgstr ""
1051
 
1052
- #: wp-to-twitter.php:243
1053
  msgid "502 Bad Gateway: Twitter is down or being upgraded."
1054
  msgstr ""
1055
 
1056
- #: wp-to-twitter.php:254
1057
  msgid "No Twitter OAuth connection found."
1058
  msgstr ""
1059
 
1060
- #. #-#-#-#-# plugin.pot (WP to Twitter 2.3.17) #-#-#-#-#
1061
- #. Plugin Name of the plugin/theme
1062
- #: wp-to-twitter.php:856
1063
- msgid "WP to Twitter"
1064
  msgstr ""
1065
 
1066
- #: wp-to-twitter.php:928
1067
  msgid "Previous Tweets"
1068
  msgstr ""
1069
 
1070
- #: wp-to-twitter.php:941
1071
  msgid "Custom Twitter Post"
1072
  msgstr ""
1073
 
1074
- #: wp-to-twitter.php:947
1075
  msgid "Your template:"
1076
  msgstr ""
1077
 
1078
- #: wp-to-twitter.php:952
1079
  msgid "YOURLS Custom Keyword"
1080
  msgstr ""
1081
 
1082
- #: wp-to-twitter.php:965
 
 
 
 
1083
  msgid "Don't Tweet this post."
1084
  msgstr ""
1085
 
1086
- #: wp-to-twitter.php:965
1087
  msgid "Tweet this post."
1088
  msgstr ""
1089
 
1090
- #: wp-to-twitter.php:975
 
 
 
 
 
1091
  msgid "This URL is direct and has not been shortened: "
1092
  msgstr ""
1093
 
1094
- #: wp-to-twitter.php:1047
1095
- msgid "WP to Twitter User Settings"
 
 
 
 
1096
  msgstr ""
1097
 
1098
- #: wp-to-twitter.php:1051
1099
  msgid "Use My Twitter Username"
1100
  msgstr ""
1101
 
1102
- #: wp-to-twitter.php:1052
1103
  msgid "Tweet my posts with an @ reference to my username."
1104
  msgstr ""
1105
 
1106
- #: wp-to-twitter.php:1053
1107
  msgid ""
1108
  "Tweet my posts with an @ reference to both my username and to the main site "
1109
  "username."
1110
  msgstr ""
1111
 
1112
- #: wp-to-twitter.php:1057
1113
  msgid "Your Twitter Username"
1114
  msgstr ""
1115
 
1116
- #: wp-to-twitter.php:1058
1117
  msgid "Enter your own Twitter username."
1118
  msgstr ""
1119
 
1120
- #: wp-to-twitter.php:1097
1121
- msgid "Check the categories you want to tweet:"
 
 
 
1122
  msgstr ""
1123
 
1124
- #: wp-to-twitter.php:1114
1125
- msgid "Set Categories"
1126
  msgstr ""
1127
 
1128
- #: wp-to-twitter.php:1138
1129
- msgid "<p>Couldn't locate the settings page.</p>"
1130
  msgstr ""
1131
 
1132
- #: wp-to-twitter.php:1143
 
 
 
 
 
 
 
 
 
 
1133
  msgid "Settings"
1134
  msgstr ""
1135
 
1136
- #: wp-to-twitter.php:1177
1137
  msgid ""
1138
- "<br /><strong>Note:</strong> Please review the <a class=\"thickbox\" href=\"%"
1139
- "1$s\">changelog</a> before upgrading."
 
 
 
 
1140
  msgstr ""
1141
 
1142
  #. Plugin URI of the plugin/theme
@@ -1145,9 +1239,9 @@ msgstr ""
1145
 
1146
  #. Description of the plugin/theme
1147
  msgid ""
1148
- "Posts a Twitter status update when you update your WordPress blog or post to "
1149
- "your blogroll, using your chosen URL shortening service. Rich in features "
1150
- "for customizing and promoting your Tweets."
1151
  msgstr ""
1152
 
1153
  #. Author of the plugin/theme
2
  # This file is distributed under the same license as the WP to Twitter package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP to Twitter 2.4.5\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
7
+ "POT-Creation-Date: 2012-06-18 17:52:04+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
19
  "request for support."
20
  msgstr ""
21
 
22
+ #: functions.php:323
23
  msgid ""
24
  "Please read the FAQ and other Help documents before making a support request."
25
  msgstr ""
26
 
27
+ #: functions.php:325
28
  msgid "Please describe your problem. I'm not psychic."
29
  msgstr ""
30
 
31
+ #: functions.php:329
32
  msgid ""
33
  "Thank you for supporting the continuing development of this plug-in! I'll "
34
  "get back to you as soon as I can."
35
  msgstr ""
36
 
37
+ #: functions.php:331
38
  msgid ""
39
  "I cannot provide free support, but will treat your request as a bug report, "
40
  "and will incorporate any permanent solutions I discover into the plug-in."
41
  msgstr ""
42
 
43
+ #: functions.php:345
44
+ msgid "Please include your license key in your support request."
45
+ msgstr ""
46
+
47
+ #: functions.php:350
48
  msgid ""
49
  "<strong>Please note</strong>: I do keep records of those who have donated, "
50
  "but if your donation came from somebody other than your account at this web "
51
  "site, you must note this in your message."
52
  msgstr ""
53
 
54
+ #: functions.php:355
55
  msgid "From:"
56
  msgstr ""
57
 
58
+ #: functions.php:358
59
  msgid ""
60
  "I have read <a href=\"http://www.joedolson.com/articles/wp-to-twitter/"
61
  "support-2/\">the FAQ for this plug-in</a>."
62
  msgstr ""
63
 
64
+ #: functions.php:361
65
  msgid ""
66
  "I have <a href=\"http://www.joedolson.com/donate.php\">made a donation to "
67
  "help support this plug-in</a>."
68
  msgstr ""
69
 
70
+ #: functions.php:367
71
  msgid "Send Support Request"
72
  msgstr ""
73
 
74
+ #: functions.php:370
75
  msgid ""
76
  "The following additional information will be sent with your support request:"
77
  msgstr ""
78
 
79
+ #: wp-to-twitter-manager.php:41
80
+ msgid "No error information is available for your shortener."
81
+ msgstr ""
82
+
83
+ #: wp-to-twitter-manager.php:43
84
+ msgid ""
85
+ "<li class=\"error\"><strong>WP to Twitter was unable to contact your "
86
+ "selected URL shortening service.</strong></li>"
87
+ msgstr ""
88
+
89
+ #: wp-to-twitter-manager.php:46
90
+ msgid ""
91
+ "<li><strong>WP to Twitter successfully contacted your selected URL "
92
+ "shortening service.</strong> The following link should point to your blog "
93
+ "homepage:"
94
+ msgstr ""
95
+
96
+ #: wp-to-twitter-manager.php:54
97
+ msgid ""
98
+ "<li><strong>WP to Twitter successfully submitted a status update to Twitter."
99
+ "</strong></li>"
100
+ msgstr ""
101
+
102
+ #: wp-to-twitter-manager.php:57
103
+ msgid ""
104
+ "<li class=\"error\"><strong>WP to Twitter failed to submit an update to "
105
+ "Twitter.</strong></li>"
106
+ msgstr ""
107
+
108
+ #: wp-to-twitter-manager.php:61
109
+ msgid "You have not connected WordPress to Twitter."
110
+ msgstr ""
111
+
112
+ #: wp-to-twitter-manager.php:65
113
+ msgid ""
114
+ "<li class=\"error\"><strong>Your server does not appear to support the "
115
+ "required methods for WP to Twitter to function.</strong> You can try it "
116
+ "anyway - these tests aren't perfect.</li>"
117
+ msgstr ""
118
+
119
+ #: wp-to-twitter-manager.php:69
120
+ msgid ""
121
+ "<li><strong>Your server should run WP to Twitter successfully.</strong></li>"
122
+ msgstr ""
123
+
124
+ #: wp-to-twitter-manager.php:87
125
  msgid "WP to Twitter Errors Cleared"
126
  msgstr ""
127
 
128
+ #: wp-to-twitter-manager.php:162
129
  msgid "WP to Twitter is now connected with Twitter."
130
  msgstr ""
131
 
132
+ #: wp-to-twitter-manager.php:169
133
  msgid ""
134
  "WP to Twitter failed to connect with Twitter. Try enabling OAuth debugging."
135
  msgstr ""
136
 
137
+ #: wp-to-twitter-manager.php:176
138
  msgid "OAuth Authentication Data Cleared."
139
  msgstr ""
140
 
141
+ #: wp-to-twitter-manager.php:183
142
  msgid ""
143
  "OAuth Authentication Failed. Your server time is not in sync with the "
144
  "Twitter servers. Talk to your hosting service to see what can be done."
145
  msgstr ""
146
 
147
+ #: wp-to-twitter-manager.php:190
148
  msgid "OAuth Authentication response not understood."
149
  msgstr ""
150
 
151
+ #: wp-to-twitter-manager.php:283
152
  msgid "WP to Twitter Advanced Options Updated"
153
  msgstr ""
154
 
155
+ #: wp-to-twitter-manager.php:305
156
  msgid ""
157
  "You must add your Bit.ly login and API key in order to shorten URLs with Bit."
158
  "ly."
159
  msgstr ""
160
 
161
+ #: wp-to-twitter-manager.php:309
162
  msgid ""
163
  "You must add your YOURLS remote URL, login, and password in order to shorten "
164
  "URLs with a remote installation of YOURLS."
165
  msgstr ""
166
 
167
+ #: wp-to-twitter-manager.php:313
168
  msgid ""
169
  "You must add your YOURLS server path in order to shorten URLs with a remote "
170
  "installation of YOURLS."
171
  msgstr ""
172
 
173
+ #: wp-to-twitter-manager.php:316
174
  msgid "WP to Twitter Options Updated"
175
  msgstr ""
176
 
177
+ #: wp-to-twitter-manager.php:325
178
  msgid "Category limits updated."
179
  msgstr ""
180
 
181
+ #: wp-to-twitter-manager.php:329
182
  msgid "Category limits unset."
183
  msgstr ""
184
 
185
+ #: wp-to-twitter-manager.php:336
186
  msgid "YOURLS password updated. "
187
  msgstr ""
188
 
189
+ #: wp-to-twitter-manager.php:339
190
  msgid ""
191
  "YOURLS password deleted. You will be unable to use your remote YOURLS "
192
  "account to create short URLS."
193
  msgstr ""
194
 
195
+ #: wp-to-twitter-manager.php:341
196
  msgid "Failed to save your YOURLS password! "
197
  msgstr ""
198
 
199
+ #: wp-to-twitter-manager.php:345
200
  msgid "YOURLS username added. "
201
  msgstr ""
202
 
203
+ #: wp-to-twitter-manager.php:349
204
  msgid "YOURLS API url added. "
205
  msgstr ""
206
 
207
+ #: wp-to-twitter-manager.php:352
208
  msgid "YOURLS API url removed. "
209
  msgstr ""
210
 
211
+ #: wp-to-twitter-manager.php:357
212
  msgid "YOURLS local server path added. "
213
  msgstr ""
214
 
215
+ #: wp-to-twitter-manager.php:359
216
  msgid "The path to your YOURLS installation is not correct. "
217
  msgstr ""
218
 
219
+ #: wp-to-twitter-manager.php:363
220
  msgid "YOURLS local server path removed. "
221
  msgstr ""
222
 
223
+ #: wp-to-twitter-manager.php:368
224
  msgid "YOURLS will use Post ID for short URL slug."
225
  msgstr ""
226
 
227
+ #: wp-to-twitter-manager.php:370
228
  msgid "YOURLS will use your custom keyword for short URL slug."
229
  msgstr ""
230
 
231
+ #: wp-to-twitter-manager.php:374
232
  msgid "YOURLS will not use Post ID for the short URL slug."
233
  msgstr ""
234
 
235
+ #: wp-to-twitter-manager.php:382
236
  msgid "Su.pr API Key and Username Updated"
237
  msgstr ""
238
 
239
+ #: wp-to-twitter-manager.php:386
240
  msgid ""
241
  "Su.pr API Key and username deleted. Su.pr URLs created by WP to Twitter will "
242
  "no longer be associated with your account. "
243
  msgstr ""
244
 
245
+ #: wp-to-twitter-manager.php:388
246
  msgid "Su.pr API Key not added - <a href='http://su.pr/'>get one here</a>! "
247
  msgstr ""
248
 
249
+ #: wp-to-twitter-manager.php:394
250
  msgid "Bit.ly API Key Updated."
251
  msgstr ""
252
 
253
+ #: wp-to-twitter-manager.php:397
254
  msgid ""
255
  "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
256
  msgstr ""
257
 
258
+ #: wp-to-twitter-manager.php:399
259
  msgid ""
260
  "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</"
261
  "a>! An API key is required to use the Bit.ly URL shortening service."
262
  msgstr ""
263
 
264
+ #: wp-to-twitter-manager.php:403
265
  msgid " Bit.ly User Login Updated."
266
  msgstr ""
267
 
268
+ #: wp-to-twitter-manager.php:406
269
  msgid ""
270
  "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing "
271
  "your username. "
272
  msgstr ""
273
 
274
+ #: wp-to-twitter-manager.php:408
275
  msgid ""
276
  "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
277
  msgstr ""
278
 
279
+ #: wp-to-twitter-manager.php:424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  msgid ""
281
+ "<p>One or more of your last posts has failed to send a status update to "
282
+ "Twitter. The Tweet has been saved, and you can re-Tweet it at your leisure.</"
283
+ "p>"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  msgstr ""
285
 
286
+ #: wp-to-twitter-manager.php:430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  msgid ""
288
  "Sorry! I couldn't get in touch with the Twitter servers to post your "
289
  "<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
290
  msgstr ""
291
 
292
+ #: wp-to-twitter-manager.php:433
293
  msgid ""
294
  "<p>The query to the URL shortener API failed, and your URL was not shrunk. "
295
  "The full post URL was attached to your Tweet. Check with your URL shortening "
296
  "provider to see if there are any known issues.</p>"
297
  msgstr ""
298
 
299
+ #: wp-to-twitter-manager.php:439
300
  msgid "Clear 'WP to Twitter' Error Messages"
301
  msgstr ""
302
 
303
+ #: wp-to-twitter-manager.php:446
304
+ msgid "WP to Twitter Options"
305
+ msgstr ""
306
+
307
+ #: wp-to-twitter-manager.php:459
308
  msgid "Basic Settings"
309
  msgstr ""
310
 
311
+ #: wp-to-twitter-manager.php:464 wp-to-twitter-manager.php:528
312
  msgid "Save WP->Twitter Options"
313
  msgstr ""
314
 
315
+ #: wp-to-twitter-manager.php:494
316
  msgid "Settings for Comments"
317
  msgstr ""
318
 
319
+ #: wp-to-twitter-manager.php:497
320
  msgid "Update Twitter when new comments are posted"
321
  msgstr ""
322
 
323
+ #: wp-to-twitter-manager.php:498
324
  msgid "Text for new comments:"
325
  msgstr ""
326
 
327
+ #: wp-to-twitter-manager.php:500
328
  msgid ""
329
  "In addition to the above short tags, comment templates can use "
330
  "<code>#commenter#</code> to post the commenter's provided name in the Tweet. "
333
  "their choice in your Twitter stream."
334
  msgstr ""
335
 
336
+ #: wp-to-twitter-manager.php:503
337
  msgid "Settings for Links"
338
  msgstr ""
339
 
340
+ #: wp-to-twitter-manager.php:506
341
  msgid "Update Twitter when you post a Blogroll link"
342
  msgstr ""
343
 
344
+ #: wp-to-twitter-manager.php:507
345
  msgid "Text for new link updates:"
346
  msgstr ""
347
 
348
+ #: wp-to-twitter-manager.php:507
349
  msgid ""
350
  "Available shortcodes: <code>#url#</code>, <code>#title#</code>, and "
351
  "<code>#description#</code>."
352
  msgstr ""
353
 
354
+ #: wp-to-twitter-manager.php:511
355
  msgid "Choose your short URL service (account settings below)"
356
  msgstr ""
357
 
358
+ #: wp-to-twitter-manager.php:514
359
  msgid "Don't shorten URLs."
360
  msgstr ""
361
 
362
+ #: wp-to-twitter-manager.php:515
363
  msgid "Use Su.pr for my URL shortener."
364
  msgstr ""
365
 
366
+ #: wp-to-twitter-manager.php:516
367
  msgid "Use Bit.ly for my URL shortener."
368
  msgstr ""
369
 
370
+ #: wp-to-twitter-manager.php:517
371
  msgid "Use Goo.gl as a URL shortener."
372
  msgstr ""
373
 
374
+ #: wp-to-twitter-manager.php:518
375
  msgid "YOURLS (installed on this server)"
376
  msgstr ""
377
 
378
+ #: wp-to-twitter-manager.php:519
379
  msgid "YOURLS (installed on a remote server)"
380
  msgstr ""
381
 
382
+ #: wp-to-twitter-manager.php:520
383
  msgid "Use WordPress as a URL shortener."
384
  msgstr ""
385
 
386
+ #: wp-to-twitter-manager.php:522
387
  msgid ""
388
  "Using WordPress as a URL shortener will send URLs to Twitter in the default "
389
  "URL format for WordPress: <code>http://domain.com/wpdir/?p=123</code>. "
390
  "Google Analytics is not available when using WordPress shortened URLs."
391
  msgstr ""
392
 
393
+ #: wp-to-twitter-manager.php:537
394
  msgid ""
395
  "<abbr title=\"Uniform Resource Locator\">URL</abbr> Shortener Account "
396
  "Settings"
397
  msgstr ""
398
 
399
+ #: wp-to-twitter-manager.php:541
400
  msgid "Your Su.pr account details"
401
  msgstr ""
402
 
403
+ #: wp-to-twitter-manager.php:546
404
  msgid "Your Su.pr Username:"
405
  msgstr ""
406
 
407
+ #: wp-to-twitter-manager.php:550
408
  msgid ""
409
  "Your Su.pr <abbr title='application programming interface'>API</abbr> Key:"
410
  msgstr ""
411
 
412
+ #: wp-to-twitter-manager.php:557
413
  msgid ""
414
  "Don't have a Su.pr account or API key? <a href='http://su.pr/'>Get one here</"
415
  "a>!<br />You'll need an API key in order to associate the URLs you create "
416
  "with your Su.pr account."
417
  msgstr ""
418
 
419
+ #: wp-to-twitter-manager.php:562
420
  msgid "Your Bit.ly account details"
421
  msgstr ""
422
 
423
+ #: wp-to-twitter-manager.php:566
424
  msgid "Your Bit.ly username:"
425
  msgstr ""
426
 
427
+ #: wp-to-twitter-manager.php:568
428
  msgid ""
429
  "This must be a standard Bit.ly account. Your Twitter or Facebook log-in will "
430
  "not work."
431
  msgstr ""
432
 
433
+ #: wp-to-twitter-manager.php:570
434
  msgid ""
435
  "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
436
  msgstr ""
437
 
438
+ #: wp-to-twitter-manager.php:578
439
  msgid "Save Bit.ly API Key"
440
  msgstr ""
441
 
442
+ #: wp-to-twitter-manager.php:578
443
  msgid "Clear Bit.ly API Key"
444
  msgstr ""
445
 
446
+ #: wp-to-twitter-manager.php:578
447
  msgid ""
448
  "A Bit.ly API key and username is required to shorten URLs via the Bit.ly API "
449
  "and WP to Twitter."
450
  msgstr ""
451
 
452
+ #: wp-to-twitter-manager.php:583
453
  msgid "Your YOURLS account details"
454
  msgstr ""
455
 
456
+ #: wp-to-twitter-manager.php:587
457
  msgid "Path to your YOURLS config file (Local installations)"
458
  msgstr ""
459
 
460
+ #: wp-to-twitter-manager.php:588 wp-to-twitter-manager.php:592
461
  msgid "Example:"
462
  msgstr ""
463
 
464
+ #: wp-to-twitter-manager.php:591
465
  msgid "URI to the YOURLS API (Remote installations)"
466
  msgstr ""
467
 
468
+ #: wp-to-twitter-manager.php:595
469
  msgid "Your YOURLS username:"
470
  msgstr ""
471
 
472
+ #: wp-to-twitter-manager.php:599
473
  msgid "Your YOURLS password:"
474
  msgstr ""
475
 
476
+ #: wp-to-twitter-manager.php:599
477
  msgid "<em>Saved</em>"
478
  msgstr ""
479
 
480
+ #: wp-to-twitter-manager.php:603
481
  msgid "Post ID for YOURLS url slug."
482
  msgstr ""
483
 
484
+ #: wp-to-twitter-manager.php:604
485
  msgid "Custom keyword for YOURLS url slug."
486
  msgstr ""
487
 
488
+ #: wp-to-twitter-manager.php:605
489
  msgid "Default: sequential URL numbering."
490
  msgstr ""
491
 
492
+ #: wp-to-twitter-manager.php:611
493
  msgid "Save YOURLS Account Info"
494
  msgstr ""
495
 
496
+ #: wp-to-twitter-manager.php:611
497
  msgid "Clear YOURLS password"
498
  msgstr ""
499
 
500
+ #: wp-to-twitter-manager.php:611
501
  msgid ""
502
  "A YOURLS password and username is required to shorten URLs via the remote "
503
  "YOURLS API and WP to Twitter."
504
  msgstr ""
505
 
506
+ #: wp-to-twitter-manager.php:622
507
  msgid "Advanced Settings"
508
  msgstr ""
509
 
510
+ #: wp-to-twitter-manager.php:627 wp-to-twitter-manager.php:782
511
  msgid "Save Advanced WP->Twitter Options"
512
  msgstr ""
513
 
514
+ #: wp-to-twitter-manager.php:629
515
  msgid "Advanced Tweet settings"
516
  msgstr ""
517
 
518
+ #: wp-to-twitter-manager.php:631
519
  msgid "Strip nonalphanumeric characters from tags"
520
  msgstr ""
521
 
522
+ #: wp-to-twitter-manager.php:632
523
  msgid "Spaces in tags replaced with:"
524
  msgstr ""
525
 
526
+ #: wp-to-twitter-manager.php:634
527
  msgid ""
528
  "Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> "
529
  "to remove spaces entirely."
530
  msgstr ""
531
 
532
+ #: wp-to-twitter-manager.php:637
533
  msgid "Maximum number of tags to include:"
534
  msgstr ""
535
 
536
+ #: wp-to-twitter-manager.php:638
537
  msgid "Maximum length in characters for included tags:"
538
  msgstr ""
539
 
540
+ #: wp-to-twitter-manager.php:639
541
  msgid ""
542
  "These options allow you to restrict the length and number of WordPress tags "
543
  "sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow "
544
  "any and all tags."
545
  msgstr ""
546
 
547
+ #: wp-to-twitter-manager.php:642
548
  msgid "Length of post excerpt (in characters):"
549
  msgstr ""
550
 
551
+ #: wp-to-twitter-manager.php:642
552
  msgid ""
553
  "By default, extracted from the post itself. If you use the 'Excerpt' field, "
554
  "that will be used instead."
555
  msgstr ""
556
 
557
+ #: wp-to-twitter-manager.php:645
558
  msgid "WP to Twitter Date Formatting:"
559
  msgstr ""
560
 
561
+ #: wp-to-twitter-manager.php:646
562
  msgid ""
563
  "Default is from your general settings. <a href='http://codex.wordpress.org/"
564
  "Formatting_Date_and_Time'>Date Formatting Documentation</a>."
565
  msgstr ""
566
 
567
+ #: wp-to-twitter-manager.php:650
568
  msgid "Custom text before all Tweets:"
569
  msgstr ""
570
 
571
+ #: wp-to-twitter-manager.php:651
572
  msgid "Custom text after all Tweets:"
573
  msgstr ""
574
 
575
+ #: wp-to-twitter-manager.php:654
576
  msgid "Custom field for an alternate URL to be shortened and Tweeted:"
577
  msgstr ""
578
 
579
+ #: wp-to-twitter-manager.php:655
580
  msgid ""
581
  "You can use a custom field to send an alternate URL for your post. The value "
582
  "is the name of a custom field containing your external URL."
583
  msgstr ""
584
 
585
+ #: wp-to-twitter-manager.php:677
586
+ msgid "Preferred status update truncation sequence"
587
+ msgstr ""
588
+
589
+ #: wp-to-twitter-manager.php:680
590
+ msgid ""
591
+ "This is the order in which items will be abbreviated or removed from your "
592
+ "status update if it is too long to send to Twitter."
593
+ msgstr ""
594
+
595
+ #: wp-to-twitter-manager.php:685
596
  msgid "Special Cases when WordPress should send a Tweet"
597
  msgstr ""
598
 
599
+ #: wp-to-twitter-manager.php:688
600
+ msgid "Do not post Tweets by default"
601
  msgstr ""
602
 
603
+ #: wp-to-twitter-manager.php:689
604
  msgid ""
605
  "By default, all posts meeting other requirements will be posted to Twitter. "
606
  "Check this to change your setting."
607
  msgstr ""
608
 
609
+ #: wp-to-twitter-manager.php:693
610
  msgid "Allow status updates from Quick Edit"
611
  msgstr ""
612
 
613
+ #: wp-to-twitter-manager.php:694
614
  msgid ""
615
  "If checked, all posts edited individually or in bulk through the Quick Edit "
616
+ "feature will be Tweeted."
617
+ msgstr ""
618
+
619
+ #: wp-to-twitter-manager.php:699
620
+ msgid ""
621
+ "Delaying tweets with WP Tweets PRO moves Tweeting to an publishing-"
622
+ "independent action."
623
  msgstr ""
624
 
625
+ #: wp-to-twitter-manager.php:706
626
  msgid ""
627
  "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
628
  msgstr ""
629
 
630
+ #: wp-to-twitter-manager.php:711
631
  msgid "Google Analytics Settings"
632
  msgstr ""
633
 
634
+ #: wp-to-twitter-manager.php:712
635
  msgid ""
636
  "You can track the response from Twitter using Google Analytics by defining a "
637
  "campaign identifier here. You can either define a static identifier or a "
641
  "additional variable."
642
  msgstr ""
643
 
644
+ #: wp-to-twitter-manager.php:716
645
  msgid "Use a Static Identifier with WP-to-Twitter"
646
  msgstr ""
647
 
648
+ #: wp-to-twitter-manager.php:717
649
  msgid "Static Campaign identifier for Google Analytics:"
650
  msgstr ""
651
 
652
+ #: wp-to-twitter-manager.php:721
653
  msgid "Use a dynamic identifier with Google Analytics and WP-to-Twitter"
654
  msgstr ""
655
 
656
+ #: wp-to-twitter-manager.php:722
657
  msgid "What dynamic identifier would you like to use?"
658
  msgstr ""
659
 
660
+ #: wp-to-twitter-manager.php:724
661
  msgid "Category"
662
  msgstr ""
663
 
664
+ #: wp-to-twitter-manager.php:725
665
  msgid "Post ID"
666
  msgstr ""
667
 
668
+ #: wp-to-twitter-manager.php:726
669
  msgid "Post Title"
670
  msgstr ""
671
 
672
+ #: wp-to-twitter-manager.php:727
673
  msgid "Author"
674
  msgstr ""
675
 
676
+ #: wp-to-twitter-manager.php:732
677
  msgid "Individual Authors"
678
  msgstr ""
679
 
680
+ #: wp-to-twitter-manager.php:735
681
  msgid "Authors have individual Twitter accounts"
682
  msgstr ""
683
 
684
+ #: wp-to-twitter-manager.php:735
685
  msgid ""
686
  "Authors can add their username in their user profile. This feature can only "
687
  "add an @reference to the author. The @reference is placed using the "
689
  "user accounts are not enabled."
690
  msgstr ""
691
 
692
+ #: wp-to-twitter-manager.php:750
693
  msgid "Choose the lowest user group that can add their Twitter information"
694
  msgstr ""
695
 
696
+ #: wp-to-twitter-manager.php:755
697
+ msgid ""
698
+ "Choose the lowest user group that can see the Custom Tweet options when "
699
+ "posting"
 
 
 
 
 
 
700
  msgstr ""
701
 
702
+ #: wp-to-twitter-manager.php:760
703
+ msgid ""
704
+ "User groups above this can toggle the Tweet/Don't Tweet option, but not see "
705
+ "other custom tweet options."
706
  msgstr ""
707
 
708
+ #: wp-to-twitter-manager.php:766
709
  msgid "Disable Error Messages"
710
  msgstr ""
711
 
712
+ #: wp-to-twitter-manager.php:768
713
  msgid "Disable global URL shortener error messages."
714
  msgstr ""
715
 
716
+ #: wp-to-twitter-manager.php:769
717
  msgid "Disable global Twitter API error messages."
718
  msgstr ""
719
 
720
+ #: wp-to-twitter-manager.php:770
721
  msgid "Disable notification to implement OAuth"
722
  msgstr ""
723
 
724
+ #: wp-to-twitter-manager.php:772
725
  msgid "Get Debugging Data for OAuth Connection"
726
  msgstr ""
727
 
728
+ #: wp-to-twitter-manager.php:774
729
+ msgid "Switch to <code>http</code> connection. (Default is https)"
730
+ msgstr ""
731
+
732
+ #: wp-to-twitter-manager.php:776
733
  msgid "I made a donation, so stop whinging at me, please."
734
  msgstr ""
735
 
736
+ #: wp-to-twitter-manager.php:790
737
  msgid "Limit Updating Categories"
738
  msgstr ""
739
 
740
+ #: wp-to-twitter-manager.php:793
741
  msgid ""
742
+ "If no categories are checked, limiting by category will be ignored, and all "
743
+ "categories will be Tweeted."
744
  msgstr ""
745
 
746
+ #: wp-to-twitter-manager.php:794
747
  msgid "<em>Category limits are disabled.</em>"
748
  msgstr ""
749
 
750
+ #: wp-to-twitter-manager.php:803
751
  msgid "Get Plug-in Support"
752
  msgstr ""
753
 
754
+ #: wp-to-twitter-manager.php:806
755
  msgid ""
756
  "Support requests without a donation will not be answered, but will be "
757
  "treated as bug reports."
758
  msgstr ""
759
 
760
+ #: wp-to-twitter-manager.php:817
761
  msgid "Check Support"
762
  msgstr ""
763
 
764
+ #: wp-to-twitter-manager.php:817
765
  msgid ""
766
  "Check whether your server supports <a href=\"http://www.joedolson.com/"
767
  "articles/wp-to-twitter/\">WP to Twitter's</a> queries to the Twitter and URL "
769
  "a URL using your selected methods."
770
  msgstr ""
771
 
772
+ #: wp-to-twitter-manager.php:828
773
+ msgid "Support WP to Twitter"
774
+ msgstr ""
775
+
776
+ #: wp-to-twitter-manager.php:830
777
+ msgid "WP to Twitter Support"
778
+ msgstr ""
779
+
780
+ #: wp-to-twitter-manager.php:834
781
+ msgid "View Settings"
782
+ msgstr ""
783
+
784
+ #: wp-to-twitter-manager.php:836 wp-to-twitter.php:1121 wp-to-twitter.php:1123
785
+ msgid "Get Support"
786
+ msgstr ""
787
+
788
+ #: wp-to-twitter-manager.php:840
789
+ msgid ""
790
+ "<a href=\"http://www.joedolson.com/donate.php\">Make a donation today!</a> "
791
+ "Every donation counts - donate $2, $10, or $100 and help me keep this plug-"
792
+ "in running!"
793
+ msgstr ""
794
+
795
+ #: wp-to-twitter-manager.php:857
796
+ msgid "Upgrade Now!"
797
+ msgstr ""
798
+
799
+ #: wp-to-twitter-manager.php:859
800
+ msgid "Upgrade to <strong>WP Tweets PRO</strong> for more control!"
801
+ msgstr ""
802
+
803
+ #: wp-to-twitter-manager.php:860
804
+ msgid "Extra features with the PRO upgrade:"
805
+ msgstr ""
806
+
807
+ #: wp-to-twitter-manager.php:862
808
+ msgid "Users can post to their own Twitter accounts"
809
+ msgstr ""
810
+
811
+ #: wp-to-twitter-manager.php:863
812
+ msgid ""
813
+ "Set a timer to send your Tweet minutes or hours after you publish the post"
814
+ msgstr ""
815
+
816
+ #: wp-to-twitter-manager.php:864
817
+ msgid "Automatically re-send Tweets at an assigned time after publishing"
818
+ msgstr ""
819
+
820
+ #: wp-to-twitter-manager.php:873
821
+ msgid "Shortcodes"
822
+ msgstr ""
823
+
824
+ #: wp-to-twitter-manager.php:875
825
+ msgid "Available in post update templates:"
826
+ msgstr ""
827
+
828
+ #: wp-to-twitter-manager.php:877
829
+ msgid "<code>#title#</code>: the title of your blog post"
830
+ msgstr ""
831
+
832
+ #: wp-to-twitter-manager.php:878
833
+ msgid "<code>#blog#</code>: the title of your blog"
834
+ msgstr ""
835
+
836
+ #: wp-to-twitter-manager.php:879
837
+ msgid "<code>#post#</code>: a short excerpt of the post content"
838
+ msgstr ""
839
+
840
+ #: wp-to-twitter-manager.php:880
841
+ msgid "<code>#category#</code>: the first selected category for the post"
842
+ msgstr ""
843
+
844
+ #: wp-to-twitter-manager.php:881
845
+ msgid "<code>#date#</code>: the post date"
846
+ msgstr ""
847
+
848
+ #: wp-to-twitter-manager.php:882
849
+ msgid "<code>#modified</code>: the post modified date"
850
+ msgstr ""
851
+
852
+ #: wp-to-twitter-manager.php:883
853
+ msgid "<code>#url#</code>: the post URL"
854
+ msgstr ""
855
+
856
+ #: wp-to-twitter-manager.php:884
857
+ msgid "<code>#author#</code>: the post author"
858
+ msgstr ""
859
+
860
+ #: wp-to-twitter-manager.php:885
861
+ msgid ""
862
+ "<code>#account#</code>: the twitter @reference for the account (or the "
863
+ "author, if author settings are enabled and set.)"
864
+ msgstr ""
865
+
866
+ #: wp-to-twitter-manager.php:886
867
+ msgid ""
868
+ "<code>#tags#</code>: your tags modified into hashtags. See options in the "
869
+ "Advanced Settings section, below."
870
+ msgstr ""
871
+
872
+ #: wp-to-twitter-manager.php:888
873
+ msgid ""
874
+ "You can also create custom shortcodes to access WordPress custom fields. Use "
875
+ "doubled square brackets surrounding the name of your custom field to add the "
876
+ "value of that custom field to your status update. Example: <code>"
877
+ "[[custom_field]]</code></p>"
878
+ msgstr ""
879
+
880
+ #: wp-to-twitter-oauth.php:98
881
+ msgid "WP to Twitter was unable to establish a connection to Twitter."
882
+ msgstr ""
883
+
884
+ #: wp-to-twitter-oauth.php:166
885
  msgid ""
886
+ "SSL Problems? Try <a href='#wpt_http'>switching to <code>http</code> "
887
+ "queries</a>.<br />"
 
888
  msgstr ""
889
 
890
+ #: wp-to-twitter-oauth.php:166
891
+ msgid "Error Message:"
892
  msgstr ""
893
 
894
+ #: wp-to-twitter-oauth.php:167
895
+ msgid "There was an error querying Twitter's servers"
896
+ msgstr ""
897
+
898
+ #: wp-to-twitter-oauth.php:183 wp-to-twitter-oauth.php:185
899
  msgid "Connect to Twitter"
900
  msgstr ""
901
 
902
+ #: wp-to-twitter-oauth.php:188
903
+ msgid "WP to Twitter Set-up"
904
+ msgstr ""
905
+
906
+ #: wp-to-twitter-oauth.php:189 wp-to-twitter-oauth.php:275
907
  msgid "Your server time:"
908
  msgstr ""
909
 
910
+ #: wp-to-twitter-oauth.php:189
911
+ msgid "Twitter's time:"
912
  msgstr ""
913
 
914
+ #: wp-to-twitter-oauth.php:189
915
  msgid ""
916
+ "If these timestamps are not within 5 minutes of each other, your server will "
917
+ "not connect to Twitter."
918
  msgstr ""
919
 
920
+ #: wp-to-twitter-oauth.php:191
921
  msgid ""
922
+ "<em>Note</em>: you will not add your Twitter user information to WP to "
923
+ "Twitter; it is not used in this authentication method."
 
 
924
  msgstr ""
925
 
926
+ #: wp-to-twitter-oauth.php:195
927
  msgid "1. Register this site as an application on "
928
  msgstr ""
929
 
930
+ #: wp-to-twitter-oauth.php:195
931
  msgid "Twitter's application registration page"
932
  msgstr ""
933
 
934
+ #: wp-to-twitter-oauth.php:197
935
  msgid ""
936
+ "If you're not currently logged in to Twitter, log-in to the account you want "
937
+ "associated with this site"
938
  msgstr ""
939
 
940
+ #: wp-to-twitter-oauth.php:198
941
  msgid ""
942
+ "Your Application's Name will show up after \"via\" in your twitter stream. "
943
+ "Your application name cannot include the word \"Twitter.\""
 
944
  msgstr ""
945
 
946
+ #: wp-to-twitter-oauth.php:199
947
+ msgid "Your Application Description can be anything."
948
  msgstr ""
949
 
950
+ #: wp-to-twitter-oauth.php:200
951
  msgid "The WebSite and Callback URL should be "
952
  msgstr ""
953
 
954
+ #: wp-to-twitter-oauth.php:202
955
  msgid "Agree to the Developer Rules of the Road and continue."
956
  msgstr ""
957
 
958
+ #: wp-to-twitter-oauth.php:203
959
+ msgid "2. Switch to the \"Settings\" tab in Twitter apps"
960
  msgstr ""
961
 
962
+ #: wp-to-twitter-oauth.php:205
963
  msgid "Select \"Read and Write\" for the Application Type"
964
  msgstr ""
965
 
966
+ #: wp-to-twitter-oauth.php:206
967
  msgid "Update the application settings"
968
  msgstr ""
969
 
970
+ #: wp-to-twitter-oauth.php:207
971
  msgid ""
972
+ "Return to the Details tab and create your access token. Refresh page to view "
973
  "your access tokens."
974
  msgstr ""
975
 
976
+ #: wp-to-twitter-oauth.php:209
977
  msgid ""
978
  "Once you have registered your site as an application, you will be provided "
979
  "with four keys."
980
  msgstr ""
981
 
982
+ #: wp-to-twitter-oauth.php:210
983
  msgid ""
984
  "3. Copy and paste your consumer key and consumer secret into the fields below"
985
  msgstr ""
986
 
987
+ #: wp-to-twitter-oauth.php:213
988
  msgid "Twitter Consumer Key"
989
  msgstr ""
990
 
991
+ #: wp-to-twitter-oauth.php:217
992
  msgid "Twitter Consumer Secret"
993
  msgstr ""
994
 
995
+ #: wp-to-twitter-oauth.php:221
996
  msgid ""
997
  "4. Copy and paste your Access Token and Access Token Secret into the fields "
998
  "below"
999
  msgstr ""
1000
 
1001
+ #: wp-to-twitter-oauth.php:222
1002
  msgid ""
1003
+ "If the Access level for your Access Token is not \"<em>Read and write</em>"
1004
+ "\", you must return to step 2 and generate a new Access Token."
1005
  msgstr ""
1006
 
1007
+ #: wp-to-twitter-oauth.php:225
1008
  msgid "Access Token"
1009
  msgstr ""
1010
 
1011
+ #: wp-to-twitter-oauth.php:229
1012
  msgid "Access Token Secret"
1013
  msgstr ""
1014
 
1015
+ #: wp-to-twitter-oauth.php:248
1016
+ msgid "Disconnect Your WordPress and Twitter Account"
1017
  msgstr ""
1018
 
1019
+ #: wp-to-twitter-oauth.php:252
1020
+ msgid "Disconnect your WordPress and Twitter Account"
1021
+ msgstr ""
1022
+
1023
+ #: wp-to-twitter-oauth.php:254
1024
  msgid ""
1025
  "<strong>Troubleshooting tip:</strong> Connected, but getting a notice that "
1026
  "your Authentication credentials are missing or incorrect? Check whether your "
1028
  "new token."
1029
  msgstr ""
1030
 
1031
+ #: wp-to-twitter-oauth.php:257
1032
+ msgid "Disconnect from Twitter"
1033
+ msgstr ""
1034
+
1035
+ #: wp-to-twitter-oauth.php:263
1036
  msgid "Twitter Username "
1037
  msgstr ""
1038
 
1039
+ #: wp-to-twitter-oauth.php:264
1040
  msgid "Consumer Key "
1041
  msgstr ""
1042
 
1043
+ #: wp-to-twitter-oauth.php:265
1044
  msgid "Consumer Secret "
1045
  msgstr ""
1046
 
1047
+ #: wp-to-twitter-oauth.php:266
1048
  msgid "Access Token "
1049
  msgstr ""
1050
 
1051
+ #: wp-to-twitter-oauth.php:267
1052
  msgid "Access Token Secret "
1053
  msgstr ""
1054
 
1055
+ #: wp-to-twitter-oauth.php:275
 
 
 
 
1056
  msgid "Twitter's current server time: "
1057
  msgstr ""
1058
 
1059
+ #: wp-to-twitter-oauth.php:277
1060
  msgid ""
1061
  "If these times are not within 5 minutes of each other, your server could "
1062
  "lose its connection with Twitter."
1063
  msgstr ""
1064
 
1065
+ #: wp-to-twitter.php:44
1066
  msgid ""
1067
+ "WP to Twitter requires PHP version 5 or above. Please upgrade PHP to run WP "
1068
+ "to Twitter."
1069
  msgstr ""
1070
 
1071
+ #: wp-to-twitter.php:66
1072
  msgid ""
1073
  "WP to Twitter requires WordPress 2.9.2 or a more recent version, but some "
1074
  "features will not work below 3.0.6. <a href=\"http://codex.wordpress.org/"
1076
  "Twitter with all features!</a>"
1077
  msgstr ""
1078
 
1079
+ #: wp-to-twitter.php:84
1080
  msgid ""
1081
+ "Twitter requires authentication by OAuth. You will need to <a "
1082
+ "href='%s'>update your settings</a> to complete installation of WP to Twitter."
1083
  msgstr ""
1084
 
1085
+ #: wp-to-twitter.php:259
1086
  msgid "200 OK: Success!"
1087
  msgstr ""
1088
 
1089
+ #: wp-to-twitter.php:264
1090
  msgid ""
1091
  "400 Bad Request: The request was invalid. This is the status code returned "
1092
  "during rate limiting."
1093
  msgstr ""
1094
 
1095
+ #: wp-to-twitter.php:268
1096
  msgid "401 Unauthorized: Authentication credentials were missing or incorrect."
1097
  msgstr ""
1098
 
1099
+ #: wp-to-twitter.php:273
1100
  msgid ""
1101
  "403 Forbidden: The request is understood, but it has been refused. This code "
1102
  "is used when requests are understood, but are denied by Twitter. Reasons can "
1103
+ "include: Too many Tweets created in a short time or the same Tweet was "
1104
  "submitted twice in a row, among others. This is not an error by WP to "
1105
  "Twitter."
1106
  msgstr ""
1107
 
1108
+ #: wp-to-twitter.php:277
1109
  msgid "500 Internal Server Error: Something is broken at Twitter."
1110
  msgstr ""
1111
 
1112
+ #: wp-to-twitter.php:281
1113
  msgid ""
1114
  "503 Service Unavailable: The Twitter servers are up, but overloaded with "
1115
  "requests - Please try again later."
1116
  msgstr ""
1117
 
1118
+ #: wp-to-twitter.php:285
1119
  msgid "502 Bad Gateway: Twitter is down or being upgraded."
1120
  msgstr ""
1121
 
1122
+ #: wp-to-twitter.php:303
1123
  msgid "No Twitter OAuth connection found."
1124
  msgstr ""
1125
 
1126
+ #: wp-to-twitter.php:1044
1127
+ msgid "WP Tweets"
 
 
1128
  msgstr ""
1129
 
1130
+ #: wp-to-twitter.php:1091
1131
  msgid "Previous Tweets"
1132
  msgstr ""
1133
 
1134
+ #: wp-to-twitter.php:1106
1135
  msgid "Custom Twitter Post"
1136
  msgstr ""
1137
 
1138
+ #: wp-to-twitter.php:1111
1139
  msgid "Your template:"
1140
  msgstr ""
1141
 
1142
+ #: wp-to-twitter.php:1116
1143
  msgid "YOURLS Custom Keyword"
1144
  msgstr ""
1145
 
1146
+ #: wp-to-twitter.php:1121
1147
+ msgid "Upgrade to WP Tweets Pro"
1148
+ msgstr ""
1149
+
1150
+ #: wp-to-twitter.php:1133
1151
  msgid "Don't Tweet this post."
1152
  msgstr ""
1153
 
1154
+ #: wp-to-twitter.php:1133
1155
  msgid "Tweet this post."
1156
  msgstr ""
1157
 
1158
+ #: wp-to-twitter.php:1143
1159
+ msgid ""
1160
+ "Access to customizing WP to Twitter values is not allowed for your user role."
1161
+ msgstr ""
1162
+
1163
+ #: wp-to-twitter.php:1162
1164
  msgid "This URL is direct and has not been shortened: "
1165
  msgstr ""
1166
 
1167
+ #: wp-to-twitter.php:1206
1168
+ msgid "Characters left: "
1169
+ msgstr ""
1170
+
1171
+ #: wp-to-twitter.php:1265
1172
+ msgid "WP Tweets User Settings"
1173
  msgstr ""
1174
 
1175
+ #: wp-to-twitter.php:1269
1176
  msgid "Use My Twitter Username"
1177
  msgstr ""
1178
 
1179
+ #: wp-to-twitter.php:1270
1180
  msgid "Tweet my posts with an @ reference to my username."
1181
  msgstr ""
1182
 
1183
+ #: wp-to-twitter.php:1271
1184
  msgid ""
1185
  "Tweet my posts with an @ reference to both my username and to the main site "
1186
  "username."
1187
  msgstr ""
1188
 
1189
+ #: wp-to-twitter.php:1275
1190
  msgid "Your Twitter Username"
1191
  msgstr ""
1192
 
1193
+ #: wp-to-twitter.php:1276
1194
  msgid "Enter your own Twitter username."
1195
  msgstr ""
1196
 
1197
+ #: wp-to-twitter.php:1281
1198
+ msgid ""
1199
+ "Note: if all site administrators have set-up their own Twitter accounts, the "
1200
+ "primary site account (as set on the settings page) is not required, and "
1201
+ "won't be used."
1202
  msgstr ""
1203
 
1204
+ #: wp-to-twitter.php:1324
1205
+ msgid "Check off categories to tweet"
1206
  msgstr ""
1207
 
1208
+ #: wp-to-twitter.php:1328
1209
+ msgid "Do not tweet posts in checked categories (Reverses default behavior)"
1210
  msgstr ""
1211
 
1212
+ #: wp-to-twitter.php:1345
1213
+ msgid ""
1214
+ "Limits are exclusive. If a post is in one category which should be posted "
1215
+ "and one category that should not, it will not be posted."
1216
+ msgstr ""
1217
+
1218
+ #: wp-to-twitter.php:1348
1219
+ msgid "Set Categories"
1220
+ msgstr ""
1221
+
1222
+ #: wp-to-twitter.php:1372
1223
  msgid "Settings"
1224
  msgstr ""
1225
 
1226
+ #: wp-to-twitter.php:1407
1227
  msgid ""
1228
+ "<br /><strong>Note:</strong> Please review the <a class=\"thickbox\" href="
1229
+ "\"%1$s\">changelog</a> before upgrading."
1230
+ msgstr ""
1231
+
1232
+ #. Plugin Name of the plugin/theme
1233
+ msgid "WP to Twitter"
1234
  msgstr ""
1235
 
1236
  #. Plugin URI of the plugin/theme
1239
 
1240
  #. Description of the plugin/theme
1241
  msgid ""
1242
+ "Posts a Tweet when you update your WordPress blog or post to your blogroll, "
1243
+ "using your chosen URL shortening service. Rich in features for customizing "
1244
+ "and promoting your Tweets."
1245
  msgstr ""
1246
 
1247
  #. Author of the plugin/theme