- Timestamp:
- 09/23/2019 08:26:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-recovery-mode-email-service.php
r45932 r46273 139 139 $support = apply_filters( 'recovery_email_support_info', __( 'Please contact your host for assistance with investigating this issue further.' ) ); 140 140 141 /* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT: those are placeholders. */ 141 /** 142 * Filters the debug information included in the fatal error protection email. 143 * 144 * @since 5.3.0 145 * 146 * @param $message array An associated array of debug information. 147 */ 148 $debug = apply_filters( 'recovery_email_debug_info', $this->get_debug( $extension ) ); 149 150 /* translators: Do not translate LINK, EXPIRES, CAUSE, DETAILS, SITEURL, PAGEURL, SUPPORT. DEBUG: those are placeholders. */ 142 151 $message = __( 143 152 'Howdy! … … 154 163 155 164 To keep your site safe, this link will expire in ###EXPIRES###. Don\'t worry about that, though: a new link will be emailed to you if the error occurs again after it expires. 165 166 When seeking help with this issue, you may be asked for some of the following information: 167 ###DEBUG### 156 168 157 169 ###DETAILS###' … … 166 178 '###PAGEURL###', 167 179 '###SUPPORT###', 180 '###DEBUG###', 168 181 ), 169 182 array( … … 175 188 home_url( $_SERVER['REQUEST_URI'] ), 176 189 $support, 190 implode( "\r\n", $debug ), 177 191 ), 178 192 $message … … 237 251 238 252 if ( 'plugin' === $extension['type'] ) { 239 if ( ! function_exists( 'get_plugins' ) ) { 240 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 241 } 242 243 $plugins = get_plugins(); 244 245 $name = ''; 246 247 // Assume plugin main file name first since it is a common convention. 248 if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) { 249 $name = $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]['Name']; 253 $plugin = $this->get_plugin( $extension ); 254 255 if ( false === $plugin ) { 256 $name = $extension['slug']; 250 257 } else { 251 foreach ( $plugins as $file => $plugin_data ) { 252 if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) { 253 $name = $plugin_data['Name']; 254 break; 255 } 256 } 257 } 258 259 if ( empty( $name ) ) { 260 $name = $extension['slug']; 258 $name = $plugin['Name']; 261 259 } 262 260 … … 273 271 return $cause; 274 272 } 273 274 /** 275 * Return the details for a single plugin based on the extension data from an error. 276 * 277 * @since 5.3.0 278 * 279 * @param array $extension The extension that caused the error. 280 * @return bool|array A plugin array {@see get_plugins()} or `false` if no plugin was found. 281 */ 282 private function get_plugin( $extension ) { 283 if ( ! function_exists( 'get_plugins' ) ) { 284 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 285 } 286 287 $plugins = get_plugins(); 288 289 // Assume plugin main file name first since it is a common convention. 290 if ( isset( $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ] ) ) { 291 return $plugins[ "{$extension['slug']}/{$extension['slug']}.php" ]; 292 } else { 293 foreach ( $plugins as $file => $plugin_data ) { 294 if ( 0 === strpos( $file, "{$extension['slug']}/" ) || $file === $extension['slug'] ) { 295 return $plugin_data; 296 } 297 } 298 } 299 300 return false; 301 } 302 303 /** 304 * Return debug information in an easy to manipulate format. 305 * 306 * @since 5.3.0 307 * 308 * @param array $extension The extension that caused the error. 309 * @return array An associated array of debug information. 310 */ 311 private function get_debug( $extension ) { 312 $theme = wp_get_theme(); 313 $wp_version = get_bloginfo( 'version' ); 314 315 if ( $extension ) { 316 $plugin = $this->get_plugin( $extension ); 317 } else { 318 $plugin = null; 319 } 320 321 $debug = array( 322 /* translators: %s: Current WordPress version number. */ 323 'wp' => sprintf( 324 __( 'WordPress version %s' ), 325 $wp_version 326 ), 327 'theme' => sprintf( 328 /* translators: 1: Current active theme name. 2: Current active theme version. */ 329 __( 'Current theme: %1$s (version %2$s)' ), 330 $theme->get( 'Name' ), 331 $theme->get( 'Version' ) 332 ), 333 ); 334 335 if ( null !== $plugin ) { 336 $debug['plugin'] = sprintf( 337 /* translators: 1: The failing plugins name. 2: The failing plugins version. */ 338 __( 'Current plugin: %1$s (version %2$s)' ), 339 $plugin['Name'], 340 $plugin['Version'] 341 ); 342 } 343 344 $debug['php'] = sprintf( 345 /* translators: %s: The currently used PHP version. */ 346 __( 'PHP version %s' ), 347 PHP_VERSION 348 ); 349 350 return $debug; 351 } 275 352 }
Note: See TracChangeset
for help on using the changeset viewer.