[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 ) { |
---|
| 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 | |
---|
| 39 | if ( !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'); |
---|
[6533] | 47 | if ( isset($asp['name']) ) { |
---|
| 48 | $picture['TITLE'] = $asp['name']; |
---|
| 49 | $template->assign('current', $picture); |
---|
| 50 | $template->assign( array( 'ASP' => $asp, ) ); |
---|
| 51 | } |
---|
[6527] | 52 | } |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | if ( !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( |
---|
[6533] | 63 | 'NAME' => 'Panoramas', |
---|
[6527] | 64 | 'URL' => get_admin_plugin_menu_link(dirname(__FILE__).'/AS_Panorama_admin.php') |
---|
| 65 | ) |
---|
| 66 | ); |
---|
| 67 | return $menu; |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | ?> |
---|