'AFPD_Clickbank_Ads_Widget', 'description' => 'Add Affilaite Payday Clickbank Ads to your site.' ); parent::__construct( 'AFPD_Clickbank_Ads_Widget', 'AFPD Clickbank Ads', $widget_options ); } //function to output the widget form function form( $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; $text = ! empty( $instance['text'] ) ? $instance['text'] : 'Your Affiliate Payday ID'; $mt = ! empty( $instance['mt'] ) ? $instance['mt'] : '10px'; $size = ! empty( $instance['size'] ) ? $instance['size'] : '300'; $acat = ! empty( $instance['acat'] ) ? $instance['acat'] : 'marketing'; if ($size == '125') {$s1 = 'checked'; $s2 = '';} if ($size == '300') {$s1 = ''; $s2 = 'checked';} if ($size != '125' && $size != '300') { $s1 = 'checked'; $s2 = ''; } if ($acat == 'marketing') { $c1 = 'selected'; $c2 = ''; $c3 = ''; $c4 = ''; } if ($acat == 'software') { $c1 = ''; $c2 = 'selected'; $c3 = ''; $c4 = ''; } if ($acat == 'family') { $c1 = ''; $c2 = ''; $c3 = 'selected'; $c4 = ''; } if ($acat == 'mixed') { $c1 = ''; $c2 = ''; $c3 = ''; $c4 = 'selected'; } echo '
'; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['text'] = strip_tags( $new_instance['text'] ); $instance['mt'] = strip_tags( $new_instance['mt'] ); $instance['size'] = strip_tags( $new_instance['size'] ); $instance['acat'] = strip_tags( $new_instance['acat'] ); return $instance; } function widget( $args, $instance ) { //get IP of visitors if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //check ip from share internet $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } //set variables $title = apply_filters( 'widget_title', $instance['title'] ); $text = $instance['text']; $link = $instance['link']; $mt = $instance['mt']; //output code echo $args['before_widget']; echo '