<?php
/*
Plugin Name: Adsense
Version: 0.1
Plugin URI: http://philhord.com/wp-hacks/adsense
Description: Inserts Google Adsense inside your posts where you see fit. Simple to use: Edit the adsense.php file to use your Adsense code instead of mine; Activate the plug-in; Click the “Adsense” button on the quicktags bar to insert the Adsense marker in your posts. Please make sure you read Google’s TOS before using this plugin!
Author: Phil Hord
Author URI: http://philhord.com
*/
/*
adsense
This function replaces tags with actual Google Adsense code
*/
function phord_insert_adsense($data) {
$tag = ““;
/**************************************************************************
** Replace this HTML code with your own customized Google Adsense code. **
**************************************************************************/
$adsense_code = ‘
Your Google Adsense code should be here, but you forgot
to edit the plugins/adsense.php file and replace the code
there with your own.
‘;
/**************************************************************************
** All done! No more changes need to be made below this line! Enjoy! **
**************************************************************************/
return str_replace( $tag, $adsense_code, $data );
}
add_filter(‘the_content’, ‘phord_insert_adsense’);
//—- The following AddAButton code comes from the Edit Button Template
//—- found here: http://codex.wordpress.org/Plugins
//—- and originally written by Owen Winkler
//—- It was originally here: http://www.asymptomatic.net/wp-hacks
//—- But I had trouble downloading it from there.
add_filter(‘admin_footer’, ‘phord_InsertAdsenseButton’);
function phord_InsertAdsenseButton()
{
if(strpos($_SERVER['REQUEST_URI'], ‘post.php’))
{
?>
<!–
var toolbar = document.getElementById(“ed_toolbar”);
function adsense_button()
{
edInsertContent(edCanvas, ”);
}
//–>
if(toolbar)
{
var theButton = document.createElement(‘input’);
theButton.type = ‘button’;
theButton.value = ”;
theButton.onclick = ;
theButton.className = ‘ed_button’;
theButton.title = “”;
theButton.id = “”;
toolbar.appendChild(theButton);
}
Filed under: Uncategorized | Leave a Comment »