Completed
Push — master ( fdb3a7...cde0c6 )
by Stephen
20:18
created
src/wp-includes/class-wp-customize-nav-menus.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @since 4.3.0
43 43
 	 * @access public
44 44
 	 *
45
-	 * @param object $manager An instance of the WP_Customize_Manager class.
45
+	 * @param WP_Customize_Manager $manager An instance of the WP_Customize_Manager class.
46 46
 	 */
47 47
 	public function __construct( $manager ) {
48 48
 		$this->previewed_menus = array();
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 	 *
877 877
 	 * @param string $nav_menu_content The HTML content for the navigation menu.
878 878
 	 * @param object $args             An object containing wp_nav_menu() arguments.
879
-	 * @return null
879
+	 * @return string
880 880
 	 */
881 881
 	public function filter_wp_nav_menu( $nav_menu_content, $args ) {
882 882
 		if ( ! empty( $args->can_partial_refresh ) && ! empty( $args->instance_number ) ) {
Please login to merge, or discard this patch.
Spacing   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -44,31 +44,31 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @param object $manager An instance of the WP_Customize_Manager class.
46 46
 	 */
47
-	public function __construct( $manager ) {
47
+	public function __construct($manager) {
48 48
 		$this->previewed_menus = array();
49 49
 		$this->manager         = $manager;
50 50
 
51 51
 		// Skip useless hooks when the user can't manage nav menus anyway.
52
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
52
+		if ( ! current_user_can('edit_theme_options')) {
53 53
 			return;
54 54
 		}
55 55
 
56
-		add_filter( 'customize_refresh_nonces', array( $this, 'filter_nonces' ) );
57
-		add_action( 'wp_ajax_load-available-menu-items-customizer', array( $this, 'ajax_load_available_items' ) );
58
-		add_action( 'wp_ajax_search-available-menu-items-customizer', array( $this, 'ajax_search_available_items' ) );
59
-		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
56
+		add_filter('customize_refresh_nonces', array($this, 'filter_nonces'));
57
+		add_action('wp_ajax_load-available-menu-items-customizer', array($this, 'ajax_load_available_items'));
58
+		add_action('wp_ajax_search-available-menu-items-customizer', array($this, 'ajax_search_available_items'));
59
+		add_action('customize_controls_enqueue_scripts', array($this, 'enqueue_scripts'));
60 60
 
61 61
 		// Needs to run after core Navigation section is set up.
62
-		add_action( 'customize_register', array( $this, 'customize_register' ), 11 );
62
+		add_action('customize_register', array($this, 'customize_register'), 11);
63 63
 
64
-		add_filter( 'customize_dynamic_setting_args', array( $this, 'filter_dynamic_setting_args' ), 10, 2 );
65
-		add_filter( 'customize_dynamic_setting_class', array( $this, 'filter_dynamic_setting_class' ), 10, 3 );
66
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_templates' ) );
67
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'available_items_template' ) );
68
-		add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
64
+		add_filter('customize_dynamic_setting_args', array($this, 'filter_dynamic_setting_args'), 10, 2);
65
+		add_filter('customize_dynamic_setting_class', array($this, 'filter_dynamic_setting_class'), 10, 3);
66
+		add_action('customize_controls_print_footer_scripts', array($this, 'print_templates'));
67
+		add_action('customize_controls_print_footer_scripts', array($this, 'available_items_template'));
68
+		add_action('customize_preview_init', array($this, 'customize_preview_init'));
69 69
 
70 70
 		// Selective Refresh partials.
71
-		add_filter( 'customize_dynamic_partial_args', array( $this, 'customize_dynamic_partial_args' ), 10, 2 );
71
+		add_filter('customize_dynamic_partial_args', array($this, 'customize_dynamic_partial_args'), 10, 2);
72 72
 	}
73 73
 
74 74
 	/**
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param array $nonces Array of nonces.
81 81
 	 * @return array $nonces Modified array of nonces.
82 82
 	 */
83
-	public function filter_nonces( $nonces ) {
84
-		$nonces['customize-menus'] = wp_create_nonce( 'customize-menus' );
83
+	public function filter_nonces($nonces) {
84
+		$nonces['customize-menus'] = wp_create_nonce('customize-menus');
85 85
 		return $nonces;
86 86
 	}
87 87
 
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 	 * @access public
93 93
 	 */
94 94
 	public function ajax_load_available_items() {
95
-		check_ajax_referer( 'customize-menus', 'customize-menus-nonce' );
95
+		check_ajax_referer('customize-menus', 'customize-menus-nonce');
96 96
 
97
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
97
+		if ( ! current_user_can('edit_theme_options')) {
98 98
 			wp_die( -1 );
99 99
 		}
100 100
 
101
-		if ( empty( $_POST['type'] ) || empty( $_POST['object'] ) ) {
102
-			wp_send_json_error( 'nav_menus_missing_type_or_object_parameter' );
101
+		if (empty($_POST['type']) || empty($_POST['object'])) {
102
+			wp_send_json_error('nav_menus_missing_type_or_object_parameter');
103 103
 		}
104 104
 
105
-		$type = sanitize_key( $_POST['type'] );
106
-		$object = sanitize_key( $_POST['object'] );
107
-		$page = empty( $_POST['page'] ) ? 0 : absint( $_POST['page'] );
108
-		$items = $this->load_available_items_query( $type, $object, $page );
105
+		$type = sanitize_key($_POST['type']);
106
+		$object = sanitize_key($_POST['object']);
107
+		$page = empty($_POST['page']) ? 0 : absint($_POST['page']);
108
+		$items = $this->load_available_items_query($type, $object, $page);
109 109
 
110
-		if ( is_wp_error( $items ) ) {
111
-			wp_send_json_error( $items->get_error_code() );
110
+		if (is_wp_error($items)) {
111
+			wp_send_json_error($items->get_error_code());
112 112
 		} else {
113
-			wp_send_json_success( array( 'items' => $items ) );
113
+			wp_send_json_success(array('items' => $items));
114 114
 		}
115 115
 	}
116 116
 
@@ -126,62 +126,62 @@  discard block
 block discarded – undo
126 126
 	 * @param int    $page   Optional. The page number used to generate the query offset. Default is '0'.
127 127
 	 * @return WP_Error|array Returns either a WP_Error object or an array of menu items.
128 128
 	 */
129
-	public function load_available_items_query( $type = 'post_type', $object = 'page', $page = 0 ) {
129
+	public function load_available_items_query($type = 'post_type', $object = 'page', $page = 0) {
130 130
 		$items = array();
131 131
 
132
-		if ( 'post_type' === $type ) {
133
-			$post_type = get_post_type_object( $object );
134
-			if ( ! $post_type ) {
135
-				return new WP_Error( 'nav_menus_invalid_post_type' );
132
+		if ('post_type' === $type) {
133
+			$post_type = get_post_type_object($object);
134
+			if ( ! $post_type) {
135
+				return new WP_Error('nav_menus_invalid_post_type');
136 136
 			}
137 137
 
138
-			if ( 0 === $page && 'page' === $object ) {
138
+			if (0 === $page && 'page' === $object) {
139 139
 				// Add "Home" link. Treat as a page, but switch to custom on add.
140 140
 				$items[] = array(
141 141
 					'id'         => 'home',
142
-					'title'      => _x( 'Home', 'nav menu home label' ),
142
+					'title'      => _x('Home', 'nav menu home label'),
143 143
 					'type'       => 'custom',
144
-					'type_label' => __( 'Custom Link' ),
144
+					'type_label' => __('Custom Link'),
145 145
 					'object'     => '',
146 146
 					'url'        => home_url(),
147 147
 				);
148
-			} elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) {
148
+			} elseif ('post' !== $object && 0 === $page && $post_type->has_archive) {
149 149
 				// Add a post type archive link.
150 150
 				$items[] = array(
151
-					'id'         => $object . '-archive',
151
+					'id'         => $object.'-archive',
152 152
 					'title'      => $post_type->labels->archives,
153 153
 					'type'       => 'post_type_archive',
154
-					'type_label' => __( 'Post Type Archive' ),
154
+					'type_label' => __('Post Type Archive'),
155 155
 					'object'     => $object,
156
-					'url'        => get_post_type_archive_link( $object ),
156
+					'url'        => get_post_type_archive_link($object),
157 157
 				);
158 158
 			}
159 159
 
160
-			$posts = get_posts( array(
160
+			$posts = get_posts(array(
161 161
 				'numberposts' => 10,
162 162
 				'offset'      => 10 * $page,
163 163
 				'orderby'     => 'date',
164 164
 				'order'       => 'DESC',
165 165
 				'post_type'   => $object,
166
-			) );
167
-			foreach ( $posts as $post ) {
166
+			));
167
+			foreach ($posts as $post) {
168 168
 				$post_title = $post->post_title;
169
-				if ( '' === $post_title ) {
169
+				if ('' === $post_title) {
170 170
 					/* translators: %d: ID of a post */
171
-					$post_title = sprintf( __( '#%d (no title)' ), $post->ID );
171
+					$post_title = sprintf(__('#%d (no title)'), $post->ID);
172 172
 				}
173 173
 				$items[] = array(
174 174
 					'id'         => "post-{$post->ID}",
175
-					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
175
+					'title'      => html_entity_decode($post_title, ENT_QUOTES, get_bloginfo('charset')),
176 176
 					'type'       => 'post_type',
177
-					'type_label' => get_post_type_object( $post->post_type )->labels->singular_name,
177
+					'type_label' => get_post_type_object($post->post_type)->labels->singular_name,
178 178
 					'object'     => $post->post_type,
179
-					'object_id'  => intval( $post->ID ),
180
-					'url'        => get_permalink( intval( $post->ID ) ),
179
+					'object_id'  => intval($post->ID),
180
+					'url'        => get_permalink(intval($post->ID)),
181 181
 				);
182 182
 			}
183
-		} elseif ( 'taxonomy' === $type ) {
184
-			$terms = get_terms( $object, array(
183
+		} elseif ('taxonomy' === $type) {
184
+			$terms = get_terms($object, array(
185 185
 				'child_of'     => 0,
186 186
 				'exclude'      => '',
187 187
 				'hide_empty'   => false,
@@ -192,20 +192,20 @@  discard block
 block discarded – undo
192 192
 				'order'        => 'DESC',
193 193
 				'orderby'      => 'count',
194 194
 				'pad_counts'   => false,
195
-			) );
196
-			if ( is_wp_error( $terms ) ) {
195
+			));
196
+			if (is_wp_error($terms)) {
197 197
 				return $terms;
198 198
 			}
199 199
 
200
-			foreach ( $terms as $term ) {
200
+			foreach ($terms as $term) {
201 201
 				$items[] = array(
202 202
 					'id'         => "term-{$term->term_id}",
203
-					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
203
+					'title'      => html_entity_decode($term->name, ENT_QUOTES, get_bloginfo('charset')),
204 204
 					'type'       => 'taxonomy',
205
-					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
205
+					'type_label' => get_taxonomy($term->taxonomy)->labels->singular_name,
206 206
 					'object'     => $term->taxonomy,
207
-					'object_id'  => intval( $term->term_id ),
208
-					'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
207
+					'object_id'  => intval($term->term_id),
208
+					'url'        => get_term_link(intval($term->term_id), $term->taxonomy),
209 209
 				);
210 210
 			}
211 211
 		}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		 * @param string $object The object name.
221 221
 		 * @param int    $page   The current page number.
222 222
 		 */
223
-		$items = apply_filters( 'customize_nav_menu_available_items', $items, $type, $object, $page );
223
+		$items = apply_filters('customize_nav_menu_available_items', $items, $type, $object, $page);
224 224
 
225 225
 		return $items;
226 226
 	}
@@ -232,28 +232,28 @@  discard block
 block discarded – undo
232 232
 	 * @access public
233 233
 	 */
234 234
 	public function ajax_search_available_items() {
235
-		check_ajax_referer( 'customize-menus', 'customize-menus-nonce' );
235
+		check_ajax_referer('customize-menus', 'customize-menus-nonce');
236 236
 
237
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
237
+		if ( ! current_user_can('edit_theme_options')) {
238 238
 			wp_die( -1 );
239 239
 		}
240 240
 
241
-		if ( empty( $_POST['search'] ) ) {
242
-			wp_send_json_error( 'nav_menus_missing_search_parameter' );
241
+		if (empty($_POST['search'])) {
242
+			wp_send_json_error('nav_menus_missing_search_parameter');
243 243
 		}
244 244
 
245
-		$p = isset( $_POST['page'] ) ? absint( $_POST['page'] ) : 0;
246
-		if ( $p < 1 ) {
245
+		$p = isset($_POST['page']) ? absint($_POST['page']) : 0;
246
+		if ($p < 1) {
247 247
 			$p = 1;
248 248
 		}
249 249
 
250
-		$s = sanitize_text_field( wp_unslash( $_POST['search'] ) );
251
-		$items = $this->search_available_items_query( array( 'pagenum' => $p, 's' => $s ) );
250
+		$s = sanitize_text_field(wp_unslash($_POST['search']));
251
+		$items = $this->search_available_items_query(array('pagenum' => $p, 's' => $s));
252 252
 
253
-		if ( empty( $items ) ) {
254
-			wp_send_json_error( array( 'message' => __( 'No results found.' ) ) );
253
+		if (empty($items)) {
254
+			wp_send_json_error(array('message' => __('No results found.')));
255 255
 		} else {
256
-			wp_send_json_success( array( 'items' => $items ) );
256
+			wp_send_json_success(array('items' => $items));
257 257
 		}
258 258
 	}
259 259
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
269 269
 	 * @return array Menu items.
270 270
 	 */
271
-	public function search_available_items_query( $args = array() ) {
271
+	public function search_available_items_query($args = array()) {
272 272
 		$items = array();
273 273
 
274
-		$post_type_objects = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
274
+		$post_type_objects = get_post_types(array('show_in_nav_menus' => true), 'objects');
275 275
 		$query = array(
276
-			'post_type'              => array_keys( $post_type_objects ),
276
+			'post_type'              => array_keys($post_type_objects),
277 277
 			'suppress_filters'       => true,
278 278
 			'update_post_term_cache' => false,
279 279
 			'update_post_meta_cache' => false,
@@ -281,55 +281,55 @@  discard block
 block discarded – undo
281 281
 			'posts_per_page'         => 20,
282 282
 		);
283 283
 
284
-		$args['pagenum'] = isset( $args['pagenum'] ) ? absint( $args['pagenum'] ) : 1;
285
-		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ( $args['pagenum'] - 1 ) : 0;
284
+		$args['pagenum'] = isset($args['pagenum']) ? absint($args['pagenum']) : 1;
285
+		$query['offset'] = $args['pagenum'] > 1 ? $query['posts_per_page'] * ($args['pagenum'] - 1) : 0;
286 286
 
287
-		if ( isset( $args['s'] ) ) {
287
+		if (isset($args['s'])) {
288 288
 			$query['s'] = $args['s'];
289 289
 		}
290 290
 
291 291
 		// Query posts.
292
-		$get_posts = new WP_Query( $query );
292
+		$get_posts = new WP_Query($query);
293 293
 
294 294
 		// Check if any posts were found.
295
-		if ( $get_posts->post_count ) {
296
-			foreach ( $get_posts->posts as $post ) {
295
+		if ($get_posts->post_count) {
296
+			foreach ($get_posts->posts as $post) {
297 297
 				$post_title = $post->post_title;
298
-				if ( '' === $post_title ) {
298
+				if ('' === $post_title) {
299 299
 					/* translators: %d: ID of a post */
300
-					$post_title = sprintf( __( '#%d (no title)' ), $post->ID );
300
+					$post_title = sprintf(__('#%d (no title)'), $post->ID);
301 301
 				}
302 302
 				$items[] = array(
303
-					'id'         => 'post-' . $post->ID,
304
-					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
303
+					'id'         => 'post-'.$post->ID,
304
+					'title'      => html_entity_decode($post_title, ENT_QUOTES, get_bloginfo('charset')),
305 305
 					'type'       => 'post_type',
306
-					'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name,
306
+					'type_label' => $post_type_objects[$post->post_type]->labels->singular_name,
307 307
 					'object'     => $post->post_type,
308
-					'object_id'  => intval( $post->ID ),
309
-					'url'        => get_permalink( intval( $post->ID ) ),
308
+					'object_id'  => intval($post->ID),
309
+					'url'        => get_permalink(intval($post->ID)),
310 310
 				);
311 311
 			}
312 312
 		}
313 313
 
314 314
 		// Query taxonomy terms.
315
-		$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
316
-		$terms = get_terms( $taxonomies, array(
315
+		$taxonomies = get_taxonomies(array('show_in_nav_menus' => true), 'names');
316
+		$terms = get_terms($taxonomies, array(
317 317
 			'name__like' => $args['s'],
318 318
 			'number'     => 20,
319 319
 			'offset'     => 20 * ($args['pagenum'] - 1),
320
-		) );
320
+		));
321 321
 
322 322
 		// Check if any taxonomies were found.
323
-		if ( ! empty( $terms ) ) {
324
-			foreach ( $terms as $term ) {
323
+		if ( ! empty($terms)) {
324
+			foreach ($terms as $term) {
325 325
 				$items[] = array(
326
-					'id'         => 'term-' . $term->term_id,
327
-					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
326
+					'id'         => 'term-'.$term->term_id,
327
+					'title'      => html_entity_decode($term->name, ENT_QUOTES, get_bloginfo('charset')),
328 328
 					'type'       => 'taxonomy',
329
-					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
329
+					'type_label' => get_taxonomy($term->taxonomy)->labels->singular_name,
330 330
 					'object'     => $term->taxonomy,
331
-					'object_id'  => intval( $term->term_id ),
332
-					'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
331
+					'object_id'  => intval($term->term_id),
332
+					'url'        => get_term_link(intval($term->term_id), $term->taxonomy),
333 333
 				);
334 334
 			}
335 335
 		}
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		 * @param array $items The array of menu items.
343 343
 		 * @param array $args  Includes 'pagenum' and 's' (search) arguments.
344 344
 		 */
345
-		$items = apply_filters( 'customize_nav_menu_searched_items', $items, $args );
345
+		$items = apply_filters('customize_nav_menu_searched_items', $items, $args);
346 346
 
347 347
 		return $items;
348 348
 	}
@@ -354,44 +354,44 @@  discard block
 block discarded – undo
354 354
 	 * @access public
355 355
 	 */
356 356
 	public function enqueue_scripts() {
357
-		wp_enqueue_style( 'customize-nav-menus' );
358
-		wp_enqueue_script( 'customize-nav-menus' );
357
+		wp_enqueue_style('customize-nav-menus');
358
+		wp_enqueue_script('customize-nav-menus');
359 359
 
360
-		$temp_nav_menu_setting      = new WP_Customize_Nav_Menu_Setting( $this->manager, 'nav_menu[-1]' );
361
-		$temp_nav_menu_item_setting = new WP_Customize_Nav_Menu_Item_Setting( $this->manager, 'nav_menu_item[-1]' );
360
+		$temp_nav_menu_setting      = new WP_Customize_Nav_Menu_Setting($this->manager, 'nav_menu[-1]');
361
+		$temp_nav_menu_item_setting = new WP_Customize_Nav_Menu_Item_Setting($this->manager, 'nav_menu_item[-1]');
362 362
 
363 363
 		// Pass data to JS.
364 364
 		$settings = array(
365 365
 			'allMenus'             => wp_get_nav_menus(),
366 366
 			'itemTypes'            => $this->available_item_types(),
367 367
 			'l10n'                 => array(
368
-				'untitled'          => _x( '(no label)', 'missing menu item navigation label' ),
369
-				'unnamed'           => _x( '(unnamed)', 'Missing menu name.' ),
370
-				'custom_label'      => __( 'Custom Link' ),
368
+				'untitled'          => _x('(no label)', 'missing menu item navigation label'),
369
+				'unnamed'           => _x('(unnamed)', 'Missing menu name.'),
370
+				'custom_label'      => __('Custom Link'),
371 371
 				/* translators: %s: menu location */
372
-				'menuLocation'      => _x( '(Currently set to: %s)', 'menu' ),
373
-				'menuNameLabel'     => __( 'Menu Name' ),
374
-				'itemAdded'         => __( 'Menu item added' ),
375
-				'itemDeleted'       => __( 'Menu item deleted' ),
376
-				'menuAdded'         => __( 'Menu created' ),
377
-				'menuDeleted'       => __( 'Menu deleted' ),
378
-				'movedUp'           => __( 'Menu item moved up' ),
379
-				'movedDown'         => __( 'Menu item moved down' ),
380
-				'movedLeft'         => __( 'Menu item moved out of submenu' ),
381
-				'movedRight'        => __( 'Menu item is now a sub-item' ),
372
+				'menuLocation'      => _x('(Currently set to: %s)', 'menu'),
373
+				'menuNameLabel'     => __('Menu Name'),
374
+				'itemAdded'         => __('Menu item added'),
375
+				'itemDeleted'       => __('Menu item deleted'),
376
+				'menuAdded'         => __('Menu created'),
377
+				'menuDeleted'       => __('Menu deleted'),
378
+				'movedUp'           => __('Menu item moved up'),
379
+				'movedDown'         => __('Menu item moved down'),
380
+				'movedLeft'         => __('Menu item moved out of submenu'),
381
+				'movedRight'        => __('Menu item is now a sub-item'),
382 382
 				/* translators: &#9656; is the unicode right-pointing triangle, and %s is the section title in the Customizer */
383
-				'customizingMenus'  => sprintf( __( 'Customizing &#9656; %s' ), esc_html( $this->manager->get_panel( 'nav_menus' )->title ) ),
383
+				'customizingMenus'  => sprintf(__('Customizing &#9656; %s'), esc_html($this->manager->get_panel('nav_menus')->title)),
384 384
 				/* translators: %s: title of menu item which is invalid */
385
-				'invalidTitleTpl'   => __( '%s (Invalid)' ),
385
+				'invalidTitleTpl'   => __('%s (Invalid)'),
386 386
 				/* translators: %s: title of menu item in draft status */
387
-				'pendingTitleTpl'   => __( '%s (Pending)' ),
388
-				'itemsFound'        => __( 'Number of items found: %d' ),
389
-				'itemsFoundMore'    => __( 'Additional items found: %d' ),
390
-				'itemsLoadingMore'  => __( 'Loading more results... please wait.' ),
391
-				'reorderModeOn'     => __( 'Reorder mode enabled' ),
392
-				'reorderModeOff'    => __( 'Reorder mode closed' ),
393
-				'reorderLabelOn'    => esc_attr__( 'Reorder menu items' ),
394
-				'reorderLabelOff'   => esc_attr__( 'Close reorder mode' ),
387
+				'pendingTitleTpl'   => __('%s (Pending)'),
388
+				'itemsFound'        => __('Number of items found: %d'),
389
+				'itemsFoundMore'    => __('Additional items found: %d'),
390
+				'itemsLoadingMore'  => __('Loading more results... please wait.'),
391
+				'reorderModeOn'     => __('Reorder mode enabled'),
392
+				'reorderModeOff'    => __('Reorder mode closed'),
393
+				'reorderLabelOn'    => esc_attr__('Reorder menu items'),
394
+				'reorderLabelOff'   => esc_attr__('Close reorder mode'),
395 395
 			),
396 396
 			'settingTransport'     => 'postMessage',
397 397
 			'phpIntMax'            => PHP_INT_MAX,
@@ -402,29 +402,29 @@  discard block
 block discarded – undo
402 402
 			'locationSlugMappedToName' => get_registered_nav_menus(),
403 403
 		);
404 404
 
405
-		$data = sprintf( 'var _wpCustomizeNavMenusSettings = %s;', wp_json_encode( $settings ) );
406
-		wp_scripts()->add_data( 'customize-nav-menus', 'data', $data );
405
+		$data = sprintf('var _wpCustomizeNavMenusSettings = %s;', wp_json_encode($settings));
406
+		wp_scripts()->add_data('customize-nav-menus', 'data', $data);
407 407
 
408 408
 		// This is copied from nav-menus.php, and it has an unfortunate object name of `menus`.
409 409
 		$nav_menus_l10n = array(
410 410
 			'oneThemeLocationNoMenus' => null,
411
-			'moveUp'       => __( 'Move up one' ),
412
-			'moveDown'     => __( 'Move down one' ),
413
-			'moveToTop'    => __( 'Move to the top' ),
411
+			'moveUp'       => __('Move up one'),
412
+			'moveDown'     => __('Move down one'),
413
+			'moveToTop'    => __('Move to the top'),
414 414
 			/* translators: %s: previous item name */
415
-			'moveUnder'    => __( 'Move under %s' ),
415
+			'moveUnder'    => __('Move under %s'),
416 416
 			/* translators: %s: previous item name */
417
-			'moveOutFrom'  => __( 'Move out from under %s' ),
417
+			'moveOutFrom'  => __('Move out from under %s'),
418 418
 			/* translators: %s: previous item name */
419
-			'under'        => __( 'Under %s' ),
419
+			'under'        => __('Under %s'),
420 420
 			/* translators: %s: previous item name */
421
-			'outFrom'      => __( 'Out from under %s' ),
421
+			'outFrom'      => __('Out from under %s'),
422 422
 			/* translators: 1: item name, 2: item position, 3: total number of items */
423
-			'menuFocus'    => __( '%1$s. Menu item %2$d of %3$d.' ),
423
+			'menuFocus'    => __('%1$s. Menu item %2$d of %3$d.'),
424 424
 			/* translators: 1: item name, 2: item position, 3: parent item name */
425
-			'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ),
425
+			'subMenuFocus' => __('%1$s. Sub item number %2$d under %3$s.'),
426 426
 		);
427
-		wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
427
+		wp_localize_script('nav-menu', 'menus', $nav_menus_l10n);
428 428
 	}
429 429
 
430 430
 	/**
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
 	 * @param string      $setting_id   ID for dynamic setting, usually coming from `$_POST['customized']`.
442 442
 	 * @return array|false
443 443
 	 */
444
-	public function filter_dynamic_setting_args( $setting_args, $setting_id ) {
445
-		if ( preg_match( WP_Customize_Nav_Menu_Setting::ID_PATTERN, $setting_id ) ) {
444
+	public function filter_dynamic_setting_args($setting_args, $setting_id) {
445
+		if (preg_match(WP_Customize_Nav_Menu_Setting::ID_PATTERN, $setting_id)) {
446 446
 			$setting_args = array(
447 447
 				'type'      => WP_Customize_Nav_Menu_Setting::TYPE,
448 448
 				'transport' => 'postMessage',
449 449
 			);
450
-		} elseif ( preg_match( WP_Customize_Nav_Menu_Item_Setting::ID_PATTERN, $setting_id ) ) {
450
+		} elseif (preg_match(WP_Customize_Nav_Menu_Item_Setting::ID_PATTERN, $setting_id)) {
451 451
 			$setting_args = array(
452 452
 				'type'      => WP_Customize_Nav_Menu_Item_Setting::TYPE,
453 453
 				'transport' => 'postMessage',
@@ -467,12 +467,12 @@  discard block
 block discarded – undo
467 467
 	 * @param array  $setting_args  WP_Customize_Setting or a subclass.
468 468
 	 * @return string
469 469
 	 */
470
-	public function filter_dynamic_setting_class( $setting_class, $setting_id, $setting_args ) {
471
-		unset( $setting_id );
470
+	public function filter_dynamic_setting_class($setting_class, $setting_id, $setting_args) {
471
+		unset($setting_id);
472 472
 
473
-		if ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Setting::TYPE === $setting_args['type'] ) {
473
+		if ( ! empty($setting_args['type']) && WP_Customize_Nav_Menu_Setting::TYPE === $setting_args['type']) {
474 474
 			$setting_class = 'WP_Customize_Nav_Menu_Setting';
475
-		} elseif ( ! empty( $setting_args['type'] ) && WP_Customize_Nav_Menu_Item_Setting::TYPE === $setting_args['type'] ) {
475
+		} elseif ( ! empty($setting_args['type']) && WP_Customize_Nav_Menu_Item_Setting::TYPE === $setting_args['type']) {
476 476
 			$setting_class = 'WP_Customize_Nav_Menu_Item_Setting';
477 477
 		}
478 478
 		return $setting_class;
@@ -487,145 +487,145 @@  discard block
 block discarded – undo
487 487
 	public function customize_register() {
488 488
 
489 489
 		// Require JS-rendered control types.
490
-		$this->manager->register_panel_type( 'WP_Customize_Nav_Menus_Panel' );
491
-		$this->manager->register_control_type( 'WP_Customize_Nav_Menu_Control' );
492
-		$this->manager->register_control_type( 'WP_Customize_Nav_Menu_Name_Control' );
493
-		$this->manager->register_control_type( 'WP_Customize_Nav_Menu_Auto_Add_Control' );
494
-		$this->manager->register_control_type( 'WP_Customize_Nav_Menu_Item_Control' );
490
+		$this->manager->register_panel_type('WP_Customize_Nav_Menus_Panel');
491
+		$this->manager->register_control_type('WP_Customize_Nav_Menu_Control');
492
+		$this->manager->register_control_type('WP_Customize_Nav_Menu_Name_Control');
493
+		$this->manager->register_control_type('WP_Customize_Nav_Menu_Auto_Add_Control');
494
+		$this->manager->register_control_type('WP_Customize_Nav_Menu_Item_Control');
495 495
 
496 496
 		// Create a panel for Menus.
497
-		$description = '<p>' . __( 'This panel is used for managing navigation menus for content you have already published on your site. You can create menus and add items for existing content such as pages, posts, categories, tags, formats, or custom links.' ) . '</p>';
498
-		if ( current_theme_supports( 'widgets' ) ) {
497
+		$description = '<p>'.__('This panel is used for managing navigation menus for content you have already published on your site. You can create menus and add items for existing content such as pages, posts, categories, tags, formats, or custom links.').'</p>';
498
+		if (current_theme_supports('widgets')) {
499 499
 			/* translators: URL to the widgets panel of the customizer */
500
-			$description .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme or in <a href="%s">widget areas</a> by adding a &#8220;Custom Menu&#8221; widget.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>';
500
+			$description .= '<p>'.sprintf(__('Menus can be displayed in locations defined by your theme or in <a href="%s">widget areas</a> by adding a &#8220;Custom Menu&#8221; widget.'), "javascript:wp.customize.panel( 'widgets' ).focus();").'</p>';
501 501
 		} else {
502
-			$description .= '<p>' . __( 'Menus can be displayed in locations defined by your theme.' ) . '</p>';
502
+			$description .= '<p>'.__('Menus can be displayed in locations defined by your theme.').'</p>';
503 503
 		}
504
-		$this->manager->add_panel( new WP_Customize_Nav_Menus_Panel( $this->manager, 'nav_menus', array(
505
-			'title'       => __( 'Menus' ),
504
+		$this->manager->add_panel(new WP_Customize_Nav_Menus_Panel($this->manager, 'nav_menus', array(
505
+			'title'       => __('Menus'),
506 506
 			'description' => $description,
507 507
 			'priority'    => 100,
508 508
 			// 'theme_supports' => 'menus|widgets', @todo allow multiple theme supports
509
-		) ) );
509
+		)));
510 510
 		$menus = wp_get_nav_menus();
511 511
 
512 512
 		// Menu locations.
513 513
 		$locations     = get_registered_nav_menus();
514
-		$num_locations = count( array_keys( $locations ) );
515
-		if ( 1 == $num_locations ) {
516
-			$description = '<p>' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '</p>';
514
+		$num_locations = count(array_keys($locations));
515
+		if (1 == $num_locations) {
516
+			$description = '<p>'.__('Your theme supports one menu. Select which menu you would like to use.').'</p>';
517 517
 		} else {
518 518
 			/* translators: %s: number of menu locations */
519
-			$description = '<p>' . sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>';
519
+			$description = '<p>'.sprintf(_n('Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations), number_format_i18n($num_locations)).'</p>';
520 520
 		}
521
-		if ( current_theme_supports( 'widgets' ) ) {
521
+		if (current_theme_supports('widgets')) {
522 522
 			/* translators: URL to the widgets panel of the customizer */
523
-			$description .= '<p>' . sprintf( __( 'You can also place menus in <a href="%s">widget areas</a> with the &#8220;Custom Menu&#8221; widget.' ), "javascript:wp.customize.panel( 'widgets' ).focus();" ) . '</p>';
523
+			$description .= '<p>'.sprintf(__('You can also place menus in <a href="%s">widget areas</a> with the &#8220;Custom Menu&#8221; widget.'), "javascript:wp.customize.panel( 'widgets' ).focus();").'</p>';
524 524
 		}
525 525
 
526
-		$this->manager->add_section( 'menu_locations', array(
527
-			'title'       => __( 'Menu Locations' ),
526
+		$this->manager->add_section('menu_locations', array(
527
+			'title'       => __('Menu Locations'),
528 528
 			'panel'       => 'nav_menus',
529 529
 			'priority'    => 5,
530 530
 			'description' => $description,
531
-		) );
531
+		));
532 532
 
533
-		$choices = array( '0' => __( '&mdash; Select &mdash;' ) );
534
-		foreach ( $menus as $menu ) {
535
-			$choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '&hellip;' );
533
+		$choices = array('0' => __('&mdash; Select &mdash;'));
534
+		foreach ($menus as $menu) {
535
+			$choices[$menu->term_id] = wp_html_excerpt($menu->name, 40, '&hellip;');
536 536
 		}
537 537
 
538
-		foreach ( $locations as $location => $description ) {
538
+		foreach ($locations as $location => $description) {
539 539
 			$setting_id = "nav_menu_locations[{$location}]";
540 540
 
541
-			$setting = $this->manager->get_setting( $setting_id );
542
-			if ( $setting ) {
541
+			$setting = $this->manager->get_setting($setting_id);
542
+			if ($setting) {
543 543
 				$setting->transport = 'postMessage';
544
-				remove_filter( "customize_sanitize_{$setting_id}", 'absint' );
545
-				add_filter( "customize_sanitize_{$setting_id}", array( $this, 'intval_base10' ) );
544
+				remove_filter("customize_sanitize_{$setting_id}", 'absint');
545
+				add_filter("customize_sanitize_{$setting_id}", array($this, 'intval_base10'));
546 546
 			} else {
547
-				$this->manager->add_setting( $setting_id, array(
548
-					'sanitize_callback' => array( $this, 'intval_base10' ),
547
+				$this->manager->add_setting($setting_id, array(
548
+					'sanitize_callback' => array($this, 'intval_base10'),
549 549
 					'theme_supports'    => 'menus',
550 550
 					'type'              => 'theme_mod',
551 551
 					'transport'         => 'postMessage',
552 552
 					'default'           => 0,
553
-				) );
553
+				));
554 554
 			}
555 555
 
556
-			$this->manager->add_control( new WP_Customize_Nav_Menu_Location_Control( $this->manager, $setting_id, array(
556
+			$this->manager->add_control(new WP_Customize_Nav_Menu_Location_Control($this->manager, $setting_id, array(
557 557
 				'label'       => $description,
558 558
 				'location_id' => $location,
559 559
 				'section'     => 'menu_locations',
560 560
 				'choices'     => $choices,
561
-			) ) );
561
+			)));
562 562
 		}
563 563
 
564 564
 		// Register each menu as a Customizer section, and add each menu item to each menu.
565
-		foreach ( $menus as $menu ) {
565
+		foreach ($menus as $menu) {
566 566
 			$menu_id = $menu->term_id;
567 567
 
568 568
 			// Create a section for each menu.
569
-			$section_id = 'nav_menu[' . $menu_id . ']';
570
-			$this->manager->add_section( new WP_Customize_Nav_Menu_Section( $this->manager, $section_id, array(
571
-				'title'     => html_entity_decode( $menu->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
569
+			$section_id = 'nav_menu['.$menu_id.']';
570
+			$this->manager->add_section(new WP_Customize_Nav_Menu_Section($this->manager, $section_id, array(
571
+				'title'     => html_entity_decode($menu->name, ENT_QUOTES, get_bloginfo('charset')),
572 572
 				'priority'  => 10,
573 573
 				'panel'     => 'nav_menus',
574
-			) ) );
574
+			)));
575 575
 
576
-			$nav_menu_setting_id = 'nav_menu[' . $menu_id . ']';
577
-			$this->manager->add_setting( new WP_Customize_Nav_Menu_Setting( $this->manager, $nav_menu_setting_id, array(
576
+			$nav_menu_setting_id = 'nav_menu['.$menu_id.']';
577
+			$this->manager->add_setting(new WP_Customize_Nav_Menu_Setting($this->manager, $nav_menu_setting_id, array(
578 578
 				'transport' => 'postMessage',
579
-			) ) );
579
+			)));
580 580
 
581 581
 			// Add the menu contents.
582
-			$menu_items = (array) wp_get_nav_menu_items( $menu_id );
582
+			$menu_items = (array) wp_get_nav_menu_items($menu_id);
583 583
 
584
-			foreach ( array_values( $menu_items ) as $i => $item ) {
584
+			foreach (array_values($menu_items) as $i => $item) {
585 585
 
586 586
 				// Create a setting for each menu item (which doesn't actually manage data, currently).
587
-				$menu_item_setting_id = 'nav_menu_item[' . $item->ID . ']';
587
+				$menu_item_setting_id = 'nav_menu_item['.$item->ID.']';
588 588
 
589 589
 				$value = (array) $item;
590 590
 				$value['nav_menu_term_id'] = $menu_id;
591
-				$this->manager->add_setting( new WP_Customize_Nav_Menu_Item_Setting( $this->manager, $menu_item_setting_id, array(
591
+				$this->manager->add_setting(new WP_Customize_Nav_Menu_Item_Setting($this->manager, $menu_item_setting_id, array(
592 592
 					'value'     => $value,
593 593
 					'transport' => 'postMessage',
594
-				) ) );
594
+				)));
595 595
 
596 596
 				// Create a control for each menu item.
597
-				$this->manager->add_control( new WP_Customize_Nav_Menu_Item_Control( $this->manager, $menu_item_setting_id, array(
597
+				$this->manager->add_control(new WP_Customize_Nav_Menu_Item_Control($this->manager, $menu_item_setting_id, array(
598 598
 					'label'    => $item->title,
599 599
 					'section'  => $section_id,
600 600
 					'priority' => 10 + $i,
601
-				) ) );
601
+				)));
602 602
 			}
603 603
 
604 604
 			// Note: other controls inside of this section get added dynamically in JS via the MenuSection.ready() function.
605 605
 		}
606 606
 
607 607
 		// Add the add-new-menu section and controls.
608
-		$this->manager->add_section( new WP_Customize_New_Menu_Section( $this->manager, 'add_menu', array(
609
-			'title'    => __( 'Add a Menu' ),
608
+		$this->manager->add_section(new WP_Customize_New_Menu_Section($this->manager, 'add_menu', array(
609
+			'title'    => __('Add a Menu'),
610 610
 			'panel'    => 'nav_menus',
611 611
 			'priority' => 999,
612
-		) ) );
612
+		)));
613 613
 
614
-		$this->manager->add_control( 'new_menu_name', array(
614
+		$this->manager->add_control('new_menu_name', array(
615 615
 			'label'       => '',
616 616
 			'section'     => 'add_menu',
617 617
 			'type'        => 'text',
618 618
 			'settings'    => array(),
619 619
 			'input_attrs' => array(
620 620
 				'class'       => 'menu-name-field',
621
-				'placeholder' => __( 'New menu name' ),
621
+				'placeholder' => __('New menu name'),
622 622
 			),
623
-		) );
623
+		));
624 624
 
625
-		$this->manager->add_control( new WP_Customize_New_Menu_Control( $this->manager, 'create_new_menu', array(
625
+		$this->manager->add_control(new WP_Customize_New_Menu_Control($this->manager, 'create_new_menu', array(
626 626
 			'section'  => 'add_menu',
627 627
 			'settings' => array(),
628
-		) ) );
628
+		)));
629 629
 	}
630 630
 
631 631
 	/**
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param mixed $value Number to convert.
641 641
 	 * @return int Integer.
642 642
 	 */
643
-	public function intval_base10( $value ) {
644
-		return intval( $value, 10 );
643
+	public function intval_base10($value) {
644
+		return intval($value, 10);
645 645
 	}
646 646
 
647 647
 	/**
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
 	public function available_item_types() {
656 656
 		$item_types = array();
657 657
 
658
-		$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
659
-		if ( $post_types ) {
660
-			foreach ( $post_types as $slug => $post_type ) {
658
+		$post_types = get_post_types(array('show_in_nav_menus' => true), 'objects');
659
+		if ($post_types) {
660
+			foreach ($post_types as $slug => $post_type) {
661 661
 				$item_types[] = array(
662 662
 					'title'  => $post_type->labels->name,
663 663
 					'type'   => 'post_type',
@@ -666,10 +666,10 @@  discard block
 block discarded – undo
666 666
 			}
667 667
 		}
668 668
 
669
-		$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'objects' );
670
-		if ( $taxonomies ) {
671
-			foreach ( $taxonomies as $slug => $taxonomy ) {
672
-				if ( 'post_format' === $taxonomy && ! current_theme_supports( 'post-formats' ) ) {
669
+		$taxonomies = get_taxonomies(array('show_in_nav_menus' => true), 'objects');
670
+		if ($taxonomies) {
671
+			foreach ($taxonomies as $slug => $taxonomy) {
672
+				if ('post_format' === $taxonomy && ! current_theme_supports('post-formats')) {
673 673
 					continue;
674 674
 				}
675 675
 				$item_types[] = array(
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		 *
688 688
 		 * @param array $item_types Custom menu item types.
689 689
 		 */
690
-		$item_types = apply_filters( 'customize_nav_menu_available_item_types', $item_types );
690
+		$item_types = apply_filters('customize_nav_menu_available_item_types', $item_types);
691 691
 
692 692
 		return $item_types;
693 693
 	}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 						<button type="button" class="button-link item-add">
714 714
 							<span class="screen-reader-text"><?php
715 715
 								/* translators: 1: Title of a menu item, 2: Type of a menu item */
716
-								printf( __( 'Add to menu: %1$s (%2$s)' ), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.type_label }}' );
716
+								printf(__('Add to menu: %1$s (%2$s)'), '{{ data.title || wp.customize.Menus.data.l10n.untitled }}', '{{ data.type_label }}');
717 717
 							?></span>
718 718
 						</button>
719 719
 					</div>
@@ -726,10 +726,10 @@  discard block
 block discarded – undo
726 726
 				<?php
727 727
 				printf(
728 728
 					'<button type="button" class="menus-move-up">%1$s</button><button type="button" class="menus-move-down">%2$s</button><button type="button" class="menus-move-left">%3$s</button><button type="button" class="menus-move-right">%4$s</button>',
729
-					__( 'Move up' ),
730
-					__( 'Move down' ),
731
-					__( 'Move one level up' ),
732
-					__( 'Move one level down' )
729
+					__('Move up'),
730
+					__('Move down'),
731
+					__('Move one level up'),
732
+					__('Move one level down')
733 733
 				);
734 734
 				?>
735 735
 			</div>
@@ -748,49 +748,49 @@  discard block
 block discarded – undo
748 748
 		<div id="available-menu-items" class="accordion-container">
749 749
 			<div class="customize-section-title">
750 750
 				<button type="button" class="customize-section-back" tabindex="-1">
751
-					<span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
751
+					<span class="screen-reader-text"><?php _e('Back'); ?></span>
752 752
 				</button>
753 753
 				<h3>
754 754
 					<span class="customize-action">
755 755
 						<?php
756 756
 							/* translators: &#9656; is the unicode right-pointing triangle, and %s is the section title in the Customizer */
757
-							printf( __( 'Customizing &#9656; %s' ), esc_html( $this->manager->get_panel( 'nav_menus' )->title ) );
757
+							printf(__('Customizing &#9656; %s'), esc_html($this->manager->get_panel('nav_menus')->title));
758 758
 						?>
759 759
 					</span>
760
-					<?php _e( 'Add Menu Items' ); ?>
760
+					<?php _e('Add Menu Items'); ?>
761 761
 				</h3>
762 762
 			</div>
763 763
 			<div id="available-menu-items-search" class="accordion-section cannot-expand">
764 764
 				<div class="accordion-section-title">
765
-					<label class="screen-reader-text" for="menu-items-search"><?php _e( 'Search Menu Items' ); ?></label>
766
-					<input type="text" id="menu-items-search" placeholder="<?php esc_attr_e( 'Search menu items&hellip;' ) ?>" aria-describedby="menu-items-search-desc" />
767
-					<p class="screen-reader-text" id="menu-items-search-desc"><?php _e( 'The search results will be updated as you type.' ); ?></p>
765
+					<label class="screen-reader-text" for="menu-items-search"><?php _e('Search Menu Items'); ?></label>
766
+					<input type="text" id="menu-items-search" placeholder="<?php esc_attr_e('Search menu items&hellip;') ?>" aria-describedby="menu-items-search-desc" />
767
+					<p class="screen-reader-text" id="menu-items-search-desc"><?php _e('The search results will be updated as you type.'); ?></p>
768 768
 					<span class="spinner"></span>
769 769
 				</div>
770
-				<button type="button" class="clear-results"><span class="screen-reader-text"><?php _e( 'Clear Results' ); ?></span></button>
770
+				<button type="button" class="clear-results"><span class="screen-reader-text"><?php _e('Clear Results'); ?></span></button>
771 771
 				<ul class="accordion-section-content" data-type="search"></ul>
772 772
 			</div>
773 773
 			<div id="new-custom-menu-item" class="accordion-section">
774 774
 				<h4 class="accordion-section-title" role="presentation">
775
-					<?php _e( 'Custom Links' ); ?>
775
+					<?php _e('Custom Links'); ?>
776 776
 					<button type="button" class="button-link" aria-expanded="false">
777
-						<span class="screen-reader-text"><?php _e( 'Toggle section: Custom Links' ); ?></span>
777
+						<span class="screen-reader-text"><?php _e('Toggle section: Custom Links'); ?></span>
778 778
 						<span class="toggle-indicator" aria-hidden="true"></span>
779 779
 					</button>
780 780
 				</h4>
781 781
 				<div class="accordion-section-content customlinkdiv">
782 782
 					<input type="hidden" value="custom" id="custom-menu-item-type" name="menu-item[-1][menu-item-type]" />
783 783
 					<p id="menu-item-url-wrap" class="wp-clearfix">
784
-						<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
784
+						<label class="howto" for="custom-menu-item-url"><?php _e('URL'); ?></label>
785 785
 						<input id="custom-menu-item-url" name="menu-item[-1][menu-item-url]" type="text" class="code menu-item-textbox" value="http://">
786 786
 					</p>
787 787
 					<p id="menu-item-name-wrap" class="wp-clearfix">
788
-						<label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>
788
+						<label class="howto" for="custom-menu-item-name"><?php _e('Link Text'); ?></label>
789 789
 						<input id="custom-menu-item-name" name="menu-item[-1][menu-item-title]" type="text" class="regular-text menu-item-textbox">
790 790
 					</p>
791 791
 					<p class="button-controls">
792 792
 						<span class="add-to-menu">
793
-							<input type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-custom-menu-item" id="custom-menu-item-submit">
793
+							<input type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="custom-menu-item-submit">
794 794
 							<span class="spinner"></span>
795 795
 						</span>
796 796
 					</p>
@@ -798,22 +798,22 @@  discard block
 block discarded – undo
798 798
 			</div>
799 799
 			<?php
800 800
 			// Containers for per-post-type item browsing; items added with JS.
801
-			foreach ( $this->available_item_types() as $available_item_type ) {
802
-				$id = sprintf( 'available-menu-items-%s-%s', $available_item_type['type'], $available_item_type['object'] );
801
+			foreach ($this->available_item_types() as $available_item_type) {
802
+				$id = sprintf('available-menu-items-%s-%s', $available_item_type['type'], $available_item_type['object']);
803 803
 				?>
804
-				<div id="<?php echo esc_attr( $id ); ?>" class="accordion-section">
804
+				<div id="<?php echo esc_attr($id); ?>" class="accordion-section">
805 805
 					<h4 class="accordion-section-title" role="presentation">
806
-						<?php echo esc_html( $available_item_type['title'] ); ?>
806
+						<?php echo esc_html($available_item_type['title']); ?>
807 807
 						<span class="spinner"></span>
808
-						<span class="no-items"><?php _e( 'No items' ); ?></span>
808
+						<span class="no-items"><?php _e('No items'); ?></span>
809 809
 						<button type="button" class="button-link" aria-expanded="false">
810 810
 							<span class="screen-reader-text"><?php
811 811
 							/* translators: %s: Title of a section with menu items */
812
-							printf( __( 'Toggle section: %s' ), esc_html( $available_item_type['title'] ) ); ?></span>
812
+							printf(__('Toggle section: %s'), esc_html($available_item_type['title'])); ?></span>
813 813
 							<span class="toggle-indicator" aria-hidden="true"></span>
814 814
 						</button>
815 815
 					</h4>
816
-					<ul class="accordion-section-content" data-type="<?php echo esc_attr( $available_item_type['type'] ); ?>" data-object="<?php echo esc_attr( $available_item_type['object'] ); ?>"></ul>
816
+					<ul class="accordion-section-content" data-type="<?php echo esc_attr($available_item_type['type']); ?>" data-object="<?php echo esc_attr($available_item_type['object']); ?>"></ul>
817 817
 				</div>
818 818
 				<?php
819 819
 			}
@@ -845,17 +845,17 @@  discard block
 block discarded – undo
845 845
 	 * @param string      $partial_id   Partial ID.
846 846
 	 * @return array Partial args.
847 847
 	 */
848
-	public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
848
+	public function customize_dynamic_partial_args($partial_args, $partial_id) {
849 849
 
850
-		if ( preg_match( '/^nav_menu_instance\[[0-9a-f]{32}\]$/', $partial_id ) ) {
851
-			if ( false === $partial_args ) {
850
+		if (preg_match('/^nav_menu_instance\[[0-9a-f]{32}\]$/', $partial_id)) {
851
+			if (false === $partial_args) {
852 852
 				$partial_args = array();
853 853
 			}
854 854
 			$partial_args = array_merge(
855 855
 				$partial_args,
856 856
 				array(
857 857
 					'type'                => 'nav_menu_instance',
858
-					'render_callback'     => array( $this, 'render_nav_menu_partial' ),
858
+					'render_callback'     => array($this, 'render_nav_menu_partial'),
859 859
 					'container_inclusive' => true,
860 860
 					'settings'            => array(), // Empty because the nav menu instance may relate to a menu or a location.
861 861
 					'capability'          => 'edit_theme_options',
@@ -873,11 +873,11 @@  discard block
 block discarded – undo
873 873
 	 * @access public
874 874
 	 */
875 875
 	public function customize_preview_init() {
876
-		add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) );
877
-		add_filter( 'wp_nav_menu_args', array( $this, 'filter_wp_nav_menu_args' ), 1000 );
878
-		add_filter( 'wp_nav_menu', array( $this, 'filter_wp_nav_menu' ), 10, 2 );
879
-		add_filter( 'wp_footer', array( $this, 'export_preview_data' ), 1 );
880
-		add_filter( 'customize_render_partials_response', array( $this, 'export_partial_rendered_nav_menu_instances' ) );
876
+		add_action('wp_enqueue_scripts', array($this, 'customize_preview_enqueue_deps'));
877
+		add_filter('wp_nav_menu_args', array($this, 'filter_wp_nav_menu_args'), 1000);
878
+		add_filter('wp_nav_menu', array($this, 'filter_wp_nav_menu'), 10, 2);
879
+		add_filter('wp_footer', array($this, 'export_preview_data'), 1);
880
+		add_filter('customize_render_partials_response', array($this, 'export_partial_rendered_nav_menu_instances'));
881 881
 	}
882 882
 
883 883
 	/**
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	 * @param array $args An array containing wp_nav_menu() arguments.
892 892
 	 * @return array Arguments.
893 893
 	 */
894
-	public function filter_wp_nav_menu_args( $args ) {
894
+	public function filter_wp_nav_menu_args($args) {
895 895
 		/*
896 896
 		 * The following conditions determine whether or not this instance of
897 897
 		 * wp_nav_menu() can use selective refreshed. A wp_nav_menu() can be
@@ -899,25 +899,25 @@  discard block
 block discarded – undo
899 899
 		 */
900 900
 		$can_partial_refresh = (
901 901
 			// ...if wp_nav_menu() is directly echoing out the menu (and thus isn't manipulating the string after generated),
902
-			! empty( $args['echo'] )
902
+			! empty($args['echo'])
903 903
 			&&
904 904
 			// ...and if the fallback_cb can be serialized to JSON, since it will be included in the placement context data,
905
-			( empty( $args['fallback_cb'] ) || is_string( $args['fallback_cb'] ) )
905
+			(empty($args['fallback_cb']) || is_string($args['fallback_cb']))
906 906
 			&&
907 907
 			// ...and if the walker can also be serialized to JSON, since it will be included in the placement context data as well,
908
-			( empty( $args['walker'] ) || is_string( $args['walker'] ) )
908
+			(empty($args['walker']) || is_string($args['walker']))
909 909
 			// ...and if it has a theme location assigned or an assigned menu to display,
910 910
 			&& (
911
-				! empty( $args['theme_location'] )
911
+				! empty($args['theme_location'])
912 912
 				||
913
-				( ! empty( $args['menu'] ) && ( is_numeric( $args['menu'] ) || is_object( $args['menu'] ) ) )
913
+				( ! empty($args['menu']) && (is_numeric($args['menu']) || is_object($args['menu'])))
914 914
 			)
915 915
 			&&
916 916
 			// ...and if the nav menu would be rendered with a wrapper container element (upon which to attach data-* attributes).
917 917
 			(
918
-				! empty( $args['container'] )
918
+				! empty($args['container'])
919 919
 				||
920
-				( isset( $args['items_wrap'] ) && '<' === substr( $args['items_wrap'], 0, 1 ) )
920
+				(isset($args['items_wrap']) && '<' === substr($args['items_wrap'], 0, 1))
921 921
 			)
922 922
 		);
923 923
 		$args['can_partial_refresh'] = $can_partial_refresh;
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 		$exported_args = $args;
926 926
 
927 927
 		// Empty out args which may not be JSON-serializable.
928
-		if ( ! $can_partial_refresh ) {
928
+		if ( ! $can_partial_refresh) {
929 929
 			$exported_args['fallback_cb'] = '';
930 930
 			$exported_args['walker'] = '';
931 931
 		}
@@ -934,15 +934,15 @@  discard block
 block discarded – undo
934 934
 		 * Replace object menu arg with a term_id menu arg, as this exports better
935 935
 		 * to JS and is easier to compare hashes.
936 936
 		 */
937
-		if ( ! empty( $exported_args['menu'] ) && is_object( $exported_args['menu'] ) ) {
937
+		if ( ! empty($exported_args['menu']) && is_object($exported_args['menu'])) {
938 938
 			$exported_args['menu'] = $exported_args['menu']->term_id;
939 939
 		}
940 940
 
941
-		ksort( $exported_args );
942
-		$exported_args['args_hmac'] = $this->hash_nav_menu_args( $exported_args );
941
+		ksort($exported_args);
942
+		$exported_args['args_hmac'] = $this->hash_nav_menu_args($exported_args);
943 943
 
944 944
 		$args['customize_preview_nav_menus_args'] = $exported_args;
945
-		$this->preview_nav_menu_instance_args[ $exported_args['args_hmac'] ] = $exported_args;
945
+		$this->preview_nav_menu_instance_args[$exported_args['args_hmac']] = $exported_args;
946 946
 		return $args;
947 947
 	}
948 948
 
@@ -960,12 +960,12 @@  discard block
 block discarded – undo
960 960
 	 * @param object $args             An object containing wp_nav_menu() arguments.
961 961
 	 * @return null
962 962
 	 */
963
-	public function filter_wp_nav_menu( $nav_menu_content, $args ) {
964
-		if ( isset( $args->customize_preview_nav_menus_args['can_partial_refresh'] ) && $args->customize_preview_nav_menus_args['can_partial_refresh'] ) {
965
-			$attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'nav_menu_instance[' . $args->customize_preview_nav_menus_args['args_hmac'] . ']' ) );
963
+	public function filter_wp_nav_menu($nav_menu_content, $args) {
964
+		if (isset($args->customize_preview_nav_menus_args['can_partial_refresh']) && $args->customize_preview_nav_menus_args['can_partial_refresh']) {
965
+			$attributes = sprintf(' data-customize-partial-id="%s"', esc_attr('nav_menu_instance['.$args->customize_preview_nav_menus_args['args_hmac'].']'));
966 966
 			$attributes .= ' data-customize-partial-type="nav_menu_instance"';
967
-			$attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $args->customize_preview_nav_menus_args ) ) );
968
-			$nav_menu_content = preg_replace( '#^(<\w+)#', '$1 ' . $attributes, $nav_menu_content, 1 );
967
+			$attributes .= sprintf(' data-customize-partial-placement-context="%s"', esc_attr(wp_json_encode($args->customize_preview_nav_menus_args)));
968
+			$nav_menu_content = preg_replace('#^(<\w+)#', '$1 '.$attributes, $nav_menu_content, 1);
969 969
 		}
970 970
 		return $nav_menu_content;
971 971
 	}
@@ -982,8 +982,8 @@  discard block
 block discarded – undo
982 982
 	 * @param array $args The arguments to hash.
983 983
 	 * @return string Hashed nav menu arguments.
984 984
 	 */
985
-	public function hash_nav_menu_args( $args ) {
986
-		return wp_hash( serialize( $args ) );
985
+	public function hash_nav_menu_args($args) {
986
+		return wp_hash(serialize($args));
987 987
 	}
988 988
 
989 989
 	/**
@@ -993,8 +993,8 @@  discard block
 block discarded – undo
993 993
 	 * @access public
994 994
 	 */
995 995
 	public function customize_preview_enqueue_deps() {
996
-		wp_enqueue_script( 'customize-preview-nav-menus' ); // Note that we have overridden this.
997
-		wp_enqueue_style( 'customize-preview' );
996
+		wp_enqueue_script('customize-preview-nav-menus'); // Note that we have overridden this.
997
+		wp_enqueue_style('customize-preview');
998 998
 	}
999 999
 
1000 1000
 	/**
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 		$exports = array(
1010 1010
 			'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args,
1011 1011
 		);
1012
-		printf( '<script>var _wpCustomizePreviewNavMenusExports = %s;</script>', wp_json_encode( $exports ) );
1012
+		printf('<script>var _wpCustomizePreviewNavMenusExports = %s;</script>', wp_json_encode($exports));
1013 1013
 	}
1014 1014
 
1015 1015
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	 * @param array $response Response.
1022 1022
 	 * @return array Response.
1023 1023
 	 */
1024
-	public function export_partial_rendered_nav_menu_instances( $response ) {
1024
+	public function export_partial_rendered_nav_menu_instances($response) {
1025 1025
 		$response['nav_menu_instance_args'] = $this->preview_nav_menu_instance_args;
1026 1026
 		return $response;
1027 1027
 	}
@@ -1038,25 +1038,25 @@  discard block
 block discarded – undo
1038 1038
 	 * @param array                $nav_menu_args Nav menu args supplied as container context.
1039 1039
 	 * @return string|false
1040 1040
 	 */
1041
-	public function render_nav_menu_partial( $partial, $nav_menu_args ) {
1042
-		unset( $partial );
1041
+	public function render_nav_menu_partial($partial, $nav_menu_args) {
1042
+		unset($partial);
1043 1043
 
1044
-		if ( ! isset( $nav_menu_args['args_hmac'] ) ) {
1044
+		if ( ! isset($nav_menu_args['args_hmac'])) {
1045 1045
 			// Error: missing_args_hmac.
1046 1046
 			return false;
1047 1047
 		}
1048 1048
 
1049 1049
 		$nav_menu_args_hmac = $nav_menu_args['args_hmac'];
1050
-		unset( $nav_menu_args['args_hmac'] );
1050
+		unset($nav_menu_args['args_hmac']);
1051 1051
 
1052
-		ksort( $nav_menu_args );
1053
-		if ( ! hash_equals( $this->hash_nav_menu_args( $nav_menu_args ), $nav_menu_args_hmac ) ) {
1052
+		ksort($nav_menu_args);
1053
+		if ( ! hash_equals($this->hash_nav_menu_args($nav_menu_args), $nav_menu_args_hmac)) {
1054 1054
 			// Error: args_hmac_mismatch.
1055 1055
 			return false;
1056 1056
 		}
1057 1057
 
1058 1058
 		ob_start();
1059
-		wp_nav_menu( $nav_menu_args );
1059
+		wp_nav_menu($nav_menu_args);
1060 1060
 		$content = ob_get_clean();
1061 1061
 
1062 1062
 		return $content;
Please login to merge, or discard this patch.
src/wp-includes/class-wp-image-editor.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @param int $width
199 199
 	 * @param int $height
200
-	 * @return true
200
+	 * @return boolean
201 201
 	 */
202 202
 	protected function update_size( $width = null, $height = null ) {
203 203
 		$this->size = array(
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @since 4.0.0
214 214
 	 * @access public
215 215
 	 *
216
-	 * @return int $quality Compression Quality. Range: [1,100]
216
+	 * @return boolean $quality Compression Quality. Range: [1,100]
217 217
 	 */
218 218
 	public function get_quality() {
219 219
 		if ( ! $this->quality ) {
Please login to merge, or discard this patch.
Braces   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -313,8 +313,7 @@  discard block
 block discarded – undo
313 313
 		if ( $filename ) {
314 314
 			$file_ext = strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) );
315 315
 			$file_mime = $this->get_mime_type( $file_ext );
316
-		}
317
-		else {
316
+		} else {
318 317
 			// If no file specified, grab editor's current extension and mime-type.
319 318
 			$file_ext = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) );
320 319
 			$file_mime = $this->mime_type;
@@ -348,8 +347,9 @@  discard block
 block discarded – undo
348 347
 			$info = pathinfo( $filename );
349 348
 			$dir  = $info['dirname'];
350 349
 
351
-			if ( isset( $info['extension'] ) )
352
-				$ext = $info['extension'];
350
+			if ( isset( $info['extension'] ) ) {
351
+							$ext = $info['extension'];
352
+			}
353 353
 
354 354
 			$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
355 355
 		}
@@ -370,8 +370,9 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
372 372
 		// $suffix will be appended to the destination filename, just before the extension
373
-		if ( ! $suffix )
374
-			$suffix = $this->get_suffix();
373
+		if ( ! $suffix ) {
374
+					$suffix = $this->get_suffix();
375
+		}
375 376
 
376 377
 		$info = pathinfo( $this->file );
377 378
 		$dir  = $info['dirname'];
@@ -380,8 +381,9 @@  discard block
 block discarded – undo
380 381
 		$name = wp_basename( $this->file, ".$ext" );
381 382
 		$new_ext = strtolower( $extension ? $extension : $ext );
382 383
 
383
-		if ( ! is_null( $dest_path ) && $_dest_path = realpath( $dest_path ) )
384
-			$dir = $_dest_path;
384
+		if ( ! is_null( $dest_path ) && $_dest_path = realpath( $dest_path ) ) {
385
+					$dir = $_dest_path;
386
+		}
385 387
 
386 388
 		return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
387 389
 	}
@@ -395,8 +397,9 @@  discard block
 block discarded – undo
395 397
 	 * @return false|string suffix
396 398
 	 */
397 399
 	public function get_suffix() {
398
-		if ( ! $this->get_size() )
399
-			return false;
400
+		if ( ! $this->get_size() ) {
401
+					return false;
402
+		}
400 403
 
401 404
 		return "{$this->size['width']}x{$this->size['height']}";
402 405
 	}
@@ -427,8 +430,9 @@  discard block
 block discarded – undo
427 430
 
428 431
 			$fp = fopen( $filename, 'w' );
429 432
 
430
-			if ( ! $fp )
431
-				return false;
433
+			if ( ! $fp ) {
434
+							return false;
435
+			}
432 436
 
433 437
 			fwrite( $fp, $contents );
434 438
 			fclose( $fp );
@@ -454,8 +458,9 @@  discard block
 block discarded – undo
454 458
 	 * @return string|false
455 459
 	 */
456 460
 	protected static function get_mime_type( $extension = null ) {
457
-		if ( ! $extension )
458
-			return false;
461
+		if ( ! $extension ) {
462
+					return false;
463
+		}
459 464
 
460 465
 		$mime_types = wp_get_mime_types();
461 466
 		$extensions = array_keys( $mime_types );
@@ -484,8 +489,9 @@  discard block
 block discarded – undo
484 489
 	protected static function get_extension( $mime_type = null ) {
485 490
 		$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );
486 491
 
487
-		if ( empty( $extensions[0] ) )
488
-			return false;
492
+		if ( empty( $extensions[0] ) ) {
493
+					return false;
494
+		}
489 495
 
490 496
 		return $extensions[0];
491 497
 	}
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param string $file Path to the file to load.
26 26
 	 */
27
-	public function __construct( $file ) {
27
+	public function __construct($file) {
28 28
 		$this->file = $file;
29 29
 	}
30 30
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param array $args
42 42
 	 * @return bool
43 43
 	 */
44
-	public static function test( $args = array() ) {
44
+	public static function test($args = array()) {
45 45
 		return false;
46 46
 	}
47 47
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @param string $mime_type
59 59
 	 * @return bool
60 60
 	 */
61
-	public static function supports_mime_type( $mime_type ) {
61
+	public static function supports_mime_type($mime_type) {
62 62
 		return false;
63 63
 	}
64 64
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param string $mime_type
85 85
 	 * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
86 86
 	 */
87
-	abstract public function save( $destfilename = null, $mime_type = null );
87
+	abstract public function save($destfilename = null, $mime_type = null);
88 88
 
89 89
 	/**
90 90
 	 * Resizes current image.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @param  bool     $crop
103 103
 	 * @return bool|WP_Error
104 104
 	 */
105
-	abstract public function resize( $max_w, $max_h, $crop = false );
105
+	abstract public function resize($max_w, $max_h, $crop = false);
106 106
 
107 107
 	/**
108 108
 	 * Resize multiple images from a single source.
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * }
123 123
 	 * @return array An array of resized images metadata by size.
124 124
 	 */
125
-	abstract public function multi_resize( $sizes );
125
+	abstract public function multi_resize($sizes);
126 126
 
127 127
 	/**
128 128
 	 * Crops Image.
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * @param bool $src_abs Optional. If the source crop points are absolute.
141 141
 	 * @return bool|WP_Error
142 142
 	 */
143
-	abstract public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false );
143
+	abstract public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false);
144 144
 
145 145
 	/**
146 146
 	 * Rotates current image counter-clockwise by $angle.
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param float $angle
153 153
 	 * @return bool|WP_Error
154 154
 	 */
155
-	abstract public function rotate( $angle );
155
+	abstract public function rotate($angle);
156 156
 
157 157
 	/**
158 158
 	 * Flips current image.
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param bool $vert Flip along Vertical Axis
166 166
 	 * @return bool|WP_Error
167 167
 	 */
168
-	abstract public function flip( $horz, $vert );
168
+	abstract public function flip($horz, $vert);
169 169
 
170 170
 	/**
171 171
 	 * Streams current image to browser.
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @param string $mime_type
178 178
 	 * @return bool|WP_Error
179 179
 	 */
180
-	abstract public function stream( $mime_type = null );
180
+	abstract public function stream($mime_type = null);
181 181
 
182 182
 	/**
183 183
 	 * Gets dimensions of image.
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param int $height
202 202
 	 * @return true
203 203
 	 */
204
-	protected function update_size( $width = null, $height = null ) {
204
+	protected function update_size($width = null, $height = null) {
205 205
 		$this->size = array(
206 206
 			'width' => (int) $width,
207 207
 			'height' => (int) $height
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return int $quality Compression Quality. Range: [1,100]
219 219
 	 */
220 220
 	public function get_quality() {
221
-		if ( ! $this->quality ) {
221
+		if ( ! $this->quality) {
222 222
 			$this->set_quality();
223 223
 		}
224 224
 
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 	 * @param int $quality Compression Quality. Range: [1,100]
235 235
 	 * @return true|WP_Error True if set successfully; WP_Error on failure.
236 236
 	 */
237
-	public function set_quality( $quality = null ) {
238
-		if ( null === $quality ) {
237
+	public function set_quality($quality = null) {
238
+		if (null === $quality) {
239 239
 			/**
240 240
 			 * Filter the default image compression quality setting.
241 241
 			 *
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 			 * @param int    $quality   Quality level between 1 (low) and 100 (high).
250 250
 			 * @param string $mime_type Image mime type.
251 251
 			 */
252
-			$quality = apply_filters( 'wp_editor_set_quality', $this->default_quality, $this->mime_type );
252
+			$quality = apply_filters('wp_editor_set_quality', $this->default_quality, $this->mime_type);
253 253
 
254
-			if ( 'image/jpeg' == $this->mime_type ) {
254
+			if ('image/jpeg' == $this->mime_type) {
255 255
 				/**
256 256
 				 * Filter the JPEG compression quality for backward-compatibility.
257 257
 				 *
@@ -268,24 +268,24 @@  discard block
 block discarded – undo
268 268
 				 * @param int    $quality Quality level between 0 (low) and 100 (high) of the JPEG.
269 269
 				 * @param string $context Context of the filter.
270 270
 				 */
271
-				$quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );
271
+				$quality = apply_filters('jpeg_quality', $quality, 'image_resize');
272 272
 			}
273 273
 
274
-			if ( $quality < 0 || $quality > 100 ) {
274
+			if ($quality < 0 || $quality > 100) {
275 275
 				$quality = $this->default_quality;
276 276
 			}
277 277
 		}
278 278
 
279 279
 		// Allow 0, but squash to 1 due to identical images in GD, and for backwards compatibility.
280
-		if ( 0 === $quality ) {
280
+		if (0 === $quality) {
281 281
 			$quality = 1;
282 282
 		}
283 283
 
284
-		if ( ( $quality >= 1 ) && ( $quality <= 100 ) ) {
284
+		if (($quality >= 1) && ($quality <= 100)) {
285 285
 			$this->quality = $quality;
286 286
 			return true;
287 287
 		} else {
288
-			return new WP_Error( 'invalid_image_quality', __('Attempted to set image quality outside of the range [1,100].') );
288
+			return new WP_Error('invalid_image_quality', __('Attempted to set image quality outside of the range [1,100].'));
289 289
 		}
290 290
 	}
291 291
 
@@ -304,34 +304,34 @@  discard block
 block discarded – undo
304 304
 	 * @param string $mime_type
305 305
 	 * @return array { filename|null, extension, mime-type }
306 306
 	 */
307
-	protected function get_output_format( $filename = null, $mime_type = null ) {
307
+	protected function get_output_format($filename = null, $mime_type = null) {
308 308
 		$new_ext = null;
309 309
 
310 310
 		// By default, assume specified type takes priority
311
-		if ( $mime_type ) {
312
-			$new_ext = $this->get_extension( $mime_type );
311
+		if ($mime_type) {
312
+			$new_ext = $this->get_extension($mime_type);
313 313
 		}
314 314
 
315
-		if ( $filename ) {
316
-			$file_ext = strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) );
317
-			$file_mime = $this->get_mime_type( $file_ext );
315
+		if ($filename) {
316
+			$file_ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
317
+			$file_mime = $this->get_mime_type($file_ext);
318 318
 		}
319 319
 		else {
320 320
 			// If no file specified, grab editor's current extension and mime-type.
321
-			$file_ext = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) );
321
+			$file_ext = strtolower(pathinfo($this->file, PATHINFO_EXTENSION));
322 322
 			$file_mime = $this->mime_type;
323 323
 		}
324 324
 
325 325
 		// Check to see if specified mime-type is the same as type implied by
326 326
 		// file extension.  If so, prefer extension from file.
327
-		if ( ! $mime_type || ( $file_mime == $mime_type ) ) {
327
+		if ( ! $mime_type || ($file_mime == $mime_type)) {
328 328
 			$mime_type = $file_mime;
329 329
 			$new_ext = $file_ext;
330 330
 		}
331 331
 
332 332
 		// Double-check that the mime-type selected is supported by the editor.
333 333
 		// If not, choose a default instead.
334
-		if ( ! $this->supports_mime_type( $mime_type ) ) {
334
+		if ( ! $this->supports_mime_type($mime_type)) {
335 335
 			/**
336 336
 			 * Filter default mime type prior to getting the file extension.
337 337
 			 *
@@ -341,22 +341,22 @@  discard block
 block discarded – undo
341 341
 			 *
342 342
 			 * @param string $mime_type Mime type string.
343 343
 			 */
344
-			$mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type );
345
-			$new_ext = $this->get_extension( $mime_type );
344
+			$mime_type = apply_filters('image_editor_default_mime_type', $this->default_mime_type);
345
+			$new_ext = $this->get_extension($mime_type);
346 346
 		}
347 347
 
348
-		if ( $filename ) {
348
+		if ($filename) {
349 349
 			$ext = '';
350
-			$info = pathinfo( $filename );
350
+			$info = pathinfo($filename);
351 351
 			$dir  = $info['dirname'];
352 352
 
353
-			if ( isset( $info['extension'] ) )
353
+			if (isset($info['extension']))
354 354
 				$ext = $info['extension'];
355 355
 
356
-			$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
356
+			$filename = trailingslashit($dir).wp_basename($filename, ".$ext").".{$new_ext}";
357 357
 		}
358 358
 
359
-		return array( $filename, $new_ext, $mime_type );
359
+		return array($filename, $new_ext, $mime_type);
360 360
 	}
361 361
 
362 362
 	/**
@@ -370,22 +370,22 @@  discard block
 block discarded – undo
370 370
 	 * @param string $extension
371 371
 	 * @return string filename
372 372
 	 */
373
-	public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
373
+	public function generate_filename($suffix = null, $dest_path = null, $extension = null) {
374 374
 		// $suffix will be appended to the destination filename, just before the extension
375
-		if ( ! $suffix )
375
+		if ( ! $suffix)
376 376
 			$suffix = $this->get_suffix();
377 377
 
378
-		$info = pathinfo( $this->file );
378
+		$info = pathinfo($this->file);
379 379
 		$dir  = $info['dirname'];
380 380
 		$ext  = $info['extension'];
381 381
 
382
-		$name = wp_basename( $this->file, ".$ext" );
383
-		$new_ext = strtolower( $extension ? $extension : $ext );
382
+		$name = wp_basename($this->file, ".$ext");
383
+		$new_ext = strtolower($extension ? $extension : $ext);
384 384
 
385
-		if ( ! is_null( $dest_path ) && $_dest_path = realpath( $dest_path ) )
385
+		if ( ! is_null($dest_path) && $_dest_path = realpath($dest_path))
386 386
 			$dir = $_dest_path;
387 387
 
388
-		return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
388
+		return trailingslashit($dir)."{$name}-{$suffix}.{$new_ext}";
389 389
 	}
390 390
 
391 391
 	/**
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 * @return false|string suffix
398 398
 	 */
399 399
 	public function get_suffix() {
400
-		if ( ! $this->get_size() )
400
+		if ( ! $this->get_size())
401 401
 			return false;
402 402
 
403 403
 		return "{$this->size['width']}x{$this->size['height']}";
@@ -414,29 +414,29 @@  discard block
 block discarded – undo
414 414
 	 * @param array $arguments
415 415
 	 * @return bool
416 416
 	 */
417
-	protected function make_image( $filename, $function, $arguments ) {
418
-		if ( $stream = wp_is_stream( $filename ) ) {
417
+	protected function make_image($filename, $function, $arguments) {
418
+		if ($stream = wp_is_stream($filename)) {
419 419
 			ob_start();
420 420
 		} else {
421 421
 			// The directory containing the original file may no longer exist when using a replication plugin.
422
-			wp_mkdir_p( dirname( $filename ) );
422
+			wp_mkdir_p(dirname($filename));
423 423
 		}
424 424
 
425
-		$result = call_user_func_array( $function, $arguments );
425
+		$result = call_user_func_array($function, $arguments);
426 426
 
427
-		if ( $result && $stream ) {
427
+		if ($result && $stream) {
428 428
 			$contents = ob_get_contents();
429 429
 
430
-			$fp = fopen( $filename, 'w' );
430
+			$fp = fopen($filename, 'w');
431 431
 
432
-			if ( ! $fp )
432
+			if ( ! $fp)
433 433
 				return false;
434 434
 
435
-			fwrite( $fp, $contents );
436
-			fclose( $fp );
435
+			fwrite($fp, $contents);
436
+			fclose($fp);
437 437
 		}
438 438
 
439
-		if ( $stream ) {
439
+		if ($stream) {
440 440
 			ob_end_clean();
441 441
 		}
442 442
 
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 	 * @param string $extension
456 456
 	 * @return string|false
457 457
 	 */
458
-	protected static function get_mime_type( $extension = null ) {
459
-		if ( ! $extension )
458
+	protected static function get_mime_type($extension = null) {
459
+		if ( ! $extension)
460 460
 			return false;
461 461
 
462 462
 		$mime_types = wp_get_mime_types();
463
-		$extensions = array_keys( $mime_types );
463
+		$extensions = array_keys($mime_types);
464 464
 
465
-		foreach ( $extensions as $_extension ) {
466
-			if ( preg_match( "/{$extension}/i", $_extension ) ) {
465
+		foreach ($extensions as $_extension) {
466
+			if (preg_match("/{$extension}/i", $_extension)) {
467 467
 				return $mime_types[$_extension];
468 468
 			}
469 469
 		}
@@ -483,10 +483,10 @@  discard block
 block discarded – undo
483 483
 	 * @param string $mime_type
484 484
 	 * @return string|false
485 485
 	 */
486
-	protected static function get_extension( $mime_type = null ) {
487
-		$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );
486
+	protected static function get_extension($mime_type = null) {
487
+		$extensions = explode('|', array_search($mime_type, wp_get_mime_types()));
488 488
 
489
-		if ( empty( $extensions[0] ) )
489
+		if (empty($extensions[0]))
490 490
 			return false;
491 491
 
492 492
 		return $extensions[0];
Please login to merge, or discard this patch.
src/wp-includes/class-wp.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -699,7 +699,7 @@
 block discarded – undo
699 699
 	 * @access public
700 700
 	 *
701 701
 	 * @param string $subject subject
702
-	 * @param array  $matches data used for substitution
702
+	 * @param string[]  $matches data used for substitution
703 703
 	 * @return string
704 704
 	 */
705 705
 	public static function apply($subject, $matches) {
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -610,22 +610,22 @@
 block discarded – undo
610 610
  	}
611 611
 
612 612
  	/**
613
-	 * Set the Headers for 404, if nothing is found for requested URL.
614
-	 *
615
-	 * Issue a 404 if a request doesn't match any posts and doesn't match
616
-	 * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
617
-	 * issued, and if the request was not a search or the homepage.
618
-	 *
619
-	 * Otherwise, issue a 200.
620
-	 *
621
-	 * This sets headers after posts have been queried. handle_404() really means "handle status."
622
-	 * By inspecting the result of querying posts, seemingly successful requests can be switched to
623
-	 * a 404 so that canonical redirection logic can kick in.
624
-	 *
625
-	 * @since 2.0.0
626
-     * @access public
627
-	 *
628
-	 * @global WP_Query $wp_query
613
+ 	 * Set the Headers for 404, if nothing is found for requested URL.
614
+ 	 *
615
+ 	 * Issue a 404 if a request doesn't match any posts and doesn't match
616
+ 	 * any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already
617
+ 	 * issued, and if the request was not a search or the homepage.
618
+ 	 *
619
+ 	 * Otherwise, issue a 200.
620
+ 	 *
621
+ 	 * This sets headers after posts have been queried. handle_404() really means "handle status."
622
+ 	 * By inspecting the result of querying posts, seemingly successful requests can be switched to
623
+ 	 * a 404 so that canonical redirection logic can kick in.
624
+ 	 *
625
+ 	 * @since 2.0.0
626
+ 	 * @access public
627
+ 	 *
628
+ 	 * @global WP_Query $wp_query
629 629
  	 */
630 630
 	public function handle_404() {
631 631
 		global $wp_query;
Please login to merge, or discard this patch.
Spacing   +142 added lines, -143 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 * @access public
16 16
 	 * @var array
17 17
 	 */
18
-	public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed' );
18
+	public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type', 'embed');
19 19
 
20 20
 	/**
21 21
 	 * Private query variables.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @access public
27 27
 	 * @var array
28 28
 	 */
29
-	public $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'title' );
29
+	public $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in', 'title');
30 30
 
31 31
 	/**
32 32
 	 * Extra query variables set by the user.
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param string $qv Query variable name.
101 101
 	 */
102 102
 	public function add_query_var($qv) {
103
-		if ( !in_array($qv, $this->public_query_vars) )
103
+		if ( ! in_array($qv, $this->public_query_vars))
104 104
 			$this->public_query_vars[] = $qv;
105 105
 	}
106 106
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @param string $name Query variable name.
114 114
 	 */
115
-	public function remove_query_var( $name ) {
116
-		$this->public_query_vars = array_diff( $this->public_query_vars, array( $name ) );
115
+	public function remove_query_var($name) {
116
+		$this->public_query_vars = array_diff($this->public_query_vars, array($name));
117 117
 	}
118 118
 
119 119
 	/**
@@ -154,35 +154,35 @@  discard block
 block discarded – undo
154 154
 		 * @param WP           $this             Current WordPress environment instance.
155 155
 		 * @param array|string $extra_query_vars Extra passed query variables.
156 156
 		 */
157
-		if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) )
157
+		if ( ! apply_filters('do_parse_request', true, $this, $extra_query_vars))
158 158
 			return;
159 159
 
160 160
 		$this->query_vars = array();
161 161
 		$post_type_query_vars = array();
162 162
 
163
-		if ( is_array( $extra_query_vars ) ) {
163
+		if (is_array($extra_query_vars)) {
164 164
 			$this->extra_query_vars = & $extra_query_vars;
165
-		} elseif ( ! empty( $extra_query_vars ) ) {
166
-			parse_str( $extra_query_vars, $this->extra_query_vars );
165
+		} elseif ( ! empty($extra_query_vars)) {
166
+			parse_str($extra_query_vars, $this->extra_query_vars);
167 167
 		}
168 168
 		// Process PATH_INFO, REQUEST_URI, and 404 for permalinks.
169 169
 
170 170
 		// Fetch the rewrite rules.
171 171
 		$rewrite = $wp_rewrite->wp_rewrite_rules();
172 172
 
173
-		if ( ! empty($rewrite) ) {
173
+		if ( ! empty($rewrite)) {
174 174
 			// If we match a rewrite rule, this will be cleared.
175 175
 			$error = '404';
176 176
 			$this->did_permalink = true;
177 177
 
178
-			$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
179
-			list( $pathinfo ) = explode( '?', $pathinfo );
180
-			$pathinfo = str_replace( "%", "%25", $pathinfo );
178
+			$pathinfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
179
+			list($pathinfo) = explode('?', $pathinfo);
180
+			$pathinfo = str_replace("%", "%25", $pathinfo);
181 181
 
182
-			list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
182
+			list($req_uri) = explode('?', $_SERVER['REQUEST_URI']);
183 183
 			$self = $_SERVER['PHP_SELF'];
184
-			$home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
185
-			$home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
184
+			$home_path = trim(parse_url(home_url(), PHP_URL_PATH), '/');
185
+			$home_path_regex = sprintf('|^%s|i', preg_quote($home_path, '|'));
186 186
 
187 187
 			// Trim path info from the end and the leading home path from the
188 188
 			// front. For path info requests, this leaves us with the requesting
@@ -190,22 +190,22 @@  discard block
 block discarded – undo
190 190
 			// requested permalink.
191 191
 			$req_uri = str_replace($pathinfo, '', $req_uri);
192 192
 			$req_uri = trim($req_uri, '/');
193
-			$req_uri = preg_replace( $home_path_regex, '', $req_uri );
193
+			$req_uri = preg_replace($home_path_regex, '', $req_uri);
194 194
 			$req_uri = trim($req_uri, '/');
195 195
 			$pathinfo = trim($pathinfo, '/');
196
-			$pathinfo = preg_replace( $home_path_regex, '', $pathinfo );
196
+			$pathinfo = preg_replace($home_path_regex, '', $pathinfo);
197 197
 			$pathinfo = trim($pathinfo, '/');
198 198
 			$self = trim($self, '/');
199
-			$self = preg_replace( $home_path_regex, '', $self );
199
+			$self = preg_replace($home_path_regex, '', $self);
200 200
 			$self = trim($self, '/');
201 201
 
202 202
 			// The requested permalink is in $pathinfo for path info requests and
203 203
 			//  $req_uri for other requests.
204
-			if ( ! empty($pathinfo) && !preg_match('|^.*' . $wp_rewrite->index . '$|', $pathinfo) ) {
204
+			if ( ! empty($pathinfo) && ! preg_match('|^.*'.$wp_rewrite->index.'$|', $pathinfo)) {
205 205
 				$requested_path = $pathinfo;
206 206
 			} else {
207 207
 				// If the request uri is the index, blank it out so that we don't try to match it against a rule.
208
-				if ( $req_uri == $wp_rewrite->index )
208
+				if ($req_uri == $wp_rewrite->index)
209 209
 					$req_uri = '';
210 210
 				$requested_path = $req_uri;
211 211
 			}
@@ -215,32 +215,32 @@  discard block
 block discarded – undo
215 215
 
216 216
 			// Look for matches.
217 217
 			$request_match = $requested_path;
218
-			if ( empty( $request_match ) ) {
218
+			if (empty($request_match)) {
219 219
 				// An empty request could only match against ^$ regex
220
-				if ( isset( $rewrite['$'] ) ) {
220
+				if (isset($rewrite['$'])) {
221 221
 					$this->matched_rule = '$';
222 222
 					$query = $rewrite['$'];
223 223
 					$matches = array('');
224 224
 				}
225 225
 			} else {
226
-				foreach ( (array) $rewrite as $match => $query ) {
226
+				foreach ((array) $rewrite as $match => $query) {
227 227
 					// If the requested file is the anchor of the match, prepend it to the path info.
228
-					if ( ! empty($requested_file) && strpos($match, $requested_file) === 0 && $requested_file != $requested_path )
229
-						$request_match = $requested_file . '/' . $requested_path;
228
+					if ( ! empty($requested_file) && strpos($match, $requested_file) === 0 && $requested_file != $requested_path)
229
+						$request_match = $requested_file.'/'.$requested_path;
230 230
 
231
-					if ( preg_match("#^$match#", $request_match, $matches) ||
232
-						preg_match("#^$match#", urldecode($request_match), $matches) ) {
231
+					if (preg_match("#^$match#", $request_match, $matches) ||
232
+						preg_match("#^$match#", urldecode($request_match), $matches)) {
233 233
 
234
-						if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
234
+						if ($wp_rewrite->use_verbose_page_rules && preg_match('/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch)) {
235 235
 							// This is a verbose page match, let's check to be sure about it.
236
-							$page = get_page_by_path( $matches[ $varmatch[1] ] );
237
-							if ( ! $page ) {
236
+							$page = get_page_by_path($matches[$varmatch[1]]);
237
+							if ( ! $page) {
238 238
 						 		continue;
239 239
 							}
240 240
 
241
-							$post_status_obj = get_post_status_object( $page->post_status );
241
+							$post_status_obj = get_post_status_object($page->post_status);
242 242
 							if ( ! $post_status_obj->public && ! $post_status_obj->protected
243
-								&& ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
243
+								&& ! $post_status_obj->private && $post_status_obj->exclude_from_search) {
244 244
 								continue;
245 245
 							}
246 246
 						}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 				}
253 253
 			}
254 254
 
255
-			if ( isset( $this->matched_rule ) ) {
255
+			if (isset($this->matched_rule)) {
256 256
 				// Trim the query of everything up to the '?'.
257 257
 				$query = preg_replace("!^.+\?!", '', $query);
258 258
 
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
 				parse_str($query, $perma_query_vars);
266 266
 
267 267
 				// If we're processing a 404 request, clear the error var since we found something.
268
-				if ( '404' == $error )
269
-					unset( $error, $_GET['error'] );
268
+				if ('404' == $error)
269
+					unset($error, $_GET['error']);
270 270
 			}
271 271
 
272 272
 			// If req_uri is empty or if it is a request for ourself, unset error.
273
-			if ( empty($requested_path) || $requested_file == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
274
-				unset( $error, $_GET['error'] );
273
+			if (empty($requested_path) || $requested_file == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false) {
274
+				unset($error, $_GET['error']);
275 275
 
276
-				if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
277
-					unset( $perma_query_vars );
276
+				if (isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false)
277
+					unset($perma_query_vars);
278 278
 
279 279
 				$this->did_permalink = false;
280 280
 			}
@@ -291,36 +291,36 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @param array $public_query_vars The array of whitelisted query variables.
293 293
 		 */
294
-		$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );
294
+		$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
295 295
 
296
-		foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {
297
-			if ( is_post_type_viewable( $t ) && $t->query_var ) {
296
+		foreach (get_post_types(array(), 'objects') as $post_type => $t) {
297
+			if (is_post_type_viewable($t) && $t->query_var) {
298 298
 				$post_type_query_vars[$t->query_var] = $post_type;
299 299
 			}
300 300
 		}
301 301
 
302
-		foreach ( $this->public_query_vars as $wpvar ) {
303
-			if ( isset( $this->extra_query_vars[$wpvar] ) )
302
+		foreach ($this->public_query_vars as $wpvar) {
303
+			if (isset($this->extra_query_vars[$wpvar]))
304 304
 				$this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
305
-			elseif ( isset( $_POST[$wpvar] ) )
305
+			elseif (isset($_POST[$wpvar]))
306 306
 				$this->query_vars[$wpvar] = $_POST[$wpvar];
307
-			elseif ( isset( $_GET[$wpvar] ) )
307
+			elseif (isset($_GET[$wpvar]))
308 308
 				$this->query_vars[$wpvar] = $_GET[$wpvar];
309
-			elseif ( isset( $perma_query_vars[$wpvar] ) )
309
+			elseif (isset($perma_query_vars[$wpvar]))
310 310
 				$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
311 311
 
312
-			if ( !empty( $this->query_vars[$wpvar] ) ) {
313
-				if ( ! is_array( $this->query_vars[$wpvar] ) ) {
312
+			if ( ! empty($this->query_vars[$wpvar])) {
313
+				if ( ! is_array($this->query_vars[$wpvar])) {
314 314
 					$this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar];
315 315
 				} else {
316
-					foreach ( $this->query_vars[$wpvar] as $vkey => $v ) {
317
-						if ( !is_object( $v ) ) {
316
+					foreach ($this->query_vars[$wpvar] as $vkey => $v) {
317
+						if ( ! is_object($v)) {
318 318
 							$this->query_vars[$wpvar][$vkey] = (string) $v;
319 319
 						}
320 320
 					}
321 321
 				}
322 322
 
323
-				if ( isset($post_type_query_vars[$wpvar] ) ) {
323
+				if (isset($post_type_query_vars[$wpvar])) {
324 324
 					$this->query_vars['post_type'] = $post_type_query_vars[$wpvar];
325 325
 					$this->query_vars['name'] = $this->query_vars[$wpvar];
326 326
 				}
@@ -328,43 +328,43 @@  discard block
 block discarded – undo
328 328
 		}
329 329
 
330 330
 		// Convert urldecoded spaces back into +
331
-		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t )
332
-			if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
333
-				$this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
331
+		foreach (get_taxonomies(array(), 'objects') as $taxonomy => $t)
332
+			if ($t->query_var && isset($this->query_vars[$t->query_var]))
333
+				$this->query_vars[$t->query_var] = str_replace(' ', '+', $this->query_vars[$t->query_var]);
334 334
 
335 335
 		// Don't allow non-publicly queryable taxonomies to be queried from the front end.
336
-		if ( ! is_admin() ) {
337
-			foreach ( get_taxonomies( array( 'publicly_queryable' => false ), 'objects' ) as $taxonomy => $t ) {
336
+		if ( ! is_admin()) {
337
+			foreach (get_taxonomies(array('publicly_queryable' => false), 'objects') as $taxonomy => $t) {
338 338
 				/*
339 339
 				 * Disallow when set to the 'taxonomy' query var.
340 340
 				 * Non-publicly queryable taxonomies cannot register custom query vars. See register_taxonomy().
341 341
 				 */
342
-				if ( isset( $this->query_vars['taxonomy'] ) && $taxonomy === $this->query_vars['taxonomy'] ) {
343
-					unset( $this->query_vars['taxonomy'], $this->query_vars['term'] );
342
+				if (isset($this->query_vars['taxonomy']) && $taxonomy === $this->query_vars['taxonomy']) {
343
+					unset($this->query_vars['taxonomy'], $this->query_vars['term']);
344 344
 				}
345 345
 			}
346 346
 		}
347 347
 
348 348
 		// Limit publicly queried post_types to those that are publicly_queryable
349
-		if ( isset( $this->query_vars['post_type']) ) {
350
-			$queryable_post_types = get_post_types( array('publicly_queryable' => true) );
351
-			if ( ! is_array( $this->query_vars['post_type'] ) ) {
352
-				if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
353
-					unset( $this->query_vars['post_type'] );
349
+		if (isset($this->query_vars['post_type'])) {
350
+			$queryable_post_types = get_post_types(array('publicly_queryable' => true));
351
+			if ( ! is_array($this->query_vars['post_type'])) {
352
+				if ( ! in_array($this->query_vars['post_type'], $queryable_post_types))
353
+					unset($this->query_vars['post_type']);
354 354
 			} else {
355
-				$this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
355
+				$this->query_vars['post_type'] = array_intersect($this->query_vars['post_type'], $queryable_post_types);
356 356
 			}
357 357
 		}
358 358
 
359 359
 		// Resolve conflicts between posts with numeric slugs and date archive queries.
360
-		$this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars );
360
+		$this->query_vars = wp_resolve_numeric_slug_conflicts($this->query_vars);
361 361
 
362
-		foreach ( (array) $this->private_query_vars as $var) {
363
-			if ( isset($this->extra_query_vars[$var]) )
362
+		foreach ((array) $this->private_query_vars as $var) {
363
+			if (isset($this->extra_query_vars[$var]))
364 364
 				$this->query_vars[$var] = $this->extra_query_vars[$var];
365 365
 		}
366 366
 
367
-		if ( isset($error) )
367
+		if (isset($error))
368 368
 			$this->query_vars['error'] = $error;
369 369
 
370 370
 		/**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 		 *
375 375
 		 * @param array $query_vars The array of requested query variables.
376 376
 		 */
377
-		$this->query_vars = apply_filters( 'request', $this->query_vars );
377
+		$this->query_vars = apply_filters('request', $this->query_vars);
378 378
 
379 379
 		/**
380 380
 		 * Fires once all query variables for the current request have been parsed.
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		 *
384 384
 		 * @param WP &$this Current WordPress environment instance (passed by reference).
385 385
 		 */
386
-		do_action_ref_array( 'parse_request', array( &$this ) );
386
+		do_action_ref_array('parse_request', array(&$this));
387 387
 	}
388 388
 
389 389
 	/**
@@ -401,50 +401,50 @@  discard block
 block discarded – undo
401 401
 		$status = null;
402 402
 		$exit_required = false;
403 403
 
404
-		if ( is_user_logged_in() )
404
+		if (is_user_logged_in())
405 405
 			$headers = array_merge($headers, wp_get_nocache_headers());
406
-		if ( ! empty( $this->query_vars['error'] ) ) {
406
+		if ( ! empty($this->query_vars['error'])) {
407 407
 			$status = (int) $this->query_vars['error'];
408
-			if ( 404 === $status ) {
409
-				if ( ! is_user_logged_in() )
408
+			if (404 === $status) {
409
+				if ( ! is_user_logged_in())
410 410
 					$headers = array_merge($headers, wp_get_nocache_headers());
411
-				$headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
412
-			} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {
411
+				$headers['Content-Type'] = get_option('html_type').'; charset='.get_option('blog_charset');
412
+			} elseif (in_array($status, array(403, 500, 502, 503))) {
413 413
 				$exit_required = true;
414 414
 			}
415
-		} elseif ( empty( $this->query_vars['feed'] ) ) {
416
-			$headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
415
+		} elseif (empty($this->query_vars['feed'])) {
416
+			$headers['Content-Type'] = get_option('html_type').'; charset='.get_option('blog_charset');
417 417
 		} else {
418 418
 			// Set the correct content type for feeds
419 419
 			$type = $this->query_vars['feed'];
420
-			if ( 'feed' == $this->query_vars['feed'] ) {
420
+			if ('feed' == $this->query_vars['feed']) {
421 421
 				$type = get_default_feed();
422 422
 			}
423
-			$headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' );
423
+			$headers['Content-Type'] = feed_content_type($type).'; charset='.get_option('blog_charset');
424 424
 
425 425
 			// We're showing a feed, so WP is indeed the only thing that last changed
426
-			if ( !empty($this->query_vars['withcomments'])
427
-				|| false !== strpos( $this->query_vars['feed'], 'comments-' )
428
-				|| ( empty($this->query_vars['withoutcomments'])
429
-					&& ( !empty($this->query_vars['p'])
430
-						|| !empty($this->query_vars['name'])
431
-						|| !empty($this->query_vars['page_id'])
432
-						|| !empty($this->query_vars['pagename'])
433
-						|| !empty($this->query_vars['attachment'])
434
-						|| !empty($this->query_vars['attachment_id'])
426
+			if ( ! empty($this->query_vars['withcomments'])
427
+				|| false !== strpos($this->query_vars['feed'], 'comments-')
428
+				|| (empty($this->query_vars['withoutcomments'])
429
+					&& ( ! empty($this->query_vars['p'])
430
+						|| ! empty($this->query_vars['name'])
431
+						|| ! empty($this->query_vars['page_id'])
432
+						|| ! empty($this->query_vars['pagename'])
433
+						|| ! empty($this->query_vars['attachment'])
434
+						|| ! empty($this->query_vars['attachment_id'])
435 435
 					)
436 436
 				)
437 437
 			)
438 438
 				$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
439 439
 			else
440 440
 				$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
441
-			$wp_etag = '"' . md5($wp_last_modified) . '"';
441
+			$wp_etag = '"'.md5($wp_last_modified).'"';
442 442
 			$headers['Last-Modified'] = $wp_last_modified;
443 443
 			$headers['ETag'] = $wp_etag;
444 444
 
445 445
 			// Support for Conditional GET
446 446
 			if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
447
-				$client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );
447
+				$client_etag = wp_unslash($_SERVER['HTTP_IF_NONE_MATCH']);
448 448
 			else $client_etag = false;
449 449
 
450 450
 			$client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
@@ -454,9 +454,8 @@  discard block
 block discarded – undo
454 454
 			// Make a timestamp for our most recent modification...
455 455
 			$wp_modified_timestamp = strtotime($wp_last_modified);
456 456
 
457
-			if ( ($client_last_modified && $client_etag) ?
458
-					 (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
459
-					 (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
457
+			if (($client_last_modified && $client_etag) ?
458
+					 (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) : (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag))) {
460 459
 				$status = 304;
461 460
 				$exit_required = true;
462 461
 			}
@@ -470,23 +469,23 @@  discard block
 block discarded – undo
470 469
 		 * @param array $headers The list of headers to be sent.
471 470
 		 * @param WP    $this    Current WordPress environment instance.
472 471
 		 */
473
-		$headers = apply_filters( 'wp_headers', $headers, $this );
472
+		$headers = apply_filters('wp_headers', $headers, $this);
474 473
 
475
-		if ( ! empty( $status ) )
476
-			status_header( $status );
474
+		if ( ! empty($status))
475
+			status_header($status);
477 476
 
478 477
 		// If Last-Modified is set to false, it should not be sent (no-cache situation).
479
-		if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {
480
-			unset( $headers['Last-Modified'] );
478
+		if (isset($headers['Last-Modified']) && false === $headers['Last-Modified']) {
479
+			unset($headers['Last-Modified']);
481 480
 
482 481
 			// In PHP 5.3+, make sure we are not sending a Last-Modified header.
483
-			if ( function_exists( 'header_remove' ) ) {
484
-				@header_remove( 'Last-Modified' );
482
+			if (function_exists('header_remove')) {
483
+				@header_remove('Last-Modified');
485 484
 			} else {
486 485
 				// In PHP 5.2, send an empty Last-Modified header, but only as a
487 486
 				// last resort to override a header already sent. #WP23021
488
-				foreach ( headers_list() as $header ) {
489
-					if ( 0 === stripos( $header, 'Last-Modified' ) ) {
487
+				foreach (headers_list() as $header) {
488
+					if (0 === stripos($header, 'Last-Modified')) {
490 489
 						$headers['Last-Modified'] = '';
491 490
 						break;
492 491
 					}
@@ -494,10 +493,10 @@  discard block
 block discarded – undo
494 493
 			}
495 494
 		}
496 495
 
497
-		foreach ( (array) $headers as $name => $field_value )
496
+		foreach ((array) $headers as $name => $field_value)
498 497
 			@header("{$name}: {$field_value}");
499 498
 
500
-		if ( $exit_required )
499
+		if ($exit_required)
501 500
 			exit();
502 501
 
503 502
 		/**
@@ -507,7 +506,7 @@  discard block
 block discarded – undo
507 506
 		 *
508 507
 		 * @param WP &$this Current WordPress environment instance (passed by reference).
509 508
 		 */
510
-		do_action_ref_array( 'send_headers', array( &$this ) );
509
+		do_action_ref_array('send_headers', array(&$this));
511 510
 	}
512 511
 
513 512
 	/**
@@ -521,16 +520,16 @@  discard block
 block discarded – undo
521 520
 	 */
522 521
 	public function build_query_string() {
523 522
 		$this->query_string = '';
524
-		foreach ( (array) array_keys($this->query_vars) as $wpvar) {
525
-			if ( '' != $this->query_vars[$wpvar] ) {
523
+		foreach ((array) array_keys($this->query_vars) as $wpvar) {
524
+			if ('' != $this->query_vars[$wpvar]) {
526 525
 				$this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
527
-				if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
526
+				if ( ! is_scalar($this->query_vars[$wpvar])) // Discard non-scalars.
528 527
 					continue;
529
-				$this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]);
528
+				$this->query_string .= $wpvar.'='.rawurlencode($this->query_vars[$wpvar]);
530 529
 			}
531 530
 		}
532 531
 
533
-		if ( has_filter( 'query_string' ) ) {  // Don't bother filtering and parsing if no plugins are hooked in.
532
+		if (has_filter('query_string')) {  // Don't bother filtering and parsing if no plugins are hooked in.
534 533
 			/**
535 534
 			 * Filters the query string before parsing.
536 535
 			 *
@@ -539,7 +538,7 @@  discard block
 block discarded – undo
539 538
 			 *
540 539
 			 * @param string $query_string The query string to modify.
541 540
 			 */
542
-			$this->query_string = apply_filters( 'query_string', $this->query_string );
541
+			$this->query_string = apply_filters('query_string', $this->query_string);
543 542
 			parse_str($this->query_string, $this->query_vars);
544 543
 		}
545 544
 	}
@@ -567,22 +566,22 @@  discard block
 block discarded – undo
567 566
 		global $wp_query;
568 567
 
569 568
 		// Extract updated query vars back into global namespace.
570
-		foreach ( (array) $wp_query->query_vars as $key => $value ) {
571
-			$GLOBALS[ $key ] = $value;
569
+		foreach ((array) $wp_query->query_vars as $key => $value) {
570
+			$GLOBALS[$key] = $value;
572 571
 		}
573 572
 
574 573
 		$GLOBALS['query_string'] = $this->query_string;
575 574
 		$GLOBALS['posts'] = & $wp_query->posts;
576
-		$GLOBALS['post'] = isset( $wp_query->post ) ? $wp_query->post : null;
575
+		$GLOBALS['post'] = isset($wp_query->post) ? $wp_query->post : null;
577 576
 		$GLOBALS['request'] = $wp_query->request;
578 577
 
579
-		if ( $wp_query->is_single() || $wp_query->is_page() ) {
578
+		if ($wp_query->is_single() || $wp_query->is_page()) {
580 579
 			$GLOBALS['more']   = 1;
581 580
 			$GLOBALS['single'] = 1;
582 581
 		}
583 582
 
584
-		if ( $wp_query->is_author() && isset( $wp_query->post ) )
585
-			$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
583
+		if ($wp_query->is_author() && isset($wp_query->post))
584
+			$GLOBALS['authordata'] = get_userdata($wp_query->post->post_author);
586 585
 	}
587 586
 
588 587
 	/**
@@ -641,70 +640,70 @@  discard block
 block discarded – undo
641 640
 		 * @param bool     $preempt  Whether to short-circuit default header status handling. Default false.
642 641
 		 * @param WP_Query $wp_query WordPress Query object.
643 642
 		 */
644
-		if ( false !== apply_filters( 'pre_handle_404', false, $wp_query ) ) {
643
+		if (false !== apply_filters('pre_handle_404', false, $wp_query)) {
645 644
 			return;
646 645
 		}
647 646
 
648 647
 		// If we've already issued a 404, bail.
649
-		if ( is_404() )
648
+		if (is_404())
650 649
 			return;
651 650
 
652 651
 		// Never 404 for the admin, robots, or if we found posts.
653
-		if ( is_admin() || is_robots() || $wp_query->posts ) {
652
+		if (is_admin() || is_robots() || $wp_query->posts) {
654 653
 
655 654
 			$success = true;
656
-			if ( is_singular() ) {
655
+			if (is_singular()) {
657 656
 				$p = false;
658 657
 
659
-				if ( $wp_query->post instanceof WP_Post ) {
658
+				if ($wp_query->post instanceof WP_Post) {
660 659
 					$p = clone $wp_query->post;
661 660
 				}
662 661
 
663 662
 				// Only set X-Pingback for single posts that allow pings.
664
-				if ( $p && pings_open( $p ) ) {
665
-					@header( 'X-Pingback: ' . get_bloginfo( 'pingback_url' ) );
663
+				if ($p && pings_open($p)) {
664
+					@header('X-Pingback: '.get_bloginfo('pingback_url'));
666 665
 				}
667 666
 
668 667
 				// check for paged content that exceeds the max number of pages
669 668
 				$next = '<!--nextpage-->';
670
-				if ( $p && false !== strpos( $p->post_content, $next ) && ! empty( $this->query_vars['page'] ) ) {
671
-					$page = trim( $this->query_vars['page'], '/' );
672
-					$success = (int) $page <= ( substr_count( $p->post_content, $next ) + 1 );
669
+				if ($p && false !== strpos($p->post_content, $next) && ! empty($this->query_vars['page'])) {
670
+					$page = trim($this->query_vars['page'], '/');
671
+					$success = (int) $page <= (substr_count($p->post_content, $next) + 1);
673 672
 				}
674 673
 			}
675 674
 
676
-			if ( $success ) {
677
-				status_header( 200 );
675
+			if ($success) {
676
+				status_header(200);
678 677
 				return;
679 678
 			}
680 679
 		}
681 680
 
682 681
 		// We will 404 for paged queries, as no posts were found.
683
-		if ( ! is_paged() ) {
682
+		if ( ! is_paged()) {
684 683
 
685 684
 			// Don't 404 for authors without posts as long as they matched an author on this site.
686
-			$author = get_query_var( 'author' );
687
-			if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {
688
-				status_header( 200 );
685
+			$author = get_query_var('author');
686
+			if (is_author() && is_numeric($author) && $author > 0 && is_user_member_of_blog($author)) {
687
+				status_header(200);
689 688
 				return;
690 689
 			}
691 690
 
692 691
 			// Don't 404 for these queries if they matched an object.
693
-			if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {
694
-				status_header( 200 );
692
+			if ((is_tag() || is_category() || is_tax() || is_post_type_archive()) && get_queried_object()) {
693
+				status_header(200);
695 694
 				return;
696 695
 			}
697 696
 
698 697
 			// Don't 404 for these queries either.
699
-			if ( is_home() || is_search() || is_feed() ) {
700
-				status_header( 200 );
698
+			if (is_home() || is_search() || is_feed()) {
699
+				status_header(200);
701 700
 				return;
702 701
 			}
703 702
 		}
704 703
 
705 704
 		// Guess it's time to 404.
706 705
 		$wp_query->set_404();
707
-		status_header( 404 );
706
+		status_header(404);
708 707
 		nocache_headers();
709 708
 	}
710 709
 
@@ -735,7 +734,7 @@  discard block
 block discarded – undo
735 734
 		 *
736 735
 		 * @param WP &$this Current WordPress environment instance (passed by reference).
737 736
 		 */
738
-		do_action_ref_array( 'wp', array( &$this ) );
737
+		do_action_ref_array('wp', array(&$this));
739 738
 	}
740 739
 }
741 740
 
@@ -825,6 +824,6 @@  discard block
 block discarded – undo
825 824
 	 */
826 825
 	public function callback($matches) {
827 826
 		$index = intval(substr($matches[0], 9, -1));
828
-		return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
827
+		return (isset($this->_matches[$index]) ? urlencode($this->_matches[$index]) : '');
829 828
 	}
830 829
 }
Please login to merge, or discard this patch.
Braces   +73 added lines, -50 removed lines patch added patch discarded remove patch
@@ -100,8 +100,9 @@  discard block
 block discarded – undo
100 100
 	 * @param string $qv Query variable name.
101 101
 	 */
102 102
 	public function add_query_var($qv) {
103
-		if ( !in_array($qv, $this->public_query_vars) )
104
-			$this->public_query_vars[] = $qv;
103
+		if ( !in_array($qv, $this->public_query_vars) ) {
104
+					$this->public_query_vars[] = $qv;
105
+		}
105 106
 	}
106 107
 
107 108
 	/**
@@ -154,8 +155,9 @@  discard block
 block discarded – undo
154 155
 		 * @param WP           $this             Current WordPress environment instance.
155 156
 		 * @param array|string $extra_query_vars Extra passed query variables.
156 157
 		 */
157
-		if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) )
158
-			return;
158
+		if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) ) {
159
+					return;
160
+		}
159 161
 
160 162
 		$this->query_vars = array();
161 163
 		$post_type_query_vars = array();
@@ -205,8 +207,9 @@  discard block
 block discarded – undo
205 207
 				$requested_path = $pathinfo;
206 208
 			} else {
207 209
 				// If the request uri is the index, blank it out so that we don't try to match it against a rule.
208
-				if ( $req_uri == $wp_rewrite->index )
209
-					$req_uri = '';
210
+				if ( $req_uri == $wp_rewrite->index ) {
211
+									$req_uri = '';
212
+				}
210 213
 				$requested_path = $req_uri;
211 214
 			}
212 215
 			$requested_file = $req_uri;
@@ -225,8 +228,9 @@  discard block
 block discarded – undo
225 228
 			} else {
226 229
 				foreach ( (array) $rewrite as $match => $query ) {
227 230
 					// If the requested file is the anchor of the match, prepend it to the path info.
228
-					if ( ! empty($requested_file) && strpos($match, $requested_file) === 0 && $requested_file != $requested_path )
229
-						$request_match = $requested_file . '/' . $requested_path;
231
+					if ( ! empty($requested_file) && strpos($match, $requested_file) === 0 && $requested_file != $requested_path ) {
232
+											$request_match = $requested_file . '/' . $requested_path;
233
+					}
230 234
 
231 235
 					if ( preg_match("#^$match#", $request_match, $matches) ||
232 236
 						preg_match("#^$match#", urldecode($request_match), $matches) ) {
@@ -265,16 +269,18 @@  discard block
 block discarded – undo
265 269
 				parse_str($query, $perma_query_vars);
266 270
 
267 271
 				// If we're processing a 404 request, clear the error var since we found something.
268
-				if ( '404' == $error )
269
-					unset( $error, $_GET['error'] );
272
+				if ( '404' == $error ) {
273
+									unset( $error, $_GET['error'] );
274
+				}
270 275
 			}
271 276
 
272 277
 			// If req_uri is empty or if it is a request for ourself, unset error.
273 278
 			if ( empty($requested_path) || $requested_file == $self || strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
274 279
 				unset( $error, $_GET['error'] );
275 280
 
276
-				if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
277
-					unset( $perma_query_vars );
281
+				if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false ) {
282
+									unset( $perma_query_vars );
283
+				}
278 284
 
279 285
 				$this->did_permalink = false;
280 286
 			}
@@ -300,14 +306,15 @@  discard block
 block discarded – undo
300 306
 		}
301 307
 
302 308
 		foreach ( $this->public_query_vars as $wpvar ) {
303
-			if ( isset( $this->extra_query_vars[$wpvar] ) )
304
-				$this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
305
-			elseif ( isset( $_POST[$wpvar] ) )
306
-				$this->query_vars[$wpvar] = $_POST[$wpvar];
307
-			elseif ( isset( $_GET[$wpvar] ) )
308
-				$this->query_vars[$wpvar] = $_GET[$wpvar];
309
-			elseif ( isset( $perma_query_vars[$wpvar] ) )
310
-				$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
309
+			if ( isset( $this->extra_query_vars[$wpvar] ) ) {
310
+							$this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
311
+			} elseif ( isset( $_POST[$wpvar] ) ) {
312
+							$this->query_vars[$wpvar] = $_POST[$wpvar];
313
+			} elseif ( isset( $_GET[$wpvar] ) ) {
314
+							$this->query_vars[$wpvar] = $_GET[$wpvar];
315
+			} elseif ( isset( $perma_query_vars[$wpvar] ) ) {
316
+							$this->query_vars[$wpvar] = $perma_query_vars[$wpvar];
317
+			}
311 318
 
312 319
 			if ( !empty( $this->query_vars[$wpvar] ) ) {
313 320
 				if ( ! is_array( $this->query_vars[$wpvar] ) ) {
@@ -328,9 +335,10 @@  discard block
 block discarded – undo
328 335
 		}
329 336
 
330 337
 		// Convert urldecoded spaces back into +
331
-		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t )
332
-			if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
338
+		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
339
+					if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
333 340
 				$this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
341
+		}
334 342
 
335 343
 		// Don't allow non-publicly queryable taxonomies to be queried from the front end.
336 344
 		if ( ! is_admin() ) {
@@ -349,8 +357,9 @@  discard block
 block discarded – undo
349 357
 		if ( isset( $this->query_vars['post_type']) ) {
350 358
 			$queryable_post_types = get_post_types( array('publicly_queryable' => true) );
351 359
 			if ( ! is_array( $this->query_vars['post_type'] ) ) {
352
-				if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) )
353
-					unset( $this->query_vars['post_type'] );
360
+				if ( ! in_array( $this->query_vars['post_type'], $queryable_post_types ) ) {
361
+									unset( $this->query_vars['post_type'] );
362
+				}
354 363
 			} else {
355 364
 				$this->query_vars['post_type'] = array_intersect( $this->query_vars['post_type'], $queryable_post_types );
356 365
 			}
@@ -360,12 +369,14 @@  discard block
 block discarded – undo
360 369
 		$this->query_vars = wp_resolve_numeric_slug_conflicts( $this->query_vars );
361 370
 
362 371
 		foreach ( (array) $this->private_query_vars as $var) {
363
-			if ( isset($this->extra_query_vars[$var]) )
364
-				$this->query_vars[$var] = $this->extra_query_vars[$var];
372
+			if ( isset($this->extra_query_vars[$var]) ) {
373
+							$this->query_vars[$var] = $this->extra_query_vars[$var];
374
+			}
365 375
 		}
366 376
 
367
-		if ( isset($error) )
368
-			$this->query_vars['error'] = $error;
377
+		if ( isset($error) ) {
378
+					$this->query_vars['error'] = $error;
379
+		}
369 380
 
370 381
 		/**
371 382
 		 * Filters the array of parsed query variables.
@@ -401,13 +412,15 @@  discard block
 block discarded – undo
401 412
 		$status = null;
402 413
 		$exit_required = false;
403 414
 
404
-		if ( is_user_logged_in() )
405
-			$headers = array_merge($headers, wp_get_nocache_headers());
415
+		if ( is_user_logged_in() ) {
416
+					$headers = array_merge($headers, wp_get_nocache_headers());
417
+		}
406 418
 		if ( ! empty( $this->query_vars['error'] ) ) {
407 419
 			$status = (int) $this->query_vars['error'];
408 420
 			if ( 404 === $status ) {
409
-				if ( ! is_user_logged_in() )
410
-					$headers = array_merge($headers, wp_get_nocache_headers());
421
+				if ( ! is_user_logged_in() ) {
422
+									$headers = array_merge($headers, wp_get_nocache_headers());
423
+				}
411 424
 				$headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
412 425
 			} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {
413 426
 				$exit_required = true;
@@ -434,18 +447,21 @@  discard block
 block discarded – undo
434 447
 						|| !empty($this->query_vars['attachment_id'])
435 448
 					)
436 449
 				)
437
-			)
438
-				$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
439
-			else
440
-				$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
450
+			) {
451
+							$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
452
+			} else {
453
+							$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
454
+			}
441 455
 			$wp_etag = '"' . md5($wp_last_modified) . '"';
442 456
 			$headers['Last-Modified'] = $wp_last_modified;
443 457
 			$headers['ETag'] = $wp_etag;
444 458
 
445 459
 			// Support for Conditional GET
446
-			if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
447
-				$client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );
448
-			else $client_etag = false;
460
+			if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
461
+							$client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] );
462
+			} else {
463
+				$client_etag = false;
464
+			}
449 465
 
450 466
 			$client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']);
451 467
 			// If string is empty, return 0. If not, attempt to parse into a timestamp
@@ -472,8 +488,9 @@  discard block
 block discarded – undo
472 488
 		 */
473 489
 		$headers = apply_filters( 'wp_headers', $headers, $this );
474 490
 
475
-		if ( ! empty( $status ) )
476
-			status_header( $status );
491
+		if ( ! empty( $status ) ) {
492
+					status_header( $status );
493
+		}
477 494
 
478 495
 		// If Last-Modified is set to false, it should not be sent (no-cache situation).
479 496
 		if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {
@@ -494,11 +511,13 @@  discard block
 block discarded – undo
494 511
 			}
495 512
 		}
496 513
 
497
-		foreach ( (array) $headers as $name => $field_value )
498
-			@header("{$name}: {$field_value}");
514
+		foreach ( (array) $headers as $name => $field_value ) {
515
+					@header("{$name}: {$field_value}");
516
+		}
499 517
 
500
-		if ( $exit_required )
501
-			exit();
518
+		if ( $exit_required ) {
519
+					exit();
520
+		}
502 521
 
503 522
 		/**
504 523
 		 * Fires once the requested HTTP headers for caching, content type, etc. have been sent.
@@ -524,8 +543,10 @@  discard block
 block discarded – undo
524 543
 		foreach ( (array) array_keys($this->query_vars) as $wpvar) {
525 544
 			if ( '' != $this->query_vars[$wpvar] ) {
526 545
 				$this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
527
-				if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
546
+				if ( !is_scalar($this->query_vars[$wpvar]) ) {
547
+					// Discard non-scalars.
528 548
 					continue;
549
+				}
529 550
 				$this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]);
530 551
 			}
531 552
 		}
@@ -581,8 +602,9 @@  discard block
 block discarded – undo
581 602
 			$GLOBALS['single'] = 1;
582 603
 		}
583 604
 
584
-		if ( $wp_query->is_author() && isset( $wp_query->post ) )
585
-			$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
605
+		if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
606
+					$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
607
+		}
586 608
 	}
587 609
 
588 610
 	/**
@@ -646,8 +668,9 @@  discard block
 block discarded – undo
646 668
 		}
647 669
 
648 670
 		// If we've already issued a 404, bail.
649
-		if ( is_404() )
650
-			return;
671
+		if ( is_404() ) {
672
+					return;
673
+		}
651 674
 
652 675
 		// Never 404 for the admin, robots, or if we found posts.
653 676
 		if ( is_admin() || is_robots() || $wp_query->posts ) {
Please login to merge, or discard this patch.
src/wp-includes/class.wp-dependencies.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @access public
271 271
 	 * @since 2.1.0
272 272
 	 *
273
-	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
273
+	 * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings).
274 274
 	 * @return void
275 275
 	 */
276 276
 	public function remove( $handles ) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @access public
290 290
 	 * @since 2.1.0
291 291
 	 *
292
-	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
292
+	 * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings).
293 293
 	 */
294 294
 	public function enqueue( $handles ) {
295 295
 		foreach ( (array) $handles as $handle ) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 * @access public
312 312
 	 * @since 2.1.0
313 313
 	 *
314
-	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
314
+	 * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings).
315 315
 	 */
316 316
 	public function dequeue( $handles ) {
317 317
 		foreach ( (array) $handles as $handle ) {
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -95,26 +95,26 @@  discard block
 block discarded – undo
95 95
 	 * @param mixed $group   Group level: level (int), no groups (false).
96 96
 	 * @return array Handles of items that have been processed.
97 97
 	 */
98
-	public function do_items( $handles = false, $group = false ) {
98
+	public function do_items($handles = false, $group = false) {
99 99
 		/*
100 100
 		 * If nothing is passed, print the queue. If a string is passed,
101 101
 		 * print that item. If an array is passed, print those items.
102 102
 		 */
103 103
 		$handles = false === $handles ? $this->queue : (array) $handles;
104
-		$this->all_deps( $handles );
104
+		$this->all_deps($handles);
105 105
 
106
-		foreach ( $this->to_do as $key => $handle ) {
107
-			if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
106
+		foreach ($this->to_do as $key => $handle) {
107
+			if ( ! in_array($handle, $this->done, true) && isset($this->registered[$handle])) {
108 108
 				/*
109 109
 				 * Attempt to process the item. If successful,
110 110
 				 * add the handle to the done array.
111 111
 				 *
112 112
 				 * Unset the item from the to_do array.
113 113
 				 */
114
-				if ( $this->do_item( $handle, $group ) )
114
+				if ($this->do_item($handle, $group))
115 115
 					$this->done[] = $handle;
116 116
 
117
-				unset( $this->to_do[$key] );
117
+				unset($this->to_do[$key]);
118 118
 			}
119 119
 		}
120 120
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param string $handle Name of the item. Should be unique.
131 131
 	 * @return bool True on success, false if not set.
132 132
 	 */
133
-	public function do_item( $handle ) {
133
+	public function do_item($handle) {
134 134
 		return isset($this->registered[$handle]);
135 135
 	}
136 136
 
@@ -150,43 +150,43 @@  discard block
 block discarded – undo
150 150
 	 * @param int|false $group     Group level: (int) level, (false) no groups.
151 151
 	 * @return bool True on success, false on failure.
152 152
 	 */
153
-	public function all_deps( $handles, $recursion = false, $group = false ) {
154
-		if ( !$handles = (array) $handles )
153
+	public function all_deps($handles, $recursion = false, $group = false) {
154
+		if ( ! $handles = (array) $handles)
155 155
 			return false;
156 156
 
157
-		foreach ( $handles as $handle ) {
157
+		foreach ($handles as $handle) {
158 158
 			$handle_parts = explode('?', $handle);
159 159
 			$handle = $handle_parts[0];
160 160
 			$queued = in_array($handle, $this->to_do, true);
161 161
 
162
-			if ( in_array($handle, $this->done, true) ) // Already done
162
+			if (in_array($handle, $this->done, true)) // Already done
163 163
 				continue;
164 164
 
165
-			$moved     = $this->set_group( $handle, $recursion, $group );
166
-			$new_group = $this->groups[ $handle ];
165
+			$moved     = $this->set_group($handle, $recursion, $group);
166
+			$new_group = $this->groups[$handle];
167 167
 
168
-			if ( $queued && !$moved ) // already queued and in the right group
168
+			if ($queued && ! $moved) // already queued and in the right group
169 169
 				continue;
170 170
 
171 171
 			$keep_going = true;
172
-			if ( !isset($this->registered[$handle]) )
172
+			if ( ! isset($this->registered[$handle]))
173 173
 				$keep_going = false; // Item doesn't exist.
174
-			elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
174
+			elseif ($this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)))
175 175
 				$keep_going = false; // Item requires dependencies that don't exist.
176
-			elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) )
176
+			elseif ($this->registered[$handle]->deps && ! $this->all_deps($this->registered[$handle]->deps, true, $new_group))
177 177
 				$keep_going = false; // Item requires dependencies that don't exist.
178 178
 
179
-			if ( ! $keep_going ) { // Either item or its dependencies don't exist.
180
-				if ( $recursion )
179
+			if ( ! $keep_going) { // Either item or its dependencies don't exist.
180
+				if ($recursion)
181 181
 					return false; // Abort this branch.
182 182
 				else
183 183
 					continue; // We're at the top level. Move on to the next one.
184 184
 			}
185 185
 
186
-			if ( $queued ) // Already grabbed it and its dependencies.
186
+			if ($queued) // Already grabbed it and its dependencies.
187 187
 				continue;
188 188
 
189
-			if ( isset($handle_parts[1]) )
189
+			if (isset($handle_parts[1]))
190 190
 				$this->args[$handle] = $handle_parts[1];
191 191
 
192 192
 			$this->to_do[] = $handle;
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * @param mixed            $args   Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer. 
215 215
 	 * @return bool Whether the item has been registered. True on success, false on failure.
216 216
 	 */
217
-	public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
218
-		if ( isset($this->registered[$handle]) )
217
+	public function add($handle, $src, $deps = array(), $ver = false, $args = null) {
218
+		if (isset($this->registered[$handle]))
219 219
 			return false;
220
-		$this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );
220
+		$this->registered[$handle] = new _WP_Dependency($handle, $src, $deps, $ver, $args);
221 221
 		return true;
222 222
 	}
223 223
 
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	 * @param mixed  $value  The data value.
235 235
 	 * @return bool True on success, false on failure.
236 236
 	 */
237
-	public function add_data( $handle, $key, $value ) {
238
-		if ( !isset( $this->registered[$handle] ) )
237
+	public function add_data($handle, $key, $value) {
238
+		if ( ! isset($this->registered[$handle]))
239 239
 			return false;
240 240
 
241
-		return $this->registered[$handle]->add_data( $key, $value );
241
+		return $this->registered[$handle]->add_data($key, $value);
242 242
 	}
243 243
 
244 244
 	/**
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 	 * @param string $key    The data key.
254 254
 	 * @return mixed Extra item data (string), false otherwise.
255 255
 	 */
256
-	public function get_data( $handle, $key ) {
257
-		if ( !isset( $this->registered[$handle] ) )
256
+	public function get_data($handle, $key) {
257
+		if ( ! isset($this->registered[$handle]))
258 258
 			return false;
259 259
 
260
-		if ( !isset( $this->registered[$handle]->extra[$key] ) )
260
+		if ( ! isset($this->registered[$handle]->extra[$key]))
261 261
 			return false;
262 262
 
263 263
 		return $this->registered[$handle]->extra[$key];
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
274 274
 	 * @return void
275 275
 	 */
276
-	public function remove( $handles ) {
277
-		foreach ( (array) $handles as $handle )
276
+	public function remove($handles) {
277
+		foreach ((array) $handles as $handle)
278 278
 			unset($this->registered[$handle]);
279 279
 	}
280 280
 
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
294 294
 	 */
295
-	public function enqueue( $handles ) {
296
-		foreach ( (array) $handles as $handle ) {
295
+	public function enqueue($handles) {
296
+		foreach ((array) $handles as $handle) {
297 297
 			$handle = explode('?', $handle);
298
-			if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
298
+			if ( ! in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]])) {
299 299
 				$this->queue[] = $handle[0];
300
-				if ( isset($handle[1]) )
300
+				if (isset($handle[1]))
301 301
 					$this->args[$handle[0]] = $handle[1];
302 302
 			}
303 303
 		}
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
317 317
 	 */
318
-	public function dequeue( $handles ) {
319
-		foreach ( (array) $handles as $handle ) {
318
+	public function dequeue($handles) {
319
+		foreach ((array) $handles as $handle) {
320 320
 			$handle = explode('?', $handle);
321 321
 			$key = array_search($handle[0], $this->queue);
322
-			if ( false !== $key ) {
322
+			if (false !== $key) {
323 323
 				unset($this->queue[$key]);
324 324
 				unset($this->args[$handle[0]]);
325 325
 			}
@@ -335,15 +335,15 @@  discard block
 block discarded – undo
335 335
 	 * @param string $handle Name of the item. Should be unique.
336 336
 	 * @return bool Whether the handle is found after recursively searching the dependency tree.
337 337
 	 */
338
-	protected function recurse_deps( $queue, $handle ) {
339
-		foreach ( $queue as $queued ) {
340
-			if ( ! isset( $this->registered[ $queued ] ) ) {
338
+	protected function recurse_deps($queue, $handle) {
339
+		foreach ($queue as $queued) {
340
+			if ( ! isset($this->registered[$queued])) {
341 341
 				continue;
342 342
 			}
343 343
 
344
-			if ( in_array( $handle, $this->registered[ $queued ]->deps ) ) {
344
+			if (in_array($handle, $this->registered[$queued]->deps)) {
345 345
 				return true;
346
-			} elseif ( $this->recurse_deps( $this->registered[ $queued ]->deps, $handle ) ) {
346
+			} elseif ($this->recurse_deps($this->registered[$queued]->deps, $handle)) {
347 347
 				return true;
348 348
 			}
349 349
 		}
@@ -362,28 +362,28 @@  discard block
 block discarded – undo
362 362
 	 * @param string $list   Property name of list array.
363 363
 	 * @return bool|_WP_Dependency Found, or object Item data.
364 364
 	 */
365
-	public function query( $handle, $list = 'registered' ) {
366
-		switch ( $list ) {
365
+	public function query($handle, $list = 'registered') {
366
+		switch ($list) {
367 367
 			case 'registered' :
368 368
 			case 'scripts': // back compat
369
-				if ( isset( $this->registered[ $handle ] ) )
370
-					return $this->registered[ $handle ];
369
+				if (isset($this->registered[$handle]))
370
+					return $this->registered[$handle];
371 371
 				return false;
372 372
 
373 373
 			case 'enqueued' :
374 374
 			case 'queue' :
375
-				if ( in_array( $handle, $this->queue ) ) {
375
+				if (in_array($handle, $this->queue)) {
376 376
 					return true;
377 377
 				}
378
-				return $this->recurse_deps( $this->queue, $handle );
378
+				return $this->recurse_deps($this->queue, $handle);
379 379
 
380 380
 			case 'to_do' :
381 381
 			case 'to_print': // back compat
382
-				return in_array( $handle, $this->to_do );
382
+				return in_array($handle, $this->to_do);
383 383
 
384 384
 			case 'done' :
385 385
 			case 'printed': // back compat
386
-				return in_array( $handle, $this->done );
386
+				return in_array($handle, $this->done);
387 387
 		}
388 388
 		return false;
389 389
 	}
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 	 * @param mixed  $group     Group level.
400 400
 	 * @return bool Not already in the group or a lower group
401 401
 	 */
402
-	public function set_group( $handle, $recursion, $group ) {
402
+	public function set_group($handle, $recursion, $group) {
403 403
 		$group = (int) $group;
404 404
 
405
-		if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) {
405
+		if (isset($this->groups[$handle]) && $this->groups[$handle] <= $group) {
406 406
 			return false;
407 407
 		}
408 408
 
409
-		$this->groups[ $handle ] = $group;
409
+		$this->groups[$handle] = $group;
410 410
 
411 411
 		return true;
412 412
 	}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 	 * @since 2.6.0
468 468
 	 * @var null
469 469
 	 */
470
-	public $args = null;  // Custom property, such as $in_footer or $media.
470
+	public $args = null; // Custom property, such as $in_footer or $media.
471 471
 
472 472
 	/**
473 473
 	 * Extra data to supply to the handle.
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 * @since 2.6.0
485 485
 	 */
486 486
 	public function __construct() {
487
-		@list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
488
-		if ( ! is_array($this->deps) )
487
+		@list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
488
+		if ( ! is_array($this->deps))
489 489
 			$this->deps = array();
490 490
 	}
491 491
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	 * @param mixed  $data The data value to add.
500 500
 	 * @return bool False if not scalar, true otherwise.
501 501
 	 */
502
-	public function add_data( $name, $data ) {
503
-		if ( !is_scalar($name) )
502
+	public function add_data($name, $data) {
503
+		if ( ! is_scalar($name))
504 504
 			return false;
505 505
 		$this->extra[$name] = $data;
506 506
 		return true;
Please login to merge, or discard this patch.
Braces   +65 added lines, -37 removed lines patch added patch discarded remove patch
@@ -111,8 +111,9 @@  discard block
 block discarded – undo
111 111
 				 *
112 112
 				 * Unset the item from the to_do array.
113 113
 				 */
114
-				if ( $this->do_item( $handle, $group ) )
115
-					$this->done[] = $handle;
114
+				if ( $this->do_item( $handle, $group ) ) {
115
+									$this->done[] = $handle;
116
+				}
116 117
 
117 118
 				unset( $this->to_do[$key] );
118 119
 			}
@@ -151,43 +152,61 @@  discard block
 block discarded – undo
151 152
 	 * @return bool True on success, false on failure.
152 153
 	 */
153 154
 	public function all_deps( $handles, $recursion = false, $group = false ) {
154
-		if ( !$handles = (array) $handles )
155
-			return false;
155
+		if ( !$handles = (array) $handles ) {
156
+					return false;
157
+		}
156 158
 
157 159
 		foreach ( $handles as $handle ) {
158 160
 			$handle_parts = explode('?', $handle);
159 161
 			$handle = $handle_parts[0];
160 162
 			$queued = in_array($handle, $this->to_do, true);
161 163
 
162
-			if ( in_array($handle, $this->done, true) ) // Already done
164
+			if ( in_array($handle, $this->done, true) ) {
165
+				// Already done
163 166
 				continue;
167
+			}
164 168
 
165 169
 			$moved     = $this->set_group( $handle, $recursion, $group );
166 170
 			$new_group = $this->groups[ $handle ];
167 171
 
168
-			if ( $queued && !$moved ) // already queued and in the right group
172
+			if ( $queued && !$moved ) {
173
+				// already queued and in the right group
169 174
 				continue;
175
+			}
170 176
 
171 177
 			$keep_going = true;
172
-			if ( !isset($this->registered[$handle]) )
173
-				$keep_going = false; // Item doesn't exist.
174
-			elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
175
-				$keep_going = false; // Item requires dependencies that don't exist.
176
-			elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) )
177
-				$keep_going = false; // Item requires dependencies that don't exist.
178
+			if ( !isset($this->registered[$handle]) ) {
179
+							$keep_going = false;
180
+			}
181
+			// Item doesn't exist.
182
+			elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) {
183
+							$keep_going = false;
184
+			}
185
+			// Item requires dependencies that don't exist.
186
+			elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) ) {
187
+							$keep_going = false;
188
+			}
189
+			// Item requires dependencies that don't exist.
178 190
 
179 191
 			if ( ! $keep_going ) { // Either item or its dependencies don't exist.
180
-				if ( $recursion )
181
-					return false; // Abort this branch.
182
-				else
183
-					continue; // We're at the top level. Move on to the next one.
192
+				if ( $recursion ) {
193
+									return false;
194
+				}
195
+				// Abort this branch.
196
+				else {
197
+									continue;
198
+				}
199
+				// We're at the top level. Move on to the next one.
184 200
 			}
185 201
 
186
-			if ( $queued ) // Already grabbed it and its dependencies.
202
+			if ( $queued ) {
203
+				// Already grabbed it and its dependencies.
187 204
 				continue;
205
+			}
188 206
 
189
-			if ( isset($handle_parts[1]) )
190
-				$this->args[$handle] = $handle_parts[1];
207
+			if ( isset($handle_parts[1]) ) {
208
+							$this->args[$handle] = $handle_parts[1];
209
+			}
191 210
 
192 211
 			$this->to_do[] = $handle;
193 212
 		}
@@ -215,8 +234,9 @@  discard block
 block discarded – undo
215 234
 	 * @return bool Whether the item has been registered. True on success, false on failure.
216 235
 	 */
217 236
 	public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) {
218
-		if ( isset($this->registered[$handle]) )
219
-			return false;
237
+		if ( isset($this->registered[$handle]) ) {
238
+					return false;
239
+		}
220 240
 		$this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args );
221 241
 		return true;
222 242
 	}
@@ -235,8 +255,9 @@  discard block
 block discarded – undo
235 255
 	 * @return bool True on success, false on failure.
236 256
 	 */
237 257
 	public function add_data( $handle, $key, $value ) {
238
-		if ( !isset( $this->registered[$handle] ) )
239
-			return false;
258
+		if ( !isset( $this->registered[$handle] ) ) {
259
+					return false;
260
+		}
240 261
 
241 262
 		return $this->registered[$handle]->add_data( $key, $value );
242 263
 	}
@@ -254,11 +275,13 @@  discard block
 block discarded – undo
254 275
 	 * @return mixed Extra item data (string), false otherwise.
255 276
 	 */
256 277
 	public function get_data( $handle, $key ) {
257
-		if ( !isset( $this->registered[$handle] ) )
258
-			return false;
278
+		if ( !isset( $this->registered[$handle] ) ) {
279
+					return false;
280
+		}
259 281
 
260
-		if ( !isset( $this->registered[$handle]->extra[$key] ) )
261
-			return false;
282
+		if ( !isset( $this->registered[$handle]->extra[$key] ) ) {
283
+					return false;
284
+		}
262 285
 
263 286
 		return $this->registered[$handle]->extra[$key];
264 287
 	}
@@ -274,8 +297,9 @@  discard block
 block discarded – undo
274 297
 	 * @return void
275 298
 	 */
276 299
 	public function remove( $handles ) {
277
-		foreach ( (array) $handles as $handle )
278
-			unset($this->registered[$handle]);
300
+		foreach ( (array) $handles as $handle ) {
301
+					unset($this->registered[$handle]);
302
+		}
279 303
 	}
280 304
 
281 305
 	/**
@@ -297,8 +321,9 @@  discard block
 block discarded – undo
297 321
 			$handle = explode('?', $handle);
298 322
 			if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
299 323
 				$this->queue[] = $handle[0];
300
-				if ( isset($handle[1]) )
301
-					$this->args[$handle[0]] = $handle[1];
324
+				if ( isset($handle[1]) ) {
325
+									$this->args[$handle[0]] = $handle[1];
326
+				}
302 327
 			}
303 328
 		}
304 329
 	}
@@ -366,8 +391,9 @@  discard block
 block discarded – undo
366 391
 		switch ( $list ) {
367 392
 			case 'registered' :
368 393
 			case 'scripts': // back compat
369
-				if ( isset( $this->registered[ $handle ] ) )
370
-					return $this->registered[ $handle ];
394
+				if ( isset( $this->registered[ $handle ] ) ) {
395
+									return $this->registered[ $handle ];
396
+				}
371 397
 				return false;
372 398
 
373 399
 			case 'enqueued' :
@@ -485,8 +511,9 @@  discard block
 block discarded – undo
485 511
 	 */
486 512
 	public function __construct() {
487 513
 		@list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
488
-		if ( ! is_array($this->deps) )
489
-			$this->deps = array();
514
+		if ( ! is_array($this->deps) ) {
515
+					$this->deps = array();
516
+		}
490 517
 	}
491 518
 
492 519
 	/**
@@ -500,8 +527,9 @@  discard block
 block discarded – undo
500 527
 	 * @return bool False if not scalar, true otherwise.
501 528
 	 */
502 529
 	public function add_data( $name, $data ) {
503
-		if ( !is_scalar($name) )
504
-			return false;
530
+		if ( !is_scalar($name) ) {
531
+					return false;
532
+		}
505 533
 		$this->extra[$name] = $data;
506 534
 		return true;
507 535
 	}
Please login to merge, or discard this patch.
src/wp-includes/feed.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -524,7 +524,7 @@
 block discarded – undo
524 524
  * @since 2.5.0
525 525
  *
526 526
  * @param string $data Input string
527
- * @return array array(type, value)
527
+ * @return string[] array(type, value)
528 528
  */
529 529
 function prep_atom_text_construct($data) {
530 530
 	if (strpos($data, '<') === false && strpos($data, '&') === false) {
Please login to merge, or discard this patch.
Braces   +42 added lines, -28 removed lines patch added patch discarded remove patch
@@ -179,8 +179,9 @@  discard block
 block discarded – undo
179 179
  * @return string The filtered content.
180 180
  */
181 181
 function get_the_content_feed($feed_type = null) {
182
-	if ( !$feed_type )
183
-		$feed_type = get_default_feed();
182
+	if ( !$feed_type ) {
183
+			$feed_type = get_default_feed();
184
+	}
184 185
 
185 186
 	/** This filter is documented in wp-includes/post-template.php */
186 187
 	$content = apply_filters( 'the_content', get_the_content() );
@@ -281,8 +282,9 @@  discard block
 block discarded – undo
281 282
 function get_comment_guid($comment_id = null) {
282 283
 	$comment = get_comment($comment_id);
283 284
 
284
-	if ( !is_object($comment) )
285
-		return false;
285
+	if ( !is_object($comment) ) {
286
+			return false;
287
+	}
286 288
 
287 289
 	return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
288 290
 }
@@ -365,34 +367,41 @@  discard block
 block discarded – undo
365 367
  * @return string All of the post categories for displaying in the feed.
366 368
  */
367 369
 function get_the_category_rss($type = null) {
368
-	if ( empty($type) )
369
-		$type = get_default_feed();
370
+	if ( empty($type) ) {
371
+			$type = get_default_feed();
372
+	}
370 373
 	$categories = get_the_category();
371 374
 	$tags = get_the_tags();
372 375
 	$the_list = '';
373 376
 	$cat_names = array();
374 377
 
375 378
 	$filter = 'rss';
376
-	if ( 'atom' == $type )
377
-		$filter = 'raw';
379
+	if ( 'atom' == $type ) {
380
+			$filter = 'raw';
381
+	}
378 382
 
379
-	if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
383
+	if ( !empty($categories) ) {
384
+		foreach ( (array) $categories as $category ) {
380 385
 		$cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
381 386
 	}
387
+	}
382 388
 
383
-	if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
389
+	if ( !empty($tags) ) {
390
+		foreach ( (array) $tags as $tag ) {
384 391
 		$cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
385 392
 	}
393
+	}
386 394
 
387 395
 	$cat_names = array_unique($cat_names);
388 396
 
389 397
 	foreach ( $cat_names as $cat_name ) {
390
-		if ( 'rdf' == $type )
391
-			$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
392
-		elseif ( 'atom' == $type )
393
-			$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
394
-		else
395
-			$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
398
+		if ( 'rdf' == $type ) {
399
+					$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
400
+		} elseif ( 'atom' == $type ) {
401
+					$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
402
+		} else {
403
+					$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
404
+		}
396 405
 	}
397 406
 
398 407
 	/**
@@ -428,10 +437,11 @@  discard block
 block discarded – undo
428 437
  */
429 438
 function html_type_rss() {
430 439
 	$type = get_bloginfo('html_type');
431
-	if (strpos($type, 'xhtml') !== false)
432
-		$type = 'xhtml';
433
-	else
434
-		$type = 'html';
440
+	if (strpos($type, 'xhtml') !== false) {
441
+			$type = 'xhtml';
442
+	} else {
443
+			$type = 'html';
444
+	}
435 445
 	echo $type;
436 446
 }
437 447
 
@@ -450,8 +460,9 @@  discard block
 block discarded – undo
450 460
  * @since 1.5.0
451 461
  */
452 462
 function rss_enclosure() {
453
-	if ( post_password_required() )
454
-		return;
463
+	if ( post_password_required() ) {
464
+			return;
465
+	}
455 466
 
456 467
 	foreach ( (array) get_post_custom() as $key => $val) {
457 468
 		if ($key == 'enclosure') {
@@ -489,8 +500,9 @@  discard block
 block discarded – undo
489 500
  * @since 2.2.0
490 501
  */
491 502
 function atom_enclosure() {
492
-	if ( post_password_required() )
493
-		return;
503
+	if ( post_password_required() ) {
504
+			return;
505
+	}
494 506
 
495 507
 	foreach ( (array) get_post_custom() as $key => $val ) {
496 508
 		if ($key == 'enclosure') {
@@ -618,8 +630,9 @@  discard block
 block discarded – undo
618 630
  * @since 2.8.0
619 631
  */
620 632
 function feed_content_type( $type = '' ) {
621
-	if ( empty($type) )
622
-		$type = get_default_feed();
633
+	if ( empty($type) ) {
634
+			$type = get_default_feed();
635
+	}
623 636
 
624 637
 	$types = array(
625 638
 		'rss'  => 'application/rss+xml',
@@ -683,8 +696,9 @@  discard block
 block discarded – undo
683 696
 	$feed->set_output_encoding( get_option( 'blog_charset' ) );
684 697
 	$feed->handle_content_type();
685 698
 
686
-	if ( $feed->error() )
687
-		return new WP_Error( 'simplepie-error', $feed->error() );
699
+	if ( $feed->error() ) {
700
+			return new WP_Error( 'simplepie-error', $feed->error() );
701
+	}
688 702
 
689 703
 	return $feed;
690 704
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param string $info Converted string value of the blog information.
36 36
 	 * @param string $show The type of blog information to retrieve.
37 37
 	 */
38
-	return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
38
+	return apply_filters('get_bloginfo_rss', convert_chars($info), $show);
39 39
 }
40 40
 
41 41
 /**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @param string $rss_container RSS container for the blog information.
62 62
 	 * @param string $show          The type of blog information to retrieve.
63 63
 	 */
64
-	echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show );
64
+	echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show);
65 65
 }
66 66
 
67 67
 /**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'.
84 84
 	 *                          Default 'rss2'.
85 85
 	 */
86
-	$default_feed = apply_filters( 'default_feed', 'rss2' );
86
+	$default_feed = apply_filters('default_feed', 'rss2');
87 87
 	return 'rss' == $default_feed ? 'rss2' : $default_feed;
88 88
 }
89 89
 
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
  * @param string $deprecated Unused..
97 97
  * @return string The document title.
98 98
  */
99
-function get_wp_title_rss( $deprecated = '&#8211;' ) {
100
-	if ( '&#8211;' !== $deprecated ) {
99
+function get_wp_title_rss($deprecated = '&#8211;') {
100
+	if ('&#8211;' !== $deprecated) {
101 101
 		/* translators: %s: 'document_title_separator' filter name */
102
-		_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
102
+		_deprecated_argument(__FUNCTION__, '4.4.0', sprintf(__('Use the %s filter instead.'), '<code>document_title_separator</code>'));
103 103
 	}
104 104
 
105 105
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param string $title      The current blog title.
112 112
 	 * @param string $deprecated Unused.
113 113
 	 */
114
-	return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated );
114
+	return apply_filters('get_wp_title_rss', wp_get_document_title(), $deprecated);
115 115
 }
116 116
 
117 117
 /**
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
  *
123 123
  * @param string $deprecated Unused.
124 124
  */
125
-function wp_title_rss( $deprecated = '&#8211;' ) {
126
-	if ( '&#8211;' !== $deprecated ) {
125
+function wp_title_rss($deprecated = '&#8211;') {
126
+	if ('&#8211;' !== $deprecated) {
127 127
 		/* translators: %s: 'document_title_separator' filter name */
128
-		_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
128
+		_deprecated_argument(__FUNCTION__, '4.4.0', sprintf(__('Use the %s filter instead.'), '<code>document_title_separator</code>'));
129 129
 	}
130 130
 
131 131
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @param string $wp_title_rss The current blog title.
140 140
 	 * @param string $deprecated   Unused.
141 141
 	 */
142
-	echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated );
142
+	echo apply_filters('wp_title_rss', get_wp_title_rss(), $deprecated);
143 143
 }
144 144
 
145 145
 /**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @param string $title The current post title.
161 161
 	 */
162
-	$title = apply_filters( 'the_title_rss', $title );
162
+	$title = apply_filters('the_title_rss', $title);
163 163
 	return $title;
164 164
 }
165 165
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
  * @return string The filtered content.
183 183
  */
184 184
 function get_the_content_feed($feed_type = null) {
185
-	if ( !$feed_type )
185
+	if ( ! $feed_type)
186 186
 		$feed_type = get_default_feed();
187 187
 
188 188
 	/** This filter is documented in wp-includes/post-template.php */
189
-	$content = apply_filters( 'the_content', get_the_content() );
189
+	$content = apply_filters('the_content', get_the_content());
190 190
 	$content = str_replace(']]>', ']]&gt;', $content);
191 191
 	/**
192 192
 	 * Filter the post content for use in feeds.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
198 198
 	 *                          Default 'rss2'.
199 199
 	 */
200
-	return apply_filters( 'the_content_feed', $content, $feed_type );
200
+	return apply_filters('the_content_feed', $content, $feed_type);
201 201
 }
202 202
 
203 203
 /**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @param string $output The current post excerpt.
227 227
 	 */
228
-	echo apply_filters( 'the_excerpt_rss', $output );
228
+	echo apply_filters('the_excerpt_rss', $output);
229 229
 }
230 230
 
231 231
 /**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param string $post_permalink The current post permalink.
243 243
 	 */
244
-	echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) );
244
+	echo esc_url(apply_filters('the_permalink_rss', get_permalink()));
245 245
 }
246 246
 
247 247
 /**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @param string $comment_permalink The current comment permalink with
260 260
 	 *                                  '#comments' appended.
261 261
 	 */
262
-	echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) );
262
+	echo esc_url(apply_filters('comments_link_feed', get_comments_link()));
263 263
 }
264 264
 
265 265
 /**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
  * @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object.
271 271
  */
272 272
 function comment_guid($comment_id = null) {
273
-	echo esc_url( get_comment_guid($comment_id) );
273
+	echo esc_url(get_comment_guid($comment_id));
274 274
 }
275 275
 
276 276
 /**
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 function get_comment_guid($comment_id = null) {
285 285
 	$comment = get_comment($comment_id);
286 286
 
287
-	if ( !is_object($comment) )
287
+	if ( ! is_object($comment))
288 288
 		return false;
289 289
 
290
-	return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID;
290
+	return get_the_guid($comment->comment_post_ID).'#comment-'.$comment->comment_ID;
291 291
 }
292 292
 
293 293
 /**
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
  *
299 299
  * @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object.
300 300
  */
301
-function comment_link( $comment = null ) {
301
+function comment_link($comment = null) {
302 302
 	/**
303 303
 	 * Filter the current comment's permalink.
304 304
 	 *
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 *
309 309
 	 * @param string $comment_permalink The current comment permalink.
310 310
 	 */
311
-	echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
311
+	echo esc_url(apply_filters('comment_link', get_comment_link($comment)));
312 312
 }
313 313
 
314 314
 /**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 *
329 329
 	 * @param string $comment_author The current comment author.
330 330
 	 */
331
-	return apply_filters( 'comment_author_rss', get_comment_author() );
331
+	return apply_filters('comment_author_rss', get_comment_author());
332 332
 }
333 333
 
334 334
 /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @param string $comment_text The content of the current comment.
356 356
 	 */
357
-	$comment_text = apply_filters( 'comment_text_rss', $comment_text );
357
+	$comment_text = apply_filters('comment_text_rss', $comment_text);
358 358
 	echo $comment_text;
359 359
 }
360 360
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
  * @return string All of the post categories for displaying in the feed.
372 372
  */
373 373
 function get_the_category_rss($type = null) {
374
-	if ( empty($type) )
374
+	if (empty($type))
375 375
 		$type = get_default_feed();
376 376
 	$categories = get_the_category();
377 377
 	$tags = get_the_tags();
@@ -379,26 +379,26 @@  discard block
 block discarded – undo
379 379
 	$cat_names = array();
380 380
 
381 381
 	$filter = 'rss';
382
-	if ( 'atom' == $type )
382
+	if ('atom' == $type)
383 383
 		$filter = 'raw';
384 384
 
385
-	if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
385
+	if ( ! empty($categories)) foreach ((array) $categories as $category) {
386 386
 		$cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
387 387
 	}
388 388
 
389
-	if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
389
+	if ( ! empty($tags)) foreach ((array) $tags as $tag) {
390 390
 		$cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
391 391
 	}
392 392
 
393 393
 	$cat_names = array_unique($cat_names);
394 394
 
395
-	foreach ( $cat_names as $cat_name ) {
396
-		if ( 'rdf' == $type )
395
+	foreach ($cat_names as $cat_name) {
396
+		if ('rdf' == $type)
397 397
 			$the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
398
-		elseif ( 'atom' == $type )
399
-			$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
398
+		elseif ('atom' == $type)
399
+			$the_list .= sprintf('<category scheme="%1$s" term="%2$s" />', esc_attr(get_bloginfo_rss('url')), esc_attr($cat_name));
400 400
 		else
401
-			$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
401
+			$the_list .= "\t\t<category><![CDATA[".@html_entity_decode($cat_name, ENT_COMPAT, get_option('blog_charset'))."]]></category>\n";
402 402
 	}
403 403
 
404 404
 	/**
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 * @param string $type     Type of feed. Possible values include 'rss2', 'atom'.
411 411
 	 *                         Default 'rss2'.
412 412
 	 */
413
-	return apply_filters( 'the_category_rss', $the_list, $type );
413
+	return apply_filters('the_category_rss', $the_list, $type);
414 414
 }
415 415
 
416 416
 /**
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
  * @since 1.5.0
457 457
  */
458 458
 function rss_enclosure() {
459
-	if ( post_password_required() )
459
+	if (post_password_required())
460 460
 		return;
461 461
 
462
-	foreach ( (array) get_post_custom() as $key => $val) {
462
+	foreach ((array) get_post_custom() as $key => $val) {
463 463
 		if ($key == 'enclosure') {
464
-			foreach ( (array) $val as $enc ) {
464
+			foreach ((array) $val as $enc) {
465 465
 				$enclosure = explode("\n", $enc);
466 466
 
467 467
 				// only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3'
468
-				$t = preg_split('/[ \t]/', trim($enclosure[2]) );
468
+				$t = preg_split('/[ \t]/', trim($enclosure[2]));
469 469
 				$type = $t[0];
470 470
 
471 471
 				/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 				 *
476 476
 				 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
477 477
 				 */
478
-				echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\n" );
478
+				echo apply_filters('rss_enclosure', '<enclosure url="'.trim(htmlspecialchars($enclosure[0])).'" length="'.trim($enclosure[1]).'" type="'.$type.'" />'."\n");
479 479
 			}
480 480
 		}
481 481
 	}
@@ -495,12 +495,12 @@  discard block
 block discarded – undo
495 495
  * @since 2.2.0
496 496
  */
497 497
 function atom_enclosure() {
498
-	if ( post_password_required() )
498
+	if (post_password_required())
499 499
 		return;
500 500
 
501
-	foreach ( (array) get_post_custom() as $key => $val ) {
501
+	foreach ((array) get_post_custom() as $key => $val) {
502 502
 		if ($key == 'enclosure') {
503
-			foreach ( (array) $val as $enc ) {
503
+			foreach ((array) $val as $enc) {
504 504
 				$enclosure = explode("\n", $enc);
505 505
 				/**
506 506
 				 * Filter the atom enclosure HTML link tag for the current post.
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 				 *
510 510
 				 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
511 511
 				 */
512
-				echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" );
512
+				echo apply_filters('atom_enclosure', '<link href="'.trim(htmlspecialchars($enclosure[0])).'" rel="enclosure" length="'.trim($enclosure[1]).'" type="'.trim($enclosure[2]).'" />'."\n");
513 513
 			}
514 514
 		}
515 515
 	}
@@ -538,11 +538,11 @@  discard block
 block discarded – undo
538 538
 	}
539 539
 
540 540
 	$parser = xml_parser_create();
541
-	xml_parse($parser, '<div>' . $data . '</div>', true);
541
+	xml_parse($parser, '<div>'.$data.'</div>', true);
542 542
 	$code = xml_get_error_code($parser);
543 543
 	xml_parser_free($parser);
544 544
 
545
-	if (!$code) {
545
+	if ( ! $code) {
546 546
 		if (strpos($data, '<') === false) {
547 547
 			return array('text', $data);
548 548
 		} else {
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
  * @see get_site_icon_url()
567 567
  */
568 568
 function atom_site_icon() {
569
-	$url = get_site_icon_url( 32 );
570
-	if ( $url ) {
569
+	$url = get_site_icon_url(32);
570
+	if ($url) {
571 571
 		echo "<icon>$url</icon>\n";
572 572
 	}
573 573
 }
@@ -579,17 +579,17 @@  discard block
 block discarded – undo
579 579
  */
580 580
 function rss2_site_icon() {
581 581
 	$rss_title = get_wp_title_rss();
582
-	if ( empty( $rss_title ) ) {
583
-		$rss_title = get_bloginfo_rss( 'name' );
582
+	if (empty($rss_title)) {
583
+		$rss_title = get_bloginfo_rss('name');
584 584
 	}
585 585
 
586
-	$url = get_site_icon_url( 32 );
587
-	if ( $url ) {
586
+	$url = get_site_icon_url(32);
587
+	if ($url) {
588 588
 		echo '
589 589
 <image>
590
-	<url>' . convert_chars( $url ) . '</url>
591
-	<title>' . $rss_title . '</title>
592
-	<link>' . get_bloginfo_rss( 'url' ) . '</link>
590
+	<url>' . convert_chars($url).'</url>
591
+	<title>' . $rss_title.'</title>
592
+	<link>' . get_bloginfo_rss('url').'</link>
593 593
 	<width>32</width>
594 594
 	<height>32</height>
595 595
 </image> ' . "\n";
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @param string $feed_link The link for the feed with set URL scheme.
617 617
 	 */
618
-	echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
618
+	echo esc_url(apply_filters('self_link', set_url_scheme('http://'.$host['host'].wp_unslash($_SERVER['REQUEST_URI']))));
619 619
 }
620 620
 
621 621
 /**
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'.
627 627
  */
628
-function feed_content_type( $type = '' ) {
629
-	if ( empty($type) )
628
+function feed_content_type($type = '') {
629
+	if (empty($type))
630 630
 		$type = get_default_feed();
631 631
 
632 632
 	$types = array(
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 		'rdf'  => 'application/rdf+xml'
637 637
 	);
638 638
 
639
-	$content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream';
639
+	$content_type = ( ! empty($types[$type])) ? $types[$type] : 'application/octet-stream';
640 640
 
641 641
 	/**
642 642
 	 * Filter the content type for a specific feed type.
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 * @param string $content_type Content type indicating the type of data that a feed contains.
647 647
 	 * @param string $type         Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'.
648 648
 	 */
649
-	return apply_filters( 'feed_content_type', $content_type, $type );
649
+	return apply_filters('feed_content_type', $content_type, $type);
650 650
 }
651 651
 
652 652
 /**
@@ -660,22 +660,22 @@  discard block
 block discarded – undo
660 660
  *
661 661
  * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success
662 662
  */
663
-function fetch_feed( $url ) {
664
-	require_once( ABSPATH . WPINC . '/class-feed.php' );
663
+function fetch_feed($url) {
664
+	require_once(ABSPATH.WPINC.'/class-feed.php');
665 665
 
666 666
 	$feed = new SimplePie();
667 667
 
668
-	$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
668
+	$feed->set_sanitize_class('WP_SimplePie_Sanitize_KSES');
669 669
 	// We must manually overwrite $feed->sanitize because SimplePie's
670 670
 	// constructor sets it before we have a chance to set the sanitization class
671 671
 	$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
672 672
 
673
-	$feed->set_cache_class( 'WP_Feed_Cache' );
674
-	$feed->set_file_class( 'WP_SimplePie_File' );
673
+	$feed->set_cache_class('WP_Feed_Cache');
674
+	$feed->set_file_class('WP_SimplePie_File');
675 675
 
676
-	$feed->set_feed_url( $url );
676
+	$feed->set_feed_url($url);
677 677
 	/** This filter is documented in wp-includes/class-feed.php */
678
-	$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
678
+	$feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url));
679 679
 	/**
680 680
 	 * Fires just before processing the SimplePie feed object.
681 681
 	 *
@@ -684,13 +684,13 @@  discard block
 block discarded – undo
684 684
 	 * @param object &$feed SimplePie feed object, passed by reference.
685 685
 	 * @param mixed  $url   URL of feed to retrieve. If an array of URLs, the feeds are merged.
686 686
 	 */
687
-	do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
687
+	do_action_ref_array('wp_feed_options', array(&$feed, $url));
688 688
 	$feed->init();
689
-	$feed->set_output_encoding( get_option( 'blog_charset' ) );
689
+	$feed->set_output_encoding(get_option('blog_charset'));
690 690
 	$feed->handle_content_type();
691 691
 
692
-	if ( $feed->error() )
693
-		return new WP_Error( 'simplepie-error', $feed->error() );
692
+	if ($feed->error())
693
+		return new WP_Error('simplepie-error', $feed->error());
694 694
 
695 695
 	return $feed;
696 696
 }
Please login to merge, or discard this patch.
src/wp-includes/ID3/getid3.lib.php 3 patches
Doc Comments   +59 added lines patch added patch discarded remove patch
@@ -99,6 +99,9 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 
101 101
 
102
+	/**
103
+	 * @param string $binarynumerator
104
+	 */
102 105
 	public static function DecimalBinary2Float($binarynumerator) {
103 106
 		$numerator   = self::Bin2Dec($binarynumerator);
104 107
 		$denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator)));
@@ -106,6 +109,9 @@  discard block
 block discarded – undo
106 109
 	}
107 110
 
108 111
 
112
+	/**
113
+	 * @param string $binarypointnumber
114
+	 */
109 115
 	public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
110 116
 		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
111 117
 		if (strpos($binarypointnumber, '.') === false) {
@@ -177,6 +183,9 @@  discard block
 block discarded – undo
177 183
 	}
178 184
 
179 185
 
186
+	/**
187
+	 * @param string $byteword
188
+	 */
180 189
 	public static function LittleEndian2Float($byteword) {
181 190
 		return self::BigEndian2Float(strrev($byteword));
182 191
 	}
@@ -366,6 +375,9 @@  discard block
 block discarded – undo
366 375
 	}
367 376
 
368 377
 
378
+	/**
379
+	 * @param integer $number
380
+	 */
369 381
 	public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
370 382
 		$intstring = '';
371 383
 		while ($number > 0) {
@@ -458,16 +470,25 @@  discard block
 block discarded – undo
458 470
 	}
459 471
 
460 472
 
473
+	/**
474
+	 * @param string $rawdata
475
+	 */
461 476
 	public static function FixedPoint8_8($rawdata) {
462 477
 		return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8));
463 478
 	}
464 479
 
465 480
 
481
+	/**
482
+	 * @param string $rawdata
483
+	 */
466 484
 	public static function FixedPoint16_16($rawdata) {
467 485
 		return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16));
468 486
 	}
469 487
 
470 488
 
489
+	/**
490
+	 * @param string $rawdata
491
+	 */
471 492
 	public static function FixedPoint2_30($rawdata) {
472 493
 		$binarystring = self::BigEndian2Bin($rawdata);
473 494
 		return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30));
@@ -531,6 +552,9 @@  discard block
 block discarded – undo
531 552
 		return false;
532 553
 	}
533 554
 
555
+	/**
556
+	 * @param SimpleXMLElement $XMLobject
557
+	 */
534 558
 	public static function SimpleXMLelement2array($XMLobject) {
535 559
 		if (!is_object($XMLobject) && !is_array($XMLobject)) {
536 560
 			return $XMLobject;
@@ -631,6 +655,9 @@  discard block
 block discarded – undo
631 655
 		return $result;
632 656
 	}
633 657
 
658
+	/**
659
+	 * @param string $filename_dest
660
+	 */
634 661
 	public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) {
635 662
 		if (!self::intValueSupported($offset + $length)) {
636 663
 			throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
@@ -863,6 +890,10 @@  discard block
 block discarded – undo
863 890
 	}
864 891
 
865 892
 	// UTF-16BE => UTF-8
893
+
894
+	/**
895
+	 * @param string $string
896
+	 */
866 897
 	public static function iconv_fallback_utf16be_utf8($string) {
867 898
 		if (substr($string, 0, 2) == "\xFE\xFF") {
868 899
 			// strip BOM
@@ -877,6 +908,10 @@  discard block
 block discarded – undo
877 908
 	}
878 909
 
879 910
 	// UTF-16LE => UTF-8
911
+
912
+	/**
913
+	 * @param string $string
914
+	 */
880 915
 	public static function iconv_fallback_utf16le_utf8($string) {
881 916
 		if (substr($string, 0, 2) == "\xFF\xFE") {
882 917
 			// strip BOM
@@ -891,6 +926,10 @@  discard block
 block discarded – undo
891 926
 	}
892 927
 
893 928
 	// UTF-16BE => ISO-8859-1
929
+
930
+	/**
931
+	 * @param string $string
932
+	 */
894 933
 	public static function iconv_fallback_utf16be_iso88591($string) {
895 934
 		if (substr($string, 0, 2) == "\xFE\xFF") {
896 935
 			// strip BOM
@@ -905,6 +944,10 @@  discard block
 block discarded – undo
905 944
 	}
906 945
 
907 946
 	// UTF-16LE => ISO-8859-1
947
+
948
+	/**
949
+	 * @param string $string
950
+	 */
908 951
 	public static function iconv_fallback_utf16le_iso88591($string) {
909 952
 		if (substr($string, 0, 2) == "\xFF\xFE") {
910 953
 			// strip BOM
@@ -940,6 +983,9 @@  discard block
 block discarded – undo
940 983
 		return $string;
941 984
 	}
942 985
 
986
+	/**
987
+	 * @return string
988
+	 */
943 989
 	public static function iconv_fallback($in_charset, $out_charset, $string) {
944 990
 
945 991
 		if ($in_charset == $out_charset) {
@@ -1271,6 +1317,12 @@  discard block
 block discarded – undo
1271 1317
 	}
1272 1318
 
1273 1319
 
1320
+	/**
1321
+	 * @param integer $begin
1322
+	 * @param integer $end
1323
+	 * @param string $file
1324
+	 * @param string $name
1325
+	 */
1274 1326
 	public static function EmbeddedLookup($key, $begin, $end, $file, $name) {
1275 1327
 
1276 1328
 		// Cached
@@ -1317,6 +1369,10 @@  discard block
 block discarded – undo
1317 1369
 		return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
1318 1370
 	}
1319 1371
 
1372
+	/**
1373
+	 * @param string $filename
1374
+	 * @param string $sourcefile
1375
+	 */
1320 1376
 	public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) {
1321 1377
 		global $GETID3_ERRORARRAY;
1322 1378
 
@@ -1341,6 +1397,9 @@  discard block
 block discarded – undo
1341 1397
 		return trim($string, "\x00");
1342 1398
 	}
1343 1399
 
1400
+	/**
1401
+	 * @param string $path
1402
+	 */
1344 1403
 	public static function getFileSizeSyscall($path) {
1345 1404
 		$filesize = false;
1346 1405
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1367,11 +1367,11 @@
 block discarded – undo
1367 1367
 
1368 1368
 
1369 1369
 	/**
1370
-	* Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268)
1371
-	* @param string $path A path.
1372
-	* @param string $suffix If the name component ends in suffix this will also be cut off.
1373
-	* @return string
1374
-	*/
1370
+	 * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268)
1371
+	 * @param string $path A path.
1372
+	 * @param string $suffix If the name component ends in suffix this will also be cut off.
1373
+	 * @return string
1374
+	 */
1375 1375
 	public static function mb_basename($path, $suffix = null) {
1376 1376
 		$splited = preg_split('#/#', rtrim($path, '/ '));
1377 1377
 		return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1);
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 class getid3_lib
16 16
 {
17 17
 
18
-	public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') {
18
+	public static function PrintHexBytes($string, $hex = true, $spaces = true, $htmlencoding = 'UTF-8') {
19 19
 		$returnstring = '';
20 20
 		for ($i = 0; $i < strlen($string); $i++) {
21 21
 			if ($hex) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 				$returnstring .= ' ';
28 28
 			}
29 29
 		}
30
-		if (!empty($htmlencoding)) {
30
+		if ( ! empty($htmlencoding)) {
31 31
 			if ($htmlencoding === true) {
32 32
 				$htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean
33 33
 			}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 
56
-	public static function safe_inc(&$variable, $increment=1) {
56
+	public static function safe_inc(&$variable, $increment = 1) {
57 57
 		if (isset($variable)) {
58 58
 			$variable += $increment;
59 59
 		} else {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		static $hasINT64 = null;
83 83
 		if ($hasINT64 === null) { // 10x faster than is_null()
84 84
 			$hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1
85
-			if (!$hasINT64 && !defined('PHP_INT_MIN')) {
85
+			if ( ! $hasINT64 && ! defined('PHP_INT_MIN')) {
86 86
 				define('PHP_INT_MIN', ~PHP_INT_MAX);
87 87
 			}
88 88
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-	public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
109
+	public static function NormalizeBinaryPoint($binarypointnumber, $maxbits = 52) {
110 110
 		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
111 111
 		if (strpos($binarypointnumber, '.') === false) {
112 112
 			$binarypointnumber = '0.'.$binarypointnumber;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
189 189
 
190 190
 		$bitword = self::BigEndian2Bin($byteword);
191
-		if (!$bitword) {
191
+		if ( ! $bitword) {
192 192
 			return 0;
193 193
 		}
194 194
 		$signbit = $bitword{0};
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 
263
-	public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
263
+	public static function BigEndian2Int($byteword, $synchsafe = false, $signed = false) {
264 264
 		$intvalue = 0;
265 265
 		$bytewordlen = strlen($byteword);
266 266
 		if ($bytewordlen == 0) {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				$intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
275 275
 			}
276 276
 		}
277
-		if ($signed && !$synchsafe) {
277
+		if ($signed && ! $synchsafe) {
278 278
 			// synchsafe ints are not allowed to be signed
279 279
 			if ($bytewordlen <= PHP_INT_SIZE) {
280 280
 				$signMaskBit = 0x80 << (8 * ($bytewordlen - 1));
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	}
290 290
 
291 291
 
292
-	public static function LittleEndian2Int($byteword, $signed=false) {
292
+	public static function LittleEndian2Int($byteword, $signed = false) {
293 293
 		return self::BigEndian2Int(strrev($byteword), false, $signed);
294 294
 	}
295 295
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 
307
-	public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) {
307
+	public static function BigEndian2String($number, $minbytes = 1, $synchsafe = false, $signed = false) {
308 308
 		if ($number < 0) {
309 309
 			throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers');
310 310
 		}
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	}
340 340
 
341 341
 
342
-	public static function Bin2Dec($binstring, $signed=false) {
342
+	public static function Bin2Dec($binstring, $signed = false) {
343 343
 		$signmult = 1;
344 344
 		if ($signed) {
345 345
 			if ($binstring{0} == '1') {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	}
367 367
 
368 368
 
369
-	public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
369
+	public static function LittleEndian2String($number, $minbytes = 1, $synchsafe = false) {
370 370
 		$intstring = '';
371 371
 		while ($number > 0) {
372 372
 			if ($synchsafe) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	public static function array_merge_clobber($array1, $array2) {
385 385
 		// written by kcØhireability*com
386 386
 		// taken from http://www.php.net/manual/en/function.array-merge-recursive.php
387
-		if (!is_array($array1) || !is_array($array2)) {
387
+		if ( ! is_array($array1) || ! is_array($array2)) {
388 388
 			return false;
389 389
 		}
390 390
 		$newarray = $array1;
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
 
401 401
 
402 402
 	public static function array_merge_noclobber($array1, $array2) {
403
-		if (!is_array($array1) || !is_array($array2)) {
403
+		if ( ! is_array($array1) || ! is_array($array2)) {
404 404
 			return false;
405 405
 		}
406 406
 		$newarray = $array1;
407 407
 		foreach ($array2 as $key => $val) {
408 408
 			if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
409 409
 				$newarray[$key] = self::array_merge_noclobber($newarray[$key], $val);
410
-			} elseif (!isset($newarray[$key])) {
410
+			} elseif ( ! isset($newarray[$key])) {
411 411
 				$newarray[$key] = $val;
412 412
 			}
413 413
 		}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		return true;
426 426
 	}
427 427
 
428
-	public static function fileextension($filename, $numextensions=1) {
428
+	public static function fileextension($filename, $numextensions = 1) {
429 429
 		if (strstr($filename, '.')) {
430 430
 			$reversedfilename = strrev($filename);
431 431
 			$offset = 0;
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 	public static function PlaytimeString($seconds) {
445 445
 		$sign = (($seconds < 0) ? '-' : '');
446 446
 		$seconds = round(abs($seconds));
447
-		$H = (int) floor( $seconds                            / 3600);
448
-		$M = (int) floor(($seconds - (3600 * $H)            ) /   60);
449
-		$S = (int) round( $seconds - (3600 * $H) - (60 * $M)        );
447
+		$H = (int) floor($seconds / 3600);
448
+		$M = (int) floor(($seconds - (3600 * $H)) / 60);
449
+		$S = (int) round($seconds - (3600 * $H) - (60 * $M));
450 450
 		return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT);
451 451
 	}
452 452
 
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 		return $ReturnedArray;
491 491
 	}
492 492
 
493
-	public static function array_max($arraydata, $returnkey=false) {
493
+	public static function array_max($arraydata, $returnkey = false) {
494 494
 		$maxvalue = false;
495 495
 		$maxkey = false;
496 496
 		foreach ($arraydata as $key => $value) {
497
-			if (!is_array($value)) {
497
+			if ( ! is_array($value)) {
498 498
 				if ($value > $maxvalue) {
499 499
 					$maxvalue = $value;
500 500
 					$maxkey = $key;
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 		return ($returnkey ? $maxkey : $maxvalue);
505 505
 	}
506 506
 
507
-	public static function array_min($arraydata, $returnkey=false) {
507
+	public static function array_min($arraydata, $returnkey = false) {
508 508
 		$minvalue = false;
509 509
 		$minkey = false;
510 510
 		foreach ($arraydata as $key => $value) {
511
-			if (!is_array($value)) {
511
+			if ( ! is_array($value)) {
512 512
 				if ($value > $minvalue) {
513 513
 					$minvalue = $value;
514 514
 					$minkey = $key;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	}
533 533
 
534 534
 	public static function SimpleXMLelement2array($XMLobject) {
535
-		if (!is_object($XMLobject) && !is_array($XMLobject)) {
535
+		if ( ! is_object($XMLobject) && ! is_array($XMLobject)) {
536 536
 			return $XMLobject;
537 537
 		}
538 538
 		$XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	// self::md5_data() - returns md5sum for a file from startuing position to absolute end position
548 548
 	public static function hash_data($file, $offset, $end, $algorithm) {
549 549
 		static $tempdir = '';
550
-		if (!self::intValueSupported($end)) {
550
+		if ( ! self::intValueSupported($end)) {
551 551
 			return false;
552 552
 		}
553 553
 		switch ($algorithm) {
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 
582 582
 				$RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call);
583 583
 				foreach ($RequiredFiles as $required_file) {
584
-					if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
584
+					if ( ! is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
585 585
 						// helper apps not available - fall back to old method
586 586
 						break 2;
587 587
 					}
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 	}
633 633
 
634 634
 	public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) {
635
-		if (!self::intValueSupported($offset + $length)) {
635
+		if ( ! self::intValueSupported($offset + $length)) {
636 636
 			throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
637 637
 		}
638 638
 		if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) {
@@ -664,25 +664,25 @@  discard block
 block discarded – undo
664 664
 			$newcharstring = chr($charval);
665 665
 		} elseif ($charval < 2048) {
666 666
 			// 110bbbbb 10bbbbbb
667
-			$newcharstring  = chr(($charval >>   6) | 0xC0);
667
+			$newcharstring  = chr(($charval >> 6) | 0xC0);
668 668
 			$newcharstring .= chr(($charval & 0x3F) | 0x80);
669 669
 		} elseif ($charval < 65536) {
670 670
 			// 1110bbbb 10bbbbbb 10bbbbbb
671
-			$newcharstring  = chr(($charval >>  12) | 0xE0);
672
-			$newcharstring .= chr(($charval >>   6) | 0xC0);
671
+			$newcharstring  = chr(($charval >> 12) | 0xE0);
672
+			$newcharstring .= chr(($charval >> 6) | 0xC0);
673 673
 			$newcharstring .= chr(($charval & 0x3F) | 0x80);
674 674
 		} else {
675 675
 			// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
676
-			$newcharstring  = chr(($charval >>  18) | 0xF0);
677
-			$newcharstring .= chr(($charval >>  12) | 0xC0);
678
-			$newcharstring .= chr(($charval >>   6) | 0xC0);
676
+			$newcharstring  = chr(($charval >> 18) | 0xF0);
677
+			$newcharstring .= chr(($charval >> 12) | 0xC0);
678
+			$newcharstring .= chr(($charval >> 6) | 0xC0);
679 679
 			$newcharstring .= chr(($charval & 0x3F) | 0x80);
680 680
 		}
681 681
 		return $newcharstring;
682 682
 	}
683 683
 
684 684
 	// ISO-8859-1 => UTF-8
685
-	public static function iconv_fallback_iso88591_utf8($string, $bom=false) {
685
+	public static function iconv_fallback_iso88591_utf8($string, $bom = false) {
686 686
 		if (function_exists('utf8_encode')) {
687 687
 			return utf8_encode($string);
688 688
 		}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	}
700 700
 
701 701
 	// ISO-8859-1 => UTF-16BE
702
-	public static function iconv_fallback_iso88591_utf16be($string, $bom=false) {
702
+	public static function iconv_fallback_iso88591_utf16be($string, $bom = false) {
703 703
 		$newcharstring = '';
704 704
 		if ($bom) {
705 705
 			$newcharstring .= "\xFE\xFF";
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	}
712 712
 
713 713
 	// ISO-8859-1 => UTF-16LE
714
-	public static function iconv_fallback_iso88591_utf16le($string, $bom=false) {
714
+	public static function iconv_fallback_iso88591_utf16le($string, $bom = false) {
715 715
 		$newcharstring = '';
716 716
 		if ($bom) {
717 717
 			$newcharstring .= "\xFF\xFE";
@@ -741,18 +741,18 @@  discard block
 block discarded – undo
741 741
 				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
742 742
 				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
743 743
 						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
744
-						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
744
+						   ((ord($string{($offset + 2)}) & 0x3F) << 6) &
745 745
 							(ord($string{($offset + 3)}) & 0x3F);
746 746
 				$offset += 4;
747 747
 			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
748 748
 				// 1110bbbb 10bbbbbb 10bbbbbb
749 749
 				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
750
-						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
750
+						   ((ord($string{($offset + 1)}) & 0x3F) << 6) &
751 751
 							(ord($string{($offset + 2)}) & 0x3F);
752 752
 				$offset += 3;
753 753
 			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
754 754
 				// 110bbbbb 10bbbbbb
755
-				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
755
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
756 756
 							(ord($string{($offset + 1)}) & 0x3F);
757 757
 				$offset += 2;
758 758
 			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 	}
773 773
 
774 774
 	// UTF-8 => UTF-16BE
775
-	public static function iconv_fallback_utf8_utf16be($string, $bom=false) {
775
+	public static function iconv_fallback_utf8_utf16be($string, $bom = false) {
776 776
 		$newcharstring = '';
777 777
 		if ($bom) {
778 778
 			$newcharstring .= "\xFE\xFF";
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
 				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
785 785
 				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
786 786
 						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
787
-						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
787
+						   ((ord($string{($offset + 2)}) & 0x3F) << 6) &
788 788
 							(ord($string{($offset + 3)}) & 0x3F);
789 789
 				$offset += 4;
790 790
 			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
791 791
 				// 1110bbbb 10bbbbbb 10bbbbbb
792 792
 				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
793
-						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
793
+						   ((ord($string{($offset + 1)}) & 0x3F) << 6) &
794 794
 							(ord($string{($offset + 2)}) & 0x3F);
795 795
 				$offset += 3;
796 796
 			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
797 797
 				// 110bbbbb 10bbbbbb
798
-				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
798
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
799 799
 							(ord($string{($offset + 1)}) & 0x3F);
800 800
 				$offset += 2;
801 801
 			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 	}
816 816
 
817 817
 	// UTF-8 => UTF-16LE
818
-	public static function iconv_fallback_utf8_utf16le($string, $bom=false) {
818
+	public static function iconv_fallback_utf8_utf16le($string, $bom = false) {
819 819
 		$newcharstring = '';
820 820
 		if ($bom) {
821 821
 			$newcharstring .= "\xFF\xFE";
@@ -827,18 +827,18 @@  discard block
 block discarded – undo
827 827
 				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
828 828
 				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
829 829
 						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
830
-						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
830
+						   ((ord($string{($offset + 2)}) & 0x3F) << 6) &
831 831
 							(ord($string{($offset + 3)}) & 0x3F);
832 832
 				$offset += 4;
833 833
 			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
834 834
 				// 1110bbbb 10bbbbbb 10bbbbbb
835 835
 				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
836
-						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
836
+						   ((ord($string{($offset + 1)}) & 0x3F) << 6) &
837 837
 							(ord($string{($offset + 2)}) & 0x3F);
838 838
 				$offset += 3;
839 839
 			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
840 840
 				// 110bbbbb 10bbbbbb
841
-				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
841
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) &
842 842
 							(ord($string{($offset + 1)}) & 0x3F);
843 843
 				$offset += 2;
844 844
 			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
989 989
 	}
990 990
 
991
-	public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') {
991
+	public static function recursiveMultiByteCharString2HTML($data, $charset = 'ISO-8859-1') {
992 992
 		if (is_string($data)) {
993 993
 			return self::MultiByteCharString2HTML($data, $charset);
994 994
 		} elseif (is_array($data)) {
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 		return $data;
1003 1003
 	}
1004 1004
 
1005
-	public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
1005
+	public static function MultiByteCharString2HTML($string, $charset = 'ISO-8859-1') {
1006 1006
 		$string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
1007 1007
 		$HTMLstring = '';
1008 1008
 
@@ -1044,16 +1044,16 @@  discard block
 block discarded – undo
1044 1044
 					$charval = 0;
1045 1045
 					if ($char_ord_val < 0x80) {
1046 1046
 						$charval = $char_ord_val;
1047
-					} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F  &&  $i+3 < $strlen) {
1047
+					} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i + 3 < $strlen) {
1048 1048
 						$charval  = (($char_ord_val & 0x07) << 18);
1049 1049
 						$charval += ((ord($string{++$i}) & 0x3F) << 12);
1050 1050
 						$charval += ((ord($string{++$i}) & 0x3F) << 6);
1051
-						$charval +=  (ord($string{++$i}) & 0x3F);
1052
-					} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07  &&  $i+2 < $strlen) {
1051
+						$charval += (ord($string{++$i}) & 0x3F);
1052
+					} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i + 2 < $strlen) {
1053 1053
 						$charval  = (($char_ord_val & 0x0F) << 12);
1054 1054
 						$charval += ((ord($string{++$i}) & 0x3F) << 6);
1055
-						$charval +=  (ord($string{++$i}) & 0x3F);
1056
-					} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03  &&  $i+1 < $strlen) {
1055
+						$charval += (ord($string{++$i}) & 0x3F);
1056
+					} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i + 1 < $strlen) {
1057 1057
 						$charval  = (($char_ord_val & 0x1F) << 6);
1058 1058
 						$charval += (ord($string{++$i}) & 0x3F);
1059 1059
 					}
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 	}
1151 1151
 
1152 1152
 
1153
-	public static function GetDataImageSize($imgData, &$imageinfo=array()) {
1153
+	public static function GetDataImageSize($imgData, &$imageinfo = array()) {
1154 1154
 		static $tempdir = '';
1155 1155
 		if (empty($tempdir)) {
1156 1156
 			// yes this is ugly, feel free to suggest a better way
@@ -1202,11 +1202,11 @@  discard block
 block discarded – undo
1202 1202
 	public static function CopyTagsToComments(&$ThisFileInfo) {
1203 1203
 
1204 1204
 		// Copy all entries from ['tags'] into common ['comments']
1205
-		if (!empty($ThisFileInfo['tags'])) {
1205
+		if ( ! empty($ThisFileInfo['tags'])) {
1206 1206
 			foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
1207 1207
 				foreach ($tagarray as $tagname => $tagdata) {
1208 1208
 					foreach ($tagdata as $key => $value) {
1209
-						if (!empty($value)) {
1209
+						if ( ! empty($value)) {
1210 1210
 							if (empty($ThisFileInfo['comments'][$tagname])) {
1211 1211
 
1212 1212
 								// fall through and append value
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 									}
1223 1223
 								}
1224 1224
 
1225
-							} elseif (!is_array($value)) {
1225
+							} elseif ( ! is_array($value)) {
1226 1226
 
1227 1227
 								$newvaluelength = strlen(trim($value));
1228 1228
 								foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
@@ -1235,9 +1235,9 @@  discard block
 block discarded – undo
1235 1235
 								}
1236 1236
 
1237 1237
 							}
1238
-							if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
1238
+							if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || ! in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
1239 1239
 								$value = (is_string($value) ? trim($value) : $value);
1240
-								if (!is_numeric($key)) {
1240
+								if ( ! is_numeric($key)) {
1241 1241
 									$ThisFileInfo['comments'][$tagname][$key] = $value;
1242 1242
 								} else {
1243 1243
 									$ThisFileInfo['comments'][$tagname][]     = $value;
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 			}
1250 1250
 
1251 1251
 			// Copy to ['comments_html']
1252
-			if (!empty($ThisFileInfo['comments'])) {
1252
+			if ( ! empty($ThisFileInfo['comments'])) {
1253 1253
 				foreach ($ThisFileInfo['comments'] as $field => $values) {
1254 1254
 					if ($field == 'picture') {
1255 1255
 						// pictures can take up a lot of space, and we don't need multiple copies of them
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 		return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
1318 1318
 	}
1319 1319
 
1320
-	public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) {
1320
+	public static function IncludeDependency($filename, $sourcefile, $DieOnFailure = false) {
1321 1321
 		global $GETID3_ERRORARRAY;
1322 1322
 
1323 1323
 		if (file_exists($filename)) {
Please login to merge, or discard this patch.
src/wp-includes/ID3/getid3.php 4 patches
Doc Comments   +39 added lines patch added patch discarded remove patch
@@ -335,6 +335,10 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	// public: analyze file
338
+
339
+	/**
340
+	 * @param string $filename
341
+	 */
338 342
 	public function analyze($filename) {
339 343
 		try {
340 344
 			if (!$this->openfile($filename)) {
@@ -486,6 +490,10 @@  discard block
 block discarded – undo
486 490
 
487 491
 
488 492
 	// private: error handling
493
+
494
+	/**
495
+	 * @param string $message
496
+	 */
489 497
 	public function error($message) {
490 498
 		$this->CleanUp();
491 499
 		if (!isset($this->info['error'])) {
@@ -1097,6 +1105,9 @@  discard block
 block discarded – undo
1097 1105
 
1098 1106
 
1099 1107
 
1108
+	/**
1109
+	 * @param string $filedata
1110
+	 */
1100 1111
 	public function GetFileFormat(&$filedata, $filename='') {
1101 1112
 		// this function will determine the format of a file based on usually
1102 1113
 		// the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG,
@@ -1136,6 +1147,10 @@  discard block
 block discarded – undo
1136 1147
 
1137 1148
 
1138 1149
 	// converts array to $encoding charset from $this->encoding
1150
+
1151
+	/**
1152
+	 * @param string $encoding
1153
+	 */
1139 1154
 	public function CharConvert(&$array, $encoding) {
1140 1155
 
1141 1156
 		// identical encoding - end here
@@ -1280,6 +1295,9 @@  discard block
 block discarded – undo
1280 1295
 		return true;
1281 1296
 	}
1282 1297
 
1298
+	/**
1299
+	 * @param string $algorithm
1300
+	 */
1283 1301
 	public function getHashdata($algorithm) {
1284 1302
 		switch ($algorithm) {
1285 1303
 			case 'md5':
@@ -1573,6 +1591,9 @@  discard block
 block discarded – undo
1573 1591
 		return tempnam($this->tempdir, 'gI3');
1574 1592
 	}
1575 1593
 
1594
+	/**
1595
+	 * @param string $name
1596
+	 */
1576 1597
 	public function include_module($name) {
1577 1598
 		//if (!file_exists($this->include_path.'module.'.$name.'.php')) {
1578 1599
 		if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
@@ -1600,6 +1621,9 @@  discard block
 block discarded – undo
1600 1621
 	private $dependency_to = null;
1601 1622
 
1602 1623
 
1624
+	/**
1625
+	 * @param string $call_module
1626
+	 */
1603 1627
 	public function __construct(getID3 $getid3, $call_module=null) {
1604 1628
 		$this->getid3 = $getid3;
1605 1629
 
@@ -1664,6 +1688,9 @@  discard block
 block discarded – undo
1664 1688
 		return fread($this->getid3->fp, $bytes);
1665 1689
 	}
1666 1690
 
1691
+	/**
1692
+	 * @param integer $whence
1693
+	 */
1667 1694
 	protected function fseek($bytes, $whence=SEEK_SET) {
1668 1695
 		if ($this->data_string_flag) {
1669 1696
 			switch ($whence) {
@@ -1701,20 +1728,32 @@  discard block
 block discarded – undo
1701 1728
 		return feof($this->getid3->fp);
1702 1729
 	}
1703 1730
 
1731
+	/**
1732
+	 * @param string $module
1733
+	 */
1704 1734
 	final protected function isDependencyFor($module) {
1705 1735
 		return $this->dependency_to == $module;
1706 1736
 	}
1707 1737
 
1738
+	/**
1739
+	 * @param string $text
1740
+	 */
1708 1741
 	protected function error($text) {
1709 1742
 		$this->getid3->info['error'][] = $text;
1710 1743
 
1711 1744
 		return false;
1712 1745
 	}
1713 1746
 
1747
+	/**
1748
+	 * @param string $text
1749
+	 */
1714 1750
 	protected function warning($text) {
1715 1751
 		return $this->getid3->warning($text);
1716 1752
 	}
1717 1753
 
1754
+	/**
1755
+	 * @param string $text
1756
+	 */
1718 1757
 	protected function notice($text) {
1719 1758
 		// does nothing for now
1720 1759
 	}
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1588,8 +1588,8 @@
 block discarded – undo
1588 1588
 abstract class getid3_handler {
1589 1589
 
1590 1590
 	/**
1591
-	* @var getID3
1592
-	*/
1591
+	 * @var getID3
1592
+	 */
1593 1593
 	protected $getid3;                       // pointer
1594 1594
 
1595 1595
 	protected $data_string_flag     = false; // analyzing filepointer or string
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@  discard block
 block discarded – undo
11 11
 /////////////////////////////////////////////////////////////////
12 12
 
13 13
 // define a constant rather than looking up every time it is needed
14
-if (!defined('GETID3_OS_ISWINDOWS')) {
14
+if ( ! defined('GETID3_OS_ISWINDOWS')) {
15 15
 	define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0));
16 16
 }
17 17
 // Get base path of getID3() - ONCE
18
-if (!defined('GETID3_INCLUDEPATH')) {
18
+if ( ! defined('GETID3_INCLUDEPATH')) {
19 19
 	define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
20 20
 }
21 21
 // Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923)
22
-if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) {
22
+if ( ! defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) {
23 23
 	define('IMG_JPG', IMAGETYPE_JPEG);
24 24
 }
25 25
 
26 26
 // attempt to define temp dir as something flexible but reliable
27 27
 $temp_dir = ini_get('upload_tmp_dir');
28
-if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
28
+if ($temp_dir && ( ! is_dir($temp_dir) || ! is_readable($temp_dir))) {
29 29
 	$temp_dir = '';
30 30
 }
31
-if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1
31
+if ( ! $temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1
32 32
 	// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
33 33
 	$temp_dir = sys_get_temp_dir();
34 34
 }
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
 			break;
53 53
 		}
54 54
 	}
55
-	if (!$found_valid_tempdir) {
55
+	if ( ! $found_valid_tempdir) {
56 56
 		$temp_dir = '';
57 57
 	}
58 58
 	unset($open_basedirs, $found_valid_tempdir, $basedir);
59 59
 }
60
-if (!$temp_dir) {
60
+if ( ! $temp_dir) {
61 61
 	$temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
62 62
 }
63 63
 // $temp_dir = '/something/else/';  // feel free to override temp dir here if it works better for your system
64
-if (!defined('GETID3_TEMP_DIR')) {
64
+if ( ! defined('GETID3_TEMP_DIR')) {
65 65
 	define('GETID3_TEMP_DIR', $temp_dir);
66 66
 }
67 67
 unset($open_basedir, $temp_dir);
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 class getID3
73 73
 {
74 74
 	// public: Settings
75
-	public $encoding        = 'UTF-8';        // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE
76
-	public $encoding_id3v1  = 'ISO-8859-1';   // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
75
+	public $encoding        = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE
76
+	public $encoding_id3v1  = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
77 77
 
78 78
 	// public: Optional tag checks - disable for speed.
79
-	public $option_tag_id3v1         = true;  // Read and process ID3v1 tags
80
-	public $option_tag_id3v2         = true;  // Read and process ID3v2 tags
81
-	public $option_tag_lyrics3       = true;  // Read and process Lyrics3 tags
82
-	public $option_tag_apetag        = true;  // Read and process APE tags
83
-	public $option_tags_process      = true;  // Copy tags to root key 'tags' and encode to $this->encoding
84
-	public $option_tags_html         = true;  // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
79
+	public $option_tag_id3v1         = true; // Read and process ID3v1 tags
80
+	public $option_tag_id3v2         = true; // Read and process ID3v2 tags
81
+	public $option_tag_lyrics3       = true; // Read and process Lyrics3 tags
82
+	public $option_tag_apetag        = true; // Read and process APE tags
83
+	public $option_tags_process      = true; // Copy tags to root key 'tags' and encode to $this->encoding
84
+	public $option_tags_html         = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
85 85
 
86 86
 	// public: Optional tag/comment calucations
87
-	public $option_extra_info        = true;  // Calculate additional info such as bitrate, channelmode etc
87
+	public $option_extra_info        = true; // Calculate additional info such as bitrate, channelmode etc
88 88
 
89 89
 	// public: Optional handling of embedded attachments (e.g. images)
90 90
 	public $option_save_attachments  = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
 	public $option_md5_data          = false; // Get MD5 sum of data part - slow
94 94
 	public $option_md5_data_source   = false; // Use MD5 of source file if availble - only FLAC and OptimFROG
95 95
 	public $option_sha1_data         = false; // Get SHA1 sum of data part - slow
96
-	public $option_max_2gb_check     = null;  // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX)
96
+	public $option_max_2gb_check     = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX)
97 97
 
98 98
 	// public: Read buffer size in bytes
99 99
 	public $option_fread_buffer_size = 32768;
100 100
 
101 101
 	// Public variables
102
-	public $filename;                         // Filename of file being analysed.
103
-	public $fp;                               // Filepointer to file being analysed.
104
-	public $info;                             // Result array.
102
+	public $filename; // Filename of file being analysed.
103
+	public $fp; // Filepointer to file being analysed.
104
+	public $info; // Result array.
105 105
 	public $tempdir = GETID3_TEMP_DIR;
106 106
 	public $memory_limit = 0;
107 107
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		}
160 160
 
161 161
 		// Load support library
162
-		if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
162
+		if ( ! include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
163 163
 			$this->startup_error .= 'getid3.lib.php is missing or corrupt';
164 164
 		}
165 165
 
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 		// This path cannot contain spaces, but the below code will attempt to get the
175 175
 		//   8.3-equivalent path automatically
176 176
 		// IMPORTANT: This path must include the trailing slash
177
-		if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) {
177
+		if (GETID3_OS_ISWINDOWS && ! defined('GETID3_HELPERAPPSDIR')) {
178 178
 
179 179
 			$helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path
180 180
 
181
-			if (!is_dir($helperappsdir)) {
181
+			if ( ! is_dir($helperappsdir)) {
182 182
 				$this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist';
183 183
 			} elseif (strpos(realpath($helperappsdir), ' ') !== false) {
184 184
 				$DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir));
185 185
 				$path_so_far = array();
186 186
 				foreach ($DirPieces as $key => $value) {
187 187
 					if (strpos($value, ' ') !== false) {
188
-						if (!empty($path_so_far)) {
188
+						if ( ! empty($path_so_far)) {
189 189
 							$commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
190 190
 							$dir_listing = `$commandline`;
191 191
 							$lines = explode("\n", $dir_listing);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 
224 224
 	// public: setOption
225 225
 	public function setOption($optArray) {
226
-		if (!is_array($optArray) || empty($optArray)) {
226
+		if ( ! is_array($optArray) || empty($optArray)) {
227 227
 			return false;
228 228
 		}
229 229
 		foreach ($optArray as $opt => $val) {
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 
239 239
 	public function openfile($filename) {
240 240
 		try {
241
-			if (!empty($this->startup_error)) {
241
+			if ( ! empty($this->startup_error)) {
242 242
 				throw new getid3_exception($this->startup_error);
243 243
 			}
244
-			if (!empty($this->startup_warning)) {
244
+			if ( ! empty($this->startup_warning)) {
245 245
 				$this->warning($this->startup_warning);
246 246
 			}
247 247
 
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 				// great
266 266
 			} else {
267 267
 				$errormessagelist = array();
268
-				if (!is_readable($filename)) {
268
+				if ( ! is_readable($filename)) {
269 269
 					$errormessagelist[] = '!is_readable';
270 270
 				}
271
-				if (!is_file($filename)) {
271
+				if ( ! is_file($filename)) {
272 272
 					$errormessagelist[] = '!is_file';
273 273
 				}
274
-				if (!file_exists($filename)) {
274
+				if ( ! file_exists($filename)) {
275 275
 					$errormessagelist[] = '!file_exists';
276 276
 				}
277 277
 				if (empty($errormessagelist)) {
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 			// set more parameters
318 318
 			$this->info['avdataoffset']        = 0;
319 319
 			$this->info['avdataend']           = $this->info['filesize'];
320
-			$this->info['fileformat']          = '';                // filled in later
321
-			$this->info['audio']['dataformat'] = '';                // filled in later, unset if not used
322
-			$this->info['video']['dataformat'] = '';                // filled in later, unset if not used
323
-			$this->info['tags']                = array();           // filled in later, unset if not used
324
-			$this->info['error']               = array();           // filled in later, unset if not used
325
-			$this->info['warning']             = array();           // filled in later, unset if not used
326
-			$this->info['comments']            = array();           // filled in later, unset if not used
327
-			$this->info['encoding']            = $this->encoding;   // required by id3v2 and iso modules - can be unset at the end if desired
320
+			$this->info['fileformat']          = ''; // filled in later
321
+			$this->info['audio']['dataformat'] = ''; // filled in later, unset if not used
322
+			$this->info['video']['dataformat'] = ''; // filled in later, unset if not used
323
+			$this->info['tags']                = array(); // filled in later, unset if not used
324
+			$this->info['error']               = array(); // filled in later, unset if not used
325
+			$this->info['warning']             = array(); // filled in later, unset if not used
326
+			$this->info['comments']            = array(); // filled in later, unset if not used
327
+			$this->info['encoding']            = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired
328 328
 
329 329
 			return true;
330 330
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	// public: analyze file
338 338
 	public function analyze($filename) {
339 339
 		try {
340
-			if (!$this->openfile($filename)) {
340
+			if ( ! $this->openfile($filename)) {
341 341
 				return $this->info;
342 342
 			}
343 343
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 			}
367 367
 
368 368
 			// ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier
369
-			if (!$this->option_tag_id3v2) {
369
+			if ( ! $this->option_tag_id3v2) {
370 370
 				fseek($this->fp, 0);
371 371
 				$header = fread($this->fp, 10);
372 372
 				if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			$determined_format = $this->GetFileFormat($formattest, $filename);
386 386
 
387 387
 			// unable to determine file format
388
-			if (!$determined_format) {
388
+			if ( ! $determined_format) {
389 389
 				fclose($this->fp);
390 390
 				return $this->error('unable to determine file format');
391 391
 			}
@@ -414,14 +414,14 @@  discard block
 block discarded – undo
414 414
 			$this->info['mime_type'] = $determined_format['mime_type'];
415 415
 
416 416
 			// supported format signature pattern detected, but module deleted
417
-			if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) {
417
+			if ( ! file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) {
418 418
 				fclose($this->fp);
419 419
 				return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.');
420 420
 			}
421 421
 
422 422
 			// module requires iconv support
423 423
 			// Check encoding/iconv support
424
-			if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) {
424
+			if ( ! empty($determined_format['iconv_req']) && ! function_exists('iconv') && ! in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) {
425 425
 				$errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. ';
426 426
 				if (GETID3_OS_ISWINDOWS) {
427 427
 					$errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32';
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
 			// instantiate module class
438 438
 			$class_name = 'getid3_'.$determined_format['module'];
439
-			if (!class_exists($class_name)) {
439
+			if ( ! class_exists($class_name)) {
440 440
 				return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.');
441 441
 			}
442 442
 			$class = new $class_name($this);
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 			// get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
464 464
 			if ($this->option_md5_data) {
465 465
 				// do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too
466
-				if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) {
466
+				if ( ! $this->option_md5_data_source || empty($this->info['md5_data_source'])) {
467 467
 					$this->getHashdata('md5');
468 468
 				}
469 469
 			}
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	// private: error handling
489 489
 	public function error($message) {
490 490
 		$this->CleanUp();
491
-		if (!isset($this->info['error'])) {
491
+		if ( ! isset($this->info['error'])) {
492 492
 			$this->info['error'] = array();
493 493
 		}
494 494
 		$this->info['error'][] = $message;
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		}
519 519
 
520 520
 		// remove empty root keys
521
-		if (!empty($this->info)) {
521
+		if ( ! empty($this->info)) {
522 522
 			foreach ($this->info as $key => $value) {
523 523
 				if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) {
524 524
 					unset($this->info[$key]);
@@ -537,10 +537,10 @@  discard block
 block discarded – undo
537 537
 		}
538 538
 
539 539
 		// remove possible duplicated identical entries
540
-		if (!empty($this->info['error'])) {
540
+		if ( ! empty($this->info['error'])) {
541 541
 			$this->info['error'] = array_values(array_unique($this->info['error']));
542 542
 		}
543
-		if (!empty($this->info['warning'])) {
543
+		if ( ! empty($this->info['warning'])) {
544 544
 			$this->info['warning'] = array_values(array_unique($this->info['warning']));
545 545
 		}
546 546
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
 				// TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
766 766
 				'tta'  => array(
767
-							'pattern'   => '^TTA',  // could also be '^TTA(\x01|\x02|\x03|2|1)'
767
+							'pattern'   => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)'
768 768
 							'group'     => 'audio',
769 769
 							'module'    => 'tta',
770 770
 							'mime_type' => 'application/octet-stream',
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 				// Misc other formats
1053 1053
 
1054 1054
 				// PAR2 - data        - Parity Volume Set Specification 2.0
1055
-				'par2' => array (
1055
+				'par2' => array(
1056 1056
 							'pattern'   => '^PAR2\x00PKT',
1057 1057
 							'group'     => 'misc',
1058 1058
 							'module'    => 'par2',
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 
1099 1099
 
1100
-	public function GetFileFormat(&$filedata, $filename='') {
1100
+	public function GetFileFormat(&$filedata, $filename = '') {
1101 1101
 		// this function will determine the format of a file based on usually
1102 1102
 		// the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG,
1103 1103
 		// and in the case of ISO CD image, 6 bytes offset 32kb from the start
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 		foreach ($this->GetFileFormatArray() as $format_name => $info) {
1108 1108
 			// The /s switch on preg_match() forces preg_match() NOT to treat
1109 1109
 			// newline (0x0A) characters as special chars but do a binary match
1110
-			if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) {
1110
+			if ( ! empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) {
1111 1111
 				$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
1112 1112
 				return $info;
1113 1113
 			}
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 			// and verify there's at least one instance of "TRACK xx AUDIO" in the file
1128 1128
 			$GetFileFormatArray = $this->GetFileFormatArray();
1129 1129
 			$info = $GetFileFormatArray['cue'];
1130
-			$info['include']   = 'module.'.$info['group'].'.'.$info['module'].'.php';
1130
+			$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
1131 1131
 			return $info;
1132 1132
 		}
1133 1133
 
@@ -1165,26 +1165,26 @@  discard block
 block discarded – undo
1165 1165
 		static $tags;
1166 1166
 		if (empty($tags)) {
1167 1167
 			$tags = array(
1168
-				'asf'       => array('asf'           , 'UTF-16LE'),
1169
-				'midi'      => array('midi'          , 'ISO-8859-1'),
1170
-				'nsv'       => array('nsv'           , 'ISO-8859-1'),
1171
-				'ogg'       => array('vorbiscomment' , 'UTF-8'),
1172
-				'png'       => array('png'           , 'UTF-8'),
1173
-				'tiff'      => array('tiff'          , 'ISO-8859-1'),
1174
-				'quicktime' => array('quicktime'     , 'UTF-8'),
1175
-				'real'      => array('real'          , 'ISO-8859-1'),
1176
-				'vqf'       => array('vqf'           , 'ISO-8859-1'),
1177
-				'zip'       => array('zip'           , 'ISO-8859-1'),
1178
-				'riff'      => array('riff'          , 'ISO-8859-1'),
1179
-				'lyrics3'   => array('lyrics3'       , 'ISO-8859-1'),
1180
-				'id3v1'     => array('id3v1'         , $this->encoding_id3v1),
1181
-				'id3v2'     => array('id3v2'         , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
1182
-				'ape'       => array('ape'           , 'UTF-8'),
1183
-				'cue'       => array('cue'           , 'ISO-8859-1'),
1184
-				'matroska'  => array('matroska'      , 'UTF-8'),
1185
-				'flac'      => array('vorbiscomment' , 'UTF-8'),
1186
-				'divxtag'   => array('divx'          , 'ISO-8859-1'),
1187
-				'iptc'      => array('iptc'          , 'ISO-8859-1'),
1168
+				'asf'       => array('asf', 'UTF-16LE'),
1169
+				'midi'      => array('midi', 'ISO-8859-1'),
1170
+				'nsv'       => array('nsv', 'ISO-8859-1'),
1171
+				'ogg'       => array('vorbiscomment', 'UTF-8'),
1172
+				'png'       => array('png', 'UTF-8'),
1173
+				'tiff'      => array('tiff', 'ISO-8859-1'),
1174
+				'quicktime' => array('quicktime', 'UTF-8'),
1175
+				'real'      => array('real', 'ISO-8859-1'),
1176
+				'vqf'       => array('vqf', 'ISO-8859-1'),
1177
+				'zip'       => array('zip', 'ISO-8859-1'),
1178
+				'riff'      => array('riff', 'ISO-8859-1'),
1179
+				'lyrics3'   => array('lyrics3', 'ISO-8859-1'),
1180
+				'id3v1'     => array('id3v1', $this->encoding_id3v1),
1181
+				'id3v2'     => array('id3v2', 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
1182
+				'ape'       => array('ape', 'UTF-8'),
1183
+				'cue'       => array('cue', 'ISO-8859-1'),
1184
+				'matroska'  => array('matroska', 'UTF-8'),
1185
+				'flac'      => array('vorbiscomment', 'UTF-8'),
1186
+				'divxtag'   => array('divx', 'ISO-8859-1'),
1187
+				'iptc'      => array('iptc', 'ISO-8859-1'),
1188 1188
 			);
1189 1189
 		}
1190 1190
 
@@ -1193,19 +1193,19 @@  discard block
 block discarded – undo
1193 1193
 			list($tag_name, $encoding) = $tagname_encoding_array;
1194 1194
 
1195 1195
 			// fill in default encoding type if not already present
1196
-			if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) {
1196
+			if (isset($this->info[$comment_name]) && ! isset($this->info[$comment_name]['encoding'])) {
1197 1197
 				$this->info[$comment_name]['encoding'] = $encoding;
1198 1198
 			}
1199 1199
 
1200 1200
 			// copy comments if key name set
1201
-			if (!empty($this->info[$comment_name]['comments'])) {
1201
+			if ( ! empty($this->info[$comment_name]['comments'])) {
1202 1202
 				foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) {
1203 1203
 					foreach ($valuearray as $key => $value) {
1204 1204
 						if (is_string($value)) {
1205 1205
 							$value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
1206 1206
 						}
1207 1207
 						if ($value) {
1208
-							if (!is_numeric($key)) {
1208
+							if ( ! is_numeric($key)) {
1209 1209
 								$this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value;
1210 1210
 							} else {
1211 1211
 								$this->info['tags'][trim($tag_name)][trim($tag_key)][]     = $value;
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 					}
1218 1218
 				}
1219 1219
 
1220
-				if (!isset($this->info['tags'][$tag_name])) {
1220
+				if ( ! isset($this->info['tags'][$tag_name])) {
1221 1221
 					// comments are set but contain nothing but empty strings, so skip
1222 1222
 					continue;
1223 1223
 				}
@@ -1228,14 +1228,14 @@  discard block
 block discarded – undo
1228 1228
 					}
1229 1229
 				}
1230 1230
 
1231
-				$this->CharConvert($this->info['tags'][$tag_name], $encoding);           // only copy gets converted!
1231
+				$this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted!
1232 1232
 			}
1233 1233
 
1234 1234
 		}
1235 1235
 
1236 1236
 		// pictures can take up a lot of space, and we don't need multiple copies of them
1237 1237
 		// let there be a single copy in [comments][picture], and not elsewhere
1238
-		if (!empty($this->info['tags'])) {
1238
+		if ( ! empty($this->info['tags'])) {
1239 1239
 			$unset_keys = array('tags', 'tags_html');
1240 1240
 			foreach ($this->info['tags'] as $tagtype => $tagarray) {
1241 1241
 				foreach ($tagarray as $tagname => $tagdata) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 				break;
1292 1292
 		}
1293 1293
 
1294
-		if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) {
1294
+		if ( ! empty($this->info['fileformat']) && ! empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) {
1295 1295
 
1296 1296
 			// We cannot get an identical md5_data value for Ogg files where the comments
1297 1297
 			// span more than 1 Ogg page (compared to the same audio data with smaller
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 
1351 1351
 				}
1352 1352
 
1353
-				if (!empty($VorbisCommentError)) {
1353
+				if ( ! empty($VorbisCommentError)) {
1354 1354
 
1355 1355
 					$this->info['warning'][]         = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError;
1356 1356
 					$this->info[$algorithm.'_data']  = false;
@@ -1380,7 +1380,7 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 		} else {
1382 1382
 
1383
-			if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) {
1383
+			if ( ! empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) {
1384 1384
 
1385 1385
 				// get hash from part of file
1386 1386
 				$this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm);
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 	public function ChannelsBitratePlaytimeCalculations() {
1408 1408
 
1409 1409
 		// set channelmode on audio
1410
-		if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) {
1410
+		if ( ! empty($this->info['audio']['channelmode']) || ! isset($this->info['audio']['channels'])) {
1411 1411
 			// ignore
1412 1412
 		} elseif ($this->info['audio']['channels'] == 1) {
1413 1413
 			$this->info['audio']['channelmode'] = 'mono';
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 		//}
1430 1430
 
1431 1431
 		// video bitrate undetermined, but calculable
1432
-		if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) {
1432
+		if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && ( ! isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) {
1433 1433
 			// if video bitrate not set
1434 1434
 			if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) {
1435 1435
 				// AND if audio bitrate is set to same as overall bitrate
@@ -1445,11 +1445,11 @@  discard block
 block discarded – undo
1445 1445
 			}
1446 1446
 		}
1447 1447
 
1448
-		if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) {
1448
+		if (( ! isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && ! empty($this->info['bitrate'])) {
1449 1449
 			$this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate'];
1450 1450
 		}
1451 1451
 
1452
-		if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) {
1452
+		if ( ! isset($this->info['bitrate']) && ! empty($this->info['playtime_seconds'])) {
1453 1453
 			$this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds'];
1454 1454
 		}
1455 1455
 		if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) {
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 		}
1464 1464
 
1465 1465
 		// Set playtime string
1466
-		if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
1466
+		if ( ! empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
1467 1467
 			$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
1468 1468
 		}
1469 1469
 	}
@@ -1493,17 +1493,17 @@  discard block
 block discarded – undo
1493 1493
 				break;
1494 1494
 
1495 1495
 			default:
1496
-				if (!empty($this->info['video']['frame_rate'])) {
1496
+				if ( ! empty($this->info['video']['frame_rate'])) {
1497 1497
 					$FrameRate = $this->info['video']['frame_rate'];
1498 1498
 				} else {
1499 1499
 					return false;
1500 1500
 				}
1501
-				if (!empty($this->info['playtime_seconds'])) {
1501
+				if ( ! empty($this->info['playtime_seconds'])) {
1502 1502
 					$PlaytimeSeconds = $this->info['playtime_seconds'];
1503 1503
 				} else {
1504 1504
 					return false;
1505 1505
 				}
1506
-				if (!empty($this->info['video']['bitrate'])) {
1506
+				if ( ! empty($this->info['video']['bitrate'])) {
1507 1507
 					$BitrateCompressed = $this->info['video']['bitrate'];
1508 1508
 				} else {
1509 1509
 					return false;
@@ -1518,15 +1518,15 @@  discard block
 block discarded – undo
1518 1518
 
1519 1519
 
1520 1520
 	public function CalculateCompressionRatioAudio() {
1521
-		if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) {
1521
+		if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || ! is_numeric($this->info['audio']['sample_rate'])) {
1522 1522
 			return false;
1523 1523
 		}
1524
-		$this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16));
1524
+		$this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * ( ! empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16));
1525 1525
 
1526
-		if (!empty($this->info['audio']['streams'])) {
1526
+		if ( ! empty($this->info['audio']['streams'])) {
1527 1527
 			foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) {
1528
-				if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) {
1529
-					$this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16));
1528
+				if ( ! empty($streamdata['bitrate']) && ! empty($streamdata['channels']) && ! empty($streamdata['sample_rate'])) {
1529
+					$this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * ( ! empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16));
1530 1530
 				}
1531 1531
 			}
1532 1532
 		}
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 	public function CalculateReplayGain() {
1538 1538
 		if (isset($this->info['replay_gain'])) {
1539
-			if (!isset($this->info['replay_gain']['reference_volume'])) {
1539
+			if ( ! isset($this->info['replay_gain']['reference_volume'])) {
1540 1540
 				$this->info['replay_gain']['reference_volume'] = (double) 89.0;
1541 1541
 			}
1542 1542
 			if (isset($this->info['replay_gain']['track']['adjustment'])) {
@@ -1557,8 +1557,8 @@  discard block
 block discarded – undo
1557 1557
 	}
1558 1558
 
1559 1559
 	public function ProcessAudioStreams() {
1560
-		if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) {
1561
-			if (!isset($this->info['audio']['streams'])) {
1560
+		if ( ! empty($this->info['audio']['bitrate']) || ! empty($this->info['audio']['channels']) || ! empty($this->info['audio']['sample_rate'])) {
1561
+			if ( ! isset($this->info['audio']['streams'])) {
1562 1562
 				foreach ($this->info['audio'] as $key => $value) {
1563 1563
 					if ($key != 'streams') {
1564 1564
 						$this->info['audio']['streams'][0][$key] = $value;
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
 
1576 1576
 	public function include_module($name) {
1577 1577
 		//if (!file_exists($this->include_path.'module.'.$name.'.php')) {
1578
-		if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
1578
+		if ( ! file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
1579 1579
 			throw new getid3_exception('Required module.'.$name.'.php is missing.');
1580 1580
 		}
1581 1581
 		include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php');
@@ -1590,17 +1590,17 @@  discard block
 block discarded – undo
1590 1590
 	/**
1591 1591
 	* @var getID3
1592 1592
 	*/
1593
-	protected $getid3;                       // pointer
1593
+	protected $getid3; // pointer
1594 1594
 
1595 1595
 	protected $data_string_flag     = false; // analyzing filepointer or string
1596
-	protected $data_string          = '';    // string to analyze
1597
-	protected $data_string_position = 0;     // seek position in string
1598
-	protected $data_string_length   = 0;     // string length
1596
+	protected $data_string          = ''; // string to analyze
1597
+	protected $data_string_position = 0; // seek position in string
1598
+	protected $data_string_length   = 0; // string length
1599 1599
 
1600 1600
 	private $dependency_to = null;
1601 1601
 
1602 1602
 
1603
-	public function __construct(getID3 $getid3, $call_module=null) {
1603
+	public function __construct(getID3 $getid3, $call_module = null) {
1604 1604
 		$this->getid3 = $getid3;
1605 1605
 
1606 1606
 		if ($call_module) {
@@ -1658,13 +1658,13 @@  discard block
 block discarded – undo
1658 1658
 			return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
1659 1659
 		}
1660 1660
 		$pos = $this->ftell() + $bytes;
1661
-		if (!getid3_lib::intValueSupported($pos)) {
1661
+		if ( ! getid3_lib::intValueSupported($pos)) {
1662 1662
 			throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10);
1663 1663
 		}
1664 1664
 		return fread($this->getid3->fp, $bytes);
1665 1665
 	}
1666 1666
 
1667
-	protected function fseek($bytes, $whence=SEEK_SET) {
1667
+	protected function fseek($bytes, $whence = SEEK_SET) {
1668 1668
 		if ($this->data_string_flag) {
1669 1669
 			switch ($whence) {
1670 1670
 				case SEEK_SET:
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 			} elseif ($whence == SEEK_END) {
1688 1688
 				$pos = $this->getid3->info['filesize'] + $bytes;
1689 1689
 			}
1690
-			if (!getid3_lib::intValueSupported($pos)) {
1690
+			if ( ! getid3_lib::intValueSupported($pos)) {
1691 1691
 				throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10);
1692 1692
 			}
1693 1693
 		}
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
 		// does nothing for now
1720 1720
 	}
1721 1721
 
1722
-	public function saveAttachment($name, $offset, $length, $image_mime=null) {
1722
+	public function saveAttachment($name, $offset, $length, $image_mime = null) {
1723 1723
 		try {
1724 1724
 
1725 1725
 			// do not extract at all
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 
1742 1742
 				// set up destination path
1743 1743
 				$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
1744
-				if (!is_dir($dir) || !is_writable($dir)) { // check supplied directory
1744
+				if ( ! is_dir($dir) || ! is_writable($dir)) { // check supplied directory
1745 1745
 					throw new Exception('supplied path ('.$dir.') does not exist, or is not writable');
1746 1746
 				}
1747 1747
 				$dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : '');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -350,8 +350,7 @@
 block discarded – undo
350 350
 						$tag_class = 'getid3_'.$tag_name;
351 351
 						$tag = new $tag_class($this);
352 352
 						$tag->Analyze();
353
-					}
354
-					catch (getid3_exception $e) {
353
+					} catch (getid3_exception $e) {
355 354
 						throw $e;
356 355
 					}
357 356
 				}
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.audio-video.asf.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -1684,6 +1684,10 @@
 block discarded – undo
1684 1684
 		return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : '');
1685 1685
 	}
1686 1686
 
1687
+	/**
1688
+	 * @param string $asf_header_extension_object_data
1689
+	 * @param integer $unhandled_sections
1690
+	 */
1687 1691
 	public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
1688 1692
 		// http://msdn.microsoft.com/en-us/library/bb643323.aspx
1689 1693
 
Please login to merge, or discard this patch.
Spacing   +98 added lines, -99 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 class getid3_asf extends getid3_handler {
20 20
 
21 21
 	public function __construct(getID3 $getid3) {
22
-		parent::__construct($getid3);  // extends getid3_handler::__construct()
22
+		parent::__construct($getid3); // extends getid3_handler::__construct()
23 23
 
24 24
 		// initialize all GUID constants
25 25
 		$GUIDarray = $this->KnownGUIDs();
26 26
 		foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
27
-			if (!defined($GUIDname)) {
27
+			if ( ! defined($GUIDname)) {
28 28
 				define($GUIDname, $this->GUIDtoBytestring($hexstringvalue));
29 29
 			}
30 30
 		}
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 					switch ($StreamPropertiesObjectData['stream_type']) {
221 221
 
222 222
 						case GETID3_ASF_Audio_Media:
223
-							$thisfile_audio['dataformat']   = (!empty($thisfile_audio['dataformat'])   ? $thisfile_audio['dataformat']   : 'asf');
224
-							$thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr');
223
+							$thisfile_audio['dataformat']   = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf');
224
+							$thisfile_audio['bitrate_mode'] = ( ! empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr');
225 225
 
226 226
 							$audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16));
227 227
 							unset($audiodata['raw']);
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 							break;
230 230
 
231 231
 						case GETID3_ASF_Video_Media:
232
-							$thisfile_video['dataformat']   = (!empty($thisfile_video['dataformat'])   ? $thisfile_video['dataformat']   : 'asf');
233
-							$thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr');
232
+							$thisfile_video['dataformat']   = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf');
233
+							$thisfile_video['bitrate_mode'] = ( ! empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr');
234 234
 							break;
235 235
 
236 236
 						case GETID3_ASF_Command_Media:
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 						//return false;
271 271
 						break;
272 272
 					}
273
-					$thisfile_asf_headerextensionobject['reserved_2']          = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
273
+					$thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
274 274
 					$offset += 2;
275 275
 					if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) {
276 276
 						$info['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"';
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 					}
280 280
 					$thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
281 281
 					$offset += 4;
282
-					$thisfile_asf_headerextensionobject['extension_data']      =                              substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']);
282
+					$thisfile_asf_headerextensionobject['extension_data']      = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']);
283 283
 					$unhandled_sections = 0;
284 284
 					$thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections);
285 285
 					if ($unhandled_sections === 0) {
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 								list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']));
356 356
 								$thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']);
357 357
 
358
-								if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) {
358
+								if ( ! isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) {
359 359
 									$thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000);
360 360
 								}
361 361
 								//if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) {
362
-								if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) {
362
+								if (empty($thisfile_video['bitrate']) && ! empty($thisfile_audio['bitrate']) && ! empty($info['bitrate'])) {
363 363
 									//$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate'];
364 364
 									$thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate'];
365 365
 								}
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 										break;
417 417
 								}
418 418
 
419
-								if (!isset($thisfile_audio['channels'])) {
419
+								if ( ! isset($thisfile_audio['channels'])) {
420 420
 									if (strstr($AudioCodecChannels, 'stereo')) {
421 421
 										$thisfile_audio['channels'] = 2;
422 422
 									} elseif (strstr($AudioCodecChannels, 'mono')) {
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 					$thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']);
534 534
 					$offset += $thisfile_asf_markerobject['name_length'];
535 535
 					for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) {
536
-						$thisfile_asf_markerobject['markers'][$MarkersCounter]['offset']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
536
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
537 537
 						$offset += 8;
538 538
 						$thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time']         = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
539 539
 						$offset += 8;
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 						$offset += 4;
548 548
 						$thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description']        = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']);
549 549
 						$offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
550
-						$PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 -  4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
550
+						$PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
551 551
 						if ($PaddingLength > 0) {
552
-							$thisfile_asf_markerobject['markers'][$MarkersCounter]['padding']               = substr($ASFHeaderData, $offset, $PaddingLength);
552
+							$thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength);
553 553
 							$offset += $PaddingLength;
554 554
 						}
555 555
 					}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 
692 692
 					$ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating');
693 693
 					foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) {
694
-						if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
694
+						if ( ! empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
695 695
 							$thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]);
696 696
 						}
697 697
 					}
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 
776 776
 							case 'wm/albumtitle':
777 777
 							case 'album':
778
-								$thisfile_asf_comments['album']  = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
778
+								$thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
779 779
 								break;
780 780
 
781 781
 							case 'wm/genre':
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 							case 'wm/year':
808 808
 							case 'year':
809 809
 							case 'date':
810
-								$thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
810
+								$thisfile_asf_comments['year'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
811 811
 								break;
812 812
 
813 813
 							case 'wm/lyrics':
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 								break;
1034 1034
 						}
1035 1035
 
1036
-						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1036
+						if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1037 1037
 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
1038 1038
 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
1039 1039
 									$thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
@@ -1042,9 +1042,9 @@  discard block
 block discarded – undo
1042 1042
 								}
1043 1043
 							}
1044 1044
 						} else {
1045
-							if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) {
1045
+							if ( ! empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) {
1046 1046
 								$thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8;
1047
-							} elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) {
1047
+							} elseif ( ! empty($thisfile_asf_audiomedia_currentstream['bitrate'])) {
1048 1048
 								$thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate'];
1049 1049
 							}
1050 1050
 						}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 						$videomediaoffset += 4;
1120 1120
 						$thisfile_asf_videomedia_currentstream['format_data']['codec_data']       = substr($streamdata['type_specific_data'], $videomediaoffset);
1121 1121
 
1122
-						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1122
+						if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1123 1123
 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
1124 1124
 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
1125 1125
 									$thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 					$thisfile_asf_simpleindexobject['objectid_guid']             = $NextObjectGUIDtext;
1226 1226
 					$thisfile_asf_simpleindexobject['objectsize']                = $NextObjectSize;
1227 1227
 
1228
-					$thisfile_asf_simpleindexobject['fileid']                    =                  substr($SimpleIndexObjectData, $offset, 16);
1228
+					$thisfile_asf_simpleindexobject['fileid']                    = substr($SimpleIndexObjectData, $offset, 16);
1229 1229
 					$offset += 16;
1230 1230
 					$thisfile_asf_simpleindexobject['fileid_guid']               = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']);
1231 1231
 					$thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8));
@@ -1379,8 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		}
1380 1380
 
1381 1381
 		switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') {
1382
-			case 'MPEG Layer-3':
1383
-				$thisfile_audio['dataformat'] = 'mp3';
1382
+			case 'MPEG Layer-3' : $thisfile_audio['dataformat'] = 'mp3';
1384 1383
 				break;
1385 1384
 
1386 1385
 			default:
@@ -1401,7 +1400,7 @@  discard block
 block discarded – undo
1401 1400
 						// AH 2003-10-01
1402 1401
 						$thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']);
1403 1402
 
1404
-						$thisfile_audio['codec']   = $thisfile_audio['encoder'];
1403
+						$thisfile_audio['codec'] = $thisfile_audio['encoder'];
1405 1404
 						break;
1406 1405
 
1407 1406
 					default:
@@ -1413,15 +1412,15 @@  discard block
 block discarded – undo
1413 1412
 		}
1414 1413
 
1415 1414
 		if (isset($info['audio'])) {
1416
-			$thisfile_audio['lossless']           = (isset($thisfile_audio['lossless'])           ? $thisfile_audio['lossless']           : false);
1417
-			$thisfile_audio['dataformat']         = (!empty($thisfile_audio['dataformat'])        ? $thisfile_audio['dataformat']         : 'asf');
1415
+			$thisfile_audio['lossless']           = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false);
1416
+			$thisfile_audio['dataformat']         = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf');
1418 1417
 		}
1419
-		if (!empty($thisfile_video['dataformat'])) {
1420
-			$thisfile_video['lossless']           = (isset($thisfile_audio['lossless'])           ? $thisfile_audio['lossless']           : false);
1418
+		if ( ! empty($thisfile_video['dataformat'])) {
1419
+			$thisfile_video['lossless']           = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false);
1421 1420
 			$thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1);
1422
-			$thisfile_video['dataformat']         = (!empty($thisfile_video['dataformat'])        ? $thisfile_video['dataformat']         : 'asf');
1421
+			$thisfile_video['dataformat']         = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf');
1423 1422
 		}
1424
-		if (!empty($thisfile_video['streams'])) {
1423
+		if ( ! empty($thisfile_video['streams'])) {
1425 1424
 			$thisfile_video['resolution_x'] = 0;
1426 1425
 			$thisfile_video['resolution_y'] = 0;
1427 1426
 			foreach ($thisfile_video['streams'] as $key => $valuearray) {
@@ -1433,7 +1432,7 @@  discard block
 block discarded – undo
1433 1432
 		}
1434 1433
 		$info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);
1435 1434
 
1436
-		if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
1435
+		if (( ! isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
1437 1436
 			$info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8);
1438 1437
 		}
1439 1438
 
@@ -1593,13 +1592,13 @@  discard block
 block discarded – undo
1593 1592
 		// AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string:
1594 1593
 		// $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp
1595 1594
 
1596
-		$hexbytecharstring  = chr(hexdec(substr($GUIDstring,  6, 2)));
1597
-		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  4, 2)));
1598
-		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  2, 2)));
1599
-		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  0, 2)));
1595
+		$hexbytecharstring  = chr(hexdec(substr($GUIDstring, 6, 2)));
1596
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2)));
1597
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2)));
1598
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2)));
1600 1599
 
1601 1600
 		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2)));
1602
-		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  9, 2)));
1601
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2)));
1603 1602
 
1604 1603
 		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2)));
1605 1604
 		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2)));
@@ -1618,19 +1617,19 @@  discard block
 block discarded – undo
1618 1617
 	}
1619 1618
 
1620 1619
 	public static function BytestringToGUID($Bytestring) {
1621
-		$GUIDstring  = str_pad(dechex(ord($Bytestring{3})),  2, '0', STR_PAD_LEFT);
1622
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{2})),  2, '0', STR_PAD_LEFT);
1623
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{1})),  2, '0', STR_PAD_LEFT);
1624
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{0})),  2, '0', STR_PAD_LEFT);
1620
+		$GUIDstring  = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT);
1621
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT);
1622
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT);
1623
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT);
1625 1624
 		$GUIDstring .= '-';
1626
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{5})),  2, '0', STR_PAD_LEFT);
1627
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{4})),  2, '0', STR_PAD_LEFT);
1625
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT);
1626
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT);
1628 1627
 		$GUIDstring .= '-';
1629
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{7})),  2, '0', STR_PAD_LEFT);
1630
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{6})),  2, '0', STR_PAD_LEFT);
1628
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT);
1629
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT);
1631 1630
 		$GUIDstring .= '-';
1632
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{8})),  2, '0', STR_PAD_LEFT);
1633
-		$GUIDstring .= str_pad(dechex(ord($Bytestring{9})),  2, '0', STR_PAD_LEFT);
1631
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT);
1632
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT);
1634 1633
 		$GUIDstring .= '-';
1635 1634
 		$GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
1636 1635
 		$GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
@@ -1642,7 +1641,7 @@  discard block
 block discarded – undo
1642 1641
 		return strtoupper($GUIDstring);
1643 1642
 	}
1644 1643
 
1645
-	public static function FILETIMEtoUNIXtime($FILETIME, $round=true) {
1644
+	public static function FILETIMEtoUNIXtime($FILETIME, $round = true) {
1646 1645
 		// FILETIME is a 64-bit unsigned integer representing
1647 1646
 		// the number of 100-nanosecond intervals since January 1, 1601
1648 1647
 		// UNIX timestamp is number of seconds since January 1, 1970
@@ -1694,12 +1693,12 @@  discard block
 block discarded – undo
1694 1693
 			$offset = $objectOffset;
1695 1694
 			$thisObject = array();
1696 1695
 
1697
-			$thisObject['guid']                              =                              substr($asf_header_extension_object_data, $offset, 16);
1696
+			$thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16);
1698 1697
 			$offset += 16;
1699 1698
 			$thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']);
1700 1699
 			$thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']);
1701 1700
 
1702
-			$thisObject['size']                              = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
1701
+			$thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
1703 1702
 			$offset += 8;
1704 1703
 			if ($thisObject['size'] <= 0) {
1705 1704
 				break;
@@ -1707,67 +1706,67 @@  discard block
 block discarded – undo
1707 1706
 
1708 1707
 			switch ($thisObject['guid']) {
1709 1708
 				case GETID3_ASF_Extended_Stream_Properties_Object:
1710
-					$thisObject['start_time']                        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
1709
+					$thisObject['start_time']                        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
1711 1710
 					$offset += 8;
1712 1711
 					$thisObject['start_time_unix']                   = $this->FILETIMEtoUNIXtime($thisObject['start_time']);
1713 1712
 
1714
-					$thisObject['end_time']                          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
1713
+					$thisObject['end_time']                          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8));
1715 1714
 					$offset += 8;
1716 1715
 					$thisObject['end_time_unix']                     = $this->FILETIMEtoUNIXtime($thisObject['end_time']);
1717 1716
 
1718
-					$thisObject['data_bitrate']                      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1717
+					$thisObject['data_bitrate']                      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1719 1718
 					$offset += 4;
1720 1719
 
1721
-					$thisObject['buffer_size']                       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1720
+					$thisObject['buffer_size']                       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1722 1721
 					$offset += 4;
1723 1722
 
1724
-					$thisObject['initial_buffer_fullness']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1723
+					$thisObject['initial_buffer_fullness']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1725 1724
 					$offset += 4;
1726 1725
 
1727
-					$thisObject['alternate_data_bitrate']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1726
+					$thisObject['alternate_data_bitrate']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1728 1727
 					$offset += 4;
1729 1728
 
1730
-					$thisObject['alternate_buffer_size']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1729
+					$thisObject['alternate_buffer_size']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1731 1730
 					$offset += 4;
1732 1731
 
1733
-					$thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1732
+					$thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1734 1733
 					$offset += 4;
1735 1734
 
1736
-					$thisObject['maximum_object_size']               = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1735
+					$thisObject['maximum_object_size']               = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1737 1736
 					$offset += 4;
1738 1737
 
1739
-					$thisObject['flags_raw']                         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1738
+					$thisObject['flags_raw']                         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1740 1739
 					$offset += 4;
1741 1740
 					$thisObject['flags']['reliable']                = (bool) $thisObject['flags_raw'] & 0x00000001;
1742 1741
 					$thisObject['flags']['seekable']                = (bool) $thisObject['flags_raw'] & 0x00000002;
1743 1742
 					$thisObject['flags']['no_cleanpoints']          = (bool) $thisObject['flags_raw'] & 0x00000004;
1744 1743
 					$thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008;
1745 1744
 
1746
-					$thisObject['stream_number']                     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1745
+					$thisObject['stream_number']                     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1747 1746
 					$offset += 2;
1748 1747
 
1749
-					$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1748
+					$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1750 1749
 					$offset += 2;
1751 1750
 
1752
-					$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1751
+					$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1753 1752
 					$offset += 4;
1754 1753
 
1755
-					$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1754
+					$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1756 1755
 					$offset += 2;
1757 1756
 
1758
-					$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1757
+					$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1759 1758
 					$offset += 2;
1760 1759
 
1761 1760
 					for ($i = 0; $i < $thisObject['stream_name_count']; $i++) {
1762 1761
 						$streamName = array();
1763 1762
 
1764
-						$streamName['language_id_index']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1763
+						$streamName['language_id_index']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1765 1764
 						$offset += 2;
1766 1765
 
1767
-						$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1766
+						$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1768 1767
 						$offset += 2;
1769 1768
 
1770
-						$streamName['stream_name']                   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $streamName['stream_name_length']));
1769
+						$streamName['stream_name']                   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length']));
1771 1770
 						$offset += $streamName['stream_name_length'];
1772 1771
 
1773 1772
 						$thisObject['stream_names'][$i] = $streamName;
@@ -1776,20 +1775,20 @@  discard block
 block discarded – undo
1776 1775
 					for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) {
1777 1776
 						$payloadExtensionSystem = array();
1778 1777
 
1779
-						$payloadExtensionSystem['extension_system_id']   =                              substr($asf_header_extension_object_data, $offset, 16);
1778
+						$payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16);
1780 1779
 						$offset += 16;
1781 1780
 						$payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']);
1782 1781
 
1783
-						$payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1782
+						$payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1784 1783
 						$offset += 2;
1785 1784
 						if ($payloadExtensionSystem['extension_system_size'] <= 0) {
1786 1785
 							break 2;
1787 1786
 						}
1788 1787
 
1789
-						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1788
+						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1790 1789
 						$offset += 4;
1791 1790
 
1792
-						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $payloadExtensionSystem['extension_system_info_length']));
1791
+						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length']));
1793 1792
 						$offset += $payloadExtensionSystem['extension_system_info_length'];
1794 1793
 
1795 1794
 						$thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
@@ -1802,32 +1801,32 @@  discard block
 block discarded – undo
1802 1801
 					break;
1803 1802
 
1804 1803
 				case GETID3_ASF_Metadata_Object:
1805
-					$thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1804
+					$thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1806 1805
 					$offset += 2;
1807 1806
 
1808 1807
 					for ($i = 0; $i < $thisObject['description_record_counts']; $i++) {
1809 1808
 						$descriptionRecord = array();
1810 1809
 
1811
-						$descriptionRecord['reserved_1']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2)); // must be zero
1810
+						$descriptionRecord['reserved_1']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero
1812 1811
 						$offset += 2;
1813 1812
 
1814
-						$descriptionRecord['stream_number']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1813
+						$descriptionRecord['stream_number']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1815 1814
 						$offset += 2;
1816 1815
 
1817
-						$descriptionRecord['name_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1816
+						$descriptionRecord['name_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1818 1817
 						$offset += 2;
1819 1818
 
1820
-						$descriptionRecord['data_type']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1819
+						$descriptionRecord['data_type']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1821 1820
 						$offset += 2;
1822 1821
 						$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
1823 1822
 
1824
-						$descriptionRecord['data_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1823
+						$descriptionRecord['data_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1825 1824
 						$offset += 4;
1826 1825
 
1827
-						$descriptionRecord['name']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
1826
+						$descriptionRecord['name']               = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']);
1828 1827
 						$offset += $descriptionRecord['name_length'];
1829 1828
 
1830
-						$descriptionRecord['data']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
1829
+						$descriptionRecord['data']               = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']);
1831 1830
 						$offset += $descriptionRecord['data_length'];
1832 1831
 						switch ($descriptionRecord['data_type']) {
1833 1832
 							case 0x0000: // Unicode string
@@ -1857,16 +1856,16 @@  discard block
 block discarded – undo
1857 1856
 					break;
1858 1857
 
1859 1858
 				case GETID3_ASF_Language_List_Object:
1860
-					$thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1859
+					$thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1861 1860
 					$offset += 2;
1862 1861
 
1863 1862
 					for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) {
1864 1863
 						$languageIDrecord = array();
1865 1864
 
1866
-						$languageIDrecord['language_id_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  1));
1865
+						$languageIDrecord['language_id_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1));
1867 1866
 						$offset += 1;
1868 1867
 
1869
-						$languageIDrecord['language_id']                =                              substr($asf_header_extension_object_data, $offset,  $languageIDrecord['language_id_length']);
1868
+						$languageIDrecord['language_id']                = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']);
1870 1869
 						$offset += $languageIDrecord['language_id_length'];
1871 1870
 
1872 1871
 						$thisObject['language_id_record'][$i] = $languageIDrecord;
@@ -1874,32 +1873,32 @@  discard block
 block discarded – undo
1874 1873
 					break;
1875 1874
 
1876 1875
 				case GETID3_ASF_Metadata_Library_Object:
1877
-					$thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1876
+					$thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1878 1877
 					$offset += 2;
1879 1878
 
1880 1879
 					for ($i = 0; $i < $thisObject['description_records_count']; $i++) {
1881 1880
 						$descriptionRecord = array();
1882 1881
 
1883
-						$descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1882
+						$descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1884 1883
 						$offset += 2;
1885 1884
 
1886
-						$descriptionRecord['stream_number']       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1885
+						$descriptionRecord['stream_number']       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1887 1886
 						$offset += 2;
1888 1887
 
1889
-						$descriptionRecord['name_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1888
+						$descriptionRecord['name_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1890 1889
 						$offset += 2;
1891 1890
 
1892
-						$descriptionRecord['data_type']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
1891
+						$descriptionRecord['data_type']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1893 1892
 						$offset += 2;
1894 1893
 						$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
1895 1894
 
1896
-						$descriptionRecord['data_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
1895
+						$descriptionRecord['data_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1897 1896
 						$offset += 4;
1898 1897
 
1899
-						$descriptionRecord['name']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
1898
+						$descriptionRecord['name']                = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']);
1900 1899
 						$offset += $descriptionRecord['name_length'];
1901 1900
 
1902
-						$descriptionRecord['data']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
1901
+						$descriptionRecord['data']                = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']);
1903 1902
 						$offset += $descriptionRecord['data_length'];
1904 1903
 
1905 1904
 						if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) {
@@ -1934,12 +1933,12 @@  discard block
 block discarded – undo
1934 1933
 	public static function metadataLibraryObjectDataTypeLookup($id) {
1935 1934
 		static $lookup = array(
1936 1935
 			0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters
1937
-			0x0001 => 'BYTE array',     // The type of the data is implementation-specific
1938
-			0x0002 => 'BOOL',           // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values
1939
-			0x0003 => 'DWORD',          // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer
1940
-			0x0004 => 'QWORD',          // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer
1941
-			0x0005 => 'WORD',           // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer
1942
-			0x0006 => 'GUID',           // The data is 16 bytes long and should be interpreted as a 128-bit GUID
1936
+			0x0001 => 'BYTE array', // The type of the data is implementation-specific
1937
+			0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values
1938
+			0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer
1939
+			0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer
1940
+			0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer
1941
+			0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID
1943 1942
 		);
1944 1943
 		return (isset($lookup[$id]) ? $lookup[$id] : 'invalid');
1945 1944
 	}
@@ -1983,10 +1982,10 @@  discard block
 block discarded – undo
1983 1982
 		$WMpicture['image_mime'] = '';
1984 1983
 		$imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo);
1985 1984
 		unset($imageinfo);
1986
-		if (!empty($imagechunkcheck)) {
1985
+		if ( ! empty($imagechunkcheck)) {
1987 1986
 			$WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
1988 1987
 		}
1989
-		if (!isset($this->getid3->info['asf']['comments']['picture'])) {
1988
+		if ( ! isset($this->getid3->info['asf']['comments']['picture'])) {
1990 1989
 			$this->getid3->info['asf']['comments']['picture'] = array();
1991 1990
 		}
1992 1991
 		$this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']);
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.audio-video.flv.php 2 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -390,6 +390,9 @@  discard block
 block discarded – undo
390 390
 	public $bytes;
391 391
 	public $pos;
392 392
 
393
+	/**
394
+	 * @param string $bytes
395
+	 */
393 396
 	public function __construct(&$bytes) {
394 397
 		$this->bytes =& $bytes;
395 398
 		$this->pos = 0;
@@ -473,6 +476,9 @@  discard block
 block discarded – undo
473 476
 class AMFReader {
474 477
 	public $stream;
475 478
 
479
+	/**
480
+	 * @param AMFStream $stream
481
+	 */
476 482
 	public function __construct(&$stream) {
477 483
 		$this->stream =& $stream;
478 484
 	}
@@ -635,6 +641,9 @@  discard block
 block discarded – undo
635 641
 	public $width;
636 642
 	public $height;
637 643
 
644
+	/**
645
+	 * @param string $sps
646
+	 */
638 647
 	public function __construct($sps) {
639 648
 		$this->sps = $sps;
640 649
 	}
@@ -691,6 +700,9 @@  discard block
 block discarded – undo
691 700
 		}
692 701
 	}
693 702
 
703
+	/**
704
+	 * @param integer $bits
705
+	 */
694 706
 	public function skipBits($bits) {
695 707
 		$newBits = $this->currentBits + $bits;
696 708
 		$this->currentBytes += (int)floor($newBits / 8);
@@ -703,6 +715,9 @@  discard block
 block discarded – undo
703 715
 		return $result;
704 716
 	}
705 717
 
718
+	/**
719
+	 * @param integer $bits
720
+	 */
706 721
 	public function getBits($bits) {
707 722
 		$result = 0;
708 723
 		for ($i = 0; $i < $bits; $i++) {
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -52,25 +52,25 @@  discard block
 block discarded – undo
52 52
 //                                                            ///
53 53
 /////////////////////////////////////////////////////////////////
54 54
 
55
-define('GETID3_FLV_TAG_AUDIO',          8);
56
-define('GETID3_FLV_TAG_VIDEO',          9);
57
-define('GETID3_FLV_TAG_META',          18);
55
+define('GETID3_FLV_TAG_AUDIO', 8);
56
+define('GETID3_FLV_TAG_VIDEO', 9);
57
+define('GETID3_FLV_TAG_META', 18);
58 58
 
59
-define('GETID3_FLV_VIDEO_H263',         2);
60
-define('GETID3_FLV_VIDEO_SCREEN',       3);
61
-define('GETID3_FLV_VIDEO_VP6FLV',       4);
59
+define('GETID3_FLV_VIDEO_H263', 2);
60
+define('GETID3_FLV_VIDEO_SCREEN', 3);
61
+define('GETID3_FLV_VIDEO_VP6FLV', 4);
62 62
 define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5);
63
-define('GETID3_FLV_VIDEO_SCREENV2',     6);
64
-define('GETID3_FLV_VIDEO_H264',         7);
65
-
66
-define('H264_AVC_SEQUENCE_HEADER',          0);
67
-define('H264_PROFILE_BASELINE',            66);
68
-define('H264_PROFILE_MAIN',                77);
69
-define('H264_PROFILE_EXTENDED',            88);
70
-define('H264_PROFILE_HIGH',               100);
71
-define('H264_PROFILE_HIGH10',             110);
72
-define('H264_PROFILE_HIGH422',            122);
73
-define('H264_PROFILE_HIGH444',            144);
63
+define('GETID3_FLV_VIDEO_SCREENV2', 6);
64
+define('GETID3_FLV_VIDEO_H264', 7);
65
+
66
+define('H264_AVC_SEQUENCE_HEADER', 0);
67
+define('H264_PROFILE_BASELINE', 66);
68
+define('H264_PROFILE_MAIN', 77);
69
+define('H264_PROFILE_EXTENDED', 88);
70
+define('H264_PROFILE_HIGH', 100);
71
+define('H264_PROFILE_HIGH10', 110);
72
+define('H264_PROFILE_HIGH422', 122);
73
+define('H264_PROFILE_HIGH444', 144);
74 74
 define('H264_PROFILE_HIGH444_PREDICTIVE', 244);
75 75
 
76 76
 class getid3_flv extends getid3_handler {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		$FLVheader = $this->fread(5);
89 89
 
90 90
 		$info['fileformat'] = 'flv';
91
-		$info['flv']['header']['signature'] =                           substr($FLVheader, 0, 3);
91
+		$info['flv']['header']['signature'] = substr($FLVheader, 0, 3);
92 92
 		$info['flv']['header']['version']   = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
93 93
 		$TypeFlags                          = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
94 94
 
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 		$tagParseCount = 0;
115 115
 		$info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);
116 116
 		$flv_framecount = &$info['flv']['framecount'];
117
-		while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime))  {
117
+		while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || ! $found_valid_meta_playtime)) {
118 118
 			$ThisTagHeader = $this->fread(16);
119 119
 
120
-			$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  0, 4));
121
-			$TagType           = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  4, 1));
122
-			$DataLength        = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  5, 3));
123
-			$Timestamp         = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  8, 3));
120
+			$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4));
121
+			$TagType           = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1));
122
+			$DataLength        = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3));
123
+			$Timestamp         = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3));
124 124
 			$LastHeaderByte    = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
125 125
 			$NextOffset = $this->ftell() - 1 + $DataLength;
126 126
 			if ($Timestamp > $Duration) {
@@ -131,18 +131,18 @@  discard block
 block discarded – undo
131 131
 			switch ($TagType) {
132 132
 				case GETID3_FLV_TAG_AUDIO:
133 133
 					$flv_framecount['audio']++;
134
-					if (!$found_audio) {
134
+					if ( ! $found_audio) {
135 135
 						$found_audio = true;
136 136
 						$info['flv']['audio']['audioFormat']     = ($LastHeaderByte >> 4) & 0x0F;
137 137
 						$info['flv']['audio']['audioRate']       = ($LastHeaderByte >> 2) & 0x03;
138 138
 						$info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01;
139
-						$info['flv']['audio']['audioType']       =  $LastHeaderByte       & 0x01;
139
+						$info['flv']['audio']['audioType']       = $LastHeaderByte & 0x01;
140 140
 					}
141 141
 					break;
142 142
 
143 143
 				case GETID3_FLV_TAG_VIDEO:
144 144
 					$flv_framecount['video']++;
145
-					if (!$found_video) {
145
+					if ( ! $found_video) {
146 146
 						$found_video = true;
147 147
 						$info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
148 148
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 							$AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1));
155 155
 							if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) {
156 156
 								//	read AVCDecoderConfigurationRecord
157
-								$configurationVersion       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  4, 1));
158
-								$AVCProfileIndication       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  5, 1));
159
-								$profile_compatibility      = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  6, 1));
160
-								$lengthSizeMinusOne         = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  7, 1));
161
-								$numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  8, 1));
157
+								$configurationVersion       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1));
158
+								$AVCProfileIndication       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1));
159
+								$profile_compatibility      = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1));
160
+								$lengthSizeMinusOne         = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1));
161
+								$numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1));
162 162
 
163 163
 								if (($numOfSequenceParameterSets & 0x1F) != 0) {
164 164
 									//	there is at least one SequenceParameterSet
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 
237 237
 							}
238 238
 
239
-						} elseif ($info['flv']['video']['videoCodec'] ==  GETID3_FLV_VIDEO_VP6FLV_ALPHA) {
239
+						} elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) {
240 240
 
241 241
 							/* contributed by schouwerwouØgmail*com */
242
-							if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set
242
+							if ( ! isset($info['video']['resolution_x'])) { // only when meta data isn't set
243 243
 								$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
244 244
 								$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2));
245 245
 								$info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 							/* end schouwerwouØgmail*com */
249 249
 
250 250
 						}
251
-						if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) {
251
+						if ( ! empty($info['video']['resolution_x']) && ! empty($info['video']['resolution_y'])) {
252 252
 							$info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
253 253
 						}
254 254
 					}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 				// Meta tag
258 258
 				case GETID3_FLV_TAG_META:
259
-					if (!$found_meta) {
259
+					if ( ! $found_meta) {
260 260
 						$found_meta = true;
261 261
 						$this->fseek(-1, SEEK_CUR);
262 262
 						$datachunk = $this->fread($DataLength);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 								}
286 286
 							}
287 287
 						}
288
-						if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
288
+						if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) {
289 289
 							$found_valid_meta_playtime = true;
290 290
 						}
291 291
 					}
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
 		}
305 305
 
306 306
 		if ($info['flv']['header']['hasAudio']) {
307
-			$info['audio']['codec']           =   self::audioFormatLookup($info['flv']['audio']['audioFormat']);
308
-			$info['audio']['sample_rate']     =     self::audioRateLookup($info['flv']['audio']['audioRate']);
307
+			$info['audio']['codec']           = self::audioFormatLookup($info['flv']['audio']['audioFormat']);
308
+			$info['audio']['sample_rate']     = self::audioRateLookup($info['flv']['audio']['audioRate']);
309 309
 			$info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']);
310 310
 
311
-			$info['audio']['channels']   =  $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
311
+			$info['audio']['channels']   = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
312 312
 			$info['audio']['lossless']   = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
313 313
 			$info['audio']['dataformat'] = 'flv';
314 314
 		}
315
-		if (!empty($info['flv']['header']['hasVideo'])) {
315
+		if ( ! empty($info['flv']['header']['hasVideo'])) {
316 316
 			$info['video']['codec']      = self::videoCodecLookup($info['flv']['video']['videoCodec']);
317 317
 			$info['video']['dataformat'] = 'flv';
318 318
 			$info['video']['lossless']   = false;
319 319
 		}
320 320
 
321 321
 		// Set information from meta
322
-		if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
322
+		if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) {
323 323
 			$info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration'];
324 324
 			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
325 325
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	public $pos;
392 392
 
393 393
 	public function __construct(&$bytes) {
394
-		$this->bytes =& $bytes;
394
+		$this->bytes = & $bytes;
395 395
 		$this->pos = 0;
396 396
 	}
397 397
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	public $stream;
475 475
 
476 476
 	public function __construct(&$stream) {
477
-		$this->stream =& $stream;
477
+		$this->stream = & $stream;
478 478
 	}
479 479
 
480 480
 	public function readData() {
@@ -642,35 +642,35 @@  discard block
 block discarded – undo
642 642
 	public function readData() {
643 643
 		$this->skipBits(8);
644 644
 		$this->skipBits(8);
645
-		$profile = $this->getBits(8);                               // read profile
645
+		$profile = $this->getBits(8); // read profile
646 646
 		if ($profile > 0) {
647 647
 			$this->skipBits(8);
648
-			$level_idc = $this->getBits(8);                         // level_idc
649
-			$this->expGolombUe();                                   // seq_parameter_set_id // sps
650
-			$this->expGolombUe();                                   // log2_max_frame_num_minus4
651
-			$picOrderType = $this->expGolombUe();                   // pic_order_cnt_type
648
+			$level_idc = $this->getBits(8); // level_idc
649
+			$this->expGolombUe(); // seq_parameter_set_id // sps
650
+			$this->expGolombUe(); // log2_max_frame_num_minus4
651
+			$picOrderType = $this->expGolombUe(); // pic_order_cnt_type
652 652
 			if ($picOrderType == 0) {
653
-				$this->expGolombUe();                               // log2_max_pic_order_cnt_lsb_minus4
653
+				$this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4
654 654
 			} elseif ($picOrderType == 1) {
655
-				$this->skipBits(1);                                 // delta_pic_order_always_zero_flag
656
-				$this->expGolombSe();                               // offset_for_non_ref_pic
657
-				$this->expGolombSe();                               // offset_for_top_to_bottom_field
655
+				$this->skipBits(1); // delta_pic_order_always_zero_flag
656
+				$this->expGolombSe(); // offset_for_non_ref_pic
657
+				$this->expGolombSe(); // offset_for_top_to_bottom_field
658 658
 				$num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle
659 659
 				for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) {
660
-					$this->expGolombSe();                           // offset_for_ref_frame[ i ]
660
+					$this->expGolombSe(); // offset_for_ref_frame[ i ]
661 661
 				}
662 662
 			}
663
-			$this->expGolombUe();                                   // num_ref_frames
664
-			$this->skipBits(1);                                     // gaps_in_frame_num_value_allowed_flag
665
-			$pic_width_in_mbs_minus1 = $this->expGolombUe();        // pic_width_in_mbs_minus1
663
+			$this->expGolombUe(); // num_ref_frames
664
+			$this->skipBits(1); // gaps_in_frame_num_value_allowed_flag
665
+			$pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1
666 666
 			$pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1
667 667
 
668
-			$frame_mbs_only_flag = $this->getBits(1);               // frame_mbs_only_flag
668
+			$frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag
669 669
 			if ($frame_mbs_only_flag == 0) {
670
-				$this->skipBits(1);                                 // mb_adaptive_frame_field_flag
670
+				$this->skipBits(1); // mb_adaptive_frame_field_flag
671 671
 			}
672
-			$this->skipBits(1);                                     // direct_8x8_inference_flag
673
-			$frame_cropping_flag = $this->getBits(1);               // frame_cropping_flag
672
+			$this->skipBits(1); // direct_8x8_inference_flag
673
+			$frame_cropping_flag = $this->getBits(1); // frame_cropping_flag
674 674
 
675 675
 			$frame_crop_left_offset   = 0;
676 676
 			$frame_crop_right_offset  = 0;
@@ -678,12 +678,12 @@  discard block
 block discarded – undo
678 678
 			$frame_crop_bottom_offset = 0;
679 679
 
680 680
 			if ($frame_cropping_flag) {
681
-				$frame_crop_left_offset   = $this->expGolombUe();   // frame_crop_left_offset
682
-				$frame_crop_right_offset  = $this->expGolombUe();   // frame_crop_right_offset
683
-				$frame_crop_top_offset    = $this->expGolombUe();   // frame_crop_top_offset
684
-				$frame_crop_bottom_offset = $this->expGolombUe();   // frame_crop_bottom_offset
681
+				$frame_crop_left_offset   = $this->expGolombUe(); // frame_crop_left_offset
682
+				$frame_crop_right_offset  = $this->expGolombUe(); // frame_crop_right_offset
683
+				$frame_crop_top_offset    = $this->expGolombUe(); // frame_crop_top_offset
684
+				$frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset
685 685
 			}
686
-			$this->skipBits(1);                                     // vui_parameters_present_flag
686
+			$this->skipBits(1); // vui_parameters_present_flag
687 687
 			// etc
688 688
 
689 689
 			$this->width  = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2);
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 
694 694
 	public function skipBits($bits) {
695 695
 		$newBits = $this->currentBits + $bits;
696
-		$this->currentBytes += (int)floor($newBits / 8);
696
+		$this->currentBytes += (int) floor($newBits / 8);
697 697
 		$this->currentBits = $newBits % 8;
698 698
 	}
699 699
 
Please login to merge, or discard this patch.