function gdl_get_gallery_data() { $img_width = get_option(THEME_SHORT_NAME . '_gallery_page_image_width', '220'); $img_height = get_option(THEME_SHORT_NAME . '_gallery_page_image_height', '165'); // init the variable $gal_root = $_POST['root']; $gal_dir = $_POST['dir']; $audio_counter = 0; if (empty($gal_root)) { $gal_root = ""; } else { $gal_root = str_replace('\\\\', '\\', $gal_root); } if (empty($gal_dir)) { $gal_dir = ""; } else { $gal_dir = str_replace('\\\\', '\\', $gal_dir); } $back_dir_index = strripos($gal_dir, '\\'); if ($back_dir_index > 0) { $back_dir = substr($gal_dir, 0, $back_dir_index); } else { $back_dir = ''; } $header_query_string = 'name = \'' . mysql_real_escape_string(GAL_PREFIX . $gal_root . '\\' . $gal_dir) . '\''; $header_query = galdb_query($header_query_string); if (!empty($header_query) && !empty($header_query[0]->title)) { $header_title = $header_query[0]->title; $header_description = $header_query[0]->description; } else { $header_title = ''; $header_description = ''; } // print the header echo '<div class="gdl-gal-container-header-wrapper">'; echo '<div class="gdl-gal-container-header-gimmick"></div>'; echo '<h1 class="gdl-gal-container-title gdl-title">' . $header_title . '</h1>'; echo '<div class="gdl-gal-container-caption">' . $header_description . '</div>'; echo '<div class="clear"></div>'; echo '<div class="gallery-nav-wrapper">'; echo '<div class="back-gallery-wrapper" data-ajax="gdl_get_gallery_data" data-root="' . $gal_root . '" data-dir="' . $back_dir . '" ><span class="back-gallery-icon"></span>Back</div>'; echo '<div class="close-gallery-wrapper" data-ajax="gdl_get_gallery_data" data-root="" data-dir="" ><span class="close-gallery-icon"></span>Close</div>'; echo '</div>'; echo '</div>'; $directory_list = get_directory_list(GAL_DEST . $gal_root . '/' . $gal_dir); echo '<div id="gdl-gallery-image-holder">'; foreach ($directory_list as $file) { if ($file['type'] == 'image') { echo '<div class="gdl-gallery-image" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;">'; $source = GAL_DEST . $gal_root . '/' . $gal_dir . '/' . $file['name']; $thumbnail = gdl_resize_gallery_image($source, GAL_TMB_DEST, $img_width, $img_height); $condition = 'name = \'' . mysql_real_escape_string(GAL_PREFIX . $gal_root . '\\' . $gal_dir . '\\' . $file['name']) . '\''; $query_result = galdb_query($condition); $image_title = ''; $icon_type = 'image'; if (empty($query_result)) { $thumbnail_full = GAL_REAL_DEST . $gal_root . '/' . $gal_dir . '/' . $file['name']; $thumbnail_full = str_replace('\\', '/', $thumbnail_full); } else { $image_title = $query_result[0]->title; if ($query_result[0]->setting == "Current Thumbnail") { $thumbnail_full = GAL_REAL_DEST . $gal_root . '/' . $gal_dir . '/' . $file['name']; $thumbnail_full = str_replace('\\', '/', $thumbnail_full); } else { $thumbnail_full = $query_result[0]->description; $icon_type = 'video'; } } if (!empty($thumbnail)) { echo '<img src="' . $thumbnail . '" alt="" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;" />'; } echo '<a data-rel="prettyPhoto[gdl-gallery]" title="' . $image_title . '" href="' . $thumbnail_full . '">'; echo '<span class="gdl-gallery-image-overlay">'; echo '<span class="gdl-gallery-image-icon ' . $icon_type . '"></span>'; echo '</span>'; echo '</a>'; echo '</div>'; } else { if ($file['type'] == 'audio') { $source = GAL_REAL_DEST . $gal_root . '/' . $gal_dir . '/' . $file['name']; $audio_title = $file['name']; $condition = 'name = \'' . mysql_real_escape_string(GAL_PREFIX . $gal_root . '\\' . $gal_dir . '\\' . $file['name']) . '\''; $query_result = galdb_query($condition); if (!empty($query_result)) { if (!empty($query_result[0]->title)) { $audio_title = $query_result[0]->title; } $thumbnail_id = $query_result[0]->thumbnail; $thumbnail = wp_get_attachment_image_src($thumbnail_id, $img_width . 'x' . $img_height); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); } else { $thumbnail = ''; } $audio_title = empty($audio_title) ? $file['name'] : $audio_title; echo '<div class="gdl-gallery-image audio" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;">'; if (!empty($thumbnail)) { echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;" />'; } echo '<div class="gdl-audio-player" data-audio="' . $source . '" >'; ?> <div class="jp-jplayer"></div> <div class="jp-title"><?php echo $audio_title; ?> </div> <div class="jp-audio-wrapper" id="jp-audio-container<?php echo $audio_counter; ?> "> <div class="jp-time-holder"> <span class="jp-current-time"></span> / <span class="jp-duration"></span> </div> <div class="jp-audio"> <div class="jp-type-single"> <div class="jp-gui jp-interface"> <div class="jp-controls"> <div href="javascript:;" class="jp-play" tabindex="1"></div> <div href="javascript:;" class="jp-pause" tabindex="1"></div> </div> <div class="jp-progress"> <div class="jp-seek-bar"><div class="jp-play-bar"></div></div> </div> </div> <div class="jp-no-solution"> <span>Update Required</span> To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>. </div> <div class="clear"></div> </div> </div> </div> <!-- jp audio wrapper --> <?php echo '</div>'; echo '</div>'; $audio_counter++; } else { if ($file['type'] == 'dir') { $condition = 'name = \'' . mysql_real_escape_string(GAL_PREFIX . $gal_root . '\\' . $gal_dir . '\\' . $file['name']) . '\''; $query_result = galdb_query($condition); if (!empty($query_result)) { $thumbnail_id = $query_result[0]->thumbnail; } else { $thumbnail_id = ''; } $thumbnail = wp_get_attachment_image_src($thumbnail_id, $img_width . 'x' . $img_height); $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); $new_gal_dir = $gal_dir . '\\' . $file['name']; echo '<div data-ajax="gdl_get_gallery_data" class="gdl-gallery-image" data-root="' . $gal_root . '" data-dir="' . $new_gal_dir . '" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;">'; if (!empty($thumbnail)) { echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '" style="width: ' . $img_width . 'px; height: ' . $img_height . 'px;" />'; } echo '<span class="gdl-gallery-folder-overlay">'; echo '<span class="gdl-gallery-folder-icon"></span></span>'; echo '</div>'; } } } } echo '</div>'; echo '<div class="clear"></div>'; die(''); }
$gal_root = '\\' . get_post_meta($post->ID, 'page-option-gallery-root-folder', true); if ($gal_root == '\\All') { $gal_root = ''; } $width = get_option(THEME_SHORT_NAME . '_first_bottom_slide_width', '210'); $height = get_option(THEME_SHORT_NAME . '_first_bottom_slide_height', '130'); $item_size = $width . 'x' . $height; $directory_list = get_directory_list(GAL_DEST . $gal_root, 'dir'); echo '<div class="bottom-image-slide1-wrapper" id="gdl-bottom-image-slide">'; echo '<div id="bottom-image-slide-control" class="active"></div>'; echo '<div class="gdl-bottom-image-slide-inner-wrapper" id="gdl-bottom-image-slide-inner-wrapper">'; echo '<div class="bottom-image-slide-overlay"></div>'; echo '<div id="gdl-bottom-image-slide-inner">'; foreach ($directory_list as $directory) { $condition = 'name = \'' . mysql_real_escape_string(GAL_PREFIX . $gal_root . '\\' . $directory) . '\''; $query_result = galdb_query($condition); if (empty($query_result) || $query_result[0]->setting == 'Random Thumbnail') { $random_list = get_directory_list(GAL_DEST . $gal_root . '\\' . $directory, 'image'); shuffle($random_list); echo '<div class="bottom-image-slide" data-ajax="gdl_get_gallery_data" data-root="' . $gal_root . '" data-dir="' . $directory . '">'; echo '<div class="flexslider flexslider-gallery" style="width:' . $width . 'px; height:' . $height . 'px;">'; echo '<ul class="slides">'; for ($i = 0; $i < 6 && $i < sizeof($random_list); $i++) { $source = GAL_DEST . $gal_root . '/' . $directory . '/' . $random_list[$i]; $img_thumbnail = gdl_resize_gallery_image($source, GAL_TMB_DEST, $width, $height); echo '<li><img src="' . $img_thumbnail . '" alt="" ></li>'; } echo '</ul>'; echo '</div>'; // flexslider echo '<div class="bottom-image-slide-title-wrapper" style="width:' . $width . 'px;">';