Ignore:
Timestamp:
Dec 16, 2012, 8:19:28 PM (11 years ago)
Author:
Klarsfeld
Message:

Upgrade for Piwigo 2.4.5
Only languages en-UK and fr-FR upgraded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Panoramas/AS_Panorama.php

    r6533 r19460  
    1212                  global $conf, $template, $page;
    1313                  $asp = & $conf['AS_panorama'];
    14                   if ( !stristr($image['name'], $asp['in_mode_360'])
    15                    and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
    16                   if (!isset($image['image_url'])) return $content;
    17                   if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
    18                   if (isset($image['width']) and $image['width'] < $asp['min_viewport_width']) return $content;
    19                   $asp['image_name'] = $image['name'];
    20                   $asp['width'] = $image['width'];
    21                   $asp['height'] = $image['height'];
    22                   if (stristr($image['name'], $asp['in_mode_180'])) {
    23                         $asp['mode_360'] = 'false';
    24                         $asp['name'] = str_replace($asp['in_mode_180'],'', $image['name']);
    25                   }
    26                   else  {
    27                         $asp['name'] = str_replace($asp['in_mode_360'],'', $image['name']);
    28                   }
    29                   $template->set_filenames(
    30                         array('AS_panorama_content' => dirname(__FILE__) . '/template/AS_panorama_content.tpl') );
    31                   $asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
    32                   $asp['content'] = $content;
    33                   $template->assign( array( 'ASP' => $asp, ) );
    34                   return $template->parse('AS_panorama_content', true);
    35                 }
    36   }
     14        //echo "<pre>"; print_r($template); echo "</pre>"; exit;
     15       
     16        if (isset($template->files['slideshow'])) return $content;
     17        if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
     18        if (!isset($image['path'])) return $content;
     19        if ( isset($page['slideshow']) and $page['slideshow'] ) return $content;
     20        if (isset($image['width']) and $image['width'] < $asp['min_viewport_width']) return $content;
     21
     22        $divtag = "<img src=\"";
     23        $divtag.= str_replace( "./", "", $image['path'])."\" width=\"".$image['width']."\" ";
     24        $divtag.= "height=\"".$image['height']."\" ";
     25        $divtag.= "alt=\"".$image['file']."\" id=\"theMainImage\" ";
     26       
     27        if ($image['height'] > $asp['viewport_height']) {
     28                $ratio = $image['width'] / $image['height'];
     29                $image['height'] = $asp['viewport_height'];
     30                $image['width'] = $asp['viewport_height'] * $ratio;
     31        }
     32
     33        $asp['image_name'] = $image['name'];
     34        $asp['width'] = $image['width'];
     35        $asp['height'] = $image['height'];
     36        if (stristr($image['name'], $asp['in_mode_180'])) {
     37                $asp['mode_360'] = 'false';
     38                $asp['name'] = str_replace($asp['in_mode_180'],'', $image['name']);
     39        }
     40        else  {
     41                $asp['name'] = str_replace($asp['in_mode_360'],'', $image['name']);
     42        }
     43       
     44        $template->set_filenames(
     45        array('AS_panorama_content' => dirname(__FILE__) . '/template/AS_panorama_content.tpl') );
     46        $asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
     47        $asp['content'] = $divtag;
     48        $template->assign( array( 'ASP' => $asp, ) );
     49        return $template->parse('AS_panorama_content', true);
     50}
     51}
    3752}
    3853
    3954if ( !function_exists( 'AS_panorama_title' ) ) {
    40   if ( $conf['AS_panorama']['In_name_display_removal'] ) {
    41     add_event_handler('loc_end_picture', 'AS_panorama_title');
    42     function AS_panorama_title()
    43     {
    44       global $conf, $template;
    45       $asp = & $conf['AS_panorama'];
    46       $picture = $template->get_template_vars('current');
    47           if ( isset($asp['name']) ) {
    48                   $picture['TITLE'] = $asp['name'];
    49                   $template->assign('current', $picture);
    50                   $template->assign( array( 'ASP' => $asp, ) );
    51           }
    52     }
    53   }
     55        if ( $conf['AS_panorama']['In_name_display_removal'] ) {
     56                add_event_handler('loc_end_picture', 'AS_panorama_title');
     57                function AS_panorama_title()
     58                {
     59                        global $conf, $template;
     60                        $asp = & $conf['AS_panorama'];
     61                        $picture = $template->get_template_vars('current');
     62                        if ( isset($asp['name']) ) {
     63                        $picture['TITLE'] = $asp['name'];
     64                        $template->assign('current', $picture);
     65                        $template->assign( array( 'ASP' => $asp, ) );
     66                        }
     67                }
     68        }
    5469}
    5570
     
    5772        if ( defined('IN_ADMIN') and IN_ADMIN ) {
    5873                add_event_handler('get_admin_plugin_menu_links', 'AS_panorama_menu');
    59     function AS_panorama_menu($menu)
    60     {
    61         array_push($menu,
    62             array(
    63                 'NAME' => 'Panoramas',
    64                 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php')
    65             )
    66         );
    67         return $menu;
    68     }
    69   }
     74                function AS_panorama_menu($menu)
     75                {
     76                        array_push($menu,
     77                                array(
     78                                        'NAME' => 'Panoramas',
     79                                        'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php')
     80                                        )
     81                        );
     82                return $menu;
     83                }
     84        }
    7085}
    7186?>
Note: See TracChangeset for help on using the changeset viewer.