From 9192a4f5e8311780bcf1b3869926bcf754b72cb0 Mon Sep 17 00:00:00 2001 From: Abhishek Awasthi Date: Mon, 21 Jun 2021 12:11:10 +0530 Subject: [PATCH] Export Feature --- paytm-donation/csv_export.php | 109 ------------------ .../includes/PaytmConstantsDonation.php | 4 +- paytm-donation/paytm-donation-listings.php | 4 - 3 files changed, 2 insertions(+), 115 deletions(-) delete mode 100755 paytm-donation/csv_export.php diff --git a/paytm-donation/csv_export.php b/paytm-donation/csv_export.php deleted file mode 100755 index 5f8a9b6..0000000 --- a/paytm-donation/csv_export.php +++ /dev/null @@ -1,109 +0,0 @@ -generate_csv(); - -header("Pragma: public"); -header("Expires: 0"); -header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); -header("Cache-Control: private", false); -header("Content-Type: application/octet-stream"); -header("Content-Disposition: attachment; filename=\"report.csv\";" ); -header("Content-Transfer-Encoding: binary"); - -echo $csv; -exit; -} - -// Add extra menu items for admins -add_action('admin_menu', array($this, 'admin_menu')); - -// Create end-points -add_filter('query_vars', array($this, 'query_vars')); -add_action('parse_request', array($this, 'parse_request')); -} - -/** -* Add extra menu items for admins -*/ -public function admin_menu() -{ -add_menu_page('Download Report', 'Download Report', 'manage_options', 'download_report', array($this, 'download_report')); -} - -/** -* Allow for custom query variables -*/ -public function query_vars($query_vars) -{ -$query_vars[] = 'download_report'; -return $query_vars; -} - -/** -* Parse the request -*/ -public function parse_request(&$wp) -{ -if(array_key_exists('download_report', $wp->query_vars)) -{ -$this->download_report(); -exit; -} -} - -/** -* Download report -*/ -public function download_report() -{ -echo '
'; -echo '
-
'; -echo '

Download Report

'; -//$url = site_url(); - -echo '

Export the Subscribers'; -} - -/** -* Converting data to CSV -*/ -public function generate_csv() -{ -$csv_output = ''; -$table = 'users'; - -$result = mysql_query("SHOW COLUMNS FROM ".$table.""); - -$i = 0; -if (mysql_num_rows($result) > 0) { -while ($row = mysql_fetch_assoc($result)) { -$csv_output = $csv_output . $row['Field'].","; -$i++; -} -} -$csv_output .= "\n"; - -$values = mysql_query("SELECT * FROM ".$table.""); -while ($rowr = mysql_fetch_row($values)) { -for ($j=0;$j<$i;$j++) { -$csv_output .= $rowr[$j].","; -} -$csv_output .= "\n"; -} - -return $csv_output; -} -} - -// Instantiate a singleton of this plugin -$csvExport = new CSVExport(); diff --git a/paytm-donation/includes/PaytmConstantsDonation.php b/paytm-donation/includes/PaytmConstantsDonation.php index 75ed635..f10d9f7 100755 --- a/paytm-donation/includes/PaytmConstantsDonation.php +++ b/paytm-donation/includes/PaytmConstantsDonation.php @@ -19,8 +19,8 @@ class PaytmConstantsDonation{ CONST CONNECT_TIMEOUT = 10; CONST TIMEOUT = 10; - CONST LAST_UPDATED = "202106018"; - CONST PLUGIN_VERSION = "2.6"; + CONST LAST_UPDATED = "20210621"; + CONST PLUGIN_VERSION = "2.7"; CONST PLUGIN_DOC_URL = "https://developer.paytm.com/docs/eCommerce-plugin/wordpress/"; CONST CUSTOM_CALLBACK_URL = ""; diff --git a/paytm-donation/paytm-donation-listings.php b/paytm-donation/paytm-donation-listings.php index e816efe..a661923 100755 --- a/paytm-donation/paytm-donation-listings.php +++ b/paytm-donation/paytm-donation-listings.php @@ -11,7 +11,6 @@ public function __construct() { global $wpdb; - //echo "

";print_r($_GET);die;
 			if(isset($_GET['filter_action'])){
 				if(!empty($_GET['payment_status'])){
 					$filter1 = "and payment_status = '".$_GET['payment_status']."'";
@@ -25,7 +24,6 @@ public function __construct()
 					$filter2 = "";
 				}
 				$donationEntries = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "paytm_donation where 1 ".$filter1.$filter2."  order by date desc", ARRAY_A);
-				//echo $wpdb->last_query;die;
 			}else{
 				$donationEntries = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "paytm_donation order by date desc", ARRAY_A);
 			}
@@ -140,7 +138,6 @@ function wp_paytm_donation_listings_page() {
 		
 	";print_r($_GET);
 			$records_per_page = 10;
 			$page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;
 			$str = '';
@@ -161,7 +158,6 @@ function wp_paytm_donation_listings_page() {
 				}
 				$donationEntries = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "paytm_donation where 1 ".$filter1.$filter2."  order by date desc limit ".$offset. " , ".$records_per_page);
 				$total = $wpdb->get_var("SELECT COUNT(id)  FROM " . $wpdb->prefix . "paytm_donation where 1 ".$filter1.$filter2."");
-				//echo $wpdb->last_query;die;
 			}else{
 				$donationEntries = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "paytm_donation order by date desc limit ".$offset. " , ".$records_per_page);
 				$total = $wpdb->get_var("SELECT COUNT(id)  FROM " . $wpdb->prefix . "paytm_donation");