Skip to content

Commit

Permalink
v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
navneet-cedcoss committed Mar 26, 2024
1 parent ffc0633 commit 9fcbf60
Show file tree
Hide file tree
Showing 20 changed files with 2,687 additions and 1,817 deletions.
348 changes: 230 additions & 118 deletions admin/class-points-rewards-for-woocommerce-admin.php

Large diffs are not rendered by default.

103 changes: 74 additions & 29 deletions admin/class-points-rewards-for-woocommerce-dummy-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public function __construct( $plugin_name, $version ) {
add_action( 'wps_wpr_others_settings', array( $this, 'wps_wpr_other_dummy_settings' ) );
add_filter( 'wps_rwpr_add_setting_tab', array( $this, 'wps_add_points_dummy_notification_addon_settings_tab' ), 22, 1 );
add_filter( 'wps_rwpr_add_setting_tab', array( $this, 'wps_add_api_dummy_settings_tab' ), 23, 1 );
add_filter( 'wps_wpr_others_settings', array( $this, 'wps_wpr_total_earning_dummy_points_settings' ), 10, 1 );
}

/**
Expand Down Expand Up @@ -2402,24 +2403,26 @@ public function wps_wpr_enqueue_dummy_file() {

$screen = get_current_screen();
if ( ! empty( $screen ) && ! empty( $screen->id ) ) {
if ( ! empty( $_GET['page'] ) && 'wps-rwpr-setting' == $_GET['page'] ) {

wp_register_style( 'wps_wpr_dummy_css_file', WPS_RWPR_DIR_URL . 'admin/partials/dummyfile/dummycss/wps-points-and-rewards-dummy.css', array(), '2.1.5' );
wp_enqueue_style( 'wps_wpr_dummy_css_file' );
wp_register_script( 'wps_wpr_dummy_js_file', WPS_RWPR_DIR_URL . 'admin/partials/dummyfile/dummyjs/wps-points-and-rewards-dummy.js', array(), '2.1.5', true );
wp_enqueue_script( 'wps_wpr_dummy_js_file' );
wp_localize_script(
'wps_wpr_dummy_js_file',
'wps_dummy_obj',
array(
'api_tabs' => esc_html__( 'API Settings', 'points-and-rewards-for-woocommerce' ),
'pur_points_tab' => esc_html__( 'Product Purchase Points', 'points-and-rewards-for-woocommerce' ),
'expire_tab' => esc_html__( 'Points Expiration', 'points-and-rewards-for-woocommerce' ),
'addon_tabs' => esc_html__( 'Notification Addon', 'points-and-rewards-for-woocommerce' ),
),
);
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {
if ( ! empty( $_GET['page'] ) && 'wps-rwpr-setting' == $_GET['page'] ) {

wp_register_style( 'wps_wpr_dummy_css_file', WPS_RWPR_DIR_URL . 'admin/partials/dummyfile/dummycss/wps-points-and-rewards-dummy.css', array(), '2.2.0' );
wp_enqueue_style( 'wps_wpr_dummy_css_file' );
wp_register_script( 'wps_wpr_dummy_js_file', WPS_RWPR_DIR_URL . 'admin/partials/dummyfile/dummyjs/wps-points-and-rewards-dummy.js', array(), '2.2.0', true );
wp_enqueue_script( 'wps_wpr_dummy_js_file' );
wp_localize_script(
'wps_wpr_dummy_js_file',
'wps_dummy_obj',
array(
'api_tabs' => esc_html__( 'API Settings', 'points-and-rewards-for-woocommerce' ),
'pur_points_tab' => esc_html__( 'Product Purchase Points', 'points-and-rewards-for-woocommerce' ),
'expire_tab' => esc_html__( 'Points Expiration', 'points-and-rewards-for-woocommerce' ),
'addon_tabs' => esc_html__( 'Notification Addon', 'points-and-rewards-for-woocommerce' ),
),
);

$this->wps_wpr_dummy_pro_popup();
$this->wps_wpr_dummy_pro_popup();
}
}
}
}
Expand All @@ -2430,20 +2433,62 @@ public function wps_wpr_enqueue_dummy_file() {
* @return void
*/
public function wps_wpr_dummy_pro_popup() {
if ( ! empty( $_GET['page'] ) && 'wps-rwpr-setting' == $_GET['page'] ) {
?>
<div class="wps-wpr__popup-dummy-for-pro" style="display: none;">
<div class="dummy_popup-shadow"></div>
<div class="dummy_popup-content">
<span class="dummy_popup-close dashicons dashicons-no-alt"></span>
<img src="<?php echo esc_url( WPS_RWPR_DIR_URL . 'admin/images/go-pro.png' ); ?>" alt="Go Pro Image" width="100" height="auto">
<h3><?php esc_html_e( 'To access more functionalities, try out our PRO plugin.', 'points-and-rewards-for-woocommerce' ); ?></h3>
<p><?php esc_html_e( 'Enjoy Referral Purchase Points, easy coupon generation, Multi-level Membership, and special birthday rewards. Elevate your experience!.', 'points-and-rewards-for-woocommerce' ); ?></p>
<a href="https://wpswings.com/product/points-and-rewards-for-woocommerce-plugin?utm_source=wpswings-par-pro&utm_medium=par-org-backend&utm_campaign=go-pro/" target="_blank"><?php esc_html_e( 'Go PRO Now!', 'points-and-rewards-for-woocommerce' ); ?></a>
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {
if ( ! empty( $_GET['page'] ) && 'wps-rwpr-setting' == $_GET['page'] ) {

?>
<div class="wps-wpr__popup-dummy-for-pro" style="display: none;">
<div class="dummy_popup-shadow"></div>
<div class="dummy_popup-content">
<span class="dummy_popup-close dashicons dashicons-no-alt"></span>
<img src="<?php echo esc_url( WPS_RWPR_DIR_URL . 'admin/images/go-pro.png' ); ?>" alt="Go Pro Image" width="100" height="auto">
<h3><?php esc_html_e( 'To access more functionalities, try out our PRO plugin.', 'points-and-rewards-for-woocommerce' ); ?></h3>
<p><?php esc_html_e( 'Enjoy Referral Purchase Points, easy coupon generation, Multi-level Membership, and special birthday rewards. Elevate your experience!.', 'points-and-rewards-for-woocommerce' ); ?></p>
<a href="https://wpswings.com/product/points-and-rewards-for-woocommerce-plugin?utm_source=wpswings-par-pro&utm_medium=par-org-backend&utm_campaign=go-pro/" target="_blank"><?php esc_html_e( 'Go PRO Now!', 'points-and-rewards-for-woocommerce' ); ?></a>
</div>
</div>
</div>
<?php
<?php
}
}
}

/**
* Undocumented function.
*
* @param array $wps_wpr_other_settings wps_wpr_other_settings.
* @return array
*/
public function wps_wpr_total_earning_dummy_points_settings( $wps_wpr_other_settings ) {

$other_settings = array(
array(
'title' => __( 'Display Total Earning Points', 'ultimate-woocommerce-points-and-rewards' ),
'type' => 'title',
),
array(
'title' => __( 'Toggle to show the total earning points on the Cart page', 'ultimate-woocommerce-points-and-rewards' ),
'type' => 'checkbox',
'id' => 'wps_wpr_cart_page_total_earning_points',
'class' => 'input-text wps_wpr_pro_plugin_settings',
'desc_tip' => __( 'Inform the user about the number of points they will earn by placing this order.', 'ultimate-woocommerce-points-and-rewards' ),
'default' => 0,
'desc' => __( 'Toggle this setting if you want to display the total earning points of an order on the cart page', 'ultimate-woocommerce-points-and-rewards' ),
),
array(
'title' => __( 'Toggle to show the total earning points on the Checkout page', 'ultimate-woocommerce-points-and-rewards' ),
'type' => 'checkbox',
'id' => 'wps_wpr_checkout_page_total_earning_points',
'class' => 'input-text wps_wpr_pro_plugin_settings',
'desc_tip' => __( 'Inform the user about the number of points they will earn by placing this order.', 'ultimate-woocommerce-points-and-rewards' ),
'default' => 0,
'desc' => __( 'Toggle this setting if you want to display the total earning points of an order on the checkout page', 'ultimate-woocommerce-points-and-rewards' ),
),
array(
'type' => 'sectionend',
),
);
$wps_wpr_other_settings = $this->wps_dummy_insert_keys_value_pair( $wps_wpr_other_settings, $other_settings, 25 );
return $wps_wpr_other_settings;
}

}
62 changes: 34 additions & 28 deletions admin/partials/points-rewards-for-woocommerce-admin-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,30 @@
<div class="wps_rwpr_navigator_template">
<div class="hubwoo-navigations">
<?php
$secure_nonce = wp_create_nonce( 'wps-par-admin-nonce' );
if ( ! empty( $wps_wpr_setting_tab ) && is_array( $wps_wpr_setting_tab ) ) {
foreach ( $wps_wpr_setting_tab as $key => $wps_tab ) {
if ( isset( $_GET['tab'] ) && $_GET['tab'] == $key ) {
?>
<div class="wps_rwpr_tabs">
<a class="wps_gw_nav_tab nav-tab nav-tab-active " href="?page=wps-rwpr-setting&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
</div>
<?php
} else {
if ( empty( $_GET['tab'] ) && 'overview-setting' == $key ) {
if ( wp_verify_nonce( $secure_nonce, 'wps-par-admin-nonce' ) ) {
if ( isset( $_GET['tab'] ) && $_GET['tab'] == $key ) {
?>
<div class="wps_rwpr_tabs">
<a class="wps_gw_nav_tab nav-tab nav-tab-active" href="?page=wps-rwpr-setting&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
<a class="wps_gw_nav_tab nav-tab nav-tab-active " href="?page=wps-rwpr-setting&nonce=<?php echo esc_html( wp_create_nonce( 'par_main_setting' ) ); ?>&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
</div>
<?php
} else {
?>
<div class="wps_rwpr_tabs">
<a class="wps_gw_nav_tab nav-tab " href="?page=wps-rwpr-setting&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
</div>
<?php
if ( empty( $_GET['tab'] ) && 'overview-setting' == $key ) {
?>
<div class="wps_rwpr_tabs">
<a class="wps_gw_nav_tab nav-tab nav-tab-active" href="?page=wps-rwpr-setting&nonce=<?php echo esc_html( wp_create_nonce( 'par_main_setting' ) ); ?>&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
</div>
<?php
} else {
?>
<div class="wps_rwpr_tabs">
<a class="wps_gw_nav_tab nav-tab " href="?page=wps-rwpr-setting&nonce=<?php echo esc_html( wp_create_nonce( 'par_main_setting' ) ); ?>&tab=<?php echo esc_html( $key ); ?>"><?php echo esc_html( $wps_tab['title'] ); ?></a>
</div>
<?php
}
}
}
}
Expand All @@ -158,23 +161,26 @@
<img src="<?php echo esc_url( WPS_RWPR_DIR_URL ); ?>public/images/loading.gif">
</div>
<?php
$secure_nonce = wp_create_nonce( 'wps-par-admin-nonce' );
if ( ! empty( $wps_wpr_setting_tab ) && is_array( $wps_wpr_setting_tab ) ) {

foreach ( $wps_wpr_setting_tab as $key => $wps_file ) {
if ( isset( $_GET['tab'] ) && $_GET['tab'] == $key ) {
$include_tab = $wps_file['file_path'];
?>
<div class="wps_rwpr_content_template">
<?php include_once $include_tab; ?>
</div>
<?php
} elseif ( empty( $_GET['tab'] ) && 'overview-setting' == $key ) {
?>
<div class="wps_rwpr_content_template">
<?php include_once $wps_file['file_path']; ?>
</div>
<?php
break;
if ( wp_verify_nonce( $secure_nonce, 'wps-par-admin-nonce' ) ) {
if ( isset( $_GET['tab'] ) && $_GET['tab'] == $key ) {
$include_tab = $wps_file['file_path'];
?>
<div class="wps_rwpr_content_template">
<?php include_once $include_tab; ?>
</div>
<?php
} elseif ( empty( $_GET['tab'] ) && 'overview-setting' == $key ) {
?>
<div class="wps_rwpr_content_template">
<?php include_once $wps_file['file_path']; ?>
</div>
<?php
break;
}
}
}
}
Expand Down
39 changes: 22 additions & 17 deletions admin/partials/templates/class-membership-log-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,28 @@ public function prepare_items() {
* @param array $cloumnb .
*/
public function wps_wpr_usort_reorder( $cloumna, $cloumnb ) {
$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) : 'id';
$order = ( ! empty( $_REQUEST['order'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : 'desc';
if ( is_numeric( $cloumna[ $orderby ] ) && is_numeric( $cloumnb[ $orderby ] ) ) {
if ( $cloumna[ $orderby ] == $cloumnb[ $orderby ] ) {
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {

return 0;
} elseif ( $cloumna[ $orderby ] < $cloumnb[ $orderby ] ) {
$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) : 'id';
$order = ( ! empty( $_REQUEST['order'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : 'desc';
if ( is_numeric( $cloumna[ $orderby ] ) && is_numeric( $cloumnb[ $orderby ] ) ) {
if ( $cloumna[ $orderby ] == $cloumnb[ $orderby ] ) {

$result = -1;
return ( 'asc' === $order ) ? $result : -$result;
} elseif ( $cloumna[ $orderby ] > $cloumnb[ $orderby ] ) {
return 0;
} elseif ( $cloumna[ $orderby ] < $cloumnb[ $orderby ] ) {

$result = -1;
return ( 'asc' === $order ) ? $result : -$result;
} elseif ( $cloumna[ $orderby ] > $cloumnb[ $orderby ] ) {

$result = 1;
return ( 'asc' === $order ) ? $result : -$result;
}
} else {

$result = 1;
$result = strcmp( $cloumna[ $orderby ], $cloumnb[ $orderby ] );
return ( 'asc' === $order ) ? $result : -$result;
}
} else {

$result = strcmp( $cloumna[ $orderby ], $cloumnb[ $orderby ] );
return ( 'asc' === $order ) ? $result : -$result;
}
}

Expand Down Expand Up @@ -247,9 +250,11 @@ public function get_users_points() {
),
);

if ( isset( $_REQUEST['s'] ) ) {
$data = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
$args['search'] = '*' . $data . '*';
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {
if ( isset( $_REQUEST['s'] ) ) {
$data = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
$args['search'] = '*' . $data . '*';
}
}

$user_data = new WP_User_Query( $args );
Expand Down
73 changes: 56 additions & 17 deletions admin/partials/templates/class-points-log-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,25 +292,27 @@ public function prepare_items() {
*/
public function wps_wpr_usort_reorder( $cloumna, $cloumnb ) {

$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) : 'id';
$order = ( ! empty( $_REQUEST['order'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : 'desc';
if ( is_numeric( $cloumna[ $orderby ] ) && is_numeric( $cloumnb[ $orderby ] ) ) {
if ( $cloumna[ $orderby ] == $cloumnb[ $orderby ] ) {
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {
$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ) : 'id';
$order = ( ! empty( $_REQUEST['order'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : 'desc';
if ( is_numeric( $cloumna[ $orderby ] ) && is_numeric( $cloumnb[ $orderby ] ) ) {
if ( $cloumna[ $orderby ] == $cloumnb[ $orderby ] ) {

return 0;
} elseif ( $cloumna[ $orderby ] < $cloumnb[ $orderby ] ) {
return 0;
} elseif ( $cloumna[ $orderby ] < $cloumnb[ $orderby ] ) {

$result = -1;
return ( 'asc' === $order ) ? $result : -$result;
} elseif ( $cloumna[ $orderby ] > $cloumnb[ $orderby ] ) {
$result = -1;
return ( 'asc' === $order ) ? $result : -$result;
} elseif ( $cloumna[ $orderby ] > $cloumnb[ $orderby ] ) {

$result = 1;
$result = 1;
return ( 'asc' === $order ) ? $result : -$result;
}
} else {

$result = strcmp( $cloumna[ $orderby ], $cloumnb[ $orderby ] );
return ( 'asc' === $order ) ? $result : -$result;
}
} else {

$result = strcmp( $cloumna[ $orderby ], $cloumnb[ $orderby ] );
return ( 'asc' === $order ) ? $result : -$result;
}
}

Expand Down Expand Up @@ -351,10 +353,12 @@ public function get_users_points( $current_page, $per_page ) {
'fields' => 'ID',
);

if ( isset( $_REQUEST['s'] ) ) {
if ( wp_verify_nonce( ! empty( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : '', 'par_main_setting' ) ) {
if ( isset( $_REQUEST['s'] ) ) {

$wps_request_search = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
$args['search'] = '*' . $wps_request_search . '*';
$wps_request_search = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) );
$args['search'] = '*' . $wps_request_search . '*';
}
}

$user_data = new WP_User_Query( $args );
Expand Down Expand Up @@ -1417,6 +1421,41 @@ public function get_users_points( $current_page, $per_page ) {
</div>
<?php
}
if ( array_key_exists( 'wps_vendor_commissions_amount', $point_log ) ) {
?>
<div class="wps_wpr_slide_toggle">
<p class="wps_wpr_view_log_notice wps_wpr_common_slider" ><?php esc_html_e( 'Vendor commission points', 'points-and-rewards-for-woocommerce' ); ?>
<a class ="wps_wpr_open_toggle" href="javascript:;"></a>
</p>
<table class = "form-table mwp_wpr_settings wps_wpr_points_view wps_wpr_common_table">
<thead>
<tr valign="top">
<th scope="row" class="wps_wpr_head_titledesc">
<span class="wps_wpr_nobr"><?php echo esc_html__( 'Date & Time', 'points-and-rewards-for-woocommerce' ); ?></span>
</th>
<th scope="row" class="wps_wpr_head_titledesc">
<span class="wps_wpr_nobr"><?php echo esc_html__( 'Point Status', 'points-and-rewards-for-woocommerce' ); ?></span>
</th>
<th scope="row" class="wps_wpr_head_titledesc">
<span class="wps_wpr_nobr"><?php echo esc_html__( 'Order No.', 'points-and-rewards-for-woocommerce' ); ?></span>
</th>
</tr>
</thead>
<?php
foreach ( $point_log['wps_vendor_commissions_amount'] as $key => $value ) {
?>
<tr valign="top">
<td class="forminp forminp-text"><?php echo esc_html( $value['date'] ); ?></td>
<td class="forminp forminp-text"><?php echo '+' . esc_html( $value['wps_vendor_commissions_amount'] ); ?> </td>
<td class="forminp forminp-text"><?php echo esc_html( $value['order_id'] ); ?> </td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}
if ( array_key_exists( 'member_assign_rewards_points', $point_log ) ) {
?>
<div class="wps_wpr_slide_toggle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*/
function wps_wpr_rand_color() {

return '#' . str_pad( dechex( mt_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT );
return '#' . str_pad( dechex( wp_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT );
}
?>

Expand Down
Loading

0 comments on commit 9fcbf60

Please sign in to comment.