<?
/*
Plugin Name: Google Analytics
Plugin URI: http://blog.thedt.net/2005/11/14/google-analytics-plugin/
Description: allows the user to add their Google Analytics code to each blog page automaticly.
Version: 0.1
Author: Matt Labrum
Author URI: http://blog.thedt.net
*/

add_action('admin_menu','ga_menu');
add_action('admin_head','ga_addcode');
add_action('wp_head','ga_addcode');

function ga_addcode(){
    $code = get_option('ga_code');
    if(!empty($code))echo stripslashes($code);
}

function ga_menu(){

add_options_page('Google Analytics', 'Google Analytics', 9, __FILE__, 'ga_manage');

}

function ga_manage(){

if(isset($_POST['ga_code'])){
update_option('ga_code', $_POST['ga_code']);
echo '<div class="updated"><p><strong>Options saved.</strong></p></div>';
}

?>
<div class="wrap">
<h2>Google Analytics Options</h2>
<?

?>
<form name="form1" method="post" action="/wordpress/xmlrpc.php?rsd">
<fieldset class="options">
Paste your Google Analytics script here<br/>
<textarea cols='80' rows='8' name='ga_code'><?echo stripslashes(get_option('ga_code'));?></textarea>

</fieldset>

<p class="submit">
<input type="submit" name="Submit" value="Update Options &raquo;" />
</p>
</form>

</div>
<?
}


?>
<?xml version="1.0" encoding="utf-8"?><rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
  <service>
    <engineName>WordPress</engineName>
    <engineLink>http://wordpress.org/</engineLink>
    <homePageLink>http://www.hughes-family.org/wordpress</homePageLink>
    <apis>
      <api name="WordPress" blogID="1" preferred="true" apiLink="http://www.hughes-family.org/wordpress/xmlrpc.php" />
      <api name="Movable Type" blogID="1" preferred="false" apiLink="http://www.hughes-family.org/wordpress/xmlrpc.php" />
      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="http://www.hughes-family.org/wordpress/xmlrpc.php" />
      <api name="Blogger" blogID="1" preferred="false" apiLink="http://www.hughes-family.org/wordpress/xmlrpc.php" />
      <api name="Atom" blogID="" preferred="false" apiLink="http://www.hughes-family.org/wordpress/wp-app.php/service" />
    </apis>
  </service>
</rsd>
