• '; echo adrotate_banner($options['group'], $options['banner'], $options['block'], false); echo '
  • '; echo $after_widget; } function adrotate_widget_control_1() { $options = $newoptions = get_option('widget_adrotate_1'); if ( $_POST['adrotate-submit-1'] ) { $newoptions['title'] = strip_tags(stripslashes($_POST['adrotate-title-1'])); $newoptions['group'] = strip_tags(stripslashes($_POST['adrotate-group-1'])); $newoptions['block'] = strip_tags(stripslashes($_POST['adrotate-block-1'])); $newoptions['banner'] = strip_tags(stripslashes($_POST['adrotate-banner-1'])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_adrotate_1', $options); } $title = attribute_escape($options['title']); $group = attribute_escape($options['group']); $block = attribute_escape($options['block']); $banner = attribute_escape($options['banner']); ?>


    HTML will be stripped out.


    Group IDs. If multiple, separate them with commas (ie. 2,3,12,5).


    Sets the amount of banners in a block.


    Leave empty for multiple groups or when using a block! Do NOT enter multiple numbers here!

    'adrotate_widget_1', 'description' => "Add banners in the sidebar." ); wp_register_sidebar_widget('AdRotate_1', 'AdRotate 1', 'adrotate_widget_1', $widget_ops); wp_register_widget_control('AdRotate_1', 'AdRotate 1', 'adrotate_widget_control_1' ); } /*------------------------------------------------------------- Name: adrotate_widget_init_2 Purpose: Widget for the sidebar Receive: -none- Return: -none- -------------------------------------------------------------*/ function adrotate_widget_init_2() { if ( !function_exists('register_sidebar_widget') ) return; if ( !function_exists('adrotate_banner') ) return; function adrotate_widget_2($args) { $options = get_option('widget_adrotate_2'); extract($args); echo $before_widget . $before_title . $options['title'] . $after_title; echo ''; echo $after_widget; } function adrotate_widget_control_2() { $options = $newoptions = get_option('widget_adrotate_2'); if ( $_POST['adrotate-submit-2'] ) { $newoptions['title'] = strip_tags(stripslashes($_POST['adrotate-title-2'])); $newoptions['group'] = strip_tags(stripslashes($_POST['adrotate-group-2'])); $newoptions['block'] = strip_tags(stripslashes($_POST['adrotate-block-2'])); $newoptions['banner'] = strip_tags(stripslashes($_POST['adrotate-banner-2'])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_adrotate_2', $options); } $title = attribute_escape($options['title']); $group = attribute_escape($options['group']); $block = attribute_escape($options['block']); $banner = attribute_escape($options['banner']); ?>


    HTML will be stripped out.


    Group IDs. If multiple, separate them with commas (ie. 2,3,12,5).


    Sets the amount of banners in a block.


    Leave empty for multiple groups or when using a block! Do NOT enter multiple numbers here!

    'adrotate_widget_2', 'description' => "Add banners in the sidebar." ); wp_register_sidebar_widget('AdRotate_2', 'AdRotate 2', 'adrotate_widget_2', $widget_ops_2); wp_register_widget_control('AdRotate_2', 'AdRotate 2', 'adrotate_widget_control_2' ); } /*------------------------------------------------------------- Name: adrotate_dashboard_widget Purpose: Add a WordPress dashboard widget Receive: -none- Return: -none- -------------------------------------------------------------*/ function adrotate_dashboard_widget() { wp_add_dashboard_widget( 'adrotate_stats_widget', 'Adrotate', 'adrotate_stats_widget' ); } /*------------------------------------------------------------- Name: adrotate_stats_widget Purpose: AdRotate stats Receive: -none- Return: -none- -------------------------------------------------------------*/ function adrotate_stats_widget() { global $wpdb; $timezone = get_option('gmt_offset')*3600; $url = get_option('siteurl'); ?> get_var("SELECT COUNT(*) FROM `".$wpdb->prefix."adrotate` ORDER BY `id`"); if($banners > 0) { ?> get_row("SELECT `title`, `clicks` FROM `".$wpdb->prefix."adrotate` ORDER BY `clicks` DESC LIMIT 1"); ?>

    title; ?> with clicks; ?> clicks.

    get_row("SELECT `title`, `clicks` FROM `".$wpdb->prefix."adrotate` ORDER BY `clicks` ASC LIMIT 1"); ?>
    title; ?> with clicks; ?> clicks.

    get_var("SELECT SUM(clicks) FROM `".$wpdb->prefix."adrotate` WHERE `tracker` = 'Y'"); $banners = $wpdb->get_var("SELECT COUNT(*) FROM `".$wpdb->prefix."adrotate` WHERE `tracker` = 'Y'"); ?>
    clicks on all banners.

    get_var("SELECT SUM(shown) FROM `".$wpdb->prefix."adrotate`"); $clicks2 = $wpdb->get_var("SELECT SUM(clicks) FROM `".$wpdb->prefix."adrotate`"); ?>
    0 AND $clicks2 > 0) { $ctr = round((100/$impressions)*$clicks2, 2); } else { $ctr = 0; } echo $impressions.' impressions and '.$clicks2.' clicks. CTR of '.$ctr.'%.'; ?>

    get_results("SELECT `timer`, `bannerid` FROM `".$wpdb->prefix."adrotate_tracker` ORDER BY `timer` DESC LIMIT 5"); ?>
    0) { foreach($lastfive as $last) { $bannertitle = $wpdb->get_var("SELECT `title` FROM `".$wpdb->prefix."adrotate` WHERE `id` = '$last->bannerid'"); echo date('d-m-Y', $last->timer) .', '. $bannertitle .'
    '; } } else { ?> No clicks in the past 24 hours

    Manage Banners  Add Banner

    There are no banners yet. Add some banners now!