Skip to content

Commit 99a2b35

Browse files
committed
feat(initialize): new filter for class instance
1 parent 7eea83d commit 99a2b35

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.3.3
2+
3+
* Enhancement: New filter on \Initialize to get the class instance
4+
* Updated: CS changes
5+
* Updated: to latest libraries changes
6+
17
## 3.3.2
28

39
* Enhancement: Tests use a dedicated .env file instead to manipulate the env file (GitHub/GitLab CI updated)

plugin-name/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"cmb2/cmb2": "2.9.*",
1818
"composer/installers": "1.x",
1919
"decodelabs/tagged": "^0.11.9",
20-
"freemius/wordpress-sdk": "2.5.*",
20+
"freemius/wordpress-sdk": "2.6.*",
2121
"inpsyde/assets": "^2.8",
2222
"inpsyde/wp-context": "1.3.*",
2323
"johnbillion/extended-cpts": "4.5.*",

plugin-name/engine/Initialize.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private function load_classes() {
9898
} catch ( \Throwable $err ) {
9999
\do_action( 'plugin_name_initialize_failed', $err );
100100

101-
if ( WP_DEBUG ) {
101+
if ( \WP_DEBUG ) {
102102
throw new \Exception( $err->getMessage() ); //phpcs:ignore
103103
}
104104
}
@@ -121,6 +121,12 @@ private function initialize_plugin_class( $classtovalidate ) {
121121
}
122122

123123
$temp = new $classtovalidate;
124+
\add_filter(
125+
'plugin_name_instance_' . $classtovalidate,
126+
function() use ( $temp ) {
127+
return $temp;
128+
}
129+
);
124130

125131
if ( !\method_exists( $temp, 'initialize' ) ) {
126132
return;

0 commit comments

Comments
 (0)