Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-content/themes/twentyeleven/inc/widgets.php 2 patches
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 	 * @since Twenty Eleven 2.2
19 19
 	 */
20 20
 	function __construct() {
21
-		parent::__construct( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), array(
21
+		parent::__construct('widget_twentyeleven_ephemera', __('Twenty Eleven Ephemera', 'twentyeleven'), array(
22 22
 			'classname'   => 'widget_twentyeleven_ephemera',
23
-			'description' => __( 'Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven' ),
23
+			'description' => __('Use this widget to list your recent Aside, Status, Quote, and Link posts', 'twentyeleven'),
24 24
 			'customize_selective_refresh' => true,
25
-		) );
25
+		));
26 26
 		$this->alt_option_name = 'widget_twentyeleven_ephemera';
27 27
 
28
-		add_action( 'save_post', array( &$this, 'flush_widget_cache' ) );
29
-		add_action( 'deleted_post', array( &$this, 'flush_widget_cache' ) );
30
-		add_action( 'switch_theme', array( &$this, 'flush_widget_cache' ) );
28
+		add_action('save_post', array(&$this, 'flush_widget_cache'));
29
+		add_action('deleted_post', array(&$this, 'flush_widget_cache'));
30
+		add_action('switch_theme', array(&$this, 'flush_widget_cache'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
 	 * @param array $args     An array of standard parameters for widgets in this theme.
48 48
 	 * @param array $instance An array of settings for this widget instance.
49 49
 	 **/
50
-	function widget( $args, $instance ) {
51
-		$cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
50
+	function widget($args, $instance) {
51
+		$cache = wp_cache_get('widget_twentyeleven_ephemera', 'widget');
52 52
 
53
-		if ( ! is_array( $cache ) )
53
+		if ( ! is_array($cache))
54 54
 			$cache = array();
55 55
 
56
-		if ( ! isset( $args['widget_id'] ) )
56
+		if ( ! isset($args['widget_id']))
57 57
 			$args['widget_id'] = null;
58 58
 
59
-		if ( ! is_customize_preview() && isset( $cache[ $args['widget_id'] ] ) ) {
60
-			echo $cache[ $args['widget_id'] ];
59
+		if ( ! is_customize_preview() && isset($cache[$args['widget_id']])) {
60
+			echo $cache[$args['widget_id']];
61 61
 			return;
62 62
 		}
63 63
 
64 64
 		ob_start();
65
-		extract( $args, EXTR_SKIP );
65
+		extract($args, EXTR_SKIP);
66 66
 
67 67
 		/** This filter is documented in wp-includes/default-widgets.php */
68
-		$args['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base );
68
+		$args['title'] = apply_filters('widget_title', empty($instance['title']) ? __('Ephemera', 'twentyeleven') : $instance['title'], $instance, $this->id_base);
69 69
 
70
-		if ( ! isset( $instance['number'] ) )
70
+		if ( ! isset($instance['number']))
71 71
 			$instance['number'] = '10';
72 72
 
73
-		if ( ! $args['number'] = absint( $instance['number'] ) )
73
+		if ( ! $args['number'] = absint($instance['number']))
74 74
 			$args['number'] = 10;
75 75
 
76 76
 		$ephemera_args = array(
@@ -78,42 +78,42 @@  discard block
 block discarded – undo
78 78
 			'posts_per_page' => $args['number'],
79 79
 			'no_found_rows'  => true,
80 80
 			'post_status'    => 'publish',
81
-			'post__not_in'   => get_option( 'sticky_posts' ),
81
+			'post__not_in'   => get_option('sticky_posts'),
82 82
 			'tax_query'      => array(
83 83
 				array(
84 84
 					'taxonomy' => 'post_format',
85
-					'terms'    => array( 'post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote' ),
85
+					'terms'    => array('post-format-aside', 'post-format-link', 'post-format-status', 'post-format-quote'),
86 86
 					'field'    => 'slug',
87 87
 					'operator' => 'IN',
88 88
 				),
89 89
 			),
90 90
 		);
91
-		$ephemera = new WP_Query( $ephemera_args );
91
+		$ephemera = new WP_Query($ephemera_args);
92 92
 
93
-		if ( $ephemera->have_posts() ) :
93
+		if ($ephemera->have_posts()) :
94 94
 			echo $args['before_widget'];
95 95
 			echo $args['before_title'];
96 96
 			echo $args['title'];
97 97
 			echo $args['after_title'];
98 98
 			?>
99 99
 			<ol>
100
-			<?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?>
100
+			<?php while ($ephemera->have_posts()) : $ephemera->the_post(); ?>
101 101
 
102
-				<?php if ( 'link' != get_post_format() ) : ?>
102
+				<?php if ('link' != get_post_format()) : ?>
103 103
 
104 104
 				<li class="widget-entry-title">
105
-					<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"><?php the_title(); ?></a>
105
+					<a href="<?php echo esc_url(get_permalink()); ?>" rel="bookmark"><?php the_title(); ?></a>
106 106
 					<span class="comments-link">
107
-						<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
107
+						<?php comments_popup_link(__('0 <span class="reply">comments &rarr;</span>', 'twentyeleven'), __('1 <span class="reply">comment &rarr;</span>', 'twentyeleven'), __('% <span class="reply">comments &rarr;</span>', 'twentyeleven')); ?>
108 108
 					</span>
109 109
 				</li>
110 110
 
111 111
 				<?php else : ?>
112 112
 
113 113
 				<li class="widget-entry-title">
114
-					<a href="<?php echo esc_url( twentyeleven_get_first_url() ); ?>" rel="bookmark"><?php the_title(); ?>&nbsp;<span>&rarr;</span></a>
114
+					<a href="<?php echo esc_url(twentyeleven_get_first_url()); ?>" rel="bookmark"><?php the_title(); ?>&nbsp;<span>&rarr;</span></a>
115 115
 					<span class="comments-link">
116
-						<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
116
+						<?php comments_popup_link(__('0 <span class="reply">comments &rarr;</span>', 'twentyeleven'), __('1 <span class="reply">comment &rarr;</span>', 'twentyeleven'), __('% <span class="reply">comments &rarr;</span>', 'twentyeleven')); ?>
117 117
 					</span>
118 118
 				</li>
119 119
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
 		// end check for ephemeral posts
132 132
 		endif;
133 133
 
134
-		$cache[ $args['widget_id'] ] = ob_get_flush();
135
-		if ( ! is_customize_preview() ) {
136
-			wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' );
134
+		$cache[$args['widget_id']] = ob_get_flush();
135
+		if ( ! is_customize_preview()) {
136
+			wp_cache_set('widget_twentyeleven_ephemera', $cache, 'widget');
137 137
 		}
138 138
 
139 139
 	}
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @since Twenty Eleven 1.0
148 148
 	 **/
149
-	function update( $new_instance, $old_instance ) {
149
+	function update($new_instance, $old_instance) {
150 150
 		$instance = $old_instance;
151
-		$instance['title'] = strip_tags( $new_instance['title'] );
151
+		$instance['title'] = strip_tags($new_instance['title']);
152 152
 		$instance['number'] = (int) $new_instance['number'];
153 153
 		$this->flush_widget_cache();
154 154
 
155
-		$alloptions = wp_cache_get( 'alloptions', 'options' );
156
-		if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) )
157
-			delete_option( 'widget_twentyeleven_ephemera' );
155
+		$alloptions = wp_cache_get('alloptions', 'options');
156
+		if (isset($alloptions['widget_twentyeleven_ephemera']))
157
+			delete_option('widget_twentyeleven_ephemera');
158 158
 
159 159
 		return $instance;
160 160
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @since Twenty Eleven 1.0
166 166
 	 */
167 167
 	function flush_widget_cache() {
168
-		wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
168
+		wp_cache_delete('widget_twentyeleven_ephemera', 'widget');
169 169
 	}
170 170
 
171 171
 	/**
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @since Twenty Eleven 1.0
177 177
 	 **/
178
-	function form( $instance ) {
179
-		$title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';
180
-		$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
178
+	function form($instance) {
179
+		$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
180
+		$number = isset($instance['number']) ? absint($instance['number']) : 10;
181 181
 ?>
182
-			<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label>
183
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
182
+			<p><label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'twentyeleven'); ?></label>
183
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
184 184
 
185
-			<p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label>
186
-			<input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3" /></p>
185
+			<p><label for="<?php echo esc_attr($this->get_field_id('number')); ?>"><?php _e('Number of posts to show:', 'twentyeleven'); ?></label>
186
+			<input id="<?php echo esc_attr($this->get_field_id('number')); ?>" name="<?php echo esc_attr($this->get_field_name('number')); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3" /></p>
187 187
 		<?php
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -50,11 +50,13 @@  discard block
 block discarded – undo
50 50
 	function widget( $args, $instance ) {
51 51
 		$cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' );
52 52
 
53
-		if ( ! is_array( $cache ) )
54
-			$cache = array();
53
+		if ( ! is_array( $cache ) ) {
54
+					$cache = array();
55
+		}
55 56
 
56
-		if ( ! isset( $args['widget_id'] ) )
57
-			$args['widget_id'] = null;
57
+		if ( ! isset( $args['widget_id'] ) ) {
58
+					$args['widget_id'] = null;
59
+		}
58 60
 
59 61
 		if ( ! is_customize_preview() && isset( $cache[ $args['widget_id'] ] ) ) {
60 62
 			echo $cache[ $args['widget_id'] ];
@@ -67,11 +69,13 @@  discard block
 block discarded – undo
67 69
 		/** This filter is documented in wp-includes/default-widgets.php */
68 70
 		$args['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Ephemera', 'twentyeleven' ) : $instance['title'], $instance, $this->id_base );
69 71
 
70
-		if ( ! isset( $instance['number'] ) )
71
-			$instance['number'] = '10';
72
+		if ( ! isset( $instance['number'] ) ) {
73
+					$instance['number'] = '10';
74
+		}
72 75
 
73
-		if ( ! $args['number'] = absint( $instance['number'] ) )
74
-			$args['number'] = 10;
76
+		if ( ! $args['number'] = absint( $instance['number'] ) ) {
77
+					$args['number'] = 10;
78
+		}
75 79
 
76 80
 		$ephemera_args = array(
77 81
 			'order'          => 'DESC',
@@ -108,10 +112,13 @@  discard block
 block discarded – undo
108 112
 					</span>
109 113
 				</li>
110 114
 
111
-				<?php else : ?>
115
+				<?php else {
116
+	: ?>
112 117
 
113 118
 				<li class="widget-entry-title">
114
-					<a href="<?php echo esc_url( twentyeleven_get_first_url() ); ?>" rel="bookmark"><?php the_title(); ?>&nbsp;<span>&rarr;</span></a>
119
+					<a href="<?php echo esc_url( twentyeleven_get_first_url() );
120
+}
121
+?>" rel="bookmark"><?php the_title(); ?>&nbsp;<span>&rarr;</span></a>
115 122
 					<span class="comments-link">
116 123
 						<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
117 124
 					</span>
@@ -153,8 +160,9 @@  discard block
 block discarded – undo
153 160
 		$this->flush_widget_cache();
154 161
 
155 162
 		$alloptions = wp_cache_get( 'alloptions', 'options' );
156
-		if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) )
157
-			delete_option( 'widget_twentyeleven_ephemera' );
163
+		if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) ) {
164
+					delete_option( 'widget_twentyeleven_ephemera' );
165
+		}
158 166
 
159 167
 		return $instance;
160 168
 	}
Please login to merge, or discard this patch.
src/wp-admin/options-general.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$right_now = time();
194 194
 		foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) {
195 195
 			if ( $tr['ts'] > $right_now ) {
196
-			    $found = true;
196
+				$found = true;
197 197
 				break;
198 198
 			}
199 199
 		}
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
 	<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
232 232
 <?php
233 233
 	/**
234
-	* Filters the default date formats.
235
-	*
236
-	* @since 2.7.0
237
-	* @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
238
-	*
239
-	* @param array $default_date_formats Array of default date formats.
240
-	*/
234
+	 * Filters the default date formats.
235
+	 *
236
+	 * @since 2.7.0
237
+	 * @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
238
+	 *
239
+	 * @param array $default_date_formats Array of default date formats.
240
+	 */
241 241
 	$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) );
242 242
 
243 243
 	$custom = true;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
269 269
 <?php
270 270
 	/**
271
-	* Filters the default time formats.
272
-	*
273
-	* @since 2.7.0
274
-	*
275
-	* @param array $default_time_formats Array of default time formats.
276
-	*/
271
+	 * Filters the default time formats.
272
+	 *
273
+	 * @since 2.7.0
274
+	 *
275
+	 * @param array $default_time_formats Array of default time formats.
276
+	 */
277 277
 	$time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) );
278 278
 
279 279
 	$custom = true;
Please login to merge, or discard this patch.
Spacing   +98 added lines, -99 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 /** WordPress Translation Install API */
13
-require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
13
+require_once(ABSPATH.'wp-admin/includes/translation-install.php');
14 14
 
15
-if ( ! current_user_can( 'manage_options' ) )
16
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
15
+if ( ! current_user_can('manage_options'))
16
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
17 17
 
18 18
 $title = __('General Settings');
19 19
 $parent_file = 'options-general.php';
@@ -22,35 +22,35 @@  discard block
 block discarded – undo
22 22
 
23 23
 add_action('admin_head', 'options_general_add_js');
24 24
 
25
-$options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' .
26
-	'<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>';
25
+$options_help = '<p>'.__('The fields on this screen determine some of the basics of your site setup.').'</p>'.
26
+	'<p>'.__('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.').'</p>';
27 27
 
28
-if ( ! is_multisite() ) {
29
-	$options_help .= '<p>' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '</p>' .
30
-		'<p>' . __('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.') . '</p>';
28
+if ( ! is_multisite()) {
29
+	$options_help .= '<p>'.__('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.').'</p>'.
30
+		'<p>'.__('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.').'</p>';
31 31
 }
32 32
 
33
-$options_help .= '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' .
34
-	'<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' .
35
-	'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
33
+$options_help .= '<p>'.__('You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).').'</p>'.
34
+	'<p>'.__('UTC means Coordinated Universal Time.').'</p>'.
35
+	'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>';
36 36
 
37
-get_current_screen()->add_help_tab( array(
37
+get_current_screen()->add_help_tab(array(
38 38
 	'id'      => 'overview',
39 39
 	'title'   => __('Overview'),
40 40
 	'content' => $options_help,
41
-) );
41
+));
42 42
 
43 43
 get_current_screen()->set_help_sidebar(
44
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
45
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_General_Screen">Documentation on General Settings</a>') . '</p>' .
46
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
44
+	'<p><strong>'.__('For more information:').'</strong></p>'.
45
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_General_Screen">Documentation on General Settings</a>').'</p>'.
46
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
47 47
 );
48 48
 
49
-include( ABSPATH . 'wp-admin/admin-header.php' );
49
+include(ABSPATH.'wp-admin/admin-header.php');
50 50
 ?>
51 51
 
52 52
 <div class="wrap">
53
-<h1><?php echo esc_html( $title ); ?></h1>
53
+<h1><?php echo esc_html($title); ?></h1>
54 54
 
55 55
 <form method="post" action="options.php" novalidate="novalidate">
56 56
 <?php settings_fields('general'); ?>
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 <tr>
64 64
 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
65 65
 <td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
66
-<p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ) ?></p></td>
66
+<p class="description" id="tagline-description"><?php _e('In a few words, explain what this site is about.') ?></p></td>
67 67
 </tr>
68
-<?php if ( !is_multisite() ) { ?>
68
+<?php if ( ! is_multisite()) { ?>
69 69
 <tr>
70 70
 <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th>
71
-<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td>
71
+<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option('siteurl'); ?>"<?php disabled(defined('WP_SITEURL')); ?> class="regular-text code<?php if (defined('WP_SITEURL')) echo ' disabled' ?>" /></td>
72 72
 </tr>
73 73
 <tr>
74 74
 <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th>
75
-<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" />
76
-<?php if ( ! defined( 'WP_HOME' ) ) : ?>
77
-<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); ?></p></td>
75
+<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option('home'); ?>"<?php disabled(defined('WP_HOME')); ?> class="regular-text code<?php if (defined('WP_HOME')) echo ' disabled' ?>" />
76
+<?php if ( ! defined('WP_HOME')) : ?>
77
+<p class="description" id="home-description"><?php _e('Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>'); ?></p></td>
78 78
 <?php endif; ?>
79 79
 </tr>
80 80
 <tr>
81 81
 <th scope="row"><label for="admin_email"><?php _e('Email Address') ?> </label></th>
82
-<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
83
-<p class="description" id="admin-email-description"><?php _e( 'This address is used for admin purposes, like new user notification.' ) ?></p></td>
82
+<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" />
83
+<p class="description" id="admin-email-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></p></td>
84 84
 </tr>
85 85
 <tr>
86 86
 <th scope="row"><?php _e('Membership') ?></th>
@@ -92,28 +92,28 @@  discard block
 block discarded – undo
92 92
 <tr>
93 93
 <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
94 94
 <td>
95
-<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
95
+<select name="default_role" id="default_role"><?php wp_dropdown_roles(get_option('default_role')); ?></select>
96 96
 </td>
97 97
 </tr>
98 98
 <?php } else { ?>
99 99
 <tr>
100 100
 <th scope="row"><label for="new_admin_email"><?php _e('Email Address') ?> </label></th>
101
-<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
102
-<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ) ?></p>
101
+<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" />
102
+<p class="description" id="new-admin-email-description"><?php _e('This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></p>
103 103
 <?php
104
-$new_admin_email = get_option( 'new_admin_email' );
105
-if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
104
+$new_admin_email = get_option('new_admin_email');
105
+if ($new_admin_email && $new_admin_email != get_option('admin_email')) : ?>
106 106
 <div class="updated inline">
107 107
 <p><?php
108 108
 	printf(
109 109
 		/* translators: %s: new admin email */
110
-		__( 'There is a pending change of the admin email to %s.' ),
111
-		'<code>' . esc_html( $new_admin_email ) . '</code>'
110
+		__('There is a pending change of the admin email to %s.'),
111
+		'<code>'.esc_html($new_admin_email).'</code>'
112 112
 	);
113 113
 	printf(
114 114
 		' <a href="%1$s">%2$s</a>',
115
-		esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ),
116
-		__( 'Cancel' )
115
+		esc_url(wp_nonce_url(admin_url('options.php?dismiss=new_admin_email'), 'dismiss-'.get_current_blog_id().'-new_admin_email')),
116
+		__('Cancel')
117 117
 	);
118 118
 ?></p>
119 119
 </div>
@@ -124,40 +124,40 @@  discard block
 block discarded – undo
124 124
 
125 125
 $languages = get_available_languages();
126 126
 $translations = wp_get_available_translations();
127
-if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
127
+if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array(WPLANG, $languages)) {
128 128
 	$languages[] = WPLANG;
129 129
 }
130
-if ( ! empty( $languages ) || ! empty( $translations ) ) {
130
+if ( ! empty($languages) || ! empty($translations)) {
131 131
 	?>
132 132
 	<tr>
133
-		<th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
133
+		<th scope="row"><label for="WPLANG"><?php _e('Site Language'); ?></label></th>
134 134
 		<td>
135 135
 			<?php
136 136
 			$locale = get_locale();
137
-			if ( ! in_array( $locale, $languages ) ) {
137
+			if ( ! in_array($locale, $languages)) {
138 138
 				$locale = '';
139 139
 			}
140 140
 
141
-			wp_dropdown_languages( array(
141
+			wp_dropdown_languages(array(
142 142
 				'name'         => 'WPLANG',
143 143
 				'id'           => 'WPLANG',
144 144
 				'selected'     => $locale,
145 145
 				'languages'    => $languages,
146 146
 				'translations' => $translations,
147
-				'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(),
148
-			) );
147
+				'show_available_translations' => ( ! is_multisite() || is_super_admin()) && wp_can_install_language_pack(),
148
+			));
149 149
 
150 150
 			// Add note about deprecated WPLANG constant.
151
-			if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
152
-				if ( is_multisite() && current_user_can( 'manage_network_options' )
153
-					|| ! is_multisite() && current_user_can( 'manage_options' ) ) {
151
+			if (defined('WPLANG') && ('' !== WPLANG) && $locale !== WPLANG) {
152
+				if (is_multisite() && current_user_can('manage_network_options')
153
+					|| ! is_multisite() && current_user_can('manage_options')) {
154 154
 					?>
155 155
 					<p class="description">
156
-						<strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
156
+						<strong><?php _e('Note:'); ?></strong> <?php printf(__('The %s constant in your %s file is no longer needed.'), '<code>WPLANG</code>', '<code>wp-config.php</code>'); ?>
157 157
 					</p>
158 158
 					<?php
159 159
 				}
160
-				_deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
160
+				_deprecated_argument('define()', '4.0.0', sprintf(__('The %s constant in your %s file is no longer needed.'), 'WPLANG', 'wp-config.php'));
161 161
 			}
162 162
 			?>
163 163
 		</td>
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
 $check_zone_info = true;
174 174
 
175 175
 // Remove old Etc mappings. Fallback to gmt_offset.
176
-if ( false !== strpos($tzstring,'Etc/GMT') )
176
+if (false !== strpos($tzstring, 'Etc/GMT'))
177 177
 	$tzstring = '';
178 178
 
179
-if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
179
+if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists
180 180
 	$check_zone_info = false;
181
-	if ( 0 == $current_offset )
181
+	if (0 == $current_offset)
182 182
 		$tzstring = 'UTC+0';
183 183
 	elseif ($current_offset < 0)
184
-		$tzstring = 'UTC' . $current_offset;
184
+		$tzstring = 'UTC'.$current_offset;
185 185
 	else
186
-		$tzstring = 'UTC+' . $current_offset;
186
+		$tzstring = 'UTC+'.$current_offset;
187 187
 }
188 188
 
189 189
 ?>
@@ -191,37 +191,37 @@  discard block
 block discarded – undo
191 191
 <td>
192 192
 
193 193
 <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
194
-	<?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?>
194
+	<?php echo wp_timezone_choice($tzstring, get_user_locale()); ?>
195 195
 </select>
196 196
 
197
-<p class="description" id="timezone-description"><?php _e( 'Choose either a city in the same timezone as you or a UTC timezone offset.' ); ?></p>
197
+<p class="description" id="timezone-description"><?php _e('Choose either a city in the same timezone as you or a UTC timezone offset.'); ?></p>
198 198
 
199 199
 <p class="timezone-info">
200 200
 	<span id="utc-time"><?php
201 201
 		/* translators: 1: UTC abbreviation, 2: UTC time */
202
-		printf( __( 'Universal time (%1$s) is %2$s.' ),
203
-			'<abbr>' . __( 'UTC' ) . '</abbr>',
204
-			'<code>' . date_i18n( $timezone_format, false, true ) . '</code>'
202
+		printf(__('Universal time (%1$s) is %2$s.'),
203
+			'<abbr>'.__('UTC').'</abbr>',
204
+			'<code>'.date_i18n($timezone_format, false, true).'</code>'
205 205
 		);
206 206
 	?></span>
207
-<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
207
+<?php if (get_option('timezone_string') || ! empty($current_offset)) : ?>
208 208
 	<span id="local-time"><?php
209 209
 		/* translators: %s: local time */
210
-		printf( __( 'Local time is %s.' ),
211
-			'<code>' . date_i18n( $timezone_format ) . '</code>'
210
+		printf(__('Local time is %s.'),
211
+			'<code>'.date_i18n($timezone_format).'</code>'
212 212
 		);
213 213
 	?></span>
214 214
 <?php endif; ?>
215 215
 </p>
216 216
 
217
-<?php if ( $check_zone_info && $tzstring ) : ?>
217
+<?php if ($check_zone_info && $tzstring) : ?>
218 218
 <p class="timezone-info">
219 219
 <span>
220 220
 	<?php
221 221
 	// Set TZ so localtime works.
222 222
 	date_default_timezone_set($tzstring);
223 223
 	$now = localtime(time(), true);
224
-	if ( $now['tm_isdst'] )
224
+	if ($now['tm_isdst'])
225 225
 		_e('This timezone is currently in daylight saving time.');
226 226
 	else
227 227
 		_e('This timezone is currently in standard time.');
@@ -230,34 +230,33 @@  discard block
 block discarded – undo
230 230
 	<?php
231 231
 	$allowed_zones = timezone_identifiers_list();
232 232
 
233
-	if ( in_array( $tzstring, $allowed_zones) ) {
233
+	if (in_array($tzstring, $allowed_zones)) {
234 234
 		$found = false;
235 235
 		$date_time_zone_selected = new DateTimeZone($tzstring);
236 236
 		$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
237 237
 		$right_now = time();
238
-		foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) {
239
-			if ( $tr['ts'] > $right_now ) {
238
+		foreach (timezone_transitions_get($date_time_zone_selected) as $tr) {
239
+			if ($tr['ts'] > $right_now) {
240 240
 			    $found = true;
241 241
 				break;
242 242
 			}
243 243
 		}
244 244
 
245
-		if ( $found ) {
245
+		if ($found) {
246 246
 			echo ' ';
247 247
 			$message = $tr['isdst'] ?
248 248
 				/* translators: %s: date and time  */
249
-				__( 'Daylight saving time begins on: %s.')  :
250
-				/* translators: %s: date and time  */
251
-				__( 'Standard time begins on: %s.' );
249
+				__('Daylight saving time begins on: %s.') : /* translators: %s: date and time  */
250
+				__('Standard time begins on: %s.');
252 251
 			// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
253
-			printf( $message,
254
-				'<code>' . date_i18n(
255
-					__( 'F j, Y' ) . ' ' . __( 'g:i a' ),
256
-					$tr['ts'] + ( $tz_offset - $tr['offset'] )
257
-				) . '</code>'
252
+			printf($message,
253
+				'<code>'.date_i18n(
254
+					__('F j, Y').' '.__('g:i a'),
255
+					$tr['ts'] + ($tz_offset - $tr['offset'])
256
+				).'</code>'
258 257
 			);
259 258
 		} else {
260
-			_e( 'This timezone does not observe daylight saving time.' );
259
+			_e('This timezone does not observe daylight saving time.');
261 260
 		}
262 261
 	}
263 262
 	// Set back to UTC.
@@ -282,25 +281,25 @@  discard block
 block discarded – undo
282 281
 	*
283 282
 	* @param array $default_date_formats Array of default date formats.
284 283
 	*/
285
-	$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) );
284
+	$date_formats = array_unique(apply_filters('date_formats', array(__('F j, Y'), 'Y-m-d', 'm/d/Y', 'd/m/Y')));
286 285
 
287 286
 	$custom = true;
288 287
 
289
-	foreach ( $date_formats as $format ) {
290
-		echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
291
-		if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
288
+	foreach ($date_formats as $format) {
289
+		echo "\t<label><input type='radio' name='date_format' value='".esc_attr($format)."'";
290
+		if (get_option('date_format') === $format) { // checked() uses "==" rather than "==="
292 291
 			echo " checked='checked'";
293 292
 			$custom = false;
294 293
 		}
295
-		echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
294
+		echo ' /> <span class="date-time-text format-i18n">'.date_i18n($format).'</span><code>'.esc_html($format)."</code></label><br />\n";
296 295
 	}
297 296
 
298 297
 	echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
299
-	checked( $custom );
300
-	echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . '</span></span></label>' .
301
-		'<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label>' .
302
-		'<input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option( 'date_format' ) ) . '" class="small-text" />' .
303
-		'<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'date_format' ) ) . '</span>' .
298
+	checked($custom);
299
+	echo '/> <span class="date-time-text date-time-custom-text">'.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom date format in the following field').'</span></span></label>'.
300
+		'<label for="date_format_custom" class="screen-reader-text">'.__('Custom date format:').'</label>'.
301
+		'<input type="text" name="date_format_custom" id="date_format_custom" value="'.esc_attr(get_option('date_format')).'" class="small-text" />'.
302
+		'<span class="screen-reader-text">'.__('example:').' </span> <span class="example">'.date_i18n(get_option('date_format')).'</span>'.
304 303
 		"<span class='spinner'></span>\n";
305 304
 ?>
306 305
 	</fieldset>
@@ -318,28 +317,28 @@  discard block
 block discarded – undo
318 317
 	*
319 318
 	* @param array $default_time_formats Array of default time formats.
320 319
 	*/
321
-	$time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) );
320
+	$time_formats = array_unique(apply_filters('time_formats', array(__('g:i a'), 'g:i A', 'H:i')));
322 321
 
323 322
 	$custom = true;
324 323
 
325
-	foreach ( $time_formats as $format ) {
326
-		echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
327
-		if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
324
+	foreach ($time_formats as $format) {
325
+		echo "\t<label><input type='radio' name='time_format' value='".esc_attr($format)."'";
326
+		if (get_option('time_format') === $format) { // checked() uses "==" rather than "==="
328 327
 			echo " checked='checked'";
329 328
 			$custom = false;
330 329
 		}
331
-		echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
330
+		echo ' /> <span class="date-time-text format-i18n">'.date_i18n($format).'</span><code>'.esc_html($format)."</code></label><br />\n";
332 331
 	}
333 332
 
334 333
 	echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
335
-	checked( $custom );
336
-	echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . '</span></span></label>' .
337
-		'<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label>' .
338
-		'<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' .
339
-		'<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' .
334
+	checked($custom);
335
+	echo '/> <span class="date-time-text date-time-custom-text">'.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom time format in the following field').'</span></span></label>'.
336
+		'<label for="time_format_custom" class="screen-reader-text">'.__('Custom time format:').'</label>'.
337
+		'<input type="text" name="time_format_custom" id="time_format_custom" value="'.esc_attr(get_option('time_format')).'" class="small-text" />'.
338
+		'<span class="screen-reader-text">'.__('example:').' </span> <span class="example">'.date_i18n(get_option('time_format')).'</span>'.
340 339
 		"<span class='spinner'></span>\n";
341 340
 
342
-	echo "\t<p class='date-time-doc'>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n";
341
+	echo "\t<p class='date-time-doc'>".__('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.')."</p>\n";
343 342
 ?>
344 343
 	</fieldset>
345 344
 </td>
@@ -355,7 +354,7 @@  discard block
 block discarded – undo
355 354
 
356 355
 for ($day_index = 0; $day_index <= 6; $day_index++) :
357 356
 	$selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
358
-	echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
357
+	echo "\n\t<option value='".esc_attr($day_index)."' $selected>".$wp_locale->get_weekday($day_index).'</option>';
359 358
 endfor;
360 359
 ?>
361 360
 </select></td>
@@ -370,4 +369,4 @@  discard block
 block discarded – undo
370 369
 
371 370
 </div>
372 371
 
373
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
372
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +26 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
 /** WordPress Translation Install API */
13 13
 require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
14 14
 
15
-if ( ! current_user_can( 'manage_options' ) )
15
+if ( ! current_user_can( 'manage_options' ) ) {
16 16
 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
17
+}
17 18
 
18 19
 $title = __('General Settings');
19 20
 $parent_file = 'options-general.php';
@@ -68,13 +69,19 @@  discard block
 block discarded – undo
68 69
 <?php if ( !is_multisite() ) { ?>
69 70
 <tr>
70 71
 <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th>
71
-<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td>
72
+<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) {
73
+	echo ' disabled' ?>" /></td>
72 74
 </tr>
73 75
 <tr>
74 76
 <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th>
75
-<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" />
77
+<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' );
78
+}
79
+?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) {
80
+	echo ' disabled' ?>" />
76 81
 <?php if ( ! defined( 'WP_HOME' ) ) : ?>
77
-<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); ?></p></td>
82
+<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' );
83
+}
84
+?></p></td>
78 85
 <?php endif; ?>
79 86
 </tr>
80 87
 <tr>
@@ -173,18 +180,20 @@  discard block
 block discarded – undo
173 180
 $check_zone_info = true;
174 181
 
175 182
 // Remove old Etc mappings. Fallback to gmt_offset.
176
-if ( false !== strpos($tzstring,'Etc/GMT') )
183
+if ( false !== strpos($tzstring,'Etc/GMT') ) {
177 184
 	$tzstring = '';
185
+}
178 186
 
179 187
 if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
180 188
 	$check_zone_info = false;
181
-	if ( 0 == $current_offset )
182
-		$tzstring = 'UTC+0';
183
-	elseif ($current_offset < 0)
184
-		$tzstring = 'UTC' . $current_offset;
185
-	else
186
-		$tzstring = 'UTC+' . $current_offset;
187
-}
189
+	if ( 0 == $current_offset ) {
190
+			$tzstring = 'UTC+0';
191
+	} elseif ($current_offset < 0) {
192
+			$tzstring = 'UTC' . $current_offset;
193
+	} else {
194
+			$tzstring = 'UTC+' . $current_offset;
195
+	}
196
+	}
188 197
 
189 198
 ?>
190 199
 <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
@@ -221,10 +230,11 @@  discard block
 block discarded – undo
221 230
 	// Set TZ so localtime works.
222 231
 	date_default_timezone_set($tzstring);
223 232
 	$now = localtime(time(), true);
224
-	if ( $now['tm_isdst'] )
225
-		_e('This timezone is currently in daylight saving time.');
226
-	else
227
-		_e('This timezone is currently in standard time.');
233
+	if ( $now['tm_isdst'] ) {
234
+			_e('This timezone is currently in daylight saving time.');
235
+	} else {
236
+			_e('This timezone is currently in standard time.');
237
+	}
228 238
 	?>
229 239
 	<br />
230 240
 	<?php
Please login to merge, or discard this patch.
src/wp-admin/includes/class-theme-upgrader.php 2 patches
Braces   +60 added lines, -37 removed lines patch added patch discarded remove patch
@@ -99,8 +99,9 @@  discard block
 block discarded – undo
99 99
 		// Check to see if we need to install a parent theme
100 100
 		$theme_info = $this->theme_info();
101 101
 
102
-		if ( ! $theme_info->parent() )
103
-			return $install_result;
102
+		if ( ! $theme_info->parent() ) {
103
+					return $install_result;
104
+		}
104 105
 
105 106
 		$this->skin->feedback( 'parent_theme_search' );
106 107
 
@@ -140,8 +141,9 @@  discard block
 block discarded – undo
140 141
 			'clear_working' => true
141 142
 		) );
142 143
 
143
-		if ( is_wp_error($parent_result) )
144
-			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
144
+		if ( is_wp_error($parent_result) ) {
145
+					add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
146
+		}
145 147
 
146 148
 		// Start cleaning up after the parents installation
147 149
 		remove_filter('install_theme_complete_actions', '__return_false', 999);
@@ -219,8 +221,9 @@  discard block
 block discarded – undo
219 221
 		remove_filter('upgrader_source_selection', array($this, 'check_package') );
220 222
 		remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
221 223
 
222
-		if ( ! $this->result || is_wp_error($this->result) )
223
-			return $this->result;
224
+		if ( ! $this->result || is_wp_error($this->result) ) {
225
+					return $this->result;
226
+		}
224 227
 
225 228
 		// Refresh the Theme Update information
226 229
 		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
@@ -289,8 +292,9 @@  discard block
 block discarded – undo
289 292
 		remove_filter('upgrader_post_install', array($this, 'current_after'));
290 293
 		remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
291 294
 
292
-		if ( ! $this->result || is_wp_error($this->result) )
293
-			return $this->result;
295
+		if ( ! $this->result || is_wp_error($this->result) ) {
296
+					return $this->result;
297
+		}
294 298
 
295 299
 		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
296 300
 
@@ -348,10 +352,12 @@  discard block
 block discarded – undo
348 352
 		// - a theme with an update available is currently in use.
349 353
 		// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
350 354
 		$maintenance = ( is_multisite() && ! empty( $themes ) );
351
-		foreach ( $themes as $theme )
352
-			$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
353
-		if ( $maintenance )
354
-			$this->maintenance_mode(true);
355
+		foreach ( $themes as $theme ) {
356
+					$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
357
+		}
358
+		if ( $maintenance ) {
359
+					$this->maintenance_mode(true);
360
+		}
355 361
 
356 362
 		$results = array();
357 363
 
@@ -388,8 +394,9 @@  discard block
 block discarded – undo
388 394
 			$results[$theme] = $this->result;
389 395
 
390 396
 			// Prevent credentials auth screen from displaying multiple times
391
-			if ( false === $result )
392
-				break;
397
+			if ( false === $result ) {
398
+							break;
399
+			}
393 400
 		} //end foreach $plugins
394 401
 
395 402
 		$this->maintenance_mode(false);
@@ -436,13 +443,16 @@  discard block
 block discarded – undo
436 443
 	public function check_package( $source ) {
437 444
 		global $wp_filesystem;
438 445
 
439
-		if ( is_wp_error($source) )
440
-			return $source;
446
+		if ( is_wp_error($source) ) {
447
+					return $source;
448
+		}
441 449
 
442 450
 		// Check the folder contains a valid theme
443 451
 		$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source);
444
-		if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation.
452
+		if ( ! is_dir($working_directory) ) {
453
+			// Sanity check, if the above fails, let's not prevent installation.
445 454
 			return $source;
455
+		}
446 456
 
447 457
 		// A proper archive should have a style.css file in the single subdirectory
448 458
 		if ( ! file_exists( $working_directory . 'style.css' ) ) {
@@ -492,16 +502,20 @@  discard block
 block discarded – undo
492 502
 	 * @return bool|WP_Error
493 503
 	 */
494 504
 	public function current_before($return, $theme) {
495
-		if ( is_wp_error($return) )
496
-			return $return;
505
+		if ( is_wp_error($return) ) {
506
+					return $return;
507
+		}
497 508
 
498 509
 		$theme = isset($theme['theme']) ? $theme['theme'] : '';
499 510
 
500
-		if ( $theme != get_stylesheet() ) //If not current
511
+		if ( $theme != get_stylesheet() ) {
512
+			//If not current
501 513
 			return $return;
514
+		}
502 515
 		//Change to maintenance mode now.
503
-		if ( ! $this->bulk )
504
-			$this->maintenance_mode(true);
516
+		if ( ! $this->bulk ) {
517
+					$this->maintenance_mode(true);
518
+		}
505 519
 
506 520
 		return $return;
507 521
 	}
@@ -520,13 +534,16 @@  discard block
 block discarded – undo
520 534
 	 * @return bool|WP_Error
521 535
 	 */
522 536
 	public function current_after($return, $theme) {
523
-		if ( is_wp_error($return) )
524
-			return $return;
537
+		if ( is_wp_error($return) ) {
538
+					return $return;
539
+		}
525 540
 
526 541
 		$theme = isset($theme['theme']) ? $theme['theme'] : '';
527 542
 
528
-		if ( $theme != get_stylesheet() ) // If not current
543
+		if ( $theme != get_stylesheet() ) {
544
+			// If not current
529 545
 			return $return;
546
+		}
530 547
 
531 548
 		// Ensure stylesheet name hasn't changed after the upgrade:
532 549
 		if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
@@ -536,8 +553,9 @@  discard block
 block discarded – undo
536 553
 		}
537 554
 
538 555
 		//Time to remove maintenance mode
539
-		if ( ! $this->bulk )
540
-			$this->maintenance_mode(false);
556
+		if ( ! $this->bulk ) {
557
+					$this->maintenance_mode(false);
558
+		}
541 559
 		return $return;
542 560
 	}
543 561
 
@@ -561,17 +579,21 @@  discard block
 block discarded – undo
561 579
 	public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
562 580
 		global $wp_filesystem;
563 581
 
564
-		if ( is_wp_error( $removed ) )
565
-			return $removed; // Pass errors through.
582
+		if ( is_wp_error( $removed ) ) {
583
+					return $removed;
584
+		}
585
+		// Pass errors through.
566 586
 
567
-		if ( ! isset( $theme['theme'] ) )
568
-			return $removed;
587
+		if ( ! isset( $theme['theme'] ) ) {
588
+					return $removed;
589
+		}
569 590
 
570 591
 		$theme = $theme['theme'];
571 592
 		$themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
572 593
 		if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
573
-			if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) )
574
-				return false;
594
+			if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) ) {
595
+							return false;
596
+			}
575 597
 		}
576 598
 
577 599
 		return true;
@@ -592,10 +614,11 @@  discard block
 block discarded – undo
592 614
 	public function theme_info($theme = null) {
593 615
 
594 616
 		if ( empty($theme) ) {
595
-			if ( !empty($this->result['destination_name']) )
596
-				$theme = $this->result['destination_name'];
597
-			else
598
-				return false;
617
+			if ( !empty($this->result['destination_name']) ) {
618
+							$theme = $this->result['destination_name'];
619
+			} else {
620
+							return false;
621
+			}
599 622
 		}
600 623
 		return wp_get_theme( $theme );
601 624
 	}
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -95,28 +95,28 @@  discard block
 block discarded – undo
95 95
 	 * @param array $child_result
96 96
 	 * @return type
97 97
 	 */
98
-	public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) {
98
+	public function check_parent_theme_filter($install_result, $hook_extra, $child_result) {
99 99
 		// Check to see if we need to install a parent theme
100 100
 		$theme_info = $this->theme_info();
101 101
 
102
-		if ( ! $theme_info->parent() )
102
+		if ( ! $theme_info->parent())
103 103
 			return $install_result;
104 104
 
105
-		$this->skin->feedback( 'parent_theme_search' );
105
+		$this->skin->feedback('parent_theme_search');
106 106
 
107
-		if ( ! $theme_info->parent()->errors() ) {
108
-			$this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version') );
107
+		if ( ! $theme_info->parent()->errors()) {
108
+			$this->skin->feedback('parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version'));
109 109
 			// We already have the theme, fall through.
110 110
 			return $install_result;
111 111
 		}
112 112
 
113 113
 		// We don't have the parent theme, let's install it.
114
-		$api = themes_api('theme_information', array('slug' => $theme_info->get('Template'), 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
114
+		$api = themes_api('theme_information', array('slug' => $theme_info->get('Template'), 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth.
115 115
 
116
-		if ( ! $api || is_wp_error($api) ) {
117
-			$this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') );
116
+		if ( ! $api || is_wp_error($api)) {
117
+			$this->skin->feedback('parent_theme_not_found', $theme_info->get('Template'));
118 118
 			// Don't show activate or preview actions after install
119
-			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
119
+			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions'));
120 120
 			return $install_result;
121 121
 		}
122 122
 
@@ -126,22 +126,22 @@  discard block
 block discarded – undo
126 126
 
127 127
 		// Override them
128 128
 		$this->skin->api = $api;
129
-		$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version);
129
+		$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; //, $api->name, $api->version);
130 130
 
131 131
 		$this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version);
132 132
 
133 133
 		add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme.
134 134
 
135 135
 		// Install the parent theme
136
-		$parent_result = $this->run( array(
136
+		$parent_result = $this->run(array(
137 137
 			'package' => $api->download_link,
138 138
 			'destination' => get_theme_root(),
139 139
 			'clear_destination' => false, //Do not overwrite files.
140 140
 			'clear_working' => true
141
-		) );
141
+		));
142 142
 
143
-		if ( is_wp_error($parent_result) )
144
-			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
143
+		if (is_wp_error($parent_result))
144
+			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions'));
145 145
 
146 146
 		// Start cleaning up after the parents installation
147 147
 		remove_filter('install_theme_complete_actions', '__return_false', 999);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @param array $actions Preview actions.
168 168
 	 * @return array
169 169
 	 */
170
-	public function hide_activate_preview_actions( $actions ) {
170
+	public function hide_activate_preview_actions($actions) {
171 171
 		unset($actions['activate'], $actions['preview']);
172 172
 		return $actions;
173 173
 	}
@@ -189,24 +189,24 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return bool|WP_Error True if the install was successful, false or a WP_Error object otherwise.
191 191
 	 */
192
-	public function install( $package, $args = array() ) {
192
+	public function install($package, $args = array()) {
193 193
 
194 194
 		$defaults = array(
195 195
 			'clear_update_cache' => true,
196 196
 		);
197
-		$parsed_args = wp_parse_args( $args, $defaults );
197
+		$parsed_args = wp_parse_args($args, $defaults);
198 198
 
199 199
 		$this->init();
200 200
 		$this->install_strings();
201 201
 
202
-		add_filter('upgrader_source_selection', array($this, 'check_package') );
202
+		add_filter('upgrader_source_selection', array($this, 'check_package'));
203 203
 		add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
204
-		if ( $parsed_args['clear_update_cache'] ) {
204
+		if ($parsed_args['clear_update_cache']) {
205 205
 			// Clear cache so wp_update_themes() knows about the new theme.
206
-			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
206
+			add_action('upgrader_process_complete', 'wp_clean_themes_cache', 9, 0);
207 207
 		}
208 208
 
209
-		$this->run( array(
209
+		$this->run(array(
210 210
 			'package' => $package,
211 211
 			'destination' => get_theme_root(),
212 212
 			'clear_destination' => false, //Do not overwrite files.
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 				'type' => 'theme',
216 216
 				'action' => 'install',
217 217
 			),
218
-		) );
218
+		));
219 219
 
220
-		remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
221
-		remove_filter('upgrader_source_selection', array($this, 'check_package') );
220
+		remove_action('upgrader_process_complete', 'wp_clean_themes_cache', 9);
221
+		remove_filter('upgrader_source_selection', array($this, 'check_package'));
222 222
 		remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
223 223
 
224
-		if ( ! $this->result || is_wp_error($this->result) )
224
+		if ( ! $this->result || is_wp_error($this->result))
225 225
 			return $this->result;
226 226
 
227 227
 		// Refresh the Theme Update information
228
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
228
+		wp_clean_themes_cache($parsed_args['clear_update_cache']);
229 229
 
230 230
 		return true;
231 231
 	}
@@ -246,39 +246,39 @@  discard block
 block discarded – undo
246 246
 	 * }
247 247
 	 * @return bool|WP_Error True if the upgrade was successful, false or a WP_Error object otherwise.
248 248
 	 */
249
-	public function upgrade( $theme, $args = array() ) {
249
+	public function upgrade($theme, $args = array()) {
250 250
 
251 251
 		$defaults = array(
252 252
 			'clear_update_cache' => true,
253 253
 		);
254
-		$parsed_args = wp_parse_args( $args, $defaults );
254
+		$parsed_args = wp_parse_args($args, $defaults);
255 255
 
256 256
 		$this->init();
257 257
 		$this->upgrade_strings();
258 258
 
259 259
 		// Is an update available?
260
-		$current = get_site_transient( 'update_themes' );
261
-		if ( !isset( $current->response[ $theme ] ) ) {
260
+		$current = get_site_transient('update_themes');
261
+		if ( ! isset($current->response[$theme])) {
262 262
 			$this->skin->before();
263 263
 			$this->skin->set_result(false);
264
-			$this->skin->error( 'up_to_date' );
264
+			$this->skin->error('up_to_date');
265 265
 			$this->skin->after();
266 266
 			return false;
267 267
 		}
268 268
 
269
-		$r = $current->response[ $theme ];
269
+		$r = $current->response[$theme];
270 270
 
271 271
 		add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
272 272
 		add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
273 273
 		add_filter('upgrader_clear_destination', array($this, 'delete_old_theme'), 10, 4);
274
-		if ( $parsed_args['clear_update_cache'] ) {
274
+		if ($parsed_args['clear_update_cache']) {
275 275
 			// Clear cache so wp_update_themes() knows about the new theme.
276
-			add_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9, 0 );
276
+			add_action('upgrader_process_complete', 'wp_clean_themes_cache', 9, 0);
277 277
 		}
278 278
 
279
-		$this->run( array(
279
+		$this->run(array(
280 280
 			'package' => $r['package'],
281
-			'destination' => get_theme_root( $theme ),
281
+			'destination' => get_theme_root($theme),
282 282
 			'clear_destination' => true,
283 283
 			'clear_working' => true,
284 284
 			'hook_extra' => array(
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
 				'type' => 'theme',
287 287
 				'action' => 'update',
288 288
 			),
289
-		) );
289
+		));
290 290
 
291
-		remove_action( 'upgrader_process_complete', 'wp_clean_themes_cache', 9 );
291
+		remove_action('upgrader_process_complete', 'wp_clean_themes_cache', 9);
292 292
 		remove_filter('upgrader_pre_install', array($this, 'current_before'));
293 293
 		remove_filter('upgrader_post_install', array($this, 'current_after'));
294 294
 		remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
295 295
 
296
-		if ( ! $this->result || is_wp_error($this->result) )
296
+		if ( ! $this->result || is_wp_error($this->result))
297 297
 			return $this->result;
298 298
 
299
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
299
+		wp_clean_themes_cache($parsed_args['clear_update_cache']);
300 300
 
301 301
 		return true;
302 302
 	}
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 	 * }
318 318
 	 * @return array[]|false An array of results, or false if unable to connect to the filesystem.
319 319
 	 */
320
-	public function bulk_upgrade( $themes, $args = array() ) {
320
+	public function bulk_upgrade($themes, $args = array()) {
321 321
 
322 322
 		$defaults = array(
323 323
 			'clear_update_cache' => true,
324 324
 		);
325
-		$parsed_args = wp_parse_args( $args, $defaults );
325
+		$parsed_args = wp_parse_args($args, $defaults);
326 326
 
327 327
 		$this->init();
328 328
 		$this->bulk = true;
329 329
 		$this->upgrade_strings();
330 330
 
331
-		$current = get_site_transient( 'update_themes' );
331
+		$current = get_site_transient('update_themes');
332 332
 
333 333
 		add_filter('upgrader_pre_install', array($this, 'current_before'), 10, 2);
334 334
 		add_filter('upgrader_post_install', array($this, 'current_after'), 10, 2);
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 		$this->skin->header();
338 338
 
339 339
 		// Connect to the Filesystem first.
340
-		$res = $this->fs_connect( array(WP_CONTENT_DIR) );
341
-		if ( ! $res ) {
340
+		$res = $this->fs_connect(array(WP_CONTENT_DIR));
341
+		if ( ! $res) {
342 342
 			$this->skin->footer();
343 343
 			return false;
344 344
 		}
@@ -349,63 +349,63 @@  discard block
 block discarded – undo
349 349
 		// - running Multisite and there are one or more themes specified, OR
350 350
 		// - a theme with an update available is currently in use.
351 351
 		// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
352
-		$maintenance = ( is_multisite() && ! empty( $themes ) );
353
-		foreach ( $themes as $theme )
352
+		$maintenance = (is_multisite() && ! empty($themes));
353
+		foreach ($themes as $theme)
354 354
 			$maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template();
355
-		if ( $maintenance )
355
+		if ($maintenance)
356 356
 			$this->maintenance_mode(true);
357 357
 
358 358
 		$results = array();
359 359
 
360 360
 		$this->update_count = count($themes);
361 361
 		$this->update_current = 0;
362
-		foreach ( $themes as $theme ) {
362
+		foreach ($themes as $theme) {
363 363
 			$this->update_current++;
364 364
 
365 365
 			$this->skin->theme_info = $this->theme_info($theme);
366 366
 
367
-			if ( !isset( $current->response[ $theme ] ) ) {
367
+			if ( ! isset($current->response[$theme])) {
368 368
 				$this->skin->set_result(true);
369 369
 				$this->skin->before();
370
-				$this->skin->feedback( 'up_to_date' );
370
+				$this->skin->feedback('up_to_date');
371 371
 				$this->skin->after();
372 372
 				$results[$theme] = true;
373 373
 				continue;
374 374
 			}
375 375
 
376 376
 			// Get the URL to the zip file
377
-			$r = $current->response[ $theme ];
377
+			$r = $current->response[$theme];
378 378
 
379
-			$result = $this->run( array(
379
+			$result = $this->run(array(
380 380
 				'package' => $r['package'],
381
-				'destination' => get_theme_root( $theme ),
381
+				'destination' => get_theme_root($theme),
382 382
 				'clear_destination' => true,
383 383
 				'clear_working' => true,
384 384
 				'is_multi' => true,
385 385
 				'hook_extra' => array(
386 386
 					'theme' => $theme
387 387
 				),
388
-			) );
388
+			));
389 389
 
390 390
 			$results[$theme] = $this->result;
391 391
 
392 392
 			// Prevent credentials auth screen from displaying multiple times
393
-			if ( false === $result )
393
+			if (false === $result)
394 394
 				break;
395 395
 		} //end foreach $plugins
396 396
 
397 397
 		$this->maintenance_mode(false);
398 398
 
399 399
 		// Refresh the Theme Update information
400
-		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
400
+		wp_clean_themes_cache($parsed_args['clear_update_cache']);
401 401
 
402 402
 		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
403
-		do_action( 'upgrader_process_complete', $this, array(
403
+		do_action('upgrader_process_complete', $this, array(
404 404
 			'action' => 'update',
405 405
 			'type' => 'theme',
406 406
 			'bulk' => true,
407 407
 			'themes' => $themes,
408
-		) );
408
+		));
409 409
 
410 410
 		$this->skin->bulk_footer();
411 411
 
@@ -434,43 +434,43 @@  discard block
 block discarded – undo
434 434
 	 * @param string $source The full path to the package source.
435 435
 	 * @return string|WP_Error The source or a WP_Error.
436 436
 	 */
437
-	public function check_package( $source ) {
437
+	public function check_package($source) {
438 438
 		global $wp_filesystem;
439 439
 
440
-		if ( is_wp_error($source) )
440
+		if (is_wp_error($source))
441 441
 			return $source;
442 442
 
443 443
 		// Check the folder contains a valid theme
444
-		$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source);
445
-		if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation.
444
+		$working_directory = str_replace($wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source);
445
+		if ( ! is_dir($working_directory)) // Sanity check, if the above fails, let's not prevent installation.
446 446
 			return $source;
447 447
 
448 448
 		// A proper archive should have a style.css file in the single subdirectory
449
-		if ( ! file_exists( $working_directory . 'style.css' ) ) {
450
-			return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'],
449
+		if ( ! file_exists($working_directory.'style.css')) {
450
+			return new WP_Error('incompatible_archive_theme_no_style', $this->strings['incompatible_archive'],
451 451
 				/* translators: %s: style.css */
452
-				sprintf( __( 'The theme is missing the %s stylesheet.' ),
452
+				sprintf(__('The theme is missing the %s stylesheet.'),
453 453
 					'<code>style.css</code>'
454 454
 				)
455 455
 			);
456 456
 		}
457 457
 
458
-		$info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) );
458
+		$info = get_file_data($working_directory.'style.css', array('Name' => 'Theme Name', 'Template' => 'Template'));
459 459
 
460
-		if ( empty( $info['Name'] ) ) {
461
-			return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'],
460
+		if (empty($info['Name'])) {
461
+			return new WP_Error('incompatible_archive_theme_no_name', $this->strings['incompatible_archive'],
462 462
 				/* translators: %s: style.css */
463
-				sprintf( __( 'The %s stylesheet doesn&#8217;t contain a valid theme header.' ),
463
+				sprintf(__('The %s stylesheet doesn&#8217;t contain a valid theme header.'),
464 464
 					'<code>style.css</code>'
465 465
 				)
466 466
 			);
467 467
 		}
468 468
 
469 469
 		// If it's not a child theme, it must have at least an index.php to be legit.
470
-		if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) ) {
471
-			return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'],
470
+		if (empty($info['Template']) && ! file_exists($working_directory.'index.php')) {
471
+			return new WP_Error('incompatible_archive_theme_no_index', $this->strings['incompatible_archive'],
472 472
 				/* translators: %s: index.php */
473
-				sprintf( __( 'The theme is missing the %s file.' ),
473
+				sprintf(__('The theme is missing the %s file.'),
474 474
 					'<code>index.php</code>'
475 475
 				)
476 476
 			);
@@ -493,15 +493,15 @@  discard block
 block discarded – undo
493 493
 	 * @return bool|WP_Error
494 494
 	 */
495 495
 	public function current_before($return, $theme) {
496
-		if ( is_wp_error($return) )
496
+		if (is_wp_error($return))
497 497
 			return $return;
498 498
 
499 499
 		$theme = isset($theme['theme']) ? $theme['theme'] : '';
500 500
 
501
-		if ( $theme != get_stylesheet() ) //If not current
501
+		if ($theme != get_stylesheet()) //If not current
502 502
 			return $return;
503 503
 		//Change to maintenance mode now.
504
-		if ( ! $this->bulk )
504
+		if ( ! $this->bulk)
505 505
 			$this->maintenance_mode(true);
506 506
 
507 507
 		return $return;
@@ -521,23 +521,23 @@  discard block
 block discarded – undo
521 521
 	 * @return bool|WP_Error
522 522
 	 */
523 523
 	public function current_after($return, $theme) {
524
-		if ( is_wp_error($return) )
524
+		if (is_wp_error($return))
525 525
 			return $return;
526 526
 
527 527
 		$theme = isset($theme['theme']) ? $theme['theme'] : '';
528 528
 
529
-		if ( $theme != get_stylesheet() ) // If not current
529
+		if ($theme != get_stylesheet()) // If not current
530 530
 			return $return;
531 531
 
532 532
 		// Ensure stylesheet name hasn't changed after the upgrade:
533
-		if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
533
+		if ($theme == get_stylesheet() && $theme != $this->result['destination_name']) {
534 534
 			wp_clean_themes_cache();
535 535
 			$stylesheet = $this->result['destination_name'];
536
-			switch_theme( $stylesheet );
536
+			switch_theme($stylesheet);
537 537
 		}
538 538
 
539 539
 		//Time to remove maintenance mode
540
-		if ( ! $this->bulk )
540
+		if ( ! $this->bulk)
541 541
 			$this->maintenance_mode(false);
542 542
 		return $return;
543 543
 	}
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
 	 * @param array  $theme
560 560
 	 * @return bool
561 561
 	 */
562
-	public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
562
+	public function delete_old_theme($removed, $local_destination, $remote_destination, $theme) {
563 563
 		global $wp_filesystem;
564 564
 
565
-		if ( is_wp_error( $removed ) )
565
+		if (is_wp_error($removed))
566 566
 			return $removed; // Pass errors through.
567 567
 
568
-		if ( ! isset( $theme['theme'] ) )
568
+		if ( ! isset($theme['theme']))
569 569
 			return $removed;
570 570
 
571 571
 		$theme = $theme['theme'];
572
-		$themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
573
-		if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
574
-			if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) )
572
+		$themes_dir = trailingslashit($wp_filesystem->wp_themes_dir($theme));
573
+		if ($wp_filesystem->exists($themes_dir.$theme)) {
574
+			if ( ! $wp_filesystem->delete($themes_dir.$theme, true))
575 575
 				return false;
576 576
 		}
577 577
 
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function theme_info($theme = null) {
594 594
 
595
-		if ( empty($theme) ) {
596
-			if ( !empty($this->result['destination_name']) )
595
+		if (empty($theme)) {
596
+			if ( ! empty($this->result['destination_name']))
597 597
 				$theme = $this->result['destination_name'];
598 598
 			else
599 599
 				return false;
600 600
 		}
601
-		return wp_get_theme( $theme );
601
+		return wp_get_theme($theme);
602 602
 	}
603 603
 
604 604
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-bulk-theme-upgrader-skin.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param string $title
27 27
 	 */
28 28
 	public function before($title = '') {
29
-		parent::before( $this->theme_info->display('Name') );
29
+		parent::before($this->theme_info->display('Name'));
30 30
 	}
31 31
 
32 32
 	/**
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @param string $title
35 35
 	 */
36 36
 	public function after($title = '') {
37
-		parent::after( $this->theme_info->display('Name') );
38
-		$this->decrement_update_count( 'theme' );
37
+		parent::after($this->theme_info->display('Name'));
38
+		$this->decrement_update_count('theme');
39 39
 	}
40 40
 
41 41
 	/**
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function bulk_footer() {
45 45
 		parent::bulk_footer();
46
-		$update_actions =  array(
47
-			'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
48
-			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
46
+		$update_actions = array(
47
+			'themes_page' => '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>',
48
+			'updates_page' => '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>'
49 49
 		);
50
-		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
51
-			unset( $update_actions['themes_page'] );
50
+		if ( ! current_user_can('switch_themes') && ! current_user_can('edit_theme_options'))
51
+			unset($update_actions['themes_page']);
52 52
 
53 53
 		/**
54 54
 		 * Filters the list of action links available following bulk theme updates.
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 		 * @param array $update_actions Array of theme action links.
59 59
 		 * @param array $theme_info     Array of information for the last-updated theme.
60 60
 		 */
61
-		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
61
+		$update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
62 62
 
63
-		if ( ! empty($update_actions) )
64
-			$this->feedback(implode(' | ', (array)$update_actions));
63
+		if ( ! empty($update_actions))
64
+			$this->feedback(implode(' | ', (array) $update_actions));
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 			'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
48 48
 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
49 49
 		);
50
-		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
51
-			unset( $update_actions['themes_page'] );
50
+		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
51
+					unset( $update_actions['themes_page'] );
52
+		}
52 53
 
53 54
 		/**
54 55
 		 * Filters the list of action links available following bulk theme updates.
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
 		 */
61 62
 		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
62 63
 
63
-		if ( ! empty($update_actions) )
64
-			$this->feedback(implode(' | ', (array)$update_actions));
64
+		if ( ! empty($update_actions) ) {
65
+					$this->feedback(implode(' | ', (array)$update_actions));
66
+		}
65 67
 	}
66 68
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-language-pack-upgrader.php 2 patches
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -176,8 +176,9 @@  discard block
 block discarded – undo
176 176
 		$this->init();
177 177
 		$this->upgrade_strings();
178 178
 
179
-		if ( ! $language_updates )
180
-			$language_updates = wp_get_translation_updates();
179
+		if ( ! $language_updates ) {
180
+					$language_updates = wp_get_translation_updates();
181
+		}
181 182
 
182 183
 		if ( empty( $language_updates ) ) {
183 184
 			$this->skin->header();
@@ -188,8 +189,9 @@  discard block
 block discarded – undo
188 189
 			return true;
189 190
 		}
190 191
 
191
-		if ( 'upgrader_process_complete' == current_filter() )
192
-			$this->skin->feedback( 'starting_upgrade' );
192
+		if ( 'upgrader_process_complete' == current_filter() ) {
193
+					$this->skin->feedback( 'starting_upgrade' );
194
+		}
193 195
 
194 196
 		// Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230
195 197
 		remove_all_filters( 'upgrader_pre_install' );
@@ -218,9 +220,10 @@  discard block
 block discarded – undo
218 220
 		 * as we then may need to create a /plugins or /themes directory inside of it.
219 221
 		 */
220 222
 		$remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR );
221
-		if ( ! $wp_filesystem->exists( $remote_destination ) )
222
-			if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
223
+		if ( ! $wp_filesystem->exists( $remote_destination ) ) {
224
+					if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
223 225
 				return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
226
+		}
224 227
 
225 228
 		$language_updates_results = array();
226 229
 
@@ -229,10 +232,11 @@  discard block
 block discarded – undo
229 232
 			$this->skin->language_update = $language_update;
230 233
 
231 234
 			$destination = WP_LANG_DIR;
232
-			if ( 'plugin' == $language_update->type )
233
-				$destination .= '/plugins';
234
-			elseif ( 'theme' == $language_update->type )
235
-				$destination .= '/themes';
235
+			if ( 'plugin' == $language_update->type ) {
236
+							$destination .= '/plugins';
237
+			} elseif ( 'theme' == $language_update->type ) {
238
+							$destination .= '/themes';
239
+			}
236 240
 
237 241
 			$this->update_current++;
238 242
 
@@ -317,8 +321,9 @@  discard block
 block discarded – undo
317 321
 	public function check_package( $source, $remote_source ) {
318 322
 		global $wp_filesystem;
319 323
 
320
-		if ( is_wp_error( $source ) )
321
-			return $source;
324
+		if ( is_wp_error( $source ) ) {
325
+					return $source;
326
+		}
322 327
 
323 328
 		// Check that the folder contains a valid language.
324 329
 		$files = $wp_filesystem->dirlist( $remote_source );
@@ -326,10 +331,11 @@  discard block
 block discarded – undo
326 331
 		// Check to see if a .po and .mo exist in the folder.
327 332
 		$po = $mo = false;
328 333
 		foreach ( (array) $files as $file => $filedata ) {
329
-			if ( '.po' == substr( $file, -3 ) )
330
-				$po = true;
331
-			elseif ( '.mo' == substr( $file, -3 ) )
332
-				$mo = true;
334
+			if ( '.po' == substr( $file, -3 ) ) {
335
+							$po = true;
336
+			} elseif ( '.mo' == substr( $file, -3 ) ) {
337
+							$mo = true;
338
+			}
333 339
 		}
334 340
 
335 341
 		if ( ! $mo || ! $po ) {
@@ -361,14 +367,16 @@  discard block
 block discarded – undo
361 367
 
362 368
 			case 'theme':
363 369
 				$theme = wp_get_theme( $update->slug );
364
-				if ( $theme->exists() )
365
-					return $theme->Get( 'Name' );
370
+				if ( $theme->exists() ) {
371
+									return $theme->Get( 'Name' );
372
+				}
366 373
 				break;
367 374
 			case 'plugin':
368 375
 				$plugin_data = get_plugins( '/' . $update->slug );
369 376
 				$plugin_data = reset( $plugin_data );
370
-				if ( $plugin_data )
371
-					return $plugin_data['Name'];
377
+				if ( $plugin_data ) {
378
+									return $plugin_data['Name'];
379
+				}
372 380
 				break;
373 381
 		}
374 382
 		return '';
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 	 *                                    a Language_Pack_Upgrader instance, the method will bail to
51 51
 	 *                                    avoid recursion. Otherwise unused. Default false.
52 52
 	 */
53
-	public static function async_upgrade( $upgrader = false ) {
53
+	public static function async_upgrade($upgrader = false) {
54 54
 		// Avoid recursion.
55
-		if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) {
55
+		if ($upgrader && $upgrader instanceof Language_Pack_Upgrader) {
56 56
 			return;
57 57
 		}
58 58
 
59 59
 		// Nothing to do?
60 60
 		$language_updates = wp_get_translation_updates();
61
-		if ( ! $language_updates ) {
61
+		if ( ! $language_updates) {
62 62
 			return;
63 63
 		}
64 64
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 		 * Noted: this is not the ideal way to accomplish this.
68 68
 		 */
69 69
 		$check_vcs = new WP_Automatic_Updater;
70
-		if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
70
+		if ($check_vcs->is_vcs_checkout(WP_CONTENT_DIR)) {
71 71
 			return;
72 72
 		}
73 73
 
74
-		foreach ( $language_updates as $key => $language_update ) {
75
-			$update = ! empty( $language_update->autoupdate );
74
+		foreach ($language_updates as $key => $language_update) {
75
+			$update = ! empty($language_update->autoupdate);
76 76
 
77 77
 			/**
78 78
 			 * Filters whether to asynchronously update translation for core, a plugin, or a theme.
@@ -82,28 +82,28 @@  discard block
 block discarded – undo
82 82
 			 * @param bool   $update          Whether to update.
83 83
 			 * @param object $language_update The update offer.
84 84
 			 */
85
-			$update = apply_filters( 'async_update_translation', $update, $language_update );
85
+			$update = apply_filters('async_update_translation', $update, $language_update);
86 86
 
87
-			if ( ! $update ) {
88
-				unset( $language_updates[ $key ] );
87
+			if ( ! $update) {
88
+				unset($language_updates[$key]);
89 89
 			}
90 90
 		}
91 91
 
92
-		if ( empty( $language_updates ) ) {
92
+		if (empty($language_updates)) {
93 93
 			return;
94 94
 		}
95 95
 
96 96
 		// Re-use the automatic upgrader skin if the parent upgrader is using it.
97
-		if ( $upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin ) {
97
+		if ($upgrader && $upgrader->skin instanceof Automatic_Upgrader_Skin) {
98 98
 			$skin = $upgrader->skin;
99 99
 		} else {
100
-			$skin = new Language_Pack_Upgrader_Skin( array(
100
+			$skin = new Language_Pack_Upgrader_Skin(array(
101 101
 				'skip_header_footer' => true,
102
-			) );
102
+			));
103 103
 		}
104 104
 
105
-		$lp_upgrader = new Language_Pack_Upgrader( $skin );
106
-		$lp_upgrader->bulk_upgrade( $language_updates );
105
+		$lp_upgrader = new Language_Pack_Upgrader($skin);
106
+		$lp_upgrader->bulk_upgrade($language_updates);
107 107
 	}
108 108
 
109 109
 	/**
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @access public
114 114
 	 */
115 115
 	public function upgrade_strings() {
116
-		$this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' );
117
-		$this->strings['up_to_date'] = __( 'The translations are up to date.' );
118
-		$this->strings['no_package'] = __( 'Update package not available.' );
119
-		$this->strings['downloading_package'] = __( 'Downloading translation from <span class="code">%s</span>&#8230;' );
120
-		$this->strings['unpack_package'] = __( 'Unpacking the update&#8230;' );
121
-		$this->strings['process_failed'] = __( 'Translation update failed.' );
122
-		$this->strings['process_success'] = __( 'Translation updated successfully.' );
116
+		$this->strings['starting_upgrade'] = __('Some of your translations need updating. Sit tight for a few more seconds while we update them as well.');
117
+		$this->strings['up_to_date'] = __('The translations are up to date.');
118
+		$this->strings['no_package'] = __('Update package not available.');
119
+		$this->strings['downloading_package'] = __('Downloading translation from <span class="code">%s</span>&#8230;');
120
+		$this->strings['unpack_package'] = __('Unpacking the update&#8230;');
121
+		$this->strings['process_failed'] = __('Translation update failed.');
122
+		$this->strings['process_success'] = __('Translation updated successfully.');
123 123
 	}
124 124
 
125 125
 	/**
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 	 *                             Language_Pack_Upgrader::bulk_upgrade(). Default empty array.
134 134
 	 * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead.
135 135
 	 */
136
-	public function upgrade( $update = false, $args = array() ) {
137
-		if ( $update ) {
138
-			$update = array( $update );
136
+	public function upgrade($update = false, $args = array()) {
137
+		if ($update) {
138
+			$update = array($update);
139 139
 		}
140 140
 
141
-		$results = $this->bulk_upgrade( $update, $args );
141
+		$results = $this->bulk_upgrade($update, $args);
142 142
 
143
-		if ( ! is_array( $results ) ) {
143
+		if ( ! is_array($results)) {
144 144
 			return $results;
145 145
 		}
146 146
 
@@ -165,73 +165,73 @@  discard block
 block discarded – undo
165 165
 	 * @return array|bool|WP_Error Will return an array of results, or true if there are no updates,
166 166
 	 *                                   false or WP_Error for initial errors.
167 167
 	 */
168
-	public function bulk_upgrade( $language_updates = array(), $args = array() ) {
168
+	public function bulk_upgrade($language_updates = array(), $args = array()) {
169 169
 		global $wp_filesystem;
170 170
 
171 171
 		$defaults = array(
172 172
 			'clear_update_cache' => true,
173 173
 		);
174
-		$parsed_args = wp_parse_args( $args, $defaults );
174
+		$parsed_args = wp_parse_args($args, $defaults);
175 175
 
176 176
 		$this->init();
177 177
 		$this->upgrade_strings();
178 178
 
179
-		if ( ! $language_updates )
179
+		if ( ! $language_updates)
180 180
 			$language_updates = wp_get_translation_updates();
181 181
 
182
-		if ( empty( $language_updates ) ) {
182
+		if (empty($language_updates)) {
183 183
 			$this->skin->header();
184
-			$this->skin->set_result( true );
185
-			$this->skin->feedback( 'up_to_date' );
184
+			$this->skin->set_result(true);
185
+			$this->skin->feedback('up_to_date');
186 186
 			$this->skin->bulk_footer();
187 187
 			$this->skin->footer();
188 188
 			return true;
189 189
 		}
190 190
 
191
-		if ( 'upgrader_process_complete' == current_filter() )
192
-			$this->skin->feedback( 'starting_upgrade' );
191
+		if ('upgrader_process_complete' == current_filter())
192
+			$this->skin->feedback('starting_upgrade');
193 193
 
194 194
 		// Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230
195
-		remove_all_filters( 'upgrader_pre_install' );
196
-		remove_all_filters( 'upgrader_clear_destination' );
197
-		remove_all_filters( 'upgrader_post_install' );
198
-		remove_all_filters( 'upgrader_source_selection' );
195
+		remove_all_filters('upgrader_pre_install');
196
+		remove_all_filters('upgrader_clear_destination');
197
+		remove_all_filters('upgrader_post_install');
198
+		remove_all_filters('upgrader_source_selection');
199 199
 
200
-		add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );
200
+		add_filter('upgrader_source_selection', array($this, 'check_package'), 10, 2);
201 201
 
202 202
 		$this->skin->header();
203 203
 
204 204
 		// Connect to the Filesystem first.
205
-		$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
206
-		if ( ! $res ) {
205
+		$res = $this->fs_connect(array(WP_CONTENT_DIR, WP_LANG_DIR));
206
+		if ( ! $res) {
207 207
 			$this->skin->footer();
208 208
 			return false;
209 209
 		}
210 210
 
211 211
 		$results = array();
212 212
 
213
-		$this->update_count = count( $language_updates );
213
+		$this->update_count = count($language_updates);
214 214
 		$this->update_current = 0;
215 215
 
216 216
 		/*
217 217
 		 * The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists,
218 218
 		 * as we then may need to create a /plugins or /themes directory inside of it.
219 219
 		 */
220
-		$remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR );
221
-		if ( ! $wp_filesystem->exists( $remote_destination ) )
222
-			if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
223
-				return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
220
+		$remote_destination = $wp_filesystem->find_folder(WP_LANG_DIR);
221
+		if ( ! $wp_filesystem->exists($remote_destination))
222
+			if ( ! $wp_filesystem->mkdir($remote_destination, FS_CHMOD_DIR))
223
+				return new WP_Error('mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination);
224 224
 
225 225
 		$language_updates_results = array();
226 226
 
227
-		foreach ( $language_updates as $language_update ) {
227
+		foreach ($language_updates as $language_update) {
228 228
 
229 229
 			$this->skin->language_update = $language_update;
230 230
 
231 231
 			$destination = WP_LANG_DIR;
232
-			if ( 'plugin' == $language_update->type )
232
+			if ('plugin' == $language_update->type)
233 233
 				$destination .= '/plugins';
234
-			elseif ( 'theme' == $language_update->type )
234
+			elseif ('theme' == $language_update->type)
235 235
 				$destination .= '/themes';
236 236
 
237 237
 			$this->update_current++;
@@ -249,51 +249,51 @@  discard block
 block discarded – undo
249 249
 				)
250 250
 			);
251 251
 
252
-			$result = $this->run( $options );
252
+			$result = $this->run($options);
253 253
 
254 254
 			$results[] = $this->result;
255 255
 
256 256
 			// Prevent credentials auth screen from displaying multiple times.
257
-			if ( false === $result ) {
257
+			if (false === $result) {
258 258
 				break;
259 259
 			}
260 260
 
261 261
 			$language_updates_results[] = array(
262 262
 				'language' => $language_update->language,
263 263
 				'type'     => $language_update->type,
264
-				'slug'     => isset( $language_update->slug ) ? $language_update->slug : 'default',
264
+				'slug'     => isset($language_update->slug) ? $language_update->slug : 'default',
265 265
 				'version'  => $language_update->version,
266 266
 			);
267 267
 		}
268 268
 
269 269
 		// Remove upgrade hooks which are not required for translation updates.
270
-		remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
271
-		remove_action( 'upgrader_process_complete', 'wp_version_check' );
272
-		remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
273
-		remove_action( 'upgrader_process_complete', 'wp_update_themes' );
270
+		remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
271
+		remove_action('upgrader_process_complete', 'wp_version_check');
272
+		remove_action('upgrader_process_complete', 'wp_update_plugins');
273
+		remove_action('upgrader_process_complete', 'wp_update_themes');
274 274
 
275 275
 		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
276
-		do_action( 'upgrader_process_complete', $this, array(
276
+		do_action('upgrader_process_complete', $this, array(
277 277
 			'action'       => 'update',
278 278
 			'type'         => 'translation',
279 279
 			'bulk'         => true,
280 280
 			'translations' => $language_updates_results
281
-		) );
281
+		));
282 282
 
283 283
 		// Re-add upgrade hooks.
284
-		add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
285
-		add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
286
-		add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
287
-		add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
284
+		add_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
285
+		add_action('upgrader_process_complete', 'wp_version_check', 10, 0);
286
+		add_action('upgrader_process_complete', 'wp_update_plugins', 10, 0);
287
+		add_action('upgrader_process_complete', 'wp_update_themes', 10, 0);
288 288
 
289 289
 		$this->skin->bulk_footer();
290 290
 
291 291
 		$this->skin->footer();
292 292
 
293 293
 		// Clean up our hooks, in case something else does an upgrade on this connection.
294
-		remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
294
+		remove_filter('upgrader_source_selection', array($this, 'check_package'));
295 295
 
296
-		if ( $parsed_args['clear_update_cache'] ) {
296
+		if ($parsed_args['clear_update_cache']) {
297 297
 			wp_clean_update_cache();
298 298
 		}
299 299
 
@@ -314,28 +314,28 @@  discard block
 block discarded – undo
314 314
 	 * @param string|WP_Error $source
315 315
 	 * @param string          $remote_source
316 316
 	 */
317
-	public function check_package( $source, $remote_source ) {
317
+	public function check_package($source, $remote_source) {
318 318
 		global $wp_filesystem;
319 319
 
320
-		if ( is_wp_error( $source ) )
320
+		if (is_wp_error($source))
321 321
 			return $source;
322 322
 
323 323
 		// Check that the folder contains a valid language.
324
-		$files = $wp_filesystem->dirlist( $remote_source );
324
+		$files = $wp_filesystem->dirlist($remote_source);
325 325
 
326 326
 		// Check to see if a .po and .mo exist in the folder.
327 327
 		$po = $mo = false;
328
-		foreach ( (array) $files as $file => $filedata ) {
329
-			if ( '.po' == substr( $file, -3 ) )
328
+		foreach ((array) $files as $file => $filedata) {
329
+			if ('.po' == substr($file, -3))
330 330
 				$po = true;
331
-			elseif ( '.mo' == substr( $file, -3 ) )
331
+			elseif ('.mo' == substr($file, -3))
332 332
 				$mo = true;
333 333
 		}
334 334
 
335
-		if ( ! $mo || ! $po ) {
336
-			return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'],
335
+		if ( ! $mo || ! $po) {
336
+			return new WP_Error('incompatible_archive_pomo', $this->strings['incompatible_archive'],
337 337
 				/* translators: 1: .po 2: .mo */
338
-				sprintf( __( 'The language pack is missing either the %1$s or %2$s files.' ),
338
+				sprintf(__('The language pack is missing either the %1$s or %2$s files.'),
339 339
 					'<code>.po</code>',
340 340
 					'<code>.mo</code>'
341 341
 				)
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 	 * @param object $update The data for an update.
355 355
 	 * @return string The name of the item being updated.
356 356
 	 */
357
-	public function get_name_for_update( $update ) {
358
-		switch ( $update->type ) {
357
+	public function get_name_for_update($update) {
358
+		switch ($update->type) {
359 359
 			case 'core':
360 360
 				return 'WordPress'; // Not translated
361 361
 
362 362
 			case 'theme':
363
-				$theme = wp_get_theme( $update->slug );
364
-				if ( $theme->exists() )
365
-					return $theme->Get( 'Name' );
363
+				$theme = wp_get_theme($update->slug);
364
+				if ($theme->exists())
365
+					return $theme->Get('Name');
366 366
 				break;
367 367
 			case 'plugin':
368
-				$plugin_data = get_plugins( '/' . $update->slug );
369
-				$plugin_data = reset( $plugin_data );
370
-				if ( $plugin_data )
368
+				$plugin_data = get_plugins('/'.$update->slug);
369
+				$plugin_data = reset($plugin_data);
370
+				if ($plugin_data)
371 371
 					return $plugin_data['Name'];
372 372
 				break;
373 373
 		}
Please login to merge, or discard this patch.
src/wp-admin/includes/class-theme-upgrader-skin.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param array $args
22 22
 	 */
23 23
 	public function __construct($args = array()) {
24
-		$defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
24
+		$defaults = array('url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme'));
25 25
 		$args = wp_parse_args($args, $defaults);
26 26
 
27 27
 		$this->theme = $args['theme'];
@@ -33,37 +33,37 @@  discard block
 block discarded – undo
33 33
 	 * @access public
34 34
 	 */
35 35
 	public function after() {
36
-		$this->decrement_update_count( 'theme' );
36
+		$this->decrement_update_count('theme');
37 37
 
38 38
 		$update_actions = array();
39
-		if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
39
+		if ( ! empty($this->upgrader->result['destination_name']) && $theme_info = $this->upgrader->theme_info()) {
40 40
 			$name       = $theme_info->display('Name');
41 41
 			$stylesheet = $this->upgrader->result['destination_name'];
42 42
 			$template   = $theme_info->get_template();
43 43
 
44
-			$activate_link = add_query_arg( array(
44
+			$activate_link = add_query_arg(array(
45 45
 				'action'     => 'activate',
46
-				'template'   => urlencode( $template ),
47
-				'stylesheet' => urlencode( $stylesheet ),
48
-			), admin_url('themes.php') );
49
-			$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
46
+				'template'   => urlencode($template),
47
+				'stylesheet' => urlencode($stylesheet),
48
+			), admin_url('themes.php'));
49
+			$activate_link = wp_nonce_url($activate_link, 'switch-theme_'.$stylesheet);
50 50
 
51
-			if ( get_stylesheet() == $stylesheet ) {
52
-				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
53
-					$update_actions['preview']  = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
51
+			if (get_stylesheet() == $stylesheet) {
52
+				if (current_user_can('edit_theme_options') && current_user_can('customize')) {
53
+					$update_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Customize').'</span><span class="screen-reader-text">'.sprintf(__('Customize &#8220;%s&#8221;'), $name).'</span></a>';
54 54
 				}
55
-			} elseif ( current_user_can( 'switch_themes' ) ) {
56
-				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
57
-					$update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
55
+			} elseif (current_user_can('switch_themes')) {
56
+				if (current_user_can('edit_theme_options') && current_user_can('customize')) {
57
+					$update_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Live Preview').'</span><span class="screen-reader-text">'.sprintf(__('Live Preview &#8220;%s&#8221;'), $name).'</span></a>';
58 58
 				}
59
-				$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
59
+				$update_actions['activate'] = '<a href="'.esc_url($activate_link).'" class="activatelink"><span aria-hidden="true">'.__('Activate').'</span><span class="screen-reader-text">'.sprintf(__('Activate &#8220;%s&#8221;'), $name).'</span></a>';
60 60
 			}
61 61
 
62
-			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
63
-				unset( $update_actions['preview'], $update_actions['activate'] );
62
+			if ( ! $this->result || is_wp_error($this->result) || is_network_admin())
63
+				unset($update_actions['preview'], $update_actions['activate']);
64 64
 		}
65 65
 
66
-		$update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
66
+		$update_actions['themes_page'] = '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>';
67 67
 
68 68
 		/**
69 69
 		 * Filters the list of action links available following a single theme update.
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 		 * @param array  $update_actions Array of theme action links.
74 74
 		 * @param string $theme          Theme directory name.
75 75
 		 */
76
-		$update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
76
+		$update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
77 77
 
78
-		if ( ! empty($update_actions) )
79
-			$this->feedback(implode(' | ', (array)$update_actions));
78
+		if ( ! empty($update_actions))
79
+			$this->feedback(implode(' | ', (array) $update_actions));
80 80
 	}
81 81
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 				$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
60 60
 			}
61 61
 
62
-			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
63
-				unset( $update_actions['preview'], $update_actions['activate'] );
62
+			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {
63
+							unset( $update_actions['preview'], $update_actions['activate'] );
64
+			}
64 65
 		}
65 66
 
66 67
 		$update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
 		 */
76 77
 		$update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
77 78
 
78
-		if ( ! empty($update_actions) )
79
-			$this->feedback(implode(' | ', (array)$update_actions));
79
+		if ( ! empty($update_actions) ) {
80
+					$this->feedback(implode(' | ', (array)$update_actions));
81
+		}
80 82
 	}
81 83
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/image-edit.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		 * @since 3.5.0
521 521
 		 *
522 522
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
523
- 		 * @param array           $changes Array of change operations.
523
+		 * @param array           $changes Array of change operations.
524 524
 		 */
525 525
 		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
526 526
 	} elseif ( is_resource( $image ) ) {
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 * @deprecated 3.5.0 Use wp_image_editor_before_change instead.
533 533
 		 *
534 534
 		 * @param resource $image   GD image resource.
535
- 		 * @param array    $changes Array of change operations.
535
+		 * @param array    $changes Array of change operations.
536 536
 		 */
537 537
 		$image = apply_filters( 'image_edit_before_change', $image, $changes );
538 538
 	}
Please login to merge, or discard this patch.
Spacing   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
23
+	if (isset($meta['width'], $meta['height']))
24
+		$big = max($meta['width'], $meta['height']);
25 25
 	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
26
+		die(__('Image data does not exist. Please re-upload the image.'));
27 27
 
28 28
 	$sizer = $big > 400 ? 400 / $big : 1;
29 29
 
30
-	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
30
+	$backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
31 31
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
32
+	if ( ! empty($backup_sizes) && isset($backup_sizes['full-orig'], $meta['file']))
33
+		$can_restore = $backup_sizes['full-orig']['file'] != basename($meta['file']);
34 34
 
35
-	if ( $msg ) {
36
-		if ( isset($msg->error) )
35
+	if ($msg) {
36
+		if (isset($msg->error))
37 37
 			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
38
+		elseif (isset($msg->msg))
39 39
 			$note = "<div class='updated'><p>$msg->msg</p></div>";
40 40
 	}
41 41
 
@@ -46,28 +46,28 @@  discard block
 block discarded – undo
46 46
 	<div class="imgedit-settings">
47 47
 	<div class="imgedit-group">
48 48
 	<div class="imgedit-group-top">
49
-		<h2><?php _e( 'Scale Image' ); ?></h2>
50
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Scale Image Help' ); ?></span></button>
49
+		<h2><?php _e('Scale Image'); ?></h2>
50
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Scale Image Help'); ?></span></button>
51 51
 		<div class="imgedit-help">
52 52
 		<p><?php _e('You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.'); ?></p>
53 53
 		</div>
54
-		<?php if ( isset( $meta['width'], $meta['height'] ) ): ?>
55
-		<p><?php printf( __('Original dimensions %s'), $meta['width'] . ' &times; ' . $meta['height'] ); ?></p>
54
+		<?php if (isset($meta['width'], $meta['height'])): ?>
55
+		<p><?php printf(__('Original dimensions %s'), $meta['width'].' &times; '.$meta['height']); ?></p>
56 56
 		<?php endif ?>
57 57
 		<div class="imgedit-submit">
58 58
 
59 59
 		<fieldset class="imgedit-scale">
60
-		<legend><?php _e( 'New dimensions:' ); ?></legend>
60
+		<legend><?php _e('New dimensions:'); ?></legend>
61 61
 		<div class="nowrap">
62
-		<label><span class="screen-reader-text"><?php _e( 'scale width' ); ?></span>
63
-		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
62
+		<label><span class="screen-reader-text"><?php _e('scale width'); ?></span>
63
+		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1, this)" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
64 64
 		</label>
65 65
 		<span class="imgedit-separator">&times;</span>
66
-		<label><span class="screen-reader-text"><?php _e( 'scale height' ); ?></span>
67
-		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
66
+		<label><span class="screen-reader-text"><?php _e('scale height'); ?></span>
67
+		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0, this)" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
68 68
 		</label>
69 69
 		<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span>
70
-		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
70
+		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e('Scale'); ?>" />
71 71
  		</div>
72 72
 		</fieldset>
73 73
 
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	</div>
76 76
 	</div>
77 77
 
78
-<?php if ( $can_restore ) { ?>
78
+<?php if ($can_restore) { ?>
79 79
 
80 80
 	<div class="imgedit-group">
81 81
 	<div class="imgedit-group-top">
82
-		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e( 'Restore Original Image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
82
+		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e('Restore Original Image'); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
83 83
 		<div class="imgedit-help">
84 84
 		<p><?php _e('Discard any changes and restore the original image.');
85 85
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
86
+		if ( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE)
87 87
 			echo ' '.__('Previously edited copies of the image will not be deleted.');
88 88
 
89 89
 		?></p>
90 90
 		<div class="imgedit-submit">
91
-		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> />
91
+		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e('Restore image'); ?>" <?php echo $can_restore; ?> />
92 92
 		</div>
93 93
 		</div>
94 94
 	</div>
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 	<div class="imgedit-group">
100 100
 	<div class="imgedit-group-top">
101
-		<h2><?php _e( 'Image Crop' ); ?></h2>
102
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Image Crop Help' ); ?></span></button>
101
+		<h2><?php _e('Image Crop'); ?></h2>
102
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Image Crop Help'); ?></span></button>
103 103
 
104 104
 		<div class="imgedit-help">
105 105
 		<p><?php _e('To crop the image, click on it and drag to make your selection.'); ?></p>
@@ -113,26 +113,26 @@  discard block
 block discarded – undo
113 113
 	</div>
114 114
 
115 115
 	<fieldset class="imgedit-crop-ratio">
116
-		<legend><?php _e( 'Aspect ratio:' ); ?></legend>
116
+		<legend><?php _e('Aspect ratio:'); ?></legend>
117 117
 		<div class="nowrap">
118
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio width' ); ?></span>
118
+		<label><span class="screen-reader-text"><?php _e('crop ratio width'); ?></span>
119 119
 		<input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" />
120 120
 		</label>
121 121
 		<span class="imgedit-separator">:</span>
122
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio height' ); ?></span>
122
+		<label><span class="screen-reader-text"><?php _e('crop ratio height'); ?></span>
123 123
 		<input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" onblur="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" />
124 124
 		</label>
125 125
 		</div>
126 126
 	</fieldset>
127 127
 
128 128
 	<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
129
-		<legend><?php _e( 'Selection:' ); ?></legend>
129
+		<legend><?php _e('Selection:'); ?></legend>
130 130
 		<div class="nowrap">
131
-		<label><span class="screen-reader-text"><?php _e( 'selection width' ); ?></span>
131
+		<label><span class="screen-reader-text"><?php _e('selection width'); ?></span>
132 132
 		<input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
133 133
 		</label>
134 134
 		<span class="imgedit-separator">&times;</span>
135
-		<label><span class="screen-reader-text"><?php _e( 'selection height' ); ?></span>
135
+		<label><span class="screen-reader-text"><?php _e('selection height'); ?></span>
136 136
 		<input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" onblur="imageEdit.setNumSelection(<?php echo $post_id; ?>, this)" />
137 137
 		</label>
138 138
 		</div>
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
 
141 141
 	</div>
142 142
 
143
-	<?php if ( $thumb && $sub_sizes ) {
144
-		$thumb_img = wp_constrain_dimensions( $thumb['width'], $thumb['height'], 160, 120 );
143
+	<?php if ($thumb && $sub_sizes) {
144
+		$thumb_img = wp_constrain_dimensions($thumb['width'], $thumb['height'], 160, 120);
145 145
 	?>
146 146
 
147 147
 	<div class="imgedit-group imgedit-applyto">
148 148
 	<div class="imgedit-group-top">
149
-		<h2><?php _e( 'Thumbnail Settings' ); ?></h2>
150
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Thumbnail Settings Help' ); ?></span></button>
149
+		<h2><?php _e('Thumbnail Settings'); ?></h2>
150
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Thumbnail Settings Help'); ?></span></button>
151 151
 		<p class="imgedit-help"><?php _e('You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.'); ?></p>
152 152
 	</div>
153 153
 
154 154
 	<figure class="imgedit-thumbnail-preview">
155 155
 		<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
156
-		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>
156
+		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e('Current thumbnail'); ?></figcaption>
157 157
 	</figure>
158 158
 
159 159
 	<div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target">
160 160
 	<fieldset>
161
-		<legend><strong><?php _e( 'Apply changes to:' ); ?></strong></legend>
161
+		<legend><strong><?php _e('Apply changes to:'); ?></strong></legend>
162 162
 
163 163
 		<label class="imgedit-label">
164 164
 		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" />
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	<div class="imgedit-panel-content wp-clearfix">
183 183
 		<?php echo $note; ?>
184 184
 		<div class="imgedit-menu wp-clearfix">
185
-			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Crop' ); ?></span></button><?php
185
+			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Crop'); ?></span></button><?php
186 186
 
187 187
 		// On some setups GD library does not provide imagerotate() - Ticket #11536
188
-		if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) {
188
+		if (wp_image_editor_supports(array('mime_type' => get_post_mime_type($post_id), 'methods' => array('rotate')))) {
189 189
 			$note_no_rotate = '';
190 190
 	?>
191
-			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate counter-clockwise' ); ?></span></button>
192
-			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate clockwise' ); ?></span></button>
191
+			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate counter-clockwise'); ?></span></button>
192
+			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate clockwise'); ?></span></button>
193 193
 	<?php } else {
194
-			$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
194
+			$note_no_rotate = '<p class="note-no-rotate"><em>'.__('Image rotation is not supported by your web host.').'</em></p>';
195 195
 	?>
196 196
 			<button type="button" class="imgedit-rleft button disabled" disabled></button>
197 197
 			<button type="button" class="imgedit-rright button disabled" disabled></button>
198 198
 	<?php } ?>
199 199
 
200
-			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e( 'Flip vertically' ); ?></span></button>
201
-			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e( 'Flip horizontally' ); ?></span></button>
200
+			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e('Flip vertically'); ?></span></button>
201
+			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e('Flip horizontally'); ?></span></button>
202 202
 
203
-			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Undo' ); ?></span></button>
204
-			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Redo' ); ?></span></button>
203
+			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Undo'); ?></span></button>
204
+			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Redo'); ?></span></button>
205 205
 			<?php echo $note_no_rotate; ?>
206 206
 		</div>
207 207
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 		<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
210 210
 		<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
211 211
 		<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
212
-		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
213
-		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
212
+		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
213
+		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
214 214
 
215 215
 		<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
216
-		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
216
+		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url('admin-ajax.php', 'relative'); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
217 217
 		</div>
218 218
 
219 219
 		<div class="imgedit-submit">
220
-			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e( 'Cancel' ); ?>" />
221
-			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
220
+			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e('Cancel'); ?>" />
221
+			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e('Save'); ?>" />
222 222
 		</div>
223 223
 	</div>
224 224
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
  * @param int $post_id
239 239
  * @return bool
240 240
  */
241
-function wp_stream_image( $image, $mime_type, $post_id ) {
242
-	if ( $image instanceof WP_Image_Editor ) {
241
+function wp_stream_image($image, $mime_type, $post_id) {
242
+	if ($image instanceof WP_Image_Editor) {
243 243
 
244 244
 		/**
245 245
 		 * Filters the WP_Image_Editor instance for the image to be streamed to the browser.
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
250 250
 		 * @param int             $post_id Post ID.
251 251
 		 */
252
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
252
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
253 253
 
254
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
254
+		if (is_wp_error($image->stream($mime_type)))
255 255
 			return false;
256 256
 
257 257
 		return true;
258 258
 	} else {
259
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
259
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
260 260
 
261 261
 		/**
262 262
 		 * Filters the GD image resource to be streamed to the browser.
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 		 * @param resource $image   Image resource to be streamed.
268 268
 		 * @param int      $post_id Post ID.
269 269
 		 */
270
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
270
+		$image = apply_filters('image_save_pre', $image, $post_id);
271 271
 
272
-		switch ( $mime_type ) {
272
+		switch ($mime_type) {
273 273
 			case 'image/jpeg':
274
-				header( 'Content-Type: image/jpeg' );
275
-				return imagejpeg( $image, null, 90 );
274
+				header('Content-Type: image/jpeg');
275
+				return imagejpeg($image, null, 90);
276 276
 			case 'image/png':
277
-				header( 'Content-Type: image/png' );
278
-				return imagepng( $image );
277
+				header('Content-Type: image/png');
278
+				return imagepng($image);
279 279
 			case 'image/gif':
280
-				header( 'Content-Type: image/gif' );
281
-				return imagegif( $image );
280
+				header('Content-Type: image/gif');
281
+				return imagegif($image);
282 282
 			default:
283 283
 				return false;
284 284
 		}
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
  * @param int $post_id
295 295
  * @return bool
296 296
  */
297
-function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
298
-	if ( $image instanceof WP_Image_Editor ) {
297
+function wp_save_image_file($filename, $image, $mime_type, $post_id) {
298
+	if ($image instanceof WP_Image_Editor) {
299 299
 
300 300
 		/** This filter is documented in wp-admin/includes/image-edit.php */
301
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
301
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
302 302
 
303 303
 		/**
304 304
 		 * Filters whether to skip saving the image file.
@@ -314,17 +314,17 @@  discard block
 block discarded – undo
314 314
 		 * @param string          $mime_type Image mime type.
315 315
 		 * @param int             $post_id   Post ID.
316 316
 		 */
317
-		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
317
+		$saved = apply_filters('wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id);
318 318
 
319
-		if ( null !== $saved )
319
+		if (null !== $saved)
320 320
 			return $saved;
321 321
 
322
-		return $image->save( $filename, $mime_type );
322
+		return $image->save($filename, $mime_type);
323 323
 	} else {
324
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
324
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
325 325
 
326 326
 		/** This filter is documented in wp-admin/includes/image-edit.php */
327
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
327
+		$image = apply_filters('image_save_pre', $image, $post_id);
328 328
 
329 329
 		/**
330 330
 		 * Filters whether to skip saving the image file.
@@ -341,20 +341,20 @@  discard block
 block discarded – undo
341 341
 		 * @param string          $mime_type Image mime type.
342 342
 		 * @param int             $post_id   Post ID.
343 343
 		 */
344
-		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
344
+		$saved = apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id);
345 345
 
346
-		if ( null !== $saved )
346
+		if (null !== $saved)
347 347
 			return $saved;
348 348
 
349
-		switch ( $mime_type ) {
349
+		switch ($mime_type) {
350 350
 			case 'image/jpeg':
351 351
 
352 352
 				/** This filter is documented in wp-includes/class-wp-image-editor.php */
353
-				return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) );
353
+				return imagejpeg($image, $filename, apply_filters('jpeg_quality', 90, 'edit_image'));
354 354
 			case 'image/png':
355
-				return imagepng( $image, $filename );
355
+				return imagepng($image, $filename);
356 356
 			case 'image/gif':
357
-				return imagegif( $image, $filename );
357
+				return imagegif($image, $filename);
358 358
 			default:
359 359
 				return false;
360 360
 		}
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
  * @return resource|false GD image resource, false otherwise.
388 388
  */
389 389
 function _rotate_image_resource($img, $angle) {
390
-	_deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' );
391
-	if ( function_exists('imagerotate') ) {
390
+	_deprecated_function(__FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()');
391
+	if (function_exists('imagerotate')) {
392 392
 		$rotated = imagerotate($img, $angle, 0);
393
-		if ( is_resource($rotated) ) {
393
+		if (is_resource($rotated)) {
394 394
 			imagedestroy($img);
395 395
 			$img = $rotated;
396 396
 		}
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
  * @return resource (maybe) flipped image resource.
411 411
  */
412 412
 function _flip_image_resource($img, $horz, $vert) {
413
-	_deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' );
413
+	_deprecated_function(__FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()');
414 414
 	$w = imagesx($img);
415 415
 	$h = imagesy($img);
416 416
 	$dst = wp_imagecreatetruecolor($w, $h);
417
-	if ( is_resource($dst) ) {
417
+	if (is_resource($dst)) {
418 418
 		$sx = $vert ? ($w - 1) : 0;
419 419
 		$sy = $horz ? ($h - 1) : 0;
420 420
 		$sw = $vert ? -$w : $w;
421 421
 		$sh = $horz ? -$h : $h;
422 422
 
423
-		if ( imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh) ) {
423
+		if (imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh)) {
424 424
 			imagedestroy($img);
425 425
 			$img = $dst;
426 426
 		}
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
  */
444 444
 function _crop_image_resource($img, $x, $y, $w, $h) {
445 445
 	$dst = wp_imagecreatetruecolor($w, $h);
446
-	if ( is_resource($dst) ) {
447
-		if ( imagecopy($dst, $img, 0, 0, $x, $y, $w, $h) ) {
446
+	if (is_resource($dst)) {
447
+		if (imagecopy($dst, $img, 0, 0, $x, $y, $w, $h)) {
448 448
 			imagedestroy($img);
449 449
 			$img = $dst;
450 450
 		}
@@ -461,24 +461,24 @@  discard block
 block discarded – undo
461 461
  * @param array           $changes Array of change operations.
462 462
  * @return WP_Image_Editor WP_Image_Editor instance with changes applied.
463 463
  */
464
-function image_edit_apply_changes( $image, $changes ) {
465
-	if ( is_resource( $image ) )
466
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
464
+function image_edit_apply_changes($image, $changes) {
465
+	if (is_resource($image))
466
+		_deprecated_argument(__FUNCTION__, '3.5.0', __('$image needs to be an WP_Image_Editor object'));
467 467
 
468
-	if ( !is_array($changes) )
468
+	if ( ! is_array($changes))
469 469
 		return $image;
470 470
 
471 471
 	// Expand change operations.
472
-	foreach ( $changes as $key => $obj ) {
473
-		if ( isset($obj->r) ) {
472
+	foreach ($changes as $key => $obj) {
473
+		if (isset($obj->r)) {
474 474
 			$obj->type = 'rotate';
475 475
 			$obj->angle = $obj->r;
476 476
 			unset($obj->r);
477
-		} elseif ( isset($obj->f) ) {
477
+		} elseif (isset($obj->f)) {
478 478
 			$obj->type = 'flip';
479 479
 			$obj->axis = $obj->f;
480 480
 			unset($obj->f);
481
-		} elseif ( isset($obj->c) ) {
481
+		} elseif (isset($obj->c)) {
482 482
 			$obj->type = 'crop';
483 483
 			$obj->sel = $obj->c;
484 484
 			unset($obj->c);
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 	}
488 488
 
489 489
 	// Combine operations.
490
-	if ( count($changes) > 1 ) {
490
+	if (count($changes) > 1) {
491 491
 		$filtered = array($changes[0]);
492
-		for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) {
492
+		for ($i = 0, $j = 1, $c = count($changes); $j < $c; $j++) {
493 493
 			$combined = false;
494
-			if ( $filtered[$i]->type == $changes[$j]->type ) {
495
-				switch ( $filtered[$i]->type ) {
494
+			if ($filtered[$i]->type == $changes[$j]->type) {
495
+				switch ($filtered[$i]->type) {
496 496
 					case 'rotate':
497 497
 						$filtered[$i]->angle += $changes[$j]->angle;
498 498
 						$combined = true;
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 						break;
504 504
 				}
505 505
 			}
506
-			if ( !$combined )
506
+			if ( ! $combined)
507 507
 				$filtered[++$i] = $changes[$j];
508 508
 		}
509 509
 		$changes = $filtered;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	}
512 512
 
513 513
 	// Image resource before applying the changes.
514
-	if ( $image instanceof WP_Image_Editor ) {
514
+	if ($image instanceof WP_Image_Editor) {
515 515
 
516 516
 		/**
517 517
 		 * Filters the WP_Image_Editor instance before applying changes to the image.
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
522 522
  		 * @param array           $changes Array of change operations.
523 523
 		 */
524
-		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
525
-	} elseif ( is_resource( $image ) ) {
524
+		$image = apply_filters('wp_image_editor_before_change', $image, $changes);
525
+	} elseif (is_resource($image)) {
526 526
 
527 527
 		/**
528 528
 		 * Filters the GD image resource before applying changes to the image.
@@ -533,39 +533,39 @@  discard block
 block discarded – undo
533 533
 		 * @param resource $image   GD image resource.
534 534
  		 * @param array    $changes Array of change operations.
535 535
 		 */
536
-		$image = apply_filters( 'image_edit_before_change', $image, $changes );
536
+		$image = apply_filters('image_edit_before_change', $image, $changes);
537 537
 	}
538 538
 
539
-	foreach ( $changes as $operation ) {
540
-		switch ( $operation->type ) {
539
+	foreach ($changes as $operation) {
540
+		switch ($operation->type) {
541 541
 			case 'rotate':
542
-				if ( $operation->angle != 0 ) {
543
-					if ( $image instanceof WP_Image_Editor )
544
-						$image->rotate( $operation->angle );
542
+				if ($operation->angle != 0) {
543
+					if ($image instanceof WP_Image_Editor)
544
+						$image->rotate($operation->angle);
545 545
 					else
546
-						$image = _rotate_image_resource( $image, $operation->angle );
546
+						$image = _rotate_image_resource($image, $operation->angle);
547 547
 				}
548 548
 				break;
549 549
 			case 'flip':
550
-				if ( $operation->axis != 0 )
551
-					if ( $image instanceof WP_Image_Editor )
552
-						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
550
+				if ($operation->axis != 0)
551
+					if ($image instanceof WP_Image_Editor)
552
+						$image->flip(($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
553 553
 					else
554
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
554
+						$image = _flip_image_resource($image, ($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
555 555
 				break;
556 556
 			case 'crop':
557 557
 				$sel = $operation->sel;
558 558
 
559
-				if ( $image instanceof WP_Image_Editor ) {
559
+				if ($image instanceof WP_Image_Editor) {
560 560
 					$size = $image->get_size();
561 561
 					$w = $size['width'];
562 562
 					$h = $size['height'];
563 563
 
564
-					$scale = 1 / _image_get_preview_ratio( $w, $h ); // discard preview scaling
565
-					$image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
564
+					$scale = 1 / _image_get_preview_ratio($w, $h); // discard preview scaling
565
+					$image->crop($sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
566 566
 				} else {
567
-					$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // discard preview scaling
568
-					$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
567
+					$scale = 1 / _image_get_preview_ratio(imagesx($image), imagesy($image)); // discard preview scaling
568
+					$image = _crop_image_resource($image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
569 569
 				}
570 570
 				break;
571 571
 		}
@@ -582,34 +582,34 @@  discard block
 block discarded – undo
582 582
  * @param int $post_id
583 583
  * @return bool
584 584
  */
585
-function stream_preview_image( $post_id ) {
586
-	$post = get_post( $post_id );
585
+function stream_preview_image($post_id) {
586
+	$post = get_post($post_id);
587 587
 
588
-	wp_raise_memory_limit( 'admin' );
588
+	wp_raise_memory_limit('admin');
589 589
 
590
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
590
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id));
591 591
 
592
-	if ( is_wp_error( $img ) ) {
592
+	if (is_wp_error($img)) {
593 593
 		return false;
594 594
 	}
595 595
 
596
-	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
597
-	if ( $changes )
598
-		$img = image_edit_apply_changes( $img, $changes );
596
+	$changes = ! empty($_REQUEST['history']) ? json_decode(wp_unslash($_REQUEST['history'])) : null;
597
+	if ($changes)
598
+		$img = image_edit_apply_changes($img, $changes);
599 599
 
600 600
 	// Scale the image.
601 601
 	$size = $img->get_size();
602 602
 	$w = $size['width'];
603 603
 	$h = $size['height'];
604 604
 
605
-	$ratio = _image_get_preview_ratio( $w, $h );
606
-	$w2 = max ( 1, $w * $ratio );
607
-	$h2 = max ( 1, $h * $ratio );
605
+	$ratio = _image_get_preview_ratio($w, $h);
606
+	$w2 = max(1, $w * $ratio);
607
+	$h2 = max(1, $h * $ratio);
608 608
 
609
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
609
+	if (is_wp_error($img->resize($w2, $h2)))
610 610
 		return false;
611 611
 
612
-	return wp_stream_image( $img, $post->post_mime_type, $post_id );
612
+	return wp_stream_image($img, $post->post_mime_type, $post_id);
613 613
 }
614 614
 
615 615
 /**
@@ -623,30 +623,30 @@  discard block
 block discarded – undo
623 623
 function wp_restore_image($post_id) {
624 624
 	$meta = wp_get_attachment_metadata($post_id);
625 625
 	$file = get_attached_file($post_id);
626
-	$backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
626
+	$backup_sizes = $old_backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
627 627
 	$restored = false;
628 628
 	$msg = new stdClass;
629 629
 
630
-	if ( !is_array($backup_sizes) ) {
630
+	if ( ! is_array($backup_sizes)) {
631 631
 		$msg->error = __('Cannot load image metadata.');
632 632
 		return $msg;
633 633
 	}
634 634
 
635 635
 	$parts = pathinfo($file);
636
-	$suffix = time() . rand(100, 999);
636
+	$suffix = time().rand(100, 999);
637 637
 	$default_sizes = get_intermediate_image_sizes();
638 638
 
639
-	if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) {
639
+	if (isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig'])) {
640 640
 		$data = $backup_sizes['full-orig'];
641 641
 
642
-		if ( $parts['basename'] != $data['file'] ) {
643
-			if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
642
+		if ($parts['basename'] != $data['file']) {
643
+			if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
644 644
 
645 645
 				// Delete only if it's an edited image.
646
-				if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
647
-					wp_delete_file( $file );
646
+				if (preg_match('/-e[0-9]{13}\./', $parts['basename'])) {
647
+					wp_delete_file($file);
648 648
 				}
649
-			} elseif ( isset( $meta['width'], $meta['height'] ) ) {
649
+			} elseif (isset($meta['width'], $meta['height'])) {
650 650
 				$backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']);
651 651
 			}
652 652
 		}
@@ -654,21 +654,21 @@  discard block
 block discarded – undo
654 654
 		$restored_file = path_join($parts['dirname'], $data['file']);
655 655
 		$restored = update_attached_file($post_id, $restored_file);
656 656
 
657
-		$meta['file'] = _wp_relative_upload_path( $restored_file );
657
+		$meta['file'] = _wp_relative_upload_path($restored_file);
658 658
 		$meta['width'] = $data['width'];
659 659
 		$meta['height'] = $data['height'];
660 660
 	}
661 661
 
662
-	foreach ( $default_sizes as $default_size ) {
663
-		if ( isset($backup_sizes["$default_size-orig"]) ) {
662
+	foreach ($default_sizes as $default_size) {
663
+		if (isset($backup_sizes["$default_size-orig"])) {
664 664
 			$data = $backup_sizes["$default_size-orig"];
665
-			if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) {
666
-				if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
665
+			if (isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file']) {
666
+				if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
667 667
 
668 668
 					// Delete only if it's an edited image.
669
-					if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) {
670
-						$delete_file = path_join( $parts['dirname'], $meta['sizes'][$default_size]['file'] );
671
-						wp_delete_file( $delete_file );
669
+					if (preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file'])) {
670
+						$delete_file = path_join($parts['dirname'], $meta['sizes'][$default_size]['file']);
671
+						wp_delete_file($delete_file);
672 672
 					}
673 673
 				} else {
674 674
 					$backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size];
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
 		}
682 682
 	}
683 683
 
684
-	if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
685
-		( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
684
+	if ( ! wp_update_attachment_metadata($post_id, $meta) ||
685
+		($old_backup_sizes !== $backup_sizes && ! update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes))) {
686 686
 
687 687
 		$msg->error = __('Cannot save image metadata.');
688 688
 		return $msg;
689 689
 	}
690 690
 
691
-	if ( !$restored )
691
+	if ( ! $restored)
692 692
 		$msg->error = __('Image metadata is inconsistent.');
693 693
 	else
694 694
 		$msg->msg = __('Image restored successfully.');
@@ -703,25 +703,25 @@  discard block
 block discarded – undo
703 703
  * @param int $post_id
704 704
  * @return \stdClass
705 705
  */
706
-function wp_save_image( $post_id ) {
706
+function wp_save_image($post_id) {
707 707
 	$_wp_additional_image_sizes = wp_get_additional_image_sizes();
708 708
 
709 709
 	$return = new stdClass;
710 710
 	$success = $delete = $scaled = $nocrop = false;
711
-	$post = get_post( $post_id );
711
+	$post = get_post($post_id);
712 712
 
713
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
714
-	if ( is_wp_error( $img ) ) {
715
-		$return->error = esc_js( __('Unable to create new image.') );
713
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id, 'full'));
714
+	if (is_wp_error($img)) {
715
+		$return->error = esc_js(__('Unable to create new image.'));
716 716
 		return $return;
717 717
 	}
718 718
 
719
-	$fwidth = !empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
720
-	$fheight = !empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
721
-	$target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
722
-	$scale = !empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
719
+	$fwidth = ! empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
720
+	$fheight = ! empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
721
+	$target = ! empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
722
+	$scale = ! empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
723 723
 
724
-	if ( $scale && $fwidth > 0 && $fheight > 0 ) {
724
+	if ($scale && $fwidth > 0 && $fheight > 0) {
725 725
 		$size = $img->get_size();
726 726
 		$sX = $size['width'];
727 727
 		$sY = $size['height'];
@@ -730,58 +730,58 @@  discard block
 block discarded – undo
730 730
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
731 731
 		if ( -0.1 < $diff && $diff < 0.1 ) {
732 732
 			// Scale the full size image.
733
-			if ( $img->resize( $fwidth, $fheight ) )
733
+			if ($img->resize($fwidth, $fheight))
734 734
 				$scaled = true;
735 735
 		}
736 736
 
737
-		if ( !$scaled ) {
738
-			$return->error = esc_js( __('Error while saving the scaled image. Please reload the page and try again.') );
737
+		if ( ! $scaled) {
738
+			$return->error = esc_js(__('Error while saving the scaled image. Please reload the page and try again.'));
739 739
 			return $return;
740 740
 		}
741
-	} elseif ( !empty($_REQUEST['history']) ) {
742
-		$changes = json_decode( wp_unslash($_REQUEST['history']) );
743
-		if ( $changes )
741
+	} elseif ( ! empty($_REQUEST['history'])) {
742
+		$changes = json_decode(wp_unslash($_REQUEST['history']));
743
+		if ($changes)
744 744
 			$img = image_edit_apply_changes($img, $changes);
745 745
 	} else {
746
-		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
746
+		$return->error = esc_js(__('Nothing to save, the image has not changed.'));
747 747
 		return $return;
748 748
 	}
749 749
 
750 750
 	$meta = wp_get_attachment_metadata($post_id);
751
-	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
751
+	$backup_sizes = get_post_meta($post->ID, '_wp_attachment_backup_sizes', true);
752 752
 
753
-	if ( !is_array($meta) ) {
754
-		$return->error = esc_js( __('Image data does not exist. Please re-upload the image.') );
753
+	if ( ! is_array($meta)) {
754
+		$return->error = esc_js(__('Image data does not exist. Please re-upload the image.'));
755 755
 		return $return;
756 756
 	}
757 757
 
758
-	if ( !is_array($backup_sizes) )
758
+	if ( ! is_array($backup_sizes))
759 759
 		$backup_sizes = array();
760 760
 
761 761
 	// Generate new filename.
762
-	$path = get_attached_file( $post_id );
762
+	$path = get_attached_file($post_id);
763 763
 
764
-	$basename = pathinfo( $path, PATHINFO_BASENAME );
765
-	$dirname = pathinfo( $path, PATHINFO_DIRNAME );
766
-	$ext = pathinfo( $path, PATHINFO_EXTENSION );
767
-	$filename = pathinfo( $path, PATHINFO_FILENAME );
768
-	$suffix = time() . rand(100, 999);
764
+	$basename = pathinfo($path, PATHINFO_BASENAME);
765
+	$dirname = pathinfo($path, PATHINFO_DIRNAME);
766
+	$ext = pathinfo($path, PATHINFO_EXTENSION);
767
+	$filename = pathinfo($path, PATHINFO_FILENAME);
768
+	$suffix = time().rand(100, 999);
769 769
 
770
-	if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
771
-		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $basename ) {
770
+	if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
771
+		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $basename) {
772 772
 
773
-		if ( 'thumbnail' == $target ) {
773
+		if ('thumbnail' == $target) {
774 774
 			$new_path = "{$dirname}/{$filename}-temp.{$ext}";
775 775
 		} else {
776 776
 			$new_path = $path;
777 777
 		}
778 778
 	} else {
779
-		while ( true ) {
780
-			$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
779
+		while (true) {
780
+			$filename = preg_replace('/-e([0-9]+)$/', '', $filename);
781 781
 			$filename .= "-e{$suffix}";
782 782
 			$new_filename = "{$filename}.{$ext}";
783 783
 			$new_path = "{$dirname}/$new_filename";
784
-			if ( file_exists($new_path) ) {
784
+			if (file_exists($new_path)) {
785 785
 				$suffix++;
786 786
 			} else {
787 787
 				break;
@@ -790,42 +790,42 @@  discard block
 block discarded – undo
790 790
 	}
791 791
 
792 792
 	// Save the full-size file, also needed to create sub-sizes.
793
-	if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) {
794
-		$return->error = esc_js( __('Unable to save the image.') );
793
+	if ( ! wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id)) {
794
+		$return->error = esc_js(__('Unable to save the image.'));
795 795
 		return $return;
796 796
 	}
797 797
 
798
-	if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) {
798
+	if ('nothumb' === $target || 'all' === $target || 'full' === $target || $scaled) {
799 799
 		$tag = false;
800
-		if ( isset( $backup_sizes['full-orig'] ) ) {
801
-			if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] !== $basename ) {
800
+		if (isset($backup_sizes['full-orig'])) {
801
+			if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes['full-orig']['file'] !== $basename) {
802 802
 				$tag = "full-$suffix";
803 803
 			}
804 804
 		} else {
805 805
 			$tag = 'full-orig';
806 806
 		}
807 807
 
808
-		if ( $tag ) {
809
-			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $basename );
808
+		if ($tag) {
809
+			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $basename);
810 810
 		}
811
-		$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
811
+		$success = ($path === $new_path) || update_attached_file($post_id, $new_path);
812 812
 
813
-		$meta['file'] = _wp_relative_upload_path( $new_path );
813
+		$meta['file'] = _wp_relative_upload_path($new_path);
814 814
 
815 815
 		$size = $img->get_size();
816 816
 		$meta['width'] = $size['width'];
817 817
 		$meta['height'] = $size['height'];
818 818
 
819
-		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
819
+		if ($success && ('nothumb' == $target || 'all' == $target)) {
820 820
 			$sizes = get_intermediate_image_sizes();
821
-			if ( 'nothumb' == $target )
822
-				$sizes = array_diff( $sizes, array('thumbnail') );
821
+			if ('nothumb' == $target)
822
+				$sizes = array_diff($sizes, array('thumbnail'));
823 823
 		}
824 824
 
825 825
 		$return->fw = $meta['width'];
826 826
 		$return->fh = $meta['height'];
827
-	} elseif ( 'thumbnail' == $target ) {
828
-		$sizes = array( 'thumbnail' );
827
+	} elseif ('thumbnail' == $target) {
828
+		$sizes = array('thumbnail');
829 829
 		$success = $delete = $nocrop = true;
830 830
 	}
831 831
 
@@ -835,63 +835,63 @@  discard block
 block discarded – undo
835 835
 	 * keeping the new resized images from overwriting the existing image files.
836 836
 	 * https://core.trac.wordpress.org/ticket/32171
837 837
 	 */
838
-	if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && ! empty( $meta['sizes'] ) ) {
839
-		foreach ( $meta['sizes'] as $size ) {
840
-			if ( ! empty( $size['file'] ) && preg_match( '/-e[0-9]{13}-/', $size['file'] ) ) {
841
-				$delete_file = path_join( $dirname, $size['file'] );
842
-				wp_delete_file( $delete_file );
838
+	if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE && ! empty($meta['sizes'])) {
839
+		foreach ($meta['sizes'] as $size) {
840
+			if ( ! empty($size['file']) && preg_match('/-e[0-9]{13}-/', $size['file'])) {
841
+				$delete_file = path_join($dirname, $size['file']);
842
+				wp_delete_file($delete_file);
843 843
 			}
844 844
 		}
845 845
 	}
846 846
 
847
-	if ( isset( $sizes ) ) {
847
+	if (isset($sizes)) {
848 848
 		$_sizes = array();
849 849
 
850
-		foreach ( $sizes as $size ) {
850
+		foreach ($sizes as $size) {
851 851
 			$tag = false;
852
-			if ( isset( $meta['sizes'][$size] ) ) {
853
-				if ( isset($backup_sizes["$size-orig"]) ) {
854
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
852
+			if (isset($meta['sizes'][$size])) {
853
+				if (isset($backup_sizes["$size-orig"])) {
854
+					if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'])
855 855
 						$tag = "$size-$suffix";
856 856
 				} else {
857 857
 					$tag = "$size-orig";
858 858
 				}
859 859
 
860
-				if ( $tag )
860
+				if ($tag)
861 861
 					$backup_sizes[$tag] = $meta['sizes'][$size];
862 862
 			}
863 863
 
864
-			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
865
-				$width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
866
-				$height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
867
-				$crop   = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
864
+			if (isset($_wp_additional_image_sizes[$size])) {
865
+				$width  = intval($_wp_additional_image_sizes[$size]['width']);
866
+				$height = intval($_wp_additional_image_sizes[$size]['height']);
867
+				$crop   = ($nocrop) ? false : $_wp_additional_image_sizes[$size]['crop'];
868 868
 			} else {
869
-				$height = get_option( "{$size}_size_h" );
870
-				$width  = get_option( "{$size}_size_w" );
871
-				$crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
869
+				$height = get_option("{$size}_size_h");
870
+				$width  = get_option("{$size}_size_w");
871
+				$crop   = ($nocrop) ? false : get_option("{$size}_crop");
872 872
 			}
873 873
 
874
-			$_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
874
+			$_sizes[$size] = array('width' => $width, 'height' => $height, 'crop' => $crop);
875 875
 		}
876 876
 
877
-		$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
877
+		$meta['sizes'] = array_merge($meta['sizes'], $img->multi_resize($_sizes));
878 878
 	}
879 879
 
880
-	unset( $img );
880
+	unset($img);
881 881
 
882
-	if ( $success ) {
883
-		wp_update_attachment_metadata( $post_id, $meta );
884
-		update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
882
+	if ($success) {
883
+		wp_update_attachment_metadata($post_id, $meta);
884
+		update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes);
885 885
 
886
-		if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
886
+		if ($target == 'thumbnail' || $target == 'all' || $target == 'full') {
887 887
 			// Check if it's an image edit from attachment edit screen
888
-			if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
889
-				$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
888
+			if ( ! empty($_REQUEST['context']) && 'edit-attachment' == $_REQUEST['context']) {
889
+				$thumb_url = wp_get_attachment_image_src($post_id, array(900, 600), true);
890 890
 				$return->thumbnail = $thumb_url[0];
891 891
 			} else {
892 892
 				$file_url = wp_get_attachment_url($post_id);
893
-				if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) {
894
-					$return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
893
+				if ( ! empty($meta['sizes']['thumbnail']) && $thumb = $meta['sizes']['thumbnail']) {
894
+					$return->thumbnail = path_join(dirname($file_url), $thumb['file']);
895 895
 				} else {
896 896
 					$return->thumbnail = "$file_url?w=128&h=128";
897 897
 				}
@@ -901,10 +901,10 @@  discard block
 block discarded – undo
901 901
 		$delete = true;
902 902
 	}
903 903
 
904
-	if ( $delete ) {
905
-		wp_delete_file( $new_path );
904
+	if ($delete) {
905
+		wp_delete_file($new_path);
906 906
 	}
907 907
 
908
-	$return->msg = esc_js( __('Image saved') );
908
+	$return->msg = esc_js(__('Image saved'));
909 909
 	return $return;
910 910
 }
Please login to merge, or discard this patch.
Braces   +73 added lines, -52 removed lines patch added patch discarded remove patch
@@ -20,23 +20,26 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
25
-	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
23
+	if ( isset( $meta['width'], $meta['height'] ) ) {
24
+			$big = max( $meta['width'], $meta['height'] );
25
+	} else {
26
+			die( __('Image data does not exist. Please re-upload the image.') );
27
+	}
27 28
 
28 29
 	$sizer = $big > 400 ? 400 / $big : 1;
29 30
 
30 31
 	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
31 32
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
33
+	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) {
34
+			$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
35
+	}
34 36
 
35 37
 	if ( $msg ) {
36
-		if ( isset($msg->error) )
37
-			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
39
-			$note = "<div class='updated'><p>$msg->msg</p></div>";
38
+		if ( isset($msg->error) ) {
39
+					$note = "<div class='error'><p>$msg->error</p></div>";
40
+		} elseif ( isset($msg->msg) ) {
41
+					$note = "<div class='updated'><p>$msg->msg</p></div>";
42
+		}
40 43
 	}
41 44
 
42 45
 	?>
@@ -83,8 +86,9 @@  discard block
 block discarded – undo
83 86
 		<div class="imgedit-help">
84 87
 		<p><?php _e('Discard any changes and restore the original image.');
85 88
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
87
-			echo ' '.__('Previously edited copies of the image will not be deleted.');
89
+		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) {
90
+					echo ' '.__('Previously edited copies of the image will not be deleted.');
91
+		}
88 92
 
89 93
 		?></p>
90 94
 		<div class="imgedit-submit">
@@ -251,8 +255,9 @@  discard block
 block discarded – undo
251 255
 		 */
252 256
 		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
253 257
 
254
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
255
-			return false;
258
+		if ( is_wp_error( $image->stream( $mime_type ) ) ) {
259
+					return false;
260
+		}
256 261
 
257 262
 		return true;
258 263
 	} else {
@@ -316,8 +321,9 @@  discard block
 block discarded – undo
316 321
 		 */
317 322
 		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
318 323
 
319
-		if ( null !== $saved )
320
-			return $saved;
324
+		if ( null !== $saved ) {
325
+					return $saved;
326
+		}
321 327
 
322 328
 		return $image->save( $filename, $mime_type );
323 329
 	} else {
@@ -343,8 +349,9 @@  discard block
 block discarded – undo
343 349
 		 */
344 350
 		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
345 351
 
346
-		if ( null !== $saved )
347
-			return $saved;
352
+		if ( null !== $saved ) {
353
+					return $saved;
354
+		}
348 355
 
349 356
 		switch ( $mime_type ) {
350 357
 			case 'image/jpeg':
@@ -462,11 +469,13 @@  discard block
 block discarded – undo
462 469
  * @return WP_Image_Editor WP_Image_Editor instance with changes applied.
463 470
  */
464 471
 function image_edit_apply_changes( $image, $changes ) {
465
-	if ( is_resource( $image ) )
466
-		_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
472
+	if ( is_resource( $image ) ) {
473
+			_deprecated_argument( __FUNCTION__, '3.5.0', __( '$image needs to be an WP_Image_Editor object' ) );
474
+	}
467 475
 
468
-	if ( !is_array($changes) )
469
-		return $image;
476
+	if ( !is_array($changes) ) {
477
+			return $image;
478
+	}
470 479
 
471 480
 	// Expand change operations.
472 481
 	foreach ( $changes as $key => $obj ) {
@@ -503,8 +512,9 @@  discard block
 block discarded – undo
503 512
 						break;
504 513
 				}
505 514
 			}
506
-			if ( !$combined )
507
-				$filtered[++$i] = $changes[$j];
515
+			if ( !$combined ) {
516
+							$filtered[++$i] = $changes[$j];
517
+			}
508 518
 		}
509 519
 		$changes = $filtered;
510 520
 		unset($filtered);
@@ -540,18 +550,20 @@  discard block
 block discarded – undo
540 550
 		switch ( $operation->type ) {
541 551
 			case 'rotate':
542 552
 				if ( $operation->angle != 0 ) {
543
-					if ( $image instanceof WP_Image_Editor )
544
-						$image->rotate( $operation->angle );
545
-					else
546
-						$image = _rotate_image_resource( $image, $operation->angle );
553
+					if ( $image instanceof WP_Image_Editor ) {
554
+											$image->rotate( $operation->angle );
555
+					} else {
556
+											$image = _rotate_image_resource( $image, $operation->angle );
557
+					}
547 558
 				}
548 559
 				break;
549 560
 			case 'flip':
550
-				if ( $operation->axis != 0 )
551
-					if ( $image instanceof WP_Image_Editor )
561
+				if ( $operation->axis != 0 ) {
562
+									if ( $image instanceof WP_Image_Editor )
552 563
 						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
553
-					else
554
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
564
+				} else {
565
+											$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
566
+					}
555 567
 				break;
556 568
 			case 'crop':
557 569
 				$sel = $operation->sel;
@@ -594,8 +606,9 @@  discard block
 block discarded – undo
594 606
 	}
595 607
 
596 608
 	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
597
-	if ( $changes )
598
-		$img = image_edit_apply_changes( $img, $changes );
609
+	if ( $changes ) {
610
+			$img = image_edit_apply_changes( $img, $changes );
611
+	}
599 612
 
600 613
 	// Scale the image.
601 614
 	$size = $img->get_size();
@@ -606,8 +619,9 @@  discard block
 block discarded – undo
606 619
 	$w2 = max ( 1, $w * $ratio );
607 620
 	$h2 = max ( 1, $h * $ratio );
608 621
 
609
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
610
-		return false;
622
+	if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) {
623
+			return false;
624
+	}
611 625
 
612 626
 	return wp_stream_image( $img, $post->post_mime_type, $post_id );
613 627
 }
@@ -688,10 +702,11 @@  discard block
 block discarded – undo
688 702
 		return $msg;
689 703
 	}
690 704
 
691
-	if ( !$restored )
692
-		$msg->error = __('Image metadata is inconsistent.');
693
-	else
694
-		$msg->msg = __('Image restored successfully.');
705
+	if ( !$restored ) {
706
+			$msg->error = __('Image metadata is inconsistent.');
707
+	} else {
708
+			$msg->msg = __('Image restored successfully.');
709
+	}
695 710
 
696 711
 	return $msg;
697 712
 }
@@ -730,8 +745,9 @@  discard block
 block discarded – undo
730 745
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
731 746
 		if ( -0.1 < $diff && $diff < 0.1 ) {
732 747
 			// Scale the full size image.
733
-			if ( $img->resize( $fwidth, $fheight ) )
734
-				$scaled = true;
748
+			if ( $img->resize( $fwidth, $fheight ) ) {
749
+							$scaled = true;
750
+			}
735 751
 		}
736 752
 
737 753
 		if ( !$scaled ) {
@@ -740,8 +756,9 @@  discard block
 block discarded – undo
740 756
 		}
741 757
 	} elseif ( !empty($_REQUEST['history']) ) {
742 758
 		$changes = json_decode( wp_unslash($_REQUEST['history']) );
743
-		if ( $changes )
744
-			$img = image_edit_apply_changes($img, $changes);
759
+		if ( $changes ) {
760
+					$img = image_edit_apply_changes($img, $changes);
761
+		}
745 762
 	} else {
746 763
 		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
747 764
 		return $return;
@@ -755,8 +772,9 @@  discard block
 block discarded – undo
755 772
 		return $return;
756 773
 	}
757 774
 
758
-	if ( !is_array($backup_sizes) )
759
-		$backup_sizes = array();
775
+	if ( !is_array($backup_sizes) ) {
776
+			$backup_sizes = array();
777
+	}
760 778
 
761 779
 	// Generate new filename.
762 780
 	$path = get_attached_file( $post_id );
@@ -818,8 +836,9 @@  discard block
 block discarded – undo
818 836
 
819 837
 		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
820 838
 			$sizes = get_intermediate_image_sizes();
821
-			if ( 'nothumb' == $target )
822
-				$sizes = array_diff( $sizes, array('thumbnail') );
839
+			if ( 'nothumb' == $target ) {
840
+							$sizes = array_diff( $sizes, array('thumbnail') );
841
+			}
823 842
 		}
824 843
 
825 844
 		$return->fw = $meta['width'];
@@ -851,14 +870,16 @@  discard block
 block discarded – undo
851 870
 			$tag = false;
852 871
 			if ( isset( $meta['sizes'][$size] ) ) {
853 872
 				if ( isset($backup_sizes["$size-orig"]) ) {
854
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
855
-						$tag = "$size-$suffix";
873
+					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] ) {
874
+											$tag = "$size-$suffix";
875
+					}
856 876
 				} else {
857 877
 					$tag = "$size-orig";
858 878
 				}
859 879
 
860
-				if ( $tag )
861
-					$backup_sizes[$tag] = $meta['sizes'][$size];
880
+				if ( $tag ) {
881
+									$backup_sizes[$tag] = $meta['sizes'][$size];
882
+				}
862 883
 			}
863 884
 
864 885
 			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -384,7 +384,7 @@
 block discarded – undo
384 384
  * @ignore
385 385
  * @param resource  $img   Image resource.
386 386
  * @param float|int $angle Image rotation angle, in degrees.
387
- * @return resource|false GD image resource, false otherwise.
387
+ * @return resource GD image resource, false otherwise.
388 388
  */
389 389
 function _rotate_image_resource($img, $angle) {
390 390
 	_deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' );
Please login to merge, or discard this patch.
src/wp-admin/includes/class-language-pack-upgrader-skin.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,35 +23,35 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param array $args
25 25
 	 */
26
-	public function __construct( $args = array() ) {
27
-		$defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
28
-		$args = wp_parse_args( $args, $defaults );
29
-		if ( $args['skip_header_footer'] ) {
26
+	public function __construct($args = array()) {
27
+		$defaults = array('url' => '', 'nonce' => '', 'title' => __('Update Translations'), 'skip_header_footer' => false);
28
+		$args = wp_parse_args($args, $defaults);
29
+		if ($args['skip_header_footer']) {
30 30
 			$this->done_header = true;
31 31
 			$this->done_footer = true;
32 32
 			$this->display_footer_actions = false;
33 33
 		}
34
-		parent::__construct( $args );
34
+		parent::__construct($args);
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * @access public
39 39
 	 */
40 40
 	public function before() {
41
-		$name = $this->upgrader->get_name_for_update( $this->language_update );
41
+		$name = $this->upgrader->get_name_for_update($this->language_update);
42 42
 
43 43
 		echo '<div class="update-messages lp-show-latest">';
44 44
 
45
-		printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
45
+		printf('<h2>'.__('Updating translations for %1$s (%2$s)&#8230;').'</h2>', $name, $this->language_update->language);
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 *
50 50
 	 * @param string|WP_Error $error
51 51
 	 */
52
-	public function error( $error ) {
52
+	public function error($error) {
53 53
 		echo '<div class="lp-error">';
54
-		parent::error( $error );
54
+		parent::error($error);
55 55
 		echo '</div>';
56 56
 	}
57 57
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @access public
67 67
 	 */
68 68
 	public function bulk_footer() {
69
-		$this->decrement_update_count( 'translation' );
69
+		$this->decrement_update_count('translation');
70 70
 		$update_actions = array();
71
-		$update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
71
+		$update_actions['updates_page'] = '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>';
72 72
 
73 73
 		/**
74 74
 		 * Filters the list of action links available following a translations update.
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		 *
78 78
 		 * @param array $update_actions Array of translations update links.
79 79
 		 */
80
-		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
80
+		$update_actions = apply_filters('update_translations_complete_actions', $update_actions);
81 81
 
82
-		if ( $update_actions && $this->display_footer_actions )
83
-			$this->feedback( implode( ' | ', $update_actions ) );
82
+		if ($update_actions && $this->display_footer_actions)
83
+			$this->feedback(implode(' | ', $update_actions));
84 84
 	}
85 85
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,8 @@
 block discarded – undo
79 79
 		 */
80 80
 		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
81 81
 
82
-		if ( $update_actions && $this->display_footer_actions )
83
-			$this->feedback( implode( ' | ', $update_actions ) );
82
+		if ( $update_actions && $this->display_footer_actions ) {
83
+					$this->feedback( implode( ' | ', $update_actions ) );
84
+		}
84 85
 	}
85 86
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function after($title = '') {
37 37
 		parent::after($this->plugin_info['Title']);
38
-		$this->decrement_update_count( 'plugin' );
38
+		$this->decrement_update_count('plugin');
39 39
 	}
40 40
 
41 41
 	/**
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function bulk_footer() {
45 45
 		parent::bulk_footer();
46
-		$update_actions =  array(
47
-			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
48
-			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
46
+		$update_actions = array(
47
+			'plugins_page' => '<a href="'.self_admin_url('plugins.php').'" target="_parent">'.__('Return to Plugins page').'</a>',
48
+			'updates_page' => '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>'
49 49
 		);
50
-		if ( ! current_user_can( 'activate_plugins' ) )
51
-			unset( $update_actions['plugins_page'] );
50
+		if ( ! current_user_can('activate_plugins'))
51
+			unset($update_actions['plugins_page']);
52 52
 
53 53
 		/**
54 54
 		 * Filters the list of action links available following bulk plugin updates.
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 		 * @param array $update_actions Array of plugin action links.
59 59
 		 * @param array $plugin_info    Array of information for the last-updated plugin.
60 60
 		 */
61
-		$update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
61
+		$update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
62 62
 
63
-		if ( ! empty($update_actions) )
64
-			$this->feedback(implode(' | ', (array)$update_actions));
63
+		if ( ! empty($update_actions))
64
+			$this->feedback(implode(' | ', (array) $update_actions));
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
48 48
 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
49 49
 		);
50
-		if ( ! current_user_can( 'activate_plugins' ) )
51
-			unset( $update_actions['plugins_page'] );
50
+		if ( ! current_user_can( 'activate_plugins' ) ) {
51
+					unset( $update_actions['plugins_page'] );
52
+		}
52 53
 
53 54
 		/**
54 55
 		 * Filters the list of action links available following bulk plugin updates.
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
 		 */
61 62
 		$update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
62 63
 
63
-		if ( ! empty($update_actions) )
64
-			$this->feedback(implode(' | ', (array)$update_actions));
64
+		if ( ! empty($update_actions) ) {
65
+					$this->feedback(implode(' | ', (array)$update_actions));
66
+		}
65 67
 	}
66 68
 }
Please login to merge, or discard this patch.