'AdSense', 'shortname' => 'ad', 'ico' => 'http://www.google.com/favicon.ico', 'www' => 'http://www.google.com/adsense/', 'www-create' => 'https://www.google.com/adsense/adsense-products', 'www-signup' => 'https://www.google.com/adsense/' ); @define("GOOGLE_ADSENSE_SCRIPTADS_URL", "http://pagead2.googlesyndication.com/pagead/show_ads.js"); /* 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 extends Ad_Generic { function Ad_AdSense(){ $this->Ad_Generic(); } function render_ad() { global $_adsensem; $code=''; $code .= '' . "\n"; $code.= '' . "\n"; return $code; } function import_settings($code) { if(preg_match('/google_ad_client = "(.*)"/', $code, $matches)!=0){ $_POST['adsensem-account-id'] = $matches[1]; } if(preg_match('/google_ad_width = (\d*);/', $code, $matches)!=0){ $_POST['adsensem-width'] = $matches[1]; if(preg_match('/google_ad_height = (\d*);/', $code, $matches)!=0){ $_POST['adsensem-height'] = $matches[1]; $_POST['adsensem-adformat']=$_POST['adsensem-width'] . "x" . $_POST['adsensem-height']; } } $this->import_settings_network($code); //passes to subtypes too in classic types $this->save_settings(); } function import_settings_network($code) { //Copy in the name from /* comment */ // /* 728x90, created 2/25/08 */ if(preg_match('/\/\* (.*) \*\//', $code, $matches)!=0){ $_POST['adsensem-notes'] = $matches[1]; } if(preg_match('/google_ad_slot = "(.*)"/', $code, $matches)!=0){ $_POST['adsensem-slot'] = $matches[1]; } if(preg_match('/google_cpa_choice = ""/', $code, $matches)!=0){ //Referral unit if(preg_match('/google_ad_output = "textlink";/', $code, $matches)!=0){$_POST['adsensem-adtype']='ref_text';} else { $_POST['adsensem-adtype']='ref_image'; $_POST['adsensem-referralformat']=$_POST['adsensem-adformat']; //passthru } } else { //Non-referral unit $formats=$this->_var_ad_formats_available(); if( isset($formats['links']['horizontal'][$_POST['adsensem-adformat']]) || isset($formats['links']['square'][$_POST['adsensem-adformat']]) ){ $_POST['adsensem-adtype']='link'; $_POST['adsensem-linkformat']=$_POST['adsensem-adformat']; //passthru } else { $_POST['adsensem-adtype']='ad'; } } } function save_settings_network() { //Note the account-id will not be saved from a non-default page because there is no form element for it >> blank. if($_POST['adsensem-account-id']!=''){ $this->set_account_id(preg_replace('/\D/','',$_POST['adsensem-account-id'])); } $this->p['slot']=strip_tags(stripslashes($_POST['adsensem-slot'])); $this->p['adtype']=strip_tags(stripslashes($_POST['adsensem-adtype'])); //Override adformat saving already switch($this->p['adtype']){ case 'ad': $this->p['adformat']=$_POST['adsensem-adformat']; break; case 'link': $this->p['adformat']=$_POST['adsensem-linkformat']; break; case 'ref_image': $this->p['adformat']=$_POST['adsensem-referralformat']; break; default: $this->p['adformat']=''; } list($this->p['width'],$this->p['height'],$null)=split('[x]',$this->p('adformat')); } function reset_defaults_network() { global $_adsensem; $_adsensem['defaults'][$this->network()]+= array ( 'slot' => '', 'html-before' => '', 'html-after' => '', ); } function import_detect_network($code){ return ( (strpos($code,'google_ad_client')!==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 ); } /* ACCOUNT ID SPECIFIC SAVE/ETC. Allows for overriding of this in sub-ad-types, etc. to share id's between types/networks. */ function account_id(){ global $_adsensem; return $_adsensem['account-ids']['Ad_AdSense']; } function set_account_id($aid){ global $_adsensem; $_adsensem['account-ids']['Ad_AdSense']=$aid; } function _form_settings_help(){ ?>
Further configuration and control over channel and slot setup can be achieved through Google's online system: