diff -r 000000000000 -r 03b0d1493584 web/wp-content/plugins/twitter-tools-bitly-links/twitter-tools-bitly-links.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/plugins/twitter-tools-bitly-links/twitter-tools-bitly-links.php Wed Dec 23 17:55:33 2009 +0000 @@ -0,0 +1,184 @@ +Twitter Tools posts to Twitter be API-created bit.ly links so you can track the number of clicks and such via your bit.ly account. Requires PHP 5.2.0+. +Author: Viper007Bond +Author URI: http://www.viper007bond.com/ + +**************************************************************************/ + +class TwitterToolsBitlyLinks { + + // Initalize the plugin by registering the hooks + function __construct() { + // Twitter Tools v2.0+ supports this natively. Don't do anything if that sub-plugin is active. + if ( function_exists('aktt_bitly_shorten_url') ) + return false; + + // Load localization domain + load_plugin_textdomain( 'twitter-tools-bitly-links', false, '/twitter-tools-bitly-links/localization' ); + + // This plugin requires PHP 5.2.0+ and WordPress 2.7+ + if ( function_exists('json_decode') && function_exists('wp_remote_retrieve_body') ) { + // Register options + add_option( 'viper_ttbl_login' ); + add_option( 'viper_ttbl_apikey' ); + + // Register hooks + add_action( 'admin_menu', array(&$this, 'register_settings_page') ); + add_action( 'wp_ajax_viper_ttbl_check', array(&$this, 'ajax_authentication_check') ); + add_filter( 'whitelist_options', array(&$this, 'whitelist_options') ); + add_filter( 'tweet_blog_post_url', array(&$this, 'modify_url') ); + + // Make sure the user has filled in their login and API key + $login = trim( get_option('viper_ttbl_login') ); + $apikey = trim( get_option('viper_ttbl_apikey') ); + if ( ( !$login || !$apikey ) && current_user_can('manage_options') ) + add_action( 'admin_notices', array(&$this, 'settings_warn') ); + } + + // Old version of PHP or WordPress? Let the user know. + elseif ( current_user_can('activate_plugins') ) { + add_action( 'admin_notices', array(&$this, 'old_version_warning') ); + } + } + + + // Register the settings page + function register_settings_page() { + add_options_page( __('Twitter Tools: bit.ly Links', 'twitter-tools-bitly-links'), __('Twitter Tools: bit.ly', 'twitter-tools-bitly-links'), 'manage_options', 'twitter-tools-bitly-links', array(&$this, 'settings_page') ); + } + + + // Whitelist the options to allow saving via options.php + function whitelist_options( $whitelist_options ) { + $whitelist_options['twitter-tools-bitly-links'] = array( 'viper_ttbl_login', 'viper_ttbl_apikey' ); + + return $whitelist_options; + } + + + // Warn about an old version of PHP or WordPress + function old_version_warning() { + global $wp_version; + echo '
' . sprintf( __( 'Twitter Tools: bit.ly Links: You do not meet the minimum requirements of PHP %1$s and WordPress %2$s. You are currently using PHP %3$s and WordPress %4$s.', 'vipers-video-quicktags' ), '5.2.0', '2.7', PHP_VERSION, $wp_version ) . "
' . sprintf( __( 'Twitter Tools: bit.ly Links: You must fill in your bit.ly details on the settings page in order for this plugin to function.', 'vipers-video-quicktags' ), admin_url('options-general.php?page=twitter-tools-bitly-links') ) . "