@@ -81,12 +81,14 @@ discard block |
||
81 | 81 | $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
82 | 82 | } else { |
83 | 83 | $class[] = 'wp-not-current-submenu'; |
84 | - if ( ! empty( $submenu_items ) ) |
|
85 | - $aria_attributes .= 'aria-haspopup="true"'; |
|
84 | + if ( ! empty( $submenu_items ) ) { |
|
85 | + $aria_attributes .= 'aria-haspopup="true"'; |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | |
88 | - if ( ! empty( $item[4] ) ) |
|
89 | - $class[] = esc_attr( $item[4] ); |
|
89 | + if ( ! empty( $item[4] ) ) { |
|
90 | + $class[] = esc_attr( $item[4] ); |
|
91 | + } |
|
90 | 92 | |
91 | 93 | $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
92 | 94 | $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
@@ -134,8 +136,9 @@ discard block |
||
134 | 136 | $submenu_items = array_values( $submenu_items ); // Re-index. |
135 | 137 | $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); |
136 | 138 | $menu_file = $submenu_items[0][2]; |
137 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
138 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
139 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
140 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
141 | + } |
|
139 | 142 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
140 | 143 | $admin_is_parent = true; |
141 | 144 | echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
@@ -145,8 +148,9 @@ discard block |
||
145 | 148 | } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
146 | 149 | $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); |
147 | 150 | $menu_file = $item[2]; |
148 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
149 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
151 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
152 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
153 | + } |
|
150 | 154 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
151 | 155 | $admin_is_parent = true; |
152 | 156 | echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; |
@@ -163,8 +167,9 @@ discard block |
||
163 | 167 | |
164 | 168 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes |
165 | 169 | foreach ( $submenu_items as $sub_key => $sub_item ) { |
166 | - if ( ! current_user_can( $sub_item[1] ) ) |
|
167 | - continue; |
|
170 | + if ( ! current_user_can( $sub_item[1] ) ) { |
|
171 | + continue; |
|
172 | + } |
|
168 | 173 | |
169 | 174 | $class = array(); |
170 | 175 | if ( $first ) { |
@@ -174,15 +179,17 @@ discard block |
||
174 | 179 | |
175 | 180 | $menu_file = $item[2]; |
176 | 181 | |
177 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
178 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
182 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
183 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
184 | + } |
|
179 | 185 | |
180 | 186 | // Handle current for post_type=post|page|foo pages, which won't match $self. |
181 | 187 | $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; |
182 | 188 | |
183 | 189 | if ( isset( $submenu_file ) ) { |
184 | - if ( $submenu_file == $sub_item[2] ) |
|
185 | - $class[] = 'current'; |
|
190 | + if ( $submenu_file == $sub_item[2] ) { |
|
191 | + $class[] = 'current'; |
|
192 | + } |
|
186 | 193 | // If plugin_page is set the parent must either match the current page or not physically exist. |
187 | 194 | // This allows plugin pages with the same hook to exist under different parents. |
188 | 195 | } elseif ( |
@@ -200,17 +207,19 @@ discard block |
||
200 | 207 | |
201 | 208 | $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); |
202 | 209 | $sub_file = $sub_item[2]; |
203 | - if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) |
|
204 | - $sub_file = substr($sub_file, 0, $pos); |
|
210 | + if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) { |
|
211 | + $sub_file = substr($sub_file, 0, $pos); |
|
212 | + } |
|
205 | 213 | |
206 | 214 | $title = wptexturize($sub_item[0]); |
207 | 215 | |
208 | 216 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { |
209 | 217 | // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir |
210 | - if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) |
|
211 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
212 | - else |
|
213 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
218 | + if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) { |
|
219 | + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
220 | + } else { |
|
221 | + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
222 | + } |
|
214 | 223 | |
215 | 224 | $sub_item_url = esc_url( $sub_item_url ); |
216 | 225 | echo "<li$class><a href='$sub_item_url'$class>$title</a></li>"; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $parent_file The parent file. |
37 | 37 | */ |
38 | -$parent_file = apply_filters( 'parent_file', $parent_file ); |
|
38 | +$parent_file = apply_filters('parent_file', $parent_file); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Filters the file of an admin menu sub-menu item. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $submenu_file The submenu file. |
46 | 46 | * @param string $parent_file The submenu item's parent file. |
47 | 47 | */ |
48 | -$submenu_file = apply_filters( 'submenu_file', $submenu_file, $parent_file ); |
|
48 | +$submenu_file = apply_filters('submenu_file', $submenu_file, $parent_file); |
|
49 | 49 | |
50 | 50 | get_admin_page_parent(); |
51 | 51 | |
@@ -65,46 +65,46 @@ discard block |
||
65 | 65 | * @param array $submenu |
66 | 66 | * @param bool $submenu_as_parent |
67 | 67 | */ |
68 | -function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { |
|
68 | +function _wp_menu_output($menu, $submenu, $submenu_as_parent = true) { |
|
69 | 69 | global $self, $parent_file, $submenu_file, $plugin_page, $typenow; |
70 | 70 | |
71 | 71 | $first = true; |
72 | 72 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url |
73 | - foreach ( $menu as $key => $item ) { |
|
73 | + foreach ($menu as $key => $item) { |
|
74 | 74 | $admin_is_parent = false; |
75 | 75 | $class = array(); |
76 | 76 | $aria_attributes = ''; |
77 | 77 | $aria_hidden = ''; |
78 | 78 | $is_separator = false; |
79 | 79 | |
80 | - if ( $first ) { |
|
80 | + if ($first) { |
|
81 | 81 | $class[] = 'wp-first-item'; |
82 | 82 | $first = false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $submenu_items = array(); |
86 | - if ( ! empty( $submenu[$item[2]] ) ) { |
|
86 | + if ( ! empty($submenu[$item[2]])) { |
|
87 | 87 | $class[] = 'wp-has-submenu'; |
88 | 88 | $submenu_items = $submenu[$item[2]]; |
89 | 89 | } |
90 | 90 | |
91 | - if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { |
|
92 | - $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
91 | + if (($parent_file && $item[2] == $parent_file) || (empty($typenow) && $self == $item[2])) { |
|
92 | + $class[] = ! empty($submenu_items) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
93 | 93 | } else { |
94 | 94 | $class[] = 'wp-not-current-submenu'; |
95 | - if ( ! empty( $submenu_items ) ) |
|
95 | + if ( ! empty($submenu_items)) |
|
96 | 96 | $aria_attributes .= 'aria-haspopup="true"'; |
97 | 97 | } |
98 | 98 | |
99 | - if ( ! empty( $item[4] ) ) |
|
100 | - $class[] = esc_attr( $item[4] ); |
|
99 | + if ( ! empty($item[4])) |
|
100 | + $class[] = esc_attr($item[4]); |
|
101 | 101 | |
102 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
103 | - $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
|
102 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
103 | + $id = ! empty($item[5]) ? ' id="'.preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]).'"' : ''; |
|
104 | 104 | $img = $img_style = ''; |
105 | 105 | $img_class = ' dashicons-before'; |
106 | 106 | |
107 | - if ( false !== strpos( $class, 'wp-menu-separator' ) ) { |
|
107 | + if (false !== strpos($class, 'wp-menu-separator')) { |
|
108 | 108 | $is_separator = true; |
109 | 109 | } |
110 | 110 | |
@@ -114,51 +114,51 @@ discard block |
||
114 | 114 | * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled |
115 | 115 | * as special cases. |
116 | 116 | */ |
117 | - if ( ! empty( $item[6] ) ) { |
|
118 | - $img = '<img src="' . $item[6] . '" alt="" />'; |
|
117 | + if ( ! empty($item[6])) { |
|
118 | + $img = '<img src="'.$item[6].'" alt="" />'; |
|
119 | 119 | |
120 | - if ( 'none' === $item[6] || 'div' === $item[6] ) { |
|
120 | + if ('none' === $item[6] || 'div' === $item[6]) { |
|
121 | 121 | $img = '<br />'; |
122 | - } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) { |
|
122 | + } elseif (0 === strpos($item[6], 'data:image/svg+xml;base64,')) { |
|
123 | 123 | $img = '<br />'; |
124 | - $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; |
|
124 | + $img_style = ' style="background-image:url(\''.esc_attr($item[6]).'\')"'; |
|
125 | 125 | $img_class = ' svg'; |
126 | - } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) { |
|
126 | + } elseif (0 === strpos($item[6], 'dashicons-')) { |
|
127 | 127 | $img = '<br />'; |
128 | - $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); |
|
128 | + $img_class = ' dashicons-before '.sanitize_html_class($item[6]); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | $arrow = '<div class="wp-menu-arrow"><div></div></div>'; |
132 | 132 | |
133 | - $title = wptexturize( $item[0] ); |
|
133 | + $title = wptexturize($item[0]); |
|
134 | 134 | |
135 | 135 | // hide separators from screen readers |
136 | - if ( $is_separator ) { |
|
136 | + if ($is_separator) { |
|
137 | 137 | $aria_hidden = ' aria-hidden="true"'; |
138 | 138 | } |
139 | 139 | |
140 | 140 | echo "\n\t<li$class$id$aria_hidden>"; |
141 | 141 | |
142 | - if ( $is_separator ) { |
|
142 | + if ($is_separator) { |
|
143 | 143 | echo '<div class="separator"></div>'; |
144 | - } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) { |
|
145 | - $submenu_items = array_values( $submenu_items ); // Re-index. |
|
146 | - $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); |
|
144 | + } elseif ($submenu_as_parent && ! empty($submenu_items)) { |
|
145 | + $submenu_items = array_values($submenu_items); // Re-index. |
|
146 | + $menu_hook = get_plugin_page_hook($submenu_items[0][2], $item[2]); |
|
147 | 147 | $menu_file = $submenu_items[0][2]; |
148 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
149 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
150 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
148 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
149 | + $menu_file = substr($menu_file, 0, $pos); |
|
150 | + if ( ! empty($menu_hook) || (('index.php' != $submenu_items[0][2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
151 | 151 | $admin_is_parent = true; |
152 | 152 | echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
153 | 153 | } else { |
154 | 154 | echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
155 | 155 | } |
156 | - } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
157 | - $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); |
|
156 | + } elseif ( ! empty($item[2]) && current_user_can($item[1])) { |
|
157 | + $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); |
|
158 | 158 | $menu_file = $item[2]; |
159 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
160 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
161 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
159 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
160 | + $menu_file = substr($menu_file, 0, $pos); |
|
161 | + if ( ! empty($menu_hook) || (('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
162 | 162 | $admin_is_parent = true; |
163 | 163 | echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; |
164 | 164 | } else { |
@@ -166,64 +166,64 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( ! empty( $submenu_items ) ) { |
|
169 | + if ( ! empty($submenu_items)) { |
|
170 | 170 | echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>"; |
171 | 171 | echo "<li class='wp-submenu-head' aria-hidden='true'>{$item[0]}</li>"; |
172 | 172 | |
173 | 173 | $first = true; |
174 | 174 | |
175 | 175 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes |
176 | - foreach ( $submenu_items as $sub_key => $sub_item ) { |
|
177 | - if ( ! current_user_can( $sub_item[1] ) ) |
|
176 | + foreach ($submenu_items as $sub_key => $sub_item) { |
|
177 | + if ( ! current_user_can($sub_item[1])) |
|
178 | 178 | continue; |
179 | 179 | |
180 | 180 | $class = array(); |
181 | - if ( $first ) { |
|
181 | + if ($first) { |
|
182 | 182 | $class[] = 'wp-first-item'; |
183 | 183 | $first = false; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $menu_file = $item[2]; |
187 | 187 | |
188 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
189 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
188 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
189 | + $menu_file = substr($menu_file, 0, $pos); |
|
190 | 190 | |
191 | 191 | // Handle current for post_type=post|page|foo pages, which won't match $self. |
192 | - $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; |
|
192 | + $self_type = ! empty($typenow) ? $self.'?post_type='.$typenow : 'nothing'; |
|
193 | 193 | |
194 | - if ( isset( $submenu_file ) ) { |
|
195 | - if ( $submenu_file == $sub_item[2] ) |
|
194 | + if (isset($submenu_file)) { |
|
195 | + if ($submenu_file == $sub_item[2]) |
|
196 | 196 | $class[] = 'current'; |
197 | 197 | // If plugin_page is set the parent must either match the current page or not physically exist. |
198 | 198 | // This allows plugin pages with the same hook to exist under different parents. |
199 | 199 | } elseif ( |
200 | - ( ! isset( $plugin_page ) && $self == $sub_item[2] ) || |
|
201 | - ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) ) |
|
200 | + ( ! isset($plugin_page) && $self == $sub_item[2]) || |
|
201 | + (isset($plugin_page) && $plugin_page == $sub_item[2] && ($item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false)) |
|
202 | 202 | ) { |
203 | 203 | $class[] = 'current'; |
204 | 204 | } |
205 | 205 | |
206 | - if ( ! empty( $sub_item[4] ) ) { |
|
207 | - $class[] = esc_attr( $sub_item[4] ); |
|
206 | + if ( ! empty($sub_item[4])) { |
|
207 | + $class[] = esc_attr($sub_item[4]); |
|
208 | 208 | } |
209 | 209 | |
210 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
210 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
211 | 211 | |
212 | 212 | $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); |
213 | 213 | $sub_file = $sub_item[2]; |
214 | - if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) |
|
214 | + if (false !== ($pos = strpos($sub_file, '?'))) |
|
215 | 215 | $sub_file = substr($sub_file, 0, $pos); |
216 | 216 | |
217 | 217 | $title = wptexturize($sub_item[0]); |
218 | 218 | |
219 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { |
|
219 | + if ( ! empty($menu_hook) || (('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR."/$sub_file") && ! file_exists(ABSPATH."/wp-admin/$sub_file"))) { |
|
220 | 220 | // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir |
221 | - if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) |
|
222 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
221 | + if (( ! $admin_is_parent && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! is_dir(WP_PLUGIN_DIR."/{$item[2]}")) || file_exists($menu_file)) |
|
222 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), $item[2]); |
|
223 | 223 | else |
224 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
224 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), 'admin.php'); |
|
225 | 225 | |
226 | - $sub_item_url = esc_url( $sub_item_url ); |
|
226 | + $sub_item_url = esc_url($sub_item_url); |
|
227 | 227 | echo "<li$class><a href='$sub_item_url'$class>$title</a></li>"; |
228 | 228 | } else { |
229 | 229 | echo "<li$class><a href='{$sub_item[2]}'$class>$title</a></li>"; |
@@ -234,31 +234,31 @@ discard block |
||
234 | 234 | echo "</li>"; |
235 | 235 | } |
236 | 236 | |
237 | - echo '<li id="collapse-menu" class="hide-if-no-js">' . |
|
238 | - '<button type="button" id="collapse-button" aria-label="' . esc_attr__( 'Collapse Main menu' ) . '" aria-expanded="true">' . |
|
239 | - '<span class="collapse-button-icon" aria-hidden="true"></span>' . |
|
240 | - '<span class="collapse-button-label">' . __( 'Collapse menu' ) . '</span>' . |
|
237 | + echo '<li id="collapse-menu" class="hide-if-no-js">'. |
|
238 | + '<button type="button" id="collapse-button" aria-label="'.esc_attr__('Collapse Main menu').'" aria-expanded="true">'. |
|
239 | + '<span class="collapse-button-icon" aria-hidden="true"></span>'. |
|
240 | + '<span class="collapse-button-label">'.__('Collapse menu').'</span>'. |
|
241 | 241 | '</button></li>'; |
242 | 242 | } |
243 | 243 | |
244 | 244 | ?> |
245 | 245 | |
246 | -<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e( 'Main menu' ); ?>"> |
|
247 | -<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e( 'Skip to main content' ); ?></a> |
|
248 | -<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e( 'Skip to toolbar' ); ?></a> |
|
246 | +<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e('Main menu'); ?>"> |
|
247 | +<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a> |
|
248 | +<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e('Skip to toolbar'); ?></a> |
|
249 | 249 | <div id="adminmenuback"></div> |
250 | 250 | <div id="adminmenuwrap"> |
251 | 251 | <ul id="adminmenu"> |
252 | 252 | |
253 | 253 | <?php |
254 | 254 | |
255 | -_wp_menu_output( $menu, $submenu ); |
|
255 | +_wp_menu_output($menu, $submenu); |
|
256 | 256 | /** |
257 | 257 | * Fires after the admin menu has been output. |
258 | 258 | * |
259 | 259 | * @since 2.5.0 |
260 | 260 | */ |
261 | -do_action( 'adminmenu' ); |
|
261 | +do_action('adminmenu'); |
|
262 | 262 | |
263 | 263 | ?> |
264 | 264 | </ul> |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | |
13 | 14 | if ( ! empty($link_id) ) { |
14 | 15 | $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
@@ -139,9 +140,12 @@ discard block |
||
139 | 140 | <input type="hidden" name="action" value="save" /> |
140 | 141 | <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> |
141 | 142 | <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
142 | -<?php else: ?> |
|
143 | +<?php else { |
|
144 | + : ?> |
|
143 | 145 | <input type="hidden" name="action" value="add" /> |
144 | -<?php endif; ?> |
|
146 | +<?php endif; |
|
147 | +} |
|
148 | +?> |
|
145 | 149 | |
146 | 150 | </div> |
147 | 151 | </div> |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | |
13 | -if ( ! empty($link_id) ) { |
|
14 | - $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
|
13 | +if ( ! empty($link_id)) { |
|
14 | + $heading = sprintf(__('<a href="%s">Links</a> / Edit Link'), 'link-manager.php'); |
|
15 | 15 | $submit_text = __('Update Link'); |
16 | 16 | $form_name = 'editlink'; |
17 | - $nonce_action = 'update-bookmark_' . $link_id; |
|
17 | + $nonce_action = 'update-bookmark_'.$link_id; |
|
18 | 18 | } else { |
19 | - $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' ); |
|
19 | + $heading = sprintf(__('<a href="%s">Links</a> / Add New Link'), 'link-manager.php'); |
|
20 | 20 | $submit_text = __('Add Link'); |
21 | 21 | $form_name = 'addlink'; |
22 | 22 | $nonce_action = 'add-bookmark'; |
23 | 23 | } |
24 | 24 | |
25 | -require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
|
25 | +require_once(ABSPATH.'wp-admin/includes/meta-boxes.php'); |
|
26 | 26 | |
27 | 27 | add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core'); |
28 | 28 | add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core'); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core'); |
32 | 32 | |
33 | 33 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
34 | -do_action( 'add_meta_boxes', 'link', $link ); |
|
34 | +do_action('add_meta_boxes', 'link', $link); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Fires when link-specific meta boxes are added. |
@@ -40,64 +40,64 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param object $link Link object. |
42 | 42 | */ |
43 | -do_action( 'add_meta_boxes_link', $link ); |
|
43 | +do_action('add_meta_boxes_link', $link); |
|
44 | 44 | |
45 | 45 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
46 | -do_action( 'do_meta_boxes', 'link', 'normal', $link ); |
|
46 | +do_action('do_meta_boxes', 'link', 'normal', $link); |
|
47 | 47 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
48 | -do_action( 'do_meta_boxes', 'link', 'advanced', $link ); |
|
48 | +do_action('do_meta_boxes', 'link', 'advanced', $link); |
|
49 | 49 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
50 | -do_action( 'do_meta_boxes', 'link', 'side', $link ); |
|
50 | +do_action('do_meta_boxes', 'link', 'side', $link); |
|
51 | 51 | |
52 | -add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
|
52 | +add_screen_option('layout_columns', array('max' => 2, 'default' => 2)); |
|
53 | 53 | |
54 | -get_current_screen()->add_help_tab( array( |
|
54 | +get_current_screen()->add_help_tab(array( |
|
55 | 55 | 'id' => 'overview', |
56 | 56 | 'title' => __('Overview'), |
57 | 57 | 'content' => |
58 | - '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' . |
|
59 | - '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' . |
|
60 | - '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>' |
|
61 | -) ); |
|
58 | + '<p>'.__('You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.').'</p>'. |
|
59 | + '<p>'.__('The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.').'</p>'. |
|
60 | + '<p>'.__('XFN stands for <a href="http://gmpg.org/xfn/">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.').'</p>' |
|
61 | +)); |
|
62 | 62 | |
63 | 63 | get_current_screen()->set_help_sidebar( |
64 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
65 | - '<p>' . __( '<a href="https://codex.wordpress.org/Links_Add_New_Screen">Documentation on Creating Links</a>' ) . '</p>' . |
|
66 | - '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
|
64 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
65 | + '<p>'.__('<a href="https://codex.wordpress.org/Links_Add_New_Screen">Documentation on Creating Links</a>').'</p>'. |
|
66 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
67 | 67 | ); |
68 | 68 | |
69 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
69 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | <div class="wrap"> |
73 | 73 | <h1 class="wp-heading-inline"><?php |
74 | -echo esc_html( $title ); |
|
74 | +echo esc_html($title); |
|
75 | 75 | ?></h1> |
76 | 76 | |
77 | -<a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a> |
|
77 | +<a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> |
|
78 | 78 | |
79 | 79 | <hr class="wp-header-end"> |
80 | 80 | |
81 | -<?php if ( isset( $_GET['added'] ) ) : ?> |
|
81 | +<?php if (isset($_GET['added'])) : ?> |
|
82 | 82 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Link added.'); ?></p></div> |
83 | 83 | <?php endif; ?> |
84 | 84 | |
85 | -<form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php"> |
|
85 | +<form name="<?php echo esc_attr($form_name); ?>" id="<?php echo esc_attr($form_name); ?>" method="post" action="link.php"> |
|
86 | 86 | <?php |
87 | -if ( ! empty( $link_added ) ) { |
|
87 | +if ( ! empty($link_added)) { |
|
88 | 88 | echo $link_added; |
89 | 89 | } |
90 | 90 | |
91 | -wp_nonce_field( $nonce_action ); |
|
92 | -wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
93 | -wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
91 | +wp_nonce_field($nonce_action); |
|
92 | +wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
93 | +wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
94 | 94 | |
95 | 95 | <div id="poststuff"> |
96 | 96 | |
97 | 97 | <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
98 | 98 | <div id="post-body-content"> |
99 | 99 | <div id="namediv" class="stuffbox"> |
100 | -<h2><label for="link_name"><?php _ex( 'Name', 'link name' ) ?></label></h2> |
|
100 | +<h2><label for="link_name"><?php _ex('Name', 'link name') ?></label></h2> |
|
101 | 101 | <div class="inside"> |
102 | 102 | <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" /> |
103 | 103 | <p><?php _e('Example: Nifty blogging software'); ?></p> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | </div> |
106 | 106 | |
107 | 107 | <div id="addressdiv" class="stuffbox"> |
108 | -<h2><label for="link_url"><?php _e( 'Web Address' ) ?></label></h2> |
|
108 | +<h2><label for="link_url"><?php _e('Web Address') ?></label></h2> |
|
109 | 109 | <div class="inside"> |
110 | 110 | <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" /> |
111 | 111 | <p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p> |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | </div> |
114 | 114 | |
115 | 115 | <div id="descriptiondiv" class="stuffbox"> |
116 | -<h2><label for="link_description"><?php _e( 'Description' ) ?></label></h2> |
|
116 | +<h2><label for="link_description"><?php _e('Description') ?></label></h2> |
|
117 | 117 | <div class="inside"> |
118 | 118 | <input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" /> |
119 | 119 | <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p> |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | <?php |
126 | 126 | |
127 | 127 | /** This action is documented in wp-admin/includes/meta-boxes.php */ |
128 | -do_action( 'submitlink_box' ); |
|
129 | -$side_meta_boxes = do_meta_boxes( 'link', 'side', $link ); |
|
128 | +do_action('submitlink_box'); |
|
129 | +$side_meta_boxes = do_meta_boxes('link', 'side', $link); |
|
130 | 130 | |
131 | 131 | ?> |
132 | 132 | </div> |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | </div> |
142 | 142 | <?php |
143 | 143 | |
144 | -if ( $link_id ) : ?> |
|
144 | +if ($link_id) : ?> |
|
145 | 145 | <input type="hidden" name="action" value="save" /> |
146 | 146 | <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> |
147 | 147 | <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined('ABSPATH') ) |
|
9 | +if ( ! defined('ABSPATH') ) { |
|
10 | 10 | die(); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * @global string $opml |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined('ABSPATH') ) |
|
9 | +if ( ! defined('ABSPATH')) |
|
10 | 10 | die(); |
11 | 11 | |
12 | 12 | /** |
@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | function startElement($parser, $tagName, $attrs) { |
34 | 34 | global $names, $urls, $targets, $descriptions, $feeds; |
35 | 35 | |
36 | - if ( 'OUTLINE' === $tagName ) { |
|
36 | + if ('OUTLINE' === $tagName) { |
|
37 | 37 | $name = ''; |
38 | - if ( isset( $attrs['TEXT'] ) ) { |
|
38 | + if (isset($attrs['TEXT'])) { |
|
39 | 39 | $name = $attrs['TEXT']; |
40 | 40 | } |
41 | - if ( isset( $attrs['TITLE'] ) ) { |
|
41 | + if (isset($attrs['TITLE'])) { |
|
42 | 42 | $name = $attrs['TITLE']; |
43 | 43 | } |
44 | 44 | $url = ''; |
45 | - if ( isset( $attrs['URL'] ) ) { |
|
45 | + if (isset($attrs['URL'])) { |
|
46 | 46 | $url = $attrs['URL']; |
47 | 47 | } |
48 | - if ( isset( $attrs['HTMLURL'] ) ) { |
|
48 | + if (isset($attrs['HTMLURL'])) { |
|
49 | 49 | $url = $attrs['HTMLURL']; |
50 | 50 | } |
51 | 51 | |
52 | 52 | // Save the data away. |
53 | 53 | $names[] = $name; |
54 | 54 | $urls[] = $url; |
55 | - $targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] : ''; |
|
56 | - $feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] : ''; |
|
57 | - $descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] : ''; |
|
55 | + $targets[] = isset($attrs['TARGET']) ? $attrs['TARGET'] : ''; |
|
56 | + $feeds[] = isset($attrs['XMLURL']) ? $attrs['XMLURL'] : ''; |
|
57 | + $descriptions[] = isset($attrs['DESCRIPTION']) ? $attrs['DESCRIPTION'] : ''; |
|
58 | 58 | } // End if outline. |
59 | 59 | } |
60 | 60 | |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | // Create an XML parser |
75 | -if ( ! function_exists( 'xml_parser_create' ) ) { |
|
76 | - trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); |
|
77 | - wp_die( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); |
|
75 | +if ( ! function_exists('xml_parser_create')) { |
|
76 | + trigger_error(__("PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension.")); |
|
77 | + wp_die(__("PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension.")); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $xml_parser = xml_parser_create(); |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | // Set the functions to handle opening and closing tags |
83 | 83 | xml_set_element_handler($xml_parser, "startElement", "endElement"); |
84 | 84 | |
85 | -if ( ! xml_parse( $xml_parser, $opml, true ) ) { |
|
85 | +if ( ! xml_parse($xml_parser, $opml, true)) { |
|
86 | 86 | printf( |
87 | 87 | /* translators: 1: error message, 2: line number */ |
88 | - __( 'XML Error: %1$s at line %2$s' ), |
|
89 | - xml_error_string( xml_get_error_code( $xml_parser ) ), |
|
90 | - xml_get_current_line_number( $xml_parser ) |
|
88 | + __('XML Error: %1$s at line %2$s'), |
|
89 | + xml_error_string(xml_get_error_code($xml_parser)), |
|
90 | + xml_get_current_line_number($xml_parser) |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 |
@@ -9,11 +9,13 @@ |
||
9 | 9 | |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
12 | +if ( !is_multisite() ) { |
|
13 | 13 | wp_die( __( 'Multisite support is not enabled.' ) ); |
14 | +} |
|
14 | 15 | |
15 | -if ( ! current_user_can( 'delete_site' ) ) |
|
16 | +if ( ! current_user_can( 'delete_site' ) ) { |
|
16 | 17 | wp_die(__( 'You do not have sufficient permissions to delete this site.')); |
18 | +} |
|
17 | 19 | |
18 | 20 | if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { |
19 | 21 | if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { |
@@ -7,45 +7,45 @@ discard block |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
13 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
12 | +if ( ! is_multisite()) |
|
13 | + wp_die(__('Multisite support is not enabled.')); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'delete_site' ) ) |
|
16 | - wp_die(__( 'Sorry, you are not allowed to delete this site.')); |
|
15 | +if ( ! current_user_can('delete_site')) |
|
16 | + wp_die(__('Sorry, you are not allowed to delete this site.')); |
|
17 | 17 | |
18 | -if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { |
|
19 | - if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) { |
|
20 | - wpmu_delete_blog( $wpdb->blogid ); |
|
21 | - wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), get_network()->site_name ) ); |
|
18 | +if (isset($_GET['h']) && $_GET['h'] != '' && get_option('delete_blog_hash') != false) { |
|
19 | + if (hash_equals(get_option('delete_blog_hash'), $_GET['h'])) { |
|
20 | + wpmu_delete_blog($wpdb->blogid); |
|
21 | + wp_die(sprintf(__('Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.'), get_network()->site_name)); |
|
22 | 22 | } else { |
23 | - wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); |
|
23 | + wp_die(__("I'm sorry, the link you clicked is stale. Please select another option.")); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | $blog = get_site(); |
28 | 28 | $user = wp_get_current_user(); |
29 | 29 | |
30 | -$title = __( 'Delete Site' ); |
|
30 | +$title = __('Delete Site'); |
|
31 | 31 | $parent_file = 'tools.php'; |
32 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
32 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
33 | 33 | |
34 | 34 | echo '<div class="wrap">'; |
35 | -echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
35 | +echo '<h1>'.esc_html($title).'</h1>'; |
|
36 | 36 | |
37 | -if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { |
|
38 | - check_admin_referer( 'delete-blog' ); |
|
37 | +if (isset($_POST['action']) && $_POST['action'] == 'deleteblog' && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1') { |
|
38 | + check_admin_referer('delete-blog'); |
|
39 | 39 | |
40 | - $hash = wp_generate_password( 20, false ); |
|
41 | - update_option( 'delete_blog_hash', $hash ); |
|
40 | + $hash = wp_generate_password(20, false); |
|
41 | + update_option('delete_blog_hash', $hash); |
|
42 | 42 | |
43 | - $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); |
|
43 | + $url_delete = esc_url(admin_url('ms-delete-site.php?h='.$hash)); |
|
44 | 44 | |
45 | - $switched_locale = switch_to_locale( get_locale() ); |
|
45 | + $switched_locale = switch_to_locale(get_locale()); |
|
46 | 46 | |
47 | 47 | /* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */ |
48 | - $content = __( "Howdy ###USERNAME###, |
|
48 | + $content = __("Howdy ###USERNAME###, |
|
49 | 49 | |
50 | 50 | You recently clicked the 'Delete Site' link on your site and filled in a |
51 | 51 | form on that page. |
@@ -68,40 +68,40 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network. |
70 | 70 | */ |
71 | - $content = apply_filters( 'delete_site_email_content', $content ); |
|
71 | + $content = apply_filters('delete_site_email_content', $content); |
|
72 | 72 | |
73 | - $content = str_replace( '###USERNAME###', $user->user_login, $content ); |
|
74 | - $content = str_replace( '###URL_DELETE###', $url_delete, $content ); |
|
75 | - $content = str_replace( '###SITE_NAME###', get_network()->site_name, $content ); |
|
73 | + $content = str_replace('###USERNAME###', $user->user_login, $content); |
|
74 | + $content = str_replace('###URL_DELETE###', $url_delete, $content); |
|
75 | + $content = str_replace('###SITE_NAME###', get_network()->site_name, $content); |
|
76 | 76 | |
77 | - wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content ); |
|
77 | + wp_mail(get_option('admin_email'), "[ ".wp_specialchars_decode(get_option('blogname'))." ] ".__('Delete My Site'), $content); |
|
78 | 78 | |
79 | - if ( $switched_locale ) { |
|
79 | + if ($switched_locale) { |
|
80 | 80 | restore_previous_locale(); |
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | |
84 | - <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ) ?></p> |
|
84 | + <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.') ?></p> |
|
85 | 85 | |
86 | 86 | <?php } else { |
87 | 87 | ?> |
88 | - <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), get_network()->site_name); ?></p> |
|
89 | - <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> |
|
88 | + <p><?php printf(__('If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), get_network()->site_name); ?></p> |
|
89 | + <p><?php _e('Remember, once deleted your site cannot be restored.') ?></p> |
|
90 | 90 | |
91 | 91 | <form method="post" name="deletedirect"> |
92 | - <?php wp_nonce_field( 'delete-blog' ) ?> |
|
92 | + <?php wp_nonce_field('delete-blog') ?> |
|
93 | 93 | <input type="hidden" name="action" value="deleteblog" /> |
94 | 94 | <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php |
95 | 95 | printf( |
96 | 96 | /* translators: %s: site address */ |
97 | - __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), |
|
98 | - $blog->domain . $blog->path |
|
97 | + __("I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again."), |
|
98 | + $blog->domain.$blog->path |
|
99 | 99 | ); |
100 | 100 | ?></strong></label></p> |
101 | - <?php submit_button( __( 'Delete My Site Permanently' ) ); ?> |
|
101 | + <?php submit_button(__('Delete My Site Permanently')); ?> |
|
102 | 102 | </form> |
103 | 103 | <?php |
104 | 104 | } |
105 | 105 | echo '</div>'; |
106 | 106 | |
107 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
107 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -45,14 +45,14 @@ |
||
45 | 45 | 'title' => __('Overview'), |
46 | 46 | 'content' => |
47 | 47 | '<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' . |
48 | - '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' . |
|
49 | - '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>' |
|
48 | + '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' . |
|
49 | + '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>' |
|
50 | 50 | ) ); |
51 | 51 | get_current_screen()->add_help_tab( array( |
52 | 52 | 'id' => 'deleting-links', |
53 | 53 | 'title' => __('Deleting Links'), |
54 | 54 | 'content' => |
55 | - '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' |
|
55 | + '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' |
|
56 | 56 | ) ); |
57 | 57 | |
58 | 58 | get_current_screen()->set_help_sidebar( |
@@ -8,8 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | -if ( ! current_user_can( 'manage_links' ) ) |
|
11 | +if ( ! current_user_can( 'manage_links' ) ) { |
|
12 | 12 | wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) ); |
13 | +} |
|
13 | 14 | |
14 | 15 | $wp_list_table = _get_list_table('WP_Links_List_Table'); |
15 | 16 | |
@@ -67,8 +68,9 @@ discard block |
||
67 | 68 | |
68 | 69 | include_once( ABSPATH . 'wp-admin/admin-header.php' ); |
69 | 70 | |
70 | -if ( ! current_user_can('manage_links') ) |
|
71 | +if ( ! current_user_can('manage_links') ) { |
|
71 | 72 | wp_die(__("You do not have sufficient permissions to edit the links for this site.")); |
73 | +} |
|
72 | 74 | |
73 | 75 | ?> |
74 | 76 |
@@ -7,37 +7,37 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | -if ( ! current_user_can( 'manage_links' ) ) |
|
12 | - wp_die( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +if ( ! current_user_can('manage_links')) |
|
12 | + wp_die(__('Sorry, you are not allowed to edit the links for this site.')); |
|
13 | 13 | |
14 | 14 | $wp_list_table = _get_list_table('WP_Links_List_Table'); |
15 | 15 | |
16 | 16 | // Handle bulk deletes |
17 | 17 | $doaction = $wp_list_table->current_action(); |
18 | 18 | |
19 | -if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { |
|
20 | - check_admin_referer( 'bulk-bookmarks' ); |
|
19 | +if ($doaction && isset($_REQUEST['linkcheck'])) { |
|
20 | + check_admin_referer('bulk-bookmarks'); |
|
21 | 21 | |
22 | - $redirect_to = admin_url( 'link-manager.php' ); |
|
22 | + $redirect_to = admin_url('link-manager.php'); |
|
23 | 23 | $bulklinks = (array) $_REQUEST['linkcheck']; |
24 | 24 | |
25 | - if ( 'delete' == $doaction ) { |
|
26 | - foreach ( $bulklinks as $link_id ) { |
|
25 | + if ('delete' == $doaction) { |
|
26 | + foreach ($bulklinks as $link_id) { |
|
27 | 27 | $link_id = (int) $link_id; |
28 | 28 | |
29 | - wp_delete_link( $link_id ); |
|
29 | + wp_delete_link($link_id); |
|
30 | 30 | } |
31 | 31 | |
32 | - $redirect_to = add_query_arg( 'deleted', count( $bulklinks ), $redirect_to ); |
|
32 | + $redirect_to = add_query_arg('deleted', count($bulklinks), $redirect_to); |
|
33 | 33 | } else { |
34 | 34 | /** This action is documented in wp-admin/edit-comments.php */ |
35 | - $redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $bulklinks ); |
|
35 | + $redirect_to = apply_filters('handle_bulk_actions-'.get_current_screen()->id, $redirect_to, $doaction, $bulklinks); |
|
36 | 36 | } |
37 | - wp_redirect( $redirect_to ); |
|
37 | + wp_redirect($redirect_to); |
|
38 | 38 | exit; |
39 | -} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
40 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
39 | +} elseif ( ! empty($_GET['_wp_http_referer'])) { |
|
40 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
41 | 41 | exit; |
42 | 42 | } |
43 | 43 | |
@@ -46,56 +46,56 @@ discard block |
||
46 | 46 | $title = __('Links'); |
47 | 47 | $this_file = $parent_file = 'link-manager.php'; |
48 | 48 | |
49 | -get_current_screen()->add_help_tab( array( |
|
49 | +get_current_screen()->add_help_tab(array( |
|
50 | 50 | 'id' => 'overview', |
51 | 51 | 'title' => __('Overview'), |
52 | 52 | 'content' => |
53 | - '<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' . |
|
54 | - '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' . |
|
55 | - '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>' |
|
56 | -) ); |
|
57 | -get_current_screen()->add_help_tab( array( |
|
53 | + '<p>'.sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php').'</p>'. |
|
54 | + '<p>'.__('Links may be separated into Link Categories; these are different than the categories used on your posts.').'</p>'. |
|
55 | + '<p>'.__('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.').'</p>' |
|
56 | +)); |
|
57 | +get_current_screen()->add_help_tab(array( |
|
58 | 58 | 'id' => 'deleting-links', |
59 | 59 | 'title' => __('Deleting Links'), |
60 | 60 | 'content' => |
61 | - '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>' |
|
62 | -) ); |
|
61 | + '<p>'.__('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.').'</p>' |
|
62 | +)); |
|
63 | 63 | |
64 | 64 | get_current_screen()->set_help_sidebar( |
65 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
66 | - '<p>' . __('<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>') . '</p>' . |
|
67 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
65 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
66 | + '<p>'.__('<a href="https://codex.wordpress.org/Links_Screen">Documentation on Managing Links</a>').'</p>'. |
|
67 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
68 | 68 | ); |
69 | 69 | |
70 | -get_current_screen()->set_screen_reader_content( array( |
|
71 | - 'heading_list' => __( 'Links list' ), |
|
72 | -) ); |
|
70 | +get_current_screen()->set_screen_reader_content(array( |
|
71 | + 'heading_list' => __('Links list'), |
|
72 | +)); |
|
73 | 73 | |
74 | -include_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
74 | +include_once(ABSPATH.'wp-admin/admin-header.php'); |
|
75 | 75 | |
76 | -if ( ! current_user_can('manage_links') ) |
|
76 | +if ( ! current_user_can('manage_links')) |
|
77 | 77 | wp_die(__('Sorry, you are not allowed to edit the links for this site.')); |
78 | 78 | |
79 | 79 | ?> |
80 | 80 | |
81 | 81 | <div class="wrap nosubsub"> |
82 | 82 | <h1 class="wp-heading-inline"><?php |
83 | -echo esc_html( $title ); |
|
83 | +echo esc_html($title); |
|
84 | 84 | ?></h1> |
85 | 85 | |
86 | -<a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a> |
|
86 | +<a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> |
|
87 | 87 | |
88 | 88 | <?php |
89 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
89 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
90 | 90 | /* translators: %s: search keywords */ |
91 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); |
|
91 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html(wp_unslash($_REQUEST['s']))); |
|
92 | 92 | } |
93 | 93 | ?> |
94 | 94 | |
95 | 95 | <hr class="wp-header-end"> |
96 | 96 | |
97 | 97 | <?php |
98 | -if ( isset($_REQUEST['deleted']) ) { |
|
98 | +if (isset($_REQUEST['deleted'])) { |
|
99 | 99 | echo '<div id="message" class="updated notice is-dismissible"><p>'; |
100 | 100 | $deleted = (int) $_REQUEST['deleted']; |
101 | 101 | printf(_n('%s link deleted.', '%s links deleted', $deleted), $deleted); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | <form id="posts-filter" method="get"> |
108 | 108 | |
109 | -<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?> |
|
109 | +<?php $wp_list_table->search_box(__('Search Links'), 'link'); ?> |
|
110 | 110 | |
111 | 111 | <?php $wp_list_table->display(); ?> |
112 | 112 | |
@@ -116,4 +116,4 @@ discard block |
||
116 | 116 | </div> |
117 | 117 | |
118 | 118 | <?php |
119 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
119 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,23 +7,23 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! current_user_can('manage_links') ) |
|
12 | +if ( ! current_user_can('manage_links')) |
|
13 | 13 | wp_die(__('You do not have sufficient permissions to add links to this site.')); |
14 | 14 | |
15 | 15 | $title = __('Add New Link'); |
16 | 16 | $parent_file = 'link-manager.php'; |
17 | 17 | |
18 | -wp_reset_vars( array('action', 'cat_id', 'link_id' ) ); |
|
18 | +wp_reset_vars(array('action', 'cat_id', 'link_id')); |
|
19 | 19 | |
20 | 20 | wp_enqueue_script('link'); |
21 | 21 | wp_enqueue_script('xfn'); |
22 | 22 | |
23 | -if ( wp_is_mobile() ) |
|
24 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
23 | +if (wp_is_mobile()) |
|
24 | + wp_enqueue_script('jquery-touch-punch'); |
|
25 | 25 | |
26 | 26 | $link = get_default_link_to_edit(); |
27 | -include( ABSPATH . 'wp-admin/edit-link-form.php' ); |
|
27 | +include(ABSPATH.'wp-admin/edit-link-form.php'); |
|
28 | 28 | |
29 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
29 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! current_user_can('manage_links') ) |
|
12 | +if ( ! current_user_can('manage_links') ) { |
|
13 | 13 | wp_die(__('You do not have sufficient permissions to add links to this site.')); |
14 | +} |
|
14 | 15 | |
15 | 16 | $title = __('Add New Link'); |
16 | 17 | $parent_file = 'link-manager.php'; |
@@ -20,8 +21,9 @@ discard block |
||
20 | 21 | wp_enqueue_script('link'); |
21 | 22 | wp_enqueue_script('xfn'); |
22 | 23 | |
23 | -if ( wp_is_mobile() ) |
|
24 | +if ( wp_is_mobile() ) { |
|
24 | 25 | wp_enqueue_script( 'jquery-touch-punch' ); |
26 | +} |
|
25 | 27 | |
26 | 28 | $link = get_default_link_to_edit(); |
27 | 29 | include( ABSPATH . 'wp-admin/edit-link-form.php' ); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_redirect( network_admin_url('themes.php') ); |
|
12 | +wp_redirect(network_admin_url('themes.php')); |
|
13 | 13 | exit; |
@@ -6,16 +6,18 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | // TODO route this pages via a specific iframe handler instead of the do_action below |
9 | -if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
9 | +if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) { |
|
10 | 10 | define( 'IFRAME_REQUEST', true ); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * WordPress Administration Bootstrap. |
14 | 15 | */ |
15 | 16 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
16 | 17 | |
17 | -if ( ! current_user_can('install_plugins') ) |
|
18 | +if ( ! current_user_can('install_plugins') ) { |
|
18 | 19 | wp_die(__('You do not have sufficient permissions to install plugins on this site.')); |
20 | +} |
|
19 | 21 | |
20 | 22 | if ( is_multisite() && ! is_network_admin() ) { |
21 | 23 | wp_redirect( network_admin_url( 'plugin-install.php' ) ); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | $parent_file = 'plugins.php'; |
50 | 52 | |
51 | 53 | wp_enqueue_script( 'plugin-install' ); |
52 | -if ( 'plugin-information' != $tab ) |
|
54 | +if ( 'plugin-information' != $tab ) { |
|
53 | 55 | add_thickbox(); |
56 | +} |
|
54 | 57 | |
55 | 58 | $body_id = $tab; |
56 | 59 |
@@ -6,55 +6,55 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | // TODO route this pages via a specific iframe handler instead of the do_action below |
9 | -if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
10 | - define( 'IFRAME_REQUEST', true ); |
|
9 | +if ( ! defined('IFRAME_REQUEST') && isset($_GET['tab']) && ('plugin-information' == $_GET['tab'])) |
|
10 | + define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * WordPress Administration Bootstrap. |
14 | 14 | */ |
15 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
15 | +require_once(dirname(__FILE__).'/admin.php'); |
|
16 | 16 | |
17 | -if ( ! current_user_can('install_plugins') ) |
|
17 | +if ( ! current_user_can('install_plugins')) |
|
18 | 18 | wp_die(__('Sorry, you are not allowed to install plugins on this site.')); |
19 | 19 | |
20 | -if ( is_multisite() && ! is_network_admin() ) { |
|
21 | - wp_redirect( network_admin_url( 'plugin-install.php' ) ); |
|
20 | +if (is_multisite() && ! is_network_admin()) { |
|
21 | + wp_redirect(network_admin_url('plugin-install.php')); |
|
22 | 22 | exit(); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); |
26 | 26 | $pagenum = $wp_list_table->get_pagenum(); |
27 | 27 | |
28 | -if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
29 | - $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
28 | +if ( ! empty($_REQUEST['_wp_http_referer'])) { |
|
29 | + $location = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
30 | 30 | |
31 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
32 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
31 | + if ( ! empty($_REQUEST['paged'])) { |
|
32 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
33 | 33 | } |
34 | 34 | |
35 | - wp_redirect( $location ); |
|
35 | + wp_redirect($location); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $wp_list_table->prepare_items(); |
40 | 40 | |
41 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
41 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
42 | 42 | |
43 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
44 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
43 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
44 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
45 | 45 | exit; |
46 | 46 | } |
47 | 47 | |
48 | -$title = __( 'Add Plugins' ); |
|
48 | +$title = __('Add Plugins'); |
|
49 | 49 | $parent_file = 'plugins.php'; |
50 | 50 | |
51 | -wp_enqueue_script( 'plugin-install' ); |
|
52 | -if ( 'plugin-information' != $tab ) |
|
51 | +wp_enqueue_script('plugin-install'); |
|
52 | +if ('plugin-information' != $tab) |
|
53 | 53 | add_thickbox(); |
54 | 54 | |
55 | 55 | $body_id = $tab; |
56 | 56 | |
57 | -wp_enqueue_script( 'updates' ); |
|
57 | +wp_enqueue_script('updates'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Fires before each tab on the Install Plugins screen is loaded. |
@@ -64,63 +64,63 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 2.7.0 |
66 | 66 | */ |
67 | -do_action( "install_plugins_pre_{$tab}" ); |
|
67 | +do_action("install_plugins_pre_{$tab}"); |
|
68 | 68 | |
69 | 69 | /* |
70 | 70 | * Call the pre upload action on every non-upload plugin install screen |
71 | 71 | * because the form is always displayed on these screens. |
72 | 72 | */ |
73 | -if ( 'upload' !== $tab ) { |
|
73 | +if ('upload' !== $tab) { |
|
74 | 74 | /** This action is documented in wp-admin/plugin-install.php */ |
75 | - do_action( 'install_plugins_pre_upload' ); |
|
75 | + do_action('install_plugins_pre_upload'); |
|
76 | 76 | } |
77 | 77 | |
78 | -get_current_screen()->add_help_tab( array( |
|
78 | +get_current_screen()->add_help_tab(array( |
|
79 | 79 | 'id' => 'overview', |
80 | 80 | 'title' => __('Overview'), |
81 | 81 | 'content' => |
82 | - '<p>' . sprintf( __('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s">WordPress Plugin Directory</a> are compatible with the license WordPress uses.' ), __( 'https://wordpress.org/plugins/' ) ) . '</p>' . |
|
83 | - '<p>' . __( 'You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.' ) . ' <span id="live-search-desc" class="hide-if-no-js">' . __( 'The search results will be updated as you type.' ) . '</span></p>' |
|
82 | + '<p>'.sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s">WordPress Plugin Directory</a> are compatible with the license WordPress uses.'), __('https://wordpress.org/plugins/')).'</p>'. |
|
83 | + '<p>'.__('You can find new plugins to install by searching or browsing the directory right here in your own Plugins section.').' <span id="live-search-desc" class="hide-if-no-js">'.__('The search results will be updated as you type.').'</span></p>' |
|
84 | 84 | |
85 | -) ); |
|
86 | -get_current_screen()->add_help_tab( array( |
|
85 | +)); |
|
86 | +get_current_screen()->add_help_tab(array( |
|
87 | 87 | 'id' => 'adding-plugins', |
88 | 88 | 'title' => __('Adding Plugins'), |
89 | 89 | 'content' => |
90 | - '<p>' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' . |
|
91 | - '<p>' . __( 'If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.' ) . '</p>' . |
|
92 | - '<p>' . __( 'You can also browse a user’s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.' ) . '</p>' . |
|
93 | - '<p>' . __( 'If you want to install a plugin that you’ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.' ) . '</p>' |
|
94 | -) ); |
|
90 | + '<p>'.__('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.').'</p>'. |
|
91 | + '<p>'.__('If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links above the plugins list. These sections rotate regularly.').'</p>'. |
|
92 | + '<p>'.__('You can also browse a user’s favorite plugins, by using the Favorites link above the plugins list and entering their WordPress.org username.').'</p>'. |
|
93 | + '<p>'.__('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload Plugin button above the plugins list. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.').'</p>' |
|
94 | +)); |
|
95 | 95 | |
96 | 96 | get_current_screen()->set_help_sidebar( |
97 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
98 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen">Documentation on Installing Plugins</a>') . '</p>' . |
|
99 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
97 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
98 | + '<p>'.__('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen">Documentation on Installing Plugins</a>').'</p>'. |
|
99 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
100 | 100 | ); |
101 | 101 | |
102 | -get_current_screen()->set_screen_reader_content( array( |
|
103 | - 'heading_views' => __( 'Filter plugins list' ), |
|
104 | - 'heading_pagination' => __( 'Plugins list navigation' ), |
|
105 | - 'heading_list' => __( 'Plugins list' ), |
|
106 | -) ); |
|
102 | +get_current_screen()->set_screen_reader_content(array( |
|
103 | + 'heading_views' => __('Filter plugins list'), |
|
104 | + 'heading_pagination' => __('Plugins list navigation'), |
|
105 | + 'heading_list' => __('Plugins list'), |
|
106 | +)); |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * WordPress Administration Template Header. |
110 | 110 | */ |
111 | -include(ABSPATH . 'wp-admin/admin-header.php'); |
|
111 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
112 | 112 | ?> |
113 | -<div class="wrap <?php echo esc_attr( "plugin-install-tab-$tab" ); ?>"> |
|
113 | +<div class="wrap <?php echo esc_attr("plugin-install-tab-$tab"); ?>"> |
|
114 | 114 | <h1 class="wp-heading-inline"><?php |
115 | -echo esc_html( $title ); |
|
115 | +echo esc_html($title); |
|
116 | 116 | ?></h1> |
117 | 117 | |
118 | 118 | <?php |
119 | -if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) { |
|
120 | - printf( ' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>', |
|
121 | - ( 'upload' === $tab ) ? self_admin_url( 'plugin-install.php' ) : self_admin_url( 'plugin-install.php?tab=upload' ), |
|
122 | - __( 'Upload Plugin' ), |
|
123 | - __( 'Browse Plugins' ) |
|
119 | +if ( ! empty($tabs['upload']) && current_user_can('upload_plugins')) { |
|
120 | + printf(' <a href="%s" class="upload-view-toggle page-title-action"><span class="upload">%s</span><span class="browse">%s</span></a>', |
|
121 | + ('upload' === $tab) ? self_admin_url('plugin-install.php') : self_admin_url('plugin-install.php?tab=upload'), |
|
122 | + __('Upload Plugin'), |
|
123 | + __('Browse Plugins') |
|
124 | 124 | ); |
125 | 125 | } |
126 | 126 | ?> |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | * Output the upload plugin form on every non-upload plugin install screen, so it can be |
133 | 133 | * displayed via JavaScript rather then opening up the devoted upload plugin page. |
134 | 134 | */ |
135 | -if ( 'upload' !== $tab ) { |
|
135 | +if ('upload' !== $tab) { |
|
136 | 136 | ?> |
137 | 137 | <div class="upload-plugin-wrap"> |
138 | 138 | <?php |
139 | 139 | /** This action is documented in wp-admin/plugin-install.php */ |
140 | - do_action( 'install_plugins_upload' ); |
|
140 | + do_action('install_plugins_upload'); |
|
141 | 141 | ?> |
142 | 142 | </div> |
143 | 143 | <?php |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @param int $paged The current page number of the plugins list table. |
157 | 157 | */ |
158 | -do_action( "install_plugins_{$tab}", $paged ); ?> |
|
158 | +do_action("install_plugins_{$tab}", $paged); ?> |
|
159 | 159 | |
160 | 160 | <span class="spinner"></span> |
161 | 161 | </div> |
@@ -167,4 +167,4 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * WordPress Administration Template Footer. |
169 | 169 | */ |
170 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
170 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -13,35 +13,35 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @since 2.1.0 |
15 | 15 | */ |
16 | -define( 'DOING_AJAX', true ); |
|
17 | -if ( ! defined( 'WP_ADMIN' ) ) { |
|
18 | - define( 'WP_ADMIN', true ); |
|
16 | +define('DOING_AJAX', true); |
|
17 | +if ( ! defined('WP_ADMIN')) { |
|
18 | + define('WP_ADMIN', true); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** Load WordPress Bootstrap */ |
22 | -require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
22 | +require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
23 | 23 | |
24 | 24 | /** Allow for cross-domain requests (from the frontend). */ |
25 | 25 | send_origin_headers(); |
26 | 26 | |
27 | 27 | // Require an action parameter |
28 | -if ( empty( $_REQUEST['action'] ) ) |
|
29 | - die( '0' ); |
|
28 | +if (empty($_REQUEST['action'])) |
|
29 | + die('0'); |
|
30 | 30 | |
31 | 31 | /** Load WordPress Administration APIs */ |
32 | -require_once( ABSPATH . 'wp-admin/includes/admin.php' ); |
|
32 | +require_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
33 | 33 | |
34 | 34 | /** Load Ajax Handlers for WordPress Core */ |
35 | -require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' ); |
|
35 | +require_once(ABSPATH.'wp-admin/includes/ajax-actions.php'); |
|
36 | 36 | |
37 | -@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
38 | -@header( 'X-Robots-Tag: noindex' ); |
|
37 | +@header('Content-Type: text/html; charset='.get_option('blog_charset')); |
|
38 | +@header('X-Robots-Tag: noindex'); |
|
39 | 39 | |
40 | 40 | send_nosniff_header(); |
41 | 41 | nocache_headers(); |
42 | 42 | |
43 | 43 | /** This action is documented in wp-admin/admin.php */ |
44 | -do_action( 'admin_init' ); |
|
44 | +do_action('admin_init'); |
|
45 | 45 | |
46 | 46 | $core_actions_get = array( |
47 | 47 | 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache', |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | $core_actions_post[] = 'wp-fullscreen-save-post'; |
70 | 70 | |
71 | 71 | // Register core Ajax calls. |
72 | -if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) |
|
73 | - add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
|
72 | +if ( ! empty($_GET['action']) && in_array($_GET['action'], $core_actions_get)) |
|
73 | + add_action('wp_ajax_'.$_GET['action'], 'wp_ajax_'.str_replace('-', '_', $_GET['action']), 1); |
|
74 | 74 | |
75 | -if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) |
|
76 | - add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); |
|
75 | +if ( ! empty($_POST['action']) && in_array($_POST['action'], $core_actions_post)) |
|
76 | + add_action('wp_ajax_'.$_POST['action'], 'wp_ajax_'.str_replace('-', '_', $_POST['action']), 1); |
|
77 | 77 | |
78 | -add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
|
78 | +add_action('wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1); |
|
79 | 79 | |
80 | -if ( is_user_logged_in() ) { |
|
80 | +if (is_user_logged_in()) { |
|
81 | 81 | /** |
82 | 82 | * Fires authenticated AJAX actions for logged-in users. |
83 | 83 | * |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 2.1.0 |
88 | 88 | */ |
89 | - do_action( 'wp_ajax_' . $_REQUEST['action'] ); |
|
89 | + do_action('wp_ajax_'.$_REQUEST['action']); |
|
90 | 90 | } else { |
91 | 91 | /** |
92 | 92 | * Fires non-authenticated AJAX actions for logged-out users. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @since 2.8.0 |
98 | 98 | */ |
99 | - do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); |
|
99 | + do_action('wp_ajax_nopriv_'.$_REQUEST['action']); |
|
100 | 100 | } |
101 | 101 | // Default status |
102 | -die( '0' ); |
|
102 | +die('0'); |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | send_origin_headers(); |
26 | 26 | |
27 | 27 | // Require an action parameter |
28 | -if ( empty( $_REQUEST['action'] ) ) |
|
28 | +if ( empty( $_REQUEST['action'] ) ) { |
|
29 | 29 | die( '0' ); |
30 | +} |
|
30 | 31 | |
31 | 32 | /** Load WordPress Administration APIs */ |
32 | 33 | require_once( ABSPATH . 'wp-admin/includes/admin.php' ); |
@@ -69,11 +70,13 @@ discard block |
||
69 | 70 | $core_actions_post[] = 'wp-fullscreen-save-post'; |
70 | 71 | |
71 | 72 | // Register core Ajax calls. |
72 | -if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) |
|
73 | +if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) { |
|
73 | 74 | add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
75 | +} |
|
74 | 76 | |
75 | -if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) |
|
77 | +if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) { |
|
76 | 78 | add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); |
79 | +} |
|
77 | 80 | |
78 | 81 | add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
79 | 82 |