diff --git a/Lib/Appsero/Insights.php b/Lib/Appsero/Insights.php
index 95f4e59b9..efc99c5b8 100644
--- a/Lib/Appsero/Insights.php
+++ b/Lib/Appsero/Insights.php
@@ -65,7 +65,7 @@ public function __construct($client, $name = null, $file = null)
/**
* Don't show the notice
*
- * @return \self
+ * @return self
*/
public function hide_notice()
{
@@ -77,7 +77,7 @@ public function hide_notice()
/**
* Add plugin data if needed
*
- * @return \self
+ * @return self
*/
public function add_plugin_data()
{
@@ -91,7 +91,7 @@ public function add_plugin_data()
*
* @param array $data
*
- * @return \self
+ * @return self
*/
public function add_extra($data = [])
{
@@ -105,7 +105,7 @@ public function add_extra($data = [])
*
* @param string $text
*
- * @return \self
+ * @return self
*/
public function notice($text = '')
{
diff --git a/Lib/invisible_recaptcha.php b/Lib/invisible_recaptcha.php
index 5f32073b2..ec365aa69 100644
--- a/Lib/invisible_recaptcha.php
+++ b/Lib/invisible_recaptcha.php
@@ -16,12 +16,13 @@
*
*/
+#[AllowDynamicProperties]
class Invisible_Recaptcha{
private static $_signupUrl = "https://www.google.com/recaptcha/admin";
public function __construct( $site_key, $secret_key ){
-
+
if ( $secret_key == null || $secret_key == "" ) {
die("To use reCAPTCHA you must get an API key from " . self::$_signupUrl . "");
@@ -32,7 +33,7 @@ public function __construct( $site_key, $secret_key ){
);
}
-
+
public function verifyResponse($recaptcha){
$remoteIp = $this->getIPAddress();
diff --git a/admin/class-admin-settings.php b/admin/class-admin-settings.php
index 9c3a1cea6..1aaa7163b 100644
--- a/admin/class-admin-settings.php
+++ b/admin/class-admin-settings.php
@@ -3,26 +3,28 @@
/**
* WPUF settings
*/
+
+#[AllowDynamicProperties]
class WPUF_Admin_Settings {
/**
* Settings API
*
- * @var \WeDevs_Settings_API
+ * @var WeDevs_Settings_API
*/
private $settings_api;
/**
* Static instance of this class
*
- * @var \self
+ * @var self
*/
private static $_instance;
/**
* Public instance of this class
*
- * @var \self
+ * @var self
*/
public $subscribers_list_table_obj;
diff --git a/admin/form-builder/assets/js/components/field-visibility/template.php b/admin/form-builder/assets/js/components/field-visibility/template.php
index e560d002e..661c65781 100644
--- a/admin/form-builder/assets/js/components/field-visibility/template.php
+++ b/admin/form-builder/assets/js/components/field-visibility/template.php
@@ -13,7 +13,9 @@
-
+
get_subscriptions();
+ $subscriptions = (new Subscription())->get_subscriptions();
if ( $subscriptions ) {
foreach ( $subscriptions as $pack ) {
diff --git a/assets/js-templates/form-components.php b/assets/js-templates/form-components.php
index 33f5a4004..d0864a2a0 100644
--- a/assets/js-templates/form-components.php
+++ b/assets/js-templates/form-components.php
@@ -1,7 +1,9 @@
diff --git a/includes/Free/Simple_Login.php b/includes/Free/Simple_Login.php
index 26674dd05..7306d04f7 100644
--- a/includes/Free/Simple_Login.php
+++ b/includes/Free/Simple_Login.php
@@ -4,6 +4,7 @@
use WeDevs\Wpuf\Render_Form;
use WeDevs\Wpuf\WPUF_User;
+use WP_Error;
/**
* Login and forgot password handler class
@@ -157,7 +158,7 @@ public function validate_custom_fields( $user, $password ) {
if ( $recaptcha === 'on' ) {
if ( isset( $_REQUEST['g-recaptcha-response'] ) ) {
if ( empty( $_REQUEST['g-recaptcha-response'] ) ) {
- $user = new \WP_Error( 'WPUFLoginCaptchaError', 'Empty reCaptcha Field.' );
+ $user = new WP_Error( 'WPUFLoginCaptchaError', 'Empty reCaptcha Field.' );
} else {
$no_captcha = 1;
$invisible_captcha = 0;
@@ -425,7 +426,7 @@ public function process_login() {
$pwd = isset( $_POST['pwd'] ) ? trim( $_POST['pwd'] ) : '';
// $g_recaptcha_response = isset( $_POST['g-recaptcha-response'] ) ? sanitize_text_field( wp_unslash( $_POST['g-recaptcha-response'] ) ) : '';
- $validation_error = new \WP_Error();
+ $validation_error = new WP_Error();
$validation_error = apply_filters( 'wpuf_process_login_errors', $validation_error, $log, $pwd );
if ( $validation_error->get_error_code() ) {
@@ -669,7 +670,7 @@ public function process_reset_password() {
return;
}
- $errors = new \WP_Error();
+ $errors = new WP_Error();
do_action( 'validate_password_reset', $errors, $user );
@@ -784,7 +785,7 @@ public function successfully_authenticate( $user, $username, $password ) {
if ( ! is_wp_error( $user ) ) {
if ( $user->ID ) {
$resend_link = add_query_arg( 'resend_activation', $user->ID, $this->get_login_url() );
- $error = new \WP_Error();
+ $error = new WP_Error();
$wpuf_user = new WPUF_User( $user->ID );
if ( ! $wpuf_user->is_verified() ) {
@@ -916,10 +917,10 @@ public function activation_user_registration() {
*
* @since 2.2
*
- * @return \WP_Error
+ * @return WP_Error
*/
public function user_activation_message() {
- return new \WP_Error( 'user-activated', __( 'Your account has been activated', 'wp-user-frontend' ), 'message' );
+ return new WP_Error( 'user-activated', __( 'Your account has been activated', 'wp-user-frontend' ), 'message' );
}
public function wp_login_page_redirect() {
diff --git a/includes/Frontend.php b/includes/Frontend.php
index c1c3423c4..7b9cefc41 100644
--- a/includes/Frontend.php
+++ b/includes/Frontend.php
@@ -2,6 +2,7 @@
namespace WeDevs\Wpuf;
+use AllowDynamicProperties;
use WeDevs\WpUtils\ContainerTrait;
/**
diff --git a/includes/Frontend/Frontend_Account.php b/includes/Frontend/Frontend_Account.php
index 5574eeffb..24a613398 100644
--- a/includes/Frontend/Frontend_Account.php
+++ b/includes/Frontend/Frontend_Account.php
@@ -2,6 +2,7 @@
namespace WeDevs\Wpuf\Frontend;
+use stdClass;
use WeDevs\Wpuf\Admin\Subscription;
use WeDevs\Wpuf\User_Subscription;
@@ -306,7 +307,7 @@ public function update_profile() {
if ( empty( $email ) ) {
wp_send_json_error( __( 'Email is a required field.', 'wp-user-frontend' ) );
}
- $user = new \stdClass();
+ $user = new stdClass();
$user->ID = $current_user->ID;
$user->first_name = $first_name;
$user->last_name = $last_name;
diff --git a/includes/Frontend/Frontend_Form.php b/includes/Frontend/Frontend_Form.php
index 17216647d..dbd5e8093 100755
--- a/includes/Frontend/Frontend_Form.php
+++ b/includes/Frontend/Frontend_Form.php
@@ -6,6 +6,7 @@
use WeDevs\Wpuf\Admin\Subscription;
use WeDevs\Wpuf\Frontend_Render_Form;
use WeDevs\Wpuf\Traits\FieldableTrait;
+use WP_User;
class Frontend_Form extends Frontend_Render_Form {
use FieldableTrait;
@@ -390,7 +391,7 @@ public function publish_guest_post() {
* @param array $allcaps
* @param array $caps
* @param array $args
- * @param \WP_User $wp_user
+ * @param WP_User $wp_user
*
* @return array
*/
diff --git a/includes/Frontend/Payment.php b/includes/Frontend/Payment.php
index 64158fa3d..302e7b7cf 100644
--- a/includes/Frontend/Payment.php
+++ b/includes/Frontend/Payment.php
@@ -2,9 +2,11 @@
namespace WeDevs\Wpuf\Frontend;
+use stdClass;
use WeDevs\Wpuf\Admin;
use WeDevs\Wpuf\Ajax;
use WeDevs\Wpuf\WPUF_User;
+use WP_Post;
/**
* WP User Frontend payment gateway handler
@@ -67,7 +69,7 @@ public function get_active_gateways() {
public function payment_page( $content ) {
global $post;
- if ( ! ( $post instanceof \WP_Post ) ) {
+ if ( ! ( $post instanceof WP_Post ) ) {
return $content;
}
@@ -397,7 +399,7 @@ public function send_to_gateway() {
$user_id = $post->post_author;
$userdata = get_userdata( $user_id );
} else {
- $userdata = new \stdClass();
+ $userdata = new stdClass();
$userdata->ID = 0;
$userdata->user_email = '';
$userdata->first_name = '';
diff --git a/includes/Log/WPUF_Log.php b/includes/Log/WPUF_Log.php
index 4fd02ac11..49b7b37ae 100644
--- a/includes/Log/WPUF_Log.php
+++ b/includes/Log/WPUF_Log.php
@@ -5,7 +5,7 @@ class WPUF_Log {
/**
* wpdb query logger
*
- * @var \WPUF_Log_WPDB_Query
+ * @var WPUF_Log_WPDB_Query
*/
public $wpdb_query;
diff --git a/includes/Traits/FieldableTrait.php b/includes/Traits/FieldableTrait.php
index bf5f3fa53..f6a5af63b 100644
--- a/includes/Traits/FieldableTrait.php
+++ b/includes/Traits/FieldableTrait.php
@@ -2,6 +2,7 @@
namespace WeDevs\Wpuf\Traits;
+use Invisible_Recaptcha;
use WeDevs\Wpuf\Fields\Form_Field_Featured_Image;
use WeDevs\Wpuf\Fields\Form_Field_Post_Content;
use WeDevs\Wpuf\Fields\Form_Field_Post_Excerpt;
@@ -289,7 +290,7 @@ public function validate_re_captcha( $no_captcha = '', $invisible = '' ) {
} elseif ( $no_captcha == 0 && 1 == $invisible ) {
$response = null;
$recaptcha = isset( $_POST['g-recaptcha-response'] ) ? sanitize_text_field( wp_unslash( $_POST['g-recaptcha-response'] ) ) : '';
- $object = new \Invisible_Recaptcha( $site_key, $private_key );
+ $object = new Invisible_Recaptcha( $site_key, $private_key );
$response = $object->verifyResponse( $recaptcha );
diff --git a/includes/Traits/TaxableTrait.php b/includes/Traits/TaxableTrait.php
index 287c87029..778b8abad 100644
--- a/includes/Traits/TaxableTrait.php
+++ b/includes/Traits/TaxableTrait.php
@@ -7,6 +7,8 @@
exit;
}
+use WC_Countries;
+use WC_Customer;
use WeDevs\Wpuf\Admin\Forms\Form;
use WeDevs\Wpuf\Data\Country_State;
@@ -324,12 +326,12 @@ function wpuf_current_tax_rate() {
$customer_id = get_current_user_id();
$woo_address = [];
$rates = $this->wpuf_get_tax_rates();
- $customer = new \WC_Customer( $customer_id );
+ $customer = new WC_Customer( $customer_id );
$woo_address = $customer->get_billing();
unset( $woo_address['email'], $woo_address['tel'], $woo_address['phone'], $woo_address['company'] );
- $countries_obj = new \WC_Countries();
+ $countries_obj = new WC_Countries();
$countries_array = $countries_obj->get_countries();
$country_states_array = $countries_obj->get_states();
$woo_address['state'] = isset( $country_states_array[ $woo_address['country'] ][ $woo_address['state'] ] ) ? $country_states_array[ $woo_address['country'] ][ $woo_address['state'] ] : '';
diff --git a/includes/User_Subscription.php b/includes/User_Subscription.php
index 678e17662..cb0774873 100644
--- a/includes/User_Subscription.php
+++ b/includes/User_Subscription.php
@@ -2,7 +2,7 @@
namespace WeDevs\Wpuf;
-/**
+use WP_Error;/**
* User Subscription Class
*
* @since 2.6.0
@@ -48,7 +48,7 @@ public function populate_data() {
/**
* Get the current pack of the user
*
- * @return array|\WP_Error
+ * @return array|WP_Error
*/
public function current_pack() {
$pack = $this->pack;
@@ -56,12 +56,12 @@ public function current_pack() {
if ( ! isset( $this->pack['pack_id'] ) ) {
$pack_page = get_permalink( wpuf_get_option( 'subscription_page', 'wpuf_payment' ) );
- return new \WP_Error( 'no-pack', sprintf( __( 'You must purchase a subscription package before posting', 'wp-user-frontend' ), $pack_page ) );
+ return new WP_Error( 'no-pack', sprintf( __( 'You must purchase a subscription package before posting', 'wp-user-frontend' ), $pack_page ) );
}
// seems like the user has a pack, now check expiration
if ( $this->expired() ) {
- return new \WP_Error( 'expired', __( 'The subscription pack has expired. Please buy a pack.', 'wp-user-frontend' ) );
+ return new WP_Error( 'expired', __( 'The subscription pack has expired. Please buy a pack.', 'wp-user-frontend' ) );
}
return $pack;
diff --git a/includes/WPUF_Privacy.php b/includes/WPUF_Privacy.php
index 6bfda1090..64ae0ac6a 100644
--- a/includes/WPUF_Privacy.php
+++ b/includes/WPUF_Privacy.php
@@ -2,6 +2,8 @@
namespace WeDevs\Wpuf;
+use WP_User;
+
/**
* Class WPUF_Privacy
*
@@ -137,7 +139,7 @@ public function register_erasers( $erasers ) {
*
* @param string $email
*
- * @return \WP_User | String
+ * @return WP_User | String
*/
public static function get_user( $email ) {
$user = get_user_by( 'email', $email );
diff --git a/includes/WPUF_User.php b/includes/WPUF_User.php
index b12533fcd..c53ab824e 100644
--- a/includes/WPUF_User.php
+++ b/includes/WPUF_User.php
@@ -2,6 +2,8 @@
namespace WeDevs\Wpuf;
+use WP_User;
+
/**
* The User Class
*
@@ -19,14 +21,14 @@ class WPUF_User {
/**
* User Object
*
- * @var \WP_User
+ * @var WP_User
*/
public $user;
/**
* The constructor
*
- * @param int|\WP_User $user
+ * @param int|WP_User $user
*/
public function __construct( $user ) {
if ( is_numeric( $user ) ) {
diff --git a/includes/Widgets/Login_Widget.php b/includes/Widgets/Login_Widget.php
index 9e0379a90..adb193b9a 100644
--- a/includes/Widgets/Login_Widget.php
+++ b/includes/Widgets/Login_Widget.php
@@ -3,13 +3,15 @@
namespace WeDevs\Wpuf\Widgets;
use WeDevs\Wpuf\Free\Simple_Login;
+use WP_Error;
+use WP_Widget;
/**
* Ajax Login and Forgot password handler class
*
* @since 2.8
*/
-class Login_Widget extends \WP_Widget {
+class Login_Widget extends WP_Widget {
public function __construct() {
parent::__construct(
@@ -109,7 +111,7 @@ public function ajax_reset_pass() {
private function ajax_lostpassword_retrieve( $user_input ) {
global $wpdb, $wp_hasher;
- $errors = new \WP_Error();
+ $errors = new WP_Error();
if ( empty( $user_input ) ) {
$errors->add( 'empty_username', __( 'ERROR: Enter a username or email address.', 'wp-user-frontend' ) );
diff --git a/includes/class-field-manager.php b/includes/class-field-manager.php
index 36fff5bba..12e556067 100755
--- a/includes/class-field-manager.php
+++ b/includes/class-field-manager.php
@@ -43,7 +43,7 @@ public function get_fields() {
*
* @param string $field_type
*
- * @return \WPUF_Field_Contract
+ * @return WPUF_Field_Contract
*/
public function get_field( $field_type ) {
$fields = $this->get_fields();
diff --git a/includes/upgrades/upgrade-2.1.9.php b/includes/upgrades/upgrade-2.1.9.php
index 31a8000a4..f29cc3b48 100644
--- a/includes/upgrades/upgrade-2.1.9.php
+++ b/includes/upgrades/upgrade-2.1.9.php
@@ -1,5 +1,7 @@
get_all_post_type();
+ $post_type = (new Subscription())->get_all_post_type();
foreach ( $results as $key => $result ) {
$args = [
diff --git a/includes/upgrades/upgrade-2.6.0.php b/includes/upgrades/upgrade-2.6.0.php
index b1c973447..87168df30 100644
--- a/includes/upgrades/upgrade-2.6.0.php
+++ b/includes/upgrades/upgrade-2.6.0.php
@@ -1,5 +1,7 @@
subscription_pack_users();
+ $users = (new Subscription())->subscription_pack_users();
foreach ( $users as $user ) {
$sub_data = get_user_meta( $user->data->ID, '_wpuf_subscription_pack', true );
diff --git a/wpuf-functions.php b/wpuf-functions.php
index 4eb3d8337..cc7e8bfdc 100644
--- a/wpuf-functions.php
+++ b/wpuf-functions.php
@@ -3107,8 +3107,8 @@ function wpuf_get_draft_post_status( $form_settings ) {
*
* @since 2.6.0
*
- * @param array $state
- * @param \WP_Post $post
+ * @param array $state
+ * @param WP_Post $post
*
* @return array
*/
@@ -4676,7 +4676,7 @@ function wpuf_modify_shortcodes( $content ) {
$post = get_post();
- if ( ! ( $post instanceof \WP_Post ) ) {
+ if ( ! ( $post instanceof WP_Post ) ) {
return $content;
}
diff --git a/wpuf.php b/wpuf.php
index 9ba119f77..c2ef1c371 100644
--- a/wpuf.php
+++ b/wpuf.php
@@ -354,7 +354,7 @@ public function get_field_seperator() {
/**
* Returns the singleton instance
*
- * @return \WP_User_Frontend
+ * @return WP_User_Frontend
*/
function wpuf() {
return WP_User_Frontend::instance();