You are here

function nodewords_url in Nodewords: D6 Meta Tags 6

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

Return the absolute URL of a path.

Return the absolute URL of a path built using the base URL saved in the Drupal variable nodewords_base_url.

Parameters

$path: The path for which the absolute must be built.

$options: An array of options as used by url().

1 call to nodewords_url()
_nodewords_prepare_path in ./nodewords.module
Provide a complete path for the current URL, optionally using a value manually assigned via a form.

File

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

Code

function nodewords_url($path, $options = array()) {

  // Remove the trailing slash, it will be added in the url() function.
  $base_url = rtrim(variable_get('nodewords_base_url', ''), '/');
  $options += array(
    'alias' => TRUE,
    'absolute' => TRUE,
    'fragment' => '',
    'query' => '',
    'prefix' => '',
  );

  // Identify if the URL alias should be used.
  if (variable_get('nodewords_use_path_alias', TRUE)) {

    // Note: the url() function's 'alias' argument is to specify that the
    // path is *already* an alias, it is not for requesting an alias be loaded.
    $options['alias'] = FALSE;
  }
  $options['base_url'] = empty($base_url) ? NULL : $base_url;
  return url($path, $options);
}