prefix.'campaigns';
if( $_GET['action'] == 'delete' || $_GET['delete']) {
if( $_GET['action'] ) { $dIDs = $wpdb->escape($_GET['donor']); }
$mngpg = get_option('siteurl').'/wp-admin/admin.php?page=ViewAllHandle';
if( $_GET['delete'] ) { $dIDs[] = $wpdb->escape($_GET['delete']); }
foreach( $dIDs as $dID ) {
$del = "DELETE FROM $tb WHERE camp_id = $dID LIMIT 1";
//echo $del; //exit;
$wpdb->query($del);
$msg = 2;
} // End of foreach loop
header("Location : $mngpg&msg=2");
}
}
$donate_version = "1.0";
include_once('dpay-widget.php');
if( !class_exists('MyWpDonate') )
{
class MyWpDonate{
function MyWpDonate() { //constructor
//ACTIONS
//Add Menu in Left Side bar
add_action( 'admin_menu', array($this, 'my_plugin_menu') );
// add_action( 'admin_head', array($this, 'icon_css') );
#Update Settings on Save
if( $_POST['action'] == 'camp_add' )
add_action( 'init', array($this,'SaveNewCampaign') );
if( $_POST['action'] == 'camp_edit' )
add_action( 'init', array($this,'SaveEditCampaign') );
# Update General Settings
if( $_POST['action'] == 'pay_update' )
add_action( 'init', array($this,'saveGeneralSettings') );
#Save Default Settings
//add_action( 'init', array($this, 'DefaultSettings') );
#Uninstall Donate Plus
if( $_POST['action'] == 'dplus_delete' )
add_action( 'init', array($this,'UninstallDP') );
//SHORTCODES
#Add Form Shortcode
add_shortcode('wpdonatebuy', array($this, 'MyDonatePage') );
add_shortcode('wpdonategoal', array($this, 'showdonategoal') );
add_shortcode('wpdonatecollected', array($this, 'donationcollection') );
add_shortcode('wpdonatemeter', array($this, 'donatemeter') );
add_shortcode('confirmdonation', array($this, 'confirmdonation') );
add_shortcode('wpdonatorlist', array($this, 'donatorlist') );
add_action( 'wp_head', array($this, 'email_js') );
//INSTALL TABLE
#Runs the database installation for the wp_donations table
register_activation_hook( __FILE__, array($this, 'MyDonateInstall') );
}
function my_plugin_menu() {
global $objDonate;
add_menu_page('Donation Goals', 'Donation Goals', 'manage_options', 'MyDonate', array($objDonate, 'ViewAllCampaign'), 'div' );
add_submenu_page( 'MyDonate', 'Donation Goals | View All Campaigns', 'View All Campaigns', 'manage_options', 'ViewAllHandle', array($objDonate, 'ViewAllCampaign'));
add_submenu_page( 'MyDonate', 'Donation Goals | Add Campaign', 'Add Campaign', 'manage_options', 'AddCampaignHandle', array($objDonate, 'AddCampaign'));
add_submenu_page( 'MyDonate', 'Donation Goals | General Settings', 'General Settings', 'manage_options', 'GeneralSettings', array($objDonate, 'GeneralSttings'));
//add_menu_page('Page title', 'Top-level menu title', 'manage_options', 'my-top-level-handle', 'my_magic_function');
//add_submenu_page( 'my-top-level-handle', 'Page title', 'Sub-menu title', 'manage_options', 'my-submenu-handle', 'my_magic_function');
}
function email_js() {
echo '';
}
// View All Campaign
function ViewAllCampaign()
{
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
if($_GET["dID"] != "" ) {
$this->ViewDonation();
} else {
global $wpdb;
$table_name = $wpdb->prefix.'campaigns';
$mngpg = get_option('siteurl').'/wp-admin/admin.php?page=ViewAllHandle';
$editpg=get_option('siteurl').'/wp-admin/admin.php?page=AddCampaignHandle';
$campaigns = $wpdb->get_results("SELECT * FROM $table_name ORDER BY camp_id DESC");
if( $_GET['s'] ):
$s = $wpdb->escape($_GET['s']);
$sq = "SELECT * FROM $table_name WHERE camp_name LIKE '%$s%' ORDER BY camp_id DESC";
$campaigns = $wpdb->get_results($sq);
endif;
$don_table_name = $wpdb->prefix.'donation';
?>
Campaign successfully deleted.
';
}
?>
prefix.'campaigns';
$DtableName = $wpdb->prefix.'donation';
$mngpg = get_option('siteurl').'/wp-admin/admin.php?page=ViewAllHandle&dID='.$dId;
$editpg=get_option('siteurl').'/wp-admin/admin.php?page=AddCampaignHandle';
$campaigns = $wpdb->get_results("SELECT * FROM $table_name WHERE camp_id=$dId");
$donations = $wpdb->get_results("SELECT * FROM $DtableName WHERE don_camp_id=$dId");
if( $_GET['s'] ):
$s = $wpdb->escape($_GET['s']);
$sq = "SELECT * FROM $DtableName WHERE don_first_name LIKE '%$s%' OR don_last_name LIKE '%$s%' OR don_email LIKE '%$s%' ORDER BY don_id ASC";
$donations = $wpdb->get_results($sq);
endif;
?>