function writeShoppingCart() { global $wpdb; $settings = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "photocrati_ecommerce_settings WHERE id = 1", ARRAY_A); foreach ($settings as $key => $value) { ${$key} = $value; } $cart = $_SESSION['cart']; if (!$cart) { return '<p><em>' . $ecomm_empty . '</em> </p>'; } else { // Parse the cart session variable $items = explode(',', $cart); $s = count($items) > 1 ? 's' : ''; if (get_option('permalink_structure') != '') { return '<button id="addto2" class="positive" style="margin:0 5px;" onClick=\'window.location.href = "' . get_bloginfo('url') . '/' . str_replace(" ", "-", strtolower($ecomm_title)) . '/"\'><img src="' . photocrati_gallery_file_uri('image/cart.png') . '"> ' . $ecomm_title . ': ' . count($items) . ' item' . $s . '</button>'; } else { $pgid = query_posts(array('pagename' => $ecomm_title)); foreach ($pgid as $pgid) { $pageid = $pgid->ID; } wp_reset_query(); return '<button id="addto2" class="positive" style="margin:0 5px;" onClick=\'window.location.href = "' . get_bloginfo('url') . '/?page_id=' . $pageid . '"\'><img src="' . photocrati_gallery_file_uri('image/cart.png') . '"> ' . $ecomm_title . ': ' . count($items) . ' item' . $s . '</button>'; } } }
?> ').show(); } }); </script> <?php echo '<div style="float:left;width:75%;">'; if ($gallery->gal_type == '6' || $gallery->gal_type == '7') { if ($gallery->gal_type == '6') { echo '<p><b>Title:</b> ' . stripslashes($gallery->gal_title) . ' | <b>Album - List Style (ID #' . $galnumber[1] . ')</b></p>'; } else { echo '<p><b>Title:</b> ' . stripslashes($gallery->gal_title) . ' | <b>Album - Grid Style (ID #' . $galnumber[1] . ')</b></p>'; } echo '<p><div style="float:left;"><a href="' . photocrati_gallery_file_uri('admin/upload_edit.php') . '?post=' . $gallery->post_id . '&gallery_id=' . $gallery->gallery_id . '&TB_iframe=true" class="thickbox"><img src="' . photocrati_gallery_file_uri('image/edit_album.jpg') . '" id="edit_button_' . $gallery->gallery_id . '" /></a></div>'; echo '<div style="float:left;"><img src="' . photocrati_gallery_file_uri('image/delete_album.jpg') . '" id="delete_abutton_' . $gallery->gallery_id . '" style="cursor:pointer;margin:0 4px;" /></div>'; echo '<div style="float:left;"><img src="' . photocrati_gallery_file_uri('image/reinsert_album.jpg') . '" id="reinsert_button_' . $gallery->gallery_id . '" style="cursor:pointer;margin:0 4px;display:none;" /></div>'; echo '<div class="msggallery1" id="msggallery_' . $gallery->gallery_id . '"></div></p>'; } else { echo '<p><b>Title:</b> ' . stripslashes($gallery->gal_title) . ' | <b>Gallery (ID #' . $galnumber[1] . ')</b></p>'; echo '<p><div style="float:left;"><a href="' . photocrati_gallery_file_uri('admin/upload_edit.php') . '?post=' . $gallery->post_id . '&gallery_id=' . $gallery->gallery_id . '&TB_iframe=true" class="thickbox"><img src="' . photocrati_gallery_file_uri('image/edit_gallery.jpg') . '" id="edit_button_' . $gallery->gallery_id . '" /></a></div>'; echo '<div style="float:left;"><img src="' . photocrati_gallery_file_uri('image/delete_gallery.jpg') . '" id="delete_button_' . $gallery->gallery_id . '" style="cursor:pointer;margin:0 4px;" /></div>'; echo '<div style="float:left;"><img src="' . photocrati_gallery_file_uri('image/reinsert_gallery.jpg') . '" id="reinsert_button_' . $gallery->gallery_id . '" style="cursor:pointer;margin:0 4px;display:none;" /></div>'; echo '<div class="msggallery1" id="msggallery_' . $gallery->gallery_id . '"></div></p>'; } echo '<input type="hidden" id="the_content_' . $gallery->gallery_id . '">'; echo '</div>'; echo '</div>'; } } else { echo '<p><b>There are no galleries associated with this page</b></p>'; }
$gallery_image_script = ' function md(e) { try { if (event.button==2||event.button==3) return false; } catch (e) { if (e.which == 3) return false; } } jQuery(this)[0].oncontextmenu = function() {return false;}; jQuery(this)[0].ondragstart = function() {return false;}; jQuery(this)[0].onmousedown = md; ' . $gallery_image_script; if ($gallery_playback_button_show) { $gallery_script .= ' var gallery = this; jQuery(".galleria-stage").append(\'<div class="play_wrapper" style="display:none;z-index:99;position:absolute;moz-opacity:.0;opacity:.0;filter:alpha(opacity=0);"><a id="play_button" style="cursor:pointer;"><img src="' . photocrati_gallery_file_uri('image/play_button.png') . '"></a></div>\'); jQuery(".galleria-stage").append(\'<div class="pause_wrapper" style="z-index:99;position:absolute;moz-opacity:.0;opacity:.0;filter:alpha(opacity=0);"><a id="pause_button" style="cursor:pointer;"><img src="' . photocrati_gallery_file_uri('image/pause_button.png') . '"></a></div>\'); jQuery(".galleria-container").hover( function () { jQuery(".play_wrapper").css("moz-opacity",".75").css("opacity",".75").css("filter","alpha(opacity=75)"); jQuery(".pause_wrapper").css("moz-opacity",".75").css("opacity",".75").css("filter","alpha(opacity=75)"); }, function () { jQuery(".play_wrapper").css("moz-opacity",".0").css("opacity",".0").css("filter","alpha(opacity=0)"); jQuery(".pause_wrapper").css("moz-opacity",".0").css("opacity",".0").css("filter","alpha(opacity=0)"); } ); jQuery(".play_wrapper").click(function() { gallery.play(); jQuery(".play_wrapper").hide(); jQuery(".pause_wrapper").show();
/"> </li> <?php $galnums2 = $galnums2 + 1; } ?> </ul> </div> </div> <?php } } ?> <div class="photocrati_buttons"> <input type="image" src="<?php echo photocrati_gallery_file_uri('image/gallery_nexgen_import.jpg'); ?> " id="import_photocrati_images" value="Import From Photocrati" onclick="return false;" /> <input type="image" src="<?php echo photocrati_gallery_file_uri('image/gallery_nexgen_cancel.jpg'); ?> " id="cancel_photocrati" value="Cancel Import" onclick="return false;" /> </div>
<?php global $post; global $wpdb; ?> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function() { jQuery.ajax({type: "POST", url: "<?php echo photocrati_gallery_file_uri('admin/get_galleries.php'); ?> ", data: 'post_id=<?php echo $_GET['post']; ?> ', success: function(data) { jQuery('#display_galleries').html(data) } }); }); </script> <div id="display_galleries"></div>
<?php /* --------------------------------- */ /* -- define Photocrati constants -- */ /* --------------------------------- */ // Gallery Constants define('PHOTOCRATI_GALLERY_PLACEHOLDER', '<img class="photocrati-placeholder aligncenter" src="' . photocrati_gallery_file_uri('image/gallery-placeholder.gif') . '" alt=""/>');
<?php $nums = $nums + 1; } ?> </ul> </div> </div> <input type="hidden" id="gal_number" value="<?php echo $galnumber[1]; ?> "> <div style="width:100%;padding-top:20px;cursor:pointer;clear:both;"></div> <div style="float:left;cursor:pointer;"> <input type="image" src="<?php echo photocrati_gallery_file_uri('image/save_gallery.jpg'); ?> " id="save_button_2" value="Save Gallery" onclick="return false;" /> </div> <div id="msggallery2"></div> </div> <div id="add_album"></div> </form> </div>
?> /admin/scripts/uploadify.php', 'scriptData': { 'cookie' : escape(document.cookie + ';<?php echo photocrati_upload_parameter_string(); ?> '), 'session_id' : '<?php echo session_id(); ?> ' }, 'cancelImg' : '<?php bloginfo('template_url'); ?> /admin/images/cancel_gallery.gif', 'auto' : true, 'buttonImg' : '<?php echo photocrati_gallery_file_uri('image/upload.jpg'); ?> ', 'folder' : '/images/uploads', 'onComplete': function(event, queueID, fileObj, response, data) { jQuery("#filesUploaded2").html('<input type="hidden" id="bg_image" name="bg_image" value="'+fileObj.name+'">'); jQuery("#fileName2") .fadeIn('slow') .html(fileObj.name+' uploaded successfully!<BR><em>Remember to save.</em>'); } }); jQuery("#update-background").click(function() { jQuery("#msgmb").html("<img src='<?php
<div class="buttons"> <button class="addto" id="pay_now" class="positive" style="margin:0 5px;width:75px;text-align:center;"> Pay Now </button> <button class="addto" id="cancel_checkout" class="positive" style="margin:0 5px;display:none;"> Cancel </button> </div> <div class="checkout_image"> <img src="<?php echo photocrati_gallery_file_uri('image/secure-payment-paypal.gif'); ?> "> </div> </div> </div> <?php } ?> </div>
jQuery.ajax({type: "POST", url: "<?php echo photocrati_gallery_file_uri('ecomm-add-to-cart.php'); ?> ", data: 'action=add&id=<?php echo $_GET['prod_id']; ?> ', success: function(data) { var ln = jQuery('[id^=qty_]').size(); jQuery('[id^=qty_]').each(function(index) { var currentId = jQuery(this).attr('id'); jQuery.ajax({type: "POST", url: "<?php echo photocrati_gallery_file_uri('ecomm-add-to-cart-quantities.php'); ?> ", data: 'action=add&id=<?php echo $_GET['prod_id']; ?> &size_id='+currentId.substr(4)+'&qty='+jQuery(this).val()+'&total='+jQuery("#line_"+currentId.substr(4)).val(), success: function(data) { var ln2 = ln - 1; if (index==ln2) { parent.jQuery.fancybox.close(); <?php if (!$_GET["page"]) { ?> parent.location.reload(); <?php
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; }