PluginProbe
WP Debugging / 2.11.6
WP Debugging v2.11.6
2.12.6 2.12.5 trunk 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.11.10 2.11.11 2.11.12 2.11.13 2.11.14 2.11.15 2.11.16 2.11.17 2.11.18 2.11.19 2.11.2 2.11.20 2.11.21 2.11.22 2.11.23 2.11.24 2.11.3 All 59 releases
← All changes | src/Bootstrap.php +13 -21 trunk2.11.6 View file →
@@ -63,9 +63,9 @@
63 63 $this->file = $file;
64 64 $this->dir = dirname( $file );
65 65 self::$options = get_site_option( 'wp_debugging', [ 'wp_debug' => '1' ] );
66 66 self::$config_path = $this->get_config_path();
67 - @ini_set( 'display_errors', 1 ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted,WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.PHP.IniSet.display_errors_Disallowed
67 + @ini_set( 'display_errors', 1 ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted
68 68 }
69 69
70 70 /**
71 71 * Test for writable wp-config.php, exit with notice if not available.
@@ -72,19 +72,8 @@
72 72 *
73 73 * @return bool|void
74 74 */
75 75 public function init() {
76 - register_activation_hook( $this->file, [ $this, 'activate' ] );
77 - register_deactivation_hook( $this->file, [ $this, 'deactivate' ] );
78 -
79 - // Load settings hooks and exit if not on WP Debugging settings page.
80 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended
81 - if ( ! isset( $_REQUEST['page'] ) || 'wp-debugging' !== sanitize_key( wp_unslash( $_REQUEST['page'] ) ) ) {
82 - ( new Settings( self::$options, self::$config_path, $this->defined_constants ) )
83 - ->load_hooks();
84 - return;
85 - }
86 -
87 76 if ( ! is_writable( self::$config_path ) ) {
88 77 echo '<div class="error notice is-dismissible"><p>';
89 78 echo wp_kses_post( __( 'The <strong>WP Debugging</strong> plugin must have a <code>wp-config.php</code> file that is writable by the filesystem.', 'wp-debugging' ) );
90 79 echo '</p></div>';
@@ -92,8 +81,9 @@
92 81 return false;
93 82 }
94 83
95 84 $this->load_hooks();
85 + \WP_Dependency_Installer::instance()->run( $this->dir );
96 86 }
97 87
98 88 /**
99 89 * Get the `wp-config.php` file path.
@@ -107,9 +97,8 @@
107 97 public function get_config_path() {
108 98 $config_path = ABSPATH . 'wp-config.php';
109 99
110 100 if ( ! file_exists( $config_path ) ) {
111 - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
112 101 if ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
113 102 $config_path = dirname( ABSPATH ) . '/wp-config.php';
114 103 }
115 104 }
@@ -131,14 +120,20 @@
131 120 */
132 121 public function load_hooks() {
133 122 add_action(
134 123 'plugins_loaded',
135 - function () {
124 + function() {
136 125 ( new Settings( self::$options, self::$config_path, $this->defined_constants ) )
137 126 ->load_hooks()
138 127 ->process_filter_constants();
139 128 }
140 129 );
130 + add_action(
131 + 'init',
132 + function () {
133 + load_plugin_textdomain( 'wp-debugging' );
134 + }
135 + );
141 136 add_filter(
142 137 'wp_dependency_timeout',
143 138 function ( $timeout, $source ) {
144 139 $timeout = basename( $this->dir ) !== $source ? $timeout : 45;
@@ -147,14 +142,11 @@
147 142 },
148 143 10,
149 144 2
150 145 );
151 - add_action(
152 - 'plugins_loaded',
153 - function () {
154 - \WP_Dependency_Installer::instance()->run( $this->dir );
155 - }
156 - );
146 +
147 + register_activation_hook( $this->file, [ $this, 'activate' ] );
148 + register_deactivation_hook( $this->file, [ $this, 'deactivate' ] );
157 149 }
158 150
159 151 /**
160 152 * Run on activation.
@@ -185,9 +177,9 @@
185 177 */
186 178 public function deactivate() {
187 179 $restore_constants = get_site_option( 'wp_debugging_restore' );
188 180 $remove_user_added = array_diff( self::$options, array_flip( $this->defined_constants ) );
189 - $remove_constants = array_diff( array_flip( $this->defined_constants ), array_keys( (array) $restore_constants ) );
181 + $remove_constants = array_diff( array_flip( $this->defined_constants ), array_keys( $restore_constants ) );
190 182 $remove_constants = array_merge( $remove_constants, $remove_user_added );
191 183
192 184 ( new Settings( self::$options, self::$config_path, $this->defined_constants ) )->remove_constants( $remove_constants );
193 185