[14421] | 1 | <?php |
---|
[28990] | 2 | function llgbo_RenderContent($content,$element_info) |
---|
| 3 | /******************************************************************/ |
---|
[29049] | 4 | { //---------------------------------------------------- |
---|
| 5 | /* LLGBO Manage Picture_content */ |
---|
| 6 | //---------------------------------------------------- |
---|
[29005] | 7 | global $template,$conf; |
---|
[28990] | 8 | $template->assign('LLGBO_PATH',LLGBO_PATH); |
---|
| 9 | include_once(LLGBO_PATH.'/css/sweettitles.css.php'); |
---|
| 10 | //----------------------------------------------------------------- |
---|
| 11 | // ----------- add CSS tooltip in footer -------------------- |
---|
| 12 | //----------------------------------------------------------------- |
---|
[29049] | 13 | if (($conf['LLGBO2']['tooltipdisp'] ) or ($conf['LLGBO2']['exifunderbt'])) |
---|
[28990] | 14 | { $template->append('footer_elements',$sweetcss); |
---|
| 15 | $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);} |
---|
| 16 | //----------------------------------------------------------------- |
---|
| 17 | // Frame is only available on picture extension |
---|
| 18 | //----------------------------------------------------------------- |
---|
[29049] | 19 | unset ($conf['LLGBO2']['is-picture']); |
---|
[28990] | 20 | $ext = get_extension($element_info['path']); |
---|
| 21 | if (!in_array($ext, $conf['picture_ext'])) |
---|
| 22 | {return $content;} |
---|
[29049] | 23 | |
---|
| 24 | $conf['LLGBO2']['is-picture'] = true; // $content ok for update |
---|
| 25 | $update_tpl = false ; |
---|
[28990] | 26 | //----------------------------------------------------------------- |
---|
| 27 | // AN OTHER PLUGIN IS WORKING -> GO BACK |
---|
| 28 | //----------------------------------------------------------------- |
---|
| 29 | if ( !empty($content) ) |
---|
[29049] | 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 | |
---|
[29019] | 41 | $autosize_type = $template->get_template_vars('automatic_size'); |
---|
[29049] | 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;">'; |
---|
[29808] | 72 | $frame_title = ""; |
---|
[29049] | 73 | if ($conf['LLGBO2']['titleframe']) { |
---|
[29808] | 74 | $frame_title = "\n".'<!-- Begin LLGBO -->'."\n".'<span id="llgboh2" style ="background:transparent;z-index:3;color:'.$conf['LLGBO2']['FR-titlecolor'].'">'; |
---|
[29049] | 75 | } |
---|
| 76 | |
---|
| 77 | $template->append('llgbo', array( |
---|
[29808] | 78 | 'FRAME_TITLE1' => $frame_title, |
---|
| 79 | 'FRAME_TITLE3' => '</span>', |
---|
[29049] | 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 |
---|
[14421] | 87 | //---------------------------------------------------- |
---|
| 88 | //------- Tooltip ------------- |
---|
[28990] | 89 | //---------------------------------------------------- |
---|
[29049] | 90 | if ($conf['LLGBO2']['tooltipdisp'] )// tooltip |
---|
[28990] | 91 | { $prev = $template->get_template_vars('previous'); |
---|
[29484] | 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 | } |
---|
[28990] | 102 | $template->append('llgbo', array('tooltipCSS' => $sweetcss), true); |
---|
[29484] | 103 | } |
---|
| 104 | // ----------------------------------------------------------- |
---|
| 105 | // 2.6 paticular case automatic size and modus management |
---|
| 106 | // ----------------------------------------------------------- |
---|
[29049] | 107 | if ($update_tpl) |
---|
| 108 | {return $template->parse( 'default_content', true);} |
---|
[28990] | 109 | |
---|
| 110 | } //end --> llgbo_RenderContent |
---|
[14421] | 111 | |
---|
[29049] | 112 | /******************************************************************/ |
---|
| 113 | function LLGBO_prefilter_Content_Frame($content, $smarty) |
---|
| 114 | /******************************************************************/ |
---|
| 115 | { // add frame on picture_content TPL |
---|
| 116 | // -------------------------------------- |
---|
| 117 | $patern = '/'.'<img(.*)id="theMainImage"(.*)>'.'/'; |
---|
[29841] | 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}'; |
---|
[29049] | 119 | $content = preg_replace($patern, $replacement, $content); |
---|
[29841] | 120 | return $content; |
---|
[29049] | 121 | } |
---|
[14421] | 122 | ?> |
---|