function process_shortcodes($atts) { $parameters = shortcode_atts(array("block" => "", "name" => ""), $atts); if (is_numeric($parameters['block'])) { $block = intval($parameters['block']); } else { $block = 0; } if ($block < 1 && $block > AD_INSERTER_BLOCKS) { $block = 0; } elseif ($parameters['name'] != '') { $shortcode_name = strtolower($parameters['name']); for ($counter = 1; $counter <= AD_INSERTER_BLOCKS; $counter++) { $obj = new ai_Block($counter); $obj->load_options($counter); $ad_name = strtolower(trim($obj->get_ad_name())); if ($shortcode_name == $ad_name) { $block = $counter; break; } } } if ($block != 0) { $obj = new ai_Block($block); $obj->load_options($block); if ($obj->get_enable_manual()) { $display_for_users = $obj->get_display_for_users(); if ($display_for_users == AD_DISPLAY_LOGGED_IN_USERS && !is_user_logged_in()) { return ""; } if ($display_for_users == AD_DISPLAY_NOT_LOGGED_IN_USERS && is_user_logged_in()) { return ""; } $display_for_devices = $obj->get_display_for_devices(); if ($display_for_devices == AD_DISPLAY_DESKTOP_DEVICES && !AI_DESKTOP) { return ""; } if ($display_for_devices == AD_DISPLAY_MOBILE_DEVICES && !AI_MOBILE) { return ""; } if ($display_for_devices == AD_DISPLAY_TABLET_DEVICES && !AI_TABLET) { return ""; } if ($display_for_devices == AD_DISPLAY_PHONE_DEVICES && !AI_PHONE) { return ""; } if ($display_for_devices == AD_DISPLAY_DESKTOP_TABLET_DEVICES && !(AI_DESKTOP || AI_TABLET)) { return ""; } if ($display_for_devices == AD_DISPLAY_DESKTOP_PHONE_DEVICES && !(AI_DESKTOP || AI_PHONE)) { return ""; } $block_class_name = get_block_class_name(); if ($obj->get_alignment_type() == AD_ALIGNMENT_NO_WRAPPING) { $ad_code = ai_getAdCode($obj); } else { $ad_code = "<div class='" . $block_class_name . " " . $block_class_name . "-" . $block . "' style='" . $obj->get_alignmet_style() . "'>" . ai_getAdCode($obj) . "</div>"; } return $ad_code; } } return ""; }