$supported_browser_icons = array('Android', 'Anonymouse', 'Baiduspider', 'BlackBerry', 'BingBot', 'CFNetwork', 'Chrome', 'Chromium', 'Default Browser', 'Exabot/BiggerBetter', 'FacebookExternalHit', 'FeedBurner', 'Feedfetcher-Google', 'Firefox', 'Internet Archive', 'Googlebot', 'Google Feedfetcher', 'Google Web Preview', 'IE', 'IEMobile', 'iPad', 'iPhone', 'iPod Touch', 'Maxthon', 'Mediapartners-Google', 'Microsoft-WebDAV', 'msnbot', 'Mozilla', 'NewsGatorOnline', 'Netscape', 'Nokia', 'Opera', 'Opera Mini', 'Opera Mobi', 'Python', 'PycURL', 'Safari', 'W3C_Validator', 'WordPress', 'Yahoo! Slurp', 'YandexBot'); $supported_os_icons = array('android', 'blackberry os', 'iphone osx', 'ios', 'java', 'linux', 'macosx', 'symbianos', 'win7', 'win8', 'win8.1', 'winphone7', 'winvista', 'winxp', 'unknown'); $supported_browser_types = array(__('Human', 'wp-slimstat'), __('Bot/Crawler', 'wp-slimstat'), __('Mobile Device', 'wp-slimstat'), __('Syndication Reader', 'wp-slimstat')); $plugin_url = plugins_url('', dirname(__FILE__)); // Set the filters $tables_to_join = 'tb.browser,tb.version,tb.platform,tb.css_version,tb.type,tb.user_agent,tci.content_type,tci.category,tci.author,tci.content_id'; wp_slimstat_db::$filters_normalized['misc']['limit_results'] = wp_slimstat::$options['number_results_raw_data']; if (wp_slimstat::$options['include_outbound_links_right_now'] == 'yes') { $tables_to_join .= ',tob.outbound_domain,tob.outbound_resource'; } // Report Header if (empty($_POST['report_id'])) { wp_slimstat_reports::report_header('slim_p7_02', 'tall'); } // Get the data $results = wp_slimstat_db::get_recent('t1.id', '', $tables_to_join); $count_page_results = count($results); $count_all_results = wp_slimstat_db::count_records('1=1', '*', true, true, $tables_to_join); if ($count_page_results == 0) { echo '<p class="nodata">' . __('No data to display', 'wp-slimstat') . '</p>'; } else { if (wp_slimstat::$options['async_load'] != 'yes' || !empty($_POST['report_id'])) { // Pagination echo wp_slimstat_reports::report_pagination('slim_p7_02', $count_page_results, $count_all_results); // Loop through the results for ($i = 0; $i < $count_page_results; $i++) { $results[$i]['ip'] = long2ip($results[$i]['ip']); $host_by_ip = $results[$i]['ip']; if (wp_slimstat::$options['convert_ip_addresses'] == 'yes') { $gethostbyaddr = gethostbyaddr($results[$i]['ip']); if ($gethostbyaddr != $host_by_ip && !empty($gethostbyaddr)) {
<?php // Avoid direct access to this piece of code if (!function_exists('add_action')) { exit(0); } $is_dashboard = empty($_REQUEST['page']) || $_REQUEST['page'] != 'wp-slim-view-1'; // Available icons $supported_browser_icons = array('Android', 'Anonymouse', 'Baiduspider', 'BlackBerry', 'BingBot', 'CFNetwork', 'Chrome', 'Chromium', 'Default Browser', 'Exabot/BiggerBetter', 'FacebookExternalHit', 'FeedBurner', 'Feedfetcher-Google', 'Firefox', 'Internet Archive', 'Googlebot', 'Google Bot', 'Google Feedfetcher', 'Google Web Preview', 'IE', 'IEMobile', 'iPad', 'iPhone', 'iPod Touch', 'Maxthon', 'Mediapartners-Google', 'Microsoft-WebDAV', 'msnbot', 'Mozilla', 'NewsGatorOnline', 'Netscape', 'Nokia', 'Opera', 'Opera Mini', 'Opera Mobi', 'Python', 'PycURL', 'Safari', 'W3C_Validator', 'WordPress', 'Yahoo! Slurp', 'YandexBot'); $supported_os_icons = array('android', 'blackberry os', 'cellos', 'chromeos', 'ios', 'iphone osx', 'java', 'linux', 'macosx', 'rim os', 'symbianos', 'win7', 'win8', 'win8.1', 'winphone7', 'winphone7.5', 'winphone8', 'winphone8.1', 'winvista', 'winxp', 'unknown'); $supported_browser_types = array(__('Human', 'wp-slimstat'), __('Bot/Crawler', 'wp-slimstat'), __('Mobile Device', 'wp-slimstat'), __('Syndication Reader', 'wp-slimstat')); $plugin_url = plugins_url('', dirname(__FILE__)); // Get the data wp_slimstat_db::$debug_message = ''; $all_results = wp_slimstat_db::get_recent(wp_slimstat_reports::$reports_info['slim_p7_02']['callback_args']); $results = array_slice($all_results, wp_slimstat_db::$filters_normalized['misc']['start_from'], wp_slimstat::$options['number_results_raw_data']); // Echo the debug message echo wp_slimstat_db::$debug_message; // Return the results if we are not echoing them (export, email, etc) if (isset($_args['echo']) && $_args['echo'] === false) { return $results; } $count_all_results = count($all_results); $count_page_results = count($results); if ($count_page_results == 0) { echo '<p class="nodata">' . __('No data to display', 'wp-slimstat') . '</p>'; } else { // Pagination echo wp_slimstat_reports::report_pagination($count_page_results, $count_all_results, true, wp_slimstat::$options['number_results_raw_data']); // Show delete button? (only those who can access the settings can see it) $current_user_can_delete = current_user_can(wp_slimstat::$options['capability_can_admin']);
public static function show_spy_view($_id = 'p0', $_type = 'undefined') { $results = !is_int($_type) ? wp_slimstat_db::get_recent('t1.id', '(t1.visit_id > 0 AND tb.type <> 1)', 'tb.browser, tb.version, tb.platform, tb.type, tb.user_agent', '', 't1.visit_id DESC') : wp_slimstat_db::get_recent_outbound($_type); if (count($results) == 0) { echo '<p class="nodata">' . __('No data to display', 'wp-slimstat') . '</p>'; return true; } $visit_id = 0; for ($i = 0; $i < count($results); $i++) { $row_details = ''; $results[$i]['ip'] = long2ip($results[$i]['ip']); $host_by_ip = $results[$i]['ip']; if (wp_slimstat::$options['convert_ip_addresses'] == 'yes') { $host_by_ip = gethostbyaddr($results[$i]['ip']); $host_by_ip .= $host_by_ip != $results[$i]['ip'] ? " ({$results[$i]['ip']})" : ''; } $results[$i]['dt'] = date_i18n(wp_slimstat_db::$formats['date_time_format'], $results[$i]['dt'], true); if (!empty($results[$i]['searchterms']) && empty($results[$i]['resource'])) { $results[$i]['resource'] = __('Search for', 'wp-slimstat') . ': ' . htmlentities($results[$i]['searchterms'], ENT_QUOTES, 'UTF-8'); } if (!empty($results[$i]['resource']) && $_type == 0) { $base_url = ''; if (!empty($results[$i]['blog_id'])) { $base_url = parse_url(get_site_url($results[$i]['blog_id'])); $base_url = $base_url['scheme'] . '://' . $base_url['host']; } $results[$i]['resource'] = '<a target="_blank" class="url" title="' . __('Open this URL in a new window', 'wp-slimstat') . '" href="' . $base_url . htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8') . '"></a> ' . $base_url . self::get_resource_title($results[$i]['resource']); } if ($visit_id != $results[$i]['visit_id']) { $highlight_row = !empty($results[$i]['searchterms']) ? ' is-search-engine' : ' is-direct'; if (empty($results[$i]['user'])) { $host_by_ip = "<a class='slimstat-filter-link' href='" . self::fs_url('ip equals ' . $results[$i]['ip']) . "'>{$host_by_ip}</a>"; } else { $display_user_name = $results[$i]['user']; if (wp_slimstat::$options['show_display_name'] == 'yes' && strpos($results[$i]['notes'], 'user:'******'login', $results[$i]['user']); if (is_object($display_real_name)) { $display_user_name = $display_real_name->display_name; } } $host_by_ip = "<a class='slimstat-filter-link highlight-user' href='" . self::fs_url('user equals ' . $results[$i]['user']) . "'>{$display_user_name}</a>"; $highlight_row = strpos($results[$i]['notes'], '[user]') !== false ? ' is-known-user' : ' is-known-visitor'; } $host_by_ip = "<a class='slimstat-font-location-1 whois' href='" . wp_slimstat::$options['ip_lookup_service'] . "{$results[$i]['ip']}' target='_blank' title='WHOIS: {$results[$i]['ip']}'></a> {$host_by_ip}"; $results[$i]['country'] = "<a class='slimstat-filter-link inline-icon' href='" . self::fs_url('country equals ' . $results[$i]['country']) . "'><img class='slimstat-tooltip-trigger' src='" . plugins_url('/images/flags/' . $results[$i]['country'] . '.png', dirname(__FILE__)) . "' width='16' height='16'/><span class='slimstat-tooltip-content'>" . __('c-' . $results[$i]['country'], 'wp-slimstat') . '</span></a>'; $results[$i]['other_ip'] = !empty($results[$i]['other_ip']) ? " <a class='slimstat-filter-link' href='" . self::fs_url('other_ip equals ' . $results[$i]['other_ip']) . "'>" . long2ip($results[$i]['other_ip']) . '</a> ' : ''; echo "<p class='header{$highlight_row}'>{$results[$i]['country']} {$host_by_ip} <span class='date-and-other'><em>{$results[$i]['other_ip']} {$results[$i]['dt']}</em></span></p>"; $visit_id = $results[$i]['visit_id']; } if (!empty($results[$i]['domain'])) { if (!is_int($_type)) { $element_url = htmlentities(strpos($results[$i]['referer'], '://') == false ? "http://{$results[$i]['domain']}{$results[$i]['referer']}" : $results[$i]['referer'], ENT_QUOTES, 'UTF-8'); $row_details = __('Source', 'wp-slimstat') . ": <a class='slimstat-filter-link' href='" . self::fs_url('domain equals ' . $results[$i]['domain']) . "'>{$results[$i]['domain']}</a>"; if (!empty($results[$i]['searchterms'])) { $row_details .= "<br>" . __('Keywords', 'wp-slimstat') . ": "; $row_details .= self::get_search_terms_info($results[$i]['searchterms'], $results[$i]['domain'], $results[$i]['referer'], true); } } else { $permalink = parse_url($results[$i]['referer']); $results[$i]['notes'] = str_replace('|ET:click', '', $results[$i]['notes']); $element_url = htmlentities(strpos($results[$i]['referer'], '://') === false ? home_url() . $results[$i]['referer'] : $results[$i]['referer'], ENT_QUOTES, 'UTF-8'); $row_details = __('Source', 'wp-slimstat') . ": <a target=\"_blank\" class=\"url\" title=\"" . __('Open this URL in a new window', 'wp-slimstat') . "\" href=\"{$element_url}\"></a><a class=\"slimstat-filter-link\" title=\"" . htmlentities(sprintf(__('Filter results where resource equals %s', 'wp-slimstat'), $permalink['path']), ENT_QUOTES, 'UTF-8') . "\" href=\"" . self::fs_url('resource equals ' . $permalink['path']) . "\">{$permalink['path']}</a>"; $row_details .= !empty($results[$i]['notes']) ? '<br><strong>Link Details</strong>: ' . htmlentities($results[$i]['notes'], ENT_QUOTES, 'UTF-8') : ''; $row_details .= $_type == -1 ? ' <strong>Type</strong>: ' . $results[$i]['type'] : ''; } } if (!empty($row_details)) { $is_expanded = wp_slimstat::$options['expand_details'] == 'yes' ? ' expanded' : ''; $row_details = "<b class='slimstat-row-details{$is_expanded}'>{$row_details}</b>"; } echo "<p>{$results[$i]['resource']} {$row_details}</p>"; } }
public static function get_raw_results($_args = array()) { // Get ALL the results $temp_starting = wp_slimstat_db::$filters_normalized['misc']['start_from']; $temp_limit_results = wp_slimstat_db::$filters_normalized['misc']['limit_results']; wp_slimstat_db::$filters_normalized['misc']['start_from'] = 0; wp_slimstat_db::$filters_normalized['misc']['limit_results'] = 1000; if (empty($_args['type'])) { return array(); } // Default Values $_args = array_merge(array('type' => '', 'columns' => '', 'where' => '', 'having' => '', 'as_column' => '', 'filter_op' => 'equals', 'outer_select_column' => '', 'aggr_function' => 'MAX', 'use_date_filters' => true), $_args); switch ($_args['type']) { case 'recent': $all_results = wp_slimstat_db::get_recent($_args['columns'], $_args['where'], $_args['having'], $_args['use_date_filters'], $_args['as_column']); break; case 'top': $all_results = wp_slimstat_db::get_top($_args['columns'], $_args['where'], $_args['having'], $_args['use_date_filters'], $_args['as_column']); break; case 'top_aggr': $all_results = wp_slimstat_db::get_top_aggr($_args['columns'], $_args['where'], $_args['outer_select_column'], $_args['aggr_function']); break; default: $all_results = array(); break; } // Restore the original filters wp_slimstat_db::$filters_normalized['misc']['start_from'] = $temp_starting; wp_slimstat_db::$filters_normalized['misc']['limit_results'] = $temp_limit_results; return $all_results; }
<?php // Avoid direct access to this piece of code if (!function_exists('add_action')) { exit(0); } // Available icons $supported_browser_icons = array('Android', 'Anonymouse', 'Baiduspider', 'BlackBerry', 'BingBot', 'CFNetwork', 'Chrome', 'Chromium', 'Default Browser', 'Exabot/BiggerBetter', 'FacebookExternalHit', 'FeedBurner', 'Feedfetcher-Google', 'Firefox', 'Internet Archive', 'Googlebot', 'Google Bot', 'Google Feedfetcher', 'Google Web Preview', 'IE', 'IEMobile', 'iPad', 'iPhone', 'iPod Touch', 'Maxthon', 'Mediapartners-Google', 'Microsoft-WebDAV', 'msnbot', 'Mozilla', 'NewsGatorOnline', 'Netscape', 'Nokia', 'Opera', 'Opera Mini', 'Opera Mobi', 'Python', 'PycURL', 'Safari', 'W3C_Validator', 'WordPress', 'Yahoo! Slurp', 'YandexBot'); $supported_os_icons = array('android', 'blackberry os', 'cellos', 'chromeos', 'ios', 'iphone osx', 'java', 'linux', 'macosx', 'rim os', 'symbianos', 'win7', 'win8', 'win8.1', 'winphone7', 'winphone7.5', 'winphone8', 'winphone8.1', 'winvista', 'winxp', 'unknown'); $supported_browser_types = array(__('Human', 'wp-slimstat'), __('Bot/Crawler', 'wp-slimstat'), __('Mobile Device', 'wp-slimstat'), __('Syndication Reader', 'wp-slimstat')); $plugin_url = plugins_url('', dirname(__FILE__)); // Set the filters wp_slimstat_db::$filters_normalized['misc']['limit_results'] = wp_slimstat::$options['number_results_raw_data']; // Get the data $results = wp_slimstat_db::get_recent('*'); // Return the results if we are not echoing them (export, email, etc) if (isset($_args['echo']) && $_args['echo'] === false) { return $results; } $count_page_results = count($results); $count_all_results = wp_slimstat_db::count_records(); if ($count_page_results == 0) { echo '<p class="nodata">' . __('No data to display', 'wp-slimstat') . '</p>'; } else { // Pagination echo wp_slimstat_reports::report_pagination($count_page_results, $count_all_results, true); // Show delete button? (only those who can access the settings can see it) $current_user_can_delete = current_user_can(wp_slimstat::$options['capability_can_admin']); $delete_row = ''; // Loop through the results for ($i = 0; $i < $count_page_results; $i++) {