Affwin Banners Widget

Affwin Banners Widget Parameters

Affiliate Window ID

 

Affiliate Window API Password
Default Banner Keywords
 
Default number of ads to display in sidebar
Number of characters for sidebar banner description
 

post->ID; global $wpdb; $querystr = "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'sidebarquery1' and post_id = $thePostID"; $pageposts = $wpdb->get_results($querystr, ARRAY_N); if ($pageposts<>''){ foreach ($pageposts as $post){ $thissidebarquery1 = $post[1]; } } if ($thissidebarquery1=='')$thissidebarquery1 = $sidebar_default_keywords; if ($thissidebarquery1<>'' ) { $awuser = get_option( "sidebar_awin_id" ); $returnedcolumns = array(sAwImageUrl,sDescription,sBrand,iMerchantId); require_once(WP_PLUGIN_DIR.'/affiliate-window-banners/classes/class.ClientFactory.php'); $awpassword = get_option( "sidebar_api_password" ); $affnumber = get_option( "affbanner_number" ); $affdesc = get_option( "affbancont_number" ); define('API_KEY', $awpassword); $oClient = ClientFactory::getClient(); $aParams7 = array( "iLimit"=> $affnumber, "sQuery" => $thissidebarquery1, "iOffset" => 0, "sSort" => 'popularity', "bIncludeTree" => true, "sColumnToReturn" => $returnedcolumns, "sMode" =>boolean); $oResponse= $oClient->call('getProductList', $aParams7); extract($args); echo $before_widget; foreach($oResponse->oProduct as $details){ $image = $details->sAwThumbUrl; $bigimage = $details->sAwImageUrl; $price = $details->fPrice; $description = $details->sDescription; $merchant = $details->iMerchantId; $awmerchantlink = $details->sAwDeepLink; $name = $details->sName; $awinsidebarcontent .= ''; } ?>
'; _e("Sidebar banners keywords", 'affban_textdomain' ); echo ' '; global $post; $postid=$post->ID; $value = get_post_meta($postid,'sidebarquery1',true); echo ""; } /* When the post is saved, saves our custom data */ function affban_save_postdata( $post_id ) { // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( !wp_verify_nonce( $_POST['affban_noncename'], plugin_basename( __FILE__ ) ) ) return; // Check permissions if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return; } else { if ( !current_user_can( 'edit_post', $post_id ) ) return; } // OK, we're authenticated: we need to find and save the data $mydata = $_POST['affban_new_field']; global $post; $post_id = $post->ID; update_post_meta($post_id,'sidebarquery1',$mydata); } ?>