Ignore:
Timestamp:
Jul 16, 2014, 9:28:35 PM (10 years ago)
Author:
gbo
Message:

[llgbo2-27A] compatible with modus and more theme

Location:
extensions/LLGBO2/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/LLGBO2/include/manage_header.php

    r29005 r29049  
    33/*      LLGBO Manage header                                        */
    44//----------------------------------------------------
     5global $template,$conf;
     6$page_name = script_basename();
    57if (!isset($page_name)) {$page_name ='index';}
    68if ($conf['LLGBO2']['manageheader'])
    79        {$no_header = false;
    8         $input= $_SERVER['PHP_SELF'];
    9         if ($conf['question_mark_in_urls'] == true)
    10                 {       foreach($_GET as $cle  =>$valeur)
    11                         {$input= $input.$cle ;}
    12         }
    13          
    14         if  ( strpos( $input,'index') == true )
    15         {       foreach($conf['LLGBO2']['HD-dispheader'] as $cle  => $valeur)
    16                         { if ($valeur  == false) {
    17                                         if($cle == 'home' ) {$cle = 'index.php';}
    18                                         if (strpos( $input, $cle) == true )
    19                                                 {$no_header = true;}
    20                                         }
    21                         }
    22         }
    23          else
    24         {       
    25                  if (isset($conf['LLGBO2']['HD-dispheader'][$page_name]) and ($conf['LLGBO2']['HD-dispheader'][$page_name] == false) ) {$no_header = true;}
    26         } 
    27          if ($no_header == true)
    28         {$template->append('head_elements','<!-- llgbo -->'."\n".'<STYLE type="text/css">'."\n".'#theHeader{display: none}'."\n".'header_msgs {position:static}'."\n".'</STYLE>');}
     10                $input= $_SERVER['PHP_SELF'];
     11                if ($conf['question_mark_in_urls'] == true)
     12                        {       foreach($_GET as $cle  =>$valeur)
     13                                {$input= $input.$cle ;}
     14                }
     15                 
     16                if  ( strpos( $input,'index') == true )
     17                {       foreach($conf['LLGBO2']['HD-dispheader'] as $cle  => $valeur)
     18                                { if ($valeur  == false) {
     19                                                if($cle == 'home' ) {$cle = 'index.php';}
     20                                                if (strpos( $input, $cle) == true )
     21                                                        {$no_header = true;}
     22                                                }
     23                                }
     24                }
     25                 else
     26                {       if (isset($conf['LLGBO2']['HD-dispheader'][$page_name]) and ($conf['LLGBO2']['HD-dispheader'][$page_name] == false) ) {$no_header = true;}
     27                } 
     28        if ($no_header == true)
     29                {$template->append('head_elements','<!-- llgbo no header-->'."\n".'<STYLE type="text/css">'."\n".'#theHeader{display: none}'."\n".'header_msgs {position:static}'."\n".'</STYLE>');}
    2930}       
    3031?>
  • extensions/LLGBO2/include/manage_picture_content.php

    r29019 r29049  
    22function llgbo_RenderContent($content,$element_info)
    33/******************************************************************/
    4 {
    5 //----------------------------------------------------   
    6 /*      LLGBO Manage Picture_content                       */
    7 //----------------------------------------------------
     4{       //----------------------------------------------------   
     5        /*      LLGBO Manage Picture_content                       */
     6        //----------------------------------------------------
    87        global $template,$conf;
    9          
    108        $template->assign('LLGBO_PATH',LLGBO_PATH);
    119        include_once(LLGBO_PATH.'/css/sweettitles.css.php');   
    12 
    1310        //-----------------------------------------------------------------
    1411        // -----------  add CSS tooltip in footer --------------------
    1512        //-----------------------------------------------------------------
    16          If (($conf['LLGBO2']['tooltipdisp']  )  or  ($conf['LLGBO2']['exifunderbt']))   
     13         if (($conf['LLGBO2']['tooltipdisp']  )  or  ($conf['LLGBO2']['exifunderbt']))   
    1714                {       $template->append('footer_elements',$sweetcss);
    1815                        $template->append('llgbo', array( 'TOOLTIP' => 'ok' ), true);}
     
    2017        // Frame is only available on picture extension
    2118        //-----------------------------------------------------------------
    22         unset ($conf['LLGBO2']['rendercontent']);
     19        unset ($conf['LLGBO2']['is-picture']);
    2320         $ext = get_extension($element_info['path']);
    2421         if (!in_array($ext, $conf['picture_ext']))
    2522                                {return $content;}
    26                 $conf['LLGBO2']['rendercontent'] = true;        // $content ok for update
    27                
     23                               
     24        $conf['LLGBO2']['is-picture'] = true;   // $content ok for update
     25        $update_tpl = false ;
    2826        //-----------------------------------------------------------------
    2927        // AN OTHER PLUGIN IS WORKING -> GO BACK
    3028        //-----------------------------------------------------------------
    3129        if ( !empty($content) )
    32                 {        // 2.6 paticular case automatic size management
    33                  $autosize_on = $template->get_template_vars('is_automatic_size');
    34                  if (empty($autosize_on) )
    35                                         {return $content;}
    36                                        
     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               
    3741                $autosize_type = $template->get_template_vars('automatic_size');
    38                  unset ($conf['LLGBO2']['PictSizeWH'] );
    39                 if (isset($autosize_type))
    40                                 {$conf['LLGBO2']['PictSizeWH'] =  $element_info['derivatives'][$autosize_type]->get_size();
    41                                          }
    42                 }
    43 
     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       
     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'].'">'.$element_info['name'].'</span>';   
     75                                }
     76                       
     77                        $template->append('llgbo', array(   
     78                                                        'FRAME_TITLE' => $frame_title,
     79                                                        'FRAME_SIZE' => $frame_size ,
     80                                                        'FRAME_BEGIN' => $frame_begin,
     81                                                        'FRAME_END' => $frame_end,
     82                                                         'GBOCSS' => LLGBO_PATH."css/llgbo_content_".$themestyle.".css" ), true);
     83                                                         
     84                        $template->set_prefilter('default_content', 'LLGBO_prefilter_Content_Frame');                                                           
     85        } // end frame                                 
    4486//----------------------------------------------------   
    4587//-------      Tooltip                   -------------   
    4688//----------------------------------------------------
    47          
    48         If ($conf['LLGBO2']['tooltipdisp'] )//   tooltip 
     89        if ($conf['LLGBO2']['tooltipdisp'] )//   tooltip 
    4990        {       $prev = $template->get_template_vars('previous');
    5091                $next  = $template->get_template_vars('next');
     
    5394                if (isset($next)){$template->append('next',  array('TITLE_ESC' =>  $next['TITLE_ESC'].$swtimg.$next['THUMB_SRC'].'>'),TRUE);}
    5495                $template->append('llgbo', array('tooltipCSS'  => $sweetcss), true);
    55         }       
    56        
    57         If (($conf['LLGBO2']['frame'])   ) //Frame
    58         {       $template->set_prefilter('default_content', 'LLGBO_prefilter_Content_Frame');
    59         //----------------------------------------------------   
    60         /*       HTML End  frame   on Picture_content       */
    61         //----------------------------------------------------         
    62                 $csstheme = 'default';
    63                 $themeconf = $template->get_template_vars('themeconf');
    64                 //  dedicated Css by parent theme       
    65                         if (isset ($themeconf['parent']))
    66                         { $themestyle = $themeconf['parent'];}
    67                         If (file_exists(LLGBO_PATH."css/llgbo_content_".$themeconf['id'].".css")) // no css file dedicated for this theme
    68                            { $themestyle = $themeconf['id'];}
    69                            else
    70                            {$themestyle = 'default';}
    71                            $frame_end = '';
    72                            
    73                          foreach ($conf['LLGBO2']['FR-sizes'] as  $value)
    74                                 {if ( $value > 0)       // boder value > 0     
    75                                         {       $frame_end = $frame_end.'</div>';}
    76                                  }
    77                          
    78                          $template->append('llgbo', array(
    79                                 'FRAME_END' => $frame_end,
    80                                 'GBOCSS' => LLGBO_PATH."css/llgbo_content_".$themestyle.".css" ), true);
    81 
    82         } // end frame
    83          // 2.6 paticular case automatic size management
    84         if ((isset($autosize_on))  and  (isset ($autosize_type)) )
    85                                                 { return $template->parse( 'default_content', true);}
     96        }               
     97         // 2.6 paticular case automatic size and modus management
     98        if ($update_tpl)
     99                {return $template->parse( 'default_content', true);} 
    86100                                               
    87101} //end --> llgbo_RenderContent
    88102
     103/******************************************************************/
     104function LLGBO_prefilter_Content_Frame($content, $smarty)
     105/******************************************************************/
     106{        // add  frame on picture_content TPL
     107        // --------------------------------------   
     108                $patern = '/'.'<img(.*)id="theMainImage"(.*)>'.'/';     
     109        $replacement =  $replacement.'{$llgbo.FRAME_TITLE}'.'{$llgbo.FRAME_SIZE}'.'{$llgbo.FRAME_BEGIN}'."\n".'<img $1 id="theMainImage" $2> '.'{$llgbo.FRAME_END}';
     110                $content = preg_replace($patern, $replacement, $content); 
     111        return $content;
     112}
    89113?>
Note: See TracChangeset for help on using the changeset viewer.