$addon) { $addon_file = $addon['slug'] . '/' . $addon['slug'] . '.php'; if (file_exists(WP_PLUGIN_DIR . '/' . $addon_file)) { $tb_installed_addons[$addon_id] = true; if(is_plugin_active($addon_file)) { $tb_active_addons[$addon_id] = true; } else { $tb_active_addons[$addon_id] = false; } } else { $tb_installed_addons[$addon_id] = false; } } return false; } function tb_admin_load_scripts() { global $js_labels; wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-fancybox', '/' . PLUGINDIR . '/tweet-blender/js/fancybox/jquery.fancybox-1.3.4.pack.js',array('jquery')); wp_enqueue_script('tb-lib', '/' . PLUGINDIR . '/tweet-blender/js/lib.js',array('jquery')); wp_localize_script('tb-lib', 'TB_labels', $js_labels); wp_enqueue_script('tb-admin', '/' . PLUGINDIR . '/tweet-blender/js/admin.js',array('jquery','jquery-ui-core','jquery-ui-tabs','jquery-fancybox','tb-lib')); } function tb_admin_load_styles() { wp_enqueue_style('tweet-blender-css', '/' . PLUGINDIR .'/tweet-blender/css/admin.css'); wp_enqueue_style('jquery-ui-css', '/' . PLUGINDIR . '/tweet-blender/css/jquery-ui/jquery-ui.css'); wp_enqueue_style('jquery-tabs-css', '/' . PLUGINDIR . '/tweet-blender/css/jquery-ui/ui.tabs.css'); wp_enqueue_style('jquery-fancybox-css', '/' . PLUGINDIR . '/tweet-blender/js/fancybox/jquery.fancybox-1.3.4.css'); } // register admin page add_action('admin_menu', 'tb_admin_menu'); function tb_admin_menu() { global $tb_installed_addons, $tb_active_addons, $tb_addons; // add hooks for Tweet Blender admin $pagehook = add_options_page(__('Tweet Blender Settings'), __('Tweet Blender', 'tweetblender'), 'manage_options', __FILE__, 'tb_admin_page'); add_action( 'admin_print_scripts-' . $pagehook, 'tb_admin_load_scripts' ); add_action( 'admin_print_styles-' . $pagehook, 'tb_admin_load_styles' ); // add hooks for addons tb_check_addons(); foreach($tb_addons as $addon_id => $addon) { $addon_file = $addon['slug'] . '/' . $addon['slug'] . '.php'; if ($tb_installed_addons[$addon_id] && $tb_active_addons[$addon_id]) { include_once(WP_PLUGIN_DIR . '/' . $addon_file); add_action( 'admin_print_scripts-' . $pagehook, 'tb_admin_load_scripts_addon' . $addon_id ); add_action( 'admin_print_styles-' . $pagehook, 'tb_admin_load_styles_addon' . $addon_id ); } } } function tb_admin_page() { global $wp_json, $tb_option_names, $tb_option_names_system, $tb_keep_tweets_options, $tb_languages, $cache_clear_results, $tb_throttle_time_options, $tb_installed_addons, $tb_active_addons, $tb_package_names; $upgrade_message = ''; // if add-on installation is requested, perform it if (isset($_GET['install_addon'])) { // get item number if (isset($_POST['item_number'])) { $item_number = $_POST['item_number']; } elseif (isset($_GET['item_number'])) { $item_number = $_GET['item_number']; } else { echo __('Error','tweetblender') . ': ' . __('addon ID was not specified', 'tweetblender'); } // store transaction ID to prefs for future auto updates if (isset($_POST['txn_id']) && $item_number) { tb_save_txn_id($item_number, $_POST['txn_id']); } // perform installation tb_download_package($item_number); return; } // check for new versions of addons if we haven't checked recently elseif (!get_transient('tb_addon_checked_upgrade')) { foreach($tb_package_names as $item_number => $name) { // if user purchased the addon if ($txn_id = tb_get_txn_id($item_number)) { $version_check_url = 'http://tweetblender.com/check_upgrade.php?item_number=' . $item_number . '&blog_url=' . urlencode(get_bloginfo('url')) . '&txn_id=' . $txn_id; $version_download_url = 'http://tweetblender.com/download.php?item_number=' . $item_number . '&blog_url=' . urlencode(get_bloginfo('url')) . '&txn_id=' . $txn_id; $response = wp_remote_get($version_check_url); if(!is_wp_error($response)) { if (isset($response['headers']['have-newer-version']) && $response['headers']['have-newer-version'] == 1) { $upgrade_message .= sprintf(__('Newer version of %s is available','tweetblender') . ' - ' . __('upgrade automatically','tweetblender') . ' ' . __('or','tweetblender') . ' ' . __('download to install manually','tweetblender') . '', $name, tb_get_current_page_url(), $item_number, $version_download_url); } } } } // don't check again for 24 hours set_transient('tb_addon_checked_upgrade', true, 60*60*24); } // Read in existing option values from database $tb_o = get_option('tweet-blender'); // set defaults if (empty($tb_o) || (isset($tb_o['archive_tweets_num']) && $tb_o['archive_tweets_num'] < 1)) { $tb_o['archive_tweets_num'] = 20; } // get API limit info $api_limit_data = null; if ($json_data = tb_get_server_rate_limit_json($tb_o)) { $api_limit_data = $wp_json->decode($json_data); } // perform maintenance if (isset($tb_o['archive_keep_tweets']) && $tb_o['archive_keep_tweets'] > 0) { tb_db_cache_clear('WHERE DATEDIFF(now(),created_at) > ' . $tb_o['archive_keep_tweets']); } // See if the user has posted us some information if( isset($_POST['tb_new_data']) && $_POST['tb_new_data'] == 'Y' ) { // check nonce check_admin_referer('tweet_blender_settings_save','tb_nonce'); // if we are disabling cache - clear it if (isset($tb_o['advanced_disabled_cache']) && (!$tb_o['advanced_disable_cache'] && $_POST['advanced_disable_cache'])) { tb_db_cache_clear(); } // if we are clearing individual cached sources if (isset($_POST['delete_cache_src']) && $_POST['delete_cache_src']) { $cleared_sources = array(); foreach ($_POST['delete_cache_src'] as $del_src) { tb_db_cache_clear("WHERE source='$del_src'"); $cleared_sources[] = $del_src; } if (sizeof($cleared_sources) > 0 ) { $cache_clear_results = __('Cleared cached tweets for', 'tweetblender') . ' ' . implode(', ',$cleared_sources); } } // check if we are rerouting with oAuth if ((isset($_POST['advanced_reroute_on']) && $_POST['advanced_reroute_on']) && (isset($_POST['advanced_reroute_type']) && $_POST['advanced_reroute_type'] == 'oauth')) { if(!isset($tb_o['oauth_access_token'])) { // Create TwitterOAuth object and get request token $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); // Get request token $request_token = $connection->getRequestToken(get_bloginfo('url') . '/' . PLUGINDIR . "/tweet-blender/lib/twitteroauth/callback.php"); if ($connection->http_code == 200) { // Save request token to session $tb_o['oauth_token'] = $token = $request_token['oauth_token']; $tb_o['oauth_token_secret'] = $request_token['oauth_token_secret']; update_option('tweet-blender',$tb_o); $errors[] = __('To take advantage of a whitelisted account with oAuth ' , 'tweetblender') . "__('please use your Twitter account to authorize access','tweetblender')."; } else { $errors[] = __("Not able to form oAuth authorization request URL. HTTP status code: ", 'tweetblender') . $connection->http_code; } } } if (isset($errors) && sizeof($errors) > 0) { $message = '
' . $cache_clear_results . '
'; $tb_o = $_POST; } else { // reset oAuth tokens if (isset($_POST['reset_oauth']) && $_POST['reset_oauth']) { unset($tb_o['oauth_access_token']); } // unset archive page ID if archive is disabled if(isset($_POST['archive_is_disabled']) && $_POST['archive_is_disabled']) { unset($tb_o['archive_page_id']); unset($tb_o['archive_is_disabled']); } // cycle through all possible options foreach($tb_option_names as $opt) { // if option was set by user - store it if(isset($_POST[$opt])) { $tb_o[$opt] = $_POST[$opt]; } // else if option was not one that user controls - unset it elseif (!array_key_exists($opt,$tb_option_names_system)) { $tb_o[$opt] = ''; } } // process filter keywords and remove empty elements if (isset($tb_o['filter_bad_strings'])) { $filtered_words = explode(',', $tb_o['filter_bad_strings']); $clean = array(); foreach ($filtered_words as $badw) { $badw = trim($badw); if (strlen($badw) > 0) { $clean[] = $badw; } } $tb_o['filter_bad_strings'] = implode(',',$clean); } update_option('tweet-blender',$tb_o); // Put an options updated message on the screen $message = '

' . __('Settings saved', 'tweetblender') . '. ' . $cache_clear_results . '

'; } } // if addon installation was cancelled by user, show message if (isset($_GET['install_addon']) && $_GET['install_addon'] == 0) { $message = '

'. __('Addon installation was cancelled','tweetblender') . ' ' . __('If you have any questions, please use one of the links under the Help tab', 'tweetblender') . '.

'; } ?>

' . $upgrade_message . '

'; } if (!empty($message)) { echo $message; } if (!empty($log_msg)) { echo ""; } ?>

> > > > > > > >
'; foreach (range(1,10) as $lim) { $throttle_select1 .= '
/>
/>
/>
/>

(/> /> )


' . __('Important','tweetblender') . ': ' . __('clears all cached tweets','tweetblender') . '.'; ?>





»


' . __('Important','tweetblender') . ': ' . __('screen names with modifiers (e.g. @user|#topic), keywords, and hastagas will still use Search API','tweetblender') . '.'; ?>
: hourly_limit); if ($api_limit_data->remaining_hits > 0) { echo sprintf(__('You have %s left', 'tweetblender') . ' · ','' . $api_limit_data->remaining_hits . '') ; } else { echo sprintf(__('You have %s left', 'tweetblender') . ' · ', ''. 0 . ''); } echo __('Next reset', 'tweetblender') . ' ' . tb_verbal_time($api_limit_data->reset_time_in_seconds); } else { echo '' . __('Check failed', 'tweetblender') . ''; } if (isset($tb_o['advanced_reroute_on']) && ($tb_o['advanced_reroute_on'] && $tb_o['advanced_reroute_type'] == 'oauth')) { echo '
' . __('checked with user account (oAuth)', 'tweetblender'); } else { $server_address = __('[IP NOT AVAILABLE]', 'tweetblender'); if (isset($_SERVER['SERVER_ADDR'])) { $server_address = esc_attr($_SERVER['SERVER_ADDR']); } echo '
' . __('checked with IP of your server','tweetblender') . ' (' . $server_address . ')'; } ?>
:
: ' . __('Present', 'tweetblender') . ''; } elseif (!empty($have_private_sources) && !isset($tb_o['oauth_access_token'])) { echo '' . __('Not Present', 'tweetblender') . ''; } else { echo __('Not Needed' , 'tweetblender'); } ?>
: tweets_num != 1) { $s = __("tweets",'tweetblender'); } echo ' '; echo urldecode($cache_src->source) . " - " . $cache_src->tweets_num . " $s - " . __("updated",'tweetblender') . ' ' . tb_verbal_time($cache_src->last_update) . '
'; } echo ''; } elseif (!isset($tb_o['advanced_disable_cache']) || $tb_o['advanced_disable_cache'] == false) { echo '' . __('no cached tweets found and caching is ON', 'tweetblender') . ''; } else { echo '' . __('no cached tweets found and caching is OFF', 'tweetblender') . ''; } ?>

:

one time flat fee of $%s. This will perform a one-click install of a new plugin and you will get FREE upgrades with new features in the future.', 'tweetblender' ),'2.99'); ?>


:

  1. Have other ideas? Please tell me

one time flat fee of $%s. This will perform a one-click install of a new plugin and you will get FREE upgrades with new features in the future.', 'tweetblender' ),'8.99'); ?>

[COMING SOON!]

: http://getsatisfaction.com/tweet_blender
: http://www.facebook.com/pages/Tweet-Blender/96201618006
: http://twitter.com/tweetblender
: http://www.tweetblender.com

prefix . "tweetblender"; $sql = "SELECT source, COUNT(*) AS tweets_num, UNIX_TIMESTAMP(MAX(created_at)) AS last_update FROM " . $table_name . " GROUP BY source"; $results = $wpdb->get_results($sql); return $results; } ?>