diff options
author | David Rothstein <drothstein@gmail.com> | 2013-12-25 18:25:43 -0500 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2013-12-25 18:25:43 -0500 |
commit | 08c95382f7be3adfd4c1cb900f222d6da7ca4056 (patch) | |
tree | 72b62210ac1959f17a8ba98eeaf42f80722ef431 /includes/common.inc | |
parent | 1f3e78c2dd94df1d17d4273687cb7dc78780d783 (diff) | |
download | brdo-08c95382f7be3adfd4c1cb900f222d6da7ca4056.tar.gz brdo-08c95382f7be3adfd4c1cb900f222d6da7ca4056.tar.bz2 |
Issue #1982020 by Fabianx, FreekyMage, Cottser: Add static caching to drupal_html_class().
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc index 9ad68eabd..903409531 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3833,7 +3833,14 @@ function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_ * The cleaned class name. */ function drupal_html_class($class) { - return drupal_clean_css_identifier(drupal_strtolower($class)); + // The output of this function will never change, so this uses a normal + // static instead of drupal_static(). + static $classes = array(); + + if (!isset($classes[$class])) { + $classes[$class] = drupal_clean_css_identifier(drupal_strtolower($class)); + } + return $classes[$class]; } /** |