function xmlsitemap_static in XML sitemap 6.2
15 calls to xmlsitemap_static()
- XMLSitemapTestHelper::addSitemapLink in ./
xmlsitemap.test - xmlsitemap_check_status in ./
xmlsitemap.inc - Check the status of all hook_requirements() from any xmlsitemap modules.
- xmlsitemap_engines_get_engine_info in xmlsitemap_engines/
xmlsitemap_engines.module - Returns information about supported search engines.
- xmlsitemap_get_context_info in ./
xmlsitemap.module - xmlsitemap_get_current_context in ./
xmlsitemap.module - Get the sitemap context of the current request.
File
- ./
xmlsitemap.module, line 1487 - Main file for the xmlsitemap module.
Code
function &xmlsitemap_static($name, $default_value = NULL, $reset = FALSE) {
static $data = array(), $default = array();
if (!isset($name)) {
// All variables are reset. This needs to be done one at a time so that
// references returned by earlier invocations of drupal_static() also get
// reset.
foreach ($default as $name => $value) {
$data[$name] = $value;
}
// As the function returns a reference, the return should always be a
// variable.
return $data;
}
if ($reset) {
// The reset means the default is loaded.
if (array_key_exists($name, $default)) {
$data[$name] = $default[$name];
}
else {
// Reset was called before a default is set and yet a variable must be
// returned.
return $data;
}
}
elseif (!array_key_exists($name, $data)) {
// Store the default value internally and also copy it to the reference to
// be returned.
$default[$name] = $data[$name] = $default_value;
}
return $data[$name];
}