web/wp-content/plugins/slideshow-jquery-image-gallery/views/SlideshowPlugin/slideshow.php
changeset 194 32102edaa81b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
       
     1 <div class="slideshow_container slideshow_container_<?php echo (is_numeric($randomId)) ? $randomId : 0; ?>" style="width: <?php echo (is_numeric($settings['width']))? $settings['width'] : 0; ?>px; height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
       
     2 	<div class="slideshow_overflow" style="width: <?php echo (is_numeric($settings['width']))? $settings['width'] : 0; ?>px; height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
       
     3 		<div class="slideshow">
       
     4 			<?php if(count($slides) > 0): ?>
       
     5 				<?php $i = 0; ?>
       
     6 				<?php foreach($slides as $slide): ?>
       
     7 
       
     8 					<?php
       
     9 					$url = $target = '';
       
    10 					if(isset($slide['url']))
       
    11 						$url = htmlspecialchars($slide['url']);
       
    12 					if(isset($slide['urlTarget']))
       
    13 						$target = htmlspecialchars($slide['urlTarget']);
       
    14 					?>
       
    15 
       
    16 					<?php if($slide['type'] == 'text'): ?>
       
    17 
       
    18 						<?php
       
    19 							$title = $description = $color = '';
       
    20 							if(isset($slide['title']))
       
    21 								$title = SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($slide['title']);
       
    22 							if(isset($slide['description']))
       
    23 								$description = SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($slide['description']);
       
    24 							if(isset($slide['color']))
       
    25 								$color = htmlspecialchars($slide['color']);
       
    26 						?>
       
    27 
       
    28 						<div class="slide slide_<?php echo $i; ?>" <?php if(!empty($color)) echo 'style="background: #' . $color . ';"'; ?> style="height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
       
    29 							<a <?php if(!empty($url)) echo 'href="' . $url . '"';?> <?php if(!empty($target)) echo 'target="' . $target . '"'; ?>>
       
    30 								<h2><?php echo $title; ?></h2>
       
    31 								<p><?php echo $description; ?></p>
       
    32 							</a>
       
    33 						</div>
       
    34 
       
    35 					<?php elseif($slide['type'] == 'video'): ?>
       
    36 
       
    37 						<?php
       
    38 							$videoId = '';
       
    39 							if(isset($slide['videoId']))
       
    40 								$videoId = htmlspecialchars($slide['videoId']);
       
    41 
       
    42 							// If the video ID contains 'v=', it means a URL has been passed. Retrieve the video ID.
       
    43 							$idPosition = null;
       
    44 							if(($idPosition = stripos($videoId, 'v=')) !== false){
       
    45 								// The video ID, which perhaps still has some arguments behind it.
       
    46 								$videoId = substr($videoId, $idPosition + 2);
       
    47 
       
    48 								// Explode on extra arguments (&).
       
    49 								$videoId = explode('&', $videoId);
       
    50 
       
    51 								// The first element is the video ID
       
    52 								if(is_array($videoId) && isset($videoId[0]))
       
    53 									$videoId = $videoId[0];
       
    54 							}
       
    55 
       
    56 							$elementVideoId = 'youtube-player-' . rand() . '-' . $videoId;
       
    57 						?>
       
    58 
       
    59 						<div class="slide slide_<?php echo $i; ?> slide_video" style="height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
       
    60 							<div class="videoId" style="display: none;"><?php echo $videoId; ?> <?php echo $elementVideoId; ?></div>
       
    61 							<div id="<?php echo $elementVideoId; ?>"></div>
       
    62 						</div>
       
    63 
       
    64 					<?php elseif($slide['type'] == 'attachment'): ?>
       
    65 
       
    66 						<?php
       
    67 						$postId = '';
       
    68 						if(isset($slide['postId']) && is_numeric($slide['postId']))
       
    69 							$postId = $slide['postId'];
       
    70 						else
       
    71 							continue;
       
    72 
       
    73 						$attachment = get_post($postId);
       
    74 						if(empty($attachment))
       
    75 							continue;
       
    76 
       
    77 						$image = wp_get_attachment_image_src($attachment->ID, 'full');
       
    78 						$imageSrc = '';
       
    79 						if(!is_array($image) || !$image){
       
    80 							if(!empty($attachment->guid))
       
    81 								$imageSrc = $attachment->guid;
       
    82 							else
       
    83 								continue;
       
    84 						}else{
       
    85 							$imageSrc = $image[0];
       
    86 						}
       
    87 						?>
       
    88 
       
    89 						<div class="slide slide_<?php echo $i; ?>" style="height: <?php echo (is_numeric($settings['height']))? $settings['height'] : 0; ?>px;">
       
    90 							<div class="description transparent">
       
    91 								<a <?php if(!empty($url)) echo 'href="' . $url . '"'; ?> <?php if(!empty($target)) echo 'target="' . $target . '"'; ?>>
       
    92 									<h2><?php echo SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($attachment->post_title); ?></h2>
       
    93 									<p><?php echo SlideshowPluginSecurity::htmlspecialchars_allow_exceptions($attachment->post_content); ?></p>
       
    94 								</a>
       
    95 							</div>
       
    96 							<a <?php if(!empty($url)) echo 'href="' . $url . '"'; ?> <?php if(!empty($target)) echo 'target="' . $target . '"'; ?>>
       
    97 								<img
       
    98 									src="<?php echo htmlspecialchars($imageSrc); ?>"
       
    99 									alt="<?php echo htmlspecialchars($attachment->post_title); ?>"
       
   100 								/>
       
   101 							</a>
       
   102 						</div>
       
   103 
       
   104 					<?php endif; ?>
       
   105 					<?php $i++; ?>
       
   106 				<?php endforeach; ?>
       
   107 			<?php endif; ?>
       
   108 		</div>
       
   109 	</div>
       
   110 
       
   111 	<div class="controllers">
       
   112 		<div class="controlPanel transparent"><ul><li class="togglePlay play"></li></ul></div>
       
   113 
       
   114 		<div class="button previous transparent"></div>
       
   115 		<div class="button next transparent"></div>
       
   116 	</div>
       
   117 
       
   118 	<div class="settings" style="display: none;"><?php echo json_encode($settings); ?></div>
       
   119 
       
   120 	<div class="manufacturer">
       
   121 		<a href="http://www.stefanboonstra.com/slideshow/">Wordpress Slideshow</a>
       
   122 	</div>
       
   123 
       
   124 	<div style="display: none;">
       
   125 		<?php echo SlideshowPluginMain::$version; ?>
       
   126 	</div>
       
   127 
       
   128 	<?php if(!empty($style)): ?>
       
   129 	<style type="text/css">
       
   130 			<?php echo htmlspecialchars($style); ?>
       
   131 	</style>
       
   132 	<?php endif; ?>
       
   133 </div>