Ejemplo n.º 1
0
function fs_get_popular_pages_tree($max_num = null, $days_ago = null, $type = null, $show_count = true)
{
    if (!$max_num) {
        $max_num = fs_get_max_popular_num();
    }
    if (!$days_ago) {
        $days_ago = fs_get_recent_popular_pages_days_ago();
    }
    $urls = fs_get_popular_pages($max_num, $days_ago, true, $type);
    if ($urls === false) {
        return fs_db_error();
    }
    $res = '';
    if (!$urls) {
        $res .= fs_r('No data yet, go get some hits');
    } else {
        $res .= "\t<ul>";
        foreach ($urls as $r) {
            $url = $r->url;
            $count = $r->c;
            $rr = array();
            fs_ensure_initialized($rr[$url]['count']);
            $url = fs_xmlentities(urldecode($url));
            $text = isset($r->title) ? $r->title : $url;
            $url_text = substr($text, 0, 80);
            if (strlen($url_text) != strlen($text)) {
                $url_text .= "...";
            }
            $count_text = $show_count ? " (<b>&lrm;{$count}</b>)" : "";
            $res .= "\n\t\t<li>\n\t\t\t<a target='_blank' title='{$text}' href='{$url}'>{$url_text}</a>{$count_text}\n\t\t</li>\n";
        }
        $res .= "\t</ul>\n";
    }
    return $res;
}
Ejemplo n.º 2
0
function fs_api_get_popular_pages($days_ago = NULL, $num_limit = 10, $site_id = true, $type = null)
{
    require_once dirname(__FILE__) . '/db-sql.php';
    return fs_get_popular_pages($num_limit, $days_ago, $type);
}