summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-09 07:16:10 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-09 07:16:10 +0000
commitc50651f7fb348ec2dc6e29cdf462f22d64045002 (patch)
tree55f4e31257b073ab98401ecdd74a1a903c855ebb /includes
parent1ffa4fe38bb6b3612092cc65897ab30e0bc9954f (diff)
downloadbrdo-c50651f7fb348ec2dc6e29cdf462f22d64045002.tar.gz
brdo-c50651f7fb348ec2dc6e29cdf462f22d64045002.tar.bz2
- Patch #340557 by Dave Reid: use static caching in drupal_is_front_page().
Diffstat (limited to 'includes')
-rw-r--r--includes/path.inc13
1 files changed, 10 insertions, 3 deletions
diff --git a/includes/path.inc b/includes/path.inc
index 2a7c3eac0..ef606fb26 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -212,6 +212,7 @@ function drupal_set_title($title = NULL, $output = CHECK_PLAIN) {
if (isset($title)) {
$stored_title = ($output == PASS_THROUGH) ? $title : check_plain($title);
}
+
return $stored_title;
}
@@ -222,9 +223,15 @@ function drupal_set_title($title = NULL, $output = CHECK_PLAIN) {
* Boolean value: TRUE if the current page is the front page; FALSE if otherwise.
*/
function drupal_is_front_page() {
- // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
- // we can check it against the 'site_frontpage' variable.
- return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node'));
+ static $is_front_page;
+
+ if (!isset($is_front_page)) {
+ // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
+ // we can check it against the 'site_frontpage' variable.
+ $is_front_page = ($_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')));
+ }
+
+ return $is_front_page;
}
/**