/** * Initalize class properties */ public static function init() { self::$screens_info = array('wp-slim-view-1' => __('Real-Time Log', 'wp-slimstat'), 'wp-slim-view-2' => __('Overview', 'wp-slimstat'), 'wp-slim-view-3' => __('Audience', 'wp-slimstat'), 'wp-slim-view-4' => __('Site Analysis', 'wp-slimstat'), 'wp-slim-view-5' => __('Traffic Sources', 'wp-slimstat'), 'wp-slim-view-6' => __('Map Overlay', 'wp-slimstat')); // Filters use the following format: browser equals Firefox&&&country contains gb $filters = array(); if (!empty($_REQUEST['fs']) && is_array($_REQUEST['fs'])) { foreach ($_REQUEST['fs'] as $a_request_filter_name => $a_request_filter_value) { $filters[] = "{$a_request_filter_name} {$a_request_filter_value}"; } } // Fields and drop downs if (!empty($_POST['f']) && !empty($_POST['o'])) { $filters[] = "{$_POST['f']} {$_POST['o']} " . (isset($_POST['v']) ? $_POST['v'] : ''); } foreach (array('minute', 'hour', 'day', 'month', 'year', 'interval_direction', 'interval', 'interval_hours', 'interval_minutes') as $a_date_time_filter_name) { if (!empty($_POST[$a_date_time_filter_name])) { $filters[] = "{$a_date_time_filter_name} equals {$_POST[$a_date_time_filter_name]}"; } } // Hidden Filters if (wp_slimstat::$options['restrict_authors_view'] == 'yes' && !current_user_can('manage_options')) { $filters[] = 'author equals ' . $GLOBALS['current_user']->user_login; self::$hidden_filters['author'] = 1; } if (!empty($filters)) { $filters = implode('&&&', $filters); } // Include and initialize the API to interact with the database include_once 'wp-slimstat-db.php'; wp_slimstat_db::init($filters); // Retrieve data that will be used by multiple reports self::$pageviews = wp_slimstat_db::count_records(); // Define all the reports // // Parameters // - title : report name // - callback : function to use to render the report // - callback_args : parameters to pass to the function // - classes : determine the look and feel of this report ( tall, normal, wide, hidden ) // - screens : where should the report appear ( wp-slim-view-1, .., wp-slim-view-4, dashboard, raw ). If 'raw' is used, it means that this report can return an array of rows for other uses ( export, email, etc ) // - tooltip : contextual help to be displayed on hover $chart_tooltip = '<strong>' . __('Chart controls', 'wp-slimstat') . '</strong><ul><li>' . __('Use your mouse wheel to zoom in and out', 'wp-slimstat') . '</li><li>' . __('While zooming in, drag the chart to move to a different area', 'wp-slimstat') . '</li><li>' . __('Double click on an empty region to reset the zoom level', 'wp-slimstat') . '</li></ul>'; self::$reports_info = array('slim_p7_02' => array('title' => __('Activity', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_activity_log'), 'callback_args' => array('type' => 'recent', 'columns' => 'id', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('full-width', 'tall'), 'screens' => array('wp-slim-view-1', 'raw'), 'tooltip' => __('Color codes', 'wp-slimstat') . '</strong><p><span class="little-color-box is-search-engine"></span> ' . __('From search result page', 'wp-slimstat') . '</p><p><span class="little-color-box is-known-visitor"></span> ' . __('Known Visitor', 'wp-slimstat') . '</p><p><span class="little-color-box is-known-user"></span> ' . __('Known Users', 'wp-slimstat') . '</p><p><span class="little-color-box is-direct"></span> ' . __('Other Humans', 'wp-slimstat') . '</p><p><span class="little-color-box"></span> ' . __('Bot or Crawler', 'wp-slimstat') . '</p>'), 'slim_p1_01' => array('title' => __('Pageviews', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_chart'), 'callback_args' => array('chart_data' => wp_slimstat_db::get_data_for_chart('COUNT(ip)', 'COUNT(DISTINCT(ip))'), 'chart_labels' => array(__('Pageviews', 'wp-slimstat'), __('Unique IPs', 'wp-slimstat'))), 'classes' => array('wide', 'chart'), 'screens' => array('wp-slim-view-2', 'dashboard'), 'tooltip' => $chart_tooltip), 'slim_p1_02' => array('title' => __('About Slimstat', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_about_wpslimstat'), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-2')), 'slim_p1_03' => array('title' => __('At a Glance', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_overview_summary'), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'dashboard')), 'slim_p1_04' => array('title' => __('Currently Online', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'username', 'where' => 'dt > ' . (date_i18n('U') - 300), 'use_date_filters' => false, 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'dashboard', 'raw'), 'tooltip' => __('When visitors leave a comment on your blog, WordPress assigns them a cookie. Slimstat leverages this information to identify returning visitors. Please note that visitors also include registered users.', 'wp-slimstat')), 'slim_p1_06' => array('title' => __('Recent Search Terms', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'searchterms', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'wp-slim-view-5', 'raw'), 'tooltip' => __('Keywords used by your visitors to find your website on a search engine.', 'wp-slimstat')), 'slim_p1_08' => array('title' => __('Top Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'SUBSTRING_INDEX(resource, "' . (!get_option('permalink_structure') ? '&' : '?') . '", 1)', 'as_column' => 'resource', 'filter_op' => 'contains', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'dashboard', 'raw'), 'tooltip' => __('Here a "page" is not just a WordPress page type, but any web page on your website, including posts, products, categories, and so on.', 'wp-slimstat')), 'slim_p1_10' => array('title' => __('Top Traffic Sources', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'referer', 'where' => 'referer NOT LIKE "%' . home_url() . '%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'wp-slim-view-5', 'dashboard', 'raw')), 'slim_p1_11' => array('title' => __('Top Known Visitors', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'username', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-2', 'dashboard', 'raw')), 'slim_p1_12' => array('title' => __('Top Search Terms', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'searchterms', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2', 'wp-slim-view-4', 'wp-slim-view-5', 'dashboard', 'raw')), 'slim_p1_13' => array('title' => __('Top Countries', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'country', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-2', 'wp-slim-view-3', 'wp-slim-view-5', 'dashboard', 'raw'), 'tooltip' => __('You can configure Slimstat to ignore a specific Country by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat')), 'slim_p1_15' => array('title' => __('Rankings', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_rankings'), 'classes' => array('normal'), 'screens' => array('wp-slim-view-2'), 'tooltip' => __("Slimstat retrieves live information from Alexa, Facebook and Google, to measures your site's rankings. Values are updated every 12 hours. Filters set above don't apply to this report.", 'wp-slimstat')), 'slim_p1_17' => array('title' => __('Top Language Families', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'SUBSTRING(language, 1, 2)', 'as_column' => 'language', 'filter_op' => 'contains', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-2', 'raw')), 'slim_p2_01' => array('title' => __('Human Visits', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_chart'), 'callback_args' => array('chart_data' => wp_slimstat_db::get_data_for_chart('COUNT(DISTINCT visit_id)', 'COUNT(DISTINCT ip)', '(visit_id > 0 AND browser_type <> 1)'), 'chart_labels' => array(__('Visits', 'wp-slimstat'), __('Unique IPs', 'wp-slimstat')), 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('wide', 'chart'), 'screens' => array('wp-slim-view-3'), 'tooltip' => $chart_tooltip), 'slim_p2_02' => array('title' => __('Audience Overview', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_visitors_summary'), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'dashboard'), 'tooltip' => __('Where not otherwise specified, the metrics in this report are referred to human visitors.', 'wp-slimstat')), 'slim_p2_03' => array('title' => __('Top Languages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'language', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_04' => array('title' => __('Top Browsers', 'wp-slimstat', 'dashboard'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'browser, browser_version', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_05' => array('title' => __('Top Service Providers', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'ip', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('wide', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw'), 'tooltip' => __('Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat')), 'slim_p2_06' => array('title' => __('Top Operating Systems', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'platform', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw'), 'tooltip' => __('Internet Service Provider: a company which provides other companies or individuals with access to the Internet. Your DSL or cable internet service is provided to you by your ISP.<br><br>You can ignore specific IP addresses by setting the corresponding filter under Settings > Slimstat > Filters.', 'wp-slimstat')), 'slim_p2_07' => array('title' => __('Top Screen Resolutions', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'resolution', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'dashboard', 'raw')), 'slim_p2_09' => array('title' => __('Browser Capabilities', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_plugins'), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3')), 'slim_p2_12' => array('title' => __('Visit Duration', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_visit_duration'), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3')), 'slim_p2_13' => array('title' => __('Recent Countries', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'country', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'wp-slim-view-5', 'raw')), 'slim_p2_14' => array('title' => __('Recent Screen Resolutions', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resolution', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_15' => array('title' => __('Recent Operating Systems', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'platform', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_16' => array('title' => __('Recent Browsers', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'browser, browser_version', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_17' => array('title' => __('Recent Languages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'language', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_18' => array('title' => __('Top Browser Families', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'browser', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'raw'), 'tooltip' => __('This report shows you what user agent families (no version considered) are popular among your visitors.', 'wp-slimstat')), 'slim_p2_19' => array('title' => __('Top OS Families', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'CONCAT("p-", SUBSTRING(platform, 1, 3))', 'as_column' => 'platform', 'filter_op' => 'contains', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'raw'), 'tooltip' => __('This report shows you what operating system families (no version considered) are popular among your visitors.', 'wp-slimstat')), 'slim_p2_20' => array('title' => __('Recent Users', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'username', 'where' => 'notes LIKE "%user:%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-3', 'raw')), 'slim_p2_21' => array('title' => __('Top Users', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'username', 'where' => 'notes LIKE "%user:%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-3', 'dashboard', 'raw')), 'slim_p3_01' => array('title' => __('Traffic Sources', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_chart'), 'callback_args' => array('chart_data' => wp_slimstat_db::get_data_for_chart('COUNT(DISTINCT(referer))', 'COUNT(DISTINCT(ip))', '(referer IS NOT NULL AND referer NOT LIKE "%' . home_url() . '%")'), 'chart_labels' => array(__('Domains', 'wp-slimstat'), __('Unique IPs', 'wp-slimstat'))), 'classes' => array('wide', 'chart'), 'screens' => array('wp-slim-view-5'), 'tooltip' => $chart_tooltip), 'slim_p3_02' => array('title' => __('Summary', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_traffic_sources_summary'), 'classes' => array('normal'), 'screens' => array('wp-slim-view-5')), 'slim_p3_06' => array('title' => __('Top Referring Search Engines', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'referer', 'where' => "searchterms IS NOT NULL AND referer NOT LIKE '%" . home_url() . "%'", 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-5', 'dashboard', 'raw')), 'slim_p3_11' => array('title' => __('Recent Exit Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'visit_id', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-5', 'raw')), 'slim_p4_01' => array('title' => __('Recent Outbound Links', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'outbound_resource', 'raw' => array(__CLASS__, 'get_raw_results')), 'callback_raw' => array(__CLASS__, 'get_raw_results'), 'classes' => array('wide'), 'screens' => array('wp-slim-view-4', 'raw'), 'tooltip' => ''), 'slim_p4_02' => array('title' => __('Recent Posts', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => 'content_type = "post"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_03' => array('title' => __('Recent Bounce Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => 'content_type <> "404"', 'having' => 'HAVING COUNT(visit_id) => 1', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw'), 'tooltip' => __('A <em>bounce page</em> is a single-page visit, or visit in which the person left your site from the entrance (landing) page.', 'wp-slimstat')), 'slim_p4_04' => array('title' => __('Recent Feeds', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => '(resource LIKE "%/feed%" OR resource LIKE "%?feed=>%" OR resource LIKE "%&feed=>%" OR content_type LIKE "%feed%")', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_05' => array('title' => __('Recent Pages Not Found', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => '(resource LIKE "[404]%" OR content_type LIKE "%404%")', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_06' => array('title' => __('Recent Internal Searches', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'searchterms', 'where' => 'content_type LIKE "%search%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw'), 'tooltip' => __("Searches performed using WordPress' built-in search functionality.", 'wp-slimstat')), 'slim_p4_07' => array('title' => __('Top Categories', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'category', 'where' => 'content_type LIKE "%category%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'raw'), 'screens' => array('wp-slim-view-4', 'dashboard')), 'slim_p4_09' => array('title' => __('Top Downloads', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'resource', 'where' => 'content_type = "download"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('wide', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw'), 'tooltip' => __('You can configure Slimstat to track specific file extensions as downloads.', 'wp-slimstat')), 'slim_p4_11' => array('title' => __('Top Posts', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'resource', 'where' => 'content_type = "post"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_13' => array('title' => __('Top Internal Searches', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'searchterms', 'where' => 'content_type LIKE "%search%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_15' => array('title' => __('Recent Categories', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => '(content_type => "category" OR content_type => "tag")', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_16' => array('title' => __('Top Pages Not Found', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'resource', 'where' => 'content_type LIKE "%404%"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_18' => array('title' => __('Top Authors', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'author', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal'), 'screens' => array('wp-slim-view-4', 'dashboard', 'raw')), 'slim_p4_19' => array('title' => __('Top Tags', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'category', 'where' => '(content_type LIKE "%tag%")', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_20' => array('title' => __('Recent Downloads', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'recent', 'columns' => 'resource', 'where' => 'content_type = "download"', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('wide', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_21' => array('title' => __('Top Outbound Links', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'outbound_resource', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_22' => array('title' => __('Your Website', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_your_blog'), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4'), 'tooltip' => __('Your content at a glance: posts, comments, pingbacks, etc. Please note that this report is not affected by the filters set here above.', 'wp-slimstat')), 'slim_p4_23' => array('title' => __('Top Bounce Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top', 'columns' => 'resource', 'where' => 'content_type <> "404"', 'having' => 'HAVING COUNT(visit_id) => 1', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_24' => array('title' => __('Top Exit Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top_aggr', 'columns' => 'visit_id', 'outer_select_column' => 'resource', 'aggr_function' => 'MAX', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p4_25' => array('title' => __('Top Entry Pages', 'wp-slimstat'), 'callback' => array(__CLASS__, 'raw_results_to_html'), 'callback_args' => array('type' => 'top_aggr', 'columns' => 'visit_id', 'outer_select_column' => 'resource', 'aggr_function' => 'MIN', 'raw' => array(__CLASS__, 'get_raw_results')), 'classes' => array('normal', 'hidden'), 'screens' => array('wp-slim-view-4', 'raw')), 'slim_p6_01' => array('title' => __('World Map', 'wp-slimstat'), 'callback' => array(__CLASS__, 'show_world_map'), 'classes' => array('tall'), 'screens' => array('wp-slim-view-6'), 'tooltip' => '')); // Allow third party tools to manipulate this list here above: please use unique report IDs that don't interfere with built-in ones, if you add your own custom report self::$reports_info = apply_filters('slimstat_reports_info', self::$reports_info); // Define what reports have been deprecated over time, to remove them from the user's settings $deprecated_reports = array('slim_p1_05', 'slim_p1_18', 'slim_p2_10', 'slim_p3_03', 'slim_p3_04', 'slim_p3_05', 'slim_p3_08', 'slim_p3_09', 'slim_p3_10', 'slim_p4_08', 'slim_p4_10', 'slim_p4_12', 'slim_p4_14', 'slim_p4_17'); // Retrieve this user's list of active reports, $user = wp_get_current_user(); $page_location = wp_slimstat::$options['use_separate_menu'] == 'yes' ? 'slimstat' : 'admin'; // Do this only if we are in one of our screens (no dashboard!) if (!empty($_REQUEST['page']) && strpos($_REQUEST['page'], 'wp-slim-view') !== false) { $user_reports = get_user_option("meta-box-order_{$page_location}_page_{$_REQUEST['page']}", $user->ID); // If this list is not empty, we rearrange the order of our reports if (!empty($user_reports[0])) { $user_reports = array_flip(explode(',', $user_reports[0])); self::$reports_info = array_intersect_key(array_merge($user_reports, self::$reports_info), $user_reports); } // Remove deprecated reports self::$reports_info = array_diff_key(self::$reports_info, $deprecated_reports); $hidden_reports = get_user_option("metaboxhidden_{$page_location}_page_{$_REQUEST['page']}", $user->ID); // If this list is not empty, use it instead of the predefined visibility if (!empty($hidden_reports) && is_array($hidden_reports)) { foreach (self::$reports_info as $a_report_id => $a_report_info) { if (in_array($a_report_id, $hidden_reports)) { if (is_array(self::$reports_info[$a_report_id]['classes']) && !in_array('hidden', $a_report_info['classes'])) { self::$reports_info[$a_report_id]['classes'][] = 'hidden'; } } else { if (is_array(self::$reports_info[$a_report_id]['classes'])) { self::$reports_info[$a_report_id]['classes'] = array_diff(self::$reports_info[$a_report_id]['classes'], array('hidden')); } } } } } else { foreach (self::$reports_info as $a_report_id => $a_report_info) { if (is_array(self::$reports_info[$a_report_id]['classes'])) { self::$reports_info[$a_report_id]['classes'] = array_diff(self::$reports_info[$a_report_id]['classes'], array('hidden')); } } } }