Passed
Push — main ( 16d49b...d78e29 )
by TARIQ
111:03
created
brighty/xmlrpc.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
19 19
 // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
20 20
 if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
21
-	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
21
+    $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
22 22
 }
23 23
 
24 24
 // Fix for mozBlog and other cases where '<?xml' isn't on the very first line.
25 25
 if ( isset( $HTTP_RAW_POST_DATA ) ) {
26
-	$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
26
+    $HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
27 27
 }
28 28
 // phpcs:enable
29 29
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 require_once __DIR__ . '/wp-load.php';
32 32
 
33 33
 if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
34
-	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
-	echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
36
-	?>
34
+    header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
+    echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
36
+    ?>
37 37
 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
38 38
 	<service>
39 39
 		<engineName>WordPress</engineName>
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 			<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
46 46
 			<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
47 47
 			<?php
48
-			/**
49
-			 * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
50
-			 *
51
-			 * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
52
-			 *
53
-			 * @since 3.5.0
54
-			 */
55
-			do_action( 'xmlrpc_rsd_apis' );
56
-			?>
48
+            /**
49
+             * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
50
+             *
51
+             * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
52
+             *
53
+             * @since 3.5.0
54
+             */
55
+            do_action( 'xmlrpc_rsd_apis' );
56
+            ?>
57 57
 		</apis>
58 58
 	</service>
59 59
 </rsd>
60 60
 	<?php
61
-	exit;
61
+    exit;
62 62
 }
63 63
 
64 64
 require_once ABSPATH . 'wp-admin/includes/admin.php';
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
  * @param string $msg Information describing logging reason.
99 99
  */
100 100
 function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
101
-	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
102
-	if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
103
-		error_log( $io . ' - ' . $msg );
104
-	}
101
+    _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
102
+    if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
103
+        error_log( $io . ' - ' . $msg );
104
+    }
105 105
 }
Please login to merge, or discard this patch.
brighty/wp-cron.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
 /* Don't make the request block till we finish, if possible. */
22 22
 if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
23
-	if ( ! headers_sent() ) {
24
-		header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25
-		header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
26
-	}
23
+    if ( ! headers_sent() ) {
24
+        header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25
+        header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
26
+    }
27 27
 
28
-	fastcgi_finish_request();
28
+    fastcgi_finish_request();
29 29
 }
30 30
 
31 31
 if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
32
-	die();
32
+    die();
33 33
 }
34 34
 
35 35
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 define( 'DOING_CRON', true );
41 41
 
42 42
 if ( ! defined( 'ABSPATH' ) ) {
43
-	/** Set up WordPress environment */
44
-	require_once __DIR__ . '/wp-load.php';
43
+    /** Set up WordPress environment */
44
+    require_once __DIR__ . '/wp-load.php';
45 45
 }
46 46
 
47 47
 /**
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
  * @return string|int|false Value of the `doing_cron` transient, 0|false otherwise.
58 58
  */
59 59
 function _get_cron_lock() {
60
-	global $wpdb;
60
+    global $wpdb;
61 61
 
62
-	$value = 0;
63
-	if ( wp_using_ext_object_cache() ) {
64
-		/*
62
+    $value = 0;
63
+    if ( wp_using_ext_object_cache() ) {
64
+        /*
65 65
 		 * Skip local cache and force re-fetch of doing_cron transient
66 66
 		 * in case another process updated the cache.
67 67
 		 */
68
-		$value = wp_cache_get( 'doing_cron', 'transient', true );
69
-	} else {
70
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
71
-		if ( is_object( $row ) ) {
72
-			$value = $row->option_value;
73
-		}
74
-	}
75
-
76
-	return $value;
68
+        $value = wp_cache_get( 'doing_cron', 'transient', true );
69
+    } else {
70
+        $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
71
+        if ( is_object( $row ) ) {
72
+            $value = $row->option_value;
73
+        }
74
+    }
75
+
76
+    return $value;
77 77
 }
78 78
 
79 79
 $crons = wp_get_ready_cron_jobs();
80 80
 if ( empty( $crons ) ) {
81
-	die();
81
+    die();
82 82
 }
83 83
 
84 84
 $gmt_time = microtime( true );
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 
89 89
 // Use global $doing_wp_cron lock, otherwise use the GET lock. If no lock, try to grab a new lock.
90 90
 if ( empty( $doing_wp_cron ) ) {
91
-	if ( empty( $_GET['doing_wp_cron'] ) ) {
92
-		// Called from external script/job. Try setting a lock.
93
-		if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
94
-			return;
95
-		}
96
-		$doing_wp_cron        = sprintf( '%.22F', microtime( true ) );
97
-		$doing_cron_transient = $doing_wp_cron;
98
-		set_transient( 'doing_cron', $doing_wp_cron );
99
-	} else {
100
-		$doing_wp_cron = $_GET['doing_wp_cron'];
101
-	}
91
+    if ( empty( $_GET['doing_wp_cron'] ) ) {
92
+        // Called from external script/job. Try setting a lock.
93
+        if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
94
+            return;
95
+        }
96
+        $doing_wp_cron        = sprintf( '%.22F', microtime( true ) );
97
+        $doing_cron_transient = $doing_wp_cron;
98
+        set_transient( 'doing_cron', $doing_wp_cron );
99
+    } else {
100
+        $doing_wp_cron = $_GET['doing_wp_cron'];
101
+    }
102 102
 }
103 103
 
104 104
 /*
@@ -106,47 +106,47 @@  discard block
 block discarded – undo
106 106
  * must match $doing_wp_cron (the "key").
107 107
  */
108 108
 if ( $doing_cron_transient !== $doing_wp_cron ) {
109
-	return;
109
+    return;
110 110
 }
111 111
 
112 112
 foreach ( $crons as $timestamp => $cronhooks ) {
113
-	if ( $timestamp > $gmt_time ) {
114
-		break;
115
-	}
116
-
117
-	foreach ( $cronhooks as $hook => $keys ) {
118
-
119
-		foreach ( $keys as $k => $v ) {
120
-
121
-			$schedule = $v['schedule'];
122
-
123
-			if ( $schedule ) {
124
-				wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] );
125
-			}
126
-
127
-			wp_unschedule_event( $timestamp, $hook, $v['args'] );
128
-
129
-			/**
130
-			 * Fires scheduled events.
131
-			 *
132
-			 * @ignore
133
-			 * @since 2.1.0
134
-			 *
135
-			 * @param string $hook Name of the hook that was scheduled to be fired.
136
-			 * @param array  $args The arguments to be passed to the hook.
137
-			 */
138
-			do_action_ref_array( $hook, $v['args'] );
139
-
140
-			// If the hook ran too long and another cron process stole the lock, quit.
141
-			if ( _get_cron_lock() !== $doing_wp_cron ) {
142
-				return;
143
-			}
144
-		}
145
-	}
113
+    if ( $timestamp > $gmt_time ) {
114
+        break;
115
+    }
116
+
117
+    foreach ( $cronhooks as $hook => $keys ) {
118
+
119
+        foreach ( $keys as $k => $v ) {
120
+
121
+            $schedule = $v['schedule'];
122
+
123
+            if ( $schedule ) {
124
+                wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] );
125
+            }
126
+
127
+            wp_unschedule_event( $timestamp, $hook, $v['args'] );
128
+
129
+            /**
130
+             * Fires scheduled events.
131
+             *
132
+             * @ignore
133
+             * @since 2.1.0
134
+             *
135
+             * @param string $hook Name of the hook that was scheduled to be fired.
136
+             * @param array  $args The arguments to be passed to the hook.
137
+             */
138
+            do_action_ref_array( $hook, $v['args'] );
139
+
140
+            // If the hook ran too long and another cron process stole the lock, quit.
141
+            if ( _get_cron_lock() !== $doing_wp_cron ) {
142
+                return;
143
+            }
144
+        }
145
+    }
146 146
 }
147 147
 
148 148
 if ( _get_cron_lock() === $doing_wp_cron ) {
149
-	delete_transient( 'doing_cron' );
149
+    delete_transient( 'doing_cron' );
150 150
 }
151 151
 
152 152
 die();
Please login to merge, or discard this patch.
brighty/wp-admin/theme-editor.php 1 patch
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( is_multisite() && ! is_network_admin() ) {
13
-	wp_redirect( network_admin_url( 'theme-editor.php' ) );
14
-	exit;
13
+    wp_redirect( network_admin_url( 'theme-editor.php' ) );
14
+    exit;
15 15
 }
16 16
 
17 17
 if ( ! current_user_can( 'edit_themes' ) ) {
18
-	wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
18
+    wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
19 19
 }
20 20
 
21 21
 // Used in the HTML title tag.
@@ -23,55 +23,55 @@  discard block
 block discarded – undo
23 23
 $parent_file = 'themes.php';
24 24
 
25 25
 get_current_screen()->add_help_tab(
26
-	array(
27
-		'id'      => 'overview',
28
-		'title'   => __( 'Overview' ),
29
-		'content' =>
30
-				'<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
31
-				'<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
32
-				'<p>' . __( 'For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
33
-				'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
34
-				'<ul>' .
35
-				'<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
36
-				'<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
37
-				'<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
38
-				'</ul>' .
39
-				'<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' .
40
-				'<p>' . __( '<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' .
41
-				'<p>' . sprintf(
42
-					/* translators: %s: Link to documentation on child themes. */
43
-					__( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ),
44
-					__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
45
-				) . '</p>' .
46
-				( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ),
47
-	)
26
+    array(
27
+        'id'      => 'overview',
28
+        'title'   => __( 'Overview' ),
29
+        'content' =>
30
+                '<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
31
+                '<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
32
+                '<p>' . __( 'For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
33
+                '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
34
+                '<ul>' .
35
+                '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
36
+                '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
37
+                '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
38
+                '</ul>' .
39
+                '<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' .
40
+                '<p>' . __( '<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' .
41
+                '<p>' . sprintf(
42
+                    /* translators: %s: Link to documentation on child themes. */
43
+                    __( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ),
44
+                    __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
45
+                ) . '</p>' .
46
+                ( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ),
47
+    )
48 48
 );
49 49
 
50 50
 get_current_screen()->set_help_sidebar(
51
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
52
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>' ) . '</p>' .
53
-	'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>' ) . '</p>' .
54
-	'<p>' . __( '<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>' ) . '</p>' .
55
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>' ) . '</p>' .
56
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
51
+    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
52
+    '<p>' . __( '<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>' ) . '</p>' .
53
+    '<p>' . __( '<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>' ) . '</p>' .
54
+    '<p>' . __( '<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>' ) . '</p>' .
55
+    '<p>' . __( '<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>' ) . '</p>' .
56
+    '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
57 57
 );
58 58
 
59 59
 wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
60 60
 
61 61
 if ( $theme ) {
62
-	$stylesheet = $theme;
62
+    $stylesheet = $theme;
63 63
 } else {
64
-	$stylesheet = get_stylesheet();
64
+    $stylesheet = get_stylesheet();
65 65
 }
66 66
 
67 67
 $theme = wp_get_theme( $stylesheet );
68 68
 
69 69
 if ( ! $theme->exists() ) {
70
-	wp_die( __( 'The requested theme does not exist.' ) );
70
+    wp_die( __( 'The requested theme does not exist.' ) );
71 71
 }
72 72
 
73 73
 if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) {
74
-	wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
74
+    wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
75 75
 }
76 76
 
77 77
 $allowed_files = array();
@@ -80,35 +80,35 @@  discard block
 block discarded – undo
80 80
 $file_types = wp_get_theme_file_editable_extensions( $theme );
81 81
 
82 82
 foreach ( $file_types as $type ) {
83
-	switch ( $type ) {
84
-		case 'php':
85
-			$allowed_files += $theme->get_files( 'php', -1 );
86
-			break;
87
-		case 'css':
88
-			$style_files                = $theme->get_files( 'css', -1 );
89
-			$allowed_files['style.css'] = $style_files['style.css'];
90
-			$allowed_files             += $style_files;
91
-			break;
92
-		default:
93
-			$allowed_files += $theme->get_files( $type, -1 );
94
-			break;
95
-	}
83
+    switch ( $type ) {
84
+        case 'php':
85
+            $allowed_files += $theme->get_files( 'php', -1 );
86
+            break;
87
+        case 'css':
88
+            $style_files                = $theme->get_files( 'css', -1 );
89
+            $allowed_files['style.css'] = $style_files['style.css'];
90
+            $allowed_files             += $style_files;
91
+            break;
92
+        default:
93
+            $allowed_files += $theme->get_files( $type, -1 );
94
+            break;
95
+    }
96 96
 }
97 97
 
98 98
 // Move functions.php and style.css to the top.
99 99
 if ( isset( $allowed_files['functions.php'] ) ) {
100
-	$allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files;
100
+    $allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files;
101 101
 }
102 102
 if ( isset( $allowed_files['style.css'] ) ) {
103
-	$allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files;
103
+    $allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files;
104 104
 }
105 105
 
106 106
 if ( empty( $file ) ) {
107
-	$relative_file = 'style.css';
108
-	$file          = $allowed_files['style.css'];
107
+    $relative_file = 'style.css';
108
+    $file          = $allowed_files['style.css'];
109 109
 } else {
110
-	$relative_file = wp_unslash( $file );
111
-	$file          = $theme->get_stylesheet_directory() . '/' . $relative_file;
110
+    $relative_file = wp_unslash( $file );
111
+    $file          = $theme->get_stylesheet_directory() . '/' . $relative_file;
112 112
 }
113 113
 
114 114
 validate_file_to_edit( $file, $allowed_files );
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 $posted_content = null;
119 119
 
120 120
 if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
121
-	$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
122
-	if ( is_wp_error( $r ) ) {
123
-		$edit_error = $r;
124
-		if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
125
-			$posted_content = wp_unslash( $_POST['newcontent'] );
126
-		}
127
-	} else {
128
-		wp_redirect(
129
-			add_query_arg(
130
-				array(
131
-					'a'     => 1, // This means "success" for some reason.
132
-					'theme' => $stylesheet,
133
-					'file'  => $relative_file,
134
-				),
135
-				admin_url( 'theme-editor.php' )
136
-			)
137
-		);
138
-		exit;
139
-	}
121
+    $r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
122
+    if ( is_wp_error( $r ) ) {
123
+        $edit_error = $r;
124
+        if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
125
+            $posted_content = wp_unslash( $_POST['newcontent'] );
126
+        }
127
+    } else {
128
+        wp_redirect(
129
+            add_query_arg(
130
+                array(
131
+                    'a'     => 1, // This means "success" for some reason.
132
+                    'theme' => $stylesheet,
133
+                    'file'  => $relative_file,
134
+                ),
135
+                admin_url( 'theme-editor.php' )
136
+            )
137
+        );
138
+        exit;
139
+    }
140 140
 }
141 141
 
142 142
 $settings = array(
143
-	'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
143
+    'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
144 144
 );
145 145
 wp_enqueue_script( 'wp-theme-plugin-editor' );
146 146
 wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
@@ -151,35 +151,35 @@  discard block
 block discarded – undo
151 151
 update_recently_edited( $file );
152 152
 
153 153
 if ( ! is_file( $file ) ) {
154
-	$error = true;
154
+    $error = true;
155 155
 }
156 156
 
157 157
 $content = '';
158 158
 if ( ! empty( $posted_content ) ) {
159
-	$content = $posted_content;
159
+    $content = $posted_content;
160 160
 } elseif ( ! $error && filesize( $file ) > 0 ) {
161
-	$f       = fopen( $file, 'r' );
162
-	$content = fread( $f, filesize( $file ) );
161
+    $f       = fopen( $file, 'r' );
162
+    $content = fread( $f, filesize( $file ) );
163 163
 
164
-	if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
165
-		$functions = wp_doc_link_parse( $content );
164
+    if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
165
+        $functions = wp_doc_link_parse( $content );
166 166
 
167
-		$docs_select  = '<select name="docs-list" id="docs-list">';
168
-		$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
169
-		foreach ( $functions as $function ) {
170
-			$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
171
-		}
172
-		$docs_select .= '</select>';
173
-	}
167
+        $docs_select  = '<select name="docs-list" id="docs-list">';
168
+        $docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
169
+        foreach ( $functions as $function ) {
170
+            $docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
171
+        }
172
+        $docs_select .= '</select>';
173
+    }
174 174
 
175
-	$content = esc_textarea( $content );
175
+    $content = esc_textarea( $content );
176 176
 }
177 177
 
178 178
 $file_description = get_file_description( $relative_file );
179 179
 $file_show        = array_search( $file, array_filter( $allowed_files ), true );
180 180
 $description      = esc_html( $file_description );
181 181
 if ( $file_description !== $file_show ) {
182
-	$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
182
+    $description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
183 183
 }
184 184
 ?>
185 185
 <div class="wrap">
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 		<p><strong><?php _e( 'Did you know?' ); ?></strong></p>
202 202
 		<p>
203 203
 			<?php
204
-			printf(
205
-				/* translators: %s: Link to Custom CSS section in the Customizer. */
206
-				__( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
207
-				esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
208
-			);
209
-			?>
204
+            printf(
205
+                /* translators: %s: Link to Custom CSS section in the Customizer. */
206
+                __( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
207
+                esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
208
+            );
209
+            ?>
210 210
 		</p>
211 211
 	</div>
212 212
 <?php endif; ?>
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 <div class="alignleft">
216 216
 <h2>
217 217
 	<?php
218
-	echo $theme->display( 'Name' );
219
-	if ( $description ) {
220
-		echo ': ' . $description;}
221
-	?>
218
+    echo $theme->display( 'Name' );
219
+    if ( $description ) {
220
+        echo ': ' . $description;}
221
+    ?>
222 222
 </h2>
223 223
 </div>
224 224
 <div class="alignright">
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
 		<label for="theme" id="theme-plugin-editor-selector"><?php _e( 'Select theme to edit:' ); ?> </label>
227 227
 		<select name="theme" id="theme">
228 228
 		<?php
229
-		foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
230
-			if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
231
-				continue;
232
-			}
233
-
234
-			$selected = ( $a_stylesheet === $stylesheet ) ? ' selected="selected"' : '';
235
-			echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display( 'Name' ) . '</option>';
236
-		}
237
-		?>
229
+        foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
230
+            if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
231
+                continue;
232
+            }
233
+
234
+            $selected = ( $a_stylesheet === $stylesheet ) ? ' selected="selected"' : '';
235
+            echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display( 'Name' ) . '</option>';
236
+        }
237
+        ?>
238 238
 		</select>
239 239
 		<?php submit_button( __( 'Select' ), '', 'Submit', false ); ?>
240 240
 	</form>
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 <?php
246 246
 if ( $theme->errors() ) {
247
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
247
+    echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
248 248
 }
249 249
 ?>
250 250
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 		<?php if ( $theme->parent() ) : ?>
255 255
 			<li class="howto">
256 256
 				<?php
257
-				printf(
258
-					/* translators: %s: Link to edit parent theme. */
259
-					__( 'This child theme inherits templates from a parent theme, %s.' ),
260
-					sprintf(
261
-						'<a href="%s">%s</a>',
262
-						self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
263
-						$theme->parent()->display( 'Name' )
264
-					)
265
-				);
266
-				?>
257
+                printf(
258
+                    /* translators: %s: Link to edit parent theme. */
259
+                    __( 'This child theme inherits templates from a parent theme, %s.' ),
260
+                    sprintf(
261
+                        '<a href="%s">%s</a>',
262
+                        self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
263
+                        $theme->parent()->display( 'Name' )
264
+                    )
265
+                );
266
+                ?>
267 267
 			</li>
268 268
 		<?php endif; ?>
269 269
 		<li role="treeitem" tabindex="-1" aria-expanded="true" aria-level="1" aria-posinset="1" aria-setsize="1">
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 
277 277
 <?php
278 278
 if ( $error ) :
279
-	echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
279
+    echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
280 280
 else :
281
-	?>
281
+    ?>
282 282
 	<form name="template" id="template" action="theme-editor.php" method="post">
283 283
 		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' ); ?>
284 284
 		<div>
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
 			<?php else : ?>
319 319
 				<p>
320 320
 					<?php
321
-					printf(
322
-						/* translators: %s: Documentation URL. */
323
-						__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324
-						__( 'https://wordpress.org/support/article/changing-file-permissions/' )
325
-					);
326
-					?>
321
+                    printf(
322
+                        /* translators: %s: Documentation URL. */
323
+                        __( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324
+                        __( 'https://wordpress.org/support/article/changing-file-permissions/' )
325
+                    );
326
+                    ?>
327 327
 				</p>
328 328
 			<?php endif; ?>
329 329
 		</div>
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
 <?php
339 339
 $dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
340 340
 if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
341
-	// Get a back URL.
342
-	$referer = wp_get_referer();
343
-
344
-	$excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
345
-
346
-	$return_url = admin_url( '/' );
347
-	if ( $referer ) {
348
-		$referer_path = parse_url( $referer, PHP_URL_PATH );
349
-		if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
350
-			$return_url = $referer;
351
-		}
352
-	}
353
-	?>
341
+    // Get a back URL.
342
+    $referer = wp_get_referer();
343
+
344
+    $excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
345
+
346
+    $return_url = admin_url( '/' );
347
+    if ( $referer ) {
348
+        $referer_path = parse_url( $referer, PHP_URL_PATH );
349
+        if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
350
+            $return_url = $referer;
351
+        }
352
+    }
353
+    ?>
354 354
 	<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js hidden">
355 355
 		<div class="notification-dialog-background"></div>
356 356
 		<div class="notification-dialog">
@@ -359,20 +359,20 @@  discard block
 block discarded – undo
359 359
 					<h1><?php _e( 'Heads up!' ); ?></h1>
360 360
 					<p>
361 361
 						<?php
362
-						_e( 'You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.' );
363
-						?>
362
+                        _e( 'You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.' );
363
+                        ?>
364 364
 					</p>
365 365
 						<?php
366
-						if ( ! $theme->parent() ) {
367
-							echo '<p>';
368
-							printf(
369
-								/* translators: %s: Link to documentation on child themes. */
370
-								__( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
371
-								esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
372
-							);
373
-							echo '</p>';
374
-						}
375
-						?>
366
+                        if ( ! $theme->parent() ) {
367
+                            echo '<p>';
368
+                            printf(
369
+                                /* translators: %s: Link to documentation on child themes. */
370
+                                __( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
371
+                                esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
372
+                            );
373
+                            echo '</p>';
374
+                        }
375
+                        ?>
376 376
 					<p><?php _e( 'If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.' ); ?></p>
377 377
 				</div>
378 378
 				<p>
Please login to merge, or discard this patch.
brighty/wp-admin/post.php 1 patch
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 wp_reset_vars( array( 'action' ) );
18 18
 
19 19
 if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
20
-	wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
20
+    wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
21 21
 } elseif ( isset( $_GET['post'] ) ) {
22
-	$post_id = (int) $_GET['post'];
22
+    $post_id = (int) $_GET['post'];
23 23
 } elseif ( isset( $_POST['post_ID'] ) ) {
24
-	$post_id = (int) $_POST['post_ID'];
24
+    $post_id = (int) $_POST['post_ID'];
25 25
 } else {
26
-	$post_id = 0;
26
+    $post_id = 0;
27 27
 }
28 28
 $post_ID = $post_id;
29 29
 
@@ -35,335 +35,335 @@  discard block
 block discarded – undo
35 35
 global $post_type, $post_type_object, $post;
36 36
 
37 37
 if ( $post_id ) {
38
-	$post = get_post( $post_id );
38
+    $post = get_post( $post_id );
39 39
 }
40 40
 
41 41
 if ( $post ) {
42
-	$post_type        = $post->post_type;
43
-	$post_type_object = get_post_type_object( $post_type );
42
+    $post_type        = $post->post_type;
43
+    $post_type_object = get_post_type_object( $post_type );
44 44
 }
45 45
 
46 46
 if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
47
-	wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
47
+    wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
48 48
 }
49 49
 
50 50
 if ( isset( $_POST['deletepost'] ) ) {
51
-	$action = 'delete';
51
+    $action = 'delete';
52 52
 } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
53
-	$action = 'preview';
53
+    $action = 'preview';
54 54
 }
55 55
 
56 56
 $sendback = wp_get_referer();
57 57
 if ( ! $sendback ||
58
-	false !== strpos( $sendback, 'post.php' ) ||
59
-	false !== strpos( $sendback, 'post-new.php' ) ) {
60
-	if ( 'attachment' === $post_type ) {
61
-		$sendback = admin_url( 'upload.php' );
62
-	} else {
63
-		$sendback = admin_url( 'edit.php' );
64
-		if ( ! empty( $post_type ) ) {
65
-			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
66
-		}
67
-	}
58
+    false !== strpos( $sendback, 'post.php' ) ||
59
+    false !== strpos( $sendback, 'post-new.php' ) ) {
60
+    if ( 'attachment' === $post_type ) {
61
+        $sendback = admin_url( 'upload.php' );
62
+    } else {
63
+        $sendback = admin_url( 'edit.php' );
64
+        if ( ! empty( $post_type ) ) {
65
+            $sendback = add_query_arg( 'post_type', $post_type, $sendback );
66
+        }
67
+    }
68 68
 } else {
69
-	$sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
69
+    $sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
70 70
 }
71 71
 
72 72
 switch ( $action ) {
73
-	case 'post-quickdraft-save':
74
-		// Check nonce and capabilities.
75
-		$nonce     = $_REQUEST['_wpnonce'];
76
-		$error_msg = false;
77
-
78
-		// For output of the Quick Draft dashboard widget.
79
-		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
-
81
-		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
-			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
-		}
84
-
85
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
-			exit;
87
-		}
88
-
89
-		if ( $error_msg ) {
90
-			return wp_dashboard_quick_press( $error_msg );
91
-		}
92
-
93
-		$post = get_post( $_REQUEST['post_ID'] );
94
-		check_admin_referer( 'add-' . $post->post_type );
95
-
96
-		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
-		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
-
99
-		// Wrap Quick Draft content in the Paragraph block.
100
-		if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
-			$_POST['content'] = sprintf(
102
-				'<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
-				str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
-			);
105
-		}
106
-
107
-		edit_post();
108
-		wp_dashboard_quick_press();
109
-		exit;
110
-
111
-	case 'postajaxpost':
112
-	case 'post':
113
-		check_admin_referer( 'add-' . $post_type );
114
-		$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
-		redirect_post( $post_id );
116
-		exit;
117
-
118
-	case 'edit':
119
-		$editing = true;
120
-
121
-		if ( empty( $post_id ) ) {
122
-			wp_redirect( admin_url( 'post.php' ) );
123
-			exit;
124
-		}
125
-
126
-		if ( ! $post ) {
127
-			wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
-		}
129
-
130
-		if ( ! $post_type_object ) {
131
-			wp_die( __( 'Invalid post type.' ) );
132
-		}
133
-
134
-		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
-			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
-		}
137
-
138
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
-			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
-		}
141
-
142
-		if ( 'trash' === $post->post_status ) {
143
-			wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
-		}
145
-
146
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
147
-			check_admin_referer( 'lock-post_' . $post_id );
148
-			wp_set_post_lock( $post_id );
149
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
-			exit;
151
-		}
152
-
153
-		$post_type = $post->post_type;
154
-		if ( 'post' === $post_type ) {
155
-			$parent_file   = 'edit.php';
156
-			$submenu_file  = 'edit.php';
157
-			$post_new_file = 'post-new.php';
158
-		} elseif ( 'attachment' === $post_type ) {
159
-			$parent_file   = 'upload.php';
160
-			$submenu_file  = 'upload.php';
161
-			$post_new_file = 'media-new.php';
162
-		} else {
163
-			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
-				$parent_file = $post_type_object->show_in_menu;
165
-			} else {
166
-				$parent_file = "edit.php?post_type=$post_type";
167
-			}
168
-			$submenu_file  = "edit.php?post_type=$post_type";
169
-			$post_new_file = "post-new.php?post_type=$post_type";
170
-		}
171
-
172
-		$title = $post_type_object->labels->edit_item;
173
-
174
-		/**
175
-		 * Allows replacement of the editor.
176
-		 *
177
-		 * @since 4.9.0
178
-		 *
179
-		 * @param bool    $replace Whether to replace the editor. Default false.
180
-		 * @param WP_Post $post    Post object.
181
-		 */
182
-		if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
-			break;
184
-		}
185
-
186
-		if ( use_block_editor_for_post( $post ) ) {
187
-			require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
-			break;
189
-		}
190
-
191
-		if ( ! wp_check_post_lock( $post->ID ) ) {
192
-			$active_post_lock = wp_set_post_lock( $post->ID );
193
-
194
-			if ( 'attachment' !== $post_type ) {
195
-				wp_enqueue_script( 'autosave' );
196
-			}
197
-		}
198
-
199
-		$post = get_post( $post_id, OBJECT, 'edit' );
200
-
201
-		if ( post_type_supports( $post_type, 'comments' ) ) {
202
-			wp_enqueue_script( 'admin-comments' );
203
-			enqueue_comment_hotkeys_js();
204
-		}
205
-
206
-		require ABSPATH . 'wp-admin/edit-form-advanced.php';
207
-
208
-		break;
209
-
210
-	case 'editattachment':
211
-		check_admin_referer( 'update-post_' . $post_id );
212
-
213
-		// Don't let these be changed.
214
-		unset( $_POST['guid'] );
215
-		$_POST['post_type'] = 'attachment';
216
-
217
-		// Update the thumbnail filename.
218
-		$newmeta          = wp_get_attachment_metadata( $post_id, true );
219
-		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
220
-
221
-		wp_update_attachment_metadata( $post_id, $newmeta );
222
-
223
-		// Intentional fall-through to trigger the edit_post() call.
224
-	case 'editpost':
225
-		check_admin_referer( 'update-post_' . $post_id );
226
-
227
-		$post_id = edit_post();
228
-
229
-		// Session cookie flag that the post was saved.
230
-		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
-			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
-		}
233
-
234
-		redirect_post( $post_id ); // Send user on their way while we keep working.
235
-
236
-		exit;
237
-
238
-	case 'trash':
239
-		check_admin_referer( 'trash-post_' . $post_id );
240
-
241
-		if ( ! $post ) {
242
-			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
-		}
244
-
245
-		if ( ! $post_type_object ) {
246
-			wp_die( __( 'Invalid post type.' ) );
247
-		}
248
-
249
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
-			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
-		}
252
-
253
-		$user_id = wp_check_post_lock( $post_id );
254
-		if ( $user_id ) {
255
-			$user = get_userdata( $user_id );
256
-			/* translators: %s: User's display name. */
257
-			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
-		}
259
-
260
-		if ( ! wp_trash_post( $post_id ) ) {
261
-			wp_die( __( 'Error in moving the item to Trash.' ) );
262
-		}
263
-
264
-		wp_redirect(
265
-			add_query_arg(
266
-				array(
267
-					'trashed' => 1,
268
-					'ids'     => $post_id,
269
-				),
270
-				$sendback
271
-			)
272
-		);
273
-		exit;
274
-
275
-	case 'untrash':
276
-		check_admin_referer( 'untrash-post_' . $post_id );
277
-
278
-		if ( ! $post ) {
279
-			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
-		}
281
-
282
-		if ( ! $post_type_object ) {
283
-			wp_die( __( 'Invalid post type.' ) );
284
-		}
285
-
286
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
-			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
-		}
289
-
290
-		if ( ! wp_untrash_post( $post_id ) ) {
291
-			wp_die( __( 'Error in restoring the item from Trash.' ) );
292
-		}
293
-
294
-		$sendback = add_query_arg(
295
-			array(
296
-				'untrashed' => 1,
297
-				'ids'       => $post_id,
298
-			),
299
-			$sendback
300
-		);
301
-		wp_redirect( $sendback );
302
-		exit;
303
-
304
-	case 'delete':
305
-		check_admin_referer( 'delete-post_' . $post_id );
306
-
307
-		if ( ! $post ) {
308
-			wp_die( __( 'This item has already been deleted.' ) );
309
-		}
310
-
311
-		if ( ! $post_type_object ) {
312
-			wp_die( __( 'Invalid post type.' ) );
313
-		}
314
-
315
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
-			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
-		}
318
-
319
-		if ( 'attachment' === $post->post_type ) {
320
-			$force = ( ! MEDIA_TRASH );
321
-			if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
-				wp_die( __( 'Error in deleting the attachment.' ) );
323
-			}
324
-		} else {
325
-			if ( ! wp_delete_post( $post_id, true ) ) {
326
-				wp_die( __( 'Error in deleting the item.' ) );
327
-			}
328
-		}
329
-
330
-		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
-		exit;
332
-
333
-	case 'preview':
334
-		check_admin_referer( 'update-post_' . $post_id );
335
-
336
-		$url = post_preview();
337
-
338
-		wp_redirect( $url );
339
-		exit;
340
-
341
-	case 'toggle-custom-fields':
342
-		check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
-
344
-		$current_user_id = get_current_user_id();
345
-		if ( $current_user_id ) {
346
-			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
-			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
-		}
349
-
350
-		wp_safe_redirect( wp_get_referer() );
351
-		exit;
352
-
353
-	default:
354
-		/**
355
-		 * Fires for a given custom post action request.
356
-		 *
357
-		 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
358
-		 *
359
-		 * @since 4.6.0
360
-		 *
361
-		 * @param int $post_id Post ID sent with the request.
362
-		 */
363
-		do_action( "post_action_{$action}", $post_id );
364
-
365
-		wp_redirect( admin_url( 'edit.php' ) );
366
-		exit;
73
+    case 'post-quickdraft-save':
74
+        // Check nonce and capabilities.
75
+        $nonce     = $_REQUEST['_wpnonce'];
76
+        $error_msg = false;
77
+
78
+        // For output of the Quick Draft dashboard widget.
79
+        require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
+
81
+        if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
+            $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
+        }
84
+
85
+        if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
+            exit;
87
+        }
88
+
89
+        if ( $error_msg ) {
90
+            return wp_dashboard_quick_press( $error_msg );
91
+        }
92
+
93
+        $post = get_post( $_REQUEST['post_ID'] );
94
+        check_admin_referer( 'add-' . $post->post_type );
95
+
96
+        $_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
+        $_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
+
99
+        // Wrap Quick Draft content in the Paragraph block.
100
+        if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
+            $_POST['content'] = sprintf(
102
+                '<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
+                str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
+            );
105
+        }
106
+
107
+        edit_post();
108
+        wp_dashboard_quick_press();
109
+        exit;
110
+
111
+    case 'postajaxpost':
112
+    case 'post':
113
+        check_admin_referer( 'add-' . $post_type );
114
+        $post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
+        redirect_post( $post_id );
116
+        exit;
117
+
118
+    case 'edit':
119
+        $editing = true;
120
+
121
+        if ( empty( $post_id ) ) {
122
+            wp_redirect( admin_url( 'post.php' ) );
123
+            exit;
124
+        }
125
+
126
+        if ( ! $post ) {
127
+            wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
+        }
129
+
130
+        if ( ! $post_type_object ) {
131
+            wp_die( __( 'Invalid post type.' ) );
132
+        }
133
+
134
+        if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
+            wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
+        }
137
+
138
+        if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
+            wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
+        }
141
+
142
+        if ( 'trash' === $post->post_status ) {
143
+            wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
+        }
145
+
146
+        if ( ! empty( $_GET['get-post-lock'] ) ) {
147
+            check_admin_referer( 'lock-post_' . $post_id );
148
+            wp_set_post_lock( $post_id );
149
+            wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
+            exit;
151
+        }
152
+
153
+        $post_type = $post->post_type;
154
+        if ( 'post' === $post_type ) {
155
+            $parent_file   = 'edit.php';
156
+            $submenu_file  = 'edit.php';
157
+            $post_new_file = 'post-new.php';
158
+        } elseif ( 'attachment' === $post_type ) {
159
+            $parent_file   = 'upload.php';
160
+            $submenu_file  = 'upload.php';
161
+            $post_new_file = 'media-new.php';
162
+        } else {
163
+            if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
+                $parent_file = $post_type_object->show_in_menu;
165
+            } else {
166
+                $parent_file = "edit.php?post_type=$post_type";
167
+            }
168
+            $submenu_file  = "edit.php?post_type=$post_type";
169
+            $post_new_file = "post-new.php?post_type=$post_type";
170
+        }
171
+
172
+        $title = $post_type_object->labels->edit_item;
173
+
174
+        /**
175
+         * Allows replacement of the editor.
176
+         *
177
+         * @since 4.9.0
178
+         *
179
+         * @param bool    $replace Whether to replace the editor. Default false.
180
+         * @param WP_Post $post    Post object.
181
+         */
182
+        if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
+            break;
184
+        }
185
+
186
+        if ( use_block_editor_for_post( $post ) ) {
187
+            require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
+            break;
189
+        }
190
+
191
+        if ( ! wp_check_post_lock( $post->ID ) ) {
192
+            $active_post_lock = wp_set_post_lock( $post->ID );
193
+
194
+            if ( 'attachment' !== $post_type ) {
195
+                wp_enqueue_script( 'autosave' );
196
+            }
197
+        }
198
+
199
+        $post = get_post( $post_id, OBJECT, 'edit' );
200
+
201
+        if ( post_type_supports( $post_type, 'comments' ) ) {
202
+            wp_enqueue_script( 'admin-comments' );
203
+            enqueue_comment_hotkeys_js();
204
+        }
205
+
206
+        require ABSPATH . 'wp-admin/edit-form-advanced.php';
207
+
208
+        break;
209
+
210
+    case 'editattachment':
211
+        check_admin_referer( 'update-post_' . $post_id );
212
+
213
+        // Don't let these be changed.
214
+        unset( $_POST['guid'] );
215
+        $_POST['post_type'] = 'attachment';
216
+
217
+        // Update the thumbnail filename.
218
+        $newmeta          = wp_get_attachment_metadata( $post_id, true );
219
+        $newmeta['thumb'] = wp_basename( $_POST['thumb'] );
220
+
221
+        wp_update_attachment_metadata( $post_id, $newmeta );
222
+
223
+        // Intentional fall-through to trigger the edit_post() call.
224
+    case 'editpost':
225
+        check_admin_referer( 'update-post_' . $post_id );
226
+
227
+        $post_id = edit_post();
228
+
229
+        // Session cookie flag that the post was saved.
230
+        if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
+            setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
+        }
233
+
234
+        redirect_post( $post_id ); // Send user on their way while we keep working.
235
+
236
+        exit;
237
+
238
+    case 'trash':
239
+        check_admin_referer( 'trash-post_' . $post_id );
240
+
241
+        if ( ! $post ) {
242
+            wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
+        }
244
+
245
+        if ( ! $post_type_object ) {
246
+            wp_die( __( 'Invalid post type.' ) );
247
+        }
248
+
249
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
+            wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
+        }
252
+
253
+        $user_id = wp_check_post_lock( $post_id );
254
+        if ( $user_id ) {
255
+            $user = get_userdata( $user_id );
256
+            /* translators: %s: User's display name. */
257
+            wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
+        }
259
+
260
+        if ( ! wp_trash_post( $post_id ) ) {
261
+            wp_die( __( 'Error in moving the item to Trash.' ) );
262
+        }
263
+
264
+        wp_redirect(
265
+            add_query_arg(
266
+                array(
267
+                    'trashed' => 1,
268
+                    'ids'     => $post_id,
269
+                ),
270
+                $sendback
271
+            )
272
+        );
273
+        exit;
274
+
275
+    case 'untrash':
276
+        check_admin_referer( 'untrash-post_' . $post_id );
277
+
278
+        if ( ! $post ) {
279
+            wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
+        }
281
+
282
+        if ( ! $post_type_object ) {
283
+            wp_die( __( 'Invalid post type.' ) );
284
+        }
285
+
286
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
+            wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
+        }
289
+
290
+        if ( ! wp_untrash_post( $post_id ) ) {
291
+            wp_die( __( 'Error in restoring the item from Trash.' ) );
292
+        }
293
+
294
+        $sendback = add_query_arg(
295
+            array(
296
+                'untrashed' => 1,
297
+                'ids'       => $post_id,
298
+            ),
299
+            $sendback
300
+        );
301
+        wp_redirect( $sendback );
302
+        exit;
303
+
304
+    case 'delete':
305
+        check_admin_referer( 'delete-post_' . $post_id );
306
+
307
+        if ( ! $post ) {
308
+            wp_die( __( 'This item has already been deleted.' ) );
309
+        }
310
+
311
+        if ( ! $post_type_object ) {
312
+            wp_die( __( 'Invalid post type.' ) );
313
+        }
314
+
315
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
+            wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
+        }
318
+
319
+        if ( 'attachment' === $post->post_type ) {
320
+            $force = ( ! MEDIA_TRASH );
321
+            if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
+                wp_die( __( 'Error in deleting the attachment.' ) );
323
+            }
324
+        } else {
325
+            if ( ! wp_delete_post( $post_id, true ) ) {
326
+                wp_die( __( 'Error in deleting the item.' ) );
327
+            }
328
+        }
329
+
330
+        wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
+        exit;
332
+
333
+    case 'preview':
334
+        check_admin_referer( 'update-post_' . $post_id );
335
+
336
+        $url = post_preview();
337
+
338
+        wp_redirect( $url );
339
+        exit;
340
+
341
+    case 'toggle-custom-fields':
342
+        check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
+
344
+        $current_user_id = get_current_user_id();
345
+        if ( $current_user_id ) {
346
+            $enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
+            update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
+        }
349
+
350
+        wp_safe_redirect( wp_get_referer() );
351
+        exit;
352
+
353
+    default:
354
+        /**
355
+         * Fires for a given custom post action request.
356
+         *
357
+         * The dynamic portion of the hook name, `$action`, refers to the custom post action.
358
+         *
359
+         * @since 4.6.0
360
+         *
361
+         * @param int $post_id Post ID sent with the request.
362
+         */
363
+        do_action( "post_action_{$action}", $post_id );
364
+
365
+        wp_redirect( admin_url( 'edit.php' ) );
366
+        exit;
367 367
 } // End switch.
368 368
 
369 369
 require_once ABSPATH . 'wp-admin/admin-footer.php';
Please login to merge, or discard this patch.
brighty/wp-admin/options-media.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
13
+    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
 $media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';
21 21
 
22 22
 if ( ! is_multisite()
23
-	&& ( get_option( 'upload_url_path' )
24
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
23
+    && ( get_option( 'upload_url_path' )
24
+        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
25 25
 ) {
26
-	$media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
26
+    $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
27 27
 }
28 28
 
29 29
 $media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
30 30
 
31 31
 get_current_screen()->add_help_tab(
32
-	array(
33
-		'id'      => 'overview',
34
-		'title'   => __( 'Overview' ),
35
-		'content' => $media_options_help,
36
-	)
32
+    array(
33
+        'id'      => 'overview',
34
+        'title'   => __( 'Overview' ),
35
+        'content' => $media_options_help,
36
+    )
37 37
 );
38 38
 
39 39
 get_current_screen()->set_help_sidebar(
40
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
41
-	'<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
42
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
40
+    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
41
+    '<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
42
+    '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
43 43
 );
44 44
 
45 45
 require_once ABSPATH . 'wp-admin/admin-header.php';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  * @global array $wp_settings
101 101
  */
102 102
 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
103
-	?>
103
+    ?>
104 104
 <h2 class="title"><?php _e( 'Embeds' ); ?></h2>
105 105
 <table class="form-table" role="presentation">
106 106
 	<?php do_settings_fields( 'media', 'embeds' ); ?>
@@ -111,22 +111,22 @@  discard block
 block discarded – undo
111 111
 <h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
112 112
 <table class="form-table" role="presentation">
113 113
 	<?php
114
-	/*
114
+    /*
115 115
 	 * If upload_url_path is not the default (empty),
116 116
 	 * or upload_path is not the default ('wp-content/uploads' or empty),
117 117
 	 * they can be edited, otherwise they're locked.
118 118
 	 */
119
-	if ( get_option( 'upload_url_path' )
120
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
121
-		?>
119
+    if ( get_option( 'upload_url_path' )
120
+        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
121
+        ?>
122 122
 <tr>
123 123
 <th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th>
124 124
 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" />
125 125
 <p class="description">
126 126
 		<?php
127
-		/* translators: %s: wp-content/uploads */
128
-		printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
129
-		?>
127
+        /* translators: %s: wp-content/uploads */
128
+        printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
129
+        ?>
130 130
 </p>
131 131
 </td>
132 132
 </tr>
Please login to merge, or discard this patch.
brighty/wp-admin/ms-delete-site.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,26 +10,26 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! is_multisite() ) {
13
-	wp_die( __( 'Multisite support is not enabled.' ) );
13
+    wp_die( __( 'Multisite support is not enabled.' ) );
14 14
 }
15 15
 
16 16
 if ( ! current_user_can( 'delete_site' ) ) {
17
-	wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
17
+    wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
18 18
 }
19 19
 
20 20
 if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
21
-	if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
22
-		wpmu_delete_blog( get_current_blog_id() );
23
-		wp_die(
24
-			sprintf(
25
-				/* translators: %s: Network title. */
26
-				__( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
27
-				get_network()->site_name
28
-			)
29
-		);
30
-	} else {
31
-		wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
32
-	}
21
+    if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
22
+        wpmu_delete_blog( get_current_blog_id() );
23
+        wp_die(
24
+            sprintf(
25
+                /* translators: %s: Network title. */
26
+                __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
27
+                get_network()->site_name
28
+            )
29
+        );
30
+    } else {
31
+        wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
32
+    }
33 33
 }
34 34
 
35 35
 $blog = get_site();
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 echo '<h1>' . esc_html( $title ) . '</h1>';
46 46
 
47 47
 if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
48
-	check_admin_referer( 'delete-blog' );
48
+    check_admin_referer( 'delete-blog' );
49 49
 
50
-	$hash = wp_generate_password( 20, false );
51
-	update_option( 'delete_blog_hash', $hash );
50
+    $hash = wp_generate_password( 20, false );
51
+    update_option( 'delete_blog_hash', $hash );
52 52
 
53
-	$url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
53
+    $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
54 54
 
55
-	$switched_locale = switch_to_locale( get_locale() );
55
+    $switched_locale = switch_to_locale( get_locale() );
56 56
 
57
-	/* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
58
-	$content = __(
59
-		"Howdy ###USERNAME###,
57
+    /* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
58
+    $content = __(
59
+        "Howdy ###USERNAME###,
60 60
 
61 61
 You recently clicked the 'Delete Site' link on your site and filled in a
62 62
 form on that page.
@@ -72,49 +72,49 @@  discard block
 block discarded – undo
72 72
 Thanks for using the site,
73 73
 All at ###SITENAME###
74 74
 ###SITEURL###"
75
-	);
76
-	/**
77
-	 * Filters the text for the email sent to the site admin when a request to delete a site in a Multisite network is submitted.
78
-	 *
79
-	 * @since 3.0.0
80
-	 *
81
-	 * @param string $content The email text.
82
-	 */
83
-	$content = apply_filters( 'delete_site_email_content', $content );
84
-
85
-	$content = str_replace( '###USERNAME###', $user->user_login, $content );
86
-	$content = str_replace( '###URL_DELETE###', $url_delete, $content );
87
-	$content = str_replace( '###SITENAME###', get_network()->site_name, $content );
88
-	$content = str_replace( '###SITEURL###', network_home_url(), $content );
89
-
90
-	wp_mail(
91
-		get_option( 'admin_email' ),
92
-		sprintf(
93
-			/* translators: %s: Site title. */
94
-			__( '[%s] Delete My Site' ),
95
-			wp_specialchars_decode( get_option( 'blogname' ) )
96
-		),
97
-		$content
98
-	);
99
-
100
-	if ( $switched_locale ) {
101
-		restore_previous_locale();
102
-	}
103
-	?>
75
+    );
76
+    /**
77
+     * Filters the text for the email sent to the site admin when a request to delete a site in a Multisite network is submitted.
78
+     *
79
+     * @since 3.0.0
80
+     *
81
+     * @param string $content The email text.
82
+     */
83
+    $content = apply_filters( 'delete_site_email_content', $content );
84
+
85
+    $content = str_replace( '###USERNAME###', $user->user_login, $content );
86
+    $content = str_replace( '###URL_DELETE###', $url_delete, $content );
87
+    $content = str_replace( '###SITENAME###', get_network()->site_name, $content );
88
+    $content = str_replace( '###SITEURL###', network_home_url(), $content );
89
+
90
+    wp_mail(
91
+        get_option( 'admin_email' ),
92
+        sprintf(
93
+            /* translators: %s: Site title. */
94
+            __( '[%s] Delete My Site' ),
95
+            wp_specialchars_decode( get_option( 'blogname' ) )
96
+        ),
97
+        $content
98
+    );
99
+
100
+    if ( $switched_locale ) {
101
+        restore_previous_locale();
102
+    }
103
+    ?>
104 104
 
105 105
 	<p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ); ?></p>
106 106
 
107 107
 	<?php
108 108
 } else {
109
-	?>
109
+    ?>
110 110
 	<p>
111 111
 	<?php
112
-		printf(
113
-			/* translators: %s: Network title. */
114
-			__( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
115
-			get_network()->site_name
116
-		);
117
-	?>
112
+        printf(
113
+            /* translators: %s: Network title. */
114
+            __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
115
+            get_network()->site_name
116
+        );
117
+    ?>
118 118
 	</p>
119 119
 	<p><?php _e( 'Remember, once deleted your site cannot be restored.' ); ?></p>
120 120
 
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 		<input type="hidden" name="action" value="deleteblog" />
124 124
 		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong>
125 125
 		<?php
126
-			printf(
127
-				/* translators: %s: Site address. */
128
-				__( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
129
-				$blog->domain . $blog->path
130
-			);
131
-		?>
126
+            printf(
127
+                /* translators: %s: Site address. */
128
+                __( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
129
+                $blog->domain . $blog->path
130
+            );
131
+        ?>
132 132
 		</strong></label></p>
133 133
 		<?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
134 134
 	</form>
Please login to merge, or discard this patch.
brighty/wp-admin/options-permalink.php 1 patch
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
13
+    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
 $parent_file = 'options-general.php';
19 19
 
20 20
 get_current_screen()->add_help_tab(
21
-	array(
22
-		'id'      => 'overview',
23
-		'title'   => __( 'Overview' ),
24
-		'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
25
-			'<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
26
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
27
-	)
21
+    array(
22
+        'id'      => 'overview',
23
+        'title'   => __( 'Overview' ),
24
+        'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
25
+            '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
26
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
27
+    )
28 28
 );
29 29
 
30 30
 get_current_screen()->add_help_tab(
31
-	array(
32
-		'id'      => 'permalink-settings',
33
-		'title'   => __( 'Permalink Settings' ),
34
-		'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
35
-			'<p>' . sprintf(
36
-				/* translators: %s: Percent sign (%). */
37
-				__( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
38
-				'<code>%</code>'
39
-			) . '</p>' .
40
-			'<p>' . sprintf(
41
-				/* translators: 1: %category%, 2: %tag% */
42
-				__( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
43
-				'<code>%category%</code>',
44
-				'<code>%tag%</code>'
45
-			) . '</p>' .
46
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
47
-	)
31
+    array(
32
+        'id'      => 'permalink-settings',
33
+        'title'   => __( 'Permalink Settings' ),
34
+        'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
35
+            '<p>' . sprintf(
36
+                /* translators: %s: Percent sign (%). */
37
+                __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
38
+                '<code>%</code>'
39
+            ) . '</p>' .
40
+            '<p>' . sprintf(
41
+                /* translators: 1: %category%, 2: %tag% */
42
+                __( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
43
+                '<code>%category%</code>',
44
+                '<code>%tag%</code>'
45
+            ) . '</p>' .
46
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
47
+    )
48 48
 );
49 49
 
50 50
 get_current_screen()->add_help_tab(
51
-	array(
52
-		'id'      => 'custom-structures',
53
-		'title'   => __( 'Custom Structures' ),
54
-		'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
55
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
56
-	)
51
+    array(
52
+        'id'      => 'custom-structures',
53
+        'title'   => __( 'Custom Structures' ),
54
+        'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
55
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
56
+    )
57 57
 );
58 58
 
59 59
 $help_sidebar_content = '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
60
-						'<p>' . __( '<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
61
-						'<p>' . __( '<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
60
+                        '<p>' . __( '<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
61
+                        '<p>' . __( '<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
62 62
 
63 63
 if ( $is_nginx ) {
64
-	$help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
64
+    $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
65 65
 }
66 66
 
67 67
 $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>';
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 $prefix      = '';
77 77
 $blog_prefix = '';
78 78
 if ( ! got_url_rewrite() ) {
79
-	$prefix = '/index.php';
79
+    $prefix = '/index.php';
80 80
 }
81 81
 
82 82
 /*
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  * base prefix, WordPress core can no longer account for the possible collision.
87 87
  */
88 88
 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
89
-	$blog_prefix = '/blog';
89
+    $blog_prefix = '/blog';
90 90
 }
91 91
 
92 92
 $category_base = get_option( 'category_base' );
@@ -96,109 +96,109 @@  discard block
 block discarded – undo
96 96
 $htaccess_update_required = false;
97 97
 
98 98
 if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
99
-	check_admin_referer( 'update-permalink' );
99
+    check_admin_referer( 'update-permalink' );
100 100
 
101
-	if ( isset( $_POST['permalink_structure'] ) ) {
102
-		if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
103
-			$permalink_structure = $_POST['selection'];
104
-		} else {
105
-			$permalink_structure = $_POST['permalink_structure'];
106
-		}
101
+    if ( isset( $_POST['permalink_structure'] ) ) {
102
+        if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
103
+            $permalink_structure = $_POST['selection'];
104
+        } else {
105
+            $permalink_structure = $_POST['permalink_structure'];
106
+        }
107 107
 
108
-		if ( ! empty( $permalink_structure ) ) {
109
-			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
110
-			if ( $prefix && $blog_prefix ) {
111
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
112
-			} else {
113
-				$permalink_structure = $blog_prefix . $permalink_structure;
114
-			}
115
-		}
108
+        if ( ! empty( $permalink_structure ) ) {
109
+            $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
110
+            if ( $prefix && $blog_prefix ) {
111
+                $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
112
+            } else {
113
+                $permalink_structure = $blog_prefix . $permalink_structure;
114
+            }
115
+        }
116 116
 
117
-		$permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
117
+        $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
118 118
 
119
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
119
+        $wp_rewrite->set_permalink_structure( $permalink_structure );
120 120
 
121
-		$structure_updated = true;
122
-	}
121
+        $structure_updated = true;
122
+    }
123 123
 
124
-	if ( isset( $_POST['category_base'] ) ) {
125
-		$category_base = $_POST['category_base'];
124
+    if ( isset( $_POST['category_base'] ) ) {
125
+        $category_base = $_POST['category_base'];
126 126
 
127
-		if ( ! empty( $category_base ) ) {
128
-			$category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
129
-		}
127
+        if ( ! empty( $category_base ) ) {
128
+            $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
129
+        }
130 130
 
131
-		$wp_rewrite->set_category_base( $category_base );
132
-	}
131
+        $wp_rewrite->set_category_base( $category_base );
132
+    }
133 133
 
134
-	if ( isset( $_POST['tag_base'] ) ) {
135
-		$tag_base = $_POST['tag_base'];
134
+    if ( isset( $_POST['tag_base'] ) ) {
135
+        $tag_base = $_POST['tag_base'];
136 136
 
137
-		if ( ! empty( $tag_base ) ) {
138
-			$tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
139
-		}
137
+        if ( ! empty( $tag_base ) ) {
138
+            $tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
139
+        }
140 140
 
141
-		$wp_rewrite->set_tag_base( $tag_base );
142
-	}
141
+        $wp_rewrite->set_tag_base( $tag_base );
142
+    }
143 143
 }
144 144
 
145 145
 if ( $iis7_permalinks ) {
146
-	if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {
147
-		$writable = true;
148
-	} else {
149
-		$writable = false;
150
-	}
146
+    if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {
147
+        $writable = true;
148
+    } else {
149
+        $writable = false;
150
+    }
151 151
 } elseif ( $is_nginx ) {
152
-	$writable = false;
152
+    $writable = false;
153 153
 } else {
154
-	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
155
-		$writable = true;
156
-	} else {
157
-		$writable       = false;
158
-		$existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
159
-		$new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
160
-
161
-		$htaccess_update_required = ( $new_rules !== $existing_rules );
162
-	}
154
+    if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
155
+        $writable = true;
156
+    } else {
157
+        $writable       = false;
158
+        $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
159
+        $new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
160
+
161
+        $htaccess_update_required = ( $new_rules !== $existing_rules );
162
+    }
163 163
 }
164 164
 
165 165
 $using_index_permalinks = $wp_rewrite->using_index_permalinks();
166 166
 
167 167
 if ( $structure_updated ) {
168
-	$message = __( 'Permalink structure updated.' );
169
-
170
-	if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
171
-		if ( $iis7_permalinks ) {
172
-			if ( ! $writable ) {
173
-				$message = sprintf(
174
-					/* translators: %s: web.config */
175
-					__( 'You should update your %s file now.' ),
176
-					'<code>web.config</code>'
177
-				);
178
-			} else {
179
-				$message = sprintf(
180
-					/* translators: %s: web.config */
181
-					__( 'Permalink structure updated. Remove write access on %s file now!' ),
182
-					'<code>web.config</code>'
183
-				);
184
-			}
185
-		} elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
186
-			$message = sprintf(
187
-				/* translators: %s: .htaccess */
188
-				__( 'You should update your %s file now.' ),
189
-				'<code>.htaccess</code>'
190
-			);
191
-		}
192
-	}
193
-
194
-	if ( ! get_settings_errors() ) {
195
-		add_settings_error( 'general', 'settings_updated', $message, 'success' );
196
-	}
197
-
198
-	set_transient( 'settings_errors', get_settings_errors(), 30 );
199
-
200
-	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
201
-	exit;
168
+    $message = __( 'Permalink structure updated.' );
169
+
170
+    if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
171
+        if ( $iis7_permalinks ) {
172
+            if ( ! $writable ) {
173
+                $message = sprintf(
174
+                    /* translators: %s: web.config */
175
+                    __( 'You should update your %s file now.' ),
176
+                    '<code>web.config</code>'
177
+                );
178
+            } else {
179
+                $message = sprintf(
180
+                    /* translators: %s: web.config */
181
+                    __( 'Permalink structure updated. Remove write access on %s file now!' ),
182
+                    '<code>web.config</code>'
183
+                );
184
+            }
185
+        } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
186
+            $message = sprintf(
187
+                /* translators: %s: .htaccess */
188
+                __( 'You should update your %s file now.' ),
189
+                '<code>.htaccess</code>'
190
+            );
191
+        }
192
+    }
193
+
194
+    if ( ! get_settings_errors() ) {
195
+        add_settings_error( 'general', 'settings_updated', $message, 'success' );
196
+    }
197
+
198
+    set_transient( 'settings_errors', get_settings_errors(), 30 );
199
+
200
+    wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
201
+    exit;
202 202
 }
203 203
 
204 204
 flush_rewrite_rules();
@@ -213,27 +213,27 @@  discard block
 block discarded – undo
213 213
 
214 214
 	<p>
215 215
 	<?php
216
-		printf(
217
-			/* translators: %s: Documentation URL. */
218
-			__( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
219
-			__( 'https://wordpress.org/support/article/using-permalinks/' )
220
-		);
221
-		?>
216
+        printf(
217
+            /* translators: %s: Documentation URL. */
218
+            __( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
219
+            __( 'https://wordpress.org/support/article/using-permalinks/' )
220
+        );
221
+        ?>
222 222
 	</p>
223 223
 
224 224
 <?php
225 225
 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
226
-	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
227
-	$category_base       = preg_replace( '|^/?blog|', '', $category_base );
228
-	$tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
226
+    $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
227
+    $category_base       = preg_replace( '|^/?blog|', '', $category_base );
228
+    $tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
229 229
 }
230 230
 
231 231
 $structures = array(
232
-	0 => '',
233
-	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
234
-	2 => $prefix . '/%year%/%monthnum%/%postname%/',
235
-	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
236
-	4 => $prefix . '/%postname%/',
232
+    0 => '',
233
+    1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
234
+    2 => $prefix . '/%year%/%monthnum%/%postname%/',
235
+    3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
236
+    4 => $prefix . '/%postname%/',
237 237
 );
238 238
 ?>
239 239
 <h2 class="title"><?php _e( 'Common Settings' ); ?></h2>
@@ -270,51 +270,51 @@  discard block
 block discarded – undo
270 270
 			<div class="available-structure-tags hide-if-no-js">
271 271
 				<div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div>
272 272
 				<?php
273
-				$available_tags = array(
274
-					/* translators: %s: Permalink structure tag. */
275
-					'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
276
-					/* translators: %s: Permalink structure tag. */
277
-					'monthnum' => __( '%s (Month of the year, for example 05.)' ),
278
-					/* translators: %s: Permalink structure tag. */
279
-					'day'      => __( '%s (Day of the month, for example 28.)' ),
280
-					/* translators: %s: Permalink structure tag. */
281
-					'hour'     => __( '%s (Hour of the day, for example 15.)' ),
282
-					/* translators: %s: Permalink structure tag. */
283
-					'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
284
-					/* translators: %s: Permalink structure tag. */
285
-					'second'   => __( '%s (Second of the minute, for example 33.)' ),
286
-					/* translators: %s: Permalink structure tag. */
287
-					'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
288
-					/* translators: %s: Permalink structure tag. */
289
-					'postname' => __( '%s (The sanitized post title (slug).)' ),
290
-					/* translators: %s: Permalink structure tag. */
291
-					'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
292
-					/* translators: %s: Permalink structure tag. */
293
-					'author'   => __( '%s (A sanitized version of the author name.)' ),
294
-				);
295
-
296
-				/**
297
-				 * Filters the list of available permalink structure tags on the Permalinks settings page.
298
-				 *
299
-				 * @since 4.9.0
300
-				 *
301
-				 * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
302
-				 */
303
-				$available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
304
-
305
-				/* translators: %s: Permalink structure tag. */
306
-				$structure_tag_added = __( '%s added to permalink structure' );
307
-
308
-				/* translators: %s: Permalink structure tag. */
309
-				$structure_tag_already_used = __( '%s (already used in permalink structure)' );
310
-
311
-				if ( ! empty( $available_tags ) ) :
312
-					?>
273
+                $available_tags = array(
274
+                    /* translators: %s: Permalink structure tag. */
275
+                    'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
276
+                    /* translators: %s: Permalink structure tag. */
277
+                    'monthnum' => __( '%s (Month of the year, for example 05.)' ),
278
+                    /* translators: %s: Permalink structure tag. */
279
+                    'day'      => __( '%s (Day of the month, for example 28.)' ),
280
+                    /* translators: %s: Permalink structure tag. */
281
+                    'hour'     => __( '%s (Hour of the day, for example 15.)' ),
282
+                    /* translators: %s: Permalink structure tag. */
283
+                    'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
284
+                    /* translators: %s: Permalink structure tag. */
285
+                    'second'   => __( '%s (Second of the minute, for example 33.)' ),
286
+                    /* translators: %s: Permalink structure tag. */
287
+                    'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
288
+                    /* translators: %s: Permalink structure tag. */
289
+                    'postname' => __( '%s (The sanitized post title (slug).)' ),
290
+                    /* translators: %s: Permalink structure tag. */
291
+                    'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
292
+                    /* translators: %s: Permalink structure tag. */
293
+                    'author'   => __( '%s (A sanitized version of the author name.)' ),
294
+                );
295
+
296
+                /**
297
+                 * Filters the list of available permalink structure tags on the Permalinks settings page.
298
+                 *
299
+                 * @since 4.9.0
300
+                 *
301
+                 * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
302
+                 */
303
+                $available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
304
+
305
+                /* translators: %s: Permalink structure tag. */
306
+                $structure_tag_added = __( '%s added to permalink structure' );
307
+
308
+                /* translators: %s: Permalink structure tag. */
309
+                $structure_tag_already_used = __( '%s (already used in permalink structure)' );
310
+
311
+                if ( ! empty( $available_tags ) ) :
312
+                    ?>
313 313
 					<p><?php _e( 'Available tags:' ); ?></p>
314 314
 					<ul role="list">
315 315
 						<?php
316
-						foreach ( $available_tags as $tag => $explanation ) {
317
-							?>
316
+                        foreach ( $available_tags as $tag => $explanation ) {
317
+                            ?>
318 318
 							<li>
319 319
 								<button type="button"
320 320
 										class="button button-secondary"
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 								</button>
326 326
 							</li>
327 327
 							<?php
328
-						}
329
-						?>
328
+                        }
329
+                        ?>
330 330
 					</ul>
331 331
 				<?php endif; ?>
332 332
 			</div>
@@ -360,22 +360,22 @@  discard block
 block discarded – undo
360 360
 </form>
361 361
 <?php if ( ! is_multisite() ) { ?>
362 362
 	<?php
363
-	if ( $iis7_permalinks ) :
364
-		if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
365
-			if ( file_exists( $home_path . 'web.config' ) ) :
366
-				?>
363
+    if ( $iis7_permalinks ) :
364
+        if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
365
+            if ( file_exists( $home_path . 'web.config' ) ) :
366
+                ?>
367 367
 <p id="iis-description-a">
368 368
 				<?php
369
-				printf(
370
-					/* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
371
-					__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
372
-					'<code>web.config</code>',
373
-					__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
374
-					'<kbd>Ctrl + A</kbd>',
375
-					'<kbd>⌘ + A</kbd>',
376
-					'<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
377
-				);
378
-				?>
369
+                printf(
370
+                    /* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
371
+                    __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
372
+                    '<code>web.config</code>',
373
+                    __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
374
+                    '<kbd>Ctrl + A</kbd>',
375
+                    '<kbd>⌘ + A</kbd>',
376
+                    '<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
377
+                );
378
+                ?>
379 379
 </p>
380 380
 <form action="options-permalink.php" method="post">
381 381
 				<?php wp_nonce_field( 'update-permalink' ); ?>
@@ -383,25 +383,25 @@  discard block
 block discarded – undo
383 383
 </form>
384 384
 <p>
385 385
 				<?php
386
-				printf(
387
-					/* translators: %s: web.config */
388
-					__( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
389
-					'<code>web.config</code>'
390
-				);
391
-				?>
386
+                printf(
387
+                    /* translators: %s: web.config */
388
+                    __( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
389
+                    '<code>web.config</code>'
390
+                );
391
+                ?>
392 392
 </p>
393 393
 		<?php else : ?>
394 394
 <p id="iis-description-b">
395 395
 			<?php
396
-			printf(
397
-				/* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
398
-				__( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
399
-				__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
400
-				'<code>web.config</code>',
401
-				'<kbd>Ctrl + A</kbd>',
402
-				'<kbd>⌘ + A</kbd>'
403
-			);
404
-			?>
396
+            printf(
397
+                /* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
398
+                __( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
399
+                __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
400
+                '<code>web.config</code>',
401
+                '<kbd>Ctrl + A</kbd>',
402
+                '<kbd>⌘ + A</kbd>'
403
+            );
404
+            ?>
405 405
 </p>
406 406
 <form action="options-permalink.php" method="post">
407 407
 			<?php wp_nonce_field( 'update-permalink' ); ?>
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
 </form>
410 410
 <p>
411 411
 			<?php
412
-			printf(
413
-				/* translators: %s: web.config */
414
-				__( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
415
-				'<code>web.config</code>'
416
-			);
417
-			?>
412
+            printf(
413
+                /* translators: %s: web.config */
414
+                __( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
415
+                '<code>web.config</code>'
416
+            );
417
+            ?>
418 418
 </p>
419 419
 		<?php endif; ?>
420 420
 	<?php endif; ?>
421 421
 		<?php
422 422
 else :
423
-	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424
-		?>
423
+    if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424
+        ?>
425 425
 <p id="htaccess-description">
426 426
 		<?php
427
-		printf(
428
-			/* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
429
-			__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
430
-			'<code>.htaccess</code>',
431
-			__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
432
-			'<kbd>Ctrl + A</kbd>',
433
-			'<kbd>⌘ + A</kbd>'
434
-		);
435
-		?>
427
+        printf(
428
+            /* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
429
+            __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
430
+            '<code>.htaccess</code>',
431
+            __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
432
+            '<kbd>Ctrl + A</kbd>',
433
+            '<kbd>⌘ + A</kbd>'
434
+        );
435
+        ?>
436 436
 </p>
437 437
 <form action="options-permalink.php" method="post">
438 438
 		<?php wp_nonce_field( 'update-permalink' ); ?>
Please login to merge, or discard this patch.
brighty/wp-admin/customize.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 require_once __DIR__ . '/admin.php';
14 14
 
15 15
 if ( ! current_user_can( 'customize' ) ) {
16
-	wp_die(
17
-		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18
-		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
19
-		403
20
-	);
16
+    wp_die(
17
+        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18
+        '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
19
+        403
20
+    );
21 21
 }
22 22
 
23 23
 /**
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 global $wp_scripts, $wp_customize;
28 28
 
29 29
 if ( $wp_customize->changeset_post_id() ) {
30
-	$changeset_post = get_post( $wp_customize->changeset_post_id() );
31
-
32
-	if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
33
-		wp_die(
34
-			'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
35
-			'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
36
-			403
37
-		);
38
-	}
39
-
40
-	$missed_schedule = (
41
-		'future' === $changeset_post->post_status &&
42
-		get_post_time( 'G', true, $changeset_post ) < time()
43
-	);
44
-	if ( $missed_schedule ) {
45
-		/*
30
+    $changeset_post = get_post( $wp_customize->changeset_post_id() );
31
+
32
+    if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
33
+        wp_die(
34
+            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
35
+            '<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
36
+            403
37
+        );
38
+    }
39
+
40
+    $missed_schedule = (
41
+        'future' === $changeset_post->post_status &&
42
+        get_post_time( 'G', true, $changeset_post ) < time()
43
+    );
44
+    if ( $missed_schedule ) {
45
+        /*
46 46
 		 * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`.
47 47
 		 *
48 48
 		 * Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false`
@@ -51,49 +51,49 @@  discard block
 block discarded – undo
51 51
 		 *
52 52
 		 * By opening an Ajax request, this is avoided and the changeset is published. See #39221.
53 53
 		 */
54
-		$nonces       = $wp_customize->get_nonces();
55
-		$request_args = array(
56
-			'nonce'                      => $nonces['save'],
57
-			'customize_changeset_uuid'   => $wp_customize->changeset_uuid(),
58
-			'wp_customize'               => 'on',
59
-			'customize_changeset_status' => 'publish',
60
-		);
61
-		ob_start();
62
-		?>
54
+        $nonces       = $wp_customize->get_nonces();
55
+        $request_args = array(
56
+            'nonce'                      => $nonces['save'],
57
+            'customize_changeset_uuid'   => $wp_customize->changeset_uuid(),
58
+            'wp_customize'               => 'on',
59
+            'customize_changeset_status' => 'publish',
60
+        );
61
+        ob_start();
62
+        ?>
63 63
 		<?php wp_print_scripts( array( 'wp-util' ) ); ?>
64 64
 		<script>
65 65
 			wp.ajax.post( 'customize_save', <?php echo wp_json_encode( $request_args ); ?> );
66 66
 		</script>
67 67
 		<?php
68
-		$script = ob_get_clean();
69
-
70
-		wp_die(
71
-			'<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
72
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
73
-			200
74
-		);
75
-	}
76
-
77
-	if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
78
-		wp_die(
79
-			'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
80
-			'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
81
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
82
-			403
83
-		);
84
-	}
68
+        $script = ob_get_clean();
69
+
70
+        wp_die(
71
+            '<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
72
+            '<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
73
+            200
74
+        );
75
+    }
76
+
77
+    if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
78
+        wp_die(
79
+            '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
80
+            '<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
81
+            '<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
82
+            403
83
+        );
84
+    }
85 85
 }
86 86
 
87 87
 
88 88
 wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
89 89
 if ( ! empty( $url ) ) {
90
-	$wp_customize->set_preview_url( wp_unslash( $url ) );
90
+    $wp_customize->set_preview_url( wp_unslash( $url ) );
91 91
 }
92 92
 if ( ! empty( $return ) ) {
93
-	$wp_customize->set_return_url( wp_unslash( $return ) );
93
+    $wp_customize->set_return_url( wp_unslash( $return ) );
94 94
 }
95 95
 if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
96
-	$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
96
+    $wp_customize->set_autofocus( wp_unslash( $autofocus ) );
97 97
 }
98 98
 
99 99
 $registered             = $wp_scripts->registered;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 $body_class = 'wp-core-ui wp-customizer js';
132 132
 
133 133
 if ( wp_is_mobile() ) :
134
-	$body_class .= ' mobile';
135
-	add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
134
+    $body_class .= ' mobile';
135
+    add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
136 136
 endif;
137 137
 
138 138
 if ( $wp_customize->is_ios() ) {
139
-	$body_class .= ' ios';
139
+    $body_class .= ' ios';
140 140
 }
141 141
 
142 142
 if ( is_rtl() ) {
143
-	$body_class .= ' rtl';
143
+    $body_class .= ' rtl';
144 144
 }
145 145
 $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
146 146
 
147 147
 if ( wp_use_widgets_block_editor() ) {
148
-	$body_class .= ' wp-embed-responsive';
148
+    $body_class .= ' wp-embed-responsive';
149 149
 }
150 150
 
151 151
 $admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
187 187
 		<div id="customize-header-actions" class="wp-full-overlay-header">
188 188
 			<?php
189
-			$compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
190
-			$compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
191
-			?>
189
+            $compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
190
+            $compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
191
+            ?>
192 192
 			<?php if ( $compatible_wp && $compatible_php ) : ?>
193 193
 				<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
194 194
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
@@ -226,22 +226,22 @@  discard block
 block discarded – undo
226 226
 					<div class="accordion-section-title">
227 227
 						<span class="preview-notice">
228 228
 						<?php
229
-							/* translators: %s: The site/panel title in the Customizer. */
230
-							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
231
-						?>
229
+                            /* translators: %s: The site/panel title in the Customizer. */
230
+                            printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
231
+                        ?>
232 232
 						</span>
233 233
 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
234 234
 					</div>
235 235
 					<div class="customize-panel-description">
236 236
 						<p>
237 237
 							<?php
238
-							_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
239
-							?>
238
+                            _e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
239
+                            ?>
240 240
 						</p>
241 241
 						<p>
242 242
 							<?php
243
-							_e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
244
-							?>
243
+                            _e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
244
+                            ?>
245 245
 						</p>
246 246
 					</div>
247 247
 				</div>
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 				<div class="devices">
264 264
 					<?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
265 265
 						<?php
266
-						if ( empty( $settings['label'] ) ) {
267
-							continue;
268
-						}
269
-						$active = ! empty( $settings['default'] );
270
-						$class  = 'preview-' . $device;
271
-						if ( $active ) {
272
-							$class .= ' active';
273
-						}
274
-						?>
266
+                        if ( empty( $settings['label'] ) ) {
267
+                            continue;
268
+                        }
269
+                        $active = ! empty( $settings['default'] );
270
+                        $class  = 'preview-' . $device;
271
+                        if ( $active ) {
272
+                            $class .= ' active';
273
+                        }
274
+                        ?>
275 275
 						<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
276 276
 							<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
277 277
 						</button>
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 	<div id="customize-preview" class="wp-full-overlay-main"></div>
285 285
 	<?php
286 286
 
287
-	/**
288
-	 * Prints templates, control scripts, and settings in the footer.
289
-	 *
290
-	 * @since 3.4.0
291
-	 */
292
-	do_action( 'customize_controls_print_footer_scripts' );
293
-	?>
287
+    /**
288
+     * Prints templates, control scripts, and settings in the footer.
289
+     *
290
+     * @since 3.4.0
291
+     */
292
+    do_action( 'customize_controls_print_footer_scripts' );
293
+    ?>
294 294
 </div>
295 295
 </body>
296 296
 </html>
Please login to merge, or discard this patch.
brighty/wp-admin/widgets-form-blocks.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Don't load directly.
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	die( '-1' );
11
+    die( '-1' );
12 12
 }
13 13
 
14 14
 // Flag that we're loading the block editor.
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) );
19 19
 
20 20
 $preload_paths = array(
21
-	array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
22
-	'/wp/v2/widget-types?context=edit&per_page=-1',
23
-	'/wp/v2/sidebars?context=edit&per_page=-1',
24
-	'/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
21
+    array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
22
+    '/wp/v2/widget-types?context=edit&per_page=-1',
23
+    '/wp/v2/sidebars?context=edit&per_page=-1',
24
+    '/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
25 25
 );
26 26
 block_editor_rest_api_preload( $preload_paths, $block_editor_context );
27 27
 
28 28
 $editor_settings = get_block_editor_settings(
29
-	array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
30
-	$block_editor_context
29
+    array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
30
+    $block_editor_context
31 31
 );
32 32
 
33 33
 // The widgets editor does not support the Block Directory, so don't load any of
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
37 37
 
38 38
 wp_add_inline_script(
39
-	'wp-edit-widgets',
40
-	sprintf(
41
-		'wp.domReady( function() {
39
+    'wp-edit-widgets',
40
+    sprintf(
41
+        'wp.domReady( function() {
42 42
 			wp.editWidgets.initialize( "widgets-editor", %s );
43 43
 		} );',
44
-		wp_json_encode( $editor_settings )
45
-	)
44
+        wp_json_encode( $editor_settings )
45
+    )
46 46
 );
47 47
 
48 48
 // Preload server-registered block schemas.
49 49
 wp_add_inline_script(
50
-	'wp-blocks',
51
-	'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
50
+    'wp-blocks',
51
+    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
52 52
 );
53 53
 
54 54
 wp_add_inline_script(
55
-	'wp-blocks',
56
-	sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
57
-	'after'
55
+    'wp-blocks',
56
+    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
57
+    'after'
58 58
 );
59 59
 
60 60
 wp_enqueue_script( 'wp-edit-widgets' );
Please login to merge, or discard this patch.