</script> <!-- XXX remove dependencies on theme --> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?> /admin/css/jquery.lightbox-0.5.css" /> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?> /admin/js/jquery.lightbox-0.5.js"></script> <?php $gallery_option_list = photocrati_gallery_option_list_get(); // Parameters passed to the iframe, basic initial validation $gallery_id = $_GET['gal_id']; $gallery_type = photocrati_gallery_type_name($_GET['gal_type']); $gallery = photocrati_gallery_instance_get($gallery_id); $gallery_info = photocrati_gallery_info_get($gallery_id); // Each item in these arrays is a CSS property eg. 'position' => 'relative' $gallery_style = array(); $gallery_stage_style = array(); $gallery_image_style = array(); $gallery_caption_style = array(); $gallery_thumbnail_container_style = array(); $gallery_thumbnail_wrap_style = array(); $gallery_thumbnail_style = array(); // Each variable holds JS code to run as Galleria's "extend" property, with own context i.e. $gallery_image_script has the Galleria image element as the "this" variable (will be applied to all images), same for thumbnails $gallery_script = null; $gallery_image_script = null; $gallery_thumbnail_script = null; $gallery_width = 960; $gallery_height = 0;
function insertGallery($atts) { $upload_dir = wp_upload_dir(); global $wpdb; $global = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "photocrati_gallery_settings WHERE id = 1", ARRAY_A); foreach ($global as $key => $value) { ${$key} = $value; } $cart_settings = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "photocrati_ecommerce_settings WHERE id = 1", ARRAY_A); foreach ($cart_settings as $key => $value) { ${$key} = $value; } $style = $wpdb->get_row("SELECT bg_color,container_color,content_width,container_padding,container_border FROM " . $wpdb->prefix . "photocrati_styles WHERE option_set = 1", ARRAY_A); foreach ($style as $key => $value) { ${$key} = $value; } if ($_GET['gal_page'] == 'true') { $contwidth = $content_width / 100; } else { $contwidth = ($content_width - 2) / 100; } if ($container_color != 'transparent') { $bg = $container_color; } else { $bg = $bg_color; } extract(shortcode_atts(array("gal_id" => '1_1', "gal_type" => '1'), $atts)); $gallery_options = photocrati_gallery_option_list_get(); $gallery = photocrati_gallery_instance_get($gal_id); // XXX here we pass in gallery_type of 'thumbnail' to ensure we get the smallest thumbnails, ideally PhotocratiGalleryImage would have all of these as additional fields $instance_list = photocrati_gallery_instance_list($gallery, array_merge($gallery_options, array('gallery_type' => 'thumbnail'))); $count = count($instance_list); $insertgallery .= '<div class="photocrati_nojava" id="gal_images_' . $gal_id . '">'; for ($i = 0; $i < $count; $i++) { $instance_image = $instance_list[$i]; $gallery_id = $instance_image->GalleryID; $insertgallery .= '<a href="' . $instance_image->URI . '" class="decoy"'; if ($gal_type == '1' && $gallery_cap1 == 'ON' || $gal_type == '2' && $gallery_cap2 == 'ON' || $gal_type == '3' && $gallery_cap3 == 'ON' || $gal_type == '4' && $gallery_cap4 == 'ON') { $insertgallery .= ' title="' . $instance_image->Description . '"'; } $insertgallery .= ' id="img_' . $gallery_id . '_' . ($i + 1) . '" rel="gallery_' . $gallery_id . '">'; $insertgallery .= '<img src="' . $instance_image->ThumbURI . '" alt="' . $instance_image->NameHTML . '" />'; $insertgallery .= '</a>'; } $insertgallery .= '</div>'; $insertgallery .= '<script type="text/javascript"> jQuery.noConflict(); jQuery("#gal_images_' . $gal_id . '").hide(); function iframe_' . $gal_id . '_loaded() { var iframe = jQuery("#g' . $gal_id . '"); var height = iframe.contents().find(\'#content\').height(); iframe.height(height); } </script>'; if ($gal_type == '1') { if (!is_page()) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=1&gal_cap=' . $gallery_cap1 . '&gal_page=false&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { if (is_page() && !is_page_template('page-with-sidebar.php')) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=1&gal_cap=' . $gallery_cap1 . '&gal_page=true&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=1&gal_cap=' . $gallery_cap1 . '&gal_page=true&page_template=true&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } } } else { if ($gal_type == '2') { if (!is_page()) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=2&gal_cap=' . $gallery_cap2 . '&gal_page=false&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { if (is_page() && !is_page_template('page-with-sidebar.php')) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=2&gal_cap=' . $gallery_cap2 . '&gal_page=true&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=2&gal_cap=' . $gallery_cap2 . '&gal_page=true&page_template=true&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } } } else { if ($gal_type == '3') { if (!is_page()) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=3&gal_cap=' . $gallery_cap3 . '&gal_page=false&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { if (is_page() && !is_page_template('page-with-sidebar.php')) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=3&gal_cap=' . $gallery_cap3 . '&gal_page=true&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=3&gal_cap=' . $gallery_cap3 . '&gal_page=true&page_template=true&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } } } else { if ($gal_type == '4') { if (!is_page()) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=4&gal_cap=' . $gallery_cap4 . '&gal_page=false&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { if (is_page() && !is_page_template('page-with-sidebar.php')) { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=4&gal_cap=' . $gallery_cap4 . '&gal_page=true&page_template=false&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } else { $insertgallery .= '<div class="iframe_wrapper"><script type="text/javascript"> <!-- document.write (\'<iframe id="g' . $gal_id . '" allowtransparency="true" src="' . get_bloginfo('wpurl') . '/index.php?display_gallery_iframe&gal_id=' . $gal_id . '&gal_type=4&gal_cap=' . $gallery_cap4 . '&gal_page=true&page_template=true&bg=' . $bg . '" scrolling="no" width="100%" frameborder="0" style="margin:0 auto;padding:0;border:0;clear:both;background:transparent;"></iframe>\'); //--> </script></div>'; } } } else { if ($gal_type == '5') { if (is_page() && !is_page_template('page-with-sidebar.php')) { $maxwidth = 960 - $container_padding * 2 - $container_border * 2; } else { $maxwidth = floor((960 - $container_padding * 2 - $container_border * 2) * $contwidth); } $layoutw = floor($maxwidth / $ecomm_per_row); $layouth = floor($layoutw * 0.664); $insertgallery .= '<script src="' . get_bloginfo('template_url') . '/admin/js/jquery.tools.min.js"></script> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function() { jQuery("a.iframe").fancybox({ \'width\' : 650, \'height\' : 500, \'autoScale\' : false, \'transitionIn\' : \'elastic\', \'transitionOut\' : \'elastic\', \'overlayColor\' : \'#0b0b0f\', \'type\' : \'iframe\' }); jQuery.ajax({type: "POST", url: "' . photocrati_gallery_file_uri('ecomm-cart-widget.php') . '", data: \'\', success: function(data) { jQuery(\'#cart_widget\').html(data) } }); }); </script> <style type="text/css"> .ecommerce { width : ' . ($layoutw - $ecomm_line_size * 2 - 30) . 'px; height : ' . ($layouth + 40) . 'px; margin : 5px; padding : 10px; background : #' . $ecomm_back_color . '; border : ' . $ecomm_line_size . 'px solid #' . $ecomm_line_color . '; } .ecommerce .image_wrapper { height : ' . $layouth . 'px; z-index : 1; overflow : hidden; } .ecommerce .image_wrapper img { max-width : ' . ($layoutw - $ecomm_line_size * 4 - 30) . 'px; max-height : ' . ($layouth - $ecomm_line_size * 2) . 'px; border : ' . $ecomm_line_size . 'px solid #' . $ecomm_line_color . '; z-index : 1; } .ecommerce .meta_wrapper { height : 30px; color : #333; margin-top : ' . 10 . 'px; text-align : left; z-index : 5; } </style> <div class="ecommerce_wrapper"> <div class="widget_wrapper"> <div id="cart_widget"></div> </div>'; $g = 1; $gallery = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_galleries WHERE gallery_id = '" . $gal_id . "' ORDER BY image_order,image_name ASC"); foreach ($gallery as $gallery) { $action = ''; $qty = explode(",", $_SESSION['cart_qty']); foreach ($qty as $cart_items) { $item = explode("|", $cart_items); if ($item[0] == $gallery->id) { $action = '&actions=edit&page=gallery'; } } $upload_dir = wp_upload_dir(); $insertgallery .= '<div class="ecommerce"'; if ($g == $ecomm_per_row + 1) { $insertgallery .= ' style="clear:both;"'; $g = 1; } $insertgallery .= '> <div class="image_wrapper">'; if (file_exists($upload_dir['basedir'] . '/galleries/post-' . $gallery->post_id . '/thumbnails/' . $gallery->image_name)) { $insertgallery .= '<a class="photocrati_lightbox_always" rel="gallery" href="' . $upload_dir['baseurl'] . '/galleries/post-' . $gallery->post_id . '/full/' . str_replace("%", "%25", $gallery->image_name) . '"'; if ($ecomm_captions == 'ON') { $insertgallery .= 'title="' . $gallery->image_alt . ''; if ($gallery->image_desc) { $insertgallery .= ' - ' . $gallery->image_desc; } $insertgallery .= '"'; } $insertgallery .= '> <img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . $upload_dir['baseurl'] . '/galleries/post-' . $gallery->post_id . '/thumbnails/' . str_replace("%", "%25", $gallery->image_name) . '" alt="' . $gallery->image_name . '">'; } else { $insertgallery .= '<a class="photocrati_lightbox_always" rel="gallery" href="' . get_bloginfo('template_url') . '/galleries/post-' . $gallery->post_id . '/full/' . str_replace("%", "%25", $gallery->image_name) . '"'; if ($ecomm_captions == 'ON') { $insertgallery .= 'title="' . $gallery->image_alt . ''; if ($gallery->image_desc) { $insertgallery .= ' - ' . $gallery->image_desc; } $insertgallery .= '"'; } $insertgallery .= '> <img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . get_bloginfo('template_url') . '/galleries/post-' . $gallery->post_id . '/thumbnails/' . str_replace("%", "%25", $gallery->image_name) . '" alt="' . $gallery->image_name . '">'; } $insertgallery .= '</a> </div> <div class="meta_wrapper"> <div class="addto">'; if (!$ecomm_but_image) { $insertgallery .= '<a class="iframe" id="addto_' . $gallery->id . '" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id=' . $gallery->id . $action . '"> <button id="addto" class="positive"> ' . $ecomm_but_text . ' </button> </a>'; } else { $insertgallery .= '<a class="iframe" id="addto_' . $gallery->id . '" href="' . photocrati_gallery_file_uri('ecomm-sizes.php') . '?prod_id=' . $gallery->id . $action . '"> <img src="' . $ecomm_but_image . '" id="addto"> </a>'; } $insertgallery .= '</div> </div> </div>'; $g = $g + 1; } $insertgallery .= '</div> <div class="clear"></div>'; } else { if ($gal_type == '6') { if (is_page() && !is_page_template('page-with-sidebar.php')) { $maxwidth = 960 - $container_padding * 2 - $container_border * 2; } else { $maxwidth = floor((960 - $container_padding * 2 - $container_border * 2) * $contwidth); } $layoutw = floor($maxwidth / $albuml_per_row); $layouth = floor($layoutw * 0.664); $insertgallery .= '<style type="text/css"> .album_list { width : ' . ($layoutw - $albuml_line_size * 2 - 20) . 'px; height : 150px; margin : 10px 0; padding : 10px; background : #' . $albuml_back_color . '; border : ' . $albuml_line_size . 'px solid #' . $albuml_line_color . '; } .album_list .image_wrapper { float : left; z-index : 1; overflow : hidden; } .album_list .image_wrapper img { border : ' . $albuml_line_size . 'px solid #' . $albuml_line_color . '; z-index : 1; } .album_list .meta_wrapper { float : left; color : #' . $albuml_font_color . '; margin-top : ' . 10 . 'px; text-align : left; z-index : 5; } .album_list .meta_wrapper h4 a { color : #' . $albuml_font_color . '; font-size : ' . $albuml_font_size . 'px; } </style> <div class="album_wrapper">'; $g = 1; $album = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_albums WHERE album_id = '" . $gal_id . "' ORDER BY album_order,gallery_id ASC"); foreach ($album as $album) { $postnumber = explode("_", $album->gallery_id); $upload_dir = wp_upload_dir(); $gallery_exists = false; $image = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_galleries WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY image_order,image_name LIMIT 1"); foreach ($image as $image) { $gallery_exists = true; } if ($gallery_exists) { $insertgallery .= '<div class="album_list"'; if ($g == $albuml_per_row + 1) { $insertgallery .= ' style="clear:both;"'; $g = 1; } $insertgallery .= '>'; $image = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_galleries WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY image_order,image_name LIMIT 1"); foreach ($image as $image) { $insertgallery .= '<div class="image_wrapper"> <a href="' . get_permalink($image->post_id) . '">'; if (file_exists($upload_dir['basedir'] . '/galleries/post-' . $postnumber[0] . '/thumbnails/' . $image->image_name)) { $insertgallery .= '<img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . $upload_dir['baseurl'] . '/galleries/post-' . $postnumber[0] . '/thumbnails/' . str_replace("%", "%25", $image->image_name) . '" alt="' . $image->image_name . '">'; } else { $insertgallery .= '<img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . get_bloginfo('template_url') . '/galleries/post-' . $postnumber[0] . '/thumbnails/' . str_replace("%", "%25", $image->image_name) . '" alt="' . $image->image_name . '">'; } $insertgallery .= '</a> </div>'; } $insertgallery .= '<div class="meta_wrapper">'; $meta = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_gallery_ids WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY gallery_id LIMIT 1"); foreach ($meta as $meta) { $insertgallery .= '<h4><a href="' . get_permalink($meta->post_id) . '">' . stripslashes($meta->gal_title) . '</a></h4>'; $insertgallery .= stripslashes($meta->gal_desc); } $insertgallery .= '</div> </div>'; } $g = $g + 1; } $insertgallery .= '</div> <div class="clear"></div>'; } else { if ($gal_type == '7') { if (is_page() && !is_page_template('page-with-sidebar.php')) { $maxwidth = 960 - $container_padding * 2 - $container_border * 2; } else { $maxwidth = floor((960 - $container_padding * 2 - $container_border * 2) * $contwidth); } $layoutw = floor($maxwidth / $albumg_per_row); $layouth = floor($layoutw * 0.664); $insertgallery .= '<style type="text/css"> .album_grid { width : ' . ($layoutw - $albumg_line_size * 2 - 30) . 'px; min-height : ' . ($layouth - $albumg_line_size * 2 + 40) . 'px; height : auto; float : left; margin : 5px; padding : 10px; background : #' . $albumg_back_color . '; border : ' . $albumg_line_size . 'px solid #' . $albumg_line_color . '; } .album_grid .image_wrapper { width : ' . ($layoutw - $albumg_line_size * 2 - 30) . 'px; height : ' . ($layouth - $albumg_line_size * 2 + 15) . 'px; float : left; text-align : center; z-index : 1; overflow : hidden; } .album_grid .image_wrapper img { max-width : ' . ($layoutw - $albumg_line_size * 4 - 30) . 'px; max-height : ' . ($layouth - $albumg_line_size * 2) . 'px; border : ' . $albumg_line_size . 'px solid #' . $albumg_line_color . '; z-index : 1; } .album_grid .meta_wrapper { width : 100%; clear : both; float : left; color : #' . $albumg_font_color . '; text-align : center; z-index : 5; } .album_grid .meta_wrapper h4 a { color : #' . $albumg_font_color . '; font-size : ' . $albumg_font_size . 'px; } </style> <div class="album_wrapper">'; $g = 1; $album = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_albums WHERE album_id = '" . $gal_id . "' ORDER BY album_order,gallery_id ASC"); foreach ($album as $album) { $postnumber = explode("_", $album->gallery_id); $gallery_exists = false; $image = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_galleries WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY image_order,image_name LIMIT 1"); foreach ($image as $image) { $gallery_exists = true; } if ($gallery_exists) { $insertgallery .= '<div class="album_grid"'; if ($g == $albumg_per_row + 1) { $insertgallery .= ' style="clear:both;"'; $g = 1; } $insertgallery .= '>'; $image = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_galleries WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY image_order,image_name LIMIT 1"); foreach ($image as $image) { $insertgallery .= '<div class="image_wrapper"> <a href="' . get_permalink($image->post_id) . '">'; if (file_exists($upload_dir['basedir'] . '/galleries/post-' . $postnumber[0] . '/thumbnails/med-' . $image->image_name)) { $insertgallery .= '<img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . $upload_dir['baseurl'] . '/galleries/post-' . $postnumber[0] . '/thumbnails/med-' . str_replace("%", "%25", $image->image_name) . '" alt="' . $image->image_name . '">'; } else { $insertgallery .= '<img onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false" src="' . get_bloginfo('template_url') . '/galleries/post-' . $postnumber[0] . '/thumbnails/med-' . str_replace("%", "%25", $image->image_name) . '" alt="' . $image->image_name . '">'; } $insertgallery .= '</a> </div>'; } $insertgallery .= '<div class="meta_wrapper">'; $meta = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "photocrati_gallery_ids WHERE gallery_id = '" . $album->gallery_id . "' ORDER BY gallery_id LIMIT 1"); foreach ($meta as $meta) { $insertgallery .= '<h4><a href="' . get_permalink($meta->post_id) . '">' . stripslashes($meta->gal_title) . '</a></h4>'; } $insertgallery .= '</div> </div>'; } $g = $g + 1; } $insertgallery .= '</div> <div class="clear"></div>'; } } } } } } } return $insertgallery; }