Skip to content

Commit

Permalink
Remove pro features
Browse files Browse the repository at this point in the history
  • Loading branch information
kawsarahmedr committed Jul 30, 2024
1 parent f75e8d7 commit b09fd43
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 956 deletions.
1 change: 0 additions & 1 deletion includes/Admin/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,5 @@ public static function save_donation_meta( $product_id ) {
update_post_meta( $product_id, '_wcdm_min_amount', ( ! empty( $_POST['_wcdm_min_amount'] ) && is_numeric( $_POST['_wcdm_min_amount'] ) ? floatval( wp_unslash( $_POST['_wcdm_min_amount'] ) ) : get_option( 'wcdm_minimum_amount' ) ) );
update_post_meta( $product_id, '_wcdm_max_amount', ( ! empty( $_POST['_wcdm_max_amount'] ) && is_numeric( $_POST['_wcdm_max_amount'] ) ? floatval( wp_unslash( $_POST['_wcdm_max_amount'] ) ) : get_option( 'wcdm_maximum_amount' ) ) );
update_post_meta( $product_id, '_wcdm_campaign_id', ( ! empty( $_POST['_wcdm_campaign_id'] ) ? sanitize_text_field( wp_unslash( $_POST['_wcdm_campaign_id'] ) ) : '' ) );
update_post_meta( $product_id, '_wcdm_campaign_cause', ( ! empty( $_POST['_wcdm_campaign_cause'] ) ? sanitize_text_field( wp_unslash( $_POST['_wcdm_campaign_cause'] ) ) : '' ) );
}
}
2 changes: 1 addition & 1 deletion includes/Admin/ListTables/CampaignsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function prepare_items() {
$sortable = $this->get_sortable_columns();
$hidden = $this->get_hidden_columns();
$this->_column_headers = array( $columns, $hidden, $sortable );
$per_page = get_option( 'posts_per_page' );
$per_page = $this->get_items_per_page( 'wcdm_campaigns_per_page', 20 );
$order_by = isset( $_GET['orderby'] ) ? sanitize_key( wp_unslash( $_GET['orderby'] ) ) : '';
$order = isset( $_GET['order'] ) ? sanitize_key( wp_unslash( $_GET['order'] ) ) : '';
$search = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : '';
Expand Down
195 changes: 0 additions & 195 deletions includes/Admin/ListTables/DonorsListTable.php

This file was deleted.

127 changes: 4 additions & 123 deletions includes/Admin/Menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,10 @@ public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_filter( 'set-screen-option', array( $this, 'screen_option' ), 10, 3 );
add_action( 'current_screen', array( $this, 'setup_list_table' ) );

add_action( 'wc_donation_manager_campaigns_content', array( $this, 'render_campaigns_content' ) );

// Settings tabs.
add_action( 'wc_donation_manager_settings_tutorial_content', array( $this, 'render_tutorial_content' ) );

// Pro tabs.
if ( ! WCDM()->is_plugin_active( 'wc-donation-manager-pro.php' ) ) {
if ( ! WCDM()->is_plugin_active( 'wc-donation-manager-pro' ) ) {
add_action( 'wc_donation_manager_donors_content', array( $this, 'render_donors_content' ) );
add_action( 'wc_donation_manager_settings_emails_content', array( $this, 'render_emails_settings' ) );
}
Expand Down Expand Up @@ -131,9 +127,9 @@ public function screen_option( $status, $option, $value ) {
'wc_donation_manager_screen_options',
array(
'wcdm_campaigns_per_page',
'wcdm_donors_per_page',
)
);

if ( in_array( $option, $options, true ) ) {
return $value;
}
Expand Down Expand Up @@ -167,12 +163,6 @@ public function setup_list_table() {
$args['option'] = 'wcdm_campaigns_per_page';
add_screen_option( 'per_page', $args );
break;
case 'wcdm-donors':
$this->list_table = new ListTables\DonorsListTable();
$this->list_table->prepare_items();
$args['option'] = 'wcdm_donors_per_page';
add_screen_option( 'per_page', $args );
break;
}
}

Expand Down Expand Up @@ -207,7 +197,7 @@ public function render_campaigns_content() {
* @return void
*/
public function render_donors_content() {
include __DIR__ . '/views/donors/donors.php';
echo esc_html__( 'The donors list table is a PRO module!', 'wc-donation-manager' );
}

/**
Expand All @@ -217,115 +207,6 @@ public function render_donors_content() {
* @return void
*/
public function render_emails_settings() {
$mailer = WC()->mailer();
$email_templates = $mailer->get_emails();

$donation_emails = array_filter(
$email_templates,
function ( $email ) {
// Check if class name contains 'WC_Donation_Order_Email'.
return str_contains( get_class( $email ), 'WC_Donation_Order_Email' );
}
);

if ( ! empty( $donation_emails ) ) {
?>
<tr valign="top">
<td class="wc_emails_wrapper" colspan="2">
<table class="wc_emails widefat" cellspacing="0">
<thead>
<tr>
<?php
$columns = apply_filters(
'woocommerce_email_setting_columns',
array(
'status' => '',
'name' => __( 'Email', 'wc-donation-manager' ),
'email_type' => __( 'Content type', 'wc-donation-manager' ),
'recipient' => __( 'Recipient(s)', 'wc-donation-manager' ),
'actions' => '',
)
);
foreach ( $columns as $key => $column ) {
echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
}
?>
</tr>
<tbody>
<?php

foreach ( $donation_emails as $email_key => $email ) {
echo '<tr>';

$manage_url = add_query_arg(
array(
'section' => strtolower( $email_key ),
),
admin_url( 'admin.php?page=wc-settings&tab=email' )
);

foreach ( $columns as $key => $column ) {

switch ( $key ) {
case 'name':
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
<a href="' . esc_url( $manage_url ) . '">' . esc_html( $email->get_title() ) . '</a>
' . wc_help_tip( $email->get_description() ) . '</td>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
break;
case 'recipient':
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
' . esc_html( $email->is_customer_email() ? __( 'Customer', 'wc-donation-manager' ) : $email->get_recipient() ) . '</td>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
break;
case 'status':
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';

if ( $email->is_manual() ) {
echo '<span class="status-manual tips" data-tip="' . esc_attr__( 'Manually sent', 'wc-donation-manager' ) . '">' . esc_html__( 'Manual', 'wc-donation-manager' ) . '</span>';
} elseif ( $email->is_enabled() ) {
echo '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Enabled', 'wc-donation-manager' ) . '">' . esc_html__( 'Yes', 'wc-donation-manager' ) . '</span>';
} else {
echo '<span class="status-disabled tips" data-tip="' . esc_attr__( 'Disabled', 'wc-donation-manager' ) . '">-</span>';
}

echo '</td>';
break;
case 'email_type':
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
' . esc_html( $email->get_content_type() ) . '
</td>';
break;
case 'actions':
echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
<a class="button alignright" href="' . esc_url( $manage_url ) . '">' . esc_html__( 'Manage', 'wc-donation-manager' ) . '</a>
</td>';
break;
default:
do_action( 'woocommerce_email_setting_column_' . $key, $email );
break;
}
}

echo '</tr>';
}
?>
</tbody>
</table>
</td>
</tr>
<?php
} else {
esc_html_e( 'No email templates found.', 'wc-donation-manager' );
}
}

/**
* Render settings - tutorial tab content.
*
* @since 1.0.0
* @return void
*/
public function render_tutorial_content() {
// TODO: Tutorials content will be appear here.
esc_html_e( 'Lorem lipsum is a dollar site. Update this text first then use it.', 'wc-donation-manager' );
echo esc_html__( 'The donation emails is a PRO module!', 'wc-donation-manager' );
}
}
Loading

0 comments on commit b09fd43

Please sign in to comment.