/** * Override or insert variables into the page templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function lullacog_preprocess_page(&$vars, $hook) { global $theme; global $user; _lullacog_add_body_classes($vars); _lullacog_process_menus($vars); // Re-add the site-name. For SEO purposes, we always want the site name in a // hidden h1. We can then toggle a visible site name using the $toggle_name var. $vars['toggle_name'] = theme_get_setting('toggle_name'); $vars['site_name'] = variable_get('site_name', 'Drupal'); // If imagecache is enabled and we're using a custom logo, use our imagecache preset. if ($vars['logo'] && function_exists('imagecache_create_url') && !theme_get_setting('default_logo')) { $vars['logo'] = strpos($vars['logo'], '/') == 0 ? substr($vars['logo'], 1) : $vars['logo']; $vars['logo'] = imagecache_create_url('header_logo', $vars['logo']); } $vars['logo_url'] = $vars['base_path']; // Load up the site follow links into a var so we can hard code them in the theme. if (function_exists('follow_links_load') && ($links = follow_links_load())) { $vars['follow_site'] = theme('follow_links', array('links' => $links, 'networks' => follow_networks_load(0))); } }
/** * Implementation of hook_preprocess_user_picture(). */ function ginkgo_preprocess_user_picture(&$vars) { $account = $vars['account']; if (isset($account->picture) && module_exists('imagecache')) { $attr = array('class' => 'user-picture'); $preset = variable_get('seed_imagecache_user_picture', '30x30_crop'); if ($view = views_get_current_view()) { switch ($view->name) { case 'og_members_faces': case 'atrium_members': case 'atrium_profile': $preset = 'user-m'; break; } } $attr['class'] .= ' picture-' . $preset; if (file_exists($account->picture)) { $image = imagecache_create_url($preset, $account->picture); $attr['style'] = 'background-image: url(' . $image . ')'; } $path = 'user/' . $account->uid; $vars['picture'] = l($account->name, $path, array('attributes' => $attr)); $vars['preset'] = $preset; } }
/** * Make logo markup overridable. */ function ginkgo_designkit_image($name, $filepath) { if ($name === 'logo') { $title = variable_get('site_name', ''); if (module_exists('spaces') && $space = spaces_get_space()) { $title = $space->title(); } $url = imagecache_create_url("designkit-image-{$name}", $filepath); $options = array('attributes' => array('class' => 'logo', 'style' => "background-position:100% 50%; background-image:url('{$url}')")); return l($space->title, '<front>', $options); } return theme_designkit_image($name, $filepath); }
?> <div id="celeb_cat_stream_items"> <div class="celeb_title_cat celeb_title_cat_<?php print $cat ?>"> <span class="celeb_title_name"><?php print $fields['field_firstname_value']->content.' '.$fields['field_lastname_value']->content?></span > <span> <!--(<?php /*print get_count_celebrities_by_vote_id($fields['nid']->raw)*/ ?> comments) --></span> <span class="celeb_title_comments"></span> </div> <div id="celeb_cat_comment"> <div id="celeb_cat_bg" class="celeb_cat_img_bg celeb_cat_img_bg_<?php print $cat ?>"> <span><?php print l("<img src='".$CelebImageUrl."' title='".$fields['field_firstname_value']->content . ' ' . $fields['field_lastname_value']->content."' class='celeb_cat_stream_img' />", 'node/' . $fields['nid']->raw, array('html' => TRUE)) ; ?> </span> </div> <div id="celeb_cat_stream_single" class="celeb_cat_<?php print $cat ?>"> <?php if($fields['field_twitter_profile_image_url_value']->raw) { $twitterCelebImageUrl = three_beats_get_image($fields['field_twitter_profile_image_url_value']->raw, '/twitter_cached_images'); $twitterCelebImageCachedUrl = imagecache_create_url('48x48', $CelebImageUrl); $CelebImageUrl = $CelebImageCachedUrl; print "<img src='".$twitterCelebImageUrl."' title='".$fields['field_twitter_author_value']->content."' class='celeb_cat_stream_img' />"; }else { print l(theme('imagecache', 'user_cached_images_small', $fields['uid']->raw . '.jpg', '', $fields['field_first_name_value']->content.' '.$fields['field_last_name_value']->content, array('class'=>'celeb_cat_stream_img')), 'user/' . $fields['uid']->raw, array('html' => TRUE)); } ?> <div id="celeb_stream_text"> <div class="sprite"> <?php if($fields['field_twitter_author_value']->content): ?> <img <?php $user_agent = $_SERVER['HTTP_USER_AGENT']; if ( stristr($user_agent, 'MSIE 6.0') ){ print ''; } if ( stristr($user_agent, 'MSIE 7.0') ){ print '';
function dewey_comment_user_picture($picture, $uid) { if (isset($picture) && module_exists('imagecache')) { $attr = array('class' => 'user-picture'); $preset = '30x30_crop'; $attr['class'] .= ' picture-' . $preset; if (file_exists($picture)) { $image = imagecache_create_url($preset, $picture); $attr['style'] = 'background-image: url(' . $image . ')'; } else { $default_image = variable_get('user_picture_default', ''); $image = imagecache_create_url($preset, $default_image); $attr['style'] = 'background-image: url(' . $image . ')'; } $path = 'user/' . $uid; $picture = l("k", $path, array('attributes' => $attr, 'purl' => array('disabled' => true))); return array($picture, $preset); } }
else if ($fields['field_vote_rate_rating']->content==75){ $thumb=t('thumb_p1'); } else if ($fields['field_vote_rate_rating']->content==100){ $thumb=t('thumb_p2'); } else { $thumb=t('thumb_none'); } ?> <div class="celeb_cat_<?php print $cat ?> celeb_cat_<?php print $cat ?>_border celeb_stream_single" id="celeb_stream_single_<?php echo $fields['nid']->raw; ?>_<?php echo $fields['uid']->raw; ?>"> <div class="celeb_stream_img_wrapper"> <?php if($fields['field_twitter_profile_image_url_value']->raw) { $CelebImageUrl = three_beats_get_image($fields['field_twitter_profile_image_url_value']->raw, '/twitter_cached_images'); $CelebImageCachedUrl = imagecache_create_url('48x48', $CelebImageUrl); $CelebImageUrl = $CelebImageCachedUrl; print "<img src='$CelebImageUrl' title='".$fields['field_twitter_author_value']->content."' class='celeb_cat_stream_img' />"; }else{ print l(theme('imagecache', 'user_cached_images_small', $fields['uid']->raw . '.jpg', '', $fields['field_first_name_value']->content.' '.$fields['field_last_name_value']->content, array('class'=>'celeb_cat_stream_img')), 'user/' . $fields['uid']->raw, array('html' => TRUE)); } ?> </div> <div class="celeb_stream_text" id="celeb_stream_text_<?php echo $fields['nid']->raw; ?>_<?php echo $fields['uid']->raw; ?>"> <div class="sprite"> <?php if($fields['field_twitter_author_value']->content): ?> <img <?php $user_agent = $_SERVER['HTTP_USER_AGENT']; if ( stristr($user_agent, 'MSIE 6.0') ){ print ''; } if ( stristr($user_agent, 'MSIE 7.0') ){ print ''; } else{ print ('style="left:70px;"');} ?> alt="" src="<?php print base_path().'sites/all/themes/3beats/images/twitter-feed.png'; ?>" class="sprites"> <?php else: ?>
function beats_imagecache($presetname, $path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) { if((in_array($presetname, array('user_avatar','48x48','189x245' , 'celebrity_80x80' )) || !$presetname) && (!file_exists($path) || !$path)){ $path = drupal_get_path('theme','3beats').'/images/defaults_img.png'; } // Check is_null() so people can intentionally pass an empty array of // to override the defaults completely. if (is_null($attributes)) { $attributes = array('class' => 'imagecache imagecache-'. $presetname); } if ($getsize && ($image = image_get_info(imagecache_create_path($presetname, $path)))) { $attributes['width'] = $image['width']; $attributes['height'] = $image['height']; } $attributes = drupal_attributes($attributes); $imagecache_url = $presetname ? imagecache_create_url($presetname, $path) : $path; return '<img src="'. $imagecache_url .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $attributes .' />'; }
/** * Print logo. */ function jake_print_logo() { $settings = theme_get_settings('jake'); $name = check_plain(variable_get('site_name', 'Drupal')); if (!empty($settings['printlogo_path']) && file_exists($settings['printlogo_path']) && module_exists('imagecache') && imagecache_preset_by_name('logo_print')) { $url = imagecache_create_url('logo_print', $settings['printlogo_path']); $image = "<img src='{$url}' title='{$name}' class='logo'/>"; return l($image, '<front>', array('html' => TRUE, 'attributes' => array('class' => 'logo'))); } // Last resort, use just the name return l(t($name), '<front>'); }
/** * Theme Product Images */ function pechi_uc_product_image($images, $teaser = 0, $page = 0) { static $rel_count = 0; // Get the current product image widget. $image_widget = uc_product_get_image_widget(); $image_widget_func = $image_widget['callback']; $first = array_shift($images); $output = '<div class="product-image"><div class="main-product-image">'; $output .= '<a href="' . imagecache_create_url('product_full', $first['filepath']) . '" title="' . $first['data']['title'] . '"'; if ($image_widget) { $output .= $image_widget_func($rel_count); } $output .= '>'; $output .= theme('imagecache', 'product', $first['filepath'], $first['data']['alt'], $first['data']['title']); $output .= '</a></div><div class="more-product-images">'; foreach ($images as $thumbnail) { // Node preview adds extra values to $images that aren't files. if (!is_array($thumbnail) || empty($thumbnail['filepath'])) { continue; } if ($rel_count >= 4) { break; } $output .= '<a href="' . imagecache_create_url('product_full', $thumbnail['filepath']) . '" title="' . $thumbnail['data']['title'] . '"'; if ($image_widget) { $output .= $image_widget_func($rel_count); } $output .= '>'; $output .= theme('imagecache', 'uc_thumbnail', $thumbnail['filepath'], $thumbnail['data']['alt'], $thumbnail['data']['title']); $output .= '</a>'; } $output .= '</div></div>'; $rel_count++; return $output; }
/** * Generate the HTML output for imagefield + imagecache images so they can be * opened in a lightbox by clicking on the image on the node page or in a view. * * This actually also handles filefields + imagecache images too. * * @param $view_preset * The imagecache preset to be displayed on the node or in the view. * @param $field_name * The field name the action is being performed on. * @param $item * An array, keyed by column, of the data stored for this item in this field. * @param $node * The node object. * @param $rel * The type of lightbox to open: lightbox, lightshow or lightframe. * @param $args * Args may override internal processes: caption, rel_grouping. * @return * The themed imagefield + imagecache image and link. * Customized to add image body to captions */ function phptemplate_imagefield_image_imagecache_lightbox2($view_preset, $field_name, $item, $node, $rel = 'lightbox', $args = array()) { if (!isset($args['lightbox_preset'])) { $args['lightbox_preset'] = 'original'; } // Can't show current node page in a lightframe on the node page. // Switch instead to show it in a lightbox. $on_image_node = arg(0) == 'node' && arg(1) == $node->nid; if ($rel == 'lightframe' && $on_image_node) { $rel = 'lightbox'; } $orig_rel = $rel; // Unserialize into original - if sourced by views. $item_data = $item['data']; if (is_string($item['data'])) { $item_data = unserialize($item['data']); } // Set up the title. $image_title = $item_data['description']; $image_title = !empty($image_title) ? $image_title : $item_data['title']; $image_title = !empty($image_title) ? $image_title : $item_data['alt']; if (empty($image_title) || variable_get('lightbox2_imagefield_use_node_title', FALSE)) { $node = node_load($node->nid); $image_title = $node->title; /* CUSTOM define image body */ $image_body = '<p>' . strip_tags($node->body) . '</p>'; } $image_tag_title = ''; if (!empty($item_data['title'])) { $image_tag_title = $item_data['title']; } // Enforce image alt. $image_tag_alt = ''; if (!empty($item_data['alt'])) { $image_tag_alt = $item_data['alt']; } elseif (!empty($image_title)) { $image_tag_alt = $image_title; } // Set up the caption. $node_links = array(); if (!empty($item['nid'])) { $attributes = array(); $attributes['id'] = 'lightbox2-node-link-text'; $target = variable_get('lightbox2_node_link_target', FALSE); if (!empty($target)) { $attributes['target'] = $target; } $node_link_text = variable_get('lightbox2_node_link_text', 'View Details'); if (!$on_image_node && !empty($node_link_text)) { $node_links[] = l($node_link_text, 'node/' . $item['nid'], array('attributes' => $attributes)); } $download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original')); if (!empty($download_link_text) && user_access('download original image')) { $node_links[] = l($download_link_text, file_create_url($item['filepath']), array('attributes' => array('target' => '_blank', 'id' => 'lightbox2-download-link-text'))); } } /* CUSTOM add image body to caption */ $caption = $image_title . $image_body; if (count($node_links)) { $caption .= '<br /><br />' . implode(" - ", $node_links); } if (isset($args['caption'])) { $caption = $args['caption']; // Override caption. } if ($orig_rel == 'lightframe') { $frame_width = variable_get('lightbox2_default_frame_width', 600); $frame_height = variable_get('lightbox2_default_frame_height', 400); $frame_size = 'width:' . $frame_width . 'px; height:' . $frame_height . 'px;'; $rel = preg_replace('/\\]$/', "|{$frame_size}]", $rel); } // Set up the rel attribute. $full_rel = ''; $imagefield_grouping = variable_get('lightbox2_imagefield_group_node_id', 1); if (isset($args['rel_grouping'])) { $full_rel = $rel . '[' . $args['rel_grouping'] . '][' . $caption . ']'; } elseif ($imagefield_grouping == 1) { $full_rel = $rel . '[' . $field_name . '][' . $caption . ']'; } elseif ($imagefield_grouping == 2 && !empty($item['nid'])) { $full_rel = $rel . '[' . $item['nid'] . '][' . $caption . ']'; } elseif ($imagefield_grouping == 3 && !empty($item['nid'])) { $full_rel = $rel . '[' . $field_name . '_' . $item['nid'] . '][' . $caption . ']'; } elseif ($imagefield_grouping == 4) { $full_rel = $rel . '[allnodes][' . $caption . ']'; } else { $full_rel = $rel . '[][' . $caption . ']'; } $class = ''; if ($view_preset != 'original') { $class = 'imagecache imagecache-' . $field_name . ' imagecache-' . $view_preset . ' imagecache-' . $field_name . '-' . $view_preset; } $link_attributes = array('rel' => $full_rel, 'class' => 'imagefield imagefield-lightbox2 imagefield-lightbox2-' . $view_preset . ' imagefield-' . $field_name . ' ' . $class); $attributes = array(); if (isset($args['compact']) && $item['#delta']) { $image = ''; } elseif ($view_preset == 'original') { $image = theme('lightbox2_image', $item['filepath'], $image_tag_alt, $image_tag_title, $attributes); } elseif ($view_preset == 'link') { // Not actually an image, just a text link. $image = variable_get('lightbox2_view_image_text', 'View image'); } else { $image = theme('imagecache', $view_preset, $item['filepath'], $image_tag_alt, $image_tag_title, $attributes); } if ($args['lightbox_preset'] == 'node') { $output = l($image, 'node/' . $node->nid . '/lightbox2', array('attributes' => $link_attributes, 'html' => TRUE)); } elseif ($args['lightbox_preset'] == 'original') { $output = l($image, file_create_url($item['filepath']), array('attributes' => $link_attributes, 'html' => TRUE)); } else { $output = l($image, imagecache_create_url($args['lightbox_preset'], $item['filepath']), array('attributes' => $link_attributes, 'html' => TRUE)); } return $output; }
/** * Override or insert variables into the page templates. * * @param $vars * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function vojo_generic_preprocess_page(&$vars, $hook) { // If we're in a group context, use group logo and header color provided by // fields in the group node. $group_node = og_get_group_context(); if ($group_node) { $vars['title_group'] = $group_node->title; $navigation_block = module_invoke('vojo_og', 'block', 'view', 'generic-group-menu'); $vars['group_menu'] = $navigation_block['content']; } if (!empty($group_node) && $group_node->field_group_logo[0]['filepath']) { $image_path = imagecache_create_url('group_logo_large', $group_node->field_group_logo[0]['filepath']); $vars['group_logo'] = '<img src="' . $image_path . '" />'; } if (!empty($group_node)) { $vars['home_link'] = url('node/' . $group_node->nid); } // If the colorpicker module is present, the vozmob_og feature will provide a // field to the group node to select the background color of the header. if (isset($group_node->field_group_header_bg_color)) { $vars['header_bg_color'] = $group_node->field_group_header_bg_color[0]['value']; } if (!$vars['show_blocks']) { $vars['sidebar'] = ''; } }
function tendu_cart_review_table($show_subtotal = TRUE) { $subtotal = 0; // Set up table header. $header = array(array('data' => t('Your Items'), 'class' => 'image'), array('data' => t(''), 'class' => 'desc'), array('data' => t('Item Price'), 'class' => 'itemprice'), array('data' => t('Quantity'), 'class' => 'qty'), array('data' => t('Price'), 'class' => 'price')); $context = array(); // Set up table rows. $contents = uc_cart_get_contents(); foreach ($contents as $item) { $price_info = array('price' => $item->price, 'qty' => $item->qty); $context['revision'] = 'altered'; $context['type'] = 'cart_item'; $context['subject'] = array('cart' => $contents, 'cart_item' => $item, 'node' => node_load($item->nid)); $total = uc_price($price_info, $context); $subtotal += $total; $prodnode = $context['subject']['node']; $description = l($prodnode->title, 'node/' . $prodnode->nid) . uc_product_get_description($item); // Remove node from context to prevent the price from being altered. $context['revision'] = 'themed-original'; $context['type'] = 'amount'; // dsm($item); unset($context['subject']); // dsm($prodnode); $prodimg = l('<img src="' . imagecache_create_url('cart', $prodnode->field_image_cache[0]['filepath']) . '"/>', 'node/' . $prodnode->nid, array('html' => true)); $rows[] = array(array('data' => $prodimg, 'class' => 'image'), array('data' => $description, 'class' => 'desc'), array('data' => t('@qty', array('@qty' => $item->price)), 'class' => 'itemprice'), array('data' => t('@qty×', array('@qty' => $item->qty)), 'class' => 'qty'), array('data' => uc_price($total, $context), 'class' => 'price')); unset($prodimg); } // Add the subtotal as the final row. if ($show_subtotal) { $context = array('revision' => 'themed-original', 'type' => 'amount'); $rows[] = array('data' => array(array('data' => '<span id="backtocart-link">' . l('Back to cart', 'cart/') . '</span> ', 'colspan' => 2, 'class' => 'backtocart-wrapper'), array('data' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ' . uc_price($subtotal, $context), 'colspan' => 3, 'class' => 'subtotal')), 'class' => 'lastrow'); } $output = '<div class="tableheader">' . t('Currently In Your Shopping Cart') . '</div>'; return $output . theme('table', $header, $rows, array('class' => 'cart-review')); }