Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xmlsitemap
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
xmlsitemap
Commits
11a9dd8d
Commit
11a9dd8d
authored
Jan 23, 2010
by
Dave Reid
Browse files
Options
Downloads
Patches
Plain Diff
by Dave Reid: Add drupal_static() caching to functions.
parent
56843b32
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
xmlsitemap.module
+9
-10
9 additions, 10 deletions
xmlsitemap.module
with
9 additions
and
10 deletions
xmlsitemap.module
+
9
−
10
View file @
11a9dd8d
...
...
@@ -621,7 +621,7 @@ function xmlsitemap_variables() {
* Internal implementation of variable_get().
*/
function
xmlsitemap_var
(
$name
,
$default
=
NULL
)
{
static
$defaults
=
NULL
;
$defaults
=
&
drupal_static
(
__FUNCTION__
)
;
if
(
!
isset
(
$defaults
))
{
$defaults
=
xmlsitemap_variables
();
}
...
...
@@ -630,7 +630,7 @@ function xmlsitemap_var($name, $default = NULL) {
// @todo Remove when stable.
if
(
!
isset
(
$defaults
[
$name
]))
{
trigger_error
(
t
(
'Default variable for %variable not found.'
,
array
(
'%variable'
=>
$name
)));
trigger_error
(
strtr
(
'Default variable for %variable not found.'
,
array
(
'%variable'
=>
drupal_placeholder
(
$name
)))
)
;
}
return
variable_get
(
$name
,
isset
(
$default
)
||
!
isset
(
$defaults
[
$name
])
?
$default
:
$defaults
[
$name
]);
...
...
@@ -643,7 +643,7 @@ function xmlsitemap_var($name, $default = NULL) {
*/
function
xmlsitemap_switch_user
(
$new_user
=
NULL
)
{
global
$user
;
static
$user_original
;
$user_original
=
&
drupal_static
(
__FUNCTION__
)
;
if
(
!
isset
(
$new_user
))
{
if
(
isset
(
$user_original
))
{
...
...
@@ -716,6 +716,7 @@ function xmlsitemap_process_form_link_options($form, &$form_state) {
/**
* @todo Document this function.
* @todo Make these translatable
*/
function
xmlsitemap_get_changefreq_options
()
{
return
array
(
...
...
@@ -741,13 +742,9 @@ function xmlsitemap_get_changefreq_options() {
* @see hook_xmlsitemap_link_info()
* @see hook_xmlsitemap_link_info_alter()
*/
function
xmlsitemap_get_link_info
(
$type
=
NULL
,
$reset
=
FALSE
)
{
function
xmlsitemap_get_link_info
(
$type
=
NULL
)
{
global
$language
;
static
$link_info
;
if
(
$reset
)
{
$link_info
=
NULL
;
}
$link_info
=
&
drupal_static
(
__FUNCTION__
);
if
(
!
isset
(
$link_info
))
{
if
(
$cached
=
cache_get
(
'xmlsitemap:link_info:'
.
$language
->
language
))
{
...
...
@@ -836,13 +833,15 @@ function _xmlsitemap_delete_recursive($path, $delete_root = FALSE) {
/**
* Load a language object by its language code.
*
* @todo Remove when http://drupal.org/node/660736 is fixed in Drupal core.
*
* @param $language
* A language code. If not provided the default language will be returned.
* @return
* A language object.
*/
function
xmlsitemap_language_load
(
$language
=
LANGUAGE_NONE
)
{
static
$languages
;
$languages
=
&
drupal_static
(
__FUNCTION__
)
;
if
(
!
isset
(
$languages
))
{
$languages
=
language_list
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment