template_print_below()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 0
dl 0
loc 24
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @package   ElkArte Forum
5
 * @copyright ElkArte Forum contributors
6
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
7
 *
8
 * This file contains code covered by:
9
 * copyright: 2011 Simple Machines (http://www.simplemachines.org)
10
 *
11
 * @version 2.0 dev
12
 *
13
 */
14
15
/**
16
 * Interface for the bit up the print page.
17
 */
18
function template_print_above()
19
{
20
	global $context, $txt;
21
22
	echo '<!DOCTYPE html>
23
<html ', $context['right_to_left'] ? 'dir="rtl"' : '', '>
24
	<head>
25
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
26
		<meta name="robots" content="noindex" />
27
		<link rel="canonical" href="', $context['canonical_url'], '" />
28
		<title>', $txt['print_page'], ' - ', $context['topic_subject'], '</title>
29
		<style>
30
			body, a {
31
				color: #000;
32
				background: #fff;
33
			}
34
			body, td, .normaltext {
35
				font-family: Verdana, arial, helvetica, serif;
36
				font-size: small;
37
			}
38
			h1#title {
39
				font-size: large;
40
				font-weight: bold;
41
			}
42
			h2#breadcrumb {
43
				margin: 1em 0 2.5em 0;
44
				font-size: small;
45
				font-weight: bold;
46
			}
47
			dl#posts {
48
				width: 90%;
49
				margin: 0;
50
				padding: 0;
51
				list-style: none;
52
			}
53
			div.postheader, #poll_data {
54
				border: solid #000;
55
				border-width: 1px 0;
56
				padding: 4px 0;
57
			}
58
			div.postbody {
59
				margin: 1em 0 2em 2em;
60
			}
61
			table {
62
				empty-cells: show;
63
			}
64
			blockquote, code {
65
				border: 1px solid #000;
66
				margin: 3px;
67
				padding: 1px;
68
				display: block;
69
			}
70
			code {
71
				font: x-small monospace;
72
			}
73
			blockquote {
74
				font-size: x-small;
75
			}
76
			.smalltext, .quoteheader, .codeheader {
77
				font-size: x-small;
78
			}
79
			.largetext {
80
				font-size: large;
81
			}
82
			.centertext {
83
				text-align: center;
84
			}
85
			.emoji {
86
				max-width: 18px;
87
				padding: 0 .13em;
88
				vertical-align: text-bottom;
89
			}
90
			hr {
91
				height: 1px;
92
				border: 0;
93
				color: black;
94
				background: black;
95
			}
96
			.voted {
97
				font-weight: bold;
98
			}
99
			@media print {
100
				.print_options {
101
					display:none;
102
				}
103
			}
104
			@media screen {
105
				.print_options {
106
					margin:1em;
107
				}
108
			}
109
		</style>
110
	</head>
111
	<body>
112
		<div class="print_options">';
113
114
	// Which option is set, text or text&images
115
	if (!empty($context['viewing_attach']))
116
	{
117
		echo '
118
			<a href="', $context['view_attach_mode']['text'], '">', $txt['print_page_text'], '</a> | <strong><a href="', $context['view_attach_mode']['images'], '">', $txt['print_page_images'], '</a></strong>';
119
	}
120
	else
121
	{
122
		echo '
123
			<strong><a href="', $context['view_attach_mode']['text'], '">', $txt['print_page_text'], '</a></strong> | <a href="', $context['view_attach_mode']['images'], '">', $txt['print_page_images'], '</a>';
124
	}
125
126
	echo '
127
		</div>
128
		<h1 id="title">', $context['forum_name_html_safe'], '</h1>
129
		<h2 id="breadcrumb">', $context['category_name'], ' => ', (empty($context['parent_boards']) ? '' : implode(' => ', $context['parent_boards']) . ' => '), $context['board_name'], ' => ', $txt['topic_started'], ': ', $context['poster_name'], ' ', $txt['search_on'], ' ', $context['post_time'], '</h2>
130
		<div id="posts">';
131
}
132
133
/**
134
 * The topic may have a poll
135
 */
136
function template_print_poll_above()
137
{
138
	global $context, $txt;
139
140
	if (!empty($context['poll']))
141
	{
142
		echo '
143
			<div id="poll_data">', $txt['poll'], '
144
				<div class="question">', $txt['poll_question'], ': <strong>', $context['poll']['question'], '</strong>';
145
146
		$print_options = 1;
147
		foreach ($context['poll']['options'] as $option)
148
		{
149
			echo '
150
					<div class="', $option['voted_this'] ? 'voted' : '', '">', $txt['option'], ' ', $print_options++, ': <strong>', $option['option'], '</strong>
151
						', $context['allow_poll_view'] ? $txt['votes'] . ': ' . $option['votes'] : '', '
152
					</div>';
153
		}
154
155
		echo '
156
			</div>';
157
	}
158
}
159
160
/**
161
 * Interface for print page central view.
162
 */
163
function template_print_page()
164
{
165
	global $context, $txt, $scripturl, $topic;
166
167
	foreach ($context['posts'] as $post)
168
	{
169
		echo '
170
			<div class="postheader">
171
				', $txt['title'], ': <strong>', $post['subject'], '</strong><br />
172
				', $txt['post_by'], ': <strong>', $post['member'], '</strong> ', $txt['search_on'], ' <strong>', $post['time'], '</strong>
173
			</div>
174
			<div class="postbody">
175
				', $post['body'];
176
177
		// Show attachment images
178
		if (!empty($context['printattach'][$post['id_msg']]))
179
		{
180
			echo '
181
				<hr />';
182
183
			foreach ($context['printattach'][$post['id_msg']] as $attach)
184
			{
185
				if (!empty($context['ila_dont_show_attach_below'])
186
					&& in_array((int) $attach['id_attach'], $context['ila_dont_show_attach_below'], true))
187
				{
188
					continue;
189
				}
190
191
				echo '
192
					<img style="width:' . $attach['width'] . 'px; height:' . $attach['height'] . 'px;" src="', $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attach['id_attach'] . '" alt="" />';
193
			}
194
		}
195
196
		echo '
197
			</div>';
198
	}
199
}
200
201
/**
202
 * Interface for the bit down the print page.
203
 */
204
function template_print_below()
205
{
206
	global $txt, $context;
207
208
	echo '
209
		</div>
210
		<div class="print_options">';
211
212
	// Show the text / image links
213
	if (!empty($context['viewing_attach']))
214
	{
215
		echo '
216
			<a href="', $context['view_attach_mode']['text'], '">', $txt['print_page_text'], '</a> | <strong><a href="', $context['view_attach_mode']['images'], '">', $txt['print_page_images'], '</a></strong>';
217
	}
218
	else
219
	{
220
		echo '
221
			<strong><a href="', $context['view_attach_mode']['text'], '">', $txt['print_page_text'], '</a></strong> | <a href="', $context['view_attach_mode']['images'], '">', $txt['print_page_images'], '</a>';
222
	}
223
224
	echo '
225
		</div>
226
		<div id="footer" class="smalltext">
227
			', theme_copyright(), '
0 ignored issues
show
Bug introduced by
Are you sure the usage of theme_copyright() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug introduced by
Are you sure theme_copyright() of type void can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

227
			', /** @scrutinizer ignore-type */ theme_copyright(), '
Loading history...
228
		</div>
229
	</body>
230
</html>';
231
}
232