Version Description
- Fixed bug introduced in WordPress 2.9 where logged in users could only edit their own profiles and associated issues.
- Fixed bug which caused #url# to repeatedly be added to the end of tweet texts on reactivation or upgrade.
- Fixed bug which generated shortener API error messages when no URL shortener was used.
- Fixed bug which prevented display of URL on edit screen if no URL shortener was used.
- Added Spanish translation courtesy of David Gil Pérez
- Made so many language changes that aforementioned translation is now terribly out of date, as are all others...
- Added ability to restrict posting to certain categories.
- Added option to dynamically generate Google Analytics campaign identifier by category, post title, author, or post id.
- Added option to configure plugin to use other services using the Twitter-compatible API.
- Added support for YOURLS installations as your URL shortener. (Either local or remote.)
- Redesigned administrative interface.
- Removed use of Snoopy and alternate HTTP request methods.
- Discontinued support for WordPress versions below version 2.7.
- Major revisions to support checks.
- Version jumped to 2.0.0
Download this release
Release Info
Developer | joedolson |
Plugin | WP to Twitter |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 2.0.0
- functions.php +109 -32
- readme.txt +32 -8
- screenshot-1.png +0 -0
- uninstall.php +21 -0
- wp-to-twitter-es_ES.mo +0 -0
- wp-to-twitter-es_ES.po +519 -0
- wp-to-twitter-manager.php +543 -267
- wp-to-twitter.php +330 -191
functions.php
CHANGED
@@ -3,6 +3,27 @@
|
|
3 |
// These functions don't perform any WP to Twitter actions, but are sometimes called for when
|
4 |
// support for primary functions is lacking.
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
if ( !class_exists('SERVICES_JSON') ) {
|
7 |
if ( version_compare( $wp_version,"2.9","<" )) {
|
8 |
require_once( WP_PLUGIN_DIR.'/wp-to-twitter/json.class.php' );
|
@@ -100,44 +121,100 @@ if ( function_exists( 'curl_init' ) ) {
|
|
100 |
}
|
101 |
function print_settings() {
|
102 |
global $version;
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
echo "<br />";
|
112 |
-
echo get_option( 'jd_twit_edited_pages' ) . " : " . get_option( 'oldpage-edited-text' );
|
113 |
-
echo "<br />[";
|
114 |
-
echo get_option( 'use_tags_as_hashtags' ) . " | " . get_option( 'jd_max_tags' ) . " | " . get_option( 'jd_max_characters' ) . "]<br />";
|
115 |
-
echo get_option( 'jd_twit_blogroll' ) . " : " . get_option( 'newlink-published-text' ) . " : " . get_option( 'jd-use-link-title' ) . " : " . get_option( 'jd-use-link-description' );
|
116 |
-
echo "<br />";
|
117 |
-
echo get_option( 'jd_post_excerpt' );
|
118 |
-
echo "<br />[" . get_option( 'jd_twit_prepend' ) . " | " . get_option( 'jd_twit_append' ) . "]<br />";
|
119 |
-
echo get_option( 'jd_twit_custom_url' );
|
120 |
-
echo "<br />[" . get_option( 'jd_tweet_default' ) . " | " . get_option( 'jd_twit_remote' ) . " | " . get_option( 'jd_twit_quickpress' ) . "]<br />[";
|
121 |
-
echo get_option( 'use-twitter-analytics' ) . " : " . get_option( 'twitter-analytics-campaign' ) . "]<br />Individuals:";
|
122 |
-
echo get_option( 'jd_individual_twitter_users' );
|
123 |
-
echo "<br />[" . get_option( 'jd-use-cligs' ) . " | " . get_option( 'jd-use-bitly' ) . " | " . get_option( 'jd-use-wp' ) . " | " . get_option( 'jd-use-none' ) . "]<br />";
|
124 |
-
echo get_option( 'twitterlogin' );
|
125 |
-
echo "<br />";
|
126 |
-
if ( get_option('twitterpw') != "") {
|
127 |
-
_e( "Twitter Password Saved",'wp-to-twitter' );
|
128 |
} else {
|
129 |
-
|
130 |
}
|
131 |
-
if ( get_option( 'bitlyapi' ) !=
|
132 |
-
$bitlyapi =
|
133 |
} else {
|
134 |
-
$bitlyapi =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
}
|
136 |
-
echo "<br />[" . get_option( 'cligsapi' ) . " | " . get_option( 'bitlylogin' ) . " | $bitlyapi ]<br />";
|
137 |
-
echo "[" . get_option( 'jd-functions-checked' ) . " | " . get_option( 'wp_twitter_failure' ) . " | " . get_option( 'wp_cligs_failure' ) . " | " . get_option( 'wp_url_failure' ) . " | " . get_option( 'wp_bitly_failure' ) . " | " . get_option( 'twitterInitialised' ) ." | " . get_option( 'jd_shortener' ) . "]</pre>";
|
138 |
|
|
|
139 |
echo "<p>";
|
140 |
-
_e( "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Hide</a>] If you're experiencing trouble, please copy these settings into any request for support.",'wp-to-twitter');
|
141 |
echo "</p></div>";
|
142 |
}
|
143 |
?>
|
3 |
// These functions don't perform any WP to Twitter actions, but are sometimes called for when
|
4 |
// support for primary functions is lacking.
|
5 |
|
6 |
+
|
7 |
+
function jd_remote_json( $url, $array=true ) {
|
8 |
+
$input = jd_fetch_url( $url );
|
9 |
+
$obj = json_decode($input, $array );
|
10 |
+
return $obj;
|
11 |
+
// TODO: some error handling ?
|
12 |
+
}
|
13 |
+
|
14 |
+
// Fetch a remote page. Input url, return content
|
15 |
+
function jd_fetch_url( $url, $method='GET', $body=array(), $headers=array() ) {
|
16 |
+
$request = new WP_Http;
|
17 |
+
$result = $request->request( $url , array( 'method'=>$method, 'body'=>$body, 'headers'=>$headers, 'user-agent'=>'WP to Twitter http://www.joedolson.com/articles/wp-to-twitter/' ) );
|
18 |
+
// Success?
|
19 |
+
if ( !is_wp_error($result) && isset($result['body']) ) {
|
20 |
+
return $result['body'];
|
21 |
+
// Failure (server problem...)
|
22 |
+
} else {
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
if ( !class_exists('SERVICES_JSON') ) {
|
28 |
if ( version_compare( $wp_version,"2.9","<" )) {
|
29 |
require_once( WP_PLUGIN_DIR.'/wp-to-twitter/json.class.php' );
|
121 |
}
|
122 |
function print_settings() {
|
123 |
global $version;
|
124 |
+
|
125 |
+
if ( get_option ( 'twitterpw' ) != '' ) {
|
126 |
+
$twitterpw = "Saved.";
|
127 |
+
} else {
|
128 |
+
$twitterpw = "Blank.";
|
129 |
+
}
|
130 |
+
if ( get_option ( 'yourlsapi' ) != '' ) {
|
131 |
+
$yourlsapi = "Saved.";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
} else {
|
133 |
+
$yourlsapi = "Blank.";
|
134 |
}
|
135 |
+
if ( get_option ( 'bitlyapi' ) != '' ) {
|
136 |
+
$bitlyapi = "Saved.";
|
137 |
} else {
|
138 |
+
$bitlyapi = "Blank.";
|
139 |
+
}
|
140 |
+
$options = array(
|
141 |
+
'newpost-published-update'=>get_option( 'newpost-published-update' ),
|
142 |
+
'newpost-published-text'=>get_option( 'newpost-published-text' ),
|
143 |
+
|
144 |
+
'oldpost-edited-update'=>get_option( 'oldpost-edited-update' ),
|
145 |
+
'oldpost-edited-text'=>get_option( 'oldpost-edited-text' ),
|
146 |
+
|
147 |
+
'jd_twit_pages'=>get_option( 'jd_twit_pages' ),
|
148 |
+
'jd_twit_edited_pages'=>get_option( 'jd_twit_edited_pages' ),
|
149 |
+
|
150 |
+
'oldpage-edited-text'=>get_option( 'oldpage-edited-text' ),
|
151 |
+
'newpage-published-text'=>get_option( 'newpage-published-text' ),
|
152 |
+
// Blogroll options
|
153 |
+
'jd_twit_blogroll'=>get_option( 'jd_twit_blogroll' ),
|
154 |
+
'newlink-published-text'=>get_option( 'newlink-published-text' ),
|
155 |
+
|
156 |
+
// account settings
|
157 |
+
'twitterlogin'=>get_option( 'twitterlogin' ),
|
158 |
+
'twitterpw'=>$twitterpw,
|
159 |
+
'cligsapi'=>get_option( 'cligsapi' ),
|
160 |
+
'bitlylogin'=>get_option( 'bitlylogin' ),
|
161 |
+
'bitlyapi'=>$bitlyapi,
|
162 |
+
'jd_api_post_status'=>get_option( 'jd_api_post_status' ),
|
163 |
+
//yourls installation
|
164 |
+
'yourlsapi'=>$yourlsapi,
|
165 |
+
'yourlspath'=>get_option( 'yourlspath' ),
|
166 |
+
'yourlsurl' =>get_option( 'yourlsurl' ),
|
167 |
+
'yourlslogin'=>get_option( 'yourlslogin' ),
|
168 |
+
//twitter api
|
169 |
+
'jd-twitter-service-name'=>get_option( 'jd-twitter-service-name' ),
|
170 |
+
'jd-twitter-char-limit'=>get_option( 'jd-twitter-char-limit' ),
|
171 |
+
'jd_use_both_services'=>get_option( 'jd_use_both_services' ),
|
172 |
+
'x-twitterlogin'=>get_option( 'x-twitterlogin' ),
|
173 |
+
'x-twitterpw'=>get_option( 'x-twitterpw' ),
|
174 |
+
|
175 |
+
//advanced settings
|
176 |
+
'use_tags_as_hashtags'=>get_option( 'use_tags_as_hashtags' ),
|
177 |
+
'jd_replace_character'=>get_option( 'jd_replace_character' ),
|
178 |
+
'jd_max_tags'=>get_option('jd_max_tags'),
|
179 |
+
'jd_max_characters'=>get_option('jd_max_characters'),
|
180 |
+
'jd_post_excerpt'=>get_option( 'jd_post_excerpt' ),
|
181 |
+
'jd_date_format'=>get_option( 'jd_date_format' ),
|
182 |
+
'jd_twit_prepend'=>get_option( 'jd_twit_prepend' ),
|
183 |
+
'jd_twit_append'=>get_option( 'jd_twit_append' ),
|
184 |
+
'jd_twit_custom_url'=>get_option( 'jd_twit_custom_url' ),
|
185 |
+
'jd_tweet_default'=>get_option( 'jd_tweet_default' ),
|
186 |
+
'jd_twit_remote'=>get_option( 'jd_twit_remote' ),
|
187 |
+
'jd_twit_quickpress'=>get_option( 'jd_twit_quickpress' ),
|
188 |
+
|
189 |
+
'twitter-analytics-campaign'=>get_option( 'twitter-analytics-campaign' ),
|
190 |
+
'use-twitter-analytics'=>get_option( 'use-twitter-analytics' ),
|
191 |
+
'jd_dynamic_analytics'=>get_option( 'jd_dynamic_analytics' ),
|
192 |
+
'use_dynamic_analytics'=>get_option( 'use_dynamic_analytics' ),
|
193 |
+
'jd_individual_twitter_users'=>get_option( 'jd_individual_twitter_users' ),
|
194 |
+
'jd_shortener'=>get_option( 'jd_shortener' ),
|
195 |
+
|
196 |
+
// Error checking
|
197 |
+
'jd-functions-checked'=>get_option( 'jd-functions-checked' ),
|
198 |
+
'wp_twitter_failure'=>get_option( 'wp_twitter_failure' ),
|
199 |
+
'wp_url_failure' =>get_option( 'wp_url_failure' ),
|
200 |
+
'twitterInitialised'=>get_option( 'twitterInitialised' ),
|
201 |
+
|
202 |
+
//category limits
|
203 |
+
'limit_categories'=>get_option('limit_categories' ),
|
204 |
+
'tweet_categories'=>get_option('tweet_categories' ),
|
205 |
+
|
206 |
+
);
|
207 |
+
|
208 |
+
echo "<div class=\"settings\">";
|
209 |
+
echo "<strong>Raw Settings Output: Version $version</strong>";
|
210 |
+
echo "<ol>";
|
211 |
+
foreach ($options as $key=>$value) {
|
212 |
+
echo "<li><code>$key</code>:$value</li>";
|
213 |
}
|
|
|
|
|
214 |
|
215 |
+
echo "</ol>";
|
216 |
echo "<p>";
|
217 |
+
_e( "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Hide</a>] If you're experiencing trouble, please copy these settings into any request for support.",'wp-to-twitter');
|
218 |
echo "</p></div>";
|
219 |
}
|
220 |
?>
|
readme.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
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.
|
6 |
-
Tested up to:
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using your chosen shortening service.
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -18,21 +18,41 @@ The plugin can send a default message for updating or editing posts or pages, bu
|
|
18 |
|
19 |
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.
|
20 |
|
|
|
|
|
21 |
Credits:
|
22 |
|
23 |
-
|
24 |
|
25 |
Translations:
|
26 |
|
27 |
-
Italian: [Gianni Diurno](http://www.gidibao.net)
|
28 |
-
German: [Melvin](http://www.toxicavenger.de/)
|
|
|
29 |
|
30 |
== Changelog ==
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
= 1.5.7 =
|
33 |
|
34 |
* Quick bug fix contributed by DougV from WordPress Forums.
|
35 |
-
*
|
36 |
|
37 |
= 1.5.6 =
|
38 |
|
@@ -275,6 +295,10 @@ There was once an unresolved bug which effected some servers causing the WP-to-T
|
|
275 |
|
276 |
Only posts which you scheduled or edited *after* installing the plugin will be Tweeted. Any future posts written before installing the plugin will be ignored by WP to Twitter.
|
277 |
|
|
|
|
|
|
|
|
|
278 |
== Screenshots ==
|
279 |
|
280 |
1. WP to Twitter main settings page.
|
1 |
=== Plugin Name ===
|
2 |
Contributors: joedolson
|
3 |
Donate link: http://www.joedolson.com/donate.php
|
4 |
+
Tags: twitter, microblogging, cligs, bitly, yourls, redirect, shortener, post, links
|
5 |
+
Requires at least: 2.7
|
6 |
+
Tested up to: 2.9.2
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
Posts a Twitter status update when you update your WordPress blog or post to your blogroll, using your chosen URL shortening service.
|
10 |
|
11 |
== Description ==
|
12 |
|
18 |
|
19 |
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.
|
20 |
|
21 |
+
WP to Twitter can also post to any other service using the Twitter-compatible API.
|
22 |
+
|
23 |
Credits:
|
24 |
|
25 |
+
Although it now bears very little resemblance to the original sources, this plugin was originally based 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). Thanks to [Cory LaViska](http://abeautifulsite.net/notebook/71) for PHP 4 compatible `json_decode` and `json_encode`. Thanks to [Michal Migurski](http://mike.teczno.com) for authoring the JSON class. Other bug fixes and related citations can be found in the changelog.
|
26 |
|
27 |
Translations:
|
28 |
|
29 |
+
* Italian: [Gianni Diurno](http://www.gidibao.net)
|
30 |
+
* German: [Melvin](http://www.toxicavenger.de/)
|
31 |
+
* Spanish: [David Gil Pérez](http://www.sohelet.com)
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 2.0.0 =
|
36 |
+
|
37 |
+
* Fixed bug introduced in WordPress 2.9 where logged in users could only edit their own profiles and associated issues.
|
38 |
+
* Fixed bug which caused #url# to repeatedly be added to the end of tweet texts on reactivation or upgrade.
|
39 |
+
* Fixed bug which generated shortener API error messages when no URL shortener was used.
|
40 |
+
* Fixed bug which prevented display of URL on edit screen if no URL shortener was used.
|
41 |
+
* Added Spanish translation courtesy of [David Gil Pérez](http://www.sohelet.com)
|
42 |
+
* Made so many language changes that aforementioned translation is now terribly out of date, as are all others...
|
43 |
+
* Added ability to restrict posting to certain categories.
|
44 |
+
* Added option to dynamically generate Google Analytics campaign identifier by category, post title, author, or post id.
|
45 |
+
* Added option to configure plugin to use other services using the Twitter-compatible API.
|
46 |
+
* Added support for YOURLS installations as your URL shortener. (Either local or remote.)
|
47 |
+
* Redesigned administrative interface.
|
48 |
+
* Removed use of Snoopy and alternate HTTP request methods.
|
49 |
+
* Discontinued support for WordPress versions below version 2.7.
|
50 |
+
* Major revisions to support checks.
|
51 |
+
* Version jumped to 2.0.0
|
52 |
+
|
53 |
= 1.5.7 =
|
54 |
|
55 |
* Quick bug fix contributed by DougV from WordPress Forums.
|
|
|
56 |
|
57 |
= 1.5.6 =
|
58 |
|
295 |
|
296 |
Only posts which you scheduled or edited *after* installing the plugin will be Tweeted. Any future posts written before installing the plugin will be ignored by WP to Twitter.
|
297 |
|
298 |
+
== Upgrade Notice ==
|
299 |
+
|
300 |
+
This version of WP to Twitter is not compatible with WordPress versions lower than 2.7. Do not upgrade if you are using an older version of WordPress.
|
301 |
+
|
302 |
== Screenshots ==
|
303 |
|
304 |
1. WP to Twitter main settings page.
|
screenshot-1.png
CHANGED
Binary file
|
uninstall.php
CHANGED
@@ -67,5 +67,26 @@ delete_option('jd_max_characters');
|
|
67 |
delete_option( 'bitlylogin' );
|
68 |
delete_option( 'jd-use-bitly' );
|
69 |
delete_option( 'bitlyapi' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
?>
|
67 |
delete_option( 'bitlylogin' );
|
68 |
delete_option( 'jd-use-bitly' );
|
69 |
delete_option( 'bitlyapi' );
|
70 |
+
|
71 |
+
// twitter compatible api
|
72 |
+
delete_option( 'jd_api_post_status' );
|
73 |
+
delete_option( 'jd-twitter-service-name' );
|
74 |
+
delete_option( 'jd-twitter-char-limit' );
|
75 |
+
delete_option( 'jd_use_both_services' );
|
76 |
+
delete_option( 'x-twitterlogin' );
|
77 |
+
delete_option( 'x-twitterpw' );
|
78 |
+
//dymamic analytics
|
79 |
+
delete_option( 'jd_dynamic_analytics' );
|
80 |
+
delete_option( 'use_dynamic_analytics' );
|
81 |
+
//category limits
|
82 |
+
delete_option('limit_categories' );
|
83 |
+
delete_option('tweet_categories' );
|
84 |
+
//yourls installation
|
85 |
+
delete_option( 'yourlsapi' );
|
86 |
+
delete_option( 'yourlspath' );
|
87 |
+
delete_option( 'yourlsurl' );
|
88 |
+
delete_option( 'yourlslogin' );
|
89 |
+
delete_option( 'jd_replace_character' );
|
90 |
+
delete_option( 'jd_date_format' )
|
91 |
}
|
92 |
?>
|
wp-to-twitter-es_ES.mo
ADDED
Binary file
|
wp-to-twitter-es_ES.po
ADDED
@@ -0,0 +1,519 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP to Twitter\n"
|
4 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-to-twitter\n"
|
5 |
+
"POT-Creation-Date: 2009-09-26 22:40+0000\n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: David Gil <dgilperez@gmail.com>\n"
|
8 |
+
"Language-Team: www.sohelet.com <dgilperez@sohelet.com>\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Poedit-Language: Spanish\n"
|
13 |
+
"X-Poedit-Country: SPAIN\n"
|
14 |
+
|
15 |
+
#: functions.php:117
|
16 |
+
msgid "Twitter Password Saved"
|
17 |
+
msgstr "Contraseña de Twitter guardada"
|
18 |
+
|
19 |
+
#: functions.php:119
|
20 |
+
msgid "Twitter Password Not Saved"
|
21 |
+
msgstr "Contraseña de Twitter no guardada"
|
22 |
+
|
23 |
+
#: functions.php:126
|
24 |
+
msgid "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Hide</a>] If you're experiencing trouble, please copy these settings into any request for support."
|
25 |
+
msgstr "[<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>Esconder</a>] Si tiene problemas, por favor copie esta configuración en cualquier petición de soporte."
|
26 |
+
|
27 |
+
#: wp-to-twitter-manager.php:60
|
28 |
+
msgid "Set your Twitter login information and URL shortener API information to use this plugin!"
|
29 |
+
msgstr "¡introduzca su información de acceso a Twitter e información de API del acortador de URLs para usar este plugin!"
|
30 |
+
|
31 |
+
#: wp-to-twitter-manager.php:66
|
32 |
+
msgid "Please add your Twitter password. "
|
33 |
+
msgstr "Por favor introduzca su contraseña de Twitter."
|
34 |
+
|
35 |
+
#: wp-to-twitter-manager.php:72
|
36 |
+
msgid "WP to Twitter Errors Cleared"
|
37 |
+
msgstr "Errores de WP to Twitter eliminados"
|
38 |
+
|
39 |
+
#: wp-to-twitter-manager.php:78
|
40 |
+
msgid "URL shortener request failed! We couldn't shrink that URL, so we attached the normal URL to your Tweet. Check with your URL shortening provider to see if there are any known issues. [<a href=\"http://blog.cli.gs\">Cli.gs Blog</a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]"
|
41 |
+
msgstr "¡El acortador de URLs falló! No pudimos reducir la URL, de modo que hemos adjuntado la URL original al Tweet. Por favor, revise con su proveedor de URL por si el problema está identificado. [<a href=\"http://blog.cli.gs\">Cli.gs Blog</a>] [<a href=\"http://blog.bit.ly\">Bit.ly Blog</a>]"
|
42 |
+
|
43 |
+
#: wp-to-twitter-manager.php:82
|
44 |
+
msgid "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! "
|
45 |
+
msgstr "Lo siento, no he podido contactar con los servidores de Twitter para notificar su nueva entrada. Su Tweet ha sido almacenado en un campo personalizado adjunto a la entrada, puede Tweetearlo manualmente si quiere."
|
46 |
+
|
47 |
+
#: wp-to-twitter-manager.php:84
|
48 |
+
msgid "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. "
|
49 |
+
msgstr "Lo siento, no he podido contactar con los servidores de Twitter para notificar su nuevo enlace. Tendrá que Tweetearlo manualmente."
|
50 |
+
|
51 |
+
#: wp-to-twitter-manager.php:137
|
52 |
+
msgid "You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly."
|
53 |
+
msgstr "Debe introducir su login y clave API de Bit.ly para acortar URLs con Bit.ly."
|
54 |
+
|
55 |
+
#: wp-to-twitter-manager.php:146
|
56 |
+
msgid "WP to Twitter Options Updated"
|
57 |
+
msgstr "Opciones de WP to Twitter actualizadas"
|
58 |
+
|
59 |
+
#: wp-to-twitter-manager.php:156
|
60 |
+
msgid "Twitter login and password updated. "
|
61 |
+
msgstr "Usuario y contraseña de Twitter actualizados."
|
62 |
+
|
63 |
+
#: wp-to-twitter-manager.php:158
|
64 |
+
msgid "You need to provide your twitter login and password! "
|
65 |
+
msgstr "¡Es necesario que introduzca su nombre de usuario y contraseña de Twitter!"
|
66 |
+
|
67 |
+
#: wp-to-twitter-manager.php:165
|
68 |
+
msgid "Cligs API Key Updated"
|
69 |
+
msgstr "Cli.gs: clave de API actualizada."
|
70 |
+
|
71 |
+
#: wp-to-twitter-manager.php:168
|
72 |
+
msgid "Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be associated with your account. "
|
73 |
+
msgstr "Cli.gs: clave de API eliminada. Los Cli.gs creados por WP to Twitter ya no estarán asociados con su cuenta."
|
74 |
+
|
75 |
+
#: wp-to-twitter-manager.php:170
|
76 |
+
msgid "Cli.gs API Key not added - <a href='http://cli.gs/user/api/'>get one here</a>! "
|
77 |
+
msgstr "Cli.gs: clave de API no añadida - ¡<a href='http://cli.gs/user/api/'>pinche aquí para conseguir una</a>! "
|
78 |
+
|
79 |
+
#: wp-to-twitter-manager.php:176
|
80 |
+
msgid "Bit.ly API Key Updated."
|
81 |
+
msgstr "Bit.ly: clave de API actualizada."
|
82 |
+
|
83 |
+
#: wp-to-twitter-manager.php:179
|
84 |
+
msgid "Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "
|
85 |
+
msgstr "Clave API Bit.ly eliminada. You cannot use the Bit.ly API without an API key. "
|
86 |
+
|
87 |
+
#: wp-to-twitter-manager.php:181
|
88 |
+
msgid "Bit.ly API Key not added - <a href='http://bit.ly/account/'>get one here</a>! An API key is required to use the Bit.ly URL shortening service."
|
89 |
+
msgstr "Clave de API de Bit.ly no añadida - ¡<a href='http://bit.ly/account/'>consiga una</a>! Se necesita una clave de API para usar el servicio de acortar URLs."
|
90 |
+
|
91 |
+
#: wp-to-twitter-manager.php:185
|
92 |
+
msgid " Bit.ly User Login Updated."
|
93 |
+
msgstr "Bit.ly: usuario actualizado."
|
94 |
+
|
95 |
+
#: wp-to-twitter-manager.php:188
|
96 |
+
msgid "Bit.ly User Login deleted. You cannot use the Bit.ly API without providing your username. "
|
97 |
+
msgstr "Nombre de usuario de Bit.ly borrado. No puede usar el servicio Bit.ly sin proporcionar un nombre de usuario."
|
98 |
+
|
99 |
+
#: wp-to-twitter-manager.php:190
|
100 |
+
msgid "Bit.ly Login not added - <a href='http://bit.ly/account/'>get one here</a>! "
|
101 |
+
msgstr "Nombre de usuario de Bit.ly no añadido - ¡<a href='http://bit.ly/account/'>consiga uno</a>! "
|
102 |
+
|
103 |
+
#: wp-to-twitter-manager.php:224
|
104 |
+
msgid "<li>Successfully contacted the Cli.gs API via Snoopy, but the URL creation failed.</li>"
|
105 |
+
msgstr "<li>Contacto correcto con Cli.gs API via Snoopy, pero la creación de la URL falló.</li>"
|
106 |
+
|
107 |
+
#: wp-to-twitter-manager.php:226
|
108 |
+
msgid "<li>Successfully contacted the Cli.gs API via Snoopy, but a Cli.gs server error prevented the URL from being shrotened.</li>"
|
109 |
+
msgstr "<li>Contacto correcto con Cli.gs API via Snoopy, pero un error en el servidor de Cli.gs impidió el acortamiento de la URL.</li>"
|
110 |
+
|
111 |
+
#: wp-to-twitter-manager.php:228
|
112 |
+
msgid "<li>Successfully contacted the Cli.gs API via Snoopy and created a shortened link.</li>"
|
113 |
+
msgstr "<li>Contacto correcto con Cli.gs API via Snoopy y creación de URL acortada correcto.</li>"
|
114 |
+
|
115 |
+
#: wp-to-twitter-manager.php:237
|
116 |
+
#: wp-to-twitter-manager.php:262
|
117 |
+
msgid "<li>Successfully contacted the Bit.ly API via Snoopy.</li>"
|
118 |
+
msgstr "<li>Contacto correcto con Bit.ly API via Snoopy.</li>"
|
119 |
+
|
120 |
+
#: wp-to-twitter-manager.php:239
|
121 |
+
#: wp-to-twitter-manager.php:264
|
122 |
+
msgid "<li>Failed to contact the Bit.ly API via Snoopy.</li>"
|
123 |
+
msgstr "<li>No he podido contactar con Bit.ly API via Snoopy.</li>"
|
124 |
+
|
125 |
+
#: wp-to-twitter-manager.php:242
|
126 |
+
msgid "<li>Cannot check the Bit.ly API without a valid API key.</li>"
|
127 |
+
msgstr "<li>No puedo conectar con Bit.ly API sin una clave API válida.</li>"
|
128 |
+
|
129 |
+
#: wp-to-twitter-manager.php:246
|
130 |
+
msgid "<li>Successfully contacted the Twitter API via Snoopy.</li>"
|
131 |
+
msgstr "<li>Contacto correcto con Twitter via Snoopy.</li>"
|
132 |
+
|
133 |
+
#: wp-to-twitter-manager.php:248
|
134 |
+
msgid "<li>Failed to contact the Twitter API via Snoopy.</li>"
|
135 |
+
msgstr "<li>No he podido contactar con la API de Twitter via Snoopy.</li>"
|
136 |
+
|
137 |
+
#: wp-to-twitter-manager.php:254
|
138 |
+
msgid "<li>Successfully contacted the Twitter API via cURL.</li>"
|
139 |
+
msgstr "<li>Contacto correcto con Twitter via cURL.</li>"
|
140 |
+
|
141 |
+
#: wp-to-twitter-manager.php:256
|
142 |
+
msgid "<li>Failed to contact the Twitter API via cURL.</li>"
|
143 |
+
msgstr "<li>No he podido contactar con la API de Twitter via cURL.</li>"
|
144 |
+
|
145 |
+
#: wp-to-twitter-manager.php:268
|
146 |
+
msgid "<li>Successfully contacted the Cli.gs API via Snoopy.</li>"
|
147 |
+
msgstr "<li>Contacto correcto con la API Cli.gs via Snoopy.</li>"
|
148 |
+
|
149 |
+
#: wp-to-twitter-manager.php:271
|
150 |
+
msgid "<li>Failed to contact the Cli.gs API via Snoopy.</li>"
|
151 |
+
msgstr "<li>No he podido contactar con la API Cli.gs via Snoopy.</li>"
|
152 |
+
|
153 |
+
#: wp-to-twitter-manager.php:276
|
154 |
+
msgid "<li><strong>Your server should run WP to Twitter successfully.</strong></li>"
|
155 |
+
msgstr "<li><strong>Su servidor debe parece WP to Twitter correctamente.</strong></li>"
|
156 |
+
|
157 |
+
#: wp-to-twitter-manager.php:281
|
158 |
+
msgid "<li>Your server does not support <code>fputs</code>.</li>"
|
159 |
+
msgstr "<li>Su servidor no soporta <code>fputs</code>.</li>"
|
160 |
+
|
161 |
+
#: wp-to-twitter-manager.php:285
|
162 |
+
msgid "<li>Your server does not support <code>file_get_contents</code> or <code>cURL</code> functions.</li>"
|
163 |
+
msgstr "<li>Su servidor no soporta las funciones <code>file_get_contents</code> o <code>cURL</code>.</li>"
|
164 |
+
|
165 |
+
#: wp-to-twitter-manager.php:289
|
166 |
+
msgid "<li>Your server does not support <code>Snoopy</code>.</li>"
|
167 |
+
msgstr "<li>Su servidor no soporta <code>Snoopy</code>.</li>"
|
168 |
+
|
169 |
+
#: wp-to-twitter-manager.php:292
|
170 |
+
msgid "<li><strong>Your server does not appear to support the required PHP functions and classes for WP to Twitter to function.</strong> You can try it anyway - these tests aren't perfect - but no guarantees.</li>"
|
171 |
+
msgstr "<li><strong>Su servidor no parece soportar las funciones y clases PHP necesarias para que WP to Twitter funcione correctamente.</strong> Puede intentarlo de todas maneras, pero no hay garantías de que funcione. </li>"
|
172 |
+
|
173 |
+
#: wp-to-twitter-manager.php:301
|
174 |
+
msgid "This plugin may not fully work in your server environment. The plugin failed to contact both a URL shortener API and the Twitter service API."
|
175 |
+
msgstr "El plugin puede no funcionar completamente en su entorno de servidor. El plugin falló al contactar con ambas APIs del acortador de URLs y del servicio de Twitter."
|
176 |
+
|
177 |
+
#: wp-to-twitter-manager.php:316
|
178 |
+
msgid "WP to Twitter Options"
|
179 |
+
msgstr "Opciones de WP to Twitter"
|
180 |
+
|
181 |
+
#: wp-to-twitter-manager.php:320
|
182 |
+
#: wp-to-twitter.php:759
|
183 |
+
msgid "Get Support"
|
184 |
+
msgstr "Consiga soporte"
|
185 |
+
|
186 |
+
#: wp-to-twitter-manager.php:321
|
187 |
+
msgid "Export Settings"
|
188 |
+
msgstr "Exportar configuración"
|
189 |
+
|
190 |
+
#: wp-to-twitter-manager.php:335
|
191 |
+
msgid "For any post update field, you can use the codes <code>#title#</code> for the title of your blog post, <code>#blog#</code> for the title of your blog, <code>#post#</code> for a short excerpt of the post content or <code>#url#</code> for the post URL (shortened or not, depending on your preferences.) You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code>"
|
192 |
+
msgstr "Para cada campo de actualización de entrada, puede usar los códigos <code>#title#</code> para el título de su entrada, <code>#blog#</code> para el nombre de su blog, <code>#post#</code> para un extracto de su entrada o <code>#url#</code> para la URL de la entrada (acortada o no, dependiendo de sus preferencias). También puede crear códigos personales para acceder a campos personalizados de Wordpress. Use dobles corchetes alrededor del nombre del campo personalizado para añadir su valor a su actualización de status. Ejemplo: <code>[[custom_field]]</code> ."
|
193 |
+
|
194 |
+
#: wp-to-twitter-manager.php:342
|
195 |
+
msgid "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."
|
196 |
+
msgstr "La actualización de estado de Twitter falló para una o más de sus últimas entradas. Su Tweet ha sido guardado en los metadatos de su entrada para que lo utilice a su conveniencia."
|
197 |
+
|
198 |
+
#: wp-to-twitter-manager.php:345
|
199 |
+
msgid "The query to the URL shortener API failed, and your URL was not shrunk. The full post URL was attached to your Tweet."
|
200 |
+
msgstr "La consulta a la API del acortador de URLs falló, por lo que la URL no se acortó. Se ha adjuntado la URL original a su Tweet."
|
201 |
+
|
202 |
+
#: wp-to-twitter-manager.php:357
|
203 |
+
msgid "Clear 'WP to Twitter' Error Messages"
|
204 |
+
msgstr "Borrar los errores de WP to Twitter"
|
205 |
+
|
206 |
+
#: wp-to-twitter-manager.php:366
|
207 |
+
msgid "Set what should be in a Tweet"
|
208 |
+
msgstr "Ajuste la estructura del Tweet"
|
209 |
+
|
210 |
+
#: wp-to-twitter-manager.php:369
|
211 |
+
msgid "Update when a post is published"
|
212 |
+
msgstr "Actualizar cuando se publique una entrada"
|
213 |
+
|
214 |
+
#: wp-to-twitter-manager.php:369
|
215 |
+
msgid "Text for new post updates:"
|
216 |
+
msgstr "Texto para nuevas entradas:"
|
217 |
+
|
218 |
+
#: wp-to-twitter-manager.php:374
|
219 |
+
msgid "Update when a post is edited"
|
220 |
+
msgstr "Actualizar cuando se edite una entrada"
|
221 |
+
|
222 |
+
#: wp-to-twitter-manager.php:374
|
223 |
+
msgid "Text for editing updates:"
|
224 |
+
msgstr "Texto para ediciones de entradas:"
|
225 |
+
|
226 |
+
#: wp-to-twitter-manager.php:378
|
227 |
+
msgid "Update Twitter when new Wordpress Pages are published"
|
228 |
+
msgstr "Actualizar Twitter cuando se publique una nueva página de Wordpress"
|
229 |
+
|
230 |
+
#: wp-to-twitter-manager.php:378
|
231 |
+
msgid "Text for new page updates:"
|
232 |
+
msgstr "Texto para nuevas páginas:"
|
233 |
+
|
234 |
+
#: wp-to-twitter-manager.php:382
|
235 |
+
msgid "Update Twitter when WordPress Pages are edited"
|
236 |
+
msgstr "Actualizar Twitter cuando se edite una nueva página de Wordpress"
|
237 |
+
|
238 |
+
#: wp-to-twitter-manager.php:382
|
239 |
+
msgid "Text for page edit updates:"
|
240 |
+
msgstr "Texto para ediciones de páginas:"
|
241 |
+
|
242 |
+
#: wp-to-twitter-manager.php:386
|
243 |
+
msgid "Add tags as hashtags on Tweets"
|
244 |
+
msgstr "Añadir hashtags a los Tweets"
|
245 |
+
|
246 |
+
#: wp-to-twitter-manager.php:388
|
247 |
+
msgid "Maximum number of tags to include:"
|
248 |
+
msgstr "Número máximo de tags a incluir:"
|
249 |
+
|
250 |
+
#: wp-to-twitter-manager.php:389
|
251 |
+
msgid "Maximum length in characters for included tags:"
|
252 |
+
msgstr "Máximo número de caracteres para los tags incluidos:"
|
253 |
+
|
254 |
+
#: wp-to-twitter-manager.php:390
|
255 |
+
msgid "These options allow you to restrict the length and number of WordPress tags sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow any and all tags."
|
256 |
+
msgstr "Estas opciones le permiten restringir el número y longitud de etiquetas (tags) que se envían a Twitter como hashtags. Introduzca <code>0</code> o un valor en blanco para permitir todas las etiquetas."
|
257 |
+
|
258 |
+
#: wp-to-twitter-manager.php:394
|
259 |
+
msgid "Update Twitter when you post a Blogroll link"
|
260 |
+
msgstr "Actualice Twitter cuando publique un enlace de Blogroll"
|
261 |
+
|
262 |
+
#: wp-to-twitter-manager.php:396
|
263 |
+
msgid "Text for new link updates:"
|
264 |
+
msgstr "Texto para nuevos enlaces:"
|
265 |
+
|
266 |
+
#: wp-to-twitter-manager.php:396
|
267 |
+
msgid "Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>."
|
268 |
+
msgstr "Códigos permitidos: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>."
|
269 |
+
|
270 |
+
#: wp-to-twitter-manager.php:399
|
271 |
+
msgid "Length of post excerpt (in characters):"
|
272 |
+
msgstr "Longitud del extracto de entrada (en caracteres):"
|
273 |
+
|
274 |
+
#: wp-to-twitter-manager.php:399
|
275 |
+
msgid "By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead."
|
276 |
+
msgstr "Extraido de la entrada misma por defecto. Si usa el campo 'Excerpt' (Extracto), se usará ése a su vez."
|
277 |
+
|
278 |
+
#: wp-to-twitter-manager.php:403
|
279 |
+
msgid "Custom text before Tweets:"
|
280 |
+
msgstr "Texto personalizado antes de Tweets:"
|
281 |
+
|
282 |
+
#: wp-to-twitter-manager.php:404
|
283 |
+
msgid "Custom text after Tweets:"
|
284 |
+
msgstr "Texto personalizado después de Tweets:"
|
285 |
+
|
286 |
+
#: wp-to-twitter-manager.php:407
|
287 |
+
msgid "Custom field for an alternate URL to be shortened and Tweeted:"
|
288 |
+
msgstr "Campo personalizado para una acortar y Tweetear una URL alternativa:"
|
289 |
+
|
290 |
+
#: wp-to-twitter-manager.php:408
|
291 |
+
msgid "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."
|
292 |
+
msgstr "Puede usar un campo personalizado para enviar a Cli.gs y Twitter una URL alternativa al permalink de Wordpress. Este valor es el nombre del campo personalizado que usa para añadir la URL externa."
|
293 |
+
|
294 |
+
#: wp-to-twitter-manager.php:412
|
295 |
+
msgid "Special Cases when WordPress should send a Tweet"
|
296 |
+
msgstr "Casos especiales en los que Wordpress debe enviar un Tweet"
|
297 |
+
|
298 |
+
#: wp-to-twitter-manager.php:415
|
299 |
+
msgid "Set default Tweet status to 'No.'"
|
300 |
+
msgstr "El estado por defecto del Tweet es 'No'"
|
301 |
+
|
302 |
+
#: wp-to-twitter-manager.php:416
|
303 |
+
msgid "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."
|
304 |
+
msgstr "Las actualizaciones de Twitter se pueden enviar por cada entrada. Por defecto, todas las entradas SÍ se enviarán a Twitter. Marque esta casilla para cambiar este ajuste a NO."
|
305 |
+
|
306 |
+
#: wp-to-twitter-manager.php:420
|
307 |
+
msgid "Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)"
|
308 |
+
msgstr "Enviar las actualizaciones de Twitter en publicación remota (Post by Email o cliente XMLRPC)"
|
309 |
+
|
310 |
+
#: wp-to-twitter-manager.php:424
|
311 |
+
msgid "Update Twitter when a post is published using QuickPress"
|
312 |
+
msgstr "Actualizar Twitter cuando se publique una entrada utilizando QuickPress"
|
313 |
+
|
314 |
+
#: wp-to-twitter-manager.php:428
|
315 |
+
msgid "Special Fields"
|
316 |
+
msgstr "Campos especiales"
|
317 |
+
|
318 |
+
#: wp-to-twitter-manager.php:431
|
319 |
+
msgid "Use Google Analytics with WP-to-Twitter"
|
320 |
+
msgstr "Usar Google Analytics con WP-to-Twitter"
|
321 |
+
|
322 |
+
#: wp-to-twitter-manager.php:432
|
323 |
+
msgid "Campaign identifier for Google Analytics:"
|
324 |
+
msgstr "Identificador de campaña de Google Analytics:"
|
325 |
+
|
326 |
+
#: wp-to-twitter-manager.php:433
|
327 |
+
msgid "You can track the response from Twitter using Google Analytics by defining a campaign identifier here."
|
328 |
+
msgstr "Puede seguir la respuesta de Twitter mediante Google Analytics si define un identificador de campaña aquí."
|
329 |
+
|
330 |
+
#: wp-to-twitter-manager.php:438
|
331 |
+
msgid "Authors have individual Twitter accounts"
|
332 |
+
msgstr "Los autores tienen cuentas de Twitter individuales"
|
333 |
+
|
334 |
+
#: wp-to-twitter-manager.php:438
|
335 |
+
msgid "Each author can set their own Twitter username and password in their user profile. Their posts will be sent to their own Twitter accounts."
|
336 |
+
msgstr "Cada autor puede elegir su cuenta de Twitter personal en su perfil de usuario. Sus entradas se notificarán a sus propias cuentas de Twitter."
|
337 |
+
|
338 |
+
#: wp-to-twitter-manager.php:442
|
339 |
+
msgid "Set your preferred URL Shortener"
|
340 |
+
msgstr "Elija su acortador de URLs preferido"
|
341 |
+
|
342 |
+
#: wp-to-twitter-manager.php:445
|
343 |
+
msgid "Use <strong>Cli.gs</strong> for my URL shortener."
|
344 |
+
msgstr "Usar <strong>Cli.gs</strong> como acortador de URLs."
|
345 |
+
|
346 |
+
#: wp-to-twitter-manager.php:445
|
347 |
+
msgid "Use <strong>Bit.ly</strong> for my URL shortener."
|
348 |
+
msgstr "Usar <strong>Bit.ly</strong> como acortador de URLs."
|
349 |
+
|
350 |
+
#: wp-to-twitter-manager.php:445
|
351 |
+
msgid "Don't shorten URLs."
|
352 |
+
msgstr "No acortar URLs."
|
353 |
+
|
354 |
+
#: wp-to-twitter-manager.php:450
|
355 |
+
msgid "Save WP->Twitter Options"
|
356 |
+
msgstr "Guardar configuración WP->Twitter "
|
357 |
+
|
358 |
+
#: wp-to-twitter-manager.php:456
|
359 |
+
msgid "Your Twitter account details"
|
360 |
+
msgstr "Detalles de su cuenta de Twitter"
|
361 |
+
|
362 |
+
#: wp-to-twitter-manager.php:463
|
363 |
+
msgid "Your Twitter username:"
|
364 |
+
msgstr "Su nombre de usuario de Twitter:"
|
365 |
+
|
366 |
+
#: wp-to-twitter-manager.php:467
|
367 |
+
msgid "Your Twitter password:"
|
368 |
+
msgstr "Su contraseña de Twitter:"
|
369 |
+
|
370 |
+
#: wp-to-twitter-manager.php:467
|
371 |
+
msgid "(<em>Saved</em>)"
|
372 |
+
msgstr "(<em>Guardado</em>)"
|
373 |
+
|
374 |
+
#: wp-to-twitter-manager.php:471
|
375 |
+
msgid "Save Twitter Login Info"
|
376 |
+
msgstr "Guardar información de login de Twitter"
|
377 |
+
|
378 |
+
#: wp-to-twitter-manager.php:471
|
379 |
+
msgid "» <small>Don't have a Twitter account? <a href='http://www.twitter.com'>Get one for free here</a>"
|
380 |
+
msgstr "» <small>¿No tiene cuenta en Twitter? <a href='http://www.twitter.com'>Consiga una aquí, gratis</a>"
|
381 |
+
|
382 |
+
#: wp-to-twitter-manager.php:475
|
383 |
+
msgid "Your Cli.gs account details"
|
384 |
+
msgstr "Detalles de su cuenta Cli.gs"
|
385 |
+
|
386 |
+
#: wp-to-twitter-manager.php:482
|
387 |
+
msgid "Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:"
|
388 |
+
msgstr "Su clave Cli.gs <abbr title='application programming interface'>API</abbr>:"
|
389 |
+
|
390 |
+
#: wp-to-twitter-manager.php:488
|
391 |
+
msgid "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."
|
392 |
+
msgstr "¿No dispone de cuenta en Cli.gs o una clave API Cligs ? ¡<a href='http://cli.gs/user/api/'>Consiga una gratis aquí</a>!<br /> Necesitará una clave API para asociar los Cligs que cree con su cuenta Cligs."
|
393 |
+
|
394 |
+
#: wp-to-twitter-manager.php:493
|
395 |
+
msgid "Your Bit.ly account details"
|
396 |
+
msgstr "Detalles de su cuenta Bit.ly"
|
397 |
+
|
398 |
+
#: wp-to-twitter-manager.php:498
|
399 |
+
msgid "Your Bit.ly username:"
|
400 |
+
msgstr "Su nombre de usuario de Bit.ly:"
|
401 |
+
|
402 |
+
#: wp-to-twitter-manager.php:502
|
403 |
+
msgid "Your Bit.ly <abbr title='application programming interface'>API</abbr> Key:"
|
404 |
+
msgstr "Su clave Bit.ly <abbr title='application programming interface'>API</abbr>:"
|
405 |
+
|
406 |
+
#: wp-to-twitter-manager.php:509
|
407 |
+
msgid "Save Bit.ly API Key"
|
408 |
+
msgstr "Guardar clave Bit.ly"
|
409 |
+
|
410 |
+
#: wp-to-twitter-manager.php:509
|
411 |
+
msgid "Clear Bit.ly API Key"
|
412 |
+
msgstr "Borrar clave Bit.ly"
|
413 |
+
|
414 |
+
#: wp-to-twitter-manager.php:509
|
415 |
+
msgid "A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter."
|
416 |
+
msgstr "Se necesita un usuario y una clave API de Bit.ly para acortar URLs con la API de Bit.ly y WP to Twitter."
|
417 |
+
|
418 |
+
#: wp-to-twitter-manager.php:518
|
419 |
+
msgid "Check Support"
|
420 |
+
msgstr "Chequear soporte"
|
421 |
+
|
422 |
+
#: wp-to-twitter-manager.php:518
|
423 |
+
msgid "Check whether your server supports WP to Twitter's queries to the Twitter and URL shortening APIs."
|
424 |
+
msgstr "Comprobar si su servidor soporta las peticiones de WP to Twitter a las APIs de Twitter y del acortador de URLs."
|
425 |
+
|
426 |
+
#: wp-to-twitter-manager.php:526
|
427 |
+
msgid "Need help?"
|
428 |
+
msgstr "¿Necesita ayuda?"
|
429 |
+
|
430 |
+
#: wp-to-twitter-manager.php:527
|
431 |
+
msgid "Visit the <a href='http://www.joedolson.com/articles/wp-to-twitter/'>WP to Twitter plugin page</a>."
|
432 |
+
msgstr "Visite la <a href='http://www.joedolson.com/articles/wp-to-twitter/'>página del plugin WP to Twitter</a>."
|
433 |
+
|
434 |
+
#: wp-to-twitter.php:691
|
435 |
+
msgid "Add_new_tag"
|
436 |
+
msgstr "Añadir_nueva_etiqueta"
|
437 |
+
|
438 |
+
#. #-#-#-#-# plugin.pot (PACKAGE VERSION) #-#-#-#-#
|
439 |
+
#. Plugin Name of an extension
|
440 |
+
#: wp-to-twitter.php:713
|
441 |
+
msgid "WP to Twitter"
|
442 |
+
msgstr "WP to Twitter"
|
443 |
+
|
444 |
+
#: wp-to-twitter.php:754
|
445 |
+
msgid "Twitter Post"
|
446 |
+
msgstr "Post de Twitter"
|
447 |
+
|
448 |
+
#: wp-to-twitter.php:759
|
449 |
+
msgid " characters.<br />Twitter posts are a maximum of 140 characters; if your Cli.gs URL is appended to the end of your document, you have 119 characters available. You can use <code>#url#</code>, <code>#title#</code>, <code>#post#</code> or <code>#blog#</code> to insert the shortened URL, post title, a post excerpt or blog name into the Tweet."
|
450 |
+
msgstr " caracteres.<br />Las entradas de Twitter son de 140 caracteres como máximo; si su URL Cli.gs se añade al final del documento, tiene 119 caracteres disponibles. Puede usar <code>#url#</code>, <code>#title#</code>, <code>#post#</code> o <code>#blog#</code> para insertar en el Tweet la URL corta, título de entrada, extracto de la entrada o nombre del blog."
|
451 |
+
|
452 |
+
#: wp-to-twitter.php:759
|
453 |
+
msgid "Make a Donation"
|
454 |
+
msgstr "Haga una Donación"
|
455 |
+
|
456 |
+
#: wp-to-twitter.php:762
|
457 |
+
msgid "Don't Tweet this post."
|
458 |
+
msgstr "No Tweetear esta entrada."
|
459 |
+
|
460 |
+
#: wp-to-twitter.php:811
|
461 |
+
msgid "WP to Twitter User Settings"
|
462 |
+
msgstr "Ajustes de usuario de WP to Twitter"
|
463 |
+
|
464 |
+
#: wp-to-twitter.php:815
|
465 |
+
msgid "Use My Twitter Account"
|
466 |
+
msgstr "Usar mi cuenta de Twitter"
|
467 |
+
|
468 |
+
#: wp-to-twitter.php:816
|
469 |
+
msgid "Select this option if you would like your posts to be Tweeted into your own Twitter account with no @ references."
|
470 |
+
msgstr "Seleccione esta opción si quiere que sus entradas se Tweeteen en su propia cuenta de Twitter sin referencias @. "
|
471 |
+
|
472 |
+
#: wp-to-twitter.php:817
|
473 |
+
msgid "Tweet my posts into my Twitter account with an @ reference to the site's main Twitter account."
|
474 |
+
msgstr "Tweetear mis entradas en mi cuenta de Twitter con una referencia @ a la cuenta principal de Twitter del blog."
|
475 |
+
|
476 |
+
#: wp-to-twitter.php:818
|
477 |
+
msgid "Tweet my posts into the main site Twitter account with an @ reference to my username. (Password not required with this option.)"
|
478 |
+
msgstr "Tweetear mis entradas con la cuenta principal de Twitter del blog, con una referencia @ a mi cuenta personal (no se necesita contraseña para esta opción)."
|
479 |
+
|
480 |
+
#: wp-to-twitter.php:821
|
481 |
+
msgid "Your Twitter Username"
|
482 |
+
msgstr "Su nombre de usuario de Twitter"
|
483 |
+
|
484 |
+
#: wp-to-twitter.php:822
|
485 |
+
msgid "Enter your own Twitter username."
|
486 |
+
msgstr "Introduzca su nombre de usuario de Twitter"
|
487 |
+
|
488 |
+
#: wp-to-twitter.php:825
|
489 |
+
msgid "Your Twitter Password"
|
490 |
+
msgstr "Su contraseña de Twitter"
|
491 |
+
|
492 |
+
#: wp-to-twitter.php:826
|
493 |
+
msgid "Enter your own Twitter password."
|
494 |
+
msgstr "Introduzca su contraseña de Twitter"
|
495 |
+
|
496 |
+
#: wp-to-twitter.php:945
|
497 |
+
msgid "<p>Couldn't locate the settings page.</p>"
|
498 |
+
msgstr "<p>No he podido encontrar la página de configuración.</p>"
|
499 |
+
|
500 |
+
#: wp-to-twitter.php:950
|
501 |
+
msgid "Settings"
|
502 |
+
msgstr "Configuración"
|
503 |
+
|
504 |
+
#. Plugin URI of an extension
|
505 |
+
msgid "http://www.joedolson.com/articles/wp-to-twitter/"
|
506 |
+
msgstr "http://www.joedolson.com/articles/wp-to-twitter/"
|
507 |
+
|
508 |
+
#. Description of an extension
|
509 |
+
msgid "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."
|
510 |
+
msgstr "Actualiza Twitter cuando crea una nueva entrada o añade algo a su Blogroll usando Cli.gs. Con una clave de API de Cli.gs, crea un clig en su cuenta Cli.gs con el nombre de su entrada como título."
|
511 |
+
|
512 |
+
#. Author of an extension
|
513 |
+
msgid "Joseph Dolson"
|
514 |
+
msgstr "Joseph Dolson"
|
515 |
+
|
516 |
+
#. Author URI of an extension
|
517 |
+
msgid "http://www.joedolson.com/"
|
518 |
+
msgstr "http://www.joedolson.com/"
|
519 |
+
|
wp-to-twitter-manager.php
CHANGED
@@ -4,69 +4,75 @@
|
|
4 |
if( get_option( $theFieldname ) == '1'){
|
5 |
echo 'checked="checked"';
|
6 |
}
|
7 |
-
}
|
|
|
|
|
|
|
|
|
|
|
8 |
$wp_twitter_error = FALSE;
|
9 |
$wp_cligs_error = FALSE;
|
10 |
$message = "";
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
//SETS DEFAULT OPTIONS
|
13 |
if ( get_option( 'twitterInitialised') != '1' ) {
|
14 |
update_option( 'newpost-published-update', '1' );
|
15 |
-
update_option( 'newpost-published-text', 'New post: #title#
|
16 |
-
update_option( 'newpost-published-showlink', '1' );
|
17 |
-
update_option( 'jd_twit_quickpress', '1' );
|
18 |
-
update_option( 'jd_shortener', '0' );
|
19 |
-
update_option( 'use_tags_as_hashtags', '0' );
|
20 |
-
update_option('jd_max_tags',5);
|
21 |
-
update_option('jd_max_characters',15);
|
22 |
-
update_option('jd_replace_character','_');
|
23 |
|
24 |
update_option( 'oldpost-edited-update', '1' );
|
25 |
-
update_option( 'oldpost-edited-text', 'Post Edited: #title#
|
26 |
-
update_option( 'oldpost-edited-showlink', '1' );
|
27 |
|
28 |
update_option( 'jd_twit_pages','0' );
|
29 |
-
update_option( '
|
30 |
-
update_option( 'newpage-published-text','New page: #title# (#url#)' );
|
31 |
-
update_option( 'oldpage-edited-text','Page edited: #title# (#url#)' );
|
32 |
|
33 |
-
update_option( '
|
|
|
|
|
|
|
|
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
update_option( 'jd_twit_remote', '0' );
|
36 |
update_option( 'jd_post_excerpt', 30 );
|
37 |
// Use Google Analytics with Twitter
|
38 |
-
update_option( 'twitter-analytics-campaign', '' );
|
39 |
update_option( 'use-twitter-analytics', '0' );
|
40 |
-
|
|
|
41 |
// Use custom external URLs to point elsewhere.
|
42 |
-
update_option( 'jd_twit_custom_url', 'external_link' );
|
43 |
-
|
44 |
-
// Cligs API
|
45 |
-
update_option( 'cligsapi','' );
|
46 |
-
|
47 |
// Error checking
|
48 |
update_option( 'jd_functions_checked','0' );
|
49 |
update_option( 'wp_twitter_failure','0' );
|
50 |
update_option( 'wp_url_failure','0' );
|
51 |
-
|
52 |
-
// Blogroll options
|
53 |
-
update_option( 'newlink-published-text', 'New link posted: ' );
|
54 |
-
update_option( 'jd_twit_blogroll', '1');
|
55 |
-
|
56 |
// Default publishing options.
|
57 |
update_option( 'jd_tweet_default', '0' );
|
58 |
// Note that default options are set.
|
59 |
-
update_option( 'twitterInitialised', '1' );
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
|
63 |
-
$message = __("Set your
|
64 |
}
|
65 |
if ( get_option( 'twitterInitialised') == '1' && get_option( 'jd_post_excerpt' ) == "" ) {
|
66 |
update_option( 'jd_post_excerpt', 30 );
|
67 |
}
|
68 |
if ( get_option( 'twitterInitialised') == '1' && get_option( 'twitterpw' ) == "" ) {
|
69 |
-
$message .= __("Please add your Twitter password
|
70 |
}
|
71 |
|
72 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
|
@@ -75,6 +81,31 @@
|
|
75 |
$message = __("WP to Twitter Errors Cleared", 'wp-to-twitter');
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
// Error messages on status update or url shortener failures
|
79 |
if ( get_option( 'wp_twitter_failure' ) == '1' ) {
|
80 |
|
@@ -88,17 +119,8 @@
|
|
88 |
$wp_to_twitter_failure = '';
|
89 |
}
|
90 |
|
91 |
-
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == '
|
92 |
-
// UPDATE OPTIONS
|
93 |
-
update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
|
94 |
-
update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
|
95 |
update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
|
96 |
-
update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
|
97 |
-
update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
|
98 |
-
update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
|
99 |
-
update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] );
|
100 |
-
update_option( 'newpage-published-text', $_POST['newpage-published-text'] );
|
101 |
-
update_option( 'oldpage-edited-text', $_POST['oldpage-edited-text'] );
|
102 |
update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
|
103 |
update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
|
104 |
update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
|
@@ -106,71 +128,114 @@
|
|
106 |
update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
|
107 |
update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
|
108 |
update_option( 'jd_shortener', $_POST['jd_shortener'] );
|
109 |
-
update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
|
110 |
-
update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
|
111 |
update_option('jd_max_tags',$_POST['jd_max_tags']);
|
112 |
update_option('jd_max_characters',$_POST['jd_max_characters']);
|
113 |
update_option('jd_replace_character',$_POST['jd_replace_character']);
|
114 |
-
update_option( 'jd_date_format',$_POST['jd_date_format'] );
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
update_option( 'jd-use-bitly', '0' );
|
120 |
-
update_option( 'jd-use-none', '0' );
|
121 |
-
update_option( 'jd-use-wp','0' );
|
122 |
-
break;
|
123 |
-
case 2:
|
124 |
-
update_option( 'jd-use-cligs', '0' );
|
125 |
-
update_option( 'jd-use-bitly', '1' );
|
126 |
-
update_option( 'jd-use-none', '0' );
|
127 |
-
update_option( 'jd-use-wp','0' );
|
128 |
-
break;
|
129 |
-
case 3:
|
130 |
-
update_option( 'jd-use-cligs', '0' );
|
131 |
-
update_option( 'jd-use-bitly', '0' );
|
132 |
-
update_option( 'jd-use-none', '1' );
|
133 |
-
update_option( 'jd-use-wp','0' );
|
134 |
-
break;
|
135 |
-
case 4:
|
136 |
-
update_option( 'jd-use-cligs', '0' );
|
137 |
-
update_option( 'jd-use-bitly', '0' );
|
138 |
-
update_option( 'jd-use-none', '0' );
|
139 |
-
update_option( 'jd-use-wp', '1' );
|
140 |
-
break;
|
141 |
-
default:
|
142 |
-
update_option( 'jd-use-cligs', '1' );
|
143 |
-
update_option( 'jd-use-bitly', '0' );
|
144 |
-
update_option( 'jd-use-wp','0' );
|
145 |
-
update_option( 'jd-use-none', '0' );
|
146 |
-
}
|
147 |
-
|
148 |
-
if ( get_option( 'jd-use-bitly' ) == 1 && ( get_option( 'bitlylogin' ) == "" || get_option( 'bitlyapi' ) == "" ) ) {
|
149 |
$message .= __( 'You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly.' , 'wp-to-twitter');
|
150 |
$message .= "<br />";
|
151 |
}
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
|
155 |
update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
|
156 |
update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
$message .= __( 'WP to Twitter Options Updated' , 'wp-to-twitter');
|
159 |
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'login' ) {
|
163 |
//UPDATE LOGIN
|
164 |
if( ( $_POST['twitterlogin'] != '' ) && ( $_POST['twitterpw'] != '' ) ) {
|
165 |
update_option( 'twitterlogin', $_POST['twitterlogin'] );
|
166 |
update_option( 'twitterpw', $_POST['twitterpw'] );
|
167 |
update_option( 'twitterlogin_encrypted', base64_encode( $_POST['twitterlogin'].':'.$_POST['twitterpw'] ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
$message = __("Twitter login and password updated. ", 'wp-to-twitter');
|
169 |
} else {
|
170 |
-
$message = __("You need to provide your
|
171 |
}
|
172 |
}
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'cligsapi' ) {
|
175 |
if ( $_POST['cligsapi'] != '' && isset( $_POST['submit'] ) ) {
|
176 |
update_option( 'cligsapi',$_POST['cligsapi'] );
|
@@ -209,103 +274,123 @@
|
|
209 |
}
|
210 |
// If you're attempting to solve the "settings page doesn't display" problem, begin your comment here.
|
211 |
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
$twit_checker = new Snoopy;
|
217 |
-
$bitly_checker = new Snoopy;
|
218 |
-
$run_Snoopy_test = TRUE;
|
219 |
-
}
|
220 |
// grab or set necessary variables
|
221 |
-
$
|
222 |
-
$
|
223 |
-
$
|
224 |
-
$testurl = urlencode("http://www.joedolson.com/articles/wp-to-twitter/");
|
225 |
-
$bitlylogin = get_option( 'bitlylogin' );
|
226 |
-
$bitlyapi = get_option( 'bitlyapi' );
|
227 |
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
$message .= __("<li>Successfully contacted the Cli.gs API via Snoopy, but a Cli.gs server error prevented the URL from being shrotened.</li>", 'wp-to-twitter');
|
239 |
-
} else {
|
240 |
-
$message .=__("<li>Successfully contacted the Cli.gs API via Snoopy and created a shortened link.</li>", 'wp-to-twitter');
|
241 |
-
$wp_cligs_error = FALSE;
|
242 |
-
}
|
243 |
-
if ($bitlyapi != "") {
|
244 |
-
$decoded = json_decode($bitly_checker->results,TRUE);
|
245 |
-
$bitly_decoded = $decoded['statusCode'];
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
} else {
|
263 |
-
|
264 |
-
|
265 |
-
$wp_twitter_error = FALSE;
|
266 |
-
$message .= __("<li>Successfully contacted the Twitter API via cURL.</li>", 'wp-to-twitter');
|
267 |
} else {
|
268 |
-
|
|
|
|
|
269 |
}
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
275 |
} else {
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
|
|
|
|
282 |
} else {
|
283 |
-
|
284 |
-
}
|
285 |
}
|
|
|
286 |
// If everything's OK, there's no reason to do this again.
|
287 |
-
if ($wp_twitter_error == FALSE
|
288 |
$message .= __("<li><strong>Your server should run WP to Twitter successfully.</strong></li>", 'wp-to-twitter');
|
289 |
update_option( 'jd-functions-checked','1' );
|
290 |
} else {
|
291 |
-
|
292 |
-
$wp_function_error = TRUE;
|
293 |
-
$message .= __("<li>Your server does not support <code>fputs</code>.</li>", 'wp-to-twitter');
|
294 |
-
}
|
295 |
-
if ( !function_exists( 'curl_init' ) || !function_exists( 'file_get_contents' ) ) {
|
296 |
-
$wp_function_error = TRUE;
|
297 |
-
$message .= __("<li>Your server does not support <code>file_get_contents</code> or <code>cURL</code> functions.</li>", 'wp-to-twitter');
|
298 |
-
}
|
299 |
-
if ( !class_exists( 'Snoopy' ) ) {
|
300 |
-
$wp_function_error = TRUE;
|
301 |
-
$message .= __("<li>Your server does not support <code>Snoopy</code>.</li>", 'wp-to-twitter');
|
302 |
-
}
|
303 |
-
|
304 |
-
$message .= __("<li><strong>Your server does not appear to support the required PHP functions and classes for WP to Twitter to function.</strong> You can try it anyway - these tests aren't perfect - but no guarantees.</li>", 'wp-to-twitter');
|
305 |
-
$message .= "</ul>";
|
306 |
update_option( 'jd-functions-checked','1' );
|
307 |
}
|
308 |
-
|
|
|
|
|
309 |
// CLOSE BUG FIX COMMENT HERE
|
310 |
?>
|
311 |
<?php if ( $wp_twitter_error == TRUE || ( $wp_cligs_error == TRUE && $wp_bitly_error == TRUE ) ) {
|
@@ -314,38 +399,50 @@ _e("This plugin may not fully work in your server environment. The plugin failed
|
|
314 |
echo "</p></div>";
|
315 |
}
|
316 |
?>
|
|
|
|
|
317 |
<?php if ( $message ) { ?>
|
318 |
<div id="message" class="updated fade"><?php echo $message; ?></div>
|
319 |
<?php } ?>
|
320 |
<div id="dropmessage" class="updated" style="display:none;"></div>
|
321 |
-
|
322 |
-
<div class="wrap" id="wp-to-twitter">
|
323 |
-
|
324 |
<?php if (isset($_GET['export']) && $_GET['export'] == "settings") {
|
325 |
print_settings();
|
326 |
} ?>
|
327 |
|
328 |
<h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
|
329 |
-
|
|
|
|
|
330 |
<div class="resources">
|
331 |
-
<
|
332 |
-
<
|
333 |
-
<
|
334 |
-
<
|
|
|
|
|
|
|
|
|
335 |
<div>
|
336 |
<input type="hidden" name="cmd" value="_s-xclick" />
|
337 |
<input type="hidden" name="hosted_button_id" value="8490399" />
|
338 |
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate" />
|
339 |
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
|
340 |
</div>
|
341 |
-
</form
|
342 |
-
</
|
343 |
|
344 |
</div>
|
345 |
|
346 |
-
<p>
|
347 |
-
|
348 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
349 |
|
350 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) { ?>
|
351 |
<div class="error">
|
@@ -364,11 +461,22 @@ print_settings();
|
|
364 |
</form>
|
365 |
<?php
|
366 |
}
|
367 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
<form method="post" action="">
|
369 |
<div>
|
370 |
<fieldset>
|
371 |
-
<legend><?php _e("
|
372 |
<p>
|
373 |
<input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
|
374 |
<label for="newpost-published-update"><strong><?php _e("Update when a post is published", 'wp-to-twitter'); ?></strong></label> <label for="newpost-published-text"><br /><?php _e("Text for new post updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo( attribute_escape( stripslashes( get_option( 'newpost-published-text' ) ) ) ); ?>" />
|
@@ -386,109 +494,74 @@ print_settings();
|
|
386 |
<input type="checkbox" name="jd_twit_edited_pages" id="jd_twit_edited_pages" value="1" <?php jd_checkCheckbox('jd_twit_edited_pages')?> />
|
387 |
<label for="jd_twit_edited_pages"><strong><?php _e("Update Twitter when WordPress Pages are edited", 'wp-to-twitter'); ?></strong></label><br /><label for="oldpage-edited-text"><?php _e("Text for page edit updates:", 'wp-to-twitter'); ?></label> <input type="text" name="oldpage-edited-text" id="oldpage-edited-text" size="60" maxlength="120" value="<?php echo( attribute_escape( stripslashes( get_option('oldpage-edited-text' ) ) ) ); ?>" />
|
388 |
</p>
|
389 |
-
<p>
|
390 |
-
<input type="checkbox" name="use_tags_as_hashtags" id="use_tags_as_hashtags" value="1" <?php jd_checkCheckbox('use_tags_as_hashtags')?> />
|
391 |
-
<label for="use_tags_as_hashtags"><strong><?php _e("Add tags as hashtags on Tweets", 'wp-to-twitter'); ?></strong></label> <label for="jd_replace_character"><?php _e("Spaces replaced with:",'wp-to-twitter'); ?></label> <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo attribute_escape( get_option('jd_replace_character') ); ?>" size="3" /><br />
|
392 |
-
<small><?php _e("Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> to remove spaces entirely.",'wp-to-twitter'); ?></small>
|
393 |
-
<br />
|
394 |
-
<label for="jd_max_tags"><?php _e("Maximum number of tags to include:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_tags" id="jd_max_tags" value="<?php echo attribute_escape( get_option('jd_max_tags') ); ?>" size="3" />
|
395 |
-
<label for="jd_max_characters"><?php _e("Maximum length in characters for included tags:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_characters" id="jd_max_characters" value="<?php echo attribute_escape( get_option('jd_max_characters') ); ?>" size="3" /><br />
|
396 |
-
<small><?php _e("These options allow you to restrict the length and number of WordPress tags sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow any and all tags.",'wp-to-twitter'); ?></small>
|
397 |
-
</p>
|
398 |
<p>
|
399 |
<input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
|
400 |
<label for="jd_twit_blogroll"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br />
|
401 |
<label for="newlink-published-text"><?php _e("Text for new link updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( attribute_escape( stripslashes( get_option( 'newlink-published-text' ) ) ) ); ?>" /><br /><small><?php _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.','wp-to-twitter'); ?></small>
|
402 |
</p>
|
403 |
-
|
404 |
-
<label for="jd_post_excerpt"><strong><?php _e("Length of post excerpt (in characters):", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php echo ( attribute_escape( get_option( 'jd_post_excerpt' ) ) ) ?>" /> <small><?php _e("By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead.", 'wp-to-twitter'); ?></small>
|
405 |
-
</p>
|
406 |
-
<p>
|
407 |
-
<label for="jd_date_format"><strong><?php _e("WP to Twitter Date Formatting:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_date_format" id="jd_date_format" size="12" maxlength="12" value="<?php if (get_option('jd_date_format')=='') { echo ( attribute_escape( get_option('date_format') ) ); } else { echo ( attribute_escape( get_option( 'jd_date_format' ) ) ); }?>" /> <small><?php _e("Default is from your general settings. <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>Date Formatting Documentation</a>.", 'wp-to-twitter'); ?></small>
|
408 |
-
</p>
|
409 |
-
|
410 |
-
<p>
|
411 |
-
<label for="jd_twit_prepend"><strong><?php _e("Custom text before Tweets:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_prepend' ) ) ) ?>" />
|
412 |
-
<label for="jd_twit_append"><strong><?php _e("Custom text after Tweets:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_append" id="jd_twit_append" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_append' ) ) ) ?>" />
|
413 |
-
</p>
|
414 |
-
<p>
|
415 |
-
<label for="jd_twit_custom_url"><strong><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></strong></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
|
416 |
-
<small><?php _e("You can use a custom field to send Cli.gs and Twitter an alternate URL from the permalink provided by WordPress. The value is the name of the custom field you're using to add an external URL.", 'wp-to-twitter'); ?></small>
|
417 |
-
</p>
|
418 |
-
</fieldset>
|
419 |
-
<fieldset>
|
420 |
-
<legend><?php _e( "Special Cases when WordPress should send a Tweet",'wp-to-twitter' ); ?></legend>
|
421 |
-
<p>
|
422 |
-
<input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
|
423 |
-
<label for="jd_tweet_default"><strong><?php _e("Set default Tweet status to 'No.'", 'wp-to-twitter'); ?></strong></label><br />
|
424 |
-
<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.", 'wp-to-twitter'); ?></small>
|
425 |
-
</p>
|
426 |
-
<p>
|
427 |
-
<input type="checkbox" name="jd_twit_remote" id="jd_twit_remote" value="1" <?php jd_checkCheckbox('jd_twit_remote')?> />
|
428 |
-
<label for="jd_twit_remote"><strong><?php _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)", 'wp-to-twitter'); ?></strong></label>
|
429 |
-
</p>
|
430 |
-
<p>
|
431 |
-
<input type="checkbox" name="jd_twit_quickpress" id="jd_twit_quickpress" value="1" <?php jd_checkCheckbox('jd_twit_quickpress')?> />
|
432 |
-
<label for="jd_twit_quickpress"><strong><?php _e("Update Twitter when a post is published using QuickPress", 'wp-to-twitter'); ?></strong></label>
|
433 |
-
</p>
|
434 |
-
</fieldset>
|
435 |
-
<fieldset>
|
436 |
-
<legend><?php _e( "Special Fields",'wp-to-twitter' ); ?></legend>
|
437 |
-
<p>
|
438 |
-
<input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
|
439 |
-
<label for="use-twitter-analytics"><strong><?php _e("Use Google Analytics with WP-to-Twitter", 'wp-to-twitter'); ?></strong></label><br />
|
440 |
-
<label for="twitter-analytics-campaign"><?php _e("Campaign identifier for Google Analytics:", 'wp-to-twitter'); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br />
|
441 |
-
<small><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here.", 'wp-to-twitter'); ?></small>
|
442 |
-
</p>
|
443 |
-
|
444 |
-
<p>
|
445 |
-
<input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
|
446 |
-
<label for="jd_individual_twitter_users"><strong><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></strong></label><br /><small><?php _e('Each author can set their own Twitter username and password in their user profile. Their posts will be sent to their own Twitter accounts.', 'wp-to-twitter'); ?></small>
|
447 |
-
</p>
|
448 |
-
</fieldset>
|
449 |
-
<fieldset>
|
450 |
-
<legend><?php _e("Set your preferred URL Shortener",'wp-to-twitter' ); ?></legend>
|
451 |
|
452 |
-
|
453 |
-
<input type="radio" name="jd_shortener" id="jd_shortener_cligs" value="1" <?php jd_checkCheckbox('jd-use-cligs')?>/> <label for="jd_shortener_cligs"><?php _e("Use <strong>Cli.gs</strong> for my URL shortener.", 'wp-to-twitter'); ?></label>
|
454 |
-
<input type="radio" name="jd_shortener" id="jd_shortener_bitly" value="2" <?php jd_checkCheckbox('jd-use-bitly')?> /> <label for="jd_shortener_bitly"><?php _e("Use <strong>Bit.ly</strong> for my URL shortener.", 'wp-to-twitter'); ?></label><br />
|
455 |
-
<input type="radio" name="jd_shortener" id="jd_shortener_wp" value="4" <?php jd_checkCheckbox('jd-use-wp')?> /> <label for="jd_shortener_wp"><?php _e("Use <strong>WordPress</strong> as a URL shortener.", 'wp-to-twitter'); ?></label>
|
456 |
-
<input type="radio" name="jd_shortener" id="jd_shortener_none" value="3" <?php jd_checkCheckbox('jd-use-none')?> /> <label for="jd_shortener_none"><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></label><br />
|
457 |
-
<small><?php _e("Using WordPress as a URL shortener will send URLs to Twitter in the default URL format for WordPress: <code>http://domain.com/subdir/?p=123</code>. Google Analytics is not available when using WordPress shortened URLs.", 'wp-to-twitter'); ?></small>
|
458 |
-
</p>
|
459 |
-
<div>
|
460 |
<input type="hidden" name="submit-type" value="options" />
|
461 |
</div>
|
462 |
-
|
463 |
-
</fieldset>
|
464 |
-
|
465 |
</div>
|
466 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
|
468 |
-
|
|
|
|
|
|
|
469 |
|
470 |
<form method="post" action="" >
|
471 |
-
|
472 |
-
|
473 |
<div>
|
474 |
<p>
|
475 |
-
<label for="twitterlogin"><?php _e("Your
|
476 |
<input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo ( attribute_escape( get_option( 'twitterlogin' ) ) ) ?>" />
|
477 |
</p>
|
478 |
<p>
|
479 |
-
<label for="twitterpw"><?php _e("Your
|
480 |
<input type="password" name="twitterpw" id="twitterpw" value="" />
|
481 |
</p>
|
482 |
<input type="hidden" name="submit-type" value="login" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
<p><input type="submit" name="submit" value="<?php _e("Save Twitter Login Info", 'wp-to-twitter'); ?>" class="button-primary" /> <?php _e("» <small>Don't have a Twitter account? <a href='http://www.twitter.com'>Get one for free here</a>", 'wp-to-twitter'); ?></small></p>
|
484 |
</div>
|
485 |
</form>
|
486 |
-
|
487 |
-
|
|
|
|
|
488 |
|
489 |
<form method="post" action="">
|
490 |
-
|
491 |
-
|
492 |
<div>
|
493 |
<p>
|
494 |
<label for="cligsapi"><?php _e("Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter'); ?></label>
|
@@ -500,9 +573,10 @@ print_settings();
|
|
500 |
<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.", 'wp-to-twitter'); ?></small></p>
|
501 |
</div>
|
502 |
</form>
|
|
|
|
|
503 |
|
504 |
-
|
505 |
-
<h2 class="bitly"><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></h2>
|
506 |
<form method="post" action="">
|
507 |
|
508 |
<div>
|
@@ -521,21 +595,223 @@ print_settings();
|
|
521 |
<p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
|
522 |
</div>
|
523 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
|
526 |
<form method="post" action="">
|
527 |
<fieldset>
|
528 |
<input type="hidden" name="submit-type" value="check-support" />
|
529 |
<p>
|
530 |
-
<input type="submit" name="submit" value="<?php _e('Check Support','wp-to-twitter'); ?>" class="button-primary" /> <small><?php _e('Check whether your server supports WP to Twitter\'s queries to the Twitter and URL shortening APIs.','wp-to-twitter'); ?></small>
|
531 |
</p>
|
532 |
</fieldset>
|
533 |
-
</form>
|
534 |
-
|
535 |
</div>
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
if( get_option( $theFieldname ) == '1'){
|
5 |
echo 'checked="checked"';
|
6 |
}
|
7 |
+
}
|
8 |
+
function jd_checkSelect( $theFieldname, $theValue ) {
|
9 |
+
if( get_option( $theFieldname ) == $theValue ){
|
10 |
+
echo 'selected="selected"';
|
11 |
+
}
|
12 |
+
}
|
13 |
$wp_twitter_error = FALSE;
|
14 |
$wp_cligs_error = FALSE;
|
15 |
$message = "";
|
16 |
+
if ( get_option('jd-twitter-service-name') == '' ) {
|
17 |
+
$twitter = "Twitter";
|
18 |
+
} else {
|
19 |
+
$twitter = get_option('jd-twitter-service-name');
|
20 |
+
}
|
21 |
//SETS DEFAULT OPTIONS
|
22 |
if ( get_option( 'twitterInitialised') != '1' ) {
|
23 |
update_option( 'newpost-published-update', '1' );
|
24 |
+
update_option( 'newpost-published-text', 'New post: #title# #url#' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
update_option( 'oldpost-edited-update', '1' );
|
27 |
+
update_option( 'oldpost-edited-text', 'Post Edited: #title# #url#' );
|
|
|
28 |
|
29 |
update_option( 'jd_twit_pages','0' );
|
30 |
+
update_option( 'newpage-published-text','New page: #title# #url#' );
|
|
|
|
|
31 |
|
32 |
+
update_option( 'jd_twit_edited_pages','0' );
|
33 |
+
update_option( 'oldpage-edited-text','Page edited: #title# #url#' );
|
34 |
+
|
35 |
+
update_option( 'jd_twit_blogroll', '1');
|
36 |
+
update_option( 'newlink-published-text', 'New link: #title# #url#' );
|
37 |
|
38 |
+
update_option( 'limit_categories','0' );
|
39 |
+
update_option( 'jd_twit_quickpress', '1' );
|
40 |
+
update_option( 'jd_shortener', '1' );
|
41 |
+
update_option( 'use_tags_as_hashtags', '0' );
|
42 |
+
update_option('jd_max_tags',3);
|
43 |
+
update_option('jd_max_characters',15);
|
44 |
+
update_option('jd_replace_character','_');
|
45 |
+
|
46 |
update_option( 'jd_twit_remote', '0' );
|
47 |
update_option( 'jd_post_excerpt', 30 );
|
48 |
// Use Google Analytics with Twitter
|
49 |
+
update_option( 'twitter-analytics-campaign', 'twitter' );
|
50 |
update_option( 'use-twitter-analytics', '0' );
|
51 |
+
update_option( 'jd_dynamic_analytics','0' );
|
52 |
+
update_option( 'use_dynamic_analytics','category' );
|
53 |
// Use custom external URLs to point elsewhere.
|
54 |
+
update_option( 'jd_twit_custom_url', 'external_link' );
|
|
|
|
|
|
|
|
|
55 |
// Error checking
|
56 |
update_option( 'jd_functions_checked','0' );
|
57 |
update_option( 'wp_twitter_failure','0' );
|
58 |
update_option( 'wp_url_failure','0' );
|
|
|
|
|
|
|
|
|
|
|
59 |
// Default publishing options.
|
60 |
update_option( 'jd_tweet_default', '0' );
|
61 |
// Note that default options are set.
|
62 |
+
update_option( 'twitterInitialised', '1' );
|
63 |
+
//Twitter API
|
64 |
+
update_option( 'jd_api_post_status', 'http://api.twitter.com/1/statuses/update.xml' );
|
65 |
+
update_option( 'jd-twitter-service-name', 'Twitter' );
|
66 |
+
update_option( 'jd-twitter-char-limit', 140 );
|
67 |
+
update_option( 'jd_use_both_services', '0' );
|
68 |
|
69 |
+
$message = __("Set your $twitter login information and URL shortener API information to use this plugin!", 'wp-to-twitter');
|
70 |
}
|
71 |
if ( get_option( 'twitterInitialised') == '1' && get_option( 'jd_post_excerpt' ) == "" ) {
|
72 |
update_option( 'jd_post_excerpt', 30 );
|
73 |
}
|
74 |
if ( get_option( 'twitterInitialised') == '1' && get_option( 'twitterpw' ) == "" ) {
|
75 |
+
$message .= __("Please <a href='#twitterpw'>add your Twitter password</a>. ", 'wp-to-twitter');
|
76 |
}
|
77 |
|
78 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'clear-error' ) {
|
81 |
$message = __("WP to Twitter Errors Cleared", 'wp-to-twitter');
|
82 |
}
|
83 |
|
84 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'service' ) {
|
85 |
+
if ( isset($_POST['jd_reset_services'] ) ) {
|
86 |
+
update_option( 'jd_api_post_status', 'http://api.twitter.com/1/statuses/update.xml' );
|
87 |
+
update_option( 'jd-twitter-service-name', 'Twitter' );
|
88 |
+
update_option( 'jd-twitter-char-limit', 140 );
|
89 |
+
update_option( 'jd_use_both_services', '0' );
|
90 |
+
update_option( 'x-twitterlogin','');
|
91 |
+
update_option( 'x-twitterpw','');
|
92 |
+
$message = __("Twitter API settings reset. You may need to change your username and password settings, if they are not the same as the alternate service previously in use.",'wp-to-twitter');
|
93 |
+
} else {
|
94 |
+
update_option( 'jd_api_post_status', $_POST['jd_api_post_status'] );
|
95 |
+
update_option( 'jd-twitter-service-name', $_POST['jd-twitter-service-name'] );
|
96 |
+
update_option( 'jd-twitter-char-limit', $_POST['jd-twitter-char-limit'] );
|
97 |
+
update_option( 'jd_use_both_services', $_POST['jd_use_both_services'] );
|
98 |
+
if ( !isset( $_POST['jd_use_both_services'] ) ) {
|
99 |
+
update_option( 'x-twitterlogin','');
|
100 |
+
update_option( 'x-twitterpw','');
|
101 |
+
}
|
102 |
+
$message = __("Twitter-compatible API settings updated. ",'wp-to-twitter');
|
103 |
+
if ( get_option( 'jd_use_both_services' ) == '1' ) {
|
104 |
+
$message .= __("You have configured WP to Twitter to use both Twitter and your selected service. Remember to add your username and login information for both services.");
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
// Error messages on status update or url shortener failures
|
110 |
if ( get_option( 'wp_twitter_failure' ) == '1' ) {
|
111 |
|
119 |
$wp_to_twitter_failure = '';
|
120 |
}
|
121 |
|
122 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'advanced' ) {
|
|
|
|
|
|
|
123 |
update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] );
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] );
|
125 |
update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] );
|
126 |
update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] );
|
128 |
update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] );
|
129 |
update_option( 'jd_twit_append', $_POST['jd_twit_append'] );
|
130 |
update_option( 'jd_shortener', $_POST['jd_shortener'] );
|
131 |
+
update_option( 'jd_post_excerpt', $_POST['jd_post_excerpt'] );
|
|
|
132 |
update_option('jd_max_tags',$_POST['jd_max_tags']);
|
133 |
update_option('jd_max_characters',$_POST['jd_max_characters']);
|
134 |
update_option('jd_replace_character',$_POST['jd_replace_character']);
|
135 |
+
update_option( 'jd_date_format',$_POST['jd_date_format'] );
|
136 |
+
update_option( 'jd_dynamic_analytics',$_POST['jd-dynamic-analytics'] );
|
137 |
+
update_option( 'use_dynamic_analytics',$_POST['use-dynamic-analytics'] );
|
138 |
+
|
139 |
+
if ( get_option( 'jd_shortener' ) == 2 && ( get_option( 'bitlylogin' ) == "" || get_option( 'bitlyapi' ) == "" ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
$message .= __( 'You must add your Bit.ly login and API key in order to shorten URLs with Bit.ly.' , 'wp-to-twitter');
|
141 |
$message .= "<br />";
|
142 |
}
|
143 |
+
if ( get_option( 'jd_shortener' ) == 6 && ( get_option( 'yourlslogin' ) == "" || get_option( 'yourlsapi' ) == "" || get_option( 'yourlsurl' ) == "" ) ) {
|
144 |
+
$message .= __( 'You must add your YOURLS remote URL, login, and password in order to shorten URLs with a remote installation of YOURLS.' , 'wp-to-twitter');
|
145 |
+
$message .= "<br />";
|
146 |
+
}
|
147 |
+
if ( get_option( 'jd_shortener' ) == 5 && ( get_option( 'yourlspath' ) == "" ) ) {
|
148 |
+
$message .= __( 'You must add your YOURLS server path in order to shorten URLs with a remote installation of YOURLS.' , 'wp-to-twitter');
|
149 |
+
$message .= "<br />";
|
150 |
+
}
|
151 |
update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] );
|
152 |
update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] );
|
153 |
update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] );
|
154 |
|
155 |
+
$message .= __( 'WP to Twitter Advanced Options Updated' , 'wp-to-twitter');
|
156 |
+
}
|
157 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) {
|
158 |
+
// UPDATE OPTIONS
|
159 |
+
update_option( 'newpost-published-update', $_POST['newpost-published-update'] );
|
160 |
+
update_option( 'newpost-published-text', $_POST['newpost-published-text'] );
|
161 |
+
update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] );
|
162 |
+
update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] );
|
163 |
+
update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] );
|
164 |
+
update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] );
|
165 |
+
update_option( 'newpage-published-text', $_POST['newpage-published-text'] );
|
166 |
+
update_option( 'oldpage-edited-text', $_POST['oldpage-edited-text'] );
|
167 |
+
update_option( 'newlink-published-text', $_POST['newlink-published-text'] );
|
168 |
+
update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] );
|
169 |
+
|
170 |
$message .= __( 'WP to Twitter Options Updated' , 'wp-to-twitter');
|
171 |
|
172 |
}
|
173 |
|
174 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'setcategories' ) {
|
175 |
+
|
176 |
+
if ( is_array($_POST['categories'])) {
|
177 |
+
$categories = serialize($_POST['categories']);
|
178 |
+
update_option('limit_categories','1');
|
179 |
+
update_option('tweet_categories',$categories);
|
180 |
+
$message = __("Category limits updated.");
|
181 |
+
} else {
|
182 |
+
update_option('limit_categories','0');
|
183 |
+
update_option('tweet_categories','');
|
184 |
+
$message = __("Category limits unset.",'wp-to-twitter');
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'login' ) {
|
190 |
//UPDATE LOGIN
|
191 |
if( ( $_POST['twitterlogin'] != '' ) && ( $_POST['twitterpw'] != '' ) ) {
|
192 |
update_option( 'twitterlogin', $_POST['twitterlogin'] );
|
193 |
update_option( 'twitterpw', $_POST['twitterpw'] );
|
194 |
update_option( 'twitterlogin_encrypted', base64_encode( $_POST['twitterlogin'].':'.$_POST['twitterpw'] ) );
|
195 |
+
$message = __("$twitter login and password updated. ", 'wp-to-twitter');
|
196 |
+
} else {
|
197 |
+
$message = __("You need to provide your $twitter login and password! ", 'wp-to-twitter');
|
198 |
+
}
|
199 |
+
}
|
200 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'x-login' ) {
|
201 |
+
//UPDATE LOGIN
|
202 |
+
if( ( $_POST['x-twitterlogin'] != '' ) && ( $_POST['x-twitterpw'] != '' ) ) {
|
203 |
+
update_option( 'x-twitterlogin', $_POST['x-twitterlogin'] );
|
204 |
+
update_option( 'x-twitterpw', $_POST['x-twitterpw'] );
|
205 |
$message = __("Twitter login and password updated. ", 'wp-to-twitter');
|
206 |
} else {
|
207 |
+
$message = __("You need to provide your Twitter login and password! ", 'wp-to-twitter');
|
208 |
}
|
209 |
}
|
210 |
|
211 |
+
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'yourlsapi' ) {
|
212 |
+
if ( $_POST['yourlsapi'] != '' && isset( $_POST['submit'] ) ) {
|
213 |
+
update_option( 'yourlsapi',$_POST['yourlsapi'] );
|
214 |
+
$message = __("YOURLS password updated. ", 'wp-to-twitter');
|
215 |
+
} else if ( isset( $_POST['clear'] ) ) {
|
216 |
+
update_option( 'yourlsapi','' );
|
217 |
+
$message = __( "YOURLS password deleted. You will be unable to use your remote YOURLS account to create short URLS.", 'wp-to-twitter');
|
218 |
+
} else {
|
219 |
+
$message = __( "Failed to save your YOURLS password! ", 'wp-to-twitter' );
|
220 |
+
}
|
221 |
+
if ( $_POST['yourlslogin'] != '' ) {
|
222 |
+
update_option( 'yourlslogin', $_POST['yourlslogin'] );
|
223 |
+
$message .= __( "YOURLS username added. ",'wp-to-twitter' );
|
224 |
+
}
|
225 |
+
if ( $_POST['yourlsurl'] != '' ) {
|
226 |
+
update_option( 'yourlsurl', $_POST['yourlsurl'] );
|
227 |
+
$message .= __( "YOURLS API url added. ",'wp-to-twitter' );
|
228 |
+
}
|
229 |
+
if ( $_POST['yourlspath'] != '' ) {
|
230 |
+
update_option( 'yourlspath', $_POST['yourlspath'] );
|
231 |
+
if ( file_exists( $_POST['yourlspath'] ) ) {
|
232 |
+
$message .= __( "YOURLS local server path added. ",'wp-to-twitter');
|
233 |
+
} else {
|
234 |
+
$message .= __( "The path to your YOURLS installation is not correct. ",'wp-to-twitter' );
|
235 |
+
}
|
236 |
+
}
|
237 |
+
}
|
238 |
+
|
239 |
if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'cligsapi' ) {
|
240 |
if ( $_POST['cligsapi'] != '' && isset( $_POST['submit'] ) ) {
|
241 |
update_option( 'cligsapi',$_POST['cligsapi'] );
|
274 |
}
|
275 |
// If you're attempting to solve the "settings page doesn't display" problem, begin your comment here.
|
276 |
|
277 |
+
|
278 |
+
|
279 |
+
if ( get_option('jd-functions-checked') == '0') {
|
280 |
+
$message = "<ul>";
|
|
|
|
|
|
|
|
|
281 |
// grab or set necessary variables
|
282 |
+
$testurl = urlencode( get_bloginfo( 'url' ) );
|
283 |
+
$shortener = get_option( 'jd_shortener' );
|
284 |
+
$passthrough = false;
|
|
|
|
|
|
|
285 |
|
286 |
+
switch ( $shortener ) {
|
287 |
+
case 0:
|
288 |
+
case 1:
|
289 |
+
$cligsapi = get_option( 'cligsapi' );
|
290 |
+
$shrink = jd_fetch_url( "http://cli.gs/api/v1/cligs/create?t=snoopy&appid=WP-to-Twitter&url=".$testurl."&key=".$cligsapi );
|
291 |
+
if (!$shrink) {
|
292 |
+
$shrink = false;
|
293 |
+
}
|
294 |
+
break;
|
295 |
+
case 2:
|
296 |
+
$bitlylogin = get_option( 'bitlylogin' );
|
297 |
+
$bitlyapi = get_option( 'bitlyapi' );
|
298 |
+
$decoded = jd_remote_json( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
|
299 |
+
if ($decoded) {
|
300 |
+
$shrink = $decoded['results'][urldecode($thispostlink)]['shortUrl'];
|
301 |
+
} else {
|
302 |
+
$shrink = false;
|
303 |
+
}
|
304 |
|
305 |
+
break;
|
306 |
+
case 3:
|
307 |
+
$passthrough = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
|
309 |
+
break;
|
310 |
+
case 4:
|
311 |
+
$passthrough = true;
|
312 |
+
|
313 |
+
break;
|
314 |
+
case 5:
|
315 |
+
// local YOURLS installation
|
316 |
+
global $yourls_reserved_URL;
|
317 |
+
define('YOURLS_INSTALLING', true); // Pretend we're installing YOURLS to bypass test for install or upgrade
|
318 |
+
define('YOURLS_FLOOD_DELAY_SECONDS', 0); // Disable flood check
|
319 |
+
if( file_exists( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' ) ) { // YOURLS 1.4
|
320 |
+
global $ydb;
|
321 |
+
require_once( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' );
|
322 |
+
$yourls_result = yourls_add_new_link( $testurl, '' );
|
323 |
+
} else { // YOURLS 1.3
|
324 |
+
require_once( get_option( 'yourlspath' ) );
|
325 |
+
$yourls_db = new wpdb( YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST );
|
326 |
+
$yourls_result = yourls_add_new_link( $testurl, '', $yourls_db );
|
327 |
+
}
|
328 |
+
if ($yourls_result) {
|
329 |
+
$shrink = $yourls_result['shorturl'];
|
330 |
+
} else {
|
331 |
+
$shrink = false;
|
332 |
+
}
|
333 |
+
break;
|
334 |
+
case 6:
|
335 |
+
// remote YOURLS installation
|
336 |
+
$yourlslogin = get_option( 'yourlslogin' );
|
337 |
+
$yourlsapi = get_option( 'yourlsapi' );
|
338 |
+
$api_url = sprintf( get_option('yourlsurl') . '?username=%s&password=%s&url=%s&format=json&action=shorturl',
|
339 |
+
$yourlslogin, $yourlsapi, $testurl );
|
340 |
+
$json = jd_remote_json( $api_url, false );
|
341 |
+
if ($json) {
|
342 |
+
$shrink = $json->shorturl;
|
343 |
+
} else {
|
344 |
+
$shrink = false;
|
345 |
+
}
|
346 |
+
break;
|
347 |
+
}
|
348 |
+
$api_url = $jdwp_api_post_status;
|
349 |
+
$yourls_URL = "";
|
350 |
+
|
351 |
+
if ($passthrough == true) {
|
352 |
+
$wp_shortener_error = FALSE;
|
353 |
+
$message .= __("<li><strong>Your selected URL shortener does not require testing.</strong></li>",'wp-to-twitter');
|
354 |
} else {
|
355 |
+
if ($shrink === FALSE) {
|
356 |
+
$message .= __("<li class=\"error\"><strong>WP to Twitter was unable to contact your selected URL shortening service.</strong></li>",'wp-to-twitter');
|
|
|
|
|
357 |
} else {
|
358 |
+
$wp_shortener_error = FALSE;
|
359 |
+
$message .= __("<li><strong>WP to Twitter successfully contacted your selected URL shortening service.</strong> The following link should point to your blog homepage:",'wp-to-twitter');
|
360 |
+
$message .= " <a href='$shrink'>$shrink</a></li>";
|
361 |
}
|
362 |
+
}
|
363 |
+
|
364 |
+
//check twitter credentials
|
365 |
+
$rand = rand(1000000,9999999);
|
366 |
+
$testpost = jd_doTwitterAPIPost( "This is a test of WP to Twitter. ($rand)" );
|
367 |
+
if ($testpost) {
|
368 |
+
$message .= __("<li><strong>WP to Twitter successfully submitted a status update to your primary update service.</strong></li>",'wp-to-twitter');
|
369 |
} else {
|
370 |
+
$wp_twitter_error = true;
|
371 |
+
$message .= __("<li class=\"error\"><strong>WP to Twitter failed to submit an update to your primary update service.</strong></li>",'wp-to-twitter');
|
372 |
+
}
|
373 |
+
if ( get_option( 'jd_use_both_services' ) == '1' ) {
|
374 |
+
$testpost2 = jd_doTwitterAPIPost( "This is a test of WP to Twitter.",false,"Twitter" );
|
375 |
+
if ($testpost2) {
|
376 |
+
$wp_twitter_error = true;
|
377 |
+
$message .= __("<li><strong>WP to Twitter successfully submitted a status update to your secondary update service.</strong></li>",'wp-to-twitter');
|
378 |
} else {
|
379 |
+
$message .= __("<li class=\"error\"><strong>WP to Twitter failed to submit an update to your secondary update service.</strong></li>",'wp-to-twitter');
|
380 |
+
}
|
381 |
}
|
382 |
+
|
383 |
// If everything's OK, there's no reason to do this again.
|
384 |
+
if ($wp_twitter_error == FALSE || $wp_shortener_error == FALSE ) {
|
385 |
$message .= __("<li><strong>Your server should run WP to Twitter successfully.</strong></li>", 'wp-to-twitter');
|
386 |
update_option( 'jd-functions-checked','1' );
|
387 |
} else {
|
388 |
+
$message .= __("<li class=\"error\"><strong>Your server does not appear to support the required methods for WP to Twitter to function.</strong> You can try it anyway - these tests aren't perfect - but no guarantees.</li>", 'wp-to-twitter');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
update_option( 'jd-functions-checked','1' );
|
390 |
}
|
391 |
+
$message .= "</ul>";
|
392 |
+
}
|
393 |
+
|
394 |
// CLOSE BUG FIX COMMENT HERE
|
395 |
?>
|
396 |
<?php if ( $wp_twitter_error == TRUE || ( $wp_cligs_error == TRUE && $wp_bitly_error == TRUE ) ) {
|
399 |
echo "</p></div>";
|
400 |
}
|
401 |
?>
|
402 |
+
|
403 |
+
<div class="wrap" id="wp-to-twitter">
|
404 |
<?php if ( $message ) { ?>
|
405 |
<div id="message" class="updated fade"><?php echo $message; ?></div>
|
406 |
<?php } ?>
|
407 |
<div id="dropmessage" class="updated" style="display:none;"></div>
|
|
|
|
|
|
|
408 |
<?php if (isset($_GET['export']) && $_GET['export'] == "settings") {
|
409 |
print_settings();
|
410 |
} ?>
|
411 |
|
412 |
<h2><?php _e("WP to Twitter Options", 'wp-to-twitter'); ?></h2>
|
413 |
+
<?php
|
414 |
+
$wp_to_twitter_directory = get_bloginfo( 'wpurl' ) . '/' . PLUGINDIR . '/' . dirname( plugin_basename(__FILE__) );
|
415 |
+
?>
|
416 |
<div class="resources">
|
417 |
+
<img src="<?php echo $wp_to_twitter_directory; ?>/wp-to-twitter-logo.png" alt="WP to Twitter" />
|
418 |
+
<p>
|
419 |
+
<a href="http://www.joedolson.com/articles/wp-to-twitter/support/"><?php _e("Get Support",'wp-to-twitter'); ?></a> ·
|
420 |
+
<a href="?page=wp-to-twitter/wp-to-twitter.php&export=settings"><?php _e("Export Settings",'wp-to-twitter'); ?></a> ·
|
421 |
+
<a href="http://www.joedolson.com/donate.php"><?php _e("Make a Donation",'wp-to-twitter'); ?></a>
|
422 |
+
</p>
|
423 |
+
<p>
|
424 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
425 |
<div>
|
426 |
<input type="hidden" name="cmd" value="_s-xclick" />
|
427 |
<input type="hidden" name="hosted_button_id" value="8490399" />
|
428 |
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" name="submit" alt="Donate" />
|
429 |
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
|
430 |
</div>
|
431 |
+
</form>
|
432 |
+
</p>
|
433 |
|
434 |
</div>
|
435 |
|
436 |
+
<p><?php _e("Shortcodes available in post update templates:", 'wp-to-twitter'); ?></p>
|
437 |
+
<ul>
|
438 |
+
<li><?php _e("<code>#title#</code>: the title of your blog post", 'wp-to-twitter'); ?></li>
|
439 |
+
<li><?php _e("<code>#blog#</code>: the title of your blog", 'wp-to-twitter'); ?></li>
|
440 |
+
<li><?php _e("<code>#post#</code>: a short excerpt of the post content", 'wp-to-twitter'); ?></li>
|
441 |
+
<li><?php _e("<code>#category#</code>: the first selected category for the post", 'wp-to-twitter'); ?></li>
|
442 |
+
<li><?php _e("<code>#date#</code>: the post date", 'wp-to-twitter'); ?></li>
|
443 |
+
<li><?php _e("<code>#url#</code>: the post URL", 'wp-to-twitter'); ?></li>
|
444 |
+
</ul>
|
445 |
+
<p><?php _e("You can also create custom shortcodes to access WordPress custom fields. Use doubled square brackets surrounding the name of your custom field to add the value of that custom field to your status update. Example: <code>[[custom_field]]</code></p>", 'wp-to-twitter'); ?>
|
446 |
|
447 |
<?php if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) { ?>
|
448 |
<div class="error">
|
461 |
</form>
|
462 |
<?php
|
463 |
}
|
464 |
+
?>
|
465 |
+
<div class="jd-settings">
|
466 |
+
<div id="poststuff" class="ui-sortable meta-box-sortables">
|
467 |
+
<?php if ( isset( $_POST['submit-type']) && $_POST['submit-type'] == 'options' ) { ?>
|
468 |
+
<div class="postbox">
|
469 |
+
<?php } else { ?>
|
470 |
+
<div class="postbox closed">
|
471 |
+
<?php } ?>
|
472 |
+
<div class="handlediv" title="Click to toggle"><br/></div>
|
473 |
+
<h3><?php _e('Basic Settings','wp-to-twitter'); ?></h3>
|
474 |
+
<div class="inside">
|
475 |
+
<br class="clear" />
|
476 |
<form method="post" action="">
|
477 |
<div>
|
478 |
<fieldset>
|
479 |
+
<legend><?php _e("Tweet Templates", 'wp-to-twitter'); ?></legend>
|
480 |
<p>
|
481 |
<input type="checkbox" name="newpost-published-update" id="newpost-published-update" value="1" <?php jd_checkCheckbox('newpost-published-update')?> />
|
482 |
<label for="newpost-published-update"><strong><?php _e("Update when a post is published", 'wp-to-twitter'); ?></strong></label> <label for="newpost-published-text"><br /><?php _e("Text for new post updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newpost-published-text" id="newpost-published-text" size="60" maxlength="120" value="<?php echo( attribute_escape( stripslashes( get_option( 'newpost-published-text' ) ) ) ); ?>" />
|
494 |
<input type="checkbox" name="jd_twit_edited_pages" id="jd_twit_edited_pages" value="1" <?php jd_checkCheckbox('jd_twit_edited_pages')?> />
|
495 |
<label for="jd_twit_edited_pages"><strong><?php _e("Update Twitter when WordPress Pages are edited", 'wp-to-twitter'); ?></strong></label><br /><label for="oldpage-edited-text"><?php _e("Text for page edit updates:", 'wp-to-twitter'); ?></label> <input type="text" name="oldpage-edited-text" id="oldpage-edited-text" size="60" maxlength="120" value="<?php echo( attribute_escape( stripslashes( get_option('oldpage-edited-text' ) ) ) ); ?>" />
|
496 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
<p>
|
498 |
<input type="checkbox" name="jd_twit_blogroll" id="jd_twit_blogroll" value="1" <?php jd_checkCheckbox('jd_twit_blogroll')?> />
|
499 |
<label for="jd_twit_blogroll"><strong><?php _e("Update Twitter when you post a Blogroll link", 'wp-to-twitter'); ?></strong></label><br />
|
500 |
<label for="newlink-published-text"><?php _e("Text for new link updates:", 'wp-to-twitter'); ?></label> <input type="text" name="newlink-published-text" id="newlink-published-text" size="60" maxlength="120" value="<?php echo ( attribute_escape( stripslashes( get_option( 'newlink-published-text' ) ) ) ); ?>" /><br /><small><?php _e('Available shortcodes: <code>#url#</code>, <code>#title#</code>, and <code>#description#</code>.','wp-to-twitter'); ?></small>
|
501 |
</p>
|
502 |
+
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
|
504 |
+
<div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
505 |
<input type="hidden" name="submit-type" value="options" />
|
506 |
</div>
|
507 |
+
<input type="submit" name="submit" value="<?php _e("Save WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary" />
|
|
|
|
|
508 |
</div>
|
509 |
</form>
|
510 |
+
</div>
|
511 |
+
</div>
|
512 |
+
</div>
|
513 |
+
<div id="poststuff" class="ui-sortable meta-box-sortables">
|
514 |
+
<?php if ( ( isset( $_POST['submit-type'] ) && ($_POST['submit-type']!='setcategories' && $_POST['submit-type']!='advanced' && $_POST['submit-type']!='options' && $_POST['submit-type']!="check-support" ) ) || get_option( 'twitterlogin' )=='' ) { ?>
|
515 |
+
<div class="postbox">
|
516 |
+
<?php } else { ?>
|
517 |
+
<div class="postbox closed">
|
518 |
+
<?php } ?> <div class="handlediv" title="Click to toggle"><br/></div>
|
519 |
+
<h3>Account Settings</h3>
|
520 |
|
521 |
+
<div class="inside">
|
522 |
+
|
523 |
+
<div class="panel">
|
524 |
+
<h4 class="twitter"><span><?php _e("Your $twitter account details", 'wp-to-twitter'); ?></span></h4>
|
525 |
|
526 |
<form method="post" action="" >
|
|
|
|
|
527 |
<div>
|
528 |
<p>
|
529 |
+
<label for="twitterlogin"><?php _e("Your $twitter username:", 'wp-to-twitter'); ?></label>
|
530 |
<input type="text" name="twitterlogin" id="twitterlogin" value="<?php echo ( attribute_escape( get_option( 'twitterlogin' ) ) ) ?>" />
|
531 |
</p>
|
532 |
<p>
|
533 |
+
<label for="twitterpw"><?php _e("Your $twitter password:", 'wp-to-twitter'); ?><?php if ( get_option( 'twitterpw' ) != "" ) { _e('(<em>Saved</em>)' , 'wp-to-twitter'); } ?></label>
|
534 |
<input type="password" name="twitterpw" id="twitterpw" value="" />
|
535 |
</p>
|
536 |
<input type="hidden" name="submit-type" value="login" />
|
537 |
+
<p><input type="submit" name="submit" value="<?php _e("Save $twitter Login Info", 'wp-to-twitter'); ?>" class="button-primary" /> <?php _e("» <small>Don't have a Twitter account? <a href='http://www.twitter.com'>Get one for free here</a>", 'wp-to-twitter'); ?></small></p>
|
538 |
+
</div>
|
539 |
+
</form>
|
540 |
+
</div>
|
541 |
+
<?php if ( get_option( 'jd_use_both_services' )=='1' ) { ?>
|
542 |
+
<div class="dualpost panel">
|
543 |
+
<h4 class="twitter"><span><?php _e("Your Twitter account details", 'wp-to-twitter'); ?></span></h4>
|
544 |
+
<p><?php _e("These are your settings for Twitter as a second update service."); ?></p>
|
545 |
+
<form method="post" action="" >
|
546 |
+
<div>
|
547 |
+
<p>
|
548 |
+
<label for="x-twitterlogin"><?php _e("Your Twitter username:", 'wp-to-twitter'); ?></label>
|
549 |
+
<input type="text" name="x-twitterlogin" id="x-twitterlogin" value="<?php echo ( attribute_escape( get_option( 'x-twitterlogin' ) ) ) ?>" />
|
550 |
+
</p>
|
551 |
+
<p>
|
552 |
+
<label for="x-twitterpw"><?php _e("Your Twitter password:", 'wp-to-twitter'); ?><?php if ( get_option( 'x-twitterpw' ) != "" ) { _e('(<em>Saved</em>)' , 'wp-to-twitter'); } ?></label>
|
553 |
+
<input type="password" name="x-twitterpw" id="x-twitterpw" value="" />
|
554 |
+
</p>
|
555 |
+
<input type="hidden" name="submit-type" value="x-login" />
|
556 |
<p><input type="submit" name="submit" value="<?php _e("Save Twitter Login Info", 'wp-to-twitter'); ?>" class="button-primary" /> <?php _e("» <small>Don't have a Twitter account? <a href='http://www.twitter.com'>Get one for free here</a>", 'wp-to-twitter'); ?></small></p>
|
557 |
</div>
|
558 |
</form>
|
559 |
+
</div>
|
560 |
+
<?php } ?>
|
561 |
+
<div class="panel">
|
562 |
+
<h4 class="cligs"><span><?php _e("Your Cli.gs account details", 'wp-to-twitter'); ?></span></h4>
|
563 |
|
564 |
<form method="post" action="">
|
|
|
|
|
565 |
<div>
|
566 |
<p>
|
567 |
<label for="cligsapi"><?php _e("Your Cli.gs <abbr title='application programming interface'>API</abbr> Key:", 'wp-to-twitter'); ?></label>
|
573 |
<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.", 'wp-to-twitter'); ?></small></p>
|
574 |
</div>
|
575 |
</form>
|
576 |
+
</div>
|
577 |
+
<div class="panel">
|
578 |
|
579 |
+
<h4 class="bitly"><span><?php _e("Your Bit.ly account details", 'wp-to-twitter'); ?></span></h4>
|
|
|
580 |
<form method="post" action="">
|
581 |
|
582 |
<div>
|
595 |
<p><input type="submit" name="submit" value="<?php _e('Save Bit.ly API Key','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear Bit.ly API Key','wp-to-twitter'); ?>" /><br /><small><?php _e("A Bit.ly API key and username is required to shorten URLs via the Bit.ly API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
|
596 |
</div>
|
597 |
</form>
|
598 |
+
</div>
|
599 |
+
<div class="panel">
|
600 |
+
<h4 class="yourls"><span><?php _e("Your YOURLS account details", 'wp-to-twitter'); ?></span></h4>
|
601 |
+
<form method="post" action="">
|
602 |
+
<div>
|
603 |
+
<p>
|
604 |
+
<label for="yourlspath"><?php _e('Path to the YOURLS config file (Local installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlspath" name="yourlspath" size="60" value="<?php echo ( attribute_escape( get_option( 'yourlspath' ) ) ); ?>"/>
|
605 |
+
<small><?php _e('Example:','wp-to-twitter'); ?> <code>/home/username/www/www/yourls/includes/config.php</code></small>
|
606 |
+
</p>
|
607 |
+
<p>
|
608 |
+
<label for="yourlsurl"><?php _e('URI to the YOURLS API (Remote installations)','wp-to-twitter'); ?></label> <input type="text" id="yourlsurl" name="yourlsurl" size="60" value="<?php echo ( attribute_escape( get_option( 'yourlsurl' ) ) ); ?>"/>
|
609 |
+
<small><?php _e('Example:','wp-to-twitter'); ?> <code>http://domain.com/yourls-api.php</code></small>
|
610 |
+
</p>
|
611 |
+
<p>
|
612 |
+
<label for="yourlslogin"><?php _e("Your YOURLS username:", 'wp-to-twitter'); ?></label>
|
613 |
+
<input type="text" name="yourlslogin" id="yourlslogin" value="<?php echo ( attribute_escape( get_option( 'yourlslogin' ) ) ) ?>" />
|
614 |
+
</p>
|
615 |
+
<p>
|
616 |
+
<label for="yourlsapi"><?php _e("Your YOURLS password:", 'wp-to-twitter'); ?> <?php if ( get_option( 'yourlsapi' ) != '') { _e("<em>Saved</em>",'wp-to-twitter'); } ?></label>
|
617 |
+
<input type="text" name="yourlsapi" id="yourlsapi" size="40" value="" />
|
618 |
+
</p>
|
619 |
|
620 |
+
<div>
|
621 |
+
<input type="hidden" name="submit-type" value="yourlsapi" />
|
622 |
+
</div>
|
623 |
+
<p><input type="submit" name="submit" value="<?php _e('Save YOURLS Account Info','wp-to-twitter'); ?>" class="button-primary" /> <input type="submit" name="clear" value="<?php _e('Clear YOURLS password','wp-to-twitter'); ?>" /><br /><small><?php _e("A YOURLS password and username is required to shorten URLs via the remote YOURLS API and WP to Twitter.", 'wp-to-twitter' ); ?></small></p>
|
624 |
+
</div>
|
625 |
+
</form>
|
626 |
+
</div>
|
627 |
+
<div class="change-service panel">
|
628 |
+
<h4 class="twitter-api"><?php _e("Change Twitter-compatible Service",'wp-to-twitter'); ?></h4>
|
629 |
+
<form method="post" action="" >
|
630 |
+
<div>
|
631 |
+
<p>
|
632 |
+
<label for="jd_api_post_status"><?php _e("URI for Twitter-compatible Post Status API","wp-to-twitter"); ?></label>
|
633 |
+
<input type="text" name="jd_api_post_status" id="jd_api_post_status" size="60" value="<?php echo get_option('jd_api_post_status'); ?>" />
|
634 |
+
</p>
|
635 |
+
<p>
|
636 |
+
<label for="jd-twitter-service-name"><?php _e("Service Name","wp-to-twitter"); ?></label>
|
637 |
+
<input type="text" name="jd-twitter-service-name" id="jd-twitter-service-name" value="<?php echo get_option( 'jd-twitter-service-name' ); ?>" />
|
638 |
+
</p>
|
639 |
+
<p>
|
640 |
+
<label for="jd-twitter-char-limit"><?php _e("Status Update Character Limit","wp-to-twitter"); ?></label>
|
641 |
+
<input type="text" name="jd-twitter-char-limit" id="jd-twitter-char-limit" value="<?php echo get_option( 'jd-twitter-char-limit' ); ?>" />
|
642 |
+
</p>
|
643 |
+
<p>
|
644 |
+
<input type="checkbox" name="jd_use_both_services" id="jd_use_both_services" value="1"<?php jd_checkCheckbox('jd_use_both_services'); ?> /> <label for="jd_use_both_services"><?php _e("Post status updates to both services.","wp-to-twitter"); ?></label>
|
645 |
+
</p>
|
646 |
+
<p>
|
647 |
+
<input type="checkbox" name="jd_reset_services" id="jd_reset_services" value="1" /> <label for="jd_reset_services"><?php _e("Reset to normal Twitter settings","wp-to-twitter"); ?></label>
|
648 |
+
</p>
|
649 |
+
<input type="hidden" name="submit-type" value="service" />
|
650 |
+
<p><input type="submit" name="submit" value="<?php _e("Update Twitter Compatible Service", 'wp-to-twitter'); ?>" class="button-primary" /> <?php _e("» <small>You can use any service using the Twitter-compatible REST API returning data in XML format with this plugin. Twitter-compatible services include <a href='http://identi.ca'>Identi.ca</a>, <a href='http://shoutem.com'>Shoutem.com</a> and <a href='http://chirup.com'>Chirup.com</a>. <strong>No support will be provided for services other than Twitter.</strong>", 'wp-to-twitter'); ?></small></p>
|
651 |
+
</div>
|
652 |
+
</form>
|
653 |
+
</div>
|
654 |
+
|
655 |
+
</div>
|
656 |
+
</div>
|
657 |
+
</div>
|
658 |
+
|
659 |
+
<div id="poststuff" class="ui-sortable meta-box-sortables">
|
660 |
+
<?php if ( isset( $_POST['submit-type']) && $_POST['submit-type']=='advanced') { ?>
|
661 |
+
<div class="postbox">
|
662 |
+
<?php } else { ?>
|
663 |
+
<div class="postbox closed">
|
664 |
+
<?php } ?>
|
665 |
+
|
666 |
+
<div class="handlediv" title="Click to toggle"><br/></div>
|
667 |
+
<h3><?php _e('Advanced Settings','wp-to-twitter'); ?></h3>
|
668 |
+
<div class="inside">
|
669 |
+
<br class="clear" />
|
670 |
+
<form method="post" action="">
|
671 |
+
<div>
|
672 |
+
|
673 |
+
<fieldset>
|
674 |
+
<legend><?php _e("Advanced Tweet settings","wp-to-twitter"); ?></legend>
|
675 |
+
<p>
|
676 |
+
<input type="checkbox" name="use_tags_as_hashtags" id="use_tags_as_hashtags" value="1" <?php jd_checkCheckbox('use_tags_as_hashtags')?> />
|
677 |
+
<label for="use_tags_as_hashtags"><?php _e("Add tags as hashtags on Tweets", 'wp-to-twitter'); ?></label>
|
678 |
+
<br /><label for="jd_replace_character"><?php _e("Spaces replaced with:",'wp-to-twitter'); ?></label> <input type="text" name="jd_replace_character" id="jd_replace_character" value="<?php echo attribute_escape( get_option('jd_replace_character') ); ?>" size="3" /><br />
|
679 |
+
<small><?php _e("Default replacement is an underscore (<code>_</code>). Use <code>[ ]</code> to remove spaces entirely.",'wp-to-twitter'); ?></small>
|
680 |
+
</p>
|
681 |
+
<p>
|
682 |
+
<label for="jd_max_tags"><?php _e("Maximum number of tags to include:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_tags" id="jd_max_tags" value="<?php echo attribute_escape( get_option('jd_max_tags') ); ?>" size="3" />
|
683 |
+
<label for="jd_max_characters"><?php _e("Maximum length in characters for included tags:",'wp-to-twitter'); ?></label> <input type="text" name="jd_max_characters" id="jd_max_characters" value="<?php echo attribute_escape( get_option('jd_max_characters') ); ?>" size="3" /><br />
|
684 |
+
<small><?php _e("These options allow you to restrict the length and number of WordPress tags sent to Twitter as hashtags. Set to <code>0</code> or leave blank to allow any and all tags.",'wp-to-twitter'); ?></small>
|
685 |
+
</p>
|
686 |
+
<p>
|
687 |
+
<label for="jd_post_excerpt"><?php _e("Length of post excerpt (in characters):", 'wp-to-twitter'); ?></label> <input type="text" name="jd_post_excerpt" id="jd_post_excerpt" size="3" maxlength="3" value="<?php echo ( attribute_escape( get_option( 'jd_post_excerpt' ) ) ) ?>" /><br /><small><?php _e("By default, extracted from the post itself. If you use the 'Excerpt' field, that will be used instead.", 'wp-to-twitter'); ?></small>
|
688 |
+
</p>
|
689 |
+
<p>
|
690 |
+
<label for="jd_date_format"><?php _e("WP to Twitter Date Formatting:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_date_format" id="jd_date_format" size="12" maxlength="12" value="<?php if (get_option('jd_date_format')=='') { echo ( attribute_escape( get_option('date_format') ) ); } else { echo ( attribute_escape( get_option( 'jd_date_format' ) ) ); }?>" /> (<?php if ( get_option( 'jd_date_format' ) != '' ) { echo date( get_option( 'jd_date_format' ) ); } else { echo date( get_option( 'date_format' ) ); } ?>)<br />
|
691 |
+
<small><?php _e("Default is from your general settings. <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>Date Formatting Documentation</a>.", 'wp-to-twitter'); ?></small>
|
692 |
+
</p>
|
693 |
+
|
694 |
+
<p>
|
695 |
+
<label for="jd_twit_prepend"><?php _e("Custom text before all Tweets:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_prepend" id="jd_twit_prepend" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_prepend' ) ) ) ?>" />
|
696 |
+
<label for="jd_twit_append"><?php _e("Custom text after all Tweets:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_append" id="jd_twit_append" size="20" maxlength="20" value="<?php echo ( attribute_escape( get_option( 'jd_twit_append' ) ) ) ?>" />
|
697 |
+
</p>
|
698 |
+
<p>
|
699 |
+
<label for="jd_twit_custom_url"><?php _e("Custom field for an alternate URL to be shortened and Tweeted:", 'wp-to-twitter'); ?></label> <input type="text" name="jd_twit_custom_url" id="jd_twit_custom_url" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'jd_twit_custom_url' ) ) ) ?>" /><br />
|
700 |
+
<small><?php _e("You can use a custom field to send an alternate URL for your post. The value is the name of a custom field containing your external URL.", 'wp-to-twitter'); ?></small>
|
701 |
+
</p>
|
702 |
+
</fieldset>
|
703 |
+
<fieldset>
|
704 |
+
<legend><?php _e( "Special Cases when WordPress should send a Tweet",'wp-to-twitter' ); ?></legend>
|
705 |
+
<p>
|
706 |
+
<input type="checkbox" name="jd_tweet_default" id="jd_tweet_default" value="1" <?php jd_checkCheckbox('jd_tweet_default')?> />
|
707 |
+
<label for="jd_tweet_default"><?php _e("Do not post status updates by default", 'wp-to-twitter'); ?></label><br />
|
708 |
+
<small><?php _e("By default, all posts meeting other requirements will be posted to Twitter. Check this to change your setting.", 'wp-to-twitter'); ?></small>
|
709 |
+
</p>
|
710 |
+
<p>
|
711 |
+
<input type="checkbox" name="jd_twit_remote" id="jd_twit_remote" value="1" <?php jd_checkCheckbox('jd_twit_remote')?> />
|
712 |
+
<label for="jd_twit_remote"><?php _e("Send Twitter Updates on remote publication (Post by Email or XMLRPC Client)", 'wp-to-twitter'); ?></label>
|
713 |
+
</p>
|
714 |
+
<p>
|
715 |
+
<input type="checkbox" name="jd_twit_quickpress" id="jd_twit_quickpress" value="1" <?php jd_checkCheckbox('jd_twit_quickpress')?> />
|
716 |
+
<label for="jd_twit_quickpress"><?php _e("Update Twitter when a post is published using QuickPress", 'wp-to-twitter'); ?></label>
|
717 |
+
</p>
|
718 |
+
</fieldset>
|
719 |
+
<fieldset>
|
720 |
+
<legend><?php _e( "Google Analytics Settings",'wp-to-twitter' ); ?></legend>
|
721 |
+
<p><?php _e("You can track the response from Twitter using Google Analytics by defining a campaign identifier here. You can either define a static identifier or a dynamic identifier. Static identifiers don't change from post to post; dynamic identifiers are derived from information relevant to the specific post. Dynamic identifiers will allow you to break down your statistics by an additional variable.","wp-to-twitter"); ?></p>
|
722 |
+
|
723 |
+
<p>
|
724 |
+
<input type="checkbox" name="use-twitter-analytics" id="use-twitter-analytics" value="1" <?php jd_checkCheckbox('use-twitter-analytics')?> />
|
725 |
+
<label for="use-twitter-analytics"><?php _e("Use a Static Identifier with WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
|
726 |
+
<label for="twitter-analytics-campaign"><?php _e("Static Campaign identifier for Google Analytics:", 'wp-to-twitter'); ?></label> <input type="text" name="twitter-analytics-campaign" id="twitter-analytics-campaign" size="40" maxlength="120" value="<?php echo ( attribute_escape( get_option( 'twitter-analytics-campaign' ) ) ) ?>" /><br />
|
727 |
+
</p>
|
728 |
+
<p>
|
729 |
+
<input type="checkbox" name="use-dynamic-analytics" id="use-dynamic-analytics" value="1" <?php jd_checkCheckbox('use_dynamic_analytics')?> />
|
730 |
+
<label for="use-dynamic-analytics"><?php _e("Use a dynamic identifier with Google Analytics and WP-to-Twitter", 'wp-to-twitter'); ?></label><br />
|
731 |
+
<label for="jd-dynamic-analytics"><?php _e("What dynamic identifier would you like to use?","wp-to-twitter"); ?></label><br />
|
732 |
+
<select name="jd-dynamic-analytics" id="jd-dynamic-analytics">
|
733 |
+
<option value="post_category"<?php jd_checkSelect( 'jd_dynamic_analytics','post_category'); ?>><?php _e("Category","wp-to-twitter"); ?></option>
|
734 |
+
<option value="post_ID"<?php jd_checkSelect( 'jd_dynamic_analytics','post_ID'); ?>><?php _e("Post ID","wp-to-twitter"); ?></option>
|
735 |
+
<option value="post_title"<?php jd_checkSelect( 'jd_dynamic_analytics','post_title'); ?>><?php _e("Post Title","wp-to-twitter"); ?></option>
|
736 |
+
<option value="post_author"<?php jd_checkSelect( 'jd_dynamic_analytics','post_author'); ?>><?php _e("Author","wp-to-twitter"); ?></option>
|
737 |
+
</select><br />
|
738 |
+
</p>
|
739 |
+
</fieldset>
|
740 |
+
<fieldset>
|
741 |
+
<legend><?php _e('Individual Authors','wp-to-twitter'); ?></legend>
|
742 |
+
<p>
|
743 |
+
<input type="checkbox" name="jd_individual_twitter_users" id="jd_individual_twitter_users" value="1" <?php jd_checkCheckbox('jd_individual_twitter_users')?> />
|
744 |
+
<label for="jd_individual_twitter_users"><?php _e("Authors have individual Twitter accounts", 'wp-to-twitter'); ?></label><br /><small><?php _e('Authors can set their own Twitter username and password in their user profile.', 'wp-to-twitter'); ?></small>
|
745 |
+
</p>
|
746 |
+
</fieldset>
|
747 |
+
<fieldset>
|
748 |
+
<legend><?php _e("Choose your short URL service",'wp-to-twitter' ); ?></legend>
|
749 |
+
<p>
|
750 |
+
<select name="jd_shortener" id="jd_shortener">
|
751 |
+
<option value="1" <?php jd_checkSelect('jd_shortener','1'); ?>><?php _e("Use Cli.gs for my URL shortener.", 'wp-to-twitter'); ?></option>
|
752 |
+
<option value="2" <?php jd_checkSelect('jd_shortener','2'); ?>><?php _e("Use Bit.ly for my URL shortener.", 'wp-to-twitter'); ?></option>
|
753 |
+
<option value="5" <?php jd_checkSelect('jd_shortener','5'); ?>><?php _e("YOURLS (installed on this server)", 'wp-to-twitter'); ?></option>
|
754 |
+
<option value="6" <?php jd_checkSelect('jd_shortener','6'); ?>><?php _e("YOURLS (installed on a remote server)", 'wp-to-twitter'); ?></option>
|
755 |
+
<option value="4" <?php jd_checkSelect('jd_shortener','4'); ?>><?php _e("Use WordPress as a URL shortener.", 'wp-to-twitter'); ?></option>
|
756 |
+
<option value="3" <?php jd_checkSelect('jd_shortener','3'); ?>><?php _e("Don't shorten URLs.", 'wp-to-twitter'); ?></option>
|
757 |
+
</select><br />
|
758 |
+
<small><?php _e("Using WordPress as a URL shortener will send URLs to Twitter in the default URL format for WordPress: <code>http://domain.com/subdir/?p=123</code>. Google Analytics is not available when using WordPress shortened URLs.", 'wp-to-twitter'); ?></small>
|
759 |
+
</p>
|
760 |
+
</fieldset>
|
761 |
+
<div>
|
762 |
+
<input type="hidden" name="submit-type" value="advanced" />
|
763 |
+
</div>
|
764 |
+
<input type="submit" name="submit" value="<?php _e("Save Advanced WP->Twitter Options", 'wp-to-twitter'); ?>" class="button-primary" />
|
765 |
+
</div>
|
766 |
+
</form>
|
767 |
+
</div>
|
768 |
+
</div>
|
769 |
+
</div>
|
770 |
+
<div id="poststuff" class="ui-sortable meta-box-sortables">
|
771 |
+
<?php if ( isset( $_POST['submit-type']) && $_POST['submit-type']=='setcategories') { ?>
|
772 |
+
<div class="postbox">
|
773 |
+
<?php } else { ?>
|
774 |
+
<div class="postbox closed">
|
775 |
+
<?php } ?>
|
776 |
+
|
777 |
+
<div class="handlediv" title="Click to toggle"><br/></div>
|
778 |
+
<h3><?php _e('Limit Updating Categories','wp-to-twitter'); ?></h3>
|
779 |
+
<div class="inside">
|
780 |
+
<br class="clear" />
|
781 |
+
<p>
|
782 |
+
<?php _e('Select which blog categories will be Tweeted. ','wp-to-twitter'); ?>
|
783 |
+
<?php
|
784 |
+
if ( get_option('limit_categories') == '0' ) {
|
785 |
+
_e('<em>Category limits are disabled.</em>','wp-to-twitter');
|
786 |
+
}
|
787 |
+
?>
|
788 |
+
</p>
|
789 |
+
<?php jd_list_categories(); ?>
|
790 |
+
|
791 |
+
</div>
|
792 |
+
</div>
|
793 |
+
</div>
|
794 |
|
795 |
<form method="post" action="">
|
796 |
<fieldset>
|
797 |
<input type="hidden" name="submit-type" value="check-support" />
|
798 |
<p>
|
799 |
+
<input type="submit" name="submit" value="<?php _e('Check Support','wp-to-twitter'); ?>" class="button-primary" /> <small><?php _e('Check whether your server supports <a href="http://www.joedolson.com/articles/wp-to-twitter/">WP to Twitter\'s</a> queries to the Twitter and URL shortening APIs. This test will send a status update to Twitter and shorten a URL using your selected methods.','wp-to-twitter'); ?></small>
|
800 |
</p>
|
801 |
</fieldset>
|
802 |
+
</form>
|
|
|
803 |
</div>
|
804 |
+
</div>
|
805 |
+
<?php global $wp_version; ?>
|
806 |
+
<script type="text/javascript">
|
807 |
+
<!--
|
808 |
+
<?php if ( version_compare( $wp_version, '2.7', '<' ) ) { ?>
|
809 |
+
jQuery('.postbox h3').prepend('<a class="togbox" title="expand this box">+</a> ');
|
810 |
+
<?php } ?>
|
811 |
+
jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
812 |
+
jQuery('.postbox .handlediv').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); } );
|
813 |
+
jQuery('.postbox.close-me').each(function() {
|
814 |
+
jQuery(this).addClass("closed");
|
815 |
+
});
|
816 |
+
//-->
|
817 |
+
</script>
|
wp-to-twitter.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP to Twitter
|
4 |
Plugin URI: http://www.joedolson.com/articles/wp-to-twitter/
|
5 |
Description: Updates Twitter when you create a new blog post or add to your blogroll using Cli.gs. With a Cli.gs API key, creates a clig in your Cli.gs account with the name of your post as the title.
|
6 |
-
Version:
|
7 |
Author: Joseph Dolson
|
8 |
Author URI: http://www.joedolson.com/
|
9 |
*/
|
@@ -23,26 +23,30 @@ Author URI: http://www.joedolson.com/
|
|
23 |
along with this program; if not, write to the Free Software
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
-
global $wp_version,$version,$jd_plugin_url;
|
27 |
|
28 |
$plugin_dir = basename(dirname(__FILE__));
|
29 |
load_plugin_textdomain( 'wp-to-twitter', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
$version = "
|
34 |
$jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
|
35 |
$jd_donate_url = "http://www.joedolson.com/donate.php";
|
36 |
|
37 |
if ( !defined( 'WP_PLUGIN_DIR' ) ) {
|
38 |
-
|
39 |
-
|
40 |
-
require_once( ABSPATH.WPINC.'/class-snoopy.php' );
|
41 |
|
42 |
// Check whether a supported version is in use.
|
43 |
-
$exit_msg='WP to Twitter requires WordPress 2.
|
44 |
|
45 |
-
if ( version_compare( $wp_version,"2.
|
46 |
exit ($exit_msg);
|
47 |
}
|
48 |
|
@@ -50,6 +54,8 @@ $exit_msg='WP to Twitter requires WordPress 2.5 or a more recent version. <a hre
|
|
50 |
require_once( WP_PLUGIN_DIR . '/wp-to-twitter/functions.php' );
|
51 |
|
52 |
function wptotwitter_activate() {
|
|
|
|
|
53 |
if ( get_option( 'jd-use-link-description' ) == 1 || get_option( 'jd-use-link-description' ) == 0 ) {
|
54 |
delete_option( 'jd-use-link-description' );
|
55 |
update_option( 'newlink-published-text', "New Link Posted: #description#" );
|
@@ -77,6 +83,7 @@ function wptotwitter_activate() {
|
|
77 |
if (get_option( 'jd_max_characters' ) == "" ) {
|
78 |
update_option( 'jd_max_characters', 5 );
|
79 |
}
|
|
|
80 |
}
|
81 |
|
82 |
// Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
|
@@ -89,13 +96,14 @@ function external_or_permalink( $post_ID ) {
|
|
89 |
return ( $ex_link ) ? $ex_link : $perma_link;
|
90 |
}
|
91 |
|
92 |
-
// This function performs the
|
93 |
-
|
94 |
-
|
|
|
95 |
//check if user login details have been entered on admin page
|
96 |
if ($authID == FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
|
97 |
-
|
98 |
-
|
99 |
} else {
|
100 |
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' ) != "" ) ) {
|
101 |
$thisuser = get_usermeta( $authID, 'wp-to-twitter-user-username' );
|
@@ -108,89 +116,33 @@ function jd_doTwitterAPIPost( $twit, $authID=FALSE ) {
|
|
108 |
if ($thisuser == '' || $thispass == '' || $twit == '' ) {
|
109 |
return FALSE;
|
110 |
} else {
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$tweet->rawheaders = array(
|
116 |
-
'X-Twitter-Client' => 'WP to Twitter'
|
117 |
-
, 'X-Twitter-Client-Version' => $version
|
118 |
-
, 'X-Twitter-Client-URL' => 'http://www.joedolson.com/scripts/wp-to-twitter.xml'
|
119 |
-
);
|
120 |
-
$tweet->user = $thisuser;
|
121 |
-
$tweet->pass = $thispass;
|
122 |
-
$tweet->submit(
|
123 |
-
JDWP_API_POST_STATUS
|
124 |
-
, array(
|
125 |
-
'status' => $twit
|
126 |
-
, 'source' => 'wptotwitter'
|
127 |
-
)
|
128 |
-
);
|
129 |
-
if (strpos($tweet->response_code, '200')) {
|
130 |
-
return TRUE;
|
131 |
} else {
|
132 |
-
|
133 |
-
return TRUE;
|
134 |
-
} else {
|
135 |
-
return FALSE;
|
136 |
-
}
|
137 |
}
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
147 |
}
|
148 |
}
|
149 |
-
// This function used to perform the API post to Twitter and now serves as a fallback.
|
150 |
-
function jd_old_doTwitterAPIPost( $twit, $authID=FALSE, $twitterURI="/statuses/update.xml" ) {
|
151 |
-
$host = 'twitter.com';
|
152 |
-
$port = 80;
|
153 |
-
$fp = @fsockopen($host, $port, $err_num, $err_msg, 10);
|
154 |
-
|
155 |
-
//check if user login details have been entered on admin page
|
156 |
-
if ($authID === FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
|
157 |
-
$thisLoginDetails = get_option( 'twitterlogin_encrypted' );
|
158 |
-
} else {
|
159 |
-
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' )!="" ) {
|
160 |
-
$thisLoginDetails = get_usermeta( $authID, 'wp-to-twitter-encrypted' );
|
161 |
-
} else {
|
162 |
-
$thisLoginDetails = get_option( 'twitterlogin_encrypted' );
|
163 |
-
}
|
164 |
-
}
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
return FALSE;
|
170 |
-
} else {
|
171 |
-
if (!fputs( $fp, "POST $twitterURI HTTP/1.1\r\n" )) {
|
172 |
-
return FALSE;
|
173 |
-
}
|
174 |
-
fputs( $fp, "Authorization: Basic ".$thisLoginDetails."\r\n" );
|
175 |
-
fputs( $fp, "User-Agent: ".$agent."\n" );
|
176 |
-
fputs( $fp, "Host: $host\n" );
|
177 |
-
fputs( $fp, "Content-type: application/x-www-form-urlencoded\n" );
|
178 |
-
fputs( $fp, "Content-length: ".mb_strlen( $twit )."\n" );
|
179 |
-
fputs( $fp, "Connection: close\n\n" );
|
180 |
-
fputs( $fp, $twit );
|
181 |
-
for ( $i = 1; $i < 10; $i++ ) {
|
182 |
-
$reply = fgets( $fp, 256 );
|
183 |
-
}
|
184 |
-
fclose( $fp );
|
185 |
-
return TRUE;
|
186 |
-
}
|
187 |
} else {
|
188 |
-
|
189 |
}
|
190 |
-
}
|
191 |
-
|
192 |
-
function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $thisposturl, $thispostcategory, $thisdate, $authID=FALSE ) {
|
193 |
-
|
194 |
$sentence = trim($sentence);
|
195 |
$thisposttitle = trim($thisposttitle);
|
196 |
$thisblogtitle = trim($thisblogtitle);
|
@@ -240,13 +192,13 @@ $length_array['thisposttitle'] = mb_strlen($thisposttitle);
|
|
240 |
$length_array['thispostcategory'] = mb_strlen($thispostcategory);
|
241 |
$length_array['thisdate'] = mb_strlen($thisdate);
|
242 |
|
243 |
-
if ($str_length >
|
244 |
foreach($length_array AS $key=>$value) {
|
245 |
-
if (($str_length >
|
246 |
-
$trim = $str_length -
|
247 |
$old_value = ${$key};
|
248 |
-
$new_value = mb_substr($old_value,0,-($trim));
|
249 |
-
$post_sentence = str_ireplace($old_value,$new_value,$post_sentence);
|
250 |
$str_length = mb_strlen( urldecode( $post_sentence ) );
|
251 |
} else {
|
252 |
}
|
@@ -257,14 +209,33 @@ return $sentence;
|
|
257 |
}
|
258 |
|
259 |
function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID ) {
|
260 |
-
|
261 |
$cligsapi = get_option( 'cligsapi' );
|
262 |
$bitlyapi = get_option( 'bitlyapi' );
|
263 |
$bitlylogin = get_option( 'bitlylogin' );
|
264 |
-
$
|
|
|
265 |
|
266 |
-
if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
$this_campaign = get_option('twitter-analytics-campaign');
|
|
|
|
|
|
|
268 |
if ( strpos( $thispostlink,"%3F" ) === FALSE) {
|
269 |
$thispostlink .= urlencode("?");
|
270 |
} else {
|
@@ -278,35 +249,51 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID ) {
|
|
278 |
switch ( get_option( 'jd_shortener' ) ) {
|
279 |
case 0:
|
280 |
case 1:
|
281 |
-
|
282 |
-
$shrink = trim($snoopy->results);
|
283 |
-
} else {
|
284 |
-
$shrink = @file_get_contents( "http://cli.gs/api/v1/cligs/create?t=fgc&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi );
|
285 |
-
}
|
286 |
-
if ( $shrink === FALSE ) {
|
287 |
-
$shrink = getfilefromurl( "http://cli.gs/api/v1/cligs/create?t=gffu&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi);
|
288 |
-
}
|
289 |
break;
|
290 |
case 2:
|
291 |
-
|
292 |
-
$shrink = $snoopy->results;
|
293 |
-
} else {
|
294 |
-
$shrink = @file_get_contents( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
|
295 |
-
}
|
296 |
-
if ( $shrink === FALSE ) {
|
297 |
-
$shrink = getfilefromurl( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
|
298 |
-
}
|
299 |
-
|
300 |
-
$decoded = json_decode($shrink,TRUE);
|
301 |
$shrink = $decoded['results'][urldecode($thispostlink)]['shortUrl'];
|
302 |
-
//die(print_r($decoded['results'][urldecode($thispostlink)]));
|
303 |
break;
|
304 |
case 3:
|
305 |
-
$shrink = $thispostlink;
|
306 |
break;
|
307 |
case 4:
|
308 |
$shrink = get_bloginfo('url') . "/?p=" . $post_ID;
|
309 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
if ( $shrink === FALSE || ( stristr( $shrink, "http://" ) === FALSE )) {
|
312 |
update_option( 'wp_url_failure','1' );
|
@@ -317,13 +304,50 @@ function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID ) {
|
|
317 |
|
318 |
function jd_expand_url( $short_url ) {
|
319 |
$short_url = urlencode( $short_url );
|
320 |
-
$
|
321 |
-
$snoopy->fetch( "http://api.longurl.org/v2/expand?format=json&url=" . $short_url );
|
322 |
-
$longurl = $snoopy->results;
|
323 |
-
$decoded = json_decode( $longurl, TRUE );
|
324 |
$url = $decoded['long-url'];
|
325 |
return $url;
|
326 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
|
328 |
function jd_twit( $post_ID ) {
|
329 |
$jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
|
@@ -343,8 +367,11 @@ function jd_twit( $post_ID ) {
|
|
343 |
$category = null;
|
344 |
$categories = get_the_category( $post_ID );
|
345 |
if ( $categories > 0 ) {
|
346 |
-
$category = $categories[0]->cat_name;
|
347 |
}
|
|
|
|
|
|
|
348 |
|
349 |
$excerpt_length = get_option( 'jd_post_excerpt' );
|
350 |
if ( trim( $get_post_info->post_excerpt ) == "" ) {
|
@@ -400,8 +427,13 @@ function jd_twit( $post_ID ) {
|
|
400 |
if ( $sentence != '' ) {
|
401 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
402 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
403 |
-
}
|
404 |
-
|
|
|
|
|
|
|
|
|
|
|
405 |
if ( $sendToTwitter === FALSE ) {
|
406 |
update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
|
407 |
update_option( 'wp_twitter_failure','1' );
|
@@ -476,7 +508,13 @@ if (($get_post_info->post_status == 'publish' || $_POST['publish'] == 'Publish')
|
|
476 |
}
|
477 |
}
|
478 |
if ( $sentence != '' ) {
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
if ( $sendToTwitter === FALSE ) {
|
481 |
update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
|
482 |
update_option( 'wp_twitter_failure','1' );
|
@@ -517,8 +555,13 @@ global $version;
|
|
517 |
$sentence = str_ireplace("#url#",$shrink,$sentence);
|
518 |
}
|
519 |
if ( $sentence != '' ) {
|
520 |
-
|
521 |
-
|
|
|
|
|
|
|
|
|
|
|
522 |
update_option('wp_twitter_failure','2');
|
523 |
}
|
524 |
}
|
@@ -549,7 +592,9 @@ function jd_twit_future( $post_ID ) {
|
|
549 |
if ( $categories > 0 ) {
|
550 |
$category = $categories[0]->cat_name;
|
551 |
}
|
552 |
-
|
|
|
|
|
553 |
if ( $jd_tweet_this == "yes" ) {
|
554 |
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
555 |
$thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
|
@@ -577,8 +622,13 @@ function jd_twit_future( $post_ID ) {
|
|
577 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
578 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
579 |
}
|
580 |
-
|
581 |
-
|
|
|
|
|
|
|
|
|
|
|
582 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
583 |
update_option( 'wp_twitter_failure','1' );
|
584 |
}
|
@@ -622,8 +672,13 @@ function jd_twit_quickpress( $post_ID ) {
|
|
622 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
623 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
624 |
}
|
625 |
-
|
626 |
-
|
|
|
|
|
|
|
|
|
|
|
627 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
628 |
update_option( 'wp_twitter_failure','1' );
|
629 |
}
|
@@ -655,7 +710,10 @@ function jd_twit_xmlrpc( $post_ID ) {
|
|
655 |
$categories = get_the_category( $post_ID );
|
656 |
if ( $categories > 0 ) {
|
657 |
$category = $categories[0]->cat_name;
|
658 |
-
}
|
|
|
|
|
|
|
659 |
$excerpt_length = get_option( 'jd_post_excerpt' );
|
660 |
if ( trim( $get_post_info->post_excerpt ) == "" ) {
|
661 |
$thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
|
@@ -676,13 +734,17 @@ function jd_twit_xmlrpc( $post_ID ) {
|
|
676 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
677 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
678 |
}
|
679 |
-
|
680 |
-
|
681 |
-
if (
|
|
|
|
|
|
|
|
|
682 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
|
683 |
update_option('wp_twitter_failure','1');
|
684 |
-
}
|
685 |
}
|
|
|
686 |
}
|
687 |
return $post_ID;
|
688 |
}
|
@@ -708,9 +770,15 @@ function store_url($post_ID, $url) {
|
|
708 |
if ( get_post_meta ( $post_ID, 'wp_jd_wp', TRUE ) != $url ) {
|
709 |
update_post_meta ( $post_ID, 'wp_jd_wp', $url );
|
710 |
}
|
|
|
|
|
|
|
|
|
711 |
}
|
712 |
if ( get_option( 'jd_shortener' ) == 0 || get_option( 'jd_shortener' ) == 1 || get_option( 'jd_shortener' ) == 2 ) {
|
713 |
$target = jd_expand_url( $url );
|
|
|
|
|
714 |
} else {
|
715 |
$target = $url;
|
716 |
}
|
@@ -774,7 +842,16 @@ jd_add_twitter_inner_box();
|
|
774 |
}
|
775 |
|
776 |
function jd_add_twitter_inner_box() {
|
777 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
778 |
global $post, $jd_plugin_url;
|
779 |
$post_id = $post;
|
780 |
if (is_object($post_id)) {
|
@@ -792,9 +869,16 @@ global $post, $jd_plugin_url;
|
|
792 |
$shortener = "Bit.ly";
|
793 |
}
|
794 |
if ( $jd_short == "" ) {
|
795 |
-
$jd_short = get_post_meta( $post_id, '
|
796 |
$shortener = "WordPress";
|
797 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
798 |
$jd_expansion = get_post_meta( $post_id, 'wp_jd_target', true );
|
799 |
?>
|
800 |
<script type="text/javascript">
|
@@ -805,12 +889,16 @@ cntfield.value = field.value.length;
|
|
805 |
// End -->
|
806 |
</script>
|
807 |
<p>
|
808 |
-
<label for="jd_twitter"><?php _e(
|
809 |
onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
|
810 |
onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo attribute_escape( $jd_twitter ); ?></textarea>
|
811 |
</p>
|
812 |
<p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo attribute_escape( mb_strlen( $description) ); ?>" />
|
813 |
-
<?php
|
|
|
|
|
|
|
|
|
814 |
</p>
|
815 |
<p>
|
816 |
<input type="checkbox" name="jd_tweet_this" value="no"<?php echo attribute_escape( $jd_selected ); ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label>
|
@@ -819,6 +907,8 @@ cntfield.value = field.value.length;
|
|
819 |
<?php
|
820 |
if ( $jd_short != "" ) {
|
821 |
_e("The previously-posted $shortener URL for this post is <code>$jd_short</code>, which points to <code>$jd_expansion</code>.", 'wp-to-twitter');
|
|
|
|
|
822 |
}
|
823 |
?>
|
824 |
</p>
|
@@ -853,34 +943,56 @@ function post_jd_twitter( $id ) {
|
|
853 |
|
854 |
|
855 |
function jd_twitter_profile() {
|
|
|
|
|
|
|
|
|
|
|
856 |
global $user_ID;
|
857 |
get_currentuserinfo();
|
858 |
-
if( $_GET['user_id'] )
|
859 |
-
|
|
|
860 |
$is_enabled = get_usermeta( $user_ID, 'wp-to-twitter-enable-user' );
|
861 |
$twitter_username = get_usermeta( $user_ID, 'wp-to-twitter-user-username' );
|
862 |
$twitter_password = get_usermeta( $user_ID, 'wp-to-twitter-user-password' );
|
863 |
-
|
|
|
864 |
?>
|
865 |
<h3><?php _e('WP to Twitter User Settings', 'wp-to-twitter'); ?></h3>
|
866 |
|
867 |
<table class="form-table">
|
868 |
<tr>
|
869 |
-
<th scope="row"><?php _e(
|
870 |
-
<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(
|
871 |
-
<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(
|
872 |
-
<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(
|
873 |
</tr>
|
874 |
<tr>
|
875 |
-
<th scope="row"><label for="wp-to-twitter-user-username"><?php _e(
|
876 |
<td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo attribute_escape( $twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.', 'wp-to-twitter'); ?></td>
|
877 |
</tr>
|
878 |
<tr>
|
879 |
-
<th scope="row"><label for="wp-to-twitter-user-password"><?php _e(
|
880 |
-
<td><input type="password" name="wp-to-twitter-user-password" id="wp-to-twitter-user-password" value="" /> <?php _e('Enter your own Twitter password.', 'wp-to-twitter'); ?></td>
|
881 |
</tr>
|
882 |
</table>
|
883 |
-
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
}
|
885 |
|
886 |
function custom_shortcodes( $sentence, $post_ID ) {
|
@@ -903,7 +1015,9 @@ function custom_shortcodes( $sentence, $post_ID ) {
|
|
903 |
function jd_twitter_save_profile(){
|
904 |
global $user_ID;
|
905 |
get_currentuserinfo();
|
906 |
-
if( $
|
|
|
|
|
907 |
update_usermeta($user_ID ,'wp-to-twitter-enable-user' , $_POST['wp-to-twitter-enable-user'] );
|
908 |
update_usermeta($user_ID ,'wp-to-twitter-user-username' , $_POST['wp-to-twitter-user-username'] );
|
909 |
if ( $_POST['wp-to-twitter-user-password'] != '' ) {
|
@@ -912,6 +1026,33 @@ function jd_twitter_save_profile(){
|
|
912 |
update_usermeta($user_ID ,'wp-to-twitter-encrypted' , base64_encode( $_POST['wp-to-twitter-user-username'].':'.$_POST['wp-to-twitter-user-password'] ) );
|
913 |
}
|
914 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
915 |
// Add the administrative settings to the "Settings" menu.
|
916 |
function jd_addTwitterAdminPages() {
|
917 |
if ( function_exists( 'add_submenu_page' ) ) {
|
@@ -924,55 +1065,28 @@ function jd_addTwitterAdminStyles() {
|
|
924 |
echo "
|
925 |
<style type=\"text/css\">
|
926 |
<!--
|
927 |
-
#wp-to-twitter
|
928 |
-
|
929 |
-
padding:
|
930 |
-
margin: 25px 0;
|
931 |
-
border: 1px solid #ddd;
|
932 |
-
-moz-border-radius: 3px;
|
933 |
-
-webkit-border-radius: 3px;
|
934 |
-
border-radius: 3px;
|
935 |
-
}
|
936 |
-
#wp-to-twitter fieldset {
|
937 |
-
background: #eaf3fa;
|
938 |
-
padding: 10px;
|
939 |
-
border: 1px solid #ccc;
|
940 |
-
-moz-border-radius: 5px;
|
941 |
-
-webkit-border-radius: 5px;
|
942 |
-
border-radius: 5px;
|
943 |
-
margin: 5px 0;
|
944 |
}
|
945 |
-
#wp-to-twitter
|
946 |
-
clear:
|
947 |
-
max-width: 800px;
|
948 |
}
|
949 |
#wp-to-twitter form .error p {
|
950 |
background: none;
|
951 |
border: none;
|
952 |
}
|
953 |
-
.floatright {
|
954 |
-
float: right;
|
955 |
-
}
|
956 |
-
.cligs, .bitly {
|
957 |
-
padding: 2px!important;
|
958 |
-
margin-top: 1.5em!important;
|
959 |
-
}
|
960 |
-
.twitter {
|
961 |
-
padding: 2px!important;
|
962 |
-
margin-top: 1.5em!important;
|
963 |
-
}
|
964 |
legend {
|
965 |
font-weight: 700;
|
966 |
-
font-size: 1.
|
967 |
-
padding: 0
|
968 |
-
border-left: 2px solid #ccc;
|
969 |
-
border-right: 2px solid #ccc;
|
970 |
}
|
971 |
.resources {
|
972 |
float: right;
|
973 |
border: 1px solid #aaa;
|
974 |
padding: 10px 10px 0;
|
975 |
margin-left: 10px;
|
|
|
976 |
-moz-border-radius: 5px;
|
977 |
-webkit-border-radius: 5px;
|
978 |
border-radius: 5px;
|
@@ -988,6 +1102,12 @@ background: #fff;
|
|
988 |
padding: 10px;
|
989 |
border: 1px solid #000;
|
990 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
991 |
-->
|
992 |
</style>";
|
993 |
}
|
@@ -1004,6 +1124,23 @@ function plugin_action($links, $file) {
|
|
1004 |
$links[] = "<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>" . __('Settings', 'wp-to-twitter', 'wp-to-twitter') . "</a>";
|
1005 |
return $links;
|
1006 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1007 |
|
1008 |
//Add Plugin Actions to WordPress
|
1009 |
|
@@ -1014,8 +1151,7 @@ if ( get_option( 'jd_individual_twitter_users')=='1') {
|
|
1014 |
add_action( 'edit_user_profile', 'jd_twitter_profile' );
|
1015 |
add_action( 'profile_update', 'jd_twitter_save_profile');
|
1016 |
}
|
1017 |
-
|
1018 |
-
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_cligs_failure' ) == '1' ) {
|
1019 |
add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>';_e('There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message.','wp-to-twitter'); echo '</p></div>';" ) );
|
1020 |
}
|
1021 |
if ( get_option( 'jd_twit_pages' )=='1' ) {
|
@@ -1048,5 +1184,8 @@ add_action( 'save_post','post_jd_twitter' );
|
|
1048 |
add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
|
1049 |
|
1050 |
register_activation_hook( __FILE__, 'wptotwitter_activate' );
|
|
|
|
|
|
|
1051 |
|
1052 |
?>
|
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: 2.0.0
|
7 |
Author: Joseph Dolson
|
8 |
Author URI: http://www.joedolson.com/
|
9 |
*/
|
23 |
along with this program; if not, write to the Free Software
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
+
global $wp_version,$version,$jd_plugin_url,$jdwp_api_post_status;
|
27 |
|
28 |
$plugin_dir = basename(dirname(__FILE__));
|
29 |
load_plugin_textdomain( 'wp-to-twitter', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
|
30 |
|
31 |
+
if ( get_option('jd_api_post_status') == '' ) {
|
32 |
+
$jdwp_api_post_status = "http://twitter.com/statuses/update.json";
|
33 |
+
} else {
|
34 |
+
$jdwp_api_post_status = get_option( 'jd_api_post_status' );
|
35 |
+
}
|
36 |
|
37 |
+
$version = "2.0.0";
|
38 |
$jd_plugin_url = "http://www.joedolson.com/articles/wp-to-twitter/";
|
39 |
$jd_donate_url = "http://www.joedolson.com/donate.php";
|
40 |
|
41 |
if ( !defined( 'WP_PLUGIN_DIR' ) ) {
|
42 |
+
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
|
43 |
+
}
|
44 |
+
//require_once( ABSPATH.WPINC.'/class-snoopy.php' );
|
45 |
|
46 |
// Check whether a supported version is in use.
|
47 |
+
$exit_msg='WP to Twitter requires WordPress 2.7 or a more recent version. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update your WordPress version!</a>';
|
48 |
|
49 |
+
if ( version_compare( $wp_version,"2.7","<" )) {
|
50 |
exit ($exit_msg);
|
51 |
}
|
52 |
|
54 |
require_once( WP_PLUGIN_DIR . '/wp-to-twitter/functions.php' );
|
55 |
|
56 |
function wptotwitter_activate() {
|
57 |
+
global $version;
|
58 |
+
if ( version_compare( $version,"1.5.6","<" )) {
|
59 |
if ( get_option( 'jd-use-link-description' ) == 1 || get_option( 'jd-use-link-description' ) == 0 ) {
|
60 |
delete_option( 'jd-use-link-description' );
|
61 |
update_option( 'newlink-published-text', "New Link Posted: #description#" );
|
83 |
if (get_option( 'jd_max_characters' ) == "" ) {
|
84 |
update_option( 'jd_max_characters', 5 );
|
85 |
}
|
86 |
+
}
|
87 |
}
|
88 |
|
89 |
// Function checks for an alternate URL to be tweeted. Contribution by Bill Berry.
|
96 |
return ( $ex_link ) ? $ex_link : $perma_link;
|
97 |
}
|
98 |
|
99 |
+
// This function performs the API post to Twitter
|
100 |
+
|
101 |
+
function jd_doTwitterAPIPost( $twit, $authID=FALSE, $service="basic" ) {
|
102 |
+
global $version, $jd_plugin_url, $jdwp_api_post_status;
|
103 |
//check if user login details have been entered on admin page
|
104 |
if ($authID == FALSE || ( get_option( 'jd_individual_twitter_users' ) != '1' ) ) {
|
105 |
+
$thisuser = get_option( 'twitterlogin' );
|
106 |
+
$thispass = get_option( 'twitterpw' );
|
107 |
} else {
|
108 |
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' ) != "" ) ) {
|
109 |
$thisuser = get_usermeta( $authID, 'wp-to-twitter-user-username' );
|
116 |
if ($thisuser == '' || $thispass == '' || $twit == '' ) {
|
117 |
return FALSE;
|
118 |
} else {
|
119 |
+
if ( $service == "Twitter" ) {
|
120 |
+
$api_url = "http://api.twitter.com/1/statuses/update.xml";
|
121 |
+
$thisuser = get_option( 'x-twitterlogin' );
|
122 |
+
$thispass = get_option( 'x-twitterpw' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
} else {
|
124 |
+
$api_url = $jdwp_api_post_status;
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
+
$twit = urldecode( $twit );
|
127 |
+
$body = array( 'status'=>$twit, 'source'=>'wptotwitter' );
|
128 |
+
$headers = array( 'Authorization' => 'Basic '.base64_encode("$thisuser:$thispass"),
|
129 |
+
'X-Twitter-Client'=>'WP to Twitter',
|
130 |
+
'X-Twitter-Client-Version' => $version,
|
131 |
+
'X-Twitter-Client-URL' => 'http://www.joedolson.com/scripts/wp-to-twitter.xml'
|
132 |
+
);
|
133 |
+
$result = jd_fetch_url( $jdwp_api_post_status, 'POST', $body, $headers );
|
134 |
+
// Basic check for success or failure: if body contains <error>some string</error>, not good
|
135 |
+
//return ( preg_match_all('!<error>[^<]+</error>!', $result, $matches) !== 1 );
|
136 |
+
return $result;
|
137 |
}
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
function jd_truncate_tweet( $sentence, $thisposttitle, $thisblogtitle, $thispostexcerpt, $thisposturl, $thispostcategory, $thisdate, $authID=FALSE ) {
|
141 |
+
if ( get_option('jd-twitter-char-limit') == '' ) {
|
142 |
+
$post_length = 140;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
} else {
|
144 |
+
$post_length = (int) get_option('jd-twitter-char-limit');
|
145 |
}
|
|
|
|
|
|
|
|
|
146 |
$sentence = trim($sentence);
|
147 |
$thisposttitle = trim($thisposttitle);
|
148 |
$thisblogtitle = trim($thisblogtitle);
|
192 |
$length_array['thispostcategory'] = mb_strlen($thispostcategory);
|
193 |
$length_array['thisdate'] = mb_strlen($thisdate);
|
194 |
|
195 |
+
if ( $str_length > $post_length ) {
|
196 |
foreach($length_array AS $key=>$value) {
|
197 |
+
if ( ( $str_length > $post_length ) && ($str_length - $value) < $post_length ) {
|
198 |
+
$trim = $str_length - $post_length;
|
199 |
$old_value = ${$key};
|
200 |
+
$new_value = mb_substr( $old_value,0,-( $trim ) );
|
201 |
+
$post_sentence = str_ireplace( $old_value,$new_value,$post_sentence );
|
202 |
$str_length = mb_strlen( urldecode( $post_sentence ) );
|
203 |
} else {
|
204 |
}
|
209 |
}
|
210 |
|
211 |
function jd_shorten_link( $thispostlink, $thisposttitle, $post_ID ) {
|
|
|
212 |
$cligsapi = get_option( 'cligsapi' );
|
213 |
$bitlyapi = get_option( 'bitlyapi' );
|
214 |
$bitlylogin = get_option( 'bitlylogin' );
|
215 |
+
$yourlslogin = get_option( 'yourlslogin');
|
216 |
+
$yourlsapi = get_option( 'yourlsapi' );
|
217 |
|
218 |
+
if ( ( get_option('twitter-analytics-campaign') != '' ) && ( get_option('use-twitter-analytics') == 1 || get_option('use_dynamic_analytics') == 1 ) ) {
|
219 |
+
if ( get_option('use_dynamic_analytics') == '1' ) {
|
220 |
+
$campaign_type = get_option('jd_dynamic_analytics');
|
221 |
+
if ($campaign_type == "post_category") {
|
222 |
+
$category = get_the_category( $post_ID );
|
223 |
+
$this_campaign = $category[0]->cat_name;
|
224 |
+
} else if ($campaign_type == "post_ID") {
|
225 |
+
$this_campaign = $post_ID;
|
226 |
+
} else if ($campaign_type == "post_title") {
|
227 |
+
$post = get_post( $post_ID );
|
228 |
+
$this_campaign = $post->post_title;
|
229 |
+
} else {
|
230 |
+
$post = get_post( $post_ID );
|
231 |
+
$post_author = $post->post_author;
|
232 |
+
$this_campaign = get_the_author_meta( 'user_login',$post_author );
|
233 |
+
}
|
234 |
+
} else {
|
235 |
$this_campaign = get_option('twitter-analytics-campaign');
|
236 |
+
}
|
237 |
+
$search = array(" ","&","?");
|
238 |
+
$this_campaign = str_replace($search,'',$this_campaign);
|
239 |
if ( strpos( $thispostlink,"%3F" ) === FALSE) {
|
240 |
$thispostlink .= urlencode("?");
|
241 |
} else {
|
249 |
switch ( get_option( 'jd_shortener' ) ) {
|
250 |
case 0:
|
251 |
case 1:
|
252 |
+
$shrink = jd_fetch_url( "http://cli.gs/api/v1/cligs/create?t=snoopy&appid=WP-to-Twitter&url=".$thispostlink."&title=".$thisposttitle."&key=".$cligsapi );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
break;
|
254 |
case 2:
|
255 |
+
$decoded = jd_remote_json( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$thispostlink."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
$shrink = $decoded['results'][urldecode($thispostlink)]['shortUrl'];
|
|
|
257 |
break;
|
258 |
case 3:
|
259 |
+
$shrink = urldecode($thispostlink);
|
260 |
break;
|
261 |
case 4:
|
262 |
$shrink = get_bloginfo('url') . "/?p=" . $post_ID;
|
263 |
break;
|
264 |
+
case 5:
|
265 |
+
// local YOURLS installation
|
266 |
+
$thispostlink = urldecode($thispostlink);
|
267 |
+
global $yourls_reserved_URL;
|
268 |
+
define('YOURLS_INSTALLING', true); // Pretend we're installing YOURLS to bypass test for install or upgrade
|
269 |
+
define('YOURLS_FLOOD_DELAY_SECONDS', 0); // Disable flood check
|
270 |
+
if( file_exists( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' ) ) { // YOURLS 1.4
|
271 |
+
global $ydb;
|
272 |
+
require_once( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' );
|
273 |
+
$yourls_result = yourls_add_new_link( $thispostlink, $post_ID );
|
274 |
+
} else { // YOURLS 1.3
|
275 |
+
require_once( get_option( 'yourlspath' ) );
|
276 |
+
$yourls_db = new wpdb( YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST );
|
277 |
+
$yourls_result = yourls_add_new_link( $thispostlink, $post_ID, $yourls_db );
|
278 |
+
}
|
279 |
+
if ($yourls_result) {
|
280 |
+
$shrink = $yourls_result['shorturl'];
|
281 |
+
} else {
|
282 |
+
$shrink = false;
|
283 |
+
}
|
284 |
+
break;
|
285 |
+
case 6:
|
286 |
+
// remote YOURLS installation
|
287 |
+
$keyword_format = "$post_ID";
|
288 |
+
$api_url = sprintf( get_option('yourlsurl') . '?username=%s&password=%s&url=%s&format=json&action=shorturl&keyword=%s',
|
289 |
+
$yourlslogin, $yourlsapi, $thispostlink, $keyword_format );
|
290 |
+
$json = jd_remote_json( $api_url, false );
|
291 |
+
if ($json) {
|
292 |
+
$shrink = $json->shorturl;
|
293 |
+
} else {
|
294 |
+
$shrink = false;
|
295 |
+
}
|
296 |
+
break;
|
297 |
}
|
298 |
if ( $shrink === FALSE || ( stristr( $shrink, "http://" ) === FALSE )) {
|
299 |
update_option( 'wp_url_failure','1' );
|
304 |
|
305 |
function jd_expand_url( $short_url ) {
|
306 |
$short_url = urlencode( $short_url );
|
307 |
+
$decoded = jd_remote_json("http://api.longurl.org/v2/expand?format=json&url=" . $short_url );
|
|
|
|
|
|
|
308 |
$url = $decoded['long-url'];
|
309 |
return $url;
|
310 |
}
|
311 |
+
function jd_expand_yourl( $short_url, $remote ) {
|
312 |
+
if ( $remote == 6 ) {
|
313 |
+
$short_url = urlencode( $short_url );
|
314 |
+
$yourl_api = get_option( 'yourlsurl' );
|
315 |
+
$user = get_option( 'yourlslogin' );
|
316 |
+
$pass = get_option( 'yourlsapi' );
|
317 |
+
$decoded = jd_remote_json( $yourl_api . "?action=expand&shorturl=$short_url&format=json&username=$user&password=$pass" );
|
318 |
+
$url = $decoded['longurl'];
|
319 |
+
return $url;
|
320 |
+
} else {
|
321 |
+
global $yourls_reserved_URL;
|
322 |
+
define('YOURLS_INSTALLING', true); // Pretend we're installing YOURLS to bypass test for install or upgrade
|
323 |
+
define('YOURLS_FLOOD_DELAY_SECONDS', 0); // Disable flood check
|
324 |
+
if ( file_exists( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' ) ) { // YOURLS 1.4
|
325 |
+
global $ydb;
|
326 |
+
require_once( dirname( get_option( 'yourlspath' ) ).'/load-yourls.php' );
|
327 |
+
$yourls_result = yourls_api_expand( $short_url );
|
328 |
+
} else { // YOURLS 1.3
|
329 |
+
require_once( get_option( 'yourlspath' ) );
|
330 |
+
$yourls_db = new wpdb( YOURLS_DB_USER, YOURLS_DB_PASS, YOURLS_DB_NAME, YOURLS_DB_HOST );
|
331 |
+
$yourls_result = yourls_api_expand( $short_url );
|
332 |
+
}
|
333 |
+
$url = $yourls_result['longurl'];
|
334 |
+
return $url;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
function in_allowed_category( $array ) {
|
339 |
+
$allowed_categories = unserialize( get_option( 'tweet_categories' ) );
|
340 |
+
if ( is_array( $array ) && is_array( $allowed_categories ) ) {
|
341 |
+
$common = @array_intersect( $array,$allowed_categories );
|
342 |
+
if ( count( $common ) >= 1 ) {
|
343 |
+
return true;
|
344 |
+
} else {
|
345 |
+
return false;
|
346 |
+
}
|
347 |
+
} else {
|
348 |
+
return true;
|
349 |
+
}
|
350 |
+
}
|
351 |
|
352 |
function jd_twit( $post_ID ) {
|
353 |
$jd_tweet_this = get_post_meta( $post_ID, 'jd_tweet_this', TRUE);
|
367 |
$category = null;
|
368 |
$categories = get_the_category( $post_ID );
|
369 |
if ( $categories > 0 ) {
|
370 |
+
$category = $categories[0]->cat_name;
|
371 |
}
|
372 |
+
foreach ($categories AS $cat) {
|
373 |
+
$category_ids[] = $cat->term_id;
|
374 |
+
}
|
375 |
|
376 |
$excerpt_length = get_option( 'jd_post_excerpt' );
|
377 |
if ( trim( $get_post_info->post_excerpt ) == "" ) {
|
427 |
if ( $sentence != '' ) {
|
428 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
429 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
430 |
+
}
|
431 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
432 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
433 |
+
if ( get_option( 'jd_use_both_services' ) == '1' ) {
|
434 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
435 |
+
}
|
436 |
+
}
|
437 |
if ( $sendToTwitter === FALSE ) {
|
438 |
update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
|
439 |
update_option( 'wp_twitter_failure','1' );
|
508 |
}
|
509 |
}
|
510 |
if ( $sentence != '' ) {
|
511 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
512 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
513 |
+
if ( get_option('jd_use_both_services') == '1' ) {
|
514 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
515 |
+
}
|
516 |
+
}
|
517 |
+
|
518 |
if ( $sendToTwitter === FALSE ) {
|
519 |
update_post_meta( $post_ID,'jd_wp_twitter',urldecode( $sentence ) );
|
520 |
update_option( 'wp_twitter_failure','1' );
|
555 |
$sentence = str_ireplace("#url#",$shrink,$sentence);
|
556 |
}
|
557 |
if ( $sentence != '' ) {
|
558 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
559 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
560 |
+
if ( get_option('jd_use_both_services') == '1' ) {
|
561 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
562 |
+
}
|
563 |
+
}
|
564 |
+
if ($sendToTwitter === FALSE) {
|
565 |
update_option('wp_twitter_failure','2');
|
566 |
}
|
567 |
}
|
592 |
if ( $categories > 0 ) {
|
593 |
$category = $categories[0]->cat_name;
|
594 |
}
|
595 |
+
foreach ($categories AS $cat) {
|
596 |
+
$category_ids[] = $cat->term_id;
|
597 |
+
}
|
598 |
if ( $jd_tweet_this == "yes" ) {
|
599 |
$thispostlink = urlencode( external_or_permalink( $post_ID ) );
|
600 |
$thisposttitle = urlencode( strip_tags( $get_post_info->post_title ) );
|
622 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
623 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
624 |
}
|
625 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
626 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
627 |
+
if ( get_option('jd_use_both_services') == '1' ) {
|
628 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
629 |
+
}
|
630 |
+
}
|
631 |
+
if ($sendToTwitter === FALSE) {
|
632 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
633 |
update_option( 'wp_twitter_failure','1' );
|
634 |
}
|
672 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
673 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
674 |
}
|
675 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
676 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
677 |
+
if ( get_option('jd_use_both_services') == '1' ) {
|
678 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
679 |
+
}
|
680 |
+
}
|
681 |
+
if ($sendToTwitter === FALSE) {
|
682 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence) );
|
683 |
update_option( 'wp_twitter_failure','1' );
|
684 |
}
|
710 |
$categories = get_the_category( $post_ID );
|
711 |
if ( $categories > 0 ) {
|
712 |
$category = $categories[0]->cat_name;
|
713 |
+
}
|
714 |
+
foreach ($categories AS $cat) {
|
715 |
+
$category_ids[] = $cat->term_id;
|
716 |
+
}
|
717 |
$excerpt_length = get_option( 'jd_post_excerpt' );
|
718 |
if ( trim( $get_post_info->post_excerpt ) == "" ) {
|
719 |
$thispostexcerpt = @mb_substr( strip_tags($get_post_info->post_content), 0, $excerpt_length );
|
734 |
if ( get_option( 'use_tags_as_hashtags' ) == '1' ) {
|
735 |
$sentence = $sentence . " " . generate_hash_tags( $post_ID );
|
736 |
}
|
737 |
+
if ( get_option('limit_categories') == '0' || in_allowed_category( $category_ids )) {
|
738 |
+
$sendToTwitter = jd_doTwitterAPIPost( $sentence, $authID );
|
739 |
+
if ( get_option('jd_use_both_services') == '1' ) {
|
740 |
+
$sendToTwitter2 = jd_doTwitterAPIPost( $sentence, $authID, $service="Twitter" );
|
741 |
+
}
|
742 |
+
}
|
743 |
+
if ($sendToTwitter === FALSE) {
|
744 |
add_post_meta( $post_ID,'jd_wp_twitter',urldecode($sentence));
|
745 |
update_option('wp_twitter_failure','1');
|
|
|
746 |
}
|
747 |
+
}
|
748 |
}
|
749 |
return $post_ID;
|
750 |
}
|
770 |
if ( get_post_meta ( $post_ID, 'wp_jd_wp', TRUE ) != $url ) {
|
771 |
update_post_meta ( $post_ID, 'wp_jd_wp', $url );
|
772 |
}
|
773 |
+
} elseif ( get_option( 'jd_shortener' ) == 5 || get_option( 'jd_shortener' ) == 6 ) {
|
774 |
+
if ( get_post_meta ( $post_ID, 'wp_jd_yourls', TRUE ) != $url ) {
|
775 |
+
update_post_meta ( $post_ID, 'wp_jd_yourls', $url );
|
776 |
+
}
|
777 |
}
|
778 |
if ( get_option( 'jd_shortener' ) == 0 || get_option( 'jd_shortener' ) == 1 || get_option( 'jd_shortener' ) == 2 ) {
|
779 |
$target = jd_expand_url( $url );
|
780 |
+
} else if ( get_option( 'jd_shortener' ) == 5 || get_option( 'jd_shortener' ) == 6 ) {
|
781 |
+
$target = jd_expand_yourl( $url, get_option( 'jd_shortener' ) );
|
782 |
} else {
|
783 |
$target = $url;
|
784 |
}
|
842 |
}
|
843 |
|
844 |
function jd_add_twitter_inner_box() {
|
845 |
+
if ( get_option('jd-twitter-service-name') == '' ) {
|
846 |
+
$twitter = "Twitter";
|
847 |
+
} else {
|
848 |
+
$twitter = get_option('jd-twitter-service-name');
|
849 |
+
}
|
850 |
+
if ( get_option('jd-twitter-char-limit') == '' ) {
|
851 |
+
$post_length = 140;
|
852 |
+
} else {
|
853 |
+
$post_length = (int) get_option('jd-twitter-char-limit');
|
854 |
+
}
|
855 |
global $post, $jd_plugin_url;
|
856 |
$post_id = $post;
|
857 |
if (is_object($post_id)) {
|
869 |
$shortener = "Bit.ly";
|
870 |
}
|
871 |
if ( $jd_short == "" ) {
|
872 |
+
$jd_short = get_post_meta( $post_id, 'wp_jd_wp', true );
|
873 |
$shortener = "WordPress";
|
874 |
}
|
875 |
+
if ( $jd_short == "" ) {
|
876 |
+
$jd_short = get_post_meta( $post_id, 'wp_jd_yourls', true );
|
877 |
+
$shortener = "YOURLS";
|
878 |
+
}
|
879 |
+
if ( $jd_short == "" ) {
|
880 |
+
$jd_direct = get_post_meta( $post_id, 'wp_jd_url', true );
|
881 |
+
}
|
882 |
$jd_expansion = get_post_meta( $post_id, 'wp_jd_target', true );
|
883 |
?>
|
884 |
<script type="text/javascript">
|
889 |
// End -->
|
890 |
</script>
|
891 |
<p>
|
892 |
+
<label for="jd_twitter"><?php _e("$twitter Post", 'wp-to-twitter', 'wp-to-twitter') ?></label><br /><textarea style="width:95%;" name="jd_twitter" id="jd_twitter" rows="2" cols="60"
|
893 |
onKeyDown="countChars(document.post.jd_twitter,document.post.twitlength)"
|
894 |
onKeyUp="countChars(document.post.jd_twitter,document.post.twitlength)"><?php echo attribute_escape( $jd_twitter ); ?></textarea>
|
895 |
</p>
|
896 |
<p><input readonly type="text" name="twitlength" size="3" maxlength="3" value="<?php echo attribute_escape( mb_strlen( $description) ); ?>" />
|
897 |
+
<?php $minus_length = $post_length - 21; ?>
|
898 |
+
<?php _e(" characters.<br />$twitter posts are a maximum of $post_length characters; if your short URL is appended to the end of your document, you have about $minus_length characters available. You can use <code>#url#</code>, <code>#title#</code>, <code>#post#</code>, <code>#category#</code>, <code>#date#</code>, or <code>#blog#</code> to insert the shortened URL, post title, the first category selected, the post date, or a post excerpt or blog name into the Tweet.", 'wp-to-twitter', 'wp-to-twitter') ?>
|
899 |
+
</p>
|
900 |
+
<p>
|
901 |
+
<a target="__blank" href="<?php echo $jd_donate_url; ?>"><?php _e('Make a Donation', 'wp-to-twitter', 'wp-to-twitter') ?></a> • <a target="__blank" href="<?php echo $jd_plugin_url; ?>"><?php _e('Get Support', 'wp-to-twitter', 'wp-to-twitter') ?></a> »
|
902 |
</p>
|
903 |
<p>
|
904 |
<input type="checkbox" name="jd_tweet_this" value="no"<?php echo attribute_escape( $jd_selected ); ?> id="jd_tweet_this" /> <label for="jd_tweet_this"><?php _e("Don't Tweet this post.", 'wp-to-twitter'); ?></label>
|
907 |
<?php
|
908 |
if ( $jd_short != "" ) {
|
909 |
_e("The previously-posted $shortener URL for this post is <code>$jd_short</code>, which points to <code>$jd_expansion</code>.", 'wp-to-twitter');
|
910 |
+
} else {
|
911 |
+
_e("This URL is direct and has not been shortened: ","wp-to-twitter"); echo "<code>$jd_direct</code>";
|
912 |
}
|
913 |
?>
|
914 |
</p>
|
943 |
|
944 |
|
945 |
function jd_twitter_profile() {
|
946 |
+
if ( get_option('jd-twitter-service-name') == '' ) {
|
947 |
+
$twitter = "Twitter";
|
948 |
+
} else {
|
949 |
+
$twitter = get_option('jd-twitter-service-name');
|
950 |
+
}
|
951 |
global $user_ID;
|
952 |
get_currentuserinfo();
|
953 |
+
if ( isset($_GET['user_id']) ) {
|
954 |
+
$user_ID = (int) $_GET['user_id'];
|
955 |
+
}
|
956 |
$is_enabled = get_usermeta( $user_ID, 'wp-to-twitter-enable-user' );
|
957 |
$twitter_username = get_usermeta( $user_ID, 'wp-to-twitter-user-username' );
|
958 |
$twitter_password = get_usermeta( $user_ID, 'wp-to-twitter-user-password' );
|
959 |
+
$x_twitter_username = get_usermeta( $user_ID, 'x-wp-to-twitter-user-username' );
|
960 |
+
$x_twitter_password = get_usermeta( $user_ID, 'x-wp-to-twitter-user-password' );
|
961 |
?>
|
962 |
<h3><?php _e('WP to Twitter User Settings', 'wp-to-twitter'); ?></h3>
|
963 |
|
964 |
<table class="form-table">
|
965 |
<tr>
|
966 |
+
<th scope="row"><?php _e("Use My $twitter Account", 'wp-to-twitter'); ?></th>
|
967 |
+
<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.", 'wp-to-twitter'); ?></label><br />
|
968 |
+
<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.", 'wp-to-twitter'); ?></label><br />
|
969 |
+
<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.)", 'wp-to-twitter'); ?></label></td>
|
970 |
</tr>
|
971 |
<tr>
|
972 |
+
<th scope="row"><label for="wp-to-twitter-user-username"><?php _e("Your $twitter Username", 'wp-to-twitter'); ?></label></th>
|
973 |
<td><input type="text" name="wp-to-twitter-user-username" id="wp-to-twitter-user-username" value="<?php echo attribute_escape( $twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.', 'wp-to-twitter'); ?></td>
|
974 |
</tr>
|
975 |
<tr>
|
976 |
+
<th scope="row"><label for="wp-to-twitter-user-password"><?php _e("Your $twitter Password", 'wp-to-twitter'); ?></label></th>
|
977 |
+
<td><input type="password" name="wp-to-twitter-user-password" id="wp-to-twitter-user-password" value="" /> <?php _e('Enter your own Twitter password.', 'wp-to-twitter'); ?> <?php if ( $twitter_password != "") { _e('<em>Password saved</em>','wp-to-twitter'); } ?></td>
|
978 |
</tr>
|
979 |
</table>
|
980 |
+
<?php if ( get_option( 'jd_use_both_services' )=='1' ) { ?>
|
981 |
+
<h3><?php _e('WP to Twitter User Settings', 'wp-to-twitter'); ?></h3>
|
982 |
+
|
983 |
+
<table class="form-table">
|
984 |
+
<tr>
|
985 |
+
<th scope="row"><label for="x-wp-to-twitter-user-username"><?php _e("Your Twitter Username", 'wp-to-twitter'); ?></label></th>
|
986 |
+
<td><input type="text" name="x-wp-to-twitter-user-username" id="x-wp-to-twitter-user-username" value="<?php echo attribute_escape( $x_twitter_username ); ?>" /> <?php _e('Enter your own Twitter username.', 'wp-to-twitter'); ?></td>
|
987 |
+
</tr>
|
988 |
+
<tr>
|
989 |
+
<th scope="row"><label for="x-wp-to-twitter-user-password"><?php _e("Your Twitter Password", 'wp-to-twitter'); ?></label></th>
|
990 |
+
<td><input type="password" name="x-wp-to-twitter-user-password" id="x-wp-to-twitter-user-password" value="" /> <?php _e('Enter your own Twitter password.', 'wp-to-twitter'); ?> <?php if ( $x_twitter_password != "") { _e('<em>Password saved</em>','wp-to-twitter'); } ?></td>
|
991 |
+
</tr>
|
992 |
+
</table>
|
993 |
+
|
994 |
+
<?php }
|
995 |
+
|
996 |
}
|
997 |
|
998 |
function custom_shortcodes( $sentence, $post_ID ) {
|
1015 |
function jd_twitter_save_profile(){
|
1016 |
global $user_ID;
|
1017 |
get_currentuserinfo();
|
1018 |
+
if ( isset($_POST['user_id']) ) {
|
1019 |
+
$user_ID = (int) $_POST['user_id'];
|
1020 |
+
}
|
1021 |
update_usermeta($user_ID ,'wp-to-twitter-enable-user' , $_POST['wp-to-twitter-enable-user'] );
|
1022 |
update_usermeta($user_ID ,'wp-to-twitter-user-username' , $_POST['wp-to-twitter-user-username'] );
|
1023 |
if ( $_POST['wp-to-twitter-user-password'] != '' ) {
|
1026 |
update_usermeta($user_ID ,'wp-to-twitter-encrypted' , base64_encode( $_POST['wp-to-twitter-user-username'].':'.$_POST['wp-to-twitter-user-password'] ) );
|
1027 |
}
|
1028 |
|
1029 |
+
function jd_list_categories() {
|
1030 |
+
$selected = "";
|
1031 |
+
$categories = get_categories('hide_empty=0');
|
1032 |
+
$input = "<form action=\"\" method=\"post\">
|
1033 |
+
<fieldset><legend>".__('Check the categories you want to tweet:','wp-to-twitter')."</legend>
|
1034 |
+
<ul>\n";
|
1035 |
+
$tweet_categories = unserialize( get_option( 'tweet_categories' ) );
|
1036 |
+
foreach ($categories AS $cat) {
|
1037 |
+
if (is_array($tweet_categories)) {
|
1038 |
+
if (in_array($cat->term_id,$tweet_categories)) {
|
1039 |
+
$selected = " checked=\"checked\"";
|
1040 |
+
} else {
|
1041 |
+
$selected = "";
|
1042 |
+
}
|
1043 |
+
}
|
1044 |
+
$input .= ' <li><input'.$selected.' type="checkbox" name="categories[]" value="'.$cat->term_id.'" id="'.$cat->category_nicename.'" /> <label for="'.$cat->category_nicename.'">'.$cat->name."</label></li>\n";
|
1045 |
+
}
|
1046 |
+
$input .= " </ul>
|
1047 |
+
</fieldset>
|
1048 |
+
<div>
|
1049 |
+
<input type=\"hidden\" name=\"submit-type\" value=\"setcategories\" />
|
1050 |
+
<input type=\"submit\" name=\"submit\" class=\"button-primary\" value=\"".__('Set Categories','wp-to-twitter')."\" />
|
1051 |
+
</div>
|
1052 |
+
</form>";
|
1053 |
+
echo $input;
|
1054 |
+
}
|
1055 |
+
|
1056 |
// Add the administrative settings to the "Settings" menu.
|
1057 |
function jd_addTwitterAdminPages() {
|
1058 |
if ( function_exists( 'add_submenu_page' ) ) {
|
1065 |
echo "
|
1066 |
<style type=\"text/css\">
|
1067 |
<!--
|
1068 |
+
#wp-to-twitter #message {
|
1069 |
+
margin: 10px 0;
|
1070 |
+
padding: 5px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1071 |
}
|
1072 |
+
#wp-to-twitter .jd-settings {
|
1073 |
+
clear: both;
|
|
|
1074 |
}
|
1075 |
#wp-to-twitter form .error p {
|
1076 |
background: none;
|
1077 |
border: none;
|
1078 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1079 |
legend {
|
1080 |
font-weight: 700;
|
1081 |
+
font-size: 1.2em;
|
1082 |
+
padding: 6px 0;
|
|
|
|
|
1083 |
}
|
1084 |
.resources {
|
1085 |
float: right;
|
1086 |
border: 1px solid #aaa;
|
1087 |
padding: 10px 10px 0;
|
1088 |
margin-left: 10px;
|
1089 |
+
margin-bottom: 10px;
|
1090 |
-moz-border-radius: 5px;
|
1091 |
-webkit-border-radius: 5px;
|
1092 |
border-radius: 5px;
|
1102 |
padding: 10px;
|
1103 |
border: 1px solid #000;
|
1104 |
}
|
1105 |
+
#wp-to-twitter .panel {
|
1106 |
+
border: 1px solid #ddd;
|
1107 |
+
background: #f6f6f6;
|
1108 |
+
padding: 5px;
|
1109 |
+
margin: 5px;
|
1110 |
+
}
|
1111 |
-->
|
1112 |
</style>";
|
1113 |
}
|
1124 |
$links[] = "<a href='options-general.php?page=wp-to-twitter/wp-to-twitter.php'>" . __('Settings', 'wp-to-twitter', 'wp-to-twitter') . "</a>";
|
1125 |
return $links;
|
1126 |
}
|
1127 |
+
/*
|
1128 |
+
// Something for later...taken out of 2.0 release. No time for this now!
|
1129 |
+
function jd_tweet_from_dashboard() {
|
1130 |
+
wp_add_dashboard_widget( 'jd_tweet_from_dashboard' , 'Post to Twitter' , 'jd_tweet_box' );
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
function jd_tweet_box() {
|
1134 |
+
global $id;
|
1135 |
+
echo '<form action="" method="post">
|
1136 |
+
<div>
|
1137 |
+
<label for="jd_tweet">';
|
1138 |
+
_e('Post to Twitter','wp-to-twitter');
|
1139 |
+
echo '<textarea cols="40" rows="8" name="jd_tweet" id="jd_tweet"></textarea>
|
1140 |
+
</div>
|
1141 |
+
</form>';
|
1142 |
+
}
|
1143 |
+
*/
|
1144 |
|
1145 |
//Add Plugin Actions to WordPress
|
1146 |
|
1151 |
add_action( 'edit_user_profile', 'jd_twitter_profile' );
|
1152 |
add_action( 'profile_update', 'jd_twitter_save_profile');
|
1153 |
}
|
1154 |
+
if ( get_option( 'wp_twitter_failure' ) == '1' || get_option( 'wp_url_failure' ) == '1' ) {
|
|
|
1155 |
add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>';_e('There\'s been an error posting your Twitter status! <a href=\"".get_bloginfo('wpurl')."/wp-admin/options-general.php?page=wp-to-twitter/wp-to-twitter.php\">Visit your WP to Twitter settings page</a> to get more information and to clear this error message.','wp-to-twitter'); echo '</p></div>';" ) );
|
1156 |
}
|
1157 |
if ( get_option( 'jd_twit_pages' )=='1' ) {
|
1184 |
add_action( 'admin_menu', 'jd_addTwitterAdminPages' );
|
1185 |
|
1186 |
register_activation_hook( __FILE__, 'wptotwitter_activate' );
|
1187 |
+
//if ( get_option( 'jd_post_tweet_from_dashboard' ) == '1' ) {
|
1188 |
+
//add_action( 'wp_dashboard_setup', 'jd_tweet_from_dashboard' );
|
1189 |
+
//}
|
1190 |
|
1191 |
?>
|