|
28 | 28 | along with this program. If not, see <https://www.gnu.org/licenses/>.
|
29 | 29 | */
|
30 | 30 |
|
31 |
| -defined( 'ABSPATH' ) or exit; |
| 31 | +defined('ABSPATH') or exit; |
32 | 32 |
|
33 |
| -add_action( 'plugins_loaded', function() { |
34 |
| - // check for MailChimp for WordPress (version 3.0 or higher) |
35 |
| - if ( !defined( 'MC4WP_VERSION' ) || version_compare( MC4WP_VERSION, '3.0', '<' ) ) { |
36 |
| - // Show notice to user |
37 |
| - add_action( 'admin_notices', function() { |
| 33 | +add_action('plugins_loaded', function () { |
| 34 | + // check for MailChimp for WordPress (version 3.0 or higher) |
| 35 | + if (!defined('MC4WP_VERSION') || version_compare(MC4WP_VERSION, '3.0', '<')) { |
| 36 | + // Show notice to user |
| 37 | + add_action('admin_notices', function () { |
38 | 38 |
|
39 |
| - // only show to user with caps |
40 |
| - if( ! current_user_can( 'install_plugins' ) ) { |
41 |
| - return; |
42 |
| - } |
| 39 | + // only show to user with caps |
| 40 | + if (! current_user_can('install_plugins')) { |
| 41 | + return; |
| 42 | + } |
43 | 43 |
|
44 |
| - add_thickbox(); |
45 |
| - $url = network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=mailchimp-for-wp&TB_iframe=true&width=600&height=550' ); |
46 |
| - ?> |
47 |
| - <div class="notice notice-warning is-dismissible"> |
48 |
| - <p><?php printf( __( 'Please install or update <a href="%s" class="thickbox">%s</a> in order to use %s.', 'mailchimp-top-bar' ), $url, '<strong>MailChimp for WordPress</strong> (version 3.0 or higher)', 'MailChimp Top Bar' ); ?></p> |
49 |
| - </div> |
50 |
| - <?php |
51 |
| - }); |
52 |
| - return; |
53 |
| - } |
| 44 | + add_thickbox(); |
| 45 | + $url = network_admin_url('plugin-install.php?tab=plugin-information&plugin=mailchimp-for-wp&TB_iframe=true&width=600&height=550'); |
| 46 | + ?> |
| 47 | + <div class="notice notice-warning is-dismissible"> |
| 48 | + <p><?php printf(__('Please install or update <a href="%s" class="thickbox">%s</a> in order to use %s.', 'mailchimp-top-bar'), $url, '<strong>MailChimp for WordPress</strong> (version 3.0 or higher)', 'MailChimp Top Bar'); ?></p> |
| 49 | + </div> |
| 50 | + <?php |
| 51 | + }); |
| 52 | + return; |
| 53 | + } |
54 | 54 |
|
55 | 55 |
|
56 |
| - define('MAILCHIMP_TOP_BAR_FILE', __FILE__); |
57 |
| - define('MAILCHIMP_TOP_BAR_DIR', __DIR__); |
58 |
| - define('MAILCHIMP_TOP_BAR_VERSION', '1.6.2'); |
| 56 | + define('MAILCHIMP_TOP_BAR_FILE', __FILE__); |
| 57 | + define('MAILCHIMP_TOP_BAR_DIR', __DIR__); |
| 58 | + define('MAILCHIMP_TOP_BAR_VERSION', '1.6.2'); |
59 | 59 |
|
60 |
| - require __DIR__ . '/src/functions.php'; |
| 60 | + require __DIR__ . '/src/functions.php'; |
61 | 61 |
|
62 |
| - if( ! is_admin() ) { |
63 |
| - // frontend code |
64 |
| - require __DIR__ . '/src/Bar.php'; |
65 |
| - $bar = new MailChimp\TopBar\Bar(); |
66 |
| - $bar->add_hooks(); |
67 |
| - } elseif( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
68 |
| - // ajax code |
69 |
| - |
70 |
| - } else { |
71 |
| - // admin code |
72 |
| - require __DIR__ . '/src/Admin.php'; |
73 |
| - $admin = new Mailchimp\TopBar\Admin(); |
74 |
| - $admin->add_hooks(); |
75 |
| - } |
76 |
| - |
77 |
| -}, 30 ); |
| 62 | + if (! is_admin()) { |
| 63 | + // frontend code |
| 64 | + require __DIR__ . '/src/Bar.php'; |
| 65 | + $bar = new MailChimp\TopBar\Bar(); |
| 66 | + $bar->add_hooks(); |
| 67 | + } elseif (defined('DOING_AJAX') && DOING_AJAX) { |
| 68 | + // ajax code |
| 69 | + } else { |
| 70 | + // admin code |
| 71 | + require __DIR__ . '/src/Admin.php'; |
| 72 | + $admin = new Mailchimp\TopBar\Admin(); |
| 73 | + $admin->add_hooks(); |
| 74 | + } |
| 75 | +}, 30); |
0 commit comments