forked from giterlizzi/dokuwiki-template-bootstrap3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tpl_functions.php
executable file
·802 lines (616 loc) · 20.7 KB
/
tpl_functions.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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
<?php
/**
* Template Functions
*
* This file provides template specific custom functions that are
* not provided by the DokuWiki core.
* It is common practice to start each function with an underscore
* to make sure it won't interfere with future core functions.
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
/**
* Create link/button to discussion page and back
*
* @author Anika Henke <[email protected]>
*/
function _tpl_discussion($discussionPage, $title, $backTitle, $link=0, $wrapper=0, $return=0) {
global $ID;
$output = '';
$discussPage = str_replace('@ID@', $ID, $discussionPage);
$discussPageRaw = str_replace('@ID@', '', $discussionPage);
$isDiscussPage = strpos($ID, $discussPageRaw) !== false;
$backID = ':'.str_replace($discussPageRaw, '', $ID);
if ($wrapper) $output .= "<$wrapper>";
if ($isDiscussPage) {
if ($link) {
ob_start();
tpl_pagelink($backID, $backTitle);
$output .= ob_get_contents();
ob_end_clean();
} else {
$output .= html_btn('back2article', $backID, '', array(), 'get', 0, $backTitle);
}
} else {
if ($link) {
ob_start();
tpl_pagelink($discussPage, $title);
$output .= ob_get_contents();
ob_end_clean();
} else {
$output .= html_btn('discussion', $discussPage, '', array(), 'get', 0, $title);
}
}
if ($wrapper) $output .= "</$wrapper>";
if ($return) return $output;
echo $output;
}
/**
* Create link/button to user page
*
* @author Anika Henke <[email protected]>
*/
function _tpl_userpage($userPage, $title, $link=0, $wrapper=0) {
if (empty($_SERVER['REMOTE_USER'])) return;
global $conf;
$userPage = str_replace('@USER@', $_SERVER['REMOTE_USER'], $userPage);
if ($wrapper) echo "<$wrapper>";
if ($link)
tpl_pagelink($userPage, $title);
else
echo html_btn('userpage', $userPage, '', array(), 'get', 0, $title);
if ($wrapper) echo "</$wrapper>";
}
/**
* Wrapper around custom template actions
*
* @author Anika Henke <[email protected]>
*/
function _tpl_action($type, $link=0, $wrapper=0, $return=0) {
switch ($type) {
case 'discussion':
if (tpl_getConf('discussionPage')) {
$output = _tpl_discussion(tpl_getConf('discussionPage'), tpl_getLang('discussion'), tpl_getLang('back_to_article'), $link, $wrapper, 1);
if ($return) return $output;
echo $output;
}
break;
case 'userpage':
if (tpl_getConf('userPage')) {
$output = _tpl_userpage(tpl_getConf('userPage'), tpl_getLang('userpage'), $link, $wrapper, 1);
if ($return) return $output;
echo $output;
}
break;
}
}
/**
* copied to core (available since Detritus)
*/
if (!function_exists('tpl_toolsevent')) {
function tpl_toolsevent($toolsname, $items, $view='main') {
$data = array(
'view' => $view,
'items' => $items
);
$hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
$evt = new Doku_Event($hook, $data);
if($evt->advise_before()){
foreach($evt->data['items'] as $k => $html) echo $html;
}
$evt->advise_after();
}
}
/**
* copied from core (available since Binky)
*/
if (!function_exists('tpl_classes')) {
function tpl_classes() {
global $ACT, $conf, $ID, $INFO;
$classes = array(
'dokuwiki',
'mode_'.$ACT,
'tpl_'.$conf['template'],
!empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '',
$INFO['exists'] ? '' : 'notFound',
($ID == $conf['start']) ? 'home' : '',
);
return join(' ', $classes);
}
}
/**
* Create event for tools menues
*
* @author Anika Henke <[email protected]>
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $toolsname name of menu
* @param array $items
* @param string $view e.g. 'main', 'detail', ...
* @param boolean $return
* @return string
*/
function bootstrap3_toolsevent($toolsname, $items, $view='main', $return = false) {
$output = '';
$data = array(
'view' => $view,
'items' => $items
);
$hook = 'TEMPLATE_'.strtoupper($toolsname).'_DISPLAY';
$evt = new Doku_Event($hook, $data);
if($evt->advise_before()){
foreach($evt->data['items'] as $k => $html) $output .= $html;
}
$evt->advise_after();
$search = array('<span>');
$replace = array('<i class="fa fa-puzzle-piece fa-fw"></i> <span>');
$output = str_replace($search, $replace, $output);
if ($return) return $output;
echo $output;
}
/**
* Include left or right sidebar
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $sidebar_page
* @param string $sidebar_id
* @param string $sidebar_header
* @param string $sidebar_footer
*/
function bootstrap3_include_sidebar($sidebar_page, $sidebar_id, $sidebar_class, $sidebar_header, $sidebar_footer) {
global $lang;
@require('tpl_sidebar.php');
}
/**
* Include action link with font-icon
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $action
* @param string $icon class
* @param boolean $return
* @return string
*/
function bootstrap3_action_item($action, $icon, $return = false) {
global $ACT;
if ($action == 'discussion') {
if (bootstrap3_conf('showDiscussion')) {
$out = _tpl_action('discussion', 1, 'li', 1);
$out = str_replace(array('<bdi>', '</bdi>'), '', $out);
return preg_replace('/(<a (.*?)>)/m', '$1<i class="'.$icon.'"></i> ', $out);
}
return '';
}
if ($link = tpl_action($action, 1, 0, 1, '<i class="'.$icon.'"></i> ')) {
if ($return) {
if ($ACT == $action) {
$link = str_replace('class="action ', 'class="action active ', $link);
}
return $link;
}
return '<li' . (($ACT == $action) ? ' class="active"' : ''). '>' . $link . '</li>';
}
return '';
}
/**
* Calculate automatically the grid size for main container
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return string
*/
function bootstrap3_container_grid() {
global $ACT;
global $ID;
global $conf;
$grids = array();
$result = '';
$showRightSidebar = bootstrap3_conf('showRightSidebar');
$showLeftSidebar = bootstrap3_conf('showSidebar');
$fluidContainer = bootstrap3_conf('fluidContainer');
if(bootstrap3_conf('fluidContainerBtn')) {
$fluidContainer = bootstrap3_fluid_container_button();
}
if ( bootstrap3_conf('showLandingPage')
&& (bool) preg_match_all(bootstrap3_conf('landingPages'), $ID) ) {
$showLeftSidebar = false;
}
if (! $showLeftSidebar) {
return 'container' . (($fluidContainer) ? '-fluid' : '');
}
foreach (explode(' ', bootstrap3_conf('leftSidebarGrid')) as $grid) {
list($col, $media, $size) = explode('-', $grid);
$grids[$media]['left'] = (int) $size;
}
foreach (explode(' ', bootstrap3_conf('rightSidebarGrid')) as $grid) {
list($col, $media, $size) = explode('-', $grid);
$grids[$media]['right'] = (int) $size;
}
foreach ($grids as $media => $item) {
$left = $item['left'];
$right = $item['right'];
$result .= sprintf('col-%s-%s ', $media, (12 - $left - ($showRightSidebar ? $right : 0)));
}
return $result;
}
/**
* Return the user home-page link
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return string
*/
function bootstrap3_user_homepage_link() {
$interwiki = getInterwiki();
$user_url = str_replace('{NAME}', $_SERVER['REMOTE_USER'], $interwiki['user']);
return wl(cleanID($user_url));
}
/**
* Check if the fluid container button is enabled (from the user cookie)
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return boolean
*/
function bootstrap3_fluid_container_button() {
if (! bootstrap3_conf('fluidContainerBtn')) return false;
if ( get_doku_pref('fluidContainer', null) !== null
&& get_doku_pref('fluidContainer', null) !== ''
&& get_doku_pref('fluidContainer', null) !== '0') {
return true;
}
return false;
}
/**
* Manipulate DokuWiki TOC to add Bootstrap3 styling
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $toc from tpl_toc()
* @param boolean $return
* @return string
*/
function bootstrap3_toc($toc, $return = false) {
$out = str_replace('<div id="', '<div class="panel panel-default" id="', $toc);
$out = str_replace('<div>', '<div class="panel-body">', $out);
$out = str_replace('<h3 class="', '<h3 class="panel-heading ', $out);
$out = str_replace('<ul class="toc">', '<ul class="toc nav nav-pills nav-stacked">', $out);
$out = preg_replace('/<div class=\"li\">(.*?)<\/div>/', '$1', $out);
if ($return) return $out;
echo $out;
}
/**
* Manipulate Sidebar page to add Bootstrap3 styling
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $sidebar
* @param boolean $return
* @return string
*/
function bootstrap3_sidebar($sidebar, $return = false) {
$out = str_replace('<ul>', '<ul class="nav nav-pills nav-stacked">', $sidebar);
$out = str_replace('<span class="curid"><a ', '<span class="curid"><a data-curid="true" ', $out);
$out = preg_replace('/<div class="li">(.*?)<\/div>/', '$1', $out);
$out = preg_replace('/<span class="curid">(.*?)<\/span>/', '$1', $out);
$out = preg_replace('/<i (.+?)><\/i> <a (.+?)>(.+?)<\/a>/', '<a $2><i $1></i> $3</a>', $out);
$out = preg_replace('/<li class="level([0-9])"> <a data-curid="true" /', '<li class="level$1 active"> <a ', $out);
$out = preg_replace('/<li class="level([0-9]) node"> <a data-curid="true" /', '<li class="level$1 node active"> <a ', $out);
$out = str_replace(' data-curid="true"', '', $out);
if ($return) return $out;
echo $out;
}
/**
* Normalize DokuWiki list items
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $html
* @return string
*/
function bootstrap3_lists($html) {
$output = preg_replace('/<div class="li">(.*?)<\/div>/', '$1', $html);
return $output;
}
/**
* Make a Bootstrap3 Nav
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $html
* @param boolean $staked
* @param string $type (= pills, tabs)
* @return string
**/
function bootstrap3_nav($html, $stacked = false, $type = '') {
$class = 'nav ';
if ($stacked) $class .= 'nav-stacked ';
if ($type) $class .= "nav-$type ";
$class = trim($class);
$output = str_replace(array('<ul class="', '<ul>'),
array("<ul class=\"$class", "<ul class=\"$class\">"),
$html);
$output = bootstrap3_lists($output);
return $output;
}
/**
* Print the search form in Bootstrap Style
*
* If the first parameter is given a div with the ID 'qsearch_out' will
* be added which instructs the ajax pagequicksearch to kick in and place
* its output into this div. The second parameter controls the propritary
* attribute autocomplete. If set to false this attribute will be set with an
* value of "off" to instruct the browser to disable it's own built in
* autocompletion feature (MSIE and Firefox)
*
* @author Andreas Gohr <[email protected]>
* @author Giuseppe Di Terlizzi <[email protected]>
* @param bool $ajax
* @param bool $autocomplete
* @return bool
*/
function bootstrap3_searchform($ajax = true, $autocomplete = true) {
global $lang;
global $ACT;
global $QUERY;
// don't print the search form if search action has been disabled
if (!actionOK('search')) return false;
print '<form action="'.wl().'" accept-charset="utf-8" class="navbar-form navbar-left search" id="dw__search" method="get" role="search"><div class="no">';
print '<div class="form-group">';
print '<input type="hidden" name="do" value="search" />';
print '<input ';
if ($ACT == 'search') print 'value="'.htmlspecialchars($QUERY).'" ';
if (!$autocomplete) print 'autocomplete="off" ';
print 'id="qsearch__in" type="search" placeholder="'.$lang['btn_search'].'" accesskey="f" name="id" class="edit form-control" title="[F]" />';
print '</div>';
print ' <button type="submit" class="btn btn-default" title="'.$lang['btn_search'].'"><i class="fa fa-fw fa-search"></i><span class="hidden-lg hidden-md hidden-sm"> '.$lang['btn_search'].'</span></button>';
if ($ajax) print '<div id="qsearch__out" class="panel panel-default ajax_qsearch JSpopup"></div>';
print '</div></form>';
return true;
}
/**
* Prints the global message array in Bootstrap style
*
* @author Andreas Gohr <[email protected]>
* @author Giuseppe Di Terlizzi <[email protected]>
*/
function bootstrap3_html_msgarea() {
global $MSG, $MSG_shown;
/** @var array $MSG */
// store if the global $MSG has already been shown and thus HTML output has been started
$MSG_shown = true;
if(!isset($MSG)) return;
$shown = array();
foreach($MSG as $msg){
$hash = md5($msg['msg']);
if(isset($shown[$hash])) continue; // skip double messages
if(info_msg_allowed($msg)){
switch ($msg['lvl']) {
case 'info':
$level = 'info';
$icon = 'fa fa-fw fa-info-circle';
break;
case 'error':
$level = 'danger';
$icon = 'fa fa-fw fa-times-circle';
break;
case 'notify':
$level = 'warning';
$icon = 'fa fa-fw fa-warning';
break;
case 'success':
$level = 'success';
$icon = 'fa fa-fw fa-check-circle';
break;
}
print '<div class="alert alert-'.$level.'">';
print '<i class="'.$icon.'"></i> ';
print $msg['msg'];
print '</div>';
}
$shown[$hash] = 1;
}
unset($GLOBALS['MSG']);
}
/**
* Return all DokuWiki actions for tools menu
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return array
*/
function bootstrap3_tools() {
global $ACT;
$result = array();
$tools = array(
'user' => array(
'icon' => 'fa fa-fw fa-user',
'items' => array(
'admin' => array('icon' => 'fa fa-fw fa-cogs'),
'profile' => array('icon' => 'fa fa-fw fa-refresh'),
#'register' => array('icon' => 'fa fa-fw fa-user-plus'),
#'login' => array('icon' => 'fa fa-fw fa-sign-'.(!empty($_SERVER['REMOTE_USER']) ? 'out' : 'in')),
)
),
'site' => array(
'icon' => 'fa fa-fw fa-wrench',
'items' => array(
'recent' => array('icon' => 'fa fa-fw fa-list-alt'),
'media' => array('icon' => 'fa fa-fw fa-picture-o'),
'index' => array('icon' => 'fa fa-fw fa-sitemap'),
)
),
'page' => array(
'icon' => 'fa fa-fw fa-file',
'items' => array(
'edit' => array('icon' => 'fa fa-fw fa-' . (($ACT == 'edit') ? 'file-text-o' : 'pencil-square-o')),
'discussion' => array('icon' => 'fa fa-fw fa-comments'),
'revert' => array('icon' => 'fa fa-fw fa-repeat'),
'revisions' => array('icon' => 'fa fa-fw fa-clock-o'),
'backlink' => array('icon' => 'fa fa-fw fa-link'),
'subscribe' => array('icon' => 'fa fa-fw fa-envelope-o'),
'top' => array('icon' => 'fa fa-fw fa-chevron-up'),
)
),
);
return $tools;
}
/**
* Return an array for a tools menu
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return array of tools
*/
function bootstrap3_tools_menu() {
$tools = bootstrap3_tools();
foreach ($tools as $id => $menu) {
foreach ($menu['items'] as $action => $item) {
$tools[$id]['menu'][$action] = bootstrap3_action_item($action, $item['icon']);
}
}
return $tools;
}
/**
* Return an array for a toolbar
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return array of tools
*/
function bootstrap3_toolbar() {
$tools = _tpl_tools();
foreach ($tools as $id => $menu) {
foreach ($menu['items'] as $action => $item) {
$tools[$id]['menu'][$action] = str_replace('class="action ', 'class="action btn btn-default ', bootstrap3_action_item($action, $item['icon'], 1));
}
}
return $tools;
}
/**
* Get either a Gravatar URL or complete image tag for a specified email address.
*
* @param string $email The email address
* @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ]
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ]
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ]
* @param boolean $img True to return a complete IMG tag False for just the URL
* @param array $atts Optional, additional key/value attributes to include in the IMG tag
* @return String containing either just a URL or a complete image tag
* @source http://gravatar.com/site/implement/images/php/
*/
function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
$url = 'https://www.gravatar.com/avatar/';
$url .= md5( strtolower( trim( $email ) ) );
$url .= "?s=$s&d=$d&r=$r";
if ( $img ) {
$url = '<img src="' . $url . '"';
foreach ( $atts as $key => $val )
$url .= ' ' . $key . '="' . $val . '"';
$url .= ' />';
}
return $url;
}
/**
* Get the template metadata
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $key
* @return array
*/
function bootstrap3_metadata($key = null) {
$meta = array();
$file = tpl_incdir() . 'conf/metadata.php';
include $file;
if ($key) return $meta[$key];
return $meta;
}
/**
* A simple wrapper for tpl_getConf
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @param string $key
* @param mixed $default value
* @return mixed
*/
function bootstrap3_conf($key, $default = false) {
global $ACT, $INFO, $ID, $conf;
$value = tpl_getConf($key, $default);
switch ($key) {
case 'showTools':
case 'showSearchForm':
case 'showPageTools':
return $value !== 'never' && ( $value == 'always' || ! empty($_SERVER['REMOTE_USER']) );
case 'showIndividualTool':
case 'hideInThemeSwitcher':
case 'tableStyle':
return explode(',', $value);
case 'showAdminMenu':
return $value && $INFO['isadmin'];
case 'hideLoginLink':
return ! $value || ! empty($_SERVER['REMOTE_USER']);
case 'browserTitle':
return str_replace(array('@WIKI@', '@TITLE@'),
array(strip_tags($conf['title']), tpl_pagetitle(null, true)),
$value);
case 'showSidebar':
return page_findnearest($conf['sidebar']) && ($ACT=='show');
case 'showRightSidebar':
return page_findnearest(tpl_getConf('rightSidebar')) && ($ACT=='show');
case 'landingPages':
return sprintf('/%s/', $value);
}
//$type = bootstrap3_metadata($key);
//if ($type[0] == 'regex') {
// return sprintf('/%s/', $value);
//}
return $value;
}
/**
* Return the Bootswatch.com theme lists defined in metadata.php
*
* @author Giuseppe Di Terlizzi <[email protected]>
*
* @return array
*/
function bootstrap3_bootswatch_theme_list() {
$bootswatch_themes = bootstrap3_metadata('bootswatchTheme');
return $bootswatch_themes['_choices'];
}
function bootstrap3_icon($pack, $name, $classes = '', $size = -1) {
if ($size > 0 && ! preg_match('/(em|px)$/', "$size")) {
$size = $size.'px';
}
$style = ($size !== -1) ? sprintf(' style="font-size:%s"', $size) : '';
$class[] = $pack;
$class[] = "$pack-$name";
$class[] = $classes;
$output = sprintf('<i class="%s"%s></i>', trim(implode(' ', $class)), $style);
return $output;
}
function bootstrap3_fa($name, $options = '', $classes = '', $size = -1) {
if (! is_array($options)) {
$options = explode(' ', $options);
}
foreach ($options as $option) {
$classes .= " fa-$option ";
}
return bootstrap3_icon('fa', $name, trim($classes), $size);
}
function bootstrap3_fa_stack($icon1, $icon2, $switch = false) {
$icon2 = str_replace('class="', 'class="fa-stack-1x ', $icon2);
$icon1 = str_replace('class="', 'class="fa-stack-2x ', $icon1);
if ($switch) {
$tmp1 = $icon1;
$tmp2 = $icon2;
$icon1 = $tmp2;
$icon2 = $tmp1;
}
return sprintf('<span class="fa-stack fa-lg">%s %s</span>', $icon1, $icon2);
}
function bootstrap_glyphicon($name, $classes = '', $size = -1) {
return bootstrap3_icon('glyphicon', $name, $classes, $size);
}