$keyword_list = yourls_get_longurl_keywords($longurl); $keyword_range = "IN ( '" . join("', '", $keyword_list) . "' )"; // IN ( 'blah', 'bleh', 'bloh' ) } else { $keyword_range = sprintf("= '%s'", yourls_escape($keyword)); } // *** Referrers *** $query = "SELECT `referrer`, COUNT(*) AS `count` FROM `{$table}` WHERE `shorturl` {$keyword_range} GROUP BY `referrer`;"; $rows = $ydb->get_results(yourls_apply_filter('stat_query_referrer', $query)); // Loop through all results and build list of referrers, countries and hits per day foreach ((array) $rows as $row) { if ($row->referrer == 'direct') { $direct = $row->count; continue; } $host = yourls_get_domain($row->referrer); if (!array_key_exists($host, $referrers)) { $referrers[$host] = array(); } if (!array_key_exists($row->referrer, $referrers[$host])) { $referrers[$host][$row->referrer] = $row->count; $notdirect += $row->count; } else { $referrers[$host][$row->referrer] += $row->count; $notdirect += $row->count; } } // Sort referrers. $referrer_sort is a array of most frequent domains arsort($referrers); $referrer_sort = array(); $number_of_sites = count(array_keys($referrers));
yourls_html_link(yourls_link($k), "/{$k}"); } if ($i < count($keyword_list)) { echo ' + '; } } } else { yourls_html_link(yourls_link($keyword)); if (count($keyword_list) > 1) { echo ' <a href="' . yourls_link($keyword) . '+all" title="Aggregate stats for duplicate short URLs"><img src="' . YOURLS_SITE . '/images/chart_bar_add.png" border="0" /></a>'; } } ?> </h3> <h3 id="longurl">Long URL: <img class="fix_images" src="<?php echo yourls_get_domain($longurl, true); ?> /favicon.ico"/> <?php yourls_html_link($longurl, '', 'longurl'); ?> </h3> <div id="tabs"> <div class="wrap_unfloat"> <ul id="headers" class="toggle_display stat_tab"> <?php if (yourls_do_log_redirect()) { ?> <li class="selected"><a href="#stat_tab_stats"><h2>Traffic statistics</h2></a></li> <li><a href="#stat_tab_location"><h2>Traffic location</h2></a></li> <li><a href="#stat_tab_sources"><h2>Traffic sources</h2></a></li>
/** * Return favicon URL * */ function yourls_get_favicon_url($url) { return yourls_match_current_protocol('http://www.google.com/s2/u/0/favicons?domain=' . yourls_get_domain($url, false)); }
function yourls_get_favicon_url($url) { return 'http://www.google.com/s2/u/0/favicons?domain=' . yourls_get_domain($url, false); }