Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-admin/includes/class-ftp-pure.php 4 patches
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
  */
28 28
 class ftp extends ftp_base {
29 29
 
30
-	function __construct($verb=FALSE, $le=FALSE) {
30
+	function __construct($verb = FALSE, $le = FALSE) {
31 31
 		parent::__construct(false, $verb, $le);
32 32
 	}
33 33
 
34
-	function ftp($verb=FALSE, $le=FALSE) {
34
+	function ftp($verb = FALSE, $le = FALSE) {
35 35
 		$this->__construct($verb, $le);
36 36
 	}
37 37
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 // <!-- --------------------------------------------------------------------------------------- -->
41 41
 
42 42
 	function _settimeout($sock) {
43
-		if(!@stream_set_timeout($sock, $this->_timeout)) {
44
-			$this->PushError('_settimeout','socket set send timeout');
43
+		if ( ! @stream_set_timeout($sock, $this->_timeout)) {
44
+			$this->PushError('_settimeout', 'socket set send timeout');
45 45
 			$this->_quit();
46 46
 			return FALSE;
47 47
 		}
@@ -51,72 +51,72 @@  discard block
 block discarded – undo
51 51
 	function _connect($host, $port) {
52 52
 		$this->SendMSG("Creating socket");
53 53
 		$sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout);
54
-		if (!$sock) {
55
-			$this->PushError('_connect','socket connect failed', $errstr." (".$errno.")");
54
+		if ( ! $sock) {
55
+			$this->PushError('_connect', 'socket connect failed', $errstr." (".$errno.")");
56 56
 			return FALSE;
57 57
 		}
58
-		$this->_connected=true;
58
+		$this->_connected = true;
59 59
 		return $sock;
60 60
 	}
61 61
 
62
-	function _readmsg($fnction="_readmsg"){
63
-		if(!$this->_connected) {
62
+	function _readmsg($fnction = "_readmsg") {
63
+		if ( ! $this->_connected) {
64 64
 			$this->PushError($fnction, 'Connect first');
65 65
 			return FALSE;
66 66
 		}
67
-		$result=true;
68
-		$this->_message="";
69
-		$this->_code=0;
70
-		$go=true;
67
+		$result = true;
68
+		$this->_message = "";
69
+		$this->_code = 0;
70
+		$go = true;
71 71
 		do {
72
-			$tmp=@fgets($this->_ftp_control_sock, 512);
73
-			if($tmp===false) {
74
-				$go=$result=false;
75
-				$this->PushError($fnction,'Read failed');
72
+			$tmp = @fgets($this->_ftp_control_sock, 512);
73
+			if ($tmp === false) {
74
+				$go = $result = false;
75
+				$this->PushError($fnction, 'Read failed');
76 76
 			} else {
77
-				$this->_message.=$tmp;
78
-				if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false;
77
+				$this->_message .= $tmp;
78
+				if (preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go = false;
79 79
 			}
80
-		} while($go);
81
-		if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
82
-		$this->_code=(int)$regs[1];
80
+		} while ($go);
81
+		if ($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
82
+		$this->_code = (int) $regs[1];
83 83
 		return $result;
84 84
 	}
85 85
 
86
-	function _exec($cmd, $fnction="_exec") {
87
-		if(!$this->_ready) {
88
-			$this->PushError($fnction,'Connect first');
86
+	function _exec($cmd, $fnction = "_exec") {
87
+		if ( ! $this->_ready) {
88
+			$this->PushError($fnction, 'Connect first');
89 89
 			return FALSE;
90 90
 		}
91
-		if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
92
-		$status=@fputs($this->_ftp_control_sock, $cmd.CRLF);
93
-		if($status===false) {
94
-			$this->PushError($fnction,'socket write failed');
91
+		if ($this->LocalEcho) echo "PUT > ", $cmd, CRLF;
92
+		$status = @fputs($this->_ftp_control_sock, $cmd.CRLF);
93
+		if ($status === false) {
94
+			$this->PushError($fnction, 'socket write failed');
95 95
 			return FALSE;
96 96
 		}
97
-		$this->_lastaction=time();
98
-		if(!$this->_readmsg($fnction)) return FALSE;
97
+		$this->_lastaction = time();
98
+		if ( ! $this->_readmsg($fnction)) return FALSE;
99 99
 		return TRUE;
100 100
 	}
101 101
 
102
-	function _data_prepare($mode=FTP_ASCII) {
103
-		if(!$this->_settype($mode)) return FALSE;
104
-		if($this->_passive) {
105
-			if(!$this->_exec("PASV", "pasv")) {
102
+	function _data_prepare($mode = FTP_ASCII) {
103
+		if ( ! $this->_settype($mode)) return FALSE;
104
+		if ($this->_passive) {
105
+			if ( ! $this->_exec("PASV", "pasv")) {
106 106
 				$this->_data_close();
107 107
 				return FALSE;
108 108
 			}
109
-			if(!$this->_checkCode()) {
109
+			if ( ! $this->_checkCode()) {
110 110
 				$this->_data_close();
111 111
 				return FALSE;
112 112
 			}
113 113
 			$ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
114
-			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
115
-            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
114
+			$this->_datahost = $ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
115
+            $this->_dataport = (((int) $ip_port[4]) << 8) + ((int) $ip_port[5]);
116 116
 			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
117
-			$this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
118
-			if(!$this->_ftp_data_sock) {
119
-				$this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
117
+			$this->_ftp_data_sock = @fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
118
+			if ( ! $this->_ftp_data_sock) {
119
+				$this->PushError("_data_prepare", "fsockopen fails", $errstr." (".$errno.")");
120 120
 				$this->_data_close();
121 121
 				return FALSE;
122 122
 			}
@@ -128,47 +128,47 @@  discard block
 block discarded – undo
128 128
 		return TRUE;
129 129
 	}
130 130
 
131
-	function _data_read($mode=FTP_ASCII, $fp=NULL) {
132
-		if(is_resource($fp)) $out=0;
133
-		else $out="";
134
-		if(!$this->_passive) {
131
+	function _data_read($mode = FTP_ASCII, $fp = NULL) {
132
+		if (is_resource($fp)) $out = 0;
133
+		else $out = "";
134
+		if ( ! $this->_passive) {
135 135
 			$this->SendMSG("Only passive connections available!");
136 136
 			return FALSE;
137 137
 		}
138
-		while (!feof($this->_ftp_data_sock)) {
139
-			$block=fread($this->_ftp_data_sock, $this->_ftp_buff_size);
140
-			if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
141
-			if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
142
-			else $out.=$block;
138
+		while ( ! feof($this->_ftp_data_sock)) {
139
+			$block = fread($this->_ftp_data_sock, $this->_ftp_buff_size);
140
+			if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
141
+			if (is_resource($fp)) $out += fwrite($fp, $block, strlen($block));
142
+			else $out .= $block;
143 143
 		}
144 144
 		return $out;
145 145
 	}
146 146
 
147
-	function _data_write($mode=FTP_ASCII, $fp=NULL) {
148
-		if(is_resource($fp)) $out=0;
149
-		else $out="";
150
-		if(!$this->_passive) {
147
+	function _data_write($mode = FTP_ASCII, $fp = NULL) {
148
+		if (is_resource($fp)) $out = 0;
149
+		else $out = "";
150
+		if ( ! $this->_passive) {
151 151
 			$this->SendMSG("Only passive connections available!");
152 152
 			return FALSE;
153 153
 		}
154
-		if(is_resource($fp)) {
155
-			while(!feof($fp)) {
156
-				$block=fread($fp, $this->_ftp_buff_size);
157
-				if(!$this->_data_write_block($mode, $block)) return false;
154
+		if (is_resource($fp)) {
155
+			while ( ! feof($fp)) {
156
+				$block = fread($fp, $this->_ftp_buff_size);
157
+				if ( ! $this->_data_write_block($mode, $block)) return false;
158 158
 			}
159
-		} elseif(!$this->_data_write_block($mode, $fp)) return false;
159
+		} elseif ( ! $this->_data_write_block($mode, $fp)) return false;
160 160
 		return TRUE;
161 161
 	}
162 162
 
163 163
 	function _data_write_block($mode, $block) {
164
-		if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
164
+		if ($mode != FTP_BINARY) $block = preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
165 165
 		do {
166
-			if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) {
167
-				$this->PushError("_data_write","Can't write to socket");
166
+			if (($t = @fwrite($this->_ftp_data_sock, $block)) === FALSE) {
167
+				$this->PushError("_data_write", "Can't write to socket");
168 168
 				return FALSE;
169 169
 			}
170
-			$block=substr($block, $t);
171
-		} while(!empty($block));
170
+			$block = substr($block, $t);
171
+		} while ( ! empty($block));
172 172
 		return true;
173 173
 	}
174 174
 
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 		return TRUE;
179 179
 	}
180 180
 
181
-	function _quit($force=FALSE) {
182
-		if($this->_connected or $force) {
181
+	function _quit($force = FALSE) {
182
+		if ($this->_connected or $force) {
183 183
 			@fclose($this->_ftp_control_sock);
184
-			$this->_connected=false;
184
+			$this->_connected = false;
185 185
 			$this->SendMSG("Socket closed");
186 186
 		}
187 187
 	}
Please login to merge, or discard this patch.
Braces   +44 added lines, -16 removed lines patch added patch discarded remove patch
@@ -75,10 +75,14 @@  discard block
 block discarded – undo
75 75
 				$this->PushError($fnction,'Read failed');
76 76
 			} else {
77 77
 				$this->_message.=$tmp;
78
-				if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false;
78
+				if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) {
79
+					$go=false;
80
+				}
79 81
 			}
80 82
 		} while($go);
81
-		if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF;
83
+		if($this->LocalEcho) {
84
+			echo "GET < ".rtrim($this->_message, CRLF).CRLF;
85
+		}
82 86
 		$this->_code=(int)$regs[1];
83 87
 		return $result;
84 88
 	}
@@ -88,19 +92,25 @@  discard block
 block discarded – undo
88 92
 			$this->PushError($fnction,'Connect first');
89 93
 			return FALSE;
90 94
 		}
91
-		if($this->LocalEcho) echo "PUT > ",$cmd,CRLF;
95
+		if($this->LocalEcho) {
96
+			echo "PUT > ",$cmd,CRLF;
97
+		}
92 98
 		$status=@fputs($this->_ftp_control_sock, $cmd.CRLF);
93 99
 		if($status===false) {
94 100
 			$this->PushError($fnction,'socket write failed');
95 101
 			return FALSE;
96 102
 		}
97 103
 		$this->_lastaction=time();
98
-		if(!$this->_readmsg($fnction)) return FALSE;
104
+		if(!$this->_readmsg($fnction)) {
105
+			return FALSE;
106
+		}
99 107
 		return TRUE;
100 108
 	}
101 109
 
102 110
 	function _data_prepare($mode=FTP_ASCII) {
103
-		if(!$this->_settype($mode)) return FALSE;
111
+		if(!$this->_settype($mode)) {
112
+			return FALSE;
113
+		}
104 114
 		if($this->_passive) {
105 115
 			if(!$this->_exec("PASV", "pasv")) {
106 116
 				$this->_data_close();
@@ -119,8 +129,9 @@  discard block
 block discarded – undo
119 129
 				$this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
120 130
 				$this->_data_close();
121 131
 				return FALSE;
132
+			} else {
133
+				$this->_ftp_data_sock;
122 134
 			}
123
-			else $this->_ftp_data_sock;
124 135
 		} else {
125 136
 			$this->SendMSG("Only passive connections available!");
126 137
 			return FALSE;
@@ -129,24 +140,35 @@  discard block
 block discarded – undo
129 140
 	}
130 141
 
131 142
 	function _data_read($mode=FTP_ASCII, $fp=NULL) {
132
-		if(is_resource($fp)) $out=0;
133
-		else $out="";
143
+		if(is_resource($fp)) {
144
+			$out=0;
145
+		} else {
146
+			$out="";
147
+		}
134 148
 		if(!$this->_passive) {
135 149
 			$this->SendMSG("Only passive connections available!");
136 150
 			return FALSE;
137 151
 		}
138 152
 		while (!feof($this->_ftp_data_sock)) {
139 153
 			$block=fread($this->_ftp_data_sock, $this->_ftp_buff_size);
140
-			if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
141
-			if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block));
142
-			else $out.=$block;
154
+			if($mode!=FTP_BINARY) {
155
+				$block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block);
156
+			}
157
+			if(is_resource($fp)) {
158
+				$out+=fwrite($fp, $block, strlen($block));
159
+			} else {
160
+				$out.=$block;
161
+			}
143 162
 		}
144 163
 		return $out;
145 164
 	}
146 165
 
147 166
 	function _data_write($mode=FTP_ASCII, $fp=NULL) {
148
-		if(is_resource($fp)) $out=0;
149
-		else $out="";
167
+		if(is_resource($fp)) {
168
+			$out=0;
169
+		} else {
170
+			$out="";
171
+		}
150 172
 		if(!$this->_passive) {
151 173
 			$this->SendMSG("Only passive connections available!");
152 174
 			return FALSE;
@@ -154,14 +176,20 @@  discard block
 block discarded – undo
154 176
 		if(is_resource($fp)) {
155 177
 			while(!feof($fp)) {
156 178
 				$block=fread($fp, $this->_ftp_buff_size);
157
-				if(!$this->_data_write_block($mode, $block)) return false;
179
+				if(!$this->_data_write_block($mode, $block)) {
180
+					return false;
181
+				}
158 182
 			}
159
-		} elseif(!$this->_data_write_block($mode, $fp)) return false;
183
+		} elseif(!$this->_data_write_block($mode, $fp)) {
184
+			return false;
185
+		}
160 186
 		return TRUE;
161 187
 	}
162 188
 
163 189
 	function _data_write_block($mode, $block) {
164
-		if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
190
+		if($mode!=FTP_BINARY) {
191
+			$block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block);
192
+		}
165 193
 		do {
166 194
 			if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) {
167 195
 				$this->PushError("_data_write","Can't write to socket");
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -94,6 +94,9 @@
 block discarded – undo
94 94
 		return $result;
95 95
 	}
96 96
 
97
+	/**
98
+	 * @param string $cmd
99
+	 */
97 100
 	function _exec($cmd, $fnction="_exec") {
98 101
 		if(!$this->_ready) {
99 102
 			$this->PushError($fnction,'Connect first');
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PemFTP - A Ftp implementation in pure PHP
4
- *
5
- * @package PemFTP
6
- * @since 2.5.0
7
- *
8
- * @version 1.0
9
- * @copyright Alexey Dotsenko
10
- * @author Alexey Dotsenko
11
- * @link http://www.phpclasses.org/browse/package/1743.html Site
12
- * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
13
- */
3
+			 * PemFTP - A Ftp implementation in pure PHP
4
+			 *
5
+			 * @package PemFTP
6
+			 * @since 2.5.0
7
+			 *
8
+			 * @version 1.0
9
+			 * @copyright Alexey Dotsenko
10
+			 * @author Alexey Dotsenko
11
+			 * @link http://www.phpclasses.org/browse/package/1743.html Site
12
+			 * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
13
+			 */
14 14
 
15 15
 /**
16 16
  * FTP implementation using fsockopen to connect.
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 			$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));
114 114
 			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
115
-            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
115
+			$this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
116 116
 			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
117 117
 			$this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
118 118
 			if(!$this->_ftp_data_sock) {
Please login to merge, or discard this patch.
src/wp-admin/includes/taxonomy.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
  * @param int        $parent   Optional. ID of parent term.
22 22
  * @return mixed
23 23
  */
24
-function category_exists( $cat_name, $parent = null ) {
24
+function category_exists($cat_name, $parent = null) {
25 25
 	$id = term_exists($cat_name, 'category', $parent);
26
-	if ( is_array($id) )
26
+	if (is_array($id))
27 27
 		$id = $id['term_id'];
28 28
 	return $id;
29 29
 }
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  * @param int $id
37 37
  * @return object
38 38
  */
39
-function get_category_to_edit( $id ) {
40
-	$category = get_term( $id, 'category', OBJECT, 'edit' );
41
-	_make_cat_compat( $category );
39
+function get_category_to_edit($id) {
40
+	$category = get_term($id, 'category', OBJECT, 'edit');
41
+	_make_cat_compat($category);
42 42
 	return $category;
43 43
 }
44 44
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
  * @param int        $parent
52 52
  * @return int|WP_Error
53 53
  */
54
-function wp_create_category( $cat_name, $parent = 0 ) {
55
-	if ( $id = category_exists($cat_name, $parent) )
54
+function wp_create_category($cat_name, $parent = 0) {
55
+	if ($id = category_exists($cat_name, $parent))
56 56
 		return $id;
57 57
 
58
-	return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
58
+	return wp_insert_category(array('cat_name' => $cat_name, 'category_parent' => $parent));
59 59
 }
60 60
 
61 61
 /**
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
  * @param int   $post_id    Optional. The post ID. Default empty.
68 68
  * @return List of categories to create for the given post.
69 69
  */
70
-function wp_create_categories( $categories, $post_id = '' ) {
71
-	$cat_ids = array ();
72
-	foreach ( $categories as $category ) {
73
-		if ( $id = category_exists( $category ) ) {
70
+function wp_create_categories($categories, $post_id = '') {
71
+	$cat_ids = array();
72
+	foreach ($categories as $category) {
73
+		if ($id = category_exists($category)) {
74 74
 			$cat_ids[] = $id;
75
-		} elseif ( $id = wp_create_category( $category ) ) {
75
+		} elseif ($id = wp_create_category($category)) {
76 76
 			$cat_ids[] = $id;
77 77
 		}
78 78
 	}
79 79
 
80
-	if ( $post_id )
80
+	if ($post_id)
81 81
 		wp_set_post_categories($post_id, $cat_ids);
82 82
 
83 83
 	return $cat_ids;
@@ -105,47 +105,47 @@  discard block
 block discarded – undo
105 105
  * @return int|object The ID number of the new or updated Category on success. Zero or a WP_Error on failure,
106 106
  *                    depending on param $wp_error.
107 107
  */
108
-function wp_insert_category( $catarr, $wp_error = false ) {
109
-	$cat_defaults = array( 'cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '' );
110
-	$catarr = wp_parse_args( $catarr, $cat_defaults );
108
+function wp_insert_category($catarr, $wp_error = false) {
109
+	$cat_defaults = array('cat_ID' => 0, 'taxonomy' => 'category', 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
110
+	$catarr = wp_parse_args($catarr, $cat_defaults);
111 111
 
112
-	if ( trim( $catarr['cat_name'] ) == '' ) {
113
-		if ( ! $wp_error ) {
112
+	if (trim($catarr['cat_name']) == '') {
113
+		if ( ! $wp_error) {
114 114
 			return 0;
115 115
 		} else {
116
-			return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) );
116
+			return new WP_Error('cat_name', __('You did not enter a category name.'));
117 117
 		}
118 118
 	}
119 119
 
120 120
 	$catarr['cat_ID'] = (int) $catarr['cat_ID'];
121 121
 
122 122
 	// Are we updating or creating?
123
-	$update = ! empty ( $catarr['cat_ID'] );
123
+	$update = ! empty ($catarr['cat_ID']);
124 124
 
125 125
 	$name = $catarr['cat_name'];
126 126
 	$description = $catarr['category_description'];
127 127
 	$slug = $catarr['category_nicename'];
128 128
 	$parent = (int) $catarr['category_parent'];
129
-	if ( $parent < 0 ) {
129
+	if ($parent < 0) {
130 130
 		$parent = 0;
131 131
 	}
132 132
 
133
-	if ( empty( $parent )
134
-		|| ! term_exists( $parent, $catarr['taxonomy'] )
135
-		|| ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) {
133
+	if (empty($parent)
134
+		|| ! term_exists($parent, $catarr['taxonomy'])
135
+		|| ($catarr['cat_ID'] && term_is_ancestor_of($catarr['cat_ID'], $parent, $catarr['taxonomy']))) {
136 136
 		$parent = 0;
137 137
 	}
138 138
 
139 139
 	$args = compact('name', 'slug', 'parent', 'description');
140 140
 
141
-	if ( $update ) {
142
-		$catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args );
141
+	if ($update) {
142
+		$catarr['cat_ID'] = wp_update_term($catarr['cat_ID'], $catarr['taxonomy'], $args);
143 143
 	} else {
144
-		$catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args );
144
+		$catarr['cat_ID'] = wp_insert_term($catarr['cat_name'], $catarr['taxonomy'], $args);
145 145
 	}
146 146
 
147
-	if ( is_wp_error( $catarr['cat_ID'] ) ) {
148
-		if ( $wp_error ) {
147
+	if (is_wp_error($catarr['cat_ID'])) {
148
+		if ($wp_error) {
149 149
 			return $catarr['cat_ID'];
150 150
 		} else {
151 151
 			return 0;
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 function wp_update_category($catarr) {
169 169
 	$cat_ID = (int) $catarr['cat_ID'];
170 170
 
171
-	if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )
171
+	if (isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']))
172 172
 		return false;
173 173
 
174 174
 	// First, get all of the original fields
175
-	$category = get_term( $cat_ID, 'category', ARRAY_A );
176
-	_make_cat_compat( $category );
175
+	$category = get_term($cat_ID, 'category', ARRAY_A);
176
+	_make_cat_compat($category);
177 177
 
178 178
 	// Escape data pulled from DB.
179 179
 	$category = wp_slash($category);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
  * @return array|WP_Error
210 210
  */
211 211
 function wp_create_tag($tag_name) {
212
-	return wp_create_term( $tag_name, 'post_tag');
212
+	return wp_create_term($tag_name, 'post_tag');
213 213
 }
214 214
 
215 215
 /**
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
  * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
222 222
  * @return string|bool|WP_Error
223 223
  */
224
-function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
225
-	return get_terms_to_edit( $post_id, $taxonomy);
224
+function get_tags_to_edit($post_id, $taxonomy = 'post_tag') {
225
+	return get_terms_to_edit($post_id, $taxonomy);
226 226
 }
227 227
 
228 228
 /**
@@ -234,29 +234,29 @@  discard block
 block discarded – undo
234 234
  * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
235 235
  * @return string|bool|WP_Error
236 236
  */
237
-function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
237
+function get_terms_to_edit($post_id, $taxonomy = 'post_tag') {
238 238
 	$post_id = (int) $post_id;
239
-	if ( !$post_id )
239
+	if ( ! $post_id)
240 240
 		return false;
241 241
 
242
-	$terms = get_object_term_cache( $post_id, $taxonomy );
243
-	if ( false === $terms ) {
244
-		$terms = wp_get_object_terms( $post_id, $taxonomy );
245
-		wp_cache_add( $post_id, $terms, $taxonomy . '_relationships' );
242
+	$terms = get_object_term_cache($post_id, $taxonomy);
243
+	if (false === $terms) {
244
+		$terms = wp_get_object_terms($post_id, $taxonomy);
245
+		wp_cache_add($post_id, $terms, $taxonomy.'_relationships');
246 246
 	}
247 247
 
248
-	if ( ! $terms ) {
248
+	if ( ! $terms) {
249 249
 		return false;
250 250
 	}
251
-	if ( is_wp_error( $terms ) ) {
251
+	if (is_wp_error($terms)) {
252 252
 		return $terms;
253 253
 	}
254 254
 	$term_names = array();
255
-	foreach ( $terms as $term ) {
255
+	foreach ($terms as $term) {
256 256
 		$term_names[] = $term->name;
257 257
 	}
258 258
 
259
-	$terms_to_edit = esc_attr( join( ',', $term_names ) );
259
+	$terms_to_edit = esc_attr(join(',', $term_names));
260 260
 
261 261
 	/**
262 262
 	 * Filter the comma-separated list of terms available to edit.
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @param array  $terms_to_edit An array of terms.
269 269
 	 * @param string $taxonomy     The taxonomy for which to retrieve terms. Default 'post_tag'.
270 270
 	 */
271
-	$terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy );
271
+	$terms_to_edit = apply_filters('terms_to_edit', $terms_to_edit, $taxonomy);
272 272
 
273 273
 	return $terms_to_edit;
274 274
 }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
  * @return array|WP_Error
284 284
  */
285 285
 function wp_create_term($tag_name, $taxonomy = 'post_tag') {
286
-	if ( $id = term_exists($tag_name, $taxonomy) )
286
+	if ($id = term_exists($tag_name, $taxonomy))
287 287
 		return $id;
288 288
 
289 289
 	return wp_insert_term($tag_name, $taxonomy);
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function category_exists( $cat_name, $parent = null ) {
25 25
 	$id = term_exists($cat_name, 'category', $parent);
26
-	if ( is_array($id) )
27
-		$id = $id['term_id'];
26
+	if ( is_array($id) ) {
27
+			$id = $id['term_id'];
28
+	}
28 29
 	return $id;
29 30
 }
30 31
 
@@ -52,8 +53,9 @@  discard block
 block discarded – undo
52 53
  * @return int|WP_Error
53 54
  */
54 55
 function wp_create_category( $cat_name, $parent = 0 ) {
55
-	if ( $id = category_exists($cat_name, $parent) )
56
-		return $id;
56
+	if ( $id = category_exists($cat_name, $parent) ) {
57
+			return $id;
58
+	}
57 59
 
58 60
 	return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
59 61
 }
@@ -77,8 +79,9 @@  discard block
 block discarded – undo
77 79
 		}
78 80
 	}
79 81
 
80
-	if ( $post_id )
81
-		wp_set_post_categories($post_id, $cat_ids);
82
+	if ( $post_id ) {
83
+			wp_set_post_categories($post_id, $cat_ids);
84
+	}
82 85
 
83 86
 	return $cat_ids;
84 87
 }
@@ -168,8 +171,9 @@  discard block
 block discarded – undo
168 171
 function wp_update_category($catarr) {
169 172
 	$cat_ID = (int) $catarr['cat_ID'];
170 173
 
171
-	if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )
172
-		return false;
174
+	if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) ) {
175
+			return false;
176
+	}
173 177
 
174 178
 	// First, get all of the original fields
175 179
 	$category = get_term( $cat_ID, 'category', ARRAY_A );
@@ -236,8 +240,9 @@  discard block
 block discarded – undo
236 240
  */
237 241
 function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
238 242
 	$post_id = (int) $post_id;
239
-	if ( !$post_id )
240
-		return false;
243
+	if ( !$post_id ) {
244
+			return false;
245
+	}
241 246
 
242 247
 	$terms = get_object_term_cache( $post_id, $taxonomy );
243 248
 	if ( false === $terms ) {
@@ -283,8 +288,9 @@  discard block
 block discarded – undo
283 288
  * @return array|WP_Error
284 289
  */
285 290
 function wp_create_term($tag_name, $taxonomy = 'post_tag') {
286
-	if ( $id = term_exists($tag_name, $taxonomy) )
287
-		return $id;
291
+	if ( $id = term_exists($tag_name, $taxonomy) ) {
292
+			return $id;
293
+	}
288 294
 
289 295
 	return wp_insert_term($tag_name, $taxonomy);
290 296
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-links-list-table.php 3 patches
Braces   +16 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,14 +48,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * List Table API: WP_Links_List_Table class
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- * @since 3.1.0
8
- */
3
+	 * List Table API: WP_Links_List_Table class
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 * @since 3.1.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Core class used to implement displaying links in a list table.
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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' ), 'button', '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'), 'button', 'filter_action', false, array('id' => 'post-query-submit'));
116 116
 ?>
117 117
 		</div>
118 118
 <?php
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 &#8220;%s&#8221;' ), $link->link_name ) ),
190
+			esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $link->link_name)),
191 191
 			$link->link_name
192 192
 		);
193 193
 	}
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&amp;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&amp;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
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/widgets.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Widgets Administration API
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Widgets Administration API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Display list of the available widgets.
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -18,34 +18,34 @@  discard block
 block discarded – undo
18 18
 	global $wp_registered_widgets, $wp_registered_widget_controls;
19 19
 
20 20
 	$sort = $wp_registered_widgets;
21
-	usort( $sort, '_sort_name_callback' );
21
+	usort($sort, '_sort_name_callback');
22 22
 	$done = array();
23 23
 
24
-	foreach ( $sort as $widget ) {
25
-		if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
24
+	foreach ($sort as $widget) {
25
+		if (in_array($widget['callback'], $done, true)) // We already showed this multi-widget
26 26
 			continue;
27 27
 
28
-		$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
28
+		$sidebar = is_active_widget($widget['callback'], $widget['id'], false, false);
29 29
 		$done[] = $widget['callback'];
30 30
 
31
-		if ( ! isset( $widget['params'][0] ) )
31
+		if ( ! isset($widget['params'][0]))
32 32
 			$widget['params'][0] = array();
33 33
 
34
-		$args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' );
34
+		$args = array('widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template');
35 35
 
36
-		if ( isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']) ) {
36
+		if (isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number'])) {
37 37
 			$id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
38 38
 			$args['_temp_id'] = "$id_base-__i__";
39 39
 			$args['_multi_num'] = next_widget_id_number($id_base);
40 40
 			$args['_add'] = 'multi';
41 41
 		} else {
42 42
 			$args['_add'] = 'single';
43
-			if ( $sidebar )
43
+			if ($sidebar)
44 44
 				$args['_hide'] = '1';
45 45
 		}
46 46
 
47
-		$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
48
-		call_user_func_array( 'wp_widget_control', $args );
47
+		$args = wp_list_widget_controls_dynamic_sidebar(array(0 => $args, 1 => $widget['params'][0]));
48
+		call_user_func_array('wp_widget_control', $args);
49 49
 	}
50 50
 }
51 51
 
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return int
59 59
  */
60
-function _sort_name_callback( $a, $b ) {
61
-	return strnatcasecmp( $a['name'], $b['name'] );
60
+function _sort_name_callback($a, $b) {
61
+	return strnatcasecmp($a['name'], $b['name']);
62 62
 }
63 63
 
64 64
 /**
@@ -70,23 +70,23 @@  discard block
 block discarded – undo
70 70
  * @param string $sidebar      Sidebar ID.
71 71
  * @param string $sidebar_name Optional. Sidebar name. Default empty.
72 72
  */
73
-function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
74
-	add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
73
+function wp_list_widget_controls($sidebar, $sidebar_name = '') {
74
+	add_filter('dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar');
75 75
 
76
-	$description = wp_sidebar_description( $sidebar );
76
+	$description = wp_sidebar_description($sidebar);
77 77
 
78
-	echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
78
+	echo '<div id="'.esc_attr($sidebar).'" class="widgets-sortables">';
79 79
 
80
-	if ( $sidebar_name ) {
80
+	if ($sidebar_name) {
81 81
 		?>
82 82
 		<div class="sidebar-name">
83 83
 			<div class="sidebar-name-arrow"><br /></div>
84
-			<h2><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h2>
84
+			<h2><?php echo esc_html($sidebar_name); ?> <span class="spinner"></span></h2>
85 85
 		</div>
86 86
 		<?php
87 87
 	}
88 88
 
89
-	if ( ! empty( $description ) ) {
89
+	if ( ! empty($description)) {
90 90
 		?>
91 91
 		<div class="sidebar-description">
92 92
 			<p class="description"><?php echo $description; ?></p>
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		<?php
95 95
 	}
96 96
 
97
-	dynamic_sidebar( $sidebar );
97
+	dynamic_sidebar($sidebar);
98 98
 
99 99
 	echo '</div>';
100 100
 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  * @param array $params
112 112
  * @return array
113 113
  */
114
-function wp_list_widget_controls_dynamic_sidebar( $params ) {
114
+function wp_list_widget_controls_dynamic_sidebar($params) {
115 115
 	global $wp_registered_widgets;
116 116
 	static $i = 0;
117 117
 	$i++;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	$params[0]['after_widget'] = "</div>";
125 125
 	$params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
126 126
 	$params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated
127
-	if ( is_callable( $wp_registered_widgets[$widget_id]['callback'] ) ) {
127
+	if (is_callable($wp_registered_widgets[$widget_id]['callback'])) {
128 128
 		$wp_registered_widgets[$widget_id]['_callback'] = $wp_registered_widgets[$widget_id]['callback'];
129 129
 		$wp_registered_widgets[$widget_id]['callback'] = 'wp_widget_control';
130 130
 	}
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
  * @param string $id_base
140 140
  * @return int
141 141
  */
142
-function next_widget_id_number( $id_base ) {
142
+function next_widget_id_number($id_base) {
143 143
 	global $wp_registered_widgets;
144 144
 	$number = 1;
145 145
 
146
-	foreach ( $wp_registered_widgets as $widget_id => $widget ) {
147
-		if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )
146
+	foreach ($wp_registered_widgets as $widget_id => $widget) {
147
+		if (preg_match('/'.$id_base.'-([0-9]+)$/', $widget_id, $matches))
148 148
 			$number = max($number, $matches[1]);
149 149
 	}
150 150
 	$number++;
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
  * @param array $sidebar_args
167 167
  * @return array
168 168
  */
169
-function wp_widget_control( $sidebar_args ) {
169
+function wp_widget_control($sidebar_args) {
170 170
 	global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
171 171
 
172 172
 	$widget_id = $sidebar_args['widget_id'];
173 173
 	$sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
174
-	$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : '-1'; // position of widget in sidebar
174
+	$key = $sidebar_id ? array_search($widget_id, $sidebars_widgets[$sidebar_id]) : '-1'; // position of widget in sidebar
175 175
 	$control = isset($wp_registered_widget_controls[$widget_id]) ? $wp_registered_widget_controls[$widget_id] : array();
176 176
 	$widget = $wp_registered_widgets[$widget_id];
177 177
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
 	$multi_number = isset($sidebar_args['_multi_num']) ? $sidebar_args['_multi_num'] : '';
182 182
 	$add_new = isset($sidebar_args['_add']) ? $sidebar_args['_add'] : '';
183 183
 
184
-	$before_form = isset( $sidebar_args['before_form'] ) ? $sidebar_args['before_form'] : '<form method="post">';
185
-	$after_form = isset( $sidebar_args['after_form'] ) ? $sidebar_args['after_form'] : '</form>';
186
-	$before_widget_content = isset( $sidebar_args['before_widget_content'] ) ? $sidebar_args['before_widget_content'] : '<div class="widget-content">';
187
-	$after_widget_content = isset( $sidebar_args['after_widget_content'] ) ? $sidebar_args['after_widget_content'] : '</div>';
184
+	$before_form = isset($sidebar_args['before_form']) ? $sidebar_args['before_form'] : '<form method="post">';
185
+	$after_form = isset($sidebar_args['after_form']) ? $sidebar_args['after_form'] : '</form>';
186
+	$before_widget_content = isset($sidebar_args['before_widget_content']) ? $sidebar_args['before_widget_content'] : '<div class="widget-content">';
187
+	$after_widget_content = isset($sidebar_args['after_widget_content']) ? $sidebar_args['after_widget_content'] : '</div>';
188 188
 
189
-	$query_arg = array( 'editwidget' => $widget['id'] );
190
-	if ( $add_new ) {
189
+	$query_arg = array('editwidget' => $widget['id']);
190
+	if ($add_new) {
191 191
 		$query_arg['addnew'] = 1;
192
-		if ( $multi_number ) {
192
+		if ($multi_number) {
193 193
 			$query_arg['num'] = $multi_number;
194 194
 			$query_arg['base'] = $id_base;
195 195
 		}
@@ -202,27 +202,27 @@  discard block
 block discarded – undo
202 202
 	 * We aren't showing a widget control, we're outputting a template
203 203
 	 * for a multi-widget control.
204 204
 	 */
205
-	if ( isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number ) {
205
+	if (isset($sidebar_args['_display']) && 'template' == $sidebar_args['_display'] && $widget_number) {
206 206
 		// number == -1 implies a template where id numbers are replaced by a generic '__i__'
207 207
 		$control['params'][0]['number'] = -1;
208 208
 		// With id_base widget id's are constructed like {$id_base}-{$id_number}.
209
-		if ( isset($control['id_base']) )
210
-			$id_format = $control['id_base'] . '-__i__';
209
+		if (isset($control['id_base']))
210
+			$id_format = $control['id_base'].'-__i__';
211 211
 	}
212 212
 
213 213
 	$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
214 214
 	unset($wp_registered_widgets[$widget_id]['_callback']);
215 215
 
216
-	$widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) );
216
+	$widget_title = esc_html(strip_tags($sidebar_args['widget_name']));
217 217
 	$has_form = 'noform';
218 218
 
219 219
 	echo $sidebar_args['before_widget']; ?>
220 220
 	<div class="widget-top">
221 221
 	<div class="widget-title-action">
222 222
 		<a class="widget-action hide-if-no-js" href="#available-widgets"></a>
223
-		<a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>">
224
-			<span class="edit"><?php _ex( 'Edit', 'widget' ); ?></span>
225
-			<span class="add"><?php _ex( 'Add', 'widget' ); ?></span>
223
+		<a class="widget-control-edit hide-if-js" href="<?php echo esc_url(add_query_arg($query_arg)); ?>">
224
+			<span class="edit"><?php _ex('Edit', 'widget'); ?></span>
225
+			<span class="add"><?php _ex('Add', 'widget'); ?></span>
226 226
 			<span class="screen-reader-text"><?php echo $widget_title; ?></span>
227 227
 		</a>
228 228
 	</div>
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 	<?php echo $before_form; ?>
234 234
 	<?php echo $before_widget_content; ?>
235 235
 	<?php
236
-	if ( isset( $control['callback'] ) ) {
237
-		$has_form = call_user_func_array( $control['callback'], $control['params'] );
236
+	if (isset($control['callback'])) {
237
+		$has_form = call_user_func_array($control['callback'], $control['params']);
238 238
 	} else {
239
-		echo "\t\t<p>" . __('There are no options for this widget.') . "</p>\n";
239
+		echo "\t\t<p>".__('There are no options for this widget.')."</p>\n";
240 240
 	}
241 241
 	?>
242 242
 	<?php echo $after_widget_content; ?>
243 243
 	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" />
244 244
 	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
245
-	<input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?>" />
246
-	<input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?>" />
245
+	<input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset($control['width'])) echo esc_attr($control['width']); ?>" />
246
+	<input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset($control['height'])) echo esc_attr($control['height']); ?>" />
247 247
 	<input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" />
248 248
 	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
249 249
 	<input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr($add_new); ?>" />
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 		<a class="widget-control-remove" href="#remove"><?php _e('Delete'); ?></a> |
254 254
 		<a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
255 255
 		</div>
256
-		<div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
257
-			<?php submit_button( __( 'Save' ), 'button-primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?>
256
+		<div class="alignright<?php if ('noform' === $has_form) echo ' widget-control-noform'; ?>">
257
+			<?php submit_button(__('Save'), 'button-primary widget-control-save right', 'savewidget', false, array('id' => 'widget-'.esc_attr($id_format).'-savewidget')); ?>
258 258
 			<span class="spinner"></span>
259 259
 		</div>
260 260
 		<br class="clear" />
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	</div>
264 264
 
265 265
 	<div class="widget-description">
266
-<?php echo ( $widget_description = wp_widget_description($widget_id) ) ? "$widget_description\n" : "$widget_title\n"; ?>
266
+<?php echo ($widget_description = wp_widget_description($widget_id)) ? "$widget_description\n" : "$widget_title\n"; ?>
267 267
 	</div>
268 268
 <?php
269 269
 	echo $sidebar_args['after_widget'];
Please login to merge, or discard this patch.
Braces   +27 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,14 +22,17 @@  discard block
 block discarded – undo
22 22
 	$done = array();
23 23
 
24 24
 	foreach ( $sort as $widget ) {
25
-		if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
25
+		if ( in_array( $widget['callback'], $done, true ) ) {
26
+			// We already showed this multi-widget
26 27
 			continue;
28
+		}
27 29
 
28 30
 		$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
29 31
 		$done[] = $widget['callback'];
30 32
 
31
-		if ( ! isset( $widget['params'][0] ) )
32
-			$widget['params'][0] = array();
33
+		if ( ! isset( $widget['params'][0] ) ) {
34
+					$widget['params'][0] = array();
35
+		}
33 36
 
34 37
 		$args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' );
35 38
 
@@ -40,8 +43,9 @@  discard block
 block discarded – undo
40 43
 			$args['_add'] = 'multi';
41 44
 		} else {
42 45
 			$args['_add'] = 'single';
43
-			if ( $sidebar )
44
-				$args['_hide'] = '1';
46
+			if ( $sidebar ) {
47
+							$args['_hide'] = '1';
48
+			}
45 49
 		}
46 50
 
47 51
 		$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
@@ -144,8 +148,9 @@  discard block
 block discarded – undo
144 148
 	$number = 1;
145 149
 
146 150
 	foreach ( $wp_registered_widgets as $widget_id => $widget ) {
147
-		if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) )
148
-			$number = max($number, $matches[1]);
151
+		if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) ) {
152
+					$number = max($number, $matches[1]);
153
+		}
149 154
 	}
150 155
 	$number++;
151 156
 
@@ -206,8 +211,9 @@  discard block
 block discarded – undo
206 211
 		// number == -1 implies a template where id numbers are replaced by a generic '__i__'
207 212
 		$control['params'][0]['number'] = -1;
208 213
 		// With id_base widget id's are constructed like {$id_base}-{$id_number}.
209
-		if ( isset($control['id_base']) )
210
-			$id_format = $control['id_base'] . '-__i__';
214
+		if ( isset($control['id_base']) ) {
215
+					$id_format = $control['id_base'] . '-__i__';
216
+		}
211 217
 	}
212 218
 
213 219
 	$wp_registered_widgets[$widget_id]['callback'] = $wp_registered_widgets[$widget_id]['_callback'];
@@ -242,8 +248,14 @@  discard block
 block discarded – undo
242 248
 	<?php echo $after_widget_content; ?>
243 249
 	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" />
244 250
 	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
245
-	<input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?>" />
246
-	<input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?>" />
251
+	<input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) {
252
+	echo esc_attr($control['width']);
253
+}
254
+?>" />
255
+	<input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) {
256
+	echo esc_attr($control['height']);
257
+}
258
+?>" />
247 259
 	<input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" />
248 260
 	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
249 261
 	<input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr($add_new); ?>" />
@@ -253,7 +265,10 @@  discard block
 block discarded – undo
253 265
 		<a class="widget-control-remove" href="#remove"><?php _e('Delete'); ?></a> |
254 266
 		<a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
255 267
 		</div>
256
-		<div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
268
+		<div class="alignright<?php if ( 'noform' === $has_form ) {
269
+	echo ' widget-control-noform';
270
+}
271
+?>">
257 272
 			<?php submit_button( __( 'Save' ), 'button-primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?>
258 273
 			<span class="spinner"></span>
259 274
 		</div>
Please login to merge, or discard this patch.
src/wp-admin/includes/plugin-install.php 2 patches
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 
68 68
 	if ( false === $res ) {
69 69
 		$url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
70
-		if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
71
-			$url = set_url_scheme( $url, 'https' );
70
+		if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
71
+					$url = set_url_scheme( $url, 'https' );
72
+		}
72 73
 
73 74
 		$http_args = array(
74 75
 			'timeout' => 15,
@@ -88,8 +89,9 @@  discard block
 block discarded – undo
88 89
 			$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
89 90
 		} else {
90 91
 			$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
91
-			if ( ! is_object( $res ) && ! is_array( $res ) )
92
-				$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
92
+			if ( ! is_object( $res ) && ! is_array( $res ) ) {
93
+							$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
94
+			}
93 95
 		}
94 96
 	} elseif ( !is_wp_error($res) ) {
95 97
 		$res->external = true;
@@ -117,13 +119,15 @@  discard block
 block discarded – undo
117 119
  */
118 120
 function install_popular_tags( $args = array() ) {
119 121
 	$key = md5(serialize($args));
120
-	if ( false !== ($tags = get_site_transient('poptags_' . $key) ) )
121
-		return $tags;
122
+	if ( false !== ($tags = get_site_transient('poptags_' . $key) ) ) {
123
+			return $tags;
124
+	}
122 125
 
123 126
 	$tags = plugins_api('hot_tags', $args);
124 127
 
125
-	if ( is_wp_error($tags) )
126
-		return $tags;
128
+	if ( is_wp_error($tags) ) {
129
+			return $tags;
130
+	}
127 131
 
128 132
 	set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS );
129 133
 
@@ -278,8 +282,9 @@  discard block
 block discarded – undo
278 282
  */
279 283
 function install_plugin_install_status($api, $loop = false) {
280 284
 	// This function is called recursively, $loop prevents further loops.
281
-	if ( is_array($api) )
282
-		$api = (object) $api;
285
+	if ( is_array($api) ) {
286
+			$api = (object) $api;
287
+	}
283 288
 
284 289
 	// Default to a "new" plugin
285 290
 	$status = 'install';
@@ -297,8 +302,9 @@  discard block
 block discarded – undo
297 302
 				$status = 'update_available';
298 303
 				$update_file = $file;
299 304
 				$version = $plugin->new_version;
300
-				if ( current_user_can('update_plugins') )
301
-					$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
305
+				if ( current_user_can('update_plugins') ) {
306
+									$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
307
+				}
302 308
 				break;
303 309
 			}
304 310
 		}
@@ -308,8 +314,9 @@  discard block
 block discarded – undo
308 314
 		if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
309 315
 			$installed_plugin = get_plugins('/' . $api->slug);
310 316
 			if ( empty($installed_plugin) ) {
311
-				if ( current_user_can('install_plugins') )
312
-					$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
317
+				if ( current_user_can('install_plugins') ) {
318
+									$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
319
+				}
313 320
 			} else {
314 321
 				$key = array_keys( $installed_plugin );
315 322
 				$key = reset( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
@@ -330,12 +337,14 @@  discard block
 block discarded – undo
330 337
 			}
331 338
 		} else {
332 339
 			// "install" & no directory with that slug
333
-			if ( current_user_can('install_plugins') )
334
-				$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
340
+			if ( current_user_can('install_plugins') ) {
341
+							$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
342
+			}
335 343
 		}
336 344
 	}
337
-	if ( isset($_GET['from']) )
338
-		$url .= '&amp;from=' . urlencode( wp_unslash( $_GET['from'] ) );
345
+	if ( isset($_GET['from']) ) {
346
+			$url .= '&amp;from=' . urlencode( wp_unslash( $_GET['from'] ) );
347
+	}
339 348
 
340 349
 	$file = $update_file;
341 350
 	return compact( 'status', 'url', 'version', 'file' );
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -98,17 +98,17 @@  discard block
 block discarded – undo
98 98
  *         {@link https://developer.wordpress.org/reference/functions/plugins_api/ function reference article}
99 99
  *         for more information on the make-up of possible return values depending on the value of `$action`.
100 100
  */
101
-function plugins_api( $action, $args = array() ) {
101
+function plugins_api($action, $args = array()) {
102 102
 
103
-	if ( is_array( $args ) ) {
103
+	if (is_array($args)) {
104 104
 		$args = (object) $args;
105 105
 	}
106 106
 
107
-	if ( ! isset( $args->per_page ) ) {
107
+	if ( ! isset($args->per_page)) {
108 108
 		$args->per_page = 24;
109 109
 	}
110 110
 
111
-	if ( ! isset( $args->locale ) ) {
111
+	if ( ! isset($args->locale)) {
112 112
 		$args->locale = get_locale();
113 113
 	}
114 114
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @param object $args   Plugin API arguments.
123 123
 	 * @param string $action The type of information being requested from the Plugin Install API.
124 124
 	 */
125
-	$args = apply_filters( 'plugins_api_args', $args, $action );
125
+	$args = apply_filters('plugins_api_args', $args, $action);
126 126
 
127 127
 	/**
128 128
 	 * Filter the response for the current WordPress.org Plugin Install API request.
@@ -138,35 +138,35 @@  discard block
 block discarded – undo
138 138
 	 * @param string             $action The type of information being requested from the Plugin Install API.
139 139
 	 * @param object             $args   Plugin API arguments.
140 140
 	 */
141
-	$res = apply_filters( 'plugins_api', false, $action, $args );
141
+	$res = apply_filters('plugins_api', false, $action, $args);
142 142
 
143
-	if ( false === $res ) {
143
+	if (false === $res) {
144 144
 		$url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
145
-		if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
146
-			$url = set_url_scheme( $url, 'https' );
145
+		if ($ssl = wp_http_supports(array('ssl')))
146
+			$url = set_url_scheme($url, 'https');
147 147
 
148 148
 		$http_args = array(
149 149
 			'timeout' => 15,
150 150
 			'body' => array(
151 151
 				'action' => $action,
152
-				'request' => serialize( $args )
152
+				'request' => serialize($args)
153 153
 			)
154 154
 		);
155
-		$request = wp_remote_post( $url, $http_args );
155
+		$request = wp_remote_post($url, $http_args);
156 156
 
157
-		if ( $ssl && is_wp_error( $request ) ) {
158
-			trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
159
-			$request = wp_remote_post( $http_url, $http_args );
157
+		if ($ssl && is_wp_error($request)) {
158
+			trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.').' '.__('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE);
159
+			$request = wp_remote_post($http_url, $http_args);
160 160
 		}
161 161
 
162
-		if ( is_wp_error($request) ) {
163
-			$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
162
+		if (is_wp_error($request)) {
163
+			$res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), $request->get_error_message());
164 164
 		} else {
165
-			$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
166
-			if ( ! is_object( $res ) && ! is_array( $res ) )
167
-				$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
165
+			$res = maybe_unserialize(wp_remote_retrieve_body($request));
166
+			if ( ! is_object($res) && ! is_array($res))
167
+				$res = new WP_Error('plugins_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request));
168 168
 		}
169
-	} elseif ( !is_wp_error($res) ) {
169
+	} elseif ( ! is_wp_error($res)) {
170 170
 		$res->external = true;
171 171
 	}
172 172
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * @param string          $action The type of information being requested from the Plugin Install API.
180 180
 	 * @param object          $args   Plugin API arguments.
181 181
 	 */
182
-	return apply_filters( 'plugins_api_result', $res, $action, $args );
182
+	return apply_filters('plugins_api_result', $res, $action, $args);
183 183
 }
184 184
 
185 185
 /**
@@ -190,17 +190,17 @@  discard block
 block discarded – undo
190 190
  * @param array $args
191 191
  * @return array
192 192
  */
193
-function install_popular_tags( $args = array() ) {
193
+function install_popular_tags($args = array()) {
194 194
 	$key = md5(serialize($args));
195
-	if ( false !== ($tags = get_site_transient('poptags_' . $key) ) )
195
+	if (false !== ($tags = get_site_transient('poptags_'.$key)))
196 196
 		return $tags;
197 197
 
198 198
 	$tags = plugins_api('hot_tags', $args);
199 199
 
200
-	if ( is_wp_error($tags) )
200
+	if (is_wp_error($tags))
201 201
 		return $tags;
202 202
 
203
-	set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS );
203
+	set_site_transient('poptags_'.$key, $tags, 3 * HOUR_IN_SECONDS);
204 204
 
205 205
 	return $tags;
206 206
 }
@@ -210,34 +210,34 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function install_dashboard() {
212 212
 	?>
213
-	<p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p>
213
+	<p><?php printf(__('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.'), 'https://wordpress.org/plugins/', self_admin_url('plugin-install.php?tab=upload')); ?></p>
214 214
 
215 215
 	<?php display_plugins_table(); ?>
216 216
 
217
-	<h2><?php _e( 'Popular tags' ) ?></h2>
218
-	<p><?php _e( 'You may also browse based on the most popular tags in the Plugin Directory:' ) ?></p>
217
+	<h2><?php _e('Popular tags') ?></h2>
218
+	<p><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
219 219
 	<?php
220 220
 
221 221
 	$api_tags = install_popular_tags();
222 222
 
223 223
 	echo '<p class="popular-tags">';
224
-	if ( is_wp_error($api_tags) ) {
224
+	if (is_wp_error($api_tags)) {
225 225
 		echo $api_tags->get_error_message();
226 226
 	} else {
227 227
 		//Set up the tags in a way which can be interpreted by wp_generate_tag_cloud()
228 228
 		$tags = array();
229
-		foreach ( (array) $api_tags as $tag ) {
230
-			$url = self_admin_url( 'plugin-install.php?tab=search&type=tag&s=' . urlencode( $tag['name'] ) );
229
+		foreach ((array) $api_tags as $tag) {
230
+			$url = self_admin_url('plugin-install.php?tab=search&type=tag&s='.urlencode($tag['name']));
231 231
 			$data = array(
232
-				'link' => esc_url( $url ),
232
+				'link' => esc_url($url),
233 233
 				'name' => $tag['name'],
234 234
 				'slug' => $tag['slug'],
235
-				'id' => sanitize_title_with_dashes( $tag['name'] ),
235
+				'id' => sanitize_title_with_dashes($tag['name']),
236 236
 				'count' => $tag['count']
237 237
 			);
238
-			$tags[ $tag['name'] ] = (object) $data;
238
+			$tags[$tag['name']] = (object) $data;
239 239
 		}
240
-		echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins') ) );
240
+		echo wp_generate_tag_cloud($tags, array('single_text' => __('%s plugin'), 'multiple_text' => __('%s plugins')));
241 241
 	}
242 242
 	echo '</p><br class="clear" />';
243 243
 }
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @param bool $type_selector
251 251
  */
252
-function install_search_form( $type_selector = true ) {
253
-	$type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
254
-	$term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
252
+function install_search_form($type_selector = true) {
253
+	$type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term';
254
+	$term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : '';
255 255
 	$input_attrs = '';
256 256
 	$button_type = 'button screen-reader-text';
257 257
 
258 258
 	// assume no $type_selector means it's a simplified search form
259
-	if ( ! $type_selector ) {
260
-		$input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__( 'Search Plugins' ) . '" ';
259
+	if ( ! $type_selector) {
260
+		$input_attrs = 'class="wp-filter-search" placeholder="'.esc_attr__('Search Plugins').'" ';
261 261
 	}
262 262
 
263 263
 	?><form class="search-form search-plugins" method="get">
264 264
 		<input type="hidden" name="tab" value="search" />
265
-		<?php if ( $type_selector ) : ?>
265
+		<?php if ($type_selector) : ?>
266 266
 		<select name="type" id="typeselector">
267 267
 			<option value="term"<?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
268 268
 			<option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		<label><span class="screen-reader-text"><?php _e('Search Plugins'); ?></span>
273 273
 			<input type="search" name="s" value="<?php echo esc_attr($term) ?>" <?php echo $input_attrs; ?>/>
274 274
 		</label>
275
-		<?php submit_button( __( 'Search Plugins' ), $button_type, false, false, array( 'id' => 'search-submit' ) ); ?>
275
+		<?php submit_button(__('Search Plugins'), $button_type, false, false, array('id' => 'search-submit')); ?>
276 276
 	</form><?php
277 277
 }
278 278
 
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 <div class="upload-plugin">
286 286
 	<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
287 287
 	<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
288
-		<?php wp_nonce_field( 'plugin-upload' ); ?>
289
-		<label class="screen-reader-text" for="pluginzip"><?php _e( 'Plugin zip file' ); ?></label>
288
+		<?php wp_nonce_field('plugin-upload'); ?>
289
+		<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
290 290
 		<input type="file" id="pluginzip" name="pluginzip" />
291
-		<?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
291
+		<?php submit_button(__('Install Now'), 'button', 'install-plugin-submit', false); ?>
292 292
 	</form>
293 293
 </div>
294 294
 <?php
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
  *
301 301
  */
302 302
 function install_plugins_favorites_form() {
303
-	$user = ! empty( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
303
+	$user = ! empty($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites');
304 304
 	?>
305
-	<p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
305
+	<p class="install-help"><?php _e('If you have marked plugins as favorites on WordPress.org, you can browse them here.'); ?></p>
306 306
 	<form method="get">
307 307
 		<input type="hidden" name="tab" value="favorites" />
308 308
 		<p>
309
-			<label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
310
-			<input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
311
-			<input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
309
+			<label for="user"><?php _e('Your WordPress.org username:'); ?></label>
310
+			<input type="search" id="user" name="user" value="<?php echo esc_attr($user); ?>" />
311
+			<input type="submit" class="button" value="<?php esc_attr_e('Get Favorites'); ?>" />
312 312
 		</p>
313 313
 	</form>
314 314
 	<?php
@@ -324,18 +324,18 @@  discard block
 block discarded – undo
324 324
 function display_plugins_table() {
325 325
 	global $wp_list_table;
326 326
 
327
-	switch ( current_filter() ) {
327
+	switch (current_filter()) {
328 328
 		case 'install_plugins_favorites' :
329
-			if ( empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) {
329
+			if (empty($_GET['user']) && ! get_user_option('wporg_favorites')) {
330 330
 				return;
331 331
 			}
332 332
 			break;
333 333
 		case 'install_plugins_recommended' :
334
-			echo '<p>' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '</p>';
334
+			echo '<p>'.__('These suggestions are based on the plugins you and other users have installed.').'</p>';
335 335
 			break;
336 336
 		case 'install_plugins_beta' :
337 337
 			printf(
338
-				'<p>' . __( 'You are using a development version of WordPress. These feature plugins are also under development. <a href="%s">Learn more</a>.' ) . '</p>',
338
+				'<p>'.__('You are using a development version of WordPress. These feature plugins are also under development. <a href="%s">Learn more</a>.').'</p>',
339 339
 				'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/'
340 340
 			);
341 341
 			break;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
  */
360 360
 function install_plugin_install_status($api, $loop = false) {
361 361
 	// This function is called recursively, $loop prevents further loops.
362
-	if ( is_array($api) )
362
+	if (is_array($api))
363 363
 		$api = (object) $api;
364 364
 
365 365
 	// Default to a "new" plugin
@@ -372,37 +372,37 @@  discard block
 block discarded – undo
372 372
 	 * and has an update awaiting it.
373 373
 	 */
374 374
 	$update_plugins = get_site_transient('update_plugins');
375
-	if ( isset( $update_plugins->response ) ) {
376
-		foreach ( (array)$update_plugins->response as $file => $plugin ) {
377
-			if ( $plugin->slug === $api->slug ) {
375
+	if (isset($update_plugins->response)) {
376
+		foreach ((array) $update_plugins->response as $file => $plugin) {
377
+			if ($plugin->slug === $api->slug) {
378 378
 				$status = 'update_available';
379 379
 				$update_file = $file;
380 380
 				$version = $plugin->new_version;
381
-				if ( current_user_can('update_plugins') )
382
-					$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
381
+				if (current_user_can('update_plugins'))
382
+					$url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin='.$update_file), 'upgrade-plugin_'.$update_file);
383 383
 				break;
384 384
 			}
385 385
 		}
386 386
 	}
387 387
 
388
-	if ( 'install' == $status ) {
389
-		if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
390
-			$installed_plugin = get_plugins('/' . $api->slug);
391
-			if ( empty($installed_plugin) ) {
392
-				if ( current_user_can('install_plugins') )
393
-					$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
388
+	if ('install' == $status) {
389
+		if (is_dir(WP_PLUGIN_DIR.'/'.$api->slug)) {
390
+			$installed_plugin = get_plugins('/'.$api->slug);
391
+			if (empty($installed_plugin)) {
392
+				if (current_user_can('install_plugins'))
393
+					$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin='.$api->slug), 'install-plugin_'.$api->slug);
394 394
 			} else {
395
-				$key = array_keys( $installed_plugin );
396
-				$key = reset( $key ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
397
-				$update_file = $api->slug . '/' . $key;
398
-				if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
395
+				$key = array_keys($installed_plugin);
396
+				$key = reset($key); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
397
+				$update_file = $api->slug.'/'.$key;
398
+				if (version_compare($api->version, $installed_plugin[$key]['Version'], '=')) {
399 399
 					$status = 'latest_installed';
400
-				} elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
400
+				} elseif (version_compare($api->version, $installed_plugin[$key]['Version'], '<')) {
401 401
 					$status = 'newer_installed';
402
-					$version = $installed_plugin[ $key ]['Version'];
402
+					$version = $installed_plugin[$key]['Version'];
403 403
 				} else {
404 404
 					//If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
405
-					if ( ! $loop ) {
405
+					if ( ! $loop) {
406 406
 						delete_site_transient('update_plugins');
407 407
 						wp_update_plugins();
408 408
 						return install_plugin_install_status($api, true);
@@ -411,15 +411,15 @@  discard block
 block discarded – undo
411 411
 			}
412 412
 		} else {
413 413
 			// "install" & no directory with that slug
414
-			if ( current_user_can('install_plugins') )
415
-				$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
414
+			if (current_user_can('install_plugins'))
415
+				$url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin='.$api->slug), 'install-plugin_'.$api->slug);
416 416
 		}
417 417
 	}
418
-	if ( isset($_GET['from']) )
419
-		$url .= '&amp;from=' . urlencode( wp_unslash( $_GET['from'] ) );
418
+	if (isset($_GET['from']))
419
+		$url .= '&amp;from='.urlencode(wp_unslash($_GET['from']));
420 420
 
421 421
 	$file = $update_file;
422
-	return compact( 'status', 'url', 'version', 'file' );
422
+	return compact('status', 'url', 'version', 'file');
423 423
 }
424 424
 
425 425
 /**
@@ -433,12 +433,12 @@  discard block
 block discarded – undo
433 433
 function install_plugin_information() {
434 434
 	global $tab;
435 435
 
436
-	if ( empty( $_REQUEST['plugin'] ) ) {
436
+	if (empty($_REQUEST['plugin'])) {
437 437
 		return;
438 438
 	}
439 439
 
440
-	$api = plugins_api( 'plugin_information', array(
441
-		'slug' => wp_unslash( $_REQUEST['plugin'] ),
440
+	$api = plugins_api('plugin_information', array(
441
+		'slug' => wp_unslash($_REQUEST['plugin']),
442 442
 		'is_ssl' => is_ssl(),
443 443
 		'fields' => array(
444 444
 			'banners' => true,
@@ -446,67 +446,67 @@  discard block
 block discarded – undo
446 446
 			'downloaded' => false,
447 447
 			'active_installs' => true
448 448
 		)
449
-	) );
449
+	));
450 450
 
451
-	if ( is_wp_error( $api ) ) {
452
-		wp_die( $api );
451
+	if (is_wp_error($api)) {
452
+		wp_die($api);
453 453
 	}
454 454
 
455 455
 	$plugins_allowedtags = array(
456
-		'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ),
457
-		'abbr' => array( 'title' => array() ), 'acronym' => array( 'title' => array() ),
456
+		'a' => array('href' => array(), 'title' => array(), 'target' => array()),
457
+		'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
458 458
 		'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
459
-		'div' => array( 'class' => array() ), 'span' => array( 'class' => array() ),
459
+		'div' => array('class' => array()), 'span' => array('class' => array()),
460 460
 		'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
461 461
 		'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
462
-		'img' => array( 'src' => array(), 'class' => array(), 'alt' => array() )
462
+		'img' => array('src' => array(), 'class' => array(), 'alt' => array())
463 463
 	);
464 464
 
465 465
 	$plugins_section_titles = array(
466
-		'description'  => _x( 'Description',  'Plugin installer section title' ),
467
-		'installation' => _x( 'Installation', 'Plugin installer section title' ),
468
-		'faq'          => _x( 'FAQ',          'Plugin installer section title' ),
469
-		'screenshots'  => _x( 'Screenshots',  'Plugin installer section title' ),
470
-		'changelog'    => _x( 'Changelog',    'Plugin installer section title' ),
471
-		'reviews'      => _x( 'Reviews',      'Plugin installer section title' ),
472
-		'other_notes'  => _x( 'Other Notes',  'Plugin installer section title' )
466
+		'description'  => _x('Description', 'Plugin installer section title'),
467
+		'installation' => _x('Installation', 'Plugin installer section title'),
468
+		'faq'          => _x('FAQ', 'Plugin installer section title'),
469
+		'screenshots'  => _x('Screenshots', 'Plugin installer section title'),
470
+		'changelog'    => _x('Changelog', 'Plugin installer section title'),
471
+		'reviews'      => _x('Reviews', 'Plugin installer section title'),
472
+		'other_notes'  => _x('Other Notes', 'Plugin installer section title')
473 473
 	);
474 474
 
475 475
 	// Sanitize HTML
476
-	foreach ( (array) $api->sections as $section_name => $content ) {
477
-		$api->sections[$section_name] = wp_kses( $content, $plugins_allowedtags );
476
+	foreach ((array) $api->sections as $section_name => $content) {
477
+		$api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
478 478
 	}
479 479
 
480
-	foreach ( array( 'version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug' ) as $key ) {
481
-		if ( isset( $api->$key ) ) {
482
-			$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
480
+	foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
481
+		if (isset($api->$key)) {
482
+			$api->$key = wp_kses($api->$key, $plugins_allowedtags);
483 483
 		}
484 484
 	}
485 485
 
486
-	$_tab = esc_attr( $tab );
486
+	$_tab = esc_attr($tab);
487 487
 
488
-	$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
489
-	if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
490
-		$section_titles = array_keys( (array) $api->sections );
491
-		$section = reset( $section_titles );
488
+	$section = isset($_REQUEST['section']) ? wp_unslash($_REQUEST['section']) : 'description'; // Default to the Description tab, Do not translate, API returns English.
489
+	if (empty($section) || ! isset($api->sections[$section])) {
490
+		$section_titles = array_keys((array) $api->sections);
491
+		$section = reset($section_titles);
492 492
 	}
493 493
 
494
-	iframe_header( __( 'Plugin Install' ) );
494
+	iframe_header(__('Plugin Install'));
495 495
 
496 496
 	$_with_banner = '';
497 497
 
498
-	if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
498
+	if ( ! empty($api->banners) && ( ! empty($api->banners['low']) || ! empty($api->banners['high']))) {
499 499
 		$_with_banner = 'with-banner';
500
-		$low  = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
501
-		$high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
500
+		$low  = empty($api->banners['low']) ? $api->banners['high'] : $api->banners['low'];
501
+		$high = empty($api->banners['high']) ? $api->banners['low'] : $api->banners['high'];
502 502
 		?>
503 503
 		<style type="text/css">
504 504
 			#plugin-information-title.with-banner {
505
-				background-image: url( <?php echo esc_url( $low ); ?> );
505
+				background-image: url( <?php echo esc_url($low); ?> );
506 506
 			}
507 507
 			@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) {
508 508
 				#plugin-information-title.with-banner {
509
-					background-image: url( <?php echo esc_url( $high ); ?> );
509
+					background-image: url( <?php echo esc_url($high); ?> );
510 510
 				}
511 511
 			}
512 512
 		</style>
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
518 518
 	echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
519 519
 
520
-	foreach ( (array) $api->sections as $section_name => $content ) {
521
-		if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
520
+	foreach ((array) $api->sections as $section_name => $content) {
521
+		if ('reviews' === $section_name && (empty($api->ratings) || 0 === array_sum((array) $api->ratings))) {
522 522
 			continue;
523 523
 		}
524 524
 
525
-		if ( isset( $plugins_section_titles[ $section_name ] ) ) {
526
-			$title = $plugins_section_titles[ $section_name ];
525
+		if (isset($plugins_section_titles[$section_name])) {
526
+			$title = $plugins_section_titles[$section_name];
527 527
 		} else {
528
-			$title = ucwords( str_replace( '_', ' ', $section_name ) );
528
+			$title = ucwords(str_replace('_', ' ', $section_name));
529 529
 		}
530 530
 
531
-		$class = ( $section_name === $section ) ? ' class="current"' : '';
532
-		$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
533
-		$href = esc_url( $href );
534
-		$san_section = esc_attr( $section_name );
531
+		$class = ($section_name === $section) ? ' class="current"' : '';
532
+		$href = add_query_arg(array('tab' => $tab, 'section' => $section_name));
533
+		$href = esc_url($href);
534
+		$san_section = esc_attr($section_name);
535 535
 		echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
536 536
 	}
537 537
 
@@ -541,77 +541,77 @@  discard block
 block discarded – undo
541 541
 	<div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
542 542
 	<div class="fyi">
543 543
 		<ul>
544
-		<?php if ( ! empty( $api->version ) ) { ?>
545
-			<li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
546
-		<?php } if ( ! empty( $api->author ) ) { ?>
547
-			<li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li>
548
-		<?php } if ( ! empty( $api->last_updated ) ) { ?>
549
-			<li><strong><?php _e( 'Last Updated:' ); ?></strong>
550
-				<?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
544
+		<?php if ( ! empty($api->version)) { ?>
545
+			<li><strong><?php _e('Version:'); ?></strong> <?php echo $api->version; ?></li>
546
+		<?php } if ( ! empty($api->author)) { ?>
547
+			<li><strong><?php _e('Author:'); ?></strong> <?php echo links_add_target($api->author, '_blank'); ?></li>
548
+		<?php } if ( ! empty($api->last_updated)) { ?>
549
+			<li><strong><?php _e('Last Updated:'); ?></strong>
550
+				<?php printf(__('%s ago'), human_time_diff(strtotime($api->last_updated))); ?>
551 551
 			</li>
552
-		<?php } if ( ! empty( $api->requires ) ) { ?>
553
-			<li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li>
554
-		<?php } if ( ! empty( $api->tested ) ) { ?>
555
-			<li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li>
556
-		<?php } if ( ! empty( $api->active_installs ) ) { ?>
557
-			<li><strong><?php _e( 'Active Installs:' ); ?></strong> <?php
558
-				if ( $api->active_installs >= 1000000 ) {
559
-					_ex( '1+ Million', 'Active plugin installs' );
552
+		<?php } if ( ! empty($api->requires)) { ?>
553
+			<li><strong><?php _e('Requires WordPress Version:'); ?></strong> <?php printf(__('%s or higher'), $api->requires); ?></li>
554
+		<?php } if ( ! empty($api->tested)) { ?>
555
+			<li><strong><?php _e('Compatible up to:'); ?></strong> <?php echo $api->tested; ?></li>
556
+		<?php } if ( ! empty($api->active_installs)) { ?>
557
+			<li><strong><?php _e('Active Installs:'); ?></strong> <?php
558
+				if ($api->active_installs >= 1000000) {
559
+					_ex('1+ Million', 'Active plugin installs');
560 560
 				} else {
561
-					echo number_format_i18n( $api->active_installs ) . '+';
561
+					echo number_format_i18n($api->active_installs).'+';
562 562
 				}
563 563
 			?></li>
564
-		<?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?>
565
-			<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page &#187;' ); ?></a></li>
566
-		<?php } if ( ! empty( $api->homepage ) ) { ?>
567
-			<li><a target="_blank" href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage &#187;' ); ?></a></li>
568
-		<?php } if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { ?>
569
-			<li><a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a></li>
564
+		<?php } if ( ! empty($api->slug) && empty($api->external)) { ?>
565
+			<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e('WordPress.org Plugin Page &#187;'); ?></a></li>
566
+		<?php } if ( ! empty($api->homepage)) { ?>
567
+			<li><a target="_blank" href="<?php echo esc_url($api->homepage); ?>"><?php _e('Plugin Homepage &#187;'); ?></a></li>
568
+		<?php } if ( ! empty($api->donate_link) && empty($api->contributors)) { ?>
569
+			<li><a target="_blank" href="<?php echo esc_url($api->donate_link); ?>"><?php _e('Donate to this plugin &#187;'); ?></a></li>
570 570
 		<?php } ?>
571 571
 		</ul>
572
-		<?php if ( ! empty( $api->rating ) ) { ?>
573
-		<h3><?php _e( 'Average Rating' ); ?></h3>
574
-		<?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
575
-		<p aria-hidden="true" class="fyi-description"><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></p>
572
+		<?php if ( ! empty($api->rating)) { ?>
573
+		<h3><?php _e('Average Rating'); ?></h3>
574
+		<?php wp_star_rating(array('rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings)); ?>
575
+		<p aria-hidden="true" class="fyi-description"><?php printf(_n('(based on %s rating)', '(based on %s ratings)', $api->num_ratings), number_format_i18n($api->num_ratings)); ?></p>
576 576
 		<?php }
577 577
 
578
-		if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) { ?>
579
-			<h3><?php _e( 'Reviews' ); ?></h3>
580
-			<p class="fyi-description"><?php _e( 'Read all reviews on WordPress.org or write your own!' ); ?></p>
578
+		if ( ! empty($api->ratings) && array_sum((array) $api->ratings) > 0) { ?>
579
+			<h3><?php _e('Reviews'); ?></h3>
580
+			<p class="fyi-description"><?php _e('Read all reviews on WordPress.org or write your own!'); ?></p>
581 581
 			<?php
582
-			foreach ( $api->ratings as $key => $ratecount ) {
582
+			foreach ($api->ratings as $key => $ratecount) {
583 583
 				// Avoid div-by-zero.
584
-				$_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
584
+				$_rating = $api->num_ratings ? ($ratecount / $api->num_ratings) : 0;
585 585
 				/* translators: 1: number of stars, 2: number of reviews */
586
-				$aria_label = esc_attr( sprintf( _n( 'Reviews with %1$d star: %2$d. Opens in a new window.', 'Reviews with %1$d stars: %2$d. Opens in a new window.', $key ),
586
+				$aria_label = esc_attr(sprintf(_n('Reviews with %1$d star: %2$d. Opens in a new window.', 'Reviews with %1$d stars: %2$d. Opens in a new window.', $key),
587 587
 					$key,
588
-					number_format_i18n( $ratecount )
589
-				) );
588
+					number_format_i18n($ratecount)
589
+				));
590 590
 				?>
591 591
 				<div class="counter-container">
592 592
 					<span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
593
-						target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
593
+						target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf(_n('%d star', '%d stars', $key), $key); ?></a></span>
594 594
 					<span class="counter-back">
595 595
 						<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
596 596
 					</span>
597
-					<span class="counter-count" aria-hidden="true"><?php echo number_format_i18n( $ratecount ); ?></span>
597
+					<span class="counter-count" aria-hidden="true"><?php echo number_format_i18n($ratecount); ?></span>
598 598
 				</div>
599 599
 				<?php
600 600
 			}
601 601
 		}
602
-		if ( ! empty( $api->contributors ) ) { ?>
603
-			<h3><?php _e( 'Contributors' ); ?></h3>
602
+		if ( ! empty($api->contributors)) { ?>
603
+			<h3><?php _e('Contributors'); ?></h3>
604 604
 			<ul class="contributors">
605 605
 				<?php
606
-				foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
607
-					if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
606
+				foreach ((array) $api->contributors as $contrib_username => $contrib_profile) {
607
+					if (empty($contrib_username) && empty($contrib_profile)) {
608 608
 						continue;
609 609
 					}
610
-					if ( empty( $contrib_username ) ) {
611
-						$contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
610
+					if (empty($contrib_username)) {
611
+						$contrib_username = preg_replace('/^.+\/(.+)\/?$/', '\1', $contrib_profile);
612 612
 					}
613
-					$contrib_username = sanitize_user( $contrib_username );
614
-					if ( empty( $contrib_profile ) ) {
613
+					$contrib_username = sanitize_user($contrib_username);
614
+					if (empty($contrib_profile)) {
615 615
 						echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' alt='' />{$contrib_username}</li>";
616 616
 					} else {
617 617
 						echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' alt='' />{$contrib_username}</a></li>";
@@ -619,26 +619,26 @@  discard block
 block discarded – undo
619 619
 				}
620 620
 				?>
621 621
 			</ul>
622
-			<?php if ( ! empty( $api->donate_link ) ) { ?>
623
-				<a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
622
+			<?php if ( ! empty($api->donate_link)) { ?>
623
+				<a target="_blank" href="<?php echo esc_url($api->donate_link); ?>"><?php _e('Donate to this plugin &#187;'); ?></a>
624 624
 			<?php } ?>
625 625
 		<?php } ?>
626 626
 	</div>
627 627
 	<div id="section-holder" class="wrap">
628 628
 	<?php
629
-		if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
630
-			echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.' ) . '</p></div>';
631
-		} elseif ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
632
-			echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.' ) . '</p></div>';
629
+		if ( ! empty($api->tested) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>')) {
630
+			echo '<div class="notice notice-warning notice-alt"><p>'.__('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.').'</p></div>';
631
+		} elseif ( ! empty($api->requires) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<')) {
632
+			echo '<div class="notice notice-warning notice-alt"><p>'.__('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.').'</p></div>';
633 633
 		}
634 634
 
635
-		foreach ( (array) $api->sections as $section_name => $content ) {
636
-			$content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
637
-			$content = links_add_target( $content, '_blank' );
635
+		foreach ((array) $api->sections as $section_name => $content) {
636
+			$content = links_add_base_url($content, 'https://wordpress.org/plugins/'.$api->slug.'/');
637
+			$content = links_add_target($content, '_blank');
638 638
 
639
-			$san_section = esc_attr( $section_name );
639
+			$san_section = esc_attr($section_name);
640 640
 
641
-			$display = ( $section_name === $section ) ? 'block' : 'none';
641
+			$display = ($section_name === $section) ? 'block' : 'none';
642 642
 
643 643
 			echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
644 644
 			echo $content;
@@ -648,24 +648,24 @@  discard block
 block discarded – undo
648 648
 	echo "</div>\n";
649 649
 	echo "</div>\n"; // #plugin-information-scrollable
650 650
 	echo "<div id='$tab-footer'>\n";
651
-	if ( ! empty( $api->download_link ) && ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
652
-		$status = install_plugin_install_status( $api );
653
-		switch ( $status['status'] ) {
651
+	if ( ! empty($api->download_link) && (current_user_can('install_plugins') || current_user_can('update_plugins'))) {
652
+		$status = install_plugin_install_status($api);
653
+		switch ($status['status']) {
654 654
 			case 'install':
655
-				if ( $status['url'] ) {
656
-					echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
655
+				if ($status['url']) {
656
+					echo '<a class="button button-primary right" href="'.$status['url'].'" target="_parent">'.__('Install Now').'</a>';
657 657
 				}
658 658
 				break;
659 659
 			case 'update_available':
660
-				if ( $status['url'] ) {
661
-					echo '<a data-slug="' . esc_attr( $api->slug ) . '" data-plugin="' . esc_attr( $status['file'] ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
660
+				if ($status['url']) {
661
+					echo '<a data-slug="'.esc_attr($api->slug).'" data-plugin="'.esc_attr($status['file']).'" id="plugin_update_from_iframe" class="button button-primary right" href="'.$status['url'].'" target="_parent">'.__('Install Update Now').'</a>';
662 662
 				}
663 663
 				break;
664 664
 			case 'newer_installed':
665
-				echo '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed'), $status['version'] ) . '</a>';
665
+				echo '<a class="button button-primary right disabled">'.sprintf(__('Newer Version (%s) Installed'), $status['version']).'</a>';
666 666
 				break;
667 667
 			case 'latest_installed':
668
-				echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
668
+				echo '<a class="button button-primary right disabled">'.__('Latest Version Installed').'</a>';
669 669
 				break;
670 670
 		}
671 671
 	}
Please login to merge, or discard this patch.
src/wp-admin/includes/update-core.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress core upgrade functionality.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- * @since 2.7.0
8
- */
3
+	 * WordPress core upgrade functionality.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 * @since 2.7.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Stores files to be deleted.
Please login to merge, or discard this patch.
Braces   +126 added lines, -88 removed lines patch added patch discarded remove patch
@@ -849,20 +849,23 @@  discard block
 block discarded – undo
849 849
 	$old_wp_version = $wp_version; // The version of WordPress we're updating from
850 850
 	$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' )  ); // a dash in the version indicates a Development release
851 851
 	$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
852
-	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
853
-		$mysql_compat = true;
854
-	else
855
-		$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
852
+	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
853
+			$mysql_compat = true;
854
+	} else {
855
+			$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
856
+	}
856 857
 
857
-	if ( !$mysql_compat || !$php_compat )
858
-		$wp_filesystem->delete($from, true);
858
+	if ( !$mysql_compat || !$php_compat ) {
859
+			$wp_filesystem->delete($from, true);
860
+	}
859 861
 
860
-	if ( !$mysql_compat && !$php_compat )
861
-		return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s 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 ) );
862
-	elseif ( !$php_compat )
863
-		return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) );
864
-	elseif ( !$mysql_compat )
865
-		return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) );
862
+	if ( !$mysql_compat && !$php_compat ) {
863
+			return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s 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 ) );
864
+	} elseif ( !$php_compat ) {
865
+			return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) );
866
+	} elseif ( !$mysql_compat ) {
867
+			return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) );
868
+	}
866 869
 
867 870
 	/** This filter is documented in wp-admin/includes/update-core.php */
868 871
 	apply_filters( 'update_feedback', __( 'Preparing to install the latest version&#8230;' ) );
@@ -878,20 +881,26 @@  discard block
 block discarded – undo
878 881
 		$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
879 882
 
880 883
 		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
881
-		if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) )
882
-			$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
884
+		if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
885
+					$checksums = $checksums[ $wp_version ];
886
+		}
887
+		// Compat code for 3.7-beta2
883 888
 		if ( is_array( $checksums ) ) {
884 889
 			foreach( $checksums as $file => $checksum ) {
885
-				if ( 'wp-content' == substr( $file, 0, 10 ) )
886
-					continue;
887
-				if ( ! file_exists( ABSPATH . $file ) )
888
-					continue;
889
-				if ( ! file_exists( $working_dir_local . $file ) )
890
-					continue;
891
-				if ( md5_file( ABSPATH . $file ) === $checksum )
892
-					$skip[] = $file;
893
-				else
894
-					$check_is_writable[ $file ] = ABSPATH . $file;
890
+				if ( 'wp-content' == substr( $file, 0, 10 ) ) {
891
+									continue;
892
+				}
893
+				if ( ! file_exists( ABSPATH . $file ) ) {
894
+									continue;
895
+				}
896
+				if ( ! file_exists( $working_dir_local . $file ) ) {
897
+									continue;
898
+				}
899
+				if ( md5_file( ABSPATH . $file ) === $checksum ) {
900
+									$skip[] = $file;
901
+				} else {
902
+									$check_is_writable[ $file ] = ABSPATH . $file;
903
+				}
895 904
 			}
896 905
 		}
897 906
 	}
@@ -904,15 +913,17 @@  discard block
 block discarded – undo
904 913
 			foreach ( $files_not_writable as $relative_file_not_writable => $file_not_writable ) {
905 914
 				// If the writable check failed, chmod file to 0644 and try again, same as copy_dir().
906 915
 				$wp_filesystem->chmod( $file_not_writable, FS_CHMOD_FILE );
907
-				if ( $wp_filesystem->is_writable( $file_not_writable ) )
908
-					unset( $files_not_writable[ $relative_file_not_writable ] );
916
+				if ( $wp_filesystem->is_writable( $file_not_writable ) ) {
917
+									unset( $files_not_writable[ $relative_file_not_writable ] );
918
+				}
909 919
 			}
910 920
 
911 921
 			// Store package-relative paths (the key) of non-writable files in the WP_Error object.
912 922
 			$error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : '';
913 923
 
914
-			if ( $files_not_writable )
915
-				return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) );
924
+			if ( $files_not_writable ) {
925
+							return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) );
926
+			}
916 927
 		}
917 928
 	}
918 929
 
@@ -928,8 +939,9 @@  discard block
 block discarded – undo
928 939
 	apply_filters( 'update_feedback', __( 'Copying the required files&#8230;' ) );
929 940
 	// Copy new versions of WP files into place.
930 941
 	$result = _copy_dir( $from . $distro, $to, $skip );
931
-	if ( is_wp_error( $result ) )
932
-		$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
942
+	if ( is_wp_error( $result ) ) {
943
+			$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
944
+	}
933 945
 
934 946
 	// Since we know the core files have copied over, we can now copy the version file
935 947
 	if ( ! is_wp_error( $result ) ) {
@@ -945,14 +957,17 @@  discard block
 block discarded – undo
945 957
 	$failed = array();
946 958
 	if ( isset( $checksums ) && is_array( $checksums ) ) {
947 959
 		foreach ( $checksums as $file => $checksum ) {
948
-			if ( 'wp-content' == substr( $file, 0, 10 ) )
949
-				continue;
950
-			if ( ! file_exists( $working_dir_local . $file ) )
951
-				continue;
952
-			if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum )
953
-				$skip[] = $file;
954
-			else
955
-				$failed[] = $file;
960
+			if ( 'wp-content' == substr( $file, 0, 10 ) ) {
961
+							continue;
962
+			}
963
+			if ( ! file_exists( $working_dir_local . $file ) ) {
964
+							continue;
965
+			}
966
+			if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum ) {
967
+							$skip[] = $file;
968
+			} else {
969
+							$failed[] = $file;
970
+			}
956 971
 		}
957 972
 	}
958 973
 
@@ -960,8 +975,9 @@  discard block
 block discarded – undo
960 975
 	if ( ! empty( $failed ) ) {
961 976
 		$total_size = 0;
962 977
 		foreach ( $failed as $file ) {
963
-			if ( file_exists( $working_dir_local . $file ) )
964
-				$total_size += filesize( $working_dir_local . $file );
978
+			if ( file_exists( $working_dir_local . $file ) ) {
979
+							$total_size += filesize( $working_dir_local . $file );
980
+			}
965 981
 		}
966 982
 
967 983
 		// If we don't have enough free space, it isn't worth trying again.
@@ -971,18 +987,20 @@  discard block
 block discarded – undo
971 987
 			$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
972 988
 		} else {
973 989
 			$result = _copy_dir( $from . $distro, $to, $skip );
974
-			if ( is_wp_error( $result ) )
975
-				$result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
990
+			if ( is_wp_error( $result ) ) {
991
+							$result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
992
+			}
976 993
 		}
977 994
 	}
978 995
 
979 996
 	// Custom Content Directory needs updating now.
980 997
 	// Copy Languages
981 998
 	if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) {
982
-		if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) )
983
-			$lang_dir = WP_LANG_DIR;
984
-		else
985
-			$lang_dir = WP_CONTENT_DIR . '/languages';
999
+		if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) ) {
1000
+					$lang_dir = WP_LANG_DIR;
1001
+		} else {
1002
+					$lang_dir = WP_CONTENT_DIR . '/languages';
1003
+		}
986 1004
 
987 1005
 		if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first
988 1006
 			$wp_filesystem->mkdir($to . str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
@@ -993,8 +1011,9 @@  discard block
 block discarded – undo
993 1011
 			$wp_lang_dir = $wp_filesystem->find_folder($lang_dir);
994 1012
 			if ( $wp_lang_dir ) {
995 1013
 				$result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);
996
-				if ( is_wp_error( $result ) )
997
-					$result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
1014
+				if ( is_wp_error( $result ) ) {
1015
+									$result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
1016
+				}
998 1017
 			}
999 1018
 		}
1000 1019
 	}
@@ -1022,33 +1041,41 @@  discard block
 block discarded – undo
1022 1041
 				list($type, $filename) = explode('/', $file, 2);
1023 1042
 
1024 1043
 				// Check to see if the bundled items exist before attempting to copy them
1025
-				if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) )
1026
-					continue;
1044
+				if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) {
1045
+									continue;
1046
+				}
1027 1047
 
1028
-				if ( 'plugins' == $type )
1029
-					$dest = $wp_filesystem->wp_plugins_dir();
1030
-				elseif ( 'themes' == $type )
1031
-					$dest = trailingslashit($wp_filesystem->wp_themes_dir()); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2
1032
-				else
1033
-					continue;
1048
+				if ( 'plugins' == $type ) {
1049
+									$dest = $wp_filesystem->wp_plugins_dir();
1050
+				} elseif ( 'themes' == $type ) {
1051
+									$dest = trailingslashit($wp_filesystem->wp_themes_dir());
1052
+				}
1053
+				// Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2
1054
+				else {
1055
+									continue;
1056
+				}
1034 1057
 
1035 1058
 				if ( ! $directory ) {
1036
-					if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) )
1037
-						continue;
1059
+					if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) ) {
1060
+											continue;
1061
+					}
1038 1062
 
1039
-					if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
1040
-						$result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
1063
+					if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) ) {
1064
+											$result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
1065
+					}
1041 1066
 				} else {
1042
-					if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) )
1043
-						continue;
1067
+					if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) ) {
1068
+											continue;
1069
+					}
1044 1070
 
1045 1071
 					$wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR);
1046 1072
 					$_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename);
1047 1073
 
1048 1074
 					// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
1049 1075
 					if ( is_wp_error( $_result ) ) {
1050
-						if ( ! is_wp_error( $result ) )
1051
-							$result = new WP_Error;
1076
+						if ( ! is_wp_error( $result ) ) {
1077
+													$result = new WP_Error;
1078
+						}
1052 1079
 						$result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), substr( $_result->get_error_data(), strlen( $dest ) ) );
1053 1080
 					}
1054 1081
 				}
@@ -1065,8 +1092,9 @@  discard block
 block discarded – undo
1065 1092
 	// Remove old files
1066 1093
 	foreach ( $_old_files as $old_file ) {
1067 1094
 		$old_file = $to . $old_file;
1068
-		if ( !$wp_filesystem->exists($old_file) )
1069
-			continue;
1095
+		if ( !$wp_filesystem->exists($old_file) ) {
1096
+					continue;
1097
+		}
1070 1098
 		$wp_filesystem->delete($old_file, true);
1071 1099
 	}
1072 1100
 
@@ -1088,10 +1116,11 @@  discard block
 block discarded – undo
1088 1116
 	$wp_filesystem->delete($from, true);
1089 1117
 
1090 1118
 	// Force refresh of update information
1091
-	if ( function_exists('delete_site_transient') )
1092
-		delete_site_transient('update_core');
1093
-	else
1094
-		delete_option('update_core');
1119
+	if ( function_exists('delete_site_transient') ) {
1120
+			delete_site_transient('update_core');
1121
+	} else {
1122
+			delete_option('update_core');
1123
+	}
1095 1124
 
1096 1125
 	/**
1097 1126
 	 * Fires after WordPress core has been successfully updated.
@@ -1103,8 +1132,9 @@  discard block
 block discarded – undo
1103 1132
 	do_action( '_core_updated_successfully', $wp_version );
1104 1133
 
1105 1134
 	// Clear the option that blocks auto updates after failures, now that we've been successful.
1106
-	if ( function_exists( 'delete_site_option' ) )
1107
-		delete_site_option( 'auto_core_update_failed' );
1135
+	if ( function_exists( 'delete_site_option' ) ) {
1136
+			delete_site_option( 'auto_core_update_failed' );
1137
+	}
1108 1138
 
1109 1139
 	return $wp_version;
1110 1140
 }
@@ -1137,20 +1167,23 @@  discard block
 block discarded – undo
1137 1167
 	$to = trailingslashit($to);
1138 1168
 
1139 1169
 	foreach ( (array) $dirlist as $filename => $fileinfo ) {
1140
-		if ( in_array( $filename, $skip_list ) )
1141
-			continue;
1170
+		if ( in_array( $filename, $skip_list ) ) {
1171
+					continue;
1172
+		}
1142 1173
 
1143 1174
 		if ( 'f' == $fileinfo['type'] ) {
1144 1175
 			if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
1145 1176
 				// If copy failed, chmod file to 0644 and try again.
1146 1177
 				$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
1147
-				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
1148
-					return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
1178
+				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
1179
+									return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
1180
+				}
1149 1181
 			}
1150 1182
 		} elseif ( 'd' == $fileinfo['type'] ) {
1151 1183
 			if ( !$wp_filesystem->is_dir($to . $filename) ) {
1152
-				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
1153
-					return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
1184
+				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) {
1185
+									return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
1186
+				}
1154 1187
 			}
1155 1188
 
1156 1189
 			/*
@@ -1159,13 +1192,15 @@  discard block
 block discarded – undo
1159 1192
 			 */
1160 1193
 			$sub_skip_list = array();
1161 1194
 			foreach ( $skip_list as $skip_item ) {
1162
-				if ( 0 === strpos( $skip_item, $filename . '/' ) )
1163
-					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
1195
+				if ( 0 === strpos( $skip_item, $filename . '/' ) ) {
1196
+									$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
1197
+				}
1164 1198
 			}
1165 1199
 
1166 1200
 			$result = _copy_dir($from . $filename, $to . $filename, $sub_skip_list);
1167
-			if ( is_wp_error($result) )
1168
-				return $result;
1201
+			if ( is_wp_error($result) ) {
1202
+							return $result;
1203
+			}
1169 1204
 		}
1170 1205
 	}
1171 1206
 	return true;
@@ -1187,15 +1222,18 @@  discard block
 block discarded – undo
1187 1222
 function _redirect_to_about_wordpress( $new_version ) {
1188 1223
 	global $wp_version, $pagenow, $action;
1189 1224
 
1190
-	if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
1191
-		return;
1225
+	if ( version_compare( $wp_version, '3.4-RC1', '>=' ) ) {
1226
+			return;
1227
+	}
1192 1228
 
1193 1229
 	// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
1194
-	if ( 'update-core.php' != $pagenow )
1195
-		return;
1230
+	if ( 'update-core.php' != $pagenow ) {
1231
+			return;
1232
+	}
1196 1233
 
1197
- 	if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
1198
- 		return;
1234
+ 	if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action ) {
1235
+ 	 		return;
1236
+ 	}
1199 1237
 
1200 1238
 	// Load the updated default text localization domain for new strings.
1201 1239
 	load_default_textdomain();
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -739,8 +739,8 @@  discard block
 block discarded – undo
739 739
 );
740 740
 
741 741
 // If not explicitly defined as false, don't install new default themes.
742
-if ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || CORE_UPGRADE_SKIP_NEW_BUNDLED ) {
743
-	$_new_bundled_files = array( 'plugins/akismet/' => '2.0' );
742
+if ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || CORE_UPGRADE_SKIP_NEW_BUNDLED) {
743
+	$_new_bundled_files = array('plugins/akismet/' => '2.0');
744 744
 }
745 745
 
746 746
 /**
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 function update_core($from, $to) {
801 801
 	global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
802 802
 
803
-	@set_time_limit( 300 );
803
+	@set_time_limit(300);
804 804
 
805 805
 	/**
806 806
 	 * Filter feedback messages displayed during the core update process.
@@ -819,20 +819,20 @@  discard block
 block discarded – undo
819 819
 	 *
820 820
 	 * @param string $feedback The core update feedback messages.
821 821
 	 */
822
-	apply_filters( 'update_feedback', __( 'Verifying the unpacked files&#8230;' ) );
822
+	apply_filters('update_feedback', __('Verifying the unpacked files&#8230;'));
823 823
 
824 824
 	// Sanity check the unzipped distribution.
825 825
 	$distro = '';
826
-	$roots = array( '/wordpress/', '/wordpress-mu/' );
827
-	foreach ( $roots as $root ) {
828
-		if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) ) {
826
+	$roots = array('/wordpress/', '/wordpress-mu/');
827
+	foreach ($roots as $root) {
828
+		if ($wp_filesystem->exists($from.$root.'readme.html') && $wp_filesystem->exists($from.$root.'wp-includes/version.php')) {
829 829
 			$distro = $root;
830 830
 			break;
831 831
 		}
832 832
 	}
833
-	if ( ! $distro ) {
834
-		$wp_filesystem->delete( $from, true );
835
-		return new WP_Error( 'insane_distro', __('The update could not be unpacked') );
833
+	if ( ! $distro) {
834
+		$wp_filesystem->delete($from, true);
835
+		return new WP_Error('insane_distro', __('The update could not be unpacked'));
836 836
 	}
837 837
 
838 838
 
@@ -846,122 +846,122 @@  discard block
 block discarded – undo
846 846
 	 */
847 847
 	global $wp_version, $required_php_version, $required_mysql_version;
848 848
 
849
-	$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';
850
-	if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
851
-		$wp_filesystem->delete( $from, true );
852
-		return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
849
+	$versions_file = trailingslashit($wp_filesystem->wp_content_dir()).'upgrade/version-current.php';
850
+	if ( ! $wp_filesystem->copy($from.$distro.'wp-includes/version.php', $versions_file)) {
851
+		$wp_filesystem->delete($from, true);
852
+		return new WP_Error('copy_failed_for_version_file', __('The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.'), 'wp-includes/version.php');
853 853
 	}
854 854
 
855
-	$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );
856
-	require( WP_CONTENT_DIR . '/upgrade/version-current.php' );
857
-	$wp_filesystem->delete( $versions_file );
855
+	$wp_filesystem->chmod($versions_file, FS_CHMOD_FILE);
856
+	require(WP_CONTENT_DIR.'/upgrade/version-current.php');
857
+	$wp_filesystem->delete($versions_file);
858 858
 
859 859
 	$php_version    = phpversion();
860 860
 	$mysql_version  = $wpdb->db_version();
861 861
 	$old_wp_version = $wp_version; // The version of WordPress we're updating from
862
-	$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' )  ); // a dash in the version indicates a Development release
863
-	$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
864
-	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
862
+	$development_build = (false !== strpos($old_wp_version.$wp_version, '-')); // a dash in the version indicates a Development release
863
+	$php_compat     = version_compare($php_version, $required_php_version, '>=');
864
+	if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql))
865 865
 		$mysql_compat = true;
866 866
 	else
867
-		$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
867
+		$mysql_compat = version_compare($mysql_version, $required_mysql_version, '>=');
868 868
 
869
-	if ( !$mysql_compat || !$php_compat )
869
+	if ( ! $mysql_compat || ! $php_compat)
870 870
 		$wp_filesystem->delete($from, true);
871 871
 
872
-	if ( !$mysql_compat && !$php_compat )
873
-		return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s 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 ) );
874
-	elseif ( !$php_compat )
875
-		return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) );
876
-	elseif ( !$mysql_compat )
877
-		return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) );
872
+	if ( ! $mysql_compat && ! $php_compat)
873
+		return new WP_Error('php_mysql_not_compatible', sprintf(__('The update cannot be installed because WordPress %1$s 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));
874
+	elseif ( ! $php_compat)
875
+		return new WP_Error('php_not_compatible', sprintf(__('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version));
876
+	elseif ( ! $mysql_compat)
877
+		return new WP_Error('mysql_not_compatible', sprintf(__('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version));
878 878
 
879 879
 	/** This filter is documented in wp-admin/includes/update-core.php */
880
-	apply_filters( 'update_feedback', __( 'Preparing to install the latest version&#8230;' ) );
880
+	apply_filters('update_feedback', __('Preparing to install the latest version&#8230;'));
881 881
 
882 882
 	// Don't copy wp-content, we'll deal with that below
883 883
 	// We also copy version.php last so failed updates report their old version
884
-	$skip = array( 'wp-content', 'wp-includes/version.php' );
884
+	$skip = array('wp-content', 'wp-includes/version.php');
885 885
 	$check_is_writable = array();
886 886
 
887 887
 	// Check to see which files don't really need updating - only available for 3.7 and higher
888
-	if ( function_exists( 'get_core_checksums' ) ) {
888
+	if (function_exists('get_core_checksums')) {
889 889
 		// Find the local version of the working directory
890
-		$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
891
-
892
-		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
893
-		if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) )
894
-			$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
895
-		if ( is_array( $checksums ) ) {
896
-			foreach ( $checksums as $file => $checksum ) {
897
-				if ( 'wp-content' == substr( $file, 0, 10 ) )
890
+		$working_dir_local = WP_CONTENT_DIR.'/upgrade/'.basename($from).$distro;
891
+
892
+		$checksums = get_core_checksums($wp_version, isset($wp_local_package) ? $wp_local_package : 'en_US');
893
+		if (is_array($checksums) && isset($checksums[$wp_version]))
894
+			$checksums = $checksums[$wp_version]; // Compat code for 3.7-beta2
895
+		if (is_array($checksums)) {
896
+			foreach ($checksums as $file => $checksum) {
897
+				if ('wp-content' == substr($file, 0, 10))
898 898
 					continue;
899
-				if ( ! file_exists( ABSPATH . $file ) )
899
+				if ( ! file_exists(ABSPATH.$file))
900 900
 					continue;
901
-				if ( ! file_exists( $working_dir_local . $file ) )
901
+				if ( ! file_exists($working_dir_local.$file))
902 902
 					continue;
903
-				if ( md5_file( ABSPATH . $file ) === $checksum )
903
+				if (md5_file(ABSPATH.$file) === $checksum)
904 904
 					$skip[] = $file;
905 905
 				else
906
-					$check_is_writable[ $file ] = ABSPATH . $file;
906
+					$check_is_writable[$file] = ABSPATH.$file;
907 907
 			}
908 908
 		}
909 909
 	}
910 910
 
911 911
 	// If we're using the direct method, we can predict write failures that are due to permissions.
912
-	if ( $check_is_writable && 'direct' === $wp_filesystem->method ) {
913
-		$files_writable = array_filter( $check_is_writable, array( $wp_filesystem, 'is_writable' ) );
914
-		if ( $files_writable !== $check_is_writable ) {
915
-			$files_not_writable = array_diff_key( $check_is_writable, $files_writable );
916
-			foreach ( $files_not_writable as $relative_file_not_writable => $file_not_writable ) {
912
+	if ($check_is_writable && 'direct' === $wp_filesystem->method) {
913
+		$files_writable = array_filter($check_is_writable, array($wp_filesystem, 'is_writable'));
914
+		if ($files_writable !== $check_is_writable) {
915
+			$files_not_writable = array_diff_key($check_is_writable, $files_writable);
916
+			foreach ($files_not_writable as $relative_file_not_writable => $file_not_writable) {
917 917
 				// If the writable check failed, chmod file to 0644 and try again, same as copy_dir().
918
-				$wp_filesystem->chmod( $file_not_writable, FS_CHMOD_FILE );
919
-				if ( $wp_filesystem->is_writable( $file_not_writable ) )
920
-					unset( $files_not_writable[ $relative_file_not_writable ] );
918
+				$wp_filesystem->chmod($file_not_writable, FS_CHMOD_FILE);
919
+				if ($wp_filesystem->is_writable($file_not_writable))
920
+					unset($files_not_writable[$relative_file_not_writable]);
921 921
 			}
922 922
 
923 923
 			// Store package-relative paths (the key) of non-writable files in the WP_Error object.
924
-			$error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : '';
924
+			$error_data = version_compare($old_wp_version, '3.7-beta2', '>') ? array_keys($files_not_writable) : '';
925 925
 
926
-			if ( $files_not_writable )
927
-				return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) );
926
+			if ($files_not_writable)
927
+				return new WP_Error('files_not_writable', __('The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.'), implode(', ', $error_data));
928 928
 		}
929 929
 	}
930 930
 
931 931
 	/** This filter is documented in wp-admin/includes/update-core.php */
932
-	apply_filters( 'update_feedback', __( 'Enabling Maintenance mode&#8230;' ) );
932
+	apply_filters('update_feedback', __('Enabling Maintenance mode&#8230;'));
933 933
 	// Create maintenance file to signal that we are upgrading
934
-	$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
935
-	$maintenance_file = $to . '.maintenance';
934
+	$maintenance_string = '<?php $upgrading = '.time().'; ?>';
935
+	$maintenance_file = $to.'.maintenance';
936 936
 	$wp_filesystem->delete($maintenance_file);
937 937
 	$wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
938 938
 
939 939
 	/** This filter is documented in wp-admin/includes/update-core.php */
940
-	apply_filters( 'update_feedback', __( 'Copying the required files&#8230;' ) );
940
+	apply_filters('update_feedback', __('Copying the required files&#8230;'));
941 941
 	// Copy new versions of WP files into place.
942
-	$result = _copy_dir( $from . $distro, $to, $skip );
943
-	if ( is_wp_error( $result ) )
944
-		$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
942
+	$result = _copy_dir($from.$distro, $to, $skip);
943
+	if (is_wp_error($result))
944
+		$result = new WP_Error($result->get_error_code(), $result->get_error_message(), substr($result->get_error_data(), strlen($to)));
945 945
 
946 946
 	// Since we know the core files have copied over, we can now copy the version file
947
-	if ( ! is_wp_error( $result ) ) {
948
-		if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
949
-			$wp_filesystem->delete( $from, true );
950
-			$result = new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
947
+	if ( ! is_wp_error($result)) {
948
+		if ( ! $wp_filesystem->copy($from.$distro.'wp-includes/version.php', $to.'wp-includes/version.php', true /* overwrite */)) {
949
+			$wp_filesystem->delete($from, true);
950
+			$result = new WP_Error('copy_failed_for_version_file', __('The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.'), 'wp-includes/version.php');
951 951
 		}
952
-		$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
952
+		$wp_filesystem->chmod($to.'wp-includes/version.php', FS_CHMOD_FILE);
953 953
 	}
954 954
 
955 955
 	// Check to make sure everything copied correctly, ignoring the contents of wp-content
956
-	$skip = array( 'wp-content' );
956
+	$skip = array('wp-content');
957 957
 	$failed = array();
958
-	if ( isset( $checksums ) && is_array( $checksums ) ) {
959
-		foreach ( $checksums as $file => $checksum ) {
960
-			if ( 'wp-content' == substr( $file, 0, 10 ) )
958
+	if (isset($checksums) && is_array($checksums)) {
959
+		foreach ($checksums as $file => $checksum) {
960
+			if ('wp-content' == substr($file, 0, 10))
961 961
 				continue;
962
-			if ( ! file_exists( $working_dir_local . $file ) )
962
+			if ( ! file_exists($working_dir_local.$file))
963 963
 				continue;
964
-			if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum )
964
+			if (file_exists(ABSPATH.$file) && md5_file(ABSPATH.$file) == $checksum)
965 965
 				$skip[] = $file;
966 966
 			else
967 967
 				$failed[] = $file;
@@ -969,99 +969,99 @@  discard block
 block discarded – undo
969 969
 	}
970 970
 
971 971
 	// Some files didn't copy properly
972
-	if ( ! empty( $failed ) ) {
972
+	if ( ! empty($failed)) {
973 973
 		$total_size = 0;
974
-		foreach ( $failed as $file ) {
975
-			if ( file_exists( $working_dir_local . $file ) )
976
-				$total_size += filesize( $working_dir_local . $file );
974
+		foreach ($failed as $file) {
975
+			if (file_exists($working_dir_local.$file))
976
+				$total_size += filesize($working_dir_local.$file);
977 977
 		}
978 978
 
979 979
 		// If we don't have enough free space, it isn't worth trying again.
980 980
 		// Unlikely to be hit due to the check in unzip_file().
981
-		$available_space = @disk_free_space( ABSPATH );
982
-		if ( $available_space && $total_size >= $available_space ) {
983
-			$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
981
+		$available_space = @disk_free_space(ABSPATH);
982
+		if ($available_space && $total_size >= $available_space) {
983
+			$result = new WP_Error('disk_full', __('There is not enough free disk space to complete the update.'));
984 984
 		} else {
985
-			$result = _copy_dir( $from . $distro, $to, $skip );
986
-			if ( is_wp_error( $result ) )
987
-				$result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
985
+			$result = _copy_dir($from.$distro, $to, $skip);
986
+			if (is_wp_error($result))
987
+				$result = new WP_Error($result->get_error_code().'_retry', $result->get_error_message(), substr($result->get_error_data(), strlen($to)));
988 988
 		}
989 989
 	}
990 990
 
991 991
 	// Custom Content Directory needs updating now.
992 992
 	// Copy Languages
993
-	if ( !is_wp_error($result) && $wp_filesystem->is_dir($from . $distro . 'wp-content/languages') ) {
994
-		if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir(WP_LANG_DIR) )
993
+	if ( ! is_wp_error($result) && $wp_filesystem->is_dir($from.$distro.'wp-content/languages')) {
994
+		if (WP_LANG_DIR != ABSPATH.WPINC.'/languages' || @is_dir(WP_LANG_DIR))
995 995
 			$lang_dir = WP_LANG_DIR;
996 996
 		else
997
-			$lang_dir = WP_CONTENT_DIR . '/languages';
997
+			$lang_dir = WP_CONTENT_DIR.'/languages';
998 998
 
999
-		if ( !@is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH) ) { // Check the language directory exists first
1000
-			$wp_filesystem->mkdir($to . str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
999
+		if ( ! @is_dir($lang_dir) && 0 === strpos($lang_dir, ABSPATH)) { // Check the language directory exists first
1000
+			$wp_filesystem->mkdir($to.str_replace(ABSPATH, '', $lang_dir), FS_CHMOD_DIR); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
1001 1001
 			clearstatcache(); // for FTP, Need to clear the stat cache
1002 1002
 		}
1003 1003
 
1004
-		if ( @is_dir($lang_dir) ) {
1004
+		if (@is_dir($lang_dir)) {
1005 1005
 			$wp_lang_dir = $wp_filesystem->find_folder($lang_dir);
1006
-			if ( $wp_lang_dir ) {
1007
-				$result = copy_dir($from . $distro . 'wp-content/languages/', $wp_lang_dir);
1008
-				if ( is_wp_error( $result ) )
1009
-					$result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
1006
+			if ($wp_lang_dir) {
1007
+				$result = copy_dir($from.$distro.'wp-content/languages/', $wp_lang_dir);
1008
+				if (is_wp_error($result))
1009
+					$result = new WP_Error($result->get_error_code().'_languages', $result->get_error_message(), substr($result->get_error_data(), strlen($wp_lang_dir)));
1010 1010
 			}
1011 1011
 		}
1012 1012
 	}
1013 1013
 
1014 1014
 	/** This filter is documented in wp-admin/includes/update-core.php */
1015
-	apply_filters( 'update_feedback', __( 'Disabling Maintenance mode&#8230;' ) );
1015
+	apply_filters('update_feedback', __('Disabling Maintenance mode&#8230;'));
1016 1016
 	// Remove maintenance file, we're done with potential site-breaking changes
1017
-	$wp_filesystem->delete( $maintenance_file );
1017
+	$wp_filesystem->delete($maintenance_file);
1018 1018
 
1019 1019
 	// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve.
1020
-	if ( '3.5' == $old_wp_version ) {
1021
-		if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' )  ) {
1022
-			$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
1020
+	if ('3.5' == $old_wp_version) {
1021
+		if (is_dir(WP_CONTENT_DIR.'/themes/twentytwelve') && ! file_exists(WP_CONTENT_DIR.'/themes/twentytwelve/style.css')) {
1022
+			$wp_filesystem->delete($wp_filesystem->wp_themes_dir().'twentytwelve/');
1023 1023
 		}
1024 1024
 	}
1025 1025
 
1026 1026
 	// Copy New bundled plugins & themes
1027 1027
 	// This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue.
1028 1028
 	// $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated
1029
-	if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
1030
-		foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
1029
+	if ( ! is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED)) {
1030
+		foreach ((array) $_new_bundled_files as $file => $introduced_version) {
1031 1031
 			// If a $development_build or if $introduced version is greater than what the site was previously running
1032
-			if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
1033
-				$directory = ('/' == $file[ strlen($file)-1 ]);
1032
+			if ($development_build || version_compare($introduced_version, $old_wp_version, '>')) {
1033
+				$directory = ('/' == $file[strlen($file) - 1]);
1034 1034
 				list($type, $filename) = explode('/', $file, 2);
1035 1035
 
1036 1036
 				// Check to see if the bundled items exist before attempting to copy them
1037
-				if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) )
1037
+				if ( ! $wp_filesystem->exists($from.$distro.'wp-content/'.$file))
1038 1038
 					continue;
1039 1039
 
1040
-				if ( 'plugins' == $type )
1040
+				if ('plugins' == $type)
1041 1041
 					$dest = $wp_filesystem->wp_plugins_dir();
1042
-				elseif ( 'themes' == $type )
1042
+				elseif ('themes' == $type)
1043 1043
 					$dest = trailingslashit($wp_filesystem->wp_themes_dir()); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2
1044 1044
 				else
1045 1045
 					continue;
1046 1046
 
1047
-				if ( ! $directory ) {
1048
-					if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) )
1047
+				if ( ! $directory) {
1048
+					if ( ! $development_build && $wp_filesystem->exists($dest.$filename))
1049 1049
 						continue;
1050 1050
 
1051
-					if ( ! $wp_filesystem->copy($from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE) )
1052
-						$result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
1051
+					if ( ! $wp_filesystem->copy($from.$distro.'wp-content/'.$file, $dest.$filename, FS_CHMOD_FILE))
1052
+						$result = new WP_Error("copy_failed_for_new_bundled_$type", __('Could not copy file.'), $dest.$filename);
1053 1053
 				} else {
1054
-					if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) )
1054
+					if ( ! $development_build && $wp_filesystem->is_dir($dest.$filename))
1055 1055
 						continue;
1056 1056
 
1057
-					$wp_filesystem->mkdir($dest . $filename, FS_CHMOD_DIR);
1058
-					$_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename);
1057
+					$wp_filesystem->mkdir($dest.$filename, FS_CHMOD_DIR);
1058
+					$_result = copy_dir($from.$distro.'wp-content/'.$file, $dest.$filename);
1059 1059
 
1060 1060
 					// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
1061
-					if ( is_wp_error( $_result ) ) {
1062
-						if ( ! is_wp_error( $result ) )
1061
+					if (is_wp_error($_result)) {
1062
+						if ( ! is_wp_error($result))
1063 1063
 							$result = new WP_Error;
1064
-						$result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), substr( $_result->get_error_data(), strlen( $dest ) ) );
1064
+						$result->add($_result->get_error_code()."_$type", $_result->get_error_message(), substr($_result->get_error_data(), strlen($dest)));
1065 1065
 					}
1066 1066
 				}
1067 1067
 			}
@@ -1069,15 +1069,15 @@  discard block
 block discarded – undo
1069 1069
 	}
1070 1070
 
1071 1071
 	// Handle $result error from the above blocks
1072
-	if ( is_wp_error($result) ) {
1072
+	if (is_wp_error($result)) {
1073 1073
 		$wp_filesystem->delete($from, true);
1074 1074
 		return $result;
1075 1075
 	}
1076 1076
 
1077 1077
 	// Remove old files
1078
-	foreach ( $_old_files as $old_file ) {
1079
-		$old_file = $to . $old_file;
1080
-		if ( !$wp_filesystem->exists($old_file) )
1078
+	foreach ($_old_files as $old_file) {
1079
+		$old_file = $to.$old_file;
1080
+		if ( ! $wp_filesystem->exists($old_file))
1081 1081
 			continue;
1082 1082
 		$wp_filesystem->delete($old_file, true);
1083 1083
 	}
@@ -1090,20 +1090,20 @@  discard block
 block discarded – undo
1090 1090
 
1091 1091
 	// Upgrade DB with separate request
1092 1092
 	/** This filter is documented in wp-admin/includes/update-core.php */
1093
-	apply_filters( 'update_feedback', __( 'Upgrading database&#8230;' ) );
1093
+	apply_filters('update_feedback', __('Upgrading database&#8230;'));
1094 1094
 	$db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
1095 1095
 	wp_remote_post($db_upgrade_url, array('timeout' => 60));
1096 1096
 
1097 1097
 	// Clear the cache to prevent an update_option() from saving a stale db_version to the cache
1098 1098
 	wp_cache_flush();
1099 1099
 	// (Not all cache back ends listen to 'flush')
1100
-	wp_cache_delete( 'alloptions', 'options' );
1100
+	wp_cache_delete('alloptions', 'options');
1101 1101
 
1102 1102
 	// Remove working directory
1103 1103
 	$wp_filesystem->delete($from, true);
1104 1104
 
1105 1105
 	// Force refresh of update information
1106
-	if ( function_exists('delete_site_transient') )
1106
+	if (function_exists('delete_site_transient'))
1107 1107
 		delete_site_transient('update_core');
1108 1108
 	else
1109 1109
 		delete_option('update_core');
@@ -1115,11 +1115,11 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @param string $wp_version The current WordPress version.
1117 1117
 	 */
1118
-	do_action( '_core_updated_successfully', $wp_version );
1118
+	do_action('_core_updated_successfully', $wp_version);
1119 1119
 
1120 1120
 	// Clear the option that blocks auto updates after failures, now that we've been successful.
1121
-	if ( function_exists( 'delete_site_option' ) )
1122
-		delete_site_option( 'auto_core_update_failed' );
1121
+	if (function_exists('delete_site_option'))
1122
+		delete_site_option('auto_core_update_failed');
1123 1123
 
1124 1124
 	return $wp_version;
1125 1125
 }
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
  * @param array $skip_list a list of files/folders to skip copying
1144 1144
  * @return mixed WP_Error on failure, True on success.
1145 1145
  */
1146
-function _copy_dir($from, $to, $skip_list = array() ) {
1146
+function _copy_dir($from, $to, $skip_list = array()) {
1147 1147
 	global $wp_filesystem;
1148 1148
 
1149 1149
 	$dirlist = $wp_filesystem->dirlist($from);
@@ -1151,21 +1151,21 @@  discard block
 block discarded – undo
1151 1151
 	$from = trailingslashit($from);
1152 1152
 	$to = trailingslashit($to);
1153 1153
 
1154
-	foreach ( (array) $dirlist as $filename => $fileinfo ) {
1155
-		if ( in_array( $filename, $skip_list ) )
1154
+	foreach ((array) $dirlist as $filename => $fileinfo) {
1155
+		if (in_array($filename, $skip_list))
1156 1156
 			continue;
1157 1157
 
1158
-		if ( 'f' == $fileinfo['type'] ) {
1159
-			if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
1158
+		if ('f' == $fileinfo['type']) {
1159
+			if ( ! $wp_filesystem->copy($from.$filename, $to.$filename, true, FS_CHMOD_FILE)) {
1160 1160
 				// If copy failed, chmod file to 0644 and try again.
1161
-				$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
1162
-				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
1163
-					return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
1161
+				$wp_filesystem->chmod($to.$filename, FS_CHMOD_FILE);
1162
+				if ( ! $wp_filesystem->copy($from.$filename, $to.$filename, true, FS_CHMOD_FILE))
1163
+					return new WP_Error('copy_failed__copy_dir', __('Could not copy file.'), $to.$filename);
1164 1164
 			}
1165
-		} elseif ( 'd' == $fileinfo['type'] ) {
1166
-			if ( !$wp_filesystem->is_dir($to . $filename) ) {
1167
-				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
1168
-					return new WP_Error( 'mkdir_failed__copy_dir', __( 'Could not create directory.' ), $to . $filename );
1165
+		} elseif ('d' == $fileinfo['type']) {
1166
+			if ( ! $wp_filesystem->is_dir($to.$filename)) {
1167
+				if ( ! $wp_filesystem->mkdir($to.$filename, FS_CHMOD_DIR))
1168
+					return new WP_Error('mkdir_failed__copy_dir', __('Could not create directory.'), $to.$filename);
1169 1169
 			}
1170 1170
 
1171 1171
 			/*
@@ -1173,13 +1173,13 @@  discard block
 block discarded – undo
1173 1173
 			 * of the existing $skip_list.
1174 1174
 			 */
1175 1175
 			$sub_skip_list = array();
1176
-			foreach ( $skip_list as $skip_item ) {
1177
-				if ( 0 === strpos( $skip_item, $filename . '/' ) )
1178
-					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
1176
+			foreach ($skip_list as $skip_item) {
1177
+				if (0 === strpos($skip_item, $filename.'/'))
1178
+					$sub_skip_list[] = preg_replace('!^'.preg_quote($filename, '!').'/!i', '', $skip_item);
1179 1179
 			}
1180 1180
 
1181
-			$result = _copy_dir($from . $filename, $to . $filename, $sub_skip_list);
1182
-			if ( is_wp_error($result) )
1181
+			$result = _copy_dir($from.$filename, $to.$filename, $sub_skip_list);
1182
+			if (is_wp_error($result))
1183 1183
 				return $result;
1184 1184
 		}
1185 1185
 	}
@@ -1199,28 +1199,28 @@  discard block
 block discarded – undo
1199 1199
  *
1200 1200
  * @param string $new_version
1201 1201
  */
1202
-function _redirect_to_about_wordpress( $new_version ) {
1202
+function _redirect_to_about_wordpress($new_version) {
1203 1203
 	global $wp_version, $pagenow, $action;
1204 1204
 
1205
-	if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
1205
+	if (version_compare($wp_version, '3.4-RC1', '>='))
1206 1206
 		return;
1207 1207
 
1208 1208
 	// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
1209
-	if ( 'update-core.php' != $pagenow )
1209
+	if ('update-core.php' != $pagenow)
1210 1210
 		return;
1211 1211
 
1212
- 	if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
1212
+ 	if ('do-core-upgrade' != $action && 'do-core-reinstall' != $action)
1213 1213
  		return;
1214 1214
 
1215 1215
 	// Load the updated default text localization domain for new strings.
1216 1216
 	load_default_textdomain();
1217 1217
 
1218 1218
 	// See do_core_upgrade()
1219
-	show_message( __('WordPress updated successfully') );
1219
+	show_message(__('WordPress updated successfully'));
1220 1220
 
1221 1221
 	// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
1222
-	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
1223
-	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
1222
+	show_message('<span class="hide-if-no-js">'.sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $new_version, 'about.php?updated').'</span>');
1223
+	show_message('<span class="hide-if-js">'.sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $new_version, 'about.php?updated').'</span>');
1224 1224
 	echo '</div>';
1225 1225
 	?>
1226 1226
 <script type="text/javascript">
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
 	<?php
1230 1230
 
1231 1231
 	// Include admin-footer.php and exit.
1232
-	include(ABSPATH . 'wp-admin/admin-footer.php');
1232
+	include(ABSPATH.'wp-admin/admin-footer.php');
1233 1233
 	exit();
1234 1234
 }
1235 1235
 
@@ -1248,30 +1248,30 @@  discard block
 block discarded – undo
1248 1248
 	$affected_files = array();
1249 1249
 
1250 1250
 	// Themes
1251
-	foreach ( $wp_theme_directories as $directory ) {
1252
-		$affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory );
1253
-		$affected_files       = array_merge( $affected_files, $affected_theme_files );
1251
+	foreach ($wp_theme_directories as $directory) {
1252
+		$affected_theme_files = _upgrade_422_find_genericons_files_in_folder($directory);
1253
+		$affected_files       = array_merge($affected_files, $affected_theme_files);
1254 1254
 	}
1255 1255
 
1256 1256
 	// Plugins
1257
-	$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR );
1258
-	$affected_files        = array_merge( $affected_files, $affected_plugin_files );
1257
+	$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder(WP_PLUGIN_DIR);
1258
+	$affected_files        = array_merge($affected_files, $affected_plugin_files);
1259 1259
 
1260
-	foreach ( $affected_files as $file ) {
1261
-		$gen_dir = $wp_filesystem->find_folder( trailingslashit( dirname( $file ) ) );
1262
-		if ( empty( $gen_dir ) ) {
1260
+	foreach ($affected_files as $file) {
1261
+		$gen_dir = $wp_filesystem->find_folder(trailingslashit(dirname($file)));
1262
+		if (empty($gen_dir)) {
1263 1263
 			continue;
1264 1264
 		}
1265 1265
 
1266 1266
 		// The path when the file is accessed via WP_Filesystem may differ in the case of FTP
1267
-		$remote_file = $gen_dir . basename( $file );
1267
+		$remote_file = $gen_dir.basename($file);
1268 1268
 
1269
-		if ( ! $wp_filesystem->exists( $remote_file ) ) {
1269
+		if ( ! $wp_filesystem->exists($remote_file)) {
1270 1270
 			continue;
1271 1271
 		}
1272 1272
 
1273
-		if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) {
1274
-			$wp_filesystem->put_contents( $remote_file, '' );
1273
+		if ( ! $wp_filesystem->delete($remote_file, false, 'f')) {
1274
+			$wp_filesystem->put_contents($remote_file, '');
1275 1275
 		}
1276 1276
 	}
1277 1277
 }
@@ -1285,18 +1285,18 @@  discard block
 block discarded – undo
1285 1285
  * @param string $directory Directory path. Expects trailingslashed.
1286 1286
  * @return array
1287 1287
  */
1288
-function _upgrade_422_find_genericons_files_in_folder( $directory ) {
1289
-	$directory = trailingslashit( $directory );
1288
+function _upgrade_422_find_genericons_files_in_folder($directory) {
1289
+	$directory = trailingslashit($directory);
1290 1290
 	$files     = array();
1291 1291
 
1292
-	if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) {
1292
+	if (file_exists("{$directory}example.html") && false !== strpos(file_get_contents("{$directory}example.html"), '<title>Genericons</title>')) {
1293 1293
 		$files[] = "{$directory}example.html";
1294 1294
 	}
1295 1295
 
1296
-	$dirs = glob( $directory . '*', GLOB_ONLYDIR );
1297
-	if ( $dirs ) {
1298
-		foreach ( $dirs as $dir ) {
1299
-			$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
1296
+	$dirs = glob($directory.'*', GLOB_ONLYDIR);
1297
+	if ($dirs) {
1298
+		foreach ($dirs as $dir) {
1299
+			$files = array_merge($files, _upgrade_422_find_genericons_files_in_folder($dir));
1300 1300
 		}
1301 1301
 	}
1302 1302
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
  * @since 4.4.0
1309 1309
  */
1310 1310
 function _upgrade_440_force_deactivate_incompatible_plugins() {
1311
-	if ( defined( 'REST_API_VERSION' ) && version_compare( REST_API_VERSION, '2.0-beta4', '<=' ) ) {
1312
-		deactivate_plugins( array( 'rest-api/plugin.php' ), true );
1311
+	if (defined('REST_API_VERSION') && version_compare(REST_API_VERSION, '2.0-beta4', '<=')) {
1312
+		deactivate_plugins(array('rest-api/plugin.php'), true);
1313 1313
 	}
1314 1314
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-importer.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WP_Importer base class
4
- */
3
+	 * WP_Importer base class
4
+	 */
5 5
 class WP_Importer {
6 6
 	/**
7 7
 	 * Class Constructor
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param string $bid
19 19
 	 * @return array
20 20
 	 */
21
-	public function get_imported_posts( $importer_name, $bid ) {
21
+	public function get_imported_posts($importer_name, $bid) {
22 22
 		global $wpdb;
23 23
 
24 24
 		$hashtable = array();
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 
29 29
 		// Grab all posts in chunks
30 30
 		do {
31
-			$meta_key = $importer_name . '_' . $bid . '_permalink';
32
-			$sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit );
33
-			$results = $wpdb->get_results( $sql );
31
+			$meta_key = $importer_name.'_'.$bid.'_permalink';
32
+			$sql = $wpdb->prepare("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit);
33
+			$results = $wpdb->get_results($sql);
34 34
 
35 35
 			// Increment offset
36
-			$offset = ( $limit + $offset );
36
+			$offset = ($limit + $offset);
37 37
 
38
-			if ( !empty( $results ) ) {
39
-				foreach ( $results as $r ) {
38
+			if ( ! empty($results)) {
39
+				foreach ($results as $r) {
40 40
 					// Set permalinks into array
41
-					$hashtable[$r->meta_value] = intval( $r->post_id );
41
+					$hashtable[$r->meta_value] = intval($r->post_id);
42 42
 				}
43 43
 			}
44
-		} while ( count( $results ) == $limit );
44
+		} while (count($results) == $limit);
45 45
 
46 46
 		// Unset to save memory.
47
-		unset( $results, $r );
47
+		unset($results, $r);
48 48
 
49 49
 		return $hashtable;
50 50
 	}
@@ -58,22 +58,22 @@  discard block
 block discarded – undo
58 58
 	 * @param string $bid
59 59
 	 * @return int
60 60
 	 */
61
-	public function count_imported_posts( $importer_name, $bid ) {
61
+	public function count_imported_posts($importer_name, $bid) {
62 62
 		global $wpdb;
63 63
 
64 64
 		$count = 0;
65 65
 
66 66
 		// Get count of permalinks
67
-		$meta_key = $importer_name . '_' . $bid . '_permalink';
68
-		$sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key );
67
+		$meta_key = $importer_name.'_'.$bid.'_permalink';
68
+		$sql = $wpdb->prepare("SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key);
69 69
 
70
-		$result = $wpdb->get_results( $sql );
70
+		$result = $wpdb->get_results($sql);
71 71
 
72
-		if ( !empty( $result ) )
73
-			$count = intval( $result[0]->cnt );
72
+		if ( ! empty($result))
73
+			$count = intval($result[0]->cnt);
74 74
 
75 75
 		// Unset to save memory.
76
-		unset( $results );
76
+		unset($results);
77 77
 
78 78
 		return $count;
79 79
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @param string $bid
87 87
 	 * @return array
88 88
 	 */
89
-	public function get_imported_comments( $bid ) {
89
+	public function get_imported_comments($bid) {
90 90
 		global $wpdb;
91 91
 
92 92
 		$hashtable = array();
@@ -96,28 +96,28 @@  discard block
 block discarded – undo
96 96
 
97 97
 		// Grab all comments in chunks
98 98
 		do {
99
-			$sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
100
-			$results = $wpdb->get_results( $sql );
99
+			$sql = $wpdb->prepare("SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit);
100
+			$results = $wpdb->get_results($sql);
101 101
 
102 102
 			// Increment offset
103
-			$offset = ( $limit + $offset );
103
+			$offset = ($limit + $offset);
104 104
 
105
-			if ( !empty( $results ) ) {
106
-				foreach ( $results as $r ) {
105
+			if ( ! empty($results)) {
106
+				foreach ($results as $r) {
107 107
 					// Explode comment_agent key
108
-					list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
109
-					$source_comment_id = intval( $source_comment_id );
108
+					list ($ca_bid, $source_comment_id) = explode('-', $r->comment_agent);
109
+					$source_comment_id = intval($source_comment_id);
110 110
 
111 111
 					// Check if this comment came from this blog
112
-					if ( $bid == $ca_bid ) {
113
-						$hashtable[$source_comment_id] = intval( $r->comment_ID );
112
+					if ($bid == $ca_bid) {
113
+						$hashtable[$source_comment_id] = intval($r->comment_ID);
114 114
 					}
115 115
 				}
116 116
 			}
117
-		} while ( count( $results ) == $limit );
117
+		} while (count($results) == $limit);
118 118
 
119 119
 		// Unset to save memory.
120
-		unset( $results, $r );
120
+		unset($results, $r);
121 121
 
122 122
 		return $hashtable;
123 123
 	}
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
 	 * @param int $blog_id
128 128
 	 * @return int|void
129 129
 	 */
130
-	public function set_blog( $blog_id ) {
131
-		if ( is_numeric( $blog_id ) ) {
130
+	public function set_blog($blog_id) {
131
+		if (is_numeric($blog_id)) {
132 132
 			$blog_id = (int) $blog_id;
133 133
 		} else {
134
-			$blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id );
135
-			if ( ( !$parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) {
136
-				fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
134
+			$blog = 'http://'.preg_replace('#^https?://#', '', $blog_id);
135
+			if (( ! $parsed = parse_url($blog)) || empty($parsed['host'])) {
136
+				fwrite(STDERR, "Error: can not determine blog_id from $blog_id\n");
137 137
 				exit();
138 138
 			}
139
-			if ( empty( $parsed['path'] ) )
139
+			if (empty($parsed['path']))
140 140
 				$parsed['path'] = '/';
141
-			$blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
142
-			if ( !$blog ) {
143
-				fwrite( STDERR, "Error: Could not find blog\n" );
141
+			$blog = get_blog_details(array('domain' => $parsed['host'], 'path' => $parsed['path']));
142
+			if ( ! $blog) {
143
+				fwrite(STDERR, "Error: Could not find blog\n");
144 144
 				exit();
145 145
 			}
146 146
 			$blog_id = (int) $blog->blog_id;
147 147
 		}
148 148
 
149
-		if ( function_exists( 'is_multisite' ) ) {
150
-			if ( is_multisite() )
151
-				switch_to_blog( $blog_id );
149
+		if (function_exists('is_multisite')) {
150
+			if (is_multisite())
151
+				switch_to_blog($blog_id);
152 152
 		}
153 153
 
154 154
 		return $blog_id;
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 	 * @param int $user_id
160 160
 	 * @return int|void
161 161
 	 */
162
-	public function set_user( $user_id ) {
163
-		if ( is_numeric( $user_id ) ) {
162
+	public function set_user($user_id) {
163
+		if (is_numeric($user_id)) {
164 164
 			$user_id = (int) $user_id;
165 165
 		} else {
166
-			$user_id = (int) username_exists( $user_id );
166
+			$user_id = (int) username_exists($user_id);
167 167
 		}
168 168
 
169
-		if ( !$user_id || !wp_set_current_user( $user_id ) ) {
170
-			fwrite( STDERR, "Error: can not find user\n" );
169
+		if ( ! $user_id || ! wp_set_current_user($user_id)) {
170
+			fwrite(STDERR, "Error: can not find user\n");
171 171
 			exit();
172 172
 		}
173 173
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param string $b
182 182
 	 * @return int
183 183
 	 */
184
-	public function cmpr_strlen( $a, $b ) {
185
-		return strlen( $b ) - strlen( $a );
184
+	public function cmpr_strlen($a, $b) {
185
+		return strlen($b) - strlen($a);
186 186
 	}
187 187
 
188 188
 	/**
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 	 * @param bool   $head
195 195
 	 * @return array
196 196
 	 */
197
-	public function get_page( $url, $username = '', $password = '', $head = false ) {
197
+	public function get_page($url, $username = '', $password = '', $head = false) {
198 198
 		// Increase the timeout
199
-		add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
199
+		add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
200 200
 
201 201
 		$headers = array();
202 202
 		$args = array();
203
-		if ( true === $head )
203
+		if (true === $head)
204 204
 			$args['method'] = 'HEAD';
205
-		if ( !empty( $username ) && !empty( $password ) )
206
-			$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
205
+		if ( ! empty($username) && ! empty($password))
206
+			$headers['Authorization'] = 'Basic '.base64_encode("$username:$password");
207 207
 
208 208
 		$args['headers'] = $headers;
209 209
 
210
-		return wp_safe_remote_request( $url, $args );
210
+		return wp_safe_remote_request($url, $args);
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param int $val
217 217
 	 * @return int
218 218
 	 */
219
-	public function bump_request_timeout( $val ) {
219
+	public function bump_request_timeout($val) {
220 220
 		return 60;
221 221
 	}
222 222
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @return bool
227 227
 	 */
228 228
 	public function is_user_over_quota() {
229
-		if ( function_exists( 'upload_is_user_over_quota' ) ) {
230
-			if ( upload_is_user_over_quota() ) {
229
+		if (function_exists('upload_is_user_over_quota')) {
230
+			if (upload_is_user_over_quota()) {
231 231
 				return true;
232 232
 			}
233 233
 		}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 * @param string $string
242 242
 	 * @return string
243 243
 	 */
244
-	public function min_whitespace( $string ) {
245
-		return preg_replace( '|[\r\n\t ]+|', ' ', $string );
244
+	public function min_whitespace($string) {
245
+		return preg_replace('|[\r\n\t ]+|', ' ', $string);
246 246
 	}
247 247
 
248 248
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @param bool   $required
269 269
  * @return mixed
270 270
  */
271
-function get_cli_args( $param, $required = false ) {
271
+function get_cli_args($param, $required = false) {
272 272
 	$args = $_SERVER['argv'];
273 273
 
274 274
 	$out = array();
@@ -276,40 +276,40 @@  discard block
 block discarded – undo
276 276
 	$last_arg = null;
277 277
 	$return = null;
278 278
 
279
-	$il = sizeof( $args );
279
+	$il = sizeof($args);
280 280
 
281
-	for ( $i = 1, $il; $i < $il; $i++ ) {
282
-		if ( (bool) preg_match( "/^--(.+)/", $args[$i], $match ) ) {
283
-			$parts = explode( "=", $match[1] );
284
-			$key = preg_replace( "/[^a-z0-9]+/", "", $parts[0] );
281
+	for ($i = 1, $il; $i < $il; $i++) {
282
+		if ((bool) preg_match("/^--(.+)/", $args[$i], $match)) {
283
+			$parts = explode("=", $match[1]);
284
+			$key = preg_replace("/[^a-z0-9]+/", "", $parts[0]);
285 285
 
286
-			if ( isset( $parts[1] ) ) {
286
+			if (isset($parts[1])) {
287 287
 				$out[$key] = $parts[1];
288 288
 			} else {
289 289
 				$out[$key] = true;
290 290
 			}
291 291
 
292 292
 			$last_arg = $key;
293
-		} elseif ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) {
294
-			for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) {
293
+		} elseif ((bool) preg_match("/^-([a-zA-Z0-9]+)/", $args[$i], $match)) {
294
+			for ($j = 0, $jl = strlen($match[1]); $j < $jl; $j++) {
295 295
 				$key = $match[1]{$j};
296 296
 				$out[$key] = true;
297 297
 			}
298 298
 
299 299
 			$last_arg = $key;
300
-		} elseif ( $last_arg !== null ) {
300
+		} elseif ($last_arg !== null) {
301 301
 			$out[$last_arg] = $args[$i];
302 302
 		}
303 303
 	}
304 304
 
305 305
 	// Check array for specified param
306
-	if ( isset( $out[$param] ) ) {
306
+	if (isset($out[$param])) {
307 307
 		// Set return value
308 308
 		$return = $out[$param];
309 309
 	}
310 310
 
311 311
 	// Check for missing required param
312
-	if ( !isset( $out[$param] ) && $required ) {
312
+	if ( ! isset($out[$param]) && $required) {
313 313
 		// Display message and exit
314 314
 		echo "\"$param\" parameter is required but was not specified\n";
315 315
 		exit();
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
 		$result = $wpdb->get_results( $sql );
71 71
 
72
-		if ( !empty( $result ) )
73
-			$count = intval( $result[0]->cnt );
72
+		if ( !empty( $result ) ) {
73
+					$count = intval( $result[0]->cnt );
74
+		}
74 75
 
75 76
 		// Unset to save memory.
76 77
 		unset( $results );
@@ -136,8 +137,9 @@  discard block
 block discarded – undo
136 137
 				fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
137 138
 				exit();
138 139
 			}
139
-			if ( empty( $parsed['path'] ) )
140
-				$parsed['path'] = '/';
140
+			if ( empty( $parsed['path'] ) ) {
141
+							$parsed['path'] = '/';
142
+			}
141 143
 			$blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
142 144
 			if ( !$blog ) {
143 145
 				fwrite( STDERR, "Error: Could not find blog\n" );
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
 		}
148 150
 
149 151
 		if ( function_exists( 'is_multisite' ) ) {
150
-			if ( is_multisite() )
151
-				switch_to_blog( $blog_id );
152
+			if ( is_multisite() ) {
153
+							switch_to_blog( $blog_id );
154
+			}
152 155
 		}
153 156
 
154 157
 		return $blog_id;
@@ -200,10 +203,12 @@  discard block
 block discarded – undo
200 203
 
201 204
 		$headers = array();
202 205
 		$args = array();
203
-		if ( true === $head )
204
-			$args['method'] = 'HEAD';
205
-		if ( !empty( $username ) && !empty( $password ) )
206
-			$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
206
+		if ( true === $head ) {
207
+					$args['method'] = 'HEAD';
208
+		}
209
+		if ( !empty( $username ) && !empty( $password ) ) {
210
+					$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
211
+		}
207 212
 
208 213
 		$args['headers'] = $headers;
209 214
 
Please login to merge, or discard this patch.
src/wp-admin/includes/export.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Export Administration API
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Export Administration API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Version number for the export format.
Please login to merge, or discard this patch.
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @since 2.5.0
15 15
  */
16
-define( 'WXR_VERSION', '1.2' );
16
+define('WXR_VERSION', '1.2');
17 17
 
18 18
 /**
19 19
  * Generates the WXR export file for download.
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @param array $args Filters defining what should be included in the export.
27 27
  */
28
-function export_wp( $args = array() ) {
28
+function export_wp($args = array()) {
29 29
 	global $wpdb, $post;
30 30
 
31
-	$defaults = array( 'content' => 'all', 'author' => false, 'category' => false,
31
+	$defaults = array('content' => 'all', 'author' => false, 'category' => false,
32 32
 		'start_date' => false, 'end_date' => false, 'status' => false,
33 33
 	);
34
-	$args = wp_parse_args( $args, $defaults );
34
+	$args = wp_parse_args($args, $defaults);
35 35
 
36 36
 	/**
37 37
 	 * Fires at the beginning of an export, before any headers are sent.
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param array $args An array of export arguments.
42 42
 	 */
43
-	do_action( 'export_wp', $args );
43
+	do_action('export_wp', $args);
44 44
 
45
-	$sitename = sanitize_key( get_bloginfo( 'name' ) );
46
-	if ( ! empty( $sitename ) ) {
45
+	$sitename = sanitize_key(get_bloginfo('name'));
46
+	if ( ! empty($sitename)) {
47 47
 		$sitename .= '.';
48 48
 	}
49
-	$date = date( 'Y-m-d' );
50
-	$wp_filename = $sitename . 'wordpress.' . $date . '.xml';
49
+	$date = date('Y-m-d');
50
+	$wp_filename = $sitename.'wordpress.'.$date.'.xml';
51 51
 	/**
52 52
 	 * Filter the export filename.
53 53
 	 *
@@ -57,84 +57,84 @@  discard block
 block discarded – undo
57 57
 	 * @param string $sitename    The site name.
58 58
 	 * @param string $date        Today's date, formatted.
59 59
 	 */
60
-	$filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date );
60
+	$filename = apply_filters('export_wp_filename', $wp_filename, $sitename, $date);
61 61
 
62
-	header( 'Content-Description: File Transfer' );
63
-	header( 'Content-Disposition: attachment; filename=' . $filename );
64
-	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
62
+	header('Content-Description: File Transfer');
63
+	header('Content-Disposition: attachment; filename='.$filename);
64
+	header('Content-Type: text/xml; charset='.get_option('blog_charset'), true);
65 65
 
66
-	if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
67
-		$ptype = get_post_type_object( $args['content'] );
68
-		if ( ! $ptype->can_export )
66
+	if ('all' != $args['content'] && post_type_exists($args['content'])) {
67
+		$ptype = get_post_type_object($args['content']);
68
+		if ( ! $ptype->can_export)
69 69
 			$args['content'] = 'post';
70 70
 
71
-		$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
71
+		$where = $wpdb->prepare("{$wpdb->posts}.post_type = %s", $args['content']);
72 72
 	} else {
73
-		$post_types = get_post_types( array( 'can_export' => true ) );
74
-		$esses = array_fill( 0, count($post_types), '%s' );
75
-		$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
73
+		$post_types = get_post_types(array('can_export' => true));
74
+		$esses = array_fill(0, count($post_types), '%s');
75
+		$where = $wpdb->prepare("{$wpdb->posts}.post_type IN (".implode(',', $esses).')', $post_types);
76 76
 	}
77 77
 
78
-	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
79
-		$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
78
+	if ($args['status'] && ('post' == $args['content'] || 'page' == $args['content']))
79
+		$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_status = %s", $args['status']);
80 80
 	else
81 81
 		$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
82 82
 
83 83
 	$join = '';
84
-	if ( $args['category'] && 'post' == $args['content'] ) {
85
-		if ( $term = term_exists( $args['category'], 'category' ) ) {
84
+	if ($args['category'] && 'post' == $args['content']) {
85
+		if ($term = term_exists($args['category'], 'category')) {
86 86
 			$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
87
-			$where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
87
+			$where .= $wpdb->prepare(" AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id']);
88 88
 		}
89 89
 	}
90 90
 
91
-	if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
92
-		if ( $args['author'] )
93
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
91
+	if ('post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content']) {
92
+		if ($args['author'])
93
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_author = %d", $args['author']);
94 94
 
95
-		if ( $args['start_date'] )
96
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
95
+		if ($args['start_date'])
96
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date >= %s", date('Y-m-d', strtotime($args['start_date'])));
97 97
 
98
-		if ( $args['end_date'] )
99
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
98
+		if ($args['end_date'])
99
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date < %s", date('Y-m-d', strtotime('+1 month', strtotime($args['end_date']))));
100 100
 	}
101 101
 
102 102
 	// Grab a snapshot of post IDs, just in case it changes during the export.
103
-	$post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
103
+	$post_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} $join WHERE $where");
104 104
 
105 105
 	/*
106 106
 	 * Get the requested terms ready, empty unless posts filtered by category
107 107
 	 * or all content.
108 108
 	 */
109 109
 	$cats = $tags = $terms = array();
110
-	if ( isset( $term ) && $term ) {
111
-		$cat = get_term( $term['term_id'], 'category' );
112
-		$cats = array( $cat->term_id => $cat );
113
-		unset( $term, $cat );
114
-	} elseif ( 'all' == $args['content'] ) {
115
-		$categories = (array) get_categories( array( 'get' => 'all' ) );
116
-		$tags = (array) get_tags( array( 'get' => 'all' ) );
110
+	if (isset($term) && $term) {
111
+		$cat = get_term($term['term_id'], 'category');
112
+		$cats = array($cat->term_id => $cat);
113
+		unset($term, $cat);
114
+	} elseif ('all' == $args['content']) {
115
+		$categories = (array) get_categories(array('get' => 'all'));
116
+		$tags = (array) get_tags(array('get' => 'all'));
117 117
 
118
-		$custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
119
-		$custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
118
+		$custom_taxonomies = get_taxonomies(array('_builtin' => false));
119
+		$custom_terms = (array) get_terms($custom_taxonomies, array('get' => 'all'));
120 120
 
121 121
 		// Put categories in order with no child going before its parent.
122
-		while ( $cat = array_shift( $categories ) ) {
123
-			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
122
+		while ($cat = array_shift($categories)) {
123
+			if ($cat->parent == 0 || isset($cats[$cat->parent]))
124 124
 				$cats[$cat->term_id] = $cat;
125 125
 			else
126 126
 				$categories[] = $cat;
127 127
 		}
128 128
 
129 129
 		// Put terms in order with no child going before its parent.
130
-		while ( $t = array_shift( $custom_terms ) ) {
131
-			if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
130
+		while ($t = array_shift($custom_terms)) {
131
+			if ($t->parent == 0 || isset($terms[$t->parent]))
132 132
 				$terms[$t->term_id] = $t;
133 133
 			else
134 134
 				$custom_terms[] = $t;
135 135
 		}
136 136
 
137
-		unset( $categories, $custom_taxonomies, $custom_terms );
137
+		unset($categories, $custom_taxonomies, $custom_terms);
138 138
 	}
139 139
 
140 140
 	/**
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 	 * @param string $str String to wrap in XML CDATA tag.
146 146
 	 * @return string
147 147
 	 */
148
-	function wxr_cdata( $str ) {
149
-		if ( ! seems_utf8( $str ) ) {
150
-			$str = utf8_encode( $str );
148
+	function wxr_cdata($str) {
149
+		if ( ! seems_utf8($str)) {
150
+			$str = utf8_encode($str);
151 151
 		}
152 152
 		// $str = ent2ncr(esc_html($str));
153
-		$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
153
+		$str = '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $str).']]>';
154 154
 
155 155
 		return $str;
156 156
 	}
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	function wxr_site_url() {
166 166
 		// Multisite: the base URL.
167
-		if ( is_multisite() )
167
+		if (is_multisite())
168 168
 			return network_home_url();
169 169
 		// WordPress (single site): the blog URL.
170 170
 		else
171
-			return get_bloginfo_rss( 'url' );
171
+			return get_bloginfo_rss('url');
172 172
 	}
173 173
 
174 174
 	/**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param object $category Category Object
180 180
 	 */
181
-	function wxr_cat_name( $category ) {
182
-		if ( empty( $category->name ) )
181
+	function wxr_cat_name($category) {
182
+		if (empty($category->name))
183 183
 			return;
184 184
 
185
-		echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';
185
+		echo '<wp:cat_name>'.wxr_cdata($category->name).'</wp:cat_name>';
186 186
 	}
187 187
 
188 188
 	/**
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param object $category Category Object
194 194
 	 */
195
-	function wxr_category_description( $category ) {
196
-		if ( empty( $category->description ) )
195
+	function wxr_category_description($category) {
196
+		if (empty($category->description))
197 197
 			return;
198 198
 
199
-		echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
199
+		echo '<wp:category_description>'.wxr_cdata($category->description).'</wp:category_description>';
200 200
 	}
201 201
 
202 202
 	/**
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param object $tag Tag Object
208 208
 	 */
209
-	function wxr_tag_name( $tag ) {
210
-		if ( empty( $tag->name ) )
209
+	function wxr_tag_name($tag) {
210
+		if (empty($tag->name))
211 211
 			return;
212 212
 
213
-		echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';
213
+		echo '<wp:tag_name>'.wxr_cdata($tag->name).'</wp:tag_name>';
214 214
 	}
215 215
 
216 216
 	/**
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @param object $tag Tag Object
222 222
 	 */
223
-	function wxr_tag_description( $tag ) {
224
-		if ( empty( $tag->description ) )
223
+	function wxr_tag_description($tag) {
224
+		if (empty($tag->description))
225 225
 			return;
226 226
 
227
-		echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
227
+		echo '<wp:tag_description>'.wxr_cdata($tag->description).'</wp:tag_description>';
228 228
 	}
229 229
 
230 230
 	/**
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	 *
235 235
 	 * @param object $term Term Object
236 236
 	 */
237
-	function wxr_term_name( $term ) {
238
-		if ( empty( $term->name ) )
237
+	function wxr_term_name($term) {
238
+		if (empty($term->name))
239 239
 			return;
240 240
 
241
-		echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
241
+		echo '<wp:term_name>'.wxr_cdata($term->name).'</wp:term_name>';
242 242
 	}
243 243
 
244 244
 	/**
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @param object $term Term Object
250 250
 	 */
251
-	function wxr_term_description( $term ) {
252
-		if ( empty( $term->description ) )
251
+	function wxr_term_description($term) {
252
+		if (empty($term->description))
253 253
 			return;
254 254
 
255
-		echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
255
+		echo '<wp:term_description>'.wxr_cdata($term->description).'</wp:term_description>';
256 256
 	}
257 257
 
258 258
 	/**
@@ -264,31 +264,31 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @param array $post_ids Array of post IDs to filter the query by. Optional.
266 266
 	 */
267
-	function wxr_authors_list( array $post_ids = null ) {
267
+	function wxr_authors_list(array $post_ids = null) {
268 268
 		global $wpdb;
269 269
 
270
-		if ( !empty( $post_ids ) ) {
271
-			$post_ids = array_map( 'absint', $post_ids );
272
-			$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
270
+		if ( ! empty($post_ids)) {
271
+			$post_ids = array_map('absint', $post_ids);
272
+			$and = 'AND ID IN ( '.implode(', ', $post_ids).')';
273 273
 		} else {
274 274
 			$and = '';
275 275
 		}
276 276
 
277 277
 		$authors = array();
278
-		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
279
-		foreach ( (array) $results as $result )
280
-			$authors[] = get_userdata( $result->post_author );
278
+		$results = $wpdb->get_results("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and");
279
+		foreach ((array) $results as $result)
280
+			$authors[] = get_userdata($result->post_author);
281 281
 
282
-		$authors = array_filter( $authors );
282
+		$authors = array_filter($authors);
283 283
 
284
-		foreach ( $authors as $author ) {
284
+		foreach ($authors as $author) {
285 285
 			echo "\t<wp:author>";
286
-			echo '<wp:author_id>' . intval( $author->ID ) . '</wp:author_id>';
287
-			echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
288
-			echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
289
-			echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
290
-			echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
291
-			echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
286
+			echo '<wp:author_id>'.intval($author->ID).'</wp:author_id>';
287
+			echo '<wp:author_login>'.wxr_cdata($author->user_login).'</wp:author_login>';
288
+			echo '<wp:author_email>'.wxr_cdata($author->user_email).'</wp:author_email>';
289
+			echo '<wp:author_display_name>'.wxr_cdata($author->display_name).'</wp:author_display_name>';
290
+			echo '<wp:author_first_name>'.wxr_cdata($author->first_name).'</wp:author_first_name>';
291
+			echo '<wp:author_last_name>'.wxr_cdata($author->last_name).'</wp:author_last_name>';
292 292
 			echo "</wp:author>\n";
293 293
 		}
294 294
 	}
@@ -300,15 +300,15 @@  discard block
 block discarded – undo
300 300
 	 */
301 301
 	function wxr_nav_menu_terms() {
302 302
 		$nav_menus = wp_get_nav_menus();
303
-		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
303
+		if (empty($nav_menus) || ! is_array($nav_menus))
304 304
 			return;
305 305
 
306
-		foreach ( $nav_menus as $menu ) {
306
+		foreach ($nav_menus as $menu) {
307 307
 			echo "\t<wp:term>";
308
-			echo '<wp:term_id>' . intval( $menu->term_id ) . '</wp:term_id>';
308
+			echo '<wp:term_id>'.intval($menu->term_id).'</wp:term_id>';
309 309
 			echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
310
-			echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
311
-			wxr_term_name( $menu );
310
+			echo '<wp:term_slug>'.wxr_cdata($menu->slug).'</wp:term_slug>';
311
+			wxr_term_name($menu);
312 312
 			echo "</wp:term>\n";
313 313
 		}
314 314
 	}
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 	function wxr_post_taxonomy() {
322 322
 		$post = get_post();
323 323
 
324
-		$taxonomies = get_object_taxonomies( $post->post_type );
325
-		if ( empty( $taxonomies ) )
324
+		$taxonomies = get_object_taxonomies($post->post_type);
325
+		if (empty($taxonomies))
326 326
 			return;
327
-		$terms = wp_get_object_terms( $post->ID, $taxonomies );
327
+		$terms = wp_get_object_terms($post->ID, $taxonomies);
328 328
 
329
-		foreach ( (array) $terms as $term ) {
330
-			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
329
+		foreach ((array) $terms as $term) {
330
+			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">".wxr_cdata($term->name)."</category>\n";
331 331
 		}
332 332
 	}
333 333
 
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
 	 * @param string $meta_key
338 338
 	 * @return bool
339 339
 	 */
340
-	function wxr_filter_postmeta( $return_me, $meta_key ) {
341
-		if ( '_edit_lock' == $meta_key )
340
+	function wxr_filter_postmeta($return_me, $meta_key) {
341
+		if ('_edit_lock' == $meta_key)
342 342
 			$return_me = true;
343 343
 		return $return_me;
344 344
 	}
345
-	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
345
+	add_filter('wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2);
346 346
 
347
-	echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
347
+	echo '<?xml version="1.0" encoding="'.get_bloginfo('charset')."\" ?>\n";
348 348
 
349 349
 	?>
350 350
 <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
365 365
 <!--    contained in this file into your site. -->
366 366
 
367
-<?php the_generator( 'export' ); ?>
367
+<?php the_generator('export'); ?>
368 368
 <rss version="2.0"
369 369
 	xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
370 370
 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
@@ -374,34 +374,34 @@  discard block
 block discarded – undo
374 374
 >
375 375
 
376 376
 <channel>
377
-	<title><?php bloginfo_rss( 'name' ); ?></title>
378
-	<link><?php bloginfo_rss( 'url' ); ?></link>
379
-	<description><?php bloginfo_rss( 'description' ); ?></description>
380
-	<pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
381
-	<language><?php bloginfo_rss( 'language' ); ?></language>
377
+	<title><?php bloginfo_rss('name'); ?></title>
378
+	<link><?php bloginfo_rss('url'); ?></link>
379
+	<description><?php bloginfo_rss('description'); ?></description>
380
+	<pubDate><?php echo date('D, d M Y H:i:s +0000'); ?></pubDate>
381
+	<language><?php bloginfo_rss('language'); ?></language>
382 382
 	<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
383 383
 	<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
384
-	<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
384
+	<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
385 385
 
386
-<?php wxr_authors_list( $post_ids ); ?>
386
+<?php wxr_authors_list($post_ids); ?>
387 387
 
388
-<?php foreach ( $cats as $c ) : ?>
389
-	<wp:category><wp:term_id><?php echo intval( $c->term_id ); ?></wp:term_id><wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename><wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[$c->parent]->slug : '' ); ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category>
388
+<?php foreach ($cats as $c) : ?>
389
+	<wp:category><wp:term_id><?php echo intval($c->term_id); ?></wp:term_id><wp:category_nicename><?php echo wxr_cdata($c->slug); ?></wp:category_nicename><wp:category_parent><?php echo wxr_cdata($c->parent ? $cats[$c->parent]->slug : ''); ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
390 390
 <?php endforeach; ?>
391
-<?php foreach ( $tags as $t ) : ?>
392
-	<wp:tag><wp:term_id><?php echo intval( $t->term_id ); ?></wp:term_id><wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug><?php wxr_tag_name( $t ); ?><?php wxr_tag_description( $t ); ?></wp:tag>
391
+<?php foreach ($tags as $t) : ?>
392
+	<wp:tag><wp:term_id><?php echo intval($t->term_id); ?></wp:term_id><wp:tag_slug><?php echo wxr_cdata($t->slug); ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
393 393
 <?php endforeach; ?>
394
-<?php foreach ( $terms as $t ) : ?>
395
-	<wp:term><wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id><wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy><wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug><wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
394
+<?php foreach ($terms as $t) : ?>
395
+	<wp:term><wp:term_id><?php echo wxr_cdata($t->term_id); ?></wp:term_id><wp:term_taxonomy><?php echo wxr_cdata($t->taxonomy); ?></wp:term_taxonomy><wp:term_slug><?php echo wxr_cdata($t->slug); ?></wp:term_slug><wp:term_parent><?php echo wxr_cdata($t->parent ? $terms[$t->parent]->slug : ''); ?></wp:term_parent><?php wxr_term_name($t); ?><?php wxr_term_description($t); ?></wp:term>
396 396
 <?php endforeach; ?>
397
-<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
397
+<?php if ('all' == $args['content']) wxr_nav_menu_terms(); ?>
398 398
 
399 399
 	<?php
400 400
 	/** This action is documented in wp-includes/feed-rss2.php */
401
-	do_action( 'rss2_head' );
401
+	do_action('rss2_head');
402 402
 	?>
403 403
 
404
-<?php if ( $post_ids ) {
404
+<?php if ($post_ids) {
405 405
 	/**
406 406
 	 * @global WP_Query $wp_query
407 407
 	 */
@@ -411,23 +411,23 @@  discard block
 block discarded – undo
411 411
 	$wp_query->in_the_loop = true;
412 412
 
413 413
 	// Fetch 20 posts at a time rather than loading the entire table into memory.
414
-	while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
415
-	$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
416
-	$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
414
+	while ($next_posts = array_splice($post_ids, 0, 20)) {
415
+	$where = 'WHERE ID IN ('.join(',', $next_posts).')';
416
+	$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} $where");
417 417
 
418 418
 	// Begin Loop.
419
-	foreach ( $posts as $post ) {
420
-		setup_postdata( $post );
421
-		$is_sticky = is_sticky( $post->ID ) ? 1 : 0;
419
+	foreach ($posts as $post) {
420
+		setup_postdata($post);
421
+		$is_sticky = is_sticky($post->ID) ? 1 : 0;
422 422
 ?>
423 423
 	<item>
424 424
 		<title><?php
425 425
 			/** This filter is documented in wp-includes/feed.php */
426
-			echo apply_filters( 'the_title_rss', $post->post_title );
426
+			echo apply_filters('the_title_rss', $post->post_title);
427 427
 		?></title>
428 428
 		<link><?php the_permalink_rss() ?></link>
429
-		<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
430
-		<dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
429
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
430
+		<dc:creator><?php echo wxr_cdata(get_the_author_meta('login')); ?></dc:creator>
431 431
 		<guid isPermaLink="false"><?php the_guid(); ?></guid>
432 432
 		<description></description>
433 433
 		<content:encoded><?php
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 			 *
439 439
 			 * @param string $post_content Content of the current post.
440 440
 			 */
441
-			echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
441
+			echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
442 442
 		?></content:encoded>
443 443
 		<excerpt:encoded><?php
444 444
 			/**
@@ -448,26 +448,26 @@  discard block
 block discarded – undo
448 448
 			 *
449 449
 			 * @param string $post_excerpt Excerpt for the current post.
450 450
 			 */
451
-			echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
451
+			echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
452 452
 		?></excerpt:encoded>
453
-		<wp:post_id><?php echo intval( $post->ID ); ?></wp:post_id>
454
-		<wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date>
455
-		<wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt>
456
-		<wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status>
457
-		<wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status>
458
-		<wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name>
459
-		<wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status>
460
-		<wp:post_parent><?php echo intval( $post->post_parent ); ?></wp:post_parent>
461
-		<wp:menu_order><?php echo intval( $post->menu_order ); ?></wp:menu_order>
462
-		<wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type>
463
-		<wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password>
464
-		<wp:is_sticky><?php echo intval( $is_sticky ); ?></wp:is_sticky>
465
-<?php	if ( $post->post_type == 'attachment' ) : ?>
466
-		<wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url>
453
+		<wp:post_id><?php echo intval($post->ID); ?></wp:post_id>
454
+		<wp:post_date><?php echo wxr_cdata($post->post_date); ?></wp:post_date>
455
+		<wp:post_date_gmt><?php echo wxr_cdata($post->post_date_gmt); ?></wp:post_date_gmt>
456
+		<wp:comment_status><?php echo wxr_cdata($post->comment_status); ?></wp:comment_status>
457
+		<wp:ping_status><?php echo wxr_cdata($post->ping_status); ?></wp:ping_status>
458
+		<wp:post_name><?php echo wxr_cdata($post->post_name); ?></wp:post_name>
459
+		<wp:status><?php echo wxr_cdata($post->post_status); ?></wp:status>
460
+		<wp:post_parent><?php echo intval($post->post_parent); ?></wp:post_parent>
461
+		<wp:menu_order><?php echo intval($post->menu_order); ?></wp:menu_order>
462
+		<wp:post_type><?php echo wxr_cdata($post->post_type); ?></wp:post_type>
463
+		<wp:post_password><?php echo wxr_cdata($post->post_password); ?></wp:post_password>
464
+		<wp:is_sticky><?php echo intval($is_sticky); ?></wp:is_sticky>
465
+<?php	if ($post->post_type == 'attachment') : ?>
466
+		<wp:attachment_url><?php echo wxr_cdata(wp_get_attachment_url($post->ID)); ?></wp:attachment_url>
467 467
 <?php 	endif; ?>
468 468
 <?php 	wxr_post_taxonomy(); ?>
469
-<?php	$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
470
-		foreach ( $postmeta as $meta ) :
469
+<?php	$postmeta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID));
470
+		foreach ($postmeta as $meta) :
471 471
 			/**
472 472
 			 * Filter whether to selectively skip post meta used for WXR exports.
473 473
 			 *
@@ -480,33 +480,33 @@  discard block
 block discarded – undo
480 480
 			 * @param string $meta_key Current meta key.
481 481
 			 * @param object $meta     Current meta object.
482 482
 			 */
483
-			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
483
+			if (apply_filters('wxr_export_skip_postmeta', false, $meta->meta_key, $meta))
484 484
 				continue;
485 485
 		?>
486 486
 		<wp:postmeta>
487
-			<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
488
-			<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
487
+			<wp:meta_key><?php echo wxr_cdata($meta->meta_key); ?></wp:meta_key>
488
+			<wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value>
489 489
 		</wp:postmeta>
490 490
 <?php	endforeach;
491 491
 
492
-		$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
493
-		$comments = array_map( 'get_comment', $_comments );
494
-		foreach ( $comments as $c ) : ?>
492
+		$_comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID));
493
+		$comments = array_map('get_comment', $_comments);
494
+		foreach ($comments as $c) : ?>
495 495
 		<wp:comment>
496
-			<wp:comment_id><?php echo intval( $c->comment_ID ); ?></wp:comment_id>
497
-			<wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
498
-			<wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email>
499
-			<wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
500
-			<wp:comment_author_IP><?php echo wxr_cdata( $c->comment_author_IP ); ?></wp:comment_author_IP>
501
-			<wp:comment_date><?php echo wxr_cdata( $c->comment_date ); ?></wp:comment_date>
502
-			<wp:comment_date_gmt><?php echo wxr_cdata( $c->comment_date_gmt ); ?></wp:comment_date_gmt>
503
-			<wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content>
504
-			<wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved>
505
-			<wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type>
506
-			<wp:comment_parent><?php echo intval( $c->comment_parent ); ?></wp:comment_parent>
507
-			<wp:comment_user_id><?php echo intval( $c->user_id ); ?></wp:comment_user_id>
508
-<?php		$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
509
-			foreach ( $c_meta as $meta ) :
496
+			<wp:comment_id><?php echo intval($c->comment_ID); ?></wp:comment_id>
497
+			<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
498
+			<wp:comment_author_email><?php echo wxr_cdata($c->comment_author_email); ?></wp:comment_author_email>
499
+			<wp:comment_author_url><?php echo esc_url_raw($c->comment_author_url); ?></wp:comment_author_url>
500
+			<wp:comment_author_IP><?php echo wxr_cdata($c->comment_author_IP); ?></wp:comment_author_IP>
501
+			<wp:comment_date><?php echo wxr_cdata($c->comment_date); ?></wp:comment_date>
502
+			<wp:comment_date_gmt><?php echo wxr_cdata($c->comment_date_gmt); ?></wp:comment_date_gmt>
503
+			<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
504
+			<wp:comment_approved><?php echo wxr_cdata($c->comment_approved); ?></wp:comment_approved>
505
+			<wp:comment_type><?php echo wxr_cdata($c->comment_type); ?></wp:comment_type>
506
+			<wp:comment_parent><?php echo intval($c->comment_parent); ?></wp:comment_parent>
507
+			<wp:comment_user_id><?php echo intval($c->user_id); ?></wp:comment_user_id>
508
+<?php		$c_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID));
509
+			foreach ($c_meta as $meta) :
510 510
 				/**
511 511
 				 * Filter whether to selectively skip comment meta used for WXR exports.
512 512
 				 *
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 				 * @param string $meta_key Current meta key.
520 520
 				 * @param object $meta     Current meta object.
521 521
 				 */
522
-				if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
522
+				if (apply_filters('wxr_export_skip_commentmeta', false, $meta->meta_key, $meta)) {
523 523
 					continue;
524 524
 				}
525 525
 			?>
526 526
 			<wp:commentmeta>
527
-				<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
528
-				<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
527
+				<wp:meta_key><?php echo wxr_cdata($meta->meta_key); ?></wp:meta_key>
528
+				<wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value>
529 529
 			</wp:commentmeta>
530 530
 <?php		endforeach; ?>
531 531
 		</wp:comment>
Please login to merge, or discard this patch.
Braces   +70 added lines, -47 removed lines patch added patch discarded remove patch
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
 	if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
67 67
 		$ptype = get_post_type_object( $args['content'] );
68
-		if ( ! $ptype->can_export )
69
-			$args['content'] = 'post';
68
+		if ( ! $ptype->can_export ) {
69
+					$args['content'] = 'post';
70
+		}
70 71
 
71 72
 		$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
72 73
 	} else {
@@ -75,10 +76,11 @@  discard block
 block discarded – undo
75 76
 		$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
76 77
 	}
77 78
 
78
-	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
79
-		$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
80
-	else
81
-		$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
79
+	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) {
80
+			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
81
+	} else {
82
+			$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
83
+	}
82 84
 
83 85
 	$join = '';
84 86
 	if ( $args['category'] && 'post' == $args['content'] ) {
@@ -89,14 +91,17 @@  discard block
 block discarded – undo
89 91
 	}
90 92
 
91 93
 	if ( 'post' == $args['content'] || 'page' == $args['content'] || 'attachment' == $args['content'] ) {
92
-		if ( $args['author'] )
93
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
94
+		if ( $args['author'] ) {
95
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
96
+		}
94 97
 
95
-		if ( $args['start_date'] )
96
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
98
+		if ( $args['start_date'] ) {
99
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
100
+		}
97 101
 
98
-		if ( $args['end_date'] )
99
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
102
+		if ( $args['end_date'] ) {
103
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
104
+		}
100 105
 	}
101 106
 
102 107
 	// Grab a snapshot of post IDs, just in case it changes during the export.
@@ -120,18 +125,20 @@  discard block
 block discarded – undo
120 125
 
121 126
 		// Put categories in order with no child going before its parent.
122 127
 		while ( $cat = array_shift( $categories ) ) {
123
-			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
124
-				$cats[$cat->term_id] = $cat;
125
-			else
126
-				$categories[] = $cat;
128
+			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) {
129
+							$cats[$cat->term_id] = $cat;
130
+			} else {
131
+							$categories[] = $cat;
132
+			}
127 133
 		}
128 134
 
129 135
 		// Put terms in order with no child going before its parent.
130 136
 		while ( $t = array_shift( $custom_terms ) ) {
131
-			if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
132
-				$terms[$t->term_id] = $t;
133
-			else
134
-				$custom_terms[] = $t;
137
+			if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) {
138
+							$terms[$t->term_id] = $t;
139
+			} else {
140
+							$custom_terms[] = $t;
141
+			}
135 142
 		}
136 143
 
137 144
 		unset( $categories, $custom_taxonomies, $custom_terms );
@@ -164,11 +171,13 @@  discard block
 block discarded – undo
164 171
 	 */
165 172
 	function wxr_site_url() {
166 173
 		// Multisite: the base URL.
167
-		if ( is_multisite() )
168
-			return network_home_url();
174
+		if ( is_multisite() ) {
175
+					return network_home_url();
176
+		}
169 177
 		// WordPress (single site): the blog URL.
170
-		else
171
-			return get_bloginfo_rss( 'url' );
178
+		else {
179
+					return get_bloginfo_rss( 'url' );
180
+		}
172 181
 	}
173 182
 
174 183
 	/**
@@ -179,8 +188,9 @@  discard block
 block discarded – undo
179 188
 	 * @param object $category Category Object
180 189
 	 */
181 190
 	function wxr_cat_name( $category ) {
182
-		if ( empty( $category->name ) )
183
-			return;
191
+		if ( empty( $category->name ) ) {
192
+					return;
193
+		}
184 194
 
185 195
 		echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';
186 196
 	}
@@ -193,8 +203,9 @@  discard block
 block discarded – undo
193 203
 	 * @param object $category Category Object
194 204
 	 */
195 205
 	function wxr_category_description( $category ) {
196
-		if ( empty( $category->description ) )
197
-			return;
206
+		if ( empty( $category->description ) ) {
207
+					return;
208
+		}
198 209
 
199 210
 		echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
200 211
 	}
@@ -207,8 +218,9 @@  discard block
 block discarded – undo
207 218
 	 * @param object $tag Tag Object
208 219
 	 */
209 220
 	function wxr_tag_name( $tag ) {
210
-		if ( empty( $tag->name ) )
211
-			return;
221
+		if ( empty( $tag->name ) ) {
222
+					return;
223
+		}
212 224
 
213 225
 		echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';
214 226
 	}
@@ -221,8 +233,9 @@  discard block
 block discarded – undo
221 233
 	 * @param object $tag Tag Object
222 234
 	 */
223 235
 	function wxr_tag_description( $tag ) {
224
-		if ( empty( $tag->description ) )
225
-			return;
236
+		if ( empty( $tag->description ) ) {
237
+					return;
238
+		}
226 239
 
227 240
 		echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
228 241
 	}
@@ -235,8 +248,9 @@  discard block
 block discarded – undo
235 248
 	 * @param object $term Term Object
236 249
 	 */
237 250
 	function wxr_term_name( $term ) {
238
-		if ( empty( $term->name ) )
239
-			return;
251
+		if ( empty( $term->name ) ) {
252
+					return;
253
+		}
240 254
 
241 255
 		echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
242 256
 	}
@@ -249,8 +263,9 @@  discard block
 block discarded – undo
249 263
 	 * @param object $term Term Object
250 264
 	 */
251 265
 	function wxr_term_description( $term ) {
252
-		if ( empty( $term->description ) )
253
-			return;
266
+		if ( empty( $term->description ) ) {
267
+					return;
268
+		}
254 269
 
255 270
 		echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
256 271
 	}
@@ -276,8 +291,9 @@  discard block
 block discarded – undo
276 291
 
277 292
 		$authors = array();
278 293
 		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
279
-		foreach ( (array) $results as $result )
280
-			$authors[] = get_userdata( $result->post_author );
294
+		foreach ( (array) $results as $result ) {
295
+					$authors[] = get_userdata( $result->post_author );
296
+		}
281 297
 
282 298
 		$authors = array_filter( $authors );
283 299
 
@@ -300,8 +316,9 @@  discard block
 block discarded – undo
300 316
 	 */
301 317
 	function wxr_nav_menu_terms() {
302 318
 		$nav_menus = wp_get_nav_menus();
303
-		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
304
-			return;
319
+		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) {
320
+					return;
321
+		}
305 322
 
306 323
 		foreach ( $nav_menus as $menu ) {
307 324
 			echo "\t<wp:term>";
@@ -322,8 +339,9 @@  discard block
 block discarded – undo
322 339
 		$post = get_post();
323 340
 
324 341
 		$taxonomies = get_object_taxonomies( $post->post_type );
325
-		if ( empty( $taxonomies ) )
326
-			return;
342
+		if ( empty( $taxonomies ) ) {
343
+					return;
344
+		}
327 345
 		$terms = wp_get_object_terms( $post->ID, $taxonomies );
328 346
 
329 347
 		foreach ( (array) $terms as $term ) {
@@ -338,8 +356,9 @@  discard block
 block discarded – undo
338 356
 	 * @return bool
339 357
 	 */
340 358
 	function wxr_filter_postmeta( $return_me, $meta_key ) {
341
-		if ( '_edit_lock' == $meta_key )
342
-			$return_me = true;
359
+		if ( '_edit_lock' == $meta_key ) {
360
+					$return_me = true;
361
+		}
343 362
 		return $return_me;
344 363
 	}
345 364
 	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
@@ -394,7 +413,10 @@  discard block
 block discarded – undo
394 413
 <?php foreach ( $terms as $t ) : ?>
395 414
 	<wp:term><wp:term_id><?php echo wxr_cdata( $t->term_id ); ?></wp:term_id><wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy><wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug><wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[$t->parent]->slug : '' ); ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
396 415
 <?php endforeach; ?>
397
-<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
416
+<?php if ( 'all' == $args['content'] ) {
417
+	wxr_nav_menu_terms();
418
+}
419
+?>
398 420
 
399 421
 	<?php
400 422
 	/** This action is documented in wp-includes/feed-rss2.php */
@@ -480,8 +502,9 @@  discard block
 block discarded – undo
480 502
 			 * @param string $meta_key Current meta key.
481 503
 			 * @param object $meta     Current meta object.
482 504
 			 */
483
-			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
484
-				continue;
505
+			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
506
+							continue;
507
+			}
485 508
 		?>
486 509
 		<wp:postmeta>
487 510
 			<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
Please login to merge, or discard this patch.
src/wp-admin/ms-options.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite network settings administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite network settings administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,6 +7,6 @@
 block discarded – undo
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'));
Please login to merge, or discard this patch.