<?php
/*
Extension Name: Google Ads
Extension Url: http://michaelraichelson.com/hacks/vanilla/
Description: Adds a <a href="http://google.com/adsense/">Google AdSense</a> unit to the panel.
Version: 0.1
Author: Michael Raichelson
Author Url: http://michaelraichelson.com/
*/
/* !! USER/SITE SPECIFIC VARIABLES - Customize these using your specific adsense values !! */
// google ad client: your identifier that ties your google ads with your account
$gad_id "pub-0333402822049669";

// are you using a google ad channel to track which site this ad unit is on? true or false
$gad_channel_tf true;

// google ad channel: identifier for which site the ads are on.
$gad_channel "3485073212";

// type of ads to show: 1- text only, 2- image only, 3- text or images
// see below for which types of ads can be used in which size units
$gad_type 1

// type of google ad unit to use
//    text or image ads :
//    1.  728 x 90 Leaderboard
//    2.  468 x 60 Banner
//    3.  300 x 250 Medium Rectangle
//    4.  160 x 600 Wide Skyscraper
//    5.  120 x 600 Skyscraper
//    text only ads :
//    6.  336 x 280 Large Rectangle
//    7.  250 x 250 Square
//    8.  234 x 60 Half Banner
//    9.  180 x 150 Small REctangle
//    10. 125x125 Button
//    11. 120 x 240 Vertical Banner
$gad_size 4;

// colors: all are 6 character hex values with no leading #symbol
// border color (edge of boxes)
$gad_color_border 'FFFFFF';
// individual ad background (background of boxes)
$gad_color_background 'FFFFFF';
// ad title link color
$gad_color_link '000099';
// color of URL of advertiser
$gad_color_url '009900';
// color of ad text
$gad_color_text '333333';

// if there are no ads found for your page, replace public service ads with an empty colored box.
// set the color for the box here, OR use an alternate URL (below) OR leave both empty to allow public service ads.
// more information on alternate ad content is available here: http://www.google.com/support/adsense/bin/static.py?page=alternateads.html
$gad_color_altcolor '';

// alternate URL for ad unit if there are no real ads that match. 
// this should be in the form of a fully-qualified URL with http:// on the beginning.
$gad_alturl '';

/* !!! UNLESS YOU ARE RECEIVING PHP ERRORS YOU SHOULDN'T NEED TO EDIT ANYTHING BELOW THIS LINE !!! */

$gad_arr_types = array(
    
=> 'text',
    
=> 'image',
    
=> 'text_image'
);
$gad_arr_sizes = array(
    
=> '728x90_as',
    
=> '468x60_as',
    
=> '300x250_as',
    
=> '160x600_as',
    
=> '120x600_as',
    
=> '336x280_as',
    
=> '250x250_as',
    
=> '234x60_as',
    
=> '180x150_as',
    
10 => '125x125_as',
    
11 => '120x240_as'
);
$gad_dim_x = array(
    
=> 728,
    
=> 468,
    
=> 300,
    
=> 160,
    
=> 120,
    
=> 336,
    
=> 250,
    
=> 234,
    
=> 180,
    
10 => 125,
    
11 => 120
);
$gad_dim_y = array(
    
=> 90,
    
=> 60,
    
=> 250,
    
=> 600,
    
=> 600,
    
=> 280,
    
=> 250,
    
=> 60,
    
=> 150,
    
10 => 125,
    
11 => 240
);

$gad_channel_code '';
if(
$gad_channel_tf){
    
$gad_channel_code 'google_ad_channel ="'.$gad_channel.'";';
}

$gad_altcolor_code '';
if(
$gad_color_altcolor != ''){
    
$gad_altcolor_code 'google_alternate_color = "'.$gad_color_altcolor.'";';
}

$gad_alturl_code '';
if(
$gad_alturl_code != ''){
    
$gad_alturl_code 'google_alternate_ad_url = "'.$gad_alturl.'";';
}

if(
in_array($Context->SelfUrl, array("index.php""categories.php""comments.php""search.php""post.php""account.php""settings.php"))){
$adcode = <<< ENDCODE
<div class="googlead">
    <script type="text/javascript">
    <!--
    google_ad_client = "$gad_id";
    google_ad_width = $gad_dim_x
[$gad_size];
    google_ad_height = $gad_dim_y
[$gad_size];
    google_ad_format = "$gad_arr_sizes
[$gad_size]";
    google_ad_type = "$gad_arr_types
[$gad_type]";
    google_color_border = "$gad_color_border";
    google_color_bg = "$gad_color_background";
    google_color_link = "$gad_color_link";
    google_color_url = "$gad_color_url";
    google_color_text = "$gad_color_text";
    $gad_channel_code
    $gad_altcolor_code
    $gad_alturl_code
    //-->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
ENDCODE;

$Panel->AddString($adcode,false);
}
?>