-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom.php
141 lines (133 loc) · 4.11 KB
/
custom.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
* Custom theme functions
*/
/**
* Generates a link for the theme favicon
* @return String link tag for theme favicon
*/
function theme_favicon() {
$image = get_theme_option('favicon');
if ($image) {
$storage = Zend_Registry::get('storage');
$uri = $storage->getUri($storage->getPathByType($image, 'theme_uploads'));
?>
<link rel="icon" href="<?php echo $uri; ?>">
<?php
}
}
/**
* Generates an Apple Touch Icon link
* @return String link tag for theme apple-touch-icon
*/
function theme_apple_touch_icon() {
$image = get_theme_option('apple_touch_icon');
if ($image) {
$storage = Zend_Registry::get('storage');
$uri = $storage->getUri($storage->getPathByType($image, 'theme_uploads'));
?>
<link rel="apple-touch-icon" href="<?php echo $uri; ?>">
<?php
}
}
/**
* Generates a link for the theme ms wide tile
* @return String link tag for theme ms wide tile
*/
function theme_ms_wide_tile() {
$image = get_theme_option('ms_wide_tile');
if ($image) {
$storage = Zend_Registry::get('storage');
$uri = $storage->getUri($storage->getPathByType($image, 'theme_uploads'));
?>
<meta name="msapplication-wide558x270logo" content="<?php echo $uri; ?>">
<?php
}
}
/**
* Generates a link for the theme ms square tile
* @return String link tag for theme ms square tile
*/
function theme_ms_square_tile() {
$image = get_theme_option('ms_square_tile');
if ($image) {
$storage = Zend_Registry::get('storage');
$uri = $storage->getUri($storage->getPathByType($image, 'theme_uploads'));
?>
<meta name="msapplication-square558x558logo" content="<?php echo $uri; ?>">
<?php
}
}
/**
* Generates the item's files
* @param Object $item in the item
* @return String list of files
*/
function theme_item_files($item, $filetypes = 'images') {
if (metadata('item', 'has files')): ?>
<div id="itemfiles" class="element item-files-list">
<h3><?php echo __('Files'); ?></h3>
<?php
// Loop through the files
set_loop_records('files', $item->Files);
foreach (loop('files') as $file) {
if ($filetypes == 'image') {
theme_item_single_image($file);
}
if ($filetypes == 'pdf' && $file->mime_type == 'application/pdf') {
theme_item_single_pdf($file);
}
}
?>
</div>
<?php endif;
}
/**
* Generate html for a single item image file
* @param Object, a file
* @return String, html
*/
function theme_item_single_image($file) {
?>
<div class="item-file">
<div class="item-file-inner">
<a href="<?php echo metadata($file, 'uri'); ?>" class="item-file-link">
<img src="<?php echo metadata($file, 'fullsize_uri'); ?>" alt="<?php echo metadata($file, array('Dublin Core', 'Title')) ?>" />
</a>
<p class="item-file-caption">
<?php echo metadata($file, array('Dublin Core', 'Title')); ?>
</p>
<?php if (all_element_texts($file)): ?>
<button class="item-file-all-metadata-toggle">
Details
</button>
<div class="item-file-all-metadata">
<div id="text-metadata">
<?php echo all_element_texts($file, ['show_element_set_headings' => false]); ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php
}
/**
* Generate html for single item PDF file
* @param Object, a file
* @return String, html
*/
function theme_item_single_pdf($file) {
?>
<div class="item-file">
<div class="item-file-inner">
<a href="<?php echo metadata($file, 'uri'); ?>" class="item-file-link">
<?php if (metadata($file, array('Dublin Core', 'Title'))): ?>
<?php echo metadata($file, array('Dublin Core', 'Title')); ?>
<?php else: ?>
PDF
<?php endif; ?>
</a>
</div>
</div>
<?php
}