source: extensions/Panoramas/AS_Panorama.php @ 6530

Last change on this file since 6530 was 6527, checked in by vdigital, 14 years ago

jQuery Panoramas

Licence : GPL
http://www.openstudio.fr/Un-viewer-de-panoramas-simple-en.html

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      $picture['TITLE'] = $asp['name'];
48      $template->assign('current', $picture);
49      $template->assign( array( 'ASP' => $asp, ) );
50    }
51  }
52}
53
54if ( !function_exists( 'AS_panorama_menu' ) ) {
55        if ( defined('IN_ADMIN') and IN_ADMIN ) {
56                add_event_handler('get_admin_plugin_menu_links', 'AS_panorama_menu');
57    function AS_panorama_menu($menu)
58    {
59        array_push($menu,
60            array(
61                'NAME' => 'Simple Panorama',
62                'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php')
63            )
64        );
65        return $menu;
66    }
67  }
68}
69?>
Note: See TracBrowser for help on using the repository browser.