diff --git a/assets/src/css/frontend-common.scss b/assets/src/css/frontend-common.scss
index 722d08d..7d95533 100644
--- a/assets/src/css/frontend-common.scss
+++ b/assets/src/css/frontend-common.scss
@@ -10,6 +10,14 @@
width: 100%;
}
}
+ .campaign-cause{
+ ul{
+ margin-bottom: 0;
+ }
+ p{
+ margin-bottom: 0;
+ }
+ }
.suggested-amounts {
display: grid;
grid-template-columns: repeat(4, 1fr);
@@ -69,3 +77,63 @@
align-self: center;
}
}
+//Frontend donation progressbar
+.wcdm-progress-bar {
+ width: 100%;
+ margin-bottom: 10px;
+ .donation-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 14px;
+ }
+
+ .donation-title {
+ font-size: 16px;
+ font-weight: 700;
+ color: #1e293b;
+ }
+
+ .donation-percent {
+ font-size: 20px;
+ font-weight: 700;
+ background: #10B981;
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ }
+
+ .progress-wrapper {
+ width: 100%;
+ height: 14px;
+ background: #e2e8f0;
+ border-radius: 999px;
+ overflow: hidden;
+ position: relative;
+ }
+
+ .progress-bar {
+ width: 0;
+ height: 100%;
+ border-radius: 999px;
+ transition: width 1s ease;
+
+ background:#10B981;
+ }
+
+ .donation-info {
+ display: flex;
+ justify-content: space-between;
+ margin-top: 14px;
+ font-size: 14px;
+ color: #64748b;
+ }
+
+ .amount {
+ font-weight: 700;
+ color: #0f172a;
+ }
+}
+//Donation product donation button
+.wcdm-donation-button{
+ background-color: #10B981 !important;
+}
diff --git a/assets/src/js/admin-common.js b/assets/src/js/admin-common.js
index 96f85c2..72737a0 100644
--- a/assets/src/js/admin-common.js
+++ b/assets/src/js/admin-common.js
@@ -5,11 +5,11 @@
* Copyright (c) 2025 PluginEver
* Licensed under the GPLv2+ license.
*/
-s
/*jslint browser: true */
/*global jQuery:false */
jQuery(document).ready(function ($) {
'use strict';
+
$.wc_donation_manager = {
init: function () {
$('#donation_products').select2({
@@ -45,4 +45,38 @@ jQuery(document).ready(function ($) {
};
$.wc_donation_manager.init();
+
+ // Helper function to show admin error
+ function wcdm_show_admin_error(message) {
+ $('.wcdm-admin-error').remove();
+ var $notice = $('
');
+ $('.wrap').first().prepend($notice);
+ $('html, body').animate({scrollTop: $('.wrap').first().offset().top - 50}, 200);
+ }
+
+ // Validate on product save
+ $('#post').on('submit', function (e) {
+ var prodType = $('#product-type').val() || $('select[name="product-type"]').val() || $('input[name="product-type"]').val();
+ if (prodType !== 'donation') return true;
+
+ var min = parseFloat($('#wcdm_min_amount').val());
+ var max = parseFloat($('#wcdm_max_amount').val());
+ min = isNaN(min) ? 0 : min;
+ max = isNaN(max) ? 0 : max;
+ var campaign = $('#wcdm_campaign_id').val() || $('select[name="wcdm_campaign_id"]').val();
+
+ if (!campaign || campaign === '0' || parseInt(campaign, 10) <= 0) {
+ e.preventDefault();
+ wcdm_show_admin_error((typeof wcdm_admin_vars !== 'undefined' && wcdm_admin_vars.i18n && wcdm_admin_vars.i18n.select_campaign_error) ? wcdm_admin_vars.i18n.select_campaign_error : 'Please select a campaign for donation products.');
+ return false;
+ }
+
+ if (min > 0 && max > 0 && min > max) {
+ e.preventDefault();
+ wcdm_show_admin_error((typeof wcdm_admin_vars !== 'undefined' && wcdm_admin_vars.i18n && wcdm_admin_vars.i18n.min_gt_max_error) ? wcdm_admin_vars.i18n.min_gt_max_error : 'Minimum amount cannot be greater than maximum amount.');
+ return false;
+ }
+
+ return true;
+ });
});
diff --git a/assets/src/js/frontend-common.js b/assets/src/js/frontend-common.js
index 4756026..0d4eea1 100644
--- a/assets/src/js/frontend-common.js
+++ b/assets/src/js/frontend-common.js
@@ -28,5 +28,37 @@
}
});
});
+
+ $('.wcdm-progress-bar').each(function () {
+
+ const $progressCard = $(this);
+
+ const raised = parseFloat($progressCard.attr('data-raised')) || 0;
+ const goal = parseFloat($progressCard.attr('data-goal')) || 0;
+ const currency = $progressCard.attr('data-currency') || '$';
+
+ const percentage = goal > 0
+ ? Math.min((raised / goal) * 100, 100)
+ : 0;
+
+ console.log(percentage);
+
+
+ $progressCard
+ .find('.progress-bar')
+ .css('width', percentage + '%');
+
+ $progressCard
+ .find('.donation-percent')
+ .text(Math.round(percentage) + '%');
+
+ $progressCard
+ .find('.raised-amount')
+ .text(currency + raised.toLocaleString());
+
+ $progressCard
+ .find('.goal-amount')
+ .text(currency + goal.toLocaleString());
+ });
});
}(jQuery));
diff --git a/composer.json b/composer.json
index de54ed6..55e285a 100644
--- a/composer.json
+++ b/composer.json
@@ -5,7 +5,7 @@
"repositories": [
{
"type": "vcs",
- "url": "git@github.com:byteever/bytekit-plugin.git"
+ "url": "git@github.com:byteever/plugin.git"
},
{
"type": "vcs",
@@ -14,7 +14,7 @@
],
"require": {
"php": ">=7.4",
- "byteever/bytekit-plugin": "dev-trunk",
+ "byteever/plugin": "dev-trunk",
"byteever/bytekit-settings": "dev-trunk"
},
"require-dev": {
@@ -52,7 +52,7 @@
"namespace_prefix": "WooCommerceDonationManager\\",
"classmap_prefix": "WooCommerceDonationManager__",
"packages": [
- "byteever/bytekit-plugin",
+ "byteever/plugin",
"byteever/bytekit-settings"
]
}
diff --git a/includes/Admin/Actions.php b/includes/Admin/Actions.php
index 9a96dbf..0c14a39 100644
--- a/includes/Admin/Actions.php
+++ b/includes/Admin/Actions.php
@@ -14,7 +14,6 @@
* @package WooCommerceDonationManager
*/
class Actions {
-
/**
* Actions constructor.
*
@@ -37,7 +36,7 @@ public static function add_campaign() {
$referer = wp_get_referer();
$name = isset( $_POST['name'] ) ? sanitize_text_field( wp_unslash( $_POST['name'] ) ) : '';
- $cause = isset( $_POST['cause'] ) ? sanitize_textarea_field( wp_unslash( $_POST['cause'] ) ) : '';
+ $cause = isset( $_POST['cause'] ) ? wp_kses_post( wp_unslash( $_POST['cause'] ) ) : '';
$goal_amount = isset( $_POST['goal_amount'] ) ? floatval( wp_unslash( $_POST['goal_amount'] ) ) : floatval( '0' );
$end_date = isset( $_POST['end_date'] ) ? sanitize_text_field( wp_unslash( $_POST['end_date'] ) ) : '';
$status = isset( $_POST['status'] ) ? sanitize_key( wp_unslash( $_POST['status'] ) ) : 'pending';
@@ -47,7 +46,7 @@ public static function add_campaign() {
'ID' => $id,
'post_type' => 'wcdm_campaigns',
'post_title' => wp_strip_all_tags( $name ),
- 'post_content' => wp_kses_post( $cause ),
+ 'post_content' => $cause,
'post_status' => $status,
'meta_input' => array(
'wcdm_goal_amount' => $goal_amount,
@@ -83,7 +82,7 @@ public static function edit_campaign() {
$referer = wp_get_referer();
$name = isset( $_POST['name'] ) ? sanitize_text_field( wp_unslash( $_POST['name'] ) ) : '';
- $cause = isset( $_POST['cause'] ) ? sanitize_textarea_field( wp_unslash( $_POST['cause'] ) ) : '';
+ $cause = isset( $_POST['cause'] ) ? wp_kses_post( wp_unslash( $_POST['cause'] ) ) : '';
$goal_amount = isset( $_POST['goal_amount'] ) ? floatval( wp_unslash( $_POST['goal_amount'] ) ) : floatval( '0' );
$end_date = isset( $_POST['end_date'] ) ? sanitize_text_field( wp_unslash( $_POST['end_date'] ) ) : '';
$status = isset( $_POST['status'] ) ? sanitize_key( wp_unslash( $_POST['status'] ) ) : 'pending';
@@ -108,7 +107,6 @@ public static function edit_campaign() {
} else {
WCDM()->flash->success( __( 'Campaign updated successfully.', 'wc-donation-manager' ) );
}
-
wp_safe_redirect( $referer );
exit;
}
diff --git a/includes/Admin/Admin.php b/includes/Admin/Admin.php
index ea79ef9..3a8dce7 100644
--- a/includes/Admin/Admin.php
+++ b/includes/Admin/Admin.php
@@ -2,6 +2,8 @@
namespace WooCommerceDonationManager\Admin;
+use WooCommerceDonationManager\Plugin;
+
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
/**
@@ -11,13 +13,22 @@
* @package WooCommerceDonationManager\Admin
*/
class Admin {
+ /**
+ * Plugin instance.
+ *
+ * @var Plugin
+ */
+ protected Plugin $plugin;
/**
- * Admin constructor.
+ * Admin Class constructor.
*
* @since 1.0.0
+ *
+ * @param Plugin $plugin Plugin instance.
*/
- public function __construct() {
+ public function __construct( Plugin $plugin ) {
+ $this->plugin = $plugin;
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_filter( 'woocommerce_screen_ids', array( $this, 'add_screen_ids' ) );
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), PHP_INT_MAX );
@@ -32,12 +43,13 @@ public function __construct() {
* @since 1.0.0
* @return void
*/
- public function enqueue_scripts( $hook ) {
+ public function enqueue_scripts( $hook ): void {
$screen_ids = Utilities::get_screen_ids();
- WCDM()->scripts->enqueue_style( 'wcdm-admin', 'css/admin.css', array( 'bytekit-layout', 'bytekit-components', 'woocommerce_admin_styles' ) );
- WCDM()->scripts->register_script( 'wcdm-admin', 'js/admin.js' );
+ $this->plugin->scripts->enqueue_style( 'wcdm-admin', 'css/admin.css', array( 'bytekit-layout', 'bytekit-components', 'woocommerce_admin_styles' ) );
+ $this->plugin->scripts->register_script( 'wcdm-admin', 'js/admin.js' );
+
+ if ( in_array( $hook, $screen_ids, true ) || 'post-new.php' === $hook ) {
- if ( in_array( $hook, $screen_ids, true ) ) {
wp_enqueue_style( 'wcdm-admin' );
wp_enqueue_script( 'wcdm-admin' );
@@ -45,7 +57,9 @@ public function enqueue_scripts( $hook ) {
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'security' => wp_create_nonce( 'wc_donation_manager' ),
'i18n' => array(
- 'search_products' => esc_html__( 'Select products', 'wc-donation-manager' ),
+ 'search_products' => esc_html__( 'Select products', 'wc-donation-manager' ),
+ 'select_campaign_error' => esc_html__( 'Please select a campaign for donation products.', 'wc-donation-manager' ),
+ 'min_gt_max_error' => esc_html__( 'Minimum amount cannot be greater than maximum amount.', 'wc-donation-manager' ),
),
);
@@ -61,7 +75,7 @@ public function enqueue_scripts( $hook ) {
*
* @return array
*/
- public function add_screen_ids( $ids ) {
+ public function add_screen_ids( $ids ): array {
return array_merge( $ids, Utilities::get_screen_ids() );
}
@@ -70,22 +84,22 @@ public function add_screen_ids( $ids ) {
*
* @param string $text Footer text.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public function admin_footer_text( $text ) {
+ public function admin_footer_text( string $text ): string {
if ( in_array( get_current_screen()->id, Utilities::get_screen_ids(), true ) ) {
$text = sprintf(
/* translators: %s: Plugin name */
__( 'Thank you for using %s!', 'wc-donation-manager' ),
- '' . esc_html( WCDM()->get_name() ) . '',
+ '' . esc_html__( 'Donation Manager', 'wc-donation-manager' ) . '',
);
- if ( WCDM()->get_review_url() ) {
+ if ( $this->plugin->review_url ) {
$text .= sprintf(
/* translators: %s: Plugin name */
__( ' Share your appreciation with a five-star review %s.', 'wc-donation-manager' ),
- 'here'
+ 'here'
);
}
}
@@ -98,14 +112,14 @@ public function admin_footer_text( $text ) {
*
* @param string $text Footer text.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public function update_footer( $text ) {
+ public function update_footer( string $text ): string {
if ( in_array( get_current_screen()->id, Utilities::get_screen_ids(), true ) ) {
/* translators: 1: Plugin version */
- $text = sprintf( esc_html__( 'Version %s', 'wc-donation-manager' ), WCDM()->get_version() );
+ $text = sprintf( esc_html__( 'Version %s', 'wc-donation-manager' ), $this->plugin->version );
}
return $text;
diff --git a/includes/Admin/Menus.php b/includes/Admin/Menus.php
index aceb09b..0fac714 100644
--- a/includes/Admin/Menus.php
+++ b/includes/Admin/Menus.php
@@ -2,6 +2,8 @@
namespace WooCommerceDonationManager\Admin;
+use WooCommerceDonationManager\Plugin;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -11,6 +13,12 @@
* @package WooCommerceDonationManager\Admin
*/
class Menus {
+ /**
+ * Plugin instance.
+ *
+ * @var Plugin
+ */
+ protected Plugin $plugin;
/**
* Main menu slug.
@@ -28,18 +36,21 @@ class Menus {
private $list_table;
/**
- * Menus constructor.
+ * Class constructor.
*
* @since 1.0.0
+ *
+ * @param Plugin $plugin Plugin instance.
*/
- public function __construct() {
+ public function __construct( Plugin $plugin ) {
+ $this->plugin = $plugin;
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' ) );
// Pro tabs.
- if ( ! WCDM()->is_plugin_active( 'wc-donation-manager-pro' ) ) {
+ if ( ! $this->plugin->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' ) );
add_action( 'woocommerce_admin_field_wcdm_add_to_cart_btn_text', array( $this, 'render_customizable_settings' ) );
@@ -208,7 +219,7 @@ public function render_donors_content() {
-
+
-
+
-
+
'wcdm_campaign_id',
- 'label' => __( 'Select a campaign', 'wc-donation-manager' ),
- 'description' => __( 'Select a campaign to assign this donation product. After selected a campaign, the campaign cause & the goal amount will be inherited.', 'wc-donation-manager' ),
- 'desc_tip' => true,
- 'options' => $campaign_options,
- 'value' => ! empty( get_post_meta( get_the_ID(), 'wcdm_campaign_id', true ) ) ? get_post_meta( get_the_ID(), 'wcdm_campaign_id', true ) : '0',
+ 'id' => 'wcdm_campaign_id',
+ 'label' => __( 'Select a campaign', 'wc-donation-manager' ),
+ 'description' => __( 'Select a campaign to assign this donation product. After selected a campaign, the campaign cause & the goal amount will be inherited.', 'wc-donation-manager' ),
+ 'desc_tip' => true,
+ 'options' => $campaign_options,
+ 'value' => ! empty( get_post_meta( get_the_ID(), 'wcdm_campaign_id', true ) ) ? get_post_meta( get_the_ID(), 'wcdm_campaign_id', true ) : '0',
+ 'custom_attributes' => array(
+ 'required' => 'required',
+ ),
)
);
diff --git a/includes/Admin/Notices.php b/includes/Admin/Notices.php
index 3ce490c..726c10d 100644
--- a/includes/Admin/Notices.php
+++ b/includes/Admin/Notices.php
@@ -2,6 +2,8 @@
namespace WooCommerceDonationManager\Admin;
+use WooCommerceDonationManager\Plugin;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -10,13 +12,22 @@
* @since 1.0.0
*/
class Notices {
+ /**
+ * Plugin instance.
+ *
+ * @var Plugin
+ */
+ protected Plugin $plugin;
/**
- * Notices constructor.
+ * Notice Class constructor.
*
* @since 1.0.0
+ *
+ * @param Plugin $plugin Plugin instance.
*/
- public function __construct() {
+ public function __construct( Plugin $plugin ) {
+ $this->plugin = $plugin;
add_action( 'admin_init', array( $this, 'admin_notices' ) );
}
@@ -31,7 +42,7 @@ public function admin_notices() {
$current_time = absint( wp_date( 'U' ) );
if ( ! defined( 'WCDM_PRO_VERSION' ) ) {
- WCDM()->notices->add(
+ $this->plugin->notices->add(
array(
'message' => __DIR__ . '/views/notices/upgrade.php',
'notice_id' => 'wcdm_upgrade',
@@ -43,7 +54,7 @@ public function admin_notices() {
// Show after 5 days.
if ( $installed_time && $current_time > ( $installed_time + ( 5 * DAY_IN_SECONDS ) ) ) {
- WCDM()->notices->add(
+ $this->plugin->notices->add(
array(
'message' => __DIR__ . '/views/notices/review.php',
'dismissible' => false,
diff --git a/includes/Admin/views/campaigns/add.php b/includes/Admin/views/campaigns/add.php
index d7f9f26..d53132f 100644
--- a/includes/Admin/views/campaigns/add.php
+++ b/includes/Admin/views/campaigns/add.php
@@ -30,7 +30,19 @@
-
+ 'cause',
+ 'media_buttons' => true,
+ 'textarea_rows' => 12,
+ 'teeny' => false,
+ 'quicktags' => true,
+ )
+ );
+ ?>
diff --git a/includes/Admin/views/campaigns/edit.php b/includes/Admin/views/campaigns/edit.php
index cdcfb12..ebed76a 100644
--- a/includes/Admin/views/campaigns/edit.php
+++ b/includes/Admin/views/campaigns/edit.php
@@ -43,7 +43,19 @@
-
+ post_content ),
+ 'wcdm_donation_cause_editor',
+ array(
+ 'textarea_name' => 'cause',
+ 'media_buttons' => true,
+ 'textarea_rows' => 12,
+ 'teeny' => false,
+ 'quicktags' => true,
+ )
+ );
+ ?>
diff --git a/includes/Admin/views/notices/review.php b/includes/Admin/views/notices/review.php
index 575d200..e946e2a 100644
--- a/includes/Admin/views/notices/review.php
+++ b/includes/Admin/views/notices/review.php
@@ -12,7 +12,7 @@
?>
- ->get_assets_url( 'images/plugin-icon.png' ) ); ?>)
+
diff --git a/includes/Admin/views/notices/upgrade.php b/includes/Admin/views/notices/upgrade.php
index 0e0b26d..028988e 100644
--- a/includes/Admin/views/notices/upgrade.php
+++ b/includes/Admin/views/notices/upgrade.php
@@ -8,11 +8,10 @@
*/
defined( 'ABSPATH' ) || exit;
-
?>
- ->get_assets_url( 'images/plugin-icon.png' ) ); ?>)
+
diff --git a/includes/Data/settings.php b/includes/Data/settings.php
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/includes/Data/settings.php
@@ -0,0 +1 @@
+get_type() === 'donation' && isset( $session_data['donation_amount'] ) ) {
$session_data['data']->set_price( $session_data['donation_amount'] );
}
@@ -48,10 +48,10 @@ public static function get_cart_item_from_session( $session_data ) {
* @param array $cart_item Cart item.
* @param string $cart_item_key Cart item key.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public static function cart_item_price( $price, $cart_item, $cart_item_key ) {
+ public static function cart_item_price( string $price, array $cart_item, string $cart_item_key ): string {
if ( ! is_cart() ) {
return $price;
}
@@ -68,10 +68,10 @@ public static function cart_item_price( $price, $cart_item, $cart_item_key ) {
*
* @param bool $cart_updated weather true of false.
*
- * @since 1.0.0
* @return bool
+ * @since 1.0.0
*/
- public static function update_cart( $cart_updated ) {
+ public static function update_cart( bool $cart_updated ): bool {
wp_verify_nonce( '_wpnonce' );
if ( 'yes' !== get_option( 'wcdm_editable_cart_price', 'yes' ) ) {
diff --git a/includes/Frontend/Frontend.php b/includes/Frontend/Frontend.php
index 9d8786b..417fea8 100644
--- a/includes/Frontend/Frontend.php
+++ b/includes/Frontend/Frontend.php
@@ -2,6 +2,8 @@
namespace WooCommerceDonationManager\Frontend;
+use WooCommerceDonationManager\Plugin;
+
defined( 'ABSPATH' ) || exit;
/**
@@ -13,16 +15,26 @@
* @package WooCommerceDonationManager\Frontend
*/
class Frontend {
+ /**
+ * Plugin instance.
+ *
+ * @var Plugin
+ */
+ protected Plugin $plugin;
/**
- * Frontend constructor.
+ * Frontend Class constructor.
*
* @since 1.0.0
+ *
+ * @param Plugin $plugin Plugin instance.
*/
- public function __construct() {
+ public function __construct( Plugin $plugin ) {
+ $this->plugin = $plugin;
add_action( 'woocommerce_before_cart', array( __CLASS__, 'remove_coupon' ) );
add_action( 'woocommerce_before_checkout_form', array( __CLASS__, 'remove_coupon' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
+ add_action( 'wp_footer', array( $this, 'maybe_add_donation_button_class' ) );
}
/**
@@ -33,7 +45,7 @@ public function __construct() {
* @since 1.0.0
* @return void
*/
- public static function remove_coupon() {
+ public static function remove_coupon(): void {
if ( ! WC()->cart->is_empty() && 'yes' === get_option( 'wcdm_disabled_coupon_field', 'yes' ) ) {
foreach ( WC()->cart->get_cart() as $cart_item ) {
if ( 'donation' === $cart_item['data']->get_type() ) {
@@ -50,8 +62,51 @@ public static function remove_coupon() {
* @since 1.0.0
* @return void
*/
- public function enqueue_scripts() {
- WCDM()->scripts->enqueue_style( 'wcdm-frontend', 'css/frontend.css' );
- WCDM()->scripts->enqueue_script( 'wcdm-frontend', 'js/frontend.js', array( 'jquery' ) );
+ public function enqueue_scripts(): void {
+ $this->plugin->scripts->enqueue_style( 'wcdm-frontend', 'css/frontend.css' );
+ $this->plugin->scripts->enqueue_script( 'wcdm-frontend', 'js/frontend.js', array( 'jquery' ) );
+ $this->plugin->scripts->enqueue_script(
+ 'wcdm-cart-block',
+ 'js/cart_block.js',
+ array(
+ 'wc-blocks-checkout',
+ 'jquery',
+ ),
+ true
+ );
+ }
+
+ /**
+ * Add custom class to Add to Cart button for donation products.
+ *
+ * This method checks if the current product is a donation product type
+ * and then injects a custom CSS class into the single product
+ * Add to Cart button using JavaScript.
+ *
+ * @return void
+ */
+ public function maybe_add_donation_button_class(): void {
+
+ if ( ! is_product() ) {
+ return;
+ }
+
+ global $product;
+
+ if ( ! $product || ! $product->is_type( 'donation' ) ) {
+ return;
+ }
+
+ ?>
+
+ get_items() as $item_id => $item ) {
$product = $item->get_product();
diff --git a/includes/Frontend/Product.php b/includes/Frontend/Product.php
index 940940d..0ed0619 100644
--- a/includes/Frontend/Product.php
+++ b/includes/Frontend/Product.php
@@ -26,7 +26,7 @@ public function __construct() {
add_action( 'woocommerce_donation_add_to_cart', array( __CLASS__, 'add_to_cart_template' ) );
add_filter( 'woocommerce_add_to_cart_redirect', array( __CLASS__, 'add_to_cart_redirect' ), 10, 2 );
add_filter( 'woocommerce_add_cart_item', array( __CLASS__, 'add_cart_item' ) );
- add_filter( 'wc_add_to_cart_message', array( __CLASS__, 'add_to_cart_message' ), 10, 2 );
+ add_filter( 'wc_add_to_cart_message_html', array( __CLASS__, 'add_to_cart_message' ), 10, 2 );
add_filter( 'woocommerce_add_to_cart_validation', array( __CLASS__, 'prevent_duplicate_add_to_cart' ), 10, 2 );
}
@@ -38,10 +38,10 @@ public function __construct() {
* @param string $link Link html.
* @param \WC_Product $product Product object.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public static function add_to_cart_link( $link, $product ) {
+ public static function add_to_cart_link( string $link, \WC_Product $product ): string {
return ( 'donation' === $product->get_type() ? str_replace( 'ajax_add_to_cart', '', $link ) : $link );
}
@@ -51,10 +51,10 @@ public static function add_to_cart_link( $link, $product ) {
* @param string $price product price html.
* @param \WC_Product $product Product object.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public static function get_price_html( $price, $product ) {
+ public static function get_price_html( string $price, \WC_Product $product ): string {
if ( 'donation' === $product->get_type() ) {
return ( is_admin() ? 'Variable' : '' );
}
@@ -70,7 +70,7 @@ public static function get_price_html( $price, $product ) {
* @since 1.0.0
* @return void
*/
- public static function before_add_to_cart_button() {
+ public static function before_add_to_cart_button(): void {
global $product;
if ( 'donation' === $product->get_type() ) {
@@ -88,13 +88,33 @@ public static function before_add_to_cart_button() {
-
-
-
-
+
+
+
+
+
+
+
+ Raised:
+ $0
+
+
+
+ Goal:
+ $0
+
+
-
-
* @since 1.0.0
* @return void
*/
- public static function add_to_cart_template() {
+ public static function add_to_cart_template(): void {
$campaign_id = get_post_meta( get_the_ID(), 'wcdm_campaign_id', true );
$campaign_end_date = intval( str_replace( '-', '', get_post_meta( $campaign_id, '_end_date', true ) ) );
$campaign_expired_text = get_option( 'wcdm_expired_text', __( 'The campaign expired!', 'wc-donation-manager' ) );
@@ -154,16 +174,16 @@ public static function add_to_cart_template() {
}
/**
- * Redirecting weather cart or checkout page.
+ * Redirecting whether cart or checkout page.
*
* This will only be applied for the donation products.
*
* @param string $url Add to cart button url.
*
- * @since 1.0.0
* @return string
+ * @since 1.0.0
*/
- public static function add_to_cart_redirect( $url ) {
+ public static function add_to_cart_redirect( string $url ) {
wp_verify_nonce( '_wpnonce' );
$product_id = (int) apply_filters( 'woocommerce_add_to_cart_product_id', ! empty( $_POST['add-to-cart'] ) ? sanitize_key( wp_unslash( $_POST['add-to-cart'] ) ) : '' );
if ( $product_id ) {
@@ -225,10 +245,10 @@ public static function add_to_cart_message( $message, $product_id ) {
* @param bool $passed Whether the product can be added to the cart.
* @param int $product_id Product ID.
*
- * @since 1.0.6
* @return bool
+ * @since 1.0.6
*/
- public static function prevent_duplicate_add_to_cart( $passed, $product_id ) {
+ public static function prevent_duplicate_add_to_cart( bool $passed, int $product_id ): bool {
$product = wc_get_product( $product_id );
// Only donation products.
diff --git a/includes/Installer.php b/includes/Installer.php
index 6ccd174..27a4af4 100644
--- a/includes/Installer.php
+++ b/includes/Installer.php
@@ -11,6 +11,13 @@
* @package WooCommerceDonationManager
*/
class Installer {
+ /**
+ * Plugin instance.
+ *
+ * @since 1.0.0
+ * @var Plugin
+ */
+ protected Plugin $plugin;
/**
* Update callbacks.
@@ -21,9 +28,14 @@ class Installer {
protected $updates = array();
/**
- * Class constructor.
+ * Install Class constructor.
+ *
+ * @since 1.0.0
+ *
+ * @param Plugin $plugin Plugin instance.
*/
- public function __construct() {
+ public function __construct( Plugin $plugin ) {
+ $this->plugin = $plugin;
add_action( 'init', array( $this, 'check_update' ), 5 );
add_action( 'wcdm_run_update_callback', array( $this, 'run_update_callback' ), 10, 2 );
add_action( 'wcdm_update_db_version', array( $this, 'update_db_version' ) );
@@ -38,18 +50,18 @@ public function __construct() {
* @return void
*/
public function check_update() {
- $db_version = WCDM()->get_db_version();
- $current_version = WCDM()->get_version();
+ $db_version = $this->plugin->options->get_db_version();
+ $current_version = $this->plugin->version;
$requires_update = version_compare( $db_version, $current_version, '<' );
$can_install = ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && ! defined( 'IFRAME_REQUEST' );
if ( $can_install && $requires_update && ! WC()->queue()->get_next( 'wcdm_run_update_callback' ) ) {
- static::install();
+ $this->install();
$update_versions = array_keys( $this->updates );
usort( $update_versions, 'version_compare' );
if ( ! is_null( $db_version ) && version_compare( $db_version, end( $update_versions ), '<' ) ) {
$this->update();
} else {
- WCDM()->update_db_version( $current_version );
+ $this->plugin->options->update_db_version( $current_version );
}
}
}
@@ -61,7 +73,7 @@ public function check_update() {
* @return void
*/
public function update() {
- $db_version = WCDM()->get_db_version();
+ $db_version = $this->plugin->options->get_db_version();
$loop = 0;
foreach ( $this->updates as $version => $callbacks ) {
$callbacks = (array) $callbacks;
@@ -81,13 +93,13 @@ public function update() {
++$loop;
}
- if ( version_compare( WCDM()->get_db_version(), WCDM()->get_version(), '<' ) &&
+ if ( version_compare( $this->plugin->options->get_db_version(), $this->plugin->version, '<' ) &&
! WC()->queue()->get_next( 'wcdm_update_db_version' ) ) {
WC()->queue()->schedule_single(
time() + $loop,
'wcdm_update_db_version',
array(
- 'version' => WCDM()->get_version(),
+ 'version' => $this->plugin->version,
)
);
}
@@ -126,7 +138,7 @@ public function run_update_callback( $callback, $version ) {
* @return void
*/
public function update_db_version( $version ) {
- WCDM()->update_db_version( $version );
+ $this->plugin->options->update_db_version( $version );
}
/**
@@ -135,14 +147,14 @@ public function update_db_version( $version ) {
* @since 1.0.0
* @return void
*/
- public static function install() {
+ public function install() {
if ( ! is_blog_installed() ) {
return;
}
self::save_default_settings();
flush_rewrite_rules( true );
add_option( 'wcdm_installed', time() );
- WCDM()->add_db_version();
+ $this->plugin->options->update_db_version( $this->plugin->version );
}
/**
diff --git a/includes/Plugin.php b/includes/Plugin.php
index ba5afe6..fe513f2 100644
--- a/includes/Plugin.php
+++ b/includes/Plugin.php
@@ -2,6 +2,8 @@
namespace WooCommerceDonationManager;
+use WooCommerceDonationManager\Installer;
+
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
/**
@@ -10,17 +12,13 @@
* @since 1.0.0
* @package WooCommerceDonationManager
*/
-final class Plugin extends \WooCommerceDonationManager\ByteKit\Plugin {
-
+final class Plugin extends \WooCommerceDonationManager\B8\Plugin\App {
/**
- * Plugin constructor.
- *
- * @param array $data The plugin data.
+ * Bootstraps the plugin.
*
- * @since 1.0.0
+ * @return void
*/
- protected function __construct( $data ) {
- parent::__construct( $data );
+ protected function bootstrap(): void {
$this->define_constants();
$this->includes();
$this->init_hooks();
@@ -32,15 +30,15 @@ protected function __construct( $data ) {
* @since 1.0.0
* @return void
*/
- public function define_constants() {
+ public function define_constants(): void {
$role = apply_filters( 'wc_donation_manager_role', 'manage_woocommerce' );
- $this->define( 'WCDM_VERSION', $this->get_version() );
- $this->define( 'WCDM_FILE', $this->get_file() );
- $this->define( 'WCDM_PATH', $this->get_dir_path() );
- $this->define( 'WCDM_URL', $this->get_dir_url() );
- $this->define( 'WCDM_ASSETS_URL', $this->get_assets_url() );
- $this->define( 'WCDM_ASSETS_PATH', $this->get_assets_path() );
- $this->define( 'WCDM_MANAGER_ROLE', $role );
+ define( 'WCDM_VERSION', $this->version );
+ define( 'WCDM_FILE', $this->file );
+ define( 'WCDM_PATH', $this->plugin_path() );
+ define( 'WCDM_URL', $this->plugin_url() );
+ define( 'WCDM_ASSETS_URL', $this->assets_url() );
+ define( 'WCDM_ASSETS_PATH', $this->assets_path() );
+ define( 'WCDM_MANAGER_ROLE', $role );
}
/**
@@ -60,8 +58,8 @@ public function includes() {
* @return void
*/
public function init_hooks() {
- register_activation_hook( $this->get_file(), array( Installer::class, 'install' ) );
- add_filter( 'plugin_action_links_' . $this->get_basename(), array( $this, 'plugin_action_links' ) );
+ register_activation_hook( $this->file, $this->callback( array( Installer::class, 'install' ) ) );
+ add_filter( 'plugin_action_links_' . $this->basename(), array( $this, 'plugin_action_links' ) );
add_action( 'before_woocommerce_init', array( $this, 'on_before_woocommerce_init' ) );
add_action( 'woocommerce_init', array( $this, 'on_init' ), 0 );
}
@@ -75,7 +73,7 @@ public function init_hooks() {
* @return array
*/
public function plugin_action_links( $links ) {
- if ( ! $this->is_plugin_active( 'wc-donation-manager-pro/wc-donation-manager-pro.php' ) ) {
+ if ( ! $this->plugin_active( 'wc-donation-manager-pro/wc-donation-manager-pro.php' ) ) {
$links['go_pro'] = ' ' . esc_html__( 'Go Pro', 'wc-donation-manager' ) . '';
}
@@ -88,10 +86,10 @@ public function plugin_action_links( $links ) {
* @since 1.0.0
* @return void
*/
- public function on_before_woocommerce_init() {
+ public function on_before_woocommerce_init(): void {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
- \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $this->get_file(), true );
- \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', $this->get_file(), true );
+ \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $this->file, true );
+ \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', $this->file, true );
}
}
@@ -101,36 +99,27 @@ public function on_before_woocommerce_init() {
* @since 1.0.0
* @return void
*/
- public function on_init() {
+ public function on_init(): void {
// Register post types.
add_action( 'init', array( $this, 'register_cpt_campaigns' ) );
// Including donation product type class.
require_once __DIR__ . '/Donation/class-donation-product.php';
- // Include common classes.
- $this->set(
- array(
- Donation\Donation::class,
- Frontend\Frontend::class,
- Frontend\Product::class,
- Frontend\Cart::class,
- Frontend\Orders::class,
- )
- );
+ $this->make( Donation\Donation::class );
+ $this->make( Frontend\Frontend::class );
+ $this->make( Frontend\Product::class );
+ $this->make( Frontend\Cart::class );
+ $this->make( Frontend\Orders::class );
// Include Admin classes.
if ( is_admin() ) {
- $this->set(
- array(
- Admin\Admin::class,
- Admin\Menus::class,
- Admin\Settings::instance(),
- Admin\Actions::class,
- Admin\Metaboxes::class,
- Admin\Notices::class,
- )
- );
+ $this->make( Admin\Admin::class );
+ $this->make( Admin\Menus::class );
+ Admin\Settings::instance();
+ $this->make( Admin\Actions::class );
+ $this->make( Admin\Metaboxes::class );
+ $this->make( Admin\Notices::class );
}
/**
@@ -149,7 +138,7 @@ public function on_init() {
* @since 1.0.0
* @return void
*/
- public function register_cpt_campaigns() {
+ public function register_cpt_campaigns(): void {
$labels = array(
'name' => _x( 'Campaign', 'post type general name', 'wc-donation-manager' ),
'singular_name' => _x( 'Campaign', 'post type singular name', 'wc-donation-manager' ),
@@ -168,7 +157,7 @@ public function register_cpt_campaigns() {
);
$args = array(
- 'labels' => apply_filters( 'wcdm_campaigns_post_type_labels', $labels ),
+ 'labels' => $this->apply_filters( 'wcdm_campaigns_post_type_labels', $labels ),
'public' => false,
'publicly_queryable' => false,
'exclude_from_search' => true,
@@ -185,6 +174,6 @@ public function register_cpt_campaigns() {
'supports' => array(),
);
- register_post_type( 'wcdm_campaigns', apply_filters( 'wcdm_campaigns_post_type_args', $args ) );
+ register_post_type( 'wcdm_campaigns', $this->apply_filters( 'campaigns_post_type_args', $args ) );
}
}
diff --git a/languages/wc-donation-manager.pot b/languages/wc-donation-manager.pot
index 8c16f7c..13d1e8a 100644
--- a/languages/wc-donation-manager.pot
+++ b/languages/wc-donation-manager.pot
@@ -9,13 +9,14 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2026-04-20T09:55:11+00:00\n"
+"POT-Creation-Date: 2026-05-20T03:31:18+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.12.0\n"
"X-Domain: wc-donation-manager\n"
#. Plugin Name of the plugin
#: wc-donation-manager.php
+#: includes/Admin/Admin.php:96
#: includes/Admin/Metaboxes.php:43
msgid "Donation Manager"
msgstr ""
@@ -40,36 +41,44 @@ msgstr ""
msgid "https://pluginever.com/"
msgstr ""
-#: includes/Admin/Actions.php:63
+#: includes/Admin/Actions.php:62
msgid "Campaign created successfully."
msgstr ""
-#: includes/Admin/Actions.php:109
+#: includes/Admin/Actions.php:108
msgid "Campaign updated successfully."
msgstr ""
-#: includes/Admin/Actions.php:136
+#: includes/Admin/Actions.php:134
msgid "Suggested amounts"
msgstr ""
-#: includes/Admin/Admin.php:48
+#: includes/Admin/Admin.php:60
msgid "Select products"
msgstr ""
+#: includes/Admin/Admin.php:61
+msgid "Please select a campaign for donation products."
+msgstr ""
+
+#: includes/Admin/Admin.php:62
+msgid "Minimum amount cannot be greater than maximum amount."
+msgstr ""
+
#. translators: %s: Plugin name
-#: includes/Admin/Admin.php:81
+#: includes/Admin/Admin.php:95
#, php-format
msgid "Thank you for using %s!"
msgstr ""
#. translators: %s: Plugin name
-#: includes/Admin/Admin.php:87
+#: includes/Admin/Admin.php:101
#, php-format
msgid " Share your appreciation with a five-star review %s."
msgstr ""
#. translators: 1: Plugin version
-#: includes/Admin/Admin.php:108
+#: includes/Admin/Admin.php:122
#, php-format
msgid "Version %s"
msgstr ""
@@ -103,62 +112,62 @@ msgid "End date"
msgstr ""
#: includes/Admin/ListTables/CampaignsListTable.php:119
-#: includes/Admin/views/campaigns/add.php:63
-#: includes/Admin/views/campaigns/edit.php:99
+#: includes/Admin/views/campaigns/add.php:75
+#: includes/Admin/views/campaigns/edit.php:111
msgid "Status"
msgstr ""
#: includes/Admin/ListTables/CampaignsListTable.php:157
#: includes/Admin/ListTables/CampaignsListTable.php:196
-#: includes/Admin/views/campaigns/edit.php:113
+#: includes/Admin/views/campaigns/edit.php:125
msgid "Delete"
msgstr ""
#: includes/Admin/ListTables/CampaignsListTable.php:195
-#: includes/Admin/views/campaigns/edit.php:150
+#: includes/Admin/views/campaigns/edit.php:162
msgid "Edit"
msgstr ""
-#: includes/Admin/Menus.php:58
-#: includes/Admin/Menus.php:59
+#: includes/Admin/Menus.php:69
+#: includes/Admin/Menus.php:70
msgid "Donations"
msgstr ""
-#: includes/Admin/Menus.php:153
+#: includes/Admin/Menus.php:164
msgid "Per page"
msgstr ""
-#: includes/Admin/Menus.php:203
+#: includes/Admin/Menus.php:214
#: includes/Admin/Utilities.php:35
#: includes/Admin/Utilities.php:36
msgid "Donors"
msgstr ""
-#: includes/Admin/Menus.php:204
+#: includes/Admin/Menus.php:215
msgid "The list of donors and their donation information(s)"
msgstr ""
-#: includes/Admin/Menus.php:208
-#: includes/Admin/Menus.php:226
-#: includes/Admin/Menus.php:244
+#: includes/Admin/Menus.php:219
+#: includes/Admin/Menus.php:237
+#: includes/Admin/Menus.php:255
msgid "Available in Pro Version"
msgstr ""
-#: includes/Admin/Menus.php:209
-#: includes/Admin/Menus.php:227
-#: includes/Admin/Menus.php:245
+#: includes/Admin/Menus.php:220
+#: includes/Admin/Menus.php:238
+#: includes/Admin/Menus.php:256
msgid "Upgrade to Pro Now"
msgstr ""
-#: includes/Admin/Menus.php:211
+#: includes/Admin/Menus.php:222
msgid "Donors list table"
msgstr ""
-#: includes/Admin/Menus.php:229
+#: includes/Admin/Menus.php:240
msgid "Customer completed emails"
msgstr ""
-#: includes/Admin/Menus.php:247
+#: includes/Admin/Menus.php:258
msgid "Add customizable settings"
msgstr ""
@@ -398,7 +407,7 @@ msgid "Settings"
msgstr ""
#: includes/Admin/views/campaigns/add.php:12
-#: includes/Plugin.php:159
+#: includes/Plugin.php:148
msgid "Add New Campaign"
msgstr ""
@@ -415,37 +424,32 @@ msgstr ""
msgid "Enter the name of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/add.php:33
-#: includes/Admin/views/campaigns/edit.php:46
-msgid "Enter the cause of the campaign..."
-msgstr ""
-
-#: includes/Admin/views/campaigns/add.php:35
+#: includes/Admin/views/campaigns/add.php:47
msgid "Enter the cause of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/add.php:41
+#: includes/Admin/views/campaigns/add.php:53
msgid "Goal amount *"
msgstr ""
-#: includes/Admin/views/campaigns/add.php:46
+#: includes/Admin/views/campaigns/add.php:58
msgid "Enter the goal amount of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/add.php:52
-#: includes/Admin/views/campaigns/edit.php:67
+#: includes/Admin/views/campaigns/add.php:64
+#: includes/Admin/views/campaigns/edit.php:79
msgid "End date *"
msgstr ""
-#: includes/Admin/views/campaigns/add.php:57
+#: includes/Admin/views/campaigns/add.php:69
msgid "Enter the end date of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/add.php:72
+#: includes/Admin/views/campaigns/add.php:84
msgid "Select the campaign status."
msgstr ""
-#: includes/Admin/views/campaigns/add.php:81
+#: includes/Admin/views/campaigns/add.php:93
msgid "Add Campaign"
msgstr ""
@@ -458,7 +462,7 @@ msgid "Search"
msgstr ""
#: includes/Admin/views/campaigns/edit.php:16
-#: includes/Plugin.php:161
+#: includes/Plugin.php:150
msgid "Edit Campaign"
msgstr ""
@@ -474,57 +478,55 @@ msgstr ""
msgid "Edit or update the name of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:48
+#: includes/Admin/views/campaigns/edit.php:60
msgid "Edit or update the cause of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:55
+#: includes/Admin/views/campaigns/edit.php:67
msgid "Goal Amount *"
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:60
+#: includes/Admin/views/campaigns/edit.php:72
msgid "Edit or update the goal amount of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:72
+#: includes/Admin/views/campaigns/edit.php:84
msgid "Edit or update the end date of the campaign."
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:82
+#: includes/Admin/views/campaigns/edit.php:94
msgid "Campaign overview"
msgstr ""
#. translators: 1: WC currency symbol 2: Raised amount
-#: includes/Admin/views/campaigns/edit.php:86
-#: includes/Frontend/Product.php:93
+#: includes/Admin/views/campaigns/edit.php:98
#, php-format
msgid "%1$s%2$.2f raised"
msgstr ""
#. translators: 1: WC currency symbol 2: Raised amount
-#: includes/Admin/views/campaigns/edit.php:87
-#: includes/Frontend/Product.php:94
+#: includes/Admin/views/campaigns/edit.php:99
#, php-format
msgid "%1$s%2$.2f goal"
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:94
+#: includes/Admin/views/campaigns/edit.php:106
msgid "Actions"
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:108
+#: includes/Admin/views/campaigns/edit.php:120
msgid "Update the campaign status."
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:114
+#: includes/Admin/views/campaigns/edit.php:126
msgid "Save Changes"
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:129
+#: includes/Admin/views/campaigns/edit.php:141
msgid "Campaign Products"
msgstr ""
-#: includes/Admin/views/campaigns/edit.php:151
+#: includes/Admin/views/campaigns/edit.php:163
msgid "View"
msgstr ""
@@ -543,7 +545,7 @@ msgid "Sure, I'd love to help!"
msgstr ""
#: includes/Admin/views/notices/review.php:40
-#: includes/Admin/views/notices/upgrade.php:40
+#: includes/Admin/views/notices/upgrade.php:39
msgid "Maybe later"
msgstr ""
@@ -551,17 +553,17 @@ msgstr ""
msgid "I've already left a review"
msgstr ""
-#: includes/Admin/views/notices/upgrade.php:18
+#: includes/Admin/views/notices/upgrade.php:17
msgid "Flash Sale Alert!"
msgstr ""
#. translators: %1$s: WooCommerce Donation Manager Pro plugin link, %2$s: Coupon code.
-#: includes/Admin/views/notices/upgrade.php:24
+#: includes/Admin/views/notices/upgrade.php:23
#, php-format
msgid "Enjoy a 10%% discount on %1$s! Use coupon code %2$s at checkout to grab the deal. Don’t miss out — this offer won’t last forever!"
msgstr ""
-#: includes/Admin/views/notices/upgrade.php:36
+#: includes/Admin/views/notices/upgrade.php:35
msgid "Upgrade now"
msgstr ""
@@ -601,67 +603,67 @@ msgstr ""
msgid "View Cart"
msgstr ""
-#: includes/Donation/Donation.php:33
+#: includes/Donation/Donation.php:35
msgid "Donation"
msgstr ""
-#: includes/Frontend/Product.php:146
+#: includes/Frontend/Product.php:166
msgid "The campaign expired!"
msgstr ""
-#: includes/Plugin.php:79
+#: includes/Plugin.php:77
msgid "Go Pro"
msgstr ""
-#: includes/Plugin.php:154
+#: includes/Plugin.php:143
msgctxt "post type general name"
msgid "Campaign"
msgstr ""
-#: includes/Plugin.php:155
+#: includes/Plugin.php:144
msgctxt "post type singular name"
msgid "Campaign"
msgstr ""
-#: includes/Plugin.php:156
+#: includes/Plugin.php:145
msgctxt "admin menu"
msgid "Campaign"
msgstr ""
-#: includes/Plugin.php:157
+#: includes/Plugin.php:146
msgctxt "add new on admin bar"
msgid "Campaign"
msgstr ""
-#: includes/Plugin.php:158
+#: includes/Plugin.php:147
msgctxt "campaign"
msgid "Add New"
msgstr ""
-#: includes/Plugin.php:160
+#: includes/Plugin.php:149
msgid "New Campaign"
msgstr ""
-#: includes/Plugin.php:162
+#: includes/Plugin.php:151
msgid "View Campaign"
msgstr ""
-#: includes/Plugin.php:163
+#: includes/Plugin.php:152
msgid "All Campaign"
msgstr ""
-#: includes/Plugin.php:164
+#: includes/Plugin.php:153
msgid "Search Campaign"
msgstr ""
-#: includes/Plugin.php:165
+#: includes/Plugin.php:154
msgid "Parent Campaign:"
msgstr ""
-#: includes/Plugin.php:166
+#: includes/Plugin.php:155
msgid "No campaigns found."
msgstr ""
-#: includes/Plugin.php:167
+#: includes/Plugin.php:156
msgid "No campaigns found in Trash."
msgstr ""
diff --git a/wc-donation-manager.php b/wc-donation-manager.php
index f3e03d0..ccde9f8 100644
--- a/wc-donation-manager.php
+++ b/wc-donation-manager.php
@@ -45,10 +45,23 @@
// Instantiate the plugin.
WooCommerceDonationManager\Plugin::create(
+ __FILE__,
array(
'file' => __FILE__,
+ 'version' => '1.1.2',
+ 'hook_prefix' => 'wcdm',
'settings_url' => admin_url( 'admin.php?page=wcdm-settings' ),
'support_url' => 'https://pluginever.com/support/',
'docs_url' => 'https://pluginever.com/docs/wc-donation-manager/',
+ 'text_domain' => 'wc-donation-manager',
)
);
+
+/**
+ * Main plugin instance.
+ *
+ * @return WooCommerceDonationManager\Plugin
+ */
+function donation_manager(): \WooCommerceDonationManager\Plugin {
+ return \WooCommerceDonationManager\Plugin::instance();
+}
|