-
Notifications
You must be signed in to change notification settings - Fork 0
/
symbiostock_author_box.php
352 lines (280 loc) · 21.3 KB
/
symbiostock_author_box.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<?php
//showing an author box from the .csv files generated by Symbiostock
//this function is so big it gets its own file!
function symbiostock_csv_symbiocard_box($symbiocard_location = '', $compact = true, $id='symbiostock_author', $attribution = false){
if(empty($symbiocard_location)){
$symbiocard_location = ABSPATH . '/symbiocard.csv';
if(file_exists(ABSPATH . '/symbiocard.csv')){
$symbiocard_location = ABSPATH . '/symbiocard.csv';
} else {
return;
}
}
$author = new network_manager;
$info = $author->csv_to_array($symbiocard_location, ',');
$symbiocard = $info[0];
foreach ($symbiocard as $key=>$value) {
$symbiocard[$key] = stripslashes($value);
}
if($compact ==true && $attribution == true){
$links = 'dropdown-menu';
$btn_group = 'btn-group';
//we toggle schema and markup based on which page we are on
$schema = '';
$creator_credits = 'author contributor copyrightHolder creator name';
$bio = '';
} elseif($compact ==true && $attribution == false){
$links = 'dropdown-menu';
$btn_group = 'btn-group';
//we toggle schema and markup based on which page we are on
$schema = '';
$creator_credits = '';
$bio = '';
}else {
$links = 'nav nav-list';
$btn_group = '';
//we toggle schema and markup based on which page we are on
$schema = 'itemtype="http://schema.org/CreativeWork"';
$creator_credits = 'givenName name';
$bio = 'itemprop="description"';
}
?>
<div <?php echo $schema; ?> class="author-bio contributor vcard row-fluid">
<div class="symbiostock_author_info span7">
<div class="author-name">
<span itemprop="<?php echo $creator_credits ?>" ><a title="Author <?php echo $symbiocard['symbiostock_display_name'] ?>" href="<?php echo $symbiocard['symbiostock_author_page'] ?>"><?php echo $symbiocard['symbiostock_display_name'] ?></a></span>
</div>
<div class="bio-container">
<p <?php echo $bio; ?>><?php
if(isset($symbiocard['symbiostock_author_bio']) && !empty($symbiocard['symbiostock_author_bio'])){
if($compact == true && strlen($symbiocard['symbiostock_author_bio']) > 74){
$pos=strpos(stripslashes($symbiocard['symbiostock_author_bio']), ' ', 75);
$bio_text = substr($symbiocard['symbiostock_author_bio'], 0,$pos ) . '...<small><a title="See full author bio..." href="'.$symbiocard['symbiostock_author_page'].'"> [more]</a></small>';
} else {
if(!empty($symbiocard['symbiostock_author_bio'])):
$bio_text = stripslashes($symbiocard['symbiostock_author_bio']);
endif;
}
echo $bio_text;
}
?></p>
</div>
<?php if($compact == false):
if(!empty($symbiocard['symbiostock_home_location_coords'])):
$symbiostock_map_info = maybe_unserialize($symbiocard['symbiostock_home_location_coords']);
endif;
if(!empty($symbiostock_map_info) && is_array($symbiostock_map_info)){
$home_area = $symbiostock_map_info['results'][0]['formatted_address'];
} else {$home_area = '';}
$symbiostock_temp_location_1_info = maybe_unserialize($symbiocard['symbiostock_temporary_location_1_info']);
if(!empty($symbiostock_temp_location_1_info) && is_array($symbiostock_temp_location_1_info)){
$temp_location_1 = $symbiostock_map_info['results'][0]['formatted_address'];
} else {$temp_location_1 = '';}
$symbiostock_temp_location_2_info = maybe_unserialize($symbiocard['symbiostock_temporary_location_2_info']);
if(!empty($symbiostock_temp_location_2_info) && is_array($symbiostock_temp_location_2_info)){
$temp_location_2 = $symbiostock_map_info['results'][0]['formatted_address'];
} else {$temp_location_2 = '';}
?>
<div id="<?php echo $id ?>" class="accordion">
<!--author important links-->
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#<?php echo $id ?>" href="#collapseOne_<?php echo $id ?>"><i style="margin-right: 20px;" class="icon-expand-alt"> </i><i class="icon-link"> </i> <span itemprop="address">Author </span></a>
</div>
<div id="collapseOne_<?php echo $id ?>" class="accordion-body collapse">
<div class="accordion-inner">
<?php endif; ?>
<div class="<?php echo $btn_group ?>">
<?php if($compact == true): ?>
<button class="btn btn-small"><i class="icon-sign-blank"> </i> <?php echo $symbiocard['symbiostock_profession_1'] ?> Info</button>
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<?php endif; ?>
<ul class="<?php echo $links ?>">
<?php if (isset($symbiocard['symbiostock_author_page']) && !empty($symbiocard['symbiostock_author_page'])): ?>
<li><a itemprop="" title="Author <?php echo $symbiocard['symbiostock_display_name'] ?>" href="<?php echo $symbiocard['symbiostock_author_page'] ?>"><i class="icon-user"> </i> Author Page</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_portfolio']) && !empty($symbiocard['symbiostock_portfolio'])): ?>
<li><a itemprop="" class="symbiostock_num_images_link" title="Portfolio" href="<?php echo $symbiocard['symbiostock_portfolio'] ?>"><i class="icon-search"> </i> Portfolio: <?php echo $symbiocard['symbiostock_num_images'] ?> images.</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_gallery_page']) && !empty($symbiocard['symbiostock_gallery_page'])): ?>
<li><a itemprop="" class="symbiostock_gallery_link" title="Gallery" href="<?php echo $symbiocard['symbiostock_gallery_page'] ?>"><i class="icon-star"> </i> Gallery Page</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_contact_page']) && !empty($symbiocard['symbiostock_contact_page'])): ?>
<li><a itemprop="" class="symbiostock_contact_author contact author" title="Contact <?php echo $symbiocard['symbiostock_display_name'] ?>" href="<?php echo $symbiocard['symbiostock_contact_page'] ?>"><i class="icon-envelope"> </i> Contact <?php echo $symbiocard['symbiostock_first_name'] ?></a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_rss']) && !empty($symbiocard['symbiostock_rss'])): ?>
<li><a itemprop="" class="symbiostock_author_rss" href="<?php echo $symbiocard['symbiostock_rss'] ?>"><i class="icon-rss"> </i> Updates / RSS</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_network_page']) && !empty($symbiocard['symbiostock_network_page'])): ?>
<li><a itemprop="" class="symbiostock_network_page" href="<?php echo $symbiocard['symbiostock_network_page'] ?>"><i class="icon-sitemap"> </i> Network</a></li>
<?php endif; ?>
</ul>
</div>
<?php if($compact == false): ?>
</div>
</div>
</div>
<!--author categories-->
<div class="symbiostock_author_categories accordion-group">
<div class="accordion-heading">
<div>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#<?php echo $id ?>" href="#collapseTwo_<?php echo $id ?>"><i style="margin-right: 20px;" class="icon-expand-alt"> </i><i class="icon-reorder"> </i> <span itemprop="address"> Categories </span> </a>
</div>
</div>
<div id="collapseTwo_<?php echo $id ?>" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="">
<?php echo maybe_unserialize($symbiocard['symbiostock_author_categories']); ?>
</ul>
</div>
</div>
</div>
<!--author network-->
<div class="symbiostock_author_network accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#<?php echo $id ?>" href="#collapseThree_<?php echo $id ?>"><i style="margin-right: 20px;" class="icon-expand-alt"> </i><i class="icon-sitemap"> </i> <span>Network </span> </a>
</div>
<div id="collapseThree_<?php echo $id ?>" class="accordion-body collapse">
<div class="accordion-inner">
<!--network links-->
<?php
if(isset($symbiocard['symbiostock_networked_sites']) && !empty($symbiocard['symbiostock_networked_sites'])){
$network_sites = unserialize($symbiocard['symbiostock_networked_sites']);
?><ul class="nav nav-list"> <?php
foreach($network_sites as $site){
!empty($site['description'])?$desc = $site['description'] : $desc = $site['address'];
echo '<li><a title="'.$desc.'" href="'.$site['address'].'"><i class="icon-user"> </i> '.$desc.'</a></li>';
}
}
?></ul> <?php
?>
</div>
</div>
</div>
<!--author site attributes-->
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#<?php echo $id ?>" href="#collapseFour_<?php echo $id ?>"><i style="margin-right: 20px;" class="icon-expand-alt"> </i><i class="icon-book"> </i> <span data-toggle="collapse" data-target="#symbiostock-author-attributes-toggle">Attributes & Symbiocard</span></a>
</div>
<div id="collapseFour_<?php echo $id ?>" class="accordion-body collapse">
<table id="symbiostock-author-attributes-toggle" class="table table-condensed accordion-inner">
<thead><tr class="info"><th colspan="2">Author Attributes</th></tr></thead>
<?php if (isset($symbiocard['symbiostock_profession_1']) && !empty($symbiocard['symbiostock_profession_1'])): ?>
<tr><td>Profession 1:</td><td itemprop="jobTitle"><?php echo $symbiocard['symbiostock_profession_1'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_profession_2']) && !empty($symbiocard['symbiostock_profession_2'])): ?>
<tr><td>Profession 2: </td><td itemprop="jobTitle"><?php echo $symbiocard['symbiostock_profession_2'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_languages']) && !empty($symbiocard['symbiostock_languages'])): ?>
<tr><td>Language(s): </td><td><?php echo $symbiocard['symbiostock_languages'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_equipment']) && !empty($symbiocard['symbiostock_equipment'])): ?>
<tr><td>Equipment: </td><td><?php echo $symbiocard['symbiostock_equipment'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_software']) && !empty($symbiocard['symbiostock_software'])): ?>
<tr><td>Software: </td><td><?php echo $symbiocard['symbiostock_software'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_open_for_assignment_jobs']) && !empty($symbiocard['symbiostock_open_for_assignment_jobs'])): ?>
<tr><td>Available for<br /> Assignments: </td><td><?php echo $symbiocard['symbiostock_open_for_assignment_jobs'] ?></td></tr>
<?php endif; ?>
<?php if (isset($home_area) && !empty($home_area)): ?>
<tr><td>Home<br /> Location: </td><td itemprop="address"><?php echo '<a target="_blank" title="' . $home_area . '" href="https://maps.google.com/?q='.urlencode($home_area).'">' . $home_area . '</a>'; ?></td></tr>
<?php endif; ?>
<?php if (isset($temp_location_1) && !empty($temp_location_1)): ?>
<tr><td>Temporary<br /> Location 1: </td><td><?php echo '<a target="_blank" title="' . $temp_location_1 . '" href="https://maps.google.com/?q='.urlencode($temp_location_1).'">' . $temp_location_1 . '</a>'; ?></td></tr>
<?php endif; ?>
<?php if (isset($temp_location_2) && !empty($temp_location_2)): ?>
<tr><td>Temporary<br /> Location 2: </td><td><?php echo '<a target="_blank" title="' . $temp_location_2 . '" href="https://maps.google.com/?q='.urlencode($temp_location_2).'">' . $temp_location_2 . '</a>'; ?></td></tr>
<?php endif; ?>
<thead><tr class="info"><th colspan="2">Site Attributes</th></tr></thead>
<?php if (isset($symbiocard['symbiostock_num_images']) && !empty($symbiocard['symbiostock_num_images'])): ?>
<tr><td># Images: </td><td><?php echo $symbiocard['symbiostock_num_images'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_portfolio_focus_1']) && !empty($symbiocard['symbiostock_portfolio_focus_1'])): ?>
<tr><td>Focus 1: </td><td><?php echo $symbiocard['symbiostock_portfolio_focus_1'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_portfolio_focus_2']) && !empty($symbiocard['symbiostock_portfolio_focus_2'])): ?>
<tr><td>Focus 2: </td><td><?php echo $symbiocard['symbiostock_portfolio_focus_2'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_specialty_1']) && !empty($symbiocard['symbiostock_specialty_1'])): ?>
<tr><td>Specialty 1: </td><td><?php echo $symbiocard['symbiostock_specialty_1'] ?></td></tr>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_specialty_2']) && !empty($symbiocard['symbiostock_specialty_2'])): ?>
<tr><td>Specialty 2: </td><td><?php echo $symbiocard['symbiostock_specialty_2'] ?></td></tr>
<?php endif; ?>
<tr><td>Symbiostock vsn: </td><td><?php echo $symbiocard['symbiostock_version'] ?></td></tr>
<tr><td>Last Update: </td><td><?php echo $symbiocard['symbiostock_csv_generated_time'] ?></td></tr>
</table>
<div class="row-fluid">
<a class="btn btn-large span12" title="Get Symbiocard" href="<?php echo $symbiocard['symbiostock_site'].'/symbiocard.csv' ?>">Get <?php echo $symbiocard['symbiostock_display_name'] ?>'s Symbiocard</a>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="symbiostock_author_avatar span5">
<?php
!isset($symbiocard['symbiostock_personal_photo'])||!isset($symbiocard['symbiostock_personal_photo']) ? $avatar_img = symbiostock_IMGDIR . '/generic-user.jpg' : $avatar_img = $symbiocard['symbiostock_personal_photo'] ;
?>
<a title="<?php echo $symbiocard['symbiostock_display_name']; ?>" href="<?php echo $symbiocard['symbiostock_author_page'] ?>">
<img class="avatar avatar-150 thumbnail" src="<?php echo $avatar_img ?>" alt="Author avatar" />
</a>
</div>
<div class="clear"></div>
</div>
<?php
}
function symbiostock_csv_symbiocard_listing($symbiocard_location = ''){
if(empty($symbiocard_location)){
return;
}
}
function symbiostock_csv_symbiocard_network_results($symbiocard_location = ''){
if(empty($symbiocard_location)){
return;
}
if(!file_exists($symbiocard_location)){return;}
$author = new network_manager;
$info = $author->csv_to_array($symbiocard_location, ',');
$symbiocard = $info[0];
foreach ($symbiocard as $key=>$value) {
$symbiocard[$key] = stripslashes($value);
}
?>
<img class="network_avatar" alt="<?php echo $symbiocard['symbiostock_my_network_name']; ?>" src="<?php echo $symbiocard['symbiostock_my_network_avatar']; ?>" />
<div class="btn-group">
<button class="btn btn-small"><i class="icon-user"> </i> <?php echo $symbiocard['symbiostock_display_name'] ?> Network Results:</button>
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<?php if (isset($symbiocard['symbiostock_my_network_logo']) && !empty($symbiocard['symbiostock_my_network_logo'])): ?>
<li><img class="media-object img-rounded aligncenter" alt="<?php echo $symbiocard['symbiostock_my_network_name']; ?>" src="<?php echo $symbiocard['symbiostock_my_network_logo']; ?>" /></li>
<li class="divider"></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_author_page']) && !empty($symbiocard['symbiostock_author_page'])): ?>
<li><a itemprop="" title="Author <?php echo $symbiocard['symbiostock_display_name'] ?>" href="<?php echo $symbiocard['symbiostock_author_page'] ?>"><i class="icon-user"> </i> Author Page</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_portfolio']) && !empty($symbiocard['symbiostock_portfolio'])): ?>
<li><a itemprop="" class="symbiostock_num_images_link" title="Portfolio" href="<?php echo $symbiocard['symbiostock_portfolio'] ?>"><i class="icon-search"> </i> Portfolio: <?php echo $symbiocard['symbiostock_num_images'] ?> images.</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_gallery_page']) && !empty($symbiocard['symbiostock_gallery_page'])): ?>
<li><a itemprop="" class="symbiostock_gallery_link" title="Gallery" href="<?php echo $symbiocard['symbiostock_gallery_page'] ?>"><i class="icon-star"> </i> Gallery Page</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_contact_page']) && !empty($symbiocard['symbiostock_contact_page'])): ?>
<li><a itemprop="" class="symbiostock_contact_author contact author" title="Contact <?php echo $symbiocard['symbiostock_display_name'] ?>" href="<?php echo $symbiocard['symbiostock_contact_page'] ?>"><i class="icon-envelope"> </i> Contact <?php echo $symbiocard['symbiostock_first_name'] ?></a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_rss']) && !empty($symbiocard['symbiostock_rss'])): ?>
<li><a itemprop="" class="symbiostock_author_rss" href="<?php echo $symbiocard['symbiostock_rss'] ?>"><i class="icon-rss"> </i> Updates / RSS</a></li>
<?php endif; ?>
<?php if (isset($symbiocard['symbiostock_network_page']) && !empty($symbiocard['symbiostock_network_page'])): ?>
<li><a itemprop="" class="symbiostock_network_page" href="<?php echo $symbiocard['symbiostock_network_page'] ?>"><i class="icon-sitemap"> </i> Network</a></li>
<?php endif; ?>
</ul>
</div>
<?php
}
?>