HEX
Server: Apache
System: Linux p3plzcpnl489499.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: dwauav0tm6jp (6177017)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //home/dwauav0tm6jp/public_html/wp-content/themes/photographer-wp/admin/post-gallery.php
<?php

	function pixelwars__photo_gallery( $atts )
	{
		extract(shortcode_atts(array('ids'     => "",
									 'orderby' => "",
									 'size'    => 'thumbnail'), $atts));
		
		$output = "";
		$items_with_commas = $ids;
		
		if ($items_with_commas != "")
		{
			global $wpdb;
			$items_in_array = preg_split("/[\s]*[,][\s]*/", $items_with_commas);
			
			if ($orderby == 'rand')
			{
				shuffle($items_in_array);
			}
			
			$output .= '<div class="media-grid-wrap">';
			
				$gallery_loading 				  = get_option('pixelwars_portfolio_gallery_loading', 'wait-for-all-images');
				$gallery_style 					  = get_option('gallery_style', 'minimal');
				$gallery_share_button 			  = get_option('gallery_share_button', 'true');
				$gallery_fullscreen_button 		  = get_option('gallery_fullscreen_button', 'true');
				$gallery_background_color_opacity = get_option('gallery_background_color_opacity', '1.00');
				$gallery_row_height 			  = get_option('gallery_row_height', '360');
				$gallery_image_load_effect 		  = get_option('gallery_image_load_effect', 'effect-4');
				
				$output .= '<div class="pw-gallery pw-collage pw-collage-loading ' . esc_attr($gallery_loading) . '" data-gallery-style="' . esc_attr($gallery_style) . '" data-share="' . esc_attr($gallery_share_button) . '" data-fullscreen="' . esc_attr($gallery_fullscreen_button) . '" data-bg-opacity="' . esc_attr($gallery_background_color_opacity) . '" data-row-height="' . esc_attr($gallery_row_height) . '" data-effect="' . esc_attr($gallery_image_load_effect) . '" data-mobile-row-height="120">';
				
					$image_resizing = get_option('pixelwars_full_size_image_resizing', '4k');
					
					foreach ($items_in_array as $item)
					{
						$image_big = "";
						
						if ($image_resizing == '2k')
						{
							$image_big = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1920');
						}
						elseif ($image_resizing == 'medium')
						{
							$image_big = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1400');
						}
						elseif ($image_resizing == 'no_resizing')
						{
							$image_big = wp_get_attachment_image_src($item, 'full');
						}
						else
						{
							$image_big = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_3840');
						}
						
						$image_medium = "";
						$image_width_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1400');
						
						if ($image_width_cropped[1] > $image_width_cropped[2])
						{
							$image_medium = $image_width_cropped;
						}
						else
						{
							$image_height_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx1080');
							$image_medium = $image_height_cropped;
						}
						
						$image_small 	 = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx500');
						$image_alt 		 = get_post_meta($item, '_wp_attachment_image_alt', true);
						$image_caption   = $wpdb->get_var($wpdb->prepare("SELECT post_excerpt FROM $wpdb->posts WHERE ID = %s", $item));
						$attachment_page = get_attachment_link($item);
						
						$output .= '<a href="' . esc_url($image_big[0]) . '" data-size="' . esc_attr($image_big[1]) . 'x' . esc_attr($image_big[2]) . '" data-med="' . esc_url($image_medium[0]) . '" data-med-size="' . esc_attr($image_medium[1]) . 'x' . esc_attr($image_medium[2]) . '" data-attachment-page="' . esc_url($attachment_page) . '">';
						
						$output .= '<img alt="' . esc_attr($image_alt) . '" src="' . esc_url($image_small[0]) . '" width="' . esc_attr($image_small[1]) . '" height="' . esc_attr($image_small[2]) . '">';
						
						if ($image_caption != "")
						{
							$output .= '<figure>'. $image_caption . '</figure>';
						}
						
						$output .= '</a>';
					}
				
				$output .= '</div>';
			$output .= '</div>';
		}
		
		return $output;
	}
	
	
	function pixelwars__photo_gallery_2($atts)
	{
		extract(shortcode_atts(array('ids'     => "",
									 'orderby' => "",
									 'size'    => 'thumbnail'), $atts));
		
		$output = "";
		$items_with_commas = $ids;
		
		if ($items_with_commas != "")
		{
			global $wpdb;
			$items_in_array = preg_split("/[\s]*[,][\s]*/", $items_with_commas);
			
			if ($orderby == 'rand')
			{
				shuffle($items_in_array);
			}
			
			$output .= '<div class="media-grid-wrap">';
			
				$gallery_loading 		   = get_option('pixelwars_portfolio_gallery_loading', 'wait-for-all-images');
				$gallery_row_height 	   = get_option('gallery_row_height', '360');
				$gallery_image_load_effect = get_option('gallery_image_load_effect', 'effect-4');
				
				$output .= '<div class="mfp-gallery pw-collage pw-collage-loading ' . esc_attr($gallery_loading) . '" data-row-height="' . esc_attr($gallery_row_height) . '" data-effect="' . esc_attr($gallery_image_load_effect) . '" data-mobile-row-height="120">';
				
					foreach ($items_in_array as $item)
					{
						$image_big_url = "";
						$image_width_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1920');
						
						if ($image_width_cropped[1] > $image_width_cropped[2])
						{
							$image_big_url = $image_width_cropped[0];
						}
						else
						{
							$image_height_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx1080');
							$image_big_url = $image_height_cropped[0];
						}
						
						$image_small   = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx500');
						$image_alt 	   = get_post_meta($item, '_wp_attachment_image_alt', true);
						$image_caption = $wpdb->get_var($wpdb->prepare("SELECT post_excerpt FROM $wpdb->posts WHERE ID = %s", $item));
						
						$title_out = "";
						
						if ($image_caption != "")
						{
							$title_out = 'title="' . esc_attr($image_caption) . '"';
						}
						
						$output .= '<a href="' . esc_url($image_big_url) . '" ' . $title_out . '>';
						$output .= '<img alt="' . esc_attr($image_alt) . '" src="' . esc_url($image_small[0]) . '" width="' . esc_attr($image_small[1]) . '" height="' . esc_attr($image_small[2]) . '">';
						$output .= '</a>';
					}
				
				$output .= '</div>';
			$output .= '</div>';
		}
		
		return $output;
	}
	
	
	function pixelwars__photo_gallery_3($atts)
	{
		extract(shortcode_atts(array('ids'     => "",
									 'orderby' => "",
									 'size'    => 'thumbnail'), $atts));
		
		$output = "";
		$items_with_commas = $ids;
		
		if ($items_with_commas != "")
		{
			global $wpdb;
			$items_in_array = preg_split("/[\s]*[,][\s]*/", $items_with_commas);
			
			if ($orderby == 'rand')
			{
				shuffle($items_in_array);
			}
			
			$output .= '<section class="viewjs-gallery">';
				$output .= '<figure>';
					$output .= '<ul>';
					
						foreach ($items_in_array as $item)
						{
							$image_big_url = "";
							$image_width_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1920');
							
							if ($image_width_cropped[1] > $image_width_cropped[2])
							{
								$image_big_url = $image_width_cropped[0];
							}
							else
							{
								$image_height_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx1080');
								$image_big_url = $image_height_cropped[0];
							}
							
							$image_small   = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx500');
							$image_alt 	   = get_post_meta($item, '_wp_attachment_image_alt', true);
							$image_caption = $wpdb->get_var($wpdb->prepare("SELECT post_excerpt FROM $wpdb->posts WHERE ID = %s", $item));
							
							$title_out = "";
							
							if ($image_caption != "")
							{
								$title_out = 'title="' . esc_attr($image_caption) . '"';
							}
							
							$output .= '<li>';
							$output .= '<a class="view" ' . $title_out . ' href="' . esc_url($image_big_url) . '" rel="photos">';
							$output .= '<img alt="' . esc_attr($image_alt) . '" src="' . esc_url($image_small[0]) . '">';
							$output .= '</a>';
							$output .= '</li>';
						}
					
					$output .= '</ul>';
				$output .= '</figure>';
			$output .= '</section> <!-- .viewjs-gallery -->';
		}
		
		return $output;
	}
	
	
	function pixelwars__homepage_photowall_gallery( $atts )
	{
		extract( shortcode_atts( array( 'ids'     => "",
										'orderby' => "",
										'size'    => 'thumbnail' ), $atts ) );
		
		$output = "";
		$items_with_commas = $ids;
		
		if ( $items_with_commas != "" )
		{
			$items_in_array = preg_split( "/[\s]*[,][\s]*/", $items_with_commas );
			
			if ( $orderby == 'rand' )
			{
				shuffle( $items_in_array );
			}
			
			$animation = get_option( 'pixelwars_homepage_photowall_animation', 'random' );
			$interval  = stripcslashes( get_option( 'pixelwars_homepage_photowall_interval', '1600' ) );
			$max_step  = get_option( 'pixelwars_homepage_photowall_max_step', '3' );
			
			$output .= '<div class="ri-grid ri-grid-loading" data-animation="' . esc_attr( $animation ) . '" data-interval="' . esc_attr( $interval ) . '" data-max-step="' . esc_attr( $max_step ) . '">';
			$output .= '<ul>';
			
			foreach ( $items_in_array as $item )
			{
				$image = wp_get_attachment_image_src( $item, 'pixelwars_theme_image_size_2' );
				$image_alt = get_post_meta( $item, '_wp_attachment_image_alt', true );
				
				$output .= '<li>';
				$output .= '<a href="#">';
				$output .= '<img alt="' . esc_attr( $image_alt ) . '" src="' . esc_url( $image[0] ) . '">';
				$output .= '</a>';
				$output .= '</li>';
			}
			
			$output .= '</ul>';
			$output .= '</div>';
		}
		
		return $output;
	}
	
	
	function pixelwars__homepage_landing_2_gallery( $atts )
	{
		extract( shortcode_atts( array( 'ids'     => "",
										'orderby' => "",
										'size'    => 'thumbnail' ), $atts ) );
		
		$output = "";
		$items_with_commas = $ids;
		
		if ( $items_with_commas != "" )
		{
			$items_in_array = preg_split( "/[\s]*[,][\s]*/", $items_with_commas );
			
			if ( $orderby == 'rand' )
			{
				shuffle( $items_in_array );
			}
			
			$loop 			  = get_option( 'pixelwars_homepage_owl_carousel_loop', 'true' );
			$center 		  = get_option( 'pixelwars_homepage_owl_carousel_center', 'true' );
			$autoplay 		  = get_option( 'pixelwars_homepage_owl_carousel_autoplay', 'true' );
			$autoplay_speed   = get_option( 'pixelwars_homepage_owl_carousel_autoplay_speed', '500' );
			$autoplay_timeout = get_option( 'pixelwars_homepage_owl_carousel_autoplay_timeout', '3000' );
			
			$output .= '<div class="owl-carousel fs-slider owl-loading" data-items="1" data-loop="' . esc_attr( $loop ) . '" data-center="' . esc_attr( $center ) . '" data-mouse-drag="false" data-nav="false" data-dots="false" data-autoplay="' . esc_attr( $autoplay ) . '" data-autoplay-speed="' . esc_attr( $autoplay_speed ) . '" data-autoplay-timeout="' . esc_attr( $autoplay_timeout ) . '" data-nav-text-prev="' . __( 'prev', 'read' ) . '" data-nav-text-next="' . __( 'next', 'read' ) . '">';
			
			foreach ( $items_in_array as $item )
			{
				$image = wp_get_attachment_image_src( $item, 'pixelwars_theme_image_size_1920' );
				
				$output .= '<div class="fs-slide" style="background-image: url( ' . esc_url( $image[0] ) . ' );"></div>';
			}
			
			$output .= '</div>';
		}
		
		return $output;
	}
	
	
	function pixelwars__homepage_landing_4_gallery($atts)
	{
		extract(shortcode_atts(array('ids'     => "",
									 'orderby' => "",
									 'size'    => 'thumbnail'), $atts));
		
		$output = "";
		$items_with_commas = $ids;
		
		if ($items_with_commas != "")
		{
			$items_in_array = preg_split("/[\s]*[,][\s]*/", $items_with_commas);
			
			if ($orderby == 'rand')
			{
				shuffle($items_in_array);
			}
			
			$output .= '<div class="fs-slider fade-slider">';
			
				foreach ($items_in_array as $item)
				{
					$image_url = "";
					$image_width_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_1920');
					
					if ($image_width_cropped[1] > $image_width_cropped[2])
					{
						$image_url = $image_width_cropped[0];
					}
					else
					{
						$image_height_cropped = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_nullx1080');
						$image_url = $image_height_cropped[0];
					}
					
					$image_alt = get_post_meta($item, '_wp_attachment_image_alt', true);
					
					$output .= '<div class="fs-slide">';
					$output .= '<img alt="' . esc_attr($image_alt) . '" src="' . esc_url($image_url) . '">';
					$output .= '</div>';
				}
			
			$output .= '</div> <!-- .fs-slider .fade-slider -->';
		}
		
		return $output;
	}
	
	
	function pixelwars__homepage_alternate_gallery( $atts )
	{
		extract( shortcode_atts( array( 'ids'     => "",
										'orderby' => "",
										'size'    => 'thumbnail' ), $atts ) );
		
		$output = "";
		$items_with_commas = $ids;
		
		if ( $items_with_commas != "" )
		{
			$items_in_array = preg_split( "/[\s]*[,][\s]*/", $items_with_commas );
			
			if ( $orderby == 'rand' )
			{
				shuffle( $items_in_array );
			}
			
			$animation = get_option( 'pixelwars_homepage_ken_slider_animation', 'kenburns' );
			$speed 	   = get_option( 'pixelwars_homepage_ken_slider_interval', '5000' );
			
			$output .= '<ul class="ken-slider" data-animation="' . esc_attr( $animation ) . '" data-speed="' . esc_attr( $speed ) . '">';
			
				foreach ( $items_in_array as $item )
				{
					$image 	   = wp_get_attachment_image_src( $item, $size );
					$image_alt = get_post_meta( $item, '_wp_attachment_image_alt', true );
					
					$output .= '<li>';
					$output .= '<img alt="' . esc_attr( $image_alt ) . '" src="' . esc_url( $image[0] ) . '">';
					$output .= '</li>';
				}
			
			$output .= '</ul>';
		}
		
		return $output;
	}
	
	
	function pixelwars__homepage_alternate_2_gallery($atts)
	{
		extract(shortcode_atts(array('ids'     => "",
									 'orderby' => "",
									 'size'    => 'thumbnail'), $atts));
		
		$output            = "";
		$items_with_commas = $ids;
		
		if ($items_with_commas != "")
		{
			$items_in_array = preg_split("/[\s]*[,][\s]*/", $items_with_commas);
			
			if ($orderby == 'rand')
			{
				shuffle($items_in_array);
			}
			
			$items            = get_option('pixelwars_homepage_owl_carousel_items', '4');
			$loop             = get_option('pixelwars_homepage_owl_carousel_loop', 'true');
			$center           = get_option('pixelwars_homepage_owl_carousel_center', 'true');
			$mouse_drag       = get_option('pixelwars_homepage_owl_carousel_mouse_drag', 'true');
			$nav_links        = get_option('pixelwars_homepage_owl_carousel_nav_links', 'true');
			$nav_dots         = get_option('pixelwars_homepage_owl_carousel_nav_dots', 'false');
			$autoplay         = get_option('pixelwars_homepage_owl_carousel_autoplay', 'true');
			$autoplay_speed   = get_option('pixelwars_homepage_owl_carousel_autoplay_speed', '500');
			$autoplay_timeout = get_option('pixelwars_homepage_owl_carousel_autoplay_timeout', '3000');
			
			$output .= '<div class="owl-carousel owl-loading" data-items="' . esc_attr($items) . '" data-loop="' . esc_attr($loop) . '" data-center="' . esc_attr($center) . '" data-mouse-drag="' . esc_attr($mouse_drag) . '" data-nav="' . esc_attr($nav_links) . '" data-dots="' . esc_attr($nav_dots) . '" data-autoplay="' . esc_attr($autoplay) . '" data-autoplay-speed="' . esc_attr($autoplay_speed) . '" data-autoplay-timeout="' . esc_attr($autoplay_timeout) . '" data-nav-text-prev="' . __('prev', 'read') . '" data-nav-text-next="' . __('next', 'read') . '">';
			
				foreach ($items_in_array as $item)
				{
					$image 	   = wp_get_attachment_image_src($item, 'pixelwars_theme_image_size_760x507');
					$image_url = $image[0]; // Get url.
					$image_alt = get_post_meta($item, '_wp_attachment_image_alt', true);
					
					$output .= '<div>';
					$output .= '<img alt="' . esc_attr($image_alt) . '" src="' . esc_url($image_url) . '">';
					$output .= '</div>';
				}
			
			$output .= '</div>';
		}
		
		return $output;
	}
	
	
	function pixelwars__post_gallery($output = "", $atts, $content = false, $tag = false)
	{
		$new_output = $output;
		
		if (is_singular('portfolio'))
		{
			$pf_type = get_option(get_the_ID() . 'pf_type', 'Standard');
			
			if ($pf_type == 'Photo Gallery')
			{
				$new_output = pixelwars__photo_gallery($atts);
			}
			elseif ($pf_type == 'Photo Gallery 2')
			{
				$new_output = pixelwars__photo_gallery_2($atts);
			}
			elseif ($pf_type == 'Photo Gallery 3')
			{
				$new_output = pixelwars__photo_gallery_3($atts);
			}
		}
		elseif (is_page_template('template-homepage.php'))
		{
			$new_output = pixelwars__homepage_photowall_gallery($atts);
		}
		elseif (is_page_template('template-homepage_landing.php'))
		{
			$new_output = pixelwars__homepage_photowall_gallery($atts);
		}
		elseif (is_page_template('template-homepage_landing_2.php'))
		{
			$new_output = pixelwars__homepage_landing_2_gallery($atts);
		}
		elseif (is_page_template('template-homepage_landing_4.php'))
		{
			$new_output = pixelwars__homepage_landing_4_gallery($atts);
		}
		elseif (is_page_template('template-homepage_alternate.php'))
		{
			$new_output = pixelwars__homepage_alternate_gallery($atts);
		}
		elseif (is_page_template('template-homepage_alternate_2.php'))
		{
			$new_output = pixelwars__homepage_alternate_2_gallery($atts);
		}
		elseif (is_singular('post') || is_page() || is_home())
		{
			$gallery_type = get_option('pixelwars__gallery_type_for_posts_and_pages', 'Photo Gallery 2');
			
			if ($gallery_type == 'Photo Gallery')
			{
				$new_output = pixelwars__photo_gallery($atts);
			}
			elseif ($gallery_type == 'Photo Gallery 2')
			{
				$new_output = pixelwars__photo_gallery_2($atts);
			}
		}
		
		return $new_output;
	}
	
	add_filter('post_gallery', 'pixelwars__post_gallery', 10, 4);

?>