wpdb = $wpdb; } /** * Display the main page for ads. * * @since 1.0 * @param void * @return void * */ function display_main() { // Load options $options = get_option('aswp_options'); $check_registration_status = aswp_core::check_registration(); if ($check_registration_status === FALSE || $check_registration_status === 'confirm') { if (aswp_core::registration_form('aswp_ads') !== TRUE) { return FALSE; } } $editing_ad = FALSE; // Check if user is trying to edit an ad if (isset($_GET['action']) == TRUE && $_GET['action'] == 'edit' && isset($_GET['ad']) == TRUE) { $ad_exist_result = $this->ad_id_exist($_GET['ad']); // Check if ad even exist. if ($ad_exist_result == FALSE) { echo aswp_html::admin_notice('error', __('Selected ad doesn\'t exist!', ASWP_UNIQUE_NAME)); die(); } else { // Display the edit page. $this->display_edit($ad_exist_result); $editing_ad = TRUE; } } if ($editing_ad == FALSE) { echo aswp_html::wrap_header(); // Check if user clicked on delete button. if (isset($_GET['action']) == TRUE && $_GET['action'] == 'delete' && isset($_GET['ad']) == TRUE) { // Delete the selected ad if ($this->delete_ad($_GET['ad']) == TRUE) { echo aswp_html::admin_notice('updated', __('Selected ad was successfully deleted.', ASWP_UNIQUE_NAME)); } } // Check if we have to delete one or more ads if (isset($_POST['aswp_delete_ads']) == TRUE && $_POST['aswp_delete_ads'] == 'yes' && isset($_POST['ad']) == TRUE && count($_POST['ad']) > 0) { // Delete the selected ads if ($this->delete_ads($_POST['ad']) == TRUE) { echo aswp_html::admin_notice('updated', __('Selected ads were successfully deleted.', ASWP_UNIQUE_NAME)); } } // Check if user has entered adsense pub id if (isset($options['options']['aswp_publisher_id']) == FALSE || $options['options']['aswp_publisher_id'] === '') { echo aswp_html::admin_notice('error', __('Please enter your AdSense Publisher ID on the', ASWP_UNIQUE_NAME).' '.__('options page', ASWP_UNIQUE_NAME).''); } ?>