1 | <?php |
---|
2 | function llgbo_RenderContent($content,$element_info) |
---|
3 | /******************************************************************/ |
---|
4 | { //---------------------------------------------------- |
---|
5 | /* LLGBO Manage Picture_content */ |
---|
6 | //---------------------------------------------------- |
---|
7 | global $template,$conf; |
---|
8 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
9 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
10 | //----------------------------------------------------------------- |
---|
11 | // ----------- add CSS tooltip in footer -------------------- |
---|
12 | //----------------------------------------------------------------- |
---|
13 | if (($conf['LLGBO2']['tooltipdisp'] ) or ($conf['LLGBO2']['exifunderbt'])) |
---|
14 | { $template->append('footer_elements',$sweetcss); |
---|
15 | $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);} |
---|
16 | //----------------------------------------------------------------- |
---|
17 | // Frame is only available on picture extension |
---|
18 | //----------------------------------------------------------------- |
---|
19 | unset ($conf['LLGBO2']['is-picture']); |
---|
20 | $ext = get_extension($element_info['path']); |
---|
21 | if (!in_array($ext, $conf['picture_ext'])) |
---|
22 | {return $content;} |
---|
23 | |
---|
24 | $conf['LLGBO2']['is-picture'] = true; // $content ok for update |
---|
25 | $update_tpl = false ; |
---|
26 | //----------------------------------------------------------------- |
---|
27 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
28 | //----------------------------------------------------------------- |
---|
29 | if ( !empty($content) ) |
---|
30 | { // 2.6 paticular case automatic size management and Modus |
---|
31 | $autosize_on = $template->get_template_vars('is_automatic_size'); |
---|
32 | $current = $template->get_template_vars('current'); // modus |
---|
33 | if ((empty ($current['selected_derivative'])) and (empty($autosize_on) )) |
---|
34 | {return $content;} |
---|
35 | } |
---|
36 | //----------------------------------------------------------------- |
---|
37 | if (($conf['LLGBO2']['frame']) ) //Frame |
---|
38 | { $deriv_type = pwg_get_session_var('picture_deriv', $conf['derivative_default_size']); |
---|
39 | $PictSizeWH = $element_info['derivatives'][$deriv_type]->get_size(); // default conf |
---|
40 | |
---|
41 | $autosize_type = $template->get_template_vars('automatic_size'); |
---|
42 | |
---|
43 | if (isset($autosize_type)) // auto size |
---|
44 | { $PictSizeWH = $element_info['derivatives'][$autosize_type]->get_size(); |
---|
45 | $update_tpl = true ;} |
---|
46 | |
---|
47 | if (isset($current['selected_derivative'])) // modus |
---|
48 | { $PictSizeWH = $current['selected_derivative']->get_size(); |
---|
49 | $update_tpl = true ;} |
---|
50 | |
---|
51 | // -- Css Theme adaptation |
---|
52 | $themeconf = $template->get_template_vars('themeconf'); |
---|
53 | if (file_exists(LLGBO_PATH."css/llgbo_content_".$themeconf['id'].".css")) // no css file dedicated for this theme |
---|
54 | { $themestyle = $themeconf['id'];} |
---|
55 | else |
---|
56 | {$themestyle = 'default';} |
---|
57 | // -- Frame build |
---|
58 | $frame_begin = ''; |
---|
59 | $frame_border =0; |
---|
60 | $frame_end = '</div>'."\n".' <!-- end LLGBO frame -->'."\n"; |
---|
61 | foreach ($conf['LLGBO2']['FR-sizes'] as $cle => $value) |
---|
62 | { if ( $value > 0) // boder value > 0 |
---|
63 | { $frame_border = $frame_border + ( 2 * $value); |
---|
64 | $frame_begin = '<div class="llgboFR" style="border:'.$value.'px solid '.$conf['LLGBO2']['FR-colors'][$cle].'">'."\n".$frame_begin; |
---|
65 | $frame_end = '</div>'.$frame_end; |
---|
66 | } |
---|
67 | } |
---|
68 | $frame_begin ="\n".'<!-- Begin LLGBO frame -->'."\n".$frame_begin; |
---|
69 | $PictSizeWH[0] = $PictSizeWH[0] + $frame_border; |
---|
70 | $PictSizeWH[1] = $PictSizeWH[1] + $frame_border; |
---|
71 | $frame_size = "\n".'<div id="llgbo0" class="llgbo" style="border:0 ;width:'.$PictSizeWH[0].'px; height:'.$PictSizeWH[1].'px;">'; |
---|
72 | $frame_title = ""; |
---|
73 | if ($conf['LLGBO2']['titleframe']) { |
---|
74 | $frame_title = "\n".'<!-- Begin LLGBO -->'."\n".'<span id="llgboh2" style ="background:transparent;z-index:3;color:'.$conf['LLGBO2']['FR-titlecolor'].'">'; |
---|
75 | } |
---|
76 | |
---|
77 | $template->append('llgbo', array( |
---|
78 | 'FRAME_TITLE1' => $frame_title, |
---|
79 | 'FRAME_TITLE3' => '</span>', |
---|
80 | 'FRAME_SIZE' => $frame_size , |
---|
81 | 'FRAME_BEGIN' => $frame_begin, |
---|
82 | 'FRAME_END' => $frame_end, |
---|
83 | 'GBOCSS' => LLGBO_PATH."css/llgbo_content_".$themestyle.".css" ), true); |
---|
84 | |
---|
85 | $template->set_prefilter('default_content', 'LLGBO_prefilter_Content_Frame'); |
---|
86 | } // end frame |
---|
87 | //---------------------------------------------------- |
---|
88 | //------- Tooltip ------------- |
---|
89 | //---------------------------------------------------- |
---|
90 | if ($conf['LLGBO2']['tooltipdisp'] )// tooltip |
---|
91 | { $prev = $template->get_template_vars('previous'); |
---|
92 | $next = $template->get_template_vars('next'); |
---|
93 | |
---|
94 | if (isset($prev)){ |
---|
95 | $prev_thumbimg = '||<img src='.$prev['derivatives']['thumb']->get_url(); |
---|
96 | $template->append('previous', array('TITLE_ESC' => $prev['TITLE_ESC'].$prev_thumbimg.'>'),TRUE); |
---|
97 | } |
---|
98 | if (isset($next)){ |
---|
99 | $next_thumbimg = '||<img src='.$next['derivatives']['thumb']->get_url(); |
---|
100 | $template->append('next', array('TITLE_ESC' => $next['TITLE_ESC'].$next_thumbimg.'>'),TRUE); |
---|
101 | } |
---|
102 | $template->append('llgbo', array('tooltipCSS' => $sweetcss), true); |
---|
103 | } |
---|
104 | // ----------------------------------------------------------- |
---|
105 | // 2.6 paticular case automatic size and modus management |
---|
106 | // ----------------------------------------------------------- |
---|
107 | if ($update_tpl) |
---|
108 | {return $template->parse( 'default_content', true);} |
---|
109 | |
---|
110 | } //end --> llgbo_RenderContent |
---|
111 | |
---|
112 | /******************************************************************/ |
---|
113 | function LLGBO_prefilter_Content_Frame($content, $smarty) |
---|
114 | /******************************************************************/ |
---|
115 | { // add frame on picture_content TPL |
---|
116 | // -------------------------------------- |
---|
117 | $patern = '/'.'<img(.*)id="theMainImage"(.*)>'.'/'; |
---|
118 | $replacement = '{if !empty($llgbo.FRAME_TITLE1)}{$llgbo.FRAME_TITLE1}{$current.TITLE} {$llgbo.FRAME_TITLE3}{/if}{$llgbo.FRAME_SIZE}{$llgbo.FRAME_BEGIN}'."\n".'<img $1 id="theMainImage" $2>'.'{$llgbo.FRAME_END}'; |
---|
119 | $content = preg_replace($patern, $replacement, $content); |
---|
120 | return $content; |
---|
121 | } |
---|
122 | ?> |
---|