This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from homescriptone/develop
Prepare version 1.9.8.3
- Loading branch information
Showing
245 changed files
with
230 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
241 changes: 121 additions & 120 deletions
241
admin/class-woo-usn-admin-settings.php
100755 → 100644
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
<?php | ||
// phpcs:ignorefile | ||
|
||
use Faker\Provider\DateTime; | ||
|
||
if ( ! class_exists( 'WP_List_Table' ) ) { | ||
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; | ||
|
@@ -20,9 +17,12 @@ public function __construct() { | |
) | ||
); | ||
|
||
add_action('admin_enqueue_scripts', function() { | ||
wp_enqueue_script( 'fontawesome','https://kit.fontawesome.com/a076d05399.js', array(), uniqid(), true ); | ||
}); | ||
add_action( | ||
'admin_enqueue_scripts', | ||
function() { | ||
wp_enqueue_script( 'fontawesome', 'https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/js/fontawesome.min.js', array(), uniqid(), true ); | ||
} | ||
); | ||
|
||
} | ||
|
||
|
@@ -52,7 +52,7 @@ public static function get_customers( $per_page = 5, $page_number = 1, $paginati | |
return $wpdb->get_results( $sql, 'ARRAY_A' ); | ||
} | ||
|
||
public static function get_customer_choices( $choice='on' ) { | ||
public static function get_customer_choices( $choice = 'on' ) { | ||
|
||
global $wpdb; | ||
|
||
|
@@ -94,7 +94,7 @@ public static function record_count() { | |
|
||
/** Text displayed when no customer data is available */ | ||
public function no_items() { | ||
_e( 'No logs avaliable.', 'sp' ); | ||
esc_html_e( 'No logs avaliable.', 'ultimate-sms-notifications' ); | ||
} | ||
|
||
|
||
|
@@ -108,34 +108,33 @@ public function no_items() { | |
*/ | ||
public function column_default( $item, $column_name ) { | ||
switch ( $column_name ) { | ||
case 'customer_id': | ||
$customer_id = $item['customer_id']; | ||
$customer = new WC_Customer( $customer_id ); | ||
$fname = $customer->get_billing_first_name() . " " . $customer->get_billing_last_name(); | ||
echo wp_kses_post( '<a href="'.admin_url( 'user-edit.php?user_id='.$customer_id ) . '">'. $fname . '</a>' ); | ||
break; | ||
|
||
case 'customer_registered_page': | ||
echo ucfirst( $item['customer_registered_page']); | ||
break; | ||
|
||
case 'customer_consent': | ||
$consent = $item['customer_consent']; | ||
if ( 'on' == $consent ) { | ||
echo '<i class="fa fa-check" style="color:green;"></i>' . __( 'Subscribed', 'ultimate-sms-notifications' ); | ||
} else { | ||
echo '<i class="fa fa-times-circle" style="color:red;"></i> ' . __( 'Unsubscribed', 'ultimate-sms-notifications' ); | ||
} | ||
|
||
break; | ||
|
||
|
||
case 'date': | ||
echo wp_date('m/d/Y H:i:s', strtotime( $item['date'] )); | ||
break; | ||
case 'customer_id': | ||
$customer_id = $item['customer_id']; | ||
$customer = new WC_Customer( $customer_id ); | ||
$fname = $customer->get_billing_first_name() . ' ' . $customer->get_billing_last_name(); | ||
echo wp_kses_post( '<a href="' . admin_url( 'user-edit.php?user_id=' . $customer_id ) . '">' . $fname . '</a>' ); | ||
break; | ||
|
||
case 'customer_registered_page': | ||
echo esc_attr( ucfirst( $item['customer_registered_page'] ) ); | ||
break; | ||
|
||
case 'customer_consent': | ||
$consent = $item['customer_consent']; | ||
if ( 'on' == $consent ) { | ||
echo '<i class="fa fa-check" style="color:green;"></i>' . esc_html__( 'Subscribed', 'ultimate-sms-notifications' ); | ||
} else { | ||
echo '<i class="fa fa-times-circle" style="color:red;"></i> ' . esc_html__( 'Unsubscribed', 'ultimate-sms-notifications' ); | ||
} | ||
|
||
break; | ||
|
||
case 'date': | ||
echo wp_date( 'm/d/Y H:i:s', strtotime( $item['date'] ) ); | ||
break; | ||
|
||
default: | ||
return print_r( $item, true ); // Show the whole array for troubleshooting purposes | ||
return print_r( $item, true ); | ||
} | ||
} | ||
|
||
|
@@ -182,11 +181,11 @@ function column_name( $item ) { | |
*/ | ||
function get_columns() { | ||
$columns = array( | ||
'cb' => '<input type="checkbox" />', | ||
'customer_id' => __( 'Customer Name', 'ultimate-sms-notifications' ), | ||
'customer_registered_page' => __( 'Customer Registration Page', 'ultimate-sms-notifications' ), | ||
'customer_consent' => __( 'Customer consent', 'ultimate-sms-notifications' ), | ||
'date' => __( 'Date', 'ultimate-sms-notifications' ), | ||
'cb' => '<input type="checkbox" />', | ||
'customer_id' => __( 'Customer Name', 'ultimate-sms-notifications' ), | ||
'customer_registered_page' => __( 'Customer Registration Page', 'ultimate-sms-notifications' ), | ||
'customer_consent' => __( 'Customer consent', 'ultimate-sms-notifications' ), | ||
'date' => __( 'Date', 'ultimate-sms-notifications' ), | ||
); | ||
|
||
return $columns; | ||
|
@@ -223,8 +222,8 @@ public function prepare_items() { | |
|
||
$this->set_pagination_args( | ||
array( | ||
'total_items' => $total_items, // WE have to calculate the total number of items | ||
'per_page' => $per_page, // WE have to determine how many items to show on a page | ||
'total_items' => $total_items, // WE have to calculate the total number of items. | ||
'per_page' => $per_page, // WE have to determine how many items to show on a page. | ||
) | ||
); | ||
|
||
|
@@ -242,45 +241,40 @@ public function process_bulk_action() { | |
if ( ! wp_verify_nonce( $nonce, 'woo_usn_sms_logs_delete_nonce' ) ) { | ||
die( 'Go get a life script kiddies' ); | ||
} else { | ||
self::delete_customer( absint( $_GET['customer'] ) ); | ||
|
||
// esc_url_raw() is used to prevent converting ampersand in url to "#038;" | ||
// add_query_arg() return the current url | ||
wp_redirect( esc_url_raw( add_query_arg() ) ); | ||
exit; | ||
if ( isset( $_GET['customer'] ) ) { | ||
self::delete_customer( absint( $_GET['customer'] ) ); | ||
wp_safe_redirect( esc_url_raw( add_query_arg() ) ); | ||
exit; | ||
} | ||
} | ||
} | ||
|
||
// If the delete bulk action is triggered | ||
// If the delete bulk action is triggered. | ||
if ( ( isset( $_POST['action'] ) && $_POST['action'] == 'bulk-delete' ) | ||
|| ( isset( $_POST['action2'] ) && $_POST['action2'] == 'bulk-delete' ) | ||
) { | ||
|
||
$delete_ids = esc_sql( $_POST['bulk-delete'] ); | ||
|
||
// loop over the array of record IDs and delete them | ||
foreach ( $delete_ids as $id ) { | ||
$delete_ids = filter_input_array( INPUT_POST ); | ||
// loop over the array of record IDs and delete them. | ||
foreach ( $delete_ids['bulk-delete'] as $id ) { | ||
self::delete_customer( $id ); | ||
|
||
} | ||
|
||
// esc_url_raw() is used to prevent converting ampersand in url to "#038;" | ||
// add_query_arg() return the current url | ||
wp_redirect( esc_url_raw( add_query_arg() ) ); | ||
wp_safe_redirect( esc_url_raw( add_query_arg() ) ); | ||
exit; | ||
} | ||
} | ||
} | ||
|
||
class Woo_Usn_Subscribers_Loader { | ||
|
||
// class instance | ||
// class instance. | ||
static $instance; | ||
|
||
// customer WP_List_Table object | ||
// customer WP_List_Table object. | ||
public $customers_obj; | ||
|
||
// class constructor | ||
// class constructor. | ||
public function __construct() { | ||
add_filter( 'set-screen-option', array( __CLASS__, 'set_screen' ), 10, 3 ); | ||
} | ||
|
Oops, something went wrong.