summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt1
-rw-r--r--zen/template.php8
2 files changed, 5 insertions, 4 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1a89cca..e57fea4 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,4 +1,5 @@
Zen 6.x-1.x-dev
+ #329769 by kmonty: Update zen_id_safe to remove underscores
#275832: hook_theme implementation breaks maintenance page when database is down
#362104: layout breaks on Zen-themed maintenance page
* Changed "or" back to "||" in template files since themers do need to learn a little PHP
diff --git a/zen/template.php b/zen/template.php
index bdb89c0..24b7bd6 100644
--- a/zen/template.php
+++ b/zen/template.php
@@ -185,7 +185,7 @@ function zen_preprocess_node(&$vars, $hook) {
$classes[] = 'node-teaser'; // Node is displayed as teaser.
}
// Class for node type: "node-type-page", "node-type-story", "node-type-my-custom-type", etc.
- $classes[] = 'node-type-' . $vars['type'];
+ $classes[] = zen_id_safe('node-type-' . $vars['type']);
$vars['classes'] = implode(' ', $classes); // Concatenate with spaces
}
@@ -240,7 +240,7 @@ function zen_preprocess_block(&$vars, $hook) {
* valid ID attribute in HTML. This function:
*
* - Ensure an ID starts with an alpha character by optionally adding an 'id'.
- * - Replaces any character except A-Z, numbers, and underscores with dashes.
+ * - Replaces any character except alphanumeric characters with dashes.
* - Converts entire string to lowercase.
*
* @param $string
@@ -250,8 +250,8 @@ function zen_preprocess_block(&$vars, $hook) {
*/
function zen_id_safe($string) {
// Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
- $string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
- // If the first character is not a-z, add 'n' in front.
+ $string = strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $string));
+ // If the first character is not a-z, add 'id' in front.
if (!ctype_lower($string{0})) { // Don't use ctype_alpha since its locale aware.
$string = 'id' . $string;
}