[6527] | 1 | <?php |
---|
| 2 | /* A simple panorama */ |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH') or !defined('ASP_DIR')) die('Hacking attempt!'); |
---|
| 4 | global $conf; |
---|
| 5 | include_once( ASP_PATH . 'AS_Panorama_default.php'); |
---|
| 6 | |
---|
| 7 | if ( !function_exists( 'AS_panorama_content' ) ) { |
---|
| 8 | if ( !defined('IN_ADMIN') or !IN_ADMIN ) { |
---|
[19535] | 9 | add_event_handler('render_element_content', 'AS_panorama_content', 41, 2 ); |
---|
[6527] | 10 | function AS_panorama_content($content, $image) |
---|
| 11 | { |
---|
| 12 | global $conf, $template, $page; |
---|
| 13 | $asp = & $conf['AS_panorama']; |
---|
[19460] | 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 | if ($image['height'] > $asp['viewport_height']) { |
---|
| 23 | $ratio = $image['width'] / $image['height']; |
---|
| 24 | $image['height'] = $asp['viewport_height']; |
---|
| 25 | $image['width'] = $asp['viewport_height'] * $ratio; |
---|
| 26 | } |
---|
| 27 | |
---|
[19535] | 28 | $content = "<img src=\"".str_replace( "./", "", $image['path'])."\" width=\"".$image['width']."\" height=\"".$image['height']."\" alt=\"".$image['file']."\" id=\"theMainImage\"></img>"; |
---|
| 29 | |
---|
| 30 | |
---|
[19460] | 31 | $asp['image_name'] = $image['name']; |
---|
| 32 | $asp['width'] = $image['width']; |
---|
| 33 | $asp['height'] = $image['height']; |
---|
| 34 | if (stristr($image['name'], $asp['in_mode_180'])) { |
---|
| 35 | $asp['mode_360'] = 'false'; |
---|
| 36 | $asp['name'] = str_replace($asp['in_mode_180'],'', $image['name']); |
---|
| 37 | } |
---|
| 38 | else { |
---|
| 39 | $asp['name'] = str_replace($asp['in_mode_360'],'', $image['name']); |
---|
| 40 | } |
---|
[19535] | 41 | $asp['footer_view'] = 'false'; |
---|
[19460] | 42 | |
---|
| 43 | $template->set_filenames( |
---|
| 44 | array('AS_panorama_content' => dirname(__FILE__) . '/template/AS_panorama_content.tpl') ); |
---|
| 45 | $asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH); |
---|
[19535] | 46 | $asp['content'] = $content; |
---|
[19460] | 47 | $template->assign( array( 'ASP' => $asp, ) ); |
---|
| 48 | return $template->parse('AS_panorama_content', true); |
---|
[6527] | 49 | } |
---|
[19460] | 50 | } |
---|
| 51 | } |
---|
[6527] | 52 | |
---|
| 53 | if ( !function_exists( 'AS_panorama_title' ) ) { |
---|
[19460] | 54 | if ( $conf['AS_panorama']['In_name_display_removal'] ) { |
---|
| 55 | add_event_handler('loc_end_picture', 'AS_panorama_title'); |
---|
| 56 | function AS_panorama_title() |
---|
| 57 | { |
---|
| 58 | global $conf, $template; |
---|
| 59 | $asp = & $conf['AS_panorama']; |
---|
| 60 | $picture = $template->get_template_vars('current'); |
---|
| 61 | if ( isset($asp['name']) ) { |
---|
| 62 | $picture['TITLE'] = $asp['name']; |
---|
| 63 | $template->assign('current', $picture); |
---|
| 64 | $template->assign( array( 'ASP' => $asp, ) ); |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | } |
---|
[6527] | 68 | } |
---|
| 69 | |
---|
| 70 | if ( !function_exists( 'AS_panorama_menu' ) ) { |
---|
| 71 | if ( defined('IN_ADMIN') and IN_ADMIN ) { |
---|
| 72 | add_event_handler('get_admin_plugin_menu_links', 'AS_panorama_menu'); |
---|
[19460] | 73 | function AS_panorama_menu($menu) |
---|
| 74 | { |
---|
| 75 | array_push($menu, |
---|
| 76 | array( |
---|
| 77 | 'NAME' => 'Panoramas', |
---|
| 78 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php') |
---|
| 79 | ) |
---|
| 80 | ); |
---|
| 81 | return $menu; |
---|
| 82 | } |
---|
| 83 | } |
---|
[6527] | 84 | } |
---|
| 85 | ?> |
---|