summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnAlbin2009-08-24 09:25:28 (GMT)
committer JohnAlbin2009-08-24 09:25:28 (GMT)
commita643594df4de1968485c7d4c67d42874f8986428 (patch)
tree106d37b56c0123403d8704dfe95228f3b6e6cd08
parent5db1c6c6afa9134c0e24b8ff8542daecf8535ba1 (diff)
#317417 by JohnAlbin and quicksketch: Fix off-line maintenance page since drupal_get_path('theme', 'zen') won't work
-rw-r--r--CHANGELOG.txt1
-rw-r--r--zen/template.conditional-styles.inc4
-rw-r--r--zen/template.php49
-rw-r--r--zen/template.theme-registry.inc4
4 files changed, 46 insertions, 12 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index d63c74c..bde8834 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -2,6 +2,7 @@
Zen 6.x-1.x-dev, xxxx-xx-xx (development release)
------------------------
+- #317417 by JohnAlbin and quicksketch: Fix off-line maintenance page since drupal_get_path('theme', 'zen') won't work
- #545320 by Deslack: Use of split() generate E_DEPRECATED warnings on PHP 5.3.0
- #472694: Drupal 6.11 broke Zen's OpenID overrides
- Updated screenshot.png to use Zen logo since an actual screenshot is boring
diff --git a/zen/template.conditional-styles.inc b/zen/template.conditional-styles.inc
index 72e1ea9..8211d1a 100644
--- a/zen/template.conditional-styles.inc
+++ b/zen/template.conditional-styles.inc
@@ -3,7 +3,7 @@
// it has been spun out to its own separate module, It would be nice to prevent
// code drift between the Zen implementation and the conditional_styles.module,
// so Zen now includes an exact copy of conditonal_style module's:
-// conditional_styles.theme.inc,v 1.5 2009/05/25 14:33:03 johnalbin Exp
+// conditional_styles.theme.inc,v 1.6 2009/08/24 08:57:32 johnalbin Exp
/**
* @file
@@ -47,7 +47,7 @@ function _conditional_styles_theme($existing, $type, $theme, $path) {
$themes = list_themes();
foreach (array_keys($themes) AS $theme) {
// We only need to process active themes.
- if ($themes[$theme]->status) {
+ if ($themes[$theme]->status || $GLOBALS['theme'] == $theme) {
$paths = conditional_styles_paths_to_basetheme($theme);
// Grab all the conditional stylesheets.
diff --git a/zen/template.php b/zen/template.php
index 58a533d..3f1c33c 100644
--- a/zen/template.php
+++ b/zen/template.php
@@ -24,10 +24,10 @@ if (theme_get_setting('zen_rebuild_registry')) {
*/
if ($GLOBALS['theme'] == 'zen') { // If we're in the main theme
if (theme_get_setting('zen_layout') == 'border-politics-fixed') {
- drupal_add_css(drupal_get_path('theme', 'zen') . '/layout-fixed.css', 'theme', 'all');
+ drupal_add_css(_zen_path() . '/layout-fixed.css', 'theme', 'all');
}
else {
- drupal_add_css(drupal_get_path('theme', 'zen') . '/layout-liquid.css', 'theme', 'all');
+ drupal_add_css(_zen_path() . '/layout-liquid.css', 'theme', 'all');
}
}
@@ -35,10 +35,7 @@ if ($GLOBALS['theme'] == 'zen') { // If we're in the main theme
* Implements HOOK_theme().
*/
function zen_theme(&$existing, $type, $theme, $path) {
- if (!db_is_active()) {
- return array();
- }
- include_once './' . drupal_get_path('theme', 'zen') . '/template.theme-registry.inc';
+ include_once './' . _zen_path() . '/template.theme-registry.inc';
return _zen_theme($existing, $type, $theme, $path);
}
@@ -158,6 +155,25 @@ function zen_preprocess_page(&$vars, $hook) {
}
/**
+ * Override or insert variables into the maintenance page template.
+ *
+ * @param $vars
+ * An array of variables to pass to the theme template.
+ * @param $hook
+ * The name of the template being rendered ("maintenance_page" in this case.)
+ */
+function zen_preprocess_maintenance_page(&$vars, $hook) {
+ // Add conditional stylesheets.
+ if (!module_exists('conditional_styles')) {
+ $vars['styles'] .= $vars['conditional_styles'] = variable_get('conditional_styles_' . $GLOBALS['theme'], '');
+ }
+
+ // Classes for body element. Allows advanced theming based on context
+ // (home page, node of certain type, etc.)
+ $vars['body_classes_array'] = explode(' ', $vars['body_classes']);
+}
+
+/**
* Override or insert variables into the node templates.
*
* @param $vars
@@ -198,7 +214,7 @@ function zen_preprocess_node(&$vars, $hook) {
* The name of the template being rendered ("comment" in this case.)
*/
function zen_preprocess_comment(&$vars, $hook) {
- include_once './' . drupal_get_path('theme', 'zen') . '/template.comment.inc';
+ include_once './' . _zen_path() . '/template.comment.inc';
_zen_preprocess_comment($vars, $hook);
}
@@ -224,7 +240,7 @@ function zen_preprocess_block(&$vars, $hook) {
$vars['edit_links_array'] = array();
$vars['edit_links'] = '';
if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) {
- include_once './' . drupal_get_path('theme', 'zen') . '/template.block-editing.inc';
+ include_once './' . _zen_path() . '/template.block-editing.inc';
zen_preprocess_block_editing($vars, $hook);
$classes[] = 'with-block-editing';
}
@@ -257,3 +273,20 @@ function zen_id_safe($string) {
}
return $string;
}
+
+/**
+ * Returns the path to the Zen theme.
+ *
+ * drupal_get_filename() is broken; see #341140. When that is fixed in Drupal 6,
+ * replace _zen_path() with drupal_get_path('theme', 'zen').
+ */
+function _zen_path() {
+ static $path = FALSE;
+ if (!$path) {
+ $matches = drupal_system_listing('zen\.info$', 'themes', 'name', 0);
+ if (!empty($matches['zen']->filename)) {
+ $path = dirname($matches['zen']->filename);
+ }
+ }
+ return $path;
+}
diff --git a/zen/template.theme-registry.inc b/zen/template.theme-registry.inc
index 4523ffd..f4fc9a6 100644
--- a/zen/template.theme-registry.inc
+++ b/zen/template.theme-registry.inc
@@ -14,7 +14,7 @@
function _zen_theme(&$existing, $type, $theme, $path) {
// Compute the conditional stylesheets.
if (!module_exists('conditional_styles')) {
- include_once './' . drupal_get_path('theme', 'zen') . '/template.conditional-styles.inc';
+ include_once './' . _zen_path() . '/template.conditional-styles.inc';
// _conditional_styles_theme() only needs to be run once.
if ($theme == 'zen') {
_conditional_styles_theme($existing, $type, $theme, $path);
@@ -28,7 +28,7 @@ function _zen_theme(&$existing, $type, $theme, $path) {
// If we are auto-rebuilding the theme registry, warn about the feature.
// Always display the warning in the admin section, otherwise limit to three
// warnings per hour.
- if (user_access('administer site configuration') && theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
+ if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('zen_rebuild_registry') && $theme == $GLOBALS['theme'] && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning');
drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning', FALSE);
}