source: extensions/Panoramas/AS_Panorama.php @ 12153

Last change on this file since 12153 was 6533, checked in by vdigital, 14 years ago

Fix: Notice: Undefined index: name in .../plugins/Panoramas/AS_Panorama.php on line 47
Fix: Panorama / Panoramas
Fix: Panoramas are disconnected when picture widths are lower than the viewport width

File size: 2.5 KB
Line 
1<?php
2/* A simple panorama */
3if (!defined('PHPWG_ROOT_PATH') or !defined('ASP_DIR')) die('Hacking attempt!');
4global $conf;
5include_once( ASP_PATH . 'AS_Panorama_default.php');
6
7if ( !function_exists( 'AS_panorama_content' ) ) {
8        if ( !defined('IN_ADMIN') or !IN_ADMIN ) {
9    add_event_handler('render_element_content', 'AS_panorama_content', 99, 2 );
10    function AS_panorama_content($content, $image)
11                {
12                  global $conf, $template, $page;
13                  $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  }
37}
38
39if ( !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  }
54}
55
56if ( !function_exists( 'AS_panorama_menu' ) ) {
57        if ( defined('IN_ADMIN') and IN_ADMIN ) {
58                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  }
70}
71?>
Note: See TracBrowser for help on using the repository browser.