Options configuration panel Version: 3.0 Author: AskApache Author URI: http://www.askapache.com == Installation == 1. Upload and unzip to the /wp-content/plugins/ directory then activate 2. Go to your Options Panel and open the "AA Firefox Ads" submenu. /wp-admin/options-general.php?page=askapache-firefox-adsense.php 3. Enter in your google firefox adsense code and hit the "Update Values" Button. 4. Add the code on your pages by including in your templates (1 per page, 1 ad per page). /--------------------------------------------------------------------\ | | | License: GPL | | | | AskApache Firefox Adsense Plugin - Adds Adsense for Firefox | | Copyright (C) 2007-2008, AskApache, www.askapache.com | | All rights reserved. | | | | This program 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. | | | | You should have received a copy of the GNU General Public License | | along with this program; if not, write to the | | Free Software Foundation, Inc. | | 51 Franklin Street, Fifth Floor | | Boston, MA 02110-1301, USA | | | \--------------------------------------------------------------------/ */ function aa_is_wp_cache(){ $aa_cache=false; if( !@include(ABSPATH . 'wp-content/wp-cache-config.php') ) $aa_cache=false; else { if(!$cache_enabled)$aa_cache=false; else $aa_cache=true; } return $aa_cache; } function aa_firead_options_setup() { add_options_page('AskApache Firefox Adsense', 'AA Firefox Ads', 7, basename(__FILE__), 'aa_firead_page'); } add_action('admin_menu', 'aa_firead_options_setup'); //--------------------------- function aa_firead_page() { $AA_FIREAD_V='3.0'; $aa_firead_code=''; global $aa_status; // security if ( function_exists('current_user_can') && !current_user_can('manage_options') ) die(__('Cheatin’ uh?')); if (! user_can_access_admin_page()) { wp_die( __('You do not have sufficient permissions to access this page.') ); } if($_SERVER['REQUEST_METHOD']==='POST'){ $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'askapache-firead-update_modify'); if(isset($_POST['aafireadcode'])) update_option('aa_firead_code',stripslashes($_POST['aafireadcode'])); $aa_status = '

Updated successfully.

'; } $aa_firead_code = get_option('aa_firead_code'); $aa_head='

[ - Get Firefox Adsense Code - AskApache Firefox Adsense Plugin '. $AA_FIREAD_V . ' - Author Home ]


'; ob_start(); echo '

Firefox Adsense Preview

'; aa_firefox_ad_test(); echo '
'; $aa_test=ob_get_clean(); $aa_main ='

AskApache Firefox Adsense ' . $AA_FIREAD_V . '

Firefox plus Google Toolbar: When a user you\'ve referred to Firefox plus Google Toolbar runs Firefox for the first time, you\'ll receive up to US$1 in your account, depending on the user\'s location. Your referral must be a Windows user, who has not previously installed Firefox, in order for you to receive credit.
'; $aa_foot='
Google Firefox Adsense Code
'; _e($aa_head); _e($aa_status); _e($aa_test); ?>

Insert this code into your template files to use. <?php if(function_exists('aa_firefox_ad'))aa_firefox_ad();?>

'; } else $aa_firead_code = get_option('aa_firead_code'); if(!aa_is_wp_cache()){ if($aa_bad===false) echo $aa_firead_code; else echo ''; }else echo ''; } function aa_firefox_ad_test(){ global $aa_status; $aa_tstatus='
'; $aa_firead_code=''; if(!isset($_SERVER['HTTP_USER_AGENT'])) $aa_tstatus.='

Your HTTP_USER_AGENT is not set... weird!.

'; else if(preg_match("/firefox/i", $_SERVER['HTTP_USER_AGENT'])) $aa_tstatus.='

You are using firefox! Normally you would not see this firefox ad..

'; else $aa_tstatus.='

You are not using firefox! '.$_SERVER['HTTP_USER_AGENT'].' which is required for this ad to be shown.

'; if(preg_match("/windows/i", $_SERVER['HTTP_USER_AGENT'])) $aa_tstatus.='

You are using Windows, which is required for this ad to be shown.

'; else $aa_tstatus.='

You are not using Windows! '.$_SERVER['HTTP_USER_AGENT'].' which is required for this ad to be shown.

'; if(get_option('aa_firead_code')!=='')$aa_firead_code = get_option('aa_firead_code'); else if(isset($_POST['aafireadcode']))$aa_firead_code=stripslashes($_POST['aafireadcode']); $aa_tstatus.=''; $aa_status.=$aa_tstatus; echo $aa_firead_code; } function aa_firefox_ad_activate(){ $default='

Ahh!

Time to get with the modern world...

'; update_option('aa_firead_code',stripslashes($default)); } register_activation_hook(__FILE__, 'aa_firefox_ad_activate'); ?>