Turn off this feature on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning'); } global $theme_key; // Get node types $node_types = node_get_types('names'); /** * The default values for the theme variables. Make sure $defaults exactly * matches the $defaults in the theme-settings.php file. */ $defaults = array( 'zeropoint_style' => 'grey', 'cssPreload' => 0, 'pagelayout' => 1, 'roundcorners' => 1, 'blockicons' => 2, 'pageicons' => 1, 'menutype' => 0, 'navpos' => 0, 'user_notverified_display' => 1, 'breadcrumb_display' => 1, 'search_snippet' => 1, 'search_info_type' => 0, 'search_info_user' => 1, 'search_info_date' => 1, 'search_info_comment' => 1, 'search_info_upload' => 1, 'mission_statement_pages' => 'home', 'front_page_title_display' => 'title_slogan', 'page_title_display_custom' => '', 'other_page_title_display' => 'ptitle_stitle', 'other_page_title_display_custom' => '', 'configurable_separator' => ' | ', 'meta_keywords' => '', 'meta_description' => '', 'taxonomy_display_default' => 'only', 'taxonomy_format_default' => 'list', 'taxonomy_enable_content_type' => 0, 'submitted_by_author_default' => 1, 'submitted_by_date_default' => 1, 'submitted_by_enable_content_type' => 0, 'rebuild_registry' => 0, ); // Make the default content-type settings the same as the default theme settings, // so we can tell if content-type-specific settings have been altered. $defaults = array_merge($defaults, theme_get_settings()); // Set the default values for content-type-specific settings foreach ($node_types as $type => $name) { $defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default']; $defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default']; $defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default']; $defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default']; } // Get default theme settings. $settings = theme_get_settings($theme_key); // Don't save the toggle_node_info_ variables if (module_exists('node')) { foreach (node_get_types() as $type => $name) { unset($settings['toggle_node_info_'. $type]); } } // Save default theme settings variable_set( str_replace('/', '_', 'theme_'. $theme_key .'_settings'), array_merge($defaults, $settings) ); // Force refresh of Drupal internals theme_get_setting('', TRUE); } function get_zeropoint_style() { $style = theme_get_setting('zeropoint_style'); //if (isset($_COOKIE["zeropointstyle"])) { //$style = $_COOKIE["zeropointstyle"]; //} return $style; } drupal_add_css(drupal_get_path('theme', 'zeropoint') . '/css/' . get_zeropoint_style() . '.css', 'theme'); /** * Modify theme variables */ function phptemplate_preprocess(&$vars) { global $user; // Get the current user $vars['is_admin'] = in_array('ADMIN', $user->roles); // Check for Admin, logged in $vars['logged_in'] = ($user->uid > 0) ? TRUE : FALSE; } function phptemplate_preprocess_page(&$vars) { // Remove sidebars if disabled if (!$vars['show_blocks']) { $vars['left'] = ''; $vars['right'] = ''; } // Build array of helpful body classes $body_classes = array(); $body_classes[] = 'layout-'. (($vars['left']) ? 'left-main' : 'main') . (($vars['right']) ? '-right' : ''); // Page sidebars are active (Jello Mold) $body_classes[] = ($vars['is_admin']) ? 'admin' : 'not-admin'; // Page user is admin $body_classes[] = ($vars['logged_in']) ? 'logged-in' : 'not-logged-in'; // Page user is logged in $body_classes[] = ($vars['is_front']) ? 'front' : 'not-front'; // Page is front page if (isset($vars['node'])) { $body_classes[] = ($vars['node']) ? 'full-node' : ''; // Page is one full node $body_classes[] = (($vars['node']->type == 'forum') || (arg(0) == 'forum')) ? 'forum' : ''; // Page is Forum page $body_classes[] = ($vars['node']->type) ? 'node-type-'. $vars['node']->type : ''; // Page has node-type-x, e.g., node-type-page $body_classes[] = ($vars['node']->nid) ? 'nid-'. $vars['node']->nid : ''; // Page has id-x, e.g., id-32 } else { $body_classes[] = (arg(0) == 'forum') ? 'forum' : ''; // Page is Forum page } // Add any taxonomy terms for node pages if (isset($vars['node']->taxonomy)) { foreach ($vars['node']->taxonomy as $taxonomy_id => $term_info) { $body_classes[] = 'tag-'. $taxonomy_id; // Page has terms (tag-x) // $taxonomy_name = id_safe($term_info->name); // if ($taxonomy_name) { // $body_classes[] = 'tag-'. $taxonomy_name; // Page has terms (tag-name) // } } } // Add unique classes for each page and website section if (!$vars['is_front']) { $path = drupal_get_path_alias($_GET['q']); list($section, ) = explode('/', $path, 2); $body_classes[] = id_safe('section-' . $section); $body_classes[] = id_safe('page-' . $path); if (arg(0) == 'node') { if (arg(1) == 'add') { if ($section == 'node') { array_pop($body_classes); // Remove 'section-node' } $body_classes[] = 'section-node-add'; // Add 'section-node-add' } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { if ($section == 'node') { array_pop($body_classes); // Remove 'section-node' } $body_classes[] = 'section-node-' . arg(2); // Add 'section-node-edit' or 'section-node-delete' } } } // Add Panels classes and lang $body_classes[] = (module_exists('panels_page') && (panels_page_get_current())) ? 'panels' : ''; // Page is Panels page $body_classes[] = ($vars['language']->language) ? 'lg-'. $vars['language']->language : ''; // Page has lang-x // Check what the user's browser is and add it as a body class $user_agent = $_SERVER['HTTP_USER_AGENT']; if($user_agent) { if (strpos($user_agent, 'MSIE 6.0')) { $body_classes[] = 'browser-ie6'; } else if (strpos($user_agent, 'MSIE 7.0')) { $body_classes[] = 'browser-ie7'; } else if (strpos($user_agent, 'MSIE 8.0')) { $body_classes[] = 'browser-ie8'; } else if (strpos($user_agent, 'MSIE')) { $body_classes[] = 'browser-ie'; } else if (strpos($user_agent, 'Firefox/2')) { $body_classes[] = 'browser-firefox2'; } else if (strpos($user_agent, 'Firefox/3')) { $body_classes[] = 'browser-firefox3'; } else if (strpos($user_agent, 'Chrome')) { $body_classes[] = 'browser-chrome'; } else if (strpos($user_agent, 'Safari')) { $body_classes[] = 'browser-safari'; } else if (strpos($user_agent, 'Presto')) { $body_classes[] = 'browser-opera'; } } $body_classes = array_filter($body_classes); // Remove empty elements $vars['body_classes'] = implode(' ', $body_classes); // Create class list separated by spaces // Generate menu tree from source of primary links $vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links')); // TNT THEME SETTINGS SECTION // Display mission statement on all pages if (theme_get_setting('mission_statement_pages') == 'all') { $vars['mission'] = theme_get_setting('mission', false); } // Hide breadcrumb on all pages if (theme_get_setting('breadcrumb_display') == 0) { $vars['breadcrumb'] = ''; } // Set site title, slogan, mission, page title & separator (unless using Page Title module) if (!module_exists('page_title')) { $title = t(variable_get('site_name', '')); $slogan = t(variable_get('site_slogan', '')); $mission = t(variable_get('site_mission', '')); $page_title = t(drupal_get_title()); $title_separator = theme_get_setting('configurable_separator'); if (drupal_is_front_page()) { // Front page title settings switch (theme_get_setting('front_page_title_display')) { case 'title_slogan': $vars['head_title'] = drupal_set_title($title . $title_separator . $slogan); break; case 'slogan_title': $vars['head_title'] = drupal_set_title($slogan . $title_separator . $title); break; case 'title_mission': $vars['head_title'] = drupal_set_title($title . $title_separator . $mission); break; case 'custom': if (theme_get_setting('page_title_display_custom') !== '') { $vars['head_title'] = drupal_set_title(t(theme_get_setting('page_title_display_custom'))); } } } else { // Non-front page title settings switch (theme_get_setting('other_page_title_display')) { case 'ptitle_slogan': $vars['head_title'] = drupal_set_title($page_title . $title_separator . $slogan); break; case 'ptitle_stitle': $vars['head_title'] = drupal_set_title($page_title . $title_separator . $title); break; case 'ptitle_smission': $vars['head_title'] = drupal_set_title($page_title . $title_separator . $mission); break; case 'ptitle_custom': if (theme_get_setting('other_page_title_display_custom') !== '') { $vars['head_title'] = drupal_set_title($page_title . $title_separator . t(theme_get_setting('other_page_title_display_custom'))); } break; case 'custom': if (theme_get_setting('other_page_title_display_custom') !== '') { $vars['head_title'] = drupal_set_title(t(theme_get_setting('other_page_title_display_custom'))); } } } $vars['head_title'] = strip_tags($vars['head_title']); // Remove any potential html tags } // Set meta keywords and description (unless using Meta tags module) if (!module_exists('nodewords')) { if (theme_get_setting('meta_keywords') !== '') { $keywords = ''; $vars['head'] .= $keywords ."\n"; } if (theme_get_setting('meta_description') !== '') { $keywords = ''; $vars['head'] .= $keywords ."\n"; } } $vars['closure'] .= '
'; } function phptemplate_preprocess_block(&$vars) { // Add regions with themed blocks (e.g., left, right) to $themed_regions array $themed_regions = array('left','right'); $vars['themed_block'] = (in_array($vars['block']->region, $themed_regions)) ? TRUE : FALSE; } function phptemplate_preprocess_node(&$vars) { // Add node region if (!$vars['teaser']){ foreach (array('content_middle') as $region) { $vars[$region] = theme('blocks', $region); } } // Build array of handy node classes $node_classes = array(); $node_classes[] = $vars['zebra']; // Node is odd or even $node_classes[] = (!$vars['node']->status) ? 'node-unpublished' : ''; // Node is unpublished $node_classes[] = ($vars['sticky']) ? 'sticky' : ''; // Node is sticky $node_classes[] = (isset($vars['node']->teaser)) ? 'teaser' : 'full-node'; // Node is teaser or full-node $node_classes[] = 'node-type-'. $vars['node']->type; // Node is type-x, e.g., node-type-page // Add any taxonomy terms for node teasers if ($vars['teaser'] && isset($vars['taxonomy'])) { foreach ($vars['taxonomy'] as $taxonomy_id_string => $term_info) { $taxonomy_id = array_pop(explode('_', $taxonomy_id_string)); $node_classes[] = 'tag-'. $taxonomy_id; // Node teaser has terms (tag-x) // $taxonomy_name = id_safe($term_info['title']); // if ($taxonomy_name) { // $node_classes[] = 'tag-'. $taxonomy_name; // Node teaser has terms (tag-name) // } } } $node_classes = array_filter($node_classes); // Remove empty elements $vars['node_classes'] = implode(' ', $node_classes); // Implode class list with spaces // Add node_bottom region content $vars['node_bottom'] = theme('blocks', 'node_bottom'); // Node Theme Settings // Date & author if (!module_exists('submitted_by')) { $date = t('') . format_date($vars['node']->created, 'medium'); // Format date as small, medium, or large $author = theme('username', $vars['node']); $author_only_separator = t(''); $author_date_separator = t(' — '); $submitted_by_content_type = (theme_get_setting('submitted_by_enable_content_type') == 1) ? $vars['node']->type : 'default'; $date_setting = (theme_get_setting('submitted_by_date_'. $submitted_by_content_type) == 1); $author_setting = (theme_get_setting('submitted_by_author_'. $submitted_by_content_type) == 1); $author_separator = ($date_setting) ? $author_date_separator : $author_only_separator; $date_author = ($date_setting) ? $date : ''; $date_author .= ($author_setting) ? $author_separator . $author : ''; $vars['submitted'] = $date_author; } // Taxonomy $taxonomy_content_type = (theme_get_setting('taxonomy_enable_content_type') == 1) ? $vars['node']->type : 'default'; $taxonomy_display = theme_get_setting('taxonomy_display_'. $taxonomy_content_type); $taxonomy_format = theme_get_setting('taxonomy_format_'. $taxonomy_content_type); if ((module_exists('taxonomy')) && ($taxonomy_display == 'all' || ($taxonomy_display == 'only' && $vars['page']))) { $vocabularies = taxonomy_get_vocabularies($vars['node']->type); $output = ''; $term_delimiter = ' | '; foreach ($vocabularies as $vocabulary) { if (theme_get_setting('taxonomy_vocab_hide_'. $taxonomy_content_type .'_'. $vocabulary->vid) != 1) { $terms = taxonomy_node_get_terms_by_vocabulary($vars['node'], $vocabulary->vid); if ($terms) { $term_items = ''; foreach ($terms as $term) { // Build vocabulary term items $term_link = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))); $term_items .= '
  • '. $term_link . $term_delimiter .'
  • '; } if ($taxonomy_format == 'vocab') { // Add vocabulary labels if separate $output .= '
  • '. $vocabulary->name .':