Skip to content

Commit

Permalink
Additional refinement for v_3.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
DefProc committed Oct 18, 2010
1 parent 43762e1 commit e13e564
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -11,6 +11,7 @@ Author: Patrick Fenner
* Added tweet length checking, will trim title and force shortening of long urls to keep tweets under 140 characters.
* Added generic [YOURLS](http://yourls.org) shortener support - for both public and private installations. Can use timestamp-hashed secret keys (preferred) or usename/password combo (sent plaintext).
* Removed CURL dependency for short URL retreval, replaced with WP_Http (CURL is still required for sending updates to Twitter).
* Removed zz.gd as a shortener option (service has closed).

3.0.1
-----
Expand Down
6 changes: 3 additions & 3 deletions readme.txt
@@ -1,7 +1,7 @@
=== TweetUpdater ===
Contributors: DefProc
Version: 3.1.alpha2
Stable tag: 3.0.1
Version: 3.1
Stable tag: 3.1
Tags: twitter, message, tweet, status, update, OAuth, shorturl, short_url, shortlink, short url, la petite url, publish, update, YOURLS, bit.ly, Stwnsh, TinyURL, ZZ.GD
Requires at least: 3.0.1
Tested up to: 3.0.1
Expand Down Expand Up @@ -30,7 +30,6 @@ External services:
* Bit.ly
* Stwnsh
* TinyURL
* ZZ.GD

Posts tweeting can be ommited based on post category, or custom field, or custom field and value pair.

Expand Down Expand Up @@ -139,6 +138,7 @@ Stable release for WP 3.0.1
* Added tweet length checking, will trim the title and force shortening of long urls to keep tweets under 140 characters.
* Added generic [YOURLS](http://yourls.org) shortener support - for both public and private installations. Can use timestamp-hashed secret keys (preferred) or usename/password combo (sent in plaintext).
* Removed CURL dependency for short URL retreval, replaced with WP_Http (CURL is still required for sending updates to Twitter).
* Removed zz.gd as a shortener option (service has closed).

= 3.0.1 =

Expand Down
7 changes: 3 additions & 4 deletions tweetupdater.php
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: TweetUpdater
Description: Update your Twitter status when you publish or update a post. Based on TwitterUpdater v1.0 by <a href="http://blog.victoriac.net/ja/geek/twitter-updater">Victoria Chan</a>
Version: 3.1.alpha2
Version: 3.1
Author: Patrick Fenner (Def-Proc.co.uk)
Author URI: http://www.deferredprocrastination.co.uk/
Plugin URI: http://www.deferredprocrastination.co.uk/projects/tweetupdater
Expand Down Expand Up @@ -105,9 +105,9 @@ function tweet_updater_is_tweetable($post, $options)

if( is_array($post_categories) && sizeof($post_categories) > 0 )
{
foreach( $options['limit_to_category'] as $key => $value )
foreach( $post_categories as $key => $value )
{
if( $value > 0 && in_array( $value, $post_categories ) )
if( $value > 0 && in_array( $value, $options['limit_to_category'] ) )
{
//echo "in cat: TRUE";
return true;
Expand Down Expand Up @@ -331,7 +331,6 @@ function tu_get_shorturl( $url_method, $link, $post_ID )
'status_txt' => $json['status_txt'],
'url_method' => 'default',
);
//echo "bit.ly failed <br /><pre>" . print_r($short_url) . "</pre>";
}
}
else if ( $url_method == 'tinyurl' || $url_method == 'default' ) //set tinyurl as default shortener
Expand Down
22 changes: 10 additions & 12 deletions tweetupdater_manager.php
Expand Up @@ -55,7 +55,7 @@ function tweet_updater_activate()
'yourls_username' => '',
'yourls_passwd' => '',
'yourls_token' => '',
'show_debug' => '1', //show database entries on settings page
//'show_debug' => '1', //show database entries on settings page - uncomment and reactivate to use
);

add_option( 'tweet_updater_options', $options_default, '', 'no' );
Expand All @@ -64,7 +64,7 @@ function tweet_updater_activate()
$current_options = get_option('tweet_updater_options');

// Check all options from the default array exist in the current array. If not, load the default values.
// (checking this way _should_ eliminate any old items that are not in the default array - but none have been removed yet.)
// checking this way should eliminate any old items that are not in the default array.
foreach( $options_default as $key => $value )
{
if( !isset($current_options[$key]) )
Expand Down Expand Up @@ -304,9 +304,9 @@ function tweet_updater_admin_init()

// Section 3: Limit tweets to posts with certain custom field/value pair or part of a specific category
add_settings_section('tweet_updater_limit_tweets', 'Limit tweets:', 'tweet_updater_limit_tweets' ,'limit_tweets');
add_settings_field('tweet_updater_limit_activate', 'Limit tweeting using the rules below?', 'tweet_updater_limit_activate', 'limit_tweets', 'tweet_updater_limit_tweets');
add_settings_field('tweet_updater_limit_to_category', 'Only tweet for posts in the selected category', 'tweet_updater_limit_to_category', 'limit_tweets', 'tweet_updater_limit_tweets');
add_settings_field('tweet_updater_limit_to_customfield', 'Only tweet for posts with this Meta tag and value', 'tweet_updater_limit_to_customfield', 'limit_tweets', 'tweet_updater_limit_tweets');
add_settings_field('tweet_updater_limit_activate', 'Limit Twitter updates using the rules below?', 'tweet_updater_limit_activate', 'limit_tweets', 'tweet_updater_limit_tweets');
add_settings_field('tweet_updater_limit_to_category', 'Send tweets when a post is in a selected category:', 'tweet_updater_limit_to_category', 'limit_tweets', 'tweet_updater_limit_tweets');
add_settings_field('tweet_updater_limit_to_customfield', 'Send tweets for posts with this Meta [Title] OR [Title AND Value]', 'tweet_updater_limit_to_customfield', 'limit_tweets', 'tweet_updater_limit_tweets');

//Section 4: Short Url service
add_settings_section('tweet_updater_short_url', 'Short URL Service:', 'tweet_updater_short_url', 'short_url');
Expand Down Expand Up @@ -369,18 +369,16 @@ function tweet_updater_edited_update()
function tweet_updater_edited_format()
{ global $tweet_updater_placeholders; $options = get_option('tweet_updater_options'); echo "<input id='tweet_updater_edited_format' type='text' size='60' maxlength='100' name='tweet_updater_options[edited_format]' value='{$options['edited_format']}' />" . $tweet_updater_placeholders; }

// Limit tweets to Categories and Custom Fields
// Limit tweets to Categories and Custom Fields
function tweet_updater_limit_tweets()
{ echo "<p>Sending of tweets can be limited to posts of a selected category, or that have a specified Custom Field (Meta) title and/or value.</p>"; }
{ echo "<p>Twitter messages can be sent only when the post is a member of a [selected category], OR that have a specified Custom Field [title] OR [title AND value].</p>"; }
function tweet_updater_limit_activate()
{ $options = get_option('tweet_updater_options'); echo "<input id='tweet_updater_limit_activate' type='checkbox' name='tweet_updater_options[limit_activate]' value='1'"; if( $options['limit_activate'] == '1' ) { echo " checked='true'"; }; echo " />"; }
function tweet_updater_limit_to_category()
{
$options = get_option('tweet_updater_options');
$categories=get_categories( array( 'orderby'=>'name', 'order'=>'ASC' , 'hide_empty'=>'0') );

//echo "<p><pre>" . print_r($categories, true) . "</pre></p>";

if ( !empty($categories) )
{
echo "<ul>";
Expand Down Expand Up @@ -446,10 +444,10 @@ function tweet_updater_chose_url1()
<li><label for='tweet_updater_yourls_url'>API page address:</label><input id='tweet_updater_yourls_url' type='text' size='60' name='tweet_updater_options[yourls_url]' value='{$options['yourls_url']}' /></li>
<li><label>When the YOURLS API is set to 'private' include either: Signature Token or: Username & Password</label>
<ul style='margin-left: 3em; margin-top: 0.5em;'>
<li><label for='tweet_updater_yourls_token'>Signature Token (preferred): </label><input id='tweet_updater_yourls_token' type='text' size='30' name='tweet_updater_options[yourls_token]' value='{$options['yourls_token']}' /></li>
<li><label for='tweet_updater_yourls_token'>Signature Token: </label><input id='tweet_updater_yourls_token' type='text' size='30' name='tweet_updater_options[yourls_token]' value='{$options['yourls_token']}' /><label>(preferred)</li>
<li><label>or:</label></li>
<li><label for='tweet_updater_yourls_username'>Username: </label><input id='tweet_updater_yourls_username' type='text' size='30' name='tweet_updater_options[yourls_username]' value='{$options['yourls_username']}' /></li>
<li><label for='tweet_updater_yourls_passwd'>Password: </label><input id='tweet_updater_yourls_passwd' type='text' size='30' name='tweet_updater_options[yourls_passwd]' value='{$options['yourls_passwd']}' /></li>
<li><label for='tweet_updater_yourls_passwd'>Password: </label><input id='tweet_updater_yourls_passwd' type='text' size='30' name='tweet_updater_options[yourls_passwd]' value='{$options['yourls_passwd']}' /><label>(not recommended - password will be sent in plaintext)</label></li>
</ul></li>
</ul>";
echo "</li>";
Expand Down Expand Up @@ -480,7 +478,7 @@ function tweet_updater_chose_url1()
if( $options['url_method'] == 'tinyurl' || $options['url_method'] == 'default' ) { echo " checked='true'"; };
echo " /><label for='tweet_updater_chose_url'>TinyURL <a href='http://tinyurl.com/'>http://tinyurl.com</a> (Default)</label></li>";

// ZZ.GD is now closed
// ZZ.GD is now closed - option removed

echo "</ul>";
}
Expand Down

0 comments on commit e13e564

Please sign in to comment.