'yes', 'breadcrumb_separator' => ' › ', 'breadcrumb_home' => 1, 'breadcrumb_trailing' => 0, 'breadcrumb_title' => 0, 'user_notverified_display' => 1, 'search_snippet' => 1, 'search_info_type' => 1, 'search_info_user' => 1, 'search_info_date' => 1, 'search_info_comment' => 1, 'search_info_upload' => 1, 'comment_title' => 'Leave a Response', 'display_author' => 1, 'display_teaser_comment' => 'normal', 'front_page_title_display' => 'title_slogan', 'page_title_display_custom' => '', 'other_page_title_display' => 'ptitle_slogan', 'other_page_title_display_custom' => '', 'configurable_separator' => ' | ', 'meta_keywords' => '', 'meta_description' => '', 'rebuild_registry' => 0, 'block_editing' => 1, ); // 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); } /** * Modify theme variables */ function phptemplate_preprocess_page(&$vars) { // Set site title, slogan, mission, page title & separator $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 // Add meta tag on all pages 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"; } } } /** * Return a themed breadcrumb trail. * * @param $breadcrumb * An array containing the breadcrumb links. * @return * A string containing the breadcrumb output. */ function magazeen_breadcrumb($breadcrumb) { // Determine if we are to display the breadcrumb $show_breadcrumb = theme_get_setting('breadcrumb_display'); if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') { // Optionally get rid of the homepage link $show_breadcrumb_home = theme_get_setting('breadcrumb_home'); if (!$show_breadcrumb_home) { array_shift($breadcrumb); } // Return the breadcrumb with separators if (!empty($breadcrumb)) { $breadcrumb_separator = theme_get_setting('breadcrumb_separator'); $trailing_separator = (theme_get_setting('breadcrumb_trailing') || theme_get_setting('breadcrumb_title')) ? $breadcrumb_separator : ''; return '"; } } // Otherwise, return an empty string return ''; } /** * Modify search results based on theme settings */ function phptemplate_preprocess_search_result(&$variables) { static $search_zebra = 'even'; $search_zebra = ($search_zebra == 'even') ? 'odd' : 'even'; $variables['search_zebra'] = $search_zebra; $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = check_plain($result['title']); // Check for existence. User search does not include snippets. $variables['snippet'] = ''; if (isset($result['snippet']) && theme_get_setting('search_snippet')) { $variables['snippet'] = $result['snippet']; } $info = array(); if (!empty($result['type']) && theme_get_setting('search_info_type')) { $info['type'] = check_plain($result['type']); } if (!empty($result['user']) && theme_get_setting('search_info_user')) { $info['user'] = $result['user']; } if (!empty($result['date']) && theme_get_setting('search_info_date')) { $info['date'] = format_date($result['date'], 'small'); } if (isset($result['extra']) && is_array($result['extra'])) { // $info = array_merge($info, $result['extra']); Drupal bug? [extra] array not keyed with 'comment' & 'upload' if (!empty($result['extra'][0]) && theme_get_setting('search_info_comment')) { $info['comment'] = $result['extra'][0]; } if (!empty($result['extra'][1]) && theme_get_setting('search_info_upload')) { $info['upload'] = $result['extra'][1]; } } // Provide separated and grouped meta information. $variables['info_split'] = $info; $variables['info'] = implode(' - ', $info); // Provide alternate search result template. $variables['template_files'][] = 'search-result-'. $variables['type']; } /** * Override username theming to display/hide 'not verified' text */ function phptemplate_username($object) { if ($object->uid && $object->name) { // Shorten the name when it is too long or it will break many tables. if (drupal_strlen($object->name) > 20) { $name = drupal_substr($object->name, 0, 15) .'...'; } else { $name = $object->name; } if (user_access('access user profiles')) { $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.')))); } else { $output = check_plain($name); } } else if ($object->name) { // Sometimes modules display content composed by people who are // not registered members of the site (e.g. mailing list or news // aggregator modules). This clause enables modules to display // the true author of the content. if (!empty($object->homepage)) { $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); } else { $output = check_plain($object->name); } // Display or hide 'not verified' text if (theme_get_setting('user_notverified_display') == 1) { $output .= ' ('. t('not verified') .')'; } } else { $output = variable_get('anonymous', t('Anonymous')); } return $output; } /** * Display comment count */ function phptemplate_comment_count($comment_count, $node_url) { switch (theme_get_setting('display_teaser_comment')) { case 'hide': $output = ''; break; case 'addnew': $output = '
'; $output .= ''; $output .= t('Add new comment'); $output .= ''; $output .= '
'; break; default: $output = '
'; $output .= ''; $output .= $comment_count .' '. t('comments'); $output .= ''; $output .= '
'; } return $output; } /** * Display author name in page */ function phptemplate_display_author($name) { if (theme_get_setting('display_author') == 0) { $output = ''; } else { $output = ''. t('By') .' '. $name .''; } return $output; } /** * Override or insert variables into the block templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("block" in this case.) */ function magazeen_preprocess_block(&$vars, $hook) { $block = $vars['block']; // Special classes for blocks. $classes = array('block'); $classes[] = 'block-' . $block->module; $classes[] = 'region-' . $vars['block_zebra']; $classes[] = $vars['zebra']; $classes[] = 'region-count-' . $vars['block_id']; $classes[] = 'count-' . $vars['id']; $vars['edit_links_array'] = array(); $vars['edit_links'] = ''; if (theme_get_setting('block_editing') && user_access('administer blocks')) { include_once './' . drupal_get_path('theme', 'magazeen') . '/include/template.block-editing.inc'; magazeen_preprocess_block_editing($vars, $hook); $classes[] = 'with-block-editing'; } // Render block classes. $vars['classes'] = implode(' ', $classes); } /** * Adds 'width940' or 'width580' classes to the main content as needed. */ function phptemplate_mainwidth_class($right) { $mainwidth = 'width940'; if ( $right ) { $mainwidth = 'width580';} print $mainwidth; } /** * Generates IE CSS links for . */ function phptemplate_get_ie_styles() { global $language; $iecss = ''; return $iecss; } // Auto-rebuild the theme registry during theme development. if (theme_get_setting('rebuild_registry')) { drupal_rebuild_theme_registry(); } /** * Theme FORM. */ function magazeen_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('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 extremely important to turn off this feature on production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning', FALSE); } return array( 'comment_form' => array( 'arguments' => array('form' => NULL), 'template' => 'comment-form', ), ); } function magazeen_preprocess_comment_form(&$vars) { $vars['submit'] = drupal_render($vars['form']['submit']); $vars['preview'] = drupal_render($vars['form']['preview']); $vars['subject'] = drupal_render($vars['form']['subject']); $vars['comment'] = drupal_render($vars['form']['comment_filter']['comment']); $vars['form']['name']['#title'] = t('Name (required)'); $vars['name'] = drupal_render($vars['form']['name']); $vars['form']['mail']['#title'] = t('Mail (will not be published) (required)'); $vars['mail'] = drupal_render($vars['form']['mail']); $vars['form']['homepage']['#title'] = t('Website'); $vars['homepage'] = drupal_render($vars['form']['homepage']); $vars['comment_preview'] = drupal_render($vars['form']['comment_preview']); } //dsm($vars['form']);