@@ -48,14 +48,18 @@ discard block |
||
48 | 48 | |
49 | 49 | $args = array( 'hide_invisible' => 0, 'hide_empty' => 0 ); |
50 | 50 | |
51 | - if ( 'all' != $cat_id ) |
|
52 | - $args['category'] = $cat_id; |
|
53 | - if ( !empty( $s ) ) |
|
54 | - $args['search'] = $s; |
|
55 | - if ( !empty( $orderby ) ) |
|
56 | - $args['orderby'] = $orderby; |
|
57 | - if ( !empty( $order ) ) |
|
58 | - $args['order'] = $order; |
|
51 | + if ( 'all' != $cat_id ) { |
|
52 | + $args['category'] = $cat_id; |
|
53 | + } |
|
54 | + if ( !empty( $s ) ) { |
|
55 | + $args['search'] = $s; |
|
56 | + } |
|
57 | + if ( !empty( $orderby ) ) { |
|
58 | + $args['orderby'] = $orderby; |
|
59 | + } |
|
60 | + if ( !empty( $order ) ) { |
|
61 | + $args['order'] = $order; |
|
62 | + } |
|
59 | 63 | |
60 | 64 | $this->items = get_bookmarks( $args ); |
61 | 65 | } |
@@ -86,9 +90,10 @@ discard block |
||
86 | 90 | protected function extra_tablenav( $which ) { |
87 | 91 | global $cat_id; |
88 | 92 | |
89 | - if ( 'top' != $which ) |
|
90 | - return; |
|
91 | -?> |
|
93 | + if ( 'top' != $which ) { |
|
94 | + return; |
|
95 | + } |
|
96 | + ?> |
|
92 | 97 | <div class="alignleft actions"> |
93 | 98 | <?php |
94 | 99 | $dropdown_options = array( |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param array $args An associative array of arguments. |
29 | 29 | */ |
30 | - public function __construct( $args = array() ) { |
|
31 | - parent::__construct( array( |
|
30 | + public function __construct($args = array()) { |
|
31 | + parent::__construct(array( |
|
32 | 32 | 'plural' => 'bookmarks', |
33 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
34 | - ) ); |
|
33 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
34 | + )); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @return bool |
40 | 40 | */ |
41 | 41 | public function ajax_user_can() { |
42 | - return current_user_can( 'manage_links' ); |
|
42 | + return current_user_can('manage_links'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | public function prepare_items() { |
53 | 53 | global $cat_id, $s, $orderby, $order; |
54 | 54 | |
55 | - wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', 's' ) ); |
|
55 | + wp_reset_vars(array('action', 'cat_id', 'link_id', 'orderby', 'order', 's')); |
|
56 | 56 | |
57 | - $args = array( 'hide_invisible' => 0, 'hide_empty' => 0 ); |
|
57 | + $args = array('hide_invisible' => 0, 'hide_empty' => 0); |
|
58 | 58 | |
59 | - if ( 'all' != $cat_id ) |
|
59 | + if ('all' != $cat_id) |
|
60 | 60 | $args['category'] = $cat_id; |
61 | - if ( !empty( $s ) ) |
|
61 | + if ( ! empty($s)) |
|
62 | 62 | $args['search'] = $s; |
63 | - if ( !empty( $orderby ) ) |
|
63 | + if ( ! empty($orderby)) |
|
64 | 64 | $args['orderby'] = $orderby; |
65 | - if ( !empty( $order ) ) |
|
65 | + if ( ! empty($order)) |
|
66 | 66 | $args['order'] = $order; |
67 | 67 | |
68 | - $this->items = get_bookmarks( $args ); |
|
68 | + $this->items = get_bookmarks($args); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @access public |
73 | 73 | */ |
74 | 74 | public function no_items() { |
75 | - _e( 'No links found.' ); |
|
75 | + _e('No links found.'); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | protected function get_bulk_actions() { |
83 | 83 | $actions = array(); |
84 | - $actions['delete'] = __( 'Delete' ); |
|
84 | + $actions['delete'] = __('Delete'); |
|
85 | 85 | |
86 | 86 | return $actions; |
87 | 87 | } |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @global int $cat_id |
92 | 92 | * @param string $which |
93 | 93 | */ |
94 | - protected function extra_tablenav( $which ) { |
|
94 | + protected function extra_tablenav($which) { |
|
95 | 95 | global $cat_id; |
96 | 96 | |
97 | - if ( 'top' != $which ) |
|
97 | + if ('top' != $which) |
|
98 | 98 | return; |
99 | 99 | ?> |
100 | 100 | <div class="alignleft actions"> |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | 'selected' => $cat_id, |
104 | 104 | 'name' => 'cat_id', |
105 | 105 | 'taxonomy' => 'link_category', |
106 | - 'show_option_all' => get_taxonomy( 'link_category' )->labels->all_items, |
|
106 | + 'show_option_all' => get_taxonomy('link_category')->labels->all_items, |
|
107 | 107 | 'hide_empty' => true, |
108 | 108 | 'hierarchical' => 1, |
109 | 109 | 'show_count' => 0, |
110 | 110 | 'orderby' => 'name', |
111 | 111 | ); |
112 | 112 | |
113 | - echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>'; |
|
114 | - wp_dropdown_categories( $dropdown_options ); |
|
115 | - submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
|
113 | + echo '<label class="screen-reader-text" for="cat_id">'.__('Filter by category').'</label>'; |
|
114 | + wp_dropdown_categories($dropdown_options); |
|
115 | + submit_button(__('Filter'), '', 'filter_action', false, array('id' => 'post-query-submit')); |
|
116 | 116 | ?> |
117 | 117 | </div> |
118 | 118 | <?php |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | public function get_columns() { |
126 | 126 | return array( |
127 | 127 | 'cb' => '<input type="checkbox" />', |
128 | - 'name' => _x( 'Name', 'link name' ), |
|
129 | - 'url' => __( 'URL' ), |
|
130 | - 'categories' => __( 'Categories' ), |
|
131 | - 'rel' => __( 'Relationship' ), |
|
132 | - 'visible' => __( 'Visible' ), |
|
133 | - 'rating' => __( 'Rating' ) |
|
128 | + 'name' => _x('Name', 'link name'), |
|
129 | + 'url' => __('URL'), |
|
130 | + 'categories' => __('Categories'), |
|
131 | + 'rel' => __('Relationship'), |
|
132 | + 'visible' => __('Visible'), |
|
133 | + 'rating' => __('Rating') |
|
134 | 134 | ); |
135 | 135 | } |
136 | 136 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param object $link The current link object. |
169 | 169 | */ |
170 | - public function column_cb( $link ) { |
|
170 | + public function column_cb($link) { |
|
171 | 171 | ?> |
172 | - <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label> |
|
173 | - <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" /> |
|
172 | + <label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf(__('Select %s'), $link->link_name); ?></label> |
|
173 | + <input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr($link->link_id); ?>" /> |
|
174 | 174 | <?php |
175 | 175 | } |
176 | 176 | |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @param object $link The current link object. |
184 | 184 | */ |
185 | - public function column_name( $link ) { |
|
186 | - $edit_link = get_edit_bookmark_link( $link ); |
|
187 | - printf( '<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong>', |
|
185 | + public function column_name($link) { |
|
186 | + $edit_link = get_edit_bookmark_link($link); |
|
187 | + printf('<strong><a class="row-title" href="%s" aria-label="%s">%s</a></strong>', |
|
188 | 188 | $edit_link, |
189 | 189 | /* translators: %s: link name */ |
190 | - esc_attr( sprintf( __( 'Edit “%s”' ), $link->link_name ) ), |
|
190 | + esc_attr(sprintf(__('Edit “%s”'), $link->link_name)), |
|
191 | 191 | $link->link_name |
192 | 192 | ); |
193 | 193 | } |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @param object $link The current link object. |
202 | 202 | */ |
203 | - public function column_url( $link ) { |
|
204 | - $short_url = url_shorten( $link->link_url ); |
|
203 | + public function column_url($link) { |
|
204 | + $short_url = url_shorten($link->link_url); |
|
205 | 205 | echo "<a href='$link->link_url'>$short_url</a>"; |
206 | 206 | } |
207 | 207 | |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @param object $link The current link object. |
217 | 217 | */ |
218 | - public function column_categories( $link ) { |
|
218 | + public function column_categories($link) { |
|
219 | 219 | global $cat_id; |
220 | 220 | |
221 | 221 | $cat_names = array(); |
222 | - foreach ( $link->link_category as $category ) { |
|
223 | - $cat = get_term( $category, 'link_category', OBJECT, 'display' ); |
|
224 | - if ( is_wp_error( $cat ) ) { |
|
222 | + foreach ($link->link_category as $category) { |
|
223 | + $cat = get_term($category, 'link_category', OBJECT, 'display'); |
|
224 | + if (is_wp_error($cat)) { |
|
225 | 225 | echo $cat->get_error_message(); |
226 | 226 | } |
227 | 227 | $cat_name = $cat->name; |
228 | - if ( $cat_id != $category ) { |
|
228 | + if ($cat_id != $category) { |
|
229 | 229 | $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; |
230 | 230 | } |
231 | 231 | $cat_names[] = $cat_name; |
232 | 232 | } |
233 | - echo implode( ', ', $cat_names ); |
|
233 | + echo implode(', ', $cat_names); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param object $link The current link object. |
243 | 243 | */ |
244 | - public function column_rel( $link ) { |
|
245 | - echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; |
|
244 | + public function column_rel($link) { |
|
245 | + echo empty($link->link_rel) ? '<br />' : $link->link_rel; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param object $link The current link object. |
255 | 255 | */ |
256 | - public function column_visible( $link ) { |
|
257 | - if ( 'Y' === $link->link_visible ) { |
|
258 | - _e( 'Yes' ); |
|
256 | + public function column_visible($link) { |
|
257 | + if ('Y' === $link->link_visible) { |
|
258 | + _e('Yes'); |
|
259 | 259 | } else { |
260 | - _e( 'No' ); |
|
260 | + _e('No'); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @param object $link The current link object. |
271 | 271 | */ |
272 | - public function column_rating( $link ) { |
|
272 | + public function column_rating($link) { |
|
273 | 273 | echo $link->link_rating; |
274 | 274 | } |
275 | 275 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param object $link Link object. |
283 | 283 | * @param string $column_name Current column name. |
284 | 284 | */ |
285 | - public function column_default( $link, $column_name ) { |
|
285 | + public function column_default($link, $column_name) { |
|
286 | 286 | /** |
287 | 287 | * Fires for each registered custom link column. |
288 | 288 | * |
@@ -291,17 +291,17 @@ discard block |
||
291 | 291 | * @param string $column_name Name of the custom column. |
292 | 292 | * @param int $link_id Link ID. |
293 | 293 | */ |
294 | - do_action( 'manage_link_custom_column', $column_name, $link->link_id ); |
|
294 | + do_action('manage_link_custom_column', $column_name, $link->link_id); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | public function display_rows() { |
298 | - foreach ( $this->items as $link ) { |
|
299 | - $link = sanitize_bookmark( $link ); |
|
300 | - $link->link_name = esc_attr( $link->link_name ); |
|
301 | - $link->link_category = wp_get_link_cats( $link->link_id ); |
|
298 | + foreach ($this->items as $link) { |
|
299 | + $link = sanitize_bookmark($link); |
|
300 | + $link->link_name = esc_attr($link->link_name); |
|
301 | + $link->link_category = wp_get_link_cats($link->link_id); |
|
302 | 302 | ?> |
303 | 303 | <tr id="link-<?php echo $link->link_id; ?>"> |
304 | - <?php $this->single_row_columns( $link ) ?> |
|
304 | + <?php $this->single_row_columns($link) ?> |
|
305 | 305 | </tr> |
306 | 306 | <?php |
307 | 307 | } |
@@ -318,16 +318,16 @@ discard block |
||
318 | 318 | * @param string $primary Primary column name. |
319 | 319 | * @return string Row action output for links. |
320 | 320 | */ |
321 | - protected function handle_row_actions( $link, $column_name, $primary ) { |
|
322 | - if ( $primary !== $column_name ) { |
|
321 | + protected function handle_row_actions($link, $column_name, $primary) { |
|
322 | + if ($primary !== $column_name) { |
|
323 | 323 | return ''; |
324 | 324 | } |
325 | 325 | |
326 | - $edit_link = get_edit_bookmark_link( $link ); |
|
326 | + $edit_link = get_edit_bookmark_link($link); |
|
327 | 327 | |
328 | 328 | $actions = array(); |
329 | - $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; |
|
330 | - $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>"; |
|
331 | - return $this->row_actions( $actions ); |
|
329 | + $actions['edit'] = '<a href="'.$edit_link.'">'.__('Edit').'</a>'; |
|
330 | + $actions['delete'] = "<a class='submitdelete' href='".wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_'.$link->link_id)."' onclick=\"if ( confirm( '".esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name))."' ) ) { return true;}return false;\">".__('Delete')."</a>"; |
|
331 | + return $this->row_actions($actions); |
|
332 | 332 | } |
333 | 333 | } |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); |
60 | 60 | return FALSE; |
61 | 61 | } |
62 | - if(!$this->_settimeout($sock)) return FALSE; |
|
62 | + if(!$this->_settimeout($sock)) { |
|
63 | + return FALSE; |
|
64 | + } |
|
63 | 65 | $this->SendMSG("Connecting to \"".$host.":".$port."\""); |
64 | 66 | if (!($res = @socket_connect($sock, $host, $port))) { |
65 | 67 | $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); |
@@ -89,7 +91,9 @@ discard block |
||
89 | 91 | $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); |
90 | 92 | } |
91 | 93 | } while($go); |
92 | - if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
94 | + if($this->LocalEcho) { |
|
95 | + echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
96 | + } |
|
93 | 97 | $this->_code=(int)$regs[1]; |
94 | 98 | return $result; |
95 | 99 | } |
@@ -99,19 +103,25 @@ discard block |
||
99 | 103 | $this->PushError($fnction,'Connect first'); |
100 | 104 | return FALSE; |
101 | 105 | } |
102 | - if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
106 | + if($this->LocalEcho) { |
|
107 | + echo "PUT > ",$cmd,CRLF; |
|
108 | + } |
|
103 | 109 | $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); |
104 | 110 | if($status===false) { |
105 | 111 | $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); |
106 | 112 | return FALSE; |
107 | 113 | } |
108 | 114 | $this->_lastaction=time(); |
109 | - if(!$this->_readmsg($fnction)) return FALSE; |
|
115 | + if(!$this->_readmsg($fnction)) { |
|
116 | + return FALSE; |
|
117 | + } |
|
110 | 118 | return TRUE; |
111 | 119 | } |
112 | 120 | |
113 | 121 | function _data_prepare($mode=FTP_ASCII) { |
114 | - if(!$this->_settype($mode)) return FALSE; |
|
122 | + if(!$this->_settype($mode)) { |
|
123 | + return FALSE; |
|
124 | + } |
|
115 | 125 | $this->SendMSG("Creating data socket"); |
116 | 126 | $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
117 | 127 | if ($this->_ftp_data_sock < 0) { |
@@ -139,8 +149,9 @@ discard block |
||
139 | 149 | $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
140 | 150 | $this->_data_close(); |
141 | 151 | return FALSE; |
152 | + } else { |
|
153 | + $this->_ftp_temp_sock=$this->_ftp_data_sock; |
|
142 | 154 | } |
143 | - else $this->_ftp_temp_sock=$this->_ftp_data_sock; |
|
144 | 155 | } else { |
145 | 156 | if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { |
146 | 157 | $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); |
@@ -176,8 +187,11 @@ discard block |
||
176 | 187 | |
177 | 188 | function _data_read($mode=FTP_ASCII, $fp=NULL) { |
178 | 189 | $NewLine=$this->_eol_code[$this->OS_local]; |
179 | - if(is_resource($fp)) $out=0; |
|
180 | - else $out=""; |
|
190 | + if(is_resource($fp)) { |
|
191 | + $out=0; |
|
192 | + } else { |
|
193 | + $out=""; |
|
194 | + } |
|
181 | 195 | if(!$this->_passive) { |
182 | 196 | $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
183 | 197 | $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); |
@@ -189,18 +203,28 @@ discard block |
||
189 | 203 | } |
190 | 204 | |
191 | 205 | while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) { |
192 | - if($block==="") break; |
|
193 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
194 | - if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
195 | - else $out.=$block; |
|
206 | + if($block==="") { |
|
207 | + break; |
|
208 | + } |
|
209 | + if($mode!=FTP_BINARY) { |
|
210 | + $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
211 | + } |
|
212 | + if(is_resource($fp)) { |
|
213 | + $out+=fwrite($fp, $block, strlen($block)); |
|
214 | + } else { |
|
215 | + $out.=$block; |
|
216 | + } |
|
196 | 217 | } |
197 | 218 | return $out; |
198 | 219 | } |
199 | 220 | |
200 | 221 | function _data_write($mode=FTP_ASCII, $fp=NULL) { |
201 | 222 | $NewLine=$this->_eol_code[$this->OS_local]; |
202 | - if(is_resource($fp)) $out=0; |
|
203 | - else $out=""; |
|
223 | + if(is_resource($fp)) { |
|
224 | + $out=0; |
|
225 | + } else { |
|
226 | + $out=""; |
|
227 | + } |
|
204 | 228 | if(!$this->_passive) { |
205 | 229 | $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
206 | 230 | $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); |
@@ -213,14 +237,20 @@ discard block |
||
213 | 237 | if(is_resource($fp)) { |
214 | 238 | while(!feof($fp)) { |
215 | 239 | $block=fread($fp, $this->_ftp_buff_size); |
216 | - if(!$this->_data_write_block($mode, $block)) return false; |
|
240 | + if(!$this->_data_write_block($mode, $block)) { |
|
241 | + return false; |
|
242 | + } |
|
217 | 243 | } |
218 | - } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
244 | + } elseif(!$this->_data_write_block($mode, $fp)) { |
|
245 | + return false; |
|
246 | + } |
|
219 | 247 | return true; |
220 | 248 | } |
221 | 249 | |
222 | 250 | function _data_write_block($mode, $block) { |
223 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
251 | + if($mode!=FTP_BINARY) { |
|
252 | + $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
253 | + } |
|
224 | 254 | do { |
225 | 255 | if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) { |
226 | 256 | $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | class ftp_sockets extends ftp_base { |
29 | 29 | |
30 | - function __construct($verb=FALSE, $le=FALSE) { |
|
30 | + function __construct($verb = FALSE, $le = FALSE) { |
|
31 | 31 | parent::__construct(true, $verb, $le); |
32 | 32 | } |
33 | 33 | |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | // <!-- --------------------------------------------------------------------------------------- --> |
37 | 37 | |
38 | 38 | function _settimeout($sock) { |
39 | - if(!@socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { |
|
40 | - $this->PushError('_connect','socket set receive timeout',socket_strerror(socket_last_error($sock))); |
|
39 | + if ( ! @socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { |
|
40 | + $this->PushError('_connect', 'socket set receive timeout', socket_strerror(socket_last_error($sock))); |
|
41 | 41 | @socket_close($sock); |
42 | 42 | return FALSE; |
43 | 43 | } |
44 | - if(!@socket_set_option($sock, SOL_SOCKET , SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { |
|
45 | - $this->PushError('_connect','socket set send timeout',socket_strerror(socket_last_error($sock))); |
|
44 | + if ( ! @socket_set_option($sock, SOL_SOCKET, SO_SNDTIMEO, array("sec"=>$this->_timeout, "usec"=>0))) { |
|
45 | + $this->PushError('_connect', 'socket set send timeout', socket_strerror(socket_last_error($sock))); |
|
46 | 46 | @socket_close($sock); |
47 | 47 | return FALSE; |
48 | 48 | } |
@@ -51,118 +51,118 @@ discard block |
||
51 | 51 | |
52 | 52 | function _connect($host, $port) { |
53 | 53 | $this->SendMSG("Creating socket"); |
54 | - if(!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { |
|
55 | - $this->PushError('_connect','socket create failed',socket_strerror(socket_last_error($sock))); |
|
54 | + if ( ! ($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) { |
|
55 | + $this->PushError('_connect', 'socket create failed', socket_strerror(socket_last_error($sock))); |
|
56 | 56 | return FALSE; |
57 | 57 | } |
58 | - if(!$this->_settimeout($sock)) return FALSE; |
|
58 | + if ( ! $this->_settimeout($sock)) return FALSE; |
|
59 | 59 | $this->SendMSG("Connecting to \"".$host.":".$port."\""); |
60 | - if (!($res = @socket_connect($sock, $host, $port))) { |
|
61 | - $this->PushError('_connect','socket connect failed',socket_strerror(socket_last_error($sock))); |
|
60 | + if ( ! ($res = @socket_connect($sock, $host, $port))) { |
|
61 | + $this->PushError('_connect', 'socket connect failed', socket_strerror(socket_last_error($sock))); |
|
62 | 62 | @socket_close($sock); |
63 | 63 | return FALSE; |
64 | 64 | } |
65 | - $this->_connected=true; |
|
65 | + $this->_connected = true; |
|
66 | 66 | return $sock; |
67 | 67 | } |
68 | 68 | |
69 | - function _readmsg($fnction="_readmsg"){ |
|
70 | - if(!$this->_connected) { |
|
71 | - $this->PushError($fnction,'Connect first'); |
|
69 | + function _readmsg($fnction = "_readmsg") { |
|
70 | + if ( ! $this->_connected) { |
|
71 | + $this->PushError($fnction, 'Connect first'); |
|
72 | 72 | return FALSE; |
73 | 73 | } |
74 | - $result=true; |
|
75 | - $this->_message=""; |
|
76 | - $this->_code=0; |
|
77 | - $go=true; |
|
74 | + $result = true; |
|
75 | + $this->_message = ""; |
|
76 | + $this->_code = 0; |
|
77 | + $go = true; |
|
78 | 78 | do { |
79 | - $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); |
|
80 | - if($tmp===false) { |
|
81 | - $go=$result=false; |
|
82 | - $this->PushError($fnction,'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); |
|
79 | + $tmp = @socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ); |
|
80 | + if ($tmp === false) { |
|
81 | + $go = $result = false; |
|
82 | + $this->PushError($fnction, 'Read failed', socket_strerror(socket_last_error($this->_ftp_control_sock))); |
|
83 | 83 | } else { |
84 | - $this->_message.=$tmp; |
|
85 | - $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); |
|
84 | + $this->_message .= $tmp; |
|
85 | + $go = ! preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs); |
|
86 | 86 | } |
87 | - } while($go); |
|
88 | - if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
89 | - $this->_code=(int)$regs[1]; |
|
87 | + } while ($go); |
|
88 | + if ($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; |
|
89 | + $this->_code = (int) $regs[1]; |
|
90 | 90 | return $result; |
91 | 91 | } |
92 | 92 | |
93 | - function _exec($cmd, $fnction="_exec") { |
|
94 | - if(!$this->_ready) { |
|
95 | - $this->PushError($fnction,'Connect first'); |
|
93 | + function _exec($cmd, $fnction = "_exec") { |
|
94 | + if ( ! $this->_ready) { |
|
95 | + $this->PushError($fnction, 'Connect first'); |
|
96 | 96 | return FALSE; |
97 | 97 | } |
98 | - if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; |
|
99 | - $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF); |
|
100 | - if($status===false) { |
|
101 | - $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream))); |
|
98 | + if ($this->LocalEcho) echo "PUT > ", $cmd, CRLF; |
|
99 | + $status = @socket_write($this->_ftp_control_sock, $cmd.CRLF); |
|
100 | + if ($status === false) { |
|
101 | + $this->PushError($fnction, 'socket write failed', socket_strerror(socket_last_error($this->stream))); |
|
102 | 102 | return FALSE; |
103 | 103 | } |
104 | - $this->_lastaction=time(); |
|
105 | - if(!$this->_readmsg($fnction)) return FALSE; |
|
104 | + $this->_lastaction = time(); |
|
105 | + if ( ! $this->_readmsg($fnction)) return FALSE; |
|
106 | 106 | return TRUE; |
107 | 107 | } |
108 | 108 | |
109 | - function _data_prepare($mode=FTP_ASCII) { |
|
110 | - if(!$this->_settype($mode)) return FALSE; |
|
109 | + function _data_prepare($mode = FTP_ASCII) { |
|
110 | + if ( ! $this->_settype($mode)) return FALSE; |
|
111 | 111 | $this->SendMSG("Creating data socket"); |
112 | 112 | $this->_ftp_data_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
113 | 113 | if ($this->_ftp_data_sock < 0) { |
114 | - $this->PushError('_data_prepare','socket create failed',socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
114 | + $this->PushError('_data_prepare', 'socket create failed', socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
115 | 115 | return FALSE; |
116 | 116 | } |
117 | - if(!$this->_settimeout($this->_ftp_data_sock)) { |
|
117 | + if ( ! $this->_settimeout($this->_ftp_data_sock)) { |
|
118 | 118 | $this->_data_close(); |
119 | 119 | return FALSE; |
120 | 120 | } |
121 | - if($this->_passive) { |
|
122 | - if(!$this->_exec("PASV", "pasv")) { |
|
121 | + if ($this->_passive) { |
|
122 | + if ( ! $this->_exec("PASV", "pasv")) { |
|
123 | 123 | $this->_data_close(); |
124 | 124 | return FALSE; |
125 | 125 | } |
126 | - if(!$this->_checkCode()) { |
|
126 | + if ( ! $this->_checkCode()) { |
|
127 | 127 | $this->_data_close(); |
128 | 128 | return FALSE; |
129 | 129 | } |
130 | 130 | $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); |
131 | - $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; |
|
132 | - $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); |
|
131 | + $this->_datahost = $ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; |
|
132 | + $this->_dataport = (((int) $ip_port[4]) << 8) + ((int) $ip_port[5]); |
|
133 | 133 | $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
134 | - if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { |
|
135 | - $this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
134 | + if ( ! @socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { |
|
135 | + $this->PushError("_data_prepare", "socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
136 | 136 | $this->_data_close(); |
137 | 137 | return FALSE; |
138 | 138 | } |
139 | - else $this->_ftp_temp_sock=$this->_ftp_data_sock; |
|
139 | + else $this->_ftp_temp_sock = $this->_ftp_data_sock; |
|
140 | 140 | } else { |
141 | - if(!@socket_getsockname($this->_ftp_control_sock, $addr, $port)) { |
|
142 | - $this->PushError("_data_prepare","can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); |
|
141 | + if ( ! @socket_getsockname($this->_ftp_control_sock, $addr, $port)) { |
|
142 | + $this->PushError("_data_prepare", "can't get control socket information", socket_strerror(socket_last_error($this->_ftp_control_sock))); |
|
143 | 143 | $this->_data_close(); |
144 | 144 | return FALSE; |
145 | 145 | } |
146 | - if(!@socket_bind($this->_ftp_data_sock,$addr)){ |
|
147 | - $this->PushError("_data_prepare","can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
146 | + if ( ! @socket_bind($this->_ftp_data_sock, $addr)) { |
|
147 | + $this->PushError("_data_prepare", "can't bind data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
148 | 148 | $this->_data_close(); |
149 | 149 | return FALSE; |
150 | 150 | } |
151 | - if(!@socket_listen($this->_ftp_data_sock)) { |
|
152 | - $this->PushError("_data_prepare","can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
151 | + if ( ! @socket_listen($this->_ftp_data_sock)) { |
|
152 | + $this->PushError("_data_prepare", "can't listen data socket", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
153 | 153 | $this->_data_close(); |
154 | 154 | return FALSE; |
155 | 155 | } |
156 | - if(!@socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { |
|
157 | - $this->PushError("_data_prepare","can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
156 | + if ( ! @socket_getsockname($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) { |
|
157 | + $this->PushError("_data_prepare", "can't get data socket information", socket_strerror(socket_last_error($this->_ftp_data_sock))); |
|
158 | 158 | $this->_data_close(); |
159 | 159 | return FALSE; |
160 | 160 | } |
161 | - if(!$this->_exec('PORT '.str_replace('.',',',$this->_datahost.'.'.($this->_dataport>>8).'.'.($this->_dataport&0x00FF)), "_port")) { |
|
161 | + if ( ! $this->_exec('PORT '.str_replace('.', ',', $this->_datahost.'.'.($this->_dataport >> 8).'.'.($this->_dataport & 0x00FF)), "_port")) { |
|
162 | 162 | $this->_data_close(); |
163 | 163 | return FALSE; |
164 | 164 | } |
165 | - if(!$this->_checkCode()) { |
|
165 | + if ( ! $this->_checkCode()) { |
|
166 | 166 | $this->_data_close(); |
167 | 167 | return FALSE; |
168 | 168 | } |
@@ -170,61 +170,61 @@ discard block |
||
170 | 170 | return TRUE; |
171 | 171 | } |
172 | 172 | |
173 | - function _data_read($mode=FTP_ASCII, $fp=NULL) { |
|
174 | - $NewLine=$this->_eol_code[$this->OS_local]; |
|
175 | - if(is_resource($fp)) $out=0; |
|
176 | - else $out=""; |
|
177 | - if(!$this->_passive) { |
|
173 | + function _data_read($mode = FTP_ASCII, $fp = NULL) { |
|
174 | + $NewLine = $this->_eol_code[$this->OS_local]; |
|
175 | + if (is_resource($fp)) $out = 0; |
|
176 | + else $out = ""; |
|
177 | + if ( ! $this->_passive) { |
|
178 | 178 | $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
179 | - $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); |
|
180 | - if($this->_ftp_temp_sock===FALSE) { |
|
181 | - $this->PushError("_data_read","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
179 | + $this->_ftp_temp_sock = socket_accept($this->_ftp_data_sock); |
|
180 | + if ($this->_ftp_temp_sock === FALSE) { |
|
181 | + $this->PushError("_data_read", "socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
182 | 182 | $this->_data_close(); |
183 | 183 | return FALSE; |
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | - while(($block=@socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ))!==false) { |
|
188 | - if($block==="") break; |
|
189 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
190 | - if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); |
|
191 | - else $out.=$block; |
|
187 | + while (($block = @socket_read($this->_ftp_temp_sock, $this->_ftp_buff_size, PHP_BINARY_READ)) !== false) { |
|
188 | + if ($block === "") break; |
|
189 | + if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); |
|
190 | + if (is_resource($fp)) $out += fwrite($fp, $block, strlen($block)); |
|
191 | + else $out .= $block; |
|
192 | 192 | } |
193 | 193 | return $out; |
194 | 194 | } |
195 | 195 | |
196 | - function _data_write($mode=FTP_ASCII, $fp=NULL) { |
|
197 | - $NewLine=$this->_eol_code[$this->OS_local]; |
|
198 | - if(is_resource($fp)) $out=0; |
|
199 | - else $out=""; |
|
200 | - if(!$this->_passive) { |
|
196 | + function _data_write($mode = FTP_ASCII, $fp = NULL) { |
|
197 | + $NewLine = $this->_eol_code[$this->OS_local]; |
|
198 | + if (is_resource($fp)) $out = 0; |
|
199 | + else $out = ""; |
|
200 | + if ( ! $this->_passive) { |
|
201 | 201 | $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); |
202 | - $this->_ftp_temp_sock=socket_accept($this->_ftp_data_sock); |
|
203 | - if($this->_ftp_temp_sock===FALSE) { |
|
204 | - $this->PushError("_data_write","socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
202 | + $this->_ftp_temp_sock = socket_accept($this->_ftp_data_sock); |
|
203 | + if ($this->_ftp_temp_sock === FALSE) { |
|
204 | + $this->PushError("_data_write", "socket_accept", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
205 | 205 | $this->_data_close(); |
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | } |
209 | - if(is_resource($fp)) { |
|
210 | - while(!feof($fp)) { |
|
211 | - $block=fread($fp, $this->_ftp_buff_size); |
|
212 | - if(!$this->_data_write_block($mode, $block)) return false; |
|
209 | + if (is_resource($fp)) { |
|
210 | + while ( ! feof($fp)) { |
|
211 | + $block = fread($fp, $this->_ftp_buff_size); |
|
212 | + if ( ! $this->_data_write_block($mode, $block)) return false; |
|
213 | 213 | } |
214 | - } elseif(!$this->_data_write_block($mode, $fp)) return false; |
|
214 | + } elseif ( ! $this->_data_write_block($mode, $fp)) return false; |
|
215 | 215 | return true; |
216 | 216 | } |
217 | 217 | |
218 | 218 | function _data_write_block($mode, $block) { |
219 | - if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
219 | + if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); |
|
220 | 220 | do { |
221 | - if(($t=@socket_write($this->_ftp_temp_sock, $block))===FALSE) { |
|
222 | - $this->PushError("_data_write","socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
221 | + if (($t = @socket_write($this->_ftp_temp_sock, $block)) === FALSE) { |
|
222 | + $this->PushError("_data_write", "socket_write", socket_strerror(socket_last_error($this->_ftp_temp_sock))); |
|
223 | 223 | $this->_data_close(); |
224 | 224 | return FALSE; |
225 | 225 | } |
226 | - $block=substr($block, $t); |
|
227 | - } while(!empty($block)); |
|
226 | + $block = substr($block, $t); |
|
227 | + } while ( ! empty($block)); |
|
228 | 228 | return true; |
229 | 229 | } |
230 | 230 | |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | function _quit() { |
239 | - if($this->_connected) { |
|
239 | + if ($this->_connected) { |
|
240 | 240 | @socket_close($this->_ftp_control_sock); |
241 | - $this->_connected=false; |
|
241 | + $this->_connected = false; |
|
242 | 242 | $this->SendMSG("Socket closed"); |
243 | 243 | } |
244 | 244 | } |
@@ -83,6 +83,9 @@ |
||
83 | 83 | return $result; |
84 | 84 | } |
85 | 85 | |
86 | + /** |
|
87 | + * @param string $cmd |
|
88 | + */ |
|
86 | 89 | function _exec($cmd, $fnction="_exec") { |
87 | 90 | if(!$this->_ready) { |
88 | 91 | $this->PushError($fnction,'Connect first'); |
@@ -7,6 +7,6 @@ |
||
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('settings.php') ); |
|
12 | +wp_redirect(network_admin_url('settings.php')); |
@@ -24,10 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | delete_site_transient('update_core'); |
26 | 26 | |
27 | -if ( isset( $_GET['step'] ) ) |
|
27 | +if ( isset( $_GET['step'] ) ) { |
|
28 | 28 | $step = $_GET['step']; |
29 | -else |
|
29 | +} else { |
|
30 | 30 | $step = 0; |
31 | +} |
|
31 | 32 | |
32 | 33 | // Do it. No output. |
33 | 34 | if ( 'upgrade_db' === $step ) { |
@@ -48,10 +49,11 @@ discard block |
||
48 | 49 | $php_version = phpversion(); |
49 | 50 | $mysql_version = $wpdb->db_version(); |
50 | 51 | $php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
51 | -if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
52 | +if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
52 | 53 | $mysql_compat = true; |
53 | -else |
|
54 | +} else { |
|
54 | 55 | $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
56 | +} |
|
55 | 57 | |
56 | 58 | @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
57 | 59 | ?> |
@@ -76,17 +78,20 @@ discard block |
||
76 | 78 | <p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
77 | 79 | |
78 | 80 | <?php elseif ( !$php_compat || !$mysql_compat ) : |
79 | - if ( !$mysql_compat && !$php_compat ) |
|
80 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
81 | - elseif ( !$php_compat ) |
|
82 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
83 | - elseif ( !$mysql_compat ) |
|
84 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
85 | -?> |
|
86 | -<?php else : |
|
81 | + if ( !$mysql_compat && !$php_compat ) { |
|
82 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
83 | + } elseif ( !$php_compat ) { |
|
84 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
85 | + } elseif ( !$mysql_compat ) { |
|
86 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
87 | + } |
|
88 | + ?> |
|
89 | +<?php else { |
|
90 | + : |
|
87 | 91 | switch ( $step ) : |
88 | 92 | case 0: |
89 | 93 | $goback = wp_get_referer(); |
94 | +} |
|
90 | 95 | if ( $goback ) { |
91 | 96 | $goback = esc_url_raw( $goback ); |
92 | 97 | $goback = urlencode( $goback ); |
@@ -12,27 +12,27 @@ discard block |
||
12 | 12 | * @since 1.5.1 |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | -define( 'WP_INSTALLING', true ); |
|
15 | +define('WP_INSTALLING', true); |
|
16 | 16 | |
17 | 17 | /** Load WordPress Bootstrap */ |
18 | -require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
18 | +require(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
19 | 19 | |
20 | 20 | nocache_headers(); |
21 | 21 | |
22 | 22 | timer_start(); |
23 | -require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
23 | +require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
24 | 24 | |
25 | 25 | delete_site_transient('update_core'); |
26 | 26 | |
27 | -if ( isset( $_GET['step'] ) ) |
|
27 | +if (isset($_GET['step'])) |
|
28 | 28 | $step = $_GET['step']; |
29 | 29 | else |
30 | 30 | $step = 0; |
31 | 31 | |
32 | 32 | // Do it. No output. |
33 | -if ( 'upgrade_db' === $step ) { |
|
33 | +if ('upgrade_db' === $step) { |
|
34 | 34 | wp_upgrade(); |
35 | - die( '0' ); |
|
35 | + die('0'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -47,74 +47,74 @@ discard block |
||
47 | 47 | |
48 | 48 | $php_version = phpversion(); |
49 | 49 | $mysql_version = $wpdb->db_version(); |
50 | -$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
51 | -if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
50 | +$php_compat = version_compare($php_version, $required_php_version, '>='); |
|
51 | +if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql)) |
|
52 | 52 | $mysql_compat = true; |
53 | 53 | else |
54 | - $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
|
54 | + $mysql_compat = version_compare($mysql_version, $required_mysql_version, '>='); |
|
55 | 55 | |
56 | -@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
|
56 | +@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset')); |
|
57 | 57 | ?> |
58 | 58 | <!DOCTYPE html> |
59 | 59 | <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
60 | 60 | <head> |
61 | 61 | <meta name="viewport" content="width=device-width" /> |
62 | - <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> |
|
62 | + <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> |
|
63 | 63 | <meta name="robots" content="noindex,nofollow" /> |
64 | - <title><?php _e( 'WordPress › Update' ); ?></title> |
|
64 | + <title><?php _e('WordPress › Update'); ?></title> |
|
65 | 65 | <?php |
66 | - wp_admin_css( 'install', true ); |
|
67 | - wp_admin_css( 'ie', true ); |
|
66 | + wp_admin_css('install', true); |
|
67 | + wp_admin_css('ie', true); |
|
68 | 68 | ?> |
69 | 69 | </head> |
70 | 70 | <body class="wp-core-ui"> |
71 | -<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p> |
|
71 | +<p id="logo"><a href="<?php echo esc_url(__('https://wordpress.org/')); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></p> |
|
72 | 72 | |
73 | -<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?> |
|
73 | +<?php if (get_option('db_version') == $wp_db_version || ! is_blog_installed()) : ?> |
|
74 | 74 | |
75 | -<h1><?php _e( 'No Update Required' ); ?></h1> |
|
76 | -<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p> |
|
77 | -<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
|
75 | +<h1><?php _e('No Update Required'); ?></h1> |
|
76 | +<p><?php _e('Your WordPress database is already up-to-date!'); ?></p> |
|
77 | +<p class="step"><a class="button button-large" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p> |
|
78 | 78 | |
79 | -<?php elseif ( !$php_compat || !$mysql_compat ) : |
|
80 | - if ( !$mysql_compat && !$php_compat ) |
|
81 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
82 | - elseif ( !$php_compat ) |
|
83 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
84 | - elseif ( !$mysql_compat ) |
|
85 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
79 | +<?php elseif ( ! $php_compat || ! $mysql_compat) : |
|
80 | + if ( ! $mysql_compat && ! $php_compat) |
|
81 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version); |
|
82 | + elseif ( ! $php_compat) |
|
83 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version); |
|
84 | + elseif ( ! $mysql_compat) |
|
85 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version); |
|
86 | 86 | ?> |
87 | 87 | <?php else : |
88 | -switch ( $step ) : |
|
88 | +switch ($step) : |
|
89 | 89 | case 0: |
90 | 90 | $goback = wp_get_referer(); |
91 | - if ( $goback ) { |
|
92 | - $goback = esc_url_raw( $goback ); |
|
93 | - $goback = urlencode( $goback ); |
|
91 | + if ($goback) { |
|
92 | + $goback = esc_url_raw($goback); |
|
93 | + $goback = urlencode($goback); |
|
94 | 94 | } |
95 | 95 | ?> |
96 | -<h1><?php _e( 'Database Update Required' ); ?></h1> |
|
97 | -<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p> |
|
98 | -<p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> |
|
99 | -<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p> |
|
96 | +<h1><?php _e('Database Update Required'); ?></h1> |
|
97 | +<p><?php _e('WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.'); ?></p> |
|
98 | +<p><?php _e('The database update process may take a little while, so please be patient.'); ?></p> |
|
99 | +<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Update WordPress Database'); ?></a></p> |
|
100 | 100 | <?php |
101 | 101 | break; |
102 | 102 | case 1: |
103 | 103 | wp_upgrade(); |
104 | 104 | |
105 | - $backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
|
106 | - $backto = esc_url( $backto ); |
|
107 | - $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); |
|
105 | + $backto = ! empty($_GET['backto']) ? wp_unslash(urldecode($_GET['backto'])) : __get_option('home').'/'; |
|
106 | + $backto = esc_url($backto); |
|
107 | + $backto = wp_validate_redirect($backto, __get_option('home').'/'); |
|
108 | 108 | ?> |
109 | -<h1><?php _e( 'Update Complete' ); ?></h1> |
|
110 | - <p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> |
|
111 | - <p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> |
|
109 | +<h1><?php _e('Update Complete'); ?></h1> |
|
110 | + <p><?php _e('Your WordPress database has been successfully updated!'); ?></p> |
|
111 | + <p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p> |
|
112 | 112 | |
113 | 113 | <!-- |
114 | 114 | <pre> |
115 | -<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?> |
|
115 | +<?php printf(__('%s queries'), $wpdb->num_queries); ?> |
|
116 | 116 | |
117 | -<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?> |
|
117 | +<?php printf(__('%s seconds'), timer_stop(0)); ?> |
|
118 | 118 | </pre> |
119 | 119 | --> |
120 | 120 |
@@ -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 |
@@ -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( |
@@ -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'); |
@@ -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( __( 'Sorry, you are not allowed to edit the links for this site.' ) ); |
13 | +} |
|
13 | 14 | |
14 | 15 | $wp_list_table = _get_list_table('WP_Links_List_Table'); |
15 | 16 | |
@@ -73,8 +74,9 @@ discard block |
||
73 | 74 | |
74 | 75 | include_once( ABSPATH . 'wp-admin/admin-header.php' ); |
75 | 76 | |
76 | -if ( ! current_user_can('manage_links') ) |
|
77 | +if ( ! current_user_can('manage_links') ) { |
|
77 | 78 | wp_die(__('Sorry, you are not allowed to edit the links for this site.')); |
79 | +} |
|
78 | 80 | |
79 | 81 | ?> |
80 | 82 |
@@ -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; |