@@ -15,32 +15,33 @@ public function __construct($_settings) {
15
15
16
16
// Initialize Carbon Fields and verify dependencies
17
17
add_action ( 'plugins_loaded ' , array ( 'Carbon_Fields \\Carbon_Fields ' , 'boot ' ) );
18
- add_action ( 'carbon_fields_loaded ' , array ( $ this , 'verify_dependencies ' ) );
18
+ add_action ( 'plugins_loaded ' , array ( & $ this , 'verify_dependencies ' ) );
19
19
20
20
}
21
21
22
22
public function verify_dependencies () {
23
+
23
24
// Check if outdated version of Carbon Fields loaded
24
25
$ error = null ;
25
26
26
- if (!defined ('\\Carbon_Fields \\VERSION ' )) {
27
+ if ( !defined ('\\Carbon_Fields \\VERSION ' ) ) {
27
28
$ error = '<strong> ' . self ::$ settings ['data ' ]['Name ' ] . ':</strong> ' . __ ('A fatal error occurred while trying to initialize plugin. ' );
28
29
} else if ( version_compare ( \Carbon_Fields \VERSION , self ::$ settings ['deps ' ]['carbon_fields ' ], '< ' ) ) {
29
30
$ error = '<strong> ' . self ::$ settings ['data ' ]['Name ' ] . ':</strong> ' . __ ('Unable to load. An outdated version of Carbon Fields has been loaded: ' . ' ' . \Carbon_Fields \VERSION ) . ' (>= ' .self ::$ settings ['deps ' ]['carbon_fields ' ] . ' ' . __ ('required ' ) . ') ' ;
30
31
}
31
32
32
33
if ($ error ) $ this ->show_notice ($ error , 'error ' , false );
33
34
return !$ error ;
35
+
34
36
}
35
37
36
38
/**
37
39
* Helper function to display a notice in the WP Admin
38
40
*/
39
41
private function show_notice ($ msg , $ type = 'error ' , $ is_dismissible = false ) {
40
- if (is_admin ()) {
41
- $ class = 'notice notice- ' .$ type .($ is_dismissible ? ' is-dismissible ' : '' );
42
- $ msg = __ ( $ msg , self ::$ settings ['data ' ]['TextDomain ' ] );
43
42
43
+ if ( is_admin () ) {
44
+ $ class = 'notice notice- ' . $ type . ( $ is_dismissible ? ' is-dismissible ' : '' );
44
45
printf ( '<div class="%1$s"><p>%2$s</p></div> ' , $ class , $ msg );
45
46
}
46
47
}
0 commit comments