24     $ar = array_map(
'trim', $ar);
 
   25     $ar = array_filter($ar, 
'is_not_null');
 
   26     $ar = array_map(
'strip_tags', $ar);
 
   27     $ar = array_unique($ar);
 
   83         'tag_names' => array(),
 
   92         'site_guids' => 
$CONFIG->site_guid,
 
  106     $singulars = array(
'type', 
'subtype', 
'owner_guid', 
'container_guid', 
'site_guid', 
'tag_name');
 
  111     if (!is_array(
$options[
'tag_names'])) {
 
  116     if (count(
$options[
'tag_names']) == 0) {
 
  117         $options[
'tag_names'] = $registered_tags;
 
  120     $diff = array_diff(
$options[
'tag_names'], $registered_tags);
 
  121     if (count($diff) > 0) {
 
  122         elgg_deprecated_notice(
'Tag metadata names must be registered by elgg_register_tag_metadata_name()', 1.7);
 
  130     $wheres[] = 
"msv.string != ''";
 
  132     $sanitised_tags = array();
 
  133     foreach (
$options[
'tag_names'] as $tag) {
 
  136     $tags_in = implode(
',', $sanitised_tags);
 
  137     $wheres[] = 
"(msn.string IN ($tags_in))";
 
  149     foreach ($wheres as $i => $where) {
 
  150         if ($where === 
false) {
 
  152         } elseif (empty($where)) {
 
  158     $wheres = array_unique($wheres);
 
  162     $joins[] = 
"JOIN {$CONFIG->dbprefix}metadata md on md.entity_guid = e.guid";
 
  163     $joins[] = 
"JOIN {$CONFIG->dbprefix}metastrings msv on msv.id = md.value_id";
 
  164     $joins[] = 
"JOIN {$CONFIG->dbprefix}metastrings msn on md.name_id = msn.id";
 
  167     $joins = array_unique($joins);
 
  169     foreach ($joins as $i => $join) {
 
  170         if ($join === 
false) {
 
  172         } elseif (empty($join)) {
 
  178     $query  = 
"SELECT msv.string as tag, count(msv.id) as total ";
 
  179     $query .= 
"FROM {$CONFIG->dbprefix}entities e ";
 
  182     foreach ($joins as $j) {
 
  189     foreach ($wheres as $w) {
 
  190         $query .= 
" $w AND ";
 
  197     $query .= 
" GROUP BY msv.string HAVING total >= {$threshold} ";
 
  198     $query .= 
" ORDER BY total DESC ";
 
  201     $query .= 
" LIMIT {$limit} ";
 
  219     if (!isset(
$CONFIG->registered_tag_metadata_names)) {
 
  220         $CONFIG->registered_tag_metadata_names = array();
 
  223     if (!in_array(
$name, 
$CONFIG->registered_tag_metadata_names)) {
 
  239     $names = (isset(
$CONFIG->registered_tag_metadata_names)) ? 
$CONFIG->registered_tag_metadata_names : array();
 
  253     $events->registerHandler(
'init', 
'system', 
'_elgg_tags_init');
 
if($guid==elgg_get_logged_in_user_guid()) $name
 
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
 
const ELGG_ENTITIES_ANY_VALUE
 
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
 
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
 
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
 
sanitise_string($string)
Wrapper function for alternate English spelling (.
 
sanitise_int($int, $signed=true)
Sanitizes an integer for database use.
 
get_data($query, $callback="")
Retrieve rows from the database.
 
_elgg_get_entity_time_where_sql($table, $time_created_upper=null, $time_created_lower=null, $time_updated_upper=null, $time_updated_lower=null)
Returns SQL where clause for entity time limits.
 
_elgg_get_guid_based_where_sql($column, $guids)
Returns SQL where clause for owner and containers.
 
_elgg_get_entity_type_subtype_where_sql($table, $types, $subtypes, $pairs)
Returns SQL where clause for type and subtype on main entity table.