@@ -7,115 +7,115 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! current_user_can( 'manage_options' ) ) |
|
13 | - wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
|
12 | +if ( ! current_user_can('manage_options')) |
|
13 | + wp_die(__('Sorry, you are not allowed to manage options for this site.')); |
|
14 | 14 | |
15 | -$title = __( 'Reading Settings' ); |
|
15 | +$title = __('Reading Settings'); |
|
16 | 16 | $parent_file = 'options-general.php'; |
17 | 17 | |
18 | 18 | add_action('admin_head', 'options_reading_add_js'); |
19 | 19 | |
20 | -get_current_screen()->add_help_tab( array( |
|
20 | +get_current_screen()->add_help_tab(array( |
|
21 | 21 | 'id' => 'overview', |
22 | 22 | 'title' => __('Overview'), |
23 | - 'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' . |
|
24 | - '<p>' . sprintf(__('You can choose what’s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' . |
|
25 | - '<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.') . '</p>' . |
|
26 | - '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
|
27 | -) ); |
|
23 | + 'content' => '<p>'.__('This screen contains the settings that affect the display of your content.').'</p>'. |
|
24 | + '<p>'.sprintf(__('You can choose what’s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page').'</p>'. |
|
25 | + '<p>'.__('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.').'</p>'. |
|
26 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>', |
|
27 | +)); |
|
28 | 28 | |
29 | -get_current_screen()->add_help_tab( array( |
|
29 | +get_current_screen()->add_help_tab(array( |
|
30 | 30 | 'id' => 'site-visibility', |
31 | - 'title' => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ), |
|
32 | - 'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to “Discourage search engines from indexing this site” and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' . |
|
33 | - '<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, “Search Engines Discouraged,” to remind you that your site is not being crawled.' ) . '</p>', |
|
34 | -) ); |
|
31 | + 'title' => has_action('blog_privacy_selector') ? __('Site Visibility') : __('Search Engine Visibility'), |
|
32 | + 'content' => '<p>'.__('You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to “Discourage search engines from indexing this site” and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.').'</p>'. |
|
33 | + '<p>'.__('When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, “Search Engines Discouraged,” to remind you that your site is not being crawled.').'</p>', |
|
34 | +)); |
|
35 | 35 | |
36 | 36 | get_current_screen()->set_help_sidebar( |
37 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
38 | - '<p>' . __('<a href="https://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' . |
|
39 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
37 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
38 | + '<p>'.__('<a href="https://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>').'</p>'. |
|
39 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
40 | 40 | ); |
41 | 41 | |
42 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
42 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
43 | 43 | ?> |
44 | 44 | |
45 | 45 | <div class="wrap"> |
46 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
46 | +<h1><?php echo esc_html($title); ?></h1> |
|
47 | 47 | |
48 | 48 | <form method="post" action="options.php"> |
49 | 49 | <?php |
50 | -settings_fields( 'reading' ); |
|
50 | +settings_fields('reading'); |
|
51 | 51 | |
52 | -if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) |
|
53 | - add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) ); |
|
52 | +if ( ! in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8'))) |
|
53 | + add_settings_field('blog_charset', __('Encoding for pages and feeds'), 'options_reading_blog_charset', 'reading', 'default', array('label_for' => 'blog_charset')); |
|
54 | 54 | ?> |
55 | 55 | |
56 | -<?php if ( ! get_pages() ) : ?> |
|
56 | +<?php if ( ! get_pages()) : ?> |
|
57 | 57 | <input name="show_on_front" type="hidden" value="posts" /> |
58 | 58 | <table class="form-table"> |
59 | 59 | <?php |
60 | - if ( 'posts' != get_option( 'show_on_front' ) ) : |
|
61 | - update_option( 'show_on_front', 'posts' ); |
|
60 | + if ('posts' != get_option('show_on_front')) : |
|
61 | + update_option('show_on_front', 'posts'); |
|
62 | 62 | endif; |
63 | 63 | |
64 | 64 | else : |
65 | - if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) ) |
|
66 | - update_option( 'show_on_front', 'posts' ); |
|
65 | + if ('page' == get_option('show_on_front') && ! get_option('page_on_front') && ! get_option('page_for_posts')) |
|
66 | + update_option('show_on_front', 'posts'); |
|
67 | 67 | ?> |
68 | 68 | <table class="form-table"> |
69 | 69 | <tr> |
70 | -<th scope="row"><?php _e( 'Front page displays' ); ?></th> |
|
71 | -<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend> |
|
70 | +<th scope="row"><?php _e('Front page displays'); ?></th> |
|
71 | +<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e('Front page displays'); ?></span></legend> |
|
72 | 72 | <p><label> |
73 | - <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> /> |
|
74 | - <?php _e( 'Your latest posts' ); ?> |
|
73 | + <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> /> |
|
74 | + <?php _e('Your latest posts'); ?> |
|
75 | 75 | </label> |
76 | 76 | </p> |
77 | 77 | <p><label> |
78 | - <input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> /> |
|
79 | - <?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?> |
|
78 | + <input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> /> |
|
79 | + <?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit.php?post_type=page'); ?> |
|
80 | 80 | </label> |
81 | 81 | </p> |
82 | 82 | <ul> |
83 | - <li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li> |
|
84 | - <li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '— Select —' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li> |
|
83 | + <li><label for="page_on_front"><?php printf(__('Front page: %s'), wp_dropdown_pages(array('name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => get_option('page_on_front')))); ?></label></li> |
|
84 | + <li><label for="page_for_posts"><?php printf(__('Posts page: %s'), wp_dropdown_pages(array('name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => get_option('page_for_posts')))); ?></label></li> |
|
85 | 85 | </ul> |
86 | -<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?> |
|
87 | -<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div> |
|
86 | +<?php if ('page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front')) : ?> |
|
87 | +<div id="front-page-warning" class="error inline"><p><?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?></p></div> |
|
88 | 88 | <?php endif; ?> |
89 | 89 | </fieldset></td> |
90 | 90 | </tr> |
91 | 91 | <?php endif; ?> |
92 | 92 | <tr> |
93 | -<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th> |
|
93 | +<th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most'); ?></label></th> |
|
94 | 94 | <td> |
95 | -<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?> |
|
95 | +<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" class="small-text" /> <?php _e('posts'); ?> |
|
96 | 96 | </td> |
97 | 97 | </tr> |
98 | 98 | <tr> |
99 | -<th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th> |
|
100 | -<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td> |
|
99 | +<th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent'); ?></label></th> |
|
100 | +<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" class="small-text" /> <?php _e('items'); ?></td> |
|
101 | 101 | </tr> |
102 | 102 | <tr> |
103 | -<th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th> |
|
104 | -<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend> |
|
105 | -<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Full text' ); ?></label><br /> |
|
106 | -<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p> |
|
103 | +<th scope="row"><?php _e('For each article in a feed, show'); ?> </th> |
|
104 | +<td><fieldset><legend class="screen-reader-text"><span><?php _e('For each article in a feed, show'); ?> </span></legend> |
|
105 | +<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?> /> <?php _e('Full text'); ?></label><br /> |
|
106 | +<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary'); ?></label></p> |
|
107 | 107 | </fieldset></td> |
108 | 108 | </tr> |
109 | 109 | |
110 | 110 | <tr class="option-site-visibility"> |
111 | -<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th> |
|
112 | -<td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend> |
|
113 | -<?php if ( has_action( 'blog_privacy_selector' ) ) : ?> |
|
111 | +<th scope="row"><?php has_action('blog_privacy_selector') ? _e('Site Visibility') : _e('Search Engine Visibility'); ?> </th> |
|
112 | +<td><fieldset><legend class="screen-reader-text"><span><?php has_action('blog_privacy_selector') ? _e('Site Visibility') : _e('Search Engine Visibility'); ?> </span></legend> |
|
113 | +<?php if (has_action('blog_privacy_selector')) : ?> |
|
114 | 114 | <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> /> |
115 | - <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/> |
|
115 | + <label for="blog-public"><?php _e('Allow search engines to index this site'); ?></label><br/> |
|
116 | 116 | <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> /> |
117 | - <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
|
118 | - <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.' ); ?></p> |
|
117 | + <label for="blog-norobots"><?php _e('Discourage search engines from indexing this site'); ?></label> |
|
118 | + <p class="description"><?php _e('Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.'); ?></p> |
|
119 | 119 | <?php |
120 | 120 | /** |
121 | 121 | * Enable the legacy 'Site Visibility' privacy options. |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @since 2.1.0 |
132 | 132 | */ |
133 | - do_action( 'blog_privacy_selector' ); |
|
133 | + do_action('blog_privacy_selector'); |
|
134 | 134 | ?> |
135 | 135 | <?php else : ?> |
136 | - <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> /> |
|
137 | - <?php _e( 'Discourage search engines from indexing this site' ); ?></label> |
|
138 | - <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> |
|
136 | + <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> /> |
|
137 | + <?php _e('Discourage search engines from indexing this site'); ?></label> |
|
138 | + <p class="description"><?php _e('It is up to search engines to honor this request.'); ?></p> |
|
139 | 139 | <?php endif; ?> |
140 | 140 | </fieldset></td> |
141 | 141 | </tr> |
142 | 142 | |
143 | -<?php do_settings_fields( 'reading', 'default' ); ?> |
|
143 | +<?php do_settings_fields('reading', 'default'); ?> |
|
144 | 144 | </table> |
145 | 145 | |
146 | -<?php do_settings_sections( 'reading' ); ?> |
|
146 | +<?php do_settings_sections('reading'); ?> |
|
147 | 147 | |
148 | 148 | <?php submit_button(); ?> |
149 | 149 | </form> |
150 | 150 | </div> |
151 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
151 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
13 | +require_once(dirname(__FILE__).'/admin.php'); |
|
14 | 14 | |
15 | 15 | // Load all the nav menu interface functions |
16 | -require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' ); |
|
16 | +require_once(ABSPATH.'wp-admin/includes/nav-menu.php'); |
|
17 | 17 | |
18 | -if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) ) |
|
19 | - wp_die( __( 'Your theme does not support navigation menus or widgets.' ) ); |
|
18 | +if ( ! current_theme_supports('menus') && ! current_theme_supports('widgets')) |
|
19 | + wp_die(__('Your theme does not support navigation menus or widgets.')); |
|
20 | 20 | |
21 | 21 | // Permissions Check |
22 | -if ( ! current_user_can( 'edit_theme_options' ) ) { |
|
22 | +if ( ! current_user_can('edit_theme_options')) { |
|
23 | 23 | wp_die( |
24 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
25 | - '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>', |
|
24 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
25 | + '<p>'.__('Sorry, you are not allowed to edit theme options on this site.').'</p>', |
|
26 | 26 | 403 |
27 | 27 | ); |
28 | 28 | } |
29 | 29 | |
30 | -wp_enqueue_script( 'nav-menu' ); |
|
30 | +wp_enqueue_script('nav-menu'); |
|
31 | 31 | |
32 | -if ( wp_is_mobile() ) |
|
33 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
32 | +if (wp_is_mobile()) |
|
33 | + wp_enqueue_script('jquery-touch-punch'); |
|
34 | 34 | |
35 | 35 | // Container for any messages displayed to the user |
36 | 36 | $messages = array(); |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | $nav_menu_selected_title = ''; |
40 | 40 | |
41 | 41 | // The menu id of the current menu being edited |
42 | -$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; |
|
42 | +$nav_menu_selected_id = isset($_REQUEST['menu']) ? (int) $_REQUEST['menu'] : 0; |
|
43 | 43 | |
44 | 44 | // Get existing menu locations assignments |
45 | 45 | $locations = get_registered_nav_menus(); |
46 | 46 | $menu_locations = get_nav_menu_locations(); |
47 | -$num_locations = count( array_keys( $locations ) ); |
|
47 | +$num_locations = count(array_keys($locations)); |
|
48 | 48 | |
49 | 49 | // Allowed actions: add, update, delete |
50 | -$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; |
|
50 | +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'edit'; |
|
51 | 51 | |
52 | 52 | /* |
53 | 53 | * If a JSON blob of navigation menu data is found, expand it and inject it |
@@ -55,32 +55,32 @@ discard block |
||
55 | 55 | */ |
56 | 56 | _wp_expand_nav_menu_post_data(); |
57 | 57 | |
58 | -switch ( $action ) { |
|
58 | +switch ($action) { |
|
59 | 59 | case 'add-menu-item': |
60 | - check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' ); |
|
61 | - if ( isset( $_REQUEST['nav-menu-locations'] ) ) |
|
62 | - set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) ); |
|
63 | - elseif ( isset( $_REQUEST['menu-item'] ) ) |
|
64 | - wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] ); |
|
60 | + check_admin_referer('add-menu_item', 'menu-settings-column-nonce'); |
|
61 | + if (isset($_REQUEST['nav-menu-locations'])) |
|
62 | + set_theme_mod('nav_menu_locations', array_map('absint', $_REQUEST['menu-locations'])); |
|
63 | + elseif (isset($_REQUEST['menu-item'])) |
|
64 | + wp_save_nav_menu_items($nav_menu_selected_id, $_REQUEST['menu-item']); |
|
65 | 65 | break; |
66 | 66 | case 'move-down-menu-item' : |
67 | 67 | |
68 | 68 | // Moving down a menu item is the same as moving up the next in order. |
69 | - check_admin_referer( 'move-menu_item' ); |
|
70 | - $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; |
|
71 | - if ( is_nav_menu_item( $menu_item_id ) ) { |
|
72 | - $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); |
|
73 | - if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { |
|
69 | + check_admin_referer('move-menu_item'); |
|
70 | + $menu_item_id = isset($_REQUEST['menu-item']) ? (int) $_REQUEST['menu-item'] : 0; |
|
71 | + if (is_nav_menu_item($menu_item_id)) { |
|
72 | + $menus = isset($_REQUEST['menu']) ? array((int) $_REQUEST['menu']) : wp_get_object_terms($menu_item_id, 'nav_menu', array('fields' => 'ids')); |
|
73 | + if ( ! is_wp_error($menus) && ! empty($menus[0])) { |
|
74 | 74 | $menu_id = (int) $menus[0]; |
75 | - $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); |
|
76 | - $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); |
|
75 | + $ordered_menu_items = wp_get_nav_menu_items($menu_id); |
|
76 | + $menu_item_data = (array) wp_setup_nav_menu_item(get_post($menu_item_id)); |
|
77 | 77 | |
78 | 78 | // Set up the data we need in one pass through the array of menu items. |
79 | 79 | $dbids_to_orders = array(); |
80 | 80 | $orders_to_dbids = array(); |
81 | - foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { |
|
82 | - if ( isset( $ordered_menu_item_object->ID ) ) { |
|
83 | - if ( isset( $ordered_menu_item_object->menu_order ) ) { |
|
81 | + foreach ((array) $ordered_menu_items as $ordered_menu_item_object) { |
|
82 | + if (isset($ordered_menu_item_object->ID)) { |
|
83 | + if (isset($ordered_menu_item_object->menu_order)) { |
|
84 | 84 | $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; |
85 | 85 | $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID; |
86 | 86 | } |
@@ -89,28 +89,28 @@ discard block |
||
89 | 89 | |
90 | 90 | // Get next in order. |
91 | 91 | if ( |
92 | - isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] ) |
|
92 | + isset($orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1]) |
|
93 | 93 | ) { |
94 | 94 | $next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1]; |
95 | - $next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) ); |
|
95 | + $next_item_data = (array) wp_setup_nav_menu_item(get_post($next_item_id)); |
|
96 | 96 | |
97 | 97 | // If not siblings of same parent, bubble menu item up but keep order. |
98 | 98 | if ( |
99 | - ! empty( $menu_item_data['menu_item_parent'] ) && |
|
99 | + ! empty($menu_item_data['menu_item_parent']) && |
|
100 | 100 | ( |
101 | - empty( $next_item_data['menu_item_parent'] ) || |
|
101 | + empty($next_item_data['menu_item_parent']) || |
|
102 | 102 | $next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent'] |
103 | 103 | ) |
104 | 104 | ) { |
105 | 105 | |
106 | - $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; |
|
106 | + $parent_db_id = in_array($menu_item_data['menu_item_parent'], $orders_to_dbids) ? (int) $menu_item_data['menu_item_parent'] : 0; |
|
107 | 107 | |
108 | - $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); |
|
108 | + $parent_object = wp_setup_nav_menu_item(get_post($parent_db_id)); |
|
109 | 109 | |
110 | - if ( ! is_wp_error( $parent_object ) ) { |
|
110 | + if ( ! is_wp_error($parent_object)) { |
|
111 | 111 | $parent_data = (array) $parent_object; |
112 | 112 | $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; |
113 | - update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
|
113 | + update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1; |
121 | 121 | |
122 | 122 | $menu_item_data['menu_item_parent'] = $next_item_data['ID']; |
123 | - update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
|
123 | + update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']); |
|
124 | 124 | |
125 | 125 | wp_update_post($menu_item_data); |
126 | 126 | wp_update_post($next_item_data); |
@@ -128,32 +128,32 @@ discard block |
||
128 | 128 | |
129 | 129 | // The item is last but still has a parent, so bubble up. |
130 | 130 | } elseif ( |
131 | - ! empty( $menu_item_data['menu_item_parent'] ) && |
|
132 | - in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) |
|
131 | + ! empty($menu_item_data['menu_item_parent']) && |
|
132 | + in_array($menu_item_data['menu_item_parent'], $orders_to_dbids) |
|
133 | 133 | ) { |
134 | - $menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true); |
|
135 | - update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
|
134 | + $menu_item_data['menu_item_parent'] = (int) get_post_meta($menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true); |
|
135 | + update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | break; |
141 | 141 | case 'move-up-menu-item' : |
142 | - check_admin_referer( 'move-menu_item' ); |
|
143 | - $menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0; |
|
144 | - if ( is_nav_menu_item( $menu_item_id ) ) { |
|
145 | - $menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) ); |
|
146 | - if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) { |
|
142 | + check_admin_referer('move-menu_item'); |
|
143 | + $menu_item_id = isset($_REQUEST['menu-item']) ? (int) $_REQUEST['menu-item'] : 0; |
|
144 | + if (is_nav_menu_item($menu_item_id)) { |
|
145 | + $menus = isset($_REQUEST['menu']) ? array((int) $_REQUEST['menu']) : wp_get_object_terms($menu_item_id, 'nav_menu', array('fields' => 'ids')); |
|
146 | + if ( ! is_wp_error($menus) && ! empty($menus[0])) { |
|
147 | 147 | $menu_id = (int) $menus[0]; |
148 | - $ordered_menu_items = wp_get_nav_menu_items( $menu_id ); |
|
149 | - $menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) ); |
|
148 | + $ordered_menu_items = wp_get_nav_menu_items($menu_id); |
|
149 | + $menu_item_data = (array) wp_setup_nav_menu_item(get_post($menu_item_id)); |
|
150 | 150 | |
151 | 151 | // Set up the data we need in one pass through the array of menu items. |
152 | 152 | $dbids_to_orders = array(); |
153 | 153 | $orders_to_dbids = array(); |
154 | - foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) { |
|
155 | - if ( isset( $ordered_menu_item_object->ID ) ) { |
|
156 | - if ( isset( $ordered_menu_item_object->menu_order ) ) { |
|
154 | + foreach ((array) $ordered_menu_items as $ordered_menu_item_object) { |
|
155 | + if (isset($ordered_menu_item_object->ID)) { |
|
156 | + if (isset($ordered_menu_item_object->menu_order)) { |
|
157 | 157 | $dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order; |
158 | 158 | $orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID; |
159 | 159 | } |
@@ -161,19 +161,19 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | // If this menu item is not first. |
164 | - if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) { |
|
164 | + if ( ! empty($dbids_to_orders[$menu_item_id]) && ! empty($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1])) { |
|
165 | 165 | |
166 | 166 | // If this menu item is a child of the previous. |
167 | 167 | if ( |
168 | - ! empty( $menu_item_data['menu_item_parent'] ) && |
|
169 | - in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) && |
|
170 | - isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) && |
|
171 | - ( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) |
|
168 | + ! empty($menu_item_data['menu_item_parent']) && |
|
169 | + in_array($menu_item_data['menu_item_parent'], array_keys($dbids_to_orders)) && |
|
170 | + isset($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]) && |
|
171 | + ($menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]) |
|
172 | 172 | ) { |
173 | - $parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0; |
|
174 | - $parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) ); |
|
173 | + $parent_db_id = in_array($menu_item_data['menu_item_parent'], $orders_to_dbids) ? (int) $menu_item_data['menu_item_parent'] : 0; |
|
174 | + $parent_object = wp_setup_nav_menu_item(get_post($parent_db_id)); |
|
175 | 175 | |
176 | - if ( ! is_wp_error( $parent_object ) ) { |
|
176 | + if ( ! is_wp_error($parent_object)) { |
|
177 | 177 | $parent_data = (array) $parent_object; |
178 | 178 | |
179 | 179 | /* |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * make menu item a child also of it. |
182 | 182 | */ |
183 | 183 | if ( |
184 | - ! empty( $dbids_to_orders[$parent_db_id] ) && |
|
185 | - ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) && |
|
186 | - ! empty( $parent_data['menu_item_parent'] ) |
|
184 | + ! empty($dbids_to_orders[$parent_db_id]) && |
|
185 | + ! empty($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1]) && |
|
186 | + ! empty($parent_data['menu_item_parent']) |
|
187 | 187 | ) { |
188 | 188 | $menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent']; |
189 | 189 | |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | * make menu item a child of that something's parent |
193 | 193 | */ |
194 | 194 | } elseif ( |
195 | - ! empty( $dbids_to_orders[$parent_db_id] ) && |
|
196 | - ! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) |
|
195 | + ! empty($dbids_to_orders[$parent_db_id]) && |
|
196 | + ! empty($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1]) |
|
197 | 197 | ) { |
198 | - $_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true); |
|
199 | - if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) |
|
198 | + $_possible_parent_id = (int) get_post_meta($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true); |
|
199 | + if (in_array($_possible_parent_id, array_keys($dbids_to_orders))) |
|
200 | 200 | $menu_item_data['menu_item_parent'] = $_possible_parent_id; |
201 | 201 | else |
202 | 202 | $menu_item_data['menu_item_parent'] = 0; |
@@ -213,22 +213,22 @@ discard block |
||
213 | 213 | $menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1; |
214 | 214 | |
215 | 215 | // Save changes. |
216 | - update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
|
216 | + update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']); |
|
217 | 217 | wp_update_post($menu_item_data); |
218 | 218 | wp_update_post($parent_data); |
219 | 219 | } |
220 | 220 | |
221 | 221 | // Else this menu item is not a child of the previous. |
222 | 222 | } elseif ( |
223 | - empty( $menu_item_data['menu_order'] ) || |
|
224 | - empty( $menu_item_data['menu_item_parent'] ) || |
|
225 | - ! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) || |
|
226 | - empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) || |
|
223 | + empty($menu_item_data['menu_order']) || |
|
224 | + empty($menu_item_data['menu_item_parent']) || |
|
225 | + ! in_array($menu_item_data['menu_item_parent'], array_keys($dbids_to_orders)) || |
|
226 | + empty($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]) || |
|
227 | 227 | $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent'] |
228 | 228 | ) { |
229 | 229 | // Just make it a child of the previous; keep the order. |
230 | 230 | $menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]; |
231 | - update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] ); |
|
231 | + update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']); |
|
232 | 232 | wp_update_post($menu_item_data); |
233 | 233 | } |
234 | 234 | } |
@@ -239,244 +239,244 @@ discard block |
||
239 | 239 | case 'delete-menu-item': |
240 | 240 | $menu_item_id = (int) $_REQUEST['menu-item']; |
241 | 241 | |
242 | - check_admin_referer( 'delete-menu_item_' . $menu_item_id ); |
|
242 | + check_admin_referer('delete-menu_item_'.$menu_item_id); |
|
243 | 243 | |
244 | - if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) |
|
245 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('The menu item has been successfully deleted.') . '</p></div>'; |
|
244 | + if (is_nav_menu_item($menu_item_id) && wp_delete_post($menu_item_id, true)) |
|
245 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('The menu item has been successfully deleted.').'</p></div>'; |
|
246 | 246 | break; |
247 | 247 | |
248 | 248 | case 'delete': |
249 | - check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id ); |
|
250 | - if ( is_nav_menu( $nav_menu_selected_id ) ) { |
|
251 | - $deletion = wp_delete_nav_menu( $nav_menu_selected_id ); |
|
249 | + check_admin_referer('delete-nav_menu-'.$nav_menu_selected_id); |
|
250 | + if (is_nav_menu($nav_menu_selected_id)) { |
|
251 | + $deletion = wp_delete_nav_menu($nav_menu_selected_id); |
|
252 | 252 | } else { |
253 | 253 | // Reset the selected menu. |
254 | 254 | $nav_menu_selected_id = 0; |
255 | - unset( $_REQUEST['menu'] ); |
|
255 | + unset($_REQUEST['menu']); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( ! isset( $deletion ) ) |
|
258 | + if ( ! isset($deletion)) |
|
259 | 259 | break; |
260 | 260 | |
261 | - if ( is_wp_error( $deletion ) ) |
|
262 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>'; |
|
261 | + if (is_wp_error($deletion)) |
|
262 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$deletion->get_error_message().'</p></div>'; |
|
263 | 263 | else |
264 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>'; |
|
264 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('The menu has been successfully deleted.').'</p></div>'; |
|
265 | 265 | break; |
266 | 266 | |
267 | 267 | case 'delete_menus': |
268 | - check_admin_referer( 'nav_menus_bulk_actions' ); |
|
269 | - foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) { |
|
270 | - if ( ! is_nav_menu( $menu_id_to_delete ) ) |
|
268 | + check_admin_referer('nav_menus_bulk_actions'); |
|
269 | + foreach ($_REQUEST['delete_menus'] as $menu_id_to_delete) { |
|
270 | + if ( ! is_nav_menu($menu_id_to_delete)) |
|
271 | 271 | continue; |
272 | 272 | |
273 | - $deletion = wp_delete_nav_menu( $menu_id_to_delete ); |
|
274 | - if ( is_wp_error( $deletion ) ) { |
|
275 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>'; |
|
273 | + $deletion = wp_delete_nav_menu($menu_id_to_delete); |
|
274 | + if (is_wp_error($deletion)) { |
|
275 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$deletion->get_error_message().'</p></div>'; |
|
276 | 276 | $deletion_error = true; |
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | - if ( empty( $deletion_error ) ) |
|
281 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>'; |
|
280 | + if (empty($deletion_error)) |
|
281 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Selected menus have been successfully deleted.').'</p></div>'; |
|
282 | 282 | break; |
283 | 283 | |
284 | 284 | case 'update': |
285 | - check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' ); |
|
285 | + check_admin_referer('update-nav_menu', 'update-nav-menu-nonce'); |
|
286 | 286 | |
287 | 287 | // Remove menu locations that have been unchecked. |
288 | - foreach ( $locations as $location => $description ) { |
|
289 | - if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) |
|
290 | - unset( $menu_locations[ $location ] ); |
|
288 | + foreach ($locations as $location => $description) { |
|
289 | + if ((empty($_POST['menu-locations']) || empty($_POST['menu-locations'][$location])) && isset($menu_locations[$location]) && $menu_locations[$location] == $nav_menu_selected_id) |
|
290 | + unset($menu_locations[$location]); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Merge new and existing menu locations if any new ones are set. |
294 | - if ( isset( $_POST['menu-locations'] ) ) { |
|
295 | - $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); |
|
296 | - $menu_locations = array_merge( $menu_locations, $new_menu_locations ); |
|
294 | + if (isset($_POST['menu-locations'])) { |
|
295 | + $new_menu_locations = array_map('absint', $_POST['menu-locations']); |
|
296 | + $menu_locations = array_merge($menu_locations, $new_menu_locations); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | // Set menu locations. |
300 | - set_theme_mod( 'nav_menu_locations', $menu_locations ); |
|
300 | + set_theme_mod('nav_menu_locations', $menu_locations); |
|
301 | 301 | |
302 | 302 | // Add Menu. |
303 | - if ( 0 == $nav_menu_selected_id ) { |
|
304 | - $new_menu_title = trim( esc_html( $_POST['menu-name'] ) ); |
|
303 | + if (0 == $nav_menu_selected_id) { |
|
304 | + $new_menu_title = trim(esc_html($_POST['menu-name'])); |
|
305 | 305 | |
306 | - if ( $new_menu_title ) { |
|
307 | - $_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) ); |
|
306 | + if ($new_menu_title) { |
|
307 | + $_nav_menu_selected_id = wp_update_nav_menu_object(0, array('menu-name' => $new_menu_title)); |
|
308 | 308 | |
309 | - if ( is_wp_error( $_nav_menu_selected_id ) ) { |
|
310 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; |
|
309 | + if (is_wp_error($_nav_menu_selected_id)) { |
|
310 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$_nav_menu_selected_id->get_error_message().'</p></div>'; |
|
311 | 311 | } else { |
312 | - $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
|
312 | + $_menu_object = wp_get_nav_menu_object($_nav_menu_selected_id); |
|
313 | 313 | $nav_menu_selected_id = $_nav_menu_selected_id; |
314 | 314 | $nav_menu_selected_title = $_menu_object->name; |
315 | - if ( isset( $_REQUEST['menu-item'] ) ) |
|
316 | - wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) ); |
|
317 | - if ( isset( $_REQUEST['zero-menu-state'] ) ) { |
|
315 | + if (isset($_REQUEST['menu-item'])) |
|
316 | + wp_save_nav_menu_items($nav_menu_selected_id, absint($_REQUEST['menu-item'])); |
|
317 | + if (isset($_REQUEST['zero-menu-state'])) { |
|
318 | 318 | // If there are menu items, add them |
319 | - wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ); |
|
319 | + wp_nav_menu_update_menu_items($nav_menu_selected_id, $nav_menu_selected_title); |
|
320 | 320 | // Auto-save nav_menu_locations |
321 | 321 | $locations = get_nav_menu_locations(); |
322 | - foreach ( $locations as $location => $menu_id ) { |
|
323 | - $locations[ $location ] = $nav_menu_selected_id; |
|
322 | + foreach ($locations as $location => $menu_id) { |
|
323 | + $locations[$location] = $nav_menu_selected_id; |
|
324 | 324 | break; // There should only be 1 |
325 | 325 | } |
326 | - set_theme_mod( 'nav_menu_locations', $locations ); |
|
326 | + set_theme_mod('nav_menu_locations', $locations); |
|
327 | 327 | } |
328 | - if ( isset( $_REQUEST['use-location'] ) ) { |
|
328 | + if (isset($_REQUEST['use-location'])) { |
|
329 | 329 | $locations = get_registered_nav_menus(); |
330 | 330 | $menu_locations = get_nav_menu_locations(); |
331 | - if ( isset( $locations[ $_REQUEST['use-location'] ] ) ) |
|
332 | - $menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id; |
|
333 | - set_theme_mod( 'nav_menu_locations', $menu_locations ); |
|
331 | + if (isset($locations[$_REQUEST['use-location']])) |
|
332 | + $menu_locations[$_REQUEST['use-location']] = $nav_menu_selected_id; |
|
333 | + set_theme_mod('nav_menu_locations', $menu_locations); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>'; |
337 | - wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) ); |
|
337 | + wp_redirect(admin_url('nav-menus.php?menu='.$_nav_menu_selected_id)); |
|
338 | 338 | exit(); |
339 | 339 | } |
340 | 340 | } else { |
341 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; |
|
341 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('Please enter a valid menu name.').'</p></div>'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | // Update existing menu. |
345 | 345 | } else { |
346 | 346 | |
347 | - $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); |
|
347 | + $_menu_object = wp_get_nav_menu_object($nav_menu_selected_id); |
|
348 | 348 | |
349 | - $menu_title = trim( esc_html( $_POST['menu-name'] ) ); |
|
350 | - if ( ! $menu_title ) { |
|
351 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>'; |
|
349 | + $menu_title = trim(esc_html($_POST['menu-name'])); |
|
350 | + if ( ! $menu_title) { |
|
351 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('Please enter a valid menu name.').'</p></div>'; |
|
352 | 352 | $menu_title = $_menu_object->name; |
353 | 353 | } |
354 | 354 | |
355 | - if ( ! is_wp_error( $_menu_object ) ) { |
|
356 | - $_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) ); |
|
357 | - if ( is_wp_error( $_nav_menu_selected_id ) ) { |
|
355 | + if ( ! is_wp_error($_menu_object)) { |
|
356 | + $_nav_menu_selected_id = wp_update_nav_menu_object($nav_menu_selected_id, array('menu-name' => $menu_title)); |
|
357 | + if (is_wp_error($_nav_menu_selected_id)) { |
|
358 | 358 | $_menu_object = $_nav_menu_selected_id; |
359 | - $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>'; |
|
359 | + $messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$_nav_menu_selected_id->get_error_message().'</p></div>'; |
|
360 | 360 | } else { |
361 | - $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id ); |
|
361 | + $_menu_object = wp_get_nav_menu_object($_nav_menu_selected_id); |
|
362 | 362 | $nav_menu_selected_title = $_menu_object->name; |
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | 366 | // Update menu items. |
367 | - if ( ! is_wp_error( $_menu_object ) ) { |
|
368 | - $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $_nav_menu_selected_id, $nav_menu_selected_title ) ); |
|
367 | + if ( ! is_wp_error($_menu_object)) { |
|
368 | + $messages = array_merge($messages, wp_nav_menu_update_menu_items($_nav_menu_selected_id, $nav_menu_selected_title)); |
|
369 | 369 | |
370 | 370 | // If the menu ID changed, redirect to the new URL. |
371 | - if ( $nav_menu_selected_id != $_nav_menu_selected_id ) { |
|
372 | - wp_redirect( admin_url( 'nav-menus.php?menu=' . intval( $_nav_menu_selected_id ) ) ); |
|
371 | + if ($nav_menu_selected_id != $_nav_menu_selected_id) { |
|
372 | + wp_redirect(admin_url('nav-menus.php?menu='.intval($_nav_menu_selected_id))); |
|
373 | 373 | exit(); |
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
377 | 377 | break; |
378 | 378 | case 'locations': |
379 | - if ( ! $num_locations ) { |
|
380 | - wp_redirect( admin_url( 'nav-menus.php' ) ); |
|
379 | + if ( ! $num_locations) { |
|
380 | + wp_redirect(admin_url('nav-menus.php')); |
|
381 | 381 | exit(); |
382 | 382 | } |
383 | 383 | |
384 | - add_filter( 'screen_options_show_screen', '__return_false' ); |
|
384 | + add_filter('screen_options_show_screen', '__return_false'); |
|
385 | 385 | |
386 | - if ( isset( $_POST['menu-locations'] ) ) { |
|
387 | - check_admin_referer( 'save-menu-locations' ); |
|
386 | + if (isset($_POST['menu-locations'])) { |
|
387 | + check_admin_referer('save-menu-locations'); |
|
388 | 388 | |
389 | - $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); |
|
390 | - $menu_locations = array_merge( $menu_locations, $new_menu_locations ); |
|
389 | + $new_menu_locations = array_map('absint', $_POST['menu-locations']); |
|
390 | + $menu_locations = array_merge($menu_locations, $new_menu_locations); |
|
391 | 391 | // Set menu locations |
392 | - set_theme_mod( 'nav_menu_locations', $menu_locations ); |
|
392 | + set_theme_mod('nav_menu_locations', $menu_locations); |
|
393 | 393 | |
394 | - $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Menu locations updated.' ) . '</p></div>'; |
|
394 | + $messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Menu locations updated.').'</p></div>'; |
|
395 | 395 | } |
396 | 396 | break; |
397 | 397 | } |
398 | 398 | |
399 | 399 | // Get all nav menus. |
400 | 400 | $nav_menus = wp_get_nav_menus(); |
401 | -$menu_count = count( $nav_menus ); |
|
401 | +$menu_count = count($nav_menus); |
|
402 | 402 | |
403 | 403 | // Are we on the add new screen? |
404 | -$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; |
|
404 | +$add_new_screen = (isset($_GET['menu']) && 0 == $_GET['menu']) ? true : false; |
|
405 | 405 | |
406 | -$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false; |
|
406 | +$locations_screen = (isset($_GET['action']) && 'locations' == $_GET['action']) ? true : false; |
|
407 | 407 | |
408 | 408 | /* |
409 | 409 | * If we have one theme location, and zero menus, we take them right |
410 | 410 | * into editing their first menu. |
411 | 411 | */ |
412 | -$page_count = wp_count_posts( 'page' ); |
|
413 | -$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; |
|
412 | +$page_count = wp_count_posts('page'); |
|
413 | +$one_theme_location_no_menus = (1 == count(get_registered_nav_menus()) && ! $add_new_screen && empty($nav_menus) && ! empty($page_count->publish)) ? true : false; |
|
414 | 414 | |
415 | 415 | $nav_menus_l10n = array( |
416 | 416 | 'oneThemeLocationNoMenus' => $one_theme_location_no_menus, |
417 | - 'moveUp' => __( 'Move up one' ), |
|
418 | - 'moveDown' => __( 'Move down one' ), |
|
419 | - 'moveToTop' => __( 'Move to the top' ), |
|
417 | + 'moveUp' => __('Move up one'), |
|
418 | + 'moveDown' => __('Move down one'), |
|
419 | + 'moveToTop' => __('Move to the top'), |
|
420 | 420 | /* translators: %s: previous item name */ |
421 | - 'moveUnder' => __( 'Move under %s' ), |
|
421 | + 'moveUnder' => __('Move under %s'), |
|
422 | 422 | /* translators: %s: previous item name */ |
423 | - 'moveOutFrom' => __( 'Move out from under %s' ), |
|
423 | + 'moveOutFrom' => __('Move out from under %s'), |
|
424 | 424 | /* translators: %s: previous item name */ |
425 | - 'under' => __( 'Under %s' ), |
|
425 | + 'under' => __('Under %s'), |
|
426 | 426 | /* translators: %s: previous item name */ |
427 | - 'outFrom' => __( 'Out from under %s' ), |
|
427 | + 'outFrom' => __('Out from under %s'), |
|
428 | 428 | /* translators: 1: item name, 2: item position, 3: total number of items */ |
429 | - 'menuFocus' => __( '%1$s. Menu item %2$d of %3$d.' ), |
|
429 | + 'menuFocus' => __('%1$s. Menu item %2$d of %3$d.'), |
|
430 | 430 | /* translators: 1: item name, 2: item position, 3: parent item name */ |
431 | - 'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ), |
|
431 | + 'subMenuFocus' => __('%1$s. Sub item number %2$d under %3$s.'), |
|
432 | 432 | ); |
433 | -wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n ); |
|
433 | +wp_localize_script('nav-menu', 'menus', $nav_menus_l10n); |
|
434 | 434 | |
435 | 435 | /* |
436 | 436 | * Redirect to add screen if there are no menus and this users has either zero, |
437 | 437 | * or more than 1 theme locations. |
438 | 438 | */ |
439 | -if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus ) |
|
440 | - wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) ); |
|
439 | +if (0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus) |
|
440 | + wp_redirect(admin_url('nav-menus.php?action=edit&menu=0')); |
|
441 | 441 | |
442 | 442 | // Get recently edited nav menu. |
443 | -$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) ); |
|
444 | -if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) ) |
|
443 | +$recently_edited = absint(get_user_option('nav_menu_recently_edited')); |
|
444 | +if (empty($recently_edited) && is_nav_menu($nav_menu_selected_id)) |
|
445 | 445 | $recently_edited = $nav_menu_selected_id; |
446 | 446 | |
447 | 447 | // Use $recently_edited if none are selected. |
448 | -if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) |
|
448 | +if (empty($nav_menu_selected_id) && ! isset($_GET['menu']) && is_nav_menu($recently_edited)) |
|
449 | 449 | $nav_menu_selected_id = $recently_edited; |
450 | 450 | |
451 | 451 | // On deletion of menu, if another menu exists, show it. |
452 | -if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) |
|
452 | +if ( ! $add_new_screen && 0 < $menu_count && isset($_GET['action']) && 'delete' == $_GET['action']) |
|
453 | 453 | $nav_menu_selected_id = $nav_menus[0]->term_id; |
454 | 454 | |
455 | 455 | // Set $nav_menu_selected_id to 0 if no menus. |
456 | -if ( $one_theme_location_no_menus ) { |
|
456 | +if ($one_theme_location_no_menus) { |
|
457 | 457 | $nav_menu_selected_id = 0; |
458 | -} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) { |
|
458 | +} elseif (empty($nav_menu_selected_id) && ! empty($nav_menus) && ! $add_new_screen) { |
|
459 | 459 | // if we have no selection yet, and we have menus, set to the first one in the list. |
460 | 460 | $nav_menu_selected_id = $nav_menus[0]->term_id; |
461 | 461 | } |
462 | 462 | |
463 | 463 | // Update the user's setting. |
464 | -if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) ) |
|
465 | - update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id ); |
|
464 | +if ($nav_menu_selected_id != $recently_edited && is_nav_menu($nav_menu_selected_id)) |
|
465 | + update_user_meta($current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id); |
|
466 | 466 | |
467 | 467 | // If there's a menu, get its name. |
468 | -if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { |
|
469 | - $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ); |
|
470 | - $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : ''; |
|
468 | +if ( ! $nav_menu_selected_title && is_nav_menu($nav_menu_selected_id)) { |
|
469 | + $_menu_object = wp_get_nav_menu_object($nav_menu_selected_id); |
|
470 | + $nav_menu_selected_title = ! is_wp_error($_menu_object) ? $_menu_object->name : ''; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | // Generate truncated menu names. |
474 | -foreach ( (array) $nav_menus as $key => $_nav_menu ) { |
|
475 | - $nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '…' ); |
|
474 | +foreach ((array) $nav_menus as $key => $_nav_menu) { |
|
475 | + $nav_menus[$key]->truncated_name = wp_html_excerpt($_nav_menu->name, 40, '…'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | // Retrieve menu locations. |
479 | -if ( current_theme_supports( 'menus' ) ) { |
|
479 | +if (current_theme_supports('menus')) { |
|
480 | 480 | $locations = get_registered_nav_menus(); |
481 | 481 | $menu_locations = get_nav_menu_locations(); |
482 | 482 | } |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | $_wp_nav_menu_max_depth = 0; |
492 | 492 | |
493 | 493 | // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth. |
494 | -if ( is_nav_menu( $nav_menu_selected_id ) ) { |
|
495 | - $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) ); |
|
496 | - $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id ); |
|
494 | +if (is_nav_menu($nav_menu_selected_id)) { |
|
495 | + $menu_items = wp_get_nav_menu_items($nav_menu_selected_id, array('post_status' => 'any')); |
|
496 | + $edit_markup = wp_get_nav_menu_to_edit($nav_menu_selected_id); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param string $classes |
504 | 504 | * @return string |
505 | 505 | */ |
506 | -function wp_nav_menu_max_depth( $classes ) { |
|
506 | +function wp_nav_menu_max_depth($classes) { |
|
507 | 507 | global $_wp_nav_menu_max_depth; |
508 | 508 | return "$classes menu-max-depth-$_wp_nav_menu_max_depth"; |
509 | 509 | } |
@@ -513,138 +513,138 @@ discard block |
||
513 | 513 | wp_nav_menu_setup(); |
514 | 514 | wp_initial_nav_menu_meta_boxes(); |
515 | 515 | |
516 | -if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) |
|
517 | - $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a “Custom Menu” widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>'; |
|
516 | +if ( ! current_theme_supports('menus') && ! $num_locations) |
|
517 | + $messages[] = '<div id="message" class="updated"><p>'.sprintf(__('Your theme does not natively support menus, but you can use them in sidebars by adding a “Custom Menu” widget on the <a href="%s">Widgets</a> screen.'), admin_url('widgets.php')).'</p></div>'; |
|
518 | 518 | |
519 | -if ( ! $locations_screen ) : // Main tab |
|
520 | - $overview = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>'; |
|
521 | - $overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a “Custom Menu” widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Fifteen', 'Twenty Fourteen' ) . '</p>'; |
|
522 | - $overview .= '<p>' . __( 'From this screen you can:' ) . '</p>'; |
|
523 | - $overview .= '<ul><li>' . __( 'Create, edit, and delete menus' ) . '</li>'; |
|
524 | - $overview .= '<li>' . __( 'Add, organize, and modify individual menu items' ) . '</li></ul>'; |
|
519 | +if ( ! $locations_screen) : // Main tab |
|
520 | + $overview = '<p>'.__('This screen is used for managing your custom navigation menus.').'</p>'; |
|
521 | + $overview .= '<p>'.sprintf(__('Menus can be displayed in locations defined by your theme, even used in sidebars by adding a “Custom Menu” widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.'), admin_url('widgets.php'), 'Twenty Fifteen', 'Twenty Fourteen').'</p>'; |
|
522 | + $overview .= '<p>'.__('From this screen you can:').'</p>'; |
|
523 | + $overview .= '<ul><li>'.__('Create, edit, and delete menus').'</li>'; |
|
524 | + $overview .= '<li>'.__('Add, organize, and modify individual menu items').'</li></ul>'; |
|
525 | 525 | |
526 | - get_current_screen()->add_help_tab( array( |
|
526 | + get_current_screen()->add_help_tab(array( |
|
527 | 527 | 'id' => 'overview', |
528 | - 'title' => __( 'Overview' ), |
|
528 | + 'title' => __('Overview'), |
|
529 | 529 | 'content' => $overview |
530 | - ) ); |
|
530 | + )); |
|
531 | 531 | |
532 | - $menu_management = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>'; |
|
533 | - $menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>' ) . '</li>'; |
|
534 | - $menu_management .= '<li>' . __( 'If you haven’t yet created any menus, <strong>click the ’create a new menu’ link</strong> to get started' ) . '</li></ul>'; |
|
535 | - $menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>'; |
|
532 | + $menu_management = '<p>'.__('The menu management box at the top of the screen is used to control which menu is opened in the editor below.').'</p>'; |
|
533 | + $menu_management .= '<ul><li>'.__('To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>').'</li>'; |
|
534 | + $menu_management .= '<li>'.__('If you haven’t yet created any menus, <strong>click the ’create a new menu’ link</strong> to get started').'</li></ul>'; |
|
535 | + $menu_management .= '<p>'.__('You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.').'</p>'; |
|
536 | 536 | |
537 | - get_current_screen()->add_help_tab( array( |
|
537 | + get_current_screen()->add_help_tab(array( |
|
538 | 538 | 'id' => 'menu-management', |
539 | - 'title' => __( 'Menu Management' ), |
|
539 | + 'title' => __('Menu Management'), |
|
540 | 540 | 'content' => $menu_management |
541 | - ) ); |
|
541 | + )); |
|
542 | 542 | |
543 | - $editing_menus = '<p>' . __( 'Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '</p>'; |
|
544 | - $editing_menus .= '<p>' . __( '<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '</p>'; |
|
545 | - $editing_menus .= '<ul><li>' . __( 'Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>' ) . '</li>'; |
|
546 | - $editing_menus .= '<li>' . __( 'To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>' ) .'</li>'; |
|
547 | - $editing_menus .= '<li>' . __( 'To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu' ) . '</li>'; |
|
548 | - $editing_menus .= '<li>' . __( 'Delete a menu item by <strong>expanding it and clicking the Remove link</strong>' ) . '</li></ul>'; |
|
543 | + $editing_menus = '<p>'.__('Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.').'</p>'; |
|
544 | + $editing_menus .= '<p>'.__('<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.').'</p>'; |
|
545 | + $editing_menus .= '<ul><li>'.__('Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>').'</li>'; |
|
546 | + $editing_menus .= '<li>'.__('To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>').'</li>'; |
|
547 | + $editing_menus .= '<li>'.__('To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu').'</li>'; |
|
548 | + $editing_menus .= '<li>'.__('Delete a menu item by <strong>expanding it and clicking the Remove link</strong>').'</li></ul>'; |
|
549 | 549 | |
550 | - get_current_screen()->add_help_tab( array( |
|
550 | + get_current_screen()->add_help_tab(array( |
|
551 | 551 | 'id' => 'editing-menus', |
552 | - 'title' => __( 'Editing Menus' ), |
|
552 | + 'title' => __('Editing Menus'), |
|
553 | 553 | 'content' => $editing_menus |
554 | - ) ); |
|
554 | + )); |
|
555 | 555 | else : // Locations Tab. |
556 | - $locations_overview = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>'; |
|
557 | - $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location’s drop down.</strong> When you’re finished, <strong>click Save Changes</strong>' ) . '</li>'; |
|
558 | - $locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent ’Edit’ link</strong>' ) . '</li>'; |
|
559 | - $locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the ’Use new menu’ link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>'; |
|
556 | + $locations_overview = '<p>'.__('This screen is used for globally assigning menus to locations defined by your theme.').'</p>'; |
|
557 | + $locations_overview .= '<ul><li>'.__('To assign menus to one or more theme locations, <strong>select a menu from each location’s drop down.</strong> When you’re finished, <strong>click Save Changes</strong>').'</li>'; |
|
558 | + $locations_overview .= '<li>'.__('To edit a menu currently assigned to a theme location, <strong>click the adjacent ’Edit’ link</strong>').'</li>'; |
|
559 | + $locations_overview .= '<li>'.__('To add a new menu instead of assigning an existing one, <strong>click the ’Use new menu’ link</strong>. Your new menu will be automatically assigned to that theme location').'</li></ul>'; |
|
560 | 560 | |
561 | - get_current_screen()->add_help_tab( array( |
|
561 | + get_current_screen()->add_help_tab(array( |
|
562 | 562 | 'id' => 'locations-overview', |
563 | - 'title' => __( 'Overview' ), |
|
563 | + 'title' => __('Overview'), |
|
564 | 564 | 'content' => $locations_overview |
565 | - ) ); |
|
565 | + )); |
|
566 | 566 | endif; |
567 | 567 | |
568 | 568 | get_current_screen()->set_help_sidebar( |
569 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
570 | - '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>' . |
|
571 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
569 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
570 | + '<p>'.__('<a href="https://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>').'</p>'. |
|
571 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
572 | 572 | ); |
573 | 573 | |
574 | 574 | // Get the admin header. |
575 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
575 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
576 | 576 | ?> |
577 | 577 | <div class="wrap"> |
578 | - <h1><?php echo esc_html( __( 'Menus' ) ); ?> |
|
578 | + <h1><?php echo esc_html(__('Menus')); ?> |
|
579 | 579 | <?php |
580 | - if ( current_user_can( 'customize' ) ) : |
|
581 | - $focus = $locations_screen ? array( 'section' => 'menu_locations' ) : array( 'panel' => 'nav_menus' ); |
|
580 | + if (current_user_can('customize')) : |
|
581 | + $focus = $locations_screen ? array('section' => 'menu_locations') : array('panel' => 'nav_menus'); |
|
582 | 582 | printf( |
583 | 583 | ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>', |
584 | - esc_url( add_query_arg( array( |
|
585 | - array( 'autofocus' => $focus ), |
|
586 | - 'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), |
|
587 | - ), admin_url( 'customize.php' ) ) ), |
|
588 | - __( 'Manage with Live Preview' ) |
|
584 | + esc_url(add_query_arg(array( |
|
585 | + array('autofocus' => $focus), |
|
586 | + 'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI'])), |
|
587 | + ), admin_url('customize.php'))), |
|
588 | + __('Manage with Live Preview') |
|
589 | 589 | ); |
590 | 590 | endif; |
591 | 591 | ?> |
592 | 592 | </h1> |
593 | 593 | <h2 class="nav-tab-wrapper wp-clearfix"> |
594 | - <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a> |
|
595 | - <?php if ( $num_locations && $menu_count ) : ?> |
|
596 | - <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a> |
|
594 | + <a href="<?php echo admin_url('nav-menus.php'); ?>" class="nav-tab<?php if ( ! isset($_GET['action']) || isset($_GET['action']) && 'locations' != $_GET['action']) echo ' nav-tab-active'; ?>"><?php esc_html_e('Edit Menus'); ?></a> |
|
595 | + <?php if ($num_locations && $menu_count) : ?> |
|
596 | + <a href="<?php echo esc_url(add_query_arg(array('action' => 'locations'), admin_url('nav-menus.php'))); ?>" class="nav-tab<?php if ($locations_screen) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manage Locations'); ?></a> |
|
597 | 597 | <?php |
598 | 598 | endif; |
599 | 599 | ?> |
600 | 600 | </h2> |
601 | 601 | <?php |
602 | - foreach ( $messages as $message ) : |
|
603 | - echo $message . "\n"; |
|
602 | + foreach ($messages as $message) : |
|
603 | + echo $message."\n"; |
|
604 | 604 | endforeach; |
605 | 605 | ?> |
606 | 606 | <?php |
607 | - if ( $locations_screen ) : |
|
608 | - if ( 1 == $num_locations ) { |
|
609 | - echo '<p>' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '</p>'; |
|
607 | + if ($locations_screen) : |
|
608 | + if (1 == $num_locations) { |
|
609 | + echo '<p>'.__('Your theme supports one menu. Select which menu you would like to use.').'</p>'; |
|
610 | 610 | } else { |
611 | - echo '<p>' . sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>'; |
|
611 | + echo '<p>'.sprintf(_n('Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations), number_format_i18n($num_locations)).'</p>'; |
|
612 | 612 | } |
613 | 613 | ?> |
614 | 614 | <div id="menu-locations-wrap"> |
615 | - <form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>"> |
|
615 | + <form method="post" action="<?php echo esc_url(add_query_arg(array('action' => 'locations'), admin_url('nav-menus.php'))); ?>"> |
|
616 | 616 | <table class="widefat fixed" id="menu-locations-table"> |
617 | 617 | <thead> |
618 | 618 | <tr> |
619 | - <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th> |
|
620 | - <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th> |
|
619 | + <th scope="col" class="manage-column column-locations"><?php _e('Theme Location'); ?></th> |
|
620 | + <th scope="col" class="manage-column column-menus"><?php _e('Assigned Menu'); ?></th> |
|
621 | 621 | </tr> |
622 | 622 | </thead> |
623 | 623 | <tbody class="menu-locations"> |
624 | - <?php foreach ( $locations as $_location => $_name ) { ?> |
|
624 | + <?php foreach ($locations as $_location => $_name) { ?> |
|
625 | 625 | <tr class="menu-locations-row"> |
626 | 626 | <td class="menu-location-title"><label for="locations-<?php echo $_location; ?>"><?php echo $_name; ?></label></td> |
627 | 627 | <td class="menu-location-menus"> |
628 | 628 | <select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>"> |
629 | - <option value="0"><?php printf( '— %s —', esc_html__( 'Select a Menu' ) ); ?></option> |
|
630 | - <?php foreach ( $nav_menus as $menu ) : ?> |
|
631 | - <?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?> |
|
632 | - <option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>"> |
|
633 | - <?php echo wp_html_excerpt( $menu->name, 40, '…' ); ?> |
|
629 | + <option value="0"><?php printf('— %s —', esc_html__('Select a Menu')); ?></option> |
|
630 | + <?php foreach ($nav_menus as $menu) : ?> |
|
631 | + <?php $selected = isset($menu_locations[$_location]) && $menu_locations[$_location] == $menu->term_id; ?> |
|
632 | + <option <?php if ($selected) echo 'data-orig="true"'; ?> <?php selected($selected); ?> value="<?php echo $menu->term_id; ?>"> |
|
633 | + <?php echo wp_html_excerpt($menu->name, 40, '…'); ?> |
|
634 | 634 | </option> |
635 | 635 | <?php endforeach; ?> |
636 | 636 | </select> |
637 | 637 | <div class="locations-row-links"> |
638 | - <?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?> |
|
638 | + <?php if (isset($menu_locations[$_location]) && 0 != $menu_locations[$_location]) : ?> |
|
639 | 639 | <span class="locations-edit-menu-link"> |
640 | - <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>"> |
|
641 | - <span aria-hidden="true"><?php _ex( 'Edit', 'menu' ); ?></span><span class="screen-reader-text"><?php _e( 'Edit selected menu' ); ?></span> |
|
640 | + <a href="<?php echo esc_url(add_query_arg(array('action' => 'edit', 'menu' => $menu_locations[$_location]), admin_url('nav-menus.php'))); ?>"> |
|
641 | + <span aria-hidden="true"><?php _ex('Edit', 'menu'); ?></span><span class="screen-reader-text"><?php _e('Edit selected menu'); ?></span> |
|
642 | 642 | </a> |
643 | 643 | </span> |
644 | 644 | <?php endif; ?> |
645 | 645 | <span class="locations-add-menu-link"> |
646 | - <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, 'use-location' => $_location ), admin_url( 'nav-menus.php' ) ) ); ?>"> |
|
647 | - <?php _ex( 'Use new menu', 'menu' ); ?> |
|
646 | + <a href="<?php echo esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0, 'use-location' => $_location), admin_url('nav-menus.php'))); ?>"> |
|
647 | + <?php _ex('Use new menu', 'menu'); ?> |
|
648 | 648 | </a> |
649 | 649 | </span> |
650 | 650 | </div><!-- .locations-row-links --> |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | <?php } // foreach ?> |
654 | 654 | </tbody> |
655 | 655 | </table> |
656 | - <p class="button-controls wp-clearfix"><?php submit_button( __( 'Save Changes' ), 'primary left', 'nav-menu-locations', false ); ?></p> |
|
657 | - <?php wp_nonce_field( 'save-menu-locations' ); ?> |
|
658 | - <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> |
|
656 | + <p class="button-controls wp-clearfix"><?php submit_button(__('Save Changes'), 'primary left', 'nav-menu-locations', false); ?></p> |
|
657 | + <?php wp_nonce_field('save-menu-locations'); ?> |
|
658 | + <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr($nav_menu_selected_id); ?>" /> |
|
659 | 659 | </form> |
660 | 660 | </div><!-- #menu-locations-wrap --> |
661 | 661 | <?php |
@@ -664,31 +664,31 @@ discard block |
||
664 | 664 | * |
665 | 665 | * @since 3.6.0 |
666 | 666 | */ |
667 | - do_action( 'after_menu_locations_table' ); ?> |
|
667 | + do_action('after_menu_locations_table'); ?> |
|
668 | 668 | <?php else : ?> |
669 | 669 | <div class="manage-menus"> |
670 | - <?php if ( $menu_count < 2 ) : ?> |
|
670 | + <?php if ($menu_count < 2) : ?> |
|
671 | 671 | <span class="add-edit-menu-action"> |
672 | - <?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> |
|
672 | + <?php printf(__('Edit your menu below, or <a href="%s">create a new menu</a>.'), esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0), admin_url('nav-menus.php')))); ?> |
|
673 | 673 | </span><!-- /add-edit-menu-action --> |
674 | 674 | <?php else : ?> |
675 | - <form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>"> |
|
675 | + <form method="get" action="<?php echo admin_url('nav-menus.php'); ?>"> |
|
676 | 676 | <input type="hidden" name="action" value="edit" /> |
677 | - <label for="select-menu-to-edit" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> |
|
677 | + <label for="select-menu-to-edit" class="selected-menu"><?php _e('Select a menu to edit:'); ?></label> |
|
678 | 678 | <select name="menu" id="select-menu-to-edit"> |
679 | - <?php if ( $add_new_screen ) : ?> |
|
680 | - <option value="0" selected="selected"><?php _e( '— Select —' ); ?></option> |
|
679 | + <?php if ($add_new_screen) : ?> |
|
680 | + <option value="0" selected="selected"><?php _e('— Select —'); ?></option> |
|
681 | 681 | <?php endif; ?> |
682 | - <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?> |
|
683 | - <option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>> |
|
682 | + <?php foreach ((array) $nav_menus as $_nav_menu) : ?> |
|
683 | + <option value="<?php echo esc_attr($_nav_menu->term_id); ?>" <?php selected($_nav_menu->term_id, $nav_menu_selected_id); ?>> |
|
684 | 684 | <?php |
685 | - echo esc_html( $_nav_menu->truncated_name ) ; |
|
685 | + echo esc_html($_nav_menu->truncated_name); |
|
686 | 686 | |
687 | - if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) { |
|
687 | + if ( ! empty($menu_locations) && in_array($_nav_menu->term_id, $menu_locations)) { |
|
688 | 688 | $locations_assigned_to_this_menu = array(); |
689 | - foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { |
|
690 | - if ( isset( $locations[ $menu_location_key ] ) ) { |
|
691 | - $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; |
|
689 | + foreach (array_keys($menu_locations, $_nav_menu->term_id) as $menu_location_key) { |
|
690 | + if (isset($locations[$menu_location_key])) { |
|
691 | + $locations_assigned_to_this_menu[] = $locations[$menu_location_key]; |
|
692 | 692 | } |
693 | 693 | } |
694 | 694 | |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | * |
700 | 700 | * @param int $locations Number of menu locations to list. Default 3. |
701 | 701 | */ |
702 | - $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); |
|
702 | + $assigned_locations = array_slice($locations_assigned_to_this_menu, 0, absint(apply_filters('wp_nav_locations_listed_per_menu', 3))); |
|
703 | 703 | |
704 | 704 | // Adds ellipses following the number of locations defined in $assigned_locations. |
705 | - if ( ! empty( $assigned_locations ) ) { |
|
706 | - printf( ' (%1$s%2$s)', |
|
707 | - implode( ', ', $assigned_locations ), |
|
708 | - count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : '' |
|
705 | + if ( ! empty($assigned_locations)) { |
|
706 | + printf(' (%1$s%2$s)', |
|
707 | + implode(', ', $assigned_locations), |
|
708 | + count($locations_assigned_to_this_menu) > count($assigned_locations) ? ' …' : '' |
|
709 | 709 | ); |
710 | 710 | } |
711 | 711 | } |
@@ -713,109 +713,109 @@ discard block |
||
713 | 713 | </option> |
714 | 714 | <?php endforeach; ?> |
715 | 715 | </select> |
716 | - <span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Select' ); ?>"></span> |
|
716 | + <span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e('Select'); ?>"></span> |
|
717 | 717 | <span class="add-new-menu-action"> |
718 | - <?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> |
|
718 | + <?php printf(__('or <a href="%s">create a new menu</a>.'), esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0), admin_url('nav-menus.php')))); ?> |
|
719 | 719 | </span><!-- /add-new-menu-action --> |
720 | 720 | </form> |
721 | 721 | <?php endif; ?> |
722 | 722 | </div><!-- /manage-menus --> |
723 | 723 | <div id="nav-menus-frame" class="wp-clearfix"> |
724 | - <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>"> |
|
724 | + <div id="menu-settings-column" class="metabox-holder<?php if (isset($_GET['menu']) && '0' == $_GET['menu']) { echo ' metabox-holder-disabled'; } ?>"> |
|
725 | 725 | |
726 | 726 | <div class="clear"></div> |
727 | 727 | |
728 | 728 | <form id="nav-menu-meta" class="nav-menu-meta" method="post" enctype="multipart/form-data"> |
729 | - <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> |
|
729 | + <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr($nav_menu_selected_id); ?>" /> |
|
730 | 730 | <input type="hidden" name="action" value="add-menu-item" /> |
731 | - <?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?> |
|
732 | - <?php do_accordion_sections( 'nav-menus', 'side', null ); ?> |
|
731 | + <?php wp_nonce_field('add-menu_item', 'menu-settings-column-nonce'); ?> |
|
732 | + <?php do_accordion_sections('nav-menus', 'side', null); ?> |
|
733 | 733 | </form> |
734 | 734 | |
735 | 735 | </div><!-- /#menu-settings-column --> |
736 | 736 | <div id="menu-management-liquid"> |
737 | 737 | <div id="menu-management"> |
738 | 738 | <form id="update-nav-menu" method="post" enctype="multipart/form-data"> |
739 | - <div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>"> |
|
739 | + <div class="menu-edit <?php if ($add_new_screen) echo 'blank-slate'; ?>"> |
|
740 | 740 | <input type="hidden" name="nav-menu-data"> |
741 | 741 | <?php |
742 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
743 | - wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
|
744 | - wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); |
|
742 | + wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
743 | + wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
|
744 | + wp_nonce_field('update-nav_menu', 'update-nav-menu-nonce'); |
|
745 | 745 | |
746 | 746 | $menu_name_aria_desc = $add_new_screen ? ' aria-describedby="menu-name-desc"' : ''; |
747 | 747 | |
748 | - if ( $one_theme_location_no_menus ) { |
|
749 | - $menu_name_val = 'value="' . esc_attr( 'Menu 1' ) . '"'; |
|
748 | + if ($one_theme_location_no_menus) { |
|
749 | + $menu_name_val = 'value="'.esc_attr('Menu 1').'"'; |
|
750 | 750 | ?> |
751 | 751 | <input type="hidden" name="zero-menu-state" value="true" /> |
752 | 752 | <?php } else { |
753 | - $menu_name_val = 'value="' . esc_attr( $nav_menu_selected_title ) . '"'; |
|
753 | + $menu_name_val = 'value="'.esc_attr($nav_menu_selected_title).'"'; |
|
754 | 754 | } ?> |
755 | 755 | <input type="hidden" name="action" value="update" /> |
756 | - <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> |
|
756 | + <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr($nav_menu_selected_id); ?>" /> |
|
757 | 757 | <div id="nav-menu-header"> |
758 | 758 | <div class="major-publishing-actions wp-clearfix"> |
759 | - <label class="menu-name-label" for="menu-name"><?php _e( 'Menu Name' ); ?></label> |
|
760 | - <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox" <?php echo $menu_name_val . $menu_name_aria_desc; ?> /> |
|
759 | + <label class="menu-name-label" for="menu-name"><?php _e('Menu Name'); ?></label> |
|
760 | + <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox" <?php echo $menu_name_val.$menu_name_aria_desc; ?> /> |
|
761 | 761 | <div class="publishing-action"> |
762 | - <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?> |
|
762 | + <?php submit_button(empty($nav_menu_selected_id) ? __('Create Menu') : __('Save Menu'), 'button-primary menu-save', 'save_menu', false, array('id' => 'save_menu_header')); ?> |
|
763 | 763 | </div><!-- END .publishing-action --> |
764 | 764 | </div><!-- END .major-publishing-actions --> |
765 | 765 | </div><!-- END .nav-menu-header --> |
766 | 766 | <div id="post-body"> |
767 | 767 | <div id="post-body-content" class="wp-clearfix"> |
768 | - <?php if ( ! $add_new_screen ) : ?> |
|
769 | - <h3><?php _e( 'Menu Structure' ); ?></h3> |
|
770 | - <?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.' ); ?> |
|
771 | - <div class="drag-instructions post-body-plain" <?php if ( isset( $menu_items ) && 0 == count( $menu_items ) ) { ?>style="display: none;"<?php } ?>> |
|
768 | + <?php if ( ! $add_new_screen) : ?> |
|
769 | + <h3><?php _e('Menu Structure'); ?></h3> |
|
770 | + <?php $starter_copy = ($one_theme_location_no_menus) ? __('Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.') : __('Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.'); ?> |
|
771 | + <div class="drag-instructions post-body-plain" <?php if (isset($menu_items) && 0 == count($menu_items)) { ?>style="display: none;"<?php } ?>> |
|
772 | 772 | <p><?php echo $starter_copy; ?></p> |
773 | 773 | </div> |
774 | 774 | <?php |
775 | - if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) { |
|
775 | + if (isset($edit_markup) && ! is_wp_error($edit_markup)) { |
|
776 | 776 | echo $edit_markup; |
777 | 777 | } else { |
778 | 778 | ?> |
779 | 779 | <ul class="menu" id="menu-to-edit"></ul> |
780 | 780 | <?php } ?> |
781 | 781 | <?php endif; ?> |
782 | - <?php if ( $add_new_screen ) : ?> |
|
783 | - <p class="post-body-plain" id="menu-name-desc"><?php _e( 'Give your menu a name, then click Create Menu.' ); ?></p> |
|
784 | - <?php if ( isset( $_GET['use-location'] ) ) : ?> |
|
785 | - <input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" /> |
|
782 | + <?php if ($add_new_screen) : ?> |
|
783 | + <p class="post-body-plain" id="menu-name-desc"><?php _e('Give your menu a name, then click Create Menu.'); ?></p> |
|
784 | + <?php if (isset($_GET['use-location'])) : ?> |
|
785 | + <input type="hidden" name="use-location" value="<?php echo esc_attr($_GET['use-location']); ?>" /> |
|
786 | 786 | <?php endif; ?> |
787 | 787 | <?php endif; ?> |
788 | - <div class="menu-settings" <?php if ( $one_theme_location_no_menus ) { ?>style="display: none;"<?php } ?>> |
|
789 | - <h3><?php _e( 'Menu Settings' ); ?></h3> |
|
788 | + <div class="menu-settings" <?php if ($one_theme_location_no_menus) { ?>style="display: none;"<?php } ?>> |
|
789 | + <h3><?php _e('Menu Settings'); ?></h3> |
|
790 | 790 | <?php |
791 | - if ( ! isset( $auto_add ) ) { |
|
792 | - $auto_add = get_option( 'nav_menu_options' ); |
|
793 | - if ( ! isset( $auto_add['auto_add'] ) ) |
|
791 | + if ( ! isset($auto_add)) { |
|
792 | + $auto_add = get_option('nav_menu_options'); |
|
793 | + if ( ! isset($auto_add['auto_add'])) |
|
794 | 794 | $auto_add = false; |
795 | - elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) |
|
795 | + elseif (false !== array_search($nav_menu_selected_id, $auto_add['auto_add'])) |
|
796 | 796 | $auto_add = true; |
797 | 797 | else |
798 | 798 | $auto_add = false; |
799 | 799 | } ?> |
800 | 800 | |
801 | 801 | <dl class="auto-add-pages"> |
802 | - <dt class="howto"><?php _e( 'Auto add pages' ); ?></dt> |
|
803 | - <dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd> |
|
802 | + <dt class="howto"><?php _e('Auto add pages'); ?></dt> |
|
803 | + <dd class="checkbox-input"><input type="checkbox"<?php checked($auto_add); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf(__('Automatically add new top-level pages to this menu'), esc_url(admin_url('edit.php?post_type=page'))); ?></label></dd> |
|
804 | 804 | </dl> |
805 | 805 | |
806 | - <?php if ( current_theme_supports( 'menus' ) ) : ?> |
|
806 | + <?php if (current_theme_supports('menus')) : ?> |
|
807 | 807 | |
808 | 808 | <dl class="menu-theme-locations"> |
809 | - <dt class="howto"><?php _e( 'Theme locations' ); ?></dt> |
|
810 | - <?php foreach ( $locations as $location => $description ) : ?> |
|
809 | + <dt class="howto"><?php _e('Theme locations'); ?></dt> |
|
810 | + <?php foreach ($locations as $location => $description) : ?> |
|
811 | 811 | <dd class="checkbox-input"> |
812 | - <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> |
|
813 | - <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label> |
|
814 | - <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?> |
|
812 | + <input type="checkbox"<?php checked(isset($menu_locations[$location]) && $menu_locations[$location] == $nav_menu_selected_id); ?> name="menu-locations[<?php echo esc_attr($location); ?>]" id="locations-<?php echo esc_attr($location); ?>" value="<?php echo esc_attr($nav_menu_selected_id); ?>" /> |
|
813 | + <label for="locations-<?php echo esc_attr($location); ?>"><?php echo $description; ?></label> |
|
814 | + <?php if ( ! empty($menu_locations[$location]) && $menu_locations[$location] != $nav_menu_selected_id) : ?> |
|
815 | 815 | <span class="theme-location-set"><?php |
816 | 816 | /* translators: %s: menu name */ |
817 | - printf( _x( '(Currently set to: %s)', 'menu location' ), |
|
818 | - wp_get_nav_menu_object( $menu_locations[ $location ] )->name |
|
817 | + printf(_x('(Currently set to: %s)', 'menu location'), |
|
818 | + wp_get_nav_menu_object($menu_locations[$location])->name |
|
819 | 819 | ); |
820 | 820 | ?></span> |
821 | 821 | <?php endif; ?> |
@@ -830,13 +830,13 @@ discard block |
||
830 | 830 | </div><!-- /#post-body --> |
831 | 831 | <div id="nav-menu-footer"> |
832 | 832 | <div class="major-publishing-actions wp-clearfix"> |
833 | - <?php if ( 0 != $menu_count && ! $add_new_screen ) : ?> |
|
833 | + <?php if (0 != $menu_count && ! $add_new_screen) : ?> |
|
834 | 834 | <span class="delete-action"> |
835 | - <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => $nav_menu_selected_id ), admin_url( 'nav-menus.php' ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?>"><?php _e('Delete Menu'); ?></a> |
|
835 | + <a class="submitdelete deletion menu-delete" href="<?php echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'delete', 'menu' => $nav_menu_selected_id), admin_url('nav-menus.php')), 'delete-nav_menu-'.$nav_menu_selected_id)); ?>"><?php _e('Delete Menu'); ?></a> |
|
836 | 836 | </span><!-- END .delete-action --> |
837 | 837 | <?php endif; ?> |
838 | 838 | <div class="publishing-action"> |
839 | - <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?> |
|
839 | + <?php submit_button(empty($nav_menu_selected_id) ? __('Create Menu') : __('Save Menu'), 'button-primary menu-save', 'save_menu', false, array('id' => 'save_menu_footer')); ?> |
|
840 | 840 | </div><!-- END .publishing-action --> |
841 | 841 | </div><!-- END .major-publishing-actions --> |
842 | 842 | </div><!-- /#nav-menu-footer --> |
@@ -847,4 +847,4 @@ discard block |
||
847 | 847 | </div><!-- /#nav-menus-frame --> |
848 | 848 | <?php endif; ?> |
849 | 849 | </div><!-- /.wrap--> |
850 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
850 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -7,13 +7,13 @@ 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 | 12 | /** WordPress Translation Install API */ |
13 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'manage_options' ) ) |
|
16 | - wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
|
15 | +if ( ! current_user_can('manage_options')) |
|
16 | + wp_die(__('Sorry, you are not allowed to manage options for this site.')); |
|
17 | 17 | |
18 | 18 | $title = __('General Settings'); |
19 | 19 | $parent_file = 'options-general.php'; |
@@ -22,35 +22,35 @@ discard block |
||
22 | 22 | |
23 | 23 | add_action('admin_head', 'options_general_add_js'); |
24 | 24 | |
25 | -$options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' . |
|
26 | - '<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>'; |
|
25 | +$options_help = '<p>'.__('The fields on this screen determine some of the basics of your site setup.').'</p>'. |
|
26 | + '<p>'.__('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.').'</p>'; |
|
27 | 27 | |
28 | -if ( ! is_multisite() ) { |
|
29 | - $options_help .= '<p>' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '</p>' . |
|
30 | - '<p>' . __('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.') . '</p>'; |
|
28 | +if ( ! is_multisite()) { |
|
29 | + $options_help .= '<p>'.__('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.').'</p>'. |
|
30 | + '<p>'.__('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.').'</p>'; |
|
31 | 31 | } |
32 | 32 | |
33 | -$options_help .= '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' . |
|
34 | - '<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' . |
|
35 | - '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; |
|
33 | +$options_help .= '<p>'.__('You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).').'</p>'. |
|
34 | + '<p>'.__('UTC means Coordinated Universal Time.').'</p>'. |
|
35 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>'; |
|
36 | 36 | |
37 | -get_current_screen()->add_help_tab( array( |
|
37 | +get_current_screen()->add_help_tab(array( |
|
38 | 38 | 'id' => 'overview', |
39 | 39 | 'title' => __('Overview'), |
40 | 40 | 'content' => $options_help, |
41 | -) ); |
|
41 | +)); |
|
42 | 42 | |
43 | 43 | get_current_screen()->set_help_sidebar( |
44 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
45 | - '<p>' . __('<a href="https://codex.wordpress.org/Settings_General_Screen" target="_blank">Documentation on General Settings</a>') . '</p>' . |
|
46 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
44 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
45 | + '<p>'.__('<a href="https://codex.wordpress.org/Settings_General_Screen" target="_blank">Documentation on General Settings</a>').'</p>'. |
|
46 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
47 | 47 | ); |
48 | 48 | |
49 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
49 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
50 | 50 | ?> |
51 | 51 | |
52 | 52 | <div class="wrap"> |
53 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
53 | +<h1><?php echo esc_html($title); ?></h1> |
|
54 | 54 | |
55 | 55 | <form method="post" action="options.php" novalidate="novalidate"> |
56 | 56 | <?php settings_fields('general'); ?> |
@@ -63,24 +63,24 @@ discard block |
||
63 | 63 | <tr> |
64 | 64 | <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th> |
65 | 65 | <td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option('blogdescription'); ?>" class="regular-text" /> |
66 | -<p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ) ?></p></td> |
|
66 | +<p class="description" id="tagline-description"><?php _e('In a few words, explain what this site is about.') ?></p></td> |
|
67 | 67 | </tr> |
68 | -<?php if ( !is_multisite() ) { ?> |
|
68 | +<?php if ( ! is_multisite()) { ?> |
|
69 | 69 | <tr> |
70 | 70 | <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th> |
71 | -<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td> |
|
71 | +<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option('siteurl'); ?>"<?php disabled(defined('WP_SITEURL')); ?> class="regular-text code<?php if (defined('WP_SITEURL')) echo ' disabled' ?>" /></td> |
|
72 | 72 | </tr> |
73 | 73 | <tr> |
74 | 74 | <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th> |
75 | -<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" /> |
|
76 | -<?php if ( ! defined( 'WP_HOME' ) ) : ?> |
|
77 | -<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); ?></p></td> |
|
75 | +<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option('home'); ?>"<?php disabled(defined('WP_HOME')); ?> class="regular-text code<?php if (defined('WP_HOME')) echo ' disabled' ?>" /> |
|
76 | +<?php if ( ! defined('WP_HOME')) : ?> |
|
77 | +<p class="description" id="home-description"><?php _e('Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>'); ?></p></td> |
|
78 | 78 | <?php endif; ?> |
79 | 79 | </tr> |
80 | 80 | <tr> |
81 | 81 | <th scope="row"><label for="admin_email"><?php _e('Email Address') ?> </label></th> |
82 | -<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
|
83 | -<p class="description" id="admin-email-description"><?php _e( 'This address is used for admin purposes, like new user notification.' ) ?></p></td> |
|
82 | +<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" /> |
|
83 | +<p class="description" id="admin-email-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></p></td> |
|
84 | 84 | </tr> |
85 | 85 | <tr> |
86 | 86 | <th scope="row"><?php _e('Membership') ?></th> |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | <tr> |
93 | 93 | <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th> |
94 | 94 | <td> |
95 | -<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select> |
|
95 | +<select name="default_role" id="default_role"><?php wp_dropdown_roles(get_option('default_role')); ?></select> |
|
96 | 96 | </td> |
97 | 97 | </tr> |
98 | 98 | <?php } else { ?> |
99 | 99 | <tr> |
100 | 100 | <th scope="row"><label for="new_admin_email"><?php _e('Email Address') ?> </label></th> |
101 | -<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
|
102 | -<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ) ?></p> |
|
101 | +<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" /> |
|
102 | +<p class="description" id="new-admin-email-description"><?php _e('This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></p> |
|
103 | 103 | <?php |
104 | -$new_admin_email = get_option( 'new_admin_email' ); |
|
105 | -if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?> |
|
104 | +$new_admin_email = get_option('new_admin_email'); |
|
105 | +if ($new_admin_email && $new_admin_email != get_option('admin_email')) : ?> |
|
106 | 106 | <div class="updated inline"> |
107 | 107 | <p><?php |
108 | 108 | printf( |
109 | 109 | /* translators: %s: new admin email */ |
110 | - __( 'There is a pending change of the admin email to %s.' ), |
|
111 | - '<code>' . esc_html( $new_admin_email ) . '</code>' |
|
110 | + __('There is a pending change of the admin email to %s.'), |
|
111 | + '<code>'.esc_html($new_admin_email).'</code>' |
|
112 | 112 | ); |
113 | 113 | printf( |
114 | 114 | ' <a href="%1$s">%2$s</a>', |
115 | - esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ), |
|
116 | - __( 'Cancel' ) |
|
115 | + esc_url(wp_nonce_url(admin_url('options.php?dismiss=new_admin_email'), 'dismiss-'.get_current_blog_id().'-new_admin_email')), |
|
116 | + __('Cancel') |
|
117 | 117 | ); |
118 | 118 | ?></p> |
119 | 119 | </div> |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | $check_zone_info = true; |
130 | 130 | |
131 | 131 | // Remove old Etc mappings. Fallback to gmt_offset. |
132 | -if ( false !== strpos($tzstring,'Etc/GMT') ) |
|
132 | +if (false !== strpos($tzstring, 'Etc/GMT')) |
|
133 | 133 | $tzstring = ''; |
134 | 134 | |
135 | -if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists |
|
135 | +if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists |
|
136 | 136 | $check_zone_info = false; |
137 | - if ( 0 == $current_offset ) |
|
137 | + if (0 == $current_offset) |
|
138 | 138 | $tzstring = 'UTC+0'; |
139 | 139 | elseif ($current_offset < 0) |
140 | - $tzstring = 'UTC' . $current_offset; |
|
140 | + $tzstring = 'UTC'.$current_offset; |
|
141 | 141 | else |
142 | - $tzstring = 'UTC+' . $current_offset; |
|
142 | + $tzstring = 'UTC+'.$current_offset; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | ?> |
@@ -150,34 +150,34 @@ discard block |
||
150 | 150 | <?php echo wp_timezone_choice($tzstring); ?> |
151 | 151 | </select> |
152 | 152 | |
153 | -<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p> |
|
153 | +<p class="description" id="timezone-description"><?php _e('Choose a city in the same timezone as you.'); ?></p> |
|
154 | 154 | |
155 | 155 | <p class="timezone-info"> |
156 | 156 | <span id="utc-time"><?php |
157 | 157 | /* translators: 1: UTC abbreviation, 2: UTC time */ |
158 | - printf( __( 'Universal time (%1$s) is %2$s.' ), |
|
159 | - '<abbr>' . __( 'UTC' ) . '</abbr>', |
|
160 | - '<code>' . date_i18n( $timezone_format, false, 'gmt' ) . '</code>' |
|
158 | + printf(__('Universal time (%1$s) is %2$s.'), |
|
159 | + '<abbr>'.__('UTC').'</abbr>', |
|
160 | + '<code>'.date_i18n($timezone_format, false, 'gmt').'</code>' |
|
161 | 161 | ); |
162 | 162 | ?></span> |
163 | -<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?> |
|
163 | +<?php if (get_option('timezone_string') || ! empty($current_offset)) : ?> |
|
164 | 164 | <span id="local-time"><?php |
165 | 165 | /* translators: %s: local time */ |
166 | - printf( __( 'Local time is %s.' ), |
|
167 | - '<code>' . date_i18n( $timezone_format ) . '</code>' |
|
166 | + printf(__('Local time is %s.'), |
|
167 | + '<code>'.date_i18n($timezone_format).'</code>' |
|
168 | 168 | ); |
169 | 169 | ?></span> |
170 | 170 | <?php endif; ?> |
171 | 171 | </p> |
172 | 172 | |
173 | -<?php if ( $check_zone_info && $tzstring ) : ?> |
|
173 | +<?php if ($check_zone_info && $tzstring) : ?> |
|
174 | 174 | <p class="timezone-info"> |
175 | 175 | <span> |
176 | 176 | <?php |
177 | 177 | // Set TZ so localtime works. |
178 | 178 | date_default_timezone_set($tzstring); |
179 | 179 | $now = localtime(time(), true); |
180 | - if ( $now['tm_isdst'] ) |
|
180 | + if ($now['tm_isdst']) |
|
181 | 181 | _e('This timezone is currently in daylight saving time.'); |
182 | 182 | else |
183 | 183 | _e('This timezone is currently in standard time.'); |
@@ -186,34 +186,33 @@ discard block |
||
186 | 186 | <?php |
187 | 187 | $allowed_zones = timezone_identifiers_list(); |
188 | 188 | |
189 | - if ( in_array( $tzstring, $allowed_zones) ) { |
|
189 | + if (in_array($tzstring, $allowed_zones)) { |
|
190 | 190 | $found = false; |
191 | 191 | $date_time_zone_selected = new DateTimeZone($tzstring); |
192 | 192 | $tz_offset = timezone_offset_get($date_time_zone_selected, date_create()); |
193 | 193 | $right_now = time(); |
194 | - foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) { |
|
195 | - if ( $tr['ts'] > $right_now ) { |
|
194 | + foreach (timezone_transitions_get($date_time_zone_selected) as $tr) { |
|
195 | + if ($tr['ts'] > $right_now) { |
|
196 | 196 | $found = true; |
197 | 197 | break; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
201 | - if ( $found ) { |
|
201 | + if ($found) { |
|
202 | 202 | echo ' '; |
203 | 203 | $message = $tr['isdst'] ? |
204 | 204 | /* translators: %s: date and time */ |
205 | - __( 'Daylight saving time begins on: %s.') : |
|
206 | - /* translators: %s: date and time */ |
|
207 | - __( 'Standard time begins on: %s.' ); |
|
205 | + __('Daylight saving time begins on: %s.') : /* translators: %s: date and time */ |
|
206 | + __('Standard time begins on: %s.'); |
|
208 | 207 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
209 | - printf( $message, |
|
210 | - '<code>' . date_i18n( |
|
211 | - __( 'F j, Y' ) . ' ' . __( 'g:i a' ), |
|
212 | - $tr['ts'] + ( $tz_offset - $tr['offset'] ) |
|
213 | - ) . '</code>' |
|
208 | + printf($message, |
|
209 | + '<code>'.date_i18n( |
|
210 | + __('F j, Y').' '.__('g:i a'), |
|
211 | + $tr['ts'] + ($tz_offset - $tr['offset']) |
|
212 | + ).'</code>' |
|
214 | 213 | ); |
215 | 214 | } else { |
216 | - _e( 'This timezone does not observe daylight saving time.' ); |
|
215 | + _e('This timezone does not observe daylight saving time.'); |
|
217 | 216 | } |
218 | 217 | } |
219 | 218 | // Set back to UTC. |
@@ -238,25 +237,25 @@ discard block |
||
238 | 237 | * |
239 | 238 | * @param array $default_date_formats Array of default date formats. |
240 | 239 | */ |
241 | - $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
|
240 | + $date_formats = array_unique(apply_filters('date_formats', array(__('F j, Y'), 'Y-m-d', 'm/d/Y', 'd/m/Y'))); |
|
242 | 241 | |
243 | 242 | $custom = true; |
244 | 243 | |
245 | - foreach ( $date_formats as $format ) { |
|
246 | - echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'"; |
|
247 | - if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" |
|
244 | + foreach ($date_formats as $format) { |
|
245 | + echo "\t<label><input type='radio' name='date_format' value='".esc_attr($format)."'"; |
|
246 | + if (get_option('date_format') === $format) { // checked() uses "==" rather than "===" |
|
248 | 247 | echo " checked='checked'"; |
249 | 248 | $custom = false; |
250 | 249 | } |
251 | - echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
|
250 | + echo ' /> <span class="date-time-text format-i18n">'.date_i18n($format).'</span><code>'.esc_html($format)."</code></label><br />\n"; |
|
252 | 251 | } |
253 | 252 | |
254 | 253 | echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
255 | - checked( $custom ); |
|
256 | - echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . '</span></label>' . |
|
257 | - '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label>' . |
|
258 | - '<input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option( 'date_format' ) ) . '" class="small-text" /></span>' . |
|
259 | - '<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'date_format' ) ) . '</span>' . |
|
254 | + checked($custom); |
|
255 | + echo '/> <span class="date-time-text date-time-custom-text">'.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom date format in the following field').'</span></label>'. |
|
256 | + '<label for="date_format_custom" class="screen-reader-text">'.__('Custom date format:').'</label>'. |
|
257 | + '<input type="text" name="date_format_custom" id="date_format_custom" value="'.esc_attr(get_option('date_format')).'" class="small-text" /></span>'. |
|
258 | + '<span class="screen-reader-text">'.__('example:').' </span> <span class="example">'.date_i18n(get_option('date_format')).'</span>'. |
|
260 | 259 | "<span class='spinner'></span>\n"; |
261 | 260 | ?> |
262 | 261 | </fieldset> |
@@ -274,28 +273,28 @@ discard block |
||
274 | 273 | * |
275 | 274 | * @param array $default_time_formats Array of default time formats. |
276 | 275 | */ |
277 | - $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
|
276 | + $time_formats = array_unique(apply_filters('time_formats', array(__('g:i a'), 'g:i A', 'H:i'))); |
|
278 | 277 | |
279 | 278 | $custom = true; |
280 | 279 | |
281 | - foreach ( $time_formats as $format ) { |
|
282 | - echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'"; |
|
283 | - if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "===" |
|
280 | + foreach ($time_formats as $format) { |
|
281 | + echo "\t<label><input type='radio' name='time_format' value='".esc_attr($format)."'"; |
|
282 | + if (get_option('time_format') === $format) { // checked() uses "==" rather than "===" |
|
284 | 283 | echo " checked='checked'"; |
285 | 284 | $custom = false; |
286 | 285 | } |
287 | - echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n"; |
|
286 | + echo ' /> <span class="date-time-text format-i18n">'.date_i18n($format).'</span><code>'.esc_html($format)."</code></label><br />\n"; |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
291 | - checked( $custom ); |
|
292 | - echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . '</span></label>' . |
|
293 | - '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label>' . |
|
294 | - '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" /></span>' . |
|
295 | - '<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' . |
|
290 | + checked($custom); |
|
291 | + echo '/> <span class="date-time-text date-time-custom-text">'.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom time format in the following field').'</span></label>'. |
|
292 | + '<label for="time_format_custom" class="screen-reader-text">'.__('Custom time format:').'</label>'. |
|
293 | + '<input type="text" name="time_format_custom" id="time_format_custom" value="'.esc_attr(get_option('time_format')).'" class="small-text" /></span>'. |
|
294 | + '<span class="screen-reader-text">'.__('example:').' </span> <span class="example">'.date_i18n(get_option('time_format')).'</span>'. |
|
296 | 295 | "<span class='spinner'></span>\n"; |
297 | 296 | |
298 | - echo "\t<p class='date-time-doc'>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n"; |
|
297 | + echo "\t<p class='date-time-doc'>".__('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.')."</p>\n"; |
|
299 | 298 | ?> |
300 | 299 | </fieldset> |
301 | 300 | </td> |
@@ -311,7 +310,7 @@ discard block |
||
311 | 310 | |
312 | 311 | for ($day_index = 0; $day_index <= 6; $day_index++) : |
313 | 312 | $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; |
314 | - echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>'; |
|
313 | + echo "\n\t<option value='".esc_attr($day_index)."' $selected>".$wp_locale->get_weekday($day_index).'</option>'; |
|
315 | 314 | endfor; |
316 | 315 | ?> |
317 | 316 | </select></td> |
@@ -321,39 +320,39 @@ discard block |
||
321 | 320 | <?php |
322 | 321 | $languages = get_available_languages(); |
323 | 322 | $translations = wp_get_available_translations(); |
324 | -if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
|
323 | +if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array(WPLANG, $languages)) { |
|
325 | 324 | $languages[] = WPLANG; |
326 | 325 | } |
327 | -if ( ! empty( $languages ) || ! empty( $translations ) ) { |
|
326 | +if ( ! empty($languages) || ! empty($translations)) { |
|
328 | 327 | ?> |
329 | 328 | <tr> |
330 | - <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th> |
|
329 | + <th width="33%" scope="row"><label for="WPLANG"><?php _e('Site Language'); ?></label></th> |
|
331 | 330 | <td> |
332 | 331 | <?php |
333 | 332 | $locale = get_locale(); |
334 | - if ( ! in_array( $locale, $languages ) ) { |
|
333 | + if ( ! in_array($locale, $languages)) { |
|
335 | 334 | $locale = ''; |
336 | 335 | } |
337 | 336 | |
338 | - wp_dropdown_languages( array( |
|
337 | + wp_dropdown_languages(array( |
|
339 | 338 | 'name' => 'WPLANG', |
340 | 339 | 'id' => 'WPLANG', |
341 | 340 | 'selected' => $locale, |
342 | 341 | 'languages' => $languages, |
343 | 342 | 'translations' => $translations, |
344 | - 'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(), |
|
345 | - ) ); |
|
343 | + 'show_available_translations' => ( ! is_multisite() || is_super_admin()) && wp_can_install_language_pack(), |
|
344 | + )); |
|
346 | 345 | |
347 | 346 | // Add note about deprecated WPLANG constant. |
348 | - if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
|
349 | - if ( is_super_admin() ) { |
|
347 | + if (defined('WPLANG') && ('' !== WPLANG) && $locale !== WPLANG) { |
|
348 | + if (is_super_admin()) { |
|
350 | 349 | ?> |
351 | 350 | <p class="description"> |
352 | - <strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?> |
|
351 | + <strong><?php _e('Note:'); ?></strong> <?php printf(__('The %s constant in your %s file is no longer needed.'), '<code>WPLANG</code>', '<code>wp-config.php</code>'); ?> |
|
353 | 352 | </p> |
354 | 353 | <?php |
355 | 354 | } |
356 | - _deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) ); |
|
355 | + _deprecated_argument('define()', '4.0.0', sprintf(__('The %s constant in your %s file is no longer needed.'), 'WPLANG', 'wp-config.php')); |
|
357 | 356 | } |
358 | 357 | ?> |
359 | 358 | </td> |
@@ -370,4 +369,4 @@ discard block |
||
370 | 369 | |
371 | 370 | </div> |
372 | 371 | |
373 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
372 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -6,99 +6,99 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) |
|
10 | - define( 'IFRAME_REQUEST', true ); |
|
9 | +if ( ! defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes'))) |
|
10 | + define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** WordPress Administration Bootstrap */ |
13 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
13 | +require_once(dirname(__FILE__).'/admin.php'); |
|
14 | 14 | |
15 | -include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
15 | +include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
16 | 16 | |
17 | -if ( isset($_GET['action']) ) { |
|
17 | +if (isset($_GET['action'])) { |
|
18 | 18 | $plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : ''; |
19 | 19 | $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : ''; |
20 | 20 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
21 | 21 | |
22 | - if ( 'update-selected' == $action ) { |
|
23 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
24 | - wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
|
22 | + if ('update-selected' == $action) { |
|
23 | + if ( ! current_user_can('update_plugins')) |
|
24 | + wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
|
25 | 25 | |
26 | - check_admin_referer( 'bulk-update-plugins' ); |
|
26 | + check_admin_referer('bulk-update-plugins'); |
|
27 | 27 | |
28 | - if ( isset( $_GET['plugins'] ) ) |
|
29 | - $plugins = explode( ',', stripslashes($_GET['plugins']) ); |
|
30 | - elseif ( isset( $_POST['checked'] ) ) |
|
28 | + if (isset($_GET['plugins'])) |
|
29 | + $plugins = explode(',', stripslashes($_GET['plugins'])); |
|
30 | + elseif (isset($_POST['checked'])) |
|
31 | 31 | $plugins = (array) $_POST['checked']; |
32 | 32 | else |
33 | 33 | $plugins = array(); |
34 | 34 | |
35 | 35 | $plugins = array_map('urldecode', $plugins); |
36 | 36 | |
37 | - $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins)); |
|
37 | + $url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins)); |
|
38 | 38 | $nonce = 'bulk-update-plugins'; |
39 | 39 | |
40 | - wp_enqueue_script( 'updates' ); |
|
40 | + wp_enqueue_script('updates'); |
|
41 | 41 | iframe_header(); |
42 | 42 | |
43 | - $upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
|
44 | - $upgrader->bulk_upgrade( $plugins ); |
|
43 | + $upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url'))); |
|
44 | + $upgrader->bulk_upgrade($plugins); |
|
45 | 45 | |
46 | 46 | iframe_footer(); |
47 | 47 | |
48 | - } elseif ( 'upgrade-plugin' == $action ) { |
|
49 | - if ( ! current_user_can('update_plugins') ) |
|
48 | + } elseif ('upgrade-plugin' == $action) { |
|
49 | + if ( ! current_user_can('update_plugins')) |
|
50 | 50 | wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
51 | 51 | |
52 | - check_admin_referer('upgrade-plugin_' . $plugin); |
|
52 | + check_admin_referer('upgrade-plugin_'.$plugin); |
|
53 | 53 | |
54 | 54 | $title = __('Update Plugin'); |
55 | 55 | $parent_file = 'plugins.php'; |
56 | 56 | $submenu_file = 'plugins.php'; |
57 | 57 | |
58 | - wp_enqueue_script( 'updates' ); |
|
59 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
58 | + wp_enqueue_script('updates'); |
|
59 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
60 | 60 | |
61 | - $nonce = 'upgrade-plugin_' . $plugin; |
|
62 | - $url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin ); |
|
61 | + $nonce = 'upgrade-plugin_'.$plugin; |
|
62 | + $url = 'update.php?action=upgrade-plugin&plugin='.urlencode($plugin); |
|
63 | 63 | |
64 | - $upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) ); |
|
64 | + $upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin'))); |
|
65 | 65 | $upgrader->upgrade($plugin); |
66 | 66 | |
67 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
67 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
68 | 68 | |
69 | - } elseif ('activate-plugin' == $action ) { |
|
70 | - if ( ! current_user_can('update_plugins') ) |
|
69 | + } elseif ('activate-plugin' == $action) { |
|
70 | + if ( ! current_user_can('update_plugins')) |
|
71 | 71 | wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
72 | 72 | |
73 | - check_admin_referer('activate-plugin_' . $plugin); |
|
74 | - if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { |
|
75 | - wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) ); |
|
76 | - activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true ); |
|
77 | - wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) ); |
|
73 | + check_admin_referer('activate-plugin_'.$plugin); |
|
74 | + if ( ! isset($_GET['failure']) && ! isset($_GET['success'])) { |
|
75 | + wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce'])); |
|
76 | + activate_plugin($plugin, '', ! empty($_GET['networkwide']), true); |
|
77 | + wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce'])); |
|
78 | 78 | die(); |
79 | 79 | } |
80 | - iframe_header( __('Plugin Reactivation'), true ); |
|
81 | - if ( isset($_GET['success']) ) |
|
82 | - echo '<p>' . __('Plugin reactivated successfully.') . '</p>'; |
|
80 | + iframe_header(__('Plugin Reactivation'), true); |
|
81 | + if (isset($_GET['success'])) |
|
82 | + echo '<p>'.__('Plugin reactivated successfully.').'</p>'; |
|
83 | 83 | |
84 | - if ( isset($_GET['failure']) ){ |
|
85 | - echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>'; |
|
84 | + if (isset($_GET['failure'])) { |
|
85 | + echo '<p>'.__('Plugin failed to reactivate due to a fatal error.').'</p>'; |
|
86 | 86 | |
87 | - error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|
87 | + error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|
88 | 88 | @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
89 | - wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
|
90 | - include( WP_PLUGIN_DIR . '/' . $plugin ); |
|
89 | + wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin); |
|
90 | + include(WP_PLUGIN_DIR.'/'.$plugin); |
|
91 | 91 | } |
92 | 92 | iframe_footer(); |
93 | - } elseif ( 'install-plugin' == $action ) { |
|
93 | + } elseif ('install-plugin' == $action) { |
|
94 | 94 | |
95 | - if ( ! current_user_can('install_plugins') ) |
|
96 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
95 | + if ( ! current_user_can('install_plugins')) |
|
96 | + wp_die(__('Sorry, you are not allowed to install plugins on this site.')); |
|
97 | 97 | |
98 | - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
|
98 | + include_once(ABSPATH.'wp-admin/includes/plugin-install.php'); //for plugins_api.. |
|
99 | 99 | |
100 | - check_admin_referer( 'install-plugin_' . $plugin ); |
|
101 | - $api = plugins_api( 'plugin_information', array( |
|
100 | + check_admin_referer('install-plugin_'.$plugin); |
|
101 | + $api = plugins_api('plugin_information', array( |
|
102 | 102 | 'slug' => $plugin, |
103 | 103 | 'fields' => array( |
104 | 104 | 'short_description' => false, |
@@ -114,34 +114,34 @@ discard block |
||
114 | 114 | 'homepage' => false, |
115 | 115 | 'donate_link' => false, |
116 | 116 | ), |
117 | - ) ); |
|
117 | + )); |
|
118 | 118 | |
119 | - if ( is_wp_error( $api ) ) { |
|
120 | - wp_die( $api ); |
|
119 | + if (is_wp_error($api)) { |
|
120 | + wp_die($api); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $title = __('Plugin Install'); |
124 | 124 | $parent_file = 'plugins.php'; |
125 | 125 | $submenu_file = 'plugin-install.php'; |
126 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
126 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
127 | 127 | |
128 | - $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); |
|
129 | - $nonce = 'install-plugin_' . $plugin; |
|
130 | - $url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin ); |
|
131 | - if ( isset($_GET['from']) ) |
|
132 | - $url .= '&from=' . urlencode(stripslashes($_GET['from'])); |
|
128 | + $title = sprintf(__('Installing Plugin: %s'), $api->name.' '.$api->version); |
|
129 | + $nonce = 'install-plugin_'.$plugin; |
|
130 | + $url = 'update.php?action=install-plugin&plugin='.urlencode($plugin); |
|
131 | + if (isset($_GET['from'])) |
|
132 | + $url .= '&from='.urlencode(stripslashes($_GET['from'])); |
|
133 | 133 | |
134 | 134 | $type = 'web'; //Install plugin type, From Web or an Upload. |
135 | 135 | |
136 | - $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); |
|
136 | + $upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api'))); |
|
137 | 137 | $upgrader->install($api->download_link); |
138 | 138 | |
139 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
139 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
140 | 140 | |
141 | - } elseif ( 'upload-plugin' == $action ) { |
|
141 | + } elseif ('upload-plugin' == $action) { |
|
142 | 142 | |
143 | - if ( ! current_user_can( 'upload_plugins' ) ) { |
|
144 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
143 | + if ( ! current_user_can('upload_plugins')) { |
|
144 | + wp_die(__('Sorry, you are not allowed to install plugins on this site.')); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | check_admin_referer('plugin-upload'); |
@@ -151,128 +151,128 @@ discard block |
||
151 | 151 | $title = __('Upload Plugin'); |
152 | 152 | $parent_file = 'plugins.php'; |
153 | 153 | $submenu_file = 'plugin-install.php'; |
154 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
154 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
155 | 155 | |
156 | - $title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) ); |
|
156 | + $title = sprintf(__('Installing Plugin from uploaded file: %s'), esc_html(basename($file_upload->filename))); |
|
157 | 157 | $nonce = 'plugin-upload'; |
158 | 158 | $url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin'); |
159 | 159 | $type = 'upload'; //Install plugin type, From Web or an Upload. |
160 | 160 | |
161 | - $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
|
162 | - $result = $upgrader->install( $file_upload->package ); |
|
161 | + $upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('type', 'title', 'nonce', 'url'))); |
|
162 | + $result = $upgrader->install($file_upload->package); |
|
163 | 163 | |
164 | - if ( $result || is_wp_error($result) ) |
|
164 | + if ($result || is_wp_error($result)) |
|
165 | 165 | $file_upload->cleanup(); |
166 | 166 | |
167 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
167 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
168 | 168 | |
169 | - } elseif ( 'upgrade-theme' == $action ) { |
|
169 | + } elseif ('upgrade-theme' == $action) { |
|
170 | 170 | |
171 | - if ( ! current_user_can('update_themes') ) |
|
171 | + if ( ! current_user_can('update_themes')) |
|
172 | 172 | wp_die(__('Sorry, you are not allowed to update themes for this site.')); |
173 | 173 | |
174 | - check_admin_referer('upgrade-theme_' . $theme); |
|
174 | + check_admin_referer('upgrade-theme_'.$theme); |
|
175 | 175 | |
176 | - wp_enqueue_script( 'customize-loader' ); |
|
177 | - wp_enqueue_script( 'updates' ); |
|
176 | + wp_enqueue_script('customize-loader'); |
|
177 | + wp_enqueue_script('updates'); |
|
178 | 178 | |
179 | 179 | $title = __('Update Theme'); |
180 | 180 | $parent_file = 'themes.php'; |
181 | 181 | $submenu_file = 'themes.php'; |
182 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
182 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
183 | 183 | |
184 | - $nonce = 'upgrade-theme_' . $theme; |
|
185 | - $url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme ); |
|
184 | + $nonce = 'upgrade-theme_'.$theme; |
|
185 | + $url = 'update.php?action=upgrade-theme&theme='.urlencode($theme); |
|
186 | 186 | |
187 | - $upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) ); |
|
187 | + $upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme'))); |
|
188 | 188 | $upgrader->upgrade($theme); |
189 | 189 | |
190 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
191 | - } elseif ( 'update-selected-themes' == $action ) { |
|
192 | - if ( ! current_user_can( 'update_themes' ) ) |
|
193 | - wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
|
190 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
191 | + } elseif ('update-selected-themes' == $action) { |
|
192 | + if ( ! current_user_can('update_themes')) |
|
193 | + wp_die(__('Sorry, you are not allowed to update themes for this site.')); |
|
194 | 194 | |
195 | - check_admin_referer( 'bulk-update-themes' ); |
|
195 | + check_admin_referer('bulk-update-themes'); |
|
196 | 196 | |
197 | - if ( isset( $_GET['themes'] ) ) |
|
198 | - $themes = explode( ',', stripslashes($_GET['themes']) ); |
|
199 | - elseif ( isset( $_POST['checked'] ) ) |
|
197 | + if (isset($_GET['themes'])) |
|
198 | + $themes = explode(',', stripslashes($_GET['themes'])); |
|
199 | + elseif (isset($_POST['checked'])) |
|
200 | 200 | $themes = (array) $_POST['checked']; |
201 | 201 | else |
202 | 202 | $themes = array(); |
203 | 203 | |
204 | 204 | $themes = array_map('urldecode', $themes); |
205 | 205 | |
206 | - $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); |
|
206 | + $url = 'update.php?action=update-selected-themes&themes='.urlencode(implode(',', $themes)); |
|
207 | 207 | $nonce = 'bulk-update-themes'; |
208 | 208 | |
209 | - wp_enqueue_script( 'updates' ); |
|
209 | + wp_enqueue_script('updates'); |
|
210 | 210 | iframe_header(); |
211 | 211 | |
212 | - $upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) ); |
|
213 | - $upgrader->bulk_upgrade( $themes ); |
|
212 | + $upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url'))); |
|
213 | + $upgrader->bulk_upgrade($themes); |
|
214 | 214 | |
215 | 215 | iframe_footer(); |
216 | - } elseif ( 'install-theme' == $action ) { |
|
216 | + } elseif ('install-theme' == $action) { |
|
217 | 217 | |
218 | - if ( ! current_user_can('install_themes') ) |
|
219 | - wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
218 | + if ( ! current_user_can('install_themes')) |
|
219 | + wp_die(__('Sorry, you are not allowed to install themes on this site.')); |
|
220 | 220 | |
221 | - include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api.. |
|
221 | + include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); //for themes_api.. |
|
222 | 222 | |
223 | - check_admin_referer( 'install-theme_' . $theme ); |
|
224 | - $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth. |
|
223 | + check_admin_referer('install-theme_'.$theme); |
|
224 | + $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth. |
|
225 | 225 | |
226 | - if ( is_wp_error($api) ) |
|
226 | + if (is_wp_error($api)) |
|
227 | 227 | wp_die($api); |
228 | 228 | |
229 | - wp_enqueue_script( 'customize-loader' ); |
|
229 | + wp_enqueue_script('customize-loader'); |
|
230 | 230 | |
231 | 231 | $title = __('Install Themes'); |
232 | 232 | $parent_file = 'themes.php'; |
233 | 233 | $submenu_file = 'themes.php'; |
234 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
234 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
235 | 235 | |
236 | - $title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version ); |
|
237 | - $nonce = 'install-theme_' . $theme; |
|
238 | - $url = 'update.php?action=install-theme&theme=' . urlencode( $theme ); |
|
236 | + $title = sprintf(__('Installing Theme: %s'), $api->name.' '.$api->version); |
|
237 | + $nonce = 'install-theme_'.$theme; |
|
238 | + $url = 'update.php?action=install-theme&theme='.urlencode($theme); |
|
239 | 239 | $type = 'web'; //Install theme type, From Web or an Upload. |
240 | 240 | |
241 | - $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) ); |
|
241 | + $upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api'))); |
|
242 | 242 | $upgrader->install($api->download_link); |
243 | 243 | |
244 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
244 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
245 | 245 | |
246 | - } elseif ( 'upload-theme' == $action ) { |
|
246 | + } elseif ('upload-theme' == $action) { |
|
247 | 247 | |
248 | - if ( ! current_user_can( 'upload_themes' ) ) { |
|
249 | - wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
248 | + if ( ! current_user_can('upload_themes')) { |
|
249 | + wp_die(__('Sorry, you are not allowed to install themes on this site.')); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | check_admin_referer('theme-upload'); |
253 | 253 | |
254 | 254 | $file_upload = new File_Upload_Upgrader('themezip', 'package'); |
255 | 255 | |
256 | - wp_enqueue_script( 'customize-loader' ); |
|
256 | + wp_enqueue_script('customize-loader'); |
|
257 | 257 | |
258 | 258 | $title = __('Upload Theme'); |
259 | 259 | $parent_file = 'themes.php'; |
260 | 260 | $submenu_file = 'theme-install.php'; |
261 | 261 | |
262 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
262 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
263 | 263 | |
264 | - $title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) ); |
|
264 | + $title = sprintf(__('Installing Theme from uploaded file: %s'), esc_html(basename($file_upload->filename))); |
|
265 | 265 | $nonce = 'theme-upload'; |
266 | 266 | $url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme'); |
267 | 267 | $type = 'upload'; //Install plugin type, From Web or an Upload. |
268 | 268 | |
269 | - $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
|
270 | - $result = $upgrader->install( $file_upload->package ); |
|
269 | + $upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('type', 'title', 'nonce', 'url'))); |
|
270 | + $result = $upgrader->install($file_upload->package); |
|
271 | 271 | |
272 | - if ( $result || is_wp_error($result) ) |
|
272 | + if ($result || is_wp_error($result)) |
|
273 | 273 | $file_upload->cleanup(); |
274 | 274 | |
275 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
275 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
276 | 276 | |
277 | 277 | } else { |
278 | 278 | /** |
@@ -284,6 +284,6 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @since 2.8.0 |
286 | 286 | */ |
287 | - do_action( "update-custom_{$action}" ); |
|
287 | + do_action("update-custom_{$action}"); |
|
288 | 288 | } |
289 | 289 | } |
@@ -6,8 +6,9 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) |
|
9 | +if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) { |
|
10 | 10 | define( 'IFRAME_REQUEST', true ); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** WordPress Administration Bootstrap */ |
13 | 14 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -20,17 +21,19 @@ discard block |
||
20 | 21 | $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
21 | 22 | |
22 | 23 | if ( 'update-selected' == $action ) { |
23 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
24 | - wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
|
24 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
25 | + wp_die( __( 'Sorry, you are not allowed to update plugins for this site.' ) ); |
|
26 | + } |
|
25 | 27 | |
26 | 28 | check_admin_referer( 'bulk-update-plugins' ); |
27 | 29 | |
28 | - if ( isset( $_GET['plugins'] ) ) |
|
29 | - $plugins = explode( ',', stripslashes($_GET['plugins']) ); |
|
30 | - elseif ( isset( $_POST['checked'] ) ) |
|
31 | - $plugins = (array) $_POST['checked']; |
|
32 | - else |
|
33 | - $plugins = array(); |
|
30 | + if ( isset( $_GET['plugins'] ) ) { |
|
31 | + $plugins = explode( ',', stripslashes($_GET['plugins']) ); |
|
32 | + } elseif ( isset( $_POST['checked'] ) ) { |
|
33 | + $plugins = (array) $_POST['checked']; |
|
34 | + } else { |
|
35 | + $plugins = array(); |
|
36 | + } |
|
34 | 37 | |
35 | 38 | $plugins = array_map('urldecode', $plugins); |
36 | 39 | |
@@ -46,8 +49,9 @@ discard block |
||
46 | 49 | iframe_footer(); |
47 | 50 | |
48 | 51 | } elseif ( 'upgrade-plugin' == $action ) { |
49 | - if ( ! current_user_can('update_plugins') ) |
|
50 | - wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
|
52 | + if ( ! current_user_can('update_plugins') ) { |
|
53 | + wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
|
54 | + } |
|
51 | 55 | |
52 | 56 | check_admin_referer('upgrade-plugin_' . $plugin); |
53 | 57 | |
@@ -67,8 +71,9 @@ discard block |
||
67 | 71 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
68 | 72 | |
69 | 73 | } elseif ('activate-plugin' == $action ) { |
70 | - if ( ! current_user_can('update_plugins') ) |
|
71 | - wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
|
74 | + if ( ! current_user_can('update_plugins') ) { |
|
75 | + wp_die(__('Sorry, you are not allowed to update plugins for this site.')); |
|
76 | + } |
|
72 | 77 | |
73 | 78 | check_admin_referer('activate-plugin_' . $plugin); |
74 | 79 | if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) { |
@@ -78,8 +83,9 @@ discard block |
||
78 | 83 | die(); |
79 | 84 | } |
80 | 85 | iframe_header( __('Plugin Reactivation'), true ); |
81 | - if ( isset($_GET['success']) ) |
|
82 | - echo '<p>' . __('Plugin reactivated successfully.') . '</p>'; |
|
86 | + if ( isset($_GET['success']) ) { |
|
87 | + echo '<p>' . __('Plugin reactivated successfully.') . '</p>'; |
|
88 | + } |
|
83 | 89 | |
84 | 90 | if ( isset($_GET['failure']) ){ |
85 | 91 | echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>'; |
@@ -92,8 +98,9 @@ discard block |
||
92 | 98 | iframe_footer(); |
93 | 99 | } elseif ( 'install-plugin' == $action ) { |
94 | 100 | |
95 | - if ( ! current_user_can('install_plugins') ) |
|
96 | - wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
101 | + if ( ! current_user_can('install_plugins') ) { |
|
102 | + wp_die( __( 'Sorry, you are not allowed to install plugins on this site.' ) ); |
|
103 | + } |
|
97 | 104 | |
98 | 105 | include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api.. |
99 | 106 | |
@@ -128,8 +135,9 @@ discard block |
||
128 | 135 | $title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ); |
129 | 136 | $nonce = 'install-plugin_' . $plugin; |
130 | 137 | $url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin ); |
131 | - if ( isset($_GET['from']) ) |
|
132 | - $url .= '&from=' . urlencode(stripslashes($_GET['from'])); |
|
138 | + if ( isset($_GET['from']) ) { |
|
139 | + $url .= '&from=' . urlencode(stripslashes($_GET['from'])); |
|
140 | + } |
|
133 | 141 | |
134 | 142 | $type = 'web'; //Install plugin type, From Web or an Upload. |
135 | 143 | |
@@ -161,15 +169,17 @@ discard block |
||
161 | 169 | $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
162 | 170 | $result = $upgrader->install( $file_upload->package ); |
163 | 171 | |
164 | - if ( $result || is_wp_error($result) ) |
|
165 | - $file_upload->cleanup(); |
|
172 | + if ( $result || is_wp_error($result) ) { |
|
173 | + $file_upload->cleanup(); |
|
174 | + } |
|
166 | 175 | |
167 | 176 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
168 | 177 | |
169 | 178 | } elseif ( 'upgrade-theme' == $action ) { |
170 | 179 | |
171 | - if ( ! current_user_can('update_themes') ) |
|
172 | - wp_die(__('Sorry, you are not allowed to update themes for this site.')); |
|
180 | + if ( ! current_user_can('update_themes') ) { |
|
181 | + wp_die(__('Sorry, you are not allowed to update themes for this site.')); |
|
182 | + } |
|
173 | 183 | |
174 | 184 | check_admin_referer('upgrade-theme_' . $theme); |
175 | 185 | |
@@ -189,17 +199,19 @@ discard block |
||
189 | 199 | |
190 | 200 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
191 | 201 | } elseif ( 'update-selected-themes' == $action ) { |
192 | - if ( ! current_user_can( 'update_themes' ) ) |
|
193 | - wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
|
202 | + if ( ! current_user_can( 'update_themes' ) ) { |
|
203 | + wp_die( __( 'Sorry, you are not allowed to update themes for this site.' ) ); |
|
204 | + } |
|
194 | 205 | |
195 | 206 | check_admin_referer( 'bulk-update-themes' ); |
196 | 207 | |
197 | - if ( isset( $_GET['themes'] ) ) |
|
198 | - $themes = explode( ',', stripslashes($_GET['themes']) ); |
|
199 | - elseif ( isset( $_POST['checked'] ) ) |
|
200 | - $themes = (array) $_POST['checked']; |
|
201 | - else |
|
202 | - $themes = array(); |
|
208 | + if ( isset( $_GET['themes'] ) ) { |
|
209 | + $themes = explode( ',', stripslashes($_GET['themes']) ); |
|
210 | + } elseif ( isset( $_POST['checked'] ) ) { |
|
211 | + $themes = (array) $_POST['checked']; |
|
212 | + } else { |
|
213 | + $themes = array(); |
|
214 | + } |
|
203 | 215 | |
204 | 216 | $themes = array_map('urldecode', $themes); |
205 | 217 | |
@@ -215,16 +227,18 @@ discard block |
||
215 | 227 | iframe_footer(); |
216 | 228 | } elseif ( 'install-theme' == $action ) { |
217 | 229 | |
218 | - if ( ! current_user_can('install_themes') ) |
|
219 | - wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
230 | + if ( ! current_user_can('install_themes') ) { |
|
231 | + wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) ); |
|
232 | + } |
|
220 | 233 | |
221 | 234 | include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api.. |
222 | 235 | |
223 | 236 | check_admin_referer( 'install-theme_' . $theme ); |
224 | 237 | $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth. |
225 | 238 | |
226 | - if ( is_wp_error($api) ) |
|
227 | - wp_die($api); |
|
239 | + if ( is_wp_error($api) ) { |
|
240 | + wp_die($api); |
|
241 | + } |
|
228 | 242 | |
229 | 243 | wp_enqueue_script( 'customize-loader' ); |
230 | 244 | |
@@ -269,8 +283,9 @@ discard block |
||
269 | 283 | $upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) ); |
270 | 284 | $result = $upgrader->install( $file_upload->package ); |
271 | 285 | |
272 | - if ( $result || is_wp_error($result) ) |
|
273 | - $file_upload->cleanup(); |
|
286 | + if ( $result || is_wp_error($result) ) { |
|
287 | + $file_upload->cleanup(); |
|
288 | + } |
|
274 | 289 | |
275 | 290 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
276 | 291 |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! current_user_can('activate_plugins') ) |
|
13 | - wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); |
|
12 | +if ( ! current_user_can('activate_plugins')) |
|
13 | + wp_die(__('Sorry, you are not allowed to manage plugins for this site.')); |
|
14 | 14 | |
15 | 15 | $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
16 | 16 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -18,302 +18,302 @@ discard block |
||
18 | 18 | $action = $wp_list_table->current_action(); |
19 | 19 | |
20 | 20 | $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; |
21 | -$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : ''; |
|
21 | +$s = isset($_REQUEST['s']) ? urlencode(wp_unslash($_REQUEST['s'])) : ''; |
|
22 | 22 | |
23 | 23 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
24 | 24 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); |
25 | 25 | |
26 | -wp_enqueue_script( 'updates' ); |
|
26 | +wp_enqueue_script('updates'); |
|
27 | 27 | |
28 | -if ( $action ) { |
|
28 | +if ($action) { |
|
29 | 29 | |
30 | - switch ( $action ) { |
|
30 | + switch ($action) { |
|
31 | 31 | case 'activate': |
32 | - if ( ! current_user_can('activate_plugins') ) |
|
32 | + if ( ! current_user_can('activate_plugins')) |
|
33 | 33 | wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
34 | 34 | |
35 | - if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { |
|
36 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
35 | + if (is_multisite() && ! is_network_admin() && is_network_only_plugin($plugin)) { |
|
36 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | - check_admin_referer('activate-plugin_' . $plugin); |
|
40 | + check_admin_referer('activate-plugin_'.$plugin); |
|
41 | 41 | |
42 | - $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() ); |
|
43 | - if ( is_wp_error( $result ) ) { |
|
44 | - if ( 'unexpected_output' == $result->get_error_code() ) { |
|
45 | - $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s"); |
|
46 | - wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); |
|
42 | + $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin='.$plugin), is_network_admin()); |
|
43 | + if (is_wp_error($result)) { |
|
44 | + if ('unexpected_output' == $result->get_error_code()) { |
|
45 | + $redirect = self_admin_url('plugins.php?error=true&charsout='.strlen($result->get_error_data()).'&plugin='.$plugin."&plugin_status=$status&paged=$page&s=$s"); |
|
46 | + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_'.$plugin), $redirect)); |
|
47 | 47 | exit; |
48 | 48 | } else { |
49 | 49 | wp_die($result); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! is_network_admin() ) { |
|
54 | - $recent = (array) get_option( 'recently_activated' ); |
|
55 | - unset( $recent[ $plugin ] ); |
|
56 | - update_option( 'recently_activated', $recent ); |
|
53 | + if ( ! is_network_admin()) { |
|
54 | + $recent = (array) get_option('recently_activated'); |
|
55 | + unset($recent[$plugin]); |
|
56 | + update_option('recently_activated', $recent); |
|
57 | 57 | } else { |
58 | - $recent = (array) get_site_option( 'recently_activated' ); |
|
59 | - unset( $recent[ $plugin ] ); |
|
60 | - update_site_option( 'recently_activated', $recent ); |
|
58 | + $recent = (array) get_site_option('recently_activated'); |
|
59 | + unset($recent[$plugin]); |
|
60 | + update_site_option('recently_activated', $recent); |
|
61 | 61 | } |
62 | 62 | |
63 | - if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { |
|
64 | - wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
63 | + if (isset($_GET['from']) && 'import' == $_GET['from']) { |
|
64 | + wp_redirect(self_admin_url("import.php?import=".str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
65 | 65 | } else { |
66 | - wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above |
|
66 | + wp_redirect(self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s")); // overrides the ?error=true one above |
|
67 | 67 | } |
68 | 68 | exit; |
69 | 69 | |
70 | 70 | case 'activate-selected': |
71 | - if ( ! current_user_can('activate_plugins') ) |
|
71 | + if ( ! current_user_can('activate_plugins')) |
|
72 | 72 | wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
73 | 73 | |
74 | 74 | check_admin_referer('bulk-plugins'); |
75 | 75 | |
76 | - $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
76 | + $plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
77 | 77 | |
78 | - if ( is_network_admin() ) { |
|
79 | - foreach ( $plugins as $i => $plugin ) { |
|
78 | + if (is_network_admin()) { |
|
79 | + foreach ($plugins as $i => $plugin) { |
|
80 | 80 | // Only activate plugins which are not already network activated. |
81 | - if ( is_plugin_active_for_network( $plugin ) ) { |
|
82 | - unset( $plugins[ $i ] ); |
|
81 | + if (is_plugin_active_for_network($plugin)) { |
|
82 | + unset($plugins[$i]); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | } else { |
86 | - foreach ( $plugins as $i => $plugin ) { |
|
86 | + foreach ($plugins as $i => $plugin) { |
|
87 | 87 | // Only activate plugins which are not already active and are not network-only when on Multisite. |
88 | - if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) { |
|
89 | - unset( $plugins[ $i ] ); |
|
88 | + if (is_plugin_active($plugin) || (is_multisite() && is_network_only_plugin($plugin))) { |
|
89 | + unset($plugins[$i]); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - if ( empty($plugins) ) { |
|
95 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
94 | + if (empty($plugins)) { |
|
95 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
96 | 96 | exit; |
97 | 97 | } |
98 | 98 | |
99 | - activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() ); |
|
99 | + activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin()); |
|
100 | 100 | |
101 | - if ( ! is_network_admin() ) { |
|
102 | - $recent = (array) get_option('recently_activated' ); |
|
101 | + if ( ! is_network_admin()) { |
|
102 | + $recent = (array) get_option('recently_activated'); |
|
103 | 103 | } else { |
104 | - $recent = (array) get_site_option('recently_activated' ); |
|
104 | + $recent = (array) get_site_option('recently_activated'); |
|
105 | 105 | } |
106 | 106 | |
107 | - foreach ( $plugins as $plugin ) { |
|
108 | - unset( $recent[ $plugin ] ); |
|
107 | + foreach ($plugins as $plugin) { |
|
108 | + unset($recent[$plugin]); |
|
109 | 109 | } |
110 | 110 | |
111 | - if ( ! is_network_admin() ) { |
|
112 | - update_option( 'recently_activated', $recent ); |
|
111 | + if ( ! is_network_admin()) { |
|
112 | + update_option('recently_activated', $recent); |
|
113 | 113 | } else { |
114 | - update_site_option( 'recently_activated', $recent ); |
|
114 | + update_site_option('recently_activated', $recent); |
|
115 | 115 | } |
116 | 116 | |
117 | - wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
117 | + wp_redirect(self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s")); |
|
118 | 118 | exit; |
119 | 119 | |
120 | 120 | case 'update-selected' : |
121 | 121 | |
122 | - check_admin_referer( 'bulk-plugins' ); |
|
122 | + check_admin_referer('bulk-plugins'); |
|
123 | 123 | |
124 | - if ( isset( $_GET['plugins'] ) ) |
|
125 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
126 | - elseif ( isset( $_POST['checked'] ) ) |
|
124 | + if (isset($_GET['plugins'])) |
|
125 | + $plugins = explode(',', $_GET['plugins']); |
|
126 | + elseif (isset($_POST['checked'])) |
|
127 | 127 | $plugins = (array) $_POST['checked']; |
128 | 128 | else |
129 | 129 | $plugins = array(); |
130 | 130 | |
131 | - $title = __( 'Update Plugins' ); |
|
131 | + $title = __('Update Plugins'); |
|
132 | 132 | $parent_file = 'plugins.php'; |
133 | 133 | |
134 | - wp_enqueue_script( 'updates' ); |
|
135 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
134 | + wp_enqueue_script('updates'); |
|
135 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
136 | 136 | |
137 | 137 | echo '<div class="wrap">'; |
138 | - echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
138 | + echo '<h1>'.esc_html($title).'</h1>'; |
|
139 | 139 | |
140 | - $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); |
|
140 | + $url = self_admin_url('update.php?action=update-selected&plugins='.urlencode(join(',', $plugins))); |
|
141 | 141 | $url = wp_nonce_url($url, 'bulk-update-plugins'); |
142 | 142 | |
143 | 143 | echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
144 | 144 | echo '</div>'; |
145 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
145 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
146 | 146 | exit; |
147 | 147 | |
148 | 148 | case 'error_scrape': |
149 | - if ( ! current_user_can('activate_plugins') ) |
|
149 | + if ( ! current_user_can('activate_plugins')) |
|
150 | 150 | wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
151 | 151 | |
152 | - check_admin_referer('plugin-activation-error_' . $plugin); |
|
152 | + check_admin_referer('plugin-activation-error_'.$plugin); |
|
153 | 153 | |
154 | 154 | $valid = validate_plugin($plugin); |
155 | - if ( is_wp_error($valid) ) |
|
155 | + if (is_wp_error($valid)) |
|
156 | 156 | wp_die($valid); |
157 | 157 | |
158 | - if ( ! WP_DEBUG ) { |
|
159 | - error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|
158 | + if ( ! WP_DEBUG) { |
|
159 | + error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
163 | 163 | // Go back to "sandbox" scope so we get the same errors as before |
164 | - plugin_sandbox_scrape( $plugin ); |
|
164 | + plugin_sandbox_scrape($plugin); |
|
165 | 165 | /** This action is documented in wp-admin/includes/plugin.php */ |
166 | - do_action( "activate_{$plugin}" ); |
|
166 | + do_action("activate_{$plugin}"); |
|
167 | 167 | exit; |
168 | 168 | |
169 | 169 | case 'deactivate': |
170 | - if ( ! current_user_can('activate_plugins') ) |
|
170 | + if ( ! current_user_can('activate_plugins')) |
|
171 | 171 | wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
172 | 172 | |
173 | - check_admin_referer('deactivate-plugin_' . $plugin); |
|
173 | + check_admin_referer('deactivate-plugin_'.$plugin); |
|
174 | 174 | |
175 | - if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { |
|
176 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
175 | + if ( ! is_network_admin() && is_plugin_active_for_network($plugin)) { |
|
176 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
177 | 177 | exit; |
178 | 178 | } |
179 | 179 | |
180 | - deactivate_plugins( $plugin, false, is_network_admin() ); |
|
180 | + deactivate_plugins($plugin, false, is_network_admin()); |
|
181 | 181 | |
182 | - if ( ! is_network_admin() ) { |
|
183 | - update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
|
182 | + if ( ! is_network_admin()) { |
|
183 | + update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated')); |
|
184 | 184 | } else { |
185 | - update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); |
|
185 | + update_site_option('recently_activated', array($plugin => time()) + (array) get_site_option('recently_activated')); |
|
186 | 186 | } |
187 | 187 | |
188 | - if ( headers_sent() ) |
|
189 | - echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
188 | + if (headers_sent()) |
|
189 | + echo "<meta http-equiv='refresh' content='".esc_attr("0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")."' />"; |
|
190 | 190 | else |
191 | - wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
191 | + wp_redirect(self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")); |
|
192 | 192 | exit; |
193 | 193 | |
194 | 194 | case 'deactivate-selected': |
195 | - if ( ! current_user_can('activate_plugins') ) |
|
195 | + if ( ! current_user_can('activate_plugins')) |
|
196 | 196 | wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
197 | 197 | |
198 | 198 | check_admin_referer('bulk-plugins'); |
199 | 199 | |
200 | - $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
200 | + $plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
201 | 201 | // Do not deactivate plugins which are already deactivated. |
202 | - if ( is_network_admin() ) { |
|
203 | - $plugins = array_filter( $plugins, 'is_plugin_active_for_network' ); |
|
202 | + if (is_network_admin()) { |
|
203 | + $plugins = array_filter($plugins, 'is_plugin_active_for_network'); |
|
204 | 204 | } else { |
205 | - $plugins = array_filter( $plugins, 'is_plugin_active' ); |
|
206 | - $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) ); |
|
205 | + $plugins = array_filter($plugins, 'is_plugin_active'); |
|
206 | + $plugins = array_diff($plugins, array_filter($plugins, 'is_plugin_active_for_network')); |
|
207 | 207 | } |
208 | - if ( empty($plugins) ) { |
|
209 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
208 | + if (empty($plugins)) { |
|
209 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
210 | 210 | exit; |
211 | 211 | } |
212 | 212 | |
213 | - deactivate_plugins( $plugins, false, is_network_admin() ); |
|
213 | + deactivate_plugins($plugins, false, is_network_admin()); |
|
214 | 214 | |
215 | 215 | $deactivated = array(); |
216 | - foreach ( $plugins as $plugin ) { |
|
217 | - $deactivated[ $plugin ] = time(); |
|
216 | + foreach ($plugins as $plugin) { |
|
217 | + $deactivated[$plugin] = time(); |
|
218 | 218 | } |
219 | 219 | |
220 | - if ( ! is_network_admin() ) { |
|
221 | - update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
|
220 | + if ( ! is_network_admin()) { |
|
221 | + update_option('recently_activated', $deactivated + (array) get_option('recently_activated')); |
|
222 | 222 | } else { |
223 | - update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) ); |
|
223 | + update_site_option('recently_activated', $deactivated + (array) get_site_option('recently_activated')); |
|
224 | 224 | } |
225 | 225 | |
226 | - wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
226 | + wp_redirect(self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s")); |
|
227 | 227 | exit; |
228 | 228 | |
229 | 229 | case 'delete-selected': |
230 | - if ( ! current_user_can('delete_plugins') ) { |
|
230 | + if ( ! current_user_can('delete_plugins')) { |
|
231 | 231 | wp_die(__('Sorry, you are not allowed to delete plugins for this site.')); |
232 | 232 | } |
233 | 233 | |
234 | 234 | check_admin_referer('bulk-plugins'); |
235 | 235 | |
236 | 236 | //$_POST = from the plugin form; $_GET = from the FTP details screen. |
237 | - $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
|
238 | - if ( empty( $plugins ) ) { |
|
239 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
237 | + $plugins = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array(); |
|
238 | + if (empty($plugins)) { |
|
239 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
240 | 240 | exit; |
241 | 241 | } |
242 | 242 | |
243 | 243 | $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. |
244 | - if ( empty( $plugins ) ) { |
|
245 | - wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
|
244 | + if (empty($plugins)) { |
|
245 | + wp_redirect(self_admin_url("plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s")); |
|
246 | 246 | exit; |
247 | 247 | } |
248 | 248 | |
249 | - include(ABSPATH . 'wp-admin/update.php'); |
|
249 | + include(ABSPATH.'wp-admin/update.php'); |
|
250 | 250 | |
251 | 251 | $parent_file = 'plugins.php'; |
252 | 252 | |
253 | - if ( ! isset($_REQUEST['verify-delete']) ) { |
|
253 | + if ( ! isset($_REQUEST['verify-delete'])) { |
|
254 | 254 | wp_enqueue_script('jquery'); |
255 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
255 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
256 | 256 | ?> |
257 | 257 | <div class="wrap"> |
258 | 258 | <?php |
259 | 259 | $plugin_info = array(); |
260 | 260 | $have_non_network_plugins = false; |
261 | - foreach ( (array) $plugins as $plugin ) { |
|
262 | - $plugin_slug = dirname( $plugin ); |
|
263 | - |
|
264 | - if ( '.' == $plugin_slug ) { |
|
265 | - if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { |
|
266 | - $plugin_info[ $plugin ] = $data; |
|
267 | - $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
268 | - if ( ! $plugin_info[ $plugin ]['Network'] ) { |
|
261 | + foreach ((array) $plugins as $plugin) { |
|
262 | + $plugin_slug = dirname($plugin); |
|
263 | + |
|
264 | + if ('.' == $plugin_slug) { |
|
265 | + if ($data = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin)) { |
|
266 | + $plugin_info[$plugin] = $data; |
|
267 | + $plugin_info[$plugin]['is_uninstallable'] = is_uninstallable_plugin($plugin); |
|
268 | + if ( ! $plugin_info[$plugin]['Network']) { |
|
269 | 269 | $have_non_network_plugins = true; |
270 | 270 | } |
271 | 271 | } |
272 | 272 | } else { |
273 | 273 | // Get plugins list from that folder. |
274 | - if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { |
|
275 | - foreach ( $folder_plugins as $plugin_file => $data ) { |
|
276 | - $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
|
277 | - $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
278 | - if ( ! $plugin_info[ $plugin_file ]['Network'] ) { |
|
274 | + if ($folder_plugins = get_plugins('/'.$plugin_slug)) { |
|
275 | + foreach ($folder_plugins as $plugin_file => $data) { |
|
276 | + $plugin_info[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $data); |
|
277 | + $plugin_info[$plugin_file]['is_uninstallable'] = is_uninstallable_plugin($plugin); |
|
278 | + if ( ! $plugin_info[$plugin_file]['Network']) { |
|
279 | 279 | $have_non_network_plugins = true; |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } |
283 | 283 | } |
284 | 284 | } |
285 | - $plugins_to_delete = count( $plugin_info ); |
|
285 | + $plugins_to_delete = count($plugin_info); |
|
286 | 286 | ?> |
287 | - <?php if ( 1 == $plugins_to_delete ) : ?> |
|
288 | - <h1><?php _e( 'Delete Plugin' ); ?></h1> |
|
289 | - <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
|
290 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
|
287 | + <?php if (1 == $plugins_to_delete) : ?> |
|
288 | + <h1><?php _e('Delete Plugin'); ?></h1> |
|
289 | + <?php if ($have_non_network_plugins && is_network_admin()) : ?> |
|
290 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This plugin may be active on other sites in the network.'); ?></p></div> |
|
291 | 291 | <?php endif; ?> |
292 | - <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
|
292 | + <p><?php _e('You are about to remove the following plugin:'); ?></p> |
|
293 | 293 | <?php else: ?> |
294 | - <h1><?php _e( 'Delete Plugins' ); ?></h1> |
|
295 | - <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
|
296 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
|
294 | + <h1><?php _e('Delete Plugins'); ?></h1> |
|
295 | + <?php if ($have_non_network_plugins && is_network_admin()) : ?> |
|
296 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These plugins may be active on other sites in the network.'); ?></p></div> |
|
297 | 297 | <?php endif; ?> |
298 | - <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
|
298 | + <p><?php _e('You are about to remove the following plugins:'); ?></p> |
|
299 | 299 | <?php endif; ?> |
300 | 300 | <ul class="ul-disc"> |
301 | 301 | <?php |
302 | 302 | $data_to_delete = false; |
303 | - foreach ( $plugin_info as $plugin ) { |
|
304 | - if ( $plugin['is_uninstallable'] ) { |
|
303 | + foreach ($plugin_info as $plugin) { |
|
304 | + if ($plugin['is_uninstallable']) { |
|
305 | 305 | /* translators: 1: plugin name, 2: plugin author */ |
306 | - echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>'; |
|
306 | + echo '<li>', sprintf(__('%1$s by %2$s (will also <strong>delete its data</strong>)'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName'].'</em>'), '</li>'; |
|
307 | 307 | $data_to_delete = true; |
308 | 308 | } else { |
309 | 309 | /* translators: 1: plugin name, 2: plugin author */ |
310 | - echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>'; |
|
310 | + echo '<li>', sprintf(_x('%1$s by %2$s', 'plugin'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName']).'</em>', '</li>'; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | ?> |
314 | 314 | </ul> |
315 | 315 | <p><?php |
316 | - if ( $data_to_delete ) |
|
316 | + if ($data_to_delete) |
|
317 | 317 | _e('Are you sure you wish to delete these files and data?'); |
318 | 318 | else |
319 | 319 | _e('Are you sure you wish to delete these files?'); |
@@ -322,38 +322,38 @@ discard block |
||
322 | 322 | <input type="hidden" name="verify-delete" value="1" /> |
323 | 323 | <input type="hidden" name="action" value="delete-selected" /> |
324 | 324 | <?php |
325 | - foreach ( (array) $plugins as $plugin ) { |
|
326 | - echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; |
|
325 | + foreach ((array) $plugins as $plugin) { |
|
326 | + echo '<input type="hidden" name="checked[]" value="'.esc_attr($plugin).'" />'; |
|
327 | 327 | } |
328 | 328 | ?> |
329 | 329 | <?php wp_nonce_field('bulk-plugins') ?> |
330 | - <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), 'button', 'submit', false ); ?> |
|
330 | + <?php submit_button($data_to_delete ? __('Yes, delete these files and data') : __('Yes, delete these files'), 'button', 'submit', false); ?> |
|
331 | 331 | </form> |
332 | 332 | <?php |
333 | 333 | $referer = wp_get_referer(); |
334 | 334 | ?> |
335 | - <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
|
336 | - <?php submit_button( __( 'No, return me to the plugin list' ), 'button', 'submit', false ); ?> |
|
335 | + <form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;"> |
|
336 | + <?php submit_button(__('No, return me to the plugin list'), 'button', 'submit', false); ?> |
|
337 | 337 | </form> |
338 | 338 | </div> |
339 | 339 | <?php |
340 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
340 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
341 | 341 | exit; |
342 | 342 | } else { |
343 | - $plugins_to_delete = count( $plugins ); |
|
343 | + $plugins_to_delete = count($plugins); |
|
344 | 344 | } // endif verify-delete |
345 | 345 | |
346 | - $delete_result = delete_plugins( $plugins ); |
|
346 | + $delete_result = delete_plugins($plugins); |
|
347 | 347 | |
348 | - set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
|
349 | - wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") ); |
|
348 | + set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
|
349 | + wp_redirect(self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s")); |
|
350 | 350 | exit; |
351 | 351 | |
352 | 352 | case 'clear-recent-list': |
353 | - if ( ! is_network_admin() ) { |
|
354 | - update_option( 'recently_activated', array() ); |
|
353 | + if ( ! is_network_admin()) { |
|
354 | + update_option('recently_activated', array()); |
|
355 | 355 | } else { |
356 | - update_site_option( 'recently_activated', array() ); |
|
356 | + update_site_option('recently_activated', array()); |
|
357 | 357 | } |
358 | 358 | break; |
359 | 359 | } |
@@ -364,128 +364,128 @@ discard block |
||
364 | 364 | wp_enqueue_script('plugin-install'); |
365 | 365 | add_thickbox(); |
366 | 366 | |
367 | -add_screen_option( 'per_page', array( 'default' => 999 ) ); |
|
367 | +add_screen_option('per_page', array('default' => 999)); |
|
368 | 368 | |
369 | -get_current_screen()->add_help_tab( array( |
|
369 | +get_current_screen()->add_help_tab(array( |
|
370 | 370 | 'id' => 'overview', |
371 | 371 | 'title' => __('Overview'), |
372 | 372 | 'content' => |
373 | - '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . |
|
374 | - '<p>' . __( 'The search for installed plugins will search for terms in their name, description, or author.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
|
375 | - '<p>' . sprintf( |
|
373 | + '<p>'.__('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.').'</p>'. |
|
374 | + '<p>'.__('The search for installed plugins will search for terms in their name, description, or author.').' <span id="live-search-desc" class="hide-if-no-js">'.__('The search results will be updated as you type.').'</span></p>'. |
|
375 | + '<p>'.sprintf( |
|
376 | 376 | /* translators: %s: WordPress Plugin Directory URL */ |
377 | - __( 'If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s" target="_blank">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!' ), |
|
377 | + __('If you would like to see more plugins to choose from, click on the “Add New” button and you will be able to browse or search for additional plugins from the <a href="%s" target="_blank">WordPress Plugin Directory</a>. Plugins in the WordPress Plugin Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), |
|
378 | 378 | 'https://wordpress.org/plugins/' |
379 | - ) . '</p>' |
|
380 | -) ); |
|
381 | -get_current_screen()->add_help_tab( array( |
|
379 | + ).'</p>' |
|
380 | +)); |
|
381 | +get_current_screen()->add_help_tab(array( |
|
382 | 382 | 'id' => 'compatibility-problems', |
383 | 383 | 'title' => __('Troubleshooting'), |
384 | 384 | 'content' => |
385 | - '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . |
|
386 | - '<p>' . sprintf( |
|
385 | + '<p>'.__('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.').'</p>'. |
|
386 | + '<p>'.sprintf( |
|
387 | 387 | /* translators: WP_PLUGIN_DIR constant value */ |
388 | - __( 'If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ), |
|
389 | - '<code>' . WP_PLUGIN_DIR . '</code>' |
|
390 | - ) . '</p>' |
|
391 | -) ); |
|
388 | + __('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.'), |
|
389 | + '<code>'.WP_PLUGIN_DIR.'</code>' |
|
390 | + ).'</p>' |
|
391 | +)); |
|
392 | 392 | |
393 | 393 | get_current_screen()->set_help_sidebar( |
394 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
395 | - '<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' . |
|
396 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
394 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
395 | + '<p>'.__('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>').'</p>'. |
|
396 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
397 | 397 | ); |
398 | 398 | |
399 | -get_current_screen()->set_screen_reader_content( array( |
|
400 | - 'heading_views' => __( 'Filter plugins list' ), |
|
401 | - 'heading_pagination' => __( 'Plugins list navigation' ), |
|
402 | - 'heading_list' => __( 'Plugins list' ), |
|
403 | -) ); |
|
399 | +get_current_screen()->set_screen_reader_content(array( |
|
400 | + 'heading_views' => __('Filter plugins list'), |
|
401 | + 'heading_pagination' => __('Plugins list navigation'), |
|
402 | + 'heading_list' => __('Plugins list'), |
|
403 | +)); |
|
404 | 404 | |
405 | 405 | $title = __('Plugins'); |
406 | 406 | $parent_file = 'plugins.php'; |
407 | 407 | |
408 | -require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
408 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
409 | 409 | |
410 | 410 | $invalid = validate_active_plugins(); |
411 | -if ( ! empty( $invalid ) ) { |
|
412 | - foreach ( $invalid as $plugin_file => $error ) { |
|
411 | +if ( ! empty($invalid)) { |
|
412 | + foreach ($invalid as $plugin_file => $error) { |
|
413 | 413 | echo '<div id="message" class="error"><p>'; |
414 | 414 | printf( |
415 | 415 | /* translators: 1: plugin file 2: error message */ |
416 | - __( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ), |
|
417 | - '<code>' . esc_html( $plugin_file ) . '</code>', |
|
416 | + __('The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s'), |
|
417 | + '<code>'.esc_html($plugin_file).'</code>', |
|
418 | 418 | $error->get_error_message() ); |
419 | 419 | echo '</p></div>'; |
420 | 420 | } |
421 | 421 | } |
422 | 422 | ?> |
423 | 423 | |
424 | -<?php if ( isset($_GET['error']) ) : |
|
424 | +<?php if (isset($_GET['error'])) : |
|
425 | 425 | |
426 | - if ( isset( $_GET['main'] ) ) |
|
427 | - $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
428 | - elseif ( isset($_GET['charsout']) ) |
|
426 | + if (isset($_GET['main'])) |
|
427 | + $errmsg = __('You cannot delete a plugin while it is active on the main site.'); |
|
428 | + elseif (isset($_GET['charsout'])) |
|
429 | 429 | $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
430 | 430 | else |
431 | 431 | $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
432 | 432 | ?> |
433 | 433 | <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
434 | 434 | <?php |
435 | - if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) { |
|
436 | - $iframe_url = add_query_arg( array( |
|
435 | + if ( ! isset($_GET['main']) && ! isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$plugin)) { |
|
436 | + $iframe_url = add_query_arg(array( |
|
437 | 437 | 'action' => 'error_scrape', |
438 | - 'plugin' => urlencode( $plugin ), |
|
439 | - '_wpnonce' => urlencode( $_GET['_error_nonce'] ), |
|
440 | - ), admin_url( 'plugins.php' ) ); |
|
438 | + 'plugin' => urlencode($plugin), |
|
439 | + '_wpnonce' => urlencode($_GET['_error_nonce']), |
|
440 | + ), admin_url('plugins.php')); |
|
441 | 441 | ?> |
442 | - <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe> |
|
442 | + <iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($iframe_url); ?>"></iframe> |
|
443 | 443 | <?php |
444 | 444 | } |
445 | 445 | ?> |
446 | 446 | </div> |
447 | -<?php elseif ( isset($_GET['deleted']) ) : |
|
448 | - $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
|
447 | +<?php elseif (isset($_GET['deleted'])) : |
|
448 | + $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
|
449 | 449 | // Delete it once we're done. |
450 | - delete_transient( 'plugins_delete_result_' . $user_ID ); |
|
450 | + delete_transient('plugins_delete_result_'.$user_ID); |
|
451 | 451 | |
452 | - if ( is_wp_error($delete_result) ) : ?> |
|
453 | - <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
|
452 | + if (is_wp_error($delete_result)) : ?> |
|
453 | + <div id="message" class="error notice is-dismissible"><p><?php printf(__('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message()); ?></p></div> |
|
454 | 454 | <?php else : ?> |
455 | 455 | <div id="message" class="updated notice is-dismissible"> |
456 | 456 | <p> |
457 | 457 | <?php |
458 | - if ( 1 == (int) $_GET['deleted'] ) { |
|
459 | - _e( 'The selected plugin has been <strong>deleted</strong>.' ); |
|
458 | + if (1 == (int) $_GET['deleted']) { |
|
459 | + _e('The selected plugin has been <strong>deleted</strong>.'); |
|
460 | 460 | } else { |
461 | - _e( 'The selected plugins have been <strong>deleted</strong>.' ); |
|
461 | + _e('The selected plugins have been <strong>deleted</strong>.'); |
|
462 | 462 | } |
463 | 463 | ?> |
464 | 464 | </p> |
465 | 465 | </div> |
466 | 466 | <?php endif; ?> |
467 | -<?php elseif ( isset($_GET['activate']) ) : ?> |
|
467 | +<?php elseif (isset($_GET['activate'])) : ?> |
|
468 | 468 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
469 | 469 | <?php elseif (isset($_GET['activate-multi'])) : ?> |
470 | 470 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
471 | -<?php elseif ( isset($_GET['deactivate']) ) : ?> |
|
471 | +<?php elseif (isset($_GET['deactivate'])) : ?> |
|
472 | 472 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
473 | 473 | <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
474 | 474 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
475 | -<?php elseif ( 'update-selected' == $action ) : ?> |
|
475 | +<?php elseif ('update-selected' == $action) : ?> |
|
476 | 476 | <div id="message" class="updated notice is-dismissible"><p><?php _e('All selected plugins are up to date.'); ?></p></div> |
477 | 477 | <?php endif; ?> |
478 | 478 | |
479 | 479 | <div class="wrap"> |
480 | -<h1><?php echo esc_html( $title ); |
|
481 | -if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> |
|
482 | - <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
|
480 | +<h1><?php echo esc_html($title); |
|
481 | +if (( ! is_multisite() || is_network_admin()) && current_user_can('install_plugins')) { ?> |
|
482 | + <a href="<?php echo self_admin_url('plugin-install.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
|
483 | 483 | <?php |
484 | 484 | } |
485 | 485 | |
486 | -if ( strlen( $s ) ) { |
|
486 | +if (strlen($s)) { |
|
487 | 487 | /* translators: %s: search keywords */ |
488 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( urldecode( $s ) ) ); |
|
488 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html(urldecode($s))); |
|
489 | 489 | } |
490 | 490 | ?> |
491 | 491 | </h1> |
@@ -503,13 +503,13 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @param array $plugins_all An array containing all installed plugins. |
505 | 505 | */ |
506 | -do_action( 'pre_current_active_plugins', $plugins['all'] ); |
|
506 | +do_action('pre_current_active_plugins', $plugins['all']); |
|
507 | 507 | ?> |
508 | 508 | |
509 | 509 | <?php $wp_list_table->views(); ?> |
510 | 510 | |
511 | 511 | <form class="search-form search-plugins" method="get"> |
512 | -<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> |
|
512 | +<?php $wp_list_table->search_box(__('Search Installed Plugins'), 'plugin'); ?> |
|
513 | 513 | </form> |
514 | 514 | |
515 | 515 | <form method="post" id="bulk-action-form"> |
@@ -528,4 +528,4 @@ discard block |
||
528 | 528 | wp_print_admin_notice_templates(); |
529 | 529 | wp_print_update_row_templates(); |
530 | 530 | |
531 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
531 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! current_user_can('activate_plugins') ) |
|
12 | +if ( ! current_user_can('activate_plugins') ) { |
|
13 | 13 | wp_die( __( 'Sorry, you are not allowed to manage plugins for this site.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
16 | 17 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | |
30 | 31 | switch ( $action ) { |
31 | 32 | case 'activate': |
32 | - if ( ! current_user_can('activate_plugins') ) |
|
33 | - wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
33 | + if ( ! current_user_can('activate_plugins') ) { |
|
34 | + wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { |
36 | 38 | wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
@@ -68,8 +70,9 @@ discard block |
||
68 | 70 | exit; |
69 | 71 | |
70 | 72 | case 'activate-selected': |
71 | - if ( ! current_user_can('activate_plugins') ) |
|
72 | - wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
73 | + if ( ! current_user_can('activate_plugins') ) { |
|
74 | + wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
75 | + } |
|
73 | 76 | |
74 | 77 | check_admin_referer('bulk-plugins'); |
75 | 78 | |
@@ -121,12 +124,13 @@ discard block |
||
121 | 124 | |
122 | 125 | check_admin_referer( 'bulk-plugins' ); |
123 | 126 | |
124 | - if ( isset( $_GET['plugins'] ) ) |
|
125 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
126 | - elseif ( isset( $_POST['checked'] ) ) |
|
127 | - $plugins = (array) $_POST['checked']; |
|
128 | - else |
|
129 | - $plugins = array(); |
|
127 | + if ( isset( $_GET['plugins'] ) ) { |
|
128 | + $plugins = explode( ',', $_GET['plugins'] ); |
|
129 | + } elseif ( isset( $_POST['checked'] ) ) { |
|
130 | + $plugins = (array) $_POST['checked']; |
|
131 | + } else { |
|
132 | + $plugins = array(); |
|
133 | + } |
|
130 | 134 | |
131 | 135 | $title = __( 'Update Plugins' ); |
132 | 136 | $parent_file = 'plugins.php'; |
@@ -146,14 +150,16 @@ discard block |
||
146 | 150 | exit; |
147 | 151 | |
148 | 152 | case 'error_scrape': |
149 | - if ( ! current_user_can('activate_plugins') ) |
|
150 | - wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
153 | + if ( ! current_user_can('activate_plugins') ) { |
|
154 | + wp_die(__('Sorry, you are not allowed to activate plugins for this site.')); |
|
155 | + } |
|
151 | 156 | |
152 | 157 | check_admin_referer('plugin-activation-error_' . $plugin); |
153 | 158 | |
154 | 159 | $valid = validate_plugin($plugin); |
155 | - if ( is_wp_error($valid) ) |
|
156 | - wp_die($valid); |
|
160 | + if ( is_wp_error($valid) ) { |
|
161 | + wp_die($valid); |
|
162 | + } |
|
157 | 163 | |
158 | 164 | if ( ! WP_DEBUG ) { |
159 | 165 | error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
@@ -167,8 +173,9 @@ discard block |
||
167 | 173 | exit; |
168 | 174 | |
169 | 175 | case 'deactivate': |
170 | - if ( ! current_user_can('activate_plugins') ) |
|
171 | - wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
|
176 | + if ( ! current_user_can('activate_plugins') ) { |
|
177 | + wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
|
178 | + } |
|
172 | 179 | |
173 | 180 | check_admin_referer('deactivate-plugin_' . $plugin); |
174 | 181 | |
@@ -185,15 +192,17 @@ discard block |
||
185 | 192 | update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) ); |
186 | 193 | } |
187 | 194 | |
188 | - if ( headers_sent() ) |
|
189 | - echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
190 | - else |
|
191 | - wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
195 | + if ( headers_sent() ) { |
|
196 | + echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
197 | + } else { |
|
198 | + wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
199 | + } |
|
192 | 200 | exit; |
193 | 201 | |
194 | 202 | case 'deactivate-selected': |
195 | - if ( ! current_user_can('activate_plugins') ) |
|
196 | - wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
|
203 | + if ( ! current_user_can('activate_plugins') ) { |
|
204 | + wp_die(__('Sorry, you are not allowed to deactivate plugins for this site.')); |
|
205 | + } |
|
197 | 206 | |
198 | 207 | check_admin_referer('bulk-plugins'); |
199 | 208 | |
@@ -290,8 +299,11 @@ discard block |
||
290 | 299 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
291 | 300 | <?php endif; ?> |
292 | 301 | <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
293 | - <?php else: ?> |
|
294 | - <h1><?php _e( 'Delete Plugins' ); ?></h1> |
|
302 | + <?php else { |
|
303 | + : ?> |
|
304 | + <h1><?php _e( 'Delete Plugins' ); |
|
305 | +} |
|
306 | +?></h1> |
|
295 | 307 | <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
296 | 308 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
297 | 309 | <?php endif; ?> |
@@ -313,10 +325,11 @@ discard block |
||
313 | 325 | ?> |
314 | 326 | </ul> |
315 | 327 | <p><?php |
316 | - if ( $data_to_delete ) |
|
317 | - _e('Are you sure you wish to delete these files and data?'); |
|
318 | - else |
|
319 | - _e('Are you sure you wish to delete these files?'); |
|
328 | + if ( $data_to_delete ) { |
|
329 | + _e('Are you sure you wish to delete these files and data?'); |
|
330 | + } else { |
|
331 | + _e('Are you sure you wish to delete these files?'); |
|
332 | + } |
|
320 | 333 | ?></p> |
321 | 334 | <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
322 | 335 | <input type="hidden" name="verify-delete" value="1" /> |
@@ -423,12 +436,13 @@ discard block |
||
423 | 436 | |
424 | 437 | <?php if ( isset($_GET['error']) ) : |
425 | 438 | |
426 | - if ( isset( $_GET['main'] ) ) |
|
427 | - $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
428 | - elseif ( isset($_GET['charsout']) ) |
|
429 | - $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
430 | - else |
|
431 | - $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
439 | + if ( isset( $_GET['main'] ) ) { |
|
440 | + $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
441 | + } elseif ( isset($_GET['charsout']) ) { |
|
442 | + $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
443 | + } else { |
|
444 | + $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
445 | + } |
|
432 | 446 | ?> |
433 | 447 | <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
434 | 448 | <?php |
@@ -451,12 +465,14 @@ discard block |
||
451 | 465 | |
452 | 466 | if ( is_wp_error($delete_result) ) : ?> |
453 | 467 | <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
454 | - <?php else : ?> |
|
468 | + <?php else { |
|
469 | + : ?> |
|
455 | 470 | <div id="message" class="updated notice is-dismissible"> |
456 | 471 | <p> |
457 | 472 | <?php |
458 | 473 | if ( 1 == (int) $_GET['deleted'] ) { |
459 | 474 | _e( 'The selected plugin has been <strong>deleted</strong>.' ); |
475 | +} |
|
460 | 476 | } else { |
461 | 477 | _e( 'The selected plugins have been <strong>deleted</strong>.' ); |
462 | 478 | } |
@@ -9,28 +9,28 @@ 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' ) ) { |
|
15 | - wp_die( __( 'Sorry, you are not allowed to import content.' ) ); |
|
14 | +if ( ! current_user_can('import')) { |
|
15 | + wp_die(__('Sorry, you are not allowed to import content.')); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $title = __('Import'); |
19 | 19 | |
20 | -get_current_screen()->add_help_tab( array( |
|
20 | +get_current_screen()->add_help_tab(array( |
|
21 | 21 | 'id' => 'overview', |
22 | 22 | 'title' => __('Overview'), |
23 | - '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>' . |
|
24 | - '<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>', |
|
25 | -) ); |
|
23 | + '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>'. |
|
24 | + '<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>', |
|
25 | +)); |
|
26 | 26 | |
27 | 27 | get_current_screen()->set_help_sidebar( |
28 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
29 | - '<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' . |
|
30 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
28 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
29 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>').'</p>'. |
|
30 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
31 | 31 | ); |
32 | 32 | |
33 | -if ( current_user_can( 'install_plugins' ) ) { |
|
33 | +if (current_user_can('install_plugins')) { |
|
34 | 34 | // List of popular importer plugins from the WordPress.org API. |
35 | 35 | $popular_importers = wp_get_popular_importers(); |
36 | 36 | } else { |
@@ -38,30 +38,30 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' |
41 | -if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { |
|
42 | - $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id']; |
|
43 | - if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops. |
|
44 | - wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) ); |
|
41 | +if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) { |
|
42 | + $importer_id = $popular_importers[$_GET['invalid']]['importer-id']; |
|
43 | + if ($importer_id != $_GET['invalid']) { // Prevent redirect loops. |
|
44 | + wp_redirect(admin_url('admin.php?import='.$importer_id)); |
|
45 | 45 | exit; |
46 | 46 | } |
47 | - unset( $importer_id ); |
|
47 | + unset($importer_id); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | add_thickbox(); |
51 | -wp_enqueue_script( 'plugin-install' ); |
|
52 | -wp_enqueue_script( 'updates' ); |
|
51 | +wp_enqueue_script('plugin-install'); |
|
52 | +wp_enqueue_script('updates'); |
|
53 | 53 | |
54 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
54 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
55 | 55 | $parent_file = 'tools.php'; |
56 | 56 | ?> |
57 | 57 | |
58 | 58 | <div class="wrap"> |
59 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
60 | -<?php if ( ! empty( $_GET['invalid'] ) ) : ?> |
|
59 | +<h1><?php echo esc_html($title); ?></h1> |
|
60 | +<?php if ( ! empty($_GET['invalid'])) : ?> |
|
61 | 61 | <div class="error"> |
62 | - <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php |
|
62 | + <p><strong><?php _e('ERROR:'); ?></strong> <?php |
|
63 | 63 | /* translators: %s: importer slug */ |
64 | - printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); |
|
64 | + printf(__('The %s importer is invalid or is not installed.'), '<strong>'.esc_html($_GET['invalid']).'</strong>'); |
|
65 | 65 | ?></p> |
66 | 66 | </div> |
67 | 67 | <?php endif; ?> |
@@ -72,108 +72,108 @@ discard block |
||
72 | 72 | $importers = get_importers(); |
73 | 73 | |
74 | 74 | // If a popular importer is not registered, create a dummy registration that links to the plugin installer. |
75 | -foreach ( $popular_importers as $pop_importer => $pop_data ) { |
|
76 | - if ( isset( $importers[ $pop_importer ] ) ) |
|
75 | +foreach ($popular_importers as $pop_importer => $pop_data) { |
|
76 | + if (isset($importers[$pop_importer])) |
|
77 | 77 | continue; |
78 | - if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
|
78 | + if (isset($importers[$pop_data['importer-id']])) |
|
79 | 79 | continue; |
80 | 80 | |
81 | 81 | // Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API. |
82 | - $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
|
82 | + $importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']); |
|
83 | 83 | } |
84 | 84 | |
85 | -if ( empty( $importers ) ) { |
|
86 | - echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful |
|
85 | +if (empty($importers)) { |
|
86 | + echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful |
|
87 | 87 | } else { |
88 | - uasort( $importers, '_usort_by_first_member' ); |
|
88 | + uasort($importers, '_usort_by_first_member'); |
|
89 | 89 | ?> |
90 | 90 | <table class="widefat importers striped"> |
91 | 91 | |
92 | 92 | <?php |
93 | - foreach ( $importers as $importer_id => $data ) { |
|
93 | + foreach ($importers as $importer_id => $data) { |
|
94 | 94 | $plugin_slug = $action = ''; |
95 | 95 | $is_plugin_installed = false; |
96 | 96 | |
97 | - if ( isset( $data['install'] ) ) { |
|
97 | + if (isset($data['install'])) { |
|
98 | 98 | $plugin_slug = $data['install']; |
99 | 99 | |
100 | - if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { |
|
100 | + if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) { |
|
101 | 101 | // Looks like an importer is installed, but not active. |
102 | - $plugins = get_plugins( '/' . $plugin_slug ); |
|
103 | - if ( ! empty( $plugins ) ) { |
|
104 | - $keys = array_keys( $plugins ); |
|
105 | - $plugin_file = $plugin_slug . '/' . $keys[0]; |
|
106 | - $url = wp_nonce_url( add_query_arg( array( |
|
102 | + $plugins = get_plugins('/'.$plugin_slug); |
|
103 | + if ( ! empty($plugins)) { |
|
104 | + $keys = array_keys($plugins); |
|
105 | + $plugin_file = $plugin_slug.'/'.$keys[0]; |
|
106 | + $url = wp_nonce_url(add_query_arg(array( |
|
107 | 107 | 'action' => 'activate', |
108 | 108 | 'plugin' => $plugin_file, |
109 | 109 | 'from' => 'import', |
110 | - ), admin_url( 'plugins.php' ) ), 'activate-plugin_' . $plugin_file ); |
|
110 | + ), admin_url('plugins.php')), 'activate-plugin_'.$plugin_file); |
|
111 | 111 | $action = sprintf( |
112 | 112 | '<a href="%s" aria-label="%s">%s</a>', |
113 | - esc_url( $url ), |
|
113 | + esc_url($url), |
|
114 | 114 | /* translators: %s: Importer name */ |
115 | - esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ), |
|
116 | - __( 'Run Importer' ) |
|
115 | + esc_attr(sprintf(__('Run %s'), $data[0])), |
|
116 | + __('Run Importer') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $is_plugin_installed = true; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | - if ( empty( $action ) ) { |
|
124 | - if ( is_main_site() ) { |
|
125 | - $url = wp_nonce_url( add_query_arg( array( |
|
123 | + if (empty($action)) { |
|
124 | + if (is_main_site()) { |
|
125 | + $url = wp_nonce_url(add_query_arg(array( |
|
126 | 126 | 'action' => 'install-plugin', |
127 | 127 | 'plugin' => $plugin_slug, |
128 | 128 | 'from' => 'import', |
129 | - ), self_admin_url( 'update.php' ) ), 'install-plugin_' . $plugin_slug ); |
|
129 | + ), self_admin_url('update.php')), 'install-plugin_'.$plugin_slug); |
|
130 | 130 | $action = sprintf( |
131 | 131 | '<a href="%1$s" class="install-now" data-slug="%2$s" data-name="%3$s" aria-label="%4$s">%5$s</a>', |
132 | - esc_url( $url ), |
|
133 | - esc_attr( $plugin_slug ), |
|
134 | - esc_attr( $data[0] ), |
|
132 | + esc_url($url), |
|
133 | + esc_attr($plugin_slug), |
|
134 | + esc_attr($data[0]), |
|
135 | 135 | /* translators: %s: Importer name */ |
136 | - esc_attr( sprintf( __( 'Install %s' ), $data[0] ) ), |
|
137 | - __( 'Install Now' ) |
|
136 | + esc_attr(sprintf(__('Install %s'), $data[0])), |
|
137 | + __('Install Now') |
|
138 | 138 | ); |
139 | 139 | } else { |
140 | 140 | $action = sprintf( |
141 | 141 | /* translators: URL to wp-admin/import.php */ |
142 | - __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), |
|
143 | - get_admin_url( get_current_network_id(), 'import.php' ) |
|
142 | + __('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'), |
|
143 | + get_admin_url(get_current_network_id(), 'import.php') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | } else { |
148 | - $url = add_query_arg( array( |
|
148 | + $url = add_query_arg(array( |
|
149 | 149 | 'import' => $importer_id, |
150 | - ), self_admin_url( 'admin.php' ) ); |
|
150 | + ), self_admin_url('admin.php')); |
|
151 | 151 | $action = sprintf( |
152 | 152 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
153 | - esc_url( $url ), |
|
153 | + esc_url($url), |
|
154 | 154 | /* translators: %s: Importer name */ |
155 | - esc_attr( sprintf( __( 'Run %s' ), $data[0] ) ), |
|
156 | - __( 'Run Importer' ) |
|
155 | + esc_attr(sprintf(__('Run %s'), $data[0])), |
|
156 | + __('Run Importer') |
|
157 | 157 | ); |
158 | 158 | |
159 | 159 | $is_plugin_installed = true; |
160 | 160 | } |
161 | 161 | |
162 | - if ( ! $is_plugin_installed && is_main_site() ) { |
|
163 | - $url = add_query_arg( array( |
|
162 | + if ( ! $is_plugin_installed && is_main_site()) { |
|
163 | + $url = add_query_arg(array( |
|
164 | 164 | 'tab' => 'plugin-information', |
165 | 165 | 'plugin' => $plugin_slug, |
166 | 166 | 'from' => 'import', |
167 | 167 | 'TB_iframe' => 'true', |
168 | 168 | 'width' => 600, |
169 | 169 | 'height' => 550, |
170 | - ), network_admin_url( 'plugin-install.php' ) ); |
|
170 | + ), network_admin_url('plugin-install.php')); |
|
171 | 171 | $action .= sprintf( |
172 | 172 | ' | <a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>', |
173 | - esc_url( $url ), |
|
173 | + esc_url($url), |
|
174 | 174 | /* translators: %s: Importer name */ |
175 | - esc_attr( sprintf( __( 'More information about %s' ), $data[0] ) ), |
|
176 | - __( 'Details' ) |
|
175 | + esc_attr(sprintf(__('More information about %s'), $data[0])), |
|
176 | + __('Details') |
|
177 | 177 | ); |
178 | 178 | } |
179 | 179 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | <?php |
194 | 194 | } |
195 | 195 | |
196 | -if ( current_user_can('install_plugins') ) |
|
197 | - 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>'; |
|
196 | +if (current_user_can('install_plugins')) |
|
197 | + 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>'; |
|
198 | 198 | ?> |
199 | 199 | |
200 | 200 | </div> |
@@ -203,4 +203,4 @@ discard block |
||
203 | 203 | wp_print_request_filesystem_credentials_modal(); |
204 | 204 | wp_print_admin_notice_templates(); |
205 | 205 | |
206 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
206 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -73,10 +73,12 @@ discard block |
||
73 | 73 | |
74 | 74 | // If a popular importer is not registered, create a dummy registration that links to the plugin installer. |
75 | 75 | foreach ( $popular_importers as $pop_importer => $pop_data ) { |
76 | - if ( isset( $importers[ $pop_importer ] ) ) |
|
77 | - continue; |
|
78 | - if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
|
79 | - continue; |
|
76 | + if ( isset( $importers[ $pop_importer ] ) ) { |
|
77 | + continue; |
|
78 | + } |
|
79 | + if ( isset( $importers[ $pop_data['importer-id'] ] ) ) { |
|
80 | + continue; |
|
81 | + } |
|
80 | 82 | |
81 | 83 | // Fill the array of registered (already installed) importers with data of the popular importers from the WordPress.org API. |
82 | 84 | $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
@@ -193,8 +195,9 @@ discard block |
||
193 | 195 | <?php |
194 | 196 | } |
195 | 197 | |
196 | -if ( current_user_can('install_plugins') ) |
|
198 | +if ( current_user_can('install_plugins') ) { |
|
197 | 199 | 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>'; |
200 | +} |
|
198 | 201 | ?> |
199 | 202 | |
200 | 203 | </div> |
@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( is_multisite() ) { |
|
13 | - if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) { |
|
12 | +if (is_multisite()) { |
|
13 | + if ( ! current_user_can('create_users') && ! current_user_can('promote_users')) { |
|
14 | 14 | wp_die( |
15 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
16 | - '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', |
|
15 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
16 | + '<p>'.__('Sorry, you are not allowed to add users to this network.').'</p>', |
|
17 | 17 | 403 |
18 | 18 | ); |
19 | 19 | } |
20 | -} elseif ( ! current_user_can( 'create_users' ) ) { |
|
20 | +} elseif ( ! current_user_can('create_users')) { |
|
21 | 21 | wp_die( |
22 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
23 | - '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', |
|
22 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
23 | + '<p>'.__('Sorry, you are not allowed to create users.').'</p>', |
|
24 | 24 | 403 |
25 | 25 | ); |
26 | 26 | } |
27 | 27 | |
28 | -if ( is_multisite() ) { |
|
29 | - add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); |
|
28 | +if (is_multisite()) { |
|
29 | + add_filter('wpmu_signup_user_notification_email', 'admin_created_user_email'); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { |
|
33 | - check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
32 | +if (isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action']) { |
|
33 | + check_admin_referer('add-user', '_wpnonce_add-user'); |
|
34 | 34 | |
35 | 35 | $user_details = null; |
36 | - $user_email = wp_unslash( $_REQUEST['email'] ); |
|
37 | - if ( false !== strpos( $user_email, '@' ) ) { |
|
38 | - $user_details = get_user_by( 'email', $user_email ); |
|
36 | + $user_email = wp_unslash($_REQUEST['email']); |
|
37 | + if (false !== strpos($user_email, '@')) { |
|
38 | + $user_details = get_user_by('email', $user_email); |
|
39 | 39 | } else { |
40 | - if ( is_super_admin() ) { |
|
41 | - $user_details = get_user_by( 'login', $user_email ); |
|
40 | + if (is_super_admin()) { |
|
41 | + $user_details = get_user_by('login', $user_email); |
|
42 | 42 | } else { |
43 | - wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ); |
|
43 | + wp_redirect(add_query_arg(array('update' => 'enter_email'), 'user-new.php')); |
|
44 | 44 | die(); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - if ( !$user_details ) { |
|
49 | - wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ); |
|
48 | + if ( ! $user_details) { |
|
49 | + wp_redirect(add_query_arg(array('update' => 'does_not_exist'), 'user-new.php')); |
|
50 | 50 | die(); |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! current_user_can( 'promote_user', $user_details->ID ) ) { |
|
53 | + if ( ! current_user_can('promote_user', $user_details->ID)) { |
|
54 | 54 | wp_die( |
55 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
56 | - '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', |
|
55 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
56 | + '<p>'.__('Sorry, you are not allowed to add users to this network.').'</p>', |
|
57 | 57 | 403 |
58 | 58 | ); |
59 | 59 | } |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | $redirect = 'user-new.php'; |
64 | 64 | $username = $user_details->user_login; |
65 | 65 | $user_id = $user_details->ID; |
66 | - if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { |
|
67 | - $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); |
|
66 | + if (($username != null && ! is_super_admin($user_id)) && (array_key_exists($blog_id, get_blogs_of_user($user_id)))) { |
|
67 | + $redirect = add_query_arg(array('update' => 'addexisting'), 'user-new.php'); |
|
68 | 68 | } else { |
69 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
70 | - add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); |
|
71 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' , 'user_id' => $user_id ), 'user-new.php' ); |
|
69 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
70 | + add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role'])); |
|
71 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $user_id), 'user-new.php'); |
|
72 | 72 | } else { |
73 | - $newuser_key = substr( md5( $user_id ), 0, 5 ); |
|
74 | - add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); |
|
73 | + $newuser_key = substr(md5($user_id), 0, 5); |
|
74 | + add_option('new_user_'.$newuser_key, array('user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST['role'])); |
|
75 | 75 | |
76 | 76 | $roles = get_editable_roles(); |
77 | - $role = $roles[ $_REQUEST['role'] ]; |
|
77 | + $role = $roles[$_REQUEST['role']]; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Fires immediately after a user is invited to join a site, but before the notification is sent. |
@@ -85,52 +85,52 @@ discard block |
||
85 | 85 | * @param array $role The role of invited user. |
86 | 86 | * @param string $newuser_key The key of the invitation. |
87 | 87 | */ |
88 | - do_action( 'invite_user', $user_id, $role, $newuser_key ); |
|
88 | + do_action('invite_user', $user_id, $role, $newuser_key); |
|
89 | 89 | |
90 | 90 | /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ |
91 | - $message = __( 'Hi, |
|
91 | + $message = __('Hi, |
|
92 | 92 | |
93 | 93 | You\'ve been invited to join \'%1$s\' at |
94 | 94 | %2$s with the role of %3$s. |
95 | 95 | |
96 | 96 | Please click the following link to confirm the invite: |
97 | 97 | %4$s' ); |
98 | - wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); |
|
99 | - $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); |
|
98 | + wp_mail($new_user_email, sprintf(__('[%s] Joining confirmation'), wp_specialchars_decode(get_option('blogname'))), sprintf($message, get_option('blogname'), home_url(), wp_specialchars_decode(translate_user_role($role['name'])), home_url("/newbloguser/$newuser_key/"))); |
|
99 | + $redirect = add_query_arg(array('update' => 'add'), 'user-new.php'); |
|
100 | 100 | } |
101 | 101 | } |
102 | - wp_redirect( $redirect ); |
|
102 | + wp_redirect($redirect); |
|
103 | 103 | die(); |
104 | -} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) { |
|
105 | - check_admin_referer( 'create-user', '_wpnonce_create-user' ); |
|
104 | +} elseif (isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action']) { |
|
105 | + check_admin_referer('create-user', '_wpnonce_create-user'); |
|
106 | 106 | |
107 | - if ( ! current_user_can( 'create_users' ) ) { |
|
107 | + if ( ! current_user_can('create_users')) { |
|
108 | 108 | wp_die( |
109 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
110 | - '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', |
|
109 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
110 | + '<p>'.__('Sorry, you are not allowed to create users.').'</p>', |
|
111 | 111 | 403 |
112 | 112 | ); |
113 | 113 | } |
114 | 114 | |
115 | - if ( ! is_multisite() ) { |
|
115 | + if ( ! is_multisite()) { |
|
116 | 116 | $user_id = edit_user(); |
117 | 117 | |
118 | - if ( is_wp_error( $user_id ) ) { |
|
118 | + if (is_wp_error($user_id)) { |
|
119 | 119 | $add_user_errors = $user_id; |
120 | 120 | } else { |
121 | - if ( current_user_can( 'list_users' ) ) |
|
122 | - $redirect = 'users.php?update=add&id=' . $user_id; |
|
121 | + if (current_user_can('list_users')) |
|
122 | + $redirect = 'users.php?update=add&id='.$user_id; |
|
123 | 123 | else |
124 | - $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); |
|
125 | - wp_redirect( $redirect ); |
|
124 | + $redirect = add_query_arg('update', 'add', 'user-new.php'); |
|
125 | + wp_redirect($redirect); |
|
126 | 126 | die(); |
127 | 127 | } |
128 | 128 | } else { |
129 | 129 | // Adding a new user to this site |
130 | - $new_user_email = wp_unslash( $_REQUEST['email'] ); |
|
131 | - $user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email ); |
|
132 | - if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { |
|
133 | - $add_user_errors = $user_details[ 'errors' ]; |
|
130 | + $new_user_email = wp_unslash($_REQUEST['email']); |
|
131 | + $user_details = wpmu_validate_user_signup($_REQUEST['user_login'], $new_user_email); |
|
132 | + if (is_wp_error($user_details['errors']) && ! empty($user_details['errors']->errors)) { |
|
133 | + $add_user_errors = $user_details['errors']; |
|
134 | 134 | } else { |
135 | 135 | /** |
136 | 136 | * Filters the user_login, also known as the username, before it is added to the site. |
@@ -139,24 +139,24 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @param string $user_login The sanitized username. |
141 | 141 | */ |
142 | - $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); |
|
143 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
144 | - add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email |
|
145 | - add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email |
|
142 | + $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true)); |
|
143 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
144 | + add_filter('wpmu_signup_user_notification', '__return_false'); // Disable confirmation email |
|
145 | + add_filter('wpmu_welcome_user_notification', '__return_false'); // Disable welcome email |
|
146 | 146 | } |
147 | - wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'] ) ); |
|
148 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
149 | - $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) ); |
|
150 | - $new_user = wpmu_activate_signup( $key ); |
|
151 | - if ( is_wp_error( $new_user ) ) { |
|
152 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' ); |
|
147 | + wpmu_signup_user($new_user_login, $new_user_email, array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'])); |
|
148 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
149 | + $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email)); |
|
150 | + $new_user = wpmu_activate_signup($key); |
|
151 | + if (is_wp_error($new_user)) { |
|
152 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); |
|
153 | 153 | } else { |
154 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation', 'user_id' => $new_user['user_id'] ), 'user-new.php' ); |
|
154 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $new_user['user_id']), 'user-new.php'); |
|
155 | 155 | } |
156 | 156 | } else { |
157 | - $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' ); |
|
157 | + $redirect = add_query_arg(array('update' => 'newuserconfirmation'), 'user-new.php'); |
|
158 | 158 | } |
159 | - wp_redirect( $redirect ); |
|
159 | + wp_redirect($redirect); |
|
160 | 160 | die(); |
161 | 161 | } |
162 | 162 | } |
@@ -166,49 +166,49 @@ discard block |
||
166 | 166 | $parent_file = 'users.php'; |
167 | 167 | |
168 | 168 | $do_both = false; |
169 | -if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) |
|
169 | +if (is_multisite() && current_user_can('promote_users') && current_user_can('create_users')) |
|
170 | 170 | $do_both = true; |
171 | 171 | |
172 | -$help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>'; |
|
172 | +$help = '<p>'.__('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.').'</p>'; |
|
173 | 173 | |
174 | -if ( is_multisite() ) { |
|
175 | - $help .= '<p>' . __('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user’s name to Edit the user profile under Network Admin > All Users.') . '</p>' . |
|
176 | - '<p>' . __('New users will receive an email letting them know they’ve been added as a user for your site. This email will also contain their password. Check the box if you don’t want the user to receive a welcome email.') . '</p>'; |
|
174 | +if (is_multisite()) { |
|
175 | + $help .= '<p>'.__('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user’s name to Edit the user profile under Network Admin > All Users.').'</p>'. |
|
176 | + '<p>'.__('New users will receive an email letting them know they’ve been added as a user for your site. This email will also contain their password. Check the box if you don’t want the user to receive a welcome email.').'</p>'; |
|
177 | 177 | } else { |
178 | - $help .= '<p>' . __('New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.') . '</p>' . |
|
178 | + $help .= '<p>'.__('New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.').'</p>'. |
|
179 | 179 | |
180 | - '<p>' . __('By default, new users will receive an email letting them know they’ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don’t want to send the new user a welcome email.') . '</p>'; |
|
180 | + '<p>'.__('By default, new users will receive an email letting them know they’ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don’t want to send the new user a welcome email.').'</p>'; |
|
181 | 181 | } |
182 | 182 | |
183 | -$help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>'; |
|
183 | +$help .= '<p>'.__('Remember to click the Add New User button at the bottom of this screen when you are finished.').'</p>'; |
|
184 | 184 | |
185 | -get_current_screen()->add_help_tab( array( |
|
185 | +get_current_screen()->add_help_tab(array( |
|
186 | 186 | 'id' => 'overview', |
187 | 187 | 'title' => __('Overview'), |
188 | 188 | 'content' => $help, |
189 | -) ); |
|
189 | +)); |
|
190 | 190 | |
191 | -get_current_screen()->add_help_tab( array( |
|
191 | +get_current_screen()->add_help_tab(array( |
|
192 | 192 | 'id' => 'user-roles', |
193 | 193 | 'title' => __('User Roles'), |
194 | -'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' . |
|
195 | - '<ul>' . |
|
196 | - '<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' . |
|
197 | - '<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' . |
|
198 | - '<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' . |
|
199 | - '<li>' . __('Editors can publish posts, manage posts as well as manage other people’s posts, etc.') . '</li>' . |
|
200 | - '<li>' . __('Administrators have access to all the administration features.') . '</li>' . |
|
194 | +'content' => '<p>'.__('Here is a basic overview of the different user roles and the permissions associated with each one:').'</p>'. |
|
195 | + '<ul>'. |
|
196 | + '<li>'.__('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.').'</li>'. |
|
197 | + '<li>'.__('Contributors can write and manage their posts but not publish posts or upload media files.').'</li>'. |
|
198 | + '<li>'.__('Authors can publish and manage their own posts, and are able to upload files.').'</li>'. |
|
199 | + '<li>'.__('Editors can publish posts, manage posts as well as manage other people’s posts, etc.').'</li>'. |
|
200 | + '<li>'.__('Administrators have access to all the administration features.').'</li>'. |
|
201 | 201 | '</ul>' |
202 | -) ); |
|
202 | +)); |
|
203 | 203 | |
204 | 204 | get_current_screen()->set_help_sidebar( |
205 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
206 | - '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' . |
|
207 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
205 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
206 | + '<p>'.__('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>').'</p>'. |
|
207 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | wp_enqueue_script('wp-ajax-response'); |
211 | -wp_enqueue_script( 'user-profile' ); |
|
211 | +wp_enqueue_script('user-profile'); |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Filters whether to enable user auto-complete for non-super admins in Multisite. |
@@ -217,26 +217,26 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param bool $enable Whether to enable auto-complete for non-super admins. Default false. |
219 | 219 | */ |
220 | -if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) |
|
221 | - && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) |
|
220 | +if (is_multisite() && current_user_can('promote_users') && ! wp_is_large_network('users') |
|
221 | + && (is_super_admin() || apply_filters('autocomplete_users_for_site_admins', false)) |
|
222 | 222 | ) { |
223 | - wp_enqueue_script( 'user-suggest' ); |
|
223 | + wp_enqueue_script('user-suggest'); |
|
224 | 224 | } |
225 | 225 | |
226 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
226 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
227 | 227 | |
228 | -if ( isset($_GET['update']) ) { |
|
228 | +if (isset($_GET['update'])) { |
|
229 | 229 | $messages = array(); |
230 | - if ( is_multisite() ) { |
|
230 | + if (is_multisite()) { |
|
231 | 231 | $edit_link = ''; |
232 | - if ( ( isset( $_GET['user_id'] ) ) ) { |
|
233 | - $user_id_new = absint( $_GET['user_id'] ); |
|
234 | - if ( $user_id_new ) { |
|
235 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); |
|
232 | + if ((isset($_GET['user_id']))) { |
|
233 | + $user_id_new = absint($_GET['user_id']); |
|
234 | + if ($user_id_new) { |
|
235 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new))); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
239 | - switch ( $_GET['update'] ) { |
|
239 | + switch ($_GET['update']) { |
|
240 | 240 | case "newuserconfirmation": |
241 | 241 | $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); |
242 | 242 | break; |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); |
245 | 245 | break; |
246 | 246 | case "addnoconfirmation": |
247 | - if ( empty( $edit_link ) ) { |
|
248 | - $messages[] = __( 'User has been added to your site.' ); |
|
247 | + if (empty($edit_link)) { |
|
248 | + $messages[] = __('User has been added to your site.'); |
|
249 | 249 | } else { |
250 | 250 | /* translators: %s: edit page url */ |
251 | - $messages[] = sprintf( __( 'User has been added to your site. <a href="%s">Edit user</a>' ), $edit_link ); |
|
251 | + $messages[] = sprintf(__('User has been added to your site. <a href="%s">Edit user</a>'), $edit_link); |
|
252 | 252 | } |
253 | 253 | break; |
254 | 254 | case "addexisting": |
@@ -262,40 +262,40 @@ discard block |
||
262 | 262 | break; |
263 | 263 | } |
264 | 264 | } else { |
265 | - if ( 'add' == $_GET['update'] ) |
|
265 | + if ('add' == $_GET['update']) |
|
266 | 266 | $messages[] = __('User added.'); |
267 | 267 | } |
268 | 268 | } |
269 | 269 | ?> |
270 | 270 | <div class="wrap"> |
271 | 271 | <h1 id="add-new-user"><?php |
272 | -if ( current_user_can( 'create_users' ) ) { |
|
273 | - echo _x( 'Add New User', 'user' ); |
|
274 | -} elseif ( current_user_can( 'promote_users' ) ) { |
|
275 | - echo _x( 'Add Existing User', 'user' ); |
|
272 | +if (current_user_can('create_users')) { |
|
273 | + echo _x('Add New User', 'user'); |
|
274 | +} elseif (current_user_can('promote_users')) { |
|
275 | + echo _x('Add Existing User', 'user'); |
|
276 | 276 | } ?> |
277 | 277 | </h1> |
278 | 278 | |
279 | -<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?> |
|
279 | +<?php if (isset($errors) && is_wp_error($errors)) : ?> |
|
280 | 280 | <div class="error"> |
281 | 281 | <ul> |
282 | 282 | <?php |
283 | - foreach ( $errors->get_error_messages() as $err ) |
|
283 | + foreach ($errors->get_error_messages() as $err) |
|
284 | 284 | echo "<li>$err</li>\n"; |
285 | 285 | ?> |
286 | 286 | </ul> |
287 | 287 | </div> |
288 | 288 | <?php endif; |
289 | 289 | |
290 | -if ( ! empty( $messages ) ) { |
|
291 | - foreach ( $messages as $msg ) |
|
292 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
290 | +if ( ! empty($messages)) { |
|
291 | + foreach ($messages as $msg) |
|
292 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
293 | 293 | } ?> |
294 | 294 | |
295 | -<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?> |
|
295 | +<?php if (isset($add_user_errors) && is_wp_error($add_user_errors)) : ?> |
|
296 | 296 | <div class="error"> |
297 | 297 | <?php |
298 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
298 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
299 | 299 | echo "<p>$message</p>"; |
300 | 300 | ?> |
301 | 301 | </div> |
@@ -303,15 +303,15 @@ discard block |
||
303 | 303 | <div id="ajax-response"></div> |
304 | 304 | |
305 | 305 | <?php |
306 | -if ( is_multisite() ) { |
|
307 | - if ( $do_both ) |
|
308 | - echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>'; |
|
309 | - if ( !is_super_admin() ) { |
|
310 | - echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; |
|
306 | +if (is_multisite()) { |
|
307 | + if ($do_both) |
|
308 | + echo '<h2 id="add-existing-user">'.__('Add Existing User').'</h2>'; |
|
309 | + if ( ! is_super_admin()) { |
|
310 | + echo '<p>'.__('Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>'; |
|
311 | 311 | $label = __('Email'); |
312 | 312 | $type = 'email'; |
313 | 313 | } else { |
314 | - echo '<p>' . __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; |
|
314 | + echo '<p>'.__('Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>'; |
|
315 | 315 | $label = __('Email or Username'); |
316 | 316 | $type = 'text'; |
317 | 317 | } |
@@ -322,10 +322,10 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @since 3.0.0 |
324 | 324 | */ |
325 | - do_action( 'user_new_form_tag' ); |
|
325 | + do_action('user_new_form_tag'); |
|
326 | 326 | ?>> |
327 | 327 | <input name="action" type="hidden" value="adduser" /> |
328 | -<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
|
328 | +<?php wp_nonce_field('add-user', '_wpnonce_add-user') ?> |
|
329 | 329 | |
330 | 330 | <table class="form-table"> |
331 | 331 | <tr class="form-field form-required"> |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | <tr class="form-field"> |
336 | 336 | <th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th> |
337 | 337 | <td><select name="role" id="adduser-role"> |
338 | - <?php wp_dropdown_roles( get_option('default_role') ); ?> |
|
338 | + <?php wp_dropdown_roles(get_option('default_role')); ?> |
|
339 | 339 | </select> |
340 | 340 | </td> |
341 | 341 | </tr> |
342 | -<?php if ( current_user_can( 'manage_network_users' ) ) { ?> |
|
342 | +<?php if (current_user_can('manage_network_users')) { ?> |
|
343 | 343 | <tr> |
344 | 344 | <th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> |
345 | - <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td> |
|
345 | + <td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e('Add the user without sending an email that requires their confirmation.'); ?></label></td> |
|
346 | 346 | </tr> |
347 | 347 | <?php } ?> |
348 | 348 | </table> |
@@ -358,48 +358,48 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @param string $type A contextual string specifying which type of new user form the hook follows. |
360 | 360 | */ |
361 | -do_action( 'user_new_form', 'add-existing-user' ); |
|
361 | +do_action('user_new_form', 'add-existing-user'); |
|
362 | 362 | ?> |
363 | -<?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?> |
|
363 | +<?php submit_button(__('Add Existing User'), 'primary', 'adduser', true, array('id' => 'addusersub')); ?> |
|
364 | 364 | </form> |
365 | 365 | <?php |
366 | 366 | } // is_multisite() |
367 | 367 | |
368 | -if ( current_user_can( 'create_users') ) { |
|
369 | - if ( $do_both ) |
|
370 | - echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>'; |
|
368 | +if (current_user_can('create_users')) { |
|
369 | + if ($do_both) |
|
370 | + echo '<h2 id="create-new-user">'.__('Add New User').'</h2>'; |
|
371 | 371 | ?> |
372 | 372 | <p><?php _e('Create a brand new user and add them to this site.'); ?></p> |
373 | 373 | <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php |
374 | 374 | /** This action is documented in wp-admin/user-new.php */ |
375 | - do_action( 'user_new_form_tag' ); |
|
375 | + do_action('user_new_form_tag'); |
|
376 | 376 | ?>> |
377 | 377 | <input name="action" type="hidden" value="createuser" /> |
378 | -<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> |
|
378 | +<?php wp_nonce_field('create-user', '_wpnonce_create-user'); ?> |
|
379 | 379 | <?php |
380 | 380 | // Load up the passed data, else set to a default. |
381 | -$creating = isset( $_POST['createuser'] ); |
|
381 | +$creating = isset($_POST['createuser']); |
|
382 | 382 | |
383 | -$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : ''; |
|
384 | -$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : ''; |
|
385 | -$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : ''; |
|
386 | -$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : ''; |
|
387 | -$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : ''; |
|
388 | -$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : ''; |
|
389 | -$new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true; |
|
390 | -$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : ''; |
|
383 | +$new_user_login = $creating && isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; |
|
384 | +$new_user_firstname = $creating && isset($_POST['first_name']) ? wp_unslash($_POST['first_name']) : ''; |
|
385 | +$new_user_lastname = $creating && isset($_POST['last_name']) ? wp_unslash($_POST['last_name']) : ''; |
|
386 | +$new_user_email = $creating && isset($_POST['email']) ? wp_unslash($_POST['email']) : ''; |
|
387 | +$new_user_uri = $creating && isset($_POST['url']) ? wp_unslash($_POST['url']) : ''; |
|
388 | +$new_user_role = $creating && isset($_POST['role']) ? wp_unslash($_POST['role']) : ''; |
|
389 | +$new_user_send_notification = $creating && ! isset($_POST['send_user_notification']) ? false : true; |
|
390 | +$new_user_ignore_pass = $creating && isset($_POST['noconfirmation']) ? wp_unslash($_POST['noconfirmation']) : ''; |
|
391 | 391 | |
392 | 392 | ?> |
393 | 393 | <table class="form-table"> |
394 | 394 | <tr class="form-field form-required"> |
395 | 395 | <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
396 | - <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
|
396 | + <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
|
397 | 397 | </tr> |
398 | 398 | <tr class="form-field form-required"> |
399 | 399 | <th scope="row"><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
400 | - <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td> |
|
400 | + <td><input name="email" type="email" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td> |
|
401 | 401 | </tr> |
402 | -<?php if ( !is_multisite() ) { ?> |
|
402 | +<?php if ( ! is_multisite()) { ?> |
|
403 | 403 | <tr class="form-field"> |
404 | 404 | <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th> |
405 | 405 | <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td> |
@@ -410,82 +410,82 @@ discard block |
||
410 | 410 | </tr> |
411 | 411 | <tr class="form-field"> |
412 | 412 | <th scope="row"><label for="url"><?php _e('Website') ?></label></th> |
413 | - <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td> |
|
413 | + <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td> |
|
414 | 414 | </tr> |
415 | 415 | <tr class="form-field form-required user-pass1-wrap"> |
416 | 416 | <th scope="row"> |
417 | 417 | <label for="pass1"> |
418 | - <?php _e( 'Password' ); ?> |
|
419 | - <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> |
|
418 | + <?php _e('Password'); ?> |
|
419 | + <span class="description hide-if-js"><?php _e('(required)'); ?></span> |
|
420 | 420 | </label> |
421 | 421 | </th> |
422 | 422 | <td> |
423 | 423 | <input class="hidden" value=" " /><!-- #24364 workaround --> |
424 | - <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button> |
|
424 | + <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e('Show password'); ?></button> |
|
425 | 425 | <div class="wp-pwd hide-if-js"> |
426 | - <?php $initial_password = wp_generate_password( 24 ); ?> |
|
426 | + <?php $initial_password = wp_generate_password(24); ?> |
|
427 | 427 | <span class="password-input-wrapper"> |
428 | - <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
|
428 | + <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr($initial_password); ?>" aria-describedby="pass-strength-result" /> |
|
429 | 429 | </span> |
430 | - <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
|
430 | + <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Hide password'); ?>"> |
|
431 | 431 | <span class="dashicons dashicons-hidden"></span> |
432 | - <span class="text"><?php _e( 'Hide' ); ?></span> |
|
432 | + <span class="text"><?php _e('Hide'); ?></span> |
|
433 | 433 | </button> |
434 | - <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> |
|
435 | - <span class="text"><?php _e( 'Cancel' ); ?></span> |
|
434 | + <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Cancel password change'); ?>"> |
|
435 | + <span class="text"><?php _e('Cancel'); ?></span> |
|
436 | 436 | </button> |
437 | 437 | <div style="display:none" id="pass-strength-result" aria-live="polite"></div> |
438 | 438 | </div> |
439 | 439 | </td> |
440 | 440 | </tr> |
441 | 441 | <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
442 | - <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
|
442 | + <th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
|
443 | 443 | <td> |
444 | 444 | <input name="pass2" type="password" id="pass2" autocomplete="off" /> |
445 | 445 | </td> |
446 | 446 | </tr> |
447 | 447 | <tr class="pw-weak"> |
448 | - <th><?php _e( 'Confirm Password' ); ?></th> |
|
448 | + <th><?php _e('Confirm Password'); ?></th> |
|
449 | 449 | <td> |
450 | 450 | <label> |
451 | 451 | <input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
452 | - <?php _e( 'Confirm use of weak password' ); ?> |
|
452 | + <?php _e('Confirm use of weak password'); ?> |
|
453 | 453 | </label> |
454 | 454 | </td> |
455 | 455 | </tr> |
456 | 456 | <tr> |
457 | - <th scope="row"><?php _e( 'Send User Notification' ) ?></th> |
|
458 | - <td><label for="send_user_notification"><input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> /> <?php _e( 'Send the new user an email about their account.' ); ?></label></td> |
|
457 | + <th scope="row"><?php _e('Send User Notification') ?></th> |
|
458 | + <td><label for="send_user_notification"><input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked($new_user_send_notification); ?> /> <?php _e('Send the new user an email about their account.'); ?></label></td> |
|
459 | 459 | </tr> |
460 | 460 | <?php } // !is_multisite ?> |
461 | 461 | <tr class="form-field"> |
462 | 462 | <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> |
463 | 463 | <td><select name="role" id="role"> |
464 | 464 | <?php |
465 | - if ( !$new_user_role ) |
|
466 | - $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); |
|
465 | + if ( ! $new_user_role) |
|
466 | + $new_user_role = ! empty($current_role) ? $current_role : get_option('default_role'); |
|
467 | 467 | wp_dropdown_roles($new_user_role); |
468 | 468 | ?> |
469 | 469 | </select> |
470 | 470 | </td> |
471 | 471 | </tr> |
472 | - <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?> |
|
472 | + <?php if (is_multisite() && current_user_can('manage_network_users')) { ?> |
|
473 | 473 | <tr> |
474 | 474 | <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th> |
475 | - <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td> |
|
475 | + <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked($new_user_ignore_pass); ?> /> <?php _e('Add the user without sending an email that requires their confirmation.'); ?></label></td> |
|
476 | 476 | </tr> |
477 | 477 | <?php } ?> |
478 | 478 | </table> |
479 | 479 | |
480 | 480 | <?php |
481 | 481 | /** This action is documented in wp-admin/user-new.php */ |
482 | -do_action( 'user_new_form', 'add-new-user' ); |
|
482 | +do_action('user_new_form', 'add-new-user'); |
|
483 | 483 | ?> |
484 | 484 | |
485 | -<?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?> |
|
485 | +<?php submit_button(__('Add New User'), 'primary', 'createuser', true, array('id' => 'createusersub')); ?> |
|
486 | 486 | |
487 | 487 | </form> |
488 | 488 | <?php } // current_user_can('create_users') ?> |
489 | 489 | </div> |
490 | 490 | <?php |
491 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
491 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | /** WordPress Administration Bootstrap */ |
19 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
19 | +require_once(dirname(__FILE__).'/admin.php'); |
|
20 | 20 | |
21 | 21 | $title = __('Settings'); |
22 | 22 | $this_file = 'options.php'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $capability = 'manage_options'; |
28 | 28 | |
29 | 29 | // This is for back compat and will eventually be removed. |
30 | -if ( empty($option_page) ) { |
|
30 | +if (empty($option_page)) { |
|
31 | 31 | $option_page = 'options'; |
32 | 32 | } else { |
33 | 33 | |
@@ -41,70 +41,70 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param string $capability The capability used for the page, which is manage_options by default. |
43 | 43 | */ |
44 | - $capability = apply_filters( "option_page_capability_{$option_page}", $capability ); |
|
44 | + $capability = apply_filters("option_page_capability_{$option_page}", $capability); |
|
45 | 45 | } |
46 | 46 | |
47 | -if ( ! current_user_can( $capability ) ) { |
|
47 | +if ( ! current_user_can($capability)) { |
|
48 | 48 | wp_die( |
49 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
50 | - '<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>', |
|
49 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
50 | + '<p>'.__('Sorry, you are not allowed to manage these items.').'</p>', |
|
51 | 51 | 403 |
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Handle admin email change requests |
56 | -if ( is_multisite() ) { |
|
57 | - if ( ! empty($_GET[ 'adminhash' ] ) ) { |
|
58 | - $new_admin_details = get_option( 'adminhash' ); |
|
56 | +if (is_multisite()) { |
|
57 | + if ( ! empty($_GET['adminhash'])) { |
|
58 | + $new_admin_details = get_option('adminhash'); |
|
59 | 59 | $redirect = 'options-general.php?updated=false'; |
60 | - if ( is_array( $new_admin_details ) && hash_equals( $new_admin_details[ 'hash' ], $_GET[ 'adminhash' ] ) && !empty($new_admin_details[ 'newemail' ]) ) { |
|
61 | - update_option( 'admin_email', $new_admin_details[ 'newemail' ] ); |
|
62 | - delete_option( 'adminhash' ); |
|
63 | - delete_option( 'new_admin_email' ); |
|
60 | + if (is_array($new_admin_details) && hash_equals($new_admin_details['hash'], $_GET['adminhash']) && ! empty($new_admin_details['newemail'])) { |
|
61 | + update_option('admin_email', $new_admin_details['newemail']); |
|
62 | + delete_option('adminhash'); |
|
63 | + delete_option('new_admin_email'); |
|
64 | 64 | $redirect = 'options-general.php?updated=true'; |
65 | 65 | } |
66 | - wp_redirect( admin_url( $redirect ) ); |
|
66 | + wp_redirect(admin_url($redirect)); |
|
67 | 67 | exit; |
68 | - } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) { |
|
69 | - check_admin_referer( 'dismiss-' . get_current_blog_id() . '-new_admin_email' ); |
|
70 | - delete_option( 'adminhash' ); |
|
71 | - delete_option( 'new_admin_email' ); |
|
72 | - wp_redirect( admin_url( 'options-general.php?updated=true' ) ); |
|
68 | + } elseif ( ! empty($_GET['dismiss']) && 'new_admin_email' == $_GET['dismiss']) { |
|
69 | + check_admin_referer('dismiss-'.get_current_blog_id().'-new_admin_email'); |
|
70 | + delete_option('adminhash'); |
|
71 | + delete_option('new_admin_email'); |
|
72 | + wp_redirect(admin_url('options-general.php?updated=true')); |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | -if ( is_multisite() && ! is_super_admin() && 'update' != $action ) { |
|
77 | +if (is_multisite() && ! is_super_admin() && 'update' != $action) { |
|
78 | 78 | wp_die( |
79 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
80 | - '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
79 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
80 | + '<p>'.__('Sorry, you are not allowed to delete these items.').'</p>', |
|
81 | 81 | 403 |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | |
85 | 85 | $whitelist_options = array( |
86 | - 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ), |
|
87 | - 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), |
|
88 | - 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), |
|
89 | - 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ), |
|
90 | - 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' ) |
|
86 | + 'general' => array('blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG'), |
|
87 | + 'discussion' => array('default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration'), |
|
88 | + 'media' => array('thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type'), |
|
89 | + 'reading' => array('posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public'), |
|
90 | + 'writing' => array('default_category', 'default_email_category', 'default_link_category', 'default_post_format') |
|
91 | 91 | ); |
92 | 92 | $whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array(); |
93 | 93 | |
94 | 94 | $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); |
95 | 95 | |
96 | -if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) |
|
96 | +if ( ! in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8'))) |
|
97 | 97 | $whitelist_options['reading'][] = 'blog_charset'; |
98 | 98 | |
99 | -if ( get_site_option( 'initial_db_version' ) < 32453 ) { |
|
99 | +if (get_site_option('initial_db_version') < 32453) { |
|
100 | 100 | $whitelist_options['writing'][] = 'use_smilies'; |
101 | 101 | $whitelist_options['writing'][] = 'use_balanceTags'; |
102 | 102 | } |
103 | 103 | |
104 | -if ( !is_multisite() ) { |
|
105 | - if ( !defined( 'WP_SITEURL' ) ) |
|
104 | +if ( ! is_multisite()) { |
|
105 | + if ( ! defined('WP_SITEURL')) |
|
106 | 106 | $whitelist_options['general'][] = 'siteurl'; |
107 | - if ( !defined( 'WP_HOME' ) ) |
|
107 | + if ( ! defined('WP_HOME')) |
|
108 | 108 | $whitelist_options['general'][] = 'home'; |
109 | 109 | |
110 | 110 | $whitelist_options['general'][] = 'admin_email'; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $whitelist_options['media'][] = 'uploads_use_yearmonth_folders'; |
118 | 118 | |
119 | 119 | // If upload_url_path and upload_path are both default values, they're locked. |
120 | - if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) { |
|
120 | + if (get_option('upload_url_path') || (get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path'))) { |
|
121 | 121 | $whitelist_options['media'][] = 'upload_path'; |
122 | 122 | $whitelist_options['media'][] = 'upload_url_path'; |
123 | 123 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param bool $enabled Whether post-by-email configuration is enabled. Default true. |
133 | 133 | */ |
134 | - if ( apply_filters( 'enable_post_by_email_configuration', true ) ) |
|
134 | + if (apply_filters('enable_post_by_email_configuration', true)) |
|
135 | 135 | $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); |
136 | 136 | } |
137 | 137 | |
@@ -142,86 +142,86 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param array White list options. |
144 | 144 | */ |
145 | -$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); |
|
145 | +$whitelist_options = apply_filters('whitelist_options', $whitelist_options); |
|
146 | 146 | |
147 | 147 | /* |
148 | 148 | * If $_GET['action'] == 'update' we are saving settings sent from a settings page |
149 | 149 | */ |
150 | -if ( 'update' == $action ) { |
|
151 | - if ( 'options' == $option_page && !isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed. |
|
150 | +if ('update' == $action) { |
|
151 | + if ('options' == $option_page && ! isset($_POST['option_page'])) { // This is for back compat and will eventually be removed. |
|
152 | 152 | $unregistered = true; |
153 | - check_admin_referer( 'update-options' ); |
|
153 | + check_admin_referer('update-options'); |
|
154 | 154 | } else { |
155 | 155 | $unregistered = false; |
156 | - check_admin_referer( $option_page . '-options' ); |
|
156 | + check_admin_referer($option_page.'-options'); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( !isset( $whitelist_options[ $option_page ] ) ) |
|
160 | - wp_die( __( '<strong>ERROR</strong>: options page not found.' ) ); |
|
159 | + if ( ! isset($whitelist_options[$option_page])) |
|
160 | + wp_die(__('<strong>ERROR</strong>: options page not found.')); |
|
161 | 161 | |
162 | - if ( 'options' == $option_page ) { |
|
163 | - if ( is_multisite() && ! is_super_admin() ) |
|
164 | - wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); |
|
165 | - $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) ); |
|
162 | + if ('options' == $option_page) { |
|
163 | + if (is_multisite() && ! is_super_admin()) |
|
164 | + wp_die(__('Sorry, you are not allowed to modify unregistered settings for this site.')); |
|
165 | + $options = explode(',', wp_unslash($_POST['page_options'])); |
|
166 | 166 | } else { |
167 | - $options = $whitelist_options[ $option_page ]; |
|
167 | + $options = $whitelist_options[$option_page]; |
|
168 | 168 | } |
169 | 169 | |
170 | - if ( 'general' == $option_page ) { |
|
170 | + if ('general' == $option_page) { |
|
171 | 171 | // Handle custom date/time formats. |
172 | - if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) |
|
172 | + if ( ! empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash($_POST['date_format'])) |
|
173 | 173 | $_POST['date_format'] = $_POST['date_format_custom']; |
174 | - if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) |
|
174 | + if ( ! empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash($_POST['time_format'])) |
|
175 | 175 | $_POST['time_format'] = $_POST['time_format_custom']; |
176 | 176 | // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. |
177 | - if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { |
|
177 | + if ( ! empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string'])) { |
|
178 | 178 | $_POST['gmt_offset'] = $_POST['timezone_string']; |
179 | 179 | $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); |
180 | 180 | $_POST['timezone_string'] = ''; |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Handle translation install. |
184 | - if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin() ) ) { // @todo: Skip if already installed |
|
185 | - require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
184 | + if ( ! empty($_POST['WPLANG']) && ( ! is_multisite() || is_super_admin())) { // @todo: Skip if already installed |
|
185 | + require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
186 | 186 | |
187 | - if ( wp_can_install_language_pack() ) { |
|
188 | - $language = wp_download_language_pack( $_POST['WPLANG'] ); |
|
189 | - if ( $language ) { |
|
187 | + if (wp_can_install_language_pack()) { |
|
188 | + $language = wp_download_language_pack($_POST['WPLANG']); |
|
189 | + if ($language) { |
|
190 | 190 | $_POST['WPLANG'] = $language; |
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | - if ( $options ) { |
|
197 | - foreach ( $options as $option ) { |
|
198 | - if ( $unregistered ) { |
|
199 | - _deprecated_argument( 'options.php', '2.7.0', |
|
196 | + if ($options) { |
|
197 | + foreach ($options as $option) { |
|
198 | + if ($unregistered) { |
|
199 | + _deprecated_argument('options.php', '2.7.0', |
|
200 | 200 | sprintf( |
201 | 201 | /* translators: %s: the option/setting */ |
202 | - __( 'The %s setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ), |
|
203 | - '<code>' . $option . '</code>' |
|
202 | + __('The %s setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API'), |
|
203 | + '<code>'.$option.'</code>' |
|
204 | 204 | ) |
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
208 | - $option = trim( $option ); |
|
208 | + $option = trim($option); |
|
209 | 209 | $value = null; |
210 | - if ( isset( $_POST[ $option ] ) ) { |
|
211 | - $value = $_POST[ $option ]; |
|
212 | - if ( ! is_array( $value ) ) |
|
213 | - $value = trim( $value ); |
|
214 | - $value = wp_unslash( $value ); |
|
210 | + if (isset($_POST[$option])) { |
|
211 | + $value = $_POST[$option]; |
|
212 | + if ( ! is_array($value)) |
|
213 | + $value = trim($value); |
|
214 | + $value = wp_unslash($value); |
|
215 | 215 | } |
216 | - update_option( $option, $value ); |
|
216 | + update_option($option, $value); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | // Switch translation in case WPLANG was changed. |
220 | - $language = get_option( 'WPLANG' ); |
|
221 | - if ( $language ) { |
|
222 | - load_default_textdomain( $language ); |
|
220 | + $language = get_option('WPLANG'); |
|
221 | + if ($language) { |
|
222 | + load_default_textdomain($language); |
|
223 | 223 | } else { |
224 | - unload_textdomain( 'default' ); |
|
224 | + unload_textdomain('default'); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
@@ -229,38 +229,38 @@ discard block |
||
229 | 229 | * Handle settings errors and return to options page |
230 | 230 | */ |
231 | 231 | // If no settings errors were registered add a general 'updated' message. |
232 | - if ( !count( get_settings_errors() ) ) |
|
232 | + if ( ! count(get_settings_errors())) |
|
233 | 233 | add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); |
234 | 234 | set_transient('settings_errors', get_settings_errors(), 30); |
235 | 235 | |
236 | 236 | /** |
237 | 237 | * Redirect back to the settings page that was submitted |
238 | 238 | */ |
239 | - $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() ); |
|
240 | - wp_redirect( $goback ); |
|
239 | + $goback = add_query_arg('settings-updated', 'true', wp_get_referer()); |
|
240 | + wp_redirect($goback); |
|
241 | 241 | exit; |
242 | 242 | } |
243 | 243 | |
244 | -include( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
244 | +include(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
245 | 245 | |
246 | 246 | <div class="wrap"> |
247 | - <h1><?php esc_html_e( 'All Settings' ); ?></h1> |
|
247 | + <h1><?php esc_html_e('All Settings'); ?></h1> |
|
248 | 248 | <form name="form" action="options.php" method="post" id="all-options"> |
249 | 249 | <?php wp_nonce_field('options-options') ?> |
250 | 250 | <input type="hidden" name="action" value="update" /> |
251 | 251 | <input type="hidden" name="option_page" value="options" /> |
252 | 252 | <table class="form-table"> |
253 | 253 | <?php |
254 | -$options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" ); |
|
254 | +$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name"); |
|
255 | 255 | |
256 | -foreach ( (array) $options as $option ) : |
|
256 | +foreach ((array) $options as $option) : |
|
257 | 257 | $disabled = false; |
258 | - if ( $option->option_name == '' ) |
|
258 | + if ($option->option_name == '') |
|
259 | 259 | continue; |
260 | - if ( is_serialized( $option->option_value ) ) { |
|
261 | - if ( is_serialized_string( $option->option_value ) ) { |
|
260 | + if (is_serialized($option->option_value)) { |
|
261 | + if (is_serialized_string($option->option_value)) { |
|
262 | 262 | // This is a serialized string, so we should display it. |
263 | - $value = maybe_unserialize( $option->option_value ); |
|
263 | + $value = maybe_unserialize($option->option_value); |
|
264 | 264 | $options_to_update[] = $option->option_name; |
265 | 265 | $class = 'all-options'; |
266 | 266 | } else { |
@@ -273,28 +273,28 @@ discard block |
||
273 | 273 | $options_to_update[] = $option->option_name; |
274 | 274 | $class = 'all-options'; |
275 | 275 | } |
276 | - $name = esc_attr( $option->option_name ); |
|
276 | + $name = esc_attr($option->option_name); |
|
277 | 277 | ?> |
278 | 278 | <tr> |
279 | - <th scope="row"><label for="<?php echo $name ?>"><?php echo esc_html( $option->option_name ); ?></label></th> |
|
279 | + <th scope="row"><label for="<?php echo $name ?>"><?php echo esc_html($option->option_name); ?></label></th> |
|
280 | 280 | <td> |
281 | -<?php if ( strpos( $value, "\n" ) !== false ) : ?> |
|
281 | +<?php if (strpos($value, "\n") !== false) : ?> |
|
282 | 282 | <textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php |
283 | - echo esc_textarea( $value ); |
|
283 | + echo esc_textarea($value); |
|
284 | 284 | ?></textarea> |
285 | 285 | <?php else: ?> |
286 | - <input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> /> |
|
286 | + <input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr($value) ?>"<?php disabled($disabled, true) ?> /> |
|
287 | 287 | <?php endif ?></td> |
288 | 288 | </tr> |
289 | 289 | <?php endforeach; ?> |
290 | 290 | </table> |
291 | 291 | |
292 | -<input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" /> |
|
292 | +<input type="hidden" name="page_options" value="<?php echo esc_attr(implode(',', $options_to_update)); ?>" /> |
|
293 | 293 | |
294 | -<?php submit_button( __( 'Save Changes' ), 'primary', 'Update' ); ?> |
|
294 | +<?php submit_button(__('Save Changes'), 'primary', 'Update'); ?> |
|
295 | 295 | |
296 | 296 | </form> |
297 | 297 | </div> |
298 | 298 | |
299 | 299 | <?php |
300 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
300 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -93,8 +93,9 @@ discard block |
||
93 | 93 | |
94 | 94 | $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass'); |
95 | 95 | |
96 | -if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) |
|
96 | +if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) { |
|
97 | 97 | $whitelist_options['reading'][] = 'blog_charset'; |
98 | +} |
|
98 | 99 | |
99 | 100 | if ( get_site_option( 'initial_db_version' ) < 32453 ) { |
100 | 101 | $whitelist_options['writing'][] = 'use_smilies'; |
@@ -102,10 +103,12 @@ discard block |
||
102 | 103 | } |
103 | 104 | |
104 | 105 | if ( !is_multisite() ) { |
105 | - if ( !defined( 'WP_SITEURL' ) ) |
|
106 | - $whitelist_options['general'][] = 'siteurl'; |
|
107 | - if ( !defined( 'WP_HOME' ) ) |
|
108 | - $whitelist_options['general'][] = 'home'; |
|
106 | + if ( !defined( 'WP_SITEURL' ) ) { |
|
107 | + $whitelist_options['general'][] = 'siteurl'; |
|
108 | + } |
|
109 | + if ( !defined( 'WP_HOME' ) ) { |
|
110 | + $whitelist_options['general'][] = 'home'; |
|
111 | + } |
|
109 | 112 | |
110 | 113 | $whitelist_options['general'][] = 'admin_email'; |
111 | 114 | $whitelist_options['general'][] = 'users_can_register'; |
@@ -131,9 +134,10 @@ discard block |
||
131 | 134 | * |
132 | 135 | * @param bool $enabled Whether post-by-email configuration is enabled. Default true. |
133 | 136 | */ |
134 | - if ( apply_filters( 'enable_post_by_email_configuration', true ) ) |
|
135 | - $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); |
|
136 | -} |
|
137 | + if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { |
|
138 | + $whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options); |
|
139 | + } |
|
140 | + } |
|
137 | 141 | |
138 | 142 | /** |
139 | 143 | * Filters the options white list. |
@@ -156,12 +160,14 @@ discard block |
||
156 | 160 | check_admin_referer( $option_page . '-options' ); |
157 | 161 | } |
158 | 162 | |
159 | - if ( !isset( $whitelist_options[ $option_page ] ) ) |
|
160 | - wp_die( __( '<strong>ERROR</strong>: options page not found.' ) ); |
|
163 | + if ( !isset( $whitelist_options[ $option_page ] ) ) { |
|
164 | + wp_die( __( '<strong>ERROR</strong>: options page not found.' ) ); |
|
165 | + } |
|
161 | 166 | |
162 | 167 | if ( 'options' == $option_page ) { |
163 | - if ( is_multisite() && ! is_super_admin() ) |
|
164 | - wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); |
|
168 | + if ( is_multisite() && ! is_super_admin() ) { |
|
169 | + wp_die( __( 'Sorry, you are not allowed to modify unregistered settings for this site.' ) ); |
|
170 | + } |
|
165 | 171 | $options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) ); |
166 | 172 | } else { |
167 | 173 | $options = $whitelist_options[ $option_page ]; |
@@ -169,10 +175,12 @@ discard block |
||
169 | 175 | |
170 | 176 | if ( 'general' == $option_page ) { |
171 | 177 | // Handle custom date/time formats. |
172 | - if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) |
|
173 | - $_POST['date_format'] = $_POST['date_format_custom']; |
|
174 | - if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) |
|
175 | - $_POST['time_format'] = $_POST['time_format_custom']; |
|
178 | + if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) { |
|
179 | + $_POST['date_format'] = $_POST['date_format_custom']; |
|
180 | + } |
|
181 | + if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) { |
|
182 | + $_POST['time_format'] = $_POST['time_format_custom']; |
|
183 | + } |
|
176 | 184 | // Map UTC+- timezones to gmt_offsets and set timezone_string to empty. |
177 | 185 | if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) { |
178 | 186 | $_POST['gmt_offset'] = $_POST['timezone_string']; |
@@ -209,8 +217,9 @@ discard block |
||
209 | 217 | $value = null; |
210 | 218 | if ( isset( $_POST[ $option ] ) ) { |
211 | 219 | $value = $_POST[ $option ]; |
212 | - if ( ! is_array( $value ) ) |
|
213 | - $value = trim( $value ); |
|
220 | + if ( ! is_array( $value ) ) { |
|
221 | + $value = trim( $value ); |
|
222 | + } |
|
214 | 223 | $value = wp_unslash( $value ); |
215 | 224 | } |
216 | 225 | update_option( $option, $value ); |
@@ -229,8 +238,9 @@ discard block |
||
229 | 238 | * Handle settings errors and return to options page |
230 | 239 | */ |
231 | 240 | // If no settings errors were registered add a general 'updated' message. |
232 | - if ( !count( get_settings_errors() ) ) |
|
233 | - add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); |
|
241 | + if ( !count( get_settings_errors() ) ) { |
|
242 | + add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); |
|
243 | + } |
|
234 | 244 | set_transient('settings_errors', get_settings_errors(), 30); |
235 | 245 | |
236 | 246 | /** |
@@ -255,8 +265,9 @@ discard block |
||
255 | 265 | |
256 | 266 | foreach ( (array) $options as $option ) : |
257 | 267 | $disabled = false; |
258 | - if ( $option->option_name == '' ) |
|
259 | - continue; |
|
268 | + if ( $option->option_name == '' ) { |
|
269 | + continue; |
|
270 | + } |
|
260 | 271 | if ( is_serialized( $option->option_value ) ) { |
261 | 272 | if ( is_serialized_string( $option->option_value ) ) { |
262 | 273 | // This is a serialized string, so we should display it. |
@@ -282,11 +293,14 @@ discard block |
||
282 | 293 | <textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php |
283 | 294 | echo esc_textarea( $value ); |
284 | 295 | ?></textarea> |
285 | - <?php else: ?> |
|
296 | + <?php else { |
|
297 | + : ?> |
|
286 | 298 | <input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> /> |
287 | 299 | <?php endif ?></td> |
288 | 300 | </tr> |
289 | -<?php endforeach; ?> |
|
301 | +<?php endforeach; |
|
302 | +} |
|
303 | +?> |
|
290 | 304 | </table> |
291 | 305 | |
292 | 306 | <input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" /> |
@@ -8,82 +8,82 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can('manage_sites') ) |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | 17 | wp_die(__('Sorry, you are not allowed to edit this site.')); |
18 | 18 | |
19 | 19 | $wp_list_table = _get_list_table('WP_Users_List_Table'); |
20 | 20 | $wp_list_table->prepare_items(); |
21 | 21 | |
22 | -get_current_screen()->add_help_tab( array( |
|
22 | +get_current_screen()->add_help_tab(array( |
|
23 | 23 | 'id' => 'overview', |
24 | 24 | 'title' => __('Overview'), |
25 | 25 | 'content' => |
26 | - '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . |
|
27 | - '<p>' . __('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . |
|
28 | - '<p>' . __('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . |
|
29 | - '<p>' . sprintf( __('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . |
|
30 | - '<p>' . __('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' |
|
31 | -) ); |
|
26 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
27 | + '<p>'.__('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
28 | + '<p>'.__('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.').'</p>'. |
|
29 | + '<p>'.sprintf(__('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.'), network_admin_url('themes.php')).'</p>'. |
|
30 | + '<p>'.__('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.').'</p>' |
|
31 | +)); |
|
32 | 32 | |
33 | 33 | get_current_screen()->set_help_sidebar( |
34 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
35 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
36 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
34 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
35 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
36 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
37 | 37 | ); |
38 | 38 | |
39 | -get_current_screen()->set_screen_reader_content( array( |
|
40 | - 'heading_views' => __( 'Filter site users list' ), |
|
41 | - 'heading_pagination' => __( 'Site users list navigation' ), |
|
42 | - 'heading_list' => __( 'Site users list' ), |
|
43 | -) ); |
|
39 | +get_current_screen()->set_screen_reader_content(array( |
|
40 | + 'heading_views' => __('Filter site users list'), |
|
41 | + 'heading_pagination' => __('Site users list navigation'), |
|
42 | + 'heading_list' => __('Site users list'), |
|
43 | +)); |
|
44 | 44 | |
45 | -$_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] ); |
|
46 | -$referer = remove_query_arg( 'update', wp_get_referer() ); |
|
45 | +$_SERVER['REQUEST_URI'] = remove_query_arg('update', $_SERVER['REQUEST_URI']); |
|
46 | +$referer = remove_query_arg('update', wp_get_referer()); |
|
47 | 47 | |
48 | -if ( ! empty( $_REQUEST['paged'] ) ) { |
|
49 | - $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
|
48 | +if ( ! empty($_REQUEST['paged'])) { |
|
49 | + $referer = add_query_arg('paged', (int) $_REQUEST['paged'], $referer); |
|
50 | 50 | } |
51 | 51 | |
52 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
52 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
53 | 53 | |
54 | -if ( ! $id ) |
|
55 | - wp_die( __('Invalid site ID.') ); |
|
54 | +if ( ! $id) |
|
55 | + wp_die(__('Invalid site ID.')); |
|
56 | 56 | |
57 | -$details = get_blog_details( $id ); |
|
58 | -if ( ! $details ) { |
|
59 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
57 | +$details = get_blog_details($id); |
|
58 | +if ( ! $details) { |
|
59 | + wp_die(__('The requested site does not exist.')); |
|
60 | 60 | } |
61 | 61 | |
62 | -if ( ! can_edit_network( $details->site_id ) ) |
|
63 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
62 | +if ( ! can_edit_network($details->site_id)) |
|
63 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
64 | 64 | |
65 | -$is_main_site = is_main_site( $id ); |
|
65 | +$is_main_site = is_main_site($id); |
|
66 | 66 | |
67 | -switch_to_blog( $id ); |
|
67 | +switch_to_blog($id); |
|
68 | 68 | |
69 | 69 | $action = $wp_list_table->current_action(); |
70 | 70 | |
71 | -if ( $action ) { |
|
71 | +if ($action) { |
|
72 | 72 | |
73 | - switch ( $action ) { |
|
73 | + switch ($action) { |
|
74 | 74 | case 'newuser': |
75 | - check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); |
|
75 | + check_admin_referer('add-user', '_wpnonce_add-new-user'); |
|
76 | 76 | $user = $_POST['user']; |
77 | - if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { |
|
77 | + if ( ! is_array($_POST['user']) || empty($user['username']) || empty($user['email'])) { |
|
78 | 78 | $update = 'err_new'; |
79 | 79 | } else { |
80 | - $password = wp_generate_password( 12, false); |
|
81 | - $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); |
|
80 | + $password = wp_generate_password(12, false); |
|
81 | + $user_id = wpmu_create_user(esc_html(strtolower($user['username'])), $password, esc_html($user['email'])); |
|
82 | 82 | |
83 | - if ( false === $user_id ) { |
|
83 | + if (false === $user_id) { |
|
84 | 84 | $update = 'err_new_dup'; |
85 | 85 | } else { |
86 | - add_user_to_blog( $id, $user_id, $_POST['new_role'] ); |
|
86 | + add_user_to_blog($id, $user_id, $_POST['new_role']); |
|
87 | 87 | $update = 'newuser'; |
88 | 88 | /** |
89 | 89 | * Fires after a user has been created via the network site-users.php page. |
@@ -92,20 +92,20 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param int $user_id ID of the newly created user. |
94 | 94 | */ |
95 | - do_action( 'network_site_users_created_user', $user_id ); |
|
95 | + do_action('network_site_users_created_user', $user_id); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | break; |
99 | 99 | |
100 | 100 | case 'adduser': |
101 | - check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
102 | - if ( !empty( $_POST['newuser'] ) ) { |
|
101 | + check_admin_referer('add-user', '_wpnonce_add-user'); |
|
102 | + if ( ! empty($_POST['newuser'])) { |
|
103 | 103 | $update = 'adduser'; |
104 | 104 | $newuser = $_POST['newuser']; |
105 | - $user = get_user_by( 'login', $newuser ); |
|
106 | - if ( $user && $user->exists() ) { |
|
107 | - if ( ! is_user_member_of_blog( $user->ID, $id ) ) |
|
108 | - add_user_to_blog( $id, $user->ID, $_POST['new_role'] ); |
|
105 | + $user = get_user_by('login', $newuser); |
|
106 | + if ($user && $user->exists()) { |
|
107 | + if ( ! is_user_member_of_blog($user->ID, $id)) |
|
108 | + add_user_to_blog($id, $user->ID, $_POST['new_role']); |
|
109 | 109 | else |
110 | 110 | $update = 'err_add_member'; |
111 | 111 | } else { |
@@ -117,48 +117,48 @@ discard block |
||
117 | 117 | break; |
118 | 118 | |
119 | 119 | case 'remove': |
120 | - if ( ! current_user_can( 'remove_users' ) ) |
|
120 | + if ( ! current_user_can('remove_users')) |
|
121 | 121 | die(__('You can’t remove users.')); |
122 | - check_admin_referer( 'bulk-users' ); |
|
122 | + check_admin_referer('bulk-users'); |
|
123 | 123 | |
124 | 124 | $update = 'remove'; |
125 | - if ( isset( $_REQUEST['users'] ) ) { |
|
125 | + if (isset($_REQUEST['users'])) { |
|
126 | 126 | $userids = $_REQUEST['users']; |
127 | 127 | |
128 | - foreach ( $userids as $user_id ) { |
|
128 | + foreach ($userids as $user_id) { |
|
129 | 129 | $user_id = (int) $user_id; |
130 | - remove_user_from_blog( $user_id, $id ); |
|
130 | + remove_user_from_blog($user_id, $id); |
|
131 | 131 | } |
132 | - } elseif ( isset( $_GET['user'] ) ) { |
|
133 | - remove_user_from_blog( $_GET['user'] ); |
|
132 | + } elseif (isset($_GET['user'])) { |
|
133 | + remove_user_from_blog($_GET['user']); |
|
134 | 134 | } else { |
135 | 135 | $update = 'err_remove'; |
136 | 136 | } |
137 | 137 | break; |
138 | 138 | |
139 | 139 | case 'promote': |
140 | - check_admin_referer( 'bulk-users' ); |
|
140 | + check_admin_referer('bulk-users'); |
|
141 | 141 | $editable_roles = get_editable_roles(); |
142 | - if ( empty( $editable_roles[$_REQUEST['new_role']] ) ) |
|
142 | + if (empty($editable_roles[$_REQUEST['new_role']])) |
|
143 | 143 | wp_die(__('You can’t give users that role.')); |
144 | 144 | |
145 | - if ( isset( $_REQUEST['users'] ) ) { |
|
145 | + if (isset($_REQUEST['users'])) { |
|
146 | 146 | $userids = $_REQUEST['users']; |
147 | 147 | $update = 'promote'; |
148 | - foreach ( $userids as $user_id ) { |
|
148 | + foreach ($userids as $user_id) { |
|
149 | 149 | $user_id = (int) $user_id; |
150 | 150 | |
151 | 151 | // If the user doesn't already belong to the blog, bail. |
152 | - if ( ! is_user_member_of_blog( $user_id ) ) { |
|
152 | + if ( ! is_user_member_of_blog($user_id)) { |
|
153 | 153 | wp_die( |
154 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
155 | - '<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', |
|
154 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
155 | + '<p>'.__('One of the selected users is not a member of this site.').'</p>', |
|
156 | 156 | 403 |
157 | 157 | ); |
158 | 158 | } |
159 | 159 | |
160 | - $user = get_userdata( $user_id ); |
|
161 | - $user->set_role( $_REQUEST['new_role'] ); |
|
160 | + $user = get_userdata($user_id); |
|
161 | + $user->set_role($_REQUEST['new_role']); |
|
162 | 162 | } |
163 | 163 | } else { |
164 | 164 | $update = 'err_promote'; |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | break; |
167 | 167 | } |
168 | 168 | |
169 | - wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); |
|
169 | + wp_safe_redirect(add_query_arg('update', $update, $referer)); |
|
170 | 170 | exit(); |
171 | 171 | } |
172 | 172 | |
173 | 173 | restore_current_blog(); |
174 | 174 | |
175 | -if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { |
|
176 | - wp_safe_redirect( $referer ); |
|
175 | +if (isset($_GET['action']) && 'update-site' == $_GET['action']) { |
|
176 | + wp_safe_redirect($referer); |
|
177 | 177 | exit(); |
178 | 178 | } |
179 | 179 | |
180 | -add_screen_option( 'per_page' ); |
|
180 | +add_screen_option('per_page'); |
|
181 | 181 | |
182 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
182 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
183 | 183 | |
184 | 184 | $parent_file = 'sites.php'; |
185 | 185 | $submenu_file = 'sites.php'; |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param bool $bool Whether to show the Add Existing User form. Default true. |
193 | 193 | */ |
194 | -if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) |
|
195 | - wp_enqueue_script( 'user-suggest' ); |
|
194 | +if ( ! wp_is_large_network('users') && apply_filters('show_network_site_users_add_existing_form', true)) |
|
195 | + wp_enqueue_script('user-suggest'); |
|
196 | 196 | |
197 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
197 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
198 | 198 | |
199 | 199 | <script type="text/javascript"> |
200 | 200 | var current_site_id = <?php echo $id; ?>; |
@@ -203,58 +203,58 @@ discard block |
||
203 | 203 | |
204 | 204 | <div class="wrap"> |
205 | 205 | <h1 id="edit-site"><?php echo $title; ?></h1> |
206 | -<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> |
|
206 | +<p class="edit-site-actions"><a href="<?php echo esc_url(get_home_url($id, '/')); ?>"><?php _e('Visit'); ?></a> | <a href="<?php echo esc_url(get_admin_url($id)); ?>"><?php _e('Dashboard'); ?></a></p> |
|
207 | 207 | <?php |
208 | 208 | |
209 | -network_edit_site_nav( array( |
|
209 | +network_edit_site_nav(array( |
|
210 | 210 | 'blog_id' => $id, |
211 | 211 | 'selected' => 'site-users' |
212 | -) ); |
|
212 | +)); |
|
213 | 213 | |
214 | -if ( isset($_GET['update']) ) : |
|
215 | - switch($_GET['update']) { |
|
214 | +if (isset($_GET['update'])) : |
|
215 | + switch ($_GET['update']) { |
|
216 | 216 | case 'adduser': |
217 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>'; |
|
217 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.__('User added.').'</p></div>'; |
|
218 | 218 | break; |
219 | 219 | case 'err_add_member': |
220 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>'; |
|
220 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('User is already a member of this site.').'</p></div>'; |
|
221 | 221 | break; |
222 | 222 | case 'err_add_notfound': |
223 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>'; |
|
223 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('Enter the username of an existing user.').'</p></div>'; |
|
224 | 224 | break; |
225 | 225 | case 'promote': |
226 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; |
|
226 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.__('Changed roles.').'</p></div>'; |
|
227 | 227 | break; |
228 | 228 | case 'err_promote': |
229 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>'; |
|
229 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('Select a user to change role.').'</p></div>'; |
|
230 | 230 | break; |
231 | 231 | case 'remove': |
232 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>'; |
|
232 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.__('User removed from this site.').'</p></div>'; |
|
233 | 233 | break; |
234 | 234 | case 'err_remove': |
235 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>'; |
|
235 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('Select a user to remove.').'</p></div>'; |
|
236 | 236 | break; |
237 | 237 | case 'newuser': |
238 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>'; |
|
238 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.__('User created.').'</p></div>'; |
|
239 | 239 | break; |
240 | 240 | case 'err_new': |
241 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>'; |
|
241 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('Enter the username and email.').'</p></div>'; |
|
242 | 242 | break; |
243 | 243 | case 'err_new_dup': |
244 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>'; |
|
244 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('Duplicated username or email address.').'</p></div>'; |
|
245 | 245 | break; |
246 | 246 | } |
247 | 247 | endif; ?> |
248 | 248 | |
249 | 249 | <form class="search-form" method="get"> |
250 | -<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?> |
|
251 | -<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
250 | +<?php $wp_list_table->search_box(__('Search Users'), 'user'); ?> |
|
251 | +<input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
252 | 252 | </form> |
253 | 253 | |
254 | 254 | <?php $wp_list_table->views(); ?> |
255 | 255 | |
256 | 256 | <form method="post" action="site-users.php?action=update-site"> |
257 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
257 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
258 | 258 | |
259 | 259 | <?php $wp_list_table->display(); ?> |
260 | 260 | |
@@ -266,27 +266,27 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @since 3.1.0 |
268 | 268 | */ |
269 | -do_action( 'network_site_users_after_list_table' ); |
|
269 | +do_action('network_site_users_after_list_table'); |
|
270 | 270 | |
271 | 271 | /** This filter is documented in wp-admin/network/site-users.php */ |
272 | -if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : ?> |
|
273 | -<h2 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h2> |
|
272 | +if (current_user_can('promote_users') && apply_filters('show_network_site_users_add_existing_form', true)) : ?> |
|
273 | +<h2 id="add-existing-user"><?php _e('Add Existing User'); ?></h2> |
|
274 | 274 | <form action="site-users.php?action=adduser" id="adduser" method="post"> |
275 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
275 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
276 | 276 | <table class="form-table"> |
277 | 277 | <tr> |
278 | - <th scope="row"><label for="newuser"><?php _e( 'Username' ); ?></label></th> |
|
278 | + <th scope="row"><label for="newuser"><?php _e('Username'); ?></label></th> |
|
279 | 279 | <td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td> |
280 | 280 | </tr> |
281 | 281 | <tr> |
282 | - <th scope="row"><label for="new_role_adduser"><?php _e( 'Role' ); ?></label></th> |
|
282 | + <th scope="row"><label for="new_role_adduser"><?php _e('Role'); ?></label></th> |
|
283 | 283 | <td><select name="new_role" id="new_role_adduser"> |
284 | - <?php wp_dropdown_roles( get_option( 'default_role' ) ); ?> |
|
284 | + <?php wp_dropdown_roles(get_option('default_role')); ?> |
|
285 | 285 | </select></td> |
286 | 286 | </tr> |
287 | 287 | </table> |
288 | - <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
|
289 | - <?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?> |
|
288 | + <?php wp_nonce_field('add-user', '_wpnonce_add-user') ?> |
|
289 | + <?php submit_button(__('Add User'), 'primary', 'add-user', true, array('id' => 'submit-add-existing-user')); ?> |
|
290 | 290 | </form> |
291 | 291 | <?php endif; ?> |
292 | 292 | |
@@ -298,33 +298,33 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @param bool $bool Whether to show the Add New User form. Default true. |
300 | 300 | */ |
301 | -if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?> |
|
302 | -<h2 id="add-new-user"><?php _e( 'Add New User' ); ?></h2> |
|
301 | +if (current_user_can('create_users') && apply_filters('show_network_site_users_add_new_form', true)) : ?> |
|
302 | +<h2 id="add-new-user"><?php _e('Add New User'); ?></h2> |
|
303 | 303 | <form action="<?php echo network_admin_url('site-users.php?action=newuser'); ?>" id="newuser" method="post"> |
304 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
304 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
305 | 305 | <table class="form-table"> |
306 | 306 | <tr> |
307 | - <th scope="row"><label for="user_username"><?php _e( 'Username' ) ?></label></th> |
|
307 | + <th scope="row"><label for="user_username"><?php _e('Username') ?></label></th> |
|
308 | 308 | <td><input type="text" class="regular-text" name="user[username]" id="user_username" /></td> |
309 | 309 | </tr> |
310 | 310 | <tr> |
311 | - <th scope="row"><label for="user_email"><?php _e( 'Email' ) ?></label></th> |
|
311 | + <th scope="row"><label for="user_email"><?php _e('Email') ?></label></th> |
|
312 | 312 | <td><input type="text" class="regular-text" name="user[email]" id="user_email" /></td> |
313 | 313 | </tr> |
314 | 314 | <tr> |
315 | - <th scope="row"><label for="new_role_newuser"><?php _e( 'Role' ); ?></label></th> |
|
315 | + <th scope="row"><label for="new_role_newuser"><?php _e('Role'); ?></label></th> |
|
316 | 316 | <td><select name="new_role" id="new_role_newuser"> |
317 | - <?php wp_dropdown_roles( get_option( 'default_role' ) ); ?> |
|
317 | + <?php wp_dropdown_roles(get_option('default_role')); ?> |
|
318 | 318 | </select></td> |
319 | 319 | </tr> |
320 | 320 | <tr class="form-field"> |
321 | - <td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ) ?></td> |
|
321 | + <td colspan="2"><?php _e('A password reset link will be sent to the user via email.') ?></td> |
|
322 | 322 | </tr> |
323 | 323 | </table> |
324 | - <?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ) ?> |
|
325 | - <?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?> |
|
324 | + <?php wp_nonce_field('add-user', '_wpnonce_add-new-user') ?> |
|
325 | + <?php submit_button(__('Add New User'), 'primary', 'add-user', true, array('id' => 'submit-add-user')); ?> |
|
326 | 326 | </form> |
327 | 327 | <?php endif; ?> |
328 | 328 | </div> |
329 | 329 | <?php |
330 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
330 | +require(ABSPATH.'wp-admin/admin-footer.php'); |