The different weights (numeric and >0) with which to display the ads. A higher value means they are more likely to be displayed. It is not suggested to put any of them at 0, but it is possible (they won\'t be displayed)

'; } function adherder_normal_weight_input() { $options = get_option('adherder_options'); echo ""; } function adherder_converted_weight_input() { $options = get_option('adherder_options'); echo ""; } function adherder_seen_weight_input() { $options = get_option('adherder_options'); echo ""; } function adherder_display_limit_text() { echo '

Enter the number of times an ad is displayed before it is considered "seen"

'; } function adherder_seen_limit_input() { $options = get_option('adherder_options'); echo ""; } function adherder_track_logged_in_text() { echo '

When this option is disabled, AdHerder will not store tracking data or impressions/click counts for administrators.

'; } function adherder_track_logged_in_input() { $options = get_option('adherder_options'); echo ""; } function adherder_ajax_widget_section_text() { echo '

This will load the widget\'s content via an Ajax call. If you are using any kind of caching plugin and want correct results, you need to turn this on. But keep in mind that you might need to rewrite some ads that use JavaScript.

'; } function adherder_ajax_widget_input() { $options = get_option('adherder_options'); echo ""; } function adherder_validate_options( $input ) { $valid = array(); $options = get_option('adherder_options'); $input_normal_weight = $input['normal_weight']; if(is_numeric($input_normal_weight)) { $valid['normal_weight'] = absint($input_normal_weight); } else { add_settings_error('adherder_normal_weight', 'adherder_options_error', 'Weight must be >= 0'); $valid['normal_weight'] = $options['normal_weight']; } $input_converted_weight = $input['converted_weight']; if(is_numeric($input_converted_weight)) { $valid['converted_weight'] = absint($input_converted_weight); } else { add_settings_error('adherder_converted_weight', 'adherder_options_error', 'Weight must be >= 0'); $valid['converted_weight'] = $options['converted_weight']; } $input_seen_weight = $input['seen_weight']; if(is_numeric($input_seen_weight)) { $valid['seen_weight'] = absint($input_seen_weight); } else { add_settings_error('adherder_seen_weight', 'adherder_options_error', 'Weight must be >= 0'); $valid['seen_weight'] = $options['seen_weight']; } $input_seen_limit = $input['seen_limit']; if(is_numeric($input_seen_limit)) { $valid['seen_limit'] = absint($input_seen_limit); } else { add_settings_error('adherder_seen_limit', 'adherder_options_error', 'Limit must be >= 0'); $valid['seen_limit'] = $options['seen_limit']; } $valid['track_logged_in'] = isset($input['track_logged_in']); $valid['ajax_widget'] = isset($input['ajax_widget']); return $valid; } function adherder_options_page() { include(plugin_dir_path(__FILE__).'/../template/options.php'); } /** * Enqueue the JavaScript used by the admin interface * */ function adherder_report_scripts() { // the google chart API is used for reporting wp_enqueue_script('google-jsapi', 'https://www.google.com/jsapi'); } /** * css for the help display */ function adherder_help_styles() { wp_enqueue_style('adherder-help', plugins_url('/adherder/css/adherder-help.css')); } function adherder_reporting_page() { $message = ''; if(isset($_POST['adherder_switch_status'])) { $ad_id = $_POST['adherder_switch_ad_id']; $ad_post = get_post($ad_id); if($ad_post && $ad_post->post_type == 'adherder_ad') { $post_update = array(); $post_update['ID'] = $ad_id; $post_changed = false; if($ad_post->post_status == 'publish') { $post_update['post_status'] = 'pending'; $post_changed = true; } else if($ad_post->post_status == 'pending') { $post_update['post_status'] = 'publish'; $post_changed = true; } else { $message = 'The call id is not in status pending or publish, status was not updated.'; } if($post_changed) { wp_update_post($post_update); } } else { $message = 'The ad id you entered is incorrect.'; } } if(isset($_POST['adherder_clear_history'])) { $ad_id = $_POST['adherder_clear_ad_id']; $ad_post = get_post($ad_id); if($ad_post && $ad_post->post_type == 'adherder_ad') { adherder_database_clean_for_post($ad_id); update_post_meta($ad_id, 'adherder_impressions', 0); update_post_meta($ad_id, 'adherder_clicks', 0); $message = 'Cleared all data for ad with id ' . $ad_id; } else { $message = 'Id ' . $ad_id . ' is not a valid ad id'; } } if(isset($_POST['adherder_cleanup_old_data'])) { adherder_database_clean(); $message = 'Older impression data cleared'; } $reports = adherder_database_find_reports(); include(plugin_dir_path(__FILE__).'/../template/report.php'); } function adherder_columns($columns) { $columns = array( "cb" => "", "title" => "Action Title", "impressions" => "Impressions", "clicks" => "Clicks", "author" => "Author", "categories" => "Categories", "date" => "Date" ); return $columns; } function adherder_column($column) { global $post; if ("ID" == $column) echo $post->ID; elseif ("impressions" == $column) echo adherder_get_impressions($post->ID); elseif ("clicks" == $column) echo adherder_get_clicks($post->ID); } function adherder_column_orderby($orderby, $wp_query) { global $wpdb; $wp_query->query = wp_parse_args($wp_query->query); if ( 'impressions' == @$wp_query->query['orderby'] ) $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = 'adherder_impressions') " . $wp_query->get('order'); if ( 'clicks' == @$wp_query->query['orderby'] ) $orderby = "(SELECT meta_value FROM $wpdb->postmeta WHERE post_id = $wpdb->posts.ID AND meta_key = 'adherder_clicks') " . $wp_query->get('order'); return $orderby; } function adherder_column_register_sortable($columns) { $columns['impressions'] = 'impressions'; $columns['clicks'] = 'clicks'; return $columns; } ?>