HEX
Server: LiteSpeed
System: Linux mail.aatilis.ir 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: www (1000)
PHP: 8.3.30
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/soqatland.com/wp-content/themes/woodmart/inc/shortcodes/compare-images.php
<?php
/**
 * Compare images shortcode.
 *
 * @package WoodMart
 */

if ( ! defined( 'WOODMART_THEME_DIR' ) ) {
	exit( 'No direct script access allowed' );
}

if ( ! function_exists( 'woodmart_shortcode_compare_images' ) ) {
	function woodmart_shortcode_compare_images( $atts ) {
		$wrapper_classes = apply_filters( 'vc_shortcodes_css_class', '', '', $atts );

		$atts = shortcode_atts(
			array(
				'css'                 => '',
				'woodmart_css_id'     => '',
				'first_image'         => '',
				'first_image_size'    => 'full',
				'second_image'        => '',
				'second_image_size'   => 'full',
				'alignment'           => '',
				'handle_color_scheme' => 'inherit',
			),
			$atts
		);

		$wrapper_classes .= ' wd-compare-img-wrapp';
		$wrapper_classes .= ! empty( $atts['alignment'] ) ? ' text-' . $atts['alignment'] : '';
		$wrapper_classes .= ' wd-wpb';

		if ( 'inherit' !== $atts['handle_color_scheme'] && 'custom' !== $atts['handle_color_scheme'] ) {
			$wrapper_classes .= ' color-scheme-' . $atts['handle_color_scheme'];
		}

		if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
			$wrapper_classes .= ' ' . vc_shortcode_custom_css_class( $atts['css'] );
		}

		$image_keys = array(
			'after'  => 'second_image',
			'before' => 'first_image',
		);

		$images_output = '';

		foreach ( $image_keys as $key => $image_key ) {
			$image_output = '';

			if ( empty( $atts[ $image_key ] ) ) {
				continue;
			}

			$image_size_key = $image_key . '_size';

			if ( ! empty( $atts[ $image_key ] ) ) {
				$image_data   = wp_get_attachment_image_src( $atts[ $image_key ], $atts[ $image_size_key ] );
				$image_output = woodmart_otf_get_image_html( $atts[ $image_key ], $atts[ $image_size_key ] );

				if ( isset( $image_data[0] ) && woodmart_is_svg( $image_data[0] ) ) {
					$image_output = woodmart_get_svg_html(
						$atts[ $image_key ],
						$atts[ $image_size_key ]
					);
				}
			}

			ob_start();
			?>
				<div class="wd-<?php echo esc_attr( $key ); ?>-img">
					<?php echo $image_output; // phpcs:ignore. ?>
				</div>
			<?php
			$images_output .= ob_get_clean();
		}

		if ( empty( $images_output ) ) {
			return;
		}

		ob_start();

		woodmart_enqueue_inline_style( 'el-compare-img' );
		woodmart_enqueue_js_script( 'compare-images-element' );
		?>
		<div class="<?php echo esc_attr( trim( $wrapper_classes ) ); ?>">
			<div class="wd-compare-img">
				<?php echo $images_output; // phpcs:ignore. ?>
				<div class="wd-compare-img-handle">
					<span></span>
				</div>
			</div>
		</div>
		<?php

		return ob_get_clean();
	}
}