" . __("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. [Cli.gs Blog] [Bit.ly Blog]") . "

"; } if ( get_option( 'wp_twitter_failure' ) == '1' ) { $wp_to_twitter_failure .= "

" . __("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! ") . "

"; } else if ( get_option( 'wp_twitter_failure' ) == '2') { $wp_to_twitter_failure .= "

" . __("Sorry! I couldn't get in touch with the Twitter servers to post your new link! You'll have to post it manually, I'm afraid. ") . "

"; } } else { $wp_to_twitter_failure = ''; } if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'options' ) { //UPDATE OPTIONS update_option( 'newpost-published-update', $_POST['newpost-published-update'] ); update_option( 'newpost-published-text', $_POST['newpost-published-text'] ); update_option( 'newpost-published-showlink', $_POST['newpost-published-showlink'] ); update_option( 'jd_tweet_default', $_POST['jd_tweet_default'] ); update_option( 'oldpost-edited-update', $_POST['oldpost-edited-update'] ); update_option( 'oldpost-edited-text', $_POST['oldpost-edited-text'] ); update_option( 'oldpost-edited-showlink', $_POST['oldpost-edited-showlink'] ); update_option( 'jd_twit_pages',$_POST['jd_twit_pages'] ); update_option( 'jd_twit_edited_pages',$_POST['jd_twit_edited_pages'] ); update_option( 'jd_twit_remote',$_POST['jd_twit_remote'] ); update_option( 'jd_twit_custom_url', $_POST['jd_twit_custom_url'] ); update_option( 'jd_twit_quickpress', $_POST['jd_twit_quickpress'] ); update_option( 'use_tags_as_hashtags', $_POST['use_tags_as_hashtags'] ); update_option( 'jd_twit_prepend', $_POST['jd_twit_prepend'] ); update_option( 'jd_twit_append', $_POST['jd_twit_append'] ); update_option( 'jd_shortener', $_POST['jd_shortener'] ); if ( $_POST['jd-use-link-field'] == '2' ) { update_option( 'jd-use-link-description', '1' ); update_option( 'jd-use-link-title', '0' ); } else if ( $_POST['jd-use-link-field'] == '1' ) { update_option( 'jd-use-link-title', '1' ); update_option( 'jd-use-link-description', '0' ); } switch ($_POST['jd_shortener']) { case 1: update_option( 'jd-use-cligs', '1' ); update_option( 'jd-use-bitly', '0' ); update_option( 'jd-use-none', '0' ); break; case 2: update_option( 'jd-use-cligs', '0' ); update_option( 'jd-use-bitly', '1' ); update_option( 'jd-use-none', '0' ); break; case 3: update_option( 'jd-use-cligs', '0' ); update_option( 'jd-use-bitly', '0' ); update_option( 'jd-use-none', '1' ); break; default: update_option( 'jd-use-cligs', '1' ); update_option( 'jd-use-bitly', '0' ); update_option( 'jd-use-none', '0' ); } update_option( 'newlink-published-text', $_POST['newlink-published-text'] ); update_option( 'jd_twit_blogroll',$_POST['jd_twit_blogroll'] ); update_option( 'use-twitter-analytics', $_POST['use-twitter-analytics'] ); update_option( 'twitter-analytics-campaign', $_POST['twitter-analytics-campaign'] ); update_option( 'jd_individual_twitter_users', $_POST['jd_individual_twitter_users'] ); $message = "WP to Twitter Options Updated"; } else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'login' ) { //UPDATE LOGIN if( ( $_POST['twitterlogin'] != '' ) && ( $_POST['twitterpw'] != '' ) ) { update_option( 'twitterlogin', $_POST['twitterlogin'] ); update_option( 'twitterpw', $_POST['twitterpw'] ); update_option( 'twitterlogin_encrypted', base64_encode( $_POST['twitterlogin'].':'.$_POST['twitterpw'] ) ); $message = __("Twitter login and password updated. "); } else { $message = __("You need to provide your twitter login and password! "); } } else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'cligsapi' ) { if ( $_POST['cligsapi'] != '' && isset( $_POST['submit'] ) ) { update_option( 'cligsapi',$_POST['cligsapi'] ); $message = __("Cligs API Key Updated"); } else if ( isset( $_POST['clear'] ) ) { update_option( 'cligsapi','' ); $message = __("Cli.gs API Key deleted. Cli.gs created by WP to Twitter will no longer be associated with your account. "); } else { $message = __("Cli.gs API Key not added - get one here! "); } } else if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'bitlyapi' ) { if ( $_POST['bitlyapi'] != '' && isset( $_POST['submit'] ) ) { update_option( 'bitlyapi',trim($_POST['bitlyapi']) ); $message = __("Bit.ly API Key Updated."); } else if ( isset( $_POST['clear'] ) ) { update_option( 'bitlyapi','' ); $message = __("Bit.ly API Key deleted. You cannot use the Bit.ly API without an API key. "); } else { $message = __("Bit.ly API Key not added - get one here! "); } if ( $_POST['bitlylogin'] != '' && isset( $_POST['submit'] ) ) { update_option( 'bitlylogin',$_POST['bitlylogin'] ); $message .= __(" Bit.ly User Login Updated."); } else if ( isset( $_POST['clear'] ) ) { update_option( 'bitlylogin','' ); $message = __("Bit.ly User Login deleted. You cannot use the Bit.ly API without providing your username. "); } else { $message = __("Bit.ly Login not added - get one here! "); } } // Check whether the server has supported for needed functions. if ( isset($_POST['submit-type']) && $_POST['submit-type'] == 'check-support' ) { update_option('jd-functions-checked', '0'); } // If you're attempting to solve the "settings page doesn't display" problem, begin your comment here. if ( get_option('jd-functions-checked') == '0') { $cligs_checker = new Snoopy; $twit_checker = new Snoopy; $bitly_checker = new Snoopy; $testurl = urlencode("http://www.joedolson.com/articles/wp-to-twitter/"); $cligs_checker->fetchtext( "http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1" ); $bitlylogin = get_option( 'bitlylogin' ); $bitlyapi = get_option( 'bitlyapi' ); $bitly_checker->fetch( "http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1" ); $twit_checker->fetch( "http://twitter.com/help/test.json" ); $wp_twitter_error = TRUE; $wp_cligs_error = TRUE; $wp_bitly_error = TRUE; if ( strlen(getfilefromurl("http://cli.gs/api/v2/cligs/create?url=$testurl&appid=WP-to-Twitter&key=&output=&test=1")) == 20 || strlen($cligs_checker->results) == 20 ) { $wp_cligs_error = FALSE; $message .= __("Successfully contacted the Cli.gs API. "); //$message .= "Twit: " . $twit_checker->results; } else { $message .=__("Failed to contact the Cli.gs API. "); } $decoded = json_decode($bitly_checker->results,TRUE); $bitly_decoded = $decoded['statusCode']; if ( $bitly_decoded == "OK" ) { $wp_bitly_error = FALSE; $message .= __("Successfully contacted the Bit.ly API. "); //$message .= "Bit.ly: $bitly_decoded"; //$message .= $bitly_decoded; } else { $message .=__("Failed to contact the Bit.ly API. "); //$message .= "Bit.ly: $bitly_decoded"; $message .= "
http://api.bit.ly/shorten?version=2.0.1&longUrl=".$testurl."&login=".$bitlylogin."&apiKey=".$bitlyapi."&history=1
"; //echo "
";
				//print_r($decoded);
				//echo "
"; } if ( $twit_checker->results == "\"ok\"" || getfilefromurl("http://twitter.com/help/test.xml") == "true" ) { $wp_twitter_error = FALSE; $message .= __("Successfully contacted the Twitter API. "); } else { $message .= __("Failed to contact the Twitter API. "); } // If everything's OK, there's no reason to do this again. if ($wp_twitter_error == FALSE && $wp_cligs_error == FALSE) { $message .= __("Your server appears to support the required PHP functions and classes for WP to Twitter to function."); update_option( 'jd-functions-checked','1' ); } else { if ( !function_exists( 'fputs' ) ) { $wp_function_error = TRUE; $message .= __("Your server does not support fputs."); } if ( !function_exists( 'curl_init' ) || !function_exists( 'file_get_contents' ) ) { $wp_function_error = TRUE; $message .= __("Your server does not support file_get_contents or cURL functions."); } if ( !class_exists( 'Snoopy' ) ) { $wp_function_error = TRUE; $message .= __("Your server does not support Snoopy."); } $message .= __("Your server does not appear to support the required PHP functions and classes for WP to Twitter to function. You can try it anyway - these tests aren't perfect - but no guarantees."); update_option( 'jd-functions-checked','1' ); } } // CLOSE BUG FIX COMMENT HERE ?>

"; _e("This plugin may not work in your server environment."); echo "

"; } ?>

#title# for the title of your blog post, #blog# for the title of your blog, or #url# for the post URL! Given the character limit for Twitter, you may not want to include your blog title."); ?>

" />

/>

/>

/>    />

/>
   />

/>

/>
/> />

/>

/>

/>


/>

/>

/> /> />

Twitter Options"); ?>" class="button-primary" />

" class="button-primary" /> Don't have a Twitter account? Get one for free here"); ?>

» Get one free here!
You'll need an API key in order to associate the Cligs you create with your Cligs account."); ?>

Check whether your server supports the functions required for the Twitter and URL shortening API calls to work.

WP to Twitter plugin page."); ?>