'AdSense Ad Unit',
'shortname' => 'ada',
'display' => false,
'limit-ads' => 3
);
/*
INITIALISATION
All functions in here called at startup (after other plugins have loaded, in case
we need to wait for the widget-plugin).
*/
class Ad_AdSense_Ad extends Ad_AdSense_Classic {
function Ad_AdSense_Ad(){
$this->Ad_AdSense_Classic();
}
function render_ad() {
global $_adsensem;
$code='';
$code .= '' . "\n";
$code.= '' . "\n";
return $code;
}
/* ADMIN Settings - Editing form for each Ad and defaults, reusable */
function admin_manage_form_network($name=false)
{
if($this->p['product']==''){$this->p['product']='ad';}
if($name!==false){ ?>
p['alternate-ad']=stripslashes($_POST['adsensem-alternate-ad']);
$this->p['alternate-url']=stripslashes($_POST['adsensem-alternate-url']);
$this->p['alternate-color']=stripslashes($_POST['adsensem-alternate-color']);
$this->p['slot']='Ad';
}
function reset_defaults_network() {
global $_adsensem;
$_adsensem['defaults'][$this->network()]+= array (
'color-border'=> 'FFFFFF',
'color-title' => '0000FF',
'color-bg' => 'FFFFFF',
'color-text' => '000000',
'color-link' => '008000',
'channel' => '',
'uistyle' => '',
'slot' => '',
'adformat' => '250x250',
'adtype' => 'text_image',
'linkformat' => '120x90',
'linktype' => '_0ads_al_s',
'html-before' => '',
'html-after' => '',
'alternate-ad'=>'benice',
);
}
//Processes the alternate ad options and returns correct code(complicated and needed across the adsense ads).
function _render_alternate_ad_code(){
$code='';
switch ($this->pd('alternate-ad')){
case 'benice' : $code.= 'google_alternate_ad_url = "?adsensem-benice=' . $this->pd('adformat') . '";' . "\n"; break;
case 'url' : $code.= 'google_alternate_ad_url = "' . $this->pd('alternate-url') . '";' . "\n"; break;
case 'color' : $code.= 'google_alternate_ad_color = "' . $this->pd('alternate-color') . '";' . "\n"; break;
case '' : break;
default : $code.= 'google_alternate_ad_url = "' . get_bloginfo('wpurl') . '/?adsensem-show-ad=' . $this->p('alternate-ad') . '";' . "\n";
}
return $code;
}
function import_detect_network($code){
return ( (strpos($code,'google_ad_client')!==false) &&
(strpos($code,'_as')!==false) &&
(strpos($code,'google_cpa_choice')===false) && //i.e. not a referral thing
(strpos($code,'google_ad_slot')===false) //i.e. not using the new slot system
);
}
// $yesno=array("yes" => 'Yes', "no" => 'No');
/*Adsense*/
function _var_ad_types_available(){
return array('text_image' => 'Text & Image', 'image' => 'Image Only', 'text' => 'Text Only');
}
function _form_settings_alternate_ads(){
$default=array('' => 'Use Default');
$alternates['Basic']=array('benice'=>'Be Nice!','url'=>'URL (Enter)','color'=>'Color (Enter)','none'=>'None');
$alternates['Defined Ads']=$this->get_alternate_ads();
adsensem_admin::_field_select('Alternates','alternate-ad',$alternates);
adsensem_admin::_field_input('URL','alternate-url',20,'Enter URL to alternate Ad for display when Google Ad unavailable.');
adsensem_admin::_field_input('Color','alternate-color',20,'Enter #RRGGBB color to display when Google Ad unavailable.');
}
}
?>