Changeset 19460 for extensions/Panoramas/AS_Panorama.php
- Timestamp:
- Dec 16, 2012, 8:19:28 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Panoramas/AS_Panorama.php
r6533 r19460 12 12 global $conf, $template, $page; 13 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 } 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 } 37 52 } 38 53 39 54 if ( !function_exists( 'AS_panorama_title' ) ) { 40 41 42 43 44 45 46 47 48 49 50 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 } 54 69 } 55 70 … … 57 72 if ( defined('IN_ADMIN') and IN_ADMIN ) { 58 73 add_event_handler('get_admin_plugin_menu_links', 'AS_panorama_menu'); 59 60 61 62 63 64 65 66 67 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 } 70 85 } 71 86 ?>
Note: See TracChangeset
for help on using the changeset viewer.