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 84677ee9f..02b1fc6ac 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 @@
"):a(b).find("li.wpuf-submit").append(''+wpuf_frontend.error_message+"
")},removeErrorNotice:function(b){a(b).find(".wpuf-errors").remove()},markError:function(b,c,d){if(a(b).closest("div").addClass("has-error"),c){var e="",f=a(b).data("label");switch(e=f||a(b).closest("li").data("label"),c){case"required":case"mismatch":case"validation":e=e+" "+error_str_obj[c];break;case"limit":e="";break;case"custom":e=d}a(b).siblings(".wpuf-error-msg").remove(),a(b).closest(".wpuf-fields.wpuf-fields-address").length?(a(b).closest("div.wpuf-sub-fields").find("div.wpuf-error-msg").remove(),a(b).closest("div.wpuf-sub-fields").append(''+e+"
")):(a(b).closest("div.wpuf-fields").find("div.wpuf-error-msg").remove(),a(b).closest("div.wpuf-fields").append(''+e+"
"))}},removeErrors:function(b){a(b).find(".has-error").removeClass("has-error"),a(".wpuf-error-msg").remove()},isValidEmail:function(a){return new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i).test(a)},isValidURL:function(a){return new RegExp("^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/){1}[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,20}(:[0-9]{1,20})?(\\/.*)?$").test(a)},insertImage:function(b,c){if(a("#"+b).length){var d=new plupload.Uploader({runtimes:"html5,html4",browse_button:b,container:"wpuf-insert-image-container",multipart:!0,multipart_params:{action:"wpuf_insert_image",form_id:a("#"+b).data("form_id")},multiple_queues:!1,multi_selection:!1,urlstream_upload:!0,file_data_name:"wpuf_file",max_file_size:wpuf_upload.max_filesize,url:wpuf_upload.plupload.url,flash_swf_url:wpuf_upload.flash_swf_url,filters:[{title:"Allowed Files",extensions:"jpg,jpeg,gif,png,bmp"}]});d.bind("Init",function(a,b){}),d.bind("FilesAdded",function(b,c){var d=a("#wpuf-insert-image-container");a.each(c,function(a,b){d.append('')}),b.refresh(),b.start()}),d.bind("QueueChanged",function(a){d.start()}),d.bind("UploadProgress",function(b,c){var d=a("#"+c.id);a(".bar",d).css({width:c.percent+"%"}),a(".percent",d).html(c.percent+"%")}),d.bind("Error",function(a,b){alert("Error #"+b.code+": "+b.message)}),d.bind("FileUploaded",function(b,d,e){if(a("#"+d.id).remove(),"error"!==e.response){if("undefined"!=typeof tinyMCE)if("function"!=typeof tinyMCE.execInstanceCommand){var f=tinyMCE.get("post_content_"+c);null!==f&&f.insertContent(e.response)}else tinyMCE.execInstanceCommand("post_content_"+c,"mceInsertContent",!1,e.response);var g=a("#post_content_"+c);g.val(g.val()+e.response)}else alert("Something went wrong")}),d.init()}},deleteAvatar:function(b){b.preventDefault(),confirm(a(this).data("confirm"))&&a.post(wpuf_frontend.ajaxurl,{action:"wpuf_delete_avatar",_wpnonce:wpuf_frontend.nonce},function(){a(b.target).parent().remove(),a("[id^=wpuf-avatar]").css("display","")})},editorLimit:{bind:function(b,c,d,e,f){"no"===d?(a("textarea#"+c).keyup(function(a){WP_User_Frontend.editorLimit.textLimit.call(this,a,b,e,f)}),a("input#"+c).keyup(function(a){WP_User_Frontend.editorLimit.textLimit.call(this,a,b,e,f)}),a("input#"+c).change(function(a){WP_User_Frontend.editorLimit.textLimit.call(this,a,b,e,f)}),a("textarea#"+c).on("paste",function(c){var d=a(this);setTimeout(function(){WP_User_Frontend.editorLimit.textLimit.call(d,c,b,e,f)},100)}),a("input#"+c).on("paste",function(c){var d=a(this);setTimeout(function(){WP_User_Frontend.editorLimit.textLimit.call(d,c,b,e,f)},100)})):setTimeout(function(){tinyMCE.get(c).onKeyUp.add(function(a,c){WP_User_Frontend.editorLimit.tinymce.onKeyUp(a,c,b,e,f)}),tinyMCE.get(c).onPaste.add(function(a,c){setTimeout(function(){WP_User_Frontend.editorLimit.tinymce.onPaste(a,c,b,e,f)},100)})},1e3)},checkTinyMCERestriction:function(b,c,d){var e=0,f=void 0!==c[0]&&null!==c[0]?parseInt(c[0]):0,g=(void 0!==c[1]&&null!==c[1]&&c[1].trim(),void 0!==c[2]&&null!==c[2]&&c[2].trim(),void 0!==c[3]&&null!==c[3]?c[3].trim():""),h=void 0!==c[4]&&null!==c[4]?c[4].trim():"",i="";"word"===g?(e=WP_User_Frontend.editorLimit.tinymce.getStats(d).words,i="word_"+h):(e=WP_User_Frontend.editorLimit.tinymce.getStats(d).chars,i="char_"+h);wpuf_frontend["word_"+h];return 0!==e&&(e>f&&"max"===h?(WP_User_Frontend.markError(b,"limit"),jQuery(".mce-path-item.mce-last",d.container).html(wpuf_frontend[i]+" "+e+"/"+f),!0):ej&&"max"===l)return WP_User_Frontend.markError(b,"limit"),!0;if(gj&&"max"===l)return WP_User_Frontend.markError(b,"limit"),!0;if(fd&&"max"===f?(WP_User_Frontend.markError(g,"limit"),WP_User_Frontend.contentLimitMessage(a(g),e,f,d)):d&&hd&&"max"===f?(WP_User_Frontend.contentLimitMessage(i,e,f,d),WP_User_Frontend.markError(i,"limit")):d&&hc&&"max"===e?(WP_User_Frontend.contentLimitMessage(f,d,e,c),WP_User_Frontend.markError(f,"limit")):c&&gc&&"max"===e?(WP_User_Frontend.contentLimitMessage(f,d,e,c),WP_User_Frontend.markError(f,"limit")):c&&g=35&&b.keyCode<=40||(b.preventDefault(),b.stopPropagation())},make_media_embed_code:function(b,c){a.post(ajaxurl,{action:"wpuf_make_media_embed_code",content:b},function(a){c.setContent(c.getContent()+c.setContent(a))})}},doUncheckRadioBtn:function(a){a.checked=!1},contentLimitMessage:function(a,b,c,d){var e="";"word"===b?"min"===c?(e=wpuf_frontend.word_min_title+"
",e+=wpuf_frontend.word_min_details.replace("%number%",d)):(e=wpuf_frontend.word_max_title+"
",e+=wpuf_frontend.word_max_details.replace("%number%",d)):"min"===c?(e=wpuf_frontend.char_min_title+"
",e+=wpuf_frontend.char_min_details.replace("%number%",d)):(e=wpuf_frontend.char_max_title+"
",e+=wpuf_frontend.char_max_details.replace("%number%",d)),a.closest(".wpuf-fields").find("span.wpuf-wordlimit-message").html(e)},editorContainingShortcode:function(b){var c=a(b),d=c.data("id"),e=a.trim(tinyMCE.get(d).getContent()).toLowerCase(),f=wpuf_frontend.protected_shortcodes;if(!f)return{shortcodeFound:!1};for(var g=0;g=35&&b.keyCode<=39||(b.shiftKey||(b.keyCode<65||b.keyCode>90)&&(b.keyCode<48||b.keyCode>57))&&(b.keyCode<96||b.keyCode>105)&&b.preventDefault()}),a('.wpuf-form-add input[name="shopurl"]').keyup(function(b){a("#url-alart").text(a(this).val())}),a('.wpuf-form-add input[name="shopurl"]').on("focusout",function(){var b=a(this),c={action:"shop_url",url_slug:b.val(),_nonce:dokan.nonce};""!==b.val()&&a.post(dokan.ajaxurl,c,function(b){0==b?(a("#url-alart").removeClass("text-success").addClass("text-danger"),a("#url-alart-mgs").removeClass("text-success").addClass("text-danger").text(dokan.seller.notAvailable)):(a("#url-alart").removeClass("text-danger").addClass("text-success"),a("#url-alart-mgs").removeClass("text-danger").addClass("text-success").text(dokan.seller.available))})}),a(".wpuf-form-add #wpuf-map-add-location").attr("name","find_address")})}(jQuery,window);
\ No newline at end of file
diff --git a/class/subscription.php b/class/subscription.php
index c39116cc2..8ada87ff0 100644
--- a/class/subscription.php
+++ b/class/subscription.php
@@ -274,8 +274,8 @@ public function get_subscriptions( $args = [] ) {
*
* @since 2.2
*
- * @param int $subscription_id
- * @param \WP_Post $pack_post
+ * @param int $subscription_id
+ * @param WP_Post $pack_post
*
* @return array
*/
@@ -353,8 +353,8 @@ public function change_default_title( $title ) {
/**
* Save form data
*
- * @param int $post_ID
- * @param \WP_Post $post
+ * @param int $post_ID
+ * @param WP_Post $post
*
* @return void
*/
diff --git a/includes/Admin.php b/includes/Admin.php
index 15543b738..66317a63f 100644
--- a/includes/Admin.php
+++ b/includes/Admin.php
@@ -101,36 +101,33 @@ public function enqueue_cpt_page_scripts( $hook_suffix ) {
}
if ( in_array( $hook_suffix, [ 'post.php', 'post-new.php' ], true ) ) {
- $screen = get_current_screen();
- if ( is_object( $screen ) && 'product' === $screen->post_type ) {
- wp_enqueue_script( 'wpuf-upload' );
- wp_localize_script(
- 'wpuf-upload',
- 'wpuf_upload',
- [
- 'confirmMsg' => __( 'Are you sure?', 'wp-user-frontend' ),
- 'delete_it' => __( 'Yes, delete it', 'wp-user-frontend' ),
- 'cancel_it' => __( 'No, cancel it', 'wp-user-frontend' ),
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
- 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
- 'plupload' => [
- 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf-upload-nonce' ),
- 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
- 'filters' => [
- [
- 'title' => __( 'Allowed Files', 'wp-user-frontend' ),
- 'extensions' => '*',
- ],
+ wp_enqueue_script( 'wpuf-upload' );
+ wp_localize_script(
+ 'wpuf-upload',
+ 'wpuf_upload',
+ [
+ 'confirmMsg' => __( 'Are you sure?', 'wp-user-frontend' ),
+ 'delete_it' => __( 'Yes, delete it', 'wp-user-frontend' ),
+ 'cancel_it' => __( 'No, cancel it', 'wp-user-frontend' ),
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
+ 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
+ 'plupload' => [
+ 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf-upload-nonce' ),
+ 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
+ 'filters' => [
+ [
+ 'title' => __( 'Allowed Files', 'wp-user-frontend' ),
+ 'extensions' => '*',
],
- 'multipart' => true,
- 'urlstream_upload' => true,
- 'warning' => __( 'Maximum number of files reached!', 'wp-user-frontend' ),
- 'size_error' => __( 'The file you have uploaded exceeds the file size limit. Please try again.', 'wp-user-frontend' ),
- 'type_error' => __( 'You have uploaded an incorrect file type. Please try again.', 'wp-user-frontend' ),
],
- ]
- );
- }
+ 'multipart' => true,
+ 'urlstream_upload' => true,
+ 'warning' => __( 'Maximum number of files reached!', 'wp-user-frontend' ),
+ 'size_error' => __( 'The file you have uploaded exceeds the file size limit. Please try again.', 'wp-user-frontend' ),
+ 'type_error' => __( 'You have uploaded an incorrect file type. Please try again.', 'wp-user-frontend' ),
+ ],
+ ]
+ );
}
}
diff --git a/includes/Admin/Admin_Settings.php b/includes/Admin/Admin_Settings.php
index 75b774ed2..13fd484c3 100644
--- a/includes/Admin/Admin_Settings.php
+++ b/includes/Admin/Admin_Settings.php
@@ -2,6 +2,8 @@
namespace WeDevs\Wpuf\Admin;
+use WeDevs_Settings_API;
+
/**
* WPUF settings
*/
@@ -10,7 +12,7 @@ class Admin_Settings {
/**
* Settings API
*
- * @var \WeDevs_Settings_API
+ * @var WeDevs_Settings_API
*/
private $settings_api;
@@ -27,7 +29,7 @@ public function __construct() {
wpuf_require_once( WPUF_INCLUDES . '/functions/settings-options.php' );
wpuf_require_once( WPUF_ROOT . '/Lib/WeDevs_Settings_API.php' );
- $this->settings_api = new \WeDevs_Settings_API();
+ $this->settings_api = new WeDevs_Settings_API();
add_action( 'admin_init', [ $this, 'admin_init' ] );
}
@@ -173,7 +175,7 @@ public function is_admin_menu_page( $screen ) {
*
* @since 4.0.0
*
- * @return \WeDevs_Settings_API
+ * @return WeDevs_Settings_API
*/
public function get_settings_api() {
return $this->settings_api;
diff --git a/includes/Admin/Admin_Tools.php b/includes/Admin/Admin_Tools.php
index f45049ea8..83dab2344 100644
--- a/includes/Admin/Admin_Tools.php
+++ b/includes/Admin/Admin_Tools.php
@@ -2,6 +2,8 @@
namespace WeDevs\Wpuf\Admin;
+use WP_Query;
+
/**
* Manage Import Export
*
@@ -255,7 +257,7 @@ public static function export_to_json( $post_type, $post_ids = [] ) {
'post__in' => ( !empty( $ids ) ) ? $ids : '',
];
- $query = new \WP_Query( $args );
+ $query = new WP_Query( $args );
foreach ( $query->posts as $post ) {
$postdata = get_object_vars( $post );
@@ -520,7 +522,7 @@ public function check_filetype_and_ext( $info ) {
* @return void
*/
public function delete_post_type( $post_type ) {
- $query = new \WP_Query(
+ $query = new WP_Query(
[
'post_type' => $post_type,
'posts_per_page' => -1,
diff --git a/includes/Admin/Dashboard_Metabox.php b/includes/Admin/Dashboard_Metabox.php
index ee9532fee..73b34fee5 100644
--- a/includes/Admin/Dashboard_Metabox.php
+++ b/includes/Admin/Dashboard_Metabox.php
@@ -2,6 +2,9 @@
namespace WeDevs\Wpuf\Admin;
+use DOMDocument;
+use DomXPath;
+
class Dashboard_Metabox {
const URL = 'https://wedevs.com/category/user-frontend-pro';
const OPT_KEY = 'wpuf_admin_db_mb';
@@ -67,7 +70,7 @@ public function render_metabox() {
?>
-
+
@@ -84,7 +87,7 @@ public function render_metabox() {
target="_blank">
-
+
@@ -101,9 +104,9 @@ private function fetch_articles() {
return [];
}
$body = wp_remote_retrieve_body( $response );
- $dom = new \DOMDocument();
+ $dom = new DOMDocument();
@$dom->loadHTML( $body );
- $finder = new \DomXPath( $dom );
+ $finder = new DomXPath( $dom );
$classname = 'post__title';
$nodes = $finder->query( "//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]" );
if ( empty( $nodes ) ) {
diff --git a/includes/Admin/Forms/Field_Manager.php b/includes/Admin/Forms/Field_Manager.php
index 48189dba0..f07360528 100755
--- a/includes/Admin/Forms/Field_Manager.php
+++ b/includes/Admin/Forms/Field_Manager.php
@@ -3,6 +3,7 @@
namespace WeDevs\Wpuf\Admin\Forms;
use WeDevs\Wpuf\Admin\Subscription;
+use WeDevs\Wpuf\Fields\Field_Contract;
use WeDevs\Wpuf\Fields\Form_Field_Checkbox;
use WeDevs\Wpuf\Fields\Form_Field_Column;
use WeDevs\Wpuf\Fields\Form_Field_Dropdown;
@@ -65,7 +66,7 @@ public function get_fields() {
*
* @param string $field_type
*
- * @return \WeDevs\Wpuf\Fields\Field_Contract
+ * @return Field_Contract
*/
public function get_field( $field_type ) {
$fields = $this->get_fields();
diff --git a/includes/Admin/Forms/Form.php b/includes/Admin/Forms/Form.php
index bf25f03e0..80e4f82d7 100644
--- a/includes/Admin/Forms/Form.php
+++ b/includes/Admin/Forms/Form.php
@@ -2,6 +2,7 @@
namespace WeDevs\Wpuf\Admin\Forms;
+#[AllowDynamicProperties]
class Form {
/**
diff --git a/includes/Admin/Forms/Post/Templates/List_Table_Admin_Post_Forms.php b/includes/Admin/Forms/Post/Templates/List_Table_Admin_Post_Forms.php
index 21d7d2c13..7a34cfbb4 100644
--- a/includes/Admin/Forms/Post/Templates/List_Table_Admin_Post_Forms.php
+++ b/includes/Admin/Forms/Post/Templates/List_Table_Admin_Post_Forms.php
@@ -3,6 +3,7 @@
namespace WeDevs\Wpuf\Admin\Forms\Post\Templates;
use WP_List_Table;
+use WP_Query;
if ( ! class_exists( 'WP_List_Table' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
@@ -269,7 +270,7 @@ public function item_query( $args ) {
$args['post_type'] = 'wpuf_forms';
- $query = new \WP_Query( $args );
+ $query = new WP_Query( $args );
$forms = [];
diff --git a/includes/Admin/Forms/Post/Templates/Pro_Form_Preview_EDD.php b/includes/Admin/Forms/Post/Templates/Pro_Form_Preview_EDD.php
index 01d1d0709..ffb2e5fdb 100644
--- a/includes/Admin/Forms/Post/Templates/Pro_Form_Preview_EDD.php
+++ b/includes/Admin/Forms/Post/Templates/Pro_Form_Preview_EDD.php
@@ -1,9 +1,12 @@
setTimezone( new \DateTimeZone( 'EST' ) );
+ $dt = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
+ $dt->setTimezone( new DateTimeZone( 'EST' ) );
return $dt->format( 'Y-m-d H:i:s T' );
}
diff --git a/includes/Admin/Shortcodes_Button.php b/includes/Admin/Shortcodes_Button.php
index c4a63c5f8..e51f540d5 100644
--- a/includes/Admin/Shortcodes_Button.php
+++ b/includes/Admin/Shortcodes_Button.php
@@ -122,7 +122,13 @@ public function localize_shortcodes() {
* @return array
*/
public function enqueue_plugin_scripts( $plugin_array ) {
- //enqueue TinyMCE plugin script with its ID.
+ global $pagenow;
+
+ if ( ! in_array( $pagenow, [ 'post.php', 'post-new.php' ] ) ) {
+ return $plugin_array;
+ }
+
+ // enqueue TinyMCE plugin script with its ID.
$plugin_array['wpuf_button'] = WPUF_ASSET_URI . '/js/wpuf-tmc-button.js';
return $plugin_array;
diff --git a/includes/Admin/Subscription.php b/includes/Admin/Subscription.php
index 6fb57a42c..78d96a757 100644
--- a/includes/Admin/Subscription.php
+++ b/includes/Admin/Subscription.php
@@ -5,6 +5,7 @@
use WeDevs\Wpuf\Admin\Forms\Form;
use WeDevs\Wpuf\Traits\TaxableTrait;
use WeDevs\Wpuf\User_Subscription;
+use WP_Post;
/**
* WPUF subscription manager
@@ -270,7 +271,7 @@ public function get_subscriptions( $args = [] ) {
* @since 2.2
*
* @param int $subscription_id
- * @param \WP_Post $pack_post
+ * @param WP_Post $pack_post
*
* @return array
*/
@@ -349,7 +350,7 @@ public function change_default_title( $title ) {
* Save form data
*
* @param int $post_ID
- * @param \WP_Post $post
+ * @param WP_Post $post
*
* @return void
*/
diff --git a/includes/Admin/Whats_New.php b/includes/Admin/Whats_New.php
index 792d38030..a454e26de 100644
--- a/includes/Admin/Whats_New.php
+++ b/includes/Admin/Whats_New.php
@@ -13,8 +13,12 @@ class Whats_New {
* Initialize the actions
*/
public function __construct() {
- add_action( 'admin_menu', [ $this, 'register_menu' ] );
- add_action( 'admin_notices', [ $this, 'admin_notice' ] );
+ if ( $this->has_new() ) {
+ add_action( 'admin_menu', [ $this, 'register_menu' ] );
+ add_action( 'admin_notices', [ $this, 'admin_notice' ] );
+ }
+
+
}
/**
@@ -64,7 +68,14 @@ public function get_option() {
* @return void
*/
public function register_menu() {
- $whats_new_page = add_submenu_page( null, __( 'Whats New', 'wp-user-frontend' ), __( 'Whats New', 'wp-user-frontend' ), 'manage_options', 'whats-new-wpuf', [ $this, 'menu_page' ] );
+ $whats_new_page = add_submenu_page(
+ wpuf()->admin->menu->parent_slug,
+ __( 'Whats New', 'wp-user-frontend' ),
+ __( 'Whats New', 'wp-user-frontend' ),
+ wpuf_admin_role(),
+ 'whats-new-wpuf',
+ [ $this, 'menu_page' ]
+ );
add_action( 'load-' . $whats_new_page, [ $this, 'enqueue_scripts' ] );
}
@@ -86,10 +97,6 @@ public function menu_page() {
* @return void
*/
public function admin_notice() {
- if ( !$this->has_new() ) {
- return;
- }
-
wp_enqueue_script( 'wp-util' );
?>
@@ -105,7 +112,7 @@ public function admin_notice() {
diff --git a/includes/Ajax/Frontend_Form_Ajax.php b/includes/Ajax/Frontend_Form_Ajax.php
index 617628583..3b27546b6 100644
--- a/includes/Ajax/Frontend_Form_Ajax.php
+++ b/includes/Ajax/Frontend_Form_Ajax.php
@@ -2,10 +2,13 @@
namespace WeDevs\Wpuf\Ajax;
+use DOMDocument;
use WeDevs\Wpuf\Admin\Forms\Form;
use WeDevs\Wpuf\Traits\FieldableTrait;
use WeDevs\Wpuf\User_Subscription;
+use WP_Error;
+#[AllowDynamicProperties]
class Frontend_Form_Ajax {
use FieldableTrait;
@@ -302,7 +305,7 @@ public function submit_post() {
// find our if any images in post content and associate them
if ( ! empty( $postarr['post_content'] ) ) {
- $dom = new \DOMDocument();
+ $dom = new DOMDocument();
@$dom->loadHTML( $postarr['post_content'] );
$images = $dom->getElementsByTagName( 'img' );
@@ -516,7 +519,7 @@ public function wpuf_get_post_user() {
$user_pass = wp_generate_password( 12, false );
- $errors = new \WP_Error();
+ $errors = new WP_Error();
do_action( 'register_post', $username, $guest_email, $errors );
diff --git a/includes/Encryption_Helper.php b/includes/Encryption_Helper.php
index f03f16d6d..a8fee4a03 100644
--- a/includes/Encryption_Helper.php
+++ b/includes/Encryption_Helper.php
@@ -2,6 +2,8 @@
namespace WeDevs\Wpuf;
+use Exception;
+
/**
* The Encryption_Helper Class to handle the encryption
*/
@@ -50,7 +52,7 @@ public static function get_encryption_key_length() {
* @since 3.5.29
*
* @return array
- * @throws \Exception
+ * @throws Exception
*/
public static function get_encryption_auth_keys() {
$defaults = [
diff --git a/includes/Fields/Form_Field_Post_Taxonomy.php b/includes/Fields/Form_Field_Post_Taxonomy.php
index 4fbe85855..be5a45ac5 100755
--- a/includes/Fields/Form_Field_Post_Taxonomy.php
+++ b/includes/Fields/Form_Field_Post_Taxonomy.php
@@ -5,6 +5,9 @@
// Post Taxonomy Class
// require WPUF_INCLUDES . '/fields/class-abstract-fields.php';
+use WPUF_Walker_Category_Multi;
+
+#[AllowDynamicProperties]
class Form_Field_Post_Taxonomy extends Field_Contract {
use Form_Field_Post_Trait;
@@ -379,7 +382,7 @@ public function tax_multiselect( $post_id = null ) {
$required = sprintf( 'data-required="%s" data-type="multiselect"', $attr['required'] );
- $walker = new \WPUF_Walker_Category_Multi();
+ $walker = new WPUF_Walker_Category_Multi();
$exclude = wpuf_get_field_settings_excludes( $this->field_settings, $this->exclude_type );
diff --git a/includes/Free/Edit_Profile.php b/includes/Free/Edit_Profile.php
index 1a9fb05a3..06d90339a 100644
--- a/includes/Free/Edit_Profile.php
+++ b/includes/Free/Edit_Profile.php
@@ -220,7 +220,7 @@ public function show_form( $user_id = null ) {
strong: "Strong",
mismatch: "Mismatch"
};
- try{convertEntities(pwsL10n);}catch(e){};
+ try{convertEntities(pwsL10n);}catch(e){}
diff --git a/includes/Free/templates/page-registration-form.php b/includes/Free/templates/page-registration-form.php
index 87f6ca1e5..66c32aa09 100644
--- a/includes/Free/templates/page-registration-form.php
+++ b/includes/Free/templates/page-registration-form.php
@@ -82,7 +82,7 @@
-
+
diff --git a/includes/Frontend.php b/includes/Frontend.php
index 803304231..f23273e23 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 2feb9e8f6..59ecc1d1f 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;
@@ -314,7 +315,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 dac451e70..ec00b15dc 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;
@@ -377,7 +378,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 3e766a3d1..650c71060 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 a31560ffe..38b1cb062 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 53f526989..3ecb6d8b7 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 9b67b0648..a5e286d88 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();