From 233fe4f89fdc55d67fd0428cf59de57fab75794d Mon Sep 17 00:00:00 2001 From: Sapayth Hossain Date: Mon, 7 Oct 2024 11:59:55 +0600 Subject: [PATCH 1/4] fix: integrations not loading properly --- includes/Integrations.php | 37 +++++++++++++++++++++++++++++++++++++ wpuf.php | 1 + 2 files changed, 38 insertions(+) create mode 100644 includes/Integrations.php diff --git a/includes/Integrations.php b/includes/Integrations.php new file mode 100644 index 000000000..12205b521 --- /dev/null +++ b/includes/Integrations.php @@ -0,0 +1,37 @@ +container['dokan'] = new Integrations\WPUF_Dokan_Integration(); + } + + if ( class_exists( 'WC_Vendors' ) ) { + $this->container['wc_vendors'] = new Integrations\WPUF_WC_Vendors_Integration(); + } + + if ( class_exists( 'WCMp' ) ) { + $this->container['wcmp'] = new Integrations\WPUF_WCMp_Integration(); + } + + if ( class_exists( 'ACF' ) ) { + $this->container['acf'] = new Integrations\WPUF_ACF_Compatibility(); + } + } +} diff --git a/wpuf.php b/wpuf.php index 592c40fa6..085823329 100644 --- a/wpuf.php +++ b/wpuf.php @@ -173,6 +173,7 @@ public function instantiate() { $this->container['bank'] = new WeDevs\Wpuf\Lib\Gateway\Bank(); $this->container['paypal'] = new WeDevs\Wpuf\Lib\Gateway\Paypal(); $this->container['api'] = new WeDevs\Wpuf\API(); + $this->container['integrations'] = new WeDevs\Wpuf\Integrations(); if ( is_admin() ) { $this->container['admin'] = new WeDevs\Wpuf\Admin(); From 11d13f1dbe6df417726c3ea88ede0b62dfce8638 Mon Sep 17 00:00:00 2001 From: Sapayth Hossain Date: Mon, 7 Oct 2024 12:13:39 +0600 Subject: [PATCH 2/4] refactor documentation --- includes/Integrations.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/includes/Integrations.php b/includes/Integrations.php index 12205b521..68397f88a 100644 --- a/includes/Integrations.php +++ b/includes/Integrations.php @@ -3,15 +3,15 @@ namespace WeDevs\Wpuf; /** - * The installer class + * The integration class to handle all integrations with our plugin * - * @since 2.6.0 + * @since WPUF_SINCE */ class Integrations { /** * Holds various class instances * - * @since 4.0.9 + * @since WPUF_SINCE * * @var array */ @@ -34,4 +34,21 @@ public function __construct() { $this->container['acf'] = new Integrations\WPUF_ACF_Compatibility(); } } + + /** + * Magic getter to bypass referencing objects + * + * @since WPUF_SINCE + * + * @param string $prop + * + * @return null|object Class Instance + */ + public function __get( $prop ) { + if ( array_key_exists( $prop, $this->container ) ) { + return $this->container[ $prop ]; + } + + return null; + } } From 34a867db444473b044c193b6b74cbf5e5b7fe7d7 Mon Sep 17 00:00:00 2001 From: Sapayth Hossain Date: Tue, 8 Oct 2024 17:25:55 +0600 Subject: [PATCH 3/4] fix script loading --- includes/Ajax/Frontend_Form_Ajax.php | 4 ++++ includes/Frontend.php | 5 +---- includes/Frontend_Render_Form.php | 1 - templates/dokan/new-post.php | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/includes/Ajax/Frontend_Form_Ajax.php b/includes/Ajax/Frontend_Form_Ajax.php index 630617651..673eeb619 100644 --- a/includes/Ajax/Frontend_Form_Ajax.php +++ b/includes/Ajax/Frontend_Form_Ajax.php @@ -19,6 +19,10 @@ class Frontend_Form_Ajax { private $expired_post_status = 'wpuf-expired_post_status'; private $post_expiration_message = 'wpuf-post_expiration_message'; + /** + * @var array + */ + private $form_fields; /** * New/Edit post submit handler diff --git a/includes/Frontend.php b/includes/Frontend.php index 21b10b4fd..7567656aa 100644 --- a/includes/Frontend.php +++ b/includes/Frontend.php @@ -180,12 +180,9 @@ public function enqueue_scripts() { private function dokan_is_seller_dashboard() { return class_exists( 'WeDevs_Dokan' ) && function_exists( 'dokan_is_seller_dashboard' ) - && dokan_is_seller_dashboard() - && ! empty( $wp->query_vars['posts'] ); + && dokan_is_seller_dashboard(); } - - /** * Show/hide admin bar to the permitted user level * diff --git a/includes/Frontend_Render_Form.php b/includes/Frontend_Render_Form.php index a3d49e3b9..12407ac1a 100644 --- a/includes/Frontend_Render_Form.php +++ b/includes/Frontend_Render_Form.php @@ -224,7 +224,6 @@ public function render_form( $form_id, $post_id = null, $atts = [], $form = null
-