@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -defined( 'WPINC' ) || die; |
|
3 | +defined('WPINC') || die; |
|
4 | 4 | |
5 | 5 | class GL_BlackBar_Activate |
6 | 6 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public static function isPhpValid() |
28 | 28 | { |
29 | - return !version_compare( PHP_VERSION, static::MIN_PHP_VERSION, '<' ); |
|
29 | + return !version_compare(PHP_VERSION, static::MIN_PHP_VERSION, '<'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function isWpValid() |
36 | 36 | { |
37 | 37 | global $wp_version; |
38 | - return !version_compare( $wp_version, static::MIN_WORDPRESS_VERSION, '<' ); |
|
38 | + return !version_compare($wp_version, static::MIN_WORDPRESS_VERSION, '<'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public static function shouldDeactivate() |
45 | 45 | { |
46 | - if( empty( static::$instance )) { |
|
46 | + if (empty(static::$instance)) { |
|
47 | 47 | static::$instance = new static; |
48 | 48 | } |
49 | - if( !static::isValid() ) { |
|
50 | - add_action( 'activated_plugin', array( static::$instance, 'deactivate' )); |
|
51 | - add_action( 'admin_notices', array( static::$instance, 'deactivate' )); |
|
49 | + if (!static::isValid()) { |
|
50 | + add_action('activated_plugin', array(static::$instance, 'deactivate')); |
|
51 | + add_action('admin_notices', array(static::$instance, 'deactivate')); |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | return false; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @return void |
59 | 59 | */ |
60 | - public function deactivate( $plugin ) |
|
60 | + public function deactivate($plugin) |
|
61 | 61 | { |
62 | - if( static::isValid() )return; |
|
63 | - $pluginName = plugin_basename( dirname( realpath( __FILE__ )).'/'.static::BASENAME ); |
|
64 | - if( $plugin == $pluginName ) { |
|
62 | + if (static::isValid())return; |
|
63 | + $pluginName = plugin_basename(dirname(realpath(__FILE__)).'/'.static::BASENAME); |
|
64 | + if ($plugin == $pluginName) { |
|
65 | 65 | $this->redirect(); //exit |
66 | 66 | } |
67 | - deactivate_plugins( $pluginName ); |
|
67 | + deactivate_plugins($pluginName); |
|
68 | 68 | $this->printNotice(); |
69 | 69 | } |
70 | 70 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function redirect() |
75 | 75 | { |
76 | - wp_safe_redirect( self_admin_url( sprintf( 'plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
77 | - filter_input( INPUT_GET, 'plugin_status' ), |
|
78 | - filter_input( INPUT_GET, 'paged' ), |
|
79 | - filter_input( INPUT_GET, 's' ) |
|
76 | + wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
77 | + filter_input(INPUT_GET, 'plugin_status'), |
|
78 | + filter_input(INPUT_GET, 'paged'), |
|
79 | + filter_input(INPUT_GET, 's') |
|
80 | 80 | ))); |
81 | 81 | exit; |
82 | 82 | } |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | { |
89 | 89 | $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
90 | 90 | $messages = array( |
91 | - __( 'The BlackBar plugin was deactivated.', 'blackbar' ), |
|
92 | - __( 'Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar' ), |
|
93 | - __( 'Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'blackbar' ), |
|
94 | - __( 'PHP version', 'blackbar' ).' '.static::MIN_PHP_VERSION, |
|
95 | - __( 'WordPress version', 'blackbar' ).' '.static::MIN_WORDPRESS_VERSION, |
|
96 | - __( 'Update WordPress', 'blackbar' ), |
|
91 | + __('The BlackBar plugin was deactivated.', 'blackbar'), |
|
92 | + __('Sorry, this plugin requires %s or greater in order to work properly.', 'blackbar'), |
|
93 | + __('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'blackbar'), |
|
94 | + __('PHP version', 'blackbar').' '.static::MIN_PHP_VERSION, |
|
95 | + __('WordPress version', 'blackbar').' '.static::MIN_WORDPRESS_VERSION, |
|
96 | + __('Update WordPress', 'blackbar'), |
|
97 | 97 | ); |
98 | - if( !static::isPhpValid() ) { |
|
99 | - printf( $noticeTemplate, |
|
98 | + if (!static::isPhpValid()) { |
|
99 | + printf($noticeTemplate, |
|
100 | 100 | $messages[0], |
101 | - sprintf( $messages[1], $messages[3] ), |
|
102 | - sprintf( $messages[2], PHP_VERSION ) |
|
101 | + sprintf($messages[1], $messages[3]), |
|
102 | + sprintf($messages[2], PHP_VERSION) |
|
103 | 103 | ); |
104 | 104 | } |
105 | - else if( !static::isWpValid() ) { |
|
106 | - printf( $noticeTemplate, |
|
105 | + else if (!static::isWpValid()) { |
|
106 | + printf($noticeTemplate, |
|
107 | 107 | $messages[0], |
108 | - sprintf( $messages[1], $messages[4] ), |
|
109 | - sprintf( '<a href="%s">%s</a>', admin_url( 'update-core.php' ), $messages[5] ) |
|
108 | + sprintf($messages[1], $messages[4]), |
|
109 | + sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages[5]) |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function deactivate( $plugin ) |
61 | 61 | { |
62 | - if( static::isValid() )return; |
|
62 | + if( static::isValid() ) { |
|
63 | + return; |
|
64 | + } |
|
63 | 65 | $pluginName = plugin_basename( dirname( realpath( __FILE__ )).'/'.static::BASENAME ); |
64 | 66 | if( $plugin == $pluginName ) { |
65 | 67 | $this->redirect(); //exit |
@@ -101,8 +103,7 @@ discard block |
||
101 | 103 | sprintf( $messages[1], $messages[3] ), |
102 | 104 | sprintf( $messages[2], PHP_VERSION ) |
103 | 105 | ); |
104 | - } |
|
105 | - else if( !static::isWpValid() ) { |
|
106 | + } else if( !static::isWpValid() ) { |
|
106 | 107 | printf( $noticeTemplate, |
107 | 108 | $messages[0], |
108 | 109 | sprintf( $messages[1], $messages[4] ), |
@@ -16,10 +16,10 @@ |
||
16 | 16 | * Domain Path: languages |
17 | 17 | */ |
18 | 18 | |
19 | -defined( 'WPINC' ) || die; |
|
19 | +defined('WPINC') || die; |
|
20 | 20 | |
21 | 21 | require_once __DIR__.'/activate.php'; |
22 | -if( \GL_BlackBar_Activate::shouldDeactivate() )return; |
|
22 | +if (\GL_BlackBar_Activate::shouldDeactivate())return; |
|
23 | 23 | |
24 | 24 | require_once __DIR__.'/autoload.php'; |
25 | 25 | (new \GeminiLabs\Blackbar\Application)->init(); |
@@ -19,7 +19,9 @@ |
||
19 | 19 | defined( 'WPINC' ) || die; |
20 | 20 | |
21 | 21 | require_once __DIR__.'/activate.php'; |
22 | -if( \GL_BlackBar_Activate::shouldDeactivate() )return; |
|
22 | +if( \GL_BlackBar_Activate::shouldDeactivate() ) { |
|
23 | + return; |
|
24 | +} |
|
23 | 25 | |
24 | 26 | require_once __DIR__.'/autoload.php'; |
25 | 27 | (new \GeminiLabs\Blackbar\Application)->init(); |