Skip to content

Commit c74cb2f

Browse files
committed
Fixed bug in show_notice()
1 parent 83860ed commit c74cb2f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/Plugin.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,33 @@ public function __construct($_settings) {
1515

1616
// Initialize Carbon Fields and verify dependencies
1717
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' ) );
1919

2020
}
2121

2222
public function verify_dependencies() {
23+
2324
// Check if outdated version of Carbon Fields loaded
2425
$error = null;
2526

26-
if(!defined('\\Carbon_Fields\\VERSION')) {
27+
if( !defined('\\Carbon_Fields\\VERSION') ) {
2728
$error = '<strong>' . self::$settings['data']['Name'] . ':</strong> ' . __('A fatal error occurred while trying to initialize plugin.');
2829
} else if( version_compare( \Carbon_Fields\VERSION, self::$settings['deps']['carbon_fields'], '<' ) ) {
2930
$error = '<strong>' . self::$settings['data']['Name'] . ':</strong> ' . __('Unable to load. An outdated version of Carbon Fields has been loaded:' . ' ' . \Carbon_Fields\VERSION) . ' (&gt;= '.self::$settings['deps']['carbon_fields'] . ' ' . __('required') . ')';
3031
}
3132

3233
if($error) $this->show_notice($error, 'error', false);
3334
return !$error;
35+
3436
}
3537

3638
/**
3739
* Helper function to display a notice in the WP Admin
3840
*/
3941
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'] );
4342

43+
if( is_admin() ) {
44+
$class = 'notice notice-' . $type . ( $is_dismissible ? ' is-dismissible' : '' );
4445
printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $msg );
4546
}
4647
}

0 commit comments

Comments
 (0)