Version Description
Download this release
Release Info
Developer | joedolson |
Plugin | WP to Twitter |
Version | 1.3.7 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.3.7
- cligs.png +0 -0
- readme.txt +84 -14
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- twitter.png +0 -0
- uninstall.php +51 -0
- wp-to-twitter-logo.png +0 -0
- wp-to-twitter-manager.php +269 -132
- wp-to-twitter.php +635 -153
- wp-to-twitter.pot +377 -0
cligs.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -1,30 +1,87 @@
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: joedolson
|
3 |
Donate link: http://www.joedolson.com/donate.php
|
4 |
-
Tags: twitter, microblogging, cligs, redirect, shortener
|
5 |
Requires at least: 2.5
|
6 |
-
Tested up to: 2.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
Posts a Twitter status update when you update your blog, using the
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
The WP-to-Twitter plugin posts a Twitter status update from your blog using the Cli.gs URL shortening service to
|
14 |
-
provide a link back to your post from Twitter.
|
15 |
|
16 |
-
|
17 |
-
statistics for the shortened URL.
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
Any status update you write which is longer than the available space will automatically be truncated by the plugin. This applies to both the default messages and to your custom messages.
|
24 |
|
25 |
-
This plugin is based loosely on the Twitter Updater plugin by Jonathan Dingman
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
== Installation ==
|
30 |
|
@@ -58,7 +115,20 @@ If Cli.gs isn't available, your tweet will be sent using it's normal post permal
|
|
58 |
|
59 |
Well, there isn't much I can do about that - but the plugin will check and see whether or not the needed methods work. If they don't, you will find a warning message on your settings page.
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
== Screenshots ==
|
62 |
|
63 |
-
1. WP to Twitter
|
64 |
-
2. WP to Twitter
|
|
1 |
=== Plugin Name ===
|
2 |
Contributors: joedolson
|
3 |
Donate link: http://www.joedolson.com/donate.php
|
4 |
+
Tags: twitter, microblogging, cligs, redirect, shortener, post, links
|
5 |
Requires at least: 2.5
|
6 |
+
Tested up to: 2.8
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using the Cligs URL shortening service.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The WP-to-Twitter plugin posts a Twitter status update from your WordPress blog using the Cli.gs URL shortening service to provide a link back to your post from Twitter.
|
|
|
14 |
|
15 |
+
**New in version 1.3.7**:
|
|
|
16 |
|
17 |
+
* Revised interface to take advantage of features added in versions 2.5 and 2.7. You can now drag and drop the WP to Twitter configuration panel in Post and Page authoring pages.
|
18 |
+
* Fixed bug where post titles were not Tweeted when using the "Press This" bookmarklet
|
19 |
+
* Security bug fix.
|
20 |
+
|
21 |
+
If you have a Cli.gs API key, the shortened URL will also be filed in your Cli.gs account so that you can track statistics for the shortened URL.
|
22 |
+
|
23 |
+
The plugin can send a default message for updating or editing posts or pages, but also allows you to write a custom Tweet for your post which says whatever you want. By default, the shortened URL from Cli.gs is appended to the end of your message, so you should keep that in mind when writing your custom Tweet.
|
24 |
|
25 |
Any status update you write which is longer than the available space will automatically be truncated by the plugin. This applies to both the default messages and to your custom messages.
|
26 |
|
27 |
+
This plugin is based loosely on the Twitter Updater plugin by [Jonathan Dingman](http://www.firesidemedia.net/dev/), which he adapted from a plugin by Victoria Chan. Other contributions by [Thor Erik](http://www.thorerik.net), Bill Berry and [Andrea Baccega](http://www.andreabaccega.com).
|
28 |
+
|
29 |
+
== Version Notes ==
|
30 |
+
|
31 |
+
**New in version 1.3.5**:
|
32 |
+
|
33 |
+
* Bug fix: when "Send link to Twitter" is disabled, Twitter status and shortcodes were not parsed correctly.
|
34 |
+
|
35 |
+
**New in version 1.3.4**:
|
36 |
+
|
37 |
+
* Bug fix: html tags in titles are stripped from tweets
|
38 |
+
* Bug fix: thanks to [Andrea Baccega](http://www.andreabaccega.com), some problems related to WP 2.7.1 should be fixed.
|
39 |
+
* Added optional prepend/append text fields.
|
40 |
+
|
41 |
+
**New in version 1.3.3**:
|
42 |
+
|
43 |
+
* Added support for shortcodes in custom Tweet fields.
|
44 |
+
* Bug fix when #url# is the first element in a Tweet string.
|
45 |
+
* Minor interface changes.
|
46 |
+
|
47 |
+
**New in version 1.3.2**:
|
48 |
+
|
49 |
+
* Added a #url# shortcode so you can decide where your short URL will appear in the tweet.
|
50 |
+
* Couple small bug fixes.
|
51 |
+
* Small changes to the settings page.
|
52 |
+
|
53 |
+
**New in version 1.3.1**:
|
54 |
|
55 |
+
* Modification for multiple authors with independent Twitter accounts -- there are now three options:
|
56 |
+
|
57 |
+
1. Tweet to your own account, instead of the blog account.
|
58 |
+
1. Tweet to your account with an @ reference to the main blog account.
|
59 |
+
1. Tweet to the main blog account with an @ reference to your own account.
|
60 |
+
|
61 |
+
* Added an option to enable or disable Tweeting of Pages when edited.
|
62 |
+
* **Fixed scheduled posting and posting from QuickPress, so both of these options will now be Tweeted.**
|
63 |
+
|
64 |
+
New in version 1.3.0: Support for multiple authors with independent Twitter & Cligs accounts. Other minor textual revisions, addition of API availability check in the Settings panel. Bugfixes: If editing a post by XMLRPC, you could not disable tweeting your edits. FIXED.
|
65 |
+
|
66 |
+
New in version 1.2.8: Bug fix to 1.2.7.
|
67 |
+
|
68 |
+
New in version 1.2.7:
|
69 |
+
- Uses the Snoopy class to retrieve information from Cligs and to post Twitter updates. Hopefully this will solve a variety of issues.
|
70 |
+
- Added an option to track traffic from your Tweeted Posts using Google Analytics (Thanks to [Joost](http://yoast.com/twitter-analytics/))
|
71 |
+
|
72 |
+
New in version 1.2.6:
|
73 |
+
- Bugfix with XMLRPC publishing -- controls to disable XMLRPC publishing now work correctly.
|
74 |
+
- Bugfix with error reporting and clearing.
|
75 |
+
- Added the option to supply an alternate URL along with your post, to be tweeted in place of the WP permalink.
|
76 |
+
|
77 |
+
New in version 1.2.5:
|
78 |
+
- Support for publishing via XMLRPC
|
79 |
+
- Corrected a couple minor bugs
|
80 |
+
- Added internationalization support
|
81 |
+
|
82 |
+
New in version 1.2.0:
|
83 |
+
- option to post your new blogroll links to Twitter, using the description field as your status update text.
|
84 |
+
- option to decide on a post level whether or not that blog post should be posted to Twitter
|
85 |
|
86 |
== Installation ==
|
87 |
|
115 |
|
116 |
Well, there isn't much I can do about that - but the plugin will check and see whether or not the needed methods work. If they don't, you will find a warning message on your settings page.
|
117 |
|
118 |
+
= If I mark a blogroll link as private, will it be posted to Twitter? =
|
119 |
+
|
120 |
+
No. They're private.
|
121 |
+
|
122 |
+
= What are the changes between version 1.1 and 1.2? =
|
123 |
+
|
124 |
+
There are several additional functions available in version 1.2. First, you can now post links you add to your blogroll to Twitter. Second, you can configure whether or not you want to Tweet posts on an individual basis. Third, you can globally set whether you'd rather have posts default to be Tweeted or NOT to be Tweeted, depending on whether you're more likely to want to Tweet most posts but not all or Tweet only the occasional post.
|
125 |
+
|
126 |
+
= I can't see the settings page! =
|
127 |
+
|
128 |
+
There�s an unresolved bug which effects some servers which causes the WP-to-Twitter settings page to fail. You can get around this problem by commenting out lines 145 - 190 in wp-to-twitter/wp-to-twitter-manager.php. (Version 1.3.4.)
|
129 |
+
|
130 |
== Screenshots ==
|
131 |
|
132 |
+
1. WP to Twitter main settings page.
|
133 |
+
2. WP to Twitter custom Tweet settings.
|
134 |
+
3. WP to Twitter user settings.
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
twitter.png
ADDED
Binary file
|
uninstall.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( !defined( 'ABSPATH' ) && !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
+
exit();
|
4 |
+
} else {
|
5 |
+
delete_option( 'newpost-published-update' );
|
6 |
+
delete_option( 'newpost-published-text' );
|
7 |
+
delete_option( 'newpost-published-showlink' );
|
8 |
+
|
9 |
+
delete_option( 'oldpost-edited-update' );
|
10 |
+
delete_option( 'oldpost-edited-text' );
|
11 |
+
delete_option( 'oldpost-edited-showlink' );
|
12 |
+
|
13 |
+
delete_option( 'jd_twit_pages' );
|
14 |
+
delete_option( 'jd_twit_edited_pages' );
|
15 |
+
|
16 |
+
delete_option( 'jd_twit_remote' );
|
17 |
+
|
18 |
+
// Use Google Analytics with Twitter
|
19 |
+
delete_option( 'twitter-analytics-campaign' );
|
20 |
+
delete_option( 'use-twitter-analytics' );
|
21 |
+
|
22 |
+
// Use custom external URLs to point elsewhere.
|
23 |
+
delete_option( 'jd_twit_custom_url' );
|
24 |
+
|
25 |
+
// Cligs API
|
26 |
+
delete_option( 'cligsapi' );
|
27 |
+
|
28 |
+
// Error checking
|
29 |
+
delete_option( 'jd_functions_checked' );
|
30 |
+
delete_option( 'wp_twitter_failure' );
|
31 |
+
delete_option( 'wp_cligs_failure' );
|
32 |
+
|
33 |
+
// Blogroll options
|
34 |
+
delete_option( 'jd-use-link-title' );
|
35 |
+
delete_option( 'jd-use-link-description' );
|
36 |
+
delete_option( 'newlink-published-text' );
|
37 |
+
delete_option( 'jd_twit_blogroll' );
|
38 |
+
|
39 |
+
// Default publishing options.
|
40 |
+
delete_option( 'jd_tweet_default' );
|
41 |
+
// Note that default options are set.
|
42 |
+
delete_option( 'twitterInitialised' );
|
43 |
+
delete_option( 'wp_twitter_failure' );
|
44 |
+
delete_option( 'wp_cligs_failure' );
|
45 |
+
delete_option( 'twitterlogin' );
|
46 |
+
delete_option( 'twitterpw' );
|
47 |
+
delete_option( 'twitterlogin_encrypted' );
|
48 |
+
delete_option( 'cligsapi' );
|
49 |
+
delete_option( 'jd_twit_quickpress' );
|
50 |
+
}
|
51 |
+
?>
|
wp-to-twitter-logo.png
ADDED
Binary file
|
wp-to-twitter-manager.php
CHANGED
@@ -1,248 +1,385 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
$wp_to_twitter_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) );
|
4 |
-
|
5 |
//update_option( 'twitterInitialised', '0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
//SETS DEFAULT OPTIONS
|
7 |
if( get_option( 'twitterInitialised') != '1' ) {
|
8 |
update_option( 'newpost-published-update', '1' );
|
9 |
-
update_option( 'newpost-published-text', '
|
10 |
update_option( 'newpost-published-showlink', '1' );
|
11 |
-
|
|
|
12 |
update_option( 'oldpost-edited-update', '1' );
|
13 |
-
update_option( 'oldpost-edited-text', '
|
14 |
update_option( 'oldpost-edited-showlink', '1' );
|
15 |
|
16 |
-
update_option( 'twitterInitialised', '1' );
|
17 |
-
update_option( 'cligsapi','' );
|
18 |
update_option( 'jd_twit_pages','0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
update_option( 'jd_functions_checked','0' );
|
20 |
update_option( 'wp_twitter_failure','0' );
|
21 |
update_option( 'wp_cligs_failure','0' );
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
update_option( 'wp_twitter_failure','0' );
|
27 |
update_option( 'wp_cligs_failure','0' );
|
28 |
-
$message =
|
29 |
}
|
|
|
|
|
30 |
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
} else {
|
38 |
-
$wp_to_twitter_failure
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
-
|
42 |
-
if ( $_POST['submit-type'] == 'options' ) {
|
43 |
//UPDATE OPTIONS
|
44 |
update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
|
45 |
update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
|
46 |
update_option( 'newpost-published-showlink', $_POST['newpost-published-showlink'] );
|
47 |
-
|
48 |
update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
|
49 |
update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
|
50 |
update_option( 'oldpost-edited-showlink', $_POST['oldpost-edited-showlink'] );
|
51 |
update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
$message = "WP to Twitter Options Updated";
|
53 |
|
54 |
-
}else if ( $_POST['submit-type'] == 'login' ){
|
55 |
//UPDATE LOGIN
|
56 |
-
if( ( $_POST['twitterlogin'] != '' )
|
57 |
-
update_option(
|
58 |
-
update_option(
|
59 |
-
|
|
|
60 |
} else {
|
61 |
-
$message = "You need to provide your twitter login and password!";
|
62 |
}
|
63 |
-
} else if ( $_POST['submit-type'] == 'cligsapi' ) {
|
64 |
-
if ( $_POST['cligsapi'] != '' ) {
|
65 |
update_option( 'cligsapi',$_POST['cligsapi'] );
|
66 |
-
$message = "Cligs API Key Updated";
|
|
|
|
|
|
|
67 |
} else {
|
68 |
-
$message = "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</a>!";
|
69 |
}
|
70 |
}
|
71 |
|
72 |
-
// FUNCTION to see if checkboxes should be checked
|
73 |
-
function jd_checkCheckbox( $theFieldname ){
|
74 |
-
if( get_option( $theFieldname ) == '1'){
|
75 |
-
echo 'checked="true"';
|
76 |
-
}
|
77 |
-
}
|
78 |
// Check whether the server has supported for needed functions.
|
|
|
|
|
|
|
|
|
79 |
if ( get_option('jd-functions-checked') == '0') {
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
// If everything's OK, there's no reason to do this again.
|
90 |
-
if ($wp_twitter_error == FALSE) {
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
}
|
93 |
}
|
94 |
-
|
95 |
?>
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
padding:0;
|
101 |
-
border: none;
|
102 |
-
}
|
103 |
-
#wp-to-twitter form p {
|
104 |
-
background: #eaf3fa;
|
105 |
-
padding: 10px 5px;
|
106 |
-
margin: 4px 0;
|
107 |
-
border: 1px solid #eee;
|
108 |
-
}
|
109 |
-
#wp-to-twitter form .error p {
|
110 |
-
background: none;
|
111 |
-
border: none;
|
112 |
-
}
|
113 |
-
.floatright {
|
114 |
-
float: right;
|
115 |
-
}
|
116 |
-
.cligs {
|
117 |
-
background: #efecdb url(<?php echo $wp_to_twitter_directory; ?>/images/cligs.png) right 50% no-repeat;
|
118 |
-
padding: 2px!important;
|
119 |
-
}
|
120 |
-
.twitter {
|
121 |
-
background: url(<?php echo $wp_to_twitter_directory; ?>/images/twitter.png) right 50% no-repeat;
|
122 |
-
padding: 2px!important;
|
123 |
-
}
|
124 |
-
-->
|
125 |
-
</style>
|
126 |
-
<?php if ($wp_twitter_error == TRUE) {
|
127 |
-
echo "<div class='error'><p>This plugin will not work in your server environment.</p></div>";
|
128 |
-
}
|
129 |
-
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
130 |
-
echo $wp_to_twitter_failure;
|
131 |
}
|
132 |
?>
|
133 |
-
<?php if ($message)
|
134 |
<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
|
135 |
-
<?php
|
136 |
<div id="dropmessage" class="updated" style="display:none;"></div>
|
137 |
|
138 |
<div class="wrap" id="wp-to-twitter">
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) { ?>
|
140 |
-
<form method="post">
|
141 |
<div class="error">
|
142 |
-
<
|
143 |
-
<input type="hidden" name="submit-type" value="clear-error">
|
144 |
-
</div>
|
145 |
-
<p><input type="submit" name="submit" value="Clear 'WP to Twitter' Error" /> <strong>Why are you seeing this field?</strong><br />
|
146 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
|
147 |
-
|
148 |
}
|
149 |
if ( get_option( 'wp_cligs_failure' ) == '1' ) {
|
150 |
-
|
151 |
}
|
|
|
152 |
?>
|
153 |
-
If you see these errors frequently, please <a href="http://www.joedolson.com/articles/wp-to-twitter/">notify the developer</a>.
|
154 |
</p>
|
155 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
</form>
|
157 |
<?php
|
158 |
}
|
159 |
-
?>
|
160 |
-
|
161 |
-
<
|
162 |
-
<p>
|
163 |
-
For any update field, you can use the codes <code>#title#</code> for the title of your blog post or <code>#blog#</code> for the title of your blog! Given the character limit for Twitter, you may not want to include your blog title.
|
164 |
-
</p>
|
165 |
-
|
166 |
-
<form method="post">
|
167 |
<div>
|
168 |
<fieldset>
|
169 |
-
<legend
|
170 |
<p>
|
171 |
<input type="checkbox" name="jd_twit_pages" id="jd_twit_pages" value="1" <?php jd_checkCheckbox('jd_twit_pages')?> />
|
172 |
-
<label for="jd_twit_pages"
|
173 |
-
</p>
|
|
|
|
|
|
|
|
|
174 |
<p>
|
175 |
<input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
|
176 |
-
<label for="newpost-published-update"
|
177 |
</p>
|
178 |
<p>
|
179 |
-
<label for="newpost-published-text"
|
180 |
-
<input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="
|
181 |
|
182 |
<input type="checkbox" name="newpost-published-showlink" id="newpost-published-showlink" value="1" <?php jd_checkCheckbox('newpost-published-showlink')?> />
|
183 |
-
<label for="newpost-published-showlink"
|
184 |
</p>
|
185 |
|
186 |
<p>
|
187 |
<input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
|
188 |
-
<label for="oldpost-edited-update"
|
189 |
</p>
|
190 |
<p>
|
191 |
<label for="oldpost-edited-text">Text for this Twitter update</label><br />
|
192 |
-
<input type="text" name="oldpost-edited-text" id="oldpost-edited-text" size="60" maxlength="
|
193 |
|
194 |
<input type="checkbox" name="oldpost-edited-showlink" id="oldpost-edited-showlink" value="1" <?php jd_checkCheckbox('oldpost-edited-showlink')?> />
|
195 |
-
<label for="oldpost-edited-showlink"
|
196 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
<div>
|
198 |
<input type="hidden" name="submit-type" value="options" />
|
199 |
</div>
|
200 |
-
<input type="submit" name="submit" value="Save WP->Twitter Options" />
|
201 |
</fieldset>
|
202 |
|
203 |
</div>
|
204 |
</form>
|
205 |
|
206 |
-
<h2 class="twitter"
|
207 |
|
208 |
-
<form method="post" >
|
209 |
<div>
|
210 |
<p>
|
211 |
-
<label for="twitterlogin"
|
212 |
<input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo(get_option('twitterlogin')) ?>" />
|
213 |
</p>
|
214 |
<p>
|
215 |
-
<label for="twitterpw"
|
216 |
<input type="password" name="twitterpw" id="twitterpw" value="" />
|
217 |
</p>
|
218 |
-
<input type="hidden" name="submit-type" value="login"
|
219 |
-
<p><input type="submit" name="submit" value="Save Twitter Login Info" /> » <small>Don't have a Twitter account? <a href=
|
220 |
</div>
|
221 |
</form>
|
222 |
|
223 |
-
<h2 class="cligs"
|
224 |
|
225 |
-
<form method="post">
|
226 |
<div>
|
227 |
<p>
|
228 |
-
<label for="cligsapi"
|
229 |
<input type="text" name="cligsapi" id="cligsapi" size="40" value="<?php echo(get_option('cligsapi')) ?>" />
|
230 |
</p>
|
231 |
<div>
|
232 |
-
<input type="hidden" name="submit-type" value="cligsapi"
|
233 |
</div>
|
234 |
-
<p><input type="submit" name="submit" value="Save Cli.gs API Key" />
|
235 |
</div>
|
236 |
-
|
237 |
-
|
|
|
238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
</div>
|
240 |
</form>
|
241 |
-
|
242 |
-
</div>
|
243 |
|
244 |
|
245 |
<div class="wrap">
|
246 |
-
<h3
|
247 |
-
<p
|
|
|
248 |
</div>
|
1 |
<?php
|
|
|
|
|
|
|
2 |
//update_option( 'twitterInitialised', '0' );
|
3 |
+
// FUNCTION to see if checkboxes should be checked
|
4 |
+
function jd_checkCheckbox( $theFieldname ) {
|
5 |
+
if( get_option( $theFieldname ) == '1'){
|
6 |
+
echo 'checked="checked"';
|
7 |
+
}
|
8 |
+
}
|
9 |
+
$wp_twitter_error = FALSE;
|
10 |
+
$wp_cligs_error = FALSE;
|
11 |
+
$message = "";
|
12 |
//SETS DEFAULT OPTIONS
|
13 |
if( get_option( 'twitterInitialised') != '1' ) {
|
14 |
update_option( 'newpost-published-update', '1' );
|
15 |
+
update_option( 'newpost-published-text', 'New post: #title# (#url#)' );
|
16 |
update_option( 'newpost-published-showlink', '1' );
|
17 |
+
update_option( 'jd_twit_quickpress', '1' );
|
18 |
+
|
19 |
update_option( 'oldpost-edited-update', '1' );
|
20 |
+
update_option( 'oldpost-edited-text', 'Post Edited: #title# (#url#)' );
|
21 |
update_option( 'oldpost-edited-showlink', '1' );
|
22 |
|
|
|
|
|
23 |
update_option( 'jd_twit_pages','0' );
|
24 |
+
update_option( 'jd_twit_edited_pages','0' );
|
25 |
+
|
26 |
+
update_option( 'jd_twit_remote', '0' );
|
27 |
+
|
28 |
+
// Use Google Analytics with Twitter
|
29 |
+
update_option( 'twitter-analytics-campaign', '' );
|
30 |
+
update_option( 'use-twitter-analytics', '0' );
|
31 |
+
|
32 |
+
// Use custom external URLs to point elsewhere.
|
33 |
+
update_option( 'jd_twit_custom_url', 'external_link' );
|
34 |
+
|
35 |
+
// Cligs API
|
36 |
+
update_option( 'cligsapi','' );
|
37 |
+
|
38 |
+
// Error checking
|
39 |
update_option( 'jd_functions_checked','0' );
|
40 |
update_option( 'wp_twitter_failure','0' );
|
41 |
update_option( 'wp_cligs_failure','0' );
|
42 |
+
|
43 |
+
// Blogroll options
|
44 |
+
update_option ('jd-use-link-title','0' );
|
45 |
+
update_option( 'jd-use-link-description','1' );
|
46 |
+
update_option( 'newlink-published-text', 'New link posted: ' );
|
47 |
+
update_option( 'jd_twit_blogroll', '1');
|
48 |
+
|
49 |
+
// Default publishing options.
|
50 |
+
update_option( 'jd_tweet_default', '0' );
|
51 |
+
// Note that default options are set.
|
52 |
+
update_option( 'twitterInitialised', '1' );
|
53 |
|
54 |
+
$message = __("Set your Twitter login information and Cli.gs API to use this plugin! ");
|
55 |
+
}
|
56 |
+
if( get_option( 'twitterInitialised') == '1' && get_option( 'twitterpw' ) == "" ) {
|
57 |
+
$message .= __("Please add your Twitter password. ");
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
|
61 |
update_option( 'wp_twitter_failure','0' );
|
62 |
update_option( 'wp_cligs_failure','0' );
|
63 |
+
$message = __("WP to Twitter Errors Cleared");
|
64 |
}
|
65 |
+
|
66 |
+
// Error messages on failures
|
67 |
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
68 |
+
if ( get_option( 'wp_cligs_failure' ) == '1' ) {
|
69 |
+
$wp_to_twitter_failure .= "<p>" . __("Cli.gs request failed! We couldn't shrink that URL, so we attached the normal URL to your Tweet. Check the <a href='http://blog.cli.gs'>Cli.gs blog</a> to see if there are any known issues. ") . "</p>";
|
70 |
+
}
|
71 |
+
|
72 |
+
if ( get_option( 'wp_twitter_failure' ) == '1' ) {
|
73 |
+
$wp_to_twitter_failure .= "<p>" . __("Sorry! I couldn't get in touch with the Twitter servers to post your new blog post. Your tweet has been stored in a custom field attached to the post, so you can Tweet it manually if you wish! ") . "</p>";
|
74 |
+
} else if ( get_option( 'wp_twitter_failure' ) == '2') {
|
75 |
+
$wp_to_twitter_failure .= "<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. ") . "</p>";
|
76 |
+
}
|
77 |
+
|
78 |
+
} else {
|
79 |
+
$wp_to_twitter_failure = '';
|
80 |
}
|
81 |
|
82 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) {
|
|
|
83 |
//UPDATE OPTIONS
|
84 |
update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
|
85 |
update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
|
86 |
update_option( 'newpost-published-showlink', $_POST['newpost-published-showlink'] );
|
87 |
+
update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
|
88 |
update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
|
89 |
update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
|
90 |
update_option( 'oldpost-edited-showlink', $_POST['oldpost-edited-showlink'] );
|
91 |
update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
|
92 |
+
update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] );
|
93 |
+
update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
|
94 |
+
update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
|
95 |
+
update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
|
96 |
+
|
97 |
+
update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
|
98 |
+
update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
|
99 |
+
|
100 |
+
|
101 |
+
if ( $_POST['jd-use-link-field'] == '2' ) {
|
102 |
+
update_option( 'jd-use-link-description', '1' );
|
103 |
+
update_option( 'jd-use-link-title', '0' );
|
104 |
+
|
105 |
+
} else if ( $_POST['jd-use-link-field'] == '1' ) {
|
106 |
+
update_option( 'jd-use-link-title', '1' );
|
107 |
+
update_option( 'jd-use-link-description', '0' );
|
108 |
+
}
|
109 |
+
update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
|
110 |
+
update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
|
111 |
+
|
112 |
+
update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
|
113 |
+
update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
|
114 |
+
|
115 |
+
update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
|
116 |
+
|
117 |
$message = "WP to Twitter Options Updated";
|
118 |
|
119 |
+
} else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'login' ) {
|
120 |
//UPDATE LOGIN
|
121 |
+
if( ( $_POST['twitterlogin'] != '' ) && ( $_POST['twitterpw'] != '' ) ) {
|
122 |
+
update_option( 'twitterlogin', $_POST['twitterlogin'] );
|
123 |
+
update_option( 'twitterpw', $_POST['twitterpw'] );
|
124 |
+
update_option( 'twitterlogin_encrypted', base64_encode( $_POST['twitterlogin'].':'.$_POST['twitterpw'] ) );
|
125 |
+
$message = __("Twitter login and password updated. ");
|
126 |
} else {
|
127 |
+
$message = __("You need to provide your twitter login and password! ");
|
128 |
}
|
129 |
+
} else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'cligsapi' ) {
|
130 |
+
if ( $_POST['cligsapi'] != '' && isset( $_POST['submit'] ) ) {
|
131 |
update_option( 'cligsapi',$_POST['cligsapi'] );
|
132 |
+
$message = __("Cligs API Key Updated");
|
133 |
+
} else if ( isset( $_POST['clear'] ) ) {
|
134 |
+
update_option( 'cligsapi','' );
|
135 |
+
$message = __("Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be associated with your account. ");
|
136 |
} else {
|
137 |
+
$message = __("Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</a>! ");
|
138 |
}
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
// Check whether the server has supported for needed functions.
|
142 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'check-support' ) {
|
143 |
+
update_option('jd-functions-checked', '0');
|
144 |
+
}
|
145 |
+
// If you're attempting to solve the "settings page doesn't display" problem, begin your comment here.
|
146 |
if ( get_option('jd-functions-checked') == '0') {
|
147 |
+
$cligs_checker = new Snoopy;
|
148 |
+
$twit_checker = new Snoopy;
|
149 |
+
$testurl = urlencode("http://www.joedolson.com/articles/wp-to-twitter/");
|
150 |
+
|
151 |
+
$cligs_checker->fetchtext( "http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1" );
|
152 |
+
$twit_checker->fetch( "http://twitter.com/help/test.json" );
|
153 |
+
$wp_twitter_error = TRUE;
|
154 |
+
$wp_cligs_error = TRUE;
|
155 |
+
if ( strlen(getfilefromurl("http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1")) == 20 || strlen($cligs_checker->results) == 20 ) {
|
156 |
+
$wp_cligs_error = FALSE;
|
157 |
+
$message .= __("Successfully contacted the Cli.gs API. ");
|
158 |
+
//$message .= "Twit: " . $twit_checker->results;
|
159 |
+
} else {
|
160 |
+
$message .=__("Failed to contact the Cli.gs API. ");
|
161 |
+
}
|
162 |
+
if ( $twit_checker->results == "\"ok\"" || getfilefromurl("http://twitter.com/help/test.xml") == "<ok>true</ok>" ) {
|
163 |
+
$wp_twitter_error = FALSE;
|
164 |
+
$message .= __("Successfully contacted the Twitter API. ");
|
165 |
+
} else {
|
166 |
+
$message .= __("Failed to contact the Twitter API. ");
|
167 |
+
}
|
168 |
// If everything's OK, there's no reason to do this again.
|
169 |
+
if ($wp_twitter_error == FALSE && $wp_cligs_error == FALSE) {
|
170 |
+
$message .= __("Your server appears to support the required PHP functions and classes for WP to Twitter to function.");
|
171 |
+
update_option( 'jd-functions-checked','1' );
|
172 |
+
} else {
|
173 |
+
if ( !function_exists( 'fputs' ) ) {
|
174 |
+
$wp_function_error = TRUE;
|
175 |
+
$message .= __("Your server does not support <code>fputs</code>.");
|
176 |
+
}
|
177 |
+
if ( !function_exists( 'curl_init' ) || !function_exists( 'file_get_contents' ) ) {
|
178 |
+
$wp_function_error = TRUE;
|
179 |
+
$message .= __("Your server does not support <code>file_get_contents</code> or <code>cURL</code> functions.");
|
180 |
+
}
|
181 |
+
if ( !class_exists( 'Snoopy' ) ) {
|
182 |
+
$wp_function_error = TRUE;
|
183 |
+
$message .= __("Your server does not support <code>Snoopy</code>.");
|
184 |
+
}
|
185 |
+
|
186 |
+
$message .= __("Your server does not appear to support the required PHP functions and classes for WP to Twitter to function. You can try it anyway - these tests aren't perfect - but no guarantees.");
|
187 |
+
update_option( 'jd-functions-checked','1' );
|
188 |
+
|
189 |
}
|
190 |
}
|
191 |
+
// CLOSE BUG FIX COMMENT HERE
|
192 |
?>
|
193 |
+
<?php if ( $wp_twitter_error == TRUE || $wp_cligs_error == TRUE ) {
|
194 |
+
echo "<div class='error'><p>";
|
195 |
+
_e("This plugin may not work in your server environment.");
|
196 |
+
echo "</p></div>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
?>
|
199 |
+
<?php if ($message) { ?>
|
200 |
<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
|
201 |
+
<?php } ?>
|
202 |
<div id="dropmessage" class="updated" style="display:none;"></div>
|
203 |
|
204 |
<div class="wrap" id="wp-to-twitter">
|
205 |
+
|
206 |
+
<h2><?php _e("WP to Twitter Options"); ?></h2>
|
207 |
+
<p>
|
208 |
+
<?php _e("For any update field, you can use the codes <code>#title#</code> for the title of your blog post, <code>#blog#</code> for the title of your blog, or <code>#url#</code> for the post URL! Given the character limit for Twitter, you may not want to include your blog title."); ?>
|
209 |
+
</p>
|
210 |
+
|
211 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) { ?>
|
|
|
212 |
<div class="error">
|
213 |
+
<p>
|
|
|
|
|
|
|
214 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' ) {
|
215 |
+
_e("One or more of your last posts has failed to send it's status update to Twitter. Your Tweet has been saved in the custom meta data for your post, and you can re-Tweet it at your leisure.");
|
216 |
}
|
217 |
if ( get_option( 'wp_cligs_failure' ) == '1' ) {
|
218 |
+
_e("The query to the Cli.gs API failed, and your URL was not shrunk. The normal post URL was attached to your Tweet.");
|
219 |
}
|
220 |
+
echo $wp_to_twitter_failure;
|
221 |
?>
|
|
|
222 |
</p>
|
223 |
</div>
|
224 |
+
<form method="post" action="">
|
225 |
+
<div>
|
226 |
+
<input type="hidden" name="submit-type" value="clear-error" />
|
227 |
+
</div>
|
228 |
+
<p><input type="submit" name="submit" value="<?php _e("Clear 'WP to Twitter' Error"); ?>" /> <strong><?php _e("Why are you seeing this field?"); ?></strong>
|
229 |
+
</p>
|
230 |
</form>
|
231 |
<?php
|
232 |
}
|
233 |
+
?>
|
234 |
+
|
235 |
+
<form method="post" action="">
|
|
|
|
|
|
|
|
|
|
|
236 |
<div>
|
237 |
<fieldset>
|
238 |
+
<legend><?php _e("Wordpress to Twitter Publishing Options"); ?></legend>
|
239 |
<p>
|
240 |
<input type="checkbox" name="jd_twit_pages" id="jd_twit_pages" value="1" <?php jd_checkCheckbox('jd_twit_pages')?> />
|
241 |
+
<label for="jd_twit_pages"><strong><?php _e("Update Twitter when new Wordpress Pages are published"); ?></strong></label>
|
242 |
+
</p>
|
243 |
+
<p>
|
244 |
+
<input type="checkbox" name="jd_twit_edited_pages" id="jd_twit_edited_pages" value="1" <?php jd_checkCheckbox('jd_twit_edited_pages')?> />
|
245 |
+
<label for="jd_twit_edited_pages"><strong><?php _e("Update Twitter when WordPress Pages are edited"); ?></strong></label>
|
246 |
+
</p>
|
247 |
<p>
|
248 |
<input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
|
249 |
+
<label for="newpost-published-update"><strong><?php _e("Update Twitter when a new post is published"); ?></strong></label>
|
250 |
</p>
|
251 |
<p>
|
252 |
+
<label for="newpost-published-text"><?php _e("Text for this Twitter update"); ?></label><br />
|
253 |
+
<input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo(get_option('newpost-published-text')) ?>" />
|
254 |
|
255 |
<input type="checkbox" name="newpost-published-showlink" id="newpost-published-showlink" value="1" <?php jd_checkCheckbox('newpost-published-showlink')?> />
|
256 |
+
<label for="newpost-published-showlink"><?php _e("Provide link to blog?"); ?></label>
|
257 |
</p>
|
258 |
|
259 |
<p>
|
260 |
<input type="checkbox" name="oldpost-edited-update" id="oldpost-edited-update" value="1" <?php jd_checkCheckbox('oldpost-edited-update')?> />
|
261 |
+
<label for="oldpost-edited-update"><strong><?php _e("Update Twitter when an old post has been edited"); ?></strong></label>
|
262 |
</p>
|
263 |
<p>
|
264 |
<label for="oldpost-edited-text">Text for this Twitter update</label><br />
|
265 |
+
<input type="text" name="oldpost-edited-text" id="oldpost-edited-text" size="60" maxlength="120" value="<?php echo(get_option('oldpost-edited-text')) ?>" />
|
266 |
|
267 |
<input type="checkbox" name="oldpost-edited-showlink" id="oldpost-edited-showlink" value="1" <?php jd_checkCheckbox('oldpost-edited-showlink')?> />
|
268 |
+
<label for="oldpost-edited-showlink"><?php _e("Provide link to blog?"); ?></label>
|
269 |
</p>
|
270 |
+
|
271 |
+
<p>
|
272 |
+
<input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
|
273 |
+
<label for="oldpost-edited-update"><strong><?php _e("Update Twitter when you post a Blogroll link"); ?></strong></label>
|
274 |
+
</p>
|
275 |
+
<p>
|
276 |
+
<input type="radio" name="jd-use-link-field" id="jd-use-link-title" value="1" <?php jd_checkCheckbox('jd-use-link-title')?> /> <label for="jd-use-link-title"><?php _e("Use <strong>link title</strong> for Twitter updates"); ?></label> <input type="radio" name="jd-use-link-field" id="jd-use-link-description" value="2" <?php jd_checkCheckbox('jd-use-link-description')?> /> <label for="jd-use-link-description"><?php _e("Use <strong>link description</strong> for Twitter updates"); ?></label>
|
277 |
+
</p>
|
278 |
+
|
279 |
+
<p>
|
280 |
+
<label for="newlink-published-text"><?php _e("Text for this Twitter update (used if above choice isn't available.)"); ?></label><br />
|
281 |
+
<input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo(get_option('newlink-published-text')) ?>" />
|
282 |
+
</p>
|
283 |
+
|
284 |
+
<p>
|
285 |
+
<input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
|
286 |
+
<label for="jd_tweet_default"><strong><?php _e("Set default Tweet status to 'No.'"); ?></strong></label><br />
|
287 |
+
<small><?php _e("Twitter updates can be set on a post by post basis. By default, posts WILL be posted to Twitter. Check this to change the default to NO."); ?></small>
|
288 |
+
</p>
|
289 |
+
<p>
|
290 |
+
<input type="checkbox" name="jd_twit_remote" id="jd_twit_remote" value="1" <?php jd_checkCheckbox('jd_twit_remote')?> />
|
291 |
+
<label for="jd_twit_remote"><strong><?php _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"); ?></strong></label>
|
292 |
+
</p>
|
293 |
+
<p>
|
294 |
+
<input type="checkbox" name="jd_twit_quickpress" id="jd_twit_quickpress" value="1" <?php jd_checkCheckbox('jd_twit_quickpress')?> />
|
295 |
+
<label for="jd_twit_quickpress"><strong><?php _e("Update Twitter when a post is published using QuickPress"); ?></strong></label>
|
296 |
+
</p>
|
297 |
+
|
298 |
+
<p>
|
299 |
+
<label for="jd_twit_prepend"><?php _e("Custom text to be prepended on every Tweet"); ?></label><br />
|
300 |
+
<input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="60" maxlength="20" value="<?php echo(get_option('jd_twit_prepend')) ?>" />
|
301 |
+
</p>
|
302 |
+
|
303 |
+
<p>
|
304 |
+
<label for="jd_twit_append"><?php _e("Custom text to be appended on every Tweet"); ?></label><br />
|
305 |
+
<input type="text" name="jd_twit_append" id="jd_twit_append" size="60" maxlength="20" value="<?php echo(get_option('jd_twit_append')) ?>" />
|
306 |
+
</p>
|
307 |
+
|
308 |
+
<p>
|
309 |
+
<label for="jd_twit_custom_url"><?php _e("Custom field containing an alternate URL to be shortened and Tweeted."); ?></label><br />
|
310 |
+
<input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="60" maxlength="120" value="<?php echo(get_option('jd_twit_custom_url')) ?>" /><br />
|
311 |
+
<small><?php _e("You can use a custom field to send Cli.gs and Twitter an alternate URL from the permalink provided by WordPress. The value is the name of the custom field you're using to add an external URL."); ?></small>
|
312 |
+
</p>
|
313 |
+
<p>
|
314 |
+
<label for="twitter-analytics-campaign"><?php _e("Campaign identifier for Google Analytics"); ?></label><br />
|
315 |
+
<input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="60" maxlength="120" value="<?php echo(get_option('twitter-analytics-campaign')) ?>" /><br />
|
316 |
+
<small><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here."); ?></small>
|
317 |
+
</p>
|
318 |
+
<p>
|
319 |
+
<input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
|
320 |
+
<label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter"); ?></strong></label>
|
321 |
+
</p>
|
322 |
+
<p>
|
323 |
+
<input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
|
324 |
+
<label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts"); ?></strong></label><br /><small><?php _e('Each author can set their own Twitter username and password in their user profile. Their posts will be sent to their own Twitter accounts.'); ?></small>
|
325 |
+
</p>
|
326 |
+
|
327 |
<div>
|
328 |
<input type="hidden" name="submit-type" value="options" />
|
329 |
</div>
|
330 |
+
<input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options"); ?>" class="button-primary" />
|
331 |
</fieldset>
|
332 |
|
333 |
</div>
|
334 |
</form>
|
335 |
|
336 |
+
<h2 class="twitter"><?php _e("Your Twitter account details"); ?></h2>
|
337 |
|
338 |
+
<form method="post" action="" >
|
339 |
<div>
|
340 |
<p>
|
341 |
+
<label for="twitterlogin"><?php _e("Your Twitter username:"); ?></label>
|
342 |
<input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo(get_option('twitterlogin')) ?>" />
|
343 |
</p>
|
344 |
<p>
|
345 |
+
<label for="twitterpw"><?php _e("Your Twitter password:"); ?></label>
|
346 |
<input type="password" name="twitterpw" id="twitterpw" value="" />
|
347 |
</p>
|
348 |
+
<input type="hidden" name="submit-type" value="login" />
|
349 |
+
<p><input type="submit" name="submit" value="<?php _e("Save Twitter Login Info"); ?>" class="button-primary" /> <?php _e("» <small>Don't have a Twitter account? <a href='http://www.twitter.com'>Get one for free here</a>"); ?></small></p>
|
350 |
</div>
|
351 |
</form>
|
352 |
|
353 |
+
<h2 class="cligs"><?php _e("Your Cli.gs account details"); ?></h2>
|
354 |
|
355 |
+
<form method="post" action="">
|
356 |
<div>
|
357 |
<p>
|
358 |
+
<label for="cligsapi"><?php _e("Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"); ?></label>
|
359 |
<input type="text" name="cligsapi" id="cligsapi" size="40" value="<?php echo(get_option('cligsapi')) ?>" />
|
360 |
</p>
|
361 |
<div>
|
362 |
+
<input type="hidden" name="submit-type" value="cligsapi" />
|
363 |
</div>
|
364 |
+
<p><input type="submit" name="submit" value="Save Cli.gs API Key" class="button-primary" /> <input type="submit" name="clear" value="Clear Cli.gs API Key" />» <small><?php _e("Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/api/'>Get one free here</a>!<br />You'll need an API key in order to associate the Cligs you create with your Cligs account."); ?></small></p>
|
365 |
</div>
|
366 |
+
</form>
|
367 |
+
|
368 |
+
</div>
|
369 |
|
370 |
+
<form method="post" action="">
|
371 |
+
<div>
|
372 |
+
<input type="hidden" name="submit-type" value="check-support" />
|
373 |
+
<p>
|
374 |
+
<input type="submit" name="submit" value="Check Support Level" class="button-primary" /> <small>Check whether your server supports the functions required for the Twitter and Cli.gs API calls to work.</small>
|
375 |
+
</p>
|
376 |
</div>
|
377 |
</form>
|
378 |
+
|
|
|
379 |
|
380 |
|
381 |
<div class="wrap">
|
382 |
+
<h3><?php _e("Need help?"); ?></h3>
|
383 |
+
<p><?php _e("Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to Twitter plugin page</a>."); ?></p>
|
384 |
+
|
385 |
</div>
|
wp-to-twitter.php
CHANGED
@@ -2,12 +2,11 @@
|
|
2 |
/*
|
3 |
Plugin Name: WP to Twitter
|
4 |
Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
|
5 |
-
Description: Updates Twitter when you create a new blog post using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account with the name of your post as the title.
|
6 |
-
Version: 1.
|
7 |
Author: Joseph Dolson
|
8 |
Author URI: http://www.joedolson.com/
|
9 |
*/
|
10 |
-
|
11 |
/* Copyright 2008 Joseph C Dolson (email : wp-to-twitter@joedolson.com)
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
@@ -24,22 +23,53 @@ Author URI: http://www.joedolson.com/
|
|
24 |
along with this program; if not, write to the Free Software
|
25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
26 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
$jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
$host = 'twitter.com';
|
31 |
$port = 80;
|
32 |
$fp = @fsockopen($host, $port, $err_num, $err_msg, 10);
|
33 |
|
34 |
//check if user login details have been entered on admin page
|
|
|
35 |
$thisLoginDetails = get_option( 'twitterlogin_encrypted' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
if ( $thisLoginDetails != '' ) {
|
38 |
if ( !is_resource($fp) ) {
|
39 |
#echo "$err_msg ($err_num)<br>\n"; // Fail Silently, but you could turn these back on...
|
40 |
return FALSE;
|
41 |
} else {
|
42 |
-
$response = TRUE;
|
43 |
if (!fputs( $fp, "POST $twitterURI HTTP/1.1\r\n" )) {
|
44 |
return FALSE;
|
45 |
}
|
@@ -54,12 +84,70 @@ function jd_doTwitterAPIPost( $twit, $twitterURI ) {
|
|
54 |
$reply = fgets( $fp, 256 );
|
55 |
}
|
56 |
fclose( $fp );
|
57 |
-
return
|
58 |
}
|
59 |
} else {
|
60 |
// no username/password: return an empty string
|
61 |
return FALSE;
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
|
65 |
// cURL query contributed by Thor Erik (http://thorerik.net)
|
@@ -74,178 +162,559 @@ function getfilefromurl($url) {
|
|
74 |
return $output;
|
75 |
}
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
function jd_twit( $post_ID ) {
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
$shrink = $thispostlink;
|
102 |
-
}
|
103 |
-
$sentence = $sentence . " " . $shrink;
|
104 |
-
|
105 |
-
if ( $customTweet != "" ) {
|
106 |
-
// Get the custom Tweet message if it's been supplied. Truncate it to fit if necessary.
|
107 |
-
if ( get_option( 'newpost-published-showlink') == '1' ) {
|
108 |
-
if ( ( strlen( $customTweet ) + 21) > 140 ) {
|
109 |
-
$customTweet = substr( $customTweet, 0, 119 );
|
110 |
-
}
|
111 |
} else {
|
112 |
-
|
113 |
-
$customTweet = substr( $customTweet, 0, 140 );
|
114 |
-
}
|
115 |
}
|
116 |
-
|
117 |
-
|
|
|
|
|
118 |
} else {
|
119 |
-
$sentence = $
|
120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
} else {
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
129 |
} else {
|
130 |
-
$
|
131 |
-
|
132 |
-
$twit_length = strlen( $sentence );
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
}
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
}
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
} else {
|
153 |
-
$
|
154 |
}
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
-
$sentence = str_replace( '#title#', $thisposttitle, $sentence );
|
158 |
-
$sentence = str_replace( '#blog#',$thisblogtitle,$sentence );
|
159 |
-
|
160 |
}
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
$post_id = $post;
|
178 |
if (is_object($post_id)) {
|
179 |
$post_id = $post_id->ID;
|
180 |
}
|
181 |
$jd_twitter = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'jd_twitter', true)));
|
|
|
|
|
|
|
|
|
|
|
182 |
?>
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
<div id="wp-to-twitter" class="postbox closed">
|
193 |
-
<h3><?php _e('WP to Twitter', 'wp-to-twitter') ?></h3>
|
194 |
-
<div class="inside">
|
195 |
-
<div id="jd-twitter">
|
196 |
-
<?php } else { ?>
|
197 |
-
<div class="dbx-b-ox-wrapper">
|
198 |
-
<fieldset id="twitdiv" class="dbx-box">
|
199 |
-
<div class="dbx-h-andle-wrapper">
|
200 |
-
<h3 class="dbx-handle"><?php _e('WP to Twitter', 'wp-to-twitter') ?></h3>
|
201 |
-
</div>
|
202 |
-
<div class="dbx-c-ontent-wrapper">
|
203 |
-
<div class="dbx-content">
|
204 |
-
<?php } ?>
|
205 |
-
|
206 |
-
<input value="jd_twit_edit" type="hidden" name="jd_twit_edit" />
|
207 |
-
|
208 |
-
<label for="jd_twitter"><?php _e('Twitter Post', 'wp-to-twitter') ?></label><br /><textarea name="jd_twitter" id="jd_twitter" rows="2" cols="60"
|
209 |
onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
|
210 |
onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo $jd_twitter ?></textarea>
|
211 |
-
<p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo strlen( $description); ?>" />
|
212 |
-
<?php _e(' characters. Twitter posts are a maximum of 140 characters; if your Cli.gs URL is appended to the end of your document, you have 119 characters available.', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter') ?></a> »
|
213 |
</p>
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
// Post the Custom Tweet into the post meta table
|
225 |
function post_jd_twitter( $id ) {
|
226 |
-
$
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
|
|
234 |
}
|
235 |
|
236 |
// Add the administrative settings to the "Settings" menu.
|
237 |
function jd_addTwitterAdminPages() {
|
238 |
if ( function_exists( 'add_submenu_page' ) ) {
|
239 |
-
add_options_page( 'WP -> Twitter', 'WP -> Twitter', 8, __FILE__, 'jd_wp_Twitter_manage_page' );
|
|
|
240 |
}
|
241 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
// Include the Manager page
|
243 |
function jd_wp_Twitter_manage_page() {
|
244 |
-
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
function plugin_action($links, $file) {
|
247 |
if ($file == plugin_basename(dirname(__FILE__).'/wp-to-twitter.php'))
|
248 |
-
$links[] = "<a href='options-general.php?page=wp-to-twitter/wp-to-twitter
|
249 |
return $links;
|
250 |
}
|
251 |
|
@@ -253,28 +722,41 @@ function plugin_action($links, $file) {
|
|
253 |
|
254 |
add_filter('plugin_action_links', 'plugin_action', -10, 2);
|
255 |
|
256 |
-
if (
|
257 |
-
add_action( '
|
258 |
-
|
259 |
-
add_action( '
|
260 |
-
}
|
261 |
-
} else {
|
262 |
-
add_action( 'dbx_post_advanced','jd_add_twitter_textinput' );
|
263 |
-
if (get_option( 'jd_twit_pages')=='1') {
|
264 |
-
add_action( 'dbx_page_advanced','jd_add_twitter_textinput' );
|
265 |
-
}
|
266 |
}
|
|
|
267 |
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
268 |
-
add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message
|
269 |
}
|
270 |
-
|
271 |
-
|
|
|
|
|
272 |
add_action( 'publish_page', 'jd_twit' );
|
273 |
-
add_action( 'edit_page','post_jd_twitter' );
|
274 |
-
add_action( 'publish_page','post_jd_twitter' );
|
275 |
}
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
|
278 |
-
add_action( 'edit_post','post_jd_twitter' );
|
279 |
-
add_action( 'publish_post','post_jd_twitter' );
|
280 |
?>
|
2 |
/*
|
3 |
Plugin Name: WP to Twitter
|
4 |
Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
|
5 |
+
Description: Updates Twitter when you create a new blog post or add to your blogroll using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account with the name of your post as the title.
|
6 |
+
Version: 1.3.7
|
7 |
Author: Joseph Dolson
|
8 |
Author URI: http://www.joedolson.com/
|
9 |
*/
|
|
|
10 |
/* Copyright 2008 Joseph C Dolson (email : wp-to-twitter@joedolson.com)
|
11 |
|
12 |
This program is free software; you can redistribute it and/or modify
|
23 |
along with this program; if not, write to the Free Software
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
+
// Reporting E_NOTICE can be good too (to report uninitialized
|
27 |
+
// variables or catch variable name misspellings ...)
|
28 |
+
global $wp_version,$version,$jd_plugin_url;
|
29 |
+
|
30 |
+
define('JDWP_API_POST_STATUS', 'http://twitter.com/statuses/update.json');
|
31 |
+
|
32 |
+
$version = "1.3.7";
|
33 |
$jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
|
34 |
+
|
35 |
+
require_once( ABSPATH.WPINC.'/class-snoopy.php' );
|
36 |
+
|
37 |
+
$exit_msg='WP to Twitter requires WordPress 2.5 or a more recent version. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update your WordPress version!</a>';
|
38 |
+
|
39 |
+
if ( version_compare( $wp_version,"2.5","<" )) {
|
40 |
+
exit ($exit_msg);
|
41 |
+
}
|
42 |
+
|
43 |
+
// Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
|
44 |
+
function external_or_permalink( $post_ID ) {
|
45 |
+
$wtb_extlink_custom_field = get_option('jd_twit_custom_url');
|
46 |
+
$perma_link = get_permalink( $post_ID );
|
47 |
+
$ex_link = get_post_meta($post_ID, $wtb_extlink_custom_field, true);
|
48 |
+
return ( $ex_link ) ? $ex_link : $perma_link;
|
49 |
+
}
|
50 |
+
|
51 |
+
// This function used to perform the API post to Twitter and now serves as a fallback.
|
52 |
+
function jd_old_doTwitterAPIPost( $twit, $authID=FALSE, $twitterURI="/statuses/update.xml" ) {
|
53 |
$host = 'twitter.com';
|
54 |
$port = 80;
|
55 |
$fp = @fsockopen($host, $port, $err_num, $err_msg, 10);
|
56 |
|
57 |
//check if user login details have been entered on admin page
|
58 |
+
if ($authID === FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
|
59 |
$thisLoginDetails = get_option( 'twitterlogin_encrypted' );
|
60 |
+
} else {
|
61 |
+
if ( ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'true' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userTwitter' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) && get_usermeta( $authID, 'wp-to-twitter-encrypted' )!="" ) {
|
62 |
+
$thisLoginDetails = get_usermeta( $authID, 'wp-to-twitter-encrypted' );
|
63 |
+
} else {
|
64 |
+
$thisLoginDetails = get_option( 'twitterlogin_encrypted' );
|
65 |
+
}
|
66 |
+
}
|
67 |
|
68 |
if ( $thisLoginDetails != '' ) {
|
69 |
if ( !is_resource($fp) ) {
|
70 |
#echo "$err_msg ($err_num)<br>\n"; // Fail Silently, but you could turn these back on...
|
71 |
return FALSE;
|
72 |
} else {
|
|
|
73 |
if (!fputs( $fp, "POST $twitterURI HTTP/1.1\r\n" )) {
|
74 |
return FALSE;
|
75 |
}
|
84 |
$reply = fgets( $fp, 256 );
|
85 |
}
|
86 |
fclose( $fp );
|
87 |
+
return TRUE;
|
88 |
}
|
89 |
} else {
|
90 |
// no username/password: return an empty string
|
91 |
return FALSE;
|
92 |
}
|
93 |
+
}
|
94 |
+
|
95 |
+
// This function performs the API post to Twitter
|
96 |
+
function jd_doTwitterAPIPost( $twit, $authID=FALSE ) {
|
97 |
+
global $version, $jd_plugin_url;
|
98 |
+
//check if user login details have been entered on admin page
|
99 |
+
if ($authID == FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
|
100 |
+
$thisuser = get_option( 'twitterlogin' );
|
101 |
+
$thispass = get_option( 'twitterpw' );
|
102 |
+
} else {
|
103 |
+
if ( ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'true' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userTwitter' || get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) && ( get_usermeta( $authID, 'wp-to-twitter-user-username' ) != "" && get_usermeta( $authID, 'wp-to-twitter-user-password' ) != "" ) ) {
|
104 |
+
$thisuser = get_usermeta( $authID, 'wp-to-twitter-user-username' );
|
105 |
+
$thispass = get_usermeta( $authID, 'wp-to-twitter-user-password' );
|
106 |
+
} else {
|
107 |
+
$thisuser = get_option( 'twitterlogin' );
|
108 |
+
$thispass = get_option( 'twitterpw' );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if ($thisuser == '' || $thispass == '' || $twit == '' ) {
|
112 |
+
return FALSE;
|
113 |
+
} else {
|
114 |
+
$twit = urldecode($twit);
|
115 |
+
$tweet = new Snoopy;
|
116 |
+
if (!empty($tweet)) {
|
117 |
+
$tweet->agent = 'WP to Twitter $jd_plugin_url';
|
118 |
+
$tweet->rawheaders = array(
|
119 |
+
'X-Twitter-Client' => 'WP to Twitter'
|
120 |
+
, 'X-Twitter-Client-Version' => $version
|
121 |
+
, 'X-Twitter-Client-URL' => 'http://www.joedolson.com/scripts/wp-to-twitter.xml'
|
122 |
+
);
|
123 |
+
$tweet->user = $thisuser;
|
124 |
+
$tweet->pass = $thispass;
|
125 |
+
$tweet->submit(
|
126 |
+
JDWP_API_POST_STATUS
|
127 |
+
, array(
|
128 |
+
'status' => $twit
|
129 |
+
, 'source' => 'wptotwitter'
|
130 |
+
)
|
131 |
+
);
|
132 |
+
if (strpos($tweet->response_code, '200')) {
|
133 |
+
return TRUE;
|
134 |
+
} else {
|
135 |
+
if (jd_old_doTwitterAPIPost( $twit, $authID ) == TRUE) {
|
136 |
+
return TRUE;
|
137 |
+
} else {
|
138 |
+
return FALSE;
|
139 |
+
}
|
140 |
+
}
|
141 |
+
} else {
|
142 |
+
if (jd_old_doTwitterAPIPost( $twit ) == TRUE) {
|
143 |
+
return TRUE;
|
144 |
+
} else {
|
145 |
+
// If you're attempting to solve the "settings page doesn't display" problem, you're in the wrong file.
|
146 |
+
// Please open /wp-to-twitter-manager.php to make your edits.
|
147 |
+
return FALSE;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
}
|
152 |
|
153 |
// cURL query contributed by Thor Erik (http://thorerik.net)
|
162 |
return $output;
|
163 |
}
|
164 |
|
165 |
+
function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID=FALSE ) {
|
166 |
+
|
167 |
+
if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'userAtTwitter' ) {
|
168 |
+
$at_append = "@" . get_option('twitterlogin');
|
169 |
+
} else if ( get_usermeta( $authID, 'wp-to-twitter-enable-user' ) == 'mainAtTwitter' ) {
|
170 |
+
$at_append = "@" . get_usermeta( $authID, 'wp-to-twitter-user-username' );
|
171 |
+
} else {
|
172 |
+
$at_append = "";
|
173 |
+
}
|
174 |
+
$sentence = $at_append . " " . $sentence;
|
175 |
+
if ( get_option( 'jd_twit_prepend' ) != "" ) {
|
176 |
+
$sentence = get_option( 'jd_twit_prepend' ) . " " . $sentence;
|
177 |
+
}
|
178 |
+
if ( get_option( 'jd_twit_append' ) != "" ) {
|
179 |
+
$sentence = $sentence . " " . get_option( 'jd_twit_append' );
|
180 |
+
}
|
181 |
+
|
182 |
+
$twit_length = strlen( $sentence );
|
183 |
+
$title_length = strlen( $thisposttitle );
|
184 |
+
$blog_length = strlen( $thisblogtitle );
|
185 |
+
if ( ( ( $twit_length + $title_length ) - 7 ) < 140 ) {
|
186 |
+
$sentence = str_replace( '#title#', $thisposttitle, $sentence );
|
187 |
+
$twit_length = strlen( $sentence );
|
188 |
+
} else {
|
189 |
+
$thisposttitle = substr( $thisposttitle, 0, ( 140- ( $twit_length-3 ) ) ) . "...";
|
190 |
+
$sentence = str_replace ( '#title#', $thisposttitle, $sentence );
|
191 |
+
$twit_length = strlen( $sentence );
|
192 |
+
}
|
193 |
+
if ( ( ( $twit_length + $blog_length ) - 6 ) < 140 ) {
|
194 |
+
$sentence = str_replace ( '#blog#',$thisblogtitle,$sentence );
|
195 |
+
$twit_length = strlen( $sentence );
|
196 |
+
} else {
|
197 |
+
$thisblogtitle = substr( $thisblogtitle, 0, ( 140-( $twit_length-3 ) ) ) . "...";
|
198 |
+
$sentence = str_replace ( '#blog#',$thisblogtitle,$sentence );
|
199 |
+
}
|
200 |
+
return $sentence;
|
201 |
+
}
|
202 |
+
|
203 |
+
function jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi ) {
|
204 |
+
$snoopy = new Snoopy;
|
205 |
+
|
206 |
+
if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
|
207 |
+
$this_campaign = get_option('twitter-analytics-campaign');
|
208 |
+
if ( strpos( $thispostlink,"%3F" ) === FALSE) {
|
209 |
+
$thispostlink .= urlencode("?");
|
210 |
+
} else {
|
211 |
+
$thispostlink .= urlencode("&");
|
212 |
+
}
|
213 |
+
$thispostlink .= urlencode("utm_campaign=$this_campaign&utm_medium=twitter&utm_source=twitter");
|
214 |
+
}
|
215 |
+
// Generate and grab the clig using the Cli.gs API
|
216 |
+
// cURL alternative contributed by Thor Erik (http://thorerik.net)
|
217 |
+
if ( $snoopy->fetchtext( "http://cli.gs/api/v1/cligs/create?t=snoopy&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi ) ) {
|
218 |
+
$shrink = $snoopy->results;
|
219 |
+
} else {
|
220 |
+
$shrink = @file_get_contents( "http://cli.gs/api/v1/cligs/create?t=fgc&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
|
221 |
+
}
|
222 |
+
if ( $shrink === FALSE ) {
|
223 |
+
$shrink = getfilefromurl( "http://cli.gs/api/v1/cligs/create?t=gffu&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
|
224 |
+
}
|
225 |
+
if ( stristr( $shrink, "http://" ) === FALSE ) {
|
226 |
+
$shrink = FALSE;
|
227 |
+
}
|
228 |
+
if ( $shrink === FALSE) {
|
229 |
+
update_option('wp_cligs_failure','1');
|
230 |
+
$shrink = $thispostlink;
|
231 |
+
}
|
232 |
+
return $shrink;
|
233 |
+
}
|
234 |
+
|
235 |
function jd_twit( $post_ID ) {
|
236 |
+
|
237 |
+
$jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
|
238 |
+
if ( $jd_tweet_this == "yes" ) {
|
239 |
+
$get_post_info = get_post( $post_ID );
|
240 |
+
$authID = $get_post_info->post_author;
|
241 |
+
$thisposttitle = urlencode( stripcslashes( strip_tags( $_POST['post_title'] ) ) );
|
242 |
+
if ($thisposttitle == "") {
|
243 |
+
$thisposttitle = urlencode( stripcslashes( strip_tags( $_POST['title'] ) ) );
|
244 |
+
}
|
245 |
+
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
246 |
+
$thisblogtitle = urlencode( get_bloginfo( 'name' ) );
|
247 |
+
$cligsapi = get_option( 'cligsapi' );
|
248 |
+
$sentence = '';
|
249 |
+
$customTweet = stripcslashes( $_POST['jd_twitter'] );
|
250 |
+
$oldClig = get_post_meta( $post_ID, 'wp_jd_clig', TRUE );
|
251 |
+
|
252 |
+
if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish') && ($_POST['prev_status'] == 'draft' || $_POST['original_post_status'] == 'draft')) {
|
253 |
+
// publish new post
|
254 |
+
if ( get_option( 'newpost-published-update' ) == '1' ) {
|
255 |
+
$sentence = stripcslashes( get_option( 'newpost-published-text' ) );
|
256 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
257 |
+
if ($oldClig != '') {
|
258 |
+
$shrink = $oldClig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
} else {
|
260 |
+
$shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
|
|
|
|
|
261 |
}
|
262 |
+
|
263 |
+
//$sentence = $sentence . " " . $shrink;
|
264 |
+
if ( strpos( $sentence, "#url#" ) === FALSE ) {
|
265 |
+
$sentence = $sentence . " " . $shrink;
|
266 |
} else {
|
267 |
+
$sentence = str_replace( "#url#", $shrink, $sentence );
|
268 |
}
|
269 |
+
|
270 |
+
if ( $customTweet != "" ) {
|
271 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
272 |
+
if ( strpos( $customTweet, "#url#" ) === FALSE ) {
|
273 |
+
$sentence = $customTweet . " " . $shrink;
|
274 |
+
} else {
|
275 |
+
$sentence = str_replace( "#url#", $shrink, $customTweet );
|
276 |
+
}
|
277 |
+
} else {
|
278 |
+
$sentence = $customTweet;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
282 |
+
// Stores the posts CLIG in a custom field for later use as needed.
|
283 |
+
add_post_meta ( $post_ID, 'wp_jd_clig', $shrink );
|
284 |
+
/* This is for testing. Creates a post meta field containing the Cli.gs API request string
|
285 |
+
//add_post_meta($post_ID, 'post_cligs_text',"http://cli.gs/api/v1/cligs/create?url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi."&appid=WP-to-Twitter"); */
|
286 |
} else {
|
287 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
288 |
+
}
|
289 |
+
}
|
290 |
+
} else if ( (( $_POST['originalaction'] == "editpost" ) && ( ( $_POST['prev_status'] == 'publish' ) || ($_POST['original_post_status'] == 'publish') ) ) && $get_post_info->post_status == 'publish'){
|
291 |
+
// if this is an old post and editing updates are enabled
|
292 |
+
if ( get_option( 'oldpost-edited-update') == '1' || get_option( 'jd_twit_edited_pages' ) == '1' ) {
|
293 |
+
$sentence = stripcslashes( get_option( 'oldpost-edited-text' ) );
|
294 |
+
if ( get_option( 'oldpost-edited-showlink') == '1') {
|
295 |
+
if ( $oldClig != '' ) {
|
296 |
+
$old_post_link = $oldClig;
|
297 |
} else {
|
298 |
+
$old_post_link = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
|
299 |
+
add_post_meta ( $post_ID, 'wp_jd_clig', $old_post_link );
|
|
|
300 |
}
|
301 |
+
}
|
302 |
+
$sentence = $sentence . " " . $old_post_link;
|
303 |
+
|
304 |
+
if ( $customTweet != "" ) {
|
305 |
+
if ( get_option( 'oldpost-edited-showlink') == '1' ) {
|
306 |
+
if ( strpos( $customTweet, "#url#" ) === FALSE ) {
|
307 |
+
$sentence = $customTweet . " " . $old_post_link;
|
308 |
+
} else {
|
309 |
+
$sentence = str_replace( "#url#", $old_post_link, $customTweet );
|
310 |
+
}
|
311 |
+
} else {
|
312 |
+
$sentence = $customTweet;
|
313 |
}
|
314 |
}
|
315 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
316 |
+
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
if ( $sentence != '' ) {
|
321 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
322 |
+
if ($sendToTwitter === FALSE) {
|
323 |
+
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
|
324 |
+
update_option('wp_twitter_failure','1');
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
return $post_ID;
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
// Add Tweets on links in Blogroll
|
333 |
+
function jd_twit_link( $link_ID ) {
|
334 |
+
global $version;
|
335 |
+
$thislinkprivate = $_POST['link_visible'];
|
336 |
+
if ($thislinkprivate != 'N') {
|
337 |
+
$thislinkname = urlencode( stripcslashes( $_POST['link_name'] ) );
|
338 |
+
$thispostlink = urlencode( $_POST['link_url'] ) ;
|
339 |
+
$thislinkdescription = urlencode( stripcslashes( $_POST['link_description'] ) );
|
340 |
+
$cligsapi = get_option( 'cligsapi' );
|
341 |
+
$sentence = '';
|
342 |
+
|
343 |
+
# || (get_option( 'jd-use-link-title' ) == '1' && $thislinkname == '')
|
344 |
+
if ( (get_option( 'jd-use-link-description' ) == '1' && $thislinkdescription == '') ) {
|
345 |
+
$sentence = stripcslashes( get_option( 'newlink-published-text' ) );
|
346 |
+
} else {
|
347 |
+
if ( get_option( 'jd-use-link-description' ) == '1' && get_option ( 'jd-use-link-title' ) == '0' ) {
|
348 |
+
$sentence = $thislinkdescription;
|
349 |
+
} else if ( get_option( 'jd-use-link-description' ) == '0' && get_option ( 'jd-use-link-title' ) == '1' ) {
|
350 |
+
$sentence = $thislinkname;
|
351 |
+
}
|
352 |
+
}
|
353 |
+
if (strlen($sentence) > 120) {
|
354 |
+
$sentence = substr($sentence,0,116) . '...';
|
355 |
+
}
|
356 |
+
// Generate and grab the clig using the Cli.gs API
|
357 |
+
// cURL alternative contributed by Thor Erik (http://thorerik.net)
|
358 |
+
$shrink = jd_shorten_link( $thispostlink, $thislinkname, $cligsapi );
|
359 |
+
|
360 |
+
if ( strpos($sentence,"#url#") === FALSE ) {
|
361 |
+
$sentence = $sentence . " " . $shrink;
|
362 |
+
} else {
|
363 |
+
$sentence = str_replace("#url#",$shrink,$sentence);
|
364 |
+
}
|
365 |
+
if ( $sentence != '' ) {
|
366 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence );
|
367 |
+
if ($sendToTwitter === FALSE) {
|
368 |
+
update_option('wp_twitter_failure','2');
|
369 |
}
|
370 |
}
|
371 |
+
|
372 |
+
return $link_ID;
|
373 |
+
} else {
|
374 |
+
return '';
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
// HANDLES SCHEDULED POSTS
|
379 |
+
function jd_twit_future( $post_ID ) {
|
380 |
+
$post_ID = $post_ID->ID;
|
381 |
+
|
382 |
+
$get_post_info = get_post( $post_ID );
|
383 |
+
$jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE );
|
384 |
+
$post_status = $get_post_info->post_status;
|
385 |
+
|
386 |
+
if ( $jd_tweet_this == "yes" ) {
|
387 |
+
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
388 |
+
$thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
|
389 |
+
$authID = $get_post_info->post_author;
|
390 |
+
$thisblogtitle = urlencode( get_bloginfo( 'name' ) );
|
391 |
+
$cligsapi = get_option( 'cligsapi' );
|
392 |
+
$sentence = '';
|
393 |
+
$customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
|
394 |
+
$sentence = stripcslashes(get_option( 'newpost-published-text' ));
|
395 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
396 |
+
$shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
|
397 |
+
if ( strpos($sentence,"#url#") === FALSE ) {
|
398 |
+
$sentence = $sentence . " " . $shrink;
|
399 |
+
} else {
|
400 |
+
$sentence = str_replace("#url#",$shrink,$sentence);
|
401 |
+
}
|
402 |
+
if ( $customTweet != "" ) {
|
403 |
+
// Get the custom Tweet message if it's been supplied. Truncate it to fit if necessary.
|
404 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
405 |
+
if ( ( strlen( $customTweet ) + 21) > 140 ) {
|
406 |
+
$customTweet = substr( $customTweet, 0, 119 );
|
407 |
+
}
|
408 |
+
} else {
|
409 |
+
if ( strlen( $customTweet ) > 140 ) {
|
410 |
+
$customTweet = substr( $customTweet, 0, 140 );
|
411 |
+
}
|
412 |
+
}
|
413 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
414 |
+
if ( strpos( $customTweet, "#url#" ) === FALSE ) {
|
415 |
+
$sentence = $customTweet . " " . $shrink;
|
416 |
+
} else {
|
417 |
+
$sentence = str_replace( "#url#", $shrink, $customTweet );
|
418 |
+
}
|
419 |
} else {
|
420 |
+
$sentence = $customTweet;
|
421 |
}
|
422 |
+
}
|
423 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID ); // Stores the posts CLIG in a custom field for later use as needed.
|
424 |
+
add_post_meta( $post_ID, 'wp_jd_clig', $shrink );
|
425 |
+
} else {
|
426 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
427 |
+
}
|
428 |
+
if ( $sentence != '' ) {
|
429 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
430 |
+
if ($sendToTwitter === FALSE) {
|
431 |
+
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
432 |
+
update_option( 'wp_twitter_failure','1' );
|
433 |
}
|
|
|
|
|
|
|
434 |
}
|
435 |
+
return $post_ID;
|
436 |
+
}
|
437 |
+
} // END jd_twit_future
|
438 |
+
|
439 |
+
// Tweet from QuickPress (no custom fields, so can't control whether to tweet.)
|
440 |
+
function jd_twit_quickpress( $post_ID ) {
|
441 |
+
$post_ID = $post_ID->ID;
|
442 |
+
|
443 |
+
$get_post_info = get_post( $post_ID );
|
444 |
+
$post_status = $get_post_info->post_status;
|
445 |
+
|
446 |
+
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
447 |
+
$thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
|
448 |
+
$authID = $get_post_info->post_author;
|
449 |
+
$thisblogtitle = urlencode( get_bloginfo( 'name' ) );
|
450 |
+
$cligsapi = get_option( 'cligsapi' );
|
451 |
+
$sentence = '';
|
452 |
+
$customTweet = get_post_meta( $post_ID, 'jd_twitter', TRUE );
|
453 |
+
$sentence = stripcslashes(get_option( 'newpost-published-text' ));
|
454 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
455 |
+
$shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
|
456 |
+
if ( strpos($sentence,"#url#") === FALSE ) {
|
457 |
+
$sentence = $sentence . " " . $shrink;
|
458 |
+
} else {
|
459 |
+
$sentence = str_replace("#url#",$shrink,$sentence);
|
460 |
+
}
|
461 |
+
$sentence = jd_truncate_tweet($sentence, $thisposttitle, $thisblogtitle, $authID);
|
462 |
+
// Stores the posts CLIG in a custom field for later use as needed.
|
463 |
+
add_post_meta( $post_ID, 'wp_jd_clig', $shrink );
|
464 |
+
} else {
|
465 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
466 |
}
|
467 |
+
if ( $sentence != '' ) {
|
468 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
469 |
+
if ($sendToTwitter === FALSE) {
|
470 |
+
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
471 |
+
update_option( 'wp_twitter_failure','1' );
|
472 |
+
}
|
473 |
+
}
|
474 |
+
return $post_ID;
|
475 |
+
} // END jd_twit_quickpress
|
476 |
+
|
477 |
+
// HANDLES xmlrpc POSTS
|
478 |
+
function jd_twit_xmlrpc( $post_ID ) {
|
479 |
+
$get_post_info = get_post( $post_ID );
|
480 |
+
$post_status = $get_post_info->post_status;
|
481 |
+
|
482 |
+
if ( get_option('oldpost-edited-update') != 1 && get_post_meta ( $post_ID, 'wp_jd_clig', TRUE ) != '' ) {
|
483 |
+
return;
|
484 |
+
} else {
|
485 |
+
if ( get_option('jd_tweet_default') != '1' && get_option('jd_twit_remote') == '1' ) {
|
486 |
+
$authID = $get_post_info->post_author;
|
487 |
+
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
488 |
+
$thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
|
489 |
+
$thisblogtitle = urlencode( get_bloginfo( 'name' ) );
|
490 |
+
$cligsapi = get_option( 'cligsapi' );
|
491 |
+
$sentence = '';
|
492 |
+
$sentence = stripcslashes(get_option( 'newpost-published-text' ));
|
493 |
+
if ( get_option( 'newpost-published-showlink' ) == '1' ) {
|
494 |
+
$shrink = jd_shorten_link( $thispostlink, $thisposttitle, $cligsapi );
|
495 |
+
if ( strpos($sentence,"#url#") === FALSE) {
|
496 |
+
$sentence = $sentence . " " . $shrink;
|
497 |
+
} else {
|
498 |
+
$sentence = str_replace("#url#",$shrink,$sentence);
|
499 |
+
}
|
500 |
+
// Check the length of the tweet and truncate parts as necessary.
|
501 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
502 |
+
// Stores the posts CLIG in a custom field for later use as needed.
|
503 |
+
add_post_meta ( $post_ID, 'wp_jd_clig', $shrink );
|
504 |
+
} else {
|
505 |
+
$sentence = jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $authID );
|
506 |
+
}
|
507 |
+
if ( $sentence != '' ) {
|
508 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
509 |
+
if ($sendToTwitter === FALSE) {
|
510 |
+
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
|
511 |
+
update_option('wp_twitter_failure','1');
|
512 |
+
}
|
513 |
+
}
|
514 |
+
}
|
515 |
+
return $post_ID;
|
516 |
+
}
|
517 |
+
} // END jd_twit_xmlrpc
|
518 |
+
// NEW IF ADD
|
519 |
+
add_action('admin_menu','jd_add_twitter_outer_box');
|
520 |
+
|
521 |
+
function jd_add_twitter_old_box() {
|
522 |
+
?>
|
523 |
+
|
524 |
+
<div class="dbx-b-ox-wrapper">
|
525 |
+
<fieldset id="twitdiv" class="dbx-box">
|
526 |
+
<div class="dbx-h-andle-wrapper">
|
527 |
+
<h3 class="dbx-handle"><?php _e('WP to Twitter', 'wp-to-twitter') ?></h3>
|
528 |
+
</div>
|
529 |
+
<div class="dbx-c-ontent-wrapper">
|
530 |
+
<div class="dbx-content">
|
531 |
+
<?php
|
532 |
+
jd_add_twitter_inner_box();
|
533 |
+
?>
|
534 |
+
</div>
|
535 |
+
</fieldset>
|
536 |
+
</div>
|
537 |
+
<?php
|
538 |
}
|
539 |
|
540 |
+
function jd_add_twitter_inner_box() {
|
541 |
+
|
542 |
+
global $post, $jd_plugin_url;
|
543 |
$post_id = $post;
|
544 |
if (is_object($post_id)) {
|
545 |
$post_id = $post_id->ID;
|
546 |
}
|
547 |
$jd_twitter = htmlspecialchars(stripcslashes(get_post_meta($post_id, 'jd_twitter', true)));
|
548 |
+
$jd_tweet_this = get_post_meta($post_id, 'jd_tweet_this', true);
|
549 |
+
if ($jd_tweet_this == 'no' || get_option( 'jd_tweet_default' ) == '1' ) {
|
550 |
+
$jd_selected = ' checked="checked"';
|
551 |
+
}
|
552 |
+
$jd_clig = get_post_meta($post_id, 'wp_jd_clig', true);
|
553 |
?>
|
554 |
+
<script type="text/javascript">
|
555 |
+
<!-- Begin
|
556 |
+
function countChars(field,cntfield) {
|
557 |
+
cntfield.value = field.value.length;
|
558 |
+
}
|
559 |
+
// End -->
|
560 |
+
</script>
|
561 |
+
<p>
|
562 |
+
<label for="jd_twitter"><?php _e('Twitter Post', 'wp-to-twitter') ?></label><br /><textarea style="width:95%;" name="jd_twitter" id="jd_twitter" rows="2" cols="60"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
|
564 |
onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo $jd_twitter ?></textarea>
|
|
|
|
|
565 |
</p>
|
566 |
+
<p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo strlen( $description); ?>" />
|
567 |
+
<?php _e(' characters.<br />Twitter posts are a maximum of 140 characters; if your Cli.gs URL is appended to the end of your document, you have 119 characters available. You can use <code>#url#</code>, <code>#title#</code>, or <code>#blog#</code> to insert the shortened URL, post title, or blog name into the Tweet.', 'wp-to-twitter') ?> <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter') ?></a> »
|
568 |
+
</p>
|
569 |
+
<p>
|
570 |
+
<input type="checkbox" name="jd_tweet_this" value="no"<?php echo $jd_selected; ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post."); ?></label>
|
571 |
+
</p>
|
572 |
+
<?php if ($jd_clig != "") { ?>
|
573 |
+
<p>
|
574 |
+
<?php
|
575 |
+
_e("The previously-posted Cl.ig URL for this post is <code>$jd_clig</code>");
|
576 |
+
?>
|
577 |
+
</p>
|
578 |
+
<?php }
|
579 |
}
|
580 |
+
function jd_add_twitter_outer_box() {
|
581 |
+
if ( function_exists( 'add_meta_box' )) {
|
582 |
+
add_meta_box( 'wptotwitter_div','WP to Twitter', 'jd_add_twitter_inner_box', 'post', 'advanced' );
|
583 |
+
if ( get_option( 'jd_twit_pages') == 1 ) {
|
584 |
+
add_meta_box( 'wptotwitter_div','WP to Twitter', 'jd_add_twitter_inner_box', 'page', 'advanced' );
|
585 |
+
}
|
586 |
+
} else {
|
587 |
+
add_action('dbx_post_advanced', 'jd_add_twitter_old_box' );
|
588 |
+
if ( get_option( 'jd_twit_pages') == 1 ) {
|
589 |
+
add_action('dbx_page_advanced', 'jd_add_twitter_old_box' );
|
590 |
+
}
|
591 |
+
}
|
592 |
+
}
|
593 |
+
|
594 |
// Post the Custom Tweet into the post meta table
|
595 |
function post_jd_twitter( $id ) {
|
596 |
+
$jd_twitter = $_POST[ 'jd_twitter' ];
|
597 |
+
if (isset($jd_twitter) && !empty($jd_twitter)) {
|
598 |
+
delete_post_meta( $id, 'jd_twitter' );
|
599 |
+
add_post_meta( $id, 'jd_twitter', $jd_twitter );
|
600 |
+
}
|
601 |
+
$jd_tweet_this = $_POST[ 'jd_tweet_this' ];
|
602 |
+
if ($jd_tweet_this == 'no') {
|
603 |
+
delete_post_meta( $id, 'jd_tweet_this' );
|
604 |
+
add_post_meta( $id, 'jd_tweet_this', 'no');
|
605 |
+
} else {
|
606 |
+
delete_post_meta( $id, 'jd_tweet_this' );
|
607 |
+
add_post_meta( $id, 'jd_tweet_this', 'yes');
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
+
|
612 |
+
function jd_twitter_profile() {
|
613 |
+
global $user_ID;
|
614 |
+
get_currentuserinfo();
|
615 |
+
if( $_GET['user_id'] ) $user_ID = $_GET['user_id'];
|
616 |
+
|
617 |
+
$is_enabled = get_usermeta( $user_ID, 'wp-to-twitter-enable-user' );
|
618 |
+
$twitter_username = get_usermeta( $user_ID, 'wp-to-twitter-user-username' );
|
619 |
+
$twitter_password = get_usermeta( $user_ID, 'wp-to-twitter-user-password' );
|
620 |
+
|
621 |
+
?>
|
622 |
+
<h3><?php _e('WP to Twitter User Settings'); ?></h3>
|
623 |
+
|
624 |
+
<table class="form-table">
|
625 |
+
<tr>
|
626 |
+
<th scope="row"><?php _e('Use My Twitter Account'); ?></th>
|
627 |
+
<td><input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user" value="userTwitter"<?php if ($is_enabled == "userTwitter" || $is_enabled == "true" ) { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user"><?php _e('Select this option if you would like your posts to be Tweeted into your own Twitter account with no @ references.'); ?></label><br />
|
628 |
+
<input type="radio" name="wp-to-twitter-enable-user" id="wp-to-twitter-enable-user-2" value="userAtTwitter"<?php if ($is_enabled == "userAtTwitter") { echo " checked='checked'"; } ?> /> <label for="wp-to-twitter-enable-user-2"><?php _e('Tweet my posts into my Twitter account with an @ reference to the site\'s main Twitter account.'); ?></label><br />
|
629 |
+
<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 into the main site Twitter account with an @ reference to my username. (Password not required with this option.)'); ?></label></td>
|
630 |
+
</tr>
|
631 |
+
<tr>
|
632 |
+
<th scope="row"><label for="wp-to-twitter-user-username"><?php _e('Your Twitter Username'); ?></label></th>
|
633 |
+
<td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo $twitter_username; ?>" /> <?php _e('Enter your own Twitter username.'); ?></td>
|
634 |
+
</tr>
|
635 |
+
<tr>
|
636 |
+
<th scope="row"><label for="wp-to-twitter-user-password"><?php _e('Your Twitter Password'); ?></label></th>
|
637 |
+
<td><input type="password" name="wp-to-twitter-user-password" id="wp-to-twitter-user-password" value="" /> <?php _e('Enter your own Twitter password.'); ?></td>
|
638 |
+
</tr>
|
639 |
+
</table>
|
640 |
+
<?php
|
641 |
+
}
|
642 |
+
|
643 |
+
function jd_twitter_save_profile(){
|
644 |
+
global $user_ID;
|
645 |
+
get_currentuserinfo();
|
646 |
+
if( $_GET['user_id'] ) { $user_ID = $_GET['user_id']; }
|
647 |
+
update_usermeta($user_ID ,'wp-to-twitter-enable-user' , $_POST['wp-to-twitter-enable-user'] );
|
648 |
+
update_usermeta($user_ID ,'wp-to-twitter-user-username' , $_POST['wp-to-twitter-user-username'] );
|
649 |
+
if ( $_POST['wp-to-twitter-user-password'] != '' ) {
|
650 |
+
update_usermeta($user_ID ,'wp-to-twitter-user-password' , $_POST['wp-to-twitter-user-password'] );
|
651 |
}
|
652 |
+
update_usermeta($user_ID ,'wp-to-twitter-encrypted' , base64_encode( $_POST['wp-to-twitter-user-username'].':'.$_POST['wp-to-twitter-user-password'] ) );
|
653 |
}
|
654 |
|
655 |
// Add the administrative settings to the "Settings" menu.
|
656 |
function jd_addTwitterAdminPages() {
|
657 |
if ( function_exists( 'add_submenu_page' ) ) {
|
658 |
+
$plugin_page = add_options_page( 'WP -> Twitter', 'WP -> Twitter', 8, __FILE__, 'jd_wp_Twitter_manage_page' );
|
659 |
+
add_action( 'admin_head-'. $plugin_page, 'jd_addTwitterAdminStyles' );
|
660 |
}
|
661 |
}
|
662 |
+
function jd_addTwitterAdminStyles() {
|
663 |
+
$wp_to_twitter_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) );
|
664 |
+
echo "
|
665 |
+
<style type=\"text/css\">
|
666 |
+
<!--
|
667 |
+
#wp-to-twitter h2 {
|
668 |
+
background: #fff url(http://dev.joedolson.com/wp-2.7/wp-content/plugins/wp-to-twitter/wp-to-twitter-logo.png) right center no-repeat;
|
669 |
+
padding: 16px 2px;
|
670 |
+
margin: 25px 0;
|
671 |
+
border: 1px solid #ddd;
|
672 |
+
-moz-border-radius: 3px;
|
673 |
+
-webkit-border-radius: 3px;
|
674 |
+
border-radius: 3px;
|
675 |
+
}
|
676 |
+
#wp-to-twitter fieldset {
|
677 |
+
margin: 0;
|
678 |
+
padding:0;
|
679 |
+
border: none;
|
680 |
+
}
|
681 |
+
#wp-to-twitter form p {
|
682 |
+
background: #eaf3fa;
|
683 |
+
padding: 10px 5px;
|
684 |
+
margin: 4px 0;
|
685 |
+
border: 1px solid #eee;
|
686 |
+
}
|
687 |
+
#wp-to-twitter form .error p {
|
688 |
+
background: none;
|
689 |
+
border: none;
|
690 |
+
}
|
691 |
+
.floatright {
|
692 |
+
float: right;
|
693 |
+
}
|
694 |
+
.cligs {
|
695 |
+
background: #fff url($wp_to_twitter_directory/cligs.png) right 50% no-repeat;
|
696 |
+
padding: 2px!important;
|
697 |
+
margin-top: 1.5em!important;
|
698 |
+
}
|
699 |
+
.twitter {
|
700 |
+
background: url($wp_to_twitter_directory/twitter.png) right 50% no-repeat;
|
701 |
+
padding: 2px!important;
|
702 |
+
margin-top: 1.5em!important;
|
703 |
+
}
|
704 |
+
-->
|
705 |
+
</style>";
|
706 |
+
}
|
707 |
// Include the Manager page
|
708 |
function jd_wp_Twitter_manage_page() {
|
709 |
+
if ( file_exists ( dirname(__FILE__).'/wp-to-twitter-manager.php' )) {
|
710 |
+
include( dirname(__FILE__).'/wp-to-twitter-manager.php' );
|
711 |
+
} else {
|
712 |
+
echo "<p>Couldn't locate the settings page.</p>";
|
713 |
+
}
|
714 |
}
|
715 |
function plugin_action($links, $file) {
|
716 |
if ($file == plugin_basename(dirname(__FILE__).'/wp-to-twitter.php'))
|
717 |
+
$links[] = "<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>" . __('Settings', 'wp-to-twitter') . "</a>";
|
718 |
return $links;
|
719 |
}
|
720 |
|
722 |
|
723 |
add_filter('plugin_action_links', 'plugin_action', -10, 2);
|
724 |
|
725 |
+
if ( get_option( 'jd_individual_twitter_users')=='1') {
|
726 |
+
add_action( 'show_user_profile', 'jd_twitter_profile' );
|
727 |
+
add_action( 'edit_user_profile', 'jd_twitter_profile' );
|
728 |
+
add_action( 'profile_update', 'jd_twitter_save_profile');
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
}
|
730 |
+
|
731 |
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
732 |
+
add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>';_e('There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message.'); echo '</p></div>';" ) );
|
733 |
}
|
734 |
+
if ( get_option( 'jd_twit_pages' )=='1' ) {
|
735 |
+
add_action( 'publish_page', 'jd_twit' );
|
736 |
+
}
|
737 |
+
if ( get_option( 'jd_twit_edited_pages' )=='1' ) {
|
738 |
add_action( 'publish_page', 'jd_twit' );
|
|
|
|
|
739 |
}
|
740 |
+
if ( get_option( 'jd_twit_blogroll' ) == '1' ) {
|
741 |
+
add_action( 'add_link', 'jd_twit_link' );
|
742 |
+
}
|
743 |
+
add_action( 'future_to_publish', 'jd_twit_future' );
|
744 |
+
|
745 |
+
if ( version_compare( $wp_version,"2.7","<" )) {
|
746 |
+
add_action( 'edit_post', 'jd_twit', 12 );
|
747 |
+
|
748 |
+
} else {
|
749 |
+
add_action( 'publish_post', 'jd_twit', 12 );
|
750 |
+
}
|
751 |
+
|
752 |
+
if ( get_option( 'jd_twit_quickpress' ) == '1' ) {
|
753 |
+
add_action( 'new_to_publish', 'jd_twit_quickpress', 12 );
|
754 |
+
}
|
755 |
+
|
756 |
+
if ( get_option( 'jd_twit_remote' ) == '1' ) {
|
757 |
+
add_action( 'xmlrpc_publish_post', 'jd_twit_xmlrpc' );
|
758 |
+
add_action( 'publish_phone', 'jd_twit_xmlrpc' ); // to add later
|
759 |
+
}
|
760 |
+
add_action( 'save_post','post_jd_twitter' );
|
761 |
add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
|
|
|
|
|
762 |
?>
|
wp-to-twitter.pot
ADDED
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# SOME DESCRIPTIVE TITLE.
|
2 |
+
# Copyright (C) YEAR Joseph Dolson
|
3 |
+
# This file is distributed under the same license as the PACKAGE package.
|
4 |
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
5 |
+
#
|
6 |
+
#, fuzzy
|
7 |
+
msgid ""
|
8 |
+
msgstr ""
|
9 |
+
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
|
11 |
+
"POT-Creation-Date: 2009-06-02 18:29+0000\n"
|
12 |
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15 |
+
"MIME-Version: 1.0\n"
|
16 |
+
"Content-Type: text/plain; charset=CHARSET\n"
|
17 |
+
"Content-Transfer-Encoding: 8bit\n"
|
18 |
+
|
19 |
+
#: wp-to-twitter-manager.php:54
|
20 |
+
msgid "Set your Twitter login information and Cli.gs API to use this plugin! "
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: wp-to-twitter-manager.php:57
|
24 |
+
msgid "Please add your Twitter password. "
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: wp-to-twitter-manager.php:63
|
28 |
+
msgid "WP to Twitter Errors Cleared"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: wp-to-twitter-manager.php:69
|
32 |
+
msgid ""
|
33 |
+
"Cli.gs request failed! We couldn't shrink that URL, so we attached the "
|
34 |
+
"normal URL to your Tweet. Check the <a href='http://blog.cli.gs'>Cli.gs "
|
35 |
+
"blog</a> to see if there are any known issues. "
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: wp-to-twitter-manager.php:73
|
39 |
+
msgid ""
|
40 |
+
"Sorry! I couldn't get in touch with the Twitter servers to post your new "
|
41 |
+
"blog post. Your tweet has been stored in a custom field attached to the "
|
42 |
+
"post, so you can Tweet it manually if you wish! "
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: wp-to-twitter-manager.php:75
|
46 |
+
msgid ""
|
47 |
+
"Sorry! I couldn't get in touch with the Twitter servers to post your "
|
48 |
+
"<strong>new link</strong>! You'll have to post it manually, I'm afraid. "
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: wp-to-twitter-manager.php:125
|
52 |
+
msgid "Twitter login and password updated. "
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: wp-to-twitter-manager.php:127
|
56 |
+
msgid "You need to provide your twitter login and password! "
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: wp-to-twitter-manager.php:132
|
60 |
+
msgid "Cligs API Key Updated"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: wp-to-twitter-manager.php:135
|
64 |
+
msgid ""
|
65 |
+
"Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be "
|
66 |
+
"associated with your account. "
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: wp-to-twitter-manager.php:137
|
70 |
+
msgid ""
|
71 |
+
"Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</"
|
72 |
+
"a>! "
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: wp-to-twitter-manager.php:157
|
76 |
+
msgid "Successfully contacted the Cli.gs API. "
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: wp-to-twitter-manager.php:160
|
80 |
+
msgid "Failed to contact the Cli.gs API. "
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: wp-to-twitter-manager.php:164
|
84 |
+
msgid "Successfully contacted the Twitter API. "
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: wp-to-twitter-manager.php:166
|
88 |
+
msgid "Failed to contact the Twitter API. "
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: wp-to-twitter-manager.php:170
|
92 |
+
msgid ""
|
93 |
+
"Your server appears to support the required PHP functions and classes for WP "
|
94 |
+
"to Twitter to function."
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: wp-to-twitter-manager.php:175
|
98 |
+
msgid "Your server does not support <code>fputs</code>."
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: wp-to-twitter-manager.php:179
|
102 |
+
msgid ""
|
103 |
+
"Your server does not support <code>file_get_contents</code> or <code>cURL</"
|
104 |
+
"code> functions."
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: wp-to-twitter-manager.php:183
|
108 |
+
msgid "Your server does not support <code>Snoopy</code>."
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: wp-to-twitter-manager.php:186
|
112 |
+
msgid ""
|
113 |
+
"Your server does not appear to support the required PHP functions and "
|
114 |
+
"classes for WP to Twitter to function. You can try it anyway - these tests "
|
115 |
+
"aren't perfect - but no guarantees."
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: wp-to-twitter-manager.php:195
|
119 |
+
msgid "This plugin may not work in your server environment."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: wp-to-twitter-manager.php:206
|
123 |
+
msgid "WP to Twitter Options"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: wp-to-twitter-manager.php:208
|
127 |
+
msgid ""
|
128 |
+
"For any update field, you can use the codes <code>#title#</code> for the "
|
129 |
+
"title of your blog post, <code>#blog#</code> for the title of your blog, or "
|
130 |
+
"<code>#url#</code> for the post URL! Given the character limit for Twitter, "
|
131 |
+
"you may not want to include your blog title."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: wp-to-twitter-manager.php:215
|
135 |
+
msgid ""
|
136 |
+
"One or more of your last posts has failed to send it's status update to "
|
137 |
+
"Twitter. Your Tweet has been saved in the custom meta data for your post, "
|
138 |
+
"and you can re-Tweet it at your leisure."
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: wp-to-twitter-manager.php:218
|
142 |
+
msgid ""
|
143 |
+
"The query to the Cli.gs API failed, and your URL was not shrunk. The normal "
|
144 |
+
"post URL was attached to your Tweet."
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: wp-to-twitter-manager.php:228
|
148 |
+
msgid "Clear 'WP to Twitter' Error"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: wp-to-twitter-manager.php:228
|
152 |
+
msgid "Why are you seeing this field?"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: wp-to-twitter-manager.php:238
|
156 |
+
msgid "Wordpress to Twitter Publishing Options"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: wp-to-twitter-manager.php:241
|
160 |
+
msgid "Update Twitter when new Wordpress Pages are published"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: wp-to-twitter-manager.php:245
|
164 |
+
msgid "Update Twitter when WordPress Pages are edited"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: wp-to-twitter-manager.php:249
|
168 |
+
msgid "Update Twitter when a new post is published"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: wp-to-twitter-manager.php:252
|
172 |
+
msgid "Text for this Twitter update"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: wp-to-twitter-manager.php:256 wp-to-twitter-manager.php:268
|
176 |
+
msgid "Provide link to blog?"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: wp-to-twitter-manager.php:261
|
180 |
+
msgid "Update Twitter when an old post has been edited"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: wp-to-twitter-manager.php:273
|
184 |
+
msgid "Update Twitter when you post a Blogroll link"
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: wp-to-twitter-manager.php:276
|
188 |
+
msgid "Use <strong>link title</strong> for Twitter updates"
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: wp-to-twitter-manager.php:276
|
192 |
+
msgid "Use <strong>link description</strong> for Twitter updates"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: wp-to-twitter-manager.php:280
|
196 |
+
msgid "Text for this Twitter update (used if above choice isn't available.)"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: wp-to-twitter-manager.php:286
|
200 |
+
msgid "Set default Tweet status to 'No.'"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: wp-to-twitter-manager.php:287
|
204 |
+
msgid ""
|
205 |
+
"Twitter updates can be set on a post by post basis. By default, posts WILL "
|
206 |
+
"be posted to Twitter. Check this to change the default to NO."
|
207 |
+
msgstr ""
|
208 |
+
|
209 |
+
#: wp-to-twitter-manager.php:291
|
210 |
+
msgid ""
|
211 |
+
"Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: wp-to-twitter-manager.php:295
|
215 |
+
msgid "Update Twitter when a post is published using QuickPress"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: wp-to-twitter-manager.php:299
|
219 |
+
msgid "Custom text to be prepended on every Tweet"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: wp-to-twitter-manager.php:304
|
223 |
+
msgid "Custom text to be appended on every Tweet"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: wp-to-twitter-manager.php:309
|
227 |
+
msgid "Custom field containing an alternate URL to be shortened and Tweeted."
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: wp-to-twitter-manager.php:311
|
231 |
+
msgid ""
|
232 |
+
"You can use a custom field to send Cli.gs and Twitter an alternate URL from "
|
233 |
+
"the permalink provided by WordPress. The value is the name of the custom "
|
234 |
+
"field you're using to add an external URL."
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: wp-to-twitter-manager.php:314
|
238 |
+
msgid "Campaign identifier for Google Analytics"
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: wp-to-twitter-manager.php:316
|
242 |
+
msgid ""
|
243 |
+
"You can track the response from Twitter using Google Analytics by defining a "
|
244 |
+
"campaign identifier here."
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: wp-to-twitter-manager.php:320
|
248 |
+
msgid "Use Google Analytics with WP-to-Twitter"
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
+
#: wp-to-twitter-manager.php:324
|
252 |
+
msgid "Authors have individual Twitter accounts"
|
253 |
+
msgstr ""
|
254 |
+
|
255 |
+
#: wp-to-twitter-manager.php:324
|
256 |
+
msgid ""
|
257 |
+
"Each author can set their own Twitter username and password in their user "
|
258 |
+
"profile. Their posts will be sent to their own Twitter accounts."
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: wp-to-twitter-manager.php:330
|
262 |
+
msgid "Save WP->Twitter Options"
|
263 |
+
msgstr ""
|
264 |
+
|
265 |
+
#: wp-to-twitter-manager.php:336
|
266 |
+
msgid "Your Twitter account details"
|
267 |
+
msgstr ""
|
268 |
+
|
269 |
+
#: wp-to-twitter-manager.php:341
|
270 |
+
msgid "Your Twitter username:"
|
271 |
+
msgstr ""
|
272 |
+
|
273 |
+
#: wp-to-twitter-manager.php:345
|
274 |
+
msgid "Your Twitter password:"
|
275 |
+
msgstr ""
|
276 |
+
|
277 |
+
#: wp-to-twitter-manager.php:349
|
278 |
+
msgid "Save Twitter Login Info"
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: wp-to-twitter-manager.php:349
|
282 |
+
msgid ""
|
283 |
+
"» <small>Don't have a Twitter account? <a href='http://www.twitter."
|
284 |
+
"com'>Get one for free here</a>"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: wp-to-twitter-manager.php:353
|
288 |
+
msgid "Your Cli.gs account details"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: wp-to-twitter-manager.php:358
|
292 |
+
msgid ""
|
293 |
+
"Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: wp-to-twitter-manager.php:364
|
297 |
+
msgid ""
|
298 |
+
"Don't have a Cli.gs account or Cligs API key? <a href='http://cli.gs/user/"
|
299 |
+
"api/'>Get one free here</a>!<br />You'll need an API key in order to "
|
300 |
+
"associate the Cligs you create with your Cligs account."
|
301 |
+
msgstr ""
|
302 |
+
|
303 |
+
#: wp-to-twitter-manager.php:382
|
304 |
+
msgid "Need help?"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: wp-to-twitter-manager.php:383
|
308 |
+
msgid ""
|
309 |
+
"Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to "
|
310 |
+
"Twitter plugin page</a>."
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
|
314 |
+
#. Plugin Name of an extension
|
315 |
+
#: wp-to-twitter.php:525
|
316 |
+
msgid "WP to Twitter"
|
317 |
+
msgstr ""
|
318 |
+
|
319 |
+
#: wp-to-twitter.php:560
|
320 |
+
msgid "Twitter Post"
|
321 |
+
msgstr ""
|
322 |
+
|
323 |
+
#: wp-to-twitter.php:565
|
324 |
+
msgid ""
|
325 |
+
" characters.<br />Twitter posts are a maximum of 140 characters; if your Cli."
|
326 |
+
"gs URL is appended to the end of your document, you have 119 characters "
|
327 |
+
"available. You can use <code>#url#</code>, <code>#title#</code>, or "
|
328 |
+
"<code>#blog#</code> to insert the shortened URL, post title, or blog name "
|
329 |
+
"into the Tweet."
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
+
#: wp-to-twitter.php:565
|
333 |
+
msgid "Get Support"
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: wp-to-twitter.php:568
|
337 |
+
msgid "Don't Tweet this post."
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: wp-to-twitter.php:620
|
341 |
+
msgid "WP to Twitter User Settings"
|
342 |
+
msgstr ""
|
343 |
+
|
344 |
+
#: wp-to-twitter.php:624
|
345 |
+
msgid "Use My Twitter Account"
|
346 |
+
msgstr ""
|
347 |
+
|
348 |
+
#: wp-to-twitter.php:630
|
349 |
+
msgid "Your Twitter Username"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: wp-to-twitter.php:634
|
353 |
+
msgid "Your Twitter Password"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: wp-to-twitter.php:713
|
357 |
+
msgid "Settings"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#. Plugin URI of an extension
|
361 |
+
msgid "http://www.joedolson.com/articles/wp-to-twitter/"
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#. Description of an extension
|
365 |
+
msgid ""
|
366 |
+
"Updates Twitter when you create a new blog post or add to your blogroll "
|
367 |
+
"using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account "
|
368 |
+
"with the name of your post as the title."
|
369 |
+
msgstr ""
|
370 |
+
|
371 |
+
#. Author of an extension
|
372 |
+
msgid "Joseph Dolson"
|
373 |
+
msgstr ""
|
374 |
+
|
375 |
+
#. Author URI of an extension
|
376 |
+
msgid "http://www.joedolson.com/"
|
377 |
+
msgstr ""
|