| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/glaza-core/includes/ |
Upload File : |
<?php
/**
* widget custom ad
*/
if ( ! function_exists( 'glaza_ad_image' ) ):
function glaza_ad_image( $settings ) {
if ( empty( $settings['image'] ) ) {
return false;
}
if ( ! empty( $settings['title'] ) ) : ?>
<div class="ad-description"><span><?php echo esc_html( $settings['title'] ); ?></span></div>
<?php endif; ?>
<div class="ad-image">
<?php if ( empty( $settings['destination'] ) ) : ?>
<img src="<?php echo esc_url( $settings['image'] ); ?>" alt="<?php if ( ! empty( $settings['title'] ) ) {
echo esc_attr( $settings['title'] );
} else {
bloginfo( 'name' );
} ?>">
<?php else : ?>
<a class="widget-ad-link" target="_blank" href="<?php echo esc_url( $settings['destination'] ); ?>"><img src="<?php echo esc_url( $settings['image'] ); ?>" alt="<?php if ( ! empty( $settings['title'] ) ) {
echo esc_attr( $settings['title'] );
} else {
bloginfo( 'name' );
} ?>"></a>
<?php endif; ?>
</div>
<?php
}
endif;
/**
* @param $settings
* render ad script
*/
if ( ! function_exists( 'glaza_ad_script' ) ) :
function glaza_ad_script( $settings ) {
if ( empty( $settings['ad_script'] ) ) {
return false;
}
if ( ! empty( $settings['title'] ) ) : ?>
<div class="ad-description"><span><?php echo esc_html( $settings['title'] ); ?></span></div>
<?php endif;
$spot = glaza_ad_spot( $settings['ad_script'] );
if ( ! empty( $spot['data_ad_slot'] ) && ! empty( $spot['data_ad_client'] ) && ! empty( $settings['ad_size'] ) ): ?>
<div class="ad-script adsense">
<style>
<?php echo '.res-'.trim($settings['id']); ?><?php echo glaza_ad_script_css($settings['ad_size_mobile']); ?>
@media (min-width: 500px) { <?php echo '.res-'.trim($settings['id']); ?><?php echo glaza_ad_script_css($settings['ad_size_table']); ?> }
@media (min-width: 800px) { <?php echo '.res-'.trim($settings['id']); ?><?php echo glaza_ad_script_css($settings['ad_size_table']); ?> }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle <?php echo '.res-'.trim($settings['id']); ?>"
style="display:inline-block"
data-ad-client="<?php echo esc_attr( $spot['data_ad_client'] ); ?>"
data-ad-slot="<?php echo esc_attr( $spot['data_ad_slot'] ); ?>"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<?php else : ?>
<div class="ad-script non-adsense">
<?php echo do_shortcode( $settings['ad_script'] ); ?>
</div>
<?php endif;
}
endif;
/**
* @param $ad_script
*
* @return array|bool
* get ad spot
*/
if ( ! function_exists( 'glaza_ad_spot' ) ) :
function glaza_ad_spot( $ad_script ) {
$data_ad = array();
if ( empty( $ad_script ) ) {
return false;
}
if ( preg_match( '/googlesyndication.com/', $ad_script ) ) {
//get ads client
$array_ad_client_code = explode( 'data-ad-client', $ad_script );
if ( empty( $array_ad_client_code[1] ) ) {
return false;
}
preg_match( '/"([a-zA-Z0-9-\s]+)"/', $array_ad_client_code[1], $match_data_ad_client );
$data_ad_client = str_replace( array( '"', ' ' ), array( '' ), $match_data_ad_client[1] );
//get ads slot
$array_ad_slot_code = explode( 'data-ad-slot', $ad_script );
if ( empty( $array_ad_slot_code[1] ) ) {
return false;
}
preg_match( '/"([a-zA-Z0-9\s]+)"/', $array_ad_slot_code[1], $match_data_add_slot );
$data_ad_slot = str_replace( array( '"', ' ' ), array( '' ), $match_data_add_slot[1] );
if ( ! empty( $data_ad_client ) && ! empty( $data_ad_slot ) ) {
$data_ad['data_ad_client'] = $data_ad_client;
$data_ad['data_ad_slot'] = $data_ad_slot;
}
return $data_ad;
} else {
return false;
}
}
endif;
/**
* @param $size
*
* @return string
* ad css
*/
if ( ! function_exists( 'glaza_ad_script_css' ) ):
function glaza_ad_script_css( $size ) {
switch ( $size ) {
case '1' :
return '{ width: 728px; height: 90px; }';
case '2' :
return '{ width: 468px; height: 60px; }';
case '3' :
return '{ width: 234px; height: 60px; }';
case '4' :
return '{ width: 125px; height: 125px; }';
case '5' :
return '{ width: 120px; height: 600px; }';
case '6' :
return '{ width: 160px; height: 600px; }';
case '7' :
return '{ width: 180px; height: 150px; }';
case '8' :
return '{ width: 120px; height: 240px; }';
case '9' :
return '{ width: 200px; height: 200px; }';
case '10' :
return '{ width: 250px; height: 250px; }';
case '11' :
return '{ width: 300px; height: 250px; }';
case '12' :
return '{ width: 336px; height: 280px; }';
case '13' :
return '{ width: 300px; height: 600px; }';
case '14' :
return '{ width: 300px; height: 1050px; }';
case '15' :
return '{ width: 320px; height: 50px; }';
case '16' :
return '{ width: 970px; height: 90px; }';
case '17' :
return '{ width: 970px; height: 250px; }';
default :
return '{ display: none; }';
}
}
endif;