'stone', ); // 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()); // 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 blogbuzz_get_style() { $style = theme_get_setting('blogbuzz_style'); return $style; } drupal_add_css(drupal_get_path('theme', 'blogbuzz') . '/css/' . blogbuzz_get_style() . '.css', 'theme'); function phptemplate_preprocess_page(&$vars) { // 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.) $classes = split(' ', $vars['body_classes']); // Remove the mostly useless page-ARG0 class. if ($index = array_search(preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', 'page-'. drupal_strtolower(arg(0))), $classes)) { unset($classes[$index]); } if (!$vars['is_front']) { // Add unique class for each page. $path = drupal_get_path_alias($_GET['q']); $classes[] = blogbuzz_id_safe('page-' . $path); // Add unique class for each website section. list($section, ) = explode('/', $path, 2); if (arg(0) == 'node') { if (arg(1) == 'add') { $section = 'node-add'; } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { $section = 'node-' . arg(2); } } $classes[] = blogbuzz_id_safe('section-' . $section); } $vars['body_classes_array'] = $classes; $vars['body_classes'] = implode(' ', $classes); // Concatenate with spaces. // Add content top & postscript classes with number of active sub-regions $region_list = array( 'main_bottom' => array('main_bottom_one', 'main_bottom_two', 'main_bottom_three', 'main_bottom_four'), 'footer' => array('footer_one', 'footer_two', 'footer_three') ); foreach ($region_list as $sub_region_key => $sub_region_list) { $active_regions = array(); foreach ($sub_region_list as $region_item) { if ($vars[$region_item]) { $active_regions[] = $region_item; } } $vars[$sub_region_key] = $sub_region_key .'-'. strval(count($active_regions)); } // Generate menu tree from source of primary links $vars['primary_links_tree'] = menu_tree(variable_get('menu_primary_links_source', 'primary-links')); } /** * Override or insert variables into the node templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("node" in this case.) */ function blogbuzz_preprocess_node(&$vars, $hook) { // Special classes for nodes $classes = array('node'); if ($vars['sticky']) { $classes[] = 'sticky'; } if (!$vars['status']) { $classes[] = 'node-unpublished'; $vars['unpublished'] = TRUE; } else { $vars['unpublished'] = FALSE; } if ($vars['uid'] && $vars['uid'] == $GLOBALS['user']->uid) { $classes[] = 'node-mine'; // Node is authored by current user. } if ($vars['teaser']) { $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[] = blogbuzz_id_safe('node-type-' . $vars['type']); $vars['classes'] = implode(' ', $classes); // Concatenate with spaces } /** * 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 blogbuzz_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']; // Render block classes. $vars['classes'] = implode(' ', $classes); } function blogbuzz_preprocess_comment(&$vars, $hook) { // Add an "unpublished" flag. $vars['unpublished'] = ($vars['comment']->status == COMMENT_NOT_PUBLISHED); // If comment subjects are disabled, don't display them. if (variable_get('comment_subject_field_' . $vars['node']->type, 1) == 0) { $vars['title'] = ''; } // Special classes for comments. $classes = array('comment'); if ($vars['comment']->new) { $classes[] = 'comment-new'; } $classes[] = $vars['status']; $classes[] = $vars['zebra']; if ($vars['id'] == 1) { $classes[] = 'first'; } if ($vars['id'] == $vars['node']->comment_count) { $classes[] = 'last'; } if ($vars['comment']->uid == 0) { // Comment is by an anonymous user. $classes[] = 'comment-by-anon'; } else { if ($vars['comment']->uid == $vars['node']->uid) { // Comment is by the node author. $classes[] = 'comment-by-author'; } if ($vars['comment']->uid == $GLOBALS['user']->uid) { // Comment was posted by current user. $classes[] = 'comment-mine'; } } $vars['classes'] = implode(' ', $classes); } function blogbuzz_preprocess_ddblock_cycle_block_content(&$vars) { if ($vars['output_type'] == 'view_fields') { $content = array(); // Add slider_items for the template // If you use the devel module uncomment the following line to see the theme variables // dsm($vars['settings']['view_name']); // dsm($vars['content'][0]); // If you don't use the devel module uncomment the following line to see the theme variables drupal_set_message('
' . var_export($vars['settings']['view_name'], true) . ''); drupal_set_message('
' . var_export($vars['content'][0], true) . ''); if ($vars['settings']['view_name'] == 'showcase_with_image') { foreach ($vars['content'] as $key1 => $result) { // add slide_image variable if (isset($result->node_data_field_image_field_image_fid)) { // get image id $fid = $result->node_data_field_image_field_image_fid; // get path to image $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid)); // use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes) if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '
' . var_export($vars['pager_settings'], true) . ''); drupal_set_message('
' . var_export($vars['content'][0], true) . ''); if ($vars['pager_settings']['view_name'] == 'showcase_with_image') { foreach ($vars['content'] as $key1 => $result) { // add pager_item_image variable if (isset($result->node_data_field_image_field_image_fid)) { $fid = $result->node_data_field_image_field_image_fid; $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid)); // use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes) if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_pager_item'] <> '