/[drupal]/contributions/modules/inline/inline.theme.inc
ViewVC logotype

Contents of /contributions/modules/inline/inline.theme.inc

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


Revision 1.2 - (show annotations) (download) (as text)
Sun Aug 17 14:43:39 2008 UTC (15 months, 1 week ago) by sun
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.1: +6 -2 lines
File MIME type: text/x-php
#273489 by sun: Code clean-up.
1 <?php
2 // $Id: inline.theme.inc,v 1.1 2008/08/17 14:22:43 sun Exp $
3
4 /**
5 * @file
6 * Output theming functions for Inline.
7 */
8
9 /**
10 * Return HTML for a link to a file.
11 */
12 function theme_inline_as_link($file) {
13 // Prepare link text with title or filename.
14 $linktext = ($file->title ? $file->title : $file->filename);
15
16 return l($linktext, file_create_url($file->filepath), array('attributes' => array('title' => t('Download: @name (@size)', array('@name' => $file->filename, '@size' => format_size($file->filesize))))));
17 }
18
19 /**
20 * Return HTML for an image.
21 */
22 function theme_inline_img($file, $field) {
23 // Prepare link text with inline title, file description or filename.
24 $title = (!empty($file->title) ? $file->title : (!empty($file->description) ? $file->description : $file->filename));
25 $inline_preset = $field == 'teaser' ? 'inline_teaser_preset' : 'inline_full_preset';
26
27 if (module_exists('imagecache') && variable_get($inline_preset, '') != '') {
28 $image = theme('imagecache',
29 variable_get($inline_preset, ''),
30 $file->filepath,
31 $title,
32 $title,
33 array('class' => 'inline')
34 );
35 }
36 else {
37 $image = theme('image',
38 $file->filepath,
39 $title,
40 $title,
41 array('class' => 'inline')
42 );
43 }
44
45 if (variable_get('inline_link_img', '1')) {
46 $attributes = array(
47 'class' => 'inline-image-link',
48 'title' => t("View") .': '. $title,
49 );
50 $html = l($image, $file->filepath, array('attributes' => $attributes, 'html' => TRUE));
51 }
52 else {
53 $html = $image;
54 }
55
56 return $html;
57 }
58
59 /**
60 * Insert an image in front of node teaser.
61 *
62 * @param object $node
63 * The node object to process.
64 * @param object $file
65 * A file object of an image to insert.
66 * @param string $field
67 * The field name to prepend with the image.
68 */
69 function theme_inline_add_to_teaser($node, $file, $field) {
70 return theme('inline_img', $file, $field) . $node->teaser;
71 }
72
73 /**
74 * Insert an image in front of node body.
75 *
76 * @param object $node
77 * The node object to process.
78 * @param object $file
79 * A file object of an image to insert.
80 * @param string $field
81 * The field name to prepend with the image.
82 */
83 function theme_inline_add_to_body($node, $file, $field) {
84 return theme('inline_img', $file, $field) . $node->body;
85 }
86
87

  ViewVC Help
Powered by ViewVC 1.1.2