query_vars ) ) { switch( $wp->query_vars['wordtwit'] ) { case 'create': include( 'ajax/create-url.php' ); break; case 'news': include( 'ajax/news.php' ); break; } exit; } } function wordtwit_avatar( $avatar ) { global $comment; if ( $comment->comment_type == 'wordtwit' ) { echo "comment_agent . "\" alt=\"\" />"; } else return $avatar; } function wordtwit_head() { echo ''; } $wordtwit_defaults = array( 'username' => '', 'password' => '', 'alternate_domain' => '', 'tags' => array(), 'reverse' => false, 'activation_time' => 0, 'message' => 'New blog posting, [title] - [link]', 'url_type' => 'tinyurl', 'enable_banner' => true, 'enable_content_conversion' => false ); //update_option( 'wordtwit_settings', '' ); function wordtwit_get_settings() { global $wordtwit_defaults; $settings = $wordtwit_defaults; $wordpress_settings = get_option( 'wordtwit_settings' ); if ( $wordpress_settings ) { foreach( $wordpress_settings as $key => $value ) { $settings[ $key ] = $value; } } return $settings; } function wordtwit_save_post( $post_id ) { if ( !wp_verify_nonce( $_POST['wordtwit_nonce'], 'WordTwit' ) ) { return $post_id; } delete_post_meta( $post_id, 'wordtwit_hashtags' ); } function wordtwit_delete_post( $id ) { global $wpdb; global $table_prefix; $sql = $wpdb->prepare( 'DELETE FROM ' . $table_prefix . 'tweet_urls WHERE post_id = %d', $id ); $wpdb->query( $sql ); } function wordtwit_post_box() { echo ''; echo '

'; echo ''; echo ''; echo ''; } function wordtwit_admin_menu() { if( function_exists( 'add_meta_box' ) ) { add_meta_box( 'wordtwit-box', __( 'WordTwit Post Management', 'wordtwit' ), 'wordtwit_post_box', 'post', 'side' ); } } function wordtwit_init() { global $twit_plugin_prefix; global $wordtwit_cache_time; global $wpdb; global $table_prefix; $settings = wordtwit_get_settings(); if ( $settings['enable_content_conversion'] ) { add_action( 'the_content', 'wordtwit_content' ); } if ( $settings['activation_time'] == 0 ) { $settings['activation_time'] = time(); wordtwit_save_settings( $settings ); } if ( strpos( $_SERVER["REQUEST_URI"], "wp-admin" ) !== false ) { wp_enqueue_script( 'fancybox', compat_get_plugin_url('wordtwit') . '/js/fancybox1.2.1.js', array( 'jquery' ) ); } wordtwit_check_table(); // check TinyURl $url = $_SERVER["REQUEST_URI"]; if ( strlen( $url ) < 6 ) { // might be a tiny URL $params = explode( '/', $url ); if ( count( $params ) == 2 ) { $tiny_url = $params[1]; $sql = $wpdb->prepare( "SELECT original FROM " . $table_prefix . "tweet_urls WHERE url = %s", $tiny_url ); $result = $wpdb->get_row( $sql ); if ( $result ) { $sql = $wpdb->prepare( "UPDATE " . $table_prefix . "tweet_urls SET views = views + 1 WHERE url = %s", $tiny_url ); $wpdb->query( $sql ); $this_site = strtolower( wordtwit_short_home( get_bloginfo('home') ) ); $short_url = strtolower( str_replace( 'www.', '', $result->original ) ); if ( strpos( $short_url, $this_site ) === false && $settings['enable_banner'] ) { // external site header( "Content-type: text/html" ); $profile = $settings['profile']; echo " \n"; echo "\t\n"; echo "\t" . $result->original . " - Courtesy of " . $profile['user']['name'] . "\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\n"; echo "\n"; echo "\t
\"\"Follow " . $profile['user']['name'] . " On Twitter

" . str_replace( 'www.', '', str_replace('http://', '', strtolower( get_bloginfo('home') ) ) ) . "

\n"; echo "

"; echo "

Latest posts from '" . get_bloginfo('name') . "'

\n"; echo "\n"; echo "

\n"; echo "
\"\"original . "\">View Original
"; echo "
\n"; echo "\t