@@ -9,47 +9,47 @@ discard block |
||
9 | 9 | * @subpackage Administration |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! isset( $_GET['inline'] ) ) |
|
13 | - define( 'IFRAME_REQUEST' , true ); |
|
12 | +if ( ! isset($_GET['inline'])) |
|
13 | + define('IFRAME_REQUEST', true); |
|
14 | 14 | |
15 | 15 | /** Load WordPress Administration Bootstrap */ |
16 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
16 | +require_once(dirname(__FILE__).'/admin.php'); |
|
17 | 17 | |
18 | -if ( ! current_user_can( 'upload_files' ) ) { |
|
19 | - wp_die( __( 'Sorry, you are not allowed to upload files.' ), 403 ); |
|
18 | +if ( ! current_user_can('upload_files')) { |
|
19 | + wp_die(__('Sorry, you are not allowed to upload files.'), 403); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | wp_enqueue_script('plupload-handlers'); |
23 | 23 | wp_enqueue_script('image-edit'); |
24 | -wp_enqueue_script('set-post-thumbnail' ); |
|
24 | +wp_enqueue_script('set-post-thumbnail'); |
|
25 | 25 | wp_enqueue_style('imgareaselect'); |
26 | -wp_enqueue_script( 'media-gallery' ); |
|
26 | +wp_enqueue_script('media-gallery'); |
|
27 | 27 | |
28 | -@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); |
|
28 | +@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset')); |
|
29 | 29 | |
30 | 30 | // IDs should be integers |
31 | 31 | $ID = isset($ID) ? (int) $ID : 0; |
32 | -$post_id = isset($post_id)? (int) $post_id : 0; |
|
32 | +$post_id = isset($post_id) ? (int) $post_id : 0; |
|
33 | 33 | |
34 | 34 | // Require an ID for the edit screen. |
35 | -if ( isset( $action ) && $action == 'edit' && !$ID ) { |
|
35 | +if (isset($action) && $action == 'edit' && ! $ID) { |
|
36 | 36 | wp_die( |
37 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
38 | - '<p>' . __( 'Invalid item ID.' ) . '</p>', |
|
37 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
38 | + '<p>'.__('Invalid item ID.').'</p>', |
|
39 | 39 | 403 |
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | -if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) { |
|
43 | +if ( ! empty($_REQUEST['post_id']) && ! current_user_can('edit_post', $_REQUEST['post_id'])) { |
|
44 | 44 | wp_die( |
45 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
46 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
45 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
46 | + '<p>'.__('Sorry, you are not allowed to edit this item.').'</p>', |
|
47 | 47 | 403 |
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | 51 | // Upload type: image, video, file, ..? |
52 | -if ( isset($_GET['type']) ) { |
|
52 | +if (isset($_GET['type'])) { |
|
53 | 53 | $type = strval($_GET['type']); |
54 | 54 | } else { |
55 | 55 | /** |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | * @param string $type The default media upload type. Possible values include |
61 | 61 | * 'image', 'audio', 'video', 'file', etc. Default 'file'. |
62 | 62 | */ |
63 | - $type = apply_filters( 'media_upload_default_type', 'file' ); |
|
63 | + $type = apply_filters('media_upload_default_type', 'file'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // Tab: gallery, library, or type-specific. |
67 | -if ( isset($_GET['tab']) ) { |
|
67 | +if (isset($_GET['tab'])) { |
|
68 | 68 | $tab = strval($_GET['tab']); |
69 | 69 | } else { |
70 | 70 | /** |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $type The default media popup tab. Default 'type' (From Computer). |
76 | 76 | */ |
77 | - $tab = apply_filters( 'media_upload_default_tab', 'type' ); |
|
77 | + $tab = apply_filters('media_upload_default_tab', 'type'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $body_id = 'media-upload'; |
81 | 81 | |
82 | 82 | // Let the action code decide how to handle the request. |
83 | -if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) { |
|
83 | +if ($tab == 'type' || $tab == 'type_url' || ! array_key_exists($tab, media_upload_tabs())) { |
|
84 | 84 | /** |
85 | 85 | * Fires inside specific upload-type views in the legacy (pre-3.5.0) |
86 | 86 | * media popup based on the current tab. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @since 2.5.0 |
97 | 97 | */ |
98 | - do_action( "media_upload_$type" ); |
|
98 | + do_action("media_upload_$type"); |
|
99 | 99 | } else { |
100 | 100 | /** |
101 | 101 | * Fires inside limited and specific upload-tab views in the legacy |
@@ -107,6 +107,6 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @since 2.5.0 |
109 | 109 | */ |
110 | - do_action( "media_upload_$tab" ); |
|
110 | + do_action("media_upload_$tab"); |
|
111 | 111 | } |
112 | 112 |
@@ -7,98 +7,98 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( is_multisite() && ! is_network_admin() ) { |
|
13 | - wp_redirect( network_admin_url( 'plugin-editor.php' ) ); |
|
12 | +if (is_multisite() && ! is_network_admin()) { |
|
13 | + wp_redirect(network_admin_url('plugin-editor.php')); |
|
14 | 14 | exit(); |
15 | 15 | } |
16 | 16 | |
17 | -if ( !current_user_can('edit_plugins') ) |
|
18 | - wp_die( __('Sorry, you are not allowed to edit plugins for this site.') ); |
|
17 | +if ( ! current_user_can('edit_plugins')) |
|
18 | + wp_die(__('Sorry, you are not allowed to edit plugins for this site.')); |
|
19 | 19 | |
20 | 20 | $title = __("Edit Plugins"); |
21 | 21 | $parent_file = 'plugins.php'; |
22 | 22 | |
23 | -wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) ); |
|
23 | +wp_reset_vars(array('action', 'error', 'file', 'plugin')); |
|
24 | 24 | |
25 | 25 | $plugins = get_plugins(); |
26 | 26 | |
27 | -if ( empty( $plugins ) ) { |
|
28 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
27 | +if (empty($plugins)) { |
|
28 | + include(ABSPATH.'wp-admin/admin-header.php'); |
|
29 | 29 | ?> |
30 | 30 | <div class="wrap"> |
31 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
32 | - <div id="message" class="error"><p><?php _e( 'You do not appear to have any plugins available at this time.' ); ?></p></div> |
|
31 | + <h1><?php echo esc_html($title); ?></h1> |
|
32 | + <div id="message" class="error"><p><?php _e('You do not appear to have any plugins available at this time.'); ?></p></div> |
|
33 | 33 | </div> |
34 | 34 | <?php |
35 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
35 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | -if ( $file ) { |
|
39 | +if ($file) { |
|
40 | 40 | $plugin = $file; |
41 | -} elseif ( empty( $plugin ) ) { |
|
41 | +} elseif (empty($plugin)) { |
|
42 | 42 | $plugin = array_keys($plugins); |
43 | 43 | $plugin = $plugin[0]; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $plugin_files = get_plugin_files($plugin); |
47 | 47 | |
48 | -if ( empty($file) ) |
|
48 | +if (empty($file)) |
|
49 | 49 | $file = $plugin_files[0]; |
50 | 50 | |
51 | 51 | $file = validate_file_to_edit($file, $plugin_files); |
52 | -$real_file = WP_PLUGIN_DIR . '/' . $file; |
|
52 | +$real_file = WP_PLUGIN_DIR.'/'.$file; |
|
53 | 53 | $scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0; |
54 | 54 | |
55 | -switch ( $action ) { |
|
55 | +switch ($action) { |
|
56 | 56 | |
57 | 57 | case 'update': |
58 | 58 | |
59 | - check_admin_referer('edit-plugin_' . $file); |
|
59 | + check_admin_referer('edit-plugin_'.$file); |
|
60 | 60 | |
61 | - $newcontent = wp_unslash( $_POST['newcontent'] ); |
|
62 | - if ( is_writeable($real_file) ) { |
|
61 | + $newcontent = wp_unslash($_POST['newcontent']); |
|
62 | + if (is_writeable($real_file)) { |
|
63 | 63 | $f = fopen($real_file, 'w+'); |
64 | 64 | fwrite($f, $newcontent); |
65 | 65 | fclose($f); |
66 | 66 | |
67 | - $network_wide = is_plugin_active_for_network( $file ); |
|
67 | + $network_wide = is_plugin_active_for_network($file); |
|
68 | 68 | |
69 | 69 | // Deactivate so we can test it. |
70 | - if ( is_plugin_active($file) || isset($_POST['phperror']) ) { |
|
71 | - if ( is_plugin_active($file) ) |
|
70 | + if (is_plugin_active($file) || isset($_POST['phperror'])) { |
|
71 | + if (is_plugin_active($file)) |
|
72 | 72 | deactivate_plugins($file, true); |
73 | 73 | |
74 | - if ( ! is_network_admin() ) { |
|
75 | - update_option( 'recently_activated', array( $file => time() ) + (array) get_option( 'recently_activated' ) ); |
|
74 | + if ( ! is_network_admin()) { |
|
75 | + update_option('recently_activated', array($file => time()) + (array) get_option('recently_activated')); |
|
76 | 76 | } else { |
77 | - update_site_option( 'recently_activated', array( $file => time() ) + (array) get_site_option( 'recently_activated' ) ); |
|
77 | + update_site_option('recently_activated', array($file => time()) + (array) get_site_option('recently_activated')); |
|
78 | 78 | } |
79 | 79 | |
80 | - wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_' . $file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=" . $network_wide)); |
|
80 | + wp_redirect(add_query_arg('_wpnonce', wp_create_nonce('edit-plugin-test_'.$file), "plugin-editor.php?file=$file&liveupdate=1&scrollto=$scrollto&networkwide=".$network_wide)); |
|
81 | 81 | exit; |
82 | 82 | } |
83 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
83 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto")); |
|
84 | 84 | } else { |
85 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto") ); |
|
85 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&scrollto=$scrollto")); |
|
86 | 86 | } |
87 | 87 | exit; |
88 | 88 | |
89 | 89 | default: |
90 | 90 | |
91 | - if ( isset($_GET['liveupdate']) ) { |
|
92 | - check_admin_referer('edit-plugin-test_' . $file); |
|
91 | + if (isset($_GET['liveupdate'])) { |
|
92 | + check_admin_referer('edit-plugin-test_'.$file); |
|
93 | 93 | |
94 | 94 | $error = validate_plugin($file); |
95 | - if ( is_wp_error($error) ) |
|
96 | - wp_die( $error ); |
|
95 | + if (is_wp_error($error)) |
|
96 | + wp_die($error); |
|
97 | 97 | |
98 | - if ( ( ! empty( $_GET['networkwide'] ) && ! is_plugin_active_for_network($file) ) || ! is_plugin_active($file) ) |
|
99 | - activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty( $_GET['networkwide'] ) ); // we'll override this later if the plugin can be included without fatal error |
|
98 | + if (( ! empty($_GET['networkwide']) && ! is_plugin_active_for_network($file)) || ! is_plugin_active($file)) |
|
99 | + activate_plugin($file, "plugin-editor.php?file=$file&phperror=1", ! empty($_GET['networkwide'])); // we'll override this later if the plugin can be included without fatal error |
|
100 | 100 | |
101 | - wp_redirect( self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto") ); |
|
101 | + wp_redirect(self_admin_url("plugin-editor.php?file=$file&a=te&scrollto=$scrollto")); |
|
102 | 102 | exit; |
103 | 103 | } |
104 | 104 | |
@@ -112,97 +112,97 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param array $editable_extensions An array of editable plugin file extensions. |
114 | 114 | */ |
115 | - $editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions ); |
|
115 | + $editable_extensions = (array) apply_filters('editable_extensions', $editable_extensions); |
|
116 | 116 | |
117 | - if ( ! is_file($real_file) ) { |
|
117 | + if ( ! is_file($real_file)) { |
|
118 | 118 | wp_die(sprintf('<p>%s</p>', __('No such file exists! Double check the name and try again.'))); |
119 | 119 | } else { |
120 | 120 | // Get the extension of the file |
121 | - if ( preg_match('/\.([^.]+)$/', $real_file, $matches) ) { |
|
121 | + if (preg_match('/\.([^.]+)$/', $real_file, $matches)) { |
|
122 | 122 | $ext = strtolower($matches[1]); |
123 | 123 | // If extension is not in the acceptable list, skip it |
124 | - if ( !in_array( $ext, $editable_extensions) ) |
|
124 | + if ( ! in_array($ext, $editable_extensions)) |
|
125 | 125 | wp_die(sprintf('<p>%s</p>', __('Files of this type are not editable.'))); |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - get_current_screen()->add_help_tab( array( |
|
129 | + get_current_screen()->add_help_tab(array( |
|
130 | 130 | 'id' => 'overview', |
131 | 131 | 'title' => __('Overview'), |
132 | 132 | 'content' => |
133 | - '<p>' . __('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' . |
|
134 | - '<p>' . __('Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.') . '</p>' . |
|
135 | - '<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' . |
|
136 | - '<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>' . |
|
137 | - '<p>' . __('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.') . '</p>' . |
|
138 | - ( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' ) |
|
139 | - ) ); |
|
133 | + '<p>'.__('You can use the editor to make changes to any of your plugins’ individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.').'</p>'. |
|
134 | + '<p>'.__('Choose a plugin to edit from the dropdown menu and click the Select button. Click once on any file name to load it in the editor, and make your changes. Don’t forget to save your changes (Update File) when you’re finished.').'</p>'. |
|
135 | + '<p>'.__('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.').'</p>'. |
|
136 | + '<p id="newcontent-description">'.__('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.').'</p>'. |
|
137 | + '<p>'.__('If you want to make changes but don’t want them to be overwritten when the plugin is updated, you may be ready to think about writing your own plugin. For information on how to edit plugins, write your own from scratch, or just better understand their anatomy, check out the links below.').'</p>'. |
|
138 | + (is_network_admin() ? '<p>'.__('Any edits to files from this screen will be reflected on all sites in the network.').'</p>' : '') |
|
139 | + )); |
|
140 | 140 | |
141 | 141 | get_current_screen()->set_help_sidebar( |
142 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
143 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' . |
|
144 | - '<p>' . __('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' . |
|
145 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
142 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
143 | + '<p>'.__('<a href="https://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>').'</p>'. |
|
144 | + '<p>'.__('<a href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>').'</p>'. |
|
145 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
146 | 146 | ); |
147 | 147 | |
148 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
148 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
149 | 149 | |
150 | - update_recently_edited(WP_PLUGIN_DIR . '/' . $file); |
|
150 | + update_recently_edited(WP_PLUGIN_DIR.'/'.$file); |
|
151 | 151 | |
152 | - $content = file_get_contents( $real_file ); |
|
152 | + $content = file_get_contents($real_file); |
|
153 | 153 | |
154 | - if ( '.php' == substr( $real_file, strrpos( $real_file, '.' ) ) ) { |
|
155 | - $functions = wp_doc_link_parse( $content ); |
|
154 | + if ('.php' == substr($real_file, strrpos($real_file, '.'))) { |
|
155 | + $functions = wp_doc_link_parse($content); |
|
156 | 156 | |
157 | - if ( !empty($functions) ) { |
|
157 | + if ( ! empty($functions)) { |
|
158 | 158 | $docs_select = '<select name="docs-list" id="docs-list">'; |
159 | - $docs_select .= '<option value="">' . __( 'Function Name…' ) . '</option>'; |
|
160 | - foreach ( $functions as $function) { |
|
161 | - $docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>'; |
|
159 | + $docs_select .= '<option value="">'.__('Function Name…').'</option>'; |
|
160 | + foreach ($functions as $function) { |
|
161 | + $docs_select .= '<option value="'.esc_attr($function).'">'.esc_html($function).'()</option>'; |
|
162 | 162 | } |
163 | 163 | $docs_select .= '</select>'; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - $content = esc_textarea( $content ); |
|
167 | + $content = esc_textarea($content); |
|
168 | 168 | ?> |
169 | 169 | <?php if (isset($_GET['a'])) : ?> |
170 | 170 | <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div> |
171 | 171 | <?php elseif (isset($_GET['phperror'])) : ?> |
172 | 172 | <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p> |
173 | 173 | <?php |
174 | - if ( wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $file ) ) { |
|
175 | - $iframe_url = add_query_arg( array( |
|
174 | + if (wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$file)) { |
|
175 | + $iframe_url = add_query_arg(array( |
|
176 | 176 | 'action' => 'error_scrape', |
177 | - 'plugin' => urlencode( $file ), |
|
178 | - '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
|
179 | - ), admin_url( 'plugins.php' ) ); |
|
177 | + 'plugin' => urlencode($file), |
|
178 | + '_wpnonce' => urlencode($_GET['_error_nonce']), |
|
179 | + ), admin_url('plugins.php')); |
|
180 | 180 | ?> |
181 | - <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
|
181 | + <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($iframe_url); ?>"></iframe> |
|
182 | 182 | <?php } ?> |
183 | 183 | </div> |
184 | 184 | <?php endif; ?> |
185 | 185 | <div class="wrap"> |
186 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
186 | +<h1><?php echo esc_html($title); ?></h1> |
|
187 | 187 | |
188 | 188 | <div class="fileedit-sub"> |
189 | 189 | <div class="alignleft"> |
190 | 190 | <big><?php |
191 | - if ( is_plugin_active( $plugin ) ) { |
|
192 | - if ( is_writeable( $real_file ) ) { |
|
191 | + if (is_plugin_active($plugin)) { |
|
192 | + if (is_writeable($real_file)) { |
|
193 | 193 | /* translators: %s: plugin file name */ |
194 | - echo sprintf( __( 'Editing %s (active)' ), '<strong>' . $file . '</strong>' ); |
|
194 | + echo sprintf(__('Editing %s (active)'), '<strong>'.$file.'</strong>'); |
|
195 | 195 | } else { |
196 | 196 | /* translators: %s: plugin file name */ |
197 | - echo sprintf( __( 'Browsing %s (active)' ), '<strong>' . $file . '</strong>' ); |
|
197 | + echo sprintf(__('Browsing %s (active)'), '<strong>'.$file.'</strong>'); |
|
198 | 198 | } |
199 | 199 | } else { |
200 | - if ( is_writeable( $real_file ) ) { |
|
200 | + if (is_writeable($real_file)) { |
|
201 | 201 | /* translators: %s: plugin file name */ |
202 | - echo sprintf( __( 'Editing %s (inactive)' ), '<strong>' . $file . '</strong>' ); |
|
202 | + echo sprintf(__('Editing %s (inactive)'), '<strong>'.$file.'</strong>'); |
|
203 | 203 | } else { |
204 | 204 | /* translators: %s: plugin file name */ |
205 | - echo sprintf( __( 'Browsing %s (inactive)' ), '<strong>' . $file . '</strong>' ); |
|
205 | + echo sprintf(__('Browsing %s (inactive)'), '<strong>'.$file.'</strong>'); |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | ?></big> |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | <strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong> |
213 | 213 | <select name="plugin" id="plugin"> |
214 | 214 | <?php |
215 | - foreach ( $plugins as $plugin_key => $a_plugin ) { |
|
215 | + foreach ($plugins as $plugin_key => $a_plugin) { |
|
216 | 216 | $plugin_name = $a_plugin['Name']; |
217 | - if ( $plugin_key == $plugin ) |
|
217 | + if ($plugin_key == $plugin) |
|
218 | 218 | $selected = " selected='selected'"; |
219 | 219 | else |
220 | 220 | $selected = ''; |
@@ -224,55 +224,55 @@ discard block |
||
224 | 224 | } |
225 | 225 | ?> |
226 | 226 | </select> |
227 | - <?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?> |
|
227 | + <?php submit_button(__('Select'), 'button', 'Submit', false); ?> |
|
228 | 228 | </form> |
229 | 229 | </div> |
230 | 230 | <br class="clear" /> |
231 | 231 | </div> |
232 | 232 | |
233 | 233 | <div id="templateside"> |
234 | - <h2><?php _e( 'Plugin Files' ); ?></h2> |
|
234 | + <h2><?php _e('Plugin Files'); ?></h2> |
|
235 | 235 | |
236 | 236 | <ul> |
237 | 237 | <?php |
238 | -foreach ( $plugin_files as $plugin_file ) : |
|
238 | +foreach ($plugin_files as $plugin_file) : |
|
239 | 239 | // Get the extension of the file |
240 | - if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) { |
|
240 | + if (preg_match('/\.([^.]+)$/', $plugin_file, $matches)) { |
|
241 | 241 | $ext = strtolower($matches[1]); |
242 | 242 | // If extension is not in the acceptable list, skip it |
243 | - if ( !in_array( $ext, $editable_extensions ) ) |
|
243 | + if ( ! in_array($ext, $editable_extensions)) |
|
244 | 244 | continue; |
245 | 245 | } else { |
246 | 246 | // No extension found |
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | ?> |
250 | - <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li> |
|
250 | + <li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode($plugin_file) ?>&plugin=<?php echo urlencode($plugin) ?>"><?php echo $plugin_file ?></a></li> |
|
251 | 251 | <?php endforeach; ?> |
252 | 252 | </ul> |
253 | 253 | </div> |
254 | 254 | <form name="template" id="template" action="plugin-editor.php" method="post"> |
255 | - <?php wp_nonce_field('edit-plugin_' . $file) ?> |
|
255 | + <?php wp_nonce_field('edit-plugin_'.$file) ?> |
|
256 | 256 | <div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea> |
257 | 257 | <input type="hidden" name="action" value="update" /> |
258 | 258 | <input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" /> |
259 | 259 | <input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" /> |
260 | 260 | <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> |
261 | 261 | </div> |
262 | - <?php if ( !empty( $docs_select ) ) : ?> |
|
263 | - <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version ) ?>&redirect=true'); }" /></div> |
|
262 | + <?php if ( ! empty($docs_select)) : ?> |
|
263 | + <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e('Look Up') ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode(get_locale()) ?>&version=<?php echo urlencode($wp_version) ?>&redirect=true'); }" /></div> |
|
264 | 264 | <?php endif; ?> |
265 | -<?php if ( is_writeable($real_file) ) : ?> |
|
266 | - <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> |
|
265 | +<?php if (is_writeable($real_file)) : ?> |
|
266 | + <?php if (in_array($file, (array) get_option('active_plugins', array()))) { ?> |
|
267 | 267 | <p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p> |
268 | 268 | <?php } ?> |
269 | 269 | <p class="submit"> |
270 | 270 | <?php |
271 | - if ( isset($_GET['phperror']) ) { |
|
271 | + if (isset($_GET['phperror'])) { |
|
272 | 272 | echo "<input type='hidden' name='phperror' value='1' />"; |
273 | - submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false ); |
|
273 | + submit_button(__('Update File and Attempt to Reactivate'), 'primary', 'submit', false); |
|
274 | 274 | } else { |
275 | - submit_button( __( 'Update File' ), 'primary', 'submit', false ); |
|
275 | + submit_button(__('Update File'), 'primary', 'submit', false); |
|
276 | 276 | } |
277 | 277 | ?> |
278 | 278 | </p> |
@@ -291,4 +291,4 @@ discard block |
||
291 | 291 | <?php |
292 | 292 | break; |
293 | 293 | } |
294 | -include(ABSPATH . "wp-admin/admin-footer.php"); |
|
294 | +include(ABSPATH."wp-admin/admin-footer.php"); |
@@ -7,43 +7,43 @@ discard block |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
13 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
12 | +if ( ! is_multisite()) |
|
13 | + wp_die(__('Multisite support is not enabled.')); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'delete_site' ) ) |
|
16 | - wp_die(__( 'Sorry, you are not allowed to delete this site.')); |
|
15 | +if ( ! current_user_can('delete_site')) |
|
16 | + wp_die(__('Sorry, you are not allowed to delete this site.')); |
|
17 | 17 | |
18 | -if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { |
|
19 | - if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) { |
|
20 | - wpmu_delete_blog( $wpdb->blogid ); |
|
21 | - wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) ); |
|
18 | +if (isset($_GET['h']) && $_GET['h'] != '' && get_option('delete_blog_hash') != false) { |
|
19 | + if (hash_equals(get_option('delete_blog_hash'), $_GET['h'])) { |
|
20 | + wpmu_delete_blog($wpdb->blogid); |
|
21 | + wp_die(sprintf(__('Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.'), $current_site->site_name)); |
|
22 | 22 | } else { |
23 | - wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); |
|
23 | + wp_die(__("I'm sorry, the link you clicked is stale. Please select another option.")); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | $blog = get_blog_details(); |
28 | 28 | $user = wp_get_current_user(); |
29 | 29 | |
30 | -$title = __( 'Delete Site' ); |
|
30 | +$title = __('Delete Site'); |
|
31 | 31 | $parent_file = 'tools.php'; |
32 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
32 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
33 | 33 | |
34 | 34 | echo '<div class="wrap">'; |
35 | -echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
35 | +echo '<h1>'.esc_html($title).'</h1>'; |
|
36 | 36 | |
37 | -if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { |
|
38 | - check_admin_referer( 'delete-blog' ); |
|
37 | +if (isset($_POST['action']) && $_POST['action'] == 'deleteblog' && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1') { |
|
38 | + check_admin_referer('delete-blog'); |
|
39 | 39 | |
40 | - $hash = wp_generate_password( 20, false ); |
|
41 | - update_option( 'delete_blog_hash', $hash ); |
|
40 | + $hash = wp_generate_password(20, false); |
|
41 | + update_option('delete_blog_hash', $hash); |
|
42 | 42 | |
43 | - $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); |
|
43 | + $url_delete = esc_url(admin_url('ms-delete-site.php?h='.$hash)); |
|
44 | 44 | |
45 | 45 | /* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */ |
46 | - $content = __( "Howdy ###USERNAME###, |
|
46 | + $content = __("Howdy ###USERNAME###, |
|
47 | 47 | |
48 | 48 | You recently clicked the 'Delete Site' link on your site and filled in a |
49 | 49 | form on that page. |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network. |
68 | 68 | */ |
69 | - $content = apply_filters( 'delete_site_email_content', $content ); |
|
69 | + $content = apply_filters('delete_site_email_content', $content); |
|
70 | 70 | |
71 | - $content = str_replace( '###USERNAME###', $user->user_login, $content ); |
|
72 | - $content = str_replace( '###URL_DELETE###', $url_delete, $content ); |
|
73 | - $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content ); |
|
71 | + $content = str_replace('###USERNAME###', $user->user_login, $content); |
|
72 | + $content = str_replace('###URL_DELETE###', $url_delete, $content); |
|
73 | + $content = str_replace('###SITE_NAME###', $current_site->site_name, $content); |
|
74 | 74 | |
75 | - wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content ); |
|
75 | + wp_mail(get_option('admin_email'), "[ ".wp_specialchars_decode(get_option('blogname'))." ] ".__('Delete My Site'), $content); |
|
76 | 76 | ?> |
77 | 77 | |
78 | - <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> |
|
78 | + <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> |
|
79 | 79 | |
80 | 80 | <?php } else { |
81 | 81 | ?> |
82 | - <p><?php printf( __( '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.'), $current_site->site_name); ?></p> |
|
83 | - <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> |
|
82 | + <p><?php printf(__('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.'), $current_site->site_name); ?></p> |
|
83 | + <p><?php _e('Remember, once deleted your site cannot be restored.') ?></p> |
|
84 | 84 | |
85 | 85 | <form method="post" name="deletedirect"> |
86 | - <?php wp_nonce_field( 'delete-blog' ) ?> |
|
86 | + <?php wp_nonce_field('delete-blog') ?> |
|
87 | 87 | <input type="hidden" name="action" value="deleteblog" /> |
88 | - <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p> |
|
89 | - <?php submit_button( __( 'Delete My Site Permanently' ) ); ?> |
|
88 | + <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf(__("I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again."), is_subdomain_install() ? $blog->domain : $blog->domain.$blog->path); ?></strong></label></p> |
|
89 | + <?php submit_button(__('Delete My Site Permanently')); ?> |
|
90 | 90 | </form> |
91 | 91 | <?php |
92 | 92 | } |
93 | 93 | echo '</div>'; |
94 | 94 | |
95 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
95 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | $parent_file = 'edit-comments.php'; |
13 | 13 | $submenu_file = 'edit-comments.php'; |
@@ -16,59 +16,59 @@ discard block |
||
16 | 16 | * @global string $action |
17 | 17 | */ |
18 | 18 | global $action; |
19 | -wp_reset_vars( array('action') ); |
|
19 | +wp_reset_vars(array('action')); |
|
20 | 20 | |
21 | -if ( isset( $_POST['deletecomment'] ) ) |
|
21 | +if (isset($_POST['deletecomment'])) |
|
22 | 22 | $action = 'deletecomment'; |
23 | 23 | |
24 | -if ( 'cdc' == $action ) |
|
24 | +if ('cdc' == $action) |
|
25 | 25 | $action = 'delete'; |
26 | -elseif ( 'mac' == $action ) |
|
26 | +elseif ('mac' == $action) |
|
27 | 27 | $action = 'approve'; |
28 | 28 | |
29 | -if ( isset( $_GET['dt'] ) ) { |
|
30 | - if ( 'spam' == $_GET['dt'] ) |
|
29 | +if (isset($_GET['dt'])) { |
|
30 | + if ('spam' == $_GET['dt']) |
|
31 | 31 | $action = 'spam'; |
32 | - elseif ( 'trash' == $_GET['dt'] ) |
|
32 | + elseif ('trash' == $_GET['dt']) |
|
33 | 33 | $action = 'trash'; |
34 | 34 | } |
35 | 35 | |
36 | -switch( $action ) { |
|
36 | +switch ($action) { |
|
37 | 37 | |
38 | 38 | case 'editcomment' : |
39 | 39 | $title = __('Edit Comment'); |
40 | 40 | |
41 | - get_current_screen()->add_help_tab( array( |
|
41 | + get_current_screen()->add_help_tab(array( |
|
42 | 42 | 'id' => 'overview', |
43 | 43 | 'title' => __('Overview'), |
44 | 44 | 'content' => |
45 | - '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' . |
|
46 | - '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' |
|
47 | - ) ); |
|
45 | + '<p>'.__('You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.').'</p>'. |
|
46 | + '<p>'.__('You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.').'</p>' |
|
47 | + )); |
|
48 | 48 | |
49 | 49 | get_current_screen()->set_help_sidebar( |
50 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
51 | - '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
|
52 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
50 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
51 | + '<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>').'</p>'. |
|
52 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | wp_enqueue_script('comment'); |
56 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
56 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
57 | 57 | |
58 | - $comment_id = absint( $_GET['c'] ); |
|
58 | + $comment_id = absint($_GET['c']); |
|
59 | 59 | |
60 | - if ( !$comment = get_comment( $comment_id ) ) |
|
61 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
60 | + if ( ! $comment = get_comment($comment_id)) |
|
61 | + comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'javascript:history.go(-1)')); |
|
62 | 62 | |
63 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
64 | - comment_footer_die( __('Sorry, you are not allowed to edit this comment.') ); |
|
63 | + if ( ! current_user_can('edit_comment', $comment_id)) |
|
64 | + comment_footer_die(__('Sorry, you are not allowed to edit this comment.')); |
|
65 | 65 | |
66 | - if ( 'trash' == $comment->comment_approved ) |
|
67 | - comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
66 | + if ('trash' == $comment->comment_approved) |
|
67 | + comment_footer_die(__('This comment is in the Trash. Please move it out of the Trash if you want to edit it.')); |
|
68 | 68 | |
69 | - $comment = get_comment_to_edit( $comment_id ); |
|
69 | + $comment = get_comment_to_edit($comment_id); |
|
70 | 70 | |
71 | - include( ABSPATH . 'wp-admin/edit-form-comment.php' ); |
|
71 | + include(ABSPATH.'wp-admin/edit-form-comment.php'); |
|
72 | 72 | |
73 | 73 | break; |
74 | 74 | |
@@ -79,40 +79,40 @@ discard block |
||
79 | 79 | |
80 | 80 | $title = __('Moderate Comment'); |
81 | 81 | |
82 | - $comment_id = absint( $_GET['c'] ); |
|
82 | + $comment_id = absint($_GET['c']); |
|
83 | 83 | |
84 | - if ( ! $comment = get_comment( $comment_id ) ) { |
|
85 | - wp_redirect( admin_url('edit-comments.php?error=1') ); |
|
84 | + if ( ! $comment = get_comment($comment_id)) { |
|
85 | + wp_redirect(admin_url('edit-comments.php?error=1')); |
|
86 | 86 | die(); |
87 | 87 | } |
88 | 88 | |
89 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
90 | - wp_redirect( admin_url('edit-comments.php?error=2') ); |
|
89 | + if ( ! current_user_can('edit_comment', $comment->comment_ID)) { |
|
90 | + wp_redirect(admin_url('edit-comments.php?error=2')); |
|
91 | 91 | die(); |
92 | 92 | } |
93 | 93 | |
94 | 94 | // No need to re-approve/re-trash/re-spam a comment. |
95 | - if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { |
|
96 | - wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); |
|
95 | + if ($action == str_replace('1', 'approve', $comment->comment_approved)) { |
|
96 | + wp_redirect(admin_url('edit-comments.php?same='.$comment_id)); |
|
97 | 97 | die(); |
98 | 98 | } |
99 | 99 | |
100 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
100 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
101 | 101 | |
102 | - $formaction = $action . 'comment'; |
|
102 | + $formaction = $action.'comment'; |
|
103 | 103 | $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
104 | 104 | $nonce_action .= $comment_id; |
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <div class="wrap"> |
108 | 108 | |
109 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
109 | +<h1><?php echo esc_html($title); ?></h1> |
|
110 | 110 | |
111 | 111 | <?php |
112 | -switch ( $action ) { |
|
112 | +switch ($action) { |
|
113 | 113 | case 'spam' : |
114 | 114 | $caution_msg = __('You are about to mark the following comment as spam:'); |
115 | - $button = _x( 'Mark as Spam', 'comment' ); |
|
115 | + $button = _x('Mark as Spam', 'comment'); |
|
116 | 116 | break; |
117 | 117 | case 'trash' : |
118 | 118 | $caution_msg = __('You are about to move the following comment to the Trash:'); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | |
131 | -if ( $comment->comment_approved != '0' ) { // if not unapproved |
|
131 | +if ($comment->comment_approved != '0') { // if not unapproved |
|
132 | 132 | $message = ''; |
133 | - switch ( $comment->comment_approved ) { |
|
133 | + switch ($comment->comment_approved) { |
|
134 | 134 | case '1' : |
135 | 135 | $message = __('This comment is currently approved.'); |
136 | 136 | break; |
@@ -141,68 +141,68 @@ discard block |
||
141 | 141 | $message = __('This comment is currently in the Trash.'); |
142 | 142 | break; |
143 | 143 | } |
144 | - if ( $message ) { |
|
145 | - echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>'; |
|
144 | + if ($message) { |
|
145 | + echo '<div id="message" class="notice notice-info"><p>'.$message.'</p></div>'; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | ?> |
149 | -<div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div> |
|
149 | +<div id="message" class="notice notice-warning"><p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p></div> |
|
150 | 150 | |
151 | 151 | <table class="form-table comment-ays"> |
152 | 152 | <tr> |
153 | 153 | <th scope="row"><?php _e('Author'); ?></th> |
154 | -<td><?php comment_author( $comment ); ?></td> |
|
154 | +<td><?php comment_author($comment); ?></td> |
|
155 | 155 | </tr> |
156 | -<?php if ( get_comment_author_email( $comment ) ) { ?> |
|
156 | +<?php if (get_comment_author_email($comment)) { ?> |
|
157 | 157 | <tr> |
158 | 158 | <th scope="row"><?php _e('Email'); ?></th> |
159 | -<td><?php comment_author_email( $comment ); ?></td> |
|
159 | +<td><?php comment_author_email($comment); ?></td> |
|
160 | 160 | </tr> |
161 | 161 | <?php } ?> |
162 | -<?php if ( get_comment_author_url( $comment ) ) { ?> |
|
162 | +<?php if (get_comment_author_url($comment)) { ?> |
|
163 | 163 | <tr> |
164 | 164 | <th scope="row"><?php _e('URL'); ?></th> |
165 | -<td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td> |
|
165 | +<td><a href="<?php comment_author_url($comment); ?>"><?php comment_author_url($comment); ?></a></td> |
|
166 | 166 | </tr> |
167 | 167 | <?php } ?> |
168 | 168 | <tr> |
169 | - <th scope="row"><?php /* translators: column name or table row header */ _e( 'In Response To' ); ?></th> |
|
169 | + <th scope="row"><?php /* translators: column name or table row header */ _e('In Response To'); ?></th> |
|
170 | 170 | <td> |
171 | 171 | <?php |
172 | 172 | $post_id = $comment->comment_post_ID; |
173 | - if ( current_user_can( 'edit_post', $post_id ) ) { |
|
174 | - $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
|
175 | - $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
|
173 | + if (current_user_can('edit_post', $post_id)) { |
|
174 | + $post_link = "<a href='".esc_url(get_edit_post_link($post_id))."'>"; |
|
175 | + $post_link .= esc_html(get_the_title($post_id)).'</a>'; |
|
176 | 176 | } else { |
177 | - $post_link = esc_html( get_the_title( $post_id ) ); |
|
177 | + $post_link = esc_html(get_the_title($post_id)); |
|
178 | 178 | } |
179 | 179 | echo $post_link; |
180 | 180 | |
181 | - if ( $comment->comment_parent ) { |
|
182 | - $parent = get_comment( $comment->comment_parent ); |
|
183 | - $parent_link = esc_url( get_comment_link( $parent ) ); |
|
184 | - $name = get_comment_author( $parent ); |
|
181 | + if ($comment->comment_parent) { |
|
182 | + $parent = get_comment($comment->comment_parent); |
|
183 | + $parent_link = esc_url(get_comment_link($parent)); |
|
184 | + $name = get_comment_author($parent); |
|
185 | 185 | printf( |
186 | 186 | /* translators: %s: comment link */ |
187 | - ' | ' . __( 'In reply to %s.' ), |
|
188 | - '<a href="' . $parent_link . '">' . $name . '</a>' |
|
187 | + ' | '.__('In reply to %s.'), |
|
188 | + '<a href="'.$parent_link.'">'.$name.'</a>' |
|
189 | 189 | ); |
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | </td> |
193 | 193 | </tr> |
194 | 194 | <tr> |
195 | - <th scope="row"><?php _e( 'Submitted on' ); ?></th> |
|
195 | + <th scope="row"><?php _e('Submitted on'); ?></th> |
|
196 | 196 | <td> |
197 | 197 | <?php |
198 | 198 | /* translators: 1: comment date, 2: comment time */ |
199 | - $submitted = sprintf( __( '%1$s at %2$s' ), |
|
199 | + $submitted = sprintf(__('%1$s at %2$s'), |
|
200 | 200 | /* translators: comment date format. See https://secure.php.net/date */ |
201 | - get_comment_date( __( 'Y/m/d' ), $comment ), |
|
202 | - get_comment_date( __( 'g:i a' ), $comment ) |
|
201 | + get_comment_date(__('Y/m/d'), $comment), |
|
202 | + get_comment_date(__('g:i a'), $comment) |
|
203 | 203 | ); |
204 | - if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) { |
|
205 | - echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>'; |
|
204 | + if ('approved' === wp_get_comment_status($comment) && ! empty ($comment->comment_post_ID)) { |
|
205 | + echo '<a href="'.esc_url(get_comment_link($comment)).'">'.$submitted.'</a>'; |
|
206 | 206 | } else { |
207 | 207 | echo $submitted; |
208 | 208 | } |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | <tr> |
213 | 213 | <th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th> |
214 | 214 | <td class="comment-content"> |
215 | - <?php comment_text( $comment ); ?> |
|
216 | - <p class="edit-comment"><a href="<?php echo admin_url( "comment.php?action=editcomment&c={$comment->comment_ID}" ); ?>"><?php esc_attr_e( 'Edit' ); ?></a></p> |
|
215 | + <?php comment_text($comment); ?> |
|
216 | + <p class="edit-comment"><a href="<?php echo admin_url("comment.php?action=editcomment&c={$comment->comment_ID}"); ?>"><?php esc_attr_e('Edit'); ?></a></p> |
|
217 | 217 | </td> |
218 | 218 | </tr> |
219 | 219 | </table> |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | <form action="comment.php" method="get" class="comment-ays-submit"> |
222 | 222 | |
223 | 223 | <p> |
224 | - <?php submit_button( $button, 'primary', 'submit', false ); ?> |
|
225 | - <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e( 'Cancel' ); ?></a> |
|
224 | + <?php submit_button($button, 'primary', 'submit', false); ?> |
|
225 | + <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e('Cancel'); ?></a> |
|
226 | 226 | </p> |
227 | 227 | |
228 | -<?php wp_nonce_field( $nonce_action ); ?> |
|
228 | +<?php wp_nonce_field($nonce_action); ?> |
|
229 | 229 | <input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" /> |
230 | 230 | <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" /> |
231 | 231 | <input type="hidden" name="noredir" value="1" /> |
@@ -242,75 +242,75 @@ discard block |
||
242 | 242 | case 'unspamcomment' : |
243 | 243 | case 'approvecomment' : |
244 | 244 | case 'unapprovecomment' : |
245 | - $comment_id = absint( $_REQUEST['c'] ); |
|
245 | + $comment_id = absint($_REQUEST['c']); |
|
246 | 246 | |
247 | - if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
248 | - check_admin_referer( 'approve-comment_' . $comment_id ); |
|
247 | + if (in_array($action, array('approvecomment', 'unapprovecomment'))) |
|
248 | + check_admin_referer('approve-comment_'.$comment_id); |
|
249 | 249 | else |
250 | - check_admin_referer( 'delete-comment_' . $comment_id ); |
|
250 | + check_admin_referer('delete-comment_'.$comment_id); |
|
251 | 251 | |
252 | 252 | $noredir = isset($_REQUEST['noredir']); |
253 | 253 | |
254 | - if ( !$comment = get_comment($comment_id) ) |
|
255 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
256 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) |
|
257 | - comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') ); |
|
254 | + if ( ! $comment = get_comment($comment_id)) |
|
255 | + comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'edit-comments.php')); |
|
256 | + if ( ! current_user_can('edit_comment', $comment->comment_ID)) |
|
257 | + comment_footer_die(__('Sorry, you are not allowed to edit comments on this post.')); |
|
258 | 258 | |
259 | - if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) |
|
259 | + if ('' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php')) |
|
260 | 260 | $redir = wp_get_referer(); |
261 | - elseif ( '' != wp_get_original_referer() && ! $noredir ) |
|
261 | + elseif ('' != wp_get_original_referer() && ! $noredir) |
|
262 | 262 | $redir = wp_get_original_referer(); |
263 | - elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
264 | - $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
263 | + elseif (in_array($action, array('approvecomment', 'unapprovecomment'))) |
|
264 | + $redir = admin_url('edit-comments.php?p='.absint($comment->comment_post_ID)); |
|
265 | 265 | else |
266 | 266 | $redir = admin_url('edit-comments.php'); |
267 | 267 | |
268 | - $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); |
|
268 | + $redir = remove_query_arg(array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir); |
|
269 | 269 | |
270 | - switch ( $action ) { |
|
270 | + switch ($action) { |
|
271 | 271 | case 'deletecomment' : |
272 | - wp_delete_comment( $comment ); |
|
273 | - $redir = add_query_arg( array('deleted' => '1'), $redir ); |
|
272 | + wp_delete_comment($comment); |
|
273 | + $redir = add_query_arg(array('deleted' => '1'), $redir); |
|
274 | 274 | break; |
275 | 275 | case 'trashcomment' : |
276 | - wp_trash_comment( $comment ); |
|
277 | - $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); |
|
276 | + wp_trash_comment($comment); |
|
277 | + $redir = add_query_arg(array('trashed' => '1', 'ids' => $comment_id), $redir); |
|
278 | 278 | break; |
279 | 279 | case 'untrashcomment' : |
280 | - wp_untrash_comment( $comment ); |
|
281 | - $redir = add_query_arg( array('untrashed' => '1'), $redir ); |
|
280 | + wp_untrash_comment($comment); |
|
281 | + $redir = add_query_arg(array('untrashed' => '1'), $redir); |
|
282 | 282 | break; |
283 | 283 | case 'spamcomment' : |
284 | - wp_spam_comment( $comment ); |
|
285 | - $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); |
|
284 | + wp_spam_comment($comment); |
|
285 | + $redir = add_query_arg(array('spammed' => '1', 'ids' => $comment_id), $redir); |
|
286 | 286 | break; |
287 | 287 | case 'unspamcomment' : |
288 | - wp_unspam_comment( $comment ); |
|
289 | - $redir = add_query_arg( array('unspammed' => '1'), $redir ); |
|
288 | + wp_unspam_comment($comment); |
|
289 | + $redir = add_query_arg(array('unspammed' => '1'), $redir); |
|
290 | 290 | break; |
291 | 291 | case 'approvecomment' : |
292 | - wp_set_comment_status( $comment, 'approve' ); |
|
293 | - $redir = add_query_arg( array( 'approved' => 1 ), $redir ); |
|
292 | + wp_set_comment_status($comment, 'approve'); |
|
293 | + $redir = add_query_arg(array('approved' => 1), $redir); |
|
294 | 294 | break; |
295 | 295 | case 'unapprovecomment' : |
296 | - wp_set_comment_status( $comment, 'hold' ); |
|
297 | - $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); |
|
296 | + wp_set_comment_status($comment, 'hold'); |
|
297 | + $redir = add_query_arg(array('unapproved' => 1), $redir); |
|
298 | 298 | break; |
299 | 299 | } |
300 | 300 | |
301 | - wp_redirect( $redir ); |
|
301 | + wp_redirect($redir); |
|
302 | 302 | die; |
303 | 303 | |
304 | 304 | case 'editedcomment' : |
305 | 305 | |
306 | - $comment_id = absint( $_POST['comment_ID'] ); |
|
307 | - $comment_post_id = absint( $_POST['comment_post_ID'] ); |
|
306 | + $comment_id = absint($_POST['comment_ID']); |
|
307 | + $comment_post_id = absint($_POST['comment_post_ID']); |
|
308 | 308 | |
309 | - check_admin_referer( 'update-comment_' . $comment_id ); |
|
309 | + check_admin_referer('update-comment_'.$comment_id); |
|
310 | 310 | |
311 | 311 | edit_comment(); |
312 | 312 | |
313 | - $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; |
|
313 | + $location = (empty($_POST['referredby']) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby']).'#comment-'.$comment_id; |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Filters the URI the user is redirected to after editing a comment in the admin. |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | * @param string $location The URI the user will be redirected to. |
321 | 321 | * @param int $comment_id The ID of the comment being edited. |
322 | 322 | */ |
323 | - $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); |
|
324 | - wp_redirect( $location ); |
|
323 | + $location = apply_filters('comment_edit_redirect', $location, $comment_id); |
|
324 | + wp_redirect($location); |
|
325 | 325 | |
326 | 326 | exit(); |
327 | 327 | |
328 | 328 | default: |
329 | - wp_die( __('Unknown action.') ); |
|
329 | + wp_die(__('Unknown action.')); |
|
330 | 330 | |
331 | 331 | } // end switch |
332 | 332 | |
333 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
333 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -18,20 +18,23 @@ discard block |
||
18 | 18 | global $action; |
19 | 19 | wp_reset_vars( array('action') ); |
20 | 20 | |
21 | -if ( isset( $_POST['deletecomment'] ) ) |
|
21 | +if ( isset( $_POST['deletecomment'] ) ) { |
|
22 | 22 | $action = 'deletecomment'; |
23 | +} |
|
23 | 24 | |
24 | -if ( 'cdc' == $action ) |
|
25 | +if ( 'cdc' == $action ) { |
|
25 | 26 | $action = 'delete'; |
26 | -elseif ( 'mac' == $action ) |
|
27 | +} elseif ( 'mac' == $action ) { |
|
27 | 28 | $action = 'approve'; |
29 | +} |
|
28 | 30 | |
29 | 31 | if ( isset( $_GET['dt'] ) ) { |
30 | - if ( 'spam' == $_GET['dt'] ) |
|
31 | - $action = 'spam'; |
|
32 | - elseif ( 'trash' == $_GET['dt'] ) |
|
33 | - $action = 'trash'; |
|
34 | -} |
|
32 | + if ( 'spam' == $_GET['dt'] ) { |
|
33 | + $action = 'spam'; |
|
34 | + } elseif ( 'trash' == $_GET['dt'] ) { |
|
35 | + $action = 'trash'; |
|
36 | + } |
|
37 | + } |
|
35 | 38 | |
36 | 39 | switch( $action ) { |
37 | 40 | |
@@ -57,14 +60,17 @@ discard block |
||
57 | 60 | |
58 | 61 | $comment_id = absint( $_GET['c'] ); |
59 | 62 | |
60 | - if ( !$comment = get_comment( $comment_id ) ) |
|
61 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
63 | + if ( !$comment = get_comment( $comment_id ) ) { |
|
64 | + comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
65 | + } |
|
62 | 66 | |
63 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
64 | - comment_footer_die( __('Sorry, you are not allowed to edit this comment.') ); |
|
67 | + if ( !current_user_can( 'edit_comment', $comment_id ) ) { |
|
68 | + comment_footer_die( __('Sorry, you are not allowed to edit this comment.') ); |
|
69 | + } |
|
65 | 70 | |
66 | - if ( 'trash' == $comment->comment_approved ) |
|
67 | - comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
71 | + if ( 'trash' == $comment->comment_approved ) { |
|
72 | + comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
73 | + } |
|
68 | 74 | |
69 | 75 | $comment = get_comment_to_edit( $comment_id ); |
70 | 76 | |
@@ -244,26 +250,30 @@ discard block |
||
244 | 250 | case 'unapprovecomment' : |
245 | 251 | $comment_id = absint( $_REQUEST['c'] ); |
246 | 252 | |
247 | - if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
248 | - check_admin_referer( 'approve-comment_' . $comment_id ); |
|
249 | - else |
|
250 | - check_admin_referer( 'delete-comment_' . $comment_id ); |
|
253 | + if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
|
254 | + check_admin_referer( 'approve-comment_' . $comment_id ); |
|
255 | + } else { |
|
256 | + check_admin_referer( 'delete-comment_' . $comment_id ); |
|
257 | + } |
|
251 | 258 | |
252 | 259 | $noredir = isset($_REQUEST['noredir']); |
253 | 260 | |
254 | - if ( !$comment = get_comment($comment_id) ) |
|
255 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
256 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) |
|
257 | - comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') ); |
|
258 | - |
|
259 | - if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) |
|
260 | - $redir = wp_get_referer(); |
|
261 | - elseif ( '' != wp_get_original_referer() && ! $noredir ) |
|
262 | - $redir = wp_get_original_referer(); |
|
263 | - elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
264 | - $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
265 | - else |
|
266 | - $redir = admin_url('edit-comments.php'); |
|
261 | + if ( !$comment = get_comment($comment_id) ) { |
|
262 | + comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
263 | + } |
|
264 | + if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
265 | + comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') ); |
|
266 | + } |
|
267 | + |
|
268 | + if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) { |
|
269 | + $redir = wp_get_referer(); |
|
270 | + } elseif ( '' != wp_get_original_referer() && ! $noredir ) { |
|
271 | + $redir = wp_get_original_referer(); |
|
272 | + } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
|
273 | + $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
274 | + } else { |
|
275 | + $redir = admin_url('edit-comments.php'); |
|
276 | + } |
|
267 | 277 | |
268 | 278 | $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); |
269 | 279 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @global string $post_type |
@@ -16,28 +16,28 @@ discard block |
||
16 | 16 | */ |
17 | 17 | global $post_type, $post_type_object, $post; |
18 | 18 | |
19 | -if ( ! isset( $_GET['post_type'] ) ) { |
|
19 | +if ( ! isset($_GET['post_type'])) { |
|
20 | 20 | $post_type = 'post'; |
21 | -} elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) { |
|
21 | +} elseif (in_array($_GET['post_type'], get_post_types(array('show_ui' => true)))) { |
|
22 | 22 | $post_type = $_GET['post_type']; |
23 | 23 | } else { |
24 | - wp_die( __( 'Invalid post type.' ) ); |
|
24 | + wp_die(__('Invalid post type.')); |
|
25 | 25 | } |
26 | -$post_type_object = get_post_type_object( $post_type ); |
|
26 | +$post_type_object = get_post_type_object($post_type); |
|
27 | 27 | |
28 | -if ( 'post' == $post_type ) { |
|
28 | +if ('post' == $post_type) { |
|
29 | 29 | $parent_file = 'edit.php'; |
30 | 30 | $submenu_file = 'post-new.php'; |
31 | -} elseif ( 'attachment' == $post_type ) { |
|
32 | - if ( wp_redirect( admin_url( 'media-new.php' ) ) ) |
|
31 | +} elseif ('attachment' == $post_type) { |
|
32 | + if (wp_redirect(admin_url('media-new.php'))) |
|
33 | 33 | exit; |
34 | 34 | } else { |
35 | 35 | $submenu_file = "post-new.php?post_type=$post_type"; |
36 | - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { |
|
36 | + if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true) { |
|
37 | 37 | $parent_file = $post_type_object->show_in_menu; |
38 | 38 | // What if there isn't a post-new.php item for this post type? |
39 | - if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) { |
|
40 | - if ( isset( $_registered_pages[ get_plugin_page_hookname( "edit.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) { |
|
39 | + if ( ! isset($_registered_pages[get_plugin_page_hookname("post-new.php?post_type=$post_type", $post_type_object->show_in_menu)])) { |
|
40 | + if (isset($_registered_pages[get_plugin_page_hookname("edit.php?post_type=$post_type", $post_type_object->show_in_menu)])) { |
|
41 | 41 | // Fall back to edit.php for that post type, if it exists |
42 | 42 | $submenu_file = "edit.php?post_type=$post_type"; |
43 | 43 | } else { |
@@ -54,33 +54,33 @@ discard block |
||
54 | 54 | |
55 | 55 | $editing = true; |
56 | 56 | |
57 | -if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) { |
|
57 | +if ( ! current_user_can($post_type_object->cap->edit_posts) || ! current_user_can($post_type_object->cap->create_posts)) { |
|
58 | 58 | wp_die( |
59 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
60 | - '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>', |
|
59 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
60 | + '<p>'.__('Sorry, you are not allowed to create posts as this user.').'</p>', |
|
61 | 61 | 403 |
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // Schedule auto-draft cleanup |
66 | -if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) |
|
67 | - wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
|
66 | +if ( ! wp_next_scheduled('wp_scheduled_auto_draft_delete')) |
|
67 | + wp_schedule_event(time(), 'daily', 'wp_scheduled_auto_draft_delete'); |
|
68 | 68 | |
69 | -wp_enqueue_script( 'autosave' ); |
|
69 | +wp_enqueue_script('autosave'); |
|
70 | 70 | |
71 | -if ( is_multisite() ) { |
|
72 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
71 | +if (is_multisite()) { |
|
72 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
73 | 73 | } else { |
74 | - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
|
74 | + $check_users = get_users(array('fields' => 'ID', 'number' => 2)); |
|
75 | 75 | |
76 | - if ( count( $check_users ) > 1 ) |
|
77 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
76 | + if (count($check_users) > 1) |
|
77 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
78 | 78 | |
79 | - unset( $check_users ); |
|
79 | + unset($check_users); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Show post form. |
83 | -$post = get_default_post_to_edit( $post_type, true ); |
|
83 | +$post = get_default_post_to_edit($post_type, true); |
|
84 | 84 | $post_ID = $post->ID; |
85 | -include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); |
|
86 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
85 | +include(ABSPATH.'wp-admin/edit-form-advanced.php'); |
|
86 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! current_user_can( 'manage_options' ) ) |
|
13 | - wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
|
12 | +if ( ! current_user_can('manage_options')) |
|
13 | + wp_die(__('Sorry, you are not allowed to manage options for this site.')); |
|
14 | 14 | |
15 | 15 | $title = __('Permalink Settings'); |
16 | 16 | $parent_file = 'options-general.php'; |
17 | 17 | |
18 | -get_current_screen()->add_help_tab( array( |
|
18 | +get_current_screen()->add_help_tab(array( |
|
19 | 19 | 'id' => 'overview', |
20 | 20 | 'title' => __('Overview'), |
21 | - '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 — hence the name permalink.') . '</p>' . |
|
22 | - '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' . |
|
23 | - '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
|
24 | -) ); |
|
21 | + '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 — hence the name permalink.').'</p>'. |
|
22 | + '<p>'.__('This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.').'</p>'. |
|
23 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>', |
|
24 | +)); |
|
25 | 25 | |
26 | -get_current_screen()->add_help_tab( array( |
|
26 | +get_current_screen()->add_help_tab(array( |
|
27 | 27 | 'id' => 'permalink-settings', |
28 | 28 | 'title' => __('Permalink Settings'), |
29 | - '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>' . |
|
30 | - '<p>' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.' ) . '</p>' . |
|
31 | - '<p>' . __('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 <code>%category%</code> or <code>%tag%</code>.') . '</p>' . |
|
32 | - '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
|
33 | -) ); |
|
29 | + '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>'. |
|
30 | + '<p>'.__('If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.').'</p>'. |
|
31 | + '<p>'.__('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 <code>%category%</code> or <code>%tag%</code>.').'</p>'. |
|
32 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>', |
|
33 | +)); |
|
34 | 34 | |
35 | -get_current_screen()->add_help_tab( array( |
|
35 | +get_current_screen()->add_help_tab(array( |
|
36 | 36 | 'id' => 'custom-structures', |
37 | 37 | 'title' => __('Custom Structures'), |
38 | - 'content' => '<p>' . __('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' . |
|
39 | - '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
|
40 | -) ); |
|
38 | + 'content' => '<p>'.__('The Optional fields let you customize the “category” and “tag” base names that will appear in archive URLs. For example, the page listing all posts in the “Uncategorized” category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.').'</p>'. |
|
39 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>', |
|
40 | +)); |
|
41 | 41 | |
42 | 42 | get_current_screen()->set_help_sidebar( |
43 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
44 | - '<p>' . __('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>') . '</p>' . |
|
45 | - '<p>' . __('<a href="https://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>') . '</p>' . |
|
46 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
43 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
44 | + '<p>'.__('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>').'</p>'. |
|
45 | + '<p>'.__('<a href="https://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>').'</p>'. |
|
46 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | add_filter('admin_head', 'options_permalink_add_js'); |
50 | 50 | |
51 | 51 | $home_path = get_home_path(); |
52 | 52 | $iis7_permalinks = iis7_supports_permalinks(); |
53 | -$permalink_structure = get_option( 'permalink_structure' ); |
|
53 | +$permalink_structure = get_option('permalink_structure'); |
|
54 | 54 | |
55 | 55 | $prefix = $blog_prefix = ''; |
56 | -if ( ! got_url_rewrite() ) |
|
56 | +if ( ! got_url_rewrite()) |
|
57 | 57 | $prefix = '/index.php'; |
58 | 58 | |
59 | 59 | /** |
@@ -62,149 +62,149 @@ discard block |
||
62 | 62 | * network. If the `permalink_structure` option has been changed to remove this |
63 | 63 | * base prefix, WordPress core can no longer account for the possible collision. |
64 | 64 | */ |
65 | -if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
|
65 | +if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) { |
|
66 | 66 | $blog_prefix = '/blog'; |
67 | 67 | } |
68 | 68 | |
69 | -$category_base = get_option( 'category_base' ); |
|
70 | -$tag_base = get_option( 'tag_base' ); |
|
69 | +$category_base = get_option('category_base'); |
|
70 | +$tag_base = get_option('tag_base'); |
|
71 | 71 | $update_required = false; |
72 | 72 | |
73 | -if ( $iis7_permalinks ) { |
|
74 | - if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) |
|
73 | +if ($iis7_permalinks) { |
|
74 | + if (( ! file_exists($home_path.'web.config') && win_is_writable($home_path)) || win_is_writable($home_path.'web.config')) |
|
75 | 75 | $writable = true; |
76 | 76 | else |
77 | 77 | $writable = false; |
78 | -} elseif ( $is_nginx ) { |
|
78 | +} elseif ($is_nginx) { |
|
79 | 79 | $writable = false; |
80 | 80 | } else { |
81 | - if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { |
|
81 | + if (( ! file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')) { |
|
82 | 82 | $writable = true; |
83 | 83 | } else { |
84 | 84 | $writable = false; |
85 | - $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) ); |
|
86 | - $new_rules = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) ); |
|
87 | - $update_required = ( $new_rules !== $existing_rules ); |
|
85 | + $existing_rules = array_filter(extract_from_markers($home_path.'.htaccess', 'WordPress')); |
|
86 | + $new_rules = array_filter(explode("\n", $wp_rewrite->mod_rewrite_rules())); |
|
87 | + $update_required = ($new_rules !== $existing_rules); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | $using_index_permalinks = $wp_rewrite->using_index_permalinks(); |
92 | 92 | |
93 | -if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { |
|
93 | +if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) { |
|
94 | 94 | check_admin_referer('update-permalink'); |
95 | 95 | |
96 | - if ( isset( $_POST['permalink_structure'] ) ) { |
|
97 | - if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) |
|
96 | + if (isset($_POST['permalink_structure'])) { |
|
97 | + if (isset($_POST['selection']) && 'custom' != $_POST['selection']) |
|
98 | 98 | $permalink_structure = $_POST['selection']; |
99 | 99 | else |
100 | 100 | $permalink_structure = $_POST['permalink_structure']; |
101 | 101 | |
102 | - if ( ! empty( $permalink_structure ) ) { |
|
103 | - $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); |
|
104 | - if ( $prefix && $blog_prefix ) |
|
105 | - $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); |
|
102 | + if ( ! empty($permalink_structure)) { |
|
103 | + $permalink_structure = preg_replace('#/+#', '/', '/'.str_replace('#', '', $permalink_structure)); |
|
104 | + if ($prefix && $blog_prefix) |
|
105 | + $permalink_structure = $prefix.preg_replace('#^/?index\.php#', '', $permalink_structure); |
|
106 | 106 | else |
107 | - $permalink_structure = $blog_prefix . $permalink_structure; |
|
107 | + $permalink_structure = $blog_prefix.$permalink_structure; |
|
108 | 108 | } |
109 | 109 | |
110 | - $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure ); |
|
110 | + $permalink_structure = sanitize_option('permalink_structure', $permalink_structure); |
|
111 | 111 | |
112 | - $wp_rewrite->set_permalink_structure( $permalink_structure ); |
|
112 | + $wp_rewrite->set_permalink_structure($permalink_structure); |
|
113 | 113 | } |
114 | 114 | |
115 | - if ( isset( $_POST['category_base'] ) ) { |
|
115 | + if (isset($_POST['category_base'])) { |
|
116 | 116 | $category_base = $_POST['category_base']; |
117 | - if ( ! empty( $category_base ) ) |
|
118 | - $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); |
|
119 | - $wp_rewrite->set_category_base( $category_base ); |
|
117 | + if ( ! empty($category_base)) |
|
118 | + $category_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $category_base)); |
|
119 | + $wp_rewrite->set_category_base($category_base); |
|
120 | 120 | } |
121 | 121 | |
122 | - if ( isset( $_POST['tag_base'] ) ) { |
|
122 | + if (isset($_POST['tag_base'])) { |
|
123 | 123 | $tag_base = $_POST['tag_base']; |
124 | - if ( ! empty( $tag_base ) ) |
|
125 | - $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); |
|
126 | - $wp_rewrite->set_tag_base( $tag_base ); |
|
124 | + if ( ! empty($tag_base)) |
|
125 | + $tag_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $tag_base)); |
|
126 | + $wp_rewrite->set_tag_base($tag_base); |
|
127 | 127 | } |
128 | 128 | |
129 | - $message = __( 'Permalink structure updated.' ); |
|
129 | + $message = __('Permalink structure updated.'); |
|
130 | 130 | |
131 | - if ( $iis7_permalinks ) { |
|
132 | - if ( $permalink_structure && ! $using_index_permalinks && ! $writable ) { |
|
133 | - $message = __( 'You should update your web.config now.' ); |
|
134 | - } elseif ( $permalink_structure && ! $using_index_permalinks && $writable ) { |
|
135 | - $message = __( 'Permalink structure updated. Remove write access on web.config file now!' ); |
|
131 | + if ($iis7_permalinks) { |
|
132 | + if ($permalink_structure && ! $using_index_permalinks && ! $writable) { |
|
133 | + $message = __('You should update your web.config now.'); |
|
134 | + } elseif ($permalink_structure && ! $using_index_permalinks && $writable) { |
|
135 | + $message = __('Permalink structure updated. Remove write access on web.config file now!'); |
|
136 | 136 | } |
137 | - } elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) { |
|
138 | - $message = __( 'You should update your .htaccess now.' ); |
|
137 | + } elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required) { |
|
138 | + $message = __('You should update your .htaccess now.'); |
|
139 | 139 | } |
140 | 140 | |
141 | - if ( ! get_settings_errors() ) { |
|
142 | - add_settings_error( 'general', 'settings_updated', $message, 'updated' ); |
|
141 | + if ( ! get_settings_errors()) { |
|
142 | + add_settings_error('general', 'settings_updated', $message, 'updated'); |
|
143 | 143 | } |
144 | 144 | |
145 | - set_transient( 'settings_errors', get_settings_errors(), 30 ); |
|
145 | + set_transient('settings_errors', get_settings_errors(), 30); |
|
146 | 146 | |
147 | - wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) ); |
|
147 | + wp_redirect(admin_url('options-permalink.php?settings-updated=true')); |
|
148 | 148 | exit; |
149 | 149 | } |
150 | 150 | |
151 | 151 | flush_rewrite_rules(); |
152 | 152 | |
153 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
153 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
154 | 154 | ?> |
155 | 155 | <div class="wrap"> |
156 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
156 | +<h1><?php echo esc_html($title); ?></h1> |
|
157 | 157 | |
158 | 158 | <form name="form" action="options-permalink.php" method="post"> |
159 | 159 | <?php wp_nonce_field('update-permalink') ?> |
160 | 160 | |
161 | - <p><?php _e( '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="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.' ); ?></p> |
|
161 | + <p><?php _e('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="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p> |
|
162 | 162 | |
163 | 163 | <?php |
164 | -if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) { |
|
165 | - $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure ); |
|
166 | - $category_base = preg_replace( '|^/?blog|', '', $category_base ); |
|
167 | - $tag_base = preg_replace( '|^/?blog|', '', $tag_base ); |
|
164 | +if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) { |
|
165 | + $permalink_structure = preg_replace('|^/?blog|', '', $permalink_structure); |
|
166 | + $category_base = preg_replace('|^/?blog|', '', $category_base); |
|
167 | + $tag_base = preg_replace('|^/?blog|', '', $tag_base); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $structures = array( |
171 | 171 | 0 => '', |
172 | - 1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/', |
|
173 | - 2 => $prefix . '/%year%/%monthnum%/%postname%/', |
|
174 | - 3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%', |
|
175 | - 4 => $prefix . '/%postname%/', |
|
172 | + 1 => $prefix.'/%year%/%monthnum%/%day%/%postname%/', |
|
173 | + 2 => $prefix.'/%year%/%monthnum%/%postname%/', |
|
174 | + 3 => $prefix.'/'._x('archives', 'sample permalink base').'/%post_id%', |
|
175 | + 4 => $prefix.'/%postname%/', |
|
176 | 176 | ); |
177 | 177 | ?> |
178 | 178 | <h2 class="title"><?php _e('Common Settings'); ?></h2> |
179 | 179 | <table class="form-table permalink-structure"> |
180 | 180 | <tr> |
181 | - <th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e( 'Plain' ); ?></label></th> |
|
181 | + <th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Plain'); ?></label></th> |
|
182 | 182 | <td><code><?php echo get_option('home'); ?>/?p=123</code></td> |
183 | 183 | </tr> |
184 | 184 | <tr> |
185 | 185 | <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th> |
186 | - <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
|
186 | + <td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'.date('d').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td> |
|
187 | 187 | </tr> |
188 | 188 | <tr> |
189 | 189 | <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th> |
190 | - <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
|
190 | + <td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td> |
|
191 | 191 | </tr> |
192 | 192 | <tr> |
193 | 193 | <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th> |
194 | - <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td> |
|
194 | + <td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('archives', 'sample permalink base').'/123'; ?></code></td> |
|
195 | 195 | </tr> |
196 | 196 | <tr> |
197 | 197 | <th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th> |
198 | - <td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td> |
|
198 | + <td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td> |
|
199 | 199 | </tr> |
200 | 200 | <tr> |
201 | 201 | <th> |
202 | - <label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> /> |
|
202 | + <label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array($permalink_structure, $structures)); ?> /> |
|
203 | 203 | <?php _e('Custom Structure'); ?> |
204 | 204 | </label> |
205 | 205 | </th> |
206 | 206 | <td> |
207 | - <code><?php echo get_option('home') . $blog_prefix; ?></code> |
|
207 | + <code><?php echo get_option('home').$blog_prefix; ?></code> |
|
208 | 208 | <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" /> |
209 | 209 | </td> |
210 | 210 | </tr> |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | <h2 class="title"><?php _e('Optional'); ?></h2> |
214 | 214 | <p><?php |
215 | 215 | /* translators: %s is a placeholder that must come at the start of the URL. */ |
216 | -printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); ?></p> |
|
216 | +printf(__('If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.'), get_option('home').$blog_prefix.$prefix); ?></p> |
|
217 | 217 | |
218 | 218 | <table class="form-table"> |
219 | 219 | <tr> |
220 | 220 | <th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th> |
221 | - <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td> |
|
221 | + <td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td> |
|
222 | 222 | </tr> |
223 | 223 | <tr> |
224 | 224 | <th><label for="tag_base"><?php _e('Tag base'); ?></label></th> |
@@ -231,33 +231,33 @@ discard block |
||
231 | 231 | |
232 | 232 | <?php submit_button(); ?> |
233 | 233 | </form> |
234 | -<?php if ( !is_multisite() ) { ?> |
|
235 | -<?php if ( $iis7_permalinks ) : |
|
236 | - if ( isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable ) : |
|
237 | - if ( file_exists($home_path . 'web.config') ) : ?> |
|
234 | +<?php if ( ! is_multisite()) { ?> |
|
235 | +<?php if ($iis7_permalinks) : |
|
236 | + if (isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable) : |
|
237 | + if (file_exists($home_path.'web.config')) : ?> |
|
238 | 238 | <p><?php _e('If your <code>web.config</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/<configuration>/<system.webServer>/<rewrite>/<rules></code> element in <code>web.config</code> file.') ?></p> |
239 | 239 | <form action="options-permalink.php" method="post"> |
240 | 240 | <?php wp_nonce_field('update-permalink') ?> |
241 | - <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p> |
|
241 | + <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules()); ?></textarea></p> |
|
242 | 242 | </form> |
243 | 243 | <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p> |
244 | 244 | <?php else : ?> |
245 | 245 | <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p> |
246 | 246 | <form action="options-permalink.php" method="post"> |
247 | 247 | <?php wp_nonce_field('update-permalink') ?> |
248 | - <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p> |
|
248 | + <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules(true)); ?></textarea></p> |
|
249 | 249 | </form> |
250 | 250 | <p><?php _e('If you temporarily make your site’s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p> |
251 | 251 | <?php endif; ?> |
252 | 252 | <?php endif; ?> |
253 | -<?php elseif ( $is_nginx ) : ?> |
|
254 | - <p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p> |
|
253 | +<?php elseif ($is_nginx) : ?> |
|
254 | + <p><?php _e('<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.'); ?></p> |
|
255 | 255 | <?php else: |
256 | - if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : ?> |
|
256 | + if ($permalink_structure && ! $using_index_permalinks && ! $writable && $update_required) : ?> |
|
257 | 257 | <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> |
258 | 258 | <form action="options-permalink.php" method="post"> |
259 | 259 | <?php wp_nonce_field('update-permalink') ?> |
260 | - <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p> |
|
260 | + <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->mod_rewrite_rules()); ?></textarea></p> |
|
261 | 261 | </form> |
262 | 262 | <?php endif; ?> |
263 | 263 | <?php endif; ?> |
@@ -265,4 +265,4 @@ discard block |
||
265 | 265 | |
266 | 266 | </div> |
267 | 267 | |
268 | -<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
268 | +<?php require(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! current_user_can( 'manage_options' ) ) |
|
12 | +if ( ! current_user_can( 'manage_options' ) ) { |
|
13 | 13 | wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $title = __('Permalink Settings'); |
16 | 17 | $parent_file = 'options-general.php'; |
@@ -53,8 +54,9 @@ discard block |
||
53 | 54 | $permalink_structure = get_option( 'permalink_structure' ); |
54 | 55 | |
55 | 56 | $prefix = $blog_prefix = ''; |
56 | -if ( ! got_url_rewrite() ) |
|
57 | +if ( ! got_url_rewrite() ) { |
|
57 | 58 | $prefix = '/index.php'; |
59 | +} |
|
58 | 60 | |
59 | 61 | /** |
60 | 62 | * In a subdirectory configuration of multisite, the `/blog` prefix is used by |
@@ -71,11 +73,12 @@ discard block |
||
71 | 73 | $update_required = false; |
72 | 74 | |
73 | 75 | if ( $iis7_permalinks ) { |
74 | - if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) |
|
75 | - $writable = true; |
|
76 | - else |
|
77 | - $writable = false; |
|
78 | -} elseif ( $is_nginx ) { |
|
76 | + if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) { |
|
77 | + $writable = true; |
|
78 | + } else { |
|
79 | + $writable = false; |
|
80 | + } |
|
81 | + } elseif ( $is_nginx ) { |
|
79 | 82 | $writable = false; |
80 | 83 | } else { |
81 | 84 | if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) { |
@@ -94,17 +97,19 @@ discard block |
||
94 | 97 | check_admin_referer('update-permalink'); |
95 | 98 | |
96 | 99 | if ( isset( $_POST['permalink_structure'] ) ) { |
97 | - if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) |
|
98 | - $permalink_structure = $_POST['selection']; |
|
99 | - else |
|
100 | - $permalink_structure = $_POST['permalink_structure']; |
|
100 | + if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) { |
|
101 | + $permalink_structure = $_POST['selection']; |
|
102 | + } else { |
|
103 | + $permalink_structure = $_POST['permalink_structure']; |
|
104 | + } |
|
101 | 105 | |
102 | 106 | if ( ! empty( $permalink_structure ) ) { |
103 | 107 | $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); |
104 | - if ( $prefix && $blog_prefix ) |
|
105 | - $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); |
|
106 | - else |
|
107 | - $permalink_structure = $blog_prefix . $permalink_structure; |
|
108 | + if ( $prefix && $blog_prefix ) { |
|
109 | + $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure ); |
|
110 | + } else { |
|
111 | + $permalink_structure = $blog_prefix . $permalink_structure; |
|
112 | + } |
|
108 | 113 | } |
109 | 114 | |
110 | 115 | $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure ); |
@@ -114,15 +119,17 @@ discard block |
||
114 | 119 | |
115 | 120 | if ( isset( $_POST['category_base'] ) ) { |
116 | 121 | $category_base = $_POST['category_base']; |
117 | - if ( ! empty( $category_base ) ) |
|
118 | - $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); |
|
122 | + if ( ! empty( $category_base ) ) { |
|
123 | + $category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); |
|
124 | + } |
|
119 | 125 | $wp_rewrite->set_category_base( $category_base ); |
120 | 126 | } |
121 | 127 | |
122 | 128 | if ( isset( $_POST['tag_base'] ) ) { |
123 | 129 | $tag_base = $_POST['tag_base']; |
124 | - if ( ! empty( $tag_base ) ) |
|
125 | - $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); |
|
130 | + if ( ! empty( $tag_base ) ) { |
|
131 | + $tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); |
|
132 | + } |
|
126 | 133 | $wp_rewrite->set_tag_base( $tag_base ); |
127 | 134 | } |
128 | 135 | |
@@ -241,23 +248,29 @@ discard block |
||
241 | 248 | <p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p> |
242 | 249 | </form> |
243 | 250 | <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p> |
244 | - <?php else : ?> |
|
251 | + <?php else { |
|
252 | + : ?> |
|
245 | 253 | <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p> |
246 | 254 | <form action="options-permalink.php" method="post"> |
247 | 255 | <?php wp_nonce_field('update-permalink') ?> |
248 | - <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p> |
|
256 | + <p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); |
|
257 | +} |
|
258 | +?></textarea></p> |
|
249 | 259 | </form> |
250 | 260 | <p><?php _e('If you temporarily make your site’s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p> |
251 | 261 | <?php endif; ?> |
252 | 262 | <?php endif; ?> |
253 | 263 | <?php elseif ( $is_nginx ) : ?> |
254 | 264 | <p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p> |
255 | -<?php else: |
|
265 | +<?php else { |
|
266 | + : |
|
256 | 267 | if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : ?> |
257 | 268 | <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p> |
258 | 269 | <form action="options-permalink.php" method="post"> |
259 | 270 | <?php wp_nonce_field('update-permalink') ?> |
260 | - <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p> |
|
271 | + <p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); |
|
272 | +} |
|
273 | +?></textarea></p> |
|
261 | 274 | </form> |
262 | 275 | <?php endif; ?> |
263 | 276 | <?php endif; ?> |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** WordPress Administration Bootstrap */ |
12 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 | +require_once(dirname(__FILE__).'/admin.php'); |
|
13 | 13 | |
14 | 14 | $parent_file = 'edit.php'; |
15 | 15 | $submenu_file = 'edit.php'; |
16 | 16 | |
17 | -wp_reset_vars( array( 'action' ) ); |
|
17 | +wp_reset_vars(array('action')); |
|
18 | 18 | |
19 | -if ( isset( $_GET['post'] ) ) |
|
19 | +if (isset($_GET['post'])) |
|
20 | 20 | $post_id = $post_ID = (int) $_GET['post']; |
21 | -elseif ( isset( $_POST['post_ID'] ) ) |
|
21 | +elseif (isset($_POST['post_ID'])) |
|
22 | 22 | $post_id = $post_ID = (int) $_POST['post_ID']; |
23 | 23 | else |
24 | 24 | $post_id = $post_ID = 0; |
@@ -30,59 +30,59 @@ discard block |
||
30 | 30 | */ |
31 | 31 | global $post_type, $post_type_object, $post; |
32 | 32 | |
33 | -if ( $post_id ) |
|
34 | - $post = get_post( $post_id ); |
|
33 | +if ($post_id) |
|
34 | + $post = get_post($post_id); |
|
35 | 35 | |
36 | -if ( $post ) { |
|
36 | +if ($post) { |
|
37 | 37 | $post_type = $post->post_type; |
38 | - $post_type_object = get_post_type_object( $post_type ); |
|
38 | + $post_type_object = get_post_type_object($post_type); |
|
39 | 39 | } |
40 | 40 | |
41 | -if ( isset( $_POST['deletepost'] ) ) |
|
41 | +if (isset($_POST['deletepost'])) |
|
42 | 42 | $action = 'delete'; |
43 | -elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) |
|
43 | +elseif (isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview']) |
|
44 | 44 | $action = 'preview'; |
45 | 45 | |
46 | 46 | $sendback = wp_get_referer(); |
47 | 47 | if ( ! $sendback || |
48 | - strpos( $sendback, 'post.php' ) !== false || |
|
49 | - strpos( $sendback, 'post-new.php' ) !== false ) { |
|
50 | - if ( 'attachment' == $post_type ) { |
|
51 | - $sendback = admin_url( 'upload.php' ); |
|
48 | + strpos($sendback, 'post.php') !== false || |
|
49 | + strpos($sendback, 'post-new.php') !== false) { |
|
50 | + if ('attachment' == $post_type) { |
|
51 | + $sendback = admin_url('upload.php'); |
|
52 | 52 | } else { |
53 | - $sendback = admin_url( 'edit.php' ); |
|
54 | - if ( ! empty( $post_type ) ) { |
|
55 | - $sendback = add_query_arg( 'post_type', $post_type, $sendback ); |
|
53 | + $sendback = admin_url('edit.php'); |
|
54 | + if ( ! empty($post_type)) { |
|
55 | + $sendback = add_query_arg('post_type', $post_type, $sendback); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } else { |
59 | - $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback ); |
|
59 | + $sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback); |
|
60 | 60 | } |
61 | 61 | |
62 | -switch($action) { |
|
62 | +switch ($action) { |
|
63 | 63 | case 'post-quickdraft-save': |
64 | 64 | // Check nonce and capabilities |
65 | 65 | $nonce = $_REQUEST['_wpnonce']; |
66 | 66 | $error_msg = false; |
67 | 67 | |
68 | 68 | // For output of the quickdraft dashboard widget |
69 | - require_once ABSPATH . 'wp-admin/includes/dashboard.php'; |
|
69 | + require_once ABSPATH.'wp-admin/includes/dashboard.php'; |
|
70 | 70 | |
71 | - if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) |
|
72 | - $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
71 | + if ( ! wp_verify_nonce($nonce, 'add-post')) |
|
72 | + $error_msg = __('Unable to submit this form, please refresh and try again.'); |
|
73 | 73 | |
74 | - if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
|
74 | + if ( ! current_user_can(get_post_type_object('post')->cap->create_posts)) { |
|
75 | 75 | exit; |
76 | 76 | } |
77 | 77 | |
78 | - if ( $error_msg ) |
|
79 | - return wp_dashboard_quick_press( $error_msg ); |
|
78 | + if ($error_msg) |
|
79 | + return wp_dashboard_quick_press($error_msg); |
|
80 | 80 | |
81 | - $post = get_post( $_REQUEST['post_ID'] ); |
|
82 | - check_admin_referer( 'add-' . $post->post_type ); |
|
81 | + $post = get_post($_REQUEST['post_ID']); |
|
82 | + check_admin_referer('add-'.$post->post_type); |
|
83 | 83 | |
84 | - $_POST['comment_status'] = get_default_comment_status( $post->post_type ); |
|
85 | - $_POST['ping_status'] = get_default_comment_status( $post->post_type, 'pingback' ); |
|
84 | + $_POST['comment_status'] = get_default_comment_status($post->post_type); |
|
85 | + $_POST['ping_status'] = get_default_comment_status($post->post_type, 'pingback'); |
|
86 | 86 | |
87 | 87 | edit_post(); |
88 | 88 | wp_dashboard_quick_press(); |
@@ -90,53 +90,53 @@ discard block |
||
90 | 90 | |
91 | 91 | case 'postajaxpost': |
92 | 92 | case 'post': |
93 | - check_admin_referer( 'add-' . $post_type ); |
|
93 | + check_admin_referer('add-'.$post_type); |
|
94 | 94 | $post_id = 'postajaxpost' == $action ? edit_post() : write_post(); |
95 | - redirect_post( $post_id ); |
|
95 | + redirect_post($post_id); |
|
96 | 96 | exit(); |
97 | 97 | |
98 | 98 | case 'edit': |
99 | 99 | $editing = true; |
100 | 100 | |
101 | - if ( empty( $post_id ) ) { |
|
102 | - wp_redirect( admin_url('post.php') ); |
|
101 | + if (empty($post_id)) { |
|
102 | + wp_redirect(admin_url('post.php')); |
|
103 | 103 | exit(); |
104 | 104 | } |
105 | 105 | |
106 | - if ( ! $post ) |
|
107 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
106 | + if ( ! $post) |
|
107 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
108 | 108 | |
109 | - if ( ! $post_type_object ) |
|
110 | - wp_die( __( 'Unknown post type.' ) ); |
|
109 | + if ( ! $post_type_object) |
|
110 | + wp_die(__('Unknown post type.')); |
|
111 | 111 | |
112 | - if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) { |
|
113 | - wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); |
|
112 | + if ( ! in_array($typenow, get_post_types(array('show_ui' => true)))) { |
|
113 | + wp_die(__('Sorry, you are not allowed to edit posts in this post type.')); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( ! current_user_can( 'edit_post', $post_id ) ) |
|
117 | - wp_die( __( 'Sorry, you are not allowed to edit this item.' ) ); |
|
116 | + if ( ! current_user_can('edit_post', $post_id)) |
|
117 | + wp_die(__('Sorry, you are not allowed to edit this item.')); |
|
118 | 118 | |
119 | - if ( 'trash' == $post->post_status ) |
|
120 | - wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
119 | + if ('trash' == $post->post_status) |
|
120 | + wp_die(__('You can’t edit this item because it is in the Trash. Please restore it and try again.')); |
|
121 | 121 | |
122 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
123 | - check_admin_referer( 'lock-post_' . $post_id ); |
|
124 | - wp_set_post_lock( $post_id ); |
|
125 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
122 | + if ( ! empty($_GET['get-post-lock'])) { |
|
123 | + check_admin_referer('lock-post_'.$post_id); |
|
124 | + wp_set_post_lock($post_id); |
|
125 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
126 | 126 | exit(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | $post_type = $post->post_type; |
130 | - if ( 'post' == $post_type ) { |
|
130 | + if ('post' == $post_type) { |
|
131 | 131 | $parent_file = "edit.php"; |
132 | 132 | $submenu_file = "edit.php"; |
133 | 133 | $post_new_file = "post-new.php"; |
134 | - } elseif ( 'attachment' == $post_type ) { |
|
134 | + } elseif ('attachment' == $post_type) { |
|
135 | 135 | $parent_file = 'upload.php'; |
136 | 136 | $submenu_file = 'upload.php'; |
137 | 137 | $post_new_file = 'media-new.php'; |
138 | 138 | } else { |
139 | - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) |
|
139 | + if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true) |
|
140 | 140 | $parent_file = $post_type_object->show_in_menu; |
141 | 141 | else |
142 | 142 | $parent_file = "edit.php?post_type=$post_type"; |
@@ -144,57 +144,57 @@ discard block |
||
144 | 144 | $post_new_file = "post-new.php?post_type=$post_type"; |
145 | 145 | } |
146 | 146 | |
147 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
148 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
147 | + if ( ! wp_check_post_lock($post->ID)) { |
|
148 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
149 | 149 | |
150 | - if ( 'attachment' !== $post_type ) |
|
150 | + if ('attachment' !== $post_type) |
|
151 | 151 | wp_enqueue_script('autosave'); |
152 | 152 | } |
153 | 153 | |
154 | - if ( is_multisite() ) { |
|
155 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
154 | + if (is_multisite()) { |
|
155 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
156 | 156 | } else { |
157 | - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
|
157 | + $check_users = get_users(array('fields' => 'ID', 'number' => 2)); |
|
158 | 158 | |
159 | - if ( count( $check_users ) > 1 ) |
|
160 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
159 | + if (count($check_users) > 1) |
|
160 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
161 | 161 | |
162 | - unset( $check_users ); |
|
162 | + unset($check_users); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | $title = $post_type_object->labels->edit_item; |
166 | 166 | $post = get_post($post_id, OBJECT, 'edit'); |
167 | 167 | |
168 | - if ( post_type_supports($post_type, 'comments') ) { |
|
168 | + if (post_type_supports($post_type, 'comments')) { |
|
169 | 169 | wp_enqueue_script('admin-comments'); |
170 | 170 | enqueue_comment_hotkeys_js(); |
171 | 171 | } |
172 | 172 | |
173 | - include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); |
|
173 | + include(ABSPATH.'wp-admin/edit-form-advanced.php'); |
|
174 | 174 | |
175 | 175 | break; |
176 | 176 | |
177 | 177 | case 'editattachment': |
178 | - check_admin_referer('update-post_' . $post_id); |
|
178 | + check_admin_referer('update-post_'.$post_id); |
|
179 | 179 | |
180 | 180 | // Don't let these be changed |
181 | 181 | unset($_POST['guid']); |
182 | 182 | $_POST['post_type'] = 'attachment'; |
183 | 183 | |
184 | 184 | // Update the thumbnail filename |
185 | - $newmeta = wp_get_attachment_metadata( $post_id, true ); |
|
185 | + $newmeta = wp_get_attachment_metadata($post_id, true); |
|
186 | 186 | $newmeta['thumb'] = $_POST['thumb']; |
187 | 187 | |
188 | - wp_update_attachment_metadata( $post_id, $newmeta ); |
|
188 | + wp_update_attachment_metadata($post_id, $newmeta); |
|
189 | 189 | |
190 | 190 | case 'editpost': |
191 | - check_admin_referer('update-post_' . $post_id); |
|
191 | + check_admin_referer('update-post_'.$post_id); |
|
192 | 192 | |
193 | 193 | $post_id = edit_post(); |
194 | 194 | |
195 | 195 | // Session cookie flag that the post was saved |
196 | - if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) { |
|
197 | - setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() ); |
|
196 | + if (isset($_COOKIE['wp-saving-post']) && $_COOKIE['wp-saving-post'] === $post_id.'-check') { |
|
197 | + setcookie('wp-saving-post', $post_id.'-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | redirect_post($post_id); // Send user on their way while we keep working |
@@ -202,72 +202,72 @@ discard block |
||
202 | 202 | exit(); |
203 | 203 | |
204 | 204 | case 'trash': |
205 | - check_admin_referer('trash-post_' . $post_id); |
|
205 | + check_admin_referer('trash-post_'.$post_id); |
|
206 | 206 | |
207 | - if ( ! $post ) |
|
208 | - wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
207 | + if ( ! $post) |
|
208 | + wp_die(__('The item you are trying to move to the Trash no longer exists.')); |
|
209 | 209 | |
210 | - if ( ! $post_type_object ) |
|
211 | - wp_die( __( 'Unknown post type.' ) ); |
|
210 | + if ( ! $post_type_object) |
|
211 | + wp_die(__('Unknown post type.')); |
|
212 | 212 | |
213 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
214 | - wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
|
213 | + if ( ! current_user_can('delete_post', $post_id)) |
|
214 | + wp_die(__('Sorry, you are not allowed to move this item to the Trash.')); |
|
215 | 215 | |
216 | - if ( $user_id = wp_check_post_lock( $post_id ) ) { |
|
217 | - $user = get_userdata( $user_id ); |
|
218 | - wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); |
|
216 | + if ($user_id = wp_check_post_lock($post_id)) { |
|
217 | + $user = get_userdata($user_id); |
|
218 | + wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name)); |
|
219 | 219 | } |
220 | 220 | |
221 | - if ( ! wp_trash_post( $post_id ) ) |
|
222 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
221 | + if ( ! wp_trash_post($post_id)) |
|
222 | + wp_die(__('Error in moving to Trash.')); |
|
223 | 223 | |
224 | - wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); |
|
224 | + wp_redirect(add_query_arg(array('trashed' => 1, 'ids' => $post_id), $sendback)); |
|
225 | 225 | exit(); |
226 | 226 | |
227 | 227 | case 'untrash': |
228 | - check_admin_referer('untrash-post_' . $post_id); |
|
228 | + check_admin_referer('untrash-post_'.$post_id); |
|
229 | 229 | |
230 | - if ( ! $post ) |
|
231 | - wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
230 | + if ( ! $post) |
|
231 | + wp_die(__('The item you are trying to restore from the Trash no longer exists.')); |
|
232 | 232 | |
233 | - if ( ! $post_type_object ) |
|
234 | - wp_die( __( 'Unknown post type.' ) ); |
|
233 | + if ( ! $post_type_object) |
|
234 | + wp_die(__('Unknown post type.')); |
|
235 | 235 | |
236 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
237 | - wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
|
236 | + if ( ! current_user_can('delete_post', $post_id)) |
|
237 | + wp_die(__('Sorry, you are not allowed to restore this item from the Trash.')); |
|
238 | 238 | |
239 | - if ( ! wp_untrash_post( $post_id ) ) |
|
240 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
239 | + if ( ! wp_untrash_post($post_id)) |
|
240 | + wp_die(__('Error in restoring from Trash.')); |
|
241 | 241 | |
242 | - wp_redirect( add_query_arg('untrashed', 1, $sendback) ); |
|
242 | + wp_redirect(add_query_arg('untrashed', 1, $sendback)); |
|
243 | 243 | exit(); |
244 | 244 | |
245 | 245 | case 'delete': |
246 | - check_admin_referer('delete-post_' . $post_id); |
|
246 | + check_admin_referer('delete-post_'.$post_id); |
|
247 | 247 | |
248 | - if ( ! $post ) |
|
249 | - wp_die( __( 'This item has already been deleted.' ) ); |
|
248 | + if ( ! $post) |
|
249 | + wp_die(__('This item has already been deleted.')); |
|
250 | 250 | |
251 | - if ( ! $post_type_object ) |
|
252 | - wp_die( __( 'Unknown post type.' ) ); |
|
251 | + if ( ! $post_type_object) |
|
252 | + wp_die(__('Unknown post type.')); |
|
253 | 253 | |
254 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
255 | - wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
|
254 | + if ( ! current_user_can('delete_post', $post_id)) |
|
255 | + wp_die(__('Sorry, you are not allowed to delete this item.')); |
|
256 | 256 | |
257 | - if ( $post->post_type == 'attachment' ) { |
|
258 | - $force = ( ! MEDIA_TRASH ); |
|
259 | - if ( ! wp_delete_attachment( $post_id, $force ) ) |
|
260 | - wp_die( __( 'Error in deleting.' ) ); |
|
257 | + if ($post->post_type == 'attachment') { |
|
258 | + $force = ( ! MEDIA_TRASH); |
|
259 | + if ( ! wp_delete_attachment($post_id, $force)) |
|
260 | + wp_die(__('Error in deleting.')); |
|
261 | 261 | } else { |
262 | - if ( ! wp_delete_post( $post_id, true ) ) |
|
263 | - wp_die( __( 'Error in deleting.' ) ); |
|
262 | + if ( ! wp_delete_post($post_id, true)) |
|
263 | + wp_die(__('Error in deleting.')); |
|
264 | 264 | } |
265 | 265 | |
266 | - wp_redirect( add_query_arg('deleted', 1, $sendback) ); |
|
266 | + wp_redirect(add_query_arg('deleted', 1, $sendback)); |
|
267 | 267 | exit(); |
268 | 268 | |
269 | 269 | case 'preview': |
270 | - check_admin_referer( 'update-post_' . $post_id ); |
|
270 | + check_admin_referer('update-post_'.$post_id); |
|
271 | 271 | |
272 | 272 | $url = post_preview(); |
273 | 273 | |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param int $post_id Post ID sent with the request. |
286 | 286 | */ |
287 | - do_action( "post_action_{$action}", $post_id ); |
|
287 | + do_action("post_action_{$action}", $post_id); |
|
288 | 288 | |
289 | - wp_redirect( admin_url('edit.php') ); |
|
289 | + wp_redirect(admin_url('edit.php')); |
|
290 | 290 | exit(); |
291 | 291 | } // end switch |
292 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
292 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -16,12 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | wp_reset_vars( array( 'action' ) ); |
18 | 18 | |
19 | -if ( isset( $_GET['post'] ) ) |
|
19 | +if ( isset( $_GET['post'] ) ) { |
|
20 | 20 | $post_id = $post_ID = (int) $_GET['post']; |
21 | -elseif ( isset( $_POST['post_ID'] ) ) |
|
21 | +} elseif ( isset( $_POST['post_ID'] ) ) { |
|
22 | 22 | $post_id = $post_ID = (int) $_POST['post_ID']; |
23 | -else |
|
23 | +} else { |
|
24 | 24 | $post_id = $post_ID = 0; |
25 | +} |
|
25 | 26 | |
26 | 27 | /** |
27 | 28 | * @global string $post_type |
@@ -30,18 +31,20 @@ discard block |
||
30 | 31 | */ |
31 | 32 | global $post_type, $post_type_object, $post; |
32 | 33 | |
33 | -if ( $post_id ) |
|
34 | +if ( $post_id ) { |
|
34 | 35 | $post = get_post( $post_id ); |
36 | +} |
|
35 | 37 | |
36 | 38 | if ( $post ) { |
37 | 39 | $post_type = $post->post_type; |
38 | 40 | $post_type_object = get_post_type_object( $post_type ); |
39 | 41 | } |
40 | 42 | |
41 | -if ( isset( $_POST['deletepost'] ) ) |
|
43 | +if ( isset( $_POST['deletepost'] ) ) { |
|
42 | 44 | $action = 'delete'; |
43 | -elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) |
|
45 | +} elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) { |
|
44 | 46 | $action = 'preview'; |
47 | +} |
|
45 | 48 | |
46 | 49 | $sendback = wp_get_referer(); |
47 | 50 | if ( ! $sendback || |
@@ -68,15 +71,17 @@ discard block |
||
68 | 71 | // For output of the quickdraft dashboard widget |
69 | 72 | require_once ABSPATH . 'wp-admin/includes/dashboard.php'; |
70 | 73 | |
71 | - if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) |
|
72 | - $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
74 | + if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) { |
|
75 | + $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
76 | + } |
|
73 | 77 | |
74 | 78 | if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
75 | 79 | exit; |
76 | 80 | } |
77 | 81 | |
78 | - if ( $error_msg ) |
|
79 | - return wp_dashboard_quick_press( $error_msg ); |
|
82 | + if ( $error_msg ) { |
|
83 | + return wp_dashboard_quick_press( $error_msg ); |
|
84 | + } |
|
80 | 85 | |
81 | 86 | $post = get_post( $_REQUEST['post_ID'] ); |
82 | 87 | check_admin_referer( 'add-' . $post->post_type ); |
@@ -103,21 +108,25 @@ discard block |
||
103 | 108 | exit(); |
104 | 109 | } |
105 | 110 | |
106 | - if ( ! $post ) |
|
107 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
111 | + if ( ! $post ) { |
|
112 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
113 | + } |
|
108 | 114 | |
109 | - if ( ! $post_type_object ) |
|
110 | - wp_die( __( 'Unknown post type.' ) ); |
|
115 | + if ( ! $post_type_object ) { |
|
116 | + wp_die( __( 'Unknown post type.' ) ); |
|
117 | + } |
|
111 | 118 | |
112 | 119 | if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) { |
113 | 120 | wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) ); |
114 | 121 | } |
115 | 122 | |
116 | - if ( ! current_user_can( 'edit_post', $post_id ) ) |
|
117 | - wp_die( __( 'Sorry, you are not allowed to edit this item.' ) ); |
|
123 | + if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
124 | + wp_die( __( 'Sorry, you are not allowed to edit this item.' ) ); |
|
125 | + } |
|
118 | 126 | |
119 | - if ( 'trash' == $post->post_status ) |
|
120 | - wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
127 | + if ( 'trash' == $post->post_status ) { |
|
128 | + wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
129 | + } |
|
121 | 130 | |
122 | 131 | if ( ! empty( $_GET['get-post-lock'] ) ) { |
123 | 132 | check_admin_referer( 'lock-post_' . $post_id ); |
@@ -136,10 +145,11 @@ discard block |
||
136 | 145 | $submenu_file = 'upload.php'; |
137 | 146 | $post_new_file = 'media-new.php'; |
138 | 147 | } else { |
139 | - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) |
|
140 | - $parent_file = $post_type_object->show_in_menu; |
|
141 | - else |
|
142 | - $parent_file = "edit.php?post_type=$post_type"; |
|
148 | + if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { |
|
149 | + $parent_file = $post_type_object->show_in_menu; |
|
150 | + } else { |
|
151 | + $parent_file = "edit.php?post_type=$post_type"; |
|
152 | + } |
|
143 | 153 | $submenu_file = "edit.php?post_type=$post_type"; |
144 | 154 | $post_new_file = "post-new.php?post_type=$post_type"; |
145 | 155 | } |
@@ -147,8 +157,9 @@ discard block |
||
147 | 157 | if ( ! wp_check_post_lock( $post->ID ) ) { |
148 | 158 | $active_post_lock = wp_set_post_lock( $post->ID ); |
149 | 159 | |
150 | - if ( 'attachment' !== $post_type ) |
|
151 | - wp_enqueue_script('autosave'); |
|
160 | + if ( 'attachment' !== $post_type ) { |
|
161 | + wp_enqueue_script('autosave'); |
|
162 | + } |
|
152 | 163 | } |
153 | 164 | |
154 | 165 | if ( is_multisite() ) { |
@@ -156,8 +167,9 @@ discard block |
||
156 | 167 | } else { |
157 | 168 | $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
158 | 169 | |
159 | - if ( count( $check_users ) > 1 ) |
|
160 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
170 | + if ( count( $check_users ) > 1 ) { |
|
171 | + add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
172 | + } |
|
161 | 173 | |
162 | 174 | unset( $check_users ); |
163 | 175 | } |
@@ -204,22 +216,26 @@ discard block |
||
204 | 216 | case 'trash': |
205 | 217 | check_admin_referer('trash-post_' . $post_id); |
206 | 218 | |
207 | - if ( ! $post ) |
|
208 | - wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
219 | + if ( ! $post ) { |
|
220 | + wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
221 | + } |
|
209 | 222 | |
210 | - if ( ! $post_type_object ) |
|
211 | - wp_die( __( 'Unknown post type.' ) ); |
|
223 | + if ( ! $post_type_object ) { |
|
224 | + wp_die( __( 'Unknown post type.' ) ); |
|
225 | + } |
|
212 | 226 | |
213 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
214 | - wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
|
227 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
228 | + wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) ); |
|
229 | + } |
|
215 | 230 | |
216 | 231 | if ( $user_id = wp_check_post_lock( $post_id ) ) { |
217 | 232 | $user = get_userdata( $user_id ); |
218 | 233 | wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); |
219 | 234 | } |
220 | 235 | |
221 | - if ( ! wp_trash_post( $post_id ) ) |
|
222 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
236 | + if ( ! wp_trash_post( $post_id ) ) { |
|
237 | + wp_die( __( 'Error in moving to Trash.' ) ); |
|
238 | + } |
|
223 | 239 | |
224 | 240 | wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); |
225 | 241 | exit(); |
@@ -227,17 +243,21 @@ discard block |
||
227 | 243 | case 'untrash': |
228 | 244 | check_admin_referer('untrash-post_' . $post_id); |
229 | 245 | |
230 | - if ( ! $post ) |
|
231 | - wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
246 | + if ( ! $post ) { |
|
247 | + wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
248 | + } |
|
232 | 249 | |
233 | - if ( ! $post_type_object ) |
|
234 | - wp_die( __( 'Unknown post type.' ) ); |
|
250 | + if ( ! $post_type_object ) { |
|
251 | + wp_die( __( 'Unknown post type.' ) ); |
|
252 | + } |
|
235 | 253 | |
236 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
237 | - wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
|
254 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
255 | + wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
|
256 | + } |
|
238 | 257 | |
239 | - if ( ! wp_untrash_post( $post_id ) ) |
|
240 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
258 | + if ( ! wp_untrash_post( $post_id ) ) { |
|
259 | + wp_die( __( 'Error in restoring from Trash.' ) ); |
|
260 | + } |
|
241 | 261 | |
242 | 262 | wp_redirect( add_query_arg('untrashed', 1, $sendback) ); |
243 | 263 | exit(); |
@@ -245,22 +265,27 @@ discard block |
||
245 | 265 | case 'delete': |
246 | 266 | check_admin_referer('delete-post_' . $post_id); |
247 | 267 | |
248 | - if ( ! $post ) |
|
249 | - wp_die( __( 'This item has already been deleted.' ) ); |
|
268 | + if ( ! $post ) { |
|
269 | + wp_die( __( 'This item has already been deleted.' ) ); |
|
270 | + } |
|
250 | 271 | |
251 | - if ( ! $post_type_object ) |
|
252 | - wp_die( __( 'Unknown post type.' ) ); |
|
272 | + if ( ! $post_type_object ) { |
|
273 | + wp_die( __( 'Unknown post type.' ) ); |
|
274 | + } |
|
253 | 275 | |
254 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
255 | - wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
|
276 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
277 | + wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
|
278 | + } |
|
256 | 279 | |
257 | 280 | if ( $post->post_type == 'attachment' ) { |
258 | 281 | $force = ( ! MEDIA_TRASH ); |
259 | - if ( ! wp_delete_attachment( $post_id, $force ) ) |
|
260 | - wp_die( __( 'Error in deleting.' ) ); |
|
282 | + if ( ! wp_delete_attachment( $post_id, $force ) ) { |
|
283 | + wp_die( __( 'Error in deleting.' ) ); |
|
284 | + } |
|
261 | 285 | } else { |
262 | - if ( ! wp_delete_post( $post_id, true ) ) |
|
263 | - wp_die( __( 'Error in deleting.' ) ); |
|
286 | + if ( ! wp_delete_post( $post_id, true ) ) { |
|
287 | + wp_die( __( 'Error in deleting.' ) ); |
|
288 | + } |
|
264 | 289 | } |
265 | 290 | |
266 | 291 | wp_redirect( add_query_arg('deleted', 1, $sendback) ); |
@@ -11,40 +11,40 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @since 2.3.2 |
13 | 13 | */ |
14 | -if ( ! defined( 'WP_ADMIN' ) ) { |
|
15 | - define( 'WP_ADMIN', true ); |
|
14 | +if ( ! defined('WP_ADMIN')) { |
|
15 | + define('WP_ADMIN', true); |
|
16 | 16 | } |
17 | 17 | |
18 | -if ( ! defined('WP_NETWORK_ADMIN') ) |
|
18 | +if ( ! defined('WP_NETWORK_ADMIN')) |
|
19 | 19 | define('WP_NETWORK_ADMIN', false); |
20 | 20 | |
21 | -if ( ! defined('WP_USER_ADMIN') ) |
|
21 | +if ( ! defined('WP_USER_ADMIN')) |
|
22 | 22 | define('WP_USER_ADMIN', false); |
23 | 23 | |
24 | -if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) { |
|
24 | +if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN) { |
|
25 | 25 | define('WP_BLOG_ADMIN', true); |
26 | 26 | } |
27 | 27 | |
28 | -if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) |
|
28 | +if (isset($_GET['import']) && ! defined('WP_LOAD_IMPORTERS')) |
|
29 | 29 | define('WP_LOAD_IMPORTERS', true); |
30 | 30 | |
31 | -require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); |
|
31 | +require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
32 | 32 | |
33 | 33 | nocache_headers(); |
34 | 34 | |
35 | -if ( get_option('db_upgraded') ) { |
|
35 | +if (get_option('db_upgraded')) { |
|
36 | 36 | flush_rewrite_rules(); |
37 | - update_option( 'db_upgraded', false ); |
|
37 | + update_option('db_upgraded', false); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Fires on the next page load after a successful DB upgrade. |
41 | 41 | * |
42 | 42 | * @since 2.8.0 |
43 | 43 | */ |
44 | - do_action( 'after_db_upgrade' ); |
|
45 | -} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) { |
|
46 | - if ( !is_multisite() ) { |
|
47 | - wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); |
|
44 | + do_action('after_db_upgrade'); |
|
45 | +} elseif (get_option('db_version') != $wp_db_version && empty($_POST)) { |
|
46 | + if ( ! is_multisite()) { |
|
47 | + wp_redirect(admin_url('upgrade.php?_wp_http_referer='.urlencode(wp_unslash($_SERVER['REQUEST_URI'])))); |
|
48 | 48 | exit; |
49 | 49 | |
50 | 50 | /** |
@@ -61,38 +61,38 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true. |
63 | 63 | */ |
64 | - } elseif ( apply_filters( 'do_mu_upgrade', true ) ) { |
|
64 | + } elseif (apply_filters('do_mu_upgrade', true)) { |
|
65 | 65 | $c = get_blog_count(); |
66 | 66 | |
67 | 67 | /* |
68 | 68 | * If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load: |
69 | 69 | * attempt to do no more than threshold value, with some +/- allowed. |
70 | 70 | */ |
71 | - if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) { |
|
72 | - require_once( ABSPATH . WPINC . '/http.php' ); |
|
73 | - $response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) ); |
|
71 | + if ($c <= 50 || ($c > 50 && mt_rand(0, (int) ($c / 50)) == 1)) { |
|
72 | + require_once(ABSPATH.WPINC.'/http.php'); |
|
73 | + $response = wp_remote_get(admin_url('upgrade.php?step=1'), array('timeout' => 120, 'httpversion' => '1.1')); |
|
74 | 74 | /** This action is documented in wp-admin/network/upgrade.php */ |
75 | - do_action( 'after_mu_upgrade', $response ); |
|
75 | + do_action('after_mu_upgrade', $response); |
|
76 | 76 | unset($response); |
77 | 77 | } |
78 | 78 | unset($c); |
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
82 | -require_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
82 | +require_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
83 | 83 | |
84 | 84 | auth_redirect(); |
85 | 85 | |
86 | 86 | // Schedule trash collection |
87 | -if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) |
|
87 | +if ( ! wp_next_scheduled('wp_scheduled_delete') && ! wp_installing()) |
|
88 | 88 | wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); |
89 | 89 | |
90 | 90 | set_screen_options(); |
91 | 91 | |
92 | -$date_format = __( 'F j, Y' ); |
|
93 | -$time_format = __( 'g:i a' ); |
|
92 | +$date_format = __('F j, Y'); |
|
93 | +$time_format = __('g:i a'); |
|
94 | 94 | |
95 | -wp_enqueue_script( 'common' ); |
|
95 | +wp_enqueue_script('common'); |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
@@ -115,30 +115,30 @@ discard block |
||
115 | 115 | |
116 | 116 | $editing = false; |
117 | 117 | |
118 | -if ( isset($_GET['page']) ) { |
|
119 | - $plugin_page = wp_unslash( $_GET['page'] ); |
|
118 | +if (isset($_GET['page'])) { |
|
119 | + $plugin_page = wp_unslash($_GET['page']); |
|
120 | 120 | $plugin_page = plugin_basename($plugin_page); |
121 | 121 | } |
122 | 122 | |
123 | -if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
123 | +if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type'])) |
|
124 | 124 | $typenow = $_REQUEST['post_type']; |
125 | 125 | else |
126 | 126 | $typenow = ''; |
127 | 127 | |
128 | -if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) |
|
128 | +if (isset($_REQUEST['taxonomy']) && taxonomy_exists($_REQUEST['taxonomy'])) |
|
129 | 129 | $taxnow = $_REQUEST['taxonomy']; |
130 | 130 | else |
131 | 131 | $taxnow = ''; |
132 | 132 | |
133 | -if ( WP_NETWORK_ADMIN ) |
|
134 | - require(ABSPATH . 'wp-admin/network/menu.php'); |
|
135 | -elseif ( WP_USER_ADMIN ) |
|
136 | - require(ABSPATH . 'wp-admin/user/menu.php'); |
|
133 | +if (WP_NETWORK_ADMIN) |
|
134 | + require(ABSPATH.'wp-admin/network/menu.php'); |
|
135 | +elseif (WP_USER_ADMIN) |
|
136 | + require(ABSPATH.'wp-admin/user/menu.php'); |
|
137 | 137 | else |
138 | - require(ABSPATH . 'wp-admin/menu.php'); |
|
138 | + require(ABSPATH.'wp-admin/menu.php'); |
|
139 | 139 | |
140 | -if ( current_user_can( 'manage_options' ) ) { |
|
141 | - wp_raise_memory_limit( 'admin' ); |
|
140 | +if (current_user_can('manage_options')) { |
|
141 | + wp_raise_memory_limit('admin'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -151,24 +151,24 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 2.5.0 |
153 | 153 | */ |
154 | -do_action( 'admin_init' ); |
|
154 | +do_action('admin_init'); |
|
155 | 155 | |
156 | -if ( isset($plugin_page) ) { |
|
157 | - if ( !empty($typenow) ) |
|
158 | - $the_parent = $pagenow . '?post_type=' . $typenow; |
|
156 | +if (isset($plugin_page)) { |
|
157 | + if ( ! empty($typenow)) |
|
158 | + $the_parent = $pagenow.'?post_type='.$typenow; |
|
159 | 159 | else |
160 | 160 | $the_parent = $pagenow; |
161 | - if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { |
|
161 | + if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent)) { |
|
162 | 162 | $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); |
163 | 163 | |
164 | 164 | // Back-compat for plugins using add_management_page(). |
165 | - if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { |
|
165 | + if (empty($page_hook) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php')) { |
|
166 | 166 | // There could be plugin specific params on the URL, so we need the whole query string |
167 | - if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) |
|
168 | - $query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
167 | + if ( ! empty($_SERVER['QUERY_STRING'])) |
|
168 | + $query_string = $_SERVER['QUERY_STRING']; |
|
169 | 169 | else |
170 | - $query_string = 'page=' . $plugin_page; |
|
171 | - wp_redirect( admin_url('tools.php?' . $query_string) ); |
|
170 | + $query_string = 'page='.$plugin_page; |
|
171 | + wp_redirect(admin_url('tools.php?'.$query_string)); |
|
172 | 172 | exit; |
173 | 173 | } |
174 | 174 | } |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | } |
177 | 177 | |
178 | 178 | $hook_suffix = ''; |
179 | -if ( isset( $page_hook ) ) { |
|
179 | +if (isset($page_hook)) { |
|
180 | 180 | $hook_suffix = $page_hook; |
181 | -} elseif ( isset( $plugin_page ) ) { |
|
181 | +} elseif (isset($plugin_page)) { |
|
182 | 182 | $hook_suffix = $plugin_page; |
183 | -} elseif ( isset( $pagenow ) ) { |
|
183 | +} elseif (isset($pagenow)) { |
|
184 | 184 | $hook_suffix = $pagenow; |
185 | 185 | } |
186 | 186 | |
187 | 187 | set_current_screen(); |
188 | 188 | |
189 | 189 | // Handle plugin admin pages. |
190 | -if ( isset($plugin_page) ) { |
|
191 | - if ( $page_hook ) { |
|
190 | +if (isset($plugin_page)) { |
|
191 | + if ($page_hook) { |
|
192 | 192 | /** |
193 | 193 | * Fires before a particular screen is loaded. |
194 | 194 | * |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @since 2.1.0 |
211 | 211 | */ |
212 | - do_action( 'load-' . $page_hook ); |
|
213 | - if (! isset($_GET['noheader'])) |
|
214 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
212 | + do_action('load-'.$page_hook); |
|
213 | + if ( ! isset($_GET['noheader'])) |
|
214 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
215 | 215 | |
216 | 216 | /** |
217 | 217 | * Used to call the registered callback for a plugin screen. |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | * @ignore |
220 | 220 | * @since 1.5.0 |
221 | 221 | */ |
222 | - do_action( $page_hook ); |
|
222 | + do_action($page_hook); |
|
223 | 223 | } else { |
224 | - if ( validate_file($plugin_page) ) |
|
224 | + if (validate_file($plugin_page)) |
|
225 | 225 | wp_die(__('Invalid plugin page')); |
226 | 226 | |
227 | - if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) |
|
227 | + if ( ! (file_exists(WP_PLUGIN_DIR."/$plugin_page") && is_file(WP_PLUGIN_DIR."/$plugin_page")) && ! (file_exists(WPMU_PLUGIN_DIR."/$plugin_page") && is_file(WPMU_PLUGIN_DIR."/$plugin_page"))) |
|
228 | 228 | wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); |
229 | 229 | |
230 | 230 | /** |
@@ -239,35 +239,35 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @since 1.5.0 |
241 | 241 | */ |
242 | - do_action( 'load-' . $plugin_page ); |
|
242 | + do_action('load-'.$plugin_page); |
|
243 | 243 | |
244 | - if ( !isset($_GET['noheader'])) |
|
245 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
244 | + if ( ! isset($_GET['noheader'])) |
|
245 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
246 | 246 | |
247 | - if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) |
|
248 | - include(WPMU_PLUGIN_DIR . "/$plugin_page"); |
|
247 | + if (file_exists(WPMU_PLUGIN_DIR."/$plugin_page")) |
|
248 | + include(WPMU_PLUGIN_DIR."/$plugin_page"); |
|
249 | 249 | else |
250 | - include(WP_PLUGIN_DIR . "/$plugin_page"); |
|
250 | + include(WP_PLUGIN_DIR."/$plugin_page"); |
|
251 | 251 | } |
252 | 252 | |
253 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
253 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
254 | 254 | |
255 | 255 | exit(); |
256 | -} elseif ( isset( $_GET['import'] ) ) { |
|
256 | +} elseif (isset($_GET['import'])) { |
|
257 | 257 | |
258 | 258 | $importer = $_GET['import']; |
259 | 259 | |
260 | - if ( ! current_user_can( 'import' ) ) { |
|
261 | - wp_die( __( 'Sorry, you are not allowed to import content.' ) ); |
|
260 | + if ( ! current_user_can('import')) { |
|
261 | + wp_die(__('Sorry, you are not allowed to import content.')); |
|
262 | 262 | } |
263 | 263 | |
264 | - if ( validate_file($importer) ) { |
|
265 | - wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); |
|
264 | + if (validate_file($importer)) { |
|
265 | + wp_redirect(admin_url('import.php?invalid='.$importer)); |
|
266 | 266 | exit; |
267 | 267 | } |
268 | 268 | |
269 | - if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) { |
|
270 | - wp_redirect( admin_url( 'import.php?invalid=' . $importer ) ); |
|
269 | + if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) { |
|
270 | + wp_redirect(admin_url('import.php?invalid='.$importer)); |
|
271 | 271 | exit; |
272 | 272 | } |
273 | 273 | |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @since 3.5.0 |
280 | 280 | */ |
281 | - do_action( 'load-importer-' . $importer ); |
|
281 | + do_action('load-importer-'.$importer); |
|
282 | 282 | |
283 | 283 | $parent_file = 'tools.php'; |
284 | 284 | $submenu_file = 'import.php'; |
285 | 285 | $title = __('Import'); |
286 | 286 | |
287 | - if (! isset($_GET['noheader'])) |
|
288 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
287 | + if ( ! isset($_GET['noheader'])) |
|
288 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
289 | 289 | |
290 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
290 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
291 | 291 | |
292 | 292 | define('WP_IMPORTING', true); |
293 | 293 | |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param bool $force Whether to force data to be filtered through kses. Default false. |
303 | 303 | */ |
304 | - if ( apply_filters( 'force_filtered_html_on_import', false ) ) { |
|
305 | - kses_init_filters(); // Always filter imported data with kses on multisite. |
|
304 | + if (apply_filters('force_filtered_html_on_import', false)) { |
|
305 | + kses_init_filters(); // Always filter imported data with kses on multisite. |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | call_user_func($wp_importers[$importer][2]); |
309 | 309 | |
310 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
310 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
311 | 311 | |
312 | 312 | // Make sure rules are flushed |
313 | 313 | flush_rewrite_rules(false); |
@@ -326,28 +326,28 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @since 2.1.0 |
328 | 328 | */ |
329 | - do_action( 'load-' . $pagenow ); |
|
329 | + do_action('load-'.$pagenow); |
|
330 | 330 | |
331 | 331 | /* |
332 | 332 | * The following hooks are fired to ensure backward compatibility. |
333 | 333 | * In all other cases, 'load-' . $pagenow should be used instead. |
334 | 334 | */ |
335 | - if ( $typenow == 'page' ) { |
|
336 | - if ( $pagenow == 'post-new.php' ) |
|
337 | - do_action( 'load-page-new.php' ); |
|
338 | - elseif ( $pagenow == 'post.php' ) |
|
339 | - do_action( 'load-page.php' ); |
|
340 | - } elseif ( $pagenow == 'edit-tags.php' ) { |
|
341 | - if ( $taxnow == 'category' ) |
|
342 | - do_action( 'load-categories.php' ); |
|
343 | - elseif ( $taxnow == 'link_category' ) |
|
344 | - do_action( 'load-edit-link-categories.php' ); |
|
345 | - } elseif( 'term.php' === $pagenow ) { |
|
346 | - do_action( 'load-edit-tags.php' ); |
|
335 | + if ($typenow == 'page') { |
|
336 | + if ($pagenow == 'post-new.php') |
|
337 | + do_action('load-page-new.php'); |
|
338 | + elseif ($pagenow == 'post.php') |
|
339 | + do_action('load-page.php'); |
|
340 | + } elseif ($pagenow == 'edit-tags.php') { |
|
341 | + if ($taxnow == 'category') |
|
342 | + do_action('load-categories.php'); |
|
343 | + elseif ($taxnow == 'link_category') |
|
344 | + do_action('load-edit-link-categories.php'); |
|
345 | + } elseif ('term.php' === $pagenow) { |
|
346 | + do_action('load-edit-tags.php'); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | -if ( ! empty( $_REQUEST['action'] ) ) { |
|
350 | +if ( ! empty($_REQUEST['action'])) { |
|
351 | 351 | /** |
352 | 352 | * Fires when an 'action' request variable is sent. |
353 | 353 | * |
@@ -356,5 +356,5 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 2.6.0 |
358 | 358 | */ |
359 | - do_action( 'admin_action_' . $_REQUEST['action'] ); |
|
359 | + do_action('admin_action_'.$_REQUEST['action']); |
|
360 | 360 | } |
@@ -15,18 +15,21 @@ discard block |
||
15 | 15 | define( 'WP_ADMIN', true ); |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! defined('WP_NETWORK_ADMIN') ) |
|
18 | +if ( ! defined('WP_NETWORK_ADMIN') ) { |
|
19 | 19 | define('WP_NETWORK_ADMIN', false); |
20 | +} |
|
20 | 21 | |
21 | -if ( ! defined('WP_USER_ADMIN') ) |
|
22 | +if ( ! defined('WP_USER_ADMIN') ) { |
|
22 | 23 | define('WP_USER_ADMIN', false); |
24 | +} |
|
23 | 25 | |
24 | 26 | if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) { |
25 | 27 | define('WP_BLOG_ADMIN', true); |
26 | 28 | } |
27 | 29 | |
28 | -if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) |
|
30 | +if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) { |
|
29 | 31 | define('WP_LOAD_IMPORTERS', true); |
32 | +} |
|
30 | 33 | |
31 | 34 | require_once(dirname(dirname(__FILE__)) . '/wp-load.php'); |
32 | 35 | |
@@ -84,8 +87,9 @@ discard block |
||
84 | 87 | auth_redirect(); |
85 | 88 | |
86 | 89 | // Schedule trash collection |
87 | -if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) |
|
90 | +if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) { |
|
88 | 91 | wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); |
92 | +} |
|
89 | 93 | |
90 | 94 | set_screen_options(); |
91 | 95 | |
@@ -120,22 +124,25 @@ discard block |
||
120 | 124 | $plugin_page = plugin_basename($plugin_page); |
121 | 125 | } |
122 | 126 | |
123 | -if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
127 | +if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { |
|
124 | 128 | $typenow = $_REQUEST['post_type']; |
125 | -else |
|
129 | +} else { |
|
126 | 130 | $typenow = ''; |
131 | +} |
|
127 | 132 | |
128 | -if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) |
|
133 | +if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) { |
|
129 | 134 | $taxnow = $_REQUEST['taxonomy']; |
130 | -else |
|
135 | +} else { |
|
131 | 136 | $taxnow = ''; |
137 | +} |
|
132 | 138 | |
133 | -if ( WP_NETWORK_ADMIN ) |
|
139 | +if ( WP_NETWORK_ADMIN ) { |
|
134 | 140 | require(ABSPATH . 'wp-admin/network/menu.php'); |
135 | -elseif ( WP_USER_ADMIN ) |
|
141 | +} elseif ( WP_USER_ADMIN ) { |
|
136 | 142 | require(ABSPATH . 'wp-admin/user/menu.php'); |
137 | -else |
|
143 | +} else { |
|
138 | 144 | require(ABSPATH . 'wp-admin/menu.php'); |
145 | +} |
|
139 | 146 | |
140 | 147 | if ( current_user_can( 'manage_options' ) ) { |
141 | 148 | wp_raise_memory_limit( 'admin' ); |
@@ -154,20 +161,22 @@ discard block |
||
154 | 161 | do_action( 'admin_init' ); |
155 | 162 | |
156 | 163 | if ( isset($plugin_page) ) { |
157 | - if ( !empty($typenow) ) |
|
158 | - $the_parent = $pagenow . '?post_type=' . $typenow; |
|
159 | - else |
|
160 | - $the_parent = $pagenow; |
|
164 | + if ( !empty($typenow) ) { |
|
165 | + $the_parent = $pagenow . '?post_type=' . $typenow; |
|
166 | + } else { |
|
167 | + $the_parent = $pagenow; |
|
168 | + } |
|
161 | 169 | if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) { |
162 | 170 | $page_hook = get_plugin_page_hook($plugin_page, $plugin_page); |
163 | 171 | |
164 | 172 | // Back-compat for plugins using add_management_page(). |
165 | 173 | if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) { |
166 | 174 | // There could be plugin specific params on the URL, so we need the whole query string |
167 | - if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) |
|
168 | - $query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
169 | - else |
|
170 | - $query_string = 'page=' . $plugin_page; |
|
175 | + if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) { |
|
176 | + $query_string = $_SERVER[ 'QUERY_STRING' ]; |
|
177 | + } else { |
|
178 | + $query_string = 'page=' . $plugin_page; |
|
179 | + } |
|
171 | 180 | wp_redirect( admin_url('tools.php?' . $query_string) ); |
172 | 181 | exit; |
173 | 182 | } |
@@ -210,8 +219,9 @@ discard block |
||
210 | 219 | * @since 2.1.0 |
211 | 220 | */ |
212 | 221 | do_action( 'load-' . $page_hook ); |
213 | - if (! isset($_GET['noheader'])) |
|
214 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
222 | + if (! isset($_GET['noheader'])) { |
|
223 | + require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
224 | + } |
|
215 | 225 | |
216 | 226 | /** |
217 | 227 | * Used to call the registered callback for a plugin screen. |
@@ -221,11 +231,13 @@ discard block |
||
221 | 231 | */ |
222 | 232 | do_action( $page_hook ); |
223 | 233 | } else { |
224 | - if ( validate_file($plugin_page) ) |
|
225 | - wp_die(__('Invalid plugin page')); |
|
234 | + if ( validate_file($plugin_page) ) { |
|
235 | + wp_die(__('Invalid plugin page')); |
|
236 | + } |
|
226 | 237 | |
227 | - if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) |
|
228 | - wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); |
|
238 | + if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) { |
|
239 | + wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page))); |
|
240 | + } |
|
229 | 241 | |
230 | 242 | /** |
231 | 243 | * Fires before a particular screen is loaded. |
@@ -241,13 +253,15 @@ discard block |
||
241 | 253 | */ |
242 | 254 | do_action( 'load-' . $plugin_page ); |
243 | 255 | |
244 | - if ( !isset($_GET['noheader'])) |
|
245 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
256 | + if ( !isset($_GET['noheader'])) { |
|
257 | + require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
258 | + } |
|
246 | 259 | |
247 | - if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) |
|
248 | - include(WPMU_PLUGIN_DIR . "/$plugin_page"); |
|
249 | - else |
|
250 | - include(WP_PLUGIN_DIR . "/$plugin_page"); |
|
260 | + if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) { |
|
261 | + include(WPMU_PLUGIN_DIR . "/$plugin_page"); |
|
262 | + } else { |
|
263 | + include(WP_PLUGIN_DIR . "/$plugin_page"); |
|
264 | + } |
|
251 | 265 | } |
252 | 266 | |
253 | 267 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
@@ -284,8 +298,9 @@ discard block |
||
284 | 298 | $submenu_file = 'import.php'; |
285 | 299 | $title = __('Import'); |
286 | 300 | |
287 | - if (! isset($_GET['noheader'])) |
|
288 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
301 | + if (! isset($_GET['noheader'])) { |
|
302 | + require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
303 | + } |
|
289 | 304 | |
290 | 305 | require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
291 | 306 | |
@@ -333,15 +348,17 @@ discard block |
||
333 | 348 | * In all other cases, 'load-' . $pagenow should be used instead. |
334 | 349 | */ |
335 | 350 | if ( $typenow == 'page' ) { |
336 | - if ( $pagenow == 'post-new.php' ) |
|
337 | - do_action( 'load-page-new.php' ); |
|
338 | - elseif ( $pagenow == 'post.php' ) |
|
339 | - do_action( 'load-page.php' ); |
|
340 | - } elseif ( $pagenow == 'edit-tags.php' ) { |
|
341 | - if ( $taxnow == 'category' ) |
|
342 | - do_action( 'load-categories.php' ); |
|
343 | - elseif ( $taxnow == 'link_category' ) |
|
344 | - do_action( 'load-edit-link-categories.php' ); |
|
351 | + if ( $pagenow == 'post-new.php' ) { |
|
352 | + do_action( 'load-page-new.php' ); |
|
353 | + } elseif ( $pagenow == 'post.php' ) { |
|
354 | + do_action( 'load-page.php' ); |
|
355 | + } |
|
356 | + } elseif ( $pagenow == 'edit-tags.php' ) { |
|
357 | + if ( $taxnow == 'category' ) { |
|
358 | + do_action( 'load-categories.php' ); |
|
359 | + } elseif ( $taxnow == 'link_category' ) { |
|
360 | + do_action( 'load-edit-link-categories.php' ); |
|
361 | + } |
|
345 | 362 | } elseif( 'term.php' === $pagenow ) { |
346 | 363 | do_action( 'load-edit-tags.php' ); |
347 | 364 | } |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | * @subpackage Press_This |
7 | 7 | */ |
8 | 8 | |
9 | -define('IFRAME_REQUEST' , true); |
|
9 | +define('IFRAME_REQUEST', true); |
|
10 | 10 | |
11 | 11 | /** WordPress Administration Bootstrap */ |
12 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 | +require_once(dirname(__FILE__).'/admin.php'); |
|
13 | 13 | |
14 | -if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
|
14 | +if ( ! current_user_can('edit_posts') || ! current_user_can(get_post_type_object('post')->cap->create_posts)) { |
|
15 | 15 | wp_die( |
16 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
17 | - '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>', |
|
16 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
17 | + '<p>'.__('Sorry, you are not allowed to create posts as this user.').'</p>', |
|
18 | 18 | 403 |
19 | 19 | ); |
20 | 20 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @global WP_Press_This $wp_press_this |
24 | 24 | */ |
25 | -if ( empty( $GLOBALS['wp_press_this'] ) ) { |
|
26 | - include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' ); |
|
25 | +if (empty($GLOBALS['wp_press_this'])) { |
|
26 | + include(ABSPATH.'wp-admin/includes/class-wp-press-this.php'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $GLOBALS['wp_press_this']->html(); |