diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-11 23:21:05 -0500 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-11 23:21:05 -0500 |
commit | c99eba75eced22b89d96c0ca711e83e2be3cc894 (patch) | |
tree | ee666451fe8bdc4d87a006dc6d5fca6c9a1685d9 /modules/locale | |
parent | 1c519917ad610f6922f3108c8313e613cbd071a1 (diff) | |
download | brdo-c99eba75eced22b89d96c0ca711e83e2be3cc894.tar.gz brdo-c99eba75eced22b89d96c0ca711e83e2be3cc894.tar.bz2 |
Issue #1387766 by dereine: Added Use fast drupal static pattern for locale.
Diffstat (limited to 'modules/locale')
-rw-r--r-- | modules/locale/locale.module | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 07884614a..0138f3964 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -630,7 +630,14 @@ function locale_modules_disabled($modules) { */ function locale($string = NULL, $context = NULL, $langcode = NULL) { global $language; - $locale_t = &drupal_static(__FUNCTION__); + + // Use the advanced drupal_static() pattern, since this is called very often. + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['locale'] = &drupal_static(__FUNCTION__); + } + $locale_t = &$drupal_static_fast['locale']; + if (!isset($string)) { // Return all cached strings if no string was specified |