public static function ShareaholicPublic::get_keywords_for in Share Buttons, Related Posts, Content Analytics - Shareaholic 8
Same name and namespace in other branches
- 7.3 public.php \ShareaholicPublic::get_keywords_for()
Get a list of tags for a piece of content
Return value
Array an array of terms or empty array
1 call to ShareaholicPublic::get_keywords_for()
- ShareaholicPublic::insert_content_meta_tags in ./
public.php - Inserts the shareaholic content meta tags on the page On all pages, it will insert the standard content meta tags On full post pages, it will insert page specific content meta tags
File
- ./
public.php, line 214
Class
- ShareaholicPublic
- This class is all about drawing the stuff in publishers' templates that visitors can see.
Code
public static function get_keywords_for($node) {
$terms = array();
if (!db_table_exists('taxonomy_index')) {
return $terms;
}
$results = db_query('SELECT tid FROM {taxonomy_index} WHERE nid = :nid', array(
':nid' => $node->nid,
));
foreach ($results as $result) {
$term = taxonomy_term_load($result->tid);
if (empty($term) || empty($term->name)) {
continue;
}
array_push($terms, ShareaholicUtilities::clean_string($term->name));
$vocabulary = taxonomy_vocabulary_load($term->vid);
if (empty($vocabulary) || empty($vocabulary->name) || preg_match('/tags/i', $vocabulary->name)) {
continue;
}
array_push($terms, ShareaholicUtilities::clean_string($vocabulary->name));
}
$terms = array_unique($terms);
return $terms;
}