function form($instance) { global $wpdb, $blog_id; $defaults = array(); $instance = wp_parse_args((array) $instance, $defaults); $license = get_option('adrotate_activate'); $title = $adid = $siteid = ''; extract($instance); $title = esc_attr($title); $adid = esc_attr($adid); $siteid = esc_attr($siteid); $ads = $wpdb->get_results("SELECT `id`, `title` FROM `{$wpdb->prefix}adrotate` WHERE (`type` = 'active' OR `type` = '2days' OR `type` = '7days') ORDER BY `id` ASC;"); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title (optional):', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /> <br /> <small><?php _e('HTML will be stripped out.', 'adrotate-pro'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('adid'); ?> "><?php _e('Advert:', 'adrotate-pro'); ?> </label><br /> <select id="<?php echo $this->get_field_id('adid'); ?> " name="<?php echo $this->get_field_name('adid'); ?> "> <option value="0"><?php _e('--', 'adrotate-pro'); ?> </option> <?php if ($ads) { ?> <?php foreach ($ads as $ad) { ?> <option value="<?php echo $ad->id; ?> " <?php if ($adid == $ad->id) { echo 'selected'; } ?> ><?php echo $ad->id; ?> - <?php echo $ad->title; ?> </option> <?php } ?> <?php } ?> </select> </p> <?php if (adrotate_is_networked() and ($license['l'] != 'Network' or $license['l'] != 'Developer')) { ?> <p> <label for="<?php echo $this->get_field_id('siteid'); ?> "><?php _e('Site ID:', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="text" value="<?php echo $siteid; ?> " /> <br /> <small><?php _e(sprintf('The site ID from a site in the network! Leave empty or %s to use current site.', $blog_id), 'adrotate-pro'); ?> </small> </p> <?php } else { ?> <input id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="hidden" value="0" /> <?php } }
function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) { global $wpdb, $adrotate_config, $adrotate_debug; $output = $group_select = $weightoverride = $mobileoverride = ''; if ($group_ids) { $license = get_site_option('adrotate_activate'); if ($site > 0 and adrotate_is_networked() and ($license['type'] == 'Network' or $license['type'] == 'Developer')) { $current_blog = $wpdb->blogid; switch_to_blog($site); } $now = adrotate_now(); $group_array = !is_array($group_ids) ? explode(",", $group_ids) : $group_ids; foreach ($group_array as $key => $value) { $group_select .= " `{$wpdb->prefix}adrotate_linkmeta`.`group` = {$value} OR"; } $group_select = rtrim($group_select, " OR"); // Grab settings to use from first group $group = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' AND `id` = %d;", $group_array[0])); if ($adrotate_debug['general'] == true) { echo "<p><strong>[DEBUG][adrotate_group] Group</strong><pre>"; echo "Group ID: " . $group->id . ', ' . $group->name; echo "<br />Group mobile: "; echo $group->mobile == 1 ? "yes" : "no"; echo "<br />User is mobile: "; echo adrotate_is_mobile() ? "yes" : "no"; echo "<br />User is tablet: "; echo adrotate_is_tablet() ? "yes" : "no"; echo "</pre></p>"; } if ($group) { if ($group->mobile == 1) { if (!adrotate_is_mobile() and !adrotate_is_tablet()) { // Desktop $mobileoverride = "AND `{$wpdb->prefix}adrotate`.`desktop` = 'Y'"; } else { if (adrotate_is_mobile()) { // Phones $mobileoverride = "AND `{$wpdb->prefix}adrotate`.`mobile` = 'Y'"; } else { if (adrotate_is_tablet()) { // Tablets $mobileoverride = "AND `{$wpdb->prefix}adrotate`.`tablet` = 'Y'"; } } } } $weightoverride = $weight > 0 ? "AND `{$wpdb->prefix}adrotate`.`weight` >= {$weight} " : ''; $fallback = $fallback == 0 ? $group->fallback : $fallback; // Get all ads in all selected groups $ads = $wpdb->get_results("SELECT \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`id`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`title`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`bannercode`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`image`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`responsive`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`tracker`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`weight`,\n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`crate`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`irate`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`budget`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`cities`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate`.`countries`,\n\t\t\t\t\t`{$wpdb->prefix}adrotate_linkmeta`.`group`\n\t\t\t\tFROM \n\t\t\t\t\t`{$wpdb->prefix}adrotate`, \n\t\t\t\t\t`{$wpdb->prefix}adrotate_linkmeta` \n\t\t\t\tWHERE \n\t\t\t\t\t({$group_select}) \n\t\t\t\t\tAND `{$wpdb->prefix}adrotate_linkmeta`.`user` = 0 \n\t\t\t\t\tAND `{$wpdb->prefix}adrotate`.`id` = `{$wpdb->prefix}adrotate_linkmeta`.`ad` \n\t\t\t\t\t{$mobileoverride}\n\t\t\t\t\t{$weightoverride}\n\t\t\t\t\tAND (`{$wpdb->prefix}adrotate`.`type` = 'active' \n\t\t\t\t\t\tOR `{$wpdb->prefix}adrotate`.`type` = '2days' \n\t\t\t\t\t\tOR `{$wpdb->prefix}adrotate`.`type` = '7days') \n\t\t\t\tGROUP BY `{$wpdb->prefix}adrotate`.`id` \n\t\t\t\tORDER BY `{$wpdb->prefix}adrotate`.`id`;"); if ($ads) { if ($adrotate_debug['general'] == true) { echo "<p><strong>[DEBUG][adrotate_group()] Selected ads</strong><pre>"; foreach ($ads as $ad) { print_r($ad->id . ', ' . $ad->title . '<br>'); } echo "</pre></p>"; } foreach ($ads as $ad) { $selected[$ad->id] = $ad; $selected = adrotate_filter_schedule($selected, $ad); if ($adrotate_config['enable_advertisers'] == 'Y' and ($ad->crate > 0 or $ad->irate > 0)) { $selected = adrotate_filter_budget($selected, $ad); } if ($adrotate_config['enable_geo'] > 0 and $group->geo == 1) { $selected = adrotate_filter_location($selected, $ad); } } if ($adrotate_debug['general'] == true) { echo "<p><strong>[DEBUG][adrotate_group] Reduced array based on settings</strong><pre>"; print_r($selected); echo "</pre></p>"; } $array_count = count($selected); if ($array_count > 0) { $before = $after = ''; $before = str_replace('%id%', $group_array[0], stripslashes(html_entity_decode($group->wrapper_before, ENT_QUOTES))); $after = str_replace('%id%', $group_array[0], stripslashes(html_entity_decode($group->wrapper_after, ENT_QUOTES))); $output .= '<div class="g' . $adrotate_config['adblock_disguise'] . ' g' . $adrotate_config['adblock_disguise'] . '-' . $group->id . '">'; // Kill dynamic mode for mobile users if ($adrotate_config['mobile_dynamic_mode'] == 'Y' and $group->modus == 1 and (adrotate_is_mobile() or adrotate_is_tablet())) { $group->modus = 0; } if ($group->modus == 1) { // Dynamic ads $i = 1; // Limit group to save resources $amount = $group->adspeed >= 10000 ? 10 : 20; // Randomize and trim output $selected = adrotate_shuffle($selected); foreach ($selected as $key => $banner) { if ($i <= $amount) { $image = str_replace('%folder%', $adrotate_config['banner_folder'], $banner->image); $output .= '<div class="g' . $adrotate_config['adblock_disguise'] . '-dyn a' . $adrotate_config['adblock_disguise'] . '-' . $banner->id . ' c-' . $i . '">'; $output .= $before . adrotate_ad_output($banner->id, $group->id, $banner->title, $banner->bannercode, $banner->tracker, $image, $banner->responsive) . $after; $output .= '</div>'; $i++; } } } else { if ($group->modus == 2) { // Block of ads $block_count = $group->gridcolumns * $group->gridrows; if ($array_count < $block_count) { $block_count = $array_count; } $columns = 1; for ($i = 1; $i <= $block_count; $i++) { $banner_id = adrotate_pick_weight($selected); $image = str_replace('%folder%', $adrotate_config['banner_folder'], $selected[$banner_id]->image); $output .= '<div class="g' . $adrotate_config['adblock_disguise'] . '-col b' . $adrotate_config['adblock_disguise'] . '-' . $group->id . ' a' . $adrotate_config['adblock_disguise'] . '-' . $selected[$banner_id]->id . '">'; $output .= $before . adrotate_ad_output($selected[$banner_id]->id, $group->id, $selected[$banner_id]->title, $selected[$banner_id]->bannercode, $selected[$banner_id]->tracker, $image, $selected[$banner_id]->responsive) . $after; $output .= '</div>'; if ($columns == $group->gridcolumns and $i != $block_count) { $output .= '</div><div class="g' . $adrotate_config['adblock_disguise'] . ' g' . $adrotate_config['adblock_disguise'] . '-' . $group->id . '">'; $columns = 1; } else { $columns++; } if ($adrotate_config['stats'] == 1 and $selected[$banner_id]->tracker == "Y") { adrotate_count_impression($selected[$banner_id]->id, $group->id, $site, $adrotate_config['impression_timer']); } unset($selected[$banner_id]); } } else { // Default (single ad) $banner_id = adrotate_pick_weight($selected); $image = str_replace('%folder%', $adrotate_config['banner_folder'], $selected[$banner_id]->image); $output .= '<div class="g' . $adrotate_config['adblock_disguise'] . '-single a' . $adrotate_config['adblock_disguise'] . '-' . $selected[$banner_id]->id . '">'; $output .= $before . adrotate_ad_output($selected[$banner_id]->id, $group->id, $selected[$banner_id]->title, $selected[$banner_id]->bannercode, $selected[$banner_id]->tracker, $image, $selected[$banner_id]->responsive) . $after; $output .= '</div>'; if ($adrotate_config['stats'] == 1 and $selected[$banner_id]->tracker == "Y") { adrotate_count_impression($selected[$banner_id]->id, $group->id, $site, $adrotate_config['impression_timer']); } } } $output .= '</div>'; unset($selected); } else { if ($site > 0 and adrotate_is_networked() and ($license['type'] == 'Network' or $license['type'] == 'Developer')) { switch_to_blog($current_blog); } $output .= adrotate_fallback($fallback, 'expired', $site); } } else { if ($site > 0 and adrotate_is_networked() and ($license['type'] == 'Network' or $license['type'] == 'Developer')) { switch_to_blog($current_blog); } $output .= adrotate_fallback($fallback, 'unqualified', $site); } } else { $output .= adrotate_error('group_not_found', array($group_array[0])); } if ($site > 0 and adrotate_is_networked() and ($license['type'] == 'Network' or $license['type'] == 'Developer')) { switch_to_blog($current_blog); } } else { $output .= adrotate_error('group_no_id'); } return $output; }
function adrotate_options() { global $wpdb, $wp_roles; $active_tab = isset($_GET['tab']) ? esc_attr($_GET['tab']) : 'general'; $status = isset($_GET['status']) ? esc_attr($_GET['status']) : ''; $error = isset($_GET['error']) ? esc_attr($_GET['error']) : ''; ?> <div class="wrap"> <h1><?php _e('AdRotate Settings', 'adrotate'); ?> </h1> <?php if ($status > 0) { adrotate_status($status, array('error' => $error)); } ?> <h2 class="nav-tab-wrapper"> <a href="?page=adrotate-settings&tab=general" class="nav-tab <?php echo $active_tab == 'general' ? 'nav-tab-active' : ''; ?> ">General</a> <a href="?page=adrotate-settings&tab=notifications" class="nav-tab <?php echo $active_tab == 'notifications' ? 'nav-tab-active' : ''; ?> ">Notifications</a> <a href="?page=adrotate-settings&tab=stats" class="nav-tab <?php echo $active_tab == 'stats' ? 'nav-tab-active' : ''; ?> ">Stats</a> <a href="?page=adrotate-settings&tab=geo" class="nav-tab <?php echo $active_tab == 'geo' ? 'nav-tab-active' : ''; ?> ">Geo Targeting</a> <a href="?page=adrotate-settings&tab=advertisers" class="nav-tab <?php echo $active_tab == 'advertisers' ? 'nav-tab-active' : ''; ?> ">Advertisers</a> <a href="?page=adrotate-settings&tab=roles" class="nav-tab <?php echo $active_tab == 'roles' ? 'nav-tab-active' : ''; ?> ">Roles</a> <a href="?page=adrotate-settings&tab=misc" class="nav-tab <?php echo $active_tab == 'misc' ? 'nav-tab-active' : ''; ?> ">Misc</a> <a href="?page=adrotate-settings&tab=maintenance" class="nav-tab <?php echo $active_tab == 'maintenance' ? 'nav-tab-active' : ''; ?> ">Maintenance</a> </h2> <form name="settings" id="post" method="post" action="admin.php?page=adrotate-settings"> <input type="hidden" name="adrotate_settings_tab" value="<?php echo $active_tab; ?> " /> <?php wp_nonce_field('adrotate_email_test', 'adrotate_nonce'); ?> <?php wp_nonce_field('adrotate_settings', 'adrotate_nonce_settings'); ?> <?php $adrotate_config = get_option('adrotate_config'); if ($active_tab == 'general') { $adrotate_crawlers = get_option('adrotate_crawlers'); $crawlers = ''; if (is_array($adrotate_crawlers)) { $crawlers = implode(', ', $adrotate_crawlers); } include "dashboard/settings/general.php"; } elseif ($active_tab == 'notifications') { include "dashboard/settings/notifications.php"; } elseif ($active_tab == 'stats') { include "dashboard/settings/statistics.php"; } elseif ($active_tab == 'geo') { include "dashboard/settings/geotargeting.php"; } elseif ($active_tab == 'advertisers') { include "dashboard/settings/advertisers.php"; } elseif ($active_tab == 'roles') { include "dashboard/settings/roles.php"; } elseif ($active_tab == 'misc') { include "dashboard/settings/misc.php"; } elseif ($active_tab == 'maintenance') { $adrotate_debug = get_option('adrotate_debug'); $adrotate_version = get_option('adrotate_version'); $adrotate_db_version = get_option('adrotate_db_version'); $adrotate_advert_status = get_option("adrotate_advert_status"); $adevaluate = wp_next_scheduled('adrotate_evaluate_ads'); $adschedule = wp_next_scheduled('adrotate_notification'); $adtracker = wp_next_scheduled('adrotate_clean_trackerdata'); include "dashboard/settings/maintenance.php"; } elseif ($active_tab == 'license') { $adrotate_is_networked = adrotate_is_networked(); $adrotate_hide_license = get_option('adrotate_hide_license'); if ($adrotate_is_networked) { $adrotate_activate = get_site_option('adrotate_activate'); } else { $adrotate_activate = get_option('adrotate_activate'); } include "dashboard/settings/license.php"; } ?> <?php if ($active_tab != 'license') { ?> <p class="submit"> <input type="submit" name="adrotate_options_submit" class="button-primary" value="<?php _e('Update Options', 'adrotate'); ?> " /> </p> <?php } ?> </form> </div> <?php }
function adrotate_geolocation() { global $wpdb, $ajdg_solutions_domain; if (!adrotate_has_cookie('geo') and adrotate_is_human()) { $adrotate_config = get_option('adrotate_config'); $remote_ip = adrotate_get_remote_ip(); $geo_result = array(); if ($adrotate_config['enable_geo'] == 1 or $adrotate_config['enable_geo'] == 2) { // Telize OR GeoBytes (deprecated) $adrotate_config['enable_geo'] = 5; // AdRotate Geo } if ($adrotate_config['enable_geo'] == 5) { // AdRotate Geo if (adrotate_is_networked()) { $adrotate_activate = get_site_option('adrotate_activate'); } else { $adrotate_activate = get_option('adrotate_activate'); } $args = array('headers' => array('User-Agent' => 'AdRotate Pro;' . get_option('siteurl')), 'sslverify' => false); $auth = base64_encode($adrotate_activate["instance"] . ':' . $adrotate_activate["key"]); $raw_response = wp_remote_get($ajdg_solutions_domain . 'api/geo/3/?auth=' . $auth . '&ip=' . $remote_ip, $args); $geo_result['provider'] = 'AdRotate Geo'; if (!is_wp_error($raw_response)) { $response = json_decode($raw_response['body'], true); $geo_result['status'] = $raw_response['response']['code']; if ($geo_result['status'] == 200) { $geo_result['city'] = isset($response['city']) ? strtolower($response['city']) : ''; $geo_result['dma'] = isset($response['dma']) ? strtolower($response['dma']) : ''; $geo_result['country'] = isset($response['country']) ? strtolower($response['country']) : ''; $geo_result['countrycode'] = isset($response['countrycode']) ? $response['countrycode'] : ''; $geo_result['state'] = isset($response['state']) ? strtolower($response['state']) : ''; $geo_result['statecode'] = isset($response['statecode']) ? strtolower($response['statecode']) : ''; } else { $geo_result['status'] = $raw_response['response']['code']; $geo_result['error'] = $raw_response['response']['message']; } update_option('adrotate_geo_requests', $response['queries_remaining']); } else { $geo_result['status'] = $raw_response->get_error_code(); $geo_result['error'] = $raw_response->get_error_message(); } } if ($adrotate_config['enable_geo'] == 3 or $adrotate_config['enable_geo'] == 4) { // MaxMind if ($adrotate_config['enable_geo'] == 3) { $service_type = 'country'; } if ($adrotate_config['enable_geo'] == 4) { $service_type = 'city'; } $args = array('headers' => array('user-agent' => 'AdRotate Pro;', 'Authorization' => 'Basic ' . base64_encode($adrotate_config["geo_email"] . ':' . $adrotate_config["geo_pass"]))); $raw_response = wp_remote_get('https://geoip.maxmind.com/geoip/v2.1/' . $service_type . '/' . $remote_ip, $args); $geo_result['provider'] = 'MaxMind ' . $service_type; if (!is_wp_error($raw_response)) { $response = json_decode($raw_response['body'], true); $geo_result['status'] = $raw_response['response']['code']; if ($geo_result['status'] == 200) { $geo_result['city'] = isset($response['city']['names']['en']) ? strtolower($response['city']['names']['en']) : ''; $geo_result['dma'] = isset($response['location']['metro_code']) ? strtolower($response['location']['metro_code']) : ''; $geo_result['country'] = isset($response['country']['names']['en']) ? strtolower($response['country']['names']['en']) : ''; $geo_result['countrycode'] = isset($response['country']['iso_code']) ? $response['country']['iso_code'] : ''; $geo_result['state'] = isset($response['subdivisions'][0]['names']['en']) ? strtolower($response['subdivisions'][0]['names']['en']) : ''; $geo_result['statecode'] = isset($response['subdivisions'][0]['iso_code']) ? strtolower($response['subdivisions'][0]['iso_code']) : ''; } else { $geo_result['status'] = $response['code']; $geo_result['error'] = $response['error']; if ($response['code'] == 'IP_ADDRESS_RESERVED') { $response['maxmind']['queries_remaining'] = 0; } if ($response['code'] == 'OUT_OF_QUERIES') { $response['maxmind']['queries_remaining'] = 0; } } update_option('adrotate_geo_requests', $response['maxmind']['queries_remaining']); } else { $geo_result['status'] = $raw_response->get_error_code(); $geo_result['error'] = $raw_response->get_error_message(); } } unset($raw_response, $response); setcookie('adrotate-geo', serialize($geo_result), time() + $adrotate_config['geo_cookie_life'], COOKIEPATH, COOKIE_DOMAIN); if (!isset($_SESSION['adrotate-geo'])) { $_SESSION['adrotate-geo'] = $geo_result; } } }
function form($instance) { global $wpdb, $blog_id; $defaults = array(); $instance = wp_parse_args((array) $instance, $defaults); $license = get_option('adrotate_activate'); $title = $groupid = $siteid = $categories = $pages = ''; extract($instance); $title = esc_attr($title); $groupid = esc_attr($groupid); $siteid = esc_attr($siteid); $categories = esc_attr($categories); $pages = esc_attr($pages); $groups = $wpdb->get_results("SELECT `id`, `name` FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' ORDER BY `id` ASC;"); ?> <?php if ($categories != '' or $pages != '') { ?> <p><?php _e('NOTE: This widget has Post Injection enabled!', 'adrotate-pro'); ?> </p> <?php } ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title (optional):', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /> <br /> <small><?php _e('HTML will be stripped out.', 'adrotate-pro'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('groupid'); ?> "><?php _e('Group:', 'adrotate-pro'); ?> </label><br /> <select id="<?php echo $this->get_field_id('groupid'); ?> " name="<?php echo $this->get_field_name('groupid'); ?> "> <option value="0"><?php _e('--', 'adrotate-pro'); ?> </option> <?php if ($groups) { ?> <?php foreach ($groups as $group) { ?> <option value="<?php echo $group->id; ?> " <?php if ($groupid == $group->id) { echo 'selected'; } ?> ><?php echo $group->id; ?> - <?php echo $group->name; ?> </option> <?php } ?> <?php } ?> </select> </p> <?php if (adrotate_is_networked() and ($license['l'] != 'Network' or $license['l'] != 'Developer')) { ?> <p> <label for="<?php echo $this->get_field_id('siteid'); ?> "><?php _e('Site ID:', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="text" value="<?php echo $siteid; ?> " /> <br /> <small><?php _e(sprintf('The site ID from a site in the network! Leave empty or %s to use current site.', $blog_id), 'adrotate-pro'); ?> </small> </p> <?php } else { ?> <input id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="hidden" value="0" /> <?php } }
function form($instance) { global $blog_id; $defaults = array(); $instance = wp_parse_args((array) $instance, $defaults); $license = get_option('adrotate_activate'); $title = $description = $type = $adid = $siteid = ''; extract($instance); $title = esc_attr($title); $description = esc_attr($description); $type = esc_attr($type); //Try and preserve pre-fix widget IDs if (isset($id) and $adid < 1) { $adid = esc_attr($id); } else { $adid = esc_attr($adid); } $siteid = esc_attr($siteid); ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title (optional):', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /> <br /> <small><?php _e('HTML will be stripped out.', 'adrotate-pro'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('description'); ?> "><?php _e('Description (optional):', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('description'); ?> " name="<?php echo $this->get_field_name('description'); ?> " type="text" value="<?php echo $description; ?> " /> <br /> <small><?php _e('What is this widget used for? (Not parsed, HTML will be stripped out.)', 'adrotate-pro'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('type'); ?> "><?php _e('Type:', 'adrotate-pro'); ?> </label> <select class="widefat" id="<?php echo $this->get_field_id('type'); ?> " name="<?php echo $this->get_field_name('type'); ?> " class="postform"> <option value="single" <?php if ($type == "single") { echo 'selected'; } ?> ><?php _e('Single Ad - Use Ad ID', 'adrotate-pro'); ?> </option> <option value="group" <?php if ($type == "group") { echo 'selected'; } ?> ><?php _e('Group of Ads - Use group ID', 'adrotate-pro'); ?> </option> </select> <br /> <small><?php _e('Choose what you want to use this widget for', 'adrotate-pro'); ?> </small> </p> <p> <label for="<?php echo $this->get_field_id('adid'); ?> "><?php _e('Advert/Group ID:', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('adid'); ?> " name="<?php echo $this->get_field_name('adid'); ?> " type="text" value="<?php echo $adid; ?> " /> <br /> <small><?php _e('Fill in the ID of the type you want to display!', 'adrotate-pro'); ?> </small> </p> <?php if (adrotate_is_networked() and ($license['l'] != 'Network' or $license['l'] != 'Developer')) { ?> <p> <label for="<?php echo $this->get_field_id('siteid'); ?> "><?php _e('Site ID:', 'adrotate-pro'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="text" value="<?php echo $siteid; ?> " /> <br /> <small><?php _e(sprintf('The site ID from a site in the network! Leave empty or %s to use current site.', $blog_id), 'adrotate-pro'); ?> </small> </p> <?php } else { ?> <input id="<?php echo $this->get_field_id('siteid'); ?> " name="<?php echo $this->get_field_name('siteid'); ?> " type="hidden" value="0" /> <?php } }
function adrotate_support_request() { if (wp_verify_nonce($_POST['ajdg_nonce_support'], 'ajdg_nonce_support_request')) { $author = sanitize_text_field($_POST['ajdg_support_username']); $useremail = sanitize_email($_POST['ajdg_support_email']); $subject = sanitize_text_field($_POST['ajdg_support_subject']); $text = esc_attr($_POST['ajdg_support_message']); if (adrotate_is_networked()) { $a = get_site_option('adrotate_activate'); $networked = 'Yes'; } else { $a = get_option('adrotate_activate'); $networked = 'No'; } if (strlen($text) < 1 or strlen($subject) < 1 or strlen($author) < 1 or strlen($useremail) < 1) { adrotate_return('adrotate', 505); } else { $website = get_bloginfo('wpurl'); $pluginversion = ADROTATE_DISPLAY; $wpversion = get_bloginfo('version'); $wpmultisite = is_multisite() ? 'Yes' : 'No'; $pluginnetwork = $networked; $wplanguage = get_bloginfo('language'); $wpcharset = get_bloginfo('charset'); $subject = "[AdRotate Pro Support] {$subject}"; $message = "<p>Hello,</p>"; $message .= "<p>{$author} has a question about AdRotate</p>"; $message .= "<p>{$text}</p>"; $message .= "<p><strong>Additional information:</strong><br />"; $message .= "Website: {$website}<br />"; $message .= "Plugin version: {$pluginversion}<br />"; $message .= "WordPress version: {$wpversion}<br />"; $message .= "Is multisite? {$wpmultisite}<br />"; $message .= "Is networked? {$pluginnetwork}<br />"; $message .= "Language: {$wplanguage}<br />"; $message .= "Charset: {$wpcharset}"; $message .= "</p>"; $message .= "<p>You can reply to this message to contact {$author}.</p>"; $message .= "<p>Have a nice day!<br />AdRotate Support</p>"; $headers[] = "Content-Type: text/html; charset=UTF-8"; $headers[] = "Reply-To: {$useremail}"; wp_mail('*****@*****.**', $subject, $message, $headers); adrotate_return('adrotate', 701); exit; } } else { adrotate_nonce_error(); exit; } }
</form> <?php } else { ?> <p><img src="<?php echo WP_CONTENT_URL; ?> /plugins/adrotate-pro/images/icon-support.png" class="alignleft pro-image" /><?php _e('When you activate your AdRotate Pro license you can use fast and personal email support. No more queueing up in the forums. Email support is get priority over the forums and is checked 5 days per week.', 'adrotate-pro'); ?> </p> <p class="submit"> <?php if (adrotate_is_networked()) { ?> <a href="<?php echo network_admin_url('admin.php?page=adrotate'); ?> " class="button-primary"><?php _e('Activate License', 'adrotate-pro'); ?> </a> <?php } else { ?> <a href="<?php echo admin_url('admin.php?page=adrotate-settings'); ?> " class="button-primary"><?php