Commit 32ff4b5d authored by lucha's avatar lucha Committed by lechuck
Browse files

pulizie di primavera: rimossi plugin obsoleti e non usati

parent 0bb7bb9d
=== Selective status list ===
Contributors: publicvoid
Tags: twitter, tweets, status, filtered
Requires at least: 2.8
Tested up to: 2.8.4
Stable tag: 0.3
Widget shows list of tweets from specified user which are marked by a specified keyword.
== Description ==
The plugin provides a widget, which shows a list of tweets from the specified author, filtered by a specified hashtag. User name and hashtag are customizable. The plugin uses AJAX to fetch status notices, hence it does'nt work for users without javascript enabled at the moment, but keeps the page load small.
== Installation ==
1. Upload the 'selectiv-tweet-list.php' and 'selective-tweet-list.js' to your '/wp-content/plugins/' directory
1. Alternatively use your wordpress installations plugin install functions in the admin area
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Drag the widget to the sidebar and fill in your desired settings (microblogging service, user name, filter hashtag, )
== Frequently Asked Questions ==
= Why are no tweets showing up? =
Make sure your user screen name is right. Check whether you have tweets containing your specified keyword in your timeline. Verify that the number of tweets fetched is set high enought to include some of those. You can check your settings by typing http://twitter.com/statuses/user_timeline.xml?screen_name=<your_screen_name>&count=<number_of_tweets_fetched> in your browsers address bar and see whether there are matching tweets.
= What about identi.ca, caching and status digests? =
Coming soon.
== Changelog ==
= 0.1 =
Initial release
= 0.2 =
- improved input validation and escaping
- use twitter search api
- allow querying status.net (identi.ca) api - usertime line batch fetching
= 0.3 =
bug fixes: widget layout, js path
/*
Part of Selective tweet list plugin for wordpress
Check out this plugin: http://wordpress.org/extend/plugins/selective-tweets/
*/
var selectiveTweetList = {
init : function(params) {
for (var p in params) {
this[p] = params[p];
}
this.pagesFetched = 0;
this.tweetsGrabbed = 0;
var searchQuery = "from:" + encodeURIComponent(this.twitterName) + "+" + encodeURIComponent(this.marker);
this.baseUrl = this.statusNet ?
"http://identi.ca/api/statuses/user_timeline.json?callback=selectiveTweetList.batchGrabTweets&count=" + Math.min(this.count*5, 200) + "&screen_name=" + encodeURIComponent(this.twitterName) :
"http://search.twitter.com/search.json?callback=selectiveTweetList.searchGrabTweets&q=" + searchQuery + "&rpp=" + this.count;
this.requestJSON();
},
requestJSON : function() {
this.pagesFetched++;
var script = document.createElement("script");
script.src = this.baseUrl + "&page=" + this.pagesFetched;
document.body.appendChild(script);
},
searchGrabTweets : function(response) {
if (response.error) {
this.makeListEntry("tweetlist", this.errorText);
} else {
for ( var tweet = 0; tweet<response.results.length; tweet++) {
this.makeListEntry("tweetlist", response.results[tweet].text.replace(this.marker, ""));
}
}
},
batchGrabTweets : function(data) {
if (data.error) {
this.makeListEntry("tweetlist", this.errorText);
} else {
this.grabTweets(data);
if(this.tweetsGrabbed<this.count && this.pagesFetched < 10) { this.requestJSON(); }
}
},
grabTweets : function(data) {
for ( var tweet = 0; tweet<data.length && this.tweetsGrabbed<this.count; tweet++) {
tweetstext = data[tweet].text;
var markerRegExp = new RegExp(this.marker);
if (tweetstext.search(markerRegExp) >= 0) {
this.tweetsGrabbed++;
this.makeListEntry("tweetlist", tweetstext.replace(markerRegExp, ""));
}
}
},
makeListEntry : function(listId, txt) {
var findUrl = /(http:\/\/\S*)/g;
var foundUrl;
var lastMatch = 0;
var entry = document.createElement("li");
var urlTxt = txt.replace(findUrl, '<a href="$1">$1</a>');
entry.innerHTML = urlTxt;
document.getElementById(this.listId).appendChild(entry);
}
}
<?php
/*
Plugin Name: Selective tweet list
Plugin URI: http://wordpress.org/extend/plugins/selective-tweets/
Description: Widget shows list of tweets from specified user which are marked by a specified keyword.
Version: 0.3
Author: publicvoid
Author URI: http://wordpress.org/extend/plugins/profile/publicvoid
*/
add_action('widgets_init', create_function('', 'return register_widget("Selective_Status_Widget");'));
class Selective_Status_Widget extends WP_Widget {
function Selective_Status_Widget() {
$widget_ops = array(
'description' => 'Shows statuses from specified user which are marked by a special keyword.'
);
$this->WP_Widget( 'selective-status', 'Selective Status', $widget_ops);
}
function form($instance) {
// show the options form
$defaults = array(
'twitter_name' => 'myname',
'selection_marker' => '#wp',
'tweets_count' => 7,
'list_title' => 'Selective tweet status',
'noscript_hint' => 'This list can only be shown with javascript switched on.',
'twitter_error' => 'Error in status api, list could not be fetched.',
'status_net' => false
);
$instance = wp_parse_args( (array) $instance, $defaults );
$texts = array(
"twitter_name"=> array(
"title"=>"user name",
"hint"=>"micro blogging user name to be used to fetch the statuses"),
"selection_marker"=> array(
"title"=>"selection marker",
"hint"=>"used to mark tweets that should be included into the list"),
"tweets_count" => array(
"title"=>"tweets count",
"hint"=>"number of tweets to be fetched from twitter (max. 100)"),
"list_title" => array(
"title"=>"list title",
"hint"=>"header of the selective tweets list"),
"noscript_hint" => array(
"title"=>"noscript hint",
"hint"=>"This hint will be shown for users with javascript switched off."),
"twitter_error"=> array(
"title"=>"twitter error message",
"hint"=>"This message will be shown, when twitter is not reachable and fetching data leeds to an error")
);
$field_name = $this->get_field_name("status_net");
$field_id = $this->get_field_id("status_net");
?>
<p>
<label title="which microblogging service you want to be queried">microblogging service:</label><br/>
<input id="<?php echo $field_id; ?>1" type="radio" name="<?php echo $field_name; ?>" value="twitter" <?php checked( $instance['status_net'], false ); ?>/> Twitter
<input id="<?php echo $field_id; ?>2" type="radio" name="<?php echo $field_name; ?>" value="status" <?php checked( $instance['status_net'], true ); ?> /> Identi.ca
</p>
<?php
foreach ($texts as $key => $texts) {
$field_id = $this->get_field_id($key);
$field_name = $this->get_field_name($key); ?>
<p>
<label for="<?php echo $field_id; ?>" title="<?php echo $texts['hint']; ?>" ><?php echo $texts['title']; ?>:</label>
<input id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" value="<?php echo $instance[$key]; ?>" style="width:100%;" />
</p>
<?php
}
}
function update($new_instance, $old_instance) {
// update settings from options
$instance = $old_instance;
foreach (array('twitter_name','selection_marker','list_title','noscript_hint','twitter_error') as $field) {
$instance[$field] = strip_tags($new_instance[$field]);
}
$instance['status_net'] = ($new_instance['status_net']=="status");
$instance['tweets_count'] = min( intval($new_instance['tweets_count']), 100 );
// 100 is the max results per page (rpp) value for twitters search api and should definitly be enough (so we need to only fetch one page)
return $instance;
}
function widget($args, $instance) {
// actually displays the widget
extract($args);
$list_title = apply_filters('widget_title', $instance['list_title'] );
echo $before_widget;
echo $before_title . $list_title . $after_title; ?>
<ul id="tweetlist">
<noscript><li><?php echo $instance['noscript_hint']; ?></li></noscript>
</ul>
<!-- // TODO ? wp_enqueue_script, don't load multiple times +++ use a proper library for status api requests -->
<script src="wp-content/plugins/selective-tweets/selective-tweet-list.js"></script>
<script>selectiveTweetList.init({
"marker": "<?php echo esc_js($instance['selection_marker']); ?>",
"twitterName": "<?php echo esc_js($instance['twitter_name']); ?>",
"count": <?php echo $instance['tweets_count']; ?>,
"errorText" : "<?php echo esc_js($instance['twitter_error']); ?>",
"listId": "tweetlist",
"statusNet": <?php echo $instance['status_net'] ? 'true' : 'false'; ?>
});</script>
<?php echo $after_widget;
}
}
?>
This diff is collapsed.
=== Twitter Tools ===
Tags: twitter, tweet, integration, post, digest, notify, integrate, archive, widget
Contributors: alexkingorg, crowdfavorite
Requires at least: 2.9
Tested up to: 3.0.1
Stable tag: 2.4
Twitter Tools is a plugin that creates a complete integration between your WordPress blog and your Twitter account.
== Details ==
Twitter Tools integrates with Twitter by giving you the following functionality:
* Archive your Twitter tweets (downloaded every 10 minutes)
* Create a blog post from each of your tweets
* Create a daily or weekly digest post of your tweets
* Create a tweet on Twitter whenever you post in your blog, with a link to the blog post
* Post a tweet from your sidebar
* Post a tweet from the WP Admin screens
* Pass your tweets along to another service (via API hook)
== Installation ==
1. Download the plugin archive and expand it (you've likely already done this).
2. Put the 'twitter-tools' directory into your wp-content/plugins/ directory.
3. Go to the Plugins page in your WordPress Administration area and click 'Activate' for Twitter Tools.
4. Go to the Twitter Tools Options page (Settings > Twitter Tools) to set up your Twitter information and preferences.
== Configuration ==
There are a number of configuration options for Twitter Tools. You can find these in Options > Twitter Tools.
== Showing Your Tweets ==
= Widget Friendly =
If you are using widgets, you can drag Twitter Tools to your sidebar to display your latest tweets.
= Shortcode =
Use:
`[aktt_tweets]`
to show your latest tweets. This will show the number of tweets set in your Settings. If you want to control how many tweets are shown explicitly, you can do so by adding a 'count' parameter like this:
`[aktt_tweets count=5]`
= Template Tags =
If you are not using widgest, you can use a template tag to add your latest tweets to your sidebar.
`<?php aktt_sidebar_tweets(); ?>`
If you just want your latest tweet, use this template tag.
`<?php aktt_latest_tweet(); ?>`
== Plugins ==
Twitter Tools supports plugins, several are included. You can find more here:
http://delicious.com/alexkingorg/twitter-tools+plugin
== Hooks/API ==
Twitter Tools contains a hook that can be used to pass along your tweet data to another service (for example, some folks have wanted to be able to update their Facebook status). To use this hook, create a plugin and add an action to:
`aktt_add_tweet` (action)
Your plugin function will receive an `aktt_tweet` object as the first parameter.
Example psuedo-code:
`function my_status_update($tweet) { // do something here }`
`add_action('aktt_add_tweet', 'my_status_update')`
---
Twitter Tools also provides a filter on the URL sent to Twitter so that you can run it through an URL-shortening service if you like.
`tweet_blog_post_url` (filter)
Your plugin function will receive the URL as the first parameter.
Example psuedo-code:
`function my_short_url($long_url) {
// do something here - return the shortened URL
$short_url = my_short_url_func($long_url);
return $short_url;
}`
`add_filter('tweet_blog_post_url', 'my_short_url')`
---
`aktt_do_tweet` (filter)
Returning false in this hook will prevent a tweet from being sent. One parameter is sent, the Tweet object to be sent to Twitter.
Example psuedo-code:
`function dont_tweet($tweet) {
if (some condition) {
// will not tweet
return false;
}
else {
// must return the $tweet to send it
return $tweet;
}
}`
`add_filter('aktt_do_tweet', 'dont_tweet')`
---
`aktt_do_blog_post_tweet` (filter)
Returning false in this hook will prevent a blog post Tweet from being sent. Two parameters are passed, the Tweet object to be sent to Twitter and the Post generating the Tweet.
Example psuedo-code:
`function dont_post_tweet($tweet, $post) {
if (some condition) {
// will not tweet
return false;
}
else {
// must return the $tweet to send it
return $tweet;
}
}`
`add_filter('aktt_do_blog_post_tweet', 'dont_post_tweet', 10, 2)`
---
`aktt_do_tweet_post` (filter)
Returning false in this hook will prevent a blog post from being created from a Tweet. Two parameters are passed, the data to be used in the post and the Tweet object.
Example psuedo-code:
`function dont_tweet_post($post, $data) {
if (some condition) {
// will not post
return false;
}
else {
// must return the $data for a post to be created
return $data;
}
}`
`add_filter('aktt_do_tweet_post', 'dont_tweet_post', 10, 2)`
---
`aktt_tweets_to_digest_post` (filter)
Allows you to make changes the tweets that will be included in a digest post.
---
`aktt_options_form` (action)
Allows you to add to the Twitter Tools settings page.
---
`aktt_post_options` (action)
Allows you to add to the Twitter Tools box on the New Post page (requires the option to tweet on blog posts to be enabled).
== Known Issues ==
* If you change your blog post notification tweet prefix, the previous blog post notification might not be correctly recognized as a blog post tweet. This is only under very rare conditions due to timing issues.
* Only one Twitter account is supported (not one account per author).
* Tweets are not deleted from the tweet table in your WordPress database when they are deleted from Twitter. To delete from your WordPress database, use a database admin tool like phpMyAdmin.
== Frequently Asked Questions ==
= Who is allowed to post a Tweet from within WordPress? =
Anyone who has a 'publish_post' permission. Basically, if you can post to the blog, you can also post to Twitter (using the account info in the Twitter Tools configuration).
= What happens if I have both my tweets posting to my blog as posts and my posts sent to Twitter? Will it cause the world to end in a spinning fireball of death? =
Actually, Twitter Tools has taken this into account and you can safely enable both creating posts from your tweets and tweets from your posts without duplicating them in either place.
= Does Twitter Tools use a URL shortening service by default? =
No, Twitter Tools sends your long URL to Twitter and Twitter chooses to shorten it or not.
As of version 2.0 a plugin to do this with the Bit.ly service is included as an option.
= Can Twitter Tools use a URL shortening service? =
Yes, Twitter Tools includes a filter:
`tweet_blog_post_url`
as of version 1.6. Plugins for this filter may already exist, or you can create your own. The plugin needs to attach to this filter using the standard WordPress `add_filter()` function and return a URL that will then be passed with your blog post tweet.
As of version 2.0 a plugin to do this with the Bit.ly service is included as an option.
= Is there any way to change the 'New Blog Post:' prefix when my new posts get tweeted? =
Yes, as of version 2.0 you can change this on the Options page.
= Can I remove the 'New Blog Post:' prefix entirely? =
No, this is not a good idea. Twitter Tools needs to be able to look at the beginning of the tweet and identify if it's a notification from your blog or not. Otherwise, Twitter Tools and Twitter could keep passing the blog posts and resulting tweets back and forth resulting in the 'spinning fireball of death' mentioned above.
== Changelog ==
= 2.4 =
* Replaced 401 authentication with OAuth.
* Now relies on WordPress to provide JSON encode/decode functions.
* WP 3.0 compatibility fix for hashtags plugin (set default hashtags properly).
* WP 3.0 compatibility fix for creating duplicate post meta.
* Added support form to settings page.
= 2.3.1 =
* Fixed a typo that was breaking the latest tweet template tag.
= 2.3 =
* Added nonces
* Patched several potential security issues (thanks Mark Jaquith)
* Load JS and CSS in separate process to possibly avoid some race conditions
= 2.2.1 =
* Typo-fix that should allow resetting digests properly (not sure when this broke, thanks lionel_chollet).
= 2.2 =
* The use of the native `json_encode()` function, required by the changes in WordPress 2.9 (version 2.1) created a problem for users with servers running 32-bit PHP. the `json_decode()` function treats the tweet ID field as an integer instead of a string, which causes the issues. Thanks to Joe Tortuga and Ciaran Walsh for sending in the fix.
= 2.1.2 =
* Missed one last(?) instance of Services_JSON
= 2.1.1 =
* Missed replacing a couple of instances of Services_JSON
= 2.1 =
* Make install code a little smarter
* Add unique index on tweet ID columns, remove duplicates and optimize table
* Track the currently installed version for easier upgrades in the future
* Cleanup around login test code
* Add action on Update Tweets (aktt_update_tweets)
* Add a shortcode to display recent tweets
* Exclude replies in aktt_latest_tweet() function (if option selected)
* Better RegEx for username and hashtag linking
* Use site_url() and admin_url(), losing backward compatibility but gaining SSL compatibility
* Added WordPress HelpCenter contact info to settings page
* Use standard meta boxes (not backwards compatible) for post screen settings
* Change how Services_JSON is included to be compatible with changes in WP 2.9 and PHP < 5.2
* Digest functionality is marked as experimental, they need to be fundamentally rewritten to avoid race conditions experienced by some users
* Misc code cleanup and bug fixes
* Added language dir and .pot file
Bit.ly plugin
* Changed RegEx for finding URLs in tweet content (thanks Porter Maus)
* Added a j.mp option
* Cleaned up the settings form
* Added a trim() on the API Key for people that struggle with copy/paste
* Use admin_url(), losing backward compatibility but gaining SSL compatibility
Exclude Category plugin
* Use admin_url(), losing backward compatibility but gaining SSL compatibility
Hashtags plugin
* Use admin_url(), losing backward compatibility but gaining SSL compatibility
= 2.0 =
* Added various hooks and filters to enable other plugins to interact with Twitter Tools.
* Added option to set blog post tweet prefix
* Added CSS classes for elements in tweet list
* Initial release of Bit.ly for Twitter Tools - enables shortening your URLs and tracking them on your Bit.ly account.
* Initial release of #hashtags for Twitter Tools - enables adding hashtags to your blog post tweets.
* Initial release of Exclude Category for Twitter Tools - enables not tweeting posts in chosen categories.
<?php
/*
Plugin Name: Twitter Tools - Bit.ly URLs
Plugin URI: http://crowdfavorite.com/wordpress/
Description: Use Bit.ly for URL shortening with Twitter Tools. This plugin relies on Twitter Tools, configure it on the Twitter Tools settings page.
Version: 2.4
Author: Crowd Favorite
Author URI: http://crowdfavorite.com
*/
// Thanks to Porter Maus for his contributions.
// ini_set('display_errors', '1'); ini_set('error_reporting', E_ALL);
if (!defined('PLUGINDIR')) {
define('PLUGINDIR','wp-content/plugins');
}
load_plugin_textdomain('twitter-tools-bitly');
define('AKTT_BITLY_API_SHORTEN_URL', 'http://api.bit.ly/shorten');
define('AKTT_BITLY_API_SHORTEN_URL_JMP', 'http://api.j.mp/shorten');
define('AKTT_BITLY_API_VERSION', '2.0.1');
function aktt_bitly_shorten_url($url) {
$parts = parse_url($url);
if (!in_array($parts['host'], array('j.mp', 'bit.ly'))) {
$snoop = get_snoopy();
$api_urls = array(
'bitly' => AKTT_BITLY_API_SHORTEN_URL,
'jmp' => AKTT_BITLY_API_SHORTEN_URL_JMP,
);
$api = $api_urls[aktt_bitly_setting('aktt_bitly_api_url')].'?version='.AKTT_BITLY_API_VERSION.'&longUrl='.urlencode($url);
$login = get_option('aktt_bitly_api_login');
$key = get_option('aktt_bitly_api_key');
if (!empty($login) && !empty($key)) {
$api .= '&login='.urlencode($login).'&apiKey='.urlencode($key).'&history=1';
}
$snoop->agent = 'Twitter Tools http://alexking.org/projects/wordpress';
$snoop->fetch($api);
$result = json_decode($snoop->results);
if (!empty($result->results->{$url}->shortUrl)) {
$url = $result->results->{$url}->shortUrl;
}
}
return $url;
}
add_filter('tweet_blog_post_url', 'aktt_bitly_shorten_url');
function aktt_bitly_shorten_tweet($tweet) {
if (strpos($tweet->tw_text, 'http') !== false) {
preg_match_all('$\b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]$i', $test, $urls);
if (isset($urls[0]) && count($urls[0])) {