WP "
@@ -6751,62 +6751,62 @@ msgstr ""
msgid "https://wedevs.com/?utm_source=WPUF_Author_URI"
msgstr ""
-#: includes/Setup_Wizard.php:44
+#: includes/Setup_Wizard.php:56
msgctxt "enhanced select"
msgid "One result is available, press enter to select it."
msgstr ""
-#: includes/Setup_Wizard.php:47
+#: includes/Setup_Wizard.php:59
msgctxt "enhanced select"
msgid "%qty% results are available, use up and down arrow keys to navigate."
msgstr ""
-#: includes/Setup_Wizard.php:51
+#: includes/Setup_Wizard.php:63
msgctxt "enhanced select"
msgid "No matches found"
msgstr ""
-#: includes/Setup_Wizard.php:52
+#: includes/Setup_Wizard.php:64
msgctxt "enhanced select"
msgid "Loading failed"
msgstr ""
-#: includes/Setup_Wizard.php:53
+#: includes/Setup_Wizard.php:65
msgctxt "enhanced select"
msgid "Please enter 1 or more characters"
msgstr ""
-#: includes/Setup_Wizard.php:56
+#: includes/Setup_Wizard.php:68
msgctxt "enhanced select"
msgid "Please enter %qty% or more characters"
msgstr ""
-#: includes/Setup_Wizard.php:59
+#: includes/Setup_Wizard.php:71
msgctxt "enhanced select"
msgid "Please delete 1 character"
msgstr ""
-#: includes/Setup_Wizard.php:60
+#: includes/Setup_Wizard.php:72
msgctxt "enhanced select"
msgid "Please delete %qty% characters"
msgstr ""
-#: includes/Setup_Wizard.php:63
+#: includes/Setup_Wizard.php:75
msgctxt "enhanced select"
msgid "You can only select 1 item"
msgstr ""
-#: includes/Setup_Wizard.php:66
+#: includes/Setup_Wizard.php:78
msgctxt "enhanced select"
msgid "You can only select %qty% items"
msgstr ""
-#: includes/Setup_Wizard.php:69
+#: includes/Setup_Wizard.php:81
msgctxt "enhanced select"
msgid "Loading more results…"
msgstr ""
-#: includes/Setup_Wizard.php:72
+#: includes/Setup_Wizard.php:84
msgctxt "enhanced select"
msgid "Searching…"
msgstr ""
diff --git a/package-lock.json b/package-lock.json
index e943414af..68c0871d9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "wp-user-frontend",
- "version": "4.0.8",
+ "version": "4.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index f761b724d..1f6e4c21f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "wp-user-frontend",
- "version": "4.0.8",
+ "version": "4.0.9",
"description": "A Frontend Plugin for WordPress",
"author": "Tareq Hasan",
"license": "GPL",
diff --git a/wpuf.php b/wpuf.php
index 53718f063..37a7f9a38 100644
--- a/wpuf.php
+++ b/wpuf.php
@@ -30,21 +30,13 @@
define( 'WPUF_ASSET_URI', WPUF_ROOT_URI . '/assets' );
define( 'WPUF_INCLUDES', WPUF_ROOT . '/includes' );
-use WeDevs\WpUtils\ContainerTrait;
use WeDevs\WpUtils\SingletonTrait;
-// Use the fully-qualified AllowDynamicProperties, otherwise the #[AllowDynamicProperties] attribute WILL NOT WORK.
-use \AllowDynamicProperties;
-
/**
* Main bootstrap class for WP User Frontend
*/
-
-/*Marking a class with #[AllowDynamicProperties] is fully backwards-compatible with earlier PHP versions, because prior to PHP 8.0 this would be interpreted as a comment, and the use non-existent classes as attributes is not an error.*/
-#[AllowDynamicProperties]
final class WP_User_Frontend {
use SingletonTrait;
- use ContainerTrait;
/**
* Form field value seperator
@@ -67,6 +59,15 @@ final class WP_User_Frontend {
*/
private $min_php = '5.6';
+ /**
+ * Holds various class instances
+ *
+ * @since WPUF_SINCE
+ *
+ * @var array
+ */
+ public $container = [];
+
/**
* Fire up the plugin
*/
@@ -165,24 +166,24 @@ public function includes() {
* @return void
*/
public function instantiate() {
- $this->assets = new WeDevs\Wpuf\Assets();
- $this->subscription = new WeDevs\Wpuf\Admin\Subscription();
- $this->fields = new WeDevs\Wpuf\Admin\Forms\Field_Manager();
- $this->customize = new WeDevs\Wpuf\Admin\Customizer_Options();
- $this->bank = new WeDevs\Wpuf\Lib\Gateway\Bank();
- $this->paypal = new WeDevs\Wpuf\Lib\Gateway\Paypal();
+ $this->container['assets'] = new WeDevs\Wpuf\Assets();
+ $this->container['subscription'] = new WeDevs\Wpuf\Admin\Subscription();
+ $this->container['fields'] = new WeDevs\Wpuf\Admin\Forms\Field_Manager();
+ $this->container['customize'] = new WeDevs\Wpuf\Admin\Customizer_Options();
+ $this->container['bank'] = new WeDevs\Wpuf\Lib\Gateway\Bank();
+ $this->container['paypal'] = new WeDevs\Wpuf\Lib\Gateway\Paypal();
if ( is_admin() ) {
- $this->admin = new WeDevs\Wpuf\Admin();
- $this->setup_wizard = new WeDevs\Wpuf\Setup_Wizard();
- $this->pro_upgrades = new WeDevs\Wpuf\Pro_Upgrades();
- $this->privacy = new WeDevs\Wpuf\WPUF_Privacy();
+ $this->container['admin'] = new WeDevs\Wpuf\Admin();
+ $this->container['setup_wizard'] = new WeDevs\Wpuf\Setup_Wizard();
+ $this->container['pro_upgrades'] = new WeDevs\Wpuf\Pro_Upgrades();
+ $this->container['privacy'] = new WeDevs\Wpuf\WPUF_Privacy();
} else {
- $this->frontend = new WeDevs\Wpuf\Frontend();
+ $this->container['frontend'] = new WeDevs\Wpuf\Frontend();
}
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
- $this->ajax = new WeDevs\Wpuf\Ajax();
+ $this->container['ajax'] = new WeDevs\Wpuf\Ajax();
}
}
@@ -208,7 +209,7 @@ public function plugin_upgrades() {
return;
}
- $this->upgrades = new WeDevs\Wpuf\Admin\Upgrades();
+ $this->container['upgrades'] = new WeDevs\Wpuf\Admin\Upgrades();
}
/**
@@ -257,7 +258,7 @@ public function wpuf_loader() {
if ( $has_pro ) {
$this->is_pro = true;
} else {
- $this->free_loader = new WeDevs\Wpuf\Free\Free_Loader();
+ $this->container['free_loader'] = new WeDevs\Wpuf\Free\Free_Loader();
}
// Remove the what's new option.
@@ -337,7 +338,7 @@ public function plugin_action_links( $links ) {
* @return void
*/
public function register_widgets() {
- $this->widgets = new WeDevs\Wpuf\Widgets\Manager();
+ $this->container['widgets'] = new WeDevs\Wpuf\Widgets\Manager();
}
public function license_expired() {
echo '';
@@ -355,6 +356,21 @@ public function license_expired() {
public function get_field_seperator() {
return self::$field_separator;
}
+
+ /**
+ * Magic getter to bypass referencing objects
+ *
+ * @since WPUF_SINCE
+ *
+ * @param string $prop
+ *
+ * @return object Class Instance
+ */
+ public function __get( $prop ) {
+ if ( array_key_exists( $prop, $this->container ) ) {
+ return $this->container[ $prop ];
+ }
+ }
}
/**