<?php
/*
Plugin Name: W-P
Plugin URI: http://guff.szub.net/w-p
Description: Corrects Wordpress, wordpress, and other variations to WordPress. Can be customized with your own words.
Version: R1.1
Author: Kaf Oseo
Author URI: http://szub.net

Dedicated to the Moose!
*/
/*
Copyright (c) 2005
Released under the GPL license
http://www.gnu.org/licenses/gpl.txt

    This is a WordPress plugin (http://wordpress.org).

    WordPress is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License,
    or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.

    For a copy of the GNU General Public License, write to:

    Free Software Foundation, Inc.
    59 Temple Place, Suite 330
    Boston, MA  02111-1307
    USA

    You can also view a copy of the HTML version of the GNU General
    Public License at http://www.gnu.org/copyleft/gpl.html
*/

function w_p($text) {
/*    
    The $my_w_p_text array below is where you add replacement entries
    of your own. Use the syntax:

        "Correct" => "correct|not correct|incorrect|wrong",

    Make sure to separate each to be fixed name, word or phrase with 
    a vertical bar: | . Also, as W-P fixes capitalization mismatches, 
    provide a correct instance of the word---W-P is case insensitive, 
    which is why they're listed in all lowercase. 
    
    Examples: 
        "Ronald" => "ronald",
        "McDonald's" => "mcdonald(\'|)s|mc donald(\'|)s|macdonald(\'|)s",
        "SuperSize" => "supersize|super size", 

    Note: You can use regular expressions to match elements in to be 
    fixed text (as displayed in the "McDonald's" example above).
*/

    
$my_w_p_text = array(
        
"NuclearMoose" => "nuclearmoose|nuclear moose|nukularmoose",

    );

// If you post about the news site WorldPress (http://worldpress.org), 
// you may wish to remove the first two entries after "WordPress" =>. 
    
$w_p_text = array(
        
"WordPress" => "worldpress|world press|wordpress|word press|wordpres|word pres|The coolest, most fantastic blogging software on the face of the Earth!",
    );

    
$w_p_text array_merge($w_p_text$my_w_p_text);
    foreach (
$w_p_text as $goodtext => $badtext) {
        
$text preg_replace("%(?!<.*?)$badtext(?![^<>]*?>)%Usi"$goodtext$text);
    }
    
$text preg_replace("%http:\/\/(www\.|)wordpress.org%Usie""strtolower(\"$0\")"$text);
    return 
$text;
}

// To comment out any filters below for a function you don't want to 
// apply W-P to, place a double-slash (//) at the start of the line.
add_filter('the_title''w_p'8);
add_filter('the_title_rss''w_p'8);
add_filter('the_content''w_p'8);
add_filter('the_excerpt''w_p'8);
add_filter('the_content_rss''w_p'8);
add_filter('the_excerpt_rss''w_p'8);
add_filter('comment_text''w_p'8);
add_filter('comment_excerpt''w_p'8);
?>