HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/www.winghung.com/wp-content/themes/zeen/inc/classes/blocks/class-zeen-block-ad.php
<?php
/**
 * Zeen block ad
 *
 * @since 1.0.0
 */

class ZeenBlockAd extends ZeenBlocks {

	/**
	 * Constructor
	 *
	 * @since 1.0.0
	 *
	*/
	public function __construct( $args ) {
		$this->type = 'da';
		parent::__construct( $args );
	}

	/**
	 * Block output
	 *
	 * @since 1.0.0
	 *
	*/
	public function output( $echo = true ) {

		if ( $this->enabled() != true ) {
			return;
		}

		if ( empty( $echo ) ) {
			ob_start();
		}
		$ad_img      = empty( $this->args['ad_img'] ) ? '' : $this->args['ad_img'];
		$ad_img_data = empty( $this->args['ad_img_id'] ) ? '' : wp_get_attachment_image_src( $this->args['ad_img_id'], 'full' );
		$ad_url      = empty( $this->args['ad_url'] ) ? '' : $this->args['ad_url'];
		$ad_img_2x   = empty( $this->args['ad_img_2x'] ) ? '' : $this->args['ad_img_2x'];
		if ( empty( $this->args['only_inner'] ) ) {
			$this->opening_wrap();
			echo '<div class="zeen-da-wrap">';
		}

		if ( 1 != $this->args['ad_type'] ) {
			$this->block_content();
		}

		if ( empty( $this->args['only_inner'] ) ) {
			if ( 1 == $this->args['ad_type'] ) {
				if ( ! empty( $ad_url ) ) {
					echo '<a href="' . esc_url( $ad_url ) . '" rel="nofollow" class="zeen-da-url"';
					if ( ! empty( $this->args['new_tab'] ) && 'on' == $this->args['new_tab'] ) {
						echo ' target="_blank"';
					}
					echo '>';
				}
				echo '<img';
				$width  = 728;
				$height = 90;
				if ( ! empty( $ad_img_data ) ) {
					if ( ! empty( $ad_img_data[1] ) ) {
						$width = $ad_img_data[1];
						echo ' width="' . (int) $ad_img_data[1] . '"';
					}
					if ( ! empty( $ad_img_data[2] ) ) {
						$height = $ad_img_data[2];
						echo ' height="' . (int) $ad_img_data[2] . '"';
					}
				}
				$ad_img    = str_replace( 'http://', 'https://', $ad_img );
				$ad_img_2x = str_replace( 'http://', 'https://', $ad_img_2x );

				echo ' src="' . esc_url( $ad_img ) . '" alt="block" class="zeen-da-img" loading="lazy"';
				if ( ! empty( $ad_img_2x ) ) {
					echo ' srcset="' . esc_url( $ad_img_2x ) . ' 2x' . '"';
				}
				echo '>';
				if ( ! empty( $ad_url ) ) {
					echo '</a>';
				}
			}
			echo '</div>';
			if ( ! empty( $this->args['small_print_check'] ) && 'off' != $this->args['small_print_check'] ) {
				echo '<div class="small-print clearfix">' . zeen_sanitize_titles( $this->args['small_print'] ) . '</div>';
			}
			$this->closing_wrap();
		}

		if ( empty( $echo ) ) {
			return ob_get_clean();
		}

	}
}