You are here

function nodewords_load_tags in Nodewords: D6 Meta Tags 6.2

Same name and namespace in other branches
  1. 6.3 nodewords.module \nodewords_load_tags()
  2. 6 nodewords.module \nodewords_load_tags()

Load tags from table.

Parameters

$options: An array of options.

Return value

An array of meta tags data as saved in the database table.

9 calls to nodewords_load_tags()
nodewords_admin_tags_edit_form in nodewords_admin/nodewords_admin.admin.inc
Front page settings form.
nodewords_custom_pages_load in nodewords_custom_pages/nodewords_custom_pages.module
Menu callback loader.
nodewords_custom_pages_load_all in nodewords_custom_pages/nodewords_custom_pages.module
Load all page meta tags from the database.
nodewords_nodeapi in ./nodewords.module
Implements hook_nodeapi().
nodewords_preprocess_page in ./nodewords.module
Implements hook_preprocess_page().

... See full list

File

./nodewords.module, line 511
Implement an API that other modules can use to add meta tags.

Code

function nodewords_load_tags($options = array()) {
  $tags = array();
  $options += _nodewords_get_default_metatags_type();
  $tags_info = nodewords_get_possible_tags();
  $result = db_query("SELECT * FROM {nodewords} WHERE type = %d AND id = %d", $options['type'], $options['id']);
  while ($row = db_fetch_object($result)) {
    if (isset($tags_info[$row->name])) {
      $tags[$row->name] = unserialize($row->content);
    }
  }
  if (empty($tags) && $options['type'] == NODEWORDS_TYPE_TERM) {
    $id = db_result(db_query_range('SELECT vid FROM {term_data} WHERE tid = %d', $options['id'], 0, 1));
    if ($id !== FALSE) {
      $options['type'] = NODEWORDS_TYPE_VOCABULARY;
      $options['id'] = $id;
      return nodewords_load_tags($options);
    }
  }
  return $tags;
}