@@ -7,80 +7,80 @@ |
||
7 | 7 | * @since 2.3.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined('WP_ADMIN') ) { |
|
10 | +if ( ! defined('WP_ADMIN')) { |
|
11 | 11 | /* |
12 | 12 | * This file is being included from a file other than wp-admin/admin.php, so |
13 | 13 | * some setup was skipped. Make sure the admin message catalog is loaded since |
14 | 14 | * load_default_textdomain() will not have done so in this context. |
15 | 15 | */ |
16 | - load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' ); |
|
16 | + load_textdomain('default', WP_LANG_DIR.'/admin-'.get_locale().'.mo'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** WordPress Administration Hooks */ |
20 | -require_once(ABSPATH . 'wp-admin/includes/admin-filters.php'); |
|
20 | +require_once(ABSPATH.'wp-admin/includes/admin-filters.php'); |
|
21 | 21 | |
22 | 22 | /** WordPress Bookmark Administration API */ |
23 | -require_once(ABSPATH . 'wp-admin/includes/bookmark.php'); |
|
23 | +require_once(ABSPATH.'wp-admin/includes/bookmark.php'); |
|
24 | 24 | |
25 | 25 | /** WordPress Comment Administration API */ |
26 | -require_once(ABSPATH . 'wp-admin/includes/comment.php'); |
|
26 | +require_once(ABSPATH.'wp-admin/includes/comment.php'); |
|
27 | 27 | |
28 | 28 | /** WordPress Administration File API */ |
29 | -require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
29 | +require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
30 | 30 | |
31 | 31 | /** WordPress Image Administration API */ |
32 | -require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
32 | +require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
33 | 33 | |
34 | 34 | /** WordPress Media Administration API */ |
35 | -require_once(ABSPATH . 'wp-admin/includes/media.php'); |
|
35 | +require_once(ABSPATH.'wp-admin/includes/media.php'); |
|
36 | 36 | |
37 | 37 | /** WordPress Import Administration API */ |
38 | -require_once(ABSPATH . 'wp-admin/includes/import.php'); |
|
38 | +require_once(ABSPATH.'wp-admin/includes/import.php'); |
|
39 | 39 | |
40 | 40 | /** WordPress Misc Administration API */ |
41 | -require_once(ABSPATH . 'wp-admin/includes/misc.php'); |
|
41 | +require_once(ABSPATH.'wp-admin/includes/misc.php'); |
|
42 | 42 | |
43 | 43 | /** WordPress Options Administration API */ |
44 | -require_once(ABSPATH . 'wp-admin/includes/options.php'); |
|
44 | +require_once(ABSPATH.'wp-admin/includes/options.php'); |
|
45 | 45 | |
46 | 46 | /** WordPress Plugin Administration API */ |
47 | -require_once(ABSPATH . 'wp-admin/includes/plugin.php'); |
|
47 | +require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
48 | 48 | |
49 | 49 | /** WordPress Post Administration API */ |
50 | -require_once(ABSPATH . 'wp-admin/includes/post.php'); |
|
50 | +require_once(ABSPATH.'wp-admin/includes/post.php'); |
|
51 | 51 | |
52 | 52 | /** WordPress Administration Screen API */ |
53 | -require_once(ABSPATH . 'wp-admin/includes/class-wp-screen.php'); |
|
54 | -require_once(ABSPATH . 'wp-admin/includes/screen.php'); |
|
53 | +require_once(ABSPATH.'wp-admin/includes/class-wp-screen.php'); |
|
54 | +require_once(ABSPATH.'wp-admin/includes/screen.php'); |
|
55 | 55 | |
56 | 56 | /** WordPress Taxonomy Administration API */ |
57 | -require_once(ABSPATH . 'wp-admin/includes/taxonomy.php'); |
|
57 | +require_once(ABSPATH.'wp-admin/includes/taxonomy.php'); |
|
58 | 58 | |
59 | 59 | /** WordPress Template Administration API */ |
60 | -require_once(ABSPATH . 'wp-admin/includes/template.php'); |
|
60 | +require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
61 | 61 | |
62 | 62 | /** WordPress List Table Administration API and base class */ |
63 | -require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); |
|
64 | -require_once(ABSPATH . 'wp-admin/includes/list-table.php'); |
|
63 | +require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
64 | +require_once(ABSPATH.'wp-admin/includes/list-table.php'); |
|
65 | 65 | |
66 | 66 | /** WordPress Theme Administration API */ |
67 | -require_once(ABSPATH . 'wp-admin/includes/theme.php'); |
|
67 | +require_once(ABSPATH.'wp-admin/includes/theme.php'); |
|
68 | 68 | |
69 | 69 | /** WordPress User Administration API */ |
70 | -require_once(ABSPATH . 'wp-admin/includes/user.php'); |
|
70 | +require_once(ABSPATH.'wp-admin/includes/user.php'); |
|
71 | 71 | |
72 | 72 | /** WordPress Site Icon API */ |
73 | -require_once(ABSPATH . 'wp-admin/includes/class-wp-site-icon.php'); |
|
73 | +require_once(ABSPATH.'wp-admin/includes/class-wp-site-icon.php'); |
|
74 | 74 | |
75 | 75 | /** WordPress Update Administration API */ |
76 | -require_once(ABSPATH . 'wp-admin/includes/update.php'); |
|
76 | +require_once(ABSPATH.'wp-admin/includes/update.php'); |
|
77 | 77 | |
78 | 78 | /** WordPress Deprecated Administration API */ |
79 | -require_once(ABSPATH . 'wp-admin/includes/deprecated.php'); |
|
79 | +require_once(ABSPATH.'wp-admin/includes/deprecated.php'); |
|
80 | 80 | |
81 | 81 | /** WordPress Multisite support API */ |
82 | -if ( is_multisite() ) { |
|
83 | - require_once(ABSPATH . 'wp-admin/includes/ms-admin-filters.php'); |
|
84 | - require_once(ABSPATH . 'wp-admin/includes/ms.php'); |
|
85 | - require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php'); |
|
82 | +if (is_multisite()) { |
|
83 | + require_once(ABSPATH.'wp-admin/includes/ms-admin-filters.php'); |
|
84 | + require_once(ABSPATH.'wp-admin/includes/ms.php'); |
|
85 | + require_once(ABSPATH.'wp-admin/includes/ms-deprecated.php'); |
|
86 | 86 | } |
@@ -9,55 +9,55 @@ discard block |
||
9 | 9 | define('WP_LOAD_IMPORTERS', true); |
10 | 10 | |
11 | 11 | /** Load WordPress Bootstrap */ |
12 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 | +require_once(dirname(__FILE__).'/admin.php'); |
|
13 | 13 | |
14 | -if ( !current_user_can('import') ) |
|
14 | +if ( ! current_user_can('import')) |
|
15 | 15 | wp_die(__('You do not have sufficient permissions to import content in this site.')); |
16 | 16 | |
17 | 17 | $title = __('Import'); |
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | - 'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' . |
|
23 | - '<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>', |
|
24 | -) ); |
|
22 | + 'content' => '<p>'.__('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.').'</p>'. |
|
23 | + '<p>'.__('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.').'</p>', |
|
24 | +)); |
|
25 | 25 | |
26 | 26 | get_current_screen()->set_help_sidebar( |
27 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
28 | - '<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' . |
|
29 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
27 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
28 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>').'</p>'. |
|
29 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
30 | 30 | ); |
31 | 31 | |
32 | -if ( current_user_can( 'install_plugins' ) ) |
|
32 | +if (current_user_can('install_plugins')) |
|
33 | 33 | $popular_importers = wp_get_popular_importers(); |
34 | 34 | else |
35 | 35 | $popular_importers = array(); |
36 | 36 | |
37 | 37 | // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' |
38 | -if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { |
|
39 | - $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id']; |
|
40 | - if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops. |
|
41 | - wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) ); |
|
38 | +if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) { |
|
39 | + $importer_id = $popular_importers[$_GET['invalid']]['importer-id']; |
|
40 | + if ($importer_id != $_GET['invalid']) { // Prevent redirect loops. |
|
41 | + wp_redirect(admin_url('admin.php?import='.$importer_id)); |
|
42 | 42 | exit; |
43 | 43 | } |
44 | - unset( $importer_id ); |
|
44 | + unset($importer_id); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | add_thickbox(); |
48 | -wp_enqueue_script( 'plugin-install' ); |
|
48 | +wp_enqueue_script('plugin-install'); |
|
49 | 49 | |
50 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
50 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
51 | 51 | $parent_file = 'tools.php'; |
52 | 52 | ?> |
53 | 53 | |
54 | 54 | <div class="wrap"> |
55 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
56 | -<?php if ( ! empty( $_GET['invalid'] ) ) : ?> |
|
55 | +<h1><?php echo esc_html($title); ?></h1> |
|
56 | +<?php if ( ! empty($_GET['invalid'])) : ?> |
|
57 | 57 | <div class="error"> |
58 | - <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php |
|
58 | + <p><strong><?php _e('ERROR:'); ?></strong> <?php |
|
59 | 59 | /* translators: %s: importer slug */ |
60 | - printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); |
|
60 | + printf(__('The %s importer is invalid or is not installed.'), '<strong>'.esc_html($_GET['invalid']).'</strong>'); |
|
61 | 61 | ?></p> |
62 | 62 | </div> |
63 | 63 | <?php endif; ?> |
@@ -68,48 +68,48 @@ discard block |
||
68 | 68 | $importers = get_importers(); |
69 | 69 | |
70 | 70 | // If a popular importer is not registered, create a dummy registration that links to the plugin installer. |
71 | -foreach ( $popular_importers as $pop_importer => $pop_data ) { |
|
72 | - if ( isset( $importers[ $pop_importer ] ) ) |
|
71 | +foreach ($popular_importers as $pop_importer => $pop_data) { |
|
72 | + if (isset($importers[$pop_importer])) |
|
73 | 73 | continue; |
74 | - if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
|
74 | + if (isset($importers[$pop_data['importer-id']])) |
|
75 | 75 | continue; |
76 | - $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
|
76 | + $importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']); |
|
77 | 77 | } |
78 | 78 | |
79 | -if ( empty( $importers ) ) { |
|
80 | - echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful |
|
79 | +if (empty($importers)) { |
|
80 | + echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful |
|
81 | 81 | } else { |
82 | - uasort( $importers, '_usort_by_first_member' ); |
|
82 | + uasort($importers, '_usort_by_first_member'); |
|
83 | 83 | ?> |
84 | 84 | <table class="widefat importers striped"> |
85 | 85 | |
86 | 86 | <?php |
87 | 87 | foreach ($importers as $importer_id => $data) { |
88 | 88 | $action = ''; |
89 | - if ( isset( $data['install'] ) ) { |
|
89 | + if (isset($data['install'])) { |
|
90 | 90 | $plugin_slug = $data['install']; |
91 | - if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { |
|
91 | + if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) { |
|
92 | 92 | // Looks like Importer is installed, But not active |
93 | - $plugins = get_plugins( '/' . $plugin_slug ); |
|
94 | - if ( !empty($plugins) ) { |
|
93 | + $plugins = get_plugins('/'.$plugin_slug); |
|
94 | + if ( ! empty($plugins)) { |
|
95 | 95 | $keys = array_keys($plugins); |
96 | - $plugin_file = $plugin_slug . '/' . $keys[0]; |
|
97 | - $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . |
|
98 | - '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; |
|
96 | + $plugin_file = $plugin_slug.'/'.$keys[0]; |
|
97 | + $action = '<a href="'.esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$plugin_file.'&from=import'), 'activate-plugin_'.$plugin_file)). |
|
98 | + '"title="'.esc_attr__('Activate importer').'"">'.$data[0].'</a>'; |
|
99 | 99 | } |
100 | 100 | } |
101 | - if ( empty($action) ) { |
|
102 | - if ( is_main_site() ) { |
|
103 | - $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . |
|
104 | - '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal" title="' . |
|
105 | - esc_attr__('Install importer') . '">' . $data[0] . '</a>'; |
|
101 | + if (empty($action)) { |
|
102 | + if (is_main_site()) { |
|
103 | + $action = '<a href="'.esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_slug. |
|
104 | + '&from=import&TB_iframe=true&width=600&height=550')).'" class="thickbox open-plugin-details-modal" title="'. |
|
105 | + esc_attr__('Install importer').'">'.$data[0].'</a>'; |
|
106 | 106 | } else { |
107 | 107 | $action = $data[0]; |
108 | - $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) ); |
|
108 | + $data[1] = sprintf(__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'), get_admin_url($current_site->blog_id, 'import.php')); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } else { |
112 | - $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; |
|
112 | + $action = "<a href='".esc_url("admin.php?import=$importer_id")."' title='".esc_attr(wptexturize(strip_tags($data[1])))."'>{$data[0]}</a>"; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | echo " |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | <?php |
125 | 125 | } |
126 | 126 | |
127 | -if ( current_user_can('install_plugins') ) |
|
128 | - echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>'; |
|
127 | +if (current_user_can('install_plugins')) |
|
128 | + echo '<p>'.sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))).'</p>'; |
|
129 | 129 | ?> |
130 | 130 | |
131 | 131 | </div> |
132 | 132 | |
133 | 133 | <?php |
134 | 134 | |
135 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
135 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Displays Administration Menu. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Displays Administration Menu. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The current page. |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $parent_file The parent file. |
37 | 37 | */ |
38 | -$parent_file = apply_filters( 'parent_file', $parent_file ); |
|
38 | +$parent_file = apply_filters('parent_file', $parent_file); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Filter the file of an admin menu sub-menu item. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $submenu_file The submenu file. |
46 | 46 | * @param string $parent_file The submenu item's parent file. |
47 | 47 | */ |
48 | -$submenu_file = apply_filters( 'submenu_file', $submenu_file, $parent_file ); |
|
48 | +$submenu_file = apply_filters('submenu_file', $submenu_file, $parent_file); |
|
49 | 49 | |
50 | 50 | get_admin_page_parent(); |
51 | 51 | |
@@ -65,46 +65,46 @@ discard block |
||
65 | 65 | * @param array $submenu |
66 | 66 | * @param bool $submenu_as_parent |
67 | 67 | */ |
68 | -function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { |
|
68 | +function _wp_menu_output($menu, $submenu, $submenu_as_parent = true) { |
|
69 | 69 | global $self, $parent_file, $submenu_file, $plugin_page, $typenow; |
70 | 70 | |
71 | 71 | $first = true; |
72 | 72 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url |
73 | - foreach ( $menu as $key => $item ) { |
|
73 | + foreach ($menu as $key => $item) { |
|
74 | 74 | $admin_is_parent = false; |
75 | 75 | $class = array(); |
76 | 76 | $aria_attributes = ''; |
77 | 77 | $aria_hidden = ''; |
78 | 78 | $is_separator = false; |
79 | 79 | |
80 | - if ( $first ) { |
|
80 | + if ($first) { |
|
81 | 81 | $class[] = 'wp-first-item'; |
82 | 82 | $first = false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $submenu_items = array(); |
86 | - if ( ! empty( $submenu[$item[2]] ) ) { |
|
86 | + if ( ! empty($submenu[$item[2]])) { |
|
87 | 87 | $class[] = 'wp-has-submenu'; |
88 | 88 | $submenu_items = $submenu[$item[2]]; |
89 | 89 | } |
90 | 90 | |
91 | - if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { |
|
92 | - $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
91 | + if (($parent_file && $item[2] == $parent_file) || (empty($typenow) && $self == $item[2])) { |
|
92 | + $class[] = ! empty($submenu_items) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
93 | 93 | } else { |
94 | 94 | $class[] = 'wp-not-current-submenu'; |
95 | - if ( ! empty( $submenu_items ) ) |
|
95 | + if ( ! empty($submenu_items)) |
|
96 | 96 | $aria_attributes .= 'aria-haspopup="true"'; |
97 | 97 | } |
98 | 98 | |
99 | - if ( ! empty( $item[4] ) ) |
|
100 | - $class[] = esc_attr( $item[4] ); |
|
99 | + if ( ! empty($item[4])) |
|
100 | + $class[] = esc_attr($item[4]); |
|
101 | 101 | |
102 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
103 | - $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
|
102 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
103 | + $id = ! empty($item[5]) ? ' id="'.preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]).'"' : ''; |
|
104 | 104 | $img = $img_style = ''; |
105 | 105 | $img_class = ' dashicons-before'; |
106 | 106 | |
107 | - if ( false !== strpos( $class, 'wp-menu-separator' ) ) { |
|
107 | + if (false !== strpos($class, 'wp-menu-separator')) { |
|
108 | 108 | $is_separator = true; |
109 | 109 | } |
110 | 110 | |
@@ -114,51 +114,51 @@ discard block |
||
114 | 114 | * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled |
115 | 115 | * as special cases. |
116 | 116 | */ |
117 | - if ( ! empty( $item[6] ) ) { |
|
118 | - $img = '<img src="' . $item[6] . '" alt="" />'; |
|
117 | + if ( ! empty($item[6])) { |
|
118 | + $img = '<img src="'.$item[6].'" alt="" />'; |
|
119 | 119 | |
120 | - if ( 'none' === $item[6] || 'div' === $item[6] ) { |
|
120 | + if ('none' === $item[6] || 'div' === $item[6]) { |
|
121 | 121 | $img = '<br />'; |
122 | - } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) { |
|
122 | + } elseif (0 === strpos($item[6], 'data:image/svg+xml;base64,')) { |
|
123 | 123 | $img = '<br />'; |
124 | - $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; |
|
124 | + $img_style = ' style="background-image:url(\''.esc_attr($item[6]).'\')"'; |
|
125 | 125 | $img_class = ' svg'; |
126 | - } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) { |
|
126 | + } elseif (0 === strpos($item[6], 'dashicons-')) { |
|
127 | 127 | $img = '<br />'; |
128 | - $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); |
|
128 | + $img_class = ' dashicons-before '.sanitize_html_class($item[6]); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | $arrow = '<div class="wp-menu-arrow"><div></div></div>'; |
132 | 132 | |
133 | - $title = wptexturize( $item[0] ); |
|
133 | + $title = wptexturize($item[0]); |
|
134 | 134 | |
135 | 135 | // hide separators from screen readers |
136 | - if ( $is_separator ) { |
|
136 | + if ($is_separator) { |
|
137 | 137 | $aria_hidden = ' aria-hidden="true"'; |
138 | 138 | } |
139 | 139 | |
140 | 140 | echo "\n\t<li$class$id$aria_hidden>"; |
141 | 141 | |
142 | - if ( $is_separator ) { |
|
142 | + if ($is_separator) { |
|
143 | 143 | echo '<div class="separator"></div>'; |
144 | - } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) { |
|
145 | - $submenu_items = array_values( $submenu_items ); // Re-index. |
|
146 | - $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); |
|
144 | + } elseif ($submenu_as_parent && ! empty($submenu_items)) { |
|
145 | + $submenu_items = array_values($submenu_items); // Re-index. |
|
146 | + $menu_hook = get_plugin_page_hook($submenu_items[0][2], $item[2]); |
|
147 | 147 | $menu_file = $submenu_items[0][2]; |
148 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
149 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
150 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
148 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
149 | + $menu_file = substr($menu_file, 0, $pos); |
|
150 | + if ( ! empty($menu_hook) || (('index.php' != $submenu_items[0][2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
151 | 151 | $admin_is_parent = true; |
152 | 152 | echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
153 | 153 | } else { |
154 | 154 | echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
155 | 155 | } |
156 | - } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
157 | - $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); |
|
156 | + } elseif ( ! empty($item[2]) && current_user_can($item[1])) { |
|
157 | + $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); |
|
158 | 158 | $menu_file = $item[2]; |
159 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
160 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
161 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
159 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
160 | + $menu_file = substr($menu_file, 0, $pos); |
|
161 | + if ( ! empty($menu_hook) || (('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
162 | 162 | $admin_is_parent = true; |
163 | 163 | echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; |
164 | 164 | } else { |
@@ -166,64 +166,64 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( ! empty( $submenu_items ) ) { |
|
169 | + if ( ! empty($submenu_items)) { |
|
170 | 170 | echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>"; |
171 | 171 | echo "<li class='wp-submenu-head' aria-hidden='true'>{$item[0]}</li>"; |
172 | 172 | |
173 | 173 | $first = true; |
174 | 174 | |
175 | 175 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes |
176 | - foreach ( $submenu_items as $sub_key => $sub_item ) { |
|
177 | - if ( ! current_user_can( $sub_item[1] ) ) |
|
176 | + foreach ($submenu_items as $sub_key => $sub_item) { |
|
177 | + if ( ! current_user_can($sub_item[1])) |
|
178 | 178 | continue; |
179 | 179 | |
180 | 180 | $class = array(); |
181 | - if ( $first ) { |
|
181 | + if ($first) { |
|
182 | 182 | $class[] = 'wp-first-item'; |
183 | 183 | $first = false; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $menu_file = $item[2]; |
187 | 187 | |
188 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
189 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
188 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
189 | + $menu_file = substr($menu_file, 0, $pos); |
|
190 | 190 | |
191 | 191 | // Handle current for post_type=post|page|foo pages, which won't match $self. |
192 | - $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; |
|
192 | + $self_type = ! empty($typenow) ? $self.'?post_type='.$typenow : 'nothing'; |
|
193 | 193 | |
194 | - if ( isset( $submenu_file ) ) { |
|
195 | - if ( $submenu_file == $sub_item[2] ) |
|
194 | + if (isset($submenu_file)) { |
|
195 | + if ($submenu_file == $sub_item[2]) |
|
196 | 196 | $class[] = 'current'; |
197 | 197 | // If plugin_page is set the parent must either match the current page or not physically exist. |
198 | 198 | // This allows plugin pages with the same hook to exist under different parents. |
199 | 199 | } elseif ( |
200 | - ( ! isset( $plugin_page ) && $self == $sub_item[2] ) || |
|
201 | - ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) ) |
|
200 | + ( ! isset($plugin_page) && $self == $sub_item[2]) || |
|
201 | + (isset($plugin_page) && $plugin_page == $sub_item[2] && ($item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false)) |
|
202 | 202 | ) { |
203 | 203 | $class[] = 'current'; |
204 | 204 | } |
205 | 205 | |
206 | - if ( ! empty( $sub_item[4] ) ) { |
|
207 | - $class[] = esc_attr( $sub_item[4] ); |
|
206 | + if ( ! empty($sub_item[4])) { |
|
207 | + $class[] = esc_attr($sub_item[4]); |
|
208 | 208 | } |
209 | 209 | |
210 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
210 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
211 | 211 | |
212 | 212 | $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); |
213 | 213 | $sub_file = $sub_item[2]; |
214 | - if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) |
|
214 | + if (false !== ($pos = strpos($sub_file, '?'))) |
|
215 | 215 | $sub_file = substr($sub_file, 0, $pos); |
216 | 216 | |
217 | 217 | $title = wptexturize($sub_item[0]); |
218 | 218 | |
219 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { |
|
219 | + if ( ! empty($menu_hook) || (('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR."/$sub_file") && ! file_exists(ABSPATH."/wp-admin/$sub_file"))) { |
|
220 | 220 | // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir |
221 | - if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) |
|
222 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
221 | + if (( ! $admin_is_parent && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! is_dir(WP_PLUGIN_DIR."/{$item[2]}")) || file_exists($menu_file)) |
|
222 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), $item[2]); |
|
223 | 223 | else |
224 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
224 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), 'admin.php'); |
|
225 | 225 | |
226 | - $sub_item_url = esc_url( $sub_item_url ); |
|
226 | + $sub_item_url = esc_url($sub_item_url); |
|
227 | 227 | echo "<li$class><a href='$sub_item_url'$class>$title</a></li>"; |
228 | 228 | } else { |
229 | 229 | echo "<li$class><a href='{$sub_item[2]}'$class>$title</a></li>"; |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>'; |
238 | - echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>'; |
|
238 | + echo '<span>'.esc_html__('Collapse menu').'</span>'; |
|
239 | 239 | echo '</li>'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | ?> |
243 | 243 | |
244 | -<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e( 'Main menu' ); ?>"> |
|
245 | -<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e( 'Skip to main content' ); ?></a> |
|
246 | -<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e( 'Skip to toolbar' ); ?></a> |
|
244 | +<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e('Main menu'); ?>"> |
|
245 | +<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a> |
|
246 | +<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e('Skip to toolbar'); ?></a> |
|
247 | 247 | <div id="adminmenuback"></div> |
248 | 248 | <div id="adminmenuwrap"> |
249 | 249 | <ul id="adminmenu"> |
250 | 250 | |
251 | 251 | <?php |
252 | 252 | |
253 | -_wp_menu_output( $menu, $submenu ); |
|
253 | +_wp_menu_output($menu, $submenu); |
|
254 | 254 | /** |
255 | 255 | * Fires after the admin menu has been output. |
256 | 256 | * |
257 | 257 | * @since 2.5.0 |
258 | 258 | */ |
259 | -do_action( 'adminmenu' ); |
|
259 | +do_action('adminmenu'); |
|
260 | 260 | |
261 | 261 | ?> |
262 | 262 | </ul> |
@@ -7,28 +7,28 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | ?> |
13 | 13 | <form name="post" action="comment.php" method="post" id="post"> |
14 | -<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?> |
|
14 | +<?php wp_nonce_field('update-comment_'.$comment->comment_ID) ?> |
|
15 | 15 | <div class="wrap"> |
16 | -<h1><?php _e( 'Edit Comment' ); ?></h1> |
|
16 | +<h1><?php _e('Edit Comment'); ?></h1> |
|
17 | 17 | |
18 | 18 | <div id="poststuff"> |
19 | 19 | <input type="hidden" name="action" value="editedcomment" /> |
20 | -<input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" /> |
|
21 | -<input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" /> |
|
20 | +<input type="hidden" name="comment_ID" value="<?php echo esc_attr($comment->comment_ID); ?>" /> |
|
21 | +<input type="hidden" name="comment_post_ID" value="<?php echo esc_attr($comment->comment_post_ID); ?>" /> |
|
22 | 22 | |
23 | 23 | <div id="post-body" class="metabox-holder columns-2"> |
24 | 24 | <div id="post-body-content" class="edit-form-section edit-comment-section"> |
25 | 25 | <?php |
26 | -if ( 'approved' === wp_get_comment_status( $comment ) && $comment->comment_post_ID > 0 ) : |
|
27 | - $comment_link = get_comment_link( $comment ); |
|
26 | +if ('approved' === wp_get_comment_status($comment) && $comment->comment_post_ID > 0) : |
|
27 | + $comment_link = get_comment_link($comment); |
|
28 | 28 | ?> |
29 | 29 | <div class="inside"> |
30 | 30 | <div id="comment-link-box"> |
31 | - <strong><?php _ex( 'Permalink:', 'comment' ); ?></strong> |
|
31 | + <strong><?php _ex('Permalink:', 'comment'); ?></strong> |
|
32 | 32 | <span id="sample-permalink"><a href="<?php echo $comment_link; ?>"><?php echo $comment_link; ?></a></span> |
33 | 33 | </div> |
34 | 34 | </div> |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | <div id="namediv" class="stuffbox"> |
37 | 37 | <div class="inside"> |
38 | 38 | <fieldset> |
39 | -<legend class="edit-comment-author"><?php _e( 'Author' ) ?></legend> |
|
39 | +<legend class="edit-comment-author"><?php _e('Author') ?></legend> |
|
40 | 40 | <table class="form-table editcomment"> |
41 | 41 | <tbody> |
42 | 42 | <tr> |
43 | - <td class="first"><label for="name"><?php _e( 'Name:' ); ?></label></td> |
|
44 | - <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td> |
|
43 | + <td class="first"><label for="name"><?php _e('Name:'); ?></label></td> |
|
44 | + <td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr($comment->comment_author); ?>" id="name" /></td> |
|
45 | 45 | </tr> |
46 | 46 | <tr> |
47 | - <td class="first"><label for="email"><?php _e( 'Email:' ); ?></label></td> |
|
47 | + <td class="first"><label for="email"><?php _e('Email:'); ?></label></td> |
|
48 | 48 | <td> |
49 | 49 | <input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" id="email" /> |
50 | 50 | </td> |
51 | 51 | </tr> |
52 | 52 | <tr> |
53 | - <td class="first"><label for="newcomment_author_url"><?php _e( 'URL:' ); ?></label></td> |
|
53 | + <td class="first"><label for="newcomment_author_url"><?php _e('URL:'); ?></label></td> |
|
54 | 54 | <td> |
55 | 55 | <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" /> |
56 | 56 | </td> |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | |
65 | 65 | <div id="postdiv" class="postarea"> |
66 | 66 | <?php |
67 | - echo '<label for="content" class="screen-reader-text">' . __( 'Comment' ) . '</label>'; |
|
68 | - $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' ); |
|
69 | - wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) ); |
|
70 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
67 | + echo '<label for="content" class="screen-reader-text">'.__('Comment').'</label>'; |
|
68 | + $quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close'); |
|
69 | + wp_editor($comment->comment_content, 'content', array('media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings)); |
|
70 | + wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
71 | 71 | </div> |
72 | 72 | </div><!-- /post-body-content --> |
73 | 73 | |
74 | 74 | <div id="postbox-container-1" class="postbox-container"> |
75 | 75 | <div id="submitdiv" class="stuffbox" > |
76 | -<h2><?php _e( 'Status' ) ?></h2> |
|
76 | +<h2><?php _e('Status') ?></h2> |
|
77 | 77 | <div class="inside"> |
78 | 78 | <div class="submitbox" id="submitcomment"> |
79 | 79 | <div id="minor-publishing"> |
@@ -81,61 +81,61 @@ discard block |
||
81 | 81 | <div id="misc-publishing-actions"> |
82 | 82 | |
83 | 83 | <fieldset class="misc-pub-section misc-pub-comment-status" id="comment-status-radio"> |
84 | -<legend class="screen-reader-text"><?php _e( 'Comment status' ); ?></legend> |
|
85 | -<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php _ex( 'Approved', 'comment status' ); ?></label><br /> |
|
86 | -<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php _ex( 'Pending', 'comment status' ); ?></label><br /> |
|
87 | -<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php _ex( 'Spam', 'comment status' ); ?></label> |
|
84 | +<legend class="screen-reader-text"><?php _e('Comment status'); ?></legend> |
|
85 | +<label class="approved"><input type="radio"<?php checked($comment->comment_approved, '1'); ?> name="comment_status" value="1" /><?php _ex('Approved', 'comment status'); ?></label><br /> |
|
86 | +<label class="waiting"><input type="radio"<?php checked($comment->comment_approved, '0'); ?> name="comment_status" value="0" /><?php _ex('Pending', 'comment status'); ?></label><br /> |
|
87 | +<label class="spam"><input type="radio"<?php checked($comment->comment_approved, 'spam'); ?> name="comment_status" value="spam" /><?php _ex('Spam', 'comment status'); ?></label> |
|
88 | 88 | </fieldset> |
89 | 89 | |
90 | 90 | <div class="misc-pub-section curtime misc-pub-curtime"> |
91 | 91 | <?php |
92 | 92 | /* translators: Publish box date format, see http://php.net/date */ |
93 | -$datef = __( 'M j, Y @ H:i' ); |
|
93 | +$datef = __('M j, Y @ H:i'); |
|
94 | 94 | ?> |
95 | 95 | <span id="timestamp"><?php |
96 | 96 | printf( |
97 | 97 | /* translators: %s: comment date */ |
98 | - __( 'Submitted on: %s' ), |
|
99 | - '<b>' . date_i18n( $datef, strtotime( $comment->comment_date ) ) . '</b>' |
|
98 | + __('Submitted on: %s'), |
|
99 | + '<b>'.date_i18n($datef, strtotime($comment->comment_date)).'</b>' |
|
100 | 100 | ); |
101 | 101 | ?></span> |
102 | -<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> |
|
102 | +<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit date and time'); ?></span></a> |
|
103 | 103 | <fieldset id='timestampdiv' class='hide-if-js'> |
104 | -<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
105 | -<?php touch_time( ( 'editcomment' === $action ), 0 ); ?> |
|
104 | +<legend class="screen-reader-text"><?php _e('Date and time'); ?></legend> |
|
105 | +<?php touch_time(('editcomment' === $action), 0); ?> |
|
106 | 106 | </fieldset> |
107 | 107 | </div> |
108 | 108 | |
109 | 109 | <?php |
110 | 110 | $post_id = $comment->comment_post_ID; |
111 | -if ( current_user_can( 'edit_post', $post_id ) ) { |
|
112 | - $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
|
113 | - $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
|
111 | +if (current_user_can('edit_post', $post_id)) { |
|
112 | + $post_link = "<a href='".esc_url(get_edit_post_link($post_id))."'>"; |
|
113 | + $post_link .= esc_html(get_the_title($post_id)).'</a>'; |
|
114 | 114 | } else { |
115 | - $post_link = esc_html( get_the_title( $post_id ) ); |
|
115 | + $post_link = esc_html(get_the_title($post_id)); |
|
116 | 116 | } |
117 | 117 | ?> |
118 | 118 | |
119 | 119 | <div class="misc-pub-section misc-pub-response-to"> |
120 | 120 | <?php printf( |
121 | 121 | /* translators: %s: post link */ |
122 | - __( 'In response to: %s' ), |
|
123 | - '<b>' . $post_link . '</b>' |
|
122 | + __('In response to: %s'), |
|
123 | + '<b>'.$post_link.'</b>' |
|
124 | 124 | ); ?> |
125 | 125 | </div> |
126 | 126 | |
127 | 127 | <?php |
128 | -if ( $comment->comment_parent ) : |
|
129 | - $parent = get_comment( $comment->comment_parent ); |
|
130 | - if ( $parent ) : |
|
131 | - $parent_link = esc_url( get_comment_link( $parent ) ); |
|
132 | - $name = get_comment_author( $parent ); |
|
128 | +if ($comment->comment_parent) : |
|
129 | + $parent = get_comment($comment->comment_parent); |
|
130 | + if ($parent) : |
|
131 | + $parent_link = esc_url(get_comment_link($parent)); |
|
132 | + $name = get_comment_author($parent); |
|
133 | 133 | ?> |
134 | 134 | <div class="misc-pub-section misc-pub-reply-to"> |
135 | 135 | <?php printf( |
136 | 136 | /* translators: %s: comment link */ |
137 | - __( 'In reply to: %s' ), |
|
138 | - '<b><a href="' . $parent_link . '">' . $name . '</a></b>' |
|
137 | + __('In reply to: %s'), |
|
138 | + '<b><a href="'.$parent_link.'">'.$name.'</a></b>' |
|
139 | 139 | ); ?> |
140 | 140 | </div> |
141 | 141 | <?php endif; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param string $html Output HTML to display miscellaneous action. |
151 | 151 | * @param object $comment Current comment object. |
152 | 152 | */ |
153 | - echo apply_filters( 'edit_comment_misc_actions', '', $comment ); |
|
153 | + echo apply_filters('edit_comment_misc_actions', '', $comment); |
|
154 | 154 | ?> |
155 | 155 | |
156 | 156 | </div> <!-- misc actions --> |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | |
160 | 160 | <div id="major-publishing-actions"> |
161 | 161 | <div id="delete-action"> |
162 | -<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=" . ( !EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment' ) . "&c=$comment->comment_ID&_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . ( !EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash') ) . "</a>\n"; ?> |
|
162 | +<?php echo "<a class='submitdelete deletion' href='".wp_nonce_url("comment.php?action=".( ! EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment')."&c=$comment->comment_ID&_wp_original_http_referer=".urlencode(wp_get_referer()), 'delete-comment_'.$comment->comment_ID)."'>".( ! EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash'))."</a>\n"; ?> |
|
163 | 163 | </div> |
164 | 164 | <div id="publishing-action"> |
165 | -<?php submit_button( __( 'Update' ), 'primary', 'save', false ); ?> |
|
165 | +<?php submit_button(__('Update'), 'primary', 'save', false); ?> |
|
166 | 166 | </div> |
167 | 167 | <div class="clear"></div> |
168 | 168 | </div> |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | <div id="postbox-container-2" class="postbox-container"> |
175 | 175 | <?php |
176 | 176 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
177 | -do_action( 'add_meta_boxes', 'comment', $comment ); |
|
177 | +do_action('add_meta_boxes', 'comment', $comment); |
|
178 | 178 | |
179 | 179 | /** |
180 | 180 | * Fires when comment-specific meta boxes are added. |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param WP_Comment $comment Comment object. |
185 | 185 | */ |
186 | -do_action( 'add_meta_boxes_comment', $comment ); |
|
186 | +do_action('add_meta_boxes_comment', $comment); |
|
187 | 187 | |
188 | 188 | do_meta_boxes(null, 'normal', $comment); |
189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" /> |
195 | 195 | <input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" /> |
196 | -<input name="referredby" type="hidden" id="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> |
|
196 | +<input name="referredby" type="hidden" id="referredby" value="<?php echo $referer ? esc_url($referer) : ''; ?>" /> |
|
197 | 197 | <?php wp_original_referer_field(true, 'previous'); ?> |
198 | 198 | <input type="hidden" name="noredir" value="1" /> |
199 | 199 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | </div> |
203 | 203 | </form> |
204 | 204 | |
205 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
205 | +<?php if ( ! wp_is_mobile()) : ?> |
|
206 | 206 | <script type="text/javascript"> |
207 | 207 | try{document.post.name.focus();}catch(e){} |
208 | 208 | </script> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Update Core administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Update Core administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
106 | 106 | echo '</p>'; |
107 | 107 | if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
108 | - echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
108 | + echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
109 | 109 | // Partial builds don't need language-specific warnings. |
110 | 110 | elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
111 | - echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
111 | + echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
112 | 112 | } |
113 | 113 | echo '</form>'; |
114 | 114 |
@@ -7,20 +7,20 @@ 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 | -wp_enqueue_style( 'plugin-install' ); |
|
13 | -wp_enqueue_script( 'plugin-install' ); |
|
14 | -wp_enqueue_script( 'updates' ); |
|
12 | +wp_enqueue_style('plugin-install'); |
|
13 | +wp_enqueue_script('plugin-install'); |
|
14 | +wp_enqueue_script('updates'); |
|
15 | 15 | add_thickbox(); |
16 | 16 | |
17 | -if ( is_multisite() && ! is_network_admin() ) { |
|
18 | - wp_redirect( network_admin_url( 'update-core.php' ) ); |
|
17 | +if (is_multisite() && ! is_network_admin()) { |
|
18 | + wp_redirect(network_admin_url('update-core.php')); |
|
19 | 19 | exit(); |
20 | 20 | } |
21 | 21 | |
22 | -if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) |
|
23 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
22 | +if ( ! current_user_can('update_core') && ! current_user_can('update_themes') && ! current_user_can('update_plugins')) |
|
23 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
@@ -32,50 +32,50 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param object $update |
34 | 34 | */ |
35 | -function list_core_update( $update ) { |
|
35 | +function list_core_update($update) { |
|
36 | 36 | global $wp_local_package, $wpdb, $wp_version; |
37 | 37 | static $first_pass = true; |
38 | 38 | |
39 | - if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
|
39 | + if ('en_US' == $update->locale && 'en_US' == get_locale()) |
|
40 | 40 | $version_string = $update->current; |
41 | 41 | // If the only available update is a partial builds, it doesn't need a language-specific version string. |
42 | - elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
|
42 | + elseif ('en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ($updates = get_core_updates()) && 1 == count($updates)) |
|
43 | 43 | $version_string = $update->current; |
44 | 44 | else |
45 | - $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
45 | + $version_string = sprintf("%s–<strong>%s</strong>", $update->current, $update->locale); |
|
46 | 46 | |
47 | 47 | $current = false; |
48 | - if ( !isset($update->response) || 'latest' == $update->response ) |
|
48 | + if ( ! isset($update->response) || 'latest' == $update->response) |
|
49 | 49 | $current = true; |
50 | 50 | $submit = __('Update Now'); |
51 | 51 | $form_action = 'update-core.php?action=do-core-upgrade'; |
52 | 52 | $php_version = phpversion(); |
53 | 53 | $mysql_version = $wpdb->db_version(); |
54 | 54 | $show_buttons = true; |
55 | - if ( 'development' == $update->response ) { |
|
55 | + if ('development' == $update->response) { |
|
56 | 56 | $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:'); |
57 | 57 | $download = __('Download nightly build'); |
58 | 58 | } else { |
59 | - if ( $current ) { |
|
60 | - $message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string ); |
|
59 | + if ($current) { |
|
60 | + $message = sprintf(__('If you need to re-install version %s, you can do so here or download the package and re-install manually:'), $version_string); |
|
61 | 61 | $submit = __('Re-install Now'); |
62 | 62 | $form_action = 'update-core.php?action=do-core-reinstall'; |
63 | 63 | } else { |
64 | - $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
|
65 | - if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
64 | + $php_compat = version_compare($php_version, $update->php_version, '>='); |
|
65 | + if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql)) |
|
66 | 66 | $mysql_compat = true; |
67 | 67 | else |
68 | - $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
69 | - |
|
70 | - if ( !$mysql_compat && !$php_compat ) |
|
71 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
72 | - elseif ( !$php_compat ) |
|
73 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
74 | - elseif ( !$mysql_compat ) |
|
75 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
68 | + $mysql_compat = version_compare($mysql_version, $update->mysql_version, '>='); |
|
69 | + |
|
70 | + if ( ! $mysql_compat && ! $php_compat) |
|
71 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version); |
|
72 | + elseif ( ! $php_compat) |
|
73 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version); |
|
74 | + elseif ( ! $mysql_compat) |
|
75 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version); |
|
76 | 76 | else |
77 | - $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | - if ( !$mysql_compat || !$php_compat ) |
|
77 | + $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | + if ( ! $mysql_compat || ! $php_compat) |
|
79 | 79 | $show_buttons = false; |
80 | 80 | } |
81 | 81 | $download = sprintf(__('Download %s'), $version_string); |
@@ -84,31 +84,31 @@ discard block |
||
84 | 84 | echo '<p>'; |
85 | 85 | echo $message; |
86 | 86 | echo '</p>'; |
87 | - echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">'; |
|
87 | + echo '<form method="post" action="'.$form_action.'" name="upgrade" class="upgrade">'; |
|
88 | 88 | wp_nonce_field('upgrade-core'); |
89 | 89 | echo '<p>'; |
90 | - echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; |
|
91 | - echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; |
|
92 | - if ( $show_buttons ) { |
|
93 | - if ( $first_pass ) { |
|
94 | - submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false ); |
|
90 | + echo '<input name="version" value="'.esc_attr($update->current).'" type="hidden"/>'; |
|
91 | + echo '<input name="locale" value="'.esc_attr($update->locale).'" type="hidden"/>'; |
|
92 | + if ($show_buttons) { |
|
93 | + if ($first_pass) { |
|
94 | + submit_button($submit, $current ? 'button' : 'primary regular', 'upgrade', false); |
|
95 | 95 | $first_pass = false; |
96 | 96 | } else { |
97 | - submit_button( $submit, 'button', 'upgrade', false ); |
|
97 | + submit_button($submit, 'button', 'upgrade', false); |
|
98 | 98 | } |
99 | - echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
|
99 | + echo ' <a href="'.esc_url($update->download).'" class="button">'.$download.'</a> '; |
|
100 | 100 | } |
101 | - if ( 'en_US' != $update->locale ) |
|
102 | - if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
103 | - submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
|
101 | + if ('en_US' != $update->locale) |
|
102 | + if ( ! isset($update->dismissed) || ! $update->dismissed) |
|
103 | + submit_button(__('Hide this update'), 'button', 'dismiss', false); |
|
104 | 104 | else |
105 | - submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
105 | + submit_button(__('Bring back this update'), 'button', 'undismiss', false); |
|
106 | 106 | echo '</p>'; |
107 | - if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
|
107 | + if ('en_US' != $update->locale && ( ! isset($wp_local_package) || $wp_local_package != $update->locale)) |
|
108 | 108 | echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
109 | 109 | // Partial builds don't need language-specific warnings. |
110 | - elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
|
111 | - echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
110 | + elseif ('en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version)) { |
|
111 | + echo '<p class="hint">'.sprintf(__('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '').'</p>'; |
|
112 | 112 | } |
113 | 113 | echo '</form>'; |
114 | 114 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | * @since 2.7.0 |
119 | 119 | */ |
120 | 120 | function dismissed_updates() { |
121 | - $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); |
|
122 | - if ( $dismissed ) { |
|
121 | + $dismissed = get_core_updates(array('dismissed' => true, 'available' => false)); |
|
122 | + if ($dismissed) { |
|
123 | 123 | |
124 | 124 | $show_text = esc_js(__('Show hidden updates')); |
125 | 125 | $hide_text = esc_js(__('Hide hidden updates')); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>'; |
137 | 137 | echo '<ul id="dismissed-updates" class="core-updates dismissed">'; |
138 | - foreach ( (array) $dismissed as $update) { |
|
138 | + foreach ((array) $dismissed as $update) { |
|
139 | 139 | echo '<li>'; |
140 | - list_core_update( $update ); |
|
140 | + list_core_update($update); |
|
141 | 141 | echo '</li>'; |
142 | 142 | } |
143 | 143 | echo '</ul>'; |
@@ -158,22 +158,22 @@ discard block |
||
158 | 158 | |
159 | 159 | $updates = get_core_updates(); |
160 | 160 | |
161 | - if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { |
|
161 | + if ( ! isset($updates[0]->response) || 'latest' == $updates[0]->response) { |
|
162 | 162 | echo '<h2>'; |
163 | 163 | _e('You have the latest version of WordPress.'); |
164 | 164 | |
165 | - if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
166 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
165 | + if (wp_http_supports(array('ssl'))) { |
|
166 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
167 | 167 | $upgrader = new WP_Automatic_Updater; |
168 | 168 | $future_minor_update = (object) array( |
169 | - 'current' => $wp_version . '.1.next.minor', |
|
170 | - 'version' => $wp_version . '.1.next.minor', |
|
169 | + 'current' => $wp_version.'.1.next.minor', |
|
170 | + 'version' => $wp_version.'.1.next.minor', |
|
171 | 171 | 'php_version' => $required_php_version, |
172 | 172 | 'mysql_version' => $required_mysql_version, |
173 | 173 | ); |
174 | - $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); |
|
175 | - if ( $should_auto_update ) |
|
176 | - echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
174 | + $should_auto_update = $upgrader->should_update('core', $future_minor_update, ABSPATH); |
|
175 | + if ($should_auto_update) |
|
176 | + echo ' '.__('Future security updates will be applied automatically.'); |
|
177 | 177 | } |
178 | 178 | echo '</h2>'; |
179 | 179 | } else { |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | echo '</p></div>'; |
183 | 183 | |
184 | 184 | echo '<h2 class="response">'; |
185 | - _e( 'An updated version of WordPress is available.' ); |
|
185 | + _e('An updated version of WordPress is available.'); |
|
186 | 186 | echo '</h2>'; |
187 | 187 | } |
188 | 188 | |
189 | - if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) { |
|
190 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
189 | + if (isset($updates[0]) && $updates[0]->response == 'development') { |
|
190 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
191 | 191 | $upgrader = new WP_Automatic_Updater; |
192 | - if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { |
|
192 | + if (wp_http_supports('ssl') && $upgrader->should_update('core', $updates[0], ABSPATH)) { |
|
193 | 193 | echo '<div class="updated inline"><p>'; |
194 | - echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' ); |
|
194 | + echo '<strong>'.__('BETA TESTERS:').'</strong> '.__('This site is set up to install updates of future beta versions automatically.'); |
|
195 | 195 | echo '</p></div>'; |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | echo '<ul class="core-updates">'; |
200 | - foreach ( (array) $updates as $update ) { |
|
200 | + foreach ((array) $updates as $update) { |
|
201 | 201 | echo '<li>'; |
202 | - list_core_update( $update ); |
|
202 | + list_core_update($update); |
|
203 | 203 | echo '</li>'; |
204 | 204 | } |
205 | 205 | echo '</ul>'; |
206 | 206 | // Don't show the maintenance mode notice when we are only showing a single re-install option. |
207 | - if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) { |
|
208 | - echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; |
|
209 | - } elseif ( ! $updates ) { |
|
210 | - list( $normalized_version ) = explode( '-', $wp_version ); |
|
211 | - echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>'; |
|
207 | + if ($updates && (count($updates) > 1 || $updates[0]->response != 'latest')) { |
|
208 | + echo '<p>'.__('While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.').'</p>'; |
|
209 | + } elseif ( ! $updates) { |
|
210 | + list($normalized_version) = explode('-', $wp_version); |
|
211 | + echo '<p>'.sprintf(__('<a href="%s">Learn more about WordPress %s</a>.'), esc_url(self_admin_url('about.php')), $normalized_version).'</p>'; |
|
212 | 212 | } |
213 | 213 | dismissed_updates(); |
214 | 214 | } |
@@ -222,77 +222,77 @@ discard block |
||
222 | 222 | |
223 | 223 | $cur_wp_version = preg_replace('/-.*$/', '', $wp_version); |
224 | 224 | |
225 | - require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
225 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
226 | 226 | $plugins = get_plugin_updates(); |
227 | - if ( empty( $plugins ) ) { |
|
228 | - echo '<h2>' . __( 'Plugins' ) . '</h2>'; |
|
229 | - echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
|
227 | + if (empty($plugins)) { |
|
228 | + echo '<h2>'.__('Plugins').'</h2>'; |
|
229 | + echo '<p>'.__('Your plugins are all up to date.').'</p>'; |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | $form_action = 'update-core.php?action=do-plugin-upgrade'; |
233 | 233 | |
234 | 234 | $core_updates = get_core_updates(); |
235 | - if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
|
235 | + if ( ! isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare($core_updates[0]->current, $cur_wp_version, '=')) |
|
236 | 236 | $core_update_version = false; |
237 | 237 | else |
238 | 238 | $core_update_version = $core_updates[0]->current; |
239 | 239 | ?> |
240 | -<h2><?php _e( 'Plugins' ); ?></h2> |
|
241 | -<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
|
242 | -<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
|
240 | +<h2><?php _e('Plugins'); ?></h2> |
|
241 | +<p><?php _e('The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.'); ?></p> |
|
242 | +<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-plugins" class="upgrade"> |
|
243 | 243 | <?php wp_nonce_field('upgrade-core'); ?> |
244 | 244 | <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
245 | 245 | <table class="widefat updates-table" id="update-plugins-table"> |
246 | 246 | <thead> |
247 | 247 | <tr> |
248 | 248 | <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td> |
249 | - <td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td> |
|
249 | + <td class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></td> |
|
250 | 250 | </tr> |
251 | 251 | </thead> |
252 | 252 | |
253 | 253 | <tbody class="plugins"> |
254 | 254 | <?php |
255 | - foreach ( (array) $plugins as $plugin_file => $plugin_data ) { |
|
255 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
256 | 256 | // Get plugin compat for running version of WordPress. |
257 | - if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) { |
|
258 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
|
259 | - } elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) { |
|
257 | + if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=')) { |
|
258 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
|
259 | + } elseif (isset($plugin_data->update->compatibility->{$cur_wp_version})) { |
|
260 | 260 | $compat = $plugin_data->update->compatibility->{$cur_wp_version}; |
261 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes); |
|
261 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes); |
|
262 | 262 | } else { |
263 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
|
263 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
|
264 | 264 | } |
265 | 265 | // Get plugin compat for updated version of WordPress. |
266 | - if ( $core_update_version ) { |
|
267 | - if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) { |
|
268 | - $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version ); |
|
269 | - } elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) { |
|
266 | + if ($core_update_version) { |
|
267 | + if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $core_update_version, '>=')) { |
|
268 | + $compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $core_update_version); |
|
269 | + } elseif (isset($plugin_data->update->compatibility->{$core_update_version} )) { |
|
270 | 270 | $update_compat = $plugin_data->update->compatibility->{$core_update_version}; |
271 | - $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes); |
|
271 | + $compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes); |
|
272 | 272 | } else { |
273 | - $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
|
273 | + $compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | // Get the upgrade notice for the new plugin version. |
277 | - if ( isset($plugin_data->update->upgrade_notice) ) { |
|
278 | - $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice); |
|
277 | + if (isset($plugin_data->update->upgrade_notice)) { |
|
278 | + $upgrade_notice = '<br />'.strip_tags($plugin_data->update->upgrade_notice); |
|
279 | 279 | } else { |
280 | 280 | $upgrade_notice = ''; |
281 | 281 | } |
282 | 282 | |
283 | - $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662'); |
|
284 | - $details_name = sprintf( '<span class="screen-reader-text">%1$s</span>', esc_attr( $plugin_data->Name ) ); |
|
283 | + $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data->update->slug.'§ion=changelog&TB_iframe=true&width=640&height=662'); |
|
284 | + $details_name = sprintf('<span class="screen-reader-text">%1$s</span>', esc_attr($plugin_data->Name)); |
|
285 | 285 | /* translators: 1: Plugin name 2: Plugin version */ |
286 | - $details_text = sprintf( __( 'View %1$s version %2$s details.' ), $details_name, $plugin_data->update->new_version ); |
|
287 | - $details = sprintf( '<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', esc_url( $details_url ), $details_text ); |
|
288 | - $checkbox_id = "checkbox_" . md5( $plugin_data->Name ); |
|
286 | + $details_text = sprintf(__('View %1$s version %2$s details.'), $details_name, $plugin_data->update->new_version); |
|
287 | + $details = sprintf('<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', esc_url($details_url), $details_text); |
|
288 | + $checkbox_id = "checkbox_".md5($plugin_data->Name); |
|
289 | 289 | ?> |
290 | 290 | <tr> |
291 | 291 | <td class="check-column"> |
292 | - <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" /> |
|
292 | + <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($plugin_file); ?>" /> |
|
293 | 293 | <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php |
294 | 294 | /* translators: %s: plugin name */ |
295 | - printf( __( 'Select %s' ), |
|
295 | + printf(__('Select %s'), |
|
296 | 296 | $plugin_data->Name |
297 | 297 | ); |
298 | 298 | ?></label> |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | <strong><?php echo $plugin_data->Name; ?></strong> |
302 | 302 | <?php |
303 | 303 | /* translators: 1: plugin version, 2: new version */ |
304 | - printf( __( 'You have version %1$s installed. Update to %2$s.' ), |
|
304 | + printf(__('You have version %1$s installed. Update to %2$s.'), |
|
305 | 305 | $plugin_data->Version, |
306 | 306 | $plugin_data->update->new_version |
307 | 307 | ); |
308 | - echo ' ' . $details . $compat . $upgrade_notice; |
|
308 | + echo ' '.$details.$compat.$upgrade_notice; |
|
309 | 309 | ?> |
310 | 310 | </p></td> |
311 | 311 | </tr> |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | <tfoot> |
318 | 318 | <tr> |
319 | 319 | <td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td> |
320 | - <td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
|
320 | + <td class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></td> |
|
321 | 321 | </tr> |
322 | 322 | </tfoot> |
323 | 323 | </table> |
@@ -331,50 +331,50 @@ discard block |
||
331 | 331 | */ |
332 | 332 | function list_theme_updates() { |
333 | 333 | $themes = get_theme_updates(); |
334 | - if ( empty( $themes ) ) { |
|
335 | - echo '<h2>' . __( 'Themes' ) . '</h2>'; |
|
336 | - echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
|
334 | + if (empty($themes)) { |
|
335 | + echo '<h2>'.__('Themes').'</h2>'; |
|
336 | + echo '<p>'.__('Your themes are all up to date.').'</p>'; |
|
337 | 337 | return; |
338 | 338 | } |
339 | 339 | |
340 | 340 | $form_action = 'update-core.php?action=do-theme-upgrade'; |
341 | 341 | ?> |
342 | -<h2><?php _e( 'Themes' ); ?></h2> |
|
343 | -<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
|
344 | -<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p> |
|
345 | -<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> |
|
342 | +<h2><?php _e('Themes'); ?></h2> |
|
343 | +<p><?php _e('The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.'); ?></p> |
|
344 | +<p><?php printf(__('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), __('https://codex.wordpress.org/Child_Themes')); ?></p> |
|
345 | +<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-themes" class="upgrade"> |
|
346 | 346 | <?php wp_nonce_field('upgrade-core'); ?> |
347 | 347 | <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
348 | 348 | <table class="widefat updates-table" id="update-themes-table"> |
349 | 349 | <thead> |
350 | 350 | <tr> |
351 | 351 | <td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td> |
352 | - <td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td> |
|
352 | + <td class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></td> |
|
353 | 353 | </tr> |
354 | 354 | </thead> |
355 | 355 | |
356 | 356 | <tbody class="plugins"> |
357 | 357 | <?php |
358 | - foreach ( $themes as $stylesheet => $theme ) { |
|
359 | - $checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) ); |
|
358 | + foreach ($themes as $stylesheet => $theme) { |
|
359 | + $checkbox_id = 'checkbox_'.md5($theme->get('Name')); |
|
360 | 360 | ?> |
361 | 361 | <tr> |
362 | 362 | <td class="check-column"> |
363 | - <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" /> |
|
363 | + <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($stylesheet); ?>" /> |
|
364 | 364 | <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php |
365 | 365 | /* translators: %s: theme name */ |
366 | - printf( __( 'Select %s' ), |
|
367 | - $theme->display( 'Name' ) |
|
366 | + printf(__('Select %s'), |
|
367 | + $theme->display('Name') |
|
368 | 368 | ); |
369 | 369 | ?></label> |
370 | 370 | </td> |
371 | 371 | <td class="plugin-title"><p> |
372 | - <img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
|
373 | - <strong><?php echo $theme->display( 'Name' ); ?></strong> |
|
372 | + <img src="<?php echo esc_url($theme->get_screenshot()); ?>" width="85" height="64" class="updates-table-screenshot" alt="" /> |
|
373 | + <strong><?php echo $theme->display('Name'); ?></strong> |
|
374 | 374 | <?php |
375 | 375 | /* translators: 1: theme version, 2: new version */ |
376 | - printf( __( 'You have version %1$s installed. Update to %2$s.' ), |
|
377 | - $theme->display( 'Version' ), |
|
376 | + printf(__('You have version %1$s installed. Update to %2$s.'), |
|
377 | + $theme->display('Version'), |
|
378 | 378 | $theme->update['new_version'] |
379 | 379 | ); |
380 | 380 | ?> |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | <tfoot> |
389 | 389 | <tr> |
390 | 390 | <td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> |
391 | - <td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td> |
|
391 | + <td class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></td> |
|
392 | 392 | </tr> |
393 | 393 | </tfoot> |
394 | 394 | </table> |
@@ -402,21 +402,21 @@ discard block |
||
402 | 402 | */ |
403 | 403 | function list_translation_updates() { |
404 | 404 | $updates = wp_get_translation_updates(); |
405 | - if ( ! $updates ) { |
|
406 | - if ( 'en_US' != get_locale() ) { |
|
407 | - echo '<h2>' . __( 'Translations' ) . '</h2>'; |
|
408 | - echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>'; |
|
405 | + if ( ! $updates) { |
|
406 | + if ('en_US' != get_locale()) { |
|
407 | + echo '<h2>'.__('Translations').'</h2>'; |
|
408 | + echo '<p>'.__('Your translations are all up to date.').'</p>'; |
|
409 | 409 | } |
410 | 410 | return; |
411 | 411 | } |
412 | 412 | |
413 | 413 | $form_action = 'update-core.php?action=do-translation-upgrade'; |
414 | 414 | ?> |
415 | - <h2><?php _e( 'Translations' ); ?></h2> |
|
416 | - <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> |
|
417 | - <p><?php _e( 'New translations are available.' ); ?></p> |
|
418 | - <?php wp_nonce_field( 'upgrade-translations' ); ?> |
|
419 | - <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> |
|
415 | + <h2><?php _e('Translations'); ?></h2> |
|
416 | + <form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-translations" class="upgrade"> |
|
417 | + <p><?php _e('New translations are available.'); ?></p> |
|
418 | + <?php wp_nonce_field('upgrade-translations'); ?> |
|
419 | + <p><input class="button" type="submit" value="<?php esc_attr_e('Update Translations'); ?>" name="upgrade" /></p> |
|
420 | 420 | </form> |
421 | 421 | <?php |
422 | 422 | } |
@@ -430,76 +430,76 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @param bool $reinstall |
432 | 432 | */ |
433 | -function do_core_upgrade( $reinstall = false ) { |
|
433 | +function do_core_upgrade($reinstall = false) { |
|
434 | 434 | global $wp_filesystem; |
435 | 435 | |
436 | - include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
436 | + include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
437 | 437 | |
438 | - if ( $reinstall ) |
|
438 | + if ($reinstall) |
|
439 | 439 | $url = 'update-core.php?action=do-core-reinstall'; |
440 | 440 | else |
441 | 441 | $url = 'update-core.php?action=do-core-upgrade'; |
442 | 442 | $url = wp_nonce_url($url, 'upgrade-core'); |
443 | 443 | |
444 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
445 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
446 | - $update = find_core_update( $version, $locale ); |
|
447 | - if ( !$update ) |
|
444 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
445 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
446 | + $update = find_core_update($version, $locale); |
|
447 | + if ( ! $update) |
|
448 | 448 | return; |
449 | 449 | |
450 | 450 | // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies |
451 | 451 | // that it's safe to do so. This only happens when there are no new files to create. |
452 | - $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files; |
|
452 | + $allow_relaxed_file_ownership = ! $reinstall && isset($update->new_files) && ! $update->new_files; |
|
453 | 453 | |
454 | 454 | ?> |
455 | 455 | <div class="wrap"> |
456 | - <h1><?php _e( 'Update WordPress' ); ?></h1> |
|
456 | + <h1><?php _e('Update WordPress'); ?></h1> |
|
457 | 457 | <?php |
458 | 458 | |
459 | - if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) { |
|
459 | + if (false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership))) { |
|
460 | 460 | echo '</div>'; |
461 | 461 | return; |
462 | 462 | } |
463 | 463 | |
464 | - if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { |
|
464 | + if ( ! WP_Filesystem($credentials, ABSPATH, $allow_relaxed_file_ownership)) { |
|
465 | 465 | // Failed to connect, Error and request again |
466 | - request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
|
466 | + request_filesystem_credentials($url, '', true, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership); |
|
467 | 467 | echo '</div>'; |
468 | 468 | return; |
469 | 469 | } |
470 | 470 | |
471 | - if ( $wp_filesystem->errors->get_error_code() ) { |
|
472 | - foreach ( $wp_filesystem->errors->get_error_messages() as $message ) |
|
471 | + if ($wp_filesystem->errors->get_error_code()) { |
|
472 | + foreach ($wp_filesystem->errors->get_error_messages() as $message) |
|
473 | 473 | show_message($message); |
474 | 474 | echo '</div>'; |
475 | 475 | return; |
476 | 476 | } |
477 | 477 | |
478 | - if ( $reinstall ) |
|
478 | + if ($reinstall) |
|
479 | 479 | $update->response = 'reinstall'; |
480 | 480 | |
481 | - add_filter( 'update_feedback', 'show_message' ); |
|
481 | + add_filter('update_feedback', 'show_message'); |
|
482 | 482 | |
483 | 483 | $upgrader = new Core_Upgrader(); |
484 | - $result = $upgrader->upgrade( $update, array( |
|
484 | + $result = $upgrader->upgrade($update, array( |
|
485 | 485 | 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership |
486 | - ) ); |
|
486 | + )); |
|
487 | 487 | |
488 | - if ( is_wp_error($result) ) { |
|
488 | + if (is_wp_error($result)) { |
|
489 | 489 | show_message($result); |
490 | - if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) |
|
491 | - show_message( __('Installation Failed') ); |
|
490 | + if ('up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code()) |
|
491 | + show_message(__('Installation Failed')); |
|
492 | 492 | echo '</div>'; |
493 | 493 | return; |
494 | 494 | } |
495 | 495 | |
496 | - show_message( __('WordPress updated successfully') ); |
|
497 | - show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
|
498 | - show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
|
496 | + show_message(__('WordPress updated successfully')); |
|
497 | + show_message('<span class="hide-if-no-js">'.sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>'); |
|
498 | + show_message('<span class="hide-if-js">'.sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>'); |
|
499 | 499 | ?> |
500 | 500 | </div> |
501 | 501 | <script type="text/javascript"> |
502 | - window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>'; |
|
502 | + window.location = '<?php echo self_admin_url('about.php?updated'); ?>'; |
|
503 | 503 | </script> |
504 | 504 | <?php |
505 | 505 | } |
@@ -508,13 +508,13 @@ discard block |
||
508 | 508 | * @since 2.7.0 |
509 | 509 | */ |
510 | 510 | function do_dismiss_core_update() { |
511 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
512 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
513 | - $update = find_core_update( $version, $locale ); |
|
514 | - if ( !$update ) |
|
511 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
512 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
513 | + $update = find_core_update($version, $locale); |
|
514 | + if ( ! $update) |
|
515 | 515 | return; |
516 | - dismiss_core_update( $update ); |
|
517 | - wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
516 | + dismiss_core_update($update); |
|
517 | + wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core')); |
|
518 | 518 | exit; |
519 | 519 | } |
520 | 520 | |
@@ -522,21 +522,21 @@ discard block |
||
522 | 522 | * @since 2.7.0 |
523 | 523 | */ |
524 | 524 | function do_undismiss_core_update() { |
525 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
526 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
527 | - $update = find_core_update( $version, $locale ); |
|
528 | - if ( !$update ) |
|
525 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
526 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
527 | + $update = find_core_update($version, $locale); |
|
528 | + if ( ! $update) |
|
529 | 529 | return; |
530 | - undismiss_core_update( $version, $locale ); |
|
531 | - wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
530 | + undismiss_core_update($version, $locale); |
|
531 | + wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core')); |
|
532 | 532 | exit; |
533 | 533 | } |
534 | 534 | |
535 | 535 | $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; |
536 | 536 | |
537 | 537 | $upgrade_error = false; |
538 | -if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) ) |
|
539 | - && ! isset( $_POST['checked'] ) ) { |
|
538 | +if (('do-theme-upgrade' == $action || ('do-plugin-upgrade' == $action && ! isset($_GET['plugins']))) |
|
539 | + && ! isset($_POST['checked'])) { |
|
540 | 540 | $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins'; |
541 | 541 | $action = 'upgrade-core'; |
542 | 542 | } |
@@ -544,47 +544,47 @@ discard block |
||
544 | 544 | $title = __('WordPress Updates'); |
545 | 545 | $parent_file = 'index.php'; |
546 | 546 | |
547 | -$updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>'; |
|
548 | -$updates_overview .= '<p>' . __( 'If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>'; |
|
547 | +$updates_overview = '<p>'.__('On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.').'</p>'; |
|
548 | +$updates_overview .= '<p>'.__('If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.').' '.__('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.').'</p>'; |
|
549 | 549 | |
550 | -get_current_screen()->add_help_tab( array( |
|
550 | +get_current_screen()->add_help_tab(array( |
|
551 | 551 | 'id' => 'overview', |
552 | - 'title' => __( 'Overview' ), |
|
552 | + 'title' => __('Overview'), |
|
553 | 553 | 'content' => $updates_overview |
554 | -) ); |
|
554 | +)); |
|
555 | 555 | |
556 | -$updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>'; |
|
557 | -$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>'; |
|
556 | +$updates_howto = '<p>'.__('<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.').' '.__('In most cases, WordPress will automatically apply maintenance and security updates in the background for you.').'</p>'; |
|
557 | +$updates_howto .= '<p>'.__('<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.').'</p>'; |
|
558 | 558 | |
559 | -if ( 'en_US' != get_locale() ) { |
|
560 | - $updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>'; |
|
559 | +if ('en_US' != get_locale()) { |
|
560 | + $updates_howto .= '<p>'.__('<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.').'</p>'; |
|
561 | 561 | } |
562 | 562 | |
563 | -get_current_screen()->add_help_tab( array( |
|
563 | +get_current_screen()->add_help_tab(array( |
|
564 | 564 | 'id' => 'how-to-update', |
565 | - 'title' => __( 'How to Update' ), |
|
565 | + 'title' => __('How to Update'), |
|
566 | 566 | 'content' => $updates_howto |
567 | -) ); |
|
567 | +)); |
|
568 | 568 | |
569 | 569 | get_current_screen()->set_help_sidebar( |
570 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
571 | - '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' . |
|
572 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
570 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
571 | + '<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>').'</p>'. |
|
572 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
573 | 573 | ); |
574 | 574 | |
575 | -if ( 'upgrade-core' == $action ) { |
|
575 | +if ('upgrade-core' == $action) { |
|
576 | 576 | // Force a update check when requested |
577 | - $force_check = ! empty( $_GET['force-check'] ); |
|
578 | - wp_version_check( array(), $force_check ); |
|
577 | + $force_check = ! empty($_GET['force-check']); |
|
578 | + wp_version_check(array(), $force_check); |
|
579 | 579 | |
580 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
580 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
581 | 581 | ?> |
582 | 582 | <div class="wrap"> |
583 | - <h1><?php _e( 'WordPress Updates' ); ?></h1> |
|
583 | + <h1><?php _e('WordPress Updates'); ?></h1> |
|
584 | 584 | <?php |
585 | - if ( $upgrade_error ) { |
|
585 | + if ($upgrade_error) { |
|
586 | 586 | echo '<div class="error"><p>'; |
587 | - if ( $upgrade_error == 'themes' ) |
|
587 | + if ($upgrade_error == 'themes') |
|
588 | 588 | _e('Please select one or more themes to update.'); |
589 | 589 | else |
590 | 590 | _e('Please select one or more plugins to update.'); |
@@ -593,129 +593,129 @@ discard block |
||
593 | 593 | |
594 | 594 | echo '<p>'; |
595 | 595 | /* translators: %1 date, %2 time. */ |
596 | - printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ) ), date_i18n( __( 'g:i a' ) ) ); |
|
597 | - echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
|
596 | + printf(__('Last checked on %1$s at %2$s.'), date_i18n(__('F j, Y')), date_i18n(__('g:i a'))); |
|
597 | + echo ' <a class="button" href="'.esc_url(self_admin_url('update-core.php?force-check=1')).'">'.__('Check Again').'</a>'; |
|
598 | 598 | echo '</p>'; |
599 | 599 | |
600 | - if ( $core = current_user_can( 'update_core' ) ) |
|
600 | + if ($core = current_user_can('update_core')) |
|
601 | 601 | core_upgrade_preamble(); |
602 | - if ( $plugins = current_user_can( 'update_plugins' ) ) |
|
602 | + if ($plugins = current_user_can('update_plugins')) |
|
603 | 603 | list_plugin_updates(); |
604 | - if ( $themes = current_user_can( 'update_themes' ) ) |
|
604 | + if ($themes = current_user_can('update_themes')) |
|
605 | 605 | list_theme_updates(); |
606 | - if ( $core || $plugins || $themes ) |
|
606 | + if ($core || $plugins || $themes) |
|
607 | 607 | list_translation_updates(); |
608 | - unset( $core, $plugins, $themes ); |
|
608 | + unset($core, $plugins, $themes); |
|
609 | 609 | /** |
610 | 610 | * Fires after the core, plugin, and theme update tables. |
611 | 611 | * |
612 | 612 | * @since 2.9.0 |
613 | 613 | */ |
614 | - do_action( 'core_upgrade_preamble' ); |
|
614 | + do_action('core_upgrade_preamble'); |
|
615 | 615 | echo '</div>'; |
616 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
616 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
617 | 617 | |
618 | -} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
|
618 | +} elseif ('do-core-upgrade' == $action || 'do-core-reinstall' == $action) { |
|
619 | 619 | |
620 | - if ( ! current_user_can( 'update_core' ) ) |
|
621 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
620 | + if ( ! current_user_can('update_core')) |
|
621 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
622 | 622 | |
623 | 623 | check_admin_referer('upgrade-core'); |
624 | 624 | |
625 | 625 | // Do the (un)dismiss actions before headers, so that they can redirect. |
626 | - if ( isset( $_POST['dismiss'] ) ) |
|
626 | + if (isset($_POST['dismiss'])) |
|
627 | 627 | do_dismiss_core_update(); |
628 | - elseif ( isset( $_POST['undismiss'] ) ) |
|
628 | + elseif (isset($_POST['undismiss'])) |
|
629 | 629 | do_undismiss_core_update(); |
630 | 630 | |
631 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
632 | - if ( 'do-core-reinstall' == $action ) |
|
631 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
632 | + if ('do-core-reinstall' == $action) |
|
633 | 633 | $reinstall = true; |
634 | 634 | else |
635 | 635 | $reinstall = false; |
636 | 636 | |
637 | - if ( isset( $_POST['upgrade'] ) ) |
|
637 | + if (isset($_POST['upgrade'])) |
|
638 | 638 | do_core_upgrade($reinstall); |
639 | 639 | |
640 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
640 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
641 | 641 | |
642 | -} elseif ( 'do-plugin-upgrade' == $action ) { |
|
642 | +} elseif ('do-plugin-upgrade' == $action) { |
|
643 | 643 | |
644 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
645 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
644 | + if ( ! current_user_can('update_plugins')) |
|
645 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
646 | 646 | |
647 | 647 | check_admin_referer('upgrade-core'); |
648 | 648 | |
649 | - if ( isset( $_GET['plugins'] ) ) { |
|
650 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
651 | - } elseif ( isset( $_POST['checked'] ) ) { |
|
649 | + if (isset($_GET['plugins'])) { |
|
650 | + $plugins = explode(',', $_GET['plugins']); |
|
651 | + } elseif (isset($_POST['checked'])) { |
|
652 | 652 | $plugins = (array) $_POST['checked']; |
653 | 653 | } else { |
654 | - wp_redirect( admin_url('update-core.php') ); |
|
654 | + wp_redirect(admin_url('update-core.php')); |
|
655 | 655 | exit; |
656 | 656 | } |
657 | 657 | |
658 | - $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins)); |
|
658 | + $url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins)); |
|
659 | 659 | $url = wp_nonce_url($url, 'bulk-update-plugins'); |
660 | 660 | |
661 | 661 | $title = __('Update Plugins'); |
662 | 662 | |
663 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
663 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
664 | 664 | echo '<div class="wrap">'; |
665 | - echo '<h1>' . __( 'Update Plugins' ) . '</h1>'; |
|
666 | - echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>'; |
|
665 | + echo '<h1>'.__('Update Plugins').'</h1>'; |
|
666 | + echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="'.esc_attr__('Update progress').'"></iframe>'; |
|
667 | 667 | echo '</div>'; |
668 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
668 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
669 | 669 | |
670 | -} elseif ( 'do-theme-upgrade' == $action ) { |
|
670 | +} elseif ('do-theme-upgrade' == $action) { |
|
671 | 671 | |
672 | - if ( ! current_user_can( 'update_themes' ) ) |
|
673 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
672 | + if ( ! current_user_can('update_themes')) |
|
673 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
674 | 674 | |
675 | 675 | check_admin_referer('upgrade-core'); |
676 | 676 | |
677 | - if ( isset( $_GET['themes'] ) ) { |
|
678 | - $themes = explode( ',', $_GET['themes'] ); |
|
679 | - } elseif ( isset( $_POST['checked'] ) ) { |
|
677 | + if (isset($_GET['themes'])) { |
|
678 | + $themes = explode(',', $_GET['themes']); |
|
679 | + } elseif (isset($_POST['checked'])) { |
|
680 | 680 | $themes = (array) $_POST['checked']; |
681 | 681 | } else { |
682 | - wp_redirect( admin_url('update-core.php') ); |
|
682 | + wp_redirect(admin_url('update-core.php')); |
|
683 | 683 | exit; |
684 | 684 | } |
685 | 685 | |
686 | - $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); |
|
686 | + $url = 'update.php?action=update-selected-themes&themes='.urlencode(implode(',', $themes)); |
|
687 | 687 | $url = wp_nonce_url($url, 'bulk-update-themes'); |
688 | 688 | |
689 | 689 | $title = __('Update Themes'); |
690 | 690 | |
691 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
691 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
692 | 692 | ?> |
693 | 693 | <div class="wrap"> |
694 | - <h1><?php _e( 'Update Themes' ); ?></h1> |
|
695 | - <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe> |
|
694 | + <h1><?php _e('Update Themes'); ?></h1> |
|
695 | + <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e('Update progress'); ?>"></iframe> |
|
696 | 696 | </div> |
697 | 697 | <?php |
698 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
698 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
699 | 699 | |
700 | -} elseif ( 'do-translation-upgrade' == $action ) { |
|
700 | +} elseif ('do-translation-upgrade' == $action) { |
|
701 | 701 | |
702 | - if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) |
|
703 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
702 | + if ( ! current_user_can('update_core') && ! current_user_can('update_plugins') && ! current_user_can('update_themes')) |
|
703 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
704 | 704 | |
705 | - check_admin_referer( 'upgrade-translations' ); |
|
705 | + check_admin_referer('upgrade-translations'); |
|
706 | 706 | |
707 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
708 | - include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
707 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
708 | + include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
709 | 709 | |
710 | 710 | $url = 'update-core.php?action=do-translation-upgrade'; |
711 | 711 | $nonce = 'upgrade-translations'; |
712 | - $title = __( 'Update Translations' ); |
|
712 | + $title = __('Update Translations'); |
|
713 | 713 | $context = WP_LANG_DIR; |
714 | 714 | |
715 | - $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) ); |
|
715 | + $upgrader = new Language_Pack_Upgrader(new Language_Pack_Upgrader_Skin(compact('url', 'nonce', 'title', 'context'))); |
|
716 | 716 | $result = $upgrader->bulk_upgrade(); |
717 | 717 | |
718 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
718 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
719 | 719 | |
720 | 720 | } else { |
721 | 721 | /** |
@@ -727,5 +727,5 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @since 3.2.0 |
729 | 729 | */ |
730 | - do_action( "update-core-custom_{$action}" ); |
|
730 | + do_action("update-core-custom_{$action}"); |
|
731 | 731 | } |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | exit(); |
20 | 20 | } |
21 | 21 | |
22 | -if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) |
|
22 | +if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) { |
|
23 | 23 | wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
24 | +} |
|
24 | 25 | |
25 | 26 | /** |
26 | 27 | * |
@@ -36,17 +37,20 @@ discard block |
||
36 | 37 | global $wp_local_package, $wpdb, $wp_version; |
37 | 38 | static $first_pass = true; |
38 | 39 | |
39 | - if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
|
40 | - $version_string = $update->current; |
|
40 | + if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) { |
|
41 | + $version_string = $update->current; |
|
42 | + } |
|
41 | 43 | // If the only available update is a partial builds, it doesn't need a language-specific version string. |
42 | - elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
|
43 | - $version_string = $update->current; |
|
44 | - else |
|
45 | - $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
44 | + elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) { |
|
45 | + $version_string = $update->current; |
|
46 | + } else { |
|
47 | + $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
48 | + } |
|
46 | 49 | |
47 | 50 | $current = false; |
48 | - if ( !isset($update->response) || 'latest' == $update->response ) |
|
49 | - $current = true; |
|
51 | + if ( !isset($update->response) || 'latest' == $update->response ) { |
|
52 | + $current = true; |
|
53 | + } |
|
50 | 54 | $submit = __('Update Now'); |
51 | 55 | $form_action = 'update-core.php?action=do-core-upgrade'; |
52 | 56 | $php_version = phpversion(); |
@@ -62,21 +66,24 @@ discard block |
||
62 | 66 | $form_action = 'update-core.php?action=do-core-reinstall'; |
63 | 67 | } else { |
64 | 68 | $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
65 | - if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
66 | - $mysql_compat = true; |
|
67 | - else |
|
68 | - $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
69 | - |
|
70 | - if ( !$mysql_compat && !$php_compat ) |
|
71 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
72 | - elseif ( !$php_compat ) |
|
73 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
74 | - elseif ( !$mysql_compat ) |
|
75 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
76 | - else |
|
77 | - $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | - if ( !$mysql_compat || !$php_compat ) |
|
79 | - $show_buttons = false; |
|
69 | + if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
70 | + $mysql_compat = true; |
|
71 | + } else { |
|
72 | + $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
73 | + } |
|
74 | + |
|
75 | + if ( !$mysql_compat && !$php_compat ) { |
|
76 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
77 | + } elseif ( !$php_compat ) { |
|
78 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
79 | + } elseif ( !$mysql_compat ) { |
|
80 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
81 | + } else { |
|
82 | + $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
83 | + } |
|
84 | + if ( !$mysql_compat || !$php_compat ) { |
|
85 | + $show_buttons = false; |
|
86 | + } |
|
80 | 87 | } |
81 | 88 | $download = sprintf(__('Download %s'), $version_string); |
82 | 89 | } |
@@ -98,14 +105,16 @@ discard block |
||
98 | 105 | } |
99 | 106 | echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
100 | 107 | } |
101 | - if ( 'en_US' != $update->locale ) |
|
102 | - if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
108 | + if ( 'en_US' != $update->locale ) { |
|
109 | + if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
103 | 110 | submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
104 | - else |
|
105 | - submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
111 | + } else { |
|
112 | + submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
113 | + } |
|
106 | 114 | echo '</p>'; |
107 | - if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
|
108 | - echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
115 | + if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) { |
|
116 | + echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
117 | + } |
|
109 | 118 | // Partial builds don't need language-specific warnings. |
110 | 119 | elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
111 | 120 | echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
@@ -172,8 +181,9 @@ discard block |
||
172 | 181 | 'mysql_version' => $required_mysql_version, |
173 | 182 | ); |
174 | 183 | $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); |
175 | - if ( $should_auto_update ) |
|
176 | - echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
184 | + if ( $should_auto_update ) { |
|
185 | + echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
186 | + } |
|
177 | 187 | } |
178 | 188 | echo '</h2>'; |
179 | 189 | } else { |
@@ -232,10 +242,11 @@ discard block |
||
232 | 242 | $form_action = 'update-core.php?action=do-plugin-upgrade'; |
233 | 243 | |
234 | 244 | $core_updates = get_core_updates(); |
235 | - if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
|
236 | - $core_update_version = false; |
|
237 | - else |
|
238 | - $core_update_version = $core_updates[0]->current; |
|
245 | + if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) { |
|
246 | + $core_update_version = false; |
|
247 | + } else { |
|
248 | + $core_update_version = $core_updates[0]->current; |
|
249 | + } |
|
239 | 250 | ?> |
240 | 251 | <h2><?php _e( 'Plugins' ); ?></h2> |
241 | 252 | <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
@@ -435,17 +446,19 @@ discard block |
||
435 | 446 | |
436 | 447 | include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
437 | 448 | |
438 | - if ( $reinstall ) |
|
439 | - $url = 'update-core.php?action=do-core-reinstall'; |
|
440 | - else |
|
441 | - $url = 'update-core.php?action=do-core-upgrade'; |
|
449 | + if ( $reinstall ) { |
|
450 | + $url = 'update-core.php?action=do-core-reinstall'; |
|
451 | + } else { |
|
452 | + $url = 'update-core.php?action=do-core-upgrade'; |
|
453 | + } |
|
442 | 454 | $url = wp_nonce_url($url, 'upgrade-core'); |
443 | 455 | |
444 | 456 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
445 | 457 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
446 | 458 | $update = find_core_update( $version, $locale ); |
447 | - if ( !$update ) |
|
448 | - return; |
|
459 | + if ( !$update ) { |
|
460 | + return; |
|
461 | + } |
|
449 | 462 | |
450 | 463 | // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies |
451 | 464 | // that it's safe to do so. This only happens when there are no new files to create. |
@@ -469,14 +482,16 @@ discard block |
||
469 | 482 | } |
470 | 483 | |
471 | 484 | if ( $wp_filesystem->errors->get_error_code() ) { |
472 | - foreach ( $wp_filesystem->errors->get_error_messages() as $message ) |
|
473 | - show_message($message); |
|
485 | + foreach ( $wp_filesystem->errors->get_error_messages() as $message ) { |
|
486 | + show_message($message); |
|
487 | + } |
|
474 | 488 | echo '</div>'; |
475 | 489 | return; |
476 | 490 | } |
477 | 491 | |
478 | - if ( $reinstall ) |
|
479 | - $update->response = 'reinstall'; |
|
492 | + if ( $reinstall ) { |
|
493 | + $update->response = 'reinstall'; |
|
494 | + } |
|
480 | 495 | |
481 | 496 | add_filter( 'update_feedback', 'show_message' ); |
482 | 497 | |
@@ -487,8 +502,9 @@ discard block |
||
487 | 502 | |
488 | 503 | if ( is_wp_error($result) ) { |
489 | 504 | show_message($result); |
490 | - if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) |
|
491 | - show_message( __('Installation Failed') ); |
|
505 | + if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) { |
|
506 | + show_message( __('Installation Failed') ); |
|
507 | + } |
|
492 | 508 | echo '</div>'; |
493 | 509 | return; |
494 | 510 | } |
@@ -511,8 +527,9 @@ discard block |
||
511 | 527 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
512 | 528 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
513 | 529 | $update = find_core_update( $version, $locale ); |
514 | - if ( !$update ) |
|
515 | - return; |
|
530 | + if ( !$update ) { |
|
531 | + return; |
|
532 | + } |
|
516 | 533 | dismiss_core_update( $update ); |
517 | 534 | wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
518 | 535 | exit; |
@@ -525,8 +542,9 @@ discard block |
||
525 | 542 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
526 | 543 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
527 | 544 | $update = find_core_update( $version, $locale ); |
528 | - if ( !$update ) |
|
529 | - return; |
|
545 | + if ( !$update ) { |
|
546 | + return; |
|
547 | + } |
|
530 | 548 | undismiss_core_update( $version, $locale ); |
531 | 549 | wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
532 | 550 | exit; |
@@ -584,10 +602,11 @@ discard block |
||
584 | 602 | <?php |
585 | 603 | if ( $upgrade_error ) { |
586 | 604 | echo '<div class="error"><p>'; |
587 | - if ( $upgrade_error == 'themes' ) |
|
588 | - _e('Please select one or more themes to update.'); |
|
589 | - else |
|
590 | - _e('Please select one or more plugins to update.'); |
|
605 | + if ( $upgrade_error == 'themes' ) { |
|
606 | + _e('Please select one or more themes to update.'); |
|
607 | + } else { |
|
608 | + _e('Please select one or more plugins to update.'); |
|
609 | + } |
|
591 | 610 | echo '</p></div>'; |
592 | 611 | } |
593 | 612 | |
@@ -597,14 +616,18 @@ discard block |
||
597 | 616 | echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
598 | 617 | echo '</p>'; |
599 | 618 | |
600 | - if ( $core = current_user_can( 'update_core' ) ) |
|
601 | - core_upgrade_preamble(); |
|
602 | - if ( $plugins = current_user_can( 'update_plugins' ) ) |
|
603 | - list_plugin_updates(); |
|
604 | - if ( $themes = current_user_can( 'update_themes' ) ) |
|
605 | - list_theme_updates(); |
|
606 | - if ( $core || $plugins || $themes ) |
|
607 | - list_translation_updates(); |
|
619 | + if ( $core = current_user_can( 'update_core' ) ) { |
|
620 | + core_upgrade_preamble(); |
|
621 | + } |
|
622 | + if ( $plugins = current_user_can( 'update_plugins' ) ) { |
|
623 | + list_plugin_updates(); |
|
624 | + } |
|
625 | + if ( $themes = current_user_can( 'update_themes' ) ) { |
|
626 | + list_theme_updates(); |
|
627 | + } |
|
628 | + if ( $core || $plugins || $themes ) { |
|
629 | + list_translation_updates(); |
|
630 | + } |
|
608 | 631 | unset( $core, $plugins, $themes ); |
609 | 632 | /** |
610 | 633 | * Fires after the core, plugin, and theme update tables. |
@@ -617,32 +640,37 @@ discard block |
||
617 | 640 | |
618 | 641 | } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
619 | 642 | |
620 | - if ( ! current_user_can( 'update_core' ) ) |
|
621 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
643 | + if ( ! current_user_can( 'update_core' ) ) { |
|
644 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
645 | + } |
|
622 | 646 | |
623 | 647 | check_admin_referer('upgrade-core'); |
624 | 648 | |
625 | 649 | // Do the (un)dismiss actions before headers, so that they can redirect. |
626 | - if ( isset( $_POST['dismiss'] ) ) |
|
627 | - do_dismiss_core_update(); |
|
628 | - elseif ( isset( $_POST['undismiss'] ) ) |
|
629 | - do_undismiss_core_update(); |
|
650 | + if ( isset( $_POST['dismiss'] ) ) { |
|
651 | + do_dismiss_core_update(); |
|
652 | + } elseif ( isset( $_POST['undismiss'] ) ) { |
|
653 | + do_undismiss_core_update(); |
|
654 | + } |
|
630 | 655 | |
631 | 656 | require_once(ABSPATH . 'wp-admin/admin-header.php'); |
632 | - if ( 'do-core-reinstall' == $action ) |
|
633 | - $reinstall = true; |
|
634 | - else |
|
635 | - $reinstall = false; |
|
657 | + if ( 'do-core-reinstall' == $action ) { |
|
658 | + $reinstall = true; |
|
659 | + } else { |
|
660 | + $reinstall = false; |
|
661 | + } |
|
636 | 662 | |
637 | - if ( isset( $_POST['upgrade'] ) ) |
|
638 | - do_core_upgrade($reinstall); |
|
663 | + if ( isset( $_POST['upgrade'] ) ) { |
|
664 | + do_core_upgrade($reinstall); |
|
665 | + } |
|
639 | 666 | |
640 | 667 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
641 | 668 | |
642 | 669 | } elseif ( 'do-plugin-upgrade' == $action ) { |
643 | 670 | |
644 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
645 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
671 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
672 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
673 | + } |
|
646 | 674 | |
647 | 675 | check_admin_referer('upgrade-core'); |
648 | 676 | |
@@ -669,8 +697,9 @@ discard block |
||
669 | 697 | |
670 | 698 | } elseif ( 'do-theme-upgrade' == $action ) { |
671 | 699 | |
672 | - if ( ! current_user_can( 'update_themes' ) ) |
|
673 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
700 | + if ( ! current_user_can( 'update_themes' ) ) { |
|
701 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
702 | + } |
|
674 | 703 | |
675 | 704 | check_admin_referer('upgrade-core'); |
676 | 705 | |
@@ -699,8 +728,9 @@ discard block |
||
699 | 728 | |
700 | 729 | } elseif ( 'do-translation-upgrade' == $action ) { |
701 | 730 | |
702 | - if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) |
|
703 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
731 | + if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) { |
|
732 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
733 | + } |
|
704 | 734 | |
705 | 735 | check_admin_referer( 'upgrade-translations' ); |
706 | 736 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * User administration panel |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 1.0.0 |
|
8 | - */ |
|
3 | + * User administration panel |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 1.0.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | unset( $help ); |
64 | 64 | |
65 | 65 | get_current_screen()->set_help_sidebar( |
66 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
67 | - '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' . |
|
68 | - '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' . |
|
69 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
66 | + '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
67 | + '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' . |
|
68 | + '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' . |
|
69 | + '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | get_current_screen()->set_screen_reader_content( array( |
@@ -90,101 +90,101 @@ discard block |
||
90 | 90 | switch ( $wp_list_table->current_action() ) { |
91 | 91 | |
92 | 92 | /* Bulk Dropdown menu Role changes */ |
93 | -case 'promote': |
|
94 | - check_admin_referer('bulk-users'); |
|
93 | + case 'promote': |
|
94 | + check_admin_referer('bulk-users'); |
|
95 | 95 | |
96 | - if ( ! current_user_can( 'promote_users' ) ) |
|
97 | - wp_die( __( 'You can’t edit that user.' ) ); |
|
96 | + if ( ! current_user_can( 'promote_users' ) ) |
|
97 | + wp_die( __( 'You can’t edit that user.' ) ); |
|
98 | 98 | |
99 | - if ( empty($_REQUEST['users']) ) { |
|
100 | - wp_redirect($redirect); |
|
101 | - exit(); |
|
102 | - } |
|
103 | - |
|
104 | - $editable_roles = get_editable_roles(); |
|
105 | - $role = false; |
|
106 | - if ( ! empty( $_REQUEST['new_role2'] ) ) { |
|
107 | - $role = $_REQUEST['new_role2']; |
|
108 | - } elseif ( ! empty( $_REQUEST['new_role'] ) ) { |
|
109 | - $role = $_REQUEST['new_role']; |
|
110 | - } |
|
111 | - |
|
112 | - if ( ! $role || empty( $editable_roles[ $role ] ) ) { |
|
113 | - wp_die( __( 'You can’t give users that role.' ) ); |
|
114 | - } |
|
115 | - |
|
116 | - $userids = $_REQUEST['users']; |
|
117 | - $update = 'promote'; |
|
118 | - foreach ( $userids as $id ) { |
|
119 | - $id = (int) $id; |
|
120 | - |
|
121 | - if ( ! current_user_can('promote_user', $id) ) |
|
122 | - wp_die(__('You can’t edit that user.')); |
|
123 | - // The new role of the current user must also have the promote_users cap or be a multisite super admin |
|
124 | - if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users') |
|
125 | - && ! ( is_multisite() && is_super_admin() ) ) { |
|
126 | - $update = 'err_admin_role'; |
|
127 | - continue; |
|
99 | + if ( empty($_REQUEST['users']) ) { |
|
100 | + wp_redirect($redirect); |
|
101 | + exit(); |
|
128 | 102 | } |
129 | 103 | |
130 | - // If the user doesn't already belong to the blog, bail. |
|
131 | - if ( is_multisite() && !is_user_member_of_blog( $id ) ) { |
|
132 | - wp_die( |
|
133 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
134 | - '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', |
|
135 | - 403 |
|
136 | - ); |
|
104 | + $editable_roles = get_editable_roles(); |
|
105 | + $role = false; |
|
106 | + if ( ! empty( $_REQUEST['new_role2'] ) ) { |
|
107 | + $role = $_REQUEST['new_role2']; |
|
108 | + } elseif ( ! empty( $_REQUEST['new_role'] ) ) { |
|
109 | + $role = $_REQUEST['new_role']; |
|
137 | 110 | } |
138 | 111 | |
139 | - $user = get_userdata( $id ); |
|
140 | - $user->set_role( $role ); |
|
141 | - } |
|
112 | + if ( ! $role || empty( $editable_roles[ $role ] ) ) { |
|
113 | + wp_die( __( 'You can’t give users that role.' ) ); |
|
114 | + } |
|
142 | 115 | |
143 | - wp_redirect(add_query_arg('update', $update, $redirect)); |
|
144 | - exit(); |
|
116 | + $userids = $_REQUEST['users']; |
|
117 | + $update = 'promote'; |
|
118 | + foreach ( $userids as $id ) { |
|
119 | + $id = (int) $id; |
|
120 | + |
|
121 | + if ( ! current_user_can('promote_user', $id) ) |
|
122 | + wp_die(__('You can’t edit that user.')); |
|
123 | + // The new role of the current user must also have the promote_users cap or be a multisite super admin |
|
124 | + if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users') |
|
125 | + && ! ( is_multisite() && is_super_admin() ) ) { |
|
126 | + $update = 'err_admin_role'; |
|
127 | + continue; |
|
128 | + } |
|
145 | 129 | |
146 | -case 'dodelete': |
|
147 | - if ( is_multisite() ) |
|
148 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
130 | + // If the user doesn't already belong to the blog, bail. |
|
131 | + if ( is_multisite() && !is_user_member_of_blog( $id ) ) { |
|
132 | + wp_die( |
|
133 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
134 | + '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', |
|
135 | + 403 |
|
136 | + ); |
|
137 | + } |
|
149 | 138 | |
150 | - check_admin_referer('delete-users'); |
|
139 | + $user = get_userdata( $id ); |
|
140 | + $user->set_role( $role ); |
|
141 | + } |
|
151 | 142 | |
152 | - if ( empty($_REQUEST['users']) ) { |
|
153 | - wp_redirect($redirect); |
|
143 | + wp_redirect(add_query_arg('update', $update, $redirect)); |
|
154 | 144 | exit(); |
155 | - } |
|
156 | 145 | |
157 | - $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
146 | + case 'dodelete': |
|
147 | + if ( is_multisite() ) |
|
148 | + wp_die( __('User deletion is not allowed from this screen.') ); |
|
158 | 149 | |
159 | - if ( empty( $_REQUEST['delete_option'] ) ) { |
|
160 | - $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' ); |
|
161 | - $url = str_replace( '&', '&', wp_nonce_url( $url, 'bulk-users' ) ); |
|
162 | - wp_redirect( $url ); |
|
163 | - exit; |
|
164 | - } |
|
165 | - |
|
166 | - if ( ! current_user_can( 'delete_users' ) ) |
|
167 | - wp_die(__('You can’t delete users.')); |
|
150 | + check_admin_referer('delete-users'); |
|
168 | 151 | |
169 | - $update = 'del'; |
|
170 | - $delete_count = 0; |
|
152 | + if ( empty($_REQUEST['users']) ) { |
|
153 | + wp_redirect($redirect); |
|
154 | + exit(); |
|
155 | + } |
|
171 | 156 | |
172 | - foreach ( $userids as $id ) { |
|
173 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
174 | - wp_die(__( 'You can’t delete that user.' ) ); |
|
157 | + $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
175 | 158 | |
176 | - if ( $id == $current_user->ID ) { |
|
177 | - $update = 'err_admin_del'; |
|
178 | - continue; |
|
179 | - } |
|
180 | - switch ( $_REQUEST['delete_option'] ) { |
|
181 | - case 'delete': |
|
182 | - wp_delete_user( $id ); |
|
183 | - break; |
|
184 | - case 'reassign': |
|
185 | - wp_delete_user( $id, $_REQUEST['reassign_user'] ); |
|
186 | - break; |
|
159 | + if ( empty( $_REQUEST['delete_option'] ) ) { |
|
160 | + $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' ); |
|
161 | + $url = str_replace( '&', '&', wp_nonce_url( $url, 'bulk-users' ) ); |
|
162 | + wp_redirect( $url ); |
|
163 | + exit; |
|
187 | 164 | } |
165 | + |
|
166 | + if ( ! current_user_can( 'delete_users' ) ) |
|
167 | + wp_die(__('You can’t delete users.')); |
|
168 | + |
|
169 | + $update = 'del'; |
|
170 | + $delete_count = 0; |
|
171 | + |
|
172 | + foreach ( $userids as $id ) { |
|
173 | + if ( ! current_user_can( 'delete_user', $id ) ) |
|
174 | + wp_die(__( 'You can’t delete that user.' ) ); |
|
175 | + |
|
176 | + if ( $id == $current_user->ID ) { |
|
177 | + $update = 'err_admin_del'; |
|
178 | + continue; |
|
179 | + } |
|
180 | + switch ( $_REQUEST['delete_option'] ) { |
|
181 | + case 'delete': |
|
182 | + wp_delete_user( $id ); |
|
183 | + break; |
|
184 | + case 'reassign': |
|
185 | + wp_delete_user( $id, $_REQUEST['reassign_user'] ); |
|
186 | + break; |
|
187 | + } |
|
188 | 188 | ++$delete_count; |
189 | 189 | } |
190 | 190 | |
@@ -192,95 +192,95 @@ discard block |
||
192 | 192 | wp_redirect($redirect); |
193 | 193 | exit(); |
194 | 194 | |
195 | -case 'delete': |
|
196 | - if ( is_multisite() ) |
|
197 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
195 | + case 'delete': |
|
196 | + if ( is_multisite() ) |
|
197 | + wp_die( __('User deletion is not allowed from this screen.') ); |
|
198 | 198 | |
199 | - check_admin_referer('bulk-users'); |
|
199 | + check_admin_referer('bulk-users'); |
|
200 | 200 | |
201 | - if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
202 | - wp_redirect($redirect); |
|
203 | - exit(); |
|
204 | - } |
|
201 | + if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
202 | + wp_redirect($redirect); |
|
203 | + exit(); |
|
204 | + } |
|
205 | 205 | |
206 | - if ( ! current_user_can( 'delete_users' ) ) |
|
207 | - $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); |
|
206 | + if ( ! current_user_can( 'delete_users' ) ) |
|
207 | + $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); |
|
208 | 208 | |
209 | - if ( empty($_REQUEST['users']) ) |
|
210 | - $userids = array( intval( $_REQUEST['user'] ) ); |
|
211 | - else |
|
212 | - $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
209 | + if ( empty($_REQUEST['users']) ) |
|
210 | + $userids = array( intval( $_REQUEST['user'] ) ); |
|
211 | + else |
|
212 | + $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
213 | 213 | |
214 | - $users_have_content = false; |
|
215 | - if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
216 | - $users_have_content = true; |
|
217 | - } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
218 | - $users_have_content = true; |
|
219 | - } |
|
214 | + $users_have_content = false; |
|
215 | + if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
216 | + $users_have_content = true; |
|
217 | + } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
218 | + $users_have_content = true; |
|
219 | + } |
|
220 | 220 | |
221 | - if ( $users_have_content ) { |
|
222 | - add_action( 'admin_head', 'delete_users_add_js' ); |
|
223 | - } |
|
221 | + if ( $users_have_content ) { |
|
222 | + add_action( 'admin_head', 'delete_users_add_js' ); |
|
223 | + } |
|
224 | 224 | |
225 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
226 | -?> |
|
227 | -<form method="post" name="updateusers" id="updateusers"> |
|
228 | -<?php wp_nonce_field('delete-users') ?> |
|
229 | -<?php echo $referer; ?> |
|
225 | + include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
226 | + ?> |
|
227 | + <form method="post" name="updateusers" id="updateusers"> |
|
228 | + <?php wp_nonce_field('delete-users') ?> |
|
229 | + <?php echo $referer; ?> |
|
230 | 230 | |
231 | 231 | <div class="wrap"> |
232 | 232 | <h1><?php _e( 'Delete Users' ); ?></h1> |
233 | -<?php if ( isset( $_REQUEST['error'] ) ) : ?> |
|
233 | + <?php if ( isset( $_REQUEST['error'] ) ) : ?> |
|
234 | 234 | <div class="error"> |
235 | 235 | <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p> |
236 | 236 | </div> |
237 | 237 | <?php endif; ?> |
238 | - |
|
239 | -<?php if ( 1 == count( $userids ) ) : ?> |
|
240 | - <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
|
241 | -<?php else : ?> |
|
242 | - <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
|
243 | -<?php endif; ?> |
|
238 | + |
|
239 | + <?php if ( 1 == count( $userids ) ) : ?> |
|
240 | + <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
|
241 | + <?php else : ?> |
|
242 | + <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
|
243 | + <?php endif; ?> |
|
244 | 244 | |
245 | 245 | <ul> |
246 | 246 | <?php |
247 | - $go_delete = 0; |
|
248 | - foreach ( $userids as $id ) { |
|
249 | - $user = get_userdata( $id ); |
|
250 | - if ( $id == $current_user->ID ) { |
|
251 | - /* translators: 1: user id, 2: user login */ |
|
252 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
253 | - } else { |
|
254 | - /* translators: 1: user id, 2: user login */ |
|
255 | - echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
256 | - $go_delete++; |
|
247 | + $go_delete = 0; |
|
248 | + foreach ( $userids as $id ) { |
|
249 | + $user = get_userdata( $id ); |
|
250 | + if ( $id == $current_user->ID ) { |
|
251 | + /* translators: 1: user id, 2: user login */ |
|
252 | + echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
253 | + } else { |
|
254 | + /* translators: 1: user id, 2: user login */ |
|
255 | + echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
256 | + $go_delete++; |
|
257 | + } |
|
257 | 258 | } |
258 | - } |
|
259 | - ?> |
|
260 | - </ul> |
|
261 | -<?php if ( $go_delete ) : |
|
259 | + ?> |
|
260 | + </ul> |
|
261 | + <?php if ( $go_delete ) : |
|
262 | 262 | |
263 | - if ( ! $users_have_content ) : ?> |
|
264 | - <input type="hidden" name="delete_option" value="delete" /> |
|
263 | + if ( ! $users_have_content ) : ?> |
|
264 | + <input type="hidden" name="delete_option" value="delete" /> |
|
265 | 265 | <?php else: ?> |
266 | - <?php if ( 1 == $go_delete ) : ?> |
|
267 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p> |
|
266 | + <?php if ( 1 == $go_delete ) : ?> |
|
267 | + <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p> |
|
268 | 268 | <?php else : ?> |
269 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p> |
|
269 | + <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p> |
|
270 | 270 | <?php endif; ?> |
271 | 271 | <ul style="list-style:none;"> |
272 | 272 | <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" /> |
273 | 273 | <?php _e('Delete all content.'); ?></label></li> |
274 | 274 | <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" /> |
275 | 275 | <?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> '; |
276 | - wp_dropdown_users( array( |
|
277 | - 'name' => 'reassign_user', |
|
278 | - 'exclude' => array_diff( $userids, array( $current_user->ID ) ), |
|
279 | - 'show' => 'display_name_with_login', |
|
280 | - ) ); ?></li> |
|
276 | + wp_dropdown_users( array( |
|
277 | + 'name' => 'reassign_user', |
|
278 | + 'exclude' => array_diff( $userids, array( $current_user->ID ) ), |
|
279 | + 'show' => 'display_name_with_login', |
|
280 | + ) ); ?></li> |
|
281 | 281 | </ul></fieldset> |
282 | 282 | <?php endif; |
283 | - /** |
|
283 | + /** |
|
284 | 284 | * Fires at the end of the delete users form prior to the confirm button. |
285 | 285 | * |
286 | 286 | * @since 4.0.0 |
@@ -289,178 +289,178 @@ discard block |
||
289 | 289 | * @param WP_User $current_user WP_User object for the current user. |
290 | 290 | * @param array $userids Array of IDs for users being deleted. |
291 | 291 | */ |
292 | - do_action( 'delete_user_form', $current_user, $userids ); |
|
293 | - ?> |
|
294 | - <input type="hidden" name="action" value="dodelete" /> |
|
292 | + do_action( 'delete_user_form', $current_user, $userids ); |
|
293 | + ?> |
|
294 | + <input type="hidden" name="action" value="dodelete" /> |
|
295 | 295 | <?php submit_button( __('Confirm Deletion'), 'primary' ); ?> |
296 | -<?php else : ?> |
|
297 | - <p><?php _e('There are no valid users selected for deletion.'); ?></p> |
|
298 | -<?php endif; ?> |
|
296 | + <?php else : ?> |
|
297 | + <p><?php _e('There are no valid users selected for deletion.'); ?></p> |
|
298 | + <?php endif; ?> |
|
299 | 299 | </div> |
300 | 300 | </form> |
301 | 301 | <?php |
302 | 302 | |
303 | -break; |
|
303 | + break; |
|
304 | 304 | |
305 | -case 'doremove': |
|
306 | - check_admin_referer('remove-users'); |
|
305 | + case 'doremove': |
|
306 | + check_admin_referer('remove-users'); |
|
307 | 307 | |
308 | - if ( ! is_multisite() ) |
|
309 | - wp_die( __( 'You can’t remove users.' ) ); |
|
308 | + if ( ! is_multisite() ) |
|
309 | + wp_die( __( 'You can’t remove users.' ) ); |
|
310 | 310 | |
311 | - if ( empty($_REQUEST['users']) ) { |
|
312 | - wp_redirect($redirect); |
|
313 | - exit; |
|
314 | - } |
|
311 | + if ( empty($_REQUEST['users']) ) { |
|
312 | + wp_redirect($redirect); |
|
313 | + exit; |
|
314 | + } |
|
315 | 315 | |
316 | - if ( ! current_user_can( 'remove_users' ) ) |
|
317 | - wp_die( __( 'You can’t remove users.' ) ); |
|
316 | + if ( ! current_user_can( 'remove_users' ) ) |
|
317 | + wp_die( __( 'You can’t remove users.' ) ); |
|
318 | 318 | |
319 | - $userids = $_REQUEST['users']; |
|
319 | + $userids = $_REQUEST['users']; |
|
320 | 320 | |
321 | - $update = 'remove'; |
|
322 | - foreach ( $userids as $id ) { |
|
323 | - $id = (int) $id; |
|
324 | - if ( $id == $current_user->ID && !is_super_admin() ) { |
|
325 | - $update = 'err_admin_remove'; |
|
326 | - continue; |
|
327 | - } |
|
328 | - if ( !current_user_can('remove_user', $id) ) { |
|
329 | - $update = 'err_admin_remove'; |
|
330 | - continue; |
|
321 | + $update = 'remove'; |
|
322 | + foreach ( $userids as $id ) { |
|
323 | + $id = (int) $id; |
|
324 | + if ( $id == $current_user->ID && !is_super_admin() ) { |
|
325 | + $update = 'err_admin_remove'; |
|
326 | + continue; |
|
327 | + } |
|
328 | + if ( !current_user_can('remove_user', $id) ) { |
|
329 | + $update = 'err_admin_remove'; |
|
330 | + continue; |
|
331 | + } |
|
332 | + remove_user_from_blog($id, $blog_id); |
|
331 | 333 | } |
332 | - remove_user_from_blog($id, $blog_id); |
|
333 | - } |
|
334 | 334 | |
335 | - $redirect = add_query_arg( array('update' => $update), $redirect); |
|
336 | - wp_redirect($redirect); |
|
337 | - exit; |
|
335 | + $redirect = add_query_arg( array('update' => $update), $redirect); |
|
336 | + wp_redirect($redirect); |
|
337 | + exit; |
|
338 | 338 | |
339 | -case 'remove': |
|
339 | + case 'remove': |
|
340 | 340 | |
341 | - check_admin_referer('bulk-users'); |
|
341 | + check_admin_referer('bulk-users'); |
|
342 | 342 | |
343 | - if ( ! is_multisite() ) |
|
344 | - wp_die( __( 'You can’t remove users.' ) ); |
|
343 | + if ( ! is_multisite() ) |
|
344 | + wp_die( __( 'You can’t remove users.' ) ); |
|
345 | 345 | |
346 | - if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
347 | - wp_redirect($redirect); |
|
348 | - exit(); |
|
349 | - } |
|
346 | + if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
347 | + wp_redirect($redirect); |
|
348 | + exit(); |
|
349 | + } |
|
350 | 350 | |
351 | - if ( !current_user_can('remove_users') ) |
|
352 | - $error = new WP_Error('edit_users', __('You can’t remove users.')); |
|
351 | + if ( !current_user_can('remove_users') ) |
|
352 | + $error = new WP_Error('edit_users', __('You can’t remove users.')); |
|
353 | 353 | |
354 | - if ( empty($_REQUEST['users']) ) |
|
355 | - $userids = array(intval($_REQUEST['user'])); |
|
356 | - else |
|
357 | - $userids = $_REQUEST['users']; |
|
354 | + if ( empty($_REQUEST['users']) ) |
|
355 | + $userids = array(intval($_REQUEST['user'])); |
|
356 | + else |
|
357 | + $userids = $_REQUEST['users']; |
|
358 | 358 | |
359 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
360 | -?> |
|
361 | -<form method="post" name="updateusers" id="updateusers"> |
|
362 | -<?php wp_nonce_field('remove-users') ?> |
|
363 | -<?php echo $referer; ?> |
|
359 | + include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
360 | + ?> |
|
361 | + <form method="post" name="updateusers" id="updateusers"> |
|
362 | + <?php wp_nonce_field('remove-users') ?> |
|
363 | + <?php echo $referer; ?> |
|
364 | 364 | |
365 | 365 | <div class="wrap"> |
366 | 366 | <h1><?php _e( 'Remove Users from Site' ); ?></h1> |
367 | 367 | |
368 | -<?php if ( 1 == count( $userids ) ) : ?> |
|
369 | - <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
|
370 | -<?php else : ?> |
|
371 | - <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
|
372 | -<?php endif; ?> |
|
368 | + <?php if ( 1 == count( $userids ) ) : ?> |
|
369 | + <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
|
370 | + <?php else : ?> |
|
371 | + <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
|
372 | + <?php endif; ?> |
|
373 | 373 | |
374 | 374 | <ul> |
375 | 375 | <?php |
376 | - $go_remove = false; |
|
377 | - foreach ( $userids as $id ) { |
|
378 | - $id = (int) $id; |
|
379 | - $user = get_userdata( $id ); |
|
380 | - if ( $id == $current_user->ID && !is_super_admin() ) { |
|
381 | - /* translators: 1: user id, 2: user login */ |
|
382 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
383 | - } elseif ( !current_user_can('remove_user', $id) ) { |
|
384 | - /* translators: 1: user id, 2: user login */ |
|
385 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don’t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
386 | - } else { |
|
387 | - /* translators: 1: user id, 2: user login */ |
|
388 | - echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
389 | - $go_remove = true; |
|
390 | - } |
|
391 | - } |
|
392 | - ?> |
|
393 | -</ul> |
|
394 | -<?php if ( $go_remove ) : ?> |
|
395 | - <input type="hidden" name="action" value="doremove" /> |
|
376 | + $go_remove = false; |
|
377 | + foreach ( $userids as $id ) { |
|
378 | + $id = (int) $id; |
|
379 | + $user = get_userdata( $id ); |
|
380 | + if ( $id == $current_user->ID && !is_super_admin() ) { |
|
381 | + /* translators: 1: user id, 2: user login */ |
|
382 | + echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
383 | + } elseif ( !current_user_can('remove_user', $id) ) { |
|
384 | + /* translators: 1: user id, 2: user login */ |
|
385 | + echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don’t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
386 | + } else { |
|
387 | + /* translators: 1: user id, 2: user login */ |
|
388 | + echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
389 | + $go_remove = true; |
|
390 | + } |
|
391 | + } |
|
392 | + ?> |
|
393 | + </ul> |
|
394 | + <?php if ( $go_remove ) : ?> |
|
395 | + <input type="hidden" name="action" value="doremove" /> |
|
396 | 396 | <?php submit_button( __('Confirm Removal'), 'primary' ); ?> |
397 | -<?php else : ?> |
|
398 | - <p><?php _e('There are no valid users selected for removal.'); ?></p> |
|
399 | -<?php endif; ?> |
|
397 | + <?php else : ?> |
|
398 | + <p><?php _e('There are no valid users selected for removal.'); ?></p> |
|
399 | + <?php endif; ?> |
|
400 | 400 | </div> |
401 | 401 | </form> |
402 | 402 | <?php |
403 | 403 | |
404 | -break; |
|
404 | + break; |
|
405 | 405 | |
406 | -default: |
|
406 | + default: |
|
407 | 407 | |
408 | - if ( !empty($_GET['_wp_http_referer']) ) { |
|
409 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
410 | - exit; |
|
411 | - } |
|
412 | - |
|
413 | - $wp_list_table->prepare_items(); |
|
414 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
415 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
416 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
417 | - exit; |
|
418 | - } |
|
408 | + if ( !empty($_GET['_wp_http_referer']) ) { |
|
409 | + wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
410 | + exit; |
|
411 | + } |
|
419 | 412 | |
420 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
413 | + $wp_list_table->prepare_items(); |
|
414 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
415 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
416 | + wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
417 | + exit; |
|
418 | + } |
|
421 | 419 | |
422 | - $messages = array(); |
|
423 | - if ( isset($_GET['update']) ) : |
|
424 | - switch($_GET['update']) { |
|
425 | - case 'del': |
|
426 | - case 'del_many': |
|
427 | - $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0; |
|
428 | - if ( 1 == $delete_count ) { |
|
429 | - $message = __( 'User deleted.' ); |
|
430 | - } else { |
|
431 | - $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); |
|
420 | + include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
421 | + |
|
422 | + $messages = array(); |
|
423 | + if ( isset($_GET['update']) ) : |
|
424 | + switch($_GET['update']) { |
|
425 | + case 'del': |
|
426 | + case 'del_many': |
|
427 | + $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0; |
|
428 | + if ( 1 == $delete_count ) { |
|
429 | + $message = __( 'User deleted.' ); |
|
430 | + } else { |
|
431 | + $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); |
|
432 | + } |
|
433 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; |
|
434 | + break; |
|
435 | + case 'add': |
|
436 | + if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { |
|
437 | + /* translators: %s: edit page url */ |
|
438 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ), |
|
439 | + esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
|
440 | + self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>'; |
|
441 | + } else { |
|
442 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>'; |
|
443 | + } |
|
444 | + break; |
|
445 | + case 'promote': |
|
446 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>'; |
|
447 | + break; |
|
448 | + case 'err_admin_role': |
|
449 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user’s role must have user editing capabilities.') . '</p></div>'; |
|
450 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>'; |
|
451 | + break; |
|
452 | + case 'err_admin_del': |
|
453 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can’t delete the current user.') . '</p></div>'; |
|
454 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>'; |
|
455 | + break; |
|
456 | + case 'remove': |
|
457 | + $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>'; |
|
458 | + break; |
|
459 | + case 'err_admin_remove': |
|
460 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>'; |
|
461 | + $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>'; |
|
462 | + break; |
|
432 | 463 | } |
433 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; |
|
434 | - break; |
|
435 | - case 'add': |
|
436 | - if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { |
|
437 | - /* translators: %s: edit page url */ |
|
438 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ), |
|
439 | - esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
|
440 | - self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>'; |
|
441 | - } else { |
|
442 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>'; |
|
443 | - } |
|
444 | - break; |
|
445 | - case 'promote': |
|
446 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>'; |
|
447 | - break; |
|
448 | - case 'err_admin_role': |
|
449 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user’s role must have user editing capabilities.') . '</p></div>'; |
|
450 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>'; |
|
451 | - break; |
|
452 | - case 'err_admin_del': |
|
453 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can’t delete the current user.') . '</p></div>'; |
|
454 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>'; |
|
455 | - break; |
|
456 | - case 'remove': |
|
457 | - $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>'; |
|
458 | - break; |
|
459 | - case 'err_admin_remove': |
|
460 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>'; |
|
461 | - $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>'; |
|
462 | - break; |
|
463 | - } |
|
464 | 464 | endif; ?> |
465 | 465 | |
466 | 466 | <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?> |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! current_user_can( 'list_users' ) ) { |
|
13 | +if ( ! current_user_can('list_users')) { |
|
14 | 14 | wp_die( |
15 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
16 | - '<p>' . __( 'You are not allowed to browse users.' ) . '</p>', |
|
15 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
16 | + '<p>'.__('You are not allowed to browse users.').'</p>', |
|
17 | 17 | 403 |
18 | 18 | ); |
19 | 19 | } |
@@ -23,63 +23,63 @@ discard block |
||
23 | 23 | $title = __('Users'); |
24 | 24 | $parent_file = 'users.php'; |
25 | 25 | |
26 | -add_screen_option( 'per_page' ); |
|
26 | +add_screen_option('per_page'); |
|
27 | 27 | |
28 | 28 | // contextual help - choose Help on the top right of admin panel to preview this. |
29 | -get_current_screen()->add_help_tab( array( |
|
29 | +get_current_screen()->add_help_tab(array( |
|
30 | 30 | 'id' => 'overview', |
31 | 31 | 'title' => __('Overview'), |
32 | - 'content' => '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' . |
|
33 | - '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>' |
|
34 | -) ) ; |
|
32 | + 'content' => '<p>'.__('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.').'</p>'. |
|
33 | + '<p>'.__('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.').'</p>' |
|
34 | +)); |
|
35 | 35 | |
36 | -get_current_screen()->add_help_tab( array( |
|
36 | +get_current_screen()->add_help_tab(array( |
|
37 | 37 | 'id' => 'screen-display', |
38 | 38 | 'title' => __('Screen Display'), |
39 | - 'content' => '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' . |
|
40 | - '<ul>' . |
|
41 | - '<li>' . __('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.') . '</li>' . |
|
42 | - '<li>' . __('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.') . '</li>' . |
|
43 | - '<li>' . __('You can view all posts made by a user by clicking on the number under the Posts column.') . '</li>' . |
|
39 | + 'content' => '<p>'.__('You can customize the display of this screen in a number of ways:').'</p>'. |
|
40 | + '<ul>'. |
|
41 | + '<li>'.__('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.').'</li>'. |
|
42 | + '<li>'.__('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.').'</li>'. |
|
43 | + '<li>'.__('You can view all posts made by a user by clicking on the number under the Posts column.').'</li>'. |
|
44 | 44 | '</ul>' |
45 | -) ); |
|
45 | +)); |
|
46 | 46 | |
47 | -$help = '<p>' . __('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:') . '</p>' . |
|
48 | - '<ul>' . |
|
49 | - '<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>'; |
|
47 | +$help = '<p>'.__('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:').'</p>'. |
|
48 | + '<ul>'. |
|
49 | + '<li>'.__('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.').'</li>'; |
|
50 | 50 | |
51 | -if ( is_multisite() ) |
|
52 | - $help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>'; |
|
51 | +if (is_multisite()) |
|
52 | + $help .= '<li>'.__('Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.').'</li>'; |
|
53 | 53 | else |
54 | - $help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>'; |
|
54 | + $help .= '<li>'.__('Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.').'</li>'; |
|
55 | 55 | |
56 | 56 | $help .= '</ul>'; |
57 | 57 | |
58 | -get_current_screen()->add_help_tab( array( |
|
58 | +get_current_screen()->add_help_tab(array( |
|
59 | 59 | 'id' => 'actions', |
60 | 60 | 'title' => __('Actions'), |
61 | 61 | 'content' => $help, |
62 | -) ); |
|
63 | -unset( $help ); |
|
62 | +)); |
|
63 | +unset($help); |
|
64 | 64 | |
65 | 65 | get_current_screen()->set_help_sidebar( |
66 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
67 | - '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' . |
|
68 | - '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' . |
|
69 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
66 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
67 | + '<p>'.__('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>').'</p>'. |
|
68 | + '<p>'.__('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>').'</p>'. |
|
69 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
70 | 70 | ); |
71 | 71 | |
72 | -get_current_screen()->set_screen_reader_content( array( |
|
73 | - 'heading_views' => __( 'Filter users list' ), |
|
74 | - 'heading_pagination' => __( 'Users list navigation' ), |
|
75 | - 'heading_list' => __( 'Users list' ), |
|
76 | -) ); |
|
77 | - |
|
78 | -if ( empty($_REQUEST) ) { |
|
79 | - $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />'; |
|
80 | -} elseif ( isset($_REQUEST['wp_http_referer']) ) { |
|
81 | - $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) ); |
|
82 | - $referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />'; |
|
72 | +get_current_screen()->set_screen_reader_content(array( |
|
73 | + 'heading_views' => __('Filter users list'), |
|
74 | + 'heading_pagination' => __('Users list navigation'), |
|
75 | + 'heading_list' => __('Users list'), |
|
76 | +)); |
|
77 | + |
|
78 | +if (empty($_REQUEST)) { |
|
79 | + $referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />'; |
|
80 | +} elseif (isset($_REQUEST['wp_http_referer'])) { |
|
81 | + $redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash($_REQUEST['wp_http_referer'])); |
|
82 | + $referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr($redirect).'" />'; |
|
83 | 83 | } else { |
84 | 84 | $redirect = 'users.php'; |
85 | 85 | $referer = ''; |
@@ -87,197 +87,197 @@ discard block |
||
87 | 87 | |
88 | 88 | $update = ''; |
89 | 89 | |
90 | -switch ( $wp_list_table->current_action() ) { |
|
90 | +switch ($wp_list_table->current_action()) { |
|
91 | 91 | |
92 | 92 | /* Bulk Dropdown menu Role changes */ |
93 | 93 | case 'promote': |
94 | 94 | check_admin_referer('bulk-users'); |
95 | 95 | |
96 | - if ( ! current_user_can( 'promote_users' ) ) |
|
97 | - wp_die( __( 'You can’t edit that user.' ) ); |
|
96 | + if ( ! current_user_can('promote_users')) |
|
97 | + wp_die(__('You can’t edit that user.')); |
|
98 | 98 | |
99 | - if ( empty($_REQUEST['users']) ) { |
|
99 | + if (empty($_REQUEST['users'])) { |
|
100 | 100 | wp_redirect($redirect); |
101 | 101 | exit(); |
102 | 102 | } |
103 | 103 | |
104 | 104 | $editable_roles = get_editable_roles(); |
105 | 105 | $role = false; |
106 | - if ( ! empty( $_REQUEST['new_role2'] ) ) { |
|
106 | + if ( ! empty($_REQUEST['new_role2'])) { |
|
107 | 107 | $role = $_REQUEST['new_role2']; |
108 | - } elseif ( ! empty( $_REQUEST['new_role'] ) ) { |
|
108 | + } elseif ( ! empty($_REQUEST['new_role'])) { |
|
109 | 109 | $role = $_REQUEST['new_role']; |
110 | 110 | } |
111 | 111 | |
112 | - if ( ! $role || empty( $editable_roles[ $role ] ) ) { |
|
113 | - wp_die( __( 'You can’t give users that role.' ) ); |
|
112 | + if ( ! $role || empty($editable_roles[$role])) { |
|
113 | + wp_die(__('You can’t give users that role.')); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $userids = $_REQUEST['users']; |
117 | 117 | $update = 'promote'; |
118 | - foreach ( $userids as $id ) { |
|
118 | + foreach ($userids as $id) { |
|
119 | 119 | $id = (int) $id; |
120 | 120 | |
121 | - if ( ! current_user_can('promote_user', $id) ) |
|
121 | + if ( ! current_user_can('promote_user', $id)) |
|
122 | 122 | wp_die(__('You can’t edit that user.')); |
123 | 123 | // The new role of the current user must also have the promote_users cap or be a multisite super admin |
124 | - if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users') |
|
125 | - && ! ( is_multisite() && is_super_admin() ) ) { |
|
124 | + if ($id == $current_user->ID && ! $wp_roles->role_objects[$role]->has_cap('promote_users') |
|
125 | + && ! (is_multisite() && is_super_admin())) { |
|
126 | 126 | $update = 'err_admin_role'; |
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // If the user doesn't already belong to the blog, bail. |
131 | - if ( is_multisite() && !is_user_member_of_blog( $id ) ) { |
|
131 | + if (is_multisite() && ! is_user_member_of_blog($id)) { |
|
132 | 132 | wp_die( |
133 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
134 | - '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', |
|
133 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
134 | + '<p>'.__('One of the selected users is not a member of this site.').'</p>', |
|
135 | 135 | 403 |
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | - $user = get_userdata( $id ); |
|
140 | - $user->set_role( $role ); |
|
139 | + $user = get_userdata($id); |
|
140 | + $user->set_role($role); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | wp_redirect(add_query_arg('update', $update, $redirect)); |
144 | 144 | exit(); |
145 | 145 | |
146 | 146 | case 'dodelete': |
147 | - if ( is_multisite() ) |
|
148 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
147 | + if (is_multisite()) |
|
148 | + wp_die(__('User deletion is not allowed from this screen.')); |
|
149 | 149 | |
150 | 150 | check_admin_referer('delete-users'); |
151 | 151 | |
152 | - if ( empty($_REQUEST['users']) ) { |
|
152 | + if (empty($_REQUEST['users'])) { |
|
153 | 153 | wp_redirect($redirect); |
154 | 154 | exit(); |
155 | 155 | } |
156 | 156 | |
157 | - $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
157 | + $userids = array_map('intval', (array) $_REQUEST['users']); |
|
158 | 158 | |
159 | - if ( empty( $_REQUEST['delete_option'] ) ) { |
|
160 | - $url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' ); |
|
161 | - $url = str_replace( '&', '&', wp_nonce_url( $url, 'bulk-users' ) ); |
|
162 | - wp_redirect( $url ); |
|
159 | + if (empty($_REQUEST['delete_option'])) { |
|
160 | + $url = self_admin_url('users.php?action=delete&users[]='.implode('&users[]=', $userids).'&error=true'); |
|
161 | + $url = str_replace('&', '&', wp_nonce_url($url, 'bulk-users')); |
|
162 | + wp_redirect($url); |
|
163 | 163 | exit; |
164 | 164 | } |
165 | 165 | |
166 | - if ( ! current_user_can( 'delete_users' ) ) |
|
166 | + if ( ! current_user_can('delete_users')) |
|
167 | 167 | wp_die(__('You can’t delete users.')); |
168 | 168 | |
169 | 169 | $update = 'del'; |
170 | 170 | $delete_count = 0; |
171 | 171 | |
172 | - foreach ( $userids as $id ) { |
|
173 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
174 | - wp_die(__( 'You can’t delete that user.' ) ); |
|
172 | + foreach ($userids as $id) { |
|
173 | + if ( ! current_user_can('delete_user', $id)) |
|
174 | + wp_die(__('You can’t delete that user.')); |
|
175 | 175 | |
176 | - if ( $id == $current_user->ID ) { |
|
176 | + if ($id == $current_user->ID) { |
|
177 | 177 | $update = 'err_admin_del'; |
178 | 178 | continue; |
179 | 179 | } |
180 | - switch ( $_REQUEST['delete_option'] ) { |
|
180 | + switch ($_REQUEST['delete_option']) { |
|
181 | 181 | case 'delete': |
182 | - wp_delete_user( $id ); |
|
182 | + wp_delete_user($id); |
|
183 | 183 | break; |
184 | 184 | case 'reassign': |
185 | - wp_delete_user( $id, $_REQUEST['reassign_user'] ); |
|
185 | + wp_delete_user($id, $_REQUEST['reassign_user']); |
|
186 | 186 | break; |
187 | 187 | } |
188 | 188 | ++$delete_count; |
189 | 189 | } |
190 | 190 | |
191 | - $redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect); |
|
191 | + $redirect = add_query_arg(array('delete_count' => $delete_count, 'update' => $update), $redirect); |
|
192 | 192 | wp_redirect($redirect); |
193 | 193 | exit(); |
194 | 194 | |
195 | 195 | case 'delete': |
196 | - if ( is_multisite() ) |
|
197 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
196 | + if (is_multisite()) |
|
197 | + wp_die(__('User deletion is not allowed from this screen.')); |
|
198 | 198 | |
199 | 199 | check_admin_referer('bulk-users'); |
200 | 200 | |
201 | - if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
201 | + if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) { |
|
202 | 202 | wp_redirect($redirect); |
203 | 203 | exit(); |
204 | 204 | } |
205 | 205 | |
206 | - if ( ! current_user_can( 'delete_users' ) ) |
|
207 | - $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); |
|
206 | + if ( ! current_user_can('delete_users')) |
|
207 | + $errors = new WP_Error('edit_users', __('You can’t delete users.')); |
|
208 | 208 | |
209 | - if ( empty($_REQUEST['users']) ) |
|
210 | - $userids = array( intval( $_REQUEST['user'] ) ); |
|
209 | + if (empty($_REQUEST['users'])) |
|
210 | + $userids = array(intval($_REQUEST['user'])); |
|
211 | 211 | else |
212 | - $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
212 | + $userids = array_map('intval', (array) $_REQUEST['users']); |
|
213 | 213 | |
214 | 214 | $users_have_content = false; |
215 | - if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
215 | + if ($wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_author IN( ".implode(',', $userids)." ) LIMIT 1")) { |
|
216 | 216 | $users_have_content = true; |
217 | - } elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
|
217 | + } elseif ($wpdb->get_var("SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( ".implode(',', $userids)." ) LIMIT 1")) { |
|
218 | 218 | $users_have_content = true; |
219 | 219 | } |
220 | 220 | |
221 | - if ( $users_have_content ) { |
|
222 | - add_action( 'admin_head', 'delete_users_add_js' ); |
|
221 | + if ($users_have_content) { |
|
222 | + add_action('admin_head', 'delete_users_add_js'); |
|
223 | 223 | } |
224 | 224 | |
225 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
225 | + include(ABSPATH.'wp-admin/admin-header.php'); |
|
226 | 226 | ?> |
227 | 227 | <form method="post" name="updateusers" id="updateusers"> |
228 | 228 | <?php wp_nonce_field('delete-users') ?> |
229 | 229 | <?php echo $referer; ?> |
230 | 230 | |
231 | 231 | <div class="wrap"> |
232 | -<h1><?php _e( 'Delete Users' ); ?></h1> |
|
233 | -<?php if ( isset( $_REQUEST['error'] ) ) : ?> |
|
232 | +<h1><?php _e('Delete Users'); ?></h1> |
|
233 | +<?php if (isset($_REQUEST['error'])) : ?> |
|
234 | 234 | <div class="error"> |
235 | - <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p> |
|
235 | + <p><strong><?php _e('ERROR:'); ?></strong> <?php _e('Please select an option.'); ?></p> |
|
236 | 236 | </div> |
237 | 237 | <?php endif; ?> |
238 | 238 | |
239 | -<?php if ( 1 == count( $userids ) ) : ?> |
|
240 | - <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
|
239 | +<?php if (1 == count($userids)) : ?> |
|
240 | + <p><?php _e('You have specified this user for deletion:'); ?></p> |
|
241 | 241 | <?php else : ?> |
242 | - <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
|
242 | + <p><?php _e('You have specified these users for deletion:'); ?></p> |
|
243 | 243 | <?php endif; ?> |
244 | 244 | |
245 | 245 | <ul> |
246 | 246 | <?php |
247 | 247 | $go_delete = 0; |
248 | - foreach ( $userids as $id ) { |
|
249 | - $user = get_userdata( $id ); |
|
250 | - if ( $id == $current_user->ID ) { |
|
248 | + foreach ($userids as $id) { |
|
249 | + $user = get_userdata($id); |
|
250 | + if ($id == $current_user->ID) { |
|
251 | 251 | /* translators: 1: user id, 2: user login */ |
252 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
252 | + echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login)."</li>\n"; |
|
253 | 253 | } else { |
254 | 254 | /* translators: 1: user id, 2: user login */ |
255 | - echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
255 | + echo "<li><input type=\"hidden\" name=\"users[]\" value=\"".esc_attr($id)."\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n"; |
|
256 | 256 | $go_delete++; |
257 | 257 | } |
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </ul> |
261 | -<?php if ( $go_delete ) : |
|
261 | +<?php if ($go_delete) : |
|
262 | 262 | |
263 | - if ( ! $users_have_content ) : ?> |
|
263 | + if ( ! $users_have_content) : ?> |
|
264 | 264 | <input type="hidden" name="delete_option" value="delete" /> |
265 | 265 | <?php else: ?> |
266 | - <?php if ( 1 == $go_delete ) : ?> |
|
267 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p> |
|
266 | + <?php if (1 == $go_delete) : ?> |
|
267 | + <fieldset><p><legend><?php _e('What should be done with content owned by this user?'); ?></legend></p> |
|
268 | 268 | <?php else : ?> |
269 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p> |
|
269 | + <fieldset><p><legend><?php _e('What should be done with content owned by these users?'); ?></legend></p> |
|
270 | 270 | <?php endif; ?> |
271 | 271 | <ul style="list-style:none;"> |
272 | 272 | <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" /> |
273 | 273 | <?php _e('Delete all content.'); ?></label></li> |
274 | 274 | <li><input type="radio" id="delete_option1" name="delete_option" value="reassign" /> |
275 | - <?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> '; |
|
276 | - wp_dropdown_users( array( |
|
275 | + <?php echo '<label for="delete_option1">'.__('Attribute all content to:').'</label> '; |
|
276 | + wp_dropdown_users(array( |
|
277 | 277 | 'name' => 'reassign_user', |
278 | - 'exclude' => array_diff( $userids, array( $current_user->ID ) ), |
|
278 | + 'exclude' => array_diff($userids, array($current_user->ID)), |
|
279 | 279 | 'show' => 'display_name_with_login', |
280 | - ) ); ?></li> |
|
280 | + )); ?></li> |
|
281 | 281 | </ul></fieldset> |
282 | 282 | <?php endif; |
283 | 283 | /** |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | * @param WP_User $current_user WP_User object for the current user. |
290 | 290 | * @param array $userids Array of IDs for users being deleted. |
291 | 291 | */ |
292 | - do_action( 'delete_user_form', $current_user, $userids ); |
|
292 | + do_action('delete_user_form', $current_user, $userids); |
|
293 | 293 | ?> |
294 | 294 | <input type="hidden" name="action" value="dodelete" /> |
295 | - <?php submit_button( __('Confirm Deletion'), 'primary' ); ?> |
|
295 | + <?php submit_button(__('Confirm Deletion'), 'primary'); ?> |
|
296 | 296 | <?php else : ?> |
297 | 297 | <p><?php _e('There are no valid users selected for deletion.'); ?></p> |
298 | 298 | <?php endif; ?> |
@@ -305,34 +305,34 @@ discard block |
||
305 | 305 | case 'doremove': |
306 | 306 | check_admin_referer('remove-users'); |
307 | 307 | |
308 | - if ( ! is_multisite() ) |
|
309 | - wp_die( __( 'You can’t remove users.' ) ); |
|
308 | + if ( ! is_multisite()) |
|
309 | + wp_die(__('You can’t remove users.')); |
|
310 | 310 | |
311 | - if ( empty($_REQUEST['users']) ) { |
|
311 | + if (empty($_REQUEST['users'])) { |
|
312 | 312 | wp_redirect($redirect); |
313 | 313 | exit; |
314 | 314 | } |
315 | 315 | |
316 | - if ( ! current_user_can( 'remove_users' ) ) |
|
317 | - wp_die( __( 'You can’t remove users.' ) ); |
|
316 | + if ( ! current_user_can('remove_users')) |
|
317 | + wp_die(__('You can’t remove users.')); |
|
318 | 318 | |
319 | 319 | $userids = $_REQUEST['users']; |
320 | 320 | |
321 | 321 | $update = 'remove'; |
322 | - foreach ( $userids as $id ) { |
|
322 | + foreach ($userids as $id) { |
|
323 | 323 | $id = (int) $id; |
324 | - if ( $id == $current_user->ID && !is_super_admin() ) { |
|
324 | + if ($id == $current_user->ID && ! is_super_admin()) { |
|
325 | 325 | $update = 'err_admin_remove'; |
326 | 326 | continue; |
327 | 327 | } |
328 | - if ( !current_user_can('remove_user', $id) ) { |
|
328 | + if ( ! current_user_can('remove_user', $id)) { |
|
329 | 329 | $update = 'err_admin_remove'; |
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | remove_user_from_blog($id, $blog_id); |
333 | 333 | } |
334 | 334 | |
335 | - $redirect = add_query_arg( array('update' => $update), $redirect); |
|
335 | + $redirect = add_query_arg(array('update' => $update), $redirect); |
|
336 | 336 | wp_redirect($redirect); |
337 | 337 | exit; |
338 | 338 | |
@@ -340,60 +340,60 @@ discard block |
||
340 | 340 | |
341 | 341 | check_admin_referer('bulk-users'); |
342 | 342 | |
343 | - if ( ! is_multisite() ) |
|
344 | - wp_die( __( 'You can’t remove users.' ) ); |
|
343 | + if ( ! is_multisite()) |
|
344 | + wp_die(__('You can’t remove users.')); |
|
345 | 345 | |
346 | - if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
|
346 | + if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) { |
|
347 | 347 | wp_redirect($redirect); |
348 | 348 | exit(); |
349 | 349 | } |
350 | 350 | |
351 | - if ( !current_user_can('remove_users') ) |
|
351 | + if ( ! current_user_can('remove_users')) |
|
352 | 352 | $error = new WP_Error('edit_users', __('You can’t remove users.')); |
353 | 353 | |
354 | - if ( empty($_REQUEST['users']) ) |
|
354 | + if (empty($_REQUEST['users'])) |
|
355 | 355 | $userids = array(intval($_REQUEST['user'])); |
356 | 356 | else |
357 | 357 | $userids = $_REQUEST['users']; |
358 | 358 | |
359 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
359 | + include(ABSPATH.'wp-admin/admin-header.php'); |
|
360 | 360 | ?> |
361 | 361 | <form method="post" name="updateusers" id="updateusers"> |
362 | 362 | <?php wp_nonce_field('remove-users') ?> |
363 | 363 | <?php echo $referer; ?> |
364 | 364 | |
365 | 365 | <div class="wrap"> |
366 | -<h1><?php _e( 'Remove Users from Site' ); ?></h1> |
|
366 | +<h1><?php _e('Remove Users from Site'); ?></h1> |
|
367 | 367 | |
368 | -<?php if ( 1 == count( $userids ) ) : ?> |
|
369 | - <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
|
368 | +<?php if (1 == count($userids)) : ?> |
|
369 | + <p><?php _e('You have specified this user for removal:'); ?></p> |
|
370 | 370 | <?php else : ?> |
371 | - <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
|
371 | + <p><?php _e('You have specified these users for removal:'); ?></p> |
|
372 | 372 | <?php endif; ?> |
373 | 373 | |
374 | 374 | <ul> |
375 | 375 | <?php |
376 | 376 | $go_remove = false; |
377 | - foreach ( $userids as $id ) { |
|
377 | + foreach ($userids as $id) { |
|
378 | 378 | $id = (int) $id; |
379 | - $user = get_userdata( $id ); |
|
380 | - if ( $id == $current_user->ID && !is_super_admin() ) { |
|
379 | + $user = get_userdata($id); |
|
380 | + if ($id == $current_user->ID && ! is_super_admin()) { |
|
381 | 381 | /* translators: 1: user id, 2: user login */ |
382 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
383 | - } elseif ( !current_user_can('remove_user', $id) ) { |
|
382 | + echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login)."</li>\n"; |
|
383 | + } elseif ( ! current_user_can('remove_user', $id)) { |
|
384 | 384 | /* translators: 1: user id, 2: user login */ |
385 | - echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don’t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n"; |
|
385 | + echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>You don’t have permission to remove this user.</strong>'), $id, $user->user_login)."</li>\n"; |
|
386 | 386 | } else { |
387 | 387 | /* translators: 1: user id, 2: user login */ |
388 | - echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n"; |
|
388 | + echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n"; |
|
389 | 389 | $go_remove = true; |
390 | 390 | } |
391 | 391 | } |
392 | 392 | ?> |
393 | 393 | </ul> |
394 | -<?php if ( $go_remove ) : ?> |
|
394 | +<?php if ($go_remove) : ?> |
|
395 | 395 | <input type="hidden" name="action" value="doremove" /> |
396 | - <?php submit_button( __('Confirm Removal'), 'primary' ); ?> |
|
396 | + <?php submit_button(__('Confirm Removal'), 'primary'); ?> |
|
397 | 397 | <?php else : ?> |
398 | 398 | <p><?php _e('There are no valid users selected for removal.'); ?></p> |
399 | 399 | <?php endif; ?> |
@@ -405,93 +405,93 @@ discard block |
||
405 | 405 | |
406 | 406 | default: |
407 | 407 | |
408 | - if ( !empty($_GET['_wp_http_referer']) ) { |
|
409 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
408 | + if ( ! empty($_GET['_wp_http_referer'])) { |
|
409 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
410 | 410 | exit; |
411 | 411 | } |
412 | 412 | |
413 | 413 | $wp_list_table->prepare_items(); |
414 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
415 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
416 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
414 | + $total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
415 | + if ($pagenum > $total_pages && $total_pages > 0) { |
|
416 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
417 | 417 | exit; |
418 | 418 | } |
419 | 419 | |
420 | - include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
420 | + include(ABSPATH.'wp-admin/admin-header.php'); |
|
421 | 421 | |
422 | 422 | $messages = array(); |
423 | - if ( isset($_GET['update']) ) : |
|
424 | - switch($_GET['update']) { |
|
423 | + if (isset($_GET['update'])) : |
|
424 | + switch ($_GET['update']) { |
|
425 | 425 | case 'del': |
426 | 426 | case 'del_many': |
427 | 427 | $delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0; |
428 | - if ( 1 == $delete_count ) { |
|
429 | - $message = __( 'User deleted.' ); |
|
428 | + if (1 == $delete_count) { |
|
429 | + $message = __('User deleted.'); |
|
430 | 430 | } else { |
431 | - $message = _n( '%s user deleted.', '%s users deleted.', $delete_count ); |
|
431 | + $message = _n('%s user deleted.', '%s users deleted.', $delete_count); |
|
432 | 432 | } |
433 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; |
|
433 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($delete_count)).'</p></div>'; |
|
434 | 434 | break; |
435 | 435 | case 'add': |
436 | - if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { |
|
436 | + if (isset($_GET['id']) && ($user_id = $_GET['id']) && current_user_can('edit_user', $user_id)) { |
|
437 | 437 | /* translators: %s: edit page url */ |
438 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ), |
|
439 | - esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
|
440 | - self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>'; |
|
438 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf(__('New user created. <a href="%s">Edit user</a>'), |
|
439 | + esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), |
|
440 | + self_admin_url('user-edit.php?user_id='.$user_id)))).'</p></div>'; |
|
441 | 441 | } else { |
442 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>'; |
|
442 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('New user created.').'</p></div>'; |
|
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'promote': |
446 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>'; |
|
446 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Changed roles.').'</p></div>'; |
|
447 | 447 | break; |
448 | 448 | case 'err_admin_role': |
449 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user’s role must have user editing capabilities.') . '</p></div>'; |
|
450 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>'; |
|
449 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('The current user’s role must have user editing capabilities.').'</p></div>'; |
|
450 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other user roles have been changed.').'</p></div>'; |
|
451 | 451 | break; |
452 | 452 | case 'err_admin_del': |
453 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can’t delete the current user.') . '</p></div>'; |
|
454 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>'; |
|
453 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('You can’t delete the current user.').'</p></div>'; |
|
454 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other users have been deleted.').'</p></div>'; |
|
455 | 455 | break; |
456 | 456 | case 'remove': |
457 | - $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>'; |
|
457 | + $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('User removed from this site.').'</p></div>'; |
|
458 | 458 | break; |
459 | 459 | case 'err_admin_remove': |
460 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>'; |
|
461 | - $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>'; |
|
460 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__("You can't remove the current user.").'</p></div>'; |
|
461 | + $messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('Other users have been removed.').'</p></div>'; |
|
462 | 462 | break; |
463 | 463 | } |
464 | 464 | endif; ?> |
465 | 465 | |
466 | -<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?> |
|
466 | +<?php if (isset($errors) && is_wp_error($errors)) : ?> |
|
467 | 467 | <div class="error"> |
468 | 468 | <ul> |
469 | 469 | <?php |
470 | - foreach ( $errors->get_error_messages() as $err ) |
|
470 | + foreach ($errors->get_error_messages() as $err) |
|
471 | 471 | echo "<li>$err</li>\n"; |
472 | 472 | ?> |
473 | 473 | </ul> |
474 | 474 | </div> |
475 | 475 | <?php endif; |
476 | 476 | |
477 | -if ( ! empty($messages) ) { |
|
478 | - foreach ( $messages as $msg ) |
|
477 | +if ( ! empty($messages)) { |
|
478 | + foreach ($messages as $msg) |
|
479 | 479 | echo $msg; |
480 | 480 | } ?> |
481 | 481 | |
482 | 482 | <div class="wrap"> |
483 | 483 | <h1> |
484 | 484 | <?php |
485 | -echo esc_html( $title ); |
|
486 | -if ( current_user_can( 'create_users' ) ) { ?> |
|
487 | - <a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a> |
|
488 | -<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?> |
|
489 | - <a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a> |
|
485 | +echo esc_html($title); |
|
486 | +if (current_user_can('create_users')) { ?> |
|
487 | + <a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a> |
|
488 | +<?php } elseif (is_multisite() && current_user_can('promote_users')) { ?> |
|
489 | + <a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add Existing', 'user'); ?></a> |
|
490 | 490 | <?php } |
491 | 491 | |
492 | -if ( strlen( $usersearch ) ) { |
|
492 | +if (strlen($usersearch)) { |
|
493 | 493 | /* translators: %s: search keywords */ |
494 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); |
|
494 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($usersearch)); |
|
495 | 495 | } |
496 | 496 | ?> |
497 | 497 | </h1> |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | <form method="get"> |
502 | 502 | |
503 | -<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?> |
|
503 | +<?php $wp_list_table->search_box(__('Search Users'), 'user'); ?> |
|
504 | 504 | |
505 | 505 | <?php $wp_list_table->display(); ?> |
506 | 506 | </form> |
@@ -512,4 +512,4 @@ discard block |
||
512 | 512 | |
513 | 513 | } // end of the $doaction switch |
514 | 514 | |
515 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
515 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -48,10 +48,11 @@ discard block |
||
48 | 48 | '<ul>' . |
49 | 49 | '<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>'; |
50 | 50 | |
51 | -if ( is_multisite() ) |
|
51 | +if ( is_multisite() ) { |
|
52 | 52 | $help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>'; |
53 | -else |
|
53 | +} else { |
|
54 | 54 | $help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>'; |
55 | +} |
|
55 | 56 | |
56 | 57 | $help .= '</ul>'; |
57 | 58 | |
@@ -93,8 +94,9 @@ discard block |
||
93 | 94 | case 'promote': |
94 | 95 | check_admin_referer('bulk-users'); |
95 | 96 | |
96 | - if ( ! current_user_can( 'promote_users' ) ) |
|
97 | - wp_die( __( 'You can’t edit that user.' ) ); |
|
97 | + if ( ! current_user_can( 'promote_users' ) ) { |
|
98 | + wp_die( __( 'You can’t edit that user.' ) ); |
|
99 | + } |
|
98 | 100 | |
99 | 101 | if ( empty($_REQUEST['users']) ) { |
100 | 102 | wp_redirect($redirect); |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | foreach ( $userids as $id ) { |
119 | 121 | $id = (int) $id; |
120 | 122 | |
121 | - if ( ! current_user_can('promote_user', $id) ) |
|
122 | - wp_die(__('You can’t edit that user.')); |
|
123 | + if ( ! current_user_can('promote_user', $id) ) { |
|
124 | + wp_die(__('You can’t edit that user.')); |
|
125 | + } |
|
123 | 126 | // The new role of the current user must also have the promote_users cap or be a multisite super admin |
124 | 127 | if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users') |
125 | 128 | && ! ( is_multisite() && is_super_admin() ) ) { |
@@ -144,8 +147,9 @@ discard block |
||
144 | 147 | exit(); |
145 | 148 | |
146 | 149 | case 'dodelete': |
147 | - if ( is_multisite() ) |
|
148 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
150 | + if ( is_multisite() ) { |
|
151 | + wp_die( __('User deletion is not allowed from this screen.') ); |
|
152 | + } |
|
149 | 153 | |
150 | 154 | check_admin_referer('delete-users'); |
151 | 155 | |
@@ -163,15 +167,17 @@ discard block |
||
163 | 167 | exit; |
164 | 168 | } |
165 | 169 | |
166 | - if ( ! current_user_can( 'delete_users' ) ) |
|
167 | - wp_die(__('You can’t delete users.')); |
|
170 | + if ( ! current_user_can( 'delete_users' ) ) { |
|
171 | + wp_die(__('You can’t delete users.')); |
|
172 | + } |
|
168 | 173 | |
169 | 174 | $update = 'del'; |
170 | 175 | $delete_count = 0; |
171 | 176 | |
172 | 177 | foreach ( $userids as $id ) { |
173 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
174 | - wp_die(__( 'You can’t delete that user.' ) ); |
|
178 | + if ( ! current_user_can( 'delete_user', $id ) ) { |
|
179 | + wp_die(__( 'You can’t delete that user.' ) ); |
|
180 | + } |
|
175 | 181 | |
176 | 182 | if ( $id == $current_user->ID ) { |
177 | 183 | $update = 'err_admin_del'; |
@@ -193,8 +199,9 @@ discard block |
||
193 | 199 | exit(); |
194 | 200 | |
195 | 201 | case 'delete': |
196 | - if ( is_multisite() ) |
|
197 | - wp_die( __('User deletion is not allowed from this screen.') ); |
|
202 | + if ( is_multisite() ) { |
|
203 | + wp_die( __('User deletion is not allowed from this screen.') ); |
|
204 | + } |
|
198 | 205 | |
199 | 206 | check_admin_referer('bulk-users'); |
200 | 207 | |
@@ -203,13 +210,15 @@ discard block |
||
203 | 210 | exit(); |
204 | 211 | } |
205 | 212 | |
206 | - if ( ! current_user_can( 'delete_users' ) ) |
|
207 | - $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); |
|
213 | + if ( ! current_user_can( 'delete_users' ) ) { |
|
214 | + $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) ); |
|
215 | + } |
|
208 | 216 | |
209 | - if ( empty($_REQUEST['users']) ) |
|
210 | - $userids = array( intval( $_REQUEST['user'] ) ); |
|
211 | - else |
|
212 | - $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
217 | + if ( empty($_REQUEST['users']) ) { |
|
218 | + $userids = array( intval( $_REQUEST['user'] ) ); |
|
219 | + } else { |
|
220 | + $userids = array_map( 'intval', (array) $_REQUEST['users'] ); |
|
221 | + } |
|
213 | 222 | |
214 | 223 | $users_have_content = false; |
215 | 224 | if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) { |
@@ -238,8 +247,11 @@ discard block |
||
238 | 247 | |
239 | 248 | <?php if ( 1 == count( $userids ) ) : ?> |
240 | 249 | <p><?php _e( 'You have specified this user for deletion:' ); ?></p> |
241 | -<?php else : ?> |
|
242 | - <p><?php _e( 'You have specified these users for deletion:' ); ?></p> |
|
250 | +<?php else { |
|
251 | + : ?> |
|
252 | + <p><?php _e( 'You have specified these users for deletion:' ); |
|
253 | +} |
|
254 | +?></p> |
|
243 | 255 | <?php endif; ?> |
244 | 256 | |
245 | 257 | <ul> |
@@ -262,11 +274,17 @@ discard block |
||
262 | 274 | |
263 | 275 | if ( ! $users_have_content ) : ?> |
264 | 276 | <input type="hidden" name="delete_option" value="delete" /> |
265 | - <?php else: ?> |
|
277 | + <?php else { |
|
278 | + : ?> |
|
266 | 279 | <?php if ( 1 == $go_delete ) : ?> |
267 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p> |
|
268 | - <?php else : ?> |
|
269 | - <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p> |
|
280 | + <fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); |
|
281 | +} |
|
282 | +?></legend></p> |
|
283 | + <?php else { |
|
284 | + : ?> |
|
285 | + <fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); |
|
286 | +} |
|
287 | +?></legend></p> |
|
270 | 288 | <?php endif; ?> |
271 | 289 | <ul style="list-style:none;"> |
272 | 290 | <li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" /> |
@@ -293,8 +311,11 @@ discard block |
||
293 | 311 | ?> |
294 | 312 | <input type="hidden" name="action" value="dodelete" /> |
295 | 313 | <?php submit_button( __('Confirm Deletion'), 'primary' ); ?> |
296 | -<?php else : ?> |
|
297 | - <p><?php _e('There are no valid users selected for deletion.'); ?></p> |
|
314 | +<?php else { |
|
315 | + : ?> |
|
316 | + <p><?php _e('There are no valid users selected for deletion.'); |
|
317 | +} |
|
318 | +?></p> |
|
298 | 319 | <?php endif; ?> |
299 | 320 | </div> |
300 | 321 | </form> |
@@ -305,16 +326,18 @@ discard block |
||
305 | 326 | case 'doremove': |
306 | 327 | check_admin_referer('remove-users'); |
307 | 328 | |
308 | - if ( ! is_multisite() ) |
|
309 | - wp_die( __( 'You can’t remove users.' ) ); |
|
329 | + if ( ! is_multisite() ) { |
|
330 | + wp_die( __( 'You can’t remove users.' ) ); |
|
331 | + } |
|
310 | 332 | |
311 | 333 | if ( empty($_REQUEST['users']) ) { |
312 | 334 | wp_redirect($redirect); |
313 | 335 | exit; |
314 | 336 | } |
315 | 337 | |
316 | - if ( ! current_user_can( 'remove_users' ) ) |
|
317 | - wp_die( __( 'You can’t remove users.' ) ); |
|
338 | + if ( ! current_user_can( 'remove_users' ) ) { |
|
339 | + wp_die( __( 'You can’t remove users.' ) ); |
|
340 | + } |
|
318 | 341 | |
319 | 342 | $userids = $_REQUEST['users']; |
320 | 343 | |
@@ -340,21 +363,24 @@ discard block |
||
340 | 363 | |
341 | 364 | check_admin_referer('bulk-users'); |
342 | 365 | |
343 | - if ( ! is_multisite() ) |
|
344 | - wp_die( __( 'You can’t remove users.' ) ); |
|
366 | + if ( ! is_multisite() ) { |
|
367 | + wp_die( __( 'You can’t remove users.' ) ); |
|
368 | + } |
|
345 | 369 | |
346 | 370 | if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) { |
347 | 371 | wp_redirect($redirect); |
348 | 372 | exit(); |
349 | 373 | } |
350 | 374 | |
351 | - if ( !current_user_can('remove_users') ) |
|
352 | - $error = new WP_Error('edit_users', __('You can’t remove users.')); |
|
375 | + if ( !current_user_can('remove_users') ) { |
|
376 | + $error = new WP_Error('edit_users', __('You can’t remove users.')); |
|
377 | + } |
|
353 | 378 | |
354 | - if ( empty($_REQUEST['users']) ) |
|
355 | - $userids = array(intval($_REQUEST['user'])); |
|
356 | - else |
|
357 | - $userids = $_REQUEST['users']; |
|
379 | + if ( empty($_REQUEST['users']) ) { |
|
380 | + $userids = array(intval($_REQUEST['user'])); |
|
381 | + } else { |
|
382 | + $userids = $_REQUEST['users']; |
|
383 | + } |
|
358 | 384 | |
359 | 385 | include( ABSPATH . 'wp-admin/admin-header.php' ); |
360 | 386 | ?> |
@@ -367,8 +393,11 @@ discard block |
||
367 | 393 | |
368 | 394 | <?php if ( 1 == count( $userids ) ) : ?> |
369 | 395 | <p><?php _e( 'You have specified this user for removal:' ); ?></p> |
370 | -<?php else : ?> |
|
371 | - <p><?php _e( 'You have specified these users for removal:' ); ?></p> |
|
396 | +<?php else { |
|
397 | + : ?> |
|
398 | + <p><?php _e( 'You have specified these users for removal:' ); |
|
399 | +} |
|
400 | +?></p> |
|
372 | 401 | <?php endif; ?> |
373 | 402 | |
374 | 403 | <ul> |
@@ -394,8 +423,11 @@ discard block |
||
394 | 423 | <?php if ( $go_remove ) : ?> |
395 | 424 | <input type="hidden" name="action" value="doremove" /> |
396 | 425 | <?php submit_button( __('Confirm Removal'), 'primary' ); ?> |
397 | -<?php else : ?> |
|
398 | - <p><?php _e('There are no valid users selected for removal.'); ?></p> |
|
426 | +<?php else { |
|
427 | + : ?> |
|
428 | + <p><?php _e('There are no valid users selected for removal.'); |
|
429 | +} |
|
430 | +?></p> |
|
399 | 431 | <?php endif; ?> |
400 | 432 | </div> |
401 | 433 | </form> |
@@ -467,17 +499,19 @@ discard block |
||
467 | 499 | <div class="error"> |
468 | 500 | <ul> |
469 | 501 | <?php |
470 | - foreach ( $errors->get_error_messages() as $err ) |
|
471 | - echo "<li>$err</li>\n"; |
|
502 | + foreach ( $errors->get_error_messages() as $err ) { |
|
503 | + echo "<li>$err</li>\n"; |
|
504 | + } |
|
472 | 505 | ?> |
473 | 506 | </ul> |
474 | 507 | </div> |
475 | 508 | <?php endif; |
476 | 509 | |
477 | 510 | if ( ! empty($messages) ) { |
478 | - foreach ( $messages as $msg ) |
|
479 | - echo $msg; |
|
480 | -} ?> |
|
511 | + foreach ( $messages as $msg ) { |
|
512 | + echo $msg; |
|
513 | + } |
|
514 | + } ?> |
|
481 | 515 | |
482 | 516 | <div class="wrap"> |
483 | 517 | <h1> |
@@ -491,12 +491,12 @@ discard block |
||
491 | 491 | </div> |
492 | 492 | <form name="post" action="post.php" method="post" id="post"<?php |
493 | 493 | /** |
494 | - * Fires inside the post editor form tag. |
|
495 | - * |
|
496 | - * @since 3.0.0 |
|
497 | - * |
|
498 | - * @param WP_Post $post Post object. |
|
499 | - */ |
|
494 | + * Fires inside the post editor form tag. |
|
495 | + * |
|
496 | + * @since 3.0.0 |
|
497 | + * |
|
498 | + * @param WP_Post $post Post object. |
|
499 | + */ |
|
500 | 500 | do_action( 'post_edit_form_tag', $post ); |
501 | 501 | |
502 | 502 | $referer = wp_get_referer(); |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | </div> |
558 | 558 | <?php |
559 | 559 | /** |
560 | - * Fires before the permalink field in the edit form. |
|
561 | - * |
|
562 | - * @since 4.1.0 |
|
563 | - * |
|
564 | - * @param WP_Post $post Post object. |
|
565 | - */ |
|
560 | + * Fires before the permalink field in the edit form. |
|
561 | + * |
|
562 | + * @since 4.1.0 |
|
563 | + * |
|
564 | + * @param WP_Post $post Post object. |
|
565 | + */ |
|
566 | 566 | do_action( 'edit_form_before_permalink', $post ); |
567 | 567 | ?> |
568 | 568 | <div class="inside"> |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $shortlink = wp_get_shortlink($post->ID, 'post'); |
576 | 576 | |
577 | 577 | if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { |
578 | - $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
578 | + $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | <?php |
601 | 601 | } |
602 | 602 | /** |
603 | - * Fires after the title field. |
|
604 | - * |
|
605 | - * @since 3.5.0 |
|
606 | - * |
|
607 | - * @param WP_Post $post Post object. |
|
608 | - */ |
|
603 | + * Fires after the title field. |
|
604 | + * |
|
605 | + * @since 3.5.0 |
|
606 | + * |
|
607 | + * @param WP_Post $post Post object. |
|
608 | + */ |
|
609 | 609 | do_action( 'edit_form_after_title', $post ); |
610 | 610 | |
611 | 611 | if ( post_type_supports($post_type, 'editor') ) { |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | </div> |
645 | 645 | <?php } |
646 | 646 | /** |
647 | - * Fires after the content editor. |
|
648 | - * |
|
649 | - * @since 3.5.0 |
|
650 | - * |
|
651 | - * @param WP_Post $post Post object. |
|
652 | - */ |
|
647 | + * Fires after the content editor. |
|
648 | + * |
|
649 | + * @since 3.5.0 |
|
650 | + * |
|
651 | + * @param WP_Post $post Post object. |
|
652 | + */ |
|
653 | 653 | do_action( 'edit_form_after_editor', $post ); |
654 | 654 | ?> |
655 | 655 | </div><!-- /post-body-content --> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | |
13 | 13 | /** |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param bool $expand Whether to enable the 'expand' functionality. Default true. |
30 | 30 | * @param string $post_type Post type. |
31 | 31 | */ |
32 | -if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() && |
|
33 | - ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) && |
|
34 | - apply_filters( 'wp_editor_expand', true, $post_type ) ) { |
|
32 | +if (post_type_supports($post_type, 'editor') && ! wp_is_mobile() && |
|
33 | + ! ($is_IE && preg_match('/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'])) && |
|
34 | + apply_filters('wp_editor_expand', true, $post_type)) { |
|
35 | 35 | |
36 | 36 | wp_enqueue_script('editor-expand'); |
37 | 37 | $_content_editor_dfw = true; |
38 | - $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); |
|
38 | + $_wp_editor_expand = (get_user_setting('editor_expand', 'on') === 'on'); |
|
39 | 39 | } |
40 | 40 | |
41 | -if ( wp_is_mobile() ) |
|
42 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
41 | +if (wp_is_mobile()) |
|
42 | + wp_enqueue_script('jquery-touch-punch'); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Post ID global |
@@ -50,33 +50,33 @@ discard block |
||
50 | 50 | $user_ID = isset($user_ID) ? (int) $user_ID : 0; |
51 | 51 | $action = isset($action) ? $action : ''; |
52 | 52 | |
53 | -if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { |
|
54 | - add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); |
|
55 | - remove_post_type_support( $post_type, 'editor' ); |
|
53 | +if ($post_ID == get_option('page_for_posts') && empty($post->post_content)) { |
|
54 | + add_action('edit_form_after_title', '_wp_posts_page_notice'); |
|
55 | + remove_post_type_support($post_type, 'editor'); |
|
56 | 56 | } |
57 | 57 | |
58 | -$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); |
|
59 | -if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { |
|
60 | - if ( wp_attachment_is( 'audio', $post ) ) { |
|
61 | - $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); |
|
62 | - } elseif ( wp_attachment_is( 'video', $post ) ) { |
|
63 | - $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); |
|
58 | +$thumbnail_support = current_theme_supports('post-thumbnails', $post_type) && post_type_supports($post_type, 'thumbnail'); |
|
59 | +if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type) { |
|
60 | + if (wp_attachment_is('audio', $post)) { |
|
61 | + $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio'); |
|
62 | + } elseif (wp_attachment_is('video', $post)) { |
|
63 | + $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video'); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -if ( $thumbnail_support ) { |
|
67 | +if ($thumbnail_support) { |
|
68 | 68 | add_thickbox(); |
69 | - wp_enqueue_media( array( 'post' => $post_ID ) ); |
|
69 | + wp_enqueue_media(array('post' => $post_ID)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add the local autosave notice HTML |
73 | -add_action( 'admin_footer', '_local_storage_notice' ); |
|
73 | +add_action('admin_footer', '_local_storage_notice'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * @todo Document the $messages array(s). |
77 | 77 | */ |
78 | -$permalink = get_permalink( $post_ID ); |
|
79 | -if ( ! $permalink ) { |
|
78 | +$permalink = get_permalink($post_ID); |
|
79 | +if ( ! $permalink) { |
|
80 | 80 | $permalink = ''; |
81 | 81 | } |
82 | 82 | |
@@ -85,82 +85,82 @@ discard block |
||
85 | 85 | $preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = ''; |
86 | 86 | $preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = ''; |
87 | 87 | |
88 | -$preview_url = get_preview_post_link( $post ); |
|
88 | +$preview_url = get_preview_post_link($post); |
|
89 | 89 | |
90 | -$viewable = is_post_type_viewable( $post_type_object ); |
|
90 | +$viewable = is_post_type_viewable($post_type_object); |
|
91 | 91 | |
92 | -if ( $viewable ) { |
|
92 | +if ($viewable) { |
|
93 | 93 | |
94 | 94 | // Preview post link. |
95 | - $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
|
96 | - esc_url( $preview_url ), |
|
97 | - __( 'Preview post' ) |
|
95 | + $preview_post_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>', |
|
96 | + esc_url($preview_url), |
|
97 | + __('Preview post') |
|
98 | 98 | ); |
99 | 99 | |
100 | 100 | // Scheduled post preview link. |
101 | - $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
|
102 | - esc_url( $permalink ), |
|
103 | - __( 'Preview post' ) |
|
101 | + $scheduled_post_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>', |
|
102 | + esc_url($permalink), |
|
103 | + __('Preview post') |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | // View post link. |
107 | - $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>', |
|
108 | - esc_url( $permalink ), |
|
109 | - __( 'View post' ) |
|
107 | + $view_post_link_html = sprintf(' <a href="%1$s">%2$s</a>', |
|
108 | + esc_url($permalink), |
|
109 | + __('View post') |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | // Preview page link. |
113 | - $preview_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
|
114 | - esc_url( $preview_url ), |
|
115 | - __( 'Preview page' ) |
|
113 | + $preview_page_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>', |
|
114 | + esc_url($preview_url), |
|
115 | + __('Preview page') |
|
116 | 116 | ); |
117 | 117 | |
118 | 118 | // Scheduled page preview link. |
119 | - $scheduled_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>', |
|
120 | - esc_url( $permalink ), |
|
121 | - __( 'Preview page' ) |
|
119 | + $scheduled_page_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>', |
|
120 | + esc_url($permalink), |
|
121 | + __('Preview page') |
|
122 | 122 | ); |
123 | 123 | |
124 | 124 | // View page link. |
125 | - $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>', |
|
126 | - esc_url( $permalink ), |
|
127 | - __( 'View page' ) |
|
125 | + $view_page_link_html = sprintf(' <a href="%1$s">%2$s</a>', |
|
126 | + esc_url($permalink), |
|
127 | + __('View page') |
|
128 | 128 | ); |
129 | 129 | |
130 | 130 | } |
131 | 131 | |
132 | 132 | /* translators: Publish box date format, see http://php.net/date */ |
133 | -$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); |
|
133 | +$scheduled_date = date_i18n(__('M j, Y @ H:i'), strtotime($post->post_date)); |
|
134 | 134 | |
135 | 135 | $messages['post'] = array( |
136 | 136 | 0 => '', // Unused. Messages start at index 1. |
137 | - 1 => __( 'Post updated.' ) . $view_post_link_html, |
|
138 | - 2 => __( 'Custom field updated.' ), |
|
139 | - 3 => __( 'Custom field deleted.' ), |
|
140 | - 4 => __( 'Post updated.' ), |
|
137 | + 1 => __('Post updated.').$view_post_link_html, |
|
138 | + 2 => __('Custom field updated.'), |
|
139 | + 3 => __('Custom field deleted.'), |
|
140 | + 4 => __('Post updated.'), |
|
141 | 141 | /* translators: %s: date and time of the revision */ |
142 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
143 | - 6 => __( 'Post published.' ) . $view_post_link_html, |
|
144 | - 7 => __( 'Post saved.' ), |
|
145 | - 8 => __( 'Post submitted.' ) . $preview_post_link_html, |
|
146 | - 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html, |
|
147 | - 10 => __( 'Post draft updated.' ) . $preview_post_link_html, |
|
142 | + 5 => isset($_GET['revision']) ? sprintf(__('Post restored to revision from %s.'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
143 | + 6 => __('Post published.').$view_post_link_html, |
|
144 | + 7 => __('Post saved.'), |
|
145 | + 8 => __('Post submitted.').$preview_post_link_html, |
|
146 | + 9 => sprintf(__('Post scheduled for: %s.'), '<strong>'.$scheduled_date.'</strong>').$scheduled_post_link_html, |
|
147 | + 10 => __('Post draft updated.').$preview_post_link_html, |
|
148 | 148 | ); |
149 | 149 | $messages['page'] = array( |
150 | 150 | 0 => '', // Unused. Messages start at index 1. |
151 | - 1 => __( 'Page updated.' ) . $view_page_link_html, |
|
152 | - 2 => __( 'Custom field updated.' ), |
|
153 | - 3 => __( 'Custom field deleted.' ), |
|
154 | - 4 => __( 'Page updated.' ), |
|
151 | + 1 => __('Page updated.').$view_page_link_html, |
|
152 | + 2 => __('Custom field updated.'), |
|
153 | + 3 => __('Custom field deleted.'), |
|
154 | + 4 => __('Page updated.'), |
|
155 | 155 | /* translators: %s: date and time of the revision */ |
156 | - 5 => isset($_GET['revision']) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
157 | - 6 => __( 'Page published.' ) . $view_page_link_html, |
|
158 | - 7 => __( 'Page saved.' ), |
|
159 | - 8 => __( 'Page submitted.' ) . $preview_page_link_html, |
|
160 | - 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, |
|
161 | - 10 => __( 'Page draft updated.' ) . $preview_page_link_html, |
|
156 | + 5 => isset($_GET['revision']) ? sprintf(__('Page restored to revision from %s.'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
157 | + 6 => __('Page published.').$view_page_link_html, |
|
158 | + 7 => __('Page saved.'), |
|
159 | + 8 => __('Page submitted.').$preview_page_link_html, |
|
160 | + 9 => sprintf(__('Page scheduled for: %s.'), '<strong>'.$scheduled_date.'</strong>').$scheduled_page_link_html, |
|
161 | + 10 => __('Page draft updated.').$preview_page_link_html, |
|
162 | 162 | ); |
163 | -$messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now. |
|
163 | +$messages['attachment'] = array_fill(1, 10, __('Media file updated.')); // Hack, for now. |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Filter the post updated messages. |
@@ -169,109 +169,109 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param array $messages Post updated messages. For defaults @see $messages declarations above. |
171 | 171 | */ |
172 | -$messages = apply_filters( 'post_updated_messages', $messages ); |
|
172 | +$messages = apply_filters('post_updated_messages', $messages); |
|
173 | 173 | |
174 | 174 | $message = false; |
175 | -if ( isset($_GET['message']) ) { |
|
176 | - $_GET['message'] = absint( $_GET['message'] ); |
|
177 | - if ( isset($messages[$post_type][$_GET['message']]) ) |
|
175 | +if (isset($_GET['message'])) { |
|
176 | + $_GET['message'] = absint($_GET['message']); |
|
177 | + if (isset($messages[$post_type][$_GET['message']])) |
|
178 | 178 | $message = $messages[$post_type][$_GET['message']]; |
179 | - elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
|
179 | + elseif ( ! isset($messages[$post_type]) && isset($messages['post'][$_GET['message']])) |
|
180 | 180 | $message = $messages['post'][$_GET['message']]; |
181 | 181 | } |
182 | 182 | |
183 | 183 | $notice = false; |
184 | 184 | $form_extra = ''; |
185 | -if ( 'auto-draft' == $post->post_status ) { |
|
186 | - if ( 'edit' == $action ) |
|
185 | +if ('auto-draft' == $post->post_status) { |
|
186 | + if ('edit' == $action) |
|
187 | 187 | $post->post_title = ''; |
188 | 188 | $autosave = false; |
189 | 189 | $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
190 | 190 | } else { |
191 | - $autosave = wp_get_post_autosave( $post_ID ); |
|
191 | + $autosave = wp_get_post_autosave($post_ID); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $form_action = 'editpost'; |
195 | -$nonce_action = 'update-post_' . $post_ID; |
|
196 | -$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; |
|
195 | +$nonce_action = 'update-post_'.$post_ID; |
|
196 | +$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='".esc_attr($post_ID)."' />"; |
|
197 | 197 | |
198 | 198 | // Detect if there exists an autosave newer than the post and if that autosave is different than the post |
199 | -if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { |
|
200 | - foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) { |
|
201 | - if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { |
|
202 | - $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); |
|
199 | +if ($autosave && mysql2date('U', $autosave->post_modified_gmt, false) > mysql2date('U', $post->post_modified_gmt, false)) { |
|
200 | + foreach (_wp_post_revision_fields($post) as $autosave_field => $_autosave_field) { |
|
201 | + if (normalize_whitespace($autosave->$autosave_field) != normalize_whitespace($post->$autosave_field)) { |
|
202 | + $notice = sprintf(__('There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>'), get_edit_post_link($autosave->ID)); |
|
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | // If this autosave isn't different from the current post, begone. |
207 | - if ( ! $notice ) |
|
208 | - wp_delete_post_revision( $autosave->ID ); |
|
207 | + if ( ! $notice) |
|
208 | + wp_delete_post_revision($autosave->ID); |
|
209 | 209 | unset($autosave_field, $_autosave_field); |
210 | 210 | } |
211 | 211 | |
212 | 212 | $post_type_object = get_post_type_object($post_type); |
213 | 213 | |
214 | 214 | // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). |
215 | -require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
|
215 | +require_once(ABSPATH.'wp-admin/includes/meta-boxes.php'); |
|
216 | 216 | |
217 | 217 | |
218 | 218 | $publish_callback_args = null; |
219 | -if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { |
|
220 | - $revisions = wp_get_post_revisions( $post_ID ); |
|
219 | +if (post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status) { |
|
220 | + $revisions = wp_get_post_revisions($post_ID); |
|
221 | 221 | |
222 | 222 | // We should aim to show the revisions metabox only when there are revisions. |
223 | - if ( count( $revisions ) > 1 ) { |
|
224 | - reset( $revisions ); // Reset pointer for key() |
|
225 | - $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) ); |
|
223 | + if (count($revisions) > 1) { |
|
224 | + reset($revisions); // Reset pointer for key() |
|
225 | + $publish_callback_args = array('revisions_count' => count($revisions), 'revision_id' => key($revisions)); |
|
226 | 226 | add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core'); |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | -if ( 'attachment' == $post_type ) { |
|
231 | - wp_enqueue_script( 'image-edit' ); |
|
232 | - wp_enqueue_style( 'imgareaselect' ); |
|
233 | - add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); |
|
234 | - add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
|
230 | +if ('attachment' == $post_type) { |
|
231 | + wp_enqueue_script('image-edit'); |
|
232 | + wp_enqueue_style('imgareaselect'); |
|
233 | + add_meta_box('submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core'); |
|
234 | + add_action('edit_form_after_title', 'edit_form_image_editor'); |
|
235 | 235 | |
236 | - if ( wp_attachment_is( 'audio', $post ) ) { |
|
237 | - add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); |
|
236 | + if (wp_attachment_is('audio', $post)) { |
|
237 | + add_meta_box('attachment-id3', __('Metadata'), 'attachment_id3_data_meta_box', null, 'normal', 'core'); |
|
238 | 238 | } |
239 | 239 | } else { |
240 | - add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
|
240 | + add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args); |
|
241 | 241 | } |
242 | 242 | |
243 | -if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|
244 | - add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); |
|
243 | +if (current_theme_supports('post-formats') && post_type_supports($post_type, 'post-formats')) |
|
244 | + add_meta_box('formatdiv', _x('Format', 'post format'), 'post_format_meta_box', null, 'side', 'core'); |
|
245 | 245 | |
246 | 246 | // all taxonomies |
247 | -foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
|
248 | - $taxonomy = get_taxonomy( $tax_name ); |
|
249 | - if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) |
|
247 | +foreach (get_object_taxonomies($post) as $tax_name) { |
|
248 | + $taxonomy = get_taxonomy($tax_name); |
|
249 | + if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb) |
|
250 | 250 | continue; |
251 | 251 | |
252 | 252 | $label = $taxonomy->labels->name; |
253 | 253 | |
254 | - if ( ! is_taxonomy_hierarchical( $tax_name ) ) |
|
255 | - $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
254 | + if ( ! is_taxonomy_hierarchical($tax_name)) |
|
255 | + $tax_meta_box_id = 'tagsdiv-'.$tax_name; |
|
256 | 256 | else |
257 | - $tax_meta_box_id = $tax_name . 'div'; |
|
257 | + $tax_meta_box_id = $tax_name.'div'; |
|
258 | 258 | |
259 | - add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); |
|
259 | + add_meta_box($tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array('taxonomy' => $tax_name)); |
|
260 | 260 | } |
261 | 261 | |
262 | -if ( post_type_supports($post_type, 'page-attributes') ) |
|
262 | +if (post_type_supports($post_type, 'page-attributes')) |
|
263 | 263 | add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); |
264 | 264 | |
265 | -if ( $thumbnail_support && current_user_can( 'upload_files' ) ) |
|
266 | - add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); |
|
265 | +if ($thumbnail_support && current_user_can('upload_files')) |
|
266 | + add_meta_box('postimagediv', esc_html($post_type_object->labels->featured_image), 'post_thumbnail_meta_box', null, 'side', 'low'); |
|
267 | 267 | |
268 | -if ( post_type_supports($post_type, 'excerpt') ) |
|
268 | +if (post_type_supports($post_type, 'excerpt')) |
|
269 | 269 | add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); |
270 | 270 | |
271 | -if ( post_type_supports($post_type, 'trackbacks') ) |
|
271 | +if (post_type_supports($post_type, 'trackbacks')) |
|
272 | 272 | add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); |
273 | 273 | |
274 | -if ( post_type_supports($post_type, 'custom-fields') ) |
|
274 | +if (post_type_supports($post_type, 'custom-fields')) |
|
275 | 275 | add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); |
276 | 276 | |
277 | 277 | /** |
@@ -282,33 +282,33 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param WP_Post $post Post object. |
284 | 284 | */ |
285 | -do_action( 'dbx_post_advanced', $post ); |
|
285 | +do_action('dbx_post_advanced', $post); |
|
286 | 286 | |
287 | 287 | // Allow the Discussion meta box to show up if the post type supports comments, |
288 | 288 | // or if comments or pings are open. |
289 | -if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) { |
|
290 | - add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' ); |
|
289 | +if (comments_open($post) || pings_open($post) || post_type_supports($post_type, 'comments')) { |
|
290 | + add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core'); |
|
291 | 291 | } |
292 | 292 | |
293 | -$stati = get_post_stati( array( 'public' => true ) ); |
|
294 | -if ( empty( $stati ) ) { |
|
295 | - $stati = array( 'publish' ); |
|
293 | +$stati = get_post_stati(array('public' => true)); |
|
294 | +if (empty($stati)) { |
|
295 | + $stati = array('publish'); |
|
296 | 296 | } |
297 | 297 | $stati[] = 'private'; |
298 | 298 | |
299 | -if ( in_array( get_post_status( $post ), $stati ) ) { |
|
299 | +if (in_array(get_post_status($post), $stati)) { |
|
300 | 300 | // If the post type support comments, or the post has comments, allow the |
301 | 301 | // Comments meta box. |
302 | - if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) { |
|
303 | - add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' ); |
|
302 | + if (comments_open($post) || pings_open($post) || $post->comment_count > 0 || post_type_supports($post_type, 'comments')) { |
|
303 | + add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core'); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | -if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) |
|
307 | +if ( ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts))) |
|
308 | 308 | add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); |
309 | 309 | |
310 | -if ( post_type_supports($post_type, 'author') ) { |
|
311 | - if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) |
|
310 | +if (post_type_supports($post_type, 'author')) { |
|
311 | + if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) |
|
312 | 312 | add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
313 | 313 | } |
314 | 314 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param string $post_type Post type. |
321 | 321 | * @param WP_Post $post Post object. |
322 | 322 | */ |
323 | -do_action( 'add_meta_boxes', $post_type, $post ); |
|
323 | +do_action('add_meta_boxes', $post_type, $post); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Fires after all built-in meta boxes have been added, contextually for the given post type. |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @param WP_Post $post Post object. |
333 | 333 | */ |
334 | -do_action( 'add_meta_boxes_' . $post_type, $post ); |
|
334 | +do_action('add_meta_boxes_'.$post_type, $post); |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Fires after meta boxes have been added. |
@@ -344,149 +344,149 @@ discard block |
||
344 | 344 | * @param string $context string Meta box context. |
345 | 345 | * @param WP_Post $post Post object. |
346 | 346 | */ |
347 | -do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
|
347 | +do_action('do_meta_boxes', $post_type, 'normal', $post); |
|
348 | 348 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
349 | -do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
|
349 | +do_action('do_meta_boxes', $post_type, 'advanced', $post); |
|
350 | 350 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
351 | -do_action( 'do_meta_boxes', $post_type, 'side', $post ); |
|
351 | +do_action('do_meta_boxes', $post_type, 'side', $post); |
|
352 | 352 | |
353 | -add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
|
353 | +add_screen_option('layout_columns', array('max' => 2, 'default' => 2)); |
|
354 | 354 | |
355 | -if ( 'post' == $post_type ) { |
|
356 | - $customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>'; |
|
355 | +if ('post' == $post_type) { |
|
356 | + $customize_display = '<p>'.__('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.').'</p>'; |
|
357 | 357 | |
358 | - get_current_screen()->add_help_tab( array( |
|
358 | + get_current_screen()->add_help_tab(array( |
|
359 | 359 | 'id' => 'customize-display', |
360 | 360 | 'title' => __('Customizing This Display'), |
361 | 361 | 'content' => $customize_display, |
362 | - ) ); |
|
362 | + )); |
|
363 | 363 | |
364 | - $title_and_editor = '<p>' . __('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>'; |
|
365 | - $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>'; |
|
366 | - $title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls. ') . '</p>'; |
|
367 | - $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>'; |
|
368 | - $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>'; |
|
369 | - $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>'; |
|
370 | - $title_and_editor .= '<p>' . __( 'Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; |
|
364 | + $title_and_editor = '<p>'.__('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.').'</p>'; |
|
365 | + $title_and_editor .= '<p>'.__('<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.').'</p>'; |
|
366 | + $title_and_editor .= '<p>'.__('Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls. ').'</p>'; |
|
367 | + $title_and_editor .= '<p>'.__('The Text mode allows you to enter HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.').'</p>'; |
|
368 | + $title_and_editor .= '<p>'.__('You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.').'</p>'; |
|
369 | + $title_and_editor .= '<p>'.__('You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.').'</p>'; |
|
370 | + $title_and_editor .= '<p>'.__('Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.').'</p>'; |
|
371 | 371 | |
372 | - get_current_screen()->add_help_tab( array( |
|
372 | + get_current_screen()->add_help_tab(array( |
|
373 | 373 | 'id' => 'title-post-editor', |
374 | 374 | 'title' => __('Title and Post Editor'), |
375 | 375 | 'content' => $title_and_editor, |
376 | - ) ); |
|
376 | + )); |
|
377 | 377 | |
378 | 378 | get_current_screen()->set_help_sidebar( |
379 | - '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php') . '</p>' . |
|
380 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
381 | - '<p>' . __('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' . |
|
382 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
379 | + '<p>'.sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php').'</p>'. |
|
380 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
381 | + '<p>'.__('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>').'</p>'. |
|
382 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
383 | 383 | ); |
384 | -} elseif ( 'page' == $post_type ) { |
|
385 | - $about_pages = '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.') . '</p>' . |
|
386 | - '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.') . '</p>'; |
|
384 | +} elseif ('page' == $post_type) { |
|
385 | + $about_pages = '<p>'.__('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.').'</p>'. |
|
386 | + '<p>'.__('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.').'</p>'; |
|
387 | 387 | |
388 | - get_current_screen()->add_help_tab( array( |
|
388 | + get_current_screen()->add_help_tab(array( |
|
389 | 389 | 'id' => 'about-pages', |
390 | 390 | 'title' => __('About Pages'), |
391 | 391 | 'content' => $about_pages, |
392 | - ) ); |
|
392 | + )); |
|
393 | 393 | |
394 | 394 | get_current_screen()->set_help_sidebar( |
395 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
396 | - '<p>' . __('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' . |
|
397 | - '<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' . |
|
398 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
395 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
396 | + '<p>'.__('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>').'</p>'. |
|
397 | + '<p>'.__('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>').'</p>'. |
|
398 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
399 | 399 | ); |
400 | -} elseif ( 'attachment' == $post_type ) { |
|
401 | - get_current_screen()->add_help_tab( array( |
|
400 | +} elseif ('attachment' == $post_type) { |
|
401 | + get_current_screen()->add_help_tab(array( |
|
402 | 402 | 'id' => 'overview', |
403 | 403 | 'title' => __('Overview'), |
404 | 404 | 'content' => |
405 | - '<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' . |
|
406 | - '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
407 | - '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
408 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
409 | - ) ); |
|
405 | + '<p>'.__('This screen allows you to edit four fields for metadata in a file within the media library.').'</p>'. |
|
406 | + '<p>'.__('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.').'</p>'. |
|
407 | + '<p>'.__('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.').'</p>'. |
|
408 | + '<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>' |
|
409 | + )); |
|
410 | 410 | |
411 | 411 | get_current_screen()->set_help_sidebar( |
412 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
413 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
414 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
412 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
413 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>').'</p>'. |
|
414 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
415 | 415 | ); |
416 | 416 | } |
417 | 417 | |
418 | -if ( 'post' == $post_type || 'page' == $post_type ) { |
|
419 | - $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; |
|
420 | - $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; |
|
418 | +if ('post' == $post_type || 'page' == $post_type) { |
|
419 | + $inserting_media = '<p>'.__('You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.').'</p>'; |
|
420 | + $inserting_media .= '<p>'.__('You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.').'</p>'; |
|
421 | 421 | |
422 | - get_current_screen()->add_help_tab( array( |
|
422 | + get_current_screen()->add_help_tab(array( |
|
423 | 423 | 'id' => 'inserting-media', |
424 | - 'title' => __( 'Inserting Media' ), |
|
424 | + 'title' => __('Inserting Media'), |
|
425 | 425 | 'content' => $inserting_media, |
426 | - ) ); |
|
426 | + )); |
|
427 | 427 | } |
428 | 428 | |
429 | -if ( 'post' == $post_type ) { |
|
430 | - $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>'; |
|
431 | - $publish_box .= '<ul><li>' . |
|
432 | - __( '<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) . |
|
429 | +if ('post' == $post_type) { |
|
430 | + $publish_box = '<p>'.__('Several boxes on this screen contain settings for how your content will be published, including:').'</p>'; |
|
431 | + $publish_box .= '<ul><li>'. |
|
432 | + __('<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.'). |
|
433 | 433 | '</li>'; |
434 | 434 | |
435 | - if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) { |
|
436 | - $publish_box .= '<li>' . __( '<strong>Format</strong> — Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>'; |
|
435 | + if (current_theme_supports('post-formats') && post_type_supports('post', 'post-formats')) { |
|
436 | + $publish_box .= '<li>'.__('<strong>Format</strong> — Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.').'</li>'; |
|
437 | 437 | } |
438 | 438 | |
439 | - if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) { |
|
439 | + if (current_theme_supports('post-thumbnails') && post_type_supports('post', 'thumbnail')) { |
|
440 | 440 | /* translators: %s: Featured Image */ |
441 | - $publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>'; |
|
441 | + $publish_box .= '<li>'.sprintf(__('<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.'), esc_html($post_type_object->labels->featured_image)).'</li>'; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | $publish_box .= '</ul>'; |
445 | 445 | |
446 | - get_current_screen()->add_help_tab( array( |
|
446 | + get_current_screen()->add_help_tab(array( |
|
447 | 447 | 'id' => 'publish-box', |
448 | 448 | 'title' => __('Publish Settings'), |
449 | 449 | 'content' => $publish_box, |
450 | - ) ); |
|
450 | + )); |
|
451 | 451 | |
452 | - $discussion_settings = '<p>' . __('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>'; |
|
453 | - $discussion_settings .= '<p>' . __('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>'; |
|
452 | + $discussion_settings = '<p>'.__('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.').'</p>'; |
|
453 | + $discussion_settings .= '<p>'.__('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.').'</p>'; |
|
454 | 454 | |
455 | - get_current_screen()->add_help_tab( array( |
|
455 | + get_current_screen()->add_help_tab(array( |
|
456 | 456 | 'id' => 'discussion-settings', |
457 | 457 | 'title' => __('Discussion Settings'), |
458 | 458 | 'content' => $discussion_settings, |
459 | - ) ); |
|
460 | -} elseif ( 'page' == $post_type ) { |
|
461 | - $page_attributes = '<p>' . __('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . |
|
462 | - '<p>' . __('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . |
|
463 | - '<p>' . __('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>'; |
|
459 | + )); |
|
460 | +} elseif ('page' == $post_type) { |
|
461 | + $page_attributes = '<p>'.__('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.').'</p>'. |
|
462 | + '<p>'.__('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.').'</p>'. |
|
463 | + '<p>'.__('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.').'</p>'; |
|
464 | 464 | |
465 | - get_current_screen()->add_help_tab( array( |
|
465 | + get_current_screen()->add_help_tab(array( |
|
466 | 466 | 'id' => 'page-attributes', |
467 | 467 | 'title' => __('Page Attributes'), |
468 | 468 | 'content' => $page_attributes, |
469 | - ) ); |
|
469 | + )); |
|
470 | 470 | } |
471 | 471 | |
472 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
472 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
473 | 473 | ?> |
474 | 474 | |
475 | 475 | <div class="wrap"> |
476 | 476 | <h1><?php |
477 | -echo esc_html( $title ); |
|
478 | -if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) |
|
479 | - echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
|
477 | +echo esc_html($title); |
|
478 | +if (isset($post_new_file) && current_user_can($post_type_object->cap->create_posts)) |
|
479 | + echo ' <a href="'.esc_url(admin_url($post_new_file)).'" class="page-title-action">'.esc_html($post_type_object->labels->add_new).'</a>'; |
|
480 | 480 | ?></h1> |
481 | -<?php if ( $notice ) : ?> |
|
481 | +<?php if ($notice) : ?> |
|
482 | 482 | <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
483 | 483 | <?php endif; ?> |
484 | -<?php if ( $message ) : ?> |
|
484 | +<?php if ($message) : ?> |
|
485 | 485 | <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div> |
486 | 486 | <?php endif; ?> |
487 | 487 | <div id="lost-connection-notice" class="error hidden"> |
488 | - <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?> |
|
489 | - <span class="hide-if-no-sessionstorage"><?php _e( 'We’re backing up this post in your browser, just in case.' ); ?></span> |
|
488 | + <p><span class="spinner"></span> <?php _e('<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.'); ?> |
|
489 | + <span class="hide-if-no-sessionstorage"><?php _e('We’re backing up this post in your browser, just in case.'); ?></span> |
|
490 | 490 | </p> |
491 | 491 | </div> |
492 | 492 | <form name="post" action="post.php" method="post" id="post"<?php |
@@ -497,29 +497,29 @@ discard block |
||
497 | 497 | * |
498 | 498 | * @param WP_Post $post Post object. |
499 | 499 | */ |
500 | -do_action( 'post_edit_form_tag', $post ); |
|
500 | +do_action('post_edit_form_tag', $post); |
|
501 | 501 | |
502 | 502 | $referer = wp_get_referer(); |
503 | 503 | ?>> |
504 | 504 | <?php wp_nonce_field($nonce_action); ?> |
505 | 505 | <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
506 | -<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
507 | -<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
508 | -<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
|
509 | -<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" /> |
|
510 | -<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" /> |
|
511 | -<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> |
|
512 | -<?php if ( ! empty( $active_post_lock ) ) { ?> |
|
513 | -<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
|
506 | +<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" /> |
|
507 | +<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" /> |
|
508 | +<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr($post->post_author); ?>" /> |
|
509 | +<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" /> |
|
510 | +<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" /> |
|
511 | +<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url($referer) : ''; ?>" /> |
|
512 | +<?php if ( ! empty($active_post_lock)) { ?> |
|
513 | +<input type="hidden" id="active_post_lock" value="<?php echo esc_attr(implode(':', $active_post_lock)); ?>" /> |
|
514 | 514 | <?php |
515 | 515 | } |
516 | -if ( 'draft' != get_post_status( $post ) ) |
|
516 | +if ('draft' != get_post_status($post)) |
|
517 | 517 | wp_original_referer_field(true, 'previous'); |
518 | 518 | |
519 | 519 | echo $form_extra; |
520 | 520 | |
521 | -wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
|
522 | -wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
521 | +wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
|
522 | +wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
523 | 523 | ?> |
524 | 524 | |
525 | 525 | <?php |
@@ -532,13 +532,13 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @param WP_Post $post Post object. |
534 | 534 | */ |
535 | -do_action( 'edit_form_top', $post ); ?> |
|
535 | +do_action('edit_form_top', $post); ?> |
|
536 | 536 | |
537 | 537 | <div id="poststuff"> |
538 | 538 | <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
539 | 539 | <div id="post-body-content"> |
540 | 540 | |
541 | -<?php if ( post_type_supports($post_type, 'title') ) { ?> |
|
541 | +<?php if (post_type_supports($post_type, 'title')) { ?> |
|
542 | 542 | <div id="titlediv"> |
543 | 543 | <div id="titlewrap"> |
544 | 544 | <?php |
@@ -550,10 +550,10 @@ discard block |
||
550 | 550 | * @param string $text Placeholder text. Default 'Enter title here'. |
551 | 551 | * @param WP_Post $post Post object. |
552 | 552 | */ |
553 | - $title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); |
|
553 | + $title_placeholder = apply_filters('enter_title_here', __('Enter title here'), $post); |
|
554 | 554 | ?> |
555 | 555 | <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label> |
556 | - <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" /> |
|
556 | + <input type="text" name="post_title" size="30" value="<?php echo esc_attr($post->post_title); ?>" id="title" spellcheck="true" autocomplete="off" /> |
|
557 | 557 | </div> |
558 | 558 | <?php |
559 | 559 | /** |
@@ -563,28 +563,28 @@ discard block |
||
563 | 563 | * |
564 | 564 | * @param WP_Post $post Post object. |
565 | 565 | */ |
566 | -do_action( 'edit_form_before_permalink', $post ); |
|
566 | +do_action('edit_form_before_permalink', $post); |
|
567 | 567 | ?> |
568 | 568 | <div class="inside"> |
569 | 569 | <?php |
570 | -if ( $viewable ) : |
|
570 | +if ($viewable) : |
|
571 | 571 | $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; |
572 | 572 | |
573 | 573 | // As of 4.4, the Get Shortlink button is hidden by default. |
574 | -if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) { |
|
574 | +if (has_filter('pre_get_shortlink') || has_filter('get_shortlink')) { |
|
575 | 575 | $shortlink = wp_get_shortlink($post->ID, 'post'); |
576 | 576 | |
577 | - if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { |
|
578 | - $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
577 | + if ( ! empty($shortlink) && $shortlink !== $permalink && $permalink !== home_url('?page_id='.$post->ID)) { |
|
578 | + $sample_permalink_html .= '<input id="shortlink" type="hidden" value="'.esc_attr($shortlink).'" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">'.__('Get Shortlink').'</a>'; |
|
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
582 | -if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
582 | +if ($post_type_object->public && ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts))) { |
|
583 | 583 | $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
584 | 584 | ?> |
585 | 585 | <div id="edit-slug-box" class="hide-if-no-js"> |
586 | 586 | <?php |
587 | - if ( $has_sample_permalink ) |
|
587 | + if ($has_sample_permalink) |
|
588 | 588 | echo $sample_permalink_html; |
589 | 589 | ?> |
590 | 590 | </div> |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | ?> |
595 | 595 | </div> |
596 | 596 | <?php |
597 | -wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); |
|
597 | +wp_nonce_field('samplepermalink', 'samplepermalinknonce', false); |
|
598 | 598 | ?> |
599 | 599 | </div><!-- /titlediv --> |
600 | 600 | <?php |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | * |
607 | 607 | * @param WP_Post $post Post object. |
608 | 608 | */ |
609 | -do_action( 'edit_form_after_title', $post ); |
|
609 | +do_action('edit_form_after_title', $post); |
|
610 | 610 | |
611 | -if ( post_type_supports($post_type, 'editor') ) { |
|
611 | +if (post_type_supports($post_type, 'editor')) { |
|
612 | 612 | ?> |
613 | -<div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>"> |
|
613 | +<div id="postdivrich" class="postarea<?php if ($_wp_editor_expand) { echo ' wp-editor-expand'; } ?>"> |
|
614 | 614 | |
615 | -<?php wp_editor( $post->post_content, 'content', array( |
|
615 | +<?php wp_editor($post->post_content, 'content', array( |
|
616 | 616 | '_content_editor_dfw' => $_content_editor_dfw, |
617 | 617 | 'drag_drop_upload' => true, |
618 | 618 | 'tabfocus_elements' => 'content-html,save-post', |
@@ -622,18 +622,18 @@ discard block |
||
622 | 622 | 'wp_autoresize_on' => $_wp_editor_expand, |
623 | 623 | 'add_unload_trigger' => false, |
624 | 624 | ), |
625 | -) ); ?> |
|
625 | +)); ?> |
|
626 | 626 | <table id="post-status-info"><tbody><tr> |
627 | - <td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> |
|
627 | + <td id="wp-word-count" class="hide-if-no-js"><?php printf(__('Word count: %s'), '<span class="word-count">0</span>'); ?></td> |
|
628 | 628 | <td class="autosave-info"> |
629 | 629 | <span class="autosave-message"> </span> |
630 | 630 | <?php |
631 | - if ( 'auto-draft' != $post->post_status ) { |
|
631 | + if ('auto-draft' != $post->post_status) { |
|
632 | 632 | echo '<span id="last-edit">'; |
633 | - if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { |
|
634 | - printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
|
633 | + if ($last_user = get_userdata(get_post_meta($post_ID, '_edit_last', true))) { |
|
634 | + printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html($last_user->display_name), mysql2date(__('F j, Y'), $post->post_modified), mysql2date(__('g:i a'), $post->post_modified)); |
|
635 | 635 | } else { |
636 | - printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); |
|
636 | + printf(__('Last edited on %1$s at %2$s'), mysql2date(__('F j, Y'), $post->post_modified), mysql2date(__('g:i a'), $post->post_modified)); |
|
637 | 637 | } |
638 | 638 | echo '</span>'; |
639 | 639 | } ?> |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | * |
651 | 651 | * @param WP_Post $post Post object. |
652 | 652 | */ |
653 | -do_action( 'edit_form_after_editor', $post ); |
|
653 | +do_action('edit_form_after_editor', $post); |
|
654 | 654 | ?> |
655 | 655 | </div><!-- /post-body-content --> |
656 | 656 | |
657 | 657 | <div id="postbox-container-1" class="postbox-container"> |
658 | 658 | <?php |
659 | 659 | |
660 | -if ( 'page' == $post_type ) { |
|
660 | +if ('page' == $post_type) { |
|
661 | 661 | /** |
662 | 662 | * Fires before meta boxes with 'side' context are output for the 'page' post type. |
663 | 663 | * |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * |
668 | 668 | * @param WP_Post $post Post object. |
669 | 669 | */ |
670 | - do_action( 'submitpage_box', $post ); |
|
670 | + do_action('submitpage_box', $post); |
|
671 | 671 | } |
672 | 672 | else { |
673 | 673 | /** |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @param WP_Post $post Post object. |
681 | 681 | */ |
682 | - do_action( 'submitpost_box', $post ); |
|
682 | + do_action('submitpost_box', $post); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | |
693 | 693 | do_meta_boxes(null, 'normal', $post); |
694 | 694 | |
695 | -if ( 'page' == $post_type ) { |
|
695 | +if ('page' == $post_type) { |
|
696 | 696 | /** |
697 | 697 | * Fires after 'normal' context meta boxes have been output for the 'page' post type. |
698 | 698 | * |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @param WP_Post $post Post object. |
702 | 702 | */ |
703 | - do_action( 'edit_page_form', $post ); |
|
703 | + do_action('edit_page_form', $post); |
|
704 | 704 | } |
705 | 705 | else { |
706 | 706 | /** |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | * |
711 | 711 | * @param WP_Post $post Post object. |
712 | 712 | */ |
713 | - do_action( 'edit_form_advanced', $post ); |
|
713 | + do_action('edit_form_advanced', $post); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | * |
727 | 727 | * @param WP_Post $post Post object. |
728 | 728 | */ |
729 | -do_action( 'dbx_post_sidebar', $post ); |
|
729 | +do_action('dbx_post_sidebar', $post); |
|
730 | 730 | |
731 | 731 | ?> |
732 | 732 | </div><!-- /post-body --> |
@@ -736,11 +736,11 @@ discard block |
||
736 | 736 | </div> |
737 | 737 | |
738 | 738 | <?php |
739 | -if ( post_type_supports( $post_type, 'comments' ) ) |
|
739 | +if (post_type_supports($post_type, 'comments')) |
|
740 | 740 | wp_comment_reply(); |
741 | 741 | ?> |
742 | 742 | |
743 | -<?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?> |
|
743 | +<?php if ( ! wp_is_mobile() && post_type_supports($post_type, 'title') && '' === $post->post_title) : ?> |
|
744 | 744 | <script type="text/javascript"> |
745 | 745 | try{document.post.title.focus();}catch(e){} |
746 | 746 | </script> |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | |
13 | 14 | /** |
14 | 15 | * @global string $post_type |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); |
39 | 40 | } |
40 | 41 | |
41 | -if ( wp_is_mobile() ) |
|
42 | +if ( wp_is_mobile() ) { |
|
42 | 43 | wp_enqueue_script( 'jquery-touch-punch' ); |
44 | +} |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Post ID global |
@@ -174,17 +176,19 @@ discard block |
||
174 | 176 | $message = false; |
175 | 177 | if ( isset($_GET['message']) ) { |
176 | 178 | $_GET['message'] = absint( $_GET['message'] ); |
177 | - if ( isset($messages[$post_type][$_GET['message']]) ) |
|
178 | - $message = $messages[$post_type][$_GET['message']]; |
|
179 | - elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
|
180 | - $message = $messages['post'][$_GET['message']]; |
|
181 | -} |
|
179 | + if ( isset($messages[$post_type][$_GET['message']]) ) { |
|
180 | + $message = $messages[$post_type][$_GET['message']]; |
|
181 | + } elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) { |
|
182 | + $message = $messages['post'][$_GET['message']]; |
|
183 | + } |
|
184 | + } |
|
182 | 185 | |
183 | 186 | $notice = false; |
184 | 187 | $form_extra = ''; |
185 | 188 | if ( 'auto-draft' == $post->post_status ) { |
186 | - if ( 'edit' == $action ) |
|
187 | - $post->post_title = ''; |
|
189 | + if ( 'edit' == $action ) { |
|
190 | + $post->post_title = ''; |
|
191 | + } |
|
188 | 192 | $autosave = false; |
189 | 193 | $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
190 | 194 | } else { |
@@ -204,8 +208,9 @@ discard block |
||
204 | 208 | } |
205 | 209 | } |
206 | 210 | // If this autosave isn't different from the current post, begone. |
207 | - if ( ! $notice ) |
|
208 | - wp_delete_post_revision( $autosave->ID ); |
|
211 | + if ( ! $notice ) { |
|
212 | + wp_delete_post_revision( $autosave->ID ); |
|
213 | + } |
|
209 | 214 | unset($autosave_field, $_autosave_field); |
210 | 215 | } |
211 | 216 | |
@@ -240,39 +245,47 @@ discard block |
||
240 | 245 | add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
241 | 246 | } |
242 | 247 | |
243 | -if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|
248 | +if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { |
|
244 | 249 | add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); |
250 | +} |
|
245 | 251 | |
246 | 252 | // all taxonomies |
247 | 253 | foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
248 | 254 | $taxonomy = get_taxonomy( $tax_name ); |
249 | - if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) |
|
250 | - continue; |
|
255 | + if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { |
|
256 | + continue; |
|
257 | + } |
|
251 | 258 | |
252 | 259 | $label = $taxonomy->labels->name; |
253 | 260 | |
254 | - if ( ! is_taxonomy_hierarchical( $tax_name ) ) |
|
255 | - $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
256 | - else |
|
257 | - $tax_meta_box_id = $tax_name . 'div'; |
|
261 | + if ( ! is_taxonomy_hierarchical( $tax_name ) ) { |
|
262 | + $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
263 | + } else { |
|
264 | + $tax_meta_box_id = $tax_name . 'div'; |
|
265 | + } |
|
258 | 266 | |
259 | 267 | add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); |
260 | 268 | } |
261 | 269 | |
262 | -if ( post_type_supports($post_type, 'page-attributes') ) |
|
270 | +if ( post_type_supports($post_type, 'page-attributes') ) { |
|
263 | 271 | add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); |
272 | +} |
|
264 | 273 | |
265 | -if ( $thumbnail_support && current_user_can( 'upload_files' ) ) |
|
274 | +if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { |
|
266 | 275 | add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); |
276 | +} |
|
267 | 277 | |
268 | -if ( post_type_supports($post_type, 'excerpt') ) |
|
278 | +if ( post_type_supports($post_type, 'excerpt') ) { |
|
269 | 279 | add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); |
280 | +} |
|
270 | 281 | |
271 | -if ( post_type_supports($post_type, 'trackbacks') ) |
|
282 | +if ( post_type_supports($post_type, 'trackbacks') ) { |
|
272 | 283 | add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); |
284 | +} |
|
273 | 285 | |
274 | -if ( post_type_supports($post_type, 'custom-fields') ) |
|
286 | +if ( post_type_supports($post_type, 'custom-fields') ) { |
|
275 | 287 | add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); |
288 | +} |
|
276 | 289 | |
277 | 290 | /** |
278 | 291 | * Fires in the middle of built-in meta box registration. |
@@ -304,13 +317,15 @@ discard block |
||
304 | 317 | } |
305 | 318 | } |
306 | 319 | |
307 | -if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) |
|
320 | +if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
308 | 321 | add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); |
322 | +} |
|
309 | 323 | |
310 | 324 | if ( post_type_supports($post_type, 'author') ) { |
311 | - if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) |
|
312 | - add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
|
313 | -} |
|
325 | + if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
|
326 | + add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
|
327 | + } |
|
328 | + } |
|
314 | 329 | |
315 | 330 | /** |
316 | 331 | * Fires after all built-in meta boxes have been added. |
@@ -475,8 +490,9 @@ discard block |
||
475 | 490 | <div class="wrap"> |
476 | 491 | <h1><?php |
477 | 492 | echo esc_html( $title ); |
478 | -if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) |
|
493 | +if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) { |
|
479 | 494 | echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
495 | +} |
|
480 | 496 | ?></h1> |
481 | 497 | <?php if ( $notice ) : ?> |
482 | 498 | <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
@@ -513,8 +529,9 @@ discard block |
||
513 | 529 | <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
514 | 530 | <?php |
515 | 531 | } |
516 | -if ( 'draft' != get_post_status( $post ) ) |
|
532 | +if ( 'draft' != get_post_status( $post ) ) { |
|
517 | 533 | wp_original_referer_field(true, 'previous'); |
534 | +} |
|
518 | 535 | |
519 | 536 | echo $form_extra; |
520 | 537 | |
@@ -584,8 +601,9 @@ discard block |
||
584 | 601 | ?> |
585 | 602 | <div id="edit-slug-box" class="hide-if-no-js"> |
586 | 603 | <?php |
587 | - if ( $has_sample_permalink ) |
|
588 | - echo $sample_permalink_html; |
|
604 | + if ( $has_sample_permalink ) { |
|
605 | + echo $sample_permalink_html; |
|
606 | + } |
|
589 | 607 | ?> |
590 | 608 | </div> |
591 | 609 | <?php |
@@ -668,8 +686,7 @@ discard block |
||
668 | 686 | * @param WP_Post $post Post object. |
669 | 687 | */ |
670 | 688 | do_action( 'submitpage_box', $post ); |
671 | -} |
|
672 | -else { |
|
689 | +} else { |
|
673 | 690 | /** |
674 | 691 | * Fires before meta boxes with 'side' context are output for all post types other than 'page'. |
675 | 692 | * |
@@ -701,8 +718,7 @@ discard block |
||
701 | 718 | * @param WP_Post $post Post object. |
702 | 719 | */ |
703 | 720 | do_action( 'edit_page_form', $post ); |
704 | -} |
|
705 | -else { |
|
721 | +} else { |
|
706 | 722 | /** |
707 | 723 | * Fires after 'normal' context meta boxes have been output for all post types other than 'page'. |
708 | 724 | * |
@@ -736,8 +752,9 @@ discard block |
||
736 | 752 | </div> |
737 | 753 | |
738 | 754 | <?php |
739 | -if ( post_type_supports( $post_type, 'comments' ) ) |
|
755 | +if ( post_type_supports( $post_type, 'comments' ) ) { |
|
740 | 756 | wp_comment_reply(); |
757 | +} |
|
741 | 758 | ?> |
742 | 759 | |
743 | 760 | <?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * About This Version administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * About This Version administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | '<a href="https://developer.wordpress.org/reference/functions/add_term_meta"><code>add_term_meta()</code></a>', |
161 | 161 | '<a href="https://developer.wordpress.org/reference/functions/get_term_meta"><code>get_term_meta()</code></a>', |
162 | 162 | '<a href="https://developer.wordpress.org/reference/functions/update_term_meta"><code>update_term_meta()</code></a>' |
163 | - ); |
|
163 | + ); |
|
164 | 164 | ?></p> |
165 | 165 | </div> |
166 | 166 | <div class="col"> |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | |
218 | 218 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
219 | 219 | _n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
220 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
220 | + '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
221 | 221 | |
222 | 222 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
223 | 223 | _n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
224 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
224 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
225 | 225 | |
226 | 226 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
227 | 227 | _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
228 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
228 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
229 | 229 | |
230 | 230 | /* translators: %s: Codex URL */ |
231 | 231 | __( 'For more information, see <a href="%s">the release notes</a>.' ); |
@@ -7,64 +7,64 @@ 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 | -wp_enqueue_style( 'wp-mediaelement' ); |
|
13 | -wp_enqueue_script( 'wp-mediaelement' ); |
|
14 | -wp_localize_script( 'mediaelement', '_wpmejsSettings', array( |
|
15 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
12 | +wp_enqueue_style('wp-mediaelement'); |
|
13 | +wp_enqueue_script('wp-mediaelement'); |
|
14 | +wp_localize_script('mediaelement', '_wpmejsSettings', array( |
|
15 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
16 | 16 | 'pauseOtherPlayers' => '' |
17 | -) ); |
|
17 | +)); |
|
18 | 18 | |
19 | -if ( current_user_can( 'install_plugins' ) ) { |
|
19 | +if (current_user_can('install_plugins')) { |
|
20 | 20 | add_thickbox(); |
21 | - wp_enqueue_script( 'plugin-install' ); |
|
21 | + wp_enqueue_script('plugin-install'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $video_url = 'https://videopress.com/embed/J44FHXvg?hd=true'; |
25 | -$locale = str_replace( '_', '-', get_locale() ); |
|
26 | -list( $locale ) = explode( '-', $locale ); |
|
27 | -if ( 'en' !== $locale ) { |
|
28 | - $video_url = add_query_arg( 'defaultLangCode', $locale, $video_url ); |
|
25 | +$locale = str_replace('_', '-', get_locale()); |
|
26 | +list($locale) = explode('-', $locale); |
|
27 | +if ('en' !== $locale) { |
|
28 | + $video_url = add_query_arg('defaultLangCode', $locale, $video_url); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | wp_oembed_add_host_js(); |
32 | 32 | |
33 | -$title = __( 'About' ); |
|
33 | +$title = __('About'); |
|
34 | 34 | |
35 | -list( $display_version ) = explode( '-', $wp_version ); |
|
35 | +list($display_version) = explode('-', $wp_version); |
|
36 | 36 | |
37 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
37 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
38 | 38 | ?> |
39 | 39 | <div class="wrap about-wrap"> |
40 | - <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
40 | + <h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
41 | 41 | |
42 | - <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes your site more connected and responsive.' ), $display_version ); ?></div> |
|
43 | - <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
42 | + <div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes your site more connected and responsive.'), $display_version); ?></div> |
|
43 | + <div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
44 | 44 | |
45 | 45 | <h2 class="nav-tab-wrapper wp-clearfix"> |
46 | - <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What’s New' ); ?></a> |
|
47 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
48 | - <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a> |
|
46 | + <a href="about.php" class="nav-tab nav-tab-active"><?php _e('What’s New'); ?></a> |
|
47 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
48 | + <a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a> |
|
49 | 49 | </h2> |
50 | 50 | |
51 | 51 | <div class="headline-feature feature-video"> |
52 | - <iframe width="1050" height="591" src="<?php echo esc_url( $video_url ); ?>" frameborder="0" allowfullscreen></iframe> |
|
52 | + <iframe width="1050" height="591" src="<?php echo esc_url($video_url); ?>" frameborder="0" allowfullscreen></iframe> |
|
53 | 53 | <script src="https://videopress.com/videopress-iframe.js"></script> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <hr> |
57 | 57 | |
58 | 58 | <div class="headline-feature feature-section one-col"> |
59 | - <h2><?php _e( 'Twenty Sixteen' ); ?></h2> |
|
59 | + <h2><?php _e('Twenty Sixteen'); ?></h2> |
|
60 | 60 | <div class="media-container"> |
61 | 61 | <img src="https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-2x.png" alt="" srcset="https://s.w.org/images/core/4.4/twenty-sixteen-white-smartphone-1x.png 268w, https://s.w.org/images/core/4.4/twenty-sixteen-white-smartphone-2x.png 536w, https://s.w.org/images/core/4.4/twenty-sixteen-white-tablet-1x.png 558w, https://s.w.org/images/core/4.4/twenty-sixteen-white-desktop-1x.png 840w, https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-1x.png 1086w, https://s.w.org/images/core/4.4/twenty-sixteen-white-tablet-2x.png 1116w, https://s.w.org/images/core/4.4/twenty-sixteen-white-desktop-2x.png 1680w, https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-2x.png 2172w" sizes="(max-width: 500px) calc((100vw - 40px) * .8), (max-width: 782px) calc((100vw - 70px) * .8), (max-width: 960px) calc((100vw - 116px) * .8), (max-width: 1290px) calc((100vw - 240px) * .8), 840px" /> |
62 | 62 | </div> |
63 | 63 | <div class="two-col"> |
64 | 64 | <div class="col"> |
65 | - <h3><?php _e( 'Introducing Twenty Sixteen' ); ?></h3> |
|
66 | - <p><?php _e( 'Our newest default theme, Twenty Sixteen, is a modern take on a classic blog design.' ); ?></p> |
|
67 | - <p><?php _e( 'Twenty Sixteen was built to look great on any device. A fluid grid design, flexible header, fun color schemes, and more, will make your content shine.' ); ?></p> |
|
65 | + <h3><?php _e('Introducing Twenty Sixteen'); ?></h3> |
|
66 | + <p><?php _e('Our newest default theme, Twenty Sixteen, is a modern take on a classic blog design.'); ?></p> |
|
67 | + <p><?php _e('Twenty Sixteen was built to look great on any device. A fluid grid design, flexible header, fun color schemes, and more, will make your content shine.'); ?></p> |
|
68 | 68 | <div class="horizontal-image"> |
69 | 69 | <div class="content"> |
70 | 70 | <img class="feature-image horizontal-screen" src="https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-2x.png" alt="" srcset="https://s.w.org/images/core/4.4/twenty-sixteen-dark-smartphone-1x.png 268w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-smartphone-2x.png 535w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-desktop-1x.png 558w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-1x.png 783w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-desktop-2x.png 1116w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-2x.png 1566w" sizes="(max-width: 500px) calc((100vw - 40px) * .8), (max-width: 782px) calc((100vw - 70px) * .8), (max-width: 960px) calc((100vw - 116px) * .5216), (max-width: 1290px) calc((100vw - 240px) * .5216), 548px" /> |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | </div> |
88 | 88 | <div class="col"> |
89 | - <h3><?php _e( 'Responsive images' ); ?></h3> |
|
90 | - <p><?php _e( 'WordPress now takes a smarter approach to displaying appropriate image sizes on any device, ensuring a perfect fit every time. You don’t need to do anything to your theme, it just works.' ); ?></p> |
|
89 | + <h3><?php _e('Responsive images'); ?></h3> |
|
90 | + <p><?php _e('WordPress now takes a smarter approach to displaying appropriate image sizes on any device, ensuring a perfect fit every time. You don’t need to do anything to your theme, it just works.'); ?></p> |
|
91 | 91 | </div> |
92 | 92 | </div> |
93 | 93 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | <div class="feature-section two-col"> |
97 | 97 | <div class="col"> |
98 | 98 | <div class="embed-container"> |
99 | - <blockquote data-secret="OcUe7B6Edh" class="wp-embedded-content"><a href="https://wordpress.org/news/2015/12/clifford/">WordPress 4.4 “Clifford”</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;" src="https://wordpress.org/news/2015/12/clifford/embed/#?secret=OcUe7B6Edh" data-secret="OcUe7B6Edh" width="600" height="338" title="<?php esc_attr_e( 'Embedded WordPress Post' ); ?>" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> |
|
99 | + <blockquote data-secret="OcUe7B6Edh" class="wp-embedded-content"><a href="https://wordpress.org/news/2015/12/clifford/">WordPress 4.4 “Clifford”</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;" src="https://wordpress.org/news/2015/12/clifford/embed/#?secret=OcUe7B6Edh" data-secret="OcUe7B6Edh" width="600" height="338" title="<?php esc_attr_e('Embedded WordPress Post'); ?>" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | <div class="col"> |
103 | - <h3><?php _e( 'Embed your WordPress content' ); ?></h3> |
|
104 | - <p><?php _e( 'Now you can embed your posts on other sites, even other WordPress sites. Simply drop a post URL into the editor and see an instant embed preview, complete with the title, excerpt, and featured image if you’ve set one. We’ll even include your site icon and links for comments and sharing.' ); ?></p> |
|
103 | + <h3><?php _e('Embed your WordPress content'); ?></h3> |
|
104 | + <p><?php _e('Now you can embed your posts on other sites, even other WordPress sites. Simply drop a post URL into the editor and see an instant embed preview, complete with the title, excerpt, and featured image if you’ve set one. We’ll even include your site icon and links for comments and sharing.'); ?></p> |
|
105 | 105 | </div> |
106 | 106 | </div> |
107 | 107 | |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | </div> |
115 | 115 | </div> |
116 | 116 | <div class="col"> |
117 | - <h3><?php _e( 'Even more embed providers' ); ?></h3> |
|
118 | - <p><?php _e( 'In addition to post embeds, WordPress 4.4 also adds support for five new oEmbed providers: Cloudup, Reddit Comments, ReverbNation, Speaker Deck, and VideoPress.' ); ?></p> |
|
117 | + <h3><?php _e('Even more embed providers'); ?></h3> |
|
118 | + <p><?php _e('In addition to post embeds, WordPress 4.4 also adds support for five new oEmbed providers: Cloudup, Reddit Comments, ReverbNation, Speaker Deck, and VideoPress.'); ?></p> |
|
119 | 119 | </div> |
120 | 120 | </div> |
121 | 121 | |
122 | 122 | <hr /> |
123 | 123 | |
124 | 124 | <div class="changelog"> |
125 | - <h3><?php _e( 'Under the Hood' ); ?></h3> |
|
125 | + <h3><?php _e('Under the Hood'); ?></h3> |
|
126 | 126 | |
127 | 127 | <div class="feature-section under-the-hood one-col"> |
128 | 128 | <div class="col"> |
129 | - <h4><?php _e( 'REST API infrastructure' ); ?></h4> |
|
129 | + <h4><?php _e('REST API infrastructure'); ?></h4> |
|
130 | 130 | <div class="two-col-text"> |
131 | - <p><?php _e( 'Infrastructure for the REST API has been integrated into core, marking a new era in developing with WordPress. The REST API serves to provide developers with a path forward for building and extending RESTful APIs on top of WordPress.' ); ?></p> |
|
131 | + <p><?php _e('Infrastructure for the REST API has been integrated into core, marking a new era in developing with WordPress. The REST API serves to provide developers with a path forward for building and extending RESTful APIs on top of WordPress.'); ?></p> |
|
132 | 132 | <p><?php |
133 | - if ( current_user_can( 'install_plugins' ) ) { |
|
133 | + if (current_user_can('install_plugins')) { |
|
134 | 134 | $url_args = array( |
135 | 135 | 'tab' => 'plugin-information', |
136 | 136 | 'plugin' => 'rest-api', |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | 'height' => 550 |
140 | 140 | ); |
141 | 141 | |
142 | - $plugin_link = '<a href="' . esc_url( add_query_arg( $url_args, network_admin_url( 'plugin-install.php' ) ) ) . '" class="thickbox open-plugin-details-modal">WordPress REST API</a>'; |
|
142 | + $plugin_link = '<a href="'.esc_url(add_query_arg($url_args, network_admin_url('plugin-install.php'))).'" class="thickbox open-plugin-details-modal">WordPress REST API</a>'; |
|
143 | 143 | } else { |
144 | 144 | $plugin_link = '<a href="https://wordpress.org/plugins/rest-api">WordPress REST API</a>'; |
145 | 145 | } |
146 | 146 | |
147 | 147 | /* translators: WordPress REST API plugin link */ |
148 | - printf( __( 'Infrastructure is the first part of a multi-stage rollout for the REST API. Inclusion of core endpoints is targeted for an upcoming release. To get a sneak peek of the core endpoints, and for more information on extending the REST API, check out the official %s plugin.' ), $plugin_link ); |
|
148 | + printf(__('Infrastructure is the first part of a multi-stage rollout for the REST API. Inclusion of core endpoints is targeted for an upcoming release. To get a sneak peek of the core endpoints, and for more information on extending the REST API, check out the official %s plugin.'), $plugin_link); |
|
149 | 149 | ?></p> |
150 | 150 | </div> |
151 | 151 | </div> |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | |
154 | 154 | <div class="feature-section under-the-hood three-col"> |
155 | 155 | <div class="col"> |
156 | - <h4><?php _e( 'Term meta' ); ?></h4> |
|
156 | + <h4><?php _e('Term meta'); ?></h4> |
|
157 | 157 | <p><?php |
158 | 158 | /* translators: 1: add_term_meta() docs link, 2: get_term_meta() docs link, 3: update_term_meta() docs link */ |
159 | - printf( __( 'Terms now support metadata, just like posts. See %1$s, %2$s, and %3$s for more information.' ), |
|
159 | + printf(__('Terms now support metadata, just like posts. See %1$s, %2$s, and %3$s for more information.'), |
|
160 | 160 | '<a href="https://developer.wordpress.org/reference/functions/add_term_meta"><code>add_term_meta()</code></a>', |
161 | 161 | '<a href="https://developer.wordpress.org/reference/functions/get_term_meta"><code>get_term_meta()</code></a>', |
162 | 162 | '<a href="https://developer.wordpress.org/reference/functions/update_term_meta"><code>update_term_meta()</code></a>' |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | ?></p> |
165 | 165 | </div> |
166 | 166 | <div class="col"> |
167 | - <h4><?php _e( 'Comment query improvements' ); ?></h4> |
|
167 | + <h4><?php _e('Comment query improvements'); ?></h4> |
|
168 | 168 | <p><?php |
169 | 169 | /* translators: WP_Comment_Query class name */ |
170 | - printf( __( 'Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler.' ), '<code>WP_Comment_Query</code>' ); |
|
170 | + printf(__('Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler.'), '<code>WP_Comment_Query</code>'); |
|
171 | 171 | ?></p> |
172 | 172 | </div> |
173 | 173 | <div class="col"> |
174 | - <h4><?php _e( 'Term, comment, and network objects' ); ?></h4> |
|
174 | + <h4><?php _e('Term, comment, and network objects'); ?></h4> |
|
175 | 175 | <p><?php |
176 | 176 | /* translators: 1: WP_Term class name, WP_Comment class name, WP_Network class name */ |
177 | - printf( __( 'New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code.' ), |
|
177 | + printf(__('New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code.'), |
|
178 | 178 | '<code>WP_Term</code>', |
179 | 179 | '<code>WP_Comment</code>', |
180 | 180 | '<code>WP_Network</code>' |
@@ -184,48 +184,48 @@ discard block |
||
184 | 184 | </div> |
185 | 185 | |
186 | 186 | <div class="return-to-dashboard"> |
187 | - <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> |
|
188 | - <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"> |
|
189 | - <?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard → Updates' ); ?> |
|
187 | + <?php if (current_user_can('update_core') && isset($_GET['updated'])) : ?> |
|
188 | + <a href="<?php echo esc_url(self_admin_url('update-core.php')); ?>"> |
|
189 | + <?php is_multisite() ? _e('Return to Updates') : _e('Return to Dashboard → Updates'); ?> |
|
190 | 190 | </a> | |
191 | 191 | <?php endif; ?> |
192 | - <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard → Home' ) : _e( 'Go to Dashboard' ); ?></a> |
|
192 | + <a href="<?php echo esc_url(self_admin_url()); ?>"><?php is_blog_admin() ? _e('Go to Dashboard → Home') : _e('Go to Dashboard'); ?></a> |
|
193 | 193 | </div> |
194 | 194 | |
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | 198 | |
199 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
199 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
200 | 200 | |
201 | 201 | // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. |
202 | 202 | return; |
203 | 203 | |
204 | -__( 'Maintenance Release' ); |
|
205 | -__( 'Maintenance Releases' ); |
|
204 | +__('Maintenance Release'); |
|
205 | +__('Maintenance Releases'); |
|
206 | 206 | |
207 | -__( 'Security Release' ); |
|
208 | -__( 'Security Releases' ); |
|
207 | +__('Security Release'); |
|
208 | +__('Security Releases'); |
|
209 | 209 | |
210 | -__( 'Maintenance and Security Release' ); |
|
211 | -__( 'Maintenance and Security Releases' ); |
|
210 | +__('Maintenance and Security Release'); |
|
211 | +__('Maintenance and Security Releases'); |
|
212 | 212 | |
213 | 213 | /* translators: %s: WordPress version number */ |
214 | -__( '<strong>Version %s</strong> addressed one security issue.' ); |
|
214 | +__('<strong>Version %s</strong> addressed one security issue.'); |
|
215 | 215 | /* translators: %s: WordPress version number */ |
216 | -__( '<strong>Version %s</strong> addressed some security issues.' ); |
|
216 | +__('<strong>Version %s</strong> addressed some security issues.'); |
|
217 | 217 | |
218 | 218 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
219 | -_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
|
220 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
219 | +_n_noop('<strong>Version %1$s</strong> addressed %2$s bug.', |
|
220 | + '<strong>Version %1$s</strong> addressed %2$s bugs.'); |
|
221 | 221 | |
222 | 222 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
223 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
224 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
223 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
224 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.'); |
|
225 | 225 | |
226 | 226 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
227 | -_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
228 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
227 | +_n_noop('<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
228 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.'); |
|
229 | 229 | |
230 | 230 | /* translators: %s: Codex URL */ |
231 | -__( 'For more information, see <a href="%s">the release notes</a>.' ); |
|
231 | +__('For more information, see <a href="%s">the release notes</a>.'); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | $title = $tax->labels->edit_item; |
32 | 32 | |
33 | 33 | if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || |
34 | - ! current_user_can( $tax->cap->manage_terms ) |
|
34 | + ! current_user_can( $tax->cap->manage_terms ) |
|
35 | 35 | ) { |
36 | 36 | wp_die( |
37 | 37 | '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( empty( $_REQUEST['tag_ID'] ) ) { |
|
14 | - $sendback = admin_url( 'edit-tags.php' ); |
|
15 | - if ( ! empty( $taxnow ) ) { |
|
16 | - $sendback = add_query_arg( array( 'taxonomy' => $taxnow ), $sendback ); |
|
13 | +if (empty($_REQUEST['tag_ID'])) { |
|
14 | + $sendback = admin_url('edit-tags.php'); |
|
15 | + if ( ! empty($taxnow)) { |
|
16 | + $sendback = add_query_arg(array('taxonomy' => $taxnow), $sendback); |
|
17 | 17 | } |
18 | - wp_redirect( esc_url( $sendback ) ); |
|
18 | + wp_redirect(esc_url($sendback)); |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
22 | -$tag_ID = absint( $_REQUEST['tag_ID'] ); |
|
23 | -$tag = get_term( $tag_ID, '', OBJECT, 'edit' ); |
|
22 | +$tag_ID = absint($_REQUEST['tag_ID']); |
|
23 | +$tag = get_term($tag_ID, '', OBJECT, 'edit'); |
|
24 | 24 | |
25 | -if ( ! $tag instanceof WP_Term ) { |
|
26 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
25 | +if ( ! $tag instanceof WP_Term) { |
|
26 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
27 | 27 | } |
28 | 28 | |
29 | -$tax = get_taxonomy( $tag->taxonomy ); |
|
29 | +$tax = get_taxonomy($tag->taxonomy); |
|
30 | 30 | $taxonomy = $tax->name; |
31 | 31 | $title = $tax->labels->edit_item; |
32 | 32 | |
33 | -if ( ! in_array( $taxonomy, get_taxonomies( array( 'show_ui' => true ) ) ) || |
|
34 | - ! current_user_can( $tax->cap->manage_terms ) |
|
33 | +if ( ! in_array($taxonomy, get_taxonomies(array('show_ui' => true))) || |
|
34 | + ! current_user_can($tax->cap->manage_terms) |
|
35 | 35 | ) { |
36 | 36 | wp_die( |
37 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
38 | - '<p>' . __( 'You are not allowed to manage this item.' ) . '</p>', |
|
37 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
38 | + '<p>'.__('You are not allowed to manage this item.').'</p>', |
|
39 | 39 | 403 |
40 | 40 | ); |
41 | 41 | } |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | $post_type = get_current_screen()->post_type; |
44 | 44 | |
45 | 45 | // Default to the first object_type associated with the taxonomy if no post type was passed. |
46 | -if ( empty( $post_type ) ) { |
|
47 | - $post_type = reset( $tax->object_type ); |
|
46 | +if (empty($post_type)) { |
|
47 | + $post_type = reset($tax->object_type); |
|
48 | 48 | } |
49 | 49 | |
50 | -if ( 'post' != $post_type ) { |
|
51 | - $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
50 | +if ('post' != $post_type) { |
|
51 | + $parent_file = ('attachment' == $post_type) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
52 | 52 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
53 | -} elseif ( 'link_category' == $taxonomy ) { |
|
53 | +} elseif ('link_category' == $taxonomy) { |
|
54 | 54 | $parent_file = 'link-manager.php'; |
55 | 55 | $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
56 | 56 | } else { |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
59 | 59 | } |
60 | 60 | |
61 | -get_current_screen()->set_screen_reader_content( array( |
|
61 | +get_current_screen()->set_screen_reader_content(array( |
|
62 | 62 | 'heading_pagination' => $tax->labels->items_list_navigation, |
63 | 63 | 'heading_list' => $tax->labels->items_list, |
64 | -) ); |
|
64 | +)); |
|
65 | 65 | |
66 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
67 | -include( ABSPATH . 'wp-admin/edit-tag-form.php' ); |
|
68 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
66 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
67 | +include(ABSPATH.'wp-admin/edit-tag-form.php'); |
|
68 | +include(ABSPATH.'wp-admin/admin-footer.php'); |