2012-05-16 07:31:36 +02:00
< ? php
function tags_widget () {
$o = '' ;
2015-05-22 03:36:46 +02:00
$r = q ( " select distinct(term), count(term) as total from tag group by term order by count(term) desc limit 20 " );
2012-05-16 07:31:36 +02:00
if ( count ( $r )) {
$o .= '<div class="widget">' ;
$o .= '<h3>' . t ( 'Trending Interests' ) . '</h3>' ;
$o .= '<ul>' ;
foreach ( $r as $rr ) {
$o .= '<li><a href="directory?search=' . $rr [ 'term' ] . '" >' . $rr [ 'term' ] . '</a></li>' ;
}
$o .= '</ul></div>' ;
}
return $o ;
}
function country_widget () {
$o = '' ;
2015-05-22 03:36:46 +02:00
$r = q ( " select distinct(`country-name`), count(`country-name`) as total from profile where `country-name` != '' group by `country-name` order by count(`country-name`) desc limit 20 " );
2012-05-16 07:31:36 +02:00
if ( count ( $r )) {
$o .= '<div class="widget">' ;
$o .= '<h3>' . t ( 'Locations' ) . '</h3>' ;
$o .= '<ul>' ;
foreach ( $r as $rr ) {
$o .= '<li><a href="directory?search=' . $rr [ 'country-name' ] . '" >' . $rr [ 'country-name' ] . '</a></li>' ;
}
$o .= '</ul></div>' ;
}
return $o ;
}
2012-07-06 07:06:42 +02:00
function get_taglist ( $limit = 50 ) {
$r = q ( " select distinct(term), count(term) as total from tag group by term order by count(term) desc limit %d " ,
intval ( $limit )
);
return $r ;
}