is_role( $role ); } return false; } function adz_get_advertise($ad_visibility,$ad_visibility_interval,$repeat_times,$target_type,$target,$ad_to_serve,$rotations_id,$sequence,$display_type,$adz_template){ if( !isset($_SESSION['first_time']) && @$_SESSION['first_time'] == '' ){ $_SESSION['first_time'] = time()+$ad_visibility_interval; } ?>
-1, 'post_type' => 'adz_ad', 'post_status' => 'publish', ); $posts_array = get_posts( $args ); $publisher_adz_ids = ''; if(!empty($posts_array)){ foreach ($posts_array as $posts) { $publisher_adz_ids .= get_post_meta($posts->ID,"network_ad_id",true).','; } } return $publisher_adz_ids; }// End of the function get_publisher_adz /* This Function Return the network adz id */ function adz_get_network_id($adz_ids){ $network_ids = ''; if(!empty($adz_ids)){ foreach ($adz_ids as $adz) { $network_ids .= get_post_meta($adz,"network_ad_id",true).','; } } return rtrim($network_ids); }// End of the function get_network_id /* This Function is user check Visitor is logged in or not on adz.world */ function adz_world_logged_in(){ global $adz_ad_network_base_url; $ad_network_url = $adz_ad_network_base_url."wp-json/adz_server/v1/ads/is_visitor_logged?visitor_ip={$_SERVER['REMOTE_ADDR']}"; $args = array(); $response = wp_remote_get( $ad_network_url , $args ); $body = wp_remote_retrieve_body($response); $json_repsonse = json_decode($body); if($json_repsonse->status == 'logged_in'){ return $json_repsonse->user_id; }else{ return false; } }// End of the function. /* This function is use to check roatation completed or not. */ function adz_check_roatation_completed_or_not( $rotation ){ $rotation_adz_pool = get_option($rotation['rotation_id']); if( rtrim($rotation['sequence'],",") == '' ){ return "network"; } if( !$rotation_adz_pool ){ $rotation_sequence_array = explode(',', $rotation['sequence']); $return = array_shift($rotation_sequence_array); }elseif( !empty($rotation_adz_pool['un_served']) ){ $return = array_shift($rotation_adz_pool['un_served']); }else{ $return = false; } return $return; }// End of function check_roatation_completed_or_not