wp/wp-includes/class-wp-recovery-mode.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     9 /**
     9 /**
    10  * Core class used to implement Recovery Mode.
    10  * Core class used to implement Recovery Mode.
    11  *
    11  *
    12  * @since 5.2.0
    12  * @since 5.2.0
    13  */
    13  */
       
    14 #[AllowDynamicProperties]
    14 class WP_Recovery_Mode {
    15 class WP_Recovery_Mode {
    15 
    16 
    16 	const EXIT_ACTION = 'exit_recovery_mode';
    17 	const EXIT_ACTION = 'exit_recovery_mode';
    17 
    18 
    18 	/**
    19 	/**
   359 		}
   360 		}
   360 
   361 
   361 		$error_file    = wp_normalize_path( $error['file'] );
   362 		$error_file    = wp_normalize_path( $error['file'] );
   362 		$wp_plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
   363 		$wp_plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
   363 
   364 
   364 		if ( 0 === strpos( $error_file, $wp_plugin_dir ) ) {
   365 		if ( str_starts_with( $error_file, $wp_plugin_dir ) ) {
   365 			$path  = str_replace( $wp_plugin_dir . '/', '', $error_file );
   366 			$path  = str_replace( $wp_plugin_dir . '/', '', $error_file );
   366 			$parts = explode( '/', $path );
   367 			$parts = explode( '/', $path );
   367 
   368 
   368 			return array(
   369 			return array(
   369 				'type' => 'plugin',
   370 				'type' => 'plugin',
   376 		}
   377 		}
   377 
   378 
   378 		foreach ( $wp_theme_directories as $theme_directory ) {
   379 		foreach ( $wp_theme_directories as $theme_directory ) {
   379 			$theme_directory = wp_normalize_path( $theme_directory );
   380 			$theme_directory = wp_normalize_path( $theme_directory );
   380 
   381 
   381 			if ( 0 === strpos( $error_file, $theme_directory ) ) {
   382 			if ( str_starts_with( $error_file, $theme_directory ) ) {
   382 				$path  = str_replace( $theme_directory . '/', '', $error_file );
   383 				$path  = str_replace( $theme_directory . '/', '', $error_file );
   383 				$parts = explode( '/', $path );
   384 				$parts = explode( '/', $path );
   384 
   385 
   385 				return array(
   386 				return array(
   386 					'type' => 'theme',
   387 					'type' => 'theme',
   410 		}
   411 		}
   411 
   412 
   412 		$network_plugins = wp_get_active_network_plugins();
   413 		$network_plugins = wp_get_active_network_plugins();
   413 
   414 
   414 		foreach ( $network_plugins as $plugin ) {
   415 		foreach ( $network_plugins as $plugin ) {
   415 			if ( 0 === strpos( $plugin, $extension['slug'] . '/' ) ) {
   416 			if ( str_starts_with( $plugin, $extension['slug'] . '/' ) ) {
   416 				return true;
   417 				return true;
   417 			}
   418 			}
   418 		}
   419 		}
   419 
   420 
   420 		return false;
   421 		return false;