/[drupal]/contributions/themes/rootcandy/template.php
ViewVC logotype

Diff of /contributions/themes/rootcandy/template.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.36.2.38, Mon Nov 9 15:22:24 2009 UTC revision 1.36.2.39, Wed Nov 11 16:44:26 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: template.php,v 1.36.2.37 2009/10/25 10:15:20 sign Exp $  // $Id: template.php,v 1.36.2.38 2009/11/09 15:22:24 sign Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 376  if (arg(0) == 'admin' && arg(2) == 'them Line 376  if (arg(0) == 'admin' && arg(2) == 'them
376  function rootcandy_get_page_classes($path = NULL) {  function rootcandy_get_page_classes($path = NULL) {
377    if (!isset($path)) $path = $_GET['q'];    if (!isset($path)) $path = $_GET['q'];
378    if ($path) {    if ($path) {
379      $classes = '';      $path = ' '. rootcandy_id_safe($path);
     $menu_item = explode('/', $path);  
     if (count($menu_item)) {  
       foreach ($menu_item as $key => $page) {  
         $menu_item[$key] = strtr($page, '-', '_');  
       }  
   
       do {  
         $classes .= ' '. implode('-', $menu_item);  
         array_pop($menu_item);  
       } while (count($menu_item));  
     }  
380    }    }
381      return $path;
382    }
383    
384    return $classes;  /**
385     * Converts a string to a suitable html ID attribute. Borrowed from Zen theme
386     *
387     * http://www.w3.org/TR/html4/struct/global.html#h-7.5.2 specifies what makes a
388     * valid ID attribute in HTML. This function:
389     *
390     * - Ensure an ID starts with an alpha character by optionally adding an 'id'.
391     * - Replaces any character except alphanumeric characters with dashes.
392     * - Converts entire string to lowercase.
393     *
394     * @param $string
395     *   The string
396     * @return
397     *   The converted string
398     */
399    function rootcandy_id_safe($string) {
400      // Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
401      return check_plain(strtolower(preg_replace('/[^a-zA-Z0-9-]+/', '-', $string)));
402  }  }
403    
404  function rootcandy_breadcrumb($breadcrumb) {  function rootcandy_breadcrumb($breadcrumb) {

Legend:
Removed from v.1.36.2.38  
changed lines
  Added in v.1.36.2.39

  ViewVC Help
Powered by ViewVC 1.1.2