Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-includes/ms-settings.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -11,117 +11,117 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 /** Include Multisite initialization functions */
14
-require_once( ABSPATH . WPINC . '/ms-load.php' );
15
-require_once( ABSPATH . WPINC . '/ms-default-constants.php' );
14
+require_once(ABSPATH.WPINC.'/ms-load.php');
15
+require_once(ABSPATH.WPINC.'/ms-default-constants.php');
16 16
 
17
-if ( defined( 'SUNRISE' ) ) {
18
-	include_once( WP_CONTENT_DIR . '/sunrise.php' );
17
+if (defined('SUNRISE')) {
18
+	include_once(WP_CONTENT_DIR.'/sunrise.php');
19 19
 }
20 20
 
21 21
 /** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */
22 22
 ms_subdomain_constants();
23 23
 
24
-if ( !isset( $current_site ) || !isset( $current_blog ) ) {
24
+if ( ! isset($current_site) || ! isset($current_blog)) {
25 25
 
26 26
 	// Given the domain and path, let's try to identify the network and site.
27 27
 	// Usually, it's easier to query the site first, which declares its network.
28 28
 	// In limited situations, though, we either can or must find the network first.
29 29
 
30
-	$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
31
-	if ( substr( $domain, -3 ) == ':80' ) {
32
-		$domain = substr( $domain, 0, -3 );
33
-		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
34
-	} elseif ( substr( $domain, -4 ) == ':443' ) {
35
-		$domain = substr( $domain, 0, -4 );
36
-		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
30
+	$domain = strtolower(stripslashes($_SERVER['HTTP_HOST']));
31
+	if (substr($domain, -3) == ':80') {
32
+		$domain = substr($domain, 0, -3);
33
+		$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'], 0, -3);
34
+	} elseif (substr($domain, -4) == ':443') {
35
+		$domain = substr($domain, 0, -4);
36
+		$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'], 0, -4);
37 37
 	}
38 38
 
39
-	$path = stripslashes( $_SERVER['REQUEST_URI'] );
40
-	if ( is_admin() ) {
41
-		$path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
39
+	$path = stripslashes($_SERVER['REQUEST_URI']);
40
+	if (is_admin()) {
41
+		$path = preg_replace('#(.*)/wp-admin/.*#', '$1/', $path);
42 42
 	}
43
-	list( $path ) = explode( '?', $path );
43
+	list($path) = explode('?', $path);
44 44
 
45 45
 	// If the network is defined in wp-config.php, we can simply use that.
46
-	if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
46
+	if (defined('DOMAIN_CURRENT_SITE') && defined('PATH_CURRENT_SITE')) {
47 47
 		$current_site = new stdClass;
48
-		$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
48
+		$current_site->id = defined('SITE_ID_CURRENT_SITE') ? SITE_ID_CURRENT_SITE : 1;
49 49
 		$current_site->domain = DOMAIN_CURRENT_SITE;
50 50
 		$current_site->path = PATH_CURRENT_SITE;
51
-		if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
51
+		if (defined('BLOG_ID_CURRENT_SITE')) {
52 52
 			$current_site->blog_id = BLOG_ID_CURRENT_SITE;
53
-		} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // deprecated.
53
+		} elseif (defined('BLOGID_CURRENT_SITE')) { // deprecated.
54 54
 			$current_site->blog_id = BLOGID_CURRENT_SITE;
55 55
 		}
56 56
 
57
-		if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) {
58
-			$current_blog = get_site_by_path( $domain, $path );
59
-		} elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) {
57
+		if (0 === strcasecmp($current_site->domain, $domain) && 0 === strcasecmp($current_site->path, $path)) {
58
+			$current_blog = get_site_by_path($domain, $path);
59
+		} elseif ('/' !== $current_site->path && 0 === strcasecmp($current_site->domain, $domain) && 0 === stripos($path, $current_site->path)) {
60 60
 			// If the current network has a path and also matches the domain and path of the request,
61 61
 			// we need to look for a site using the first path segment following the network's path.
62
-			$current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) );
62
+			$current_blog = get_site_by_path($domain, $path, 1 + count(explode('/', trim($current_site->path, '/'))));
63 63
 		} else {
64 64
 			// Otherwise, use the first path segment (as usual).
65
-			$current_blog = get_site_by_path( $domain, $path, 1 );
65
+			$current_blog = get_site_by_path($domain, $path, 1);
66 66
 		}
67 67
 
68
-	} elseif ( ! is_subdomain_install() ) {
68
+	} elseif ( ! is_subdomain_install()) {
69 69
 		/*
70 70
 		 * A "subdomain" install can be re-interpreted to mean "can support any domain".
71 71
 		 * If we're not dealing with one of these installs, then the important part is determining
72 72
 		 * the network first, because we need the network's path to identify any sites.
73 73
 		 */
74
-		if ( ! $current_site = wp_cache_get( 'current_network', 'site-options' ) ) {
74
+		if ( ! $current_site = wp_cache_get('current_network', 'site-options')) {
75 75
 			// Are there even two networks installed?
76
-			$one_network = $wpdb->get_row( "SELECT * FROM $wpdb->site LIMIT 2" ); // [sic]
77
-			if ( 1 === $wpdb->num_rows ) {
78
-				$current_site = wp_get_network( $one_network );
79
-				wp_cache_add( 'current_network', $current_site, 'site-options' );
80
-			} elseif ( 0 === $wpdb->num_rows ) {
76
+			$one_network = $wpdb->get_row("SELECT * FROM $wpdb->site LIMIT 2"); // [sic]
77
+			if (1 === $wpdb->num_rows) {
78
+				$current_site = wp_get_network($one_network);
79
+				wp_cache_add('current_network', $current_site, 'site-options');
80
+			} elseif (0 === $wpdb->num_rows) {
81 81
 				ms_not_installed();
82 82
 			}
83 83
 		}
84
-		if ( empty( $current_site ) ) {
85
-			$current_site = get_network_by_path( $domain, $path, 1 );
84
+		if (empty($current_site)) {
85
+			$current_site = get_network_by_path($domain, $path, 1);
86 86
 		}
87 87
 
88
-		if ( empty( $current_site ) ) {
88
+		if (empty($current_site)) {
89 89
 			ms_not_installed();
90
-		} elseif ( $path === $current_site->path ) {
91
-			$current_blog = get_site_by_path( $domain, $path );
90
+		} elseif ($path === $current_site->path) {
91
+			$current_blog = get_site_by_path($domain, $path);
92 92
 		} else {
93 93
 			// Search the network path + one more path segment (on top of the network path).
94
-			$current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) );
94
+			$current_blog = get_site_by_path($domain, $path, substr_count($current_site->path, '/'));
95 95
 		}
96 96
 	} else {
97 97
 		// Find the site by the domain and at most the first path segment.
98
-		$current_blog = get_site_by_path( $domain, $path, 1 );
99
-		if ( $current_blog ) {
100
-			$current_site = wp_get_network( $current_blog->site_id ? $current_blog->site_id : 1 );
98
+		$current_blog = get_site_by_path($domain, $path, 1);
99
+		if ($current_blog) {
100
+			$current_site = wp_get_network($current_blog->site_id ? $current_blog->site_id : 1);
101 101
 		} else {
102 102
 			// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
103
-			$current_site = get_network_by_path( $domain, $path, 1 );
103
+			$current_site = get_network_by_path($domain, $path, 1);
104 104
 		}
105 105
 	}
106 106
 
107 107
 	// The network declared by the site trumps any constants.
108
-	if ( $current_blog && $current_blog->site_id != $current_site->id ) {
109
-		$current_site = wp_get_network( $current_blog->site_id );
108
+	if ($current_blog && $current_blog->site_id != $current_site->id) {
109
+		$current_site = wp_get_network($current_blog->site_id);
110 110
 	}
111 111
 
112 112
 	// No network has been found, bail.
113
-	if ( empty( $current_site ) ) {
113
+	if (empty($current_site)) {
114 114
 		ms_not_installed();
115 115
 	}
116 116
 
117 117
 	// @todo Investigate when exactly this can occur.
118
-	if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) {
118
+	if (empty($current_blog) && defined('WP_INSTALLING')) {
119 119
 		$current_blog = new stdClass;
120 120
 		$current_blog->blog_id = $blog_id = 1;
121 121
 	}
122 122
 
123 123
 	// No site has been found, bail.
124
-	if ( empty( $current_blog ) ) {
124
+	if (empty($current_blog)) {
125 125
 		// We're going to redirect to the network URL, with some possible modifications.
126 126
 		$scheme = is_ssl() ? 'https' : 'http';
127 127
 		$destination = "$scheme://{$current_site->domain}{$current_site->path}";
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
 		 * @param string $domain       The domain used to search for a site.
139 139
 		 * @param string $path         The path used to search for a site.
140 140
 		 */
141
-		do_action( 'ms_site_not_found', $current_site, $domain, $path );
141
+		do_action('ms_site_not_found', $current_site, $domain, $path);
142 142
 
143
-		if ( is_subdomain_install() && ! defined( 'NOBLOGREDIRECT' ) ) {
143
+		if (is_subdomain_install() && ! defined('NOBLOGREDIRECT')) {
144 144
 			// For a "subdomain" install, redirect to the signup form specifically.
145
-			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
146
-		} elseif ( is_subdomain_install() ) {
145
+			$destination .= 'wp-signup.php?new='.str_replace('.'.$current_site->domain, '', $domain);
146
+		} elseif (is_subdomain_install()) {
147 147
 			// For a "subdomain" install, the NOBLOGREDIRECT constant
148 148
 			// can be used to avoid a redirect to the signup form.
149 149
 			// Using the ms_site_not_found action is preferred to the constant.
150
-			if ( '%siteurl%' !== NOBLOGREDIRECT ) {
150
+			if ('%siteurl%' !== NOBLOGREDIRECT) {
151 151
 				$destination = NOBLOGREDIRECT;
152 152
 			}
153
-		} elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) {
153
+		} elseif (0 === strcasecmp($current_site->domain, $domain)) {
154 154
 			/*
155 155
 			 * If the domain we were searching for matches the network's domain,
156 156
 			 * it's no use redirecting back to ourselves -- it'll cause a loop.
@@ -159,42 +159,42 @@  discard block
 block discarded – undo
159 159
 			ms_not_installed();
160 160
 		}
161 161
 
162
-		header( 'Location: ' . $destination );
162
+		header('Location: '.$destination);
163 163
 		exit;
164 164
 	}
165 165
 
166 166
 	// @todo What if the domain of the network doesn't match the current site?
167 167
 	$current_site->cookie_domain = $current_site->domain;
168
-	if ( 'www.' === substr( $current_site->cookie_domain, 0, 4 ) ) {
169
-		$current_site->cookie_domain = substr( $current_site->cookie_domain, 4 );
168
+	if ('www.' === substr($current_site->cookie_domain, 0, 4)) {
169
+		$current_site->cookie_domain = substr($current_site->cookie_domain, 4);
170 170
 	}
171 171
 
172 172
 	// Figure out the current network's main site.
173
-	if ( ! isset( $current_site->blog_id ) ) {
174
-		if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) {
173
+	if ( ! isset($current_site->blog_id)) {
174
+		if ($current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path) {
175 175
 			$current_site->blog_id = $current_blog->blog_id;
176
-		} elseif ( ! $current_site->blog_id = wp_cache_get( 'network:' . $current_site->id . ':main_site', 'site-options' ) ) {
177
-			$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
178
-				$current_site->domain, $current_site->path ) );
179
-			wp_cache_add( 'network:' . $current_site->id . ':main_site', $current_site->blog_id, 'site-options' );
176
+		} elseif ( ! $current_site->blog_id = wp_cache_get('network:'.$current_site->id.':main_site', 'site-options')) {
177
+			$current_site->blog_id = $wpdb->get_var($wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s",
178
+				$current_site->domain, $current_site->path));
179
+			wp_cache_add('network:'.$current_site->id.':main_site', $current_site->blog_id, 'site-options');
180 180
 		}
181 181
 	}
182 182
 
183 183
 	$blog_id = $current_blog->blog_id;
184 184
 	$public  = $current_blog->public;
185 185
 
186
-	if ( empty( $current_blog->site_id ) ) {
186
+	if (empty($current_blog->site_id)) {
187 187
 		// This dates to [MU134] and shouldn't be relevant anymore,
188 188
 		// but it could be possible for arguments passed to insert_blog() etc.
189 189
 		$current_blog->site_id = 1;
190 190
 	}
191 191
 
192 192
 	$site_id = $current_blog->site_id;
193
-	wp_load_core_site_options( $site_id );
193
+	wp_load_core_site_options($site_id);
194 194
 }
195 195
 
196
-$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php
197
-$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
196
+$wpdb->set_prefix($table_prefix, false); // $table_prefix can be set in sunrise.php
197
+$wpdb->set_blog_id($current_blog->blog_id, $current_blog->site_id);
198 198
 $table_prefix = $wpdb->get_blog_prefix();
199 199
 $_wp_switched_stack = array();
200 200
 $switched = false;
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 // need to init cache again after blog_id is set
203 203
 wp_start_object_cache();
204 204
 
205
-if ( ! isset( $current_site->site_name ) ) {
206
-	$current_site->site_name = get_site_option( 'site_name' );
207
-	if ( ! $current_site->site_name ) {
208
-		$current_site->site_name = ucfirst( $current_site->domain );
205
+if ( ! isset($current_site->site_name)) {
206
+	$current_site->site_name = get_site_option('site_name');
207
+	if ( ! $current_site->site_name) {
208
+		$current_site->site_name = ucfirst($current_site->domain);
209 209
 	}
210 210
 }
211 211
 
Please login to merge, or discard this patch.
src/wp-includes/media-template.php 2 patches
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
23 23
 	preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
24 24
 	<#
25
-	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
25
+	<?php foreach (array('autoplay', 'loop') as $attr):
26 26
 	?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
27 27
 		#> <?php echo $attr ?><#
28 28
 	}
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	<source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
33 33
 	<# } #>
34 34
 
35
-	<?php foreach ( $audio_types as $type ):
35
+	<?php foreach ($audio_types as $type):
36 36
 	?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
37 37
 	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
38 38
 	<# } #>
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	<# if ( w ) { #>width="{{ w }}"<# } #>
94 94
 	<# if ( h ) { #>height="{{ h }}"<# } #>
95 95
 	<?php
96
-	$props = array( 'poster' => '', 'preload' => 'metadata' );
97
-	foreach ( $props as $key => $value ):
98
-		if ( empty( $value ) ) {
96
+	$props = array('poster' => '', 'preload' => 'metadata');
97
+	foreach ($props as $key => $value):
98
+		if (empty($value)) {
99 99
 		?><#
100 100
 		if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
101 101
 			#> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		}
106 106
 	endforeach;
107 107
 	?><#
108
-	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
108
+	<?php foreach (array('autoplay', 'loop') as $attr):
109 109
 	?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
110 110
 		#> <?php echo $attr ?><#
111 111
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		<# }
122 122
 	} #>
123 123
 
124
-	<?php foreach ( $video_types as $type ):
124
+	<?php foreach ($video_types as $type):
125 125
 	?><# if ( data.model.<?php echo $type ?> ) { #>
126 126
 	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
127 127
 	<# } #>
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 function wp_print_media_templates() {
143 143
 	global $is_IE;
144 144
 	$class = 'media-modal wp-core-ui';
145
-	if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
145
+	if ($is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false)
146 146
 		$class .= ' ie7';
147 147
 	?>
148 148
 	<!--[if lte IE 8]>
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
 	<script type="text/html" id="tmpl-media-modal">
168 168
 		<div class="<?php echo $class; ?>">
169
-			<button type="button" class="button-link media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></button>
169
+			<button type="button" class="button-link media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e('Close media panel'); ?></span></span></button>
170 170
 			<div class="media-modal-content"></div>
171 171
 		</div>
172 172
 		<div class="media-modal-backdrop"></div>
@@ -174,38 +174,38 @@  discard block
 block discarded – undo
174 174
 
175 175
 	<script type="text/html" id="tmpl-uploader-window">
176 176
 		<div class="uploader-window-content">
177
-			<h3><?php _e( 'Drop files to upload' ); ?></h3>
177
+			<h3><?php _e('Drop files to upload'); ?></h3>
178 178
 		</div>
179 179
 	</script>
180 180
 
181 181
 	<script type="text/html" id="tmpl-uploader-editor">
182 182
 		<div class="uploader-editor-content">
183
-			<div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
183
+			<div class="uploader-editor-title"><?php _e('Drop files to upload'); ?></div>
184 184
 		</div>
185 185
 	</script>
186 186
 
187 187
 	<script type="text/html" id="tmpl-uploader-inline">
188 188
 		<# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
189 189
 		<# if ( data.canClose ) { #>
190
-		<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button>
190
+		<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Close uploader'); ?></span></button>
191 191
 		<# } #>
192 192
 		<div class="uploader-inline-content {{ messageClass }}">
193 193
 		<# if ( data.message ) { #>
194 194
 			<h3 class="upload-message">{{ data.message }}</h3>
195 195
 		<# } #>
196
-		<?php if ( ! _device_can_upload() ) : ?>
197
-			<h3 class="upload-instructions"><?php printf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/' ); ?></h3>
198
-		<?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
199
-			<h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
196
+		<?php if ( ! _device_can_upload()) : ?>
197
+			<h3 class="upload-instructions"><?php printf(__('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/'); ?></h3>
198
+		<?php elseif (is_multisite() && ! is_upload_space_available()) : ?>
199
+			<h3 class="upload-instructions"><?php _e('Upload Limit Exceeded'); ?></h3>
200 200
 			<?php
201 201
 			/** This action is documented in wp-admin/includes/media.php */
202
-			do_action( 'upload_ui_over_quota' ); ?>
202
+			do_action('upload_ui_over_quota'); ?>
203 203
 
204 204
 		<?php else : ?>
205 205
 			<div class="upload-ui">
206
-				<h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
207
-				<p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
208
-				<button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button>
206
+				<h3 class="upload-instructions drop-instructions"><?php _e('Drop files anywhere to upload'); ?></h3>
207
+				<p class="upload-instructions drop-instructions"><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p>
208
+				<button type="button" class="browser button button-hero"><?php _e('Select Files'); ?></button>
209 209
 			</div>
210 210
 
211 211
 			<div class="upload-inline-status"></div>
@@ -213,55 +213,55 @@  discard block
 block discarded – undo
213 213
 			<div class="post-upload-ui">
214 214
 				<?php
215 215
 				/** This action is documented in wp-admin/includes/media.php */
216
-				do_action( 'pre-upload-ui' );
216
+				do_action('pre-upload-ui');
217 217
 				/** This action is documented in wp-admin/includes/media.php */
218
-				do_action( 'pre-plupload-upload-ui' );
218
+				do_action('pre-plupload-upload-ui');
219 219
 
220
-				if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
220
+				if (10 === remove_action('post-plupload-upload-ui', 'media_upload_flash_bypass')) {
221 221
 					/** This action is documented in wp-admin/includes/media.php */
222
-					do_action( 'post-plupload-upload-ui' );
223
-					add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
222
+					do_action('post-plupload-upload-ui');
223
+					add_action('post-plupload-upload-ui', 'media_upload_flash_bypass');
224 224
 				} else {
225 225
 					/** This action is documented in wp-admin/includes/media.php */
226
-					do_action( 'post-plupload-upload-ui' );
226
+					do_action('post-plupload-upload-ui');
227 227
 				}
228 228
 
229 229
 				$max_upload_size = wp_max_upload_size();
230
-				if ( ! $max_upload_size ) {
230
+				if ( ! $max_upload_size) {
231 231
 					$max_upload_size = 0;
232 232
 				}
233 233
 				?>
234 234
 
235 235
 				<p class="max-upload-size"><?php
236
-					printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
236
+					printf(__('Maximum upload file size: %s.'), esc_html(size_format($max_upload_size)));
237 237
 				?></p>
238 238
 
239 239
 				<# if ( data.suggestedWidth && data.suggestedHeight ) { #>
240 240
 					<p class="suggested-dimensions">
241
-						<?php _e( 'Suggested image dimensions:' ); ?> {{data.suggestedWidth}} &times; {{data.suggestedHeight}}
241
+						<?php _e('Suggested image dimensions:'); ?> {{data.suggestedWidth}} &times; {{data.suggestedHeight}}
242 242
 					</p>
243 243
 				<# } #>
244 244
 
245 245
 				<?php
246 246
 				/** This action is documented in wp-admin/includes/media.php */
247
-				do_action( 'post-upload-ui' ); ?>
247
+				do_action('post-upload-ui'); ?>
248 248
 			</div>
249 249
 		<?php endif; ?>
250 250
 		</div>
251 251
 	</script>
252 252
 
253 253
 	<script type="text/html" id="tmpl-media-library-view-switcher">
254
-		<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list">
255
-			<span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
254
+		<a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>" class="view-list">
255
+			<span class="screen-reader-text"><?php _e('List View'); ?></span>
256 256
 		</a>
257
-		<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current">
258
-			<span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
257
+		<a href="<?php echo esc_url(add_query_arg('mode', 'grid', $_SERVER['REQUEST_URI'])) ?>" class="view-grid current">
258
+			<span class="screen-reader-text"><?php _e('Grid View'); ?></span>
259 259
 		</a>
260 260
 	</script>
261 261
 
262 262
 	<script type="text/html" id="tmpl-uploader-status">
263
-		<h3><?php _e( 'Uploading' ); ?></h3>
264
-		<button type="button" class="button-link upload-dismiss-errors"><span class="screen-reader-text"><?php _e( 'Dismiss Errors' ); ?></span></button>
263
+		<h3><?php _e('Uploading'); ?></h3>
264
+		<button type="button" class="button-link upload-dismiss-errors"><span class="screen-reader-text"><?php _e('Dismiss Errors'); ?></span></button>
265 265
 
266 266
 		<div class="media-progress-bar"><div></div></div>
267 267
 		<div class="upload-details">
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 
282 282
 	<script type="text/html" id="tmpl-edit-attachment-frame">
283 283
 		<div class="edit-media-header">
284
-			<button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button>
285
-			<button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button>
284
+			<button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e('Edit previous media item'); ?></span></button>
285
+			<button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e('Edit next media item'); ?></span></button>
286 286
 		</div>
287 287
 		<div class="media-frame-title"></div>
288 288
 		<div class="media-frame-content"></div>
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
 				<div class="attachment-actions">
332 332
 					<# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #>
333
-					<button type="button" class="button edit-attachment"><?php _e( 'Edit Image' ); ?></button>
333
+					<button type="button" class="button edit-attachment"><?php _e('Edit Image'); ?></button>
334 334
 					<# } #>
335 335
 				</div>
336 336
 			</div>
@@ -341,24 +341,24 @@  discard block
 block discarded – undo
341 341
 				<span class="saved"><?php esc_html_e('Saved.'); ?></span>
342 342
 			</span>
343 343
 			<div class="details">
344
-				<div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div>
345
-				<div class="filename"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div>
346
-				<div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div>
344
+				<div class="filename"><strong><?php _e('File name:'); ?></strong> {{ data.filename }}</div>
345
+				<div class="filename"><strong><?php _e('File type:'); ?></strong> {{ data.mime }}</div>
346
+				<div class="uploaded"><strong><?php _e('Uploaded on:'); ?></strong> {{ data.dateFormatted }}</div>
347 347
 
348
-				<div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div>
348
+				<div class="file-size"><strong><?php _e('File size:'); ?></strong> {{ data.filesizeHumanReadable }}</div>
349 349
 				<# if ( 'image' === data.type && ! data.uploading ) { #>
350 350
 					<# if ( data.width && data.height ) { #>
351
-						<div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} &times; {{ data.height }}</div>
351
+						<div class="dimensions"><strong><?php _e('Dimensions:'); ?></strong> {{ data.width }} &times; {{ data.height }}</div>
352 352
 					<# } #>
353 353
 				<# } #>
354 354
 
355 355
 				<# if ( data.fileLength ) { #>
356
-					<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div>
356
+					<div class="file-length"><strong><?php _e('Length:'); ?></strong> {{ data.fileLength }}</div>
357 357
 				<# } #>
358 358
 
359 359
 				<# if ( 'audio' === data.type && data.meta.bitrate ) { #>
360 360
 					<div class="bitrate">
361
-						<strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
361
+						<strong><?php _e('Bitrate:'); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
362 362
 						<# if ( data.meta.bitrate_mode ) { #>
363 363
 						{{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
364 364
 						<# } #>
@@ -378,30 +378,30 @@  discard block
 block discarded – undo
378 378
 					<input type="text" value="{{ data.url }}" readonly />
379 379
 				</label>
380 380
 				<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
381
-				<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
381
+				<?php if (post_type_supports('attachment', 'title')) : ?>
382 382
 				<label class="setting" data-setting="title">
383 383
 					<span class="name"><?php _e('Title'); ?></span>
384 384
 					<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
385 385
 				</label>
386 386
 				<?php endif; ?>
387 387
 				<# if ( 'audio' === data.type ) { #>
388
-				<?php foreach ( array(
389
-					'artist' => __( 'Artist' ),
390
-					'album' => __( 'Album' ),
391
-				) as $key => $label ) : ?>
392
-				<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
388
+				<?php foreach (array(
389
+					'artist' => __('Artist'),
390
+					'album' => __('Album'),
391
+				) as $key => $label) : ?>
392
+				<label class="setting" data-setting="<?php echo esc_attr($key) ?>">
393 393
 					<span class="name"><?php echo $label ?></span>
394 394
 					<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
395 395
 				</label>
396 396
 				<?php endforeach; ?>
397 397
 				<# } #>
398 398
 				<label class="setting" data-setting="caption">
399
-					<span class="name"><?php _e( 'Caption' ); ?></span>
399
+					<span class="name"><?php _e('Caption'); ?></span>
400 400
 					<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
401 401
 				</label>
402 402
 				<# if ( 'image' === data.type ) { #>
403 403
 					<label class="setting" data-setting="alt">
404
-						<span class="name"><?php _e( 'Alt Text' ); ?></span>
404
+						<span class="name"><?php _e('Alt Text'); ?></span>
405 405
 						<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
406 406
 					</label>
407 407
 				<# } #>
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
 					<textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
411 411
 				</label>
412 412
 				<label class="setting">
413
-					<span class="name"><?php _e( 'Uploaded By' ); ?></span>
413
+					<span class="name"><?php _e('Uploaded By'); ?></span>
414 414
 					<span class="value">{{ data.authorName }}</span>
415 415
 				</label>
416 416
 				<# if ( data.uploadedToTitle ) { #>
417 417
 					<label class="setting">
418
-						<span class="name"><?php _e( 'Uploaded To' ); ?></span>
418
+						<span class="name"><?php _e('Uploaded To'); ?></span>
419 419
 						<# if ( data.uploadedToLink ) { #>
420 420
 							<span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
421 421
 						<# } else { #>
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
 			</div>
428 428
 
429 429
 			<div class="actions">
430
-				<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
430
+				<a class="view-attachment" href="{{ data.link }}"><?php _e('View attachment page'); ?></a>
431 431
 				<# if ( data.can.save ) { #> |
432
-					<a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
432
+					<a href="post.php?post={{ data.id }}&action=edit"><?php _e('Edit more details'); ?></a>
433 433
 				<# } #>
434 434
 				<# if ( ! data.uploading && data.can.remove ) { #> |
435
-					<?php if ( MEDIA_TRASH ): ?>
435
+					<?php if (MEDIA_TRASH): ?>
436 436
 						<# if ( 'trash' === data.status ) { #>
437
-							<button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
437
+							<button type="button" class="button-link untrash-attachment"><?php _e('Untrash'); ?></button>
438 438
 						<# } else { #>
439
-							<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
439
+							<button type="button" class="button-link trash-attachment"><?php _ex('Trash', 'verb'); ?></button>
440 440
 						<# } #>
441 441
 					<?php else: ?>
442
-						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
442
+						<button type="button" class="button-link delete-attachment"><?php _e('Delete Permanently'); ?></button>
443 443
 					<?php endif; ?>
444 444
 				<# } #>
445 445
 			</div>
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
 				<# } #>
471 471
 			</div>
472 472
 			<# if ( data.buttons.close ) { #>
473
-				<button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e( 'Remove' ); ?></span></button>
473
+				<button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e('Remove'); ?></span></button>
474 474
 			<# } #>
475 475
 		</div>
476 476
 		<# if ( data.buttons.check ) { #>
477
-			<button type="button" class="button-link check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e( 'Deselect' ); ?></span></button>
477
+			<button type="button" class="button-link check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e('Deselect'); ?></span></button>
478 478
 		<# } #>
479 479
 		<#
480 480
 		var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
@@ -525,23 +525,23 @@  discard block
 block discarded – undo
525 525
 					<# } #>
526 526
 
527 527
 					<# if ( data.can.save && data.sizes ) { #>
528
-						<a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
528
+						<a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e('Edit Image'); ?></a>
529 529
 					<# } #>
530 530
 				<# } #>
531 531
 
532 532
 				<# if ( data.fileLength ) { #>
533
-					<div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div>
533
+					<div class="file-length"><?php _e('Length:'); ?> {{ data.fileLength }}</div>
534 534
 				<# } #>
535 535
 
536 536
 				<# if ( ! data.uploading && data.can.remove ) { #>
537
-					<?php if ( MEDIA_TRASH ): ?>
537
+					<?php if (MEDIA_TRASH): ?>
538 538
 					<# if ( 'trash' === data.status ) { #>
539
-						<button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button>
539
+						<button type="button" class="button-link untrash-attachment"><?php _e('Untrash'); ?></button>
540 540
 					<# } else { #>
541
-						<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
541
+						<button type="button" class="button-link trash-attachment"><?php _ex('Trash', 'verb'); ?></button>
542 542
 					<# } #>
543 543
 					<?php else: ?>
544
-						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
544
+						<button type="button" class="button-link delete-attachment"><?php _e('Delete Permanently'); ?></button>
545 545
 					<?php endif; ?>
546 546
 				<# } #>
547 547
 
@@ -558,18 +558,18 @@  discard block
 block discarded – undo
558 558
 			<input type="text" value="{{ data.url }}" readonly />
559 559
 		</label>
560 560
 		<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
561
-		<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
561
+		<?php if (post_type_supports('attachment', 'title')) : ?>
562 562
 		<label class="setting" data-setting="title">
563 563
 			<span class="name"><?php _e('Title'); ?></span>
564 564
 			<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
565 565
 		</label>
566 566
 		<?php endif; ?>
567 567
 		<# if ( 'audio' === data.type ) { #>
568
-		<?php foreach ( array(
569
-			'artist' => __( 'Artist' ),
570
-			'album' => __( 'Album' ),
571
-		) as $key => $label ) : ?>
572
-		<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
568
+		<?php foreach (array(
569
+			'artist' => __('Artist'),
570
+			'album' => __('Album'),
571
+		) as $key => $label) : ?>
572
+		<label class="setting" data-setting="<?php echo esc_attr($key) ?>">
573 573
 			<span class="name"><?php echo $label ?></span>
574 574
 			<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
575 575
 		</label>
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		<div class="selection-info">
596 596
 			<span class="count"></span>
597 597
 			<# if ( data.editable ) { #>
598
-				<button type="button" class="button-link edit-selection"><?php _e( 'Edit Selection' ); ?></button>
598
+				<button type="button" class="button-link edit-selection"><?php _e('Edit Selection'); ?></button>
599 599
 			<# } #>
600 600
 			<# if ( data.clearable ) { #>
601
-				<button type="button" class="button-link clear-selection"><?php _e( 'Clear' ); ?></button>
601
+				<button type="button" class="button-link clear-selection"><?php _e('Clear'); ?></button>
602 602
 			<# } #>
603 603
 		</div>
604 604
 		<div class="selection-view"></div>
@@ -690,19 +690,19 @@  discard block
 block discarded – undo
690 690
 					<# } #>>
691 691
 					<?php
692 692
 					/** This filter is documented in wp-admin/includes/media.php */
693
-					$sizes = apply_filters( 'image_size_names_choose', array(
693
+					$sizes = apply_filters('image_size_names_choose', array(
694 694
 						'thumbnail' => __('Thumbnail'),
695 695
 						'medium'    => __('Medium'),
696 696
 						'large'     => __('Large'),
697 697
 						'full'      => __('Full Size'),
698
-					) );
698
+					));
699 699
 
700
-					foreach ( $sizes as $value => $name ) : ?>
700
+					foreach ($sizes as $value => $name) : ?>
701 701
 						<#
702
-						var size = data.sizes['<?php echo esc_js( $value ); ?>'];
702
+						var size = data.sizes['<?php echo esc_js($value); ?>'];
703 703
 						if ( size ) { #>
704
-							<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
705
-								<?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
704
+							<option value="<?php echo esc_attr($value); ?>" <?php selected($value, 'full'); ?>>
705
+								<?php echo esc_html($name); ?> &ndash; {{ size.width }} &times; {{ size.height }}
706 706
 							</option>
707 707
 						<# } #>
708 708
 					<?php endforeach; ?>
@@ -740,23 +740,23 @@  discard block
 block discarded – undo
740 740
 			<span><?php _e('Columns'); ?></span>
741 741
 			<select class="columns" name="columns"
742 742
 				data-setting="columns">
743
-				<?php for ( $i = 1; $i <= 9; $i++ ) : ?>
744
-					<option value="<?php echo esc_attr( $i ); ?>" <#
743
+				<?php for ($i = 1; $i <= 9; $i++) : ?>
744
+					<option value="<?php echo esc_attr($i); ?>" <#
745 745
 						if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
746 746
 					#>>
747
-						<?php echo esc_html( $i ); ?>
747
+						<?php echo esc_html($i); ?>
748 748
 					</option>
749 749
 				<?php endfor; ?>
750 750
 			</select>
751 751
 		</label>
752 752
 
753 753
 		<label class="setting">
754
-			<span><?php _e( 'Random Order' ); ?></span>
754
+			<span><?php _e('Random Order'); ?></span>
755 755
 			<input type="checkbox" data-setting="_orderbyRandom" />
756 756
 		</label>
757 757
 
758 758
 		<label class="setting size">
759
-			<span><?php _e( 'Size' ); ?></span>
759
+			<span><?php _e('Size'); ?></span>
760 760
 			<select class="size" name="size"
761 761
 				data-setting="size"
762 762
 				<# if ( data.userSettings ) { #>
@@ -765,16 +765,16 @@  discard block
 block discarded – undo
765 765
 				>
766 766
 				<?php
767 767
 				// This filter is documented in wp-admin/includes/media.php
768
-				$size_names = apply_filters( 'image_size_names_choose', array(
769
-					'thumbnail' => __( 'Thumbnail' ),
770
-					'medium'    => __( 'Medium' ),
771
-					'large'     => __( 'Large' ),
772
-					'full'      => __( 'Full Size' ),
773
-				) );
774
-
775
-				foreach ( $size_names as $size => $label ) : ?>
776
-					<option value="<?php echo esc_attr( $size ); ?>">
777
-						<?php echo esc_html( $label ); ?>
768
+				$size_names = apply_filters('image_size_names_choose', array(
769
+					'thumbnail' => __('Thumbnail'),
770
+					'medium'    => __('Medium'),
771
+					'large'     => __('Large'),
772
+					'full'      => __('Full Size'),
773
+				));
774
+
775
+				foreach ($size_names as $size => $label) : ?>
776
+					<option value="<?php echo esc_attr($size); ?>">
777
+						<?php echo esc_html($label); ?>
778 778
 					</option>
779 779
 				<?php endforeach; ?>
780 780
 			</select>
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 	</script>
783 783
 
784 784
 	<script type="text/html" id="tmpl-playlist-settings">
785
-		<h3><?php _e( 'Playlist Settings' ); ?></h3>
785
+		<h3><?php _e('Playlist Settings'); ?></h3>
786 786
 
787 787
 		<# var emptyModel = _.isEmpty( data.model ),
788 788
 			isVideo = 'video' === data.controller.get('library').props.get('type'); #>
@@ -792,9 +792,9 @@  discard block
 block discarded – undo
792 792
 				checked="checked"
793 793
 			<# } #> />
794 794
 			<# if ( isVideo ) { #>
795
-			<span><?php _e( 'Show Video List' ); ?></span>
795
+			<span><?php _e('Show Video List'); ?></span>
796 796
 			<# } else { #>
797
-			<span><?php _e( 'Show Tracklist' ); ?></span>
797
+			<span><?php _e('Show Tracklist'); ?></span>
798 798
 			<# } #>
799 799
 		</label>
800 800
 
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 			<input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #>
804 804
 				checked="checked"
805 805
 			<# } #> />
806
-			<span><?php _e( 'Show Artist Name in Tracklist' ); ?></span>
806
+			<span><?php _e('Show Artist Name in Tracklist'); ?></span>
807 807
 		</label>
808 808
 		<# } #>
809 809
 
@@ -811,13 +811,13 @@  discard block
 block discarded – undo
811 811
 			<input type="checkbox" data-setting="images" <# if ( emptyModel ) { #>
812 812
 				checked="checked"
813 813
 			<# } #> />
814
-			<span><?php _e( 'Show Images' ); ?></span>
814
+			<span><?php _e('Show Images'); ?></span>
815 815
 		</label>
816 816
 	</script>
817 817
 
818 818
 	<script type="text/html" id="tmpl-embed-link-settings">
819 819
 		<label class="setting link-text">
820
-			<span><?php _e( 'Link Text' ); ?></span>
820
+			<span><?php _e('Link Text'); ?></span>
821 821
 			<input type="text" class="alignment" data-setting="linkText" />
822 822
 		</label>
823 823
 		<div class="embed-container" style="display: none;">
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 
833 833
 		<?php
834 834
 		/** This filter is documented in wp-admin/includes/media.php */
835
-		if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
835
+		if ( ! apply_filters('disable_captions', '')) : ?>
836 836
 			<label class="setting caption">
837 837
 				<span><?php _e('Caption'); ?></span>
838 838
 				<textarea data-setting="caption" />
@@ -888,8 +888,8 @@  discard block
 block discarded – undo
888 888
 
889 889
 						<# if ( data.attachment && window.imageEdit ) { #>
890 890
 							<div class="actions">
891
-								<input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
892
-								<input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
891
+								<input type="button" class="edit-attachment button" value="<?php esc_attr_e('Edit Original'); ?>" />
892
+								<input type="button" class="replace-attachment button" value="<?php esc_attr_e('Replace'); ?>" />
893 893
 							</div>
894 894
 						<# } #>
895 895
 					</div>
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 				<div class="column-settings">
898 898
 					<?php
899 899
 					/** This filter is documented in wp-admin/includes/media.php */
900
-					if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
900
+					if ( ! apply_filters('disable_captions', '')) : ?>
901 901
 						<label class="setting caption">
902 902
 							<span><?php _e('Caption'); ?></span>
903 903
 							<textarea data-setting="caption">{{ data.model.caption }}</textarea>
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 						<input type="text" data-setting="alt" value="{{ data.model.alt }}" />
910 910
 					</label>
911 911
 
912
-					<h3><?php _e( 'Display Settings' ); ?></h3>
912
+					<h3><?php _e('Display Settings'); ?></h3>
913 913
 					<div class="setting align">
914 914
 						<span><?php _e('Align'); ?></span>
915 915
 						<div class="button-group button-large" data-setting="align">
@@ -939,30 +939,30 @@  discard block
 block discarded – undo
939 939
 									<# } #>>
940 940
 									<?php
941 941
 									/** This filter is documented in wp-admin/includes/media.php */
942
-									$sizes = apply_filters( 'image_size_names_choose', array(
942
+									$sizes = apply_filters('image_size_names_choose', array(
943 943
 										'thumbnail' => __('Thumbnail'),
944 944
 										'medium'    => __('Medium'),
945 945
 										'large'     => __('Large'),
946 946
 										'full'      => __('Full Size'),
947
-									) );
947
+									));
948 948
 
949
-									foreach ( $sizes as $value => $name ) : ?>
949
+									foreach ($sizes as $value => $name) : ?>
950 950
 										<#
951
-										var size = data.sizes['<?php echo esc_js( $value ); ?>'];
951
+										var size = data.sizes['<?php echo esc_js($value); ?>'];
952 952
 										if ( size ) { #>
953
-											<option value="<?php echo esc_attr( $value ); ?>">
954
-												<?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
953
+											<option value="<?php echo esc_attr($value); ?>">
954
+												<?php echo esc_html($name); ?> &ndash; {{ size.width }} &times; {{ size.height }}
955 955
 											</option>
956 956
 										<# } #>
957 957
 									<?php endforeach; ?>
958
-									<option value="<?php echo esc_attr( 'custom' ); ?>">
959
-										<?php _e( 'Custom Size' ); ?>
958
+									<option value="<?php echo esc_attr('custom'); ?>">
959
+										<?php _e('Custom Size'); ?>
960 960
 									</option>
961 961
 								</select>
962 962
 							</label>
963 963
 						<# } #>
964 964
 							<div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
965
-								<label><span><?php _e( 'Width' ); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">&times;</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label>
965
+								<label><span><?php _e('Width'); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">&times;</span><label><span><?php _e('Height'); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label>
966 966
 							</div>
967 967
 					<# } #>
968 968
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 						<input type="text" class="link-to-custom" data-setting="linkUrl" />
992 992
 					</div>
993 993
 					<div class="advanced-section">
994
-						<h3><button type="button" class="button-link advanced-toggle"><?php _e( 'Advanced Options' ); ?></button></h3>
994
+						<h3><button type="button" class="button-link advanced-toggle"><?php _e('Advanced Options'); ?></button></h3>
995 995
 						<div class="advanced-settings hidden">
996 996
 							<div class="advanced-image">
997 997
 								<label class="setting title-text">
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 							</div>
1006 1006
 							<div class="advanced-link">
1007 1007
 								<div class="setting link-target">
1008
-									<label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new window/tab' ); ?></label>
1008
+									<label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e('Open link in a new window/tab'); ?></label>
1009 1009
 								</div>
1010 1010
 								<label class="setting link-rel">
1011 1011
 									<span><?php _e('Link Rel'); ?></span>
@@ -1048,28 +1048,28 @@  discard block
 block discarded – undo
1048 1048
 				<label class="setting">
1049 1049
 					<span>SRC</span>
1050 1050
 					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
1051
-					<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
1051
+					<button type="button" class="button-link remove-setting"><?php _e('Remove audio source'); ?></button>
1052 1052
 				</label>
1053 1053
 				<# } #>
1054 1054
 				<?php
1055 1055
 
1056
-				foreach ( $audio_types as $type ):
1056
+				foreach ($audio_types as $type):
1057 1057
 				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
1058 1058
 					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
1059 1059
 						delete html5types.<?php echo $type ?>;
1060 1060
 					}
1061 1061
 				#>
1062 1062
 				<label class="setting">
1063
-					<span><?php echo strtoupper( $type ) ?></span>
1063
+					<span><?php echo strtoupper($type) ?></span>
1064 1064
 					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
1065
-					<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
1065
+					<button type="button" class="button-link remove-setting"><?php _e('Remove audio source'); ?></button>
1066 1066
 				</label>
1067 1067
 				<# } #>
1068 1068
 				<?php endforeach ?>
1069 1069
 
1070 1070
 				<# if ( ! _.isEmpty( html5types ) ) { #>
1071 1071
 				<div class="setting">
1072
-					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span>
1072
+					<span><?php _e('Add alternate sources for maximum HTML5 playback:') ?></span>
1073 1073
 					<div class="button-large">
1074 1074
 					<# _.each( html5types, function (mime, type) { #>
1075 1075
 					<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
@@ -1079,22 +1079,22 @@  discard block
 block discarded – undo
1079 1079
 				<# } #>
1080 1080
 
1081 1081
 				<div class="setting preload">
1082
-					<span><?php _e( 'Preload' ); ?></span>
1082
+					<span><?php _e('Preload'); ?></span>
1083 1083
 					<div class="button-group button-large" data-setting="preload">
1084
-						<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1085
-						<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1086
-						<button class="button active" value="none"><?php _e( 'None' ); ?></button>
1084
+						<button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?></button>
1085
+						<button class="button" value="metadata"><?php _e('Metadata'); ?></button>
1086
+						<button class="button active" value="none"><?php _e('None'); ?></button>
1087 1087
 					</div>
1088 1088
 				</div>
1089 1089
 
1090 1090
 				<label class="setting checkbox-setting">
1091 1091
 					<input type="checkbox" data-setting="autoplay" />
1092
-					<span><?php _e( 'Autoplay' ); ?></span>
1092
+					<span><?php _e('Autoplay'); ?></span>
1093 1093
 				</label>
1094 1094
 
1095 1095
 				<label class="setting checkbox-setting">
1096 1096
 					<input type="checkbox" data-setting="loop" />
1097
-					<span><?php _e( 'Loop' ); ?></span>
1097
+					<span><?php _e('Loop'); ?></span>
1098 1098
 				</label>
1099 1099
 			</div>
1100 1100
 		</div>
@@ -1131,19 +1131,19 @@  discard block
 block discarded – undo
1131 1131
 				<label class="setting">
1132 1132
 					<span>SRC</span>
1133 1133
 					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
1134
-					<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
1134
+					<button type="button" class="button-link remove-setting"><?php _e('Remove video source'); ?></button>
1135 1135
 				</label>
1136 1136
 				<# } #>
1137
-				<?php foreach ( $video_types as $type ):
1137
+				<?php foreach ($video_types as $type):
1138 1138
 				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
1139 1139
 					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
1140 1140
 						delete html5types.<?php echo $type ?>;
1141 1141
 					}
1142 1142
 				#>
1143 1143
 				<label class="setting">
1144
-					<span><?php echo strtoupper( $type ) ?></span>
1144
+					<span><?php echo strtoupper($type) ?></span>
1145 1145
 					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
1146
-					<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
1146
+					<button type="button" class="button-link remove-setting"><?php _e('Remove video source'); ?></button>
1147 1147
 				</label>
1148 1148
 				<# } #>
1149 1149
 				<?php endforeach ?>
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
 				<# if ( ! _.isEmpty( html5types ) ) { #>
1153 1153
 				<div class="setting">
1154
-					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span>
1154
+					<span><?php _e('Add alternate sources for maximum HTML5 playback:'); ?></span>
1155 1155
 					<div class="button-large">
1156 1156
 					<# _.each( html5types, function (mime, type) { #>
1157 1157
 					<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
@@ -1162,32 +1162,32 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
 				<# if ( ! _.isEmpty( data.model.poster ) ) { #>
1164 1164
 				<label class="setting">
1165
-					<span><?php _e( 'Poster Image' ); ?></span>
1165
+					<span><?php _e('Poster Image'); ?></span>
1166 1166
 					<input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
1167
-					<button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button>
1167
+					<button type="button" class="button-link remove-setting"><?php _e('Remove poster image'); ?></button>
1168 1168
 				</label>
1169 1169
 				<# } #>
1170 1170
 				<div class="setting preload">
1171
-					<span><?php _e( 'Preload' ); ?></span>
1171
+					<span><?php _e('Preload'); ?></span>
1172 1172
 					<div class="button-group button-large" data-setting="preload">
1173
-						<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
1174
-						<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
1175
-						<button class="button active" value="none"><?php _e( 'None' ); ?></button>
1173
+						<button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?></button>
1174
+						<button class="button" value="metadata"><?php _e('Metadata'); ?></button>
1175
+						<button class="button active" value="none"><?php _e('None'); ?></button>
1176 1176
 					</div>
1177 1177
 				</div>
1178 1178
 
1179 1179
 				<label class="setting checkbox-setting">
1180 1180
 					<input type="checkbox" data-setting="autoplay" />
1181
-					<span><?php _e( 'Autoplay' ); ?></span>
1181
+					<span><?php _e('Autoplay'); ?></span>
1182 1182
 				</label>
1183 1183
 
1184 1184
 				<label class="setting checkbox-setting">
1185 1185
 					<input type="checkbox" data-setting="loop" />
1186
-					<span><?php _e( 'Loop' ); ?></span>
1186
+					<span><?php _e('Loop'); ?></span>
1187 1187
 				</label>
1188 1188
 
1189 1189
 				<label class="setting" data-setting="content">
1190
-					<span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
1190
+					<span><?php _e('Tracks (subtitles, captions, descriptions, chapters, or metadata)'); ?></span>
1191 1191
 					<#
1192 1192
 					var content = '';
1193 1193
 					if ( ! _.isEmpty( data.model.content ) ) {
@@ -1196,11 +1196,11 @@  discard block
 block discarded – undo
1196 1196
 							content += track.outerHTML; #>
1197 1197
 						<p>
1198 1198
 							<input class="content-track" type="text" value="{{ track.outerHTML }}" />
1199
-							<button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button>
1199
+							<button type="button" class="button-link remove-setting remove-track"><?php _ex('Remove video track', 'media'); ?></button>
1200 1200
 						</p>
1201 1201
 						<# } ); #>
1202 1202
 					<# } else { #>
1203
-					<em><?php _e( 'There are no associated subtitles.' ); ?></em>
1203
+					<em><?php _e('There are no associated subtitles.'); ?></em>
1204 1204
 					<# } #>
1205 1205
 					<textarea class="hidden content-setting">{{ content }}</textarea>
1206 1206
 				</label>
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 			</div>
1234 1234
 		<# } else { #>
1235 1235
 			<div class="wpview-error">
1236
-				<div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
1236
+				<div class="dashicons dashicons-format-gallery"></div><p><?php _e('No items found.'); ?></p>
1237 1237
 			</div>
1238 1238
 		<# } #>
1239 1239
 	</script>
@@ -1244,20 +1244,20 @@  discard block
 block discarded – undo
1244 1244
 	</script>
1245 1245
 
1246 1246
 	<script type="text/html" id="tmpl-site-icon-preview">
1247
-		<h2><?php _e( 'Preview' ); ?></h2>
1248
-		<strong><?php _e( 'As a browser icon' ); ?></strong>
1247
+		<h2><?php _e('Preview'); ?></h2>
1248
+		<strong><?php _e('As a browser icon'); ?></strong>
1249 1249
 		<div class="favicon-preview">
1250 1250
 			<img src="images/browser.png" class="browser-preview" width="182" height="" alt=""/>
1251 1251
 
1252 1252
 			<div class="favicon">
1253
-				<img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
1253
+				<img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e('Preview as a browser icon'); ?>"/>
1254 1254
 			</div>
1255
-			<span class="browser-title"><?php bloginfo( 'name' ); ?></span>
1255
+			<span class="browser-title"><?php bloginfo('name'); ?></span>
1256 1256
 		</div>
1257 1257
 
1258
-		<strong><?php _e( 'As an app icon' ); ?></strong>
1258
+		<strong><?php _e('As an app icon'); ?></strong>
1259 1259
 		<div class="app-icon-preview">
1260
-			<img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
1260
+			<img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e('Preview as an app icon'); ?>"/>
1261 1261
 		</div>
1262 1262
 	</script>
1263 1263
 
@@ -1268,5 +1268,5 @@  discard block
 block discarded – undo
1268 1268
 	 *
1269 1269
 	 * @since 3.5.0
1270 1270
 	 */
1271
-	do_action( 'print_media_templates' );
1271
+	do_action('print_media_templates');
1272 1272
 }
Please login to merge, or discard this patch.
Braces   +18 added lines, -8 removed lines patch added patch discarded remove patch
@@ -142,8 +142,9 @@  discard block
 block discarded – undo
142 142
 function wp_print_media_templates() {
143 143
 	global $is_IE;
144 144
 	$class = 'media-modal wp-core-ui';
145
-	if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
146
-		$class .= ' ie7';
145
+	if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false ) {
146
+			$class .= ' ie7';
147
+	}
147 148
 	?>
148 149
 	<!--[if lte IE 8]>
149 150
 	<style>
@@ -201,9 +202,12 @@  discard block
 block discarded – undo
201 202
 			/** This action is documented in wp-admin/includes/media.php */
202 203
 			do_action( 'upload_ui_over_quota' ); ?>
203 204
 
204
-		<?php else : ?>
205
+		<?php else {
206
+	: ?>
205 207
 			<div class="upload-ui">
206
-				<h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
208
+				<h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' );
209
+}
210
+?></h3>
207 211
 				<p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
208 212
 				<button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button>
209 213
 			</div>
@@ -438,8 +442,11 @@  discard block
 block discarded – undo
438 442
 						<# } else { #>
439 443
 							<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
440 444
 						<# } #>
441
-					<?php else: ?>
442
-						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
445
+					<?php else {
446
+	: ?>
447
+						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' );
448
+}
449
+?></button>
443 450
 					<?php endif; ?>
444 451
 				<# } #>
445 452
 			</div>
@@ -540,8 +547,11 @@  discard block
 block discarded – undo
540 547
 					<# } else { #>
541 548
 						<button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button>
542 549
 					<# } #>
543
-					<?php else: ?>
544
-						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button>
550
+					<?php else {
551
+	: ?>
552
+						<button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' );
553
+}
554
+?></button>
545 555
 					<?php endif; ?>
546 556
 				<# } #>
547 557
 
Please login to merge, or discard this patch.
src/wp-includes/class-oembed.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * API for fetching the HTML to embed remote content based on a provided URL.
4
- * Used internally by the {@link WP_Embed} class, but is designed to be generic.
5
- *
6
- * @link https://codex.wordpress.org/oEmbed oEmbed Codex Article
7
- * @link http://oembed.com/ oEmbed Homepage
8
- *
9
- * @package WordPress
10
- * @subpackage oEmbed
11
- */
3
+	 * API for fetching the HTML to embed remote content based on a provided URL.
4
+	 * Used internally by the {@link WP_Embed} class, but is designed to be generic.
5
+	 *
6
+	 * @link https://codex.wordpress.org/oEmbed oEmbed Codex Article
7
+	 * @link http://oembed.com/ oEmbed Homepage
8
+	 *
9
+	 * @package WordPress
10
+	 * @subpackage oEmbed
11
+	 */
12 12
 
13 13
 /**
14 14
  * oEmbed class.
Please login to merge, or discard this patch.
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public static $early_providers = array();
27 27
 
28
-	private $compat_methods = array( '_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body' );
28
+	private $compat_methods = array('_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body');
29 29
 
30 30
 	/**
31 31
 	 * Constructor
@@ -34,57 +34,57 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct() {
36 36
 		$providers = array(
37
-			'#http://((m|www)\.)?youtube\.com/watch.*#i'          => array( 'http://www.youtube.com/oembed',                      true  ),
38
-			'#https://((m|www)\.)?youtube\.com/watch.*#i'         => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
39
-			'#http://((m|www)\.)?youtube\.com/playlist.*#i'       => array( 'http://www.youtube.com/oembed',                      true  ),
40
-			'#https://((m|www)\.)?youtube\.com/playlist.*#i'      => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
41
-			'#http://youtu\.be/.*#i'                              => array( 'http://www.youtube.com/oembed',                      true  ),
42
-			'#https://youtu\.be/.*#i'                             => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
43
-			'http://blip.tv/*'                                    => array( 'http://blip.tv/oembed/',                             false ),
44
-			'#https?://(.+\.)?vimeo\.com/.*#i'                    => array( 'http://vimeo.com/api/oembed.{format}',               true  ),
45
-			'#https?://(www\.)?dailymotion\.com/.*#i'             => array( 'http://www.dailymotion.com/services/oembed',         true  ),
46
-			'http://dai.ly/*'                                     => array( 'http://www.dailymotion.com/services/oembed',         false ),
47
-			'#https?://(www\.)?flickr\.com/.*#i'                  => array( 'https://www.flickr.com/services/oembed/',            true  ),
48
-			'#https?://flic\.kr/.*#i'                             => array( 'https://www.flickr.com/services/oembed/',            true  ),
49
-			'#https?://(.+\.)?smugmug\.com/.*#i'                  => array( 'http://api.smugmug.com/services/oembed/',            true  ),
50
-			'#https?://(www\.)?hulu\.com/watch/.*#i'              => array( 'http://www.hulu.com/api/oembed.{format}',            true  ),
51
-			'http://i*.photobucket.com/albums/*'                  => array( 'http://photobucket.com/oembed',                      false ),
52
-			'http://gi*.photobucket.com/groups/*'                 => array( 'http://photobucket.com/oembed',                      false ),
53
-			'#https?://(www\.)?scribd\.com/doc/.*#i'              => array( 'http://www.scribd.com/services/oembed',              true  ),
54
-			'#https?://wordpress.tv/.*#i'                         => array( 'http://wordpress.tv/oembed/',                        true  ),
55
-			'#https?://(.+\.)?polldaddy\.com/.*#i'                => array( 'https://polldaddy.com/oembed/',                      true  ),
56
-			'#https?://poll\.fm/.*#i'                             => array( 'https://polldaddy.com/oembed/',                      true  ),
57
-			'#https?://(www\.)?funnyordie\.com/videos/.*#i'       => array( 'http://www.funnyordie.com/oembed',                   true  ),
58
-			'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array( 'https://api.twitter.com/1/statuses/oembed.{format}', true  ),
59
-			'#https?://vine.co/v/.*#i'                            => array( 'https://vine.co/oembed.{format}',                    true  ),
60
- 			'#https?://(www\.)?soundcloud\.com/.*#i'              => array( 'http://soundcloud.com/oembed',                       true  ),
61
-			'#https?://(.+?\.)?slideshare\.net/.*#i'              => array( 'https://www.slideshare.net/api/oembed/2',            true  ),
62
-			'#https?://instagr(\.am|am\.com)/p/.*#i'              => array( 'https://api.instagram.com/oembed',                   true  ),
63
-			'#https?://(www\.)?rdio\.com/.*#i'                    => array( 'http://www.rdio.com/api/oembed/',                    true  ),
64
-			'#https?://rd\.io/x/.*#i'                             => array( 'http://www.rdio.com/api/oembed/',                    true  ),
65
-			'#https?://(open|play)\.spotify\.com/.*#i'            => array( 'https://embed.spotify.com/oembed/',                  true  ),
66
-			'#https?://(.+\.)?imgur\.com/.*#i'                    => array( 'http://api.imgur.com/oembed',                        true  ),
67
-			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'           => array( 'http://api.meetup.com/oembed',                       true  ),
68
-			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'           => array( 'http://issuu.com/oembed_wp',                         true  ),
69
-			'#https?://(www\.)?collegehumor\.com/video/.*#i'      => array( 'http://www.collegehumor.com/oembed.{format}',        true  ),
70
-			'#https?://(www\.)?mixcloud\.com/.*#i'                => array( 'http://www.mixcloud.com/oembed',                     true  ),
71
-			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'       => array( 'http://www.ted.com/talks/oembed.{format}',           true  ),
72
-			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'http://animoto.com/oembeds/create',                  true  ),
73
-			'#https?://(.+)\.tumblr\.com/post/.*#i'               => array( 'https://www.tumblr.com/oembed/1.0',                  true  ),
74
-			'#https?://(www\.)?kickstarter\.com/projects/.*#i'    => array( 'https://www.kickstarter.com/services/oembed',        true  ),
75
-			'#https?://kck\.st/.*#i'                              => array( 'https://www.kickstarter.com/services/oembed',        true  ),
76
-			'#https?://cloudup\.com/.*#i'                         => array( 'https://cloudup.com/oembed', true ),
37
+			'#http://((m|www)\.)?youtube\.com/watch.*#i'          => array('http://www.youtube.com/oembed', true),
38
+			'#https://((m|www)\.)?youtube\.com/watch.*#i'         => array('http://www.youtube.com/oembed?scheme=https', true),
39
+			'#http://((m|www)\.)?youtube\.com/playlist.*#i'       => array('http://www.youtube.com/oembed', true),
40
+			'#https://((m|www)\.)?youtube\.com/playlist.*#i'      => array('http://www.youtube.com/oembed?scheme=https', true),
41
+			'#http://youtu\.be/.*#i'                              => array('http://www.youtube.com/oembed', true),
42
+			'#https://youtu\.be/.*#i'                             => array('http://www.youtube.com/oembed?scheme=https', true),
43
+			'http://blip.tv/*'                                    => array('http://blip.tv/oembed/', false),
44
+			'#https?://(.+\.)?vimeo\.com/.*#i'                    => array('http://vimeo.com/api/oembed.{format}', true),
45
+			'#https?://(www\.)?dailymotion\.com/.*#i'             => array('http://www.dailymotion.com/services/oembed', true),
46
+			'http://dai.ly/*'                                     => array('http://www.dailymotion.com/services/oembed', false),
47
+			'#https?://(www\.)?flickr\.com/.*#i'                  => array('https://www.flickr.com/services/oembed/', true),
48
+			'#https?://flic\.kr/.*#i'                             => array('https://www.flickr.com/services/oembed/', true),
49
+			'#https?://(.+\.)?smugmug\.com/.*#i'                  => array('http://api.smugmug.com/services/oembed/', true),
50
+			'#https?://(www\.)?hulu\.com/watch/.*#i'              => array('http://www.hulu.com/api/oembed.{format}', true),
51
+			'http://i*.photobucket.com/albums/*'                  => array('http://photobucket.com/oembed', false),
52
+			'http://gi*.photobucket.com/groups/*'                 => array('http://photobucket.com/oembed', false),
53
+			'#https?://(www\.)?scribd\.com/doc/.*#i'              => array('http://www.scribd.com/services/oembed', true),
54
+			'#https?://wordpress.tv/.*#i'                         => array('http://wordpress.tv/oembed/', true),
55
+			'#https?://(.+\.)?polldaddy\.com/.*#i'                => array('https://polldaddy.com/oembed/', true),
56
+			'#https?://poll\.fm/.*#i'                             => array('https://polldaddy.com/oembed/', true),
57
+			'#https?://(www\.)?funnyordie\.com/videos/.*#i'       => array('http://www.funnyordie.com/oembed', true),
58
+			'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array('https://api.twitter.com/1/statuses/oembed.{format}', true),
59
+			'#https?://vine.co/v/.*#i'                            => array('https://vine.co/oembed.{format}', true),
60
+ 			'#https?://(www\.)?soundcloud\.com/.*#i'              => array('http://soundcloud.com/oembed', true),
61
+			'#https?://(.+?\.)?slideshare\.net/.*#i'              => array('https://www.slideshare.net/api/oembed/2', true),
62
+			'#https?://instagr(\.am|am\.com)/p/.*#i'              => array('https://api.instagram.com/oembed', true),
63
+			'#https?://(www\.)?rdio\.com/.*#i'                    => array('http://www.rdio.com/api/oembed/', true),
64
+			'#https?://rd\.io/x/.*#i'                             => array('http://www.rdio.com/api/oembed/', true),
65
+			'#https?://(open|play)\.spotify\.com/.*#i'            => array('https://embed.spotify.com/oembed/', true),
66
+			'#https?://(.+\.)?imgur\.com/.*#i'                    => array('http://api.imgur.com/oembed', true),
67
+			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'           => array('http://api.meetup.com/oembed', true),
68
+			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'           => array('http://issuu.com/oembed_wp', true),
69
+			'#https?://(www\.)?collegehumor\.com/video/.*#i'      => array('http://www.collegehumor.com/oembed.{format}', true),
70
+			'#https?://(www\.)?mixcloud\.com/.*#i'                => array('http://www.mixcloud.com/oembed', true),
71
+			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'       => array('http://www.ted.com/talks/oembed.{format}', true),
72
+			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array('http://animoto.com/oembeds/create', true),
73
+			'#https?://(.+)\.tumblr\.com/post/.*#i'               => array('https://www.tumblr.com/oembed/1.0', true),
74
+			'#https?://(www\.)?kickstarter\.com/projects/.*#i'    => array('https://www.kickstarter.com/services/oembed', true),
75
+			'#https?://kck\.st/.*#i'                              => array('https://www.kickstarter.com/services/oembed', true),
76
+			'#https?://cloudup\.com/.*#i'                         => array('https://cloudup.com/oembed', true),
77 77
 		);
78 78
 
79
-		if ( ! empty( self::$early_providers['add'] ) ) {
80
-			foreach ( self::$early_providers['add'] as $format => $data ) {
81
-				$providers[ $format ] = $data;
79
+		if ( ! empty(self::$early_providers['add'])) {
80
+			foreach (self::$early_providers['add'] as $format => $data) {
81
+				$providers[$format] = $data;
82 82
 			}
83 83
 		}
84 84
 
85
-		if ( ! empty( self::$early_providers['remove'] ) ) {
86
-			foreach ( self::$early_providers['remove'] as $format ) {
87
-				unset( $providers[ $format ] );
85
+		if ( ! empty(self::$early_providers['remove'])) {
86
+			foreach (self::$early_providers['remove'] as $format) {
87
+				unset($providers[$format]);
88 88
 			}
89 89
 		}
90 90
 
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 		 *
168 168
 		 * @param array $providers An array of popular oEmbed providers.
169 169
 		 */
170
-		$this->providers = apply_filters( 'oembed_providers', $providers );
170
+		$this->providers = apply_filters('oembed_providers', $providers);
171 171
 
172 172
 		// Fix any embeds that contain new lines in the middle of the HTML which breaks wpautop().
173
-		add_filter( 'oembed_dataparse', array($this, '_strip_newlines'), 10, 3 );
173
+		add_filter('oembed_dataparse', array($this, '_strip_newlines'), 10, 3);
174 174
 	}
175 175
 
176 176
 	/**
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @param array    $arguments Arguments to pass when calling.
184 184
 	 * @return mixed|bool Return value of the callback, false otherwise.
185 185
 	 */
186
-	public function __call( $name, $arguments ) {
187
-		if ( in_array( $name, $this->compat_methods ) ) {
188
-			return call_user_func_array( array( $this, $name ), $arguments );
186
+	public function __call($name, $arguments) {
187
+		if (in_array($name, $this->compat_methods)) {
188
+			return call_user_func_array(array($this, $name), $arguments);
189 189
 		}
190 190
 		return false;
191 191
 	}
@@ -202,30 +202,30 @@  discard block
 block discarded – undo
202 202
 	 * @param string|array  $args Optional provider arguments.
203 203
 	 * @return false|string False on failure, otherwise the oEmbed provider URL.
204 204
 	 */
205
-	public function get_provider( $url, $args = '' ) {
205
+	public function get_provider($url, $args = '') {
206 206
 
207 207
 		$provider = false;
208 208
 
209
-		if ( !isset($args['discover']) )
209
+		if ( ! isset($args['discover']))
210 210
 			$args['discover'] = true;
211 211
 
212
-		foreach ( $this->providers as $matchmask => $data ) {
213
-			list( $providerurl, $regex ) = $data;
212
+		foreach ($this->providers as $matchmask => $data) {
213
+			list($providerurl, $regex) = $data;
214 214
 
215 215
 			// Turn the asterisk-type provider URLs into regex
216
-			if ( !$regex ) {
217
-				$matchmask = '#' . str_replace( '___wildcard___', '(.+)', preg_quote( str_replace( '*', '___wildcard___', $matchmask ), '#' ) ) . '#i';
218
-				$matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask );
216
+			if ( ! $regex) {
217
+				$matchmask = '#'.str_replace('___wildcard___', '(.+)', preg_quote(str_replace('*', '___wildcard___', $matchmask), '#')).'#i';
218
+				$matchmask = preg_replace('|^#http\\\://|', '#https?\://', $matchmask);
219 219
 			}
220 220
 
221
-			if ( preg_match( $matchmask, $url ) ) {
222
-				$provider = str_replace( '{format}', 'json', $providerurl ); // JSON is easier to deal with than XML
221
+			if (preg_match($matchmask, $url)) {
222
+				$provider = str_replace('{format}', 'json', $providerurl); // JSON is easier to deal with than XML
223 223
 				break;
224 224
 			}
225 225
 		}
226 226
 
227
-		if ( !$provider && $args['discover'] )
228
-			$provider = $this->discover( $url );
227
+		if ( ! $provider && $args['discover'])
228
+			$provider = $this->discover($url);
229 229
 
230 230
 		return $provider;
231 231
 	}
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 	 * @param bool   $regex    Optional. Whether the $format parameter is in a regex format.
249 249
 	 *                         Default false.
250 250
 	 */
251
-	public static function _add_provider_early( $format, $provider, $regex = false ) {
252
-		if ( empty( self::$early_providers['add'] ) ) {
251
+	public static function _add_provider_early($format, $provider, $regex = false) {
252
+		if (empty(self::$early_providers['add'])) {
253 253
 			self::$early_providers['add'] = array();
254 254
 		}
255 255
 
256
-		self::$early_providers['add'][ $format ] = array( $provider, $regex );
256
+		self::$early_providers['add'][$format] = array($provider, $regex);
257 257
 	}
258 258
 
259 259
 	/**
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	 * @param string $format The format of URL that this provider can handle. You can use
272 272
 	 *                       asterisks as wildcards.
273 273
 	 */
274
-	public static function _remove_provider_early( $format ) {
275
-		if ( empty( self::$early_providers['remove'] ) ) {
274
+	public static function _remove_provider_early($format) {
275
+		if (empty(self::$early_providers['remove'])) {
276 276
 			self::$early_providers['remove'] = array();
277 277
 		}
278 278
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @param array $args Optional arguments. Usually passed from a shortcode.
290 290
 	 * @return false|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
291 291
 	 */
292
-	public function get_html( $url, $args = '' ) {
293
-		$provider = $this->get_provider( $url, $args );
292
+	public function get_html($url, $args = '') {
293
+		$provider = $this->get_provider($url, $args);
294 294
 
295
-		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
295
+		if ( ! $provider || false === $data = $this->fetch($provider, $url, $args))
296 296
 			return false;
297 297
 
298 298
 		/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		 * @param string $url  URL of the content to be embedded.
305 305
 		 * @param array  $args Optional arguments, usually passed from a shortcode.
306 306
 		 */
307
-		return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
307
+		return apply_filters('oembed_result', $this->data2html($data, $url), $url, $args);
308 308
 	}
309 309
 
310 310
 	/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param string $url The URL that should be inspected for discovery `<link>` tags.
314 314
 	 * @return false|string False on failure, otherwise the oEmbed provider URL.
315 315
 	 */
316
-	public function discover( $url ) {
316
+	public function discover($url) {
317 317
 		$providers = array();
318 318
 
319 319
 		/**
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 		 * @param array  $args oEmbed remote get arguments.
327 327
 		 * @param string $url  URL to be inspected.
328 328
 		 */
329
-		$args = apply_filters( 'oembed_remote_get_args', array(), $url );
329
+		$args = apply_filters('oembed_remote_get_args', array(), $url);
330 330
 
331 331
 		// Fetch URL content
332
-		$request = wp_safe_remote_get( $url, $args );
333
-		if ( $html = wp_remote_retrieve_body( $request ) ) {
332
+		$request = wp_safe_remote_get($url, $args);
333
+		if ($html = wp_remote_retrieve_body($request)) {
334 334
 
335 335
 			/**
336 336
 			 * Filter the link types that contain oEmbed provider URLs.
@@ -341,33 +341,33 @@  discard block
 block discarded – undo
341 341
 			 *                      'text/xml+oembed', and 'application/xml+oembed' (incorrect,
342 342
 			 *                      used by at least Vimeo).
343 343
 			 */
344
-			$linktypes = apply_filters( 'oembed_linktypes', array(
344
+			$linktypes = apply_filters('oembed_linktypes', array(
345 345
 				'application/json+oembed' => 'json',
346 346
 				'text/xml+oembed' => 'xml',
347 347
 				'application/xml+oembed' => 'xml',
348
-			) );
348
+			));
349 349
 
350 350
 			// Strip <body>
351
-			$html = substr( $html, 0, stripos( $html, '</head>' ) );
351
+			$html = substr($html, 0, stripos($html, '</head>'));
352 352
 
353 353
 			// Do a quick check
354 354
 			$tagfound = false;
355
-			foreach ( $linktypes as $linktype => $format ) {
356
-				if ( stripos($html, $linktype) ) {
355
+			foreach ($linktypes as $linktype => $format) {
356
+				if (stripos($html, $linktype)) {
357 357
 					$tagfound = true;
358 358
 					break;
359 359
 				}
360 360
 			}
361 361
 
362
-			if ( $tagfound && preg_match_all( '#<link([^<>]+)/?>#iU', $html, $links ) ) {
363
-				foreach ( $links[1] as $link ) {
364
-					$atts = shortcode_parse_atts( $link );
362
+			if ($tagfound && preg_match_all('#<link([^<>]+)/?>#iU', $html, $links)) {
363
+				foreach ($links[1] as $link) {
364
+					$atts = shortcode_parse_atts($link);
365 365
 
366
-					if ( !empty($atts['type']) && !empty($linktypes[$atts['type']]) && !empty($atts['href']) ) {
367
-						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode( $atts['href'] );
366
+					if ( ! empty($atts['type']) && ! empty($linktypes[$atts['type']]) && ! empty($atts['href'])) {
367
+						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode($atts['href']);
368 368
 
369 369
 						// Stop here if it's JSON (that's all we need)
370
-						if ( 'json' == $linktypes[$atts['type']] )
370
+						if ('json' == $linktypes[$atts['type']])
371 371
 							break;
372 372
 					}
373 373
 				}
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 		}
376 376
 
377 377
 		// JSON is preferred to XML
378
-		if ( !empty($providers['json']) )
378
+		if ( ! empty($providers['json']))
379 379
 			return $providers['json'];
380
-		elseif ( !empty($providers['xml']) )
380
+		elseif ( ! empty($providers['xml']))
381 381
 			return $providers['xml'];
382 382
 		else
383 383
 			return false;
@@ -391,12 +391,12 @@  discard block
 block discarded – undo
391 391
 	 * @param array $args Optional arguments. Usually passed from a shortcode.
392 392
 	 * @return false|object False on failure, otherwise the result in the form of an object.
393 393
 	 */
394
-	public function fetch( $provider, $url, $args = '' ) {
395
-		$args = wp_parse_args( $args, wp_embed_defaults( $url ) );
394
+	public function fetch($provider, $url, $args = '') {
395
+		$args = wp_parse_args($args, wp_embed_defaults($url));
396 396
 
397
-		$provider = add_query_arg( 'maxwidth', (int) $args['width'], $provider );
398
-		$provider = add_query_arg( 'maxheight', (int) $args['height'], $provider );
399
-		$provider = add_query_arg( 'url', urlencode($url), $provider );
397
+		$provider = add_query_arg('maxwidth', (int) $args['width'], $provider);
398
+		$provider = add_query_arg('maxheight', (int) $args['height'], $provider);
399
+		$provider = add_query_arg('url', urlencode($url), $provider);
400 400
 
401 401
 		/**
402 402
 		 * Filter the oEmbed URL to be fetched.
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
 		 * @param string $url      URL of the content to be embedded.
408 408
 		 * @param array  $args     Optional arguments, usually passed from a shortcode.
409 409
 		 */
410
-		$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
410
+		$provider = apply_filters('oembed_fetch_url', $provider, $url, $args);
411 411
 
412
-		foreach( array( 'json', 'xml' ) as $format ) {
413
-			$result = $this->_fetch_with_format( $provider, $format );
414
-			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
412
+		foreach (array('json', 'xml') as $format) {
413
+			$result = $this->_fetch_with_format($provider, $format);
414
+			if (is_wp_error($result) && 'not-implemented' == $result->get_error_code())
415 415
 				continue;
416
-			return ( $result && ! is_wp_error( $result ) ) ? $result : false;
416
+			return ($result && ! is_wp_error($result)) ? $result : false;
417 417
 		}
418 418
 		return false;
419 419
 	}
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
 	 * @param string $format Format to use
428 428
 	 * @return false|object|WP_Error False on failure, otherwise the result in the form of an object.
429 429
 	 */
430
-	private function _fetch_with_format( $provider_url_with_args, $format ) {
431
-		$provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
430
+	private function _fetch_with_format($provider_url_with_args, $format) {
431
+		$provider_url_with_args = add_query_arg('format', $format, $provider_url_with_args);
432 432
 
433 433
 		/** This filter is documented in wp-includes/class-oembed.php */
434
-		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
434
+		$args = apply_filters('oembed_remote_get_args', array(), $provider_url_with_args);
435 435
 
436
-		$response = wp_safe_remote_get( $provider_url_with_args, $args );
437
-		if ( 501 == wp_remote_retrieve_response_code( $response ) )
438
-			return new WP_Error( 'not-implemented' );
439
-		if ( ! $body = wp_remote_retrieve_body( $response ) )
436
+		$response = wp_safe_remote_get($provider_url_with_args, $args);
437
+		if (501 == wp_remote_retrieve_response_code($response))
438
+			return new WP_Error('not-implemented');
439
+		if ( ! $body = wp_remote_retrieve_body($response))
440 440
 			return false;
441 441
 		$parse_method = "_parse_$format";
442
-		return $this->$parse_method( $body );
442
+		return $this->$parse_method($body);
443 443
 	}
444 444
 
445 445
 	/**
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 	 * @param string $response_body
452 452
 	 * @return object|false
453 453
 	 */
454
-	private function _parse_json( $response_body ) {
455
-		$data = json_decode( trim( $response_body ) );
456
-		return ( $data && is_object( $data ) ) ? $data : false;
454
+	private function _parse_json($response_body) {
455
+		$data = json_decode(trim($response_body));
456
+		return ($data && is_object($data)) ? $data : false;
457 457
 	}
458 458
 
459 459
 	/**
@@ -465,17 +465,17 @@  discard block
 block discarded – undo
465 465
 	 * @param string $response_body
466 466
 	 * @return object|false
467 467
 	 */
468
-	private function _parse_xml( $response_body ) {
469
-		if ( ! function_exists( 'libxml_disable_entity_loader' ) )
468
+	private function _parse_xml($response_body) {
469
+		if ( ! function_exists('libxml_disable_entity_loader'))
470 470
 			return false;
471 471
 
472
-		$loader = libxml_disable_entity_loader( true );
473
-		$errors = libxml_use_internal_errors( true );
472
+		$loader = libxml_disable_entity_loader(true);
473
+		$errors = libxml_use_internal_errors(true);
474 474
 
475
-		$return = $this->_parse_xml_body( $response_body );
475
+		$return = $this->_parse_xml_body($response_body);
476 476
 
477
-		libxml_use_internal_errors( $errors );
478
-		libxml_disable_entity_loader( $loader );
477
+		libxml_use_internal_errors($errors);
478
+		libxml_disable_entity_loader($loader);
479 479
 
480 480
 		return $return;
481 481
 	}
@@ -489,29 +489,29 @@  discard block
 block discarded – undo
489 489
 	 * @param string $response_body
490 490
 	 * @return object|false
491 491
 	 */
492
-	private function _parse_xml_body( $response_body ) {
493
-		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument' ) )
492
+	private function _parse_xml_body($response_body) {
493
+		if ( ! function_exists('simplexml_import_dom') || ! class_exists('DOMDocument'))
494 494
 			return false;
495 495
 
496 496
 		$dom = new DOMDocument;
497
-		$success = $dom->loadXML( $response_body );
498
-		if ( ! $success )
497
+		$success = $dom->loadXML($response_body);
498
+		if ( ! $success)
499 499
 			return false;
500 500
 
501
-		if ( isset( $dom->doctype ) )
501
+		if (isset($dom->doctype))
502 502
 			return false;
503 503
 
504
-		foreach ( $dom->childNodes as $child ) {
505
-			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType )
504
+		foreach ($dom->childNodes as $child) {
505
+			if (XML_DOCUMENT_TYPE_NODE === $child->nodeType)
506 506
 				return false;
507 507
 		}
508 508
 
509
-		$xml = simplexml_import_dom( $dom );
510
-		if ( ! $xml )
509
+		$xml = simplexml_import_dom($dom);
510
+		if ( ! $xml)
511 511
 			return false;
512 512
 
513 513
 		$return = new stdClass;
514
-		foreach ( $xml as $key => $value ) {
514
+		foreach ($xml as $key => $value) {
515 515
 			$return->$key = (string) $value;
516 516
 		}
517 517
 
@@ -525,32 +525,32 @@  discard block
 block discarded – undo
525 525
 	 * @param string $url The URL to the content that is desired to be embedded.
526 526
 	 * @return false|string False on error, otherwise the HTML needed to embed.
527 527
 	 */
528
-	public function data2html( $data, $url ) {
529
-		if ( ! is_object( $data ) || empty( $data->type ) )
528
+	public function data2html($data, $url) {
529
+		if ( ! is_object($data) || empty($data->type))
530 530
 			return false;
531 531
 
532 532
 		$return = false;
533 533
 
534
-		switch ( $data->type ) {
534
+		switch ($data->type) {
535 535
 			case 'photo':
536
-				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) )
536
+				if (empty($data->url) || empty($data->width) || empty($data->height))
537 537
 					break;
538
-				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) )
538
+				if ( ! is_string($data->url) || ! is_numeric($data->width) || ! is_numeric($data->height))
539 539
 					break;
540 540
 
541
-				$title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : '';
542
-				$return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>';
541
+				$title = ! empty($data->title) && is_string($data->title) ? $data->title : '';
542
+				$return = '<a href="'.esc_url($url).'"><img src="'.esc_url($data->url).'" alt="'.esc_attr($title).'" width="'.esc_attr($data->width).'" height="'.esc_attr($data->height).'" /></a>';
543 543
 				break;
544 544
 
545 545
 			case 'video':
546 546
 			case 'rich':
547
-				if ( ! empty( $data->html ) && is_string( $data->html ) )
547
+				if ( ! empty($data->html) && is_string($data->html))
548 548
 					$return = $data->html;
549 549
 				break;
550 550
 
551 551
 			case 'link':
552
-				if ( ! empty( $data->title ) && is_string( $data->title ) )
553
-					$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
552
+				if ( ! empty($data->title) && is_string($data->title))
553
+					$return = '<a href="'.esc_url($url).'">'.esc_html($data->title).'</a>';
554 554
 				break;
555 555
 
556 556
 			default:
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param object $data   A data object result from an oEmbed provider.
569 569
 		 * @param string $url    The URL of the content to be embedded.
570 570
 		 */
571
-		return apply_filters( 'oembed_dataparse', $return, $data, $url );
571
+		return apply_filters('oembed_dataparse', $return, $data, $url);
572 572
 	}
573 573
 
574 574
 	/**
@@ -580,33 +580,33 @@  discard block
 block discarded – undo
580 580
 	 * @param string $url The original URL passed to oEmbed.
581 581
 	 * @return string Possibly modified $html
582 582
 	 */
583
-	public function _strip_newlines( $html, $data, $url ) {
584
-		if ( false === strpos( $html, "\n" ) ) {
583
+	public function _strip_newlines($html, $data, $url) {
584
+		if (false === strpos($html, "\n")) {
585 585
 			return $html;
586 586
 		}
587 587
 
588 588
 		$count = 1;
589 589
 		$found = array();
590 590
 		$token = '__PRE__';
591
-		$search = array( "\t", "\n", "\r", ' ' );
592
-		$replace = array( '__TAB__', '__NL__', '__CR__', '__SPACE__' );
593
-		$tokenized = str_replace( $search, $replace, $html );
591
+		$search = array("\t", "\n", "\r", ' ');
592
+		$replace = array('__TAB__', '__NL__', '__CR__', '__SPACE__');
593
+		$tokenized = str_replace($search, $replace, $html);
594 594
 
595
-		preg_match_all( '#(<pre[^>]*>.+?</pre>)#i', $tokenized, $matches, PREG_SET_ORDER );
596
-		foreach ( $matches as $i => $match ) {
597
-			$tag_html = str_replace( $replace, $search, $match[0] );
598
-			$tag_token = $token . $i;
595
+		preg_match_all('#(<pre[^>]*>.+?</pre>)#i', $tokenized, $matches, PREG_SET_ORDER);
596
+		foreach ($matches as $i => $match) {
597
+			$tag_html = str_replace($replace, $search, $match[0]);
598
+			$tag_token = $token.$i;
599 599
 
600
-			$found[ $tag_token ] = $tag_html;
601
-			$html = str_replace( $tag_html, $tag_token, $html, $count );
600
+			$found[$tag_token] = $tag_html;
601
+			$html = str_replace($tag_html, $tag_token, $html, $count);
602 602
 		}
603 603
 
604
-		$replaced = str_replace( $replace, $search, $html );
605
-		$stripped = str_replace( array( "\r\n", "\n" ), '', $replaced );
606
-		$pre = array_values( $found );
607
-		$tokens = array_keys( $found );
604
+		$replaced = str_replace($replace, $search, $html);
605
+		$stripped = str_replace(array("\r\n", "\n"), '', $replaced);
606
+		$pre = array_values($found);
607
+		$tokens = array_keys($found);
608 608
 
609
-		return str_replace( $tokens, $pre, $stripped );
609
+		return str_replace($tokens, $pre, $stripped);
610 610
 	}
611 611
 }
612 612
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 function _wp_oembed_get_object() {
624 624
 	static $wp_oembed = null;
625 625
 
626
-	if ( is_null( $wp_oembed ) ) {
626
+	if (is_null($wp_oembed)) {
627 627
 		$wp_oembed = new WP_oEmbed();
628 628
 	}
629 629
 	return $wp_oembed;
Please login to merge, or discard this patch.
Braces   +61 added lines, -42 removed lines patch added patch discarded remove patch
@@ -206,8 +206,9 @@  discard block
 block discarded – undo
206 206
 
207 207
 		$provider = false;
208 208
 
209
-		if ( !isset($args['discover']) )
210
-			$args['discover'] = true;
209
+		if ( !isset($args['discover']) ) {
210
+					$args['discover'] = true;
211
+		}
211 212
 
212 213
 		foreach ( $this->providers as $matchmask => $data ) {
213 214
 			list( $providerurl, $regex ) = $data;
@@ -224,8 +225,9 @@  discard block
 block discarded – undo
224 225
 			}
225 226
 		}
226 227
 
227
-		if ( !$provider && $args['discover'] )
228
-			$provider = $this->discover( $url );
228
+		if ( !$provider && $args['discover'] ) {
229
+					$provider = $this->discover( $url );
230
+		}
229 231
 
230 232
 		return $provider;
231 233
 	}
@@ -292,8 +294,9 @@  discard block
 block discarded – undo
292 294
 	public function get_html( $url, $args = '' ) {
293 295
 		$provider = $this->get_provider( $url, $args );
294 296
 
295
-		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
296
-			return false;
297
+		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) ) {
298
+					return false;
299
+		}
297 300
 
298 301
 		/**
299 302
 		 * Filter the HTML returned by the oEmbed provider.
@@ -367,20 +370,22 @@  discard block
 block discarded – undo
367 370
 						$providers[$linktypes[$atts['type']]] = htmlspecialchars_decode( $atts['href'] );
368 371
 
369 372
 						// Stop here if it's JSON (that's all we need)
370
-						if ( 'json' == $linktypes[$atts['type']] )
371
-							break;
373
+						if ( 'json' == $linktypes[$atts['type']] ) {
374
+													break;
375
+						}
372 376
 					}
373 377
 				}
374 378
 			}
375 379
 		}
376 380
 
377 381
 		// JSON is preferred to XML
378
-		if ( !empty($providers['json']) )
379
-			return $providers['json'];
380
-		elseif ( !empty($providers['xml']) )
381
-			return $providers['xml'];
382
-		else
383
-			return false;
382
+		if ( !empty($providers['json']) ) {
383
+					return $providers['json'];
384
+		} elseif ( !empty($providers['xml']) ) {
385
+					return $providers['xml'];
386
+		} else {
387
+					return false;
388
+		}
384 389
 	}
385 390
 
386 391
 	/**
@@ -411,8 +416,9 @@  discard block
 block discarded – undo
411 416
 
412 417
 		foreach( array( 'json', 'xml' ) as $format ) {
413 418
 			$result = $this->_fetch_with_format( $provider, $format );
414
-			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
415
-				continue;
419
+			if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() ) {
420
+							continue;
421
+			}
416 422
 			return ( $result && ! is_wp_error( $result ) ) ? $result : false;
417 423
 		}
418 424
 		return false;
@@ -434,10 +440,12 @@  discard block
 block discarded – undo
434 440
 		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
435 441
 
436 442
 		$response = wp_safe_remote_get( $provider_url_with_args, $args );
437
-		if ( 501 == wp_remote_retrieve_response_code( $response ) )
438
-			return new WP_Error( 'not-implemented' );
439
-		if ( ! $body = wp_remote_retrieve_body( $response ) )
440
-			return false;
443
+		if ( 501 == wp_remote_retrieve_response_code( $response ) ) {
444
+					return new WP_Error( 'not-implemented' );
445
+		}
446
+		if ( ! $body = wp_remote_retrieve_body( $response ) ) {
447
+					return false;
448
+		}
441 449
 		$parse_method = "_parse_$format";
442 450
 		return $this->$parse_method( $body );
443 451
 	}
@@ -466,8 +474,9 @@  discard block
 block discarded – undo
466 474
 	 * @return object|false
467 475
 	 */
468 476
 	private function _parse_xml( $response_body ) {
469
-		if ( ! function_exists( 'libxml_disable_entity_loader' ) )
470
-			return false;
477
+		if ( ! function_exists( 'libxml_disable_entity_loader' ) ) {
478
+					return false;
479
+		}
471 480
 
472 481
 		$loader = libxml_disable_entity_loader( true );
473 482
 		$errors = libxml_use_internal_errors( true );
@@ -490,25 +499,30 @@  discard block
 block discarded – undo
490 499
 	 * @return object|false
491 500
 	 */
492 501
 	private function _parse_xml_body( $response_body ) {
493
-		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument' ) )
494
-			return false;
502
+		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument' ) ) {
503
+					return false;
504
+		}
495 505
 
496 506
 		$dom = new DOMDocument;
497 507
 		$success = $dom->loadXML( $response_body );
498
-		if ( ! $success )
499
-			return false;
508
+		if ( ! $success ) {
509
+					return false;
510
+		}
500 511
 
501
-		if ( isset( $dom->doctype ) )
502
-			return false;
512
+		if ( isset( $dom->doctype ) ) {
513
+					return false;
514
+		}
503 515
 
504 516
 		foreach ( $dom->childNodes as $child ) {
505
-			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType )
506
-				return false;
517
+			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType ) {
518
+							return false;
519
+			}
507 520
 		}
508 521
 
509 522
 		$xml = simplexml_import_dom( $dom );
510
-		if ( ! $xml )
511
-			return false;
523
+		if ( ! $xml ) {
524
+					return false;
525
+		}
512 526
 
513 527
 		$return = new stdClass;
514 528
 		foreach ( $xml as $key => $value ) {
@@ -526,17 +540,20 @@  discard block
 block discarded – undo
526 540
 	 * @return false|string False on error, otherwise the HTML needed to embed.
527 541
 	 */
528 542
 	public function data2html( $data, $url ) {
529
-		if ( ! is_object( $data ) || empty( $data->type ) )
530
-			return false;
543
+		if ( ! is_object( $data ) || empty( $data->type ) ) {
544
+					return false;
545
+		}
531 546
 
532 547
 		$return = false;
533 548
 
534 549
 		switch ( $data->type ) {
535 550
 			case 'photo':
536
-				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) )
537
-					break;
538
-				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) )
539
-					break;
551
+				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) ) {
552
+									break;
553
+				}
554
+				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) ) {
555
+									break;
556
+				}
540 557
 
541 558
 				$title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : '';
542 559
 				$return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>';
@@ -544,13 +561,15 @@  discard block
 block discarded – undo
544 561
 
545 562
 			case 'video':
546 563
 			case 'rich':
547
-				if ( ! empty( $data->html ) && is_string( $data->html ) )
548
-					$return = $data->html;
564
+				if ( ! empty( $data->html ) && is_string( $data->html ) ) {
565
+									$return = $data->html;
566
+				}
549 567
 				break;
550 568
 
551 569
 			case 'link':
552
-				if ( ! empty( $data->title ) && is_string( $data->title ) )
553
-					$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
570
+				if ( ! empty( $data->title ) && is_string( $data->title ) ) {
571
+									$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
572
+				}
554 573
 				break;
555 574
 
556 575
 			default:
Please login to merge, or discard this patch.
src/wp-includes/ms-files.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite upload handler.
4
- *
5
- * @since 3.0.0
6
- *
7
- * @package WordPress
8
- * @subpackage Multisite
9
- */
3
+	 * Multisite upload handler.
4
+	 *
5
+	 * @since 3.0.0
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Multisite
9
+	 */
10 10
 
11 11
 define( 'SHORTINIT', true );
12 12
 require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -8,75 +8,75 @@
 block discarded – undo
8 8
  * @subpackage Multisite
9 9
  */
10 10
 
11
-define( 'SHORTINIT', true );
12
-require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
11
+define('SHORTINIT', true);
12
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
13 13
 
14
-if ( !is_multisite() )
15
-	die( 'Multisite support not enabled' );
14
+if ( ! is_multisite())
15
+	die('Multisite support not enabled');
16 16
 
17 17
 ms_file_constants();
18 18
 
19
-error_reporting( 0 );
19
+error_reporting(0);
20 20
 
21
-if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
22
-	status_header( 404 );
23
-	die( '404 &#8212; File not found.' );
21
+if ($current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1') {
22
+	status_header(404);
23
+	die('404 &#8212; File not found.');
24 24
 }
25 25
 
26
-$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET[ 'file' ] );
27
-if ( !is_file( $file ) ) {
28
-	status_header( 404 );
29
-	die( '404 &#8212; File not found.' );
26
+$file = rtrim(BLOGUPLOADDIR, '/').'/'.str_replace('..', '', $_GET['file']);
27
+if ( ! is_file($file)) {
28
+	status_header(404);
29
+	die('404 &#8212; File not found.');
30 30
 }
31 31
 
32
-$mime = wp_check_filetype( $file );
33
-if ( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
34
-	$mime[ 'type' ] = mime_content_type( $file );
32
+$mime = wp_check_filetype($file);
33
+if (false === $mime['type'] && function_exists('mime_content_type'))
34
+	$mime['type'] = mime_content_type($file);
35 35
 
36
-if ( $mime[ 'type' ] )
37
-	$mimetype = $mime[ 'type' ];
36
+if ($mime['type'])
37
+	$mimetype = $mime['type'];
38 38
 else
39
-	$mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
39
+	$mimetype = 'image/'.substr($file, strrpos($file, '.') + 1);
40 40
 
41
-header( 'Content-Type: ' . $mimetype ); // always send this
42
-if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
43
-	header( 'Content-Length: ' . filesize( $file ) );
41
+header('Content-Type: '.$mimetype); // always send this
42
+if (false === strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS'))
43
+	header('Content-Length: '.filesize($file));
44 44
 
45 45
 // Optional support for X-Sendfile and X-Accel-Redirect
46
-if ( WPMU_ACCEL_REDIRECT ) {
47
-	header( 'X-Accel-Redirect: ' . str_replace( WP_CONTENT_DIR, '', $file ) );
46
+if (WPMU_ACCEL_REDIRECT) {
47
+	header('X-Accel-Redirect: '.str_replace(WP_CONTENT_DIR, '', $file));
48 48
 	exit;
49
-} elseif ( WPMU_SENDFILE ) {
50
-	header( 'X-Sendfile: ' . $file );
49
+} elseif (WPMU_SENDFILE) {
50
+	header('X-Sendfile: '.$file);
51 51
 	exit;
52 52
 }
53 53
 
54
-$last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) );
55
-$etag = '"' . md5( $last_modified ) . '"';
56
-header( "Last-Modified: $last_modified GMT" );
57
-header( 'ETag: ' . $etag );
58
-header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' );
54
+$last_modified = gmdate('D, d M Y H:i:s', filemtime($file));
55
+$etag = '"'.md5($last_modified).'"';
56
+header("Last-Modified: $last_modified GMT");
57
+header('ETag: '.$etag);
58
+header('Expires: '.gmdate('D, d M Y H:i:s', time() + 100000000).' GMT');
59 59
 
60 60
 // Support for Conditional GET - use stripslashes to avoid formatting.php dependency
61
-$client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;
61
+$client_etag = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
62 62
 
63
-if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
63
+if ( ! isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
64 64
 	$_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
65 65
 
66
-$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
66
+$client_last_modified = trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
67 67
 // If string is empty, return 0. If not, attempt to parse into a timestamp
68
-$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;
68
+$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
69 69
 
70 70
 // Make a timestamp for our most recent modification...
71 71
 $modified_timestamp = strtotime($last_modified);
72 72
 
73
-if ( ( $client_last_modified && $client_etag )
74
-	? ( ( $client_modified_timestamp >= $modified_timestamp) && ( $client_etag == $etag ) )
75
-	: ( ( $client_modified_timestamp >= $modified_timestamp) || ( $client_etag == $etag ) )
73
+if (($client_last_modified && $client_etag)
74
+	? (($client_modified_timestamp >= $modified_timestamp) && ($client_etag == $etag))
75
+	: (($client_modified_timestamp >= $modified_timestamp) || ($client_etag == $etag))
76 76
 	) {
77
-	status_header( 304 );
77
+	status_header(304);
78 78
 	exit;
79 79
 }
80 80
 
81 81
 // If we made it this far, just serve the file
82
-readfile( $file );
82
+readfile($file);
Please login to merge, or discard this patch.
Braces   +11 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
 define( 'SHORTINIT', true );
12 12
 require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
13 13
 
14
-if ( !is_multisite() )
14
+if ( !is_multisite() ) {
15 15
 	die( 'Multisite support not enabled' );
16
+}
16 17
 
17 18
 ms_file_constants();
18 19
 
@@ -30,17 +31,20 @@  discard block
 block discarded – undo
30 31
 }
31 32
 
32 33
 $mime = wp_check_filetype( $file );
33
-if ( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
34
+if ( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) ) {
34 35
 	$mime[ 'type' ] = mime_content_type( $file );
36
+}
35 37
 
36
-if ( $mime[ 'type' ] )
38
+if ( $mime[ 'type' ] ) {
37 39
 	$mimetype = $mime[ 'type' ];
38
-else
40
+} else {
39 41
 	$mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
42
+}
40 43
 
41 44
 header( 'Content-Type: ' . $mimetype ); // always send this
42
-if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
45
+if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) ) {
43 46
 	header( 'Content-Length: ' . filesize( $file ) );
47
+}
44 48
 
45 49
 // Optional support for X-Sendfile and X-Accel-Redirect
46 50
 if ( WPMU_ACCEL_REDIRECT ) {
@@ -60,8 +64,9 @@  discard block
 block discarded – undo
60 64
 // Support for Conditional GET - use stripslashes to avoid formatting.php dependency
61 65
 $client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;
62 66
 
63
-if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
67
+if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
64 68
 	$_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
69
+}
65 70
 
66 71
 $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
67 72
 // If string is empty, return 0. If not, attempt to parse into a timestamp
Please login to merge, or discard this patch.
src/wp-includes/pomo/entry.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
- * Contains Translation_Entry class
4
- *
5
- * @version $Id: entry.php 718 2012-10-31 00:32:02Z nbachiyski $
6
- * @package pomo
7
- * @subpackage entry
8
- */
3
+	 * Contains Translation_Entry class
4
+	 *
5
+	 * @version $Id: entry.php 718 2012-10-31 00:32:02Z nbachiyski $
6
+	 * @package pomo
7
+	 * @subpackage entry
8
+	 */
9 9
 
10 10
 if ( !class_exists( 'Translation_Entry' ) ):
11 11
 /**
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @subpackage entry
8 8
  */
9 9
 
10
-if ( !class_exists( 'Translation_Entry' ) ):
10
+if ( ! class_exists('Translation_Entry')):
11 11
 /**
12 12
  * Translation_Entry class encapsulates a translatable string
13 13
  */
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 * 	- references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
41 41
 	 * 	- flags (array) -- flags like php-format
42 42
 	 */
43
-	function __construct( $args = array() ) {
43
+	function __construct($args = array()) {
44 44
 		// if no singular -- empty object
45
-		if (!isset($args['singular'])) {
45
+		if ( ! isset($args['singular'])) {
46 46
 			return;
47 47
 		}
48 48
 		// get member variable values from args hash
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 			$this->$varname = $value;
51 51
 		}
52 52
 		if (isset($args['plural'])) $this->is_plural = true;
53
-		if (!is_array($this->translations)) $this->translations = array();
54
-		if (!is_array($this->references)) $this->references = array();
55
-		if (!is_array($this->flags)) $this->flags = array();
53
+		if ( ! is_array($this->translations)) $this->translations = array();
54
+		if ( ! is_array($this->references)) $this->references = array();
55
+		if ( ! is_array($this->flags)) $this->flags = array();
56 56
 	}
57 57
 
58 58
 	/**
59 59
 	 * PHP4 constructor.
60 60
 	 */
61
-	public function Translation_Entry( $args = array() ) {
62
-		self::__construct( $args );
61
+	public function Translation_Entry($args = array()) {
62
+		self::__construct($args);
63 63
 	}
64 64
 
65 65
 	/**
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 	function key() {
71 71
 		if (is_null($this->singular)) return false;
72 72
 		// prepend context and EOT, like in MO files
73
-		return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
73
+		return is_null($this->context) ? $this->singular : $this->context.chr(4).$this->singular;
74 74
 	}
75 75
 
76 76
 	/**
77 77
 	 * @param object $other
78 78
 	 */
79 79
 	function merge_with(&$other) {
80
-		$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
81
-		$this->references = array_unique( array_merge( $this->references, $other->references ) );
82
-		if ( $this->extracted_comments != $other->extracted_comments ) {
80
+		$this->flags = array_unique(array_merge($this->flags, $other->flags));
81
+		$this->references = array_unique(array_merge($this->references, $other->references));
82
+		if ($this->extracted_comments != $other->extracted_comments) {
83 83
 			$this->extracted_comments .= $other->extracted_comments;
84 84
 		}
85 85
 
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,10 +49,18 @@  discard block
 block discarded – undo
49 49
 		foreach ($args as $varname => $value) {
50 50
 			$this->$varname = $value;
51 51
 		}
52
-		if (isset($args['plural'])) $this->is_plural = true;
53
-		if (!is_array($this->translations)) $this->translations = array();
54
-		if (!is_array($this->references)) $this->references = array();
55
-		if (!is_array($this->flags)) $this->flags = array();
52
+		if (isset($args['plural'])) {
53
+			$this->is_plural = true;
54
+		}
55
+		if (!is_array($this->translations)) {
56
+			$this->translations = array();
57
+		}
58
+		if (!is_array($this->references)) {
59
+			$this->references = array();
60
+		}
61
+		if (!is_array($this->flags)) {
62
+			$this->flags = array();
63
+		}
56 64
 	}
57 65
 
58 66
 	/**
@@ -68,7 +76,9 @@  discard block
 block discarded – undo
68 76
 	 * @return string|bool the key or false if the entry is empty
69 77
 	 */
70 78
 	function key() {
71
-		if (is_null($this->singular)) return false;
79
+		if (is_null($this->singular)) {
80
+			return false;
81
+		}
72 82
 		// prepend context and EOT, like in MO files
73 83
 		return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
74 84
 	}
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff/Engine/shell.php 3 patches
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -16,147 +16,147 @@
 block discarded – undo
16 16
  */
17 17
 class Text_Diff_Engine_shell {
18 18
 
19
-    /**
20
-     * Path to the diff executable
21
-     *
22
-     * @var string
23
-     */
24
-    var $_diffCommand = 'diff';
25
-
26
-    /**
27
-     * Returns the array of differences.
28
-     *
29
-     * @param array $from_lines lines of text from old file
30
-     * @param array $to_lines   lines of text from new file
31
-     *
32
-     * @return array all changes made (array with Text_Diff_Op_* objects)
33
-     */
34
-    function diff($from_lines, $to_lines)
35
-    {
36
-        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
37
-        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
38
-
39
-        $temp_dir = Text_Diff::_getTempDir();
40
-
41
-        // Execute gnu diff or similar to get a standard diff file.
42
-        $from_file = tempnam($temp_dir, 'Text_Diff');
43
-        $to_file = tempnam($temp_dir, 'Text_Diff');
44
-        $fp = fopen($from_file, 'w');
45
-        fwrite($fp, implode("\n", $from_lines));
46
-        fclose($fp);
47
-        $fp = fopen($to_file, 'w');
48
-        fwrite($fp, implode("\n", $to_lines));
49
-        fclose($fp);
50
-        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
51
-        unlink($from_file);
52
-        unlink($to_file);
53
-
54
-        if (is_null($diff)) {
55
-            // No changes were made
56
-            return array(new Text_Diff_Op_copy($from_lines));
57
-        }
58
-
59
-        $from_line_no = 1;
60
-        $to_line_no = 1;
61
-        $edits = array();
62
-
63
-        // Get changed lines by parsing something like:
64
-        // 0a1,2
65
-        // 1,2c4,6
66
-        // 1,5d6
67
-        preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
68
-            $matches, PREG_SET_ORDER);
69
-
70
-        foreach ($matches as $match) {
71
-            if (!isset($match[5])) {
72
-                // This paren is not set every time (see regex).
73
-                $match[5] = false;
74
-            }
75
-
76
-            if ($match[3] == 'a') {
77
-                $from_line_no--;
78
-            }
79
-
80
-            if ($match[3] == 'd') {
81
-                $to_line_no--;
82
-            }
83
-
84
-            if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
85
-                // copied lines
86
-                assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
87
-                array_push($edits,
88
-                    new Text_Diff_Op_copy(
89
-                        $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
90
-                        $this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
91
-            }
92
-
93
-            switch ($match[3]) {
94
-            case 'd':
95
-                // deleted lines
96
-                array_push($edits,
97
-                    new Text_Diff_Op_delete(
98
-                        $this->_getLines($from_lines, $from_line_no, $match[2])));
99
-                $to_line_no++;
100
-                break;
101
-
102
-            case 'c':
103
-                // changed lines
104
-                array_push($edits,
105
-                    new Text_Diff_Op_change(
106
-                        $this->_getLines($from_lines, $from_line_no, $match[2]),
107
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
108
-                break;
109
-
110
-            case 'a':
111
-                // added lines
112
-                array_push($edits,
113
-                    new Text_Diff_Op_add(
114
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
115
-                $from_line_no++;
116
-                break;
117
-            }
118
-        }
119
-
120
-        if (!empty($from_lines)) {
121
-            // Some lines might still be pending. Add them as copied
122
-            array_push($edits,
123
-                new Text_Diff_Op_copy(
124
-                    $this->_getLines($from_lines, $from_line_no,
125
-                                     $from_line_no + count($from_lines) - 1),
126
-                    $this->_getLines($to_lines, $to_line_no,
127
-                                     $to_line_no + count($to_lines) - 1)));
128
-        }
129
-
130
-        return $edits;
131
-    }
132
-
133
-    /**
134
-     * Get lines from either the old or new text
135
-     *
136
-     * @access private
137
-     *
138
-     * @param array &$text_lines Either $from_lines or $to_lines
139
-     * @param int   &$line_no    Current line number
140
-     * @param int   $end         Optional end line, when we want to chop more
141
-     *                           than one line.
142
-     *
143
-     * @return array The chopped lines
144
-     */
145
-    function _getLines(&$text_lines, &$line_no, $end = false)
146
-    {
147
-        if (!empty($end)) {
148
-            $lines = array();
149
-            // We can shift even more
150
-            while ($line_no <= $end) {
151
-                array_push($lines, array_shift($text_lines));
152
-                $line_no++;
153
-            }
154
-        } else {
155
-            $lines = array(array_shift($text_lines));
156
-            $line_no++;
157
-        }
158
-
159
-        return $lines;
160
-    }
19
+	/**
20
+	 * Path to the diff executable
21
+	 *
22
+	 * @var string
23
+	 */
24
+	var $_diffCommand = 'diff';
25
+
26
+	/**
27
+	 * Returns the array of differences.
28
+	 *
29
+	 * @param array $from_lines lines of text from old file
30
+	 * @param array $to_lines   lines of text from new file
31
+	 *
32
+	 * @return array all changes made (array with Text_Diff_Op_* objects)
33
+	 */
34
+	function diff($from_lines, $to_lines)
35
+	{
36
+		array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
37
+		array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
38
+
39
+		$temp_dir = Text_Diff::_getTempDir();
40
+
41
+		// Execute gnu diff or similar to get a standard diff file.
42
+		$from_file = tempnam($temp_dir, 'Text_Diff');
43
+		$to_file = tempnam($temp_dir, 'Text_Diff');
44
+		$fp = fopen($from_file, 'w');
45
+		fwrite($fp, implode("\n", $from_lines));
46
+		fclose($fp);
47
+		$fp = fopen($to_file, 'w');
48
+		fwrite($fp, implode("\n", $to_lines));
49
+		fclose($fp);
50
+		$diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
51
+		unlink($from_file);
52
+		unlink($to_file);
53
+
54
+		if (is_null($diff)) {
55
+			// No changes were made
56
+			return array(new Text_Diff_Op_copy($from_lines));
57
+		}
58
+
59
+		$from_line_no = 1;
60
+		$to_line_no = 1;
61
+		$edits = array();
62
+
63
+		// Get changed lines by parsing something like:
64
+		// 0a1,2
65
+		// 1,2c4,6
66
+		// 1,5d6
67
+		preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
68
+			$matches, PREG_SET_ORDER);
69
+
70
+		foreach ($matches as $match) {
71
+			if (!isset($match[5])) {
72
+				// This paren is not set every time (see regex).
73
+				$match[5] = false;
74
+			}
75
+
76
+			if ($match[3] == 'a') {
77
+				$from_line_no--;
78
+			}
79
+
80
+			if ($match[3] == 'd') {
81
+				$to_line_no--;
82
+			}
83
+
84
+			if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
85
+				// copied lines
86
+				assert('$match[1] - $from_line_no == $match[4] - $to_line_no');
87
+				array_push($edits,
88
+					new Text_Diff_Op_copy(
89
+						$this->_getLines($from_lines, $from_line_no, $match[1] - 1),
90
+						$this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
91
+			}
92
+
93
+			switch ($match[3]) {
94
+			case 'd':
95
+				// deleted lines
96
+				array_push($edits,
97
+					new Text_Diff_Op_delete(
98
+						$this->_getLines($from_lines, $from_line_no, $match[2])));
99
+				$to_line_no++;
100
+				break;
101
+
102
+			case 'c':
103
+				// changed lines
104
+				array_push($edits,
105
+					new Text_Diff_Op_change(
106
+						$this->_getLines($from_lines, $from_line_no, $match[2]),
107
+						$this->_getLines($to_lines, $to_line_no, $match[5])));
108
+				break;
109
+
110
+			case 'a':
111
+				// added lines
112
+				array_push($edits,
113
+					new Text_Diff_Op_add(
114
+						$this->_getLines($to_lines, $to_line_no, $match[5])));
115
+				$from_line_no++;
116
+				break;
117
+			}
118
+		}
119
+
120
+		if (!empty($from_lines)) {
121
+			// Some lines might still be pending. Add them as copied
122
+			array_push($edits,
123
+				new Text_Diff_Op_copy(
124
+					$this->_getLines($from_lines, $from_line_no,
125
+									 $from_line_no + count($from_lines) - 1),
126
+					$this->_getLines($to_lines, $to_line_no,
127
+									 $to_line_no + count($to_lines) - 1)));
128
+		}
129
+
130
+		return $edits;
131
+	}
132
+
133
+	/**
134
+	 * Get lines from either the old or new text
135
+	 *
136
+	 * @access private
137
+	 *
138
+	 * @param array &$text_lines Either $from_lines or $to_lines
139
+	 * @param int   &$line_no    Current line number
140
+	 * @param int   $end         Optional end line, when we want to chop more
141
+	 *                           than one line.
142
+	 *
143
+	 * @return array The chopped lines
144
+	 */
145
+	function _getLines(&$text_lines, &$line_no, $end = false)
146
+	{
147
+		if (!empty($end)) {
148
+			$lines = array();
149
+			// We can shift even more
150
+			while ($line_no <= $end) {
151
+				array_push($lines, array_shift($text_lines));
152
+				$line_no++;
153
+			}
154
+		} else {
155
+			$lines = array(array_shift($text_lines));
156
+			$line_no++;
157
+		}
158
+
159
+		return $lines;
160
+	}
161 161
 
162 162
 }
Please login to merge, or discard this patch.
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -91,29 +91,29 @@
 block discarded – undo
91 91
             }
92 92
 
93 93
             switch ($match[3]) {
94
-            case 'd':
95
-                // deleted lines
96
-                array_push($edits,
97
-                    new Text_Diff_Op_delete(
98
-                        $this->_getLines($from_lines, $from_line_no, $match[2])));
99
-                $to_line_no++;
100
-                break;
101
-
102
-            case 'c':
103
-                // changed lines
104
-                array_push($edits,
105
-                    new Text_Diff_Op_change(
106
-                        $this->_getLines($from_lines, $from_line_no, $match[2]),
107
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
108
-                break;
109
-
110
-            case 'a':
111
-                // added lines
112
-                array_push($edits,
113
-                    new Text_Diff_Op_add(
114
-                        $this->_getLines($to_lines, $to_line_no, $match[5])));
115
-                $from_line_no++;
116
-                break;
94
+            	case 'd':
95
+                	// deleted lines
96
+                	array_push($edits,
97
+                    	new Text_Diff_Op_delete(
98
+                        	$this->_getLines($from_lines, $from_line_no, $match[2])));
99
+                	$to_line_no++;
100
+                	break;
101
+
102
+            	case 'c':
103
+                	// changed lines
104
+                	array_push($edits,
105
+                    	new Text_Diff_Op_change(
106
+                        	$this->_getLines($from_lines, $from_line_no, $match[2]),
107
+                        	$this->_getLines($to_lines, $to_line_no, $match[5])));
108
+                	break;
109
+
110
+            	case 'a':
111
+                	// added lines
112
+                	array_push($edits,
113
+                    	new Text_Diff_Op_add(
114
+                        	$this->_getLines($to_lines, $to_line_no, $match[5])));
115
+                	$from_line_no++;
116
+                	break;
117 117
             }
118 118
         }
119 119
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $fp = fopen($to_file, 'w');
48 48
         fwrite($fp, implode("\n", $to_lines));
49 49
         fclose($fp);
50
-        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
50
+        $diff = shell_exec($this->_diffCommand.' '.$from_file.' '.$to_file);
51 51
         unlink($from_file);
52 52
         unlink($to_file);
53 53
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $matches, PREG_SET_ORDER);
69 69
 
70 70
         foreach ($matches as $match) {
71
-            if (!isset($match[5])) {
71
+            if ( ! isset($match[5])) {
72 72
                 // This paren is not set every time (see regex).
73 73
                 $match[5] = false;
74 74
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             }
118 118
         }
119 119
 
120
-        if (!empty($from_lines)) {
120
+        if ( ! empty($from_lines)) {
121 121
             // Some lines might still be pending. Add them as copied
122 122
             array_push($edits,
123 123
                 new Text_Diff_Op_copy(
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     function _getLines(&$text_lines, &$line_no, $end = false)
146 146
     {
147
-        if (!empty($end)) {
147
+        if ( ! empty($end)) {
148 148
             $lines = array();
149 149
             // We can shift even more
150 150
             while ($line_no <= $end) {
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff/Engine/xdiff.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class Text_Diff_Engine_xdiff {
17 17
 
18
-    /**
19
-     */
20
-    function diff($from_lines, $to_lines)
21
-    {
22
-        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
23
-        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
18
+	/**
19
+	 */
20
+	function diff($from_lines, $to_lines)
21
+	{
22
+		array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
23
+		array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
24 24
 
25
-        /* Convert the two input arrays into strings for xdiff processing. */
26
-        $from_string = implode("\n", $from_lines);
27
-        $to_string = implode("\n", $to_lines);
25
+		/* Convert the two input arrays into strings for xdiff processing. */
26
+		$from_string = implode("\n", $from_lines);
27
+		$to_string = implode("\n", $to_lines);
28 28
 
29
-        /* Diff the two strings and convert the result to an array. */
30
-        $diff = xdiff_string_diff($from_string, $to_string, count($to_lines));
31
-        $diff = explode("\n", $diff);
29
+		/* Diff the two strings and convert the result to an array. */
30
+		$diff = xdiff_string_diff($from_string, $to_string, count($to_lines));
31
+		$diff = explode("\n", $diff);
32 32
 
33
-        /* Walk through the diff one line at a time.  We build the $edits
33
+		/* Walk through the diff one line at a time.  We build the $edits
34 34
          * array of diff operations by reading the first character of the
35 35
          * xdiff output (which is in the "unified diff" format).
36 36
          *
@@ -38,27 +38,27 @@  discard block
 block discarded – undo
38 38
          * lines using this approach, so we can't add Text_Diff_Op_changed
39 39
          * instances to the $edits array.  The result is still perfectly
40 40
          * valid, albeit a little less descriptive and efficient. */
41
-        $edits = array();
42
-        foreach ($diff as $line) {
43
-            if (!strlen($line)) {
44
-                continue;
45
-            }
46
-            switch ($line[0]) {
47
-            case ' ':
48
-                $edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
-                break;
41
+		$edits = array();
42
+		foreach ($diff as $line) {
43
+			if (!strlen($line)) {
44
+				continue;
45
+			}
46
+			switch ($line[0]) {
47
+			case ' ':
48
+				$edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
+				break;
50 50
 
51
-            case '+':
52
-                $edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
-                break;
51
+			case '+':
52
+				$edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
+				break;
54 54
 
55
-            case '-':
56
-                $edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
-                break;
58
-            }
59
-        }
55
+			case '-':
56
+				$edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
+				break;
58
+			}
59
+		}
60 60
 
61
-        return $edits;
62
-    }
61
+		return $edits;
62
+	}
63 63
 
64 64
 }
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@
 block discarded – undo
44 44
                 continue;
45 45
             }
46 46
             switch ($line[0]) {
47
-            case ' ':
48
-                $edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
-                break;
47
+            	case ' ':
48
+                	$edits[] = new Text_Diff_Op_copy(array(substr($line, 1)));
49
+                	break;
50 50
 
51
-            case '+':
52
-                $edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
-                break;
51
+            	case '+':
52
+                	$edits[] = new Text_Diff_Op_add(array(substr($line, 1)));
53
+                	break;
54 54
 
55
-            case '-':
56
-                $edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
-                break;
55
+            	case '-':
56
+                	$edits[] = new Text_Diff_Op_delete(array(substr($line, 1)));
57
+                	break;
58 58
             }
59 59
         }
60 60
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
          * valid, albeit a little less descriptive and efficient. */
41 41
         $edits = array();
42 42
         foreach ($diff as $line) {
43
-            if (!strlen($line)) {
43
+            if ( ! strlen($line)) {
44 44
                 continue;
45 45
             }
46 46
             switch ($line[0]) {
Please login to merge, or discard this patch.
src/wp-includes/Text/Diff.php 2 patches
Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -17,43 +17,43 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class Text_Diff {
19 19
 
20
-    /**
21
-     * Array of changes.
22
-     *
23
-     * @var array
24
-     */
25
-    var $_edits;
26
-
27
-    /**
28
-     * Computes diffs between sequences of strings.
29
-     *
30
-     * @param string $engine     Name of the diffing engine to use.  'auto'
31
-     *                           will automatically select the best.
32
-     * @param array $params      Parameters to pass to the diffing engine.
33
-     *                           Normally an array of two arrays, each
34
-     *                           containing the lines from a file.
35
-     */
36
-    function __construct( $engine, $params )
37
-    {
38
-        // Backward compatibility workaround.
39
-        if (!is_string($engine)) {
40
-            $params = array($engine, $params);
41
-            $engine = 'auto';
42
-        }
43
-
44
-        if ($engine == 'auto') {
45
-            $engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
46
-        } else {
47
-            $engine = basename($engine);
48
-        }
49
-
50
-        // WP #7391
51
-        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
-        $class = 'Text_Diff_Engine_' . $engine;
53
-        $diff_engine = new $class();
54
-
55
-        $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
56
-    }
20
+	/**
21
+	 * Array of changes.
22
+	 *
23
+	 * @var array
24
+	 */
25
+	var $_edits;
26
+
27
+	/**
28
+	 * Computes diffs between sequences of strings.
29
+	 *
30
+	 * @param string $engine     Name of the diffing engine to use.  'auto'
31
+	 *                           will automatically select the best.
32
+	 * @param array $params      Parameters to pass to the diffing engine.
33
+	 *                           Normally an array of two arrays, each
34
+	 *                           containing the lines from a file.
35
+	 */
36
+	function __construct( $engine, $params )
37
+	{
38
+		// Backward compatibility workaround.
39
+		if (!is_string($engine)) {
40
+			$params = array($engine, $params);
41
+			$engine = 'auto';
42
+		}
43
+
44
+		if ($engine == 'auto') {
45
+			$engine = extension_loaded('xdiff') ? 'xdiff' : 'native';
46
+		} else {
47
+			$engine = basename($engine);
48
+		}
49
+
50
+		// WP #7391
51
+		require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
+		$class = 'Text_Diff_Engine_' . $engine;
53
+		$diff_engine = new $class();
54
+
55
+		$this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
56
+	}
57 57
 
58 58
 	/**
59 59
 	 * PHP4 constructor.
@@ -62,230 +62,230 @@  discard block
 block discarded – undo
62 62
 		self::__construct( $engine, $params );
63 63
 	}
64 64
 
65
-    /**
66
-     * Returns the array of differences.
67
-     */
68
-    function getDiff()
69
-    {
70
-        return $this->_edits;
71
-    }
72
-
73
-    /**
74
-     * returns the number of new (added) lines in a given diff.
75
-     *
76
-     * @since Text_Diff 1.1.0
77
-     *
78
-     * @return integer The number of new lines
79
-     */
80
-    function countAddedLines()
81
-    {
82
-        $count = 0;
83
-        foreach ($this->_edits as $edit) {
84
-            if (is_a($edit, 'Text_Diff_Op_add') ||
85
-                is_a($edit, 'Text_Diff_Op_change')) {
86
-                $count += $edit->nfinal();
87
-            }
88
-        }
89
-        return $count;
90
-    }
91
-
92
-    /**
93
-     * Returns the number of deleted (removed) lines in a given diff.
94
-     *
95
-     * @since Text_Diff 1.1.0
96
-     *
97
-     * @return integer The number of deleted lines
98
-     */
99
-    function countDeletedLines()
100
-    {
101
-        $count = 0;
102
-        foreach ($this->_edits as $edit) {
103
-            if (is_a($edit, 'Text_Diff_Op_delete') ||
104
-                is_a($edit, 'Text_Diff_Op_change')) {
105
-                $count += $edit->norig();
106
-            }
107
-        }
108
-        return $count;
109
-    }
110
-
111
-    /**
112
-     * Computes a reversed diff.
113
-     *
114
-     * Example:
115
-     * <code>
116
-     * $diff = new Text_Diff($lines1, $lines2);
117
-     * $rev = $diff->reverse();
118
-     * </code>
119
-     *
120
-     * @return Text_Diff  A Diff object representing the inverse of the
121
-     *                    original diff.  Note that we purposely don't return a
122
-     *                    reference here, since this essentially is a clone()
123
-     *                    method.
124
-     */
125
-    function reverse()
126
-    {
127
-        if (version_compare(zend_version(), '2', '>')) {
128
-            $rev = clone($this);
129
-        } else {
130
-            $rev = $this;
131
-        }
132
-        $rev->_edits = array();
133
-        foreach ($this->_edits as $edit) {
134
-            $rev->_edits[] = $edit->reverse();
135
-        }
136
-        return $rev;
137
-    }
138
-
139
-    /**
140
-     * Checks for an empty diff.
141
-     *
142
-     * @return boolean  True if two sequences were identical.
143
-     */
144
-    function isEmpty()
145
-    {
146
-        foreach ($this->_edits as $edit) {
147
-            if (!is_a($edit, 'Text_Diff_Op_copy')) {
148
-                return false;
149
-            }
150
-        }
151
-        return true;
152
-    }
153
-
154
-    /**
155
-     * Computes the length of the Longest Common Subsequence (LCS).
156
-     *
157
-     * This is mostly for diagnostic purposes.
158
-     *
159
-     * @return integer  The length of the LCS.
160
-     */
161
-    function lcs()
162
-    {
163
-        $lcs = 0;
164
-        foreach ($this->_edits as $edit) {
165
-            if (is_a($edit, 'Text_Diff_Op_copy')) {
166
-                $lcs += count($edit->orig);
167
-            }
168
-        }
169
-        return $lcs;
170
-    }
171
-
172
-    /**
173
-     * Gets the original set of lines.
174
-     *
175
-     * This reconstructs the $from_lines parameter passed to the constructor.
176
-     *
177
-     * @return array  The original sequence of strings.
178
-     */
179
-    function getOriginal()
180
-    {
181
-        $lines = array();
182
-        foreach ($this->_edits as $edit) {
183
-            if ($edit->orig) {
184
-                array_splice($lines, count($lines), 0, $edit->orig);
185
-            }
186
-        }
187
-        return $lines;
188
-    }
189
-
190
-    /**
191
-     * Gets the final set of lines.
192
-     *
193
-     * This reconstructs the $to_lines parameter passed to the constructor.
194
-     *
195
-     * @return array  The sequence of strings.
196
-     */
197
-    function getFinal()
198
-    {
199
-        $lines = array();
200
-        foreach ($this->_edits as $edit) {
201
-            if ($edit->final) {
202
-                array_splice($lines, count($lines), 0, $edit->final);
203
-            }
204
-        }
205
-        return $lines;
206
-    }
207
-
208
-    /**
209
-     * Removes trailing newlines from a line of text. This is meant to be used
210
-     * with array_walk().
211
-     *
212
-     * @param string $line  The line to trim.
213
-     * @param integer $key  The index of the line in the array. Not used.
214
-     */
215
-    static function trimNewlines(&$line, $key)
216
-    {
217
-        $line = str_replace(array("\n", "\r"), '', $line);
218
-    }
219
-
220
-    /**
221
-     * Determines the location of the system temporary directory.
222
-     *
223
-     * @static
224
-     *
225
-     * @access protected
226
-     *
227
-     * @return string  A directory name which can be used for temp files.
228
-     *                 Returns false if one could not be found.
229
-     */
230
-    function _getTempDir()
231
-    {
232
-        $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
233
-                               'c:\windows\temp', 'c:\winnt\temp');
234
-
235
-        /* Try PHP's upload_tmp_dir directive. */
236
-        $tmp = ini_get('upload_tmp_dir');
237
-
238
-        /* Otherwise, try to determine the TMPDIR environment variable. */
239
-        if (!strlen($tmp)) {
240
-            $tmp = getenv('TMPDIR');
241
-        }
242
-
243
-        /* If we still cannot determine a value, then cycle through a list of
65
+	/**
66
+	 * Returns the array of differences.
67
+	 */
68
+	function getDiff()
69
+	{
70
+		return $this->_edits;
71
+	}
72
+
73
+	/**
74
+	 * returns the number of new (added) lines in a given diff.
75
+	 *
76
+	 * @since Text_Diff 1.1.0
77
+	 *
78
+	 * @return integer The number of new lines
79
+	 */
80
+	function countAddedLines()
81
+	{
82
+		$count = 0;
83
+		foreach ($this->_edits as $edit) {
84
+			if (is_a($edit, 'Text_Diff_Op_add') ||
85
+				is_a($edit, 'Text_Diff_Op_change')) {
86
+				$count += $edit->nfinal();
87
+			}
88
+		}
89
+		return $count;
90
+	}
91
+
92
+	/**
93
+	 * Returns the number of deleted (removed) lines in a given diff.
94
+	 *
95
+	 * @since Text_Diff 1.1.0
96
+	 *
97
+	 * @return integer The number of deleted lines
98
+	 */
99
+	function countDeletedLines()
100
+	{
101
+		$count = 0;
102
+		foreach ($this->_edits as $edit) {
103
+			if (is_a($edit, 'Text_Diff_Op_delete') ||
104
+				is_a($edit, 'Text_Diff_Op_change')) {
105
+				$count += $edit->norig();
106
+			}
107
+		}
108
+		return $count;
109
+	}
110
+
111
+	/**
112
+	 * Computes a reversed diff.
113
+	 *
114
+	 * Example:
115
+	 * <code>
116
+	 * $diff = new Text_Diff($lines1, $lines2);
117
+	 * $rev = $diff->reverse();
118
+	 * </code>
119
+	 *
120
+	 * @return Text_Diff  A Diff object representing the inverse of the
121
+	 *                    original diff.  Note that we purposely don't return a
122
+	 *                    reference here, since this essentially is a clone()
123
+	 *                    method.
124
+	 */
125
+	function reverse()
126
+	{
127
+		if (version_compare(zend_version(), '2', '>')) {
128
+			$rev = clone($this);
129
+		} else {
130
+			$rev = $this;
131
+		}
132
+		$rev->_edits = array();
133
+		foreach ($this->_edits as $edit) {
134
+			$rev->_edits[] = $edit->reverse();
135
+		}
136
+		return $rev;
137
+	}
138
+
139
+	/**
140
+	 * Checks for an empty diff.
141
+	 *
142
+	 * @return boolean  True if two sequences were identical.
143
+	 */
144
+	function isEmpty()
145
+	{
146
+		foreach ($this->_edits as $edit) {
147
+			if (!is_a($edit, 'Text_Diff_Op_copy')) {
148
+				return false;
149
+			}
150
+		}
151
+		return true;
152
+	}
153
+
154
+	/**
155
+	 * Computes the length of the Longest Common Subsequence (LCS).
156
+	 *
157
+	 * This is mostly for diagnostic purposes.
158
+	 *
159
+	 * @return integer  The length of the LCS.
160
+	 */
161
+	function lcs()
162
+	{
163
+		$lcs = 0;
164
+		foreach ($this->_edits as $edit) {
165
+			if (is_a($edit, 'Text_Diff_Op_copy')) {
166
+				$lcs += count($edit->orig);
167
+			}
168
+		}
169
+		return $lcs;
170
+	}
171
+
172
+	/**
173
+	 * Gets the original set of lines.
174
+	 *
175
+	 * This reconstructs the $from_lines parameter passed to the constructor.
176
+	 *
177
+	 * @return array  The original sequence of strings.
178
+	 */
179
+	function getOriginal()
180
+	{
181
+		$lines = array();
182
+		foreach ($this->_edits as $edit) {
183
+			if ($edit->orig) {
184
+				array_splice($lines, count($lines), 0, $edit->orig);
185
+			}
186
+		}
187
+		return $lines;
188
+	}
189
+
190
+	/**
191
+	 * Gets the final set of lines.
192
+	 *
193
+	 * This reconstructs the $to_lines parameter passed to the constructor.
194
+	 *
195
+	 * @return array  The sequence of strings.
196
+	 */
197
+	function getFinal()
198
+	{
199
+		$lines = array();
200
+		foreach ($this->_edits as $edit) {
201
+			if ($edit->final) {
202
+				array_splice($lines, count($lines), 0, $edit->final);
203
+			}
204
+		}
205
+		return $lines;
206
+	}
207
+
208
+	/**
209
+	 * Removes trailing newlines from a line of text. This is meant to be used
210
+	 * with array_walk().
211
+	 *
212
+	 * @param string $line  The line to trim.
213
+	 * @param integer $key  The index of the line in the array. Not used.
214
+	 */
215
+	static function trimNewlines(&$line, $key)
216
+	{
217
+		$line = str_replace(array("\n", "\r"), '', $line);
218
+	}
219
+
220
+	/**
221
+	 * Determines the location of the system temporary directory.
222
+	 *
223
+	 * @static
224
+	 *
225
+	 * @access protected
226
+	 *
227
+	 * @return string  A directory name which can be used for temp files.
228
+	 *                 Returns false if one could not be found.
229
+	 */
230
+	function _getTempDir()
231
+	{
232
+		$tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp',
233
+							   'c:\windows\temp', 'c:\winnt\temp');
234
+
235
+		/* Try PHP's upload_tmp_dir directive. */
236
+		$tmp = ini_get('upload_tmp_dir');
237
+
238
+		/* Otherwise, try to determine the TMPDIR environment variable. */
239
+		if (!strlen($tmp)) {
240
+			$tmp = getenv('TMPDIR');
241
+		}
242
+
243
+		/* If we still cannot determine a value, then cycle through a list of
244 244
          * preset possibilities. */
245
-        while (!strlen($tmp) && count($tmp_locations)) {
246
-            $tmp_check = array_shift($tmp_locations);
247
-            if (@is_dir($tmp_check)) {
248
-                $tmp = $tmp_check;
249
-            }
250
-        }
251
-
252
-        /* If it is still empty, we have failed, so return false; otherwise
245
+		while (!strlen($tmp) && count($tmp_locations)) {
246
+			$tmp_check = array_shift($tmp_locations);
247
+			if (@is_dir($tmp_check)) {
248
+				$tmp = $tmp_check;
249
+			}
250
+		}
251
+
252
+		/* If it is still empty, we have failed, so return false; otherwise
253 253
          * return the directory determined. */
254
-        return strlen($tmp) ? $tmp : false;
255
-    }
256
-
257
-    /**
258
-     * Checks a diff for validity.
259
-     *
260
-     * This is here only for debugging purposes.
261
-     */
262
-    function _check($from_lines, $to_lines)
263
-    {
264
-        if (serialize($from_lines) != serialize($this->getOriginal())) {
265
-            trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
266
-        }
267
-        if (serialize($to_lines) != serialize($this->getFinal())) {
268
-            trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
269
-        }
270
-
271
-        $rev = $this->reverse();
272
-        if (serialize($to_lines) != serialize($rev->getOriginal())) {
273
-            trigger_error("Reversed original doesn't match", E_USER_ERROR);
274
-        }
275
-        if (serialize($from_lines) != serialize($rev->getFinal())) {
276
-            trigger_error("Reversed final doesn't match", E_USER_ERROR);
277
-        }
278
-
279
-        $prevtype = null;
280
-        foreach ($this->_edits as $edit) {
281
-            if ($prevtype == get_class($edit)) {
282
-                trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
283
-            }
284
-            $prevtype = get_class($edit);
285
-        }
286
-
287
-        return true;
288
-    }
254
+		return strlen($tmp) ? $tmp : false;
255
+	}
256
+
257
+	/**
258
+	 * Checks a diff for validity.
259
+	 *
260
+	 * This is here only for debugging purposes.
261
+	 */
262
+	function _check($from_lines, $to_lines)
263
+	{
264
+		if (serialize($from_lines) != serialize($this->getOriginal())) {
265
+			trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
266
+		}
267
+		if (serialize($to_lines) != serialize($this->getFinal())) {
268
+			trigger_error("Reconstructed final doesn't match", E_USER_ERROR);
269
+		}
270
+
271
+		$rev = $this->reverse();
272
+		if (serialize($to_lines) != serialize($rev->getOriginal())) {
273
+			trigger_error("Reversed original doesn't match", E_USER_ERROR);
274
+		}
275
+		if (serialize($from_lines) != serialize($rev->getFinal())) {
276
+			trigger_error("Reversed final doesn't match", E_USER_ERROR);
277
+		}
278
+
279
+		$prevtype = null;
280
+		foreach ($this->_edits as $edit) {
281
+			if ($prevtype == get_class($edit)) {
282
+				trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
283
+			}
284
+			$prevtype = get_class($edit);
285
+		}
286
+
287
+		return true;
288
+	}
289 289
 
290 290
 }
291 291
 
@@ -295,53 +295,53 @@  discard block
 block discarded – undo
295 295
  */
296 296
 class Text_MappedDiff extends Text_Diff {
297 297
 
298
-    /**
299
-     * Computes a diff between sequences of strings.
300
-     *
301
-     * This can be used to compute things like case-insensitve diffs, or diffs
302
-     * which ignore changes in white-space.
303
-     *
304
-     * @param array $from_lines         An array of strings.
305
-     * @param array $to_lines           An array of strings.
306
-     * @param array $mapped_from_lines  This array should have the same size
307
-     *                                  number of elements as $from_lines.  The
308
-     *                                  elements in $mapped_from_lines and
309
-     *                                  $mapped_to_lines are what is actually
310
-     *                                  compared when computing the diff.
311
-     * @param array $mapped_to_lines    This array should have the same number
312
-     *                                  of elements as $to_lines.
313
-     */
314
-    function __construct($from_lines, $to_lines,
315
-                             $mapped_from_lines, $mapped_to_lines)
316
-    {
317
-        assert(count($from_lines) == count($mapped_from_lines));
318
-        assert(count($to_lines) == count($mapped_to_lines));
319
-
320
-        parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
321
-
322
-        $xi = $yi = 0;
323
-        for ($i = 0; $i < count($this->_edits); $i++) {
324
-            $orig = &$this->_edits[$i]->orig;
325
-            if (is_array($orig)) {
326
-                $orig = array_slice($from_lines, $xi, count($orig));
327
-                $xi += count($orig);
328
-            }
329
-
330
-            $final = &$this->_edits[$i]->final;
331
-            if (is_array($final)) {
332
-                $final = array_slice($to_lines, $yi, count($final));
333
-                $yi += count($final);
334
-            }
335
-        }
336
-    }
298
+	/**
299
+	 * Computes a diff between sequences of strings.
300
+	 *
301
+	 * This can be used to compute things like case-insensitve diffs, or diffs
302
+	 * which ignore changes in white-space.
303
+	 *
304
+	 * @param array $from_lines         An array of strings.
305
+	 * @param array $to_lines           An array of strings.
306
+	 * @param array $mapped_from_lines  This array should have the same size
307
+	 *                                  number of elements as $from_lines.  The
308
+	 *                                  elements in $mapped_from_lines and
309
+	 *                                  $mapped_to_lines are what is actually
310
+	 *                                  compared when computing the diff.
311
+	 * @param array $mapped_to_lines    This array should have the same number
312
+	 *                                  of elements as $to_lines.
313
+	 */
314
+	function __construct($from_lines, $to_lines,
315
+							 $mapped_from_lines, $mapped_to_lines)
316
+	{
317
+		assert(count($from_lines) == count($mapped_from_lines));
318
+		assert(count($to_lines) == count($mapped_to_lines));
319
+
320
+		parent::Text_Diff($mapped_from_lines, $mapped_to_lines);
321
+
322
+		$xi = $yi = 0;
323
+		for ($i = 0; $i < count($this->_edits); $i++) {
324
+			$orig = &$this->_edits[$i]->orig;
325
+			if (is_array($orig)) {
326
+				$orig = array_slice($from_lines, $xi, count($orig));
327
+				$xi += count($orig);
328
+			}
329
+
330
+			$final = &$this->_edits[$i]->final;
331
+			if (is_array($final)) {
332
+				$final = array_slice($to_lines, $yi, count($final));
333
+				$yi += count($final);
334
+			}
335
+		}
336
+	}
337 337
 
338 338
 	/**
339 339
 	 * PHP4 constructor.
340 340
 	 */
341 341
 	public function Text_MappedDiff( $from_lines, $to_lines,
342
-                             $mapped_from_lines, $mapped_to_lines ) {
342
+							 $mapped_from_lines, $mapped_to_lines ) {
343 343
 		self::__construct( $from_lines, $to_lines,
344
-                             $mapped_from_lines, $mapped_to_lines );
344
+							 $mapped_from_lines, $mapped_to_lines );
345 345
 	}
346 346
 
347 347
 }
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
  */
355 355
 class Text_Diff_Op {
356 356
 
357
-    var $orig;
358
-    var $final;
357
+	var $orig;
358
+	var $final;
359 359
 
360
-    function &reverse()
361
-    {
362
-        trigger_error('Abstract method', E_USER_ERROR);
363
-    }
360
+	function &reverse()
361
+	{
362
+		trigger_error('Abstract method', E_USER_ERROR);
363
+	}
364 364
 
365
-    function norig()
366
-    {
367
-        return $this->orig ? count($this->orig) : 0;
368
-    }
365
+	function norig()
366
+	{
367
+		return $this->orig ? count($this->orig) : 0;
368
+	}
369 369
 
370
-    function nfinal()
371
-    {
372
-        return $this->final ? count($this->final) : 0;
373
-    }
370
+	function nfinal()
371
+	{
372
+		return $this->final ? count($this->final) : 0;
373
+	}
374 374
 
375 375
 }
376 376
 
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
 	/**
386 386
 	 * PHP5 constructor.
387 387
 	 */
388
-    function __construct( $orig, $final = false )
389
-    {
390
-        if (!is_array($final)) {
391
-            $final = $orig;
392
-        }
393
-        $this->orig = $orig;
394
-        $this->final = $final;
395
-    }
388
+	function __construct( $orig, $final = false )
389
+	{
390
+		if (!is_array($final)) {
391
+			$final = $orig;
392
+		}
393
+		$this->orig = $orig;
394
+		$this->final = $final;
395
+	}
396 396
 
397 397
 	/**
398 398
 	 * PHP4 constructor.
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		self::__construct( $orig, $final );
402 402
 	}
403 403
 
404
-    function &reverse()
405
-    {
406
-        $reverse = new Text_Diff_Op_copy($this->final, $this->orig);
407
-        return $reverse;
408
-    }
404
+	function &reverse()
405
+	{
406
+		$reverse = new Text_Diff_Op_copy($this->final, $this->orig);
407
+		return $reverse;
408
+	}
409 409
 
410 410
 }
411 411
 
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 	 * PHP5 constructor.
422 422
 	 */
423 423
 	function __construct( $lines )
424
-    {
425
-        $this->orig = $lines;
426
-        $this->final = false;
427
-    }
424
+	{
425
+		$this->orig = $lines;
426
+		$this->final = false;
427
+	}
428 428
 
429 429
 	/**
430 430
 	 * PHP4 constructor.
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 		self::__construct( $lines );
434 434
 	}
435 435
 
436
-    function &reverse()
437
-    {
438
-        $reverse = new Text_Diff_Op_add($this->orig);
439
-        return $reverse;
440
-    }
436
+	function &reverse()
437
+	{
438
+		$reverse = new Text_Diff_Op_add($this->orig);
439
+		return $reverse;
440
+	}
441 441
 
442 442
 }
443 443
 
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * PHP5 constructor.
454 454
 	 */
455
-    function __construct( $lines )
456
-    {
457
-        $this->final = $lines;
458
-        $this->orig = false;
459
-    }
455
+	function __construct( $lines )
456
+	{
457
+		$this->final = $lines;
458
+		$this->orig = false;
459
+	}
460 460
 
461 461
 	/**
462 462
 	 * PHP4 constructor.
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 		self::__construct( $lines );
466 466
 	}
467 467
 
468
-    function &reverse()
469
-    {
470
-        $reverse = new Text_Diff_Op_delete($this->final);
471
-        return $reverse;
472
-    }
468
+	function &reverse()
469
+	{
470
+		$reverse = new Text_Diff_Op_delete($this->final);
471
+		return $reverse;
472
+	}
473 473
 
474 474
 }
475 475
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * PHP5 constructor.
486 486
 	 */
487
-    function __construct( $orig, $final )
488
-    {
489
-        $this->orig = $orig;
490
-        $this->final = $final;
491
-    }
487
+	function __construct( $orig, $final )
488
+	{
489
+		$this->orig = $orig;
490
+		$this->final = $final;
491
+	}
492 492
 
493 493
 	/**
494 494
 	 * PHP4 constructor.
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 		self::__construct( $orig, $final );
498 498
 	}
499 499
 
500
-    function &reverse()
501
-    {
502
-        $reverse = new Text_Diff_Op_change($this->final, $this->orig);
503
-        return $reverse;
504
-    }
500
+	function &reverse()
501
+	{
502
+		$reverse = new Text_Diff_Op_change($this->final, $this->orig);
503
+		return $reverse;
504
+	}
505 505
 
506 506
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
      *                           Normally an array of two arrays, each
34 34
      *                           containing the lines from a file.
35 35
      */
36
-    function __construct( $engine, $params )
36
+    function __construct($engine, $params)
37 37
     {
38 38
         // Backward compatibility workaround.
39
-        if (!is_string($engine)) {
39
+        if ( ! is_string($engine)) {
40 40
             $params = array($engine, $params);
41 41
             $engine = 'auto';
42 42
         }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
         }
49 49
 
50 50
         // WP #7391
51
-        require_once dirname(__FILE__).'/Diff/Engine/' . $engine . '.php';
52
-        $class = 'Text_Diff_Engine_' . $engine;
51
+        require_once dirname(__FILE__).'/Diff/Engine/'.$engine.'.php';
52
+        $class = 'Text_Diff_Engine_'.$engine;
53 53
         $diff_engine = new $class();
54 54
 
55 55
         $this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * PHP4 constructor.
60 60
 	 */
61
-	public function Text_Diff( $engine, $params ) {
62
-		self::__construct( $engine, $params );
61
+	public function Text_Diff($engine, $params) {
62
+		self::__construct($engine, $params);
63 63
 	}
64 64
 
65 65
     /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     function isEmpty()
145 145
     {
146 146
         foreach ($this->_edits as $edit) {
147
-            if (!is_a($edit, 'Text_Diff_Op_copy')) {
147
+            if ( ! is_a($edit, 'Text_Diff_Op_copy')) {
148 148
                 return false;
149 149
             }
150 150
         }
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
         $tmp = ini_get('upload_tmp_dir');
237 237
 
238 238
         /* Otherwise, try to determine the TMPDIR environment variable. */
239
-        if (!strlen($tmp)) {
239
+        if ( ! strlen($tmp)) {
240 240
             $tmp = getenv('TMPDIR');
241 241
         }
242 242
 
243 243
         /* If we still cannot determine a value, then cycle through a list of
244 244
          * preset possibilities. */
245
-        while (!strlen($tmp) && count($tmp_locations)) {
245
+        while ( ! strlen($tmp) && count($tmp_locations)) {
246 246
             $tmp_check = array_shift($tmp_locations);
247 247
             if (@is_dir($tmp_check)) {
248 248
                 $tmp = $tmp_check;
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	/**
339 339
 	 * PHP4 constructor.
340 340
 	 */
341
-	public function Text_MappedDiff( $from_lines, $to_lines,
342
-                             $mapped_from_lines, $mapped_to_lines ) {
343
-		self::__construct( $from_lines, $to_lines,
344
-                             $mapped_from_lines, $mapped_to_lines );
341
+	public function Text_MappedDiff($from_lines, $to_lines,
342
+                             $mapped_from_lines, $mapped_to_lines) {
343
+		self::__construct($from_lines, $to_lines,
344
+                             $mapped_from_lines, $mapped_to_lines);
345 345
 	}
346 346
 
347 347
 }
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	/**
386 386
 	 * PHP5 constructor.
387 387
 	 */
388
-    function __construct( $orig, $final = false )
388
+    function __construct($orig, $final = false)
389 389
     {
390
-        if (!is_array($final)) {
390
+        if ( ! is_array($final)) {
391 391
             $final = $orig;
392 392
         }
393 393
         $this->orig = $orig;
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 	/**
398 398
 	 * PHP4 constructor.
399 399
 	 */
400
-	public function Text_Diff_Op_copy( $orig, $final = false ) {
401
-		self::__construct( $orig, $final );
400
+	public function Text_Diff_Op_copy($orig, $final = false) {
401
+		self::__construct($orig, $final);
402 402
 	}
403 403
 
404 404
     function &reverse()
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	/**
421 421
 	 * PHP5 constructor.
422 422
 	 */
423
-	function __construct( $lines )
423
+	function __construct($lines)
424 424
     {
425 425
         $this->orig = $lines;
426 426
         $this->final = false;
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	/**
430 430
 	 * PHP4 constructor.
431 431
 	 */
432
-	public function Text_Diff_Op_delete( $lines ) {
433
-		self::__construct( $lines );
432
+	public function Text_Diff_Op_delete($lines) {
433
+		self::__construct($lines);
434 434
 	}
435 435
 
436 436
     function &reverse()
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * PHP5 constructor.
454 454
 	 */
455
-    function __construct( $lines )
455
+    function __construct($lines)
456 456
     {
457 457
         $this->final = $lines;
458 458
         $this->orig = false;
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 	/**
462 462
 	 * PHP4 constructor.
463 463
 	 */
464
-	public function Text_Diff_Op_add( $lines ) {
465
-		self::__construct( $lines );
464
+	public function Text_Diff_Op_add($lines) {
465
+		self::__construct($lines);
466 466
 	}
467 467
 
468 468
     function &reverse()
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	/**
485 485
 	 * PHP5 constructor.
486 486
 	 */
487
-    function __construct( $orig, $final )
487
+    function __construct($orig, $final)
488 488
     {
489 489
         $this->orig = $orig;
490 490
         $this->final = $final;
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	/**
494 494
 	 * PHP4 constructor.
495 495
 	 */
496
-	public function Text_Diff_Op_change( $orig, $final ) {
497
-		self::__construct( $orig, $final );
496
+	public function Text_Diff_Op_change($orig, $final) {
497
+		self::__construct($orig, $final);
498 498
 	}
499 499
 
500 500
     function &reverse()
Please login to merge, or discard this patch.
src/wp-includes/feed-atom.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
  * @package WordPress
6 6
  */
7 7
 
8
-header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
8
+header('Content-Type: '.feed_content_type('atom').'; charset='.get_option('blog_charset'), true);
9 9
 $more = 1;
10 10
 
11 11
 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
12 12
 
13 13
 /** This action is documented in wp-includes/feed-rss2.php */
14
-do_action( 'rss_tag_pre', 'atom' );
14
+do_action('rss_tag_pre', 'atom');
15 15
 ?>
16 16
 <feed
17 17
   xmlns="http://www.w3.org/2005/Atom"
18 18
   xmlns:thr="http://purl.org/syndication/thread/1.0"
19
-  xml:lang="<?php bloginfo_rss( 'language' ); ?>"
19
+  xml:lang="<?php bloginfo_rss('language'); ?>"
20 20
   xml:base="<?php bloginfo_rss('url') ?>/wp-atom.php"
21 21
   <?php
22 22
   /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
    *
25 25
    * @since 2.0.0
26 26
    */
27
-  do_action( 'atom_ns' );
27
+  do_action('atom_ns');
28 28
   ?>
29 29
  >
30 30
 	<title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @since 2.0.0
44 44
 	 */
45
-	do_action( 'atom_head' );
45
+	do_action('atom_head');
46 46
 
47
-	while ( have_posts() ) : the_post();
47
+	while (have_posts()) : the_post();
48 48
 	?>
49 49
 	<entry>
50 50
 		<author>
51 51
 			<name><?php the_author() ?></name>
52
-			<?php $author_url = get_the_author_meta('url'); if ( !empty($author_url) ) : ?>
52
+			<?php $author_url = get_the_author_meta('url'); if ( ! empty($author_url)) : ?>
53 53
 			<uri><?php the_author_meta('url')?></uri>
54 54
 			<?php endif;
55 55
 
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
 			 *
59 59
 			 * @since 3.2.0
60 60
 			 */
61
-			do_action( 'atom_author' );
61
+			do_action('atom_author');
62 62
 		?>
63 63
 		</author>
64 64
 		<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
65 65
 		<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>" />
66
-		<id><?php the_guid() ; ?></id>
66
+		<id><?php the_guid(); ?></id>
67 67
 		<updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
68 68
 		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
69 69
 		<?php the_category_rss('atom') ?>
70 70
 		<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
71
-<?php if ( !get_option('rss_use_excerpt') ) : ?>
71
+<?php if ( ! get_option('rss_use_excerpt')) : ?>
72 72
 		<content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content_feed('atom') ?>]]></content>
73 73
 <?php endif; ?>
74 74
 	<?php atom_enclosure();
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @since 2.0.0
79 79
 	 */
80
-	do_action( 'atom_entry' );
80
+	do_action('atom_entry');
81 81
 		?>
82 82
 		<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
83
-		<link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
83
+		<link rel="replies" type="application/atom+xml" href="<?php echo esc_url(get_post_comments_feed_link(0, 'atom')); ?>" thr:count="<?php echo get_comments_number()?>"/>
84 84
 		<thr:total><?php echo get_comments_number()?></thr:total>
85 85
 	</entry>
86
-	<?php endwhile ; ?>
86
+	<?php endwhile; ?>
87 87
 </feed>
Please login to merge, or discard this patch.