@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | * @since 1.5.0 |
1584 | 1584 | * |
1585 | 1585 | * @param int $num Number of day. |
1586 | - * @return int Days since the start of the week. |
|
1586 | + * @return double Days since the start of the week. |
|
1587 | 1587 | */ |
1588 | 1588 | function calendar_week_mod($num) { |
1589 | 1589 | $base = 7; |
@@ -2737,7 +2737,7 @@ discard block |
||
2737 | 2737 | * @type string $before_page_number A string to appear before the page number. Default empty. |
2738 | 2738 | * @type string $after_page_number A string to append after the page number. Default empty. |
2739 | 2739 | * } |
2740 | - * @return array|string|void String of page links or array of page links. |
|
2740 | + * @return string String of page links or array of page links. |
|
2741 | 2741 | */ |
2742 | 2742 | function paginate_links( $args = '' ) { |
2743 | 2743 | global $wp_query, $wp_rewrite; |
@@ -2900,7 +2900,7 @@ discard block |
||
2900 | 2900 | * @param string $key The unique key for this theme. |
2901 | 2901 | * @param string $name The name of the theme. |
2902 | 2902 | * @param string $url The url of the css file containing the colour scheme. |
2903 | - * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme. |
|
2903 | + * @param string[] $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme. |
|
2904 | 2904 | * @param array $icons Optional An array of CSS color definitions used to color any SVG icons |
2905 | 2905 | */ |
2906 | 2906 | function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * General template tags that can go anywhere in a template. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Template |
|
7 | - */ |
|
3 | + * General template tags that can go anywhere in a template. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Template |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Load header template. |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @param string $name The name of the specialised header. |
21 | 21 | */ |
22 | -function get_header( $name = null ) { |
|
22 | +function get_header($name = null) { |
|
23 | 23 | /** |
24 | 24 | * Fires before the header template file is loaded. |
25 | 25 | * |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param string $name Name of the specific header file to use. |
34 | 34 | */ |
35 | - do_action( 'get_header', $name ); |
|
35 | + do_action('get_header', $name); |
|
36 | 36 | |
37 | 37 | $templates = array(); |
38 | 38 | $name = (string) $name; |
39 | - if ( '' !== $name ) |
|
39 | + if ('' !== $name) |
|
40 | 40 | $templates[] = "header-{$name}.php"; |
41 | 41 | |
42 | 42 | $templates[] = 'header.php'; |
43 | 43 | |
44 | 44 | // Backward compat code will be removed in a future release |
45 | 45 | if ('' == locate_template($templates, true)) |
46 | - load_template( ABSPATH . WPINC . '/theme-compat/header.php'); |
|
46 | + load_template(ABSPATH.WPINC.'/theme-compat/header.php'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @param string $name The name of the specialised footer. |
61 | 61 | */ |
62 | -function get_footer( $name = null ) { |
|
62 | +function get_footer($name = null) { |
|
63 | 63 | /** |
64 | 64 | * Fires before the footer template file is loaded. |
65 | 65 | * |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param string $name Name of the specific footer file to use. |
74 | 74 | */ |
75 | - do_action( 'get_footer', $name ); |
|
75 | + do_action('get_footer', $name); |
|
76 | 76 | |
77 | 77 | $templates = array(); |
78 | 78 | $name = (string) $name; |
79 | - if ( '' !== $name ) |
|
79 | + if ('' !== $name) |
|
80 | 80 | $templates[] = "footer-{$name}.php"; |
81 | 81 | |
82 | 82 | $templates[] = 'footer.php'; |
83 | 83 | |
84 | 84 | // Backward compat code will be removed in a future release |
85 | 85 | if ('' == locate_template($templates, true)) |
86 | - load_template( ABSPATH . WPINC . '/theme-compat/footer.php'); |
|
86 | + load_template(ABSPATH.WPINC.'/theme-compat/footer.php'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @param string $name The name of the specialised sidebar. |
101 | 101 | */ |
102 | -function get_sidebar( $name = null ) { |
|
102 | +function get_sidebar($name = null) { |
|
103 | 103 | /** |
104 | 104 | * Fires before the sidebar template file is loaded. |
105 | 105 | * |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @param string $name Name of the specific sidebar file to use. |
114 | 114 | */ |
115 | - do_action( 'get_sidebar', $name ); |
|
115 | + do_action('get_sidebar', $name); |
|
116 | 116 | |
117 | 117 | $templates = array(); |
118 | 118 | $name = (string) $name; |
119 | - if ( '' !== $name ) |
|
119 | + if ('' !== $name) |
|
120 | 120 | $templates[] = "sidebar-{$name}.php"; |
121 | 121 | |
122 | 122 | $templates[] = 'sidebar.php'; |
123 | 123 | |
124 | 124 | // Backward compat code will be removed in a future release |
125 | 125 | if ('' == locate_template($templates, true)) |
126 | - load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php'); |
|
126 | + load_template(ABSPATH.WPINC.'/theme-compat/sidebar.php'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string $slug The slug name for the generic template. |
148 | 148 | * @param string $name The name of the specialised template. |
149 | 149 | */ |
150 | -function get_template_part( $slug, $name = null ) { |
|
150 | +function get_template_part($slug, $name = null) { |
|
151 | 151 | /** |
152 | 152 | * Fires before the specified template part file is loaded. |
153 | 153 | * |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | * @param string $slug The slug name for the generic template. |
160 | 160 | * @param string $name The name of the specialized template. |
161 | 161 | */ |
162 | - do_action( "get_template_part_{$slug}", $slug, $name ); |
|
162 | + do_action("get_template_part_{$slug}", $slug, $name); |
|
163 | 163 | |
164 | 164 | $templates = array(); |
165 | 165 | $name = (string) $name; |
166 | - if ( '' !== $name ) |
|
166 | + if ('' !== $name) |
|
167 | 167 | $templates[] = "{$slug}-{$name}.php"; |
168 | 168 | |
169 | 169 | $templates[] = "{$slug}.php"; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param bool $echo Default to echo and not return the form. |
194 | 194 | * @return string|void String when $echo is false. |
195 | 195 | */ |
196 | -function get_search_form( $echo = true ) { |
|
196 | +function get_search_form($echo = true) { |
|
197 | 197 | /** |
198 | 198 | * Fires before the search form is retrieved, at the start of get_search_form(). |
199 | 199 | * |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @link https://core.trac.wordpress.org/ticket/19321 |
204 | 204 | */ |
205 | - do_action( 'pre_get_search_form' ); |
|
205 | + do_action('pre_get_search_form'); |
|
206 | 206 | |
207 | - $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml'; |
|
207 | + $format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml'; |
|
208 | 208 | |
209 | 209 | /** |
210 | 210 | * Filter the HTML format of the search form. |
@@ -214,28 +214,28 @@ discard block |
||
214 | 214 | * @param string $format The type of markup to use in the search form. |
215 | 215 | * Accepts 'html5', 'xhtml'. |
216 | 216 | */ |
217 | - $format = apply_filters( 'search_form_format', $format ); |
|
217 | + $format = apply_filters('search_form_format', $format); |
|
218 | 218 | |
219 | - $search_form_template = locate_template( 'searchform.php' ); |
|
220 | - if ( '' != $search_form_template ) { |
|
219 | + $search_form_template = locate_template('searchform.php'); |
|
220 | + if ('' != $search_form_template) { |
|
221 | 221 | ob_start(); |
222 | - require( $search_form_template ); |
|
222 | + require($search_form_template); |
|
223 | 223 | $form = ob_get_clean(); |
224 | 224 | } else { |
225 | - if ( 'html5' == $format ) { |
|
226 | - $form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '"> |
|
225 | + if ('html5' == $format) { |
|
226 | + $form = '<form role="search" method="get" class="search-form" action="'.esc_url(home_url('/')).'"> |
|
227 | 227 | <label> |
228 | - <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span> |
|
229 | - <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( 'Search for:', 'label' ) . '" /> |
|
228 | + <span class="screen-reader-text">' . _x('Search for:', 'label').'</span> |
|
229 | + <input type="search" class="search-field" placeholder="' . esc_attr_x('Search …', 'placeholder').'" value="'.get_search_query().'" name="s" title="'.esc_attr_x('Search for:', 'label').'" /> |
|
230 | 230 | </label> |
231 | - <input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> |
|
231 | + <input type="submit" class="search-submit" value="'. esc_attr_x('Search', 'submit button').'" /> |
|
232 | 232 | </form>'; |
233 | 233 | } else { |
234 | - $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> |
|
234 | + $form = '<form role="search" method="get" id="searchform" class="searchform" action="'.esc_url(home_url('/')).'"> |
|
235 | 235 | <div> |
236 | - <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label> |
|
237 | - <input type="text" value="' . get_search_query() . '" name="s" id="s" /> |
|
238 | - <input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> |
|
236 | + <label class="screen-reader-text" for="s">' . _x('Search for:', 'label').'</label> |
|
237 | + <input type="text" value="' . get_search_query().'" name="s" id="s" /> |
|
238 | + <input type="submit" id="searchsubmit" value="'. esc_attr_x('Search', 'submit button').'" /> |
|
239 | 239 | </div> |
240 | 240 | </form>'; |
241 | 241 | } |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | * |
249 | 249 | * @param string $form The search form HTML output. |
250 | 250 | */ |
251 | - $result = apply_filters( 'get_search_form', $form ); |
|
251 | + $result = apply_filters('get_search_form', $form); |
|
252 | 252 | |
253 | - if ( null === $result ) |
|
253 | + if (null === $result) |
|
254 | 254 | $result = $form; |
255 | 255 | |
256 | - if ( $echo ) |
|
256 | + if ($echo) |
|
257 | 257 | echo $result; |
258 | 258 | else |
259 | 259 | return $result; |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | * @return string|void String when retrieving. |
273 | 273 | */ |
274 | 274 | function wp_loginout($redirect = '', $echo = true) { |
275 | - if ( ! is_user_logged_in() ) |
|
276 | - $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; |
|
275 | + if ( ! is_user_logged_in()) |
|
276 | + $link = '<a href="'.esc_url(wp_login_url($redirect)).'">'.__('Log in').'</a>'; |
|
277 | 277 | else |
278 | - $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>'; |
|
278 | + $link = '<a href="'.esc_url(wp_logout_url($redirect)).'">'.__('Log out').'</a>'; |
|
279 | 279 | |
280 | - if ( $echo ) { |
|
280 | + if ($echo) { |
|
281 | 281 | /** |
282 | 282 | * Filter the HTML output for the Log In/Log Out link. |
283 | 283 | * |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @param string $link The HTML link content. |
287 | 287 | */ |
288 | - echo apply_filters( 'loginout', $link ); |
|
288 | + echo apply_filters('loginout', $link); |
|
289 | 289 | } else { |
290 | 290 | /** This filter is documented in wp-includes/general-template.php */ |
291 | - return apply_filters( 'loginout', $link ); |
|
291 | + return apply_filters('loginout', $link); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | * @return string A log out URL. |
304 | 304 | */ |
305 | 305 | function wp_logout_url($redirect = '') { |
306 | - $args = array( 'action' => 'logout' ); |
|
307 | - if ( !empty($redirect) ) { |
|
308 | - $args['redirect_to'] = urlencode( $redirect ); |
|
306 | + $args = array('action' => 'logout'); |
|
307 | + if ( ! empty($redirect)) { |
|
308 | + $args['redirect_to'] = urlencode($redirect); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $logout_url = add_query_arg($args, site_url('wp-login.php', 'login')); |
312 | - $logout_url = wp_nonce_url( $logout_url, 'log-out' ); |
|
312 | + $logout_url = wp_nonce_url($logout_url, 'log-out'); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Filter the logout URL. |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @param string $logout_url The Log Out URL. |
320 | 320 | * @param string $redirect Path to redirect to on logout. |
321 | 321 | */ |
322 | - return apply_filters( 'logout_url', $logout_url, $redirect ); |
|
322 | + return apply_filters('logout_url', $logout_url, $redirect); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | function wp_login_url($redirect = '', $force_reauth = false) { |
335 | 335 | $login_url = site_url('wp-login.php', 'login'); |
336 | 336 | |
337 | - if ( !empty($redirect) ) |
|
337 | + if ( ! empty($redirect)) |
|
338 | 338 | $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); |
339 | 339 | |
340 | - if ( $force_reauth ) |
|
340 | + if ($force_reauth) |
|
341 | 341 | $login_url = add_query_arg('reauth', '1', $login_url); |
342 | 342 | |
343 | 343 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @param string $redirect The path to redirect to on login, if supplied. |
351 | 351 | * @param bool $force_reauth Whether to force reauthorization, even if a cookie is present. |
352 | 352 | */ |
353 | - return apply_filters( 'login_url', $login_url, $redirect, $force_reauth ); |
|
353 | + return apply_filters('login_url', $login_url, $redirect, $force_reauth); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param string $register The user registration URL. |
370 | 370 | */ |
371 | - return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) ); |
|
371 | + return apply_filters('register_url', site_url('wp-login.php?action=register', 'login')); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
@@ -380,15 +380,15 @@ discard block |
||
380 | 380 | * @param array $args Configuration options to modify the form output. |
381 | 381 | * @return string|void String when retrieving. |
382 | 382 | */ |
383 | -function wp_login_form( $args = array() ) { |
|
383 | +function wp_login_form($args = array()) { |
|
384 | 384 | $defaults = array( |
385 | 385 | 'echo' => true, |
386 | - 'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], // Default redirect is back to the current page |
|
386 | + 'redirect' => (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], // Default redirect is back to the current page |
|
387 | 387 | 'form_id' => 'loginform', |
388 | - 'label_username' => __( 'Username' ), |
|
389 | - 'label_password' => __( 'Password' ), |
|
390 | - 'label_remember' => __( 'Remember Me' ), |
|
391 | - 'label_log_in' => __( 'Log In' ), |
|
388 | + 'label_username' => __('Username'), |
|
389 | + 'label_password' => __('Password'), |
|
390 | + 'label_remember' => __('Remember Me'), |
|
391 | + 'label_log_in' => __('Log In'), |
|
392 | 392 | 'id_username' => 'user_login', |
393 | 393 | 'id_password' => 'user_pass', |
394 | 394 | 'id_remember' => 'rememberme', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * |
408 | 408 | * @param array $defaults An array of default login form arguments. |
409 | 409 | */ |
410 | - $args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) ); |
|
410 | + $args = wp_parse_args($args, apply_filters('login_form_defaults', $defaults)); |
|
411 | 411 | |
412 | 412 | /** |
413 | 413 | * Filter content to display at the top of the login form. |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param string $content Content to display. Default empty. |
420 | 420 | * @param array $args Array of login form arguments. |
421 | 421 | */ |
422 | - $login_form_top = apply_filters( 'login_form_top', '', $args ); |
|
422 | + $login_form_top = apply_filters('login_form_top', '', $args); |
|
423 | 423 | |
424 | 424 | /** |
425 | 425 | * Filter content to display in the middle of the login form. |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * @param string $content Content to display. Default empty. |
433 | 433 | * @param array $args Array of login form arguments. |
434 | 434 | */ |
435 | - $login_form_middle = apply_filters( 'login_form_middle', '', $args ); |
|
435 | + $login_form_middle = apply_filters('login_form_middle', '', $args); |
|
436 | 436 | |
437 | 437 | /** |
438 | 438 | * Filter content to display at the bottom of the login form. |
@@ -444,29 +444,29 @@ discard block |
||
444 | 444 | * @param string $content Content to display. Default empty. |
445 | 445 | * @param array $args Array of login form arguments. |
446 | 446 | */ |
447 | - $login_form_bottom = apply_filters( 'login_form_bottom', '', $args ); |
|
447 | + $login_form_bottom = apply_filters('login_form_bottom', '', $args); |
|
448 | 448 | |
449 | 449 | $form = ' |
450 | - <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post"> |
|
451 | - ' . $login_form_top . ' |
|
450 | + <form name="' . $args['form_id'].'" id="'.$args['form_id'].'" action="'.esc_url(site_url('wp-login.php', 'login_post')).'" method="post"> |
|
451 | + ' . $login_form_top.' |
|
452 | 452 | <p class="login-username"> |
453 | - <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label> |
|
454 | - <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" /> |
|
453 | + <label for="' . esc_attr($args['id_username']).'">'.esc_html($args['label_username']).'</label> |
|
454 | + <input type="text" name="log" id="' . esc_attr($args['id_username']).'" class="input" value="'.esc_attr($args['value_username']).'" size="20" /> |
|
455 | 455 | </p> |
456 | 456 | <p class="login-password"> |
457 | - <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label> |
|
458 | - <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" /> |
|
457 | + <label for="' . esc_attr($args['id_password']).'">'.esc_html($args['label_password']).'</label> |
|
458 | + <input type="password" name="pwd" id="' . esc_attr($args['id_password']).'" class="input" value="" size="20" /> |
|
459 | 459 | </p> |
460 | - ' . $login_form_middle . ' |
|
461 | - ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . ' |
|
460 | + ' . $login_form_middle.' |
|
461 | + ' . ($args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="'.esc_attr($args['id_remember']).'" value="forever"'.($args['value_remember'] ? ' checked="checked"' : '').' /> '.esc_html($args['label_remember']).'</label></p>' : '').' |
|
462 | 462 | <p class="login-submit"> |
463 | - <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" /> |
|
464 | - <input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" /> |
|
463 | + <input type="submit" name="wp-submit" id="' . esc_attr($args['id_submit']).'" class="button-primary" value="'.esc_attr($args['label_log_in']).'" /> |
|
464 | + <input type="hidden" name="redirect_to" value="' . esc_url($args['redirect']).'" /> |
|
465 | 465 | </p> |
466 | - ' . $login_form_bottom . ' |
|
466 | + ' . $login_form_bottom.' |
|
467 | 467 | </form>'; |
468 | 468 | |
469 | - if ( $args['echo'] ) |
|
469 | + if ($args['echo']) |
|
470 | 470 | echo $form; |
471 | 471 | else |
472 | 472 | return $form; |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | * @param string $redirect Path to redirect to on login. |
481 | 481 | * @return string Lost password URL. |
482 | 482 | */ |
483 | -function wp_lostpassword_url( $redirect = '' ) { |
|
484 | - $args = array( 'action' => 'lostpassword' ); |
|
485 | - if ( !empty($redirect) ) { |
|
483 | +function wp_lostpassword_url($redirect = '') { |
|
484 | + $args = array('action' => 'lostpassword'); |
|
485 | + if ( ! empty($redirect)) { |
|
486 | 486 | $args['redirect_to'] = $redirect; |
487 | 487 | } |
488 | 488 | |
489 | - $lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') ); |
|
489 | + $lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login')); |
|
490 | 490 | |
491 | 491 | /** |
492 | 492 | * Filter the Lost Password URL. |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $lostpassword_url The lost password page URL. |
497 | 497 | * @param string $redirect The path to redirect to on login. |
498 | 498 | */ |
499 | - return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect ); |
|
499 | + return apply_filters('lostpassword_url', $lostpassword_url, $redirect); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
@@ -512,14 +512,14 @@ discard block |
||
512 | 512 | * @param bool $echo Default to echo and not return the link. |
513 | 513 | * @return string|void String when retrieving. |
514 | 514 | */ |
515 | -function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { |
|
516 | - if ( ! is_user_logged_in() ) { |
|
517 | - if ( get_option('users_can_register') ) |
|
518 | - $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after; |
|
515 | +function wp_register($before = '<li>', $after = '</li>', $echo = true) { |
|
516 | + if ( ! is_user_logged_in()) { |
|
517 | + if (get_option('users_can_register')) |
|
518 | + $link = $before.'<a href="'.esc_url(wp_registration_url()).'">'.__('Register').'</a>'.$after; |
|
519 | 519 | else |
520 | 520 | $link = ''; |
521 | 521 | } else { |
522 | - $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after; |
|
522 | + $link = $before.'<a href="'.admin_url().'">'.__('Site Admin').'</a>'.$after; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @param string $link The HTML code for the link to the Registration or Admin page. |
534 | 534 | */ |
535 | - $link = apply_filters( 'register', $link ); |
|
535 | + $link = apply_filters('register', $link); |
|
536 | 536 | |
537 | - if ( $echo ) { |
|
537 | + if ($echo) { |
|
538 | 538 | echo $link; |
539 | 539 | } else { |
540 | 540 | return $link; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | * |
558 | 558 | * @since 1.5.0 |
559 | 559 | */ |
560 | - do_action( 'wp_meta' ); |
|
560 | + do_action('wp_meta'); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | /** |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @param string $show What to display. |
570 | 570 | */ |
571 | -function bloginfo( $show='' ) { |
|
572 | - echo get_bloginfo( $show, 'display' ); |
|
571 | +function bloginfo($show = '') { |
|
572 | + echo get_bloginfo($show, 'display'); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | /** |
@@ -599,17 +599,17 @@ discard block |
||
599 | 599 | * @param string $filter How to filter what is retrieved. |
600 | 600 | * @return string Mostly string values, might be empty. |
601 | 601 | */ |
602 | -function get_bloginfo( $show = '', $filter = 'raw' ) { |
|
603 | - switch( $show ) { |
|
602 | +function get_bloginfo($show = '', $filter = 'raw') { |
|
603 | + switch ($show) { |
|
604 | 604 | case 'home' : // DEPRECATED |
605 | 605 | case 'siteurl' : // DEPRECATED |
606 | - _deprecated_argument( __FUNCTION__, '2.2', sprintf( |
|
606 | + _deprecated_argument(__FUNCTION__, '2.2', sprintf( |
|
607 | 607 | /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */ |
608 | - __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), |
|
609 | - '<code>' . $show . '</code>', |
|
608 | + __('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.'), |
|
609 | + '<code>'.$show.'</code>', |
|
610 | 610 | '<code>bloginfo()</code>', |
611 | 611 | '<code>url</code>' |
612 | - ) ); |
|
612 | + )); |
|
613 | 613 | case 'url' : |
614 | 614 | $output = home_url(); |
615 | 615 | break; |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $output = get_feed_link('comments_rss2'); |
639 | 639 | break; |
640 | 640 | case 'pingback_url': |
641 | - $output = site_url( 'xmlrpc.php' ); |
|
641 | + $output = site_url('xmlrpc.php'); |
|
642 | 642 | break; |
643 | 643 | case 'stylesheet_url': |
644 | 644 | $output = get_stylesheet_uri(); |
@@ -669,14 +669,14 @@ discard block |
||
669 | 669 | $output = str_replace('_', '-', $output); |
670 | 670 | break; |
671 | 671 | case 'text_direction': |
672 | - _deprecated_argument( __FUNCTION__, '2.2', sprintf( |
|
672 | + _deprecated_argument(__FUNCTION__, '2.2', sprintf( |
|
673 | 673 | /* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */ |
674 | - __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ), |
|
675 | - '<code>' . $show . '</code>', |
|
674 | + __('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.'), |
|
675 | + '<code>'.$show.'</code>', |
|
676 | 676 | '<code>bloginfo()</code>', |
677 | 677 | '<code>is_rtl()</code>' |
678 | - ) ); |
|
679 | - if ( function_exists( 'is_rtl' ) ) { |
|
678 | + )); |
|
679 | + if (function_exists('is_rtl')) { |
|
680 | 680 | $output = is_rtl() ? 'rtl' : 'ltr'; |
681 | 681 | } else { |
682 | 682 | $output = 'ltr'; |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | strpos($show, 'home') === false) |
695 | 695 | $url = false; |
696 | 696 | |
697 | - if ( 'display' == $filter ) { |
|
698 | - if ( $url ) { |
|
697 | + if ('display' == $filter) { |
|
698 | + if ($url) { |
|
699 | 699 | /** |
700 | 700 | * Filter the URL returned by get_bloginfo(). |
701 | 701 | * |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param mixed $output The URL returned by bloginfo(). |
705 | 705 | * @param mixed $show Type of information requested. |
706 | 706 | */ |
707 | - $output = apply_filters( 'bloginfo_url', $output, $show ); |
|
707 | + $output = apply_filters('bloginfo_url', $output, $show); |
|
708 | 708 | } else { |
709 | 709 | /** |
710 | 710 | * Filter the site information returned by get_bloginfo(). |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param mixed $output The requested non-URL site information. |
715 | 715 | * @param mixed $show Type of information requested. |
716 | 716 | */ |
717 | - $output = apply_filters( 'bloginfo', $output, $show ); |
|
717 | + $output = apply_filters('bloginfo', $output, $show); |
|
718 | 718 | } |
719 | 719 | } |
720 | 720 | |
@@ -729,21 +729,21 @@ discard block |
||
729 | 729 | * @param int $blog_id Id of the blog to get the site icon for. |
730 | 730 | * @return string Site Icon URL. |
731 | 731 | */ |
732 | -function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { |
|
733 | - if ( $blog_id && is_multisite() ) { |
|
734 | - $site_icon_id = get_blog_option( $blog_id, 'site_icon' ); |
|
732 | +function get_site_icon_url($size = 512, $url = '', $blog_id = 0) { |
|
733 | + if ($blog_id && is_multisite()) { |
|
734 | + $site_icon_id = get_blog_option($blog_id, 'site_icon'); |
|
735 | 735 | } else { |
736 | - $site_icon_id = get_option( 'site_icon' ); |
|
736 | + $site_icon_id = get_option('site_icon'); |
|
737 | 737 | } |
738 | 738 | |
739 | - if ( $site_icon_id ) { |
|
740 | - if ( $size >= 512 ) { |
|
739 | + if ($site_icon_id) { |
|
740 | + if ($size >= 512) { |
|
741 | 741 | $size_data = 'full'; |
742 | 742 | } else { |
743 | - $size_data = array( $size, $size ); |
|
743 | + $size_data = array($size, $size); |
|
744 | 744 | } |
745 | - $url_data = wp_get_attachment_image_src( $site_icon_id, $size_data ); |
|
746 | - if ( $url_data ) { |
|
745 | + $url_data = wp_get_attachment_image_src($site_icon_id, $size_data); |
|
746 | + if ($url_data) { |
|
747 | 747 | $url = $url_data[0]; |
748 | 748 | } |
749 | 749 | } |
@@ -758,8 +758,8 @@ discard block |
||
758 | 758 | * @param string $url Fallback url if no site icon is found. |
759 | 759 | * @param int $blog_id Id of the blog to get the site icon for. |
760 | 760 | */ |
761 | -function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) { |
|
762 | - echo esc_url( get_site_icon_url( $size, $url, $blog_id ) ); |
|
761 | +function site_icon_url($size = 512, $url = '', $blog_id = 0) { |
|
762 | + echo esc_url(get_site_icon_url($size, $url, $blog_id)); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | /** |
@@ -768,8 +768,8 @@ discard block |
||
768 | 768 | * @param int $blog_id Optional. Blog ID. Default: Current blog. |
769 | 769 | * @return bool |
770 | 770 | */ |
771 | -function has_site_icon( $blog_id = 0 ) { |
|
772 | - return (bool) get_site_icon_url( 512, '', $blog_id ); |
|
771 | +function has_site_icon($blog_id = 0) { |
|
772 | + return (bool) get_site_icon_url(512, '', $blog_id); |
|
773 | 773 | } |
774 | 774 | |
775 | 775 | /** |
@@ -782,16 +782,16 @@ discard block |
||
782 | 782 | * @see wp_title() |
783 | 783 | */ |
784 | 784 | function _wp_render_title_tag() { |
785 | - if ( ! current_theme_supports( 'title-tag' ) ) { |
|
785 | + if ( ! current_theme_supports('title-tag')) { |
|
786 | 786 | return; |
787 | 787 | } |
788 | 788 | |
789 | 789 | // This can only work internally on wp_head. |
790 | - if ( ! did_action( 'wp_head' ) && ! doing_action( 'wp_head' ) ) { |
|
790 | + if ( ! did_action('wp_head') && ! doing_action('wp_head')) { |
|
791 | 791 | return; |
792 | 792 | } |
793 | 793 | |
794 | - echo '<title>' . wp_title( '|', false, 'right' ) . "</title>\n"; |
|
794 | + echo '<title>'.wp_title('|', false, 'right')."</title>\n"; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * @param string $seplocation Optional. Direction to display title, 'right'. |
821 | 821 | * @return string|void String on retrieve. |
822 | 822 | */ |
823 | -function wp_title( $sep = '»', $display = true, $seplocation = '' ) { |
|
823 | +function wp_title($sep = '»', $display = true, $seplocation = '') { |
|
824 | 824 | global $wp_locale, $page, $paged; |
825 | 825 | |
826 | 826 | $m = get_query_var('m'); |
@@ -833,75 +833,75 @@ discard block |
||
833 | 833 | $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary |
834 | 834 | |
835 | 835 | // If there is a post |
836 | - if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) { |
|
837 | - $title = single_post_title( '', false ); |
|
836 | + if (is_single() || (is_home() && ! is_front_page()) || (is_page() && ! is_front_page())) { |
|
837 | + $title = single_post_title('', false); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | // If there's a post type archive |
841 | - if ( is_post_type_archive() ) { |
|
842 | - $post_type = get_query_var( 'post_type' ); |
|
843 | - if ( is_array( $post_type ) ) |
|
844 | - $post_type = reset( $post_type ); |
|
845 | - $post_type_object = get_post_type_object( $post_type ); |
|
846 | - if ( ! $post_type_object->has_archive ) |
|
847 | - $title = post_type_archive_title( '', false ); |
|
841 | + if (is_post_type_archive()) { |
|
842 | + $post_type = get_query_var('post_type'); |
|
843 | + if (is_array($post_type)) |
|
844 | + $post_type = reset($post_type); |
|
845 | + $post_type_object = get_post_type_object($post_type); |
|
846 | + if ( ! $post_type_object->has_archive) |
|
847 | + $title = post_type_archive_title('', false); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | // If there's a category or tag |
851 | - if ( is_category() || is_tag() ) { |
|
852 | - $title = single_term_title( '', false ); |
|
851 | + if (is_category() || is_tag()) { |
|
852 | + $title = single_term_title('', false); |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | // If there's a taxonomy |
856 | - if ( is_tax() ) { |
|
856 | + if (is_tax()) { |
|
857 | 857 | $term = get_queried_object(); |
858 | - if ( $term ) { |
|
859 | - $tax = get_taxonomy( $term->taxonomy ); |
|
860 | - $title = single_term_title( $tax->labels->name . $t_sep, false ); |
|
858 | + if ($term) { |
|
859 | + $tax = get_taxonomy($term->taxonomy); |
|
860 | + $title = single_term_title($tax->labels->name.$t_sep, false); |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | |
864 | 864 | // If there's an author |
865 | - if ( is_author() && ! is_post_type_archive() ) { |
|
865 | + if (is_author() && ! is_post_type_archive()) { |
|
866 | 866 | $author = get_queried_object(); |
867 | - if ( $author ) |
|
867 | + if ($author) |
|
868 | 868 | $title = $author->display_name; |
869 | 869 | } |
870 | 870 | |
871 | 871 | // Post type archives with has_archive should override terms. |
872 | - if ( is_post_type_archive() && $post_type_object->has_archive ) |
|
873 | - $title = post_type_archive_title( '', false ); |
|
872 | + if (is_post_type_archive() && $post_type_object->has_archive) |
|
873 | + $title = post_type_archive_title('', false); |
|
874 | 874 | |
875 | 875 | // If there's a month |
876 | - if ( is_archive() && !empty($m) ) { |
|
876 | + if (is_archive() && ! empty($m)) { |
|
877 | 877 | $my_year = substr($m, 0, 4); |
878 | 878 | $my_month = $wp_locale->get_month(substr($m, 4, 2)); |
879 | 879 | $my_day = intval(substr($m, 6, 2)); |
880 | - $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
|
880 | + $title = $my_year.($my_month ? $t_sep.$my_month : '').($my_day ? $t_sep.$my_day : ''); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | // If there's a year |
884 | - if ( is_archive() && !empty($year) ) { |
|
884 | + if (is_archive() && ! empty($year)) { |
|
885 | 885 | $title = $year; |
886 | - if ( !empty($monthnum) ) |
|
887 | - $title .= $t_sep . $wp_locale->get_month($monthnum); |
|
888 | - if ( !empty($day) ) |
|
889 | - $title .= $t_sep . zeroise($day, 2); |
|
886 | + if ( ! empty($monthnum)) |
|
887 | + $title .= $t_sep.$wp_locale->get_month($monthnum); |
|
888 | + if ( ! empty($day)) |
|
889 | + $title .= $t_sep.zeroise($day, 2); |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | // If it's a search |
893 | - if ( is_search() ) { |
|
893 | + if (is_search()) { |
|
894 | 894 | /* translators: 1: separator, 2: search phrase */ |
895 | 895 | $title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search)); |
896 | 896 | } |
897 | 897 | |
898 | 898 | // If it's a 404 page |
899 | - if ( is_404() ) { |
|
899 | + if (is_404()) { |
|
900 | 900 | $title = __('Page not found'); |
901 | 901 | } |
902 | 902 | |
903 | 903 | $prefix = ''; |
904 | - if ( !empty($title) ) |
|
904 | + if ( ! empty($title)) |
|
905 | 905 | $prefix = " $sep "; |
906 | 906 | |
907 | 907 | /** |
@@ -911,26 +911,26 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @param array $title_array Parts of the page title. |
913 | 913 | */ |
914 | - $title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) ); |
|
914 | + $title_array = apply_filters('wp_title_parts', explode($t_sep, $title)); |
|
915 | 915 | |
916 | 916 | // Determines position of the separator and direction of the breadcrumb |
917 | - if ( 'right' == $seplocation ) { // sep on right, so reverse the order |
|
918 | - $title_array = array_reverse( $title_array ); |
|
919 | - $title = implode( " $sep ", $title_array ) . $prefix; |
|
917 | + if ('right' == $seplocation) { // sep on right, so reverse the order |
|
918 | + $title_array = array_reverse($title_array); |
|
919 | + $title = implode(" $sep ", $title_array).$prefix; |
|
920 | 920 | } else { |
921 | - $title = $prefix . implode( " $sep ", $title_array ); |
|
921 | + $title = $prefix.implode(" $sep ", $title_array); |
|
922 | 922 | } |
923 | 923 | |
924 | - if ( current_theme_supports( 'title-tag' ) && ! is_feed() ) { |
|
925 | - $title .= get_bloginfo( 'name', 'display' ); |
|
924 | + if (current_theme_supports('title-tag') && ! is_feed()) { |
|
925 | + $title .= get_bloginfo('name', 'display'); |
|
926 | 926 | |
927 | - $site_description = get_bloginfo( 'description', 'display' ); |
|
928 | - if ( $site_description && ( is_home() || is_front_page() ) ) { |
|
927 | + $site_description = get_bloginfo('description', 'display'); |
|
928 | + if ($site_description && (is_home() || is_front_page())) { |
|
929 | 929 | $title .= " $sep $site_description"; |
930 | 930 | } |
931 | 931 | |
932 | - if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { |
|
933 | - $title .= " $sep " . sprintf( __( 'Page %s' ), max( $paged, $page ) ); |
|
932 | + if (($paged >= 2 || $page >= 2) && ! is_404()) { |
|
933 | + $title .= " $sep ".sprintf(__('Page %s'), max($paged, $page)); |
|
934 | 934 | } |
935 | 935 | } |
936 | 936 | |
@@ -943,10 +943,10 @@ discard block |
||
943 | 943 | * @param string $sep Title separator. |
944 | 944 | * @param string $seplocation Location of the separator (left or right). |
945 | 945 | */ |
946 | - $title = apply_filters( 'wp_title', $title, $sep, $seplocation ); |
|
946 | + $title = apply_filters('wp_title', $title, $sep, $seplocation); |
|
947 | 947 | |
948 | 948 | // Send it out |
949 | - if ( $display ) |
|
949 | + if ($display) |
|
950 | 950 | echo $title; |
951 | 951 | else |
952 | 952 | return $title; |
@@ -969,10 +969,10 @@ discard block |
||
969 | 969 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
970 | 970 | * @return string|void Title when retrieving. |
971 | 971 | */ |
972 | -function single_post_title( $prefix = '', $display = true ) { |
|
972 | +function single_post_title($prefix = '', $display = true) { |
|
973 | 973 | $_post = get_queried_object(); |
974 | 974 | |
975 | - if ( !isset($_post->post_title) ) |
|
975 | + if ( ! isset($_post->post_title)) |
|
976 | 976 | return; |
977 | 977 | |
978 | 978 | /** |
@@ -983,11 +983,11 @@ discard block |
||
983 | 983 | * @param string $_post_title The single post page title. |
984 | 984 | * @param object $_post The current queried object as returned by get_queried_object(). |
985 | 985 | */ |
986 | - $title = apply_filters( 'single_post_title', $_post->post_title, $_post ); |
|
987 | - if ( $display ) |
|
988 | - echo $prefix . $title; |
|
986 | + $title = apply_filters('single_post_title', $_post->post_title, $_post); |
|
987 | + if ($display) |
|
988 | + echo $prefix.$title; |
|
989 | 989 | else |
990 | - return $prefix . $title; |
|
990 | + return $prefix.$title; |
|
991 | 991 | } |
992 | 992 | |
993 | 993 | /** |
@@ -1002,15 +1002,15 @@ discard block |
||
1002 | 1002 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
1003 | 1003 | * @return string|void Title when retrieving, null when displaying or failure. |
1004 | 1004 | */ |
1005 | -function post_type_archive_title( $prefix = '', $display = true ) { |
|
1006 | - if ( ! is_post_type_archive() ) |
|
1005 | +function post_type_archive_title($prefix = '', $display = true) { |
|
1006 | + if ( ! is_post_type_archive()) |
|
1007 | 1007 | return; |
1008 | 1008 | |
1009 | - $post_type = get_query_var( 'post_type' ); |
|
1010 | - if ( is_array( $post_type ) ) |
|
1011 | - $post_type = reset( $post_type ); |
|
1009 | + $post_type = get_query_var('post_type'); |
|
1010 | + if (is_array($post_type)) |
|
1011 | + $post_type = reset($post_type); |
|
1012 | 1012 | |
1013 | - $post_type_obj = get_post_type_object( $post_type ); |
|
1013 | + $post_type_obj = get_post_type_object($post_type); |
|
1014 | 1014 | |
1015 | 1015 | /** |
1016 | 1016 | * Filter the post type archive title. |
@@ -1020,12 +1020,12 @@ discard block |
||
1020 | 1020 | * @param string $post_type_name Post type 'name' label. |
1021 | 1021 | * @param string $post_type Post type. |
1022 | 1022 | */ |
1023 | - $title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type ); |
|
1023 | + $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name, $post_type); |
|
1024 | 1024 | |
1025 | - if ( $display ) |
|
1026 | - echo $prefix . $title; |
|
1025 | + if ($display) |
|
1026 | + echo $prefix.$title; |
|
1027 | 1027 | else |
1028 | - return $prefix . $title; |
|
1028 | + return $prefix.$title; |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | /** |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
1046 | 1046 | * @return string|void Title when retrieving. |
1047 | 1047 | */ |
1048 | -function single_cat_title( $prefix = '', $display = true ) { |
|
1049 | - return single_term_title( $prefix, $display ); |
|
1048 | +function single_cat_title($prefix = '', $display = true) { |
|
1049 | + return single_term_title($prefix, $display); |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
1067 | 1067 | * @return string|void Title when retrieving. |
1068 | 1068 | */ |
1069 | -function single_tag_title( $prefix = '', $display = true ) { |
|
1070 | - return single_term_title( $prefix, $display ); |
|
1069 | +function single_tag_title($prefix = '', $display = true) { |
|
1070 | + return single_term_title($prefix, $display); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | /** |
@@ -1087,13 +1087,13 @@ discard block |
||
1087 | 1087 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
1088 | 1088 | * @return string|void Title when retrieving. |
1089 | 1089 | */ |
1090 | -function single_term_title( $prefix = '', $display = true ) { |
|
1090 | +function single_term_title($prefix = '', $display = true) { |
|
1091 | 1091 | $term = get_queried_object(); |
1092 | 1092 | |
1093 | - if ( !$term ) |
|
1093 | + if ( ! $term) |
|
1094 | 1094 | return; |
1095 | 1095 | |
1096 | - if ( is_category() ) { |
|
1096 | + if (is_category()) { |
|
1097 | 1097 | /** |
1098 | 1098 | * Filter the category archive page title. |
1099 | 1099 | * |
@@ -1101,8 +1101,8 @@ discard block |
||
1101 | 1101 | * |
1102 | 1102 | * @param string $term_name Category name for archive being displayed. |
1103 | 1103 | */ |
1104 | - $term_name = apply_filters( 'single_cat_title', $term->name ); |
|
1105 | - } elseif ( is_tag() ) { |
|
1104 | + $term_name = apply_filters('single_cat_title', $term->name); |
|
1105 | + } elseif (is_tag()) { |
|
1106 | 1106 | /** |
1107 | 1107 | * Filter the tag archive page title. |
1108 | 1108 | * |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | * |
1111 | 1111 | * @param string $term_name Tag name for archive being displayed. |
1112 | 1112 | */ |
1113 | - $term_name = apply_filters( 'single_tag_title', $term->name ); |
|
1114 | - } elseif ( is_tax() ) { |
|
1113 | + $term_name = apply_filters('single_tag_title', $term->name); |
|
1114 | + } elseif (is_tax()) { |
|
1115 | 1115 | /** |
1116 | 1116 | * Filter the custom taxonomy archive page title. |
1117 | 1117 | * |
@@ -1119,18 +1119,18 @@ discard block |
||
1119 | 1119 | * |
1120 | 1120 | * @param string $term_name Term name for archive being displayed. |
1121 | 1121 | */ |
1122 | - $term_name = apply_filters( 'single_term_title', $term->name ); |
|
1122 | + $term_name = apply_filters('single_term_title', $term->name); |
|
1123 | 1123 | } else { |
1124 | 1124 | return; |
1125 | 1125 | } |
1126 | 1126 | |
1127 | - if ( empty( $term_name ) ) |
|
1127 | + if (empty($term_name)) |
|
1128 | 1128 | return; |
1129 | 1129 | |
1130 | - if ( $display ) |
|
1131 | - echo $prefix . $term_name; |
|
1130 | + if ($display) |
|
1131 | + echo $prefix.$term_name; |
|
1132 | 1132 | else |
1133 | - return $prefix . $term_name; |
|
1133 | + return $prefix.$term_name; |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | /** |
@@ -1153,27 +1153,27 @@ discard block |
||
1153 | 1153 | * @param bool $display Optional, default is true. Whether to display or retrieve title. |
1154 | 1154 | * @return string|void Title when retrieving. |
1155 | 1155 | */ |
1156 | -function single_month_title($prefix = '', $display = true ) { |
|
1156 | +function single_month_title($prefix = '', $display = true) { |
|
1157 | 1157 | global $wp_locale; |
1158 | 1158 | |
1159 | 1159 | $m = get_query_var('m'); |
1160 | 1160 | $year = get_query_var('year'); |
1161 | 1161 | $monthnum = get_query_var('monthnum'); |
1162 | 1162 | |
1163 | - if ( !empty($monthnum) && !empty($year) ) { |
|
1163 | + if ( ! empty($monthnum) && ! empty($year)) { |
|
1164 | 1164 | $my_year = $year; |
1165 | 1165 | $my_month = $wp_locale->get_month($monthnum); |
1166 | - } elseif ( !empty($m) ) { |
|
1166 | + } elseif ( ! empty($m)) { |
|
1167 | 1167 | $my_year = substr($m, 0, 4); |
1168 | 1168 | $my_month = $wp_locale->get_month(substr($m, 4, 2)); |
1169 | 1169 | } |
1170 | 1170 | |
1171 | - if ( empty($my_month) ) |
|
1171 | + if (empty($my_month)) |
|
1172 | 1172 | return false; |
1173 | 1173 | |
1174 | - $result = $prefix . $my_month . $prefix . $my_year; |
|
1174 | + $result = $prefix.$my_month.$prefix.$my_year; |
|
1175 | 1175 | |
1176 | - if ( !$display ) |
|
1176 | + if ( ! $display) |
|
1177 | 1177 | return $result; |
1178 | 1178 | echo $result; |
1179 | 1179 | } |
@@ -1188,11 +1188,11 @@ discard block |
||
1188 | 1188 | * @param string $before Optional. Content to prepend to the title. Default empty. |
1189 | 1189 | * @param string $after Optional. Content to append to the title. Default empty. |
1190 | 1190 | */ |
1191 | -function the_archive_title( $before = '', $after = '' ) { |
|
1191 | +function the_archive_title($before = '', $after = '') { |
|
1192 | 1192 | $title = get_the_archive_title(); |
1193 | 1193 | |
1194 | - if ( ! empty( $title ) ) { |
|
1195 | - echo $before . $title . $after; |
|
1194 | + if ( ! empty($title)) { |
|
1195 | + echo $before.$title.$after; |
|
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
@@ -1204,46 +1204,46 @@ discard block |
||
1204 | 1204 | * @return string Archive title. |
1205 | 1205 | */ |
1206 | 1206 | function get_the_archive_title() { |
1207 | - if ( is_category() ) { |
|
1208 | - $title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) ); |
|
1209 | - } elseif ( is_tag() ) { |
|
1210 | - $title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) ); |
|
1211 | - } elseif ( is_author() ) { |
|
1212 | - $title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' ); |
|
1213 | - } elseif ( is_year() ) { |
|
1214 | - $title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) ); |
|
1215 | - } elseif ( is_month() ) { |
|
1216 | - $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); |
|
1217 | - } elseif ( is_day() ) { |
|
1218 | - $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); |
|
1219 | - } elseif ( is_tax( 'post_format' ) ) { |
|
1220 | - if ( is_tax( 'post_format', 'post-format-aside' ) ) { |
|
1221 | - $title = _x( 'Asides', 'post format archive title' ); |
|
1222 | - } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { |
|
1223 | - $title = _x( 'Galleries', 'post format archive title' ); |
|
1224 | - } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { |
|
1225 | - $title = _x( 'Images', 'post format archive title' ); |
|
1226 | - } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { |
|
1227 | - $title = _x( 'Videos', 'post format archive title' ); |
|
1228 | - } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { |
|
1229 | - $title = _x( 'Quotes', 'post format archive title' ); |
|
1230 | - } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { |
|
1231 | - $title = _x( 'Links', 'post format archive title' ); |
|
1232 | - } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { |
|
1233 | - $title = _x( 'Statuses', 'post format archive title' ); |
|
1234 | - } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { |
|
1235 | - $title = _x( 'Audio', 'post format archive title' ); |
|
1236 | - } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { |
|
1237 | - $title = _x( 'Chats', 'post format archive title' ); |
|
1207 | + if (is_category()) { |
|
1208 | + $title = sprintf(__('Category: %s'), single_cat_title('', false)); |
|
1209 | + } elseif (is_tag()) { |
|
1210 | + $title = sprintf(__('Tag: %s'), single_tag_title('', false)); |
|
1211 | + } elseif (is_author()) { |
|
1212 | + $title = sprintf(__('Author: %s'), '<span class="vcard">'.get_the_author().'</span>'); |
|
1213 | + } elseif (is_year()) { |
|
1214 | + $title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format'))); |
|
1215 | + } elseif (is_month()) { |
|
1216 | + $title = sprintf(__('Month: %s'), get_the_date(_x('F Y', 'monthly archives date format'))); |
|
1217 | + } elseif (is_day()) { |
|
1218 | + $title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format'))); |
|
1219 | + } elseif (is_tax('post_format')) { |
|
1220 | + if (is_tax('post_format', 'post-format-aside')) { |
|
1221 | + $title = _x('Asides', 'post format archive title'); |
|
1222 | + } elseif (is_tax('post_format', 'post-format-gallery')) { |
|
1223 | + $title = _x('Galleries', 'post format archive title'); |
|
1224 | + } elseif (is_tax('post_format', 'post-format-image')) { |
|
1225 | + $title = _x('Images', 'post format archive title'); |
|
1226 | + } elseif (is_tax('post_format', 'post-format-video')) { |
|
1227 | + $title = _x('Videos', 'post format archive title'); |
|
1228 | + } elseif (is_tax('post_format', 'post-format-quote')) { |
|
1229 | + $title = _x('Quotes', 'post format archive title'); |
|
1230 | + } elseif (is_tax('post_format', 'post-format-link')) { |
|
1231 | + $title = _x('Links', 'post format archive title'); |
|
1232 | + } elseif (is_tax('post_format', 'post-format-status')) { |
|
1233 | + $title = _x('Statuses', 'post format archive title'); |
|
1234 | + } elseif (is_tax('post_format', 'post-format-audio')) { |
|
1235 | + $title = _x('Audio', 'post format archive title'); |
|
1236 | + } elseif (is_tax('post_format', 'post-format-chat')) { |
|
1237 | + $title = _x('Chats', 'post format archive title'); |
|
1238 | 1238 | } |
1239 | - } elseif ( is_post_type_archive() ) { |
|
1240 | - $title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) ); |
|
1241 | - } elseif ( is_tax() ) { |
|
1242 | - $tax = get_taxonomy( get_queried_object()->taxonomy ); |
|
1239 | + } elseif (is_post_type_archive()) { |
|
1240 | + $title = sprintf(__('Archives: %s'), post_type_archive_title('', false)); |
|
1241 | + } elseif (is_tax()) { |
|
1242 | + $tax = get_taxonomy(get_queried_object()->taxonomy); |
|
1243 | 1243 | /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */ |
1244 | - $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) ); |
|
1244 | + $title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false)); |
|
1245 | 1245 | } else { |
1246 | - $title = __( 'Archives' ); |
|
1246 | + $title = __('Archives'); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | /** |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | * |
1254 | 1254 | * @param string $title Archive title to be displayed. |
1255 | 1255 | */ |
1256 | - return apply_filters( 'get_the_archive_title', $title ); |
|
1256 | + return apply_filters('get_the_archive_title', $title); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | /** |
@@ -1266,10 +1266,10 @@ discard block |
||
1266 | 1266 | * @param string $before Optional. Content to prepend to the description. Default empty. |
1267 | 1267 | * @param string $after Optional. Content to append to the description. Default empty. |
1268 | 1268 | */ |
1269 | -function the_archive_description( $before = '', $after = '' ) { |
|
1269 | +function the_archive_description($before = '', $after = '') { |
|
1270 | 1270 | $description = get_the_archive_description(); |
1271 | - if ( $description ) { |
|
1272 | - echo $before . $description . $after; |
|
1271 | + if ($description) { |
|
1272 | + echo $before.$description.$after; |
|
1273 | 1273 | } |
1274 | 1274 | } |
1275 | 1275 | |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | * |
1291 | 1291 | * @param string $description Archive description to be displayed. |
1292 | 1292 | */ |
1293 | - return apply_filters( 'get_the_archive_description', term_description() ); |
|
1293 | + return apply_filters('get_the_archive_description', term_description()); |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | /** |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | $url = esc_url($url); |
1334 | 1334 | |
1335 | 1335 | if ('link' == $format) |
1336 | - $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
|
1336 | + $link_html = "\t<link rel='archives' title='".esc_attr($text)."' href='$url' />\n"; |
|
1337 | 1337 | elseif ('option' == $format) |
1338 | 1338 | $link_html = "\t<option value='$url'>$before $text $after</option>\n"; |
1339 | 1339 | elseif ('html' == $format) |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | * |
1349 | 1349 | * @param string $link_html The archive HTML link content. |
1350 | 1350 | */ |
1351 | - return apply_filters( 'get_archives_link', $link_html ); |
|
1351 | + return apply_filters('get_archives_link', $link_html); |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | /** |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | * } |
1385 | 1385 | * @return string|void String when retrieving. |
1386 | 1386 | */ |
1387 | -function wp_get_archives( $args = '' ) { |
|
1387 | +function wp_get_archives($args = '') { |
|
1388 | 1388 | global $wpdb, $wp_locale; |
1389 | 1389 | |
1390 | 1390 | $defaults = array( |
@@ -1394,19 +1394,19 @@ discard block |
||
1394 | 1394 | 'echo' => 1, 'order' => 'DESC', |
1395 | 1395 | ); |
1396 | 1396 | |
1397 | - $r = wp_parse_args( $args, $defaults ); |
|
1397 | + $r = wp_parse_args($args, $defaults); |
|
1398 | 1398 | |
1399 | - if ( '' == $r['type'] ) { |
|
1399 | + if ('' == $r['type']) { |
|
1400 | 1400 | $r['type'] = 'monthly'; |
1401 | 1401 | } |
1402 | 1402 | |
1403 | - if ( ! empty( $r['limit'] ) ) { |
|
1404 | - $r['limit'] = absint( $r['limit'] ); |
|
1405 | - $r['limit'] = ' LIMIT ' . $r['limit']; |
|
1403 | + if ( ! empty($r['limit'])) { |
|
1404 | + $r['limit'] = absint($r['limit']); |
|
1405 | + $r['limit'] = ' LIMIT '.$r['limit']; |
|
1406 | 1406 | } |
1407 | 1407 | |
1408 | - $order = strtoupper( $r['order'] ); |
|
1409 | - if ( $order !== 'ASC' ) { |
|
1408 | + $order = strtoupper($r['order']); |
|
1409 | + if ($order !== 'ASC') { |
|
1410 | 1410 | $order = 'DESC'; |
1411 | 1411 | } |
1412 | 1412 | |
@@ -1421,12 +1421,12 @@ discard block |
||
1421 | 1421 | |
1422 | 1422 | // options for weekly archive (only if you over-ride the general date format) |
1423 | 1423 | $archive_week_start_date_format = 'Y/m/d'; |
1424 | - $archive_week_end_date_format = 'Y/m/d'; |
|
1424 | + $archive_week_end_date_format = 'Y/m/d'; |
|
1425 | 1425 | |
1426 | - if ( ! $archive_date_format_over_ride ) { |
|
1427 | - $archive_day_date_format = get_option( 'date_format' ); |
|
1428 | - $archive_week_start_date_format = get_option( 'date_format' ); |
|
1429 | - $archive_week_end_date_format = get_option( 'date_format' ); |
|
1426 | + if ( ! $archive_date_format_over_ride) { |
|
1427 | + $archive_day_date_format = get_option('date_format'); |
|
1428 | + $archive_week_start_date_format = get_option('date_format'); |
|
1429 | + $archive_week_end_date_format = get_option('date_format'); |
|
1430 | 1430 | } |
1431 | 1431 | |
1432 | 1432 | /** |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | * @param string $sql_where Portion of SQL query containing the WHERE clause. |
1438 | 1438 | * @param array $r An array of default arguments. |
1439 | 1439 | */ |
1440 | - $where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r ); |
|
1440 | + $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r); |
|
1441 | 1441 | |
1442 | 1442 | /** |
1443 | 1443 | * Filter the SQL JOIN clause for retrieving archives. |
@@ -1447,130 +1447,130 @@ discard block |
||
1447 | 1447 | * @param string $sql_join Portion of SQL query containing JOIN clause. |
1448 | 1448 | * @param array $r An array of default arguments. |
1449 | 1449 | */ |
1450 | - $join = apply_filters( 'getarchives_join', '', $r ); |
|
1450 | + $join = apply_filters('getarchives_join', '', $r); |
|
1451 | 1451 | |
1452 | 1452 | $output = ''; |
1453 | 1453 | |
1454 | - $last_changed = wp_cache_get( 'last_changed', 'posts' ); |
|
1455 | - if ( ! $last_changed ) { |
|
1454 | + $last_changed = wp_cache_get('last_changed', 'posts'); |
|
1455 | + if ( ! $last_changed) { |
|
1456 | 1456 | $last_changed = microtime(); |
1457 | - wp_cache_set( 'last_changed', $last_changed, 'posts' ); |
|
1457 | + wp_cache_set('last_changed', $last_changed, 'posts'); |
|
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | $limit = $r['limit']; |
1461 | 1461 | |
1462 | - if ( 'monthly' == $r['type'] ) { |
|
1462 | + if ('monthly' == $r['type']) { |
|
1463 | 1463 | $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit"; |
1464 | - $key = md5( $query ); |
|
1464 | + $key = md5($query); |
|
1465 | 1465 | $key = "wp_get_archives:$key:$last_changed"; |
1466 | - if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
|
1467 | - $results = $wpdb->get_results( $query ); |
|
1468 | - wp_cache_set( $key, $results, 'posts' ); |
|
1466 | + if ( ! $results = wp_cache_get($key, 'posts')) { |
|
1467 | + $results = $wpdb->get_results($query); |
|
1468 | + wp_cache_set($key, $results, 'posts'); |
|
1469 | 1469 | } |
1470 | - if ( $results ) { |
|
1470 | + if ($results) { |
|
1471 | 1471 | $after = $r['after']; |
1472 | - foreach ( (array) $results as $result ) { |
|
1473 | - $url = get_month_link( $result->year, $result->month ); |
|
1472 | + foreach ((array) $results as $result) { |
|
1473 | + $url = get_month_link($result->year, $result->month); |
|
1474 | 1474 | /* translators: 1: month name, 2: 4-digit year */ |
1475 | - $text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year ); |
|
1476 | - if ( $r['show_post_count'] ) { |
|
1477 | - $r['after'] = ' (' . $result->posts . ')' . $after; |
|
1475 | + $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($result->month), $result->year); |
|
1476 | + if ($r['show_post_count']) { |
|
1477 | + $r['after'] = ' ('.$result->posts.')'.$after; |
|
1478 | 1478 | } |
1479 | - $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
|
1479 | + $output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']); |
|
1480 | 1480 | } |
1481 | 1481 | } |
1482 | - } elseif ( 'yearly' == $r['type'] ) { |
|
1482 | + } elseif ('yearly' == $r['type']) { |
|
1483 | 1483 | $query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit"; |
1484 | - $key = md5( $query ); |
|
1484 | + $key = md5($query); |
|
1485 | 1485 | $key = "wp_get_archives:$key:$last_changed"; |
1486 | - if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
|
1487 | - $results = $wpdb->get_results( $query ); |
|
1488 | - wp_cache_set( $key, $results, 'posts' ); |
|
1486 | + if ( ! $results = wp_cache_get($key, 'posts')) { |
|
1487 | + $results = $wpdb->get_results($query); |
|
1488 | + wp_cache_set($key, $results, 'posts'); |
|
1489 | 1489 | } |
1490 | - if ( $results ) { |
|
1490 | + if ($results) { |
|
1491 | 1491 | $after = $r['after']; |
1492 | - foreach ( (array) $results as $result) { |
|
1493 | - $url = get_year_link( $result->year ); |
|
1494 | - $text = sprintf( '%d', $result->year ); |
|
1495 | - if ( $r['show_post_count'] ) { |
|
1496 | - $r['after'] = ' (' . $result->posts . ')' . $after; |
|
1492 | + foreach ((array) $results as $result) { |
|
1493 | + $url = get_year_link($result->year); |
|
1494 | + $text = sprintf('%d', $result->year); |
|
1495 | + if ($r['show_post_count']) { |
|
1496 | + $r['after'] = ' ('.$result->posts.')'.$after; |
|
1497 | 1497 | } |
1498 | - $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
|
1498 | + $output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']); |
|
1499 | 1499 | } |
1500 | 1500 | } |
1501 | - } elseif ( 'daily' == $r['type'] ) { |
|
1501 | + } elseif ('daily' == $r['type']) { |
|
1502 | 1502 | $query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit"; |
1503 | - $key = md5( $query ); |
|
1503 | + $key = md5($query); |
|
1504 | 1504 | $key = "wp_get_archives:$key:$last_changed"; |
1505 | - if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
|
1506 | - $results = $wpdb->get_results( $query ); |
|
1507 | - wp_cache_set( $key, $results, 'posts' ); |
|
1505 | + if ( ! $results = wp_cache_get($key, 'posts')) { |
|
1506 | + $results = $wpdb->get_results($query); |
|
1507 | + wp_cache_set($key, $results, 'posts'); |
|
1508 | 1508 | } |
1509 | - if ( $results ) { |
|
1509 | + if ($results) { |
|
1510 | 1510 | $after = $r['after']; |
1511 | - foreach ( (array) $results as $result ) { |
|
1512 | - $url = get_day_link( $result->year, $result->month, $result->dayofmonth ); |
|
1513 | - $date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth ); |
|
1514 | - $text = mysql2date( $archive_day_date_format, $date ); |
|
1515 | - if ( $r['show_post_count'] ) { |
|
1516 | - $r['after'] = ' (' . $result->posts . ')' . $after; |
|
1511 | + foreach ((array) $results as $result) { |
|
1512 | + $url = get_day_link($result->year, $result->month, $result->dayofmonth); |
|
1513 | + $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth); |
|
1514 | + $text = mysql2date($archive_day_date_format, $date); |
|
1515 | + if ($r['show_post_count']) { |
|
1516 | + $r['after'] = ' ('.$result->posts.')'.$after; |
|
1517 | 1517 | } |
1518 | - $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
|
1518 | + $output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']); |
|
1519 | 1519 | } |
1520 | 1520 | } |
1521 | - } elseif ( 'weekly' == $r['type'] ) { |
|
1522 | - $week = _wp_mysql_week( '`post_date`' ); |
|
1521 | + } elseif ('weekly' == $r['type']) { |
|
1522 | + $week = _wp_mysql_week('`post_date`'); |
|
1523 | 1523 | $query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit"; |
1524 | - $key = md5( $query ); |
|
1524 | + $key = md5($query); |
|
1525 | 1525 | $key = "wp_get_archives:$key:$last_changed"; |
1526 | - if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
|
1527 | - $results = $wpdb->get_results( $query ); |
|
1528 | - wp_cache_set( $key, $results, 'posts' ); |
|
1526 | + if ( ! $results = wp_cache_get($key, 'posts')) { |
|
1527 | + $results = $wpdb->get_results($query); |
|
1528 | + wp_cache_set($key, $results, 'posts'); |
|
1529 | 1529 | } |
1530 | 1530 | $arc_w_last = ''; |
1531 | - if ( $results ) { |
|
1531 | + if ($results) { |
|
1532 | 1532 | $after = $r['after']; |
1533 | - foreach ( (array) $results as $result ) { |
|
1534 | - if ( $result->week != $arc_w_last ) { |
|
1533 | + foreach ((array) $results as $result) { |
|
1534 | + if ($result->week != $arc_w_last) { |
|
1535 | 1535 | $arc_year = $result->yr; |
1536 | 1536 | $arc_w_last = $result->week; |
1537 | - $arc_week = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) ); |
|
1538 | - $arc_week_start = date_i18n( $archive_week_start_date_format, $arc_week['start'] ); |
|
1539 | - $arc_week_end = date_i18n( $archive_week_end_date_format, $arc_week['end'] ); |
|
1540 | - $url = sprintf( '%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $result->week ); |
|
1541 | - $text = $arc_week_start . $archive_week_separator . $arc_week_end; |
|
1542 | - if ( $r['show_post_count'] ) { |
|
1543 | - $r['after'] = ' (' . $result->posts . ')' . $after; |
|
1537 | + $arc_week = get_weekstartend($result->yyyymmdd, get_option('start_of_week')); |
|
1538 | + $arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']); |
|
1539 | + $arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']); |
|
1540 | + $url = sprintf('%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d', home_url(), '', '?', '=', $arc_year, '&', '=', $result->week); |
|
1541 | + $text = $arc_week_start.$archive_week_separator.$arc_week_end; |
|
1542 | + if ($r['show_post_count']) { |
|
1543 | + $r['after'] = ' ('.$result->posts.')'.$after; |
|
1544 | 1544 | } |
1545 | - $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
|
1545 | + $output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']); |
|
1546 | 1546 | } |
1547 | 1547 | } |
1548 | 1548 | } |
1549 | - } elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) { |
|
1550 | - $orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; |
|
1549 | + } elseif (('postbypost' == $r['type']) || ('alpha' == $r['type'])) { |
|
1550 | + $orderby = ('alpha' == $r['type']) ? 'post_title ASC ' : 'post_date DESC, ID DESC '; |
|
1551 | 1551 | $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit"; |
1552 | - $key = md5( $query ); |
|
1552 | + $key = md5($query); |
|
1553 | 1553 | $key = "wp_get_archives:$key:$last_changed"; |
1554 | - if ( ! $results = wp_cache_get( $key, 'posts' ) ) { |
|
1555 | - $results = $wpdb->get_results( $query ); |
|
1556 | - wp_cache_set( $key, $results, 'posts' ); |
|
1554 | + if ( ! $results = wp_cache_get($key, 'posts')) { |
|
1555 | + $results = $wpdb->get_results($query); |
|
1556 | + wp_cache_set($key, $results, 'posts'); |
|
1557 | 1557 | } |
1558 | - if ( $results ) { |
|
1559 | - foreach ( (array) $results as $result ) { |
|
1560 | - if ( $result->post_date != '0000-00-00 00:00:00' ) { |
|
1561 | - $url = get_permalink( $result ); |
|
1562 | - if ( $result->post_title ) { |
|
1558 | + if ($results) { |
|
1559 | + foreach ((array) $results as $result) { |
|
1560 | + if ($result->post_date != '0000-00-00 00:00:00') { |
|
1561 | + $url = get_permalink($result); |
|
1562 | + if ($result->post_title) { |
|
1563 | 1563 | /** This filter is documented in wp-includes/post-template.php */ |
1564 | - $text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) ); |
|
1564 | + $text = strip_tags(apply_filters('the_title', $result->post_title, $result->ID)); |
|
1565 | 1565 | } else { |
1566 | 1566 | $text = $result->ID; |
1567 | 1567 | } |
1568 | - $output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] ); |
|
1568 | + $output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']); |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | } |
1572 | 1572 | } |
1573 | - if ( $r['echo'] ) { |
|
1573 | + if ($r['echo']) { |
|
1574 | 1574 | echo $output; |
1575 | 1575 | } else { |
1576 | 1576 | return $output; |
@@ -1587,7 +1587,7 @@ discard block |
||
1587 | 1587 | */ |
1588 | 1588 | function calendar_week_mod($num) { |
1589 | 1589 | $base = 7; |
1590 | - return ($num - $base*floor($num/$base)); |
|
1590 | + return ($num - $base * floor($num / $base)); |
|
1591 | 1591 | } |
1592 | 1592 | |
1593 | 1593 | /** |
@@ -1612,51 +1612,51 @@ discard block |
||
1612 | 1612 | function get_calendar($initial = true, $echo = true) { |
1613 | 1613 | global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; |
1614 | 1614 | |
1615 | - $key = md5( $m . $monthnum . $year ); |
|
1616 | - if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) { |
|
1617 | - if ( is_array($cache) && isset( $cache[ $key ] ) ) { |
|
1618 | - if ( $echo ) { |
|
1615 | + $key = md5($m.$monthnum.$year); |
|
1616 | + if ($cache = wp_cache_get('get_calendar', 'calendar')) { |
|
1617 | + if (is_array($cache) && isset($cache[$key])) { |
|
1618 | + if ($echo) { |
|
1619 | 1619 | /** This filter is documented in wp-includes/general-template.php */ |
1620 | - echo apply_filters( 'get_calendar', $cache[$key] ); |
|
1620 | + echo apply_filters('get_calendar', $cache[$key]); |
|
1621 | 1621 | return; |
1622 | 1622 | } else { |
1623 | 1623 | /** This filter is documented in wp-includes/general-template.php */ |
1624 | - return apply_filters( 'get_calendar', $cache[$key] ); |
|
1624 | + return apply_filters('get_calendar', $cache[$key]); |
|
1625 | 1625 | } |
1626 | 1626 | } |
1627 | 1627 | } |
1628 | 1628 | |
1629 | - if ( !is_array($cache) ) |
|
1629 | + if ( ! is_array($cache)) |
|
1630 | 1630 | $cache = array(); |
1631 | 1631 | |
1632 | 1632 | // Quick check. If we have no posts at all, abort! |
1633 | - if ( !$posts ) { |
|
1633 | + if ( ! $posts) { |
|
1634 | 1634 | $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1"); |
1635 | - if ( !$gotsome ) { |
|
1636 | - $cache[ $key ] = ''; |
|
1637 | - wp_cache_set( 'get_calendar', $cache, 'calendar' ); |
|
1635 | + if ( ! $gotsome) { |
|
1636 | + $cache[$key] = ''; |
|
1637 | + wp_cache_set('get_calendar', $cache, 'calendar'); |
|
1638 | 1638 | return; |
1639 | 1639 | } |
1640 | 1640 | } |
1641 | 1641 | |
1642 | - if ( isset($_GET['w']) ) |
|
1642 | + if (isset($_GET['w'])) |
|
1643 | 1643 | $w = ''.intval($_GET['w']); |
1644 | 1644 | |
1645 | 1645 | // week_begins = 0 stands for Sunday |
1646 | 1646 | $week_begins = intval(get_option('start_of_week')); |
1647 | 1647 | |
1648 | 1648 | // Let's figure out when we are |
1649 | - if ( !empty($monthnum) && !empty($year) ) { |
|
1649 | + if ( ! empty($monthnum) && ! empty($year)) { |
|
1650 | 1650 | $thismonth = ''.zeroise(intval($monthnum), 2); |
1651 | 1651 | $thisyear = ''.intval($year); |
1652 | - } elseif ( !empty($w) ) { |
|
1652 | + } elseif ( ! empty($w)) { |
|
1653 | 1653 | // We need to get the month from MySQL |
1654 | 1654 | $thisyear = ''.intval(substr($m, 0, 4)); |
1655 | 1655 | $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's |
1656 | 1656 | $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')"); |
1657 | - } elseif ( !empty($m) ) { |
|
1657 | + } elseif ( ! empty($m)) { |
|
1658 | 1658 | $thisyear = ''.intval(substr($m, 0, 4)); |
1659 | - if ( strlen($m) < 6 ) |
|
1659 | + if (strlen($m) < 6) |
|
1660 | 1660 | $thismonth = '01'; |
1661 | 1661 | else |
1662 | 1662 | $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | $thismonth = gmdate('m', current_time('timestamp')); |
1666 | 1666 | } |
1667 | 1667 | |
1668 | - $unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear); |
|
1668 | + $unixmonth = mktime(0, 0, 0, $thismonth, 1, $thisyear); |
|
1669 | 1669 | $last_day = date('t', $unixmonth); |
1670 | 1670 | |
1671 | 1671 | // Get the next and previous month and year with at least one post |
@@ -1685,17 +1685,17 @@ discard block |
||
1685 | 1685 | /* translators: Calendar caption: 1: month name, 2: 4-digit year */ |
1686 | 1686 | $calendar_caption = _x('%1$s %2$s', 'calendar caption'); |
1687 | 1687 | $calendar_output = '<table id="wp-calendar"> |
1688 | - <caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption> |
|
1688 | + <caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)).'</caption> |
|
1689 | 1689 | <thead> |
1690 | 1690 | <tr>'; |
1691 | 1691 | |
1692 | 1692 | $myweek = array(); |
1693 | 1693 | |
1694 | - for ( $wdcount=0; $wdcount<=6; $wdcount++ ) { |
|
1695 | - $myweek[] = $wp_locale->get_weekday(($wdcount+$week_begins)%7); |
|
1694 | + for ($wdcount = 0; $wdcount <= 6; $wdcount++) { |
|
1695 | + $myweek[] = $wp_locale->get_weekday(($wdcount + $week_begins) % 7); |
|
1696 | 1696 | } |
1697 | 1697 | |
1698 | - foreach ( $myweek as $wd ) { |
|
1698 | + foreach ($myweek as $wd) { |
|
1699 | 1699 | $day_name = $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd); |
1700 | 1700 | $wd = esc_attr($wd); |
1701 | 1701 | $calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>"; |
@@ -1708,16 +1708,16 @@ discard block |
||
1708 | 1708 | <tfoot> |
1709 | 1709 | <tr>'; |
1710 | 1710 | |
1711 | - if ( $previous ) { |
|
1712 | - $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '">« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>'; |
|
1711 | + if ($previous) { |
|
1712 | + $calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="'.get_month_link($previous->year, $previous->month).'">« '.$wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)).'</a></td>'; |
|
1713 | 1713 | } else { |
1714 | 1714 | $calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>'; |
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | $calendar_output .= "\n\t\t".'<td class="pad"> </td>'; |
1718 | 1718 | |
1719 | - if ( $next ) { |
|
1720 | - $calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link($next->year, $next->month) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' »</a></td>'; |
|
1719 | + if ($next) { |
|
1720 | + $calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="'.get_month_link($next->year, $next->month).'">'.$wp_locale->get_month_abbrev($wp_locale->get_month($next->month)).' »</a></td>'; |
|
1721 | 1721 | } else { |
1722 | 1722 | $calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>'; |
1723 | 1723 | } |
@@ -1736,8 +1736,8 @@ discard block |
||
1736 | 1736 | FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' |
1737 | 1737 | AND post_type = 'post' AND post_status = 'publish' |
1738 | 1738 | AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N); |
1739 | - if ( $dayswithposts ) { |
|
1740 | - foreach ( (array) $dayswithposts as $daywith ) { |
|
1739 | + if ($dayswithposts) { |
|
1740 | + foreach ((array) $dayswithposts as $daywith) { |
|
1741 | 1741 | $daywithpost[] = $daywith[0]; |
1742 | 1742 | } |
1743 | 1743 | } |
@@ -1754,57 +1754,57 @@ discard block |
||
1754 | 1754 | ."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' " |
1755 | 1755 | ."AND post_type = 'post' AND post_status = 'publish'" |
1756 | 1756 | ); |
1757 | - if ( $ak_post_titles ) { |
|
1758 | - foreach ( (array) $ak_post_titles as $ak_post_title ) { |
|
1757 | + if ($ak_post_titles) { |
|
1758 | + foreach ((array) $ak_post_titles as $ak_post_title) { |
|
1759 | 1759 | |
1760 | 1760 | /** This filter is documented in wp-includes/post-template.php */ |
1761 | - $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) ); |
|
1761 | + $post_title = esc_attr(apply_filters('the_title', $ak_post_title->post_title, $ak_post_title->ID)); |
|
1762 | 1762 | |
1763 | - if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) ) |
|
1763 | + if (empty($ak_titles_for_day['day_'.$ak_post_title->dom])) |
|
1764 | 1764 | $ak_titles_for_day['day_'.$ak_post_title->dom] = ''; |
1765 | - if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one |
|
1765 | + if (empty($ak_titles_for_day["$ak_post_title->dom"])) // first one |
|
1766 | 1766 | $ak_titles_for_day["$ak_post_title->dom"] = $post_title; |
1767 | 1767 | else |
1768 | - $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title; |
|
1768 | + $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator.$post_title; |
|
1769 | 1769 | } |
1770 | 1770 | } |
1771 | 1771 | |
1772 | 1772 | // See how much we should pad in the beginning |
1773 | - $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins); |
|
1774 | - if ( 0 != $pad ) |
|
1775 | - $calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad"> </td>'; |
|
1773 | + $pad = calendar_week_mod(date('w', $unixmonth) - $week_begins); |
|
1774 | + if (0 != $pad) |
|
1775 | + $calendar_output .= "\n\t\t".'<td colspan="'.esc_attr($pad).'" class="pad"> </td>'; |
|
1776 | 1776 | |
1777 | 1777 | $daysinmonth = intval(date('t', $unixmonth)); |
1778 | - for ( $day = 1; $day <= $daysinmonth; ++$day ) { |
|
1779 | - if ( isset($newrow) && $newrow ) |
|
1778 | + for ($day = 1; $day <= $daysinmonth; ++$day) { |
|
1779 | + if (isset($newrow) && $newrow) |
|
1780 | 1780 | $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; |
1781 | 1781 | $newrow = false; |
1782 | 1782 | |
1783 | - if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) |
|
1783 | + if ($day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp'))) |
|
1784 | 1784 | $calendar_output .= '<td id="today">'; |
1785 | 1785 | else |
1786 | 1786 | $calendar_output .= '<td>'; |
1787 | 1787 | |
1788 | - if ( in_array($day, $daywithpost) ) // any posts today? |
|
1789 | - $calendar_output .= '<a href="' . get_day_link( $thisyear, $thismonth, $day ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>"; |
|
1788 | + if (in_array($day, $daywithpost)) // any posts today? |
|
1789 | + $calendar_output .= '<a href="'.get_day_link($thisyear, $thismonth, $day).'" title="'.esc_attr($ak_titles_for_day[$day])."\">$day</a>"; |
|
1790 | 1790 | else |
1791 | 1791 | $calendar_output .= $day; |
1792 | 1792 | $calendar_output .= '</td>'; |
1793 | 1793 | |
1794 | - if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) ) |
|
1794 | + if (6 == calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins)) |
|
1795 | 1795 | $newrow = true; |
1796 | 1796 | } |
1797 | 1797 | |
1798 | - $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins); |
|
1799 | - if ( $pad != 0 && $pad != 7 ) |
|
1800 | - $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'"> </td>'; |
|
1798 | + $pad = 7 - calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins); |
|
1799 | + if ($pad != 0 && $pad != 7) |
|
1800 | + $calendar_output .= "\n\t\t".'<td class="pad" colspan="'.esc_attr($pad).'"> </td>'; |
|
1801 | 1801 | |
1802 | 1802 | $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>"; |
1803 | 1803 | |
1804 | - $cache[ $key ] = $calendar_output; |
|
1805 | - wp_cache_set( 'get_calendar', $cache, 'calendar' ); |
|
1804 | + $cache[$key] = $calendar_output; |
|
1805 | + wp_cache_set('get_calendar', $cache, 'calendar'); |
|
1806 | 1806 | |
1807 | - if ( $echo ) { |
|
1807 | + if ($echo) { |
|
1808 | 1808 | /** |
1809 | 1809 | * Filter the HTML calendar output. |
1810 | 1810 | * |
@@ -1812,10 +1812,10 @@ discard block |
||
1812 | 1812 | * |
1813 | 1813 | * @param string $calendar_output HTML output of the calendar. |
1814 | 1814 | */ |
1815 | - echo apply_filters( 'get_calendar', $calendar_output ); |
|
1815 | + echo apply_filters('get_calendar', $calendar_output); |
|
1816 | 1816 | } else { |
1817 | 1817 | /** This filter is documented in wp-includes/general-template.php */ |
1818 | - return apply_filters( 'get_calendar', $calendar_output ); |
|
1818 | + return apply_filters('get_calendar', $calendar_output); |
|
1819 | 1819 | } |
1820 | 1820 | |
1821 | 1821 | } |
@@ -1827,7 +1827,7 @@ discard block |
||
1827 | 1827 | * @since 2.1.0 |
1828 | 1828 | */ |
1829 | 1829 | function delete_get_calendar_cache() { |
1830 | - wp_cache_delete( 'get_calendar', 'calendar' ); |
|
1830 | + wp_cache_delete('get_calendar', 'calendar'); |
|
1831 | 1831 | } |
1832 | 1832 | |
1833 | 1833 | /** |
@@ -1845,16 +1845,16 @@ discard block |
||
1845 | 1845 | function allowed_tags() { |
1846 | 1846 | global $allowedtags; |
1847 | 1847 | $allowed = ''; |
1848 | - foreach ( (array) $allowedtags as $tag => $attributes ) { |
|
1848 | + foreach ((array) $allowedtags as $tag => $attributes) { |
|
1849 | 1849 | $allowed .= '<'.$tag; |
1850 | - if ( 0 < count($attributes) ) { |
|
1851 | - foreach ( $attributes as $attribute => $limits ) { |
|
1850 | + if (0 < count($attributes)) { |
|
1851 | + foreach ($attributes as $attribute => $limits) { |
|
1852 | 1852 | $allowed .= ' '.$attribute.'=""'; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | 1855 | $allowed .= '> '; |
1856 | 1856 | } |
1857 | - return htmlentities( $allowed ); |
|
1857 | + return htmlentities($allowed); |
|
1858 | 1858 | } |
1859 | 1859 | |
1860 | 1860 | /***** Date/Time tags *****/ |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | * @since 1.0.0 |
1866 | 1866 | */ |
1867 | 1867 | function the_date_xml() { |
1868 | - echo mysql2date( 'Y-m-d', get_post()->post_date, false ); |
|
1868 | + echo mysql2date('Y-m-d', get_post()->post_date, false); |
|
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | /** |
@@ -1891,11 +1891,11 @@ discard block |
||
1891 | 1891 | * @param bool $echo Optional, default is display. Whether to echo the date or return it. |
1892 | 1892 | * @return string|void String if retrieving. |
1893 | 1893 | */ |
1894 | -function the_date( $d = '', $before = '', $after = '', $echo = true ) { |
|
1894 | +function the_date($d = '', $before = '', $after = '', $echo = true) { |
|
1895 | 1895 | global $currentday, $previousday; |
1896 | 1896 | |
1897 | - if ( $currentday != $previousday ) { |
|
1898 | - $the_date = $before . get_the_date( $d ) . $after; |
|
1897 | + if ($currentday != $previousday) { |
|
1898 | + $the_date = $before.get_the_date($d).$after; |
|
1899 | 1899 | $previousday = $currentday; |
1900 | 1900 | |
1901 | 1901 | /** |
@@ -1909,9 +1909,9 @@ discard block |
||
1909 | 1909 | * @param string $before HTML output before the date. |
1910 | 1910 | * @param string $after HTML output after the date. |
1911 | 1911 | */ |
1912 | - $the_date = apply_filters( 'the_date', $the_date, $d, $before, $after ); |
|
1912 | + $the_date = apply_filters('the_date', $the_date, $d, $before, $after); |
|
1913 | 1913 | |
1914 | - if ( $echo ) |
|
1914 | + if ($echo) |
|
1915 | 1915 | echo $the_date; |
1916 | 1916 | else |
1917 | 1917 | return $the_date; |
@@ -1930,17 +1930,17 @@ discard block |
||
1930 | 1930 | * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
1931 | 1931 | * @return false|string Date the current post was written. False on failure. |
1932 | 1932 | */ |
1933 | -function get_the_date( $d = '', $post = null ) { |
|
1934 | - $post = get_post( $post ); |
|
1933 | +function get_the_date($d = '', $post = null) { |
|
1934 | + $post = get_post($post); |
|
1935 | 1935 | |
1936 | - if ( ! $post ) { |
|
1936 | + if ( ! $post) { |
|
1937 | 1937 | return false; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | - if ( '' == $d ) { |
|
1941 | - $the_date = mysql2date( get_option( 'date_format' ), $post->post_date ); |
|
1940 | + if ('' == $d) { |
|
1941 | + $the_date = mysql2date(get_option('date_format'), $post->post_date); |
|
1942 | 1942 | } else { |
1943 | - $the_date = mysql2date( $d, $post->post_date ); |
|
1943 | + $the_date = mysql2date($d, $post->post_date); |
|
1944 | 1944 | } |
1945 | 1945 | |
1946 | 1946 | /** |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | * if not specified. |
1954 | 1954 | * @param int|WP_Post $post The post object or ID. |
1955 | 1955 | */ |
1956 | - return apply_filters( 'get_the_date', $the_date, $d, $post ); |
|
1956 | + return apply_filters('get_the_date', $the_date, $d, $post); |
|
1957 | 1957 | } |
1958 | 1958 | |
1959 | 1959 | /** |
@@ -1967,8 +1967,8 @@ discard block |
||
1967 | 1967 | * @param bool $echo Optional, default is display. Whether to echo the date or return it. |
1968 | 1968 | * @return string|void String if retrieving. |
1969 | 1969 | */ |
1970 | -function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) { |
|
1971 | - $the_modified_date = $before . get_the_modified_date($d) . $after; |
|
1970 | +function the_modified_date($d = '', $before = '', $after = '', $echo = true) { |
|
1971 | + $the_modified_date = $before.get_the_modified_date($d).$after; |
|
1972 | 1972 | |
1973 | 1973 | /** |
1974 | 1974 | * Filter the date a post was last modified for display. |
@@ -1981,9 +1981,9 @@ discard block |
||
1981 | 1981 | * @param string $before HTML output before the date. |
1982 | 1982 | * @param string $after HTML output after the date. |
1983 | 1983 | */ |
1984 | - $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after ); |
|
1984 | + $the_modified_date = apply_filters('the_modified_date', $the_modified_date, $d, $before, $after); |
|
1985 | 1985 | |
1986 | - if ( $echo ) |
|
1986 | + if ($echo) |
|
1987 | 1987 | echo $the_modified_date; |
1988 | 1988 | else |
1989 | 1989 | return $the_modified_date; |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | * @return string |
2000 | 2000 | */ |
2001 | 2001 | function get_the_modified_date($d = '') { |
2002 | - if ( '' == $d ) |
|
2002 | + if ('' == $d) |
|
2003 | 2003 | $the_time = get_post_modified_time(get_option('date_format'), null, null, true); |
2004 | 2004 | else |
2005 | 2005 | $the_time = get_post_modified_time($d, null, null, true); |
@@ -2013,7 +2013,7 @@ discard block |
||
2013 | 2013 | * @param string $d PHP date format. Defaults to value specified in |
2014 | 2014 | * 'date_format' option. |
2015 | 2015 | */ |
2016 | - return apply_filters( 'get_the_modified_date', $the_time, $d ); |
|
2016 | + return apply_filters('get_the_modified_date', $the_time, $d); |
|
2017 | 2017 | } |
2018 | 2018 | |
2019 | 2019 | /** |
@@ -2023,7 +2023,7 @@ discard block |
||
2023 | 2023 | * |
2024 | 2024 | * @param string $d Either 'G', 'U', or php date format. |
2025 | 2025 | */ |
2026 | -function the_time( $d = '' ) { |
|
2026 | +function the_time($d = '') { |
|
2027 | 2027 | /** |
2028 | 2028 | * Filter the time a post was written for display. |
2029 | 2029 | * |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | * @param string $d The time format. Accepts 'G', 'U', |
2034 | 2034 | * or php date format. |
2035 | 2035 | */ |
2036 | - echo apply_filters( 'the_time', get_the_time( $d ), $d ); |
|
2036 | + echo apply_filters('the_time', get_the_time($d), $d); |
|
2037 | 2037 | } |
2038 | 2038 | |
2039 | 2039 | /** |
@@ -2047,14 +2047,14 @@ discard block |
||
2047 | 2047 | * @param int|WP_Post $post WP_Post object or ID. Default is global $post object. |
2048 | 2048 | * @return false|string Formatted date string or Unix timestamp. False on failure. |
2049 | 2049 | */ |
2050 | -function get_the_time( $d = '', $post = null ) { |
|
2050 | +function get_the_time($d = '', $post = null) { |
|
2051 | 2051 | $post = get_post($post); |
2052 | 2052 | |
2053 | - if ( ! $post ) { |
|
2053 | + if ( ! $post) { |
|
2054 | 2054 | return false; |
2055 | 2055 | } |
2056 | 2056 | |
2057 | - if ( '' == $d ) |
|
2057 | + if ('' == $d) |
|
2058 | 2058 | $the_time = get_post_time(get_option('time_format'), false, $post, true); |
2059 | 2059 | else |
2060 | 2060 | $the_time = get_post_time($d, false, $post, true); |
@@ -2070,7 +2070,7 @@ discard block |
||
2070 | 2070 | * in 'time_format' option. Default empty. |
2071 | 2071 | * @param int|WP_Post $post WP_Post object or ID. |
2072 | 2072 | */ |
2073 | - return apply_filters( 'get_the_time', $the_time, $d, $post ); |
|
2073 | + return apply_filters('get_the_time', $the_time, $d, $post); |
|
2074 | 2074 | } |
2075 | 2075 | |
2076 | 2076 | /** |
@@ -2085,14 +2085,14 @@ discard block |
||
2085 | 2085 | * @param bool $translate Whether to translate the time string. Default false. |
2086 | 2086 | * @return false|string|int Formatted date string or Unix timestamp. False on failure. |
2087 | 2087 | */ |
2088 | -function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
|
2088 | +function get_post_time($d = 'U', $gmt = false, $post = null, $translate = false) { |
|
2089 | 2089 | $post = get_post($post); |
2090 | 2090 | |
2091 | - if ( ! $post ) { |
|
2091 | + if ( ! $post) { |
|
2092 | 2092 | return false; |
2093 | 2093 | } |
2094 | 2094 | |
2095 | - if ( $gmt ) |
|
2095 | + if ($gmt) |
|
2096 | 2096 | $time = $post->post_date_gmt; |
2097 | 2097 | else |
2098 | 2098 | $time = $post->post_date; |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | * Accepts 'G', 'U', or php date format. Default 'U'. |
2110 | 2110 | * @param bool $gmt Whether to retrieve the GMT time. Default false. |
2111 | 2111 | */ |
2112 | - return apply_filters( 'get_post_time', $time, $d, $gmt ); |
|
2112 | + return apply_filters('get_post_time', $time, $d, $gmt); |
|
2113 | 2113 | } |
2114 | 2114 | |
2115 | 2115 | /** |
@@ -2130,7 +2130,7 @@ discard block |
||
2130 | 2130 | * or php date format. Defaults to value |
2131 | 2131 | * specified in 'time_format' option. |
2132 | 2132 | */ |
2133 | - echo apply_filters( 'the_modified_time', get_the_modified_time($d), $d ); |
|
2133 | + echo apply_filters('the_modified_time', get_the_modified_time($d), $d); |
|
2134 | 2134 | } |
2135 | 2135 | |
2136 | 2136 | /** |
@@ -2142,7 +2142,7 @@ discard block |
||
2142 | 2142 | * @return string |
2143 | 2143 | */ |
2144 | 2144 | function get_the_modified_time($d = '') { |
2145 | - if ( '' == $d ) |
|
2145 | + if ('' == $d) |
|
2146 | 2146 | $the_time = get_post_modified_time(get_option('time_format'), null, null, true); |
2147 | 2147 | else |
2148 | 2148 | $the_time = get_post_modified_time($d, null, null, true); |
@@ -2157,7 +2157,7 @@ discard block |
||
2157 | 2157 | * written. Accepts 'G', 'U', or php date format. Defaults |
2158 | 2158 | * to value specified in 'time_format' option. |
2159 | 2159 | */ |
2160 | - return apply_filters( 'get_the_modified_time', $the_time, $d ); |
|
2160 | + return apply_filters('get_the_modified_time', $the_time, $d); |
|
2161 | 2161 | } |
2162 | 2162 | |
2163 | 2163 | /** |
@@ -2172,14 +2172,14 @@ discard block |
||
2172 | 2172 | * @param bool $translate Whether to translate the time string. Default false. |
2173 | 2173 | * @return false|string Formatted date string or Unix timestamp. False on failure. |
2174 | 2174 | */ |
2175 | -function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) { |
|
2175 | +function get_post_modified_time($d = 'U', $gmt = false, $post = null, $translate = false) { |
|
2176 | 2176 | $post = get_post($post); |
2177 | 2177 | |
2178 | - if ( ! $post ) { |
|
2178 | + if ( ! $post) { |
|
2179 | 2179 | return false; |
2180 | 2180 | } |
2181 | 2181 | |
2182 | - if ( $gmt ) |
|
2182 | + if ($gmt) |
|
2183 | 2183 | $time = $post->post_modified_gmt; |
2184 | 2184 | else |
2185 | 2185 | $time = $post->post_modified; |
@@ -2194,7 +2194,7 @@ discard block |
||
2194 | 2194 | * @param string $d The date format. Accepts 'G', 'U', or php date format. Default 'U'. |
2195 | 2195 | * @param bool $gmt Whether to return the GMT time. Default false. |
2196 | 2196 | */ |
2197 | - return apply_filters( 'get_post_modified_time', $time, $d, $gmt ); |
|
2197 | + return apply_filters('get_post_modified_time', $time, $d, $gmt); |
|
2198 | 2198 | } |
2199 | 2199 | |
2200 | 2200 | /** |
@@ -2206,7 +2206,7 @@ discard block |
||
2206 | 2206 | */ |
2207 | 2207 | function the_weekday() { |
2208 | 2208 | global $wp_locale; |
2209 | - $the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); |
|
2209 | + $the_weekday = $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false)); |
|
2210 | 2210 | |
2211 | 2211 | /** |
2212 | 2212 | * Filter the weekday on which the post was written, for display. |
@@ -2215,7 +2215,7 @@ discard block |
||
2215 | 2215 | * |
2216 | 2216 | * @param string $the_weekday |
2217 | 2217 | */ |
2218 | - echo apply_filters( 'the_weekday', $the_weekday ); |
|
2218 | + echo apply_filters('the_weekday', $the_weekday); |
|
2219 | 2219 | } |
2220 | 2220 | |
2221 | 2221 | /** |
@@ -2233,12 +2233,12 @@ discard block |
||
2233 | 2233 | * @param string $before Optional Output before the date. |
2234 | 2234 | * @param string $after Optional Output after the date. |
2235 | 2235 | */ |
2236 | -function the_weekday_date($before='',$after='') { |
|
2236 | +function the_weekday_date($before = '', $after = '') { |
|
2237 | 2237 | global $wp_locale, $currentday, $previousweekday; |
2238 | 2238 | $the_weekday_date = ''; |
2239 | - if ( $currentday != $previousweekday ) { |
|
2239 | + if ($currentday != $previousweekday) { |
|
2240 | 2240 | $the_weekday_date .= $before; |
2241 | - $the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) ); |
|
2241 | + $the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false)); |
|
2242 | 2242 | $the_weekday_date .= $after; |
2243 | 2243 | $previousweekday = $currentday; |
2244 | 2244 | } |
@@ -2252,7 +2252,7 @@ discard block |
||
2252 | 2252 | * @param string $before The HTML to output before the date. |
2253 | 2253 | * @param string $after The HTML to output after the date. |
2254 | 2254 | */ |
2255 | - $the_weekday_date = apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after ); |
|
2255 | + $the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after); |
|
2256 | 2256 | echo $the_weekday_date; |
2257 | 2257 | } |
2258 | 2258 | |
@@ -2267,7 +2267,7 @@ discard block |
||
2267 | 2267 | * |
2268 | 2268 | * @since 1.5.0 |
2269 | 2269 | */ |
2270 | - do_action( 'wp_head' ); |
|
2270 | + do_action('wp_head'); |
|
2271 | 2271 | } |
2272 | 2272 | |
2273 | 2273 | /** |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | * |
2282 | 2282 | * @since 1.5.1 |
2283 | 2283 | */ |
2284 | - do_action( 'wp_footer' ); |
|
2284 | + do_action('wp_footer'); |
|
2285 | 2285 | } |
2286 | 2286 | |
2287 | 2287 | /** |
@@ -2291,8 +2291,8 @@ discard block |
||
2291 | 2291 | * |
2292 | 2292 | * @param array $args Optional arguments. |
2293 | 2293 | */ |
2294 | -function feed_links( $args = array() ) { |
|
2295 | - if ( !current_theme_supports('automatic-feed-links') ) |
|
2294 | +function feed_links($args = array()) { |
|
2295 | + if ( ! current_theme_supports('automatic-feed-links')) |
|
2296 | 2296 | return; |
2297 | 2297 | |
2298 | 2298 | $defaults = array( |
@@ -2304,10 +2304,10 @@ discard block |
||
2304 | 2304 | 'comstitle' => __('%1$s %2$s Comments Feed'), |
2305 | 2305 | ); |
2306 | 2306 | |
2307 | - $args = wp_parse_args( $args, $defaults ); |
|
2307 | + $args = wp_parse_args($args, $defaults); |
|
2308 | 2308 | |
2309 | - echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n"; |
|
2310 | - echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n"; |
|
2309 | + echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['feedtitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link())."\" />\n"; |
|
2310 | + echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['comstitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link('comments_'.get_default_feed()))."\" />\n"; |
|
2311 | 2311 | } |
2312 | 2312 | |
2313 | 2313 | /** |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | * |
2318 | 2318 | * @param array $args Optional arguments. |
2319 | 2319 | */ |
2320 | -function feed_links_extra( $args = array() ) { |
|
2320 | +function feed_links_extra($args = array()) { |
|
2321 | 2321 | $defaults = array( |
2322 | 2322 | /* translators: Separator between blog name and feed type in feed links */ |
2323 | 2323 | 'separator' => _x('»', 'feed link'), |
@@ -2335,55 +2335,55 @@ discard block |
||
2335 | 2335 | 'posttypetitle' => __('%1$s %2$s %3$s Feed'), |
2336 | 2336 | ); |
2337 | 2337 | |
2338 | - $args = wp_parse_args( $args, $defaults ); |
|
2338 | + $args = wp_parse_args($args, $defaults); |
|
2339 | 2339 | |
2340 | - if ( is_singular() ) { |
|
2340 | + if (is_singular()) { |
|
2341 | 2341 | $id = 0; |
2342 | - $post = get_post( $id ); |
|
2342 | + $post = get_post($id); |
|
2343 | 2343 | |
2344 | - if ( comments_open() || pings_open() || $post->comment_count > 0 ) { |
|
2345 | - $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); |
|
2346 | - $href = get_post_comments_feed_link( $post->ID ); |
|
2344 | + if (comments_open() || pings_open() || $post->comment_count > 0) { |
|
2345 | + $title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false))); |
|
2346 | + $href = get_post_comments_feed_link($post->ID); |
|
2347 | 2347 | } |
2348 | - } elseif ( is_post_type_archive() ) { |
|
2349 | - $post_type = get_query_var( 'post_type' ); |
|
2350 | - if ( is_array( $post_type ) ) |
|
2351 | - $post_type = reset( $post_type ); |
|
2352 | - |
|
2353 | - $post_type_obj = get_post_type_object( $post_type ); |
|
2354 | - $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); |
|
2355 | - $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
|
2356 | - } elseif ( is_category() ) { |
|
2348 | + } elseif (is_post_type_archive()) { |
|
2349 | + $post_type = get_query_var('post_type'); |
|
2350 | + if (is_array($post_type)) |
|
2351 | + $post_type = reset($post_type); |
|
2352 | + |
|
2353 | + $post_type_obj = get_post_type_object($post_type); |
|
2354 | + $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name); |
|
2355 | + $href = get_post_type_archive_feed_link($post_type_obj->name); |
|
2356 | + } elseif (is_category()) { |
|
2357 | 2357 | $term = get_queried_object(); |
2358 | 2358 | |
2359 | - if ( $term ) { |
|
2360 | - $title = sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name ); |
|
2361 | - $href = get_category_feed_link( $term->term_id ); |
|
2359 | + if ($term) { |
|
2360 | + $title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name); |
|
2361 | + $href = get_category_feed_link($term->term_id); |
|
2362 | 2362 | } |
2363 | - } elseif ( is_tag() ) { |
|
2363 | + } elseif (is_tag()) { |
|
2364 | 2364 | $term = get_queried_object(); |
2365 | 2365 | |
2366 | - if ( $term ) { |
|
2367 | - $title = sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name ); |
|
2368 | - $href = get_tag_feed_link( $term->term_id ); |
|
2366 | + if ($term) { |
|
2367 | + $title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name); |
|
2368 | + $href = get_tag_feed_link($term->term_id); |
|
2369 | 2369 | } |
2370 | - } elseif ( is_author() ) { |
|
2371 | - $author_id = intval( get_query_var('author') ); |
|
2370 | + } elseif (is_author()) { |
|
2371 | + $author_id = intval(get_query_var('author')); |
|
2372 | 2372 | |
2373 | - $title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) ); |
|
2374 | - $href = get_author_feed_link( $author_id ); |
|
2375 | - } elseif ( is_search() ) { |
|
2376 | - $title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) ); |
|
2373 | + $title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id)); |
|
2374 | + $href = get_author_feed_link($author_id); |
|
2375 | + } elseif (is_search()) { |
|
2376 | + $title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false)); |
|
2377 | 2377 | $href = get_search_feed_link(); |
2378 | - } elseif ( is_post_type_archive() ) { |
|
2379 | - $title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) ); |
|
2378 | + } elseif (is_post_type_archive()) { |
|
2379 | + $title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false)); |
|
2380 | 2380 | $post_type_obj = get_queried_object(); |
2381 | - if ( $post_type_obj ) |
|
2382 | - $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
|
2381 | + if ($post_type_obj) |
|
2382 | + $href = get_post_type_archive_feed_link($post_type_obj->name); |
|
2383 | 2383 | } |
2384 | 2384 | |
2385 | - if ( isset($title) && isset($href) ) |
|
2386 | - echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
|
2385 | + if (isset($title) && isset($href)) |
|
2386 | + echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr($title).'" href="'.esc_url($href).'" />'."\n"; |
|
2387 | 2387 | } |
2388 | 2388 | |
2389 | 2389 | /** |
@@ -2393,7 +2393,7 @@ discard block |
||
2393 | 2393 | * @since 2.0.0 |
2394 | 2394 | */ |
2395 | 2395 | function rsd_link() { |
2396 | - echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n"; |
|
2396 | + echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.get_bloginfo('wpurl')."/xmlrpc.php?rsd\" />\n"; |
|
2397 | 2397 | } |
2398 | 2398 | |
2399 | 2399 | /** |
@@ -2404,7 +2404,7 @@ discard block |
||
2404 | 2404 | */ |
2405 | 2405 | function wlwmanifest_link() { |
2406 | 2406 | echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="', |
2407 | - includes_url( 'wlwmanifest.xml' ), '" /> ', "\n"; |
|
2407 | + includes_url('wlwmanifest.xml'), '" /> ', "\n"; |
|
2408 | 2408 | } |
2409 | 2409 | |
2410 | 2410 | /** |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | */ |
2421 | 2421 | function noindex() { |
2422 | 2422 | // If the blog is not public, tell robots to go away. |
2423 | - if ( '0' == get_option('blog_public') ) |
|
2423 | + if ('0' == get_option('blog_public')) |
|
2424 | 2424 | wp_no_robots(); |
2425 | 2425 | } |
2426 | 2426 | |
@@ -2444,15 +2444,15 @@ discard block |
||
2444 | 2444 | * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon. |
2445 | 2445 | */ |
2446 | 2446 | function wp_site_icon() { |
2447 | - if ( ! has_site_icon() && ! is_customize_preview() ) { |
|
2447 | + if ( ! has_site_icon() && ! is_customize_preview()) { |
|
2448 | 2448 | return; |
2449 | 2449 | } |
2450 | 2450 | |
2451 | 2451 | $meta_tags = array( |
2452 | - sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( get_site_icon_url( 32 ) ) ), |
|
2453 | - sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( get_site_icon_url( 192 ) ) ), |
|
2454 | - sprintf( '<link rel="apple-touch-icon-precomposed" href="%s">', esc_url( get_site_icon_url( 180 ) ) ), |
|
2455 | - sprintf( '<meta name="msapplication-TileImage" content="%s">', esc_url( get_site_icon_url( 270 ) ) ), |
|
2452 | + sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url(get_site_icon_url(32))), |
|
2453 | + sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url(get_site_icon_url(192))), |
|
2454 | + sprintf('<link rel="apple-touch-icon-precomposed" href="%s">', esc_url(get_site_icon_url(180))), |
|
2455 | + sprintf('<meta name="msapplication-TileImage" content="%s">', esc_url(get_site_icon_url(270))), |
|
2456 | 2456 | ); |
2457 | 2457 | |
2458 | 2458 | /** |
@@ -2462,10 +2462,10 @@ discard block |
||
2462 | 2462 | * |
2463 | 2463 | * @param array $meta_tags Site Icon meta elements. |
2464 | 2464 | */ |
2465 | - $meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags ); |
|
2466 | - $meta_tags = array_filter( $meta_tags ); |
|
2465 | + $meta_tags = apply_filters('site_icon_meta_tags', $meta_tags); |
|
2466 | + $meta_tags = array_filter($meta_tags); |
|
2467 | 2467 | |
2468 | - foreach ( $meta_tags as $meta_tag ) { |
|
2468 | + foreach ($meta_tags as $meta_tag) { |
|
2469 | 2469 | echo "$meta_tag\n"; |
2470 | 2470 | } |
2471 | 2471 | } |
@@ -2490,13 +2490,13 @@ discard block |
||
2490 | 2490 | function user_can_richedit() { |
2491 | 2491 | global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE; |
2492 | 2492 | |
2493 | - if ( !isset($wp_rich_edit) ) { |
|
2493 | + if ( ! isset($wp_rich_edit)) { |
|
2494 | 2494 | $wp_rich_edit = false; |
2495 | 2495 | |
2496 | - if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users |
|
2497 | - if ( $is_safari ) { |
|
2498 | - $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 ); |
|
2499 | - } elseif ( $is_gecko || $is_chrome || $is_IE || ( $is_opera && !wp_is_mobile() ) ) { |
|
2496 | + if (get_user_option('rich_editing') == 'true' || ! is_user_logged_in()) { // default to 'true' for logged out users |
|
2497 | + if ($is_safari) { |
|
2498 | + $wp_rich_edit = ! wp_is_mobile() || (preg_match('!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match) && intval($match[1]) >= 534); |
|
2499 | + } elseif ($is_gecko || $is_chrome || $is_IE || ($is_opera && ! wp_is_mobile())) { |
|
2500 | 2500 | $wp_rich_edit = true; |
2501 | 2501 | } |
2502 | 2502 | } |
@@ -2509,7 +2509,7 @@ discard block |
||
2509 | 2509 | * |
2510 | 2510 | * @param bool $wp_rich_edit Whether the user can access to the rich (Visual) editor. |
2511 | 2511 | */ |
2512 | - return apply_filters( 'user_can_richedit', $wp_rich_edit ); |
|
2512 | + return apply_filters('user_can_richedit', $wp_rich_edit); |
|
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | /** |
@@ -2524,9 +2524,9 @@ discard block |
||
2524 | 2524 | */ |
2525 | 2525 | function wp_default_editor() { |
2526 | 2526 | $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults |
2527 | - if ( wp_get_current_user() ) { // look for cookie |
|
2527 | + if (wp_get_current_user()) { // look for cookie |
|
2528 | 2528 | $ed = get_user_setting('editor', 'tinymce'); |
2529 | - $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r; |
|
2529 | + $r = (in_array($ed, array('tinymce', 'html', 'test'))) ? $ed : $r; |
|
2530 | 2530 | } |
2531 | 2531 | |
2532 | 2532 | /** |
@@ -2536,7 +2536,7 @@ discard block |
||
2536 | 2536 | * |
2537 | 2537 | * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'. |
2538 | 2538 | */ |
2539 | - return apply_filters( 'wp_default_editor', $r ); |
|
2539 | + return apply_filters('wp_default_editor', $r); |
|
2540 | 2540 | } |
2541 | 2541 | |
2542 | 2542 | /** |
@@ -2558,9 +2558,9 @@ discard block |
||
2558 | 2558 | * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/. |
2559 | 2559 | * @param array $settings See _WP_Editors::editor(). |
2560 | 2560 | */ |
2561 | -function wp_editor( $content, $editor_id, $settings = array() ) { |
|
2562 | - if ( ! class_exists( '_WP_Editors' ) ) |
|
2563 | - require( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
2561 | +function wp_editor($content, $editor_id, $settings = array()) { |
|
2562 | + if ( ! class_exists('_WP_Editors')) |
|
2563 | + require(ABSPATH.WPINC.'/class-wp-editor.php'); |
|
2564 | 2564 | |
2565 | 2565 | _WP_Editors::editor($content, $editor_id, $settings); |
2566 | 2566 | } |
@@ -2577,7 +2577,7 @@ discard block |
||
2577 | 2577 | * Only use when you are later escaping it. Do not use unescaped. |
2578 | 2578 | * @return string |
2579 | 2579 | */ |
2580 | -function get_search_query( $escaped = true ) { |
|
2580 | +function get_search_query($escaped = true) { |
|
2581 | 2581 | /** |
2582 | 2582 | * Filter the contents of the search query variable. |
2583 | 2583 | * |
@@ -2585,10 +2585,10 @@ discard block |
||
2585 | 2585 | * |
2586 | 2586 | * @param mixed $search Contents of the search query variable. |
2587 | 2587 | */ |
2588 | - $query = apply_filters( 'get_search_query', get_query_var( 's' ) ); |
|
2588 | + $query = apply_filters('get_search_query', get_query_var('s')); |
|
2589 | 2589 | |
2590 | - if ( $escaped ) |
|
2591 | - $query = esc_attr( $query ); |
|
2590 | + if ($escaped) |
|
2591 | + $query = esc_attr($query); |
|
2592 | 2592 | return $query; |
2593 | 2593 | } |
2594 | 2594 | |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | * |
2609 | 2609 | * @param mixed $search Contents of the search query variable. |
2610 | 2610 | */ |
2611 | - echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) ); |
|
2611 | + echo esc_attr(apply_filters('the_search_query', get_search_query(false))); |
|
2612 | 2612 | } |
2613 | 2613 | |
2614 | 2614 | /** |
@@ -2621,17 +2621,17 @@ discard block |
||
2621 | 2621 | * |
2622 | 2622 | * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'. |
2623 | 2623 | */ |
2624 | -function get_language_attributes( $doctype = 'html' ) { |
|
2624 | +function get_language_attributes($doctype = 'html') { |
|
2625 | 2625 | $attributes = array(); |
2626 | 2626 | |
2627 | - if ( function_exists( 'is_rtl' ) && is_rtl() ) |
|
2627 | + if (function_exists('is_rtl') && is_rtl()) |
|
2628 | 2628 | $attributes[] = 'dir="rtl"'; |
2629 | 2629 | |
2630 | - if ( $lang = get_bloginfo('language') ) { |
|
2631 | - if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) |
|
2630 | + if ($lang = get_bloginfo('language')) { |
|
2631 | + if (get_option('html_type') == 'text/html' || $doctype == 'html') |
|
2632 | 2632 | $attributes[] = "lang=\"$lang\""; |
2633 | 2633 | |
2634 | - if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) |
|
2634 | + if (get_option('html_type') != 'text/html' || $doctype == 'xhtml') |
|
2635 | 2635 | $attributes[] = "xml:lang=\"$lang\""; |
2636 | 2636 | } |
2637 | 2637 | |
@@ -2646,7 +2646,7 @@ discard block |
||
2646 | 2646 | * @param string $output A space-separated list of language attributes. |
2647 | 2647 | * @param string $doctype The type of html document (xhtml|html). |
2648 | 2648 | */ |
2649 | - return apply_filters( 'language_attributes', $output, $doctype ); |
|
2649 | + return apply_filters('language_attributes', $output, $doctype); |
|
2650 | 2650 | } |
2651 | 2651 | |
2652 | 2652 | /** |
@@ -2660,8 +2660,8 @@ discard block |
||
2660 | 2660 | * |
2661 | 2661 | * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'. |
2662 | 2662 | */ |
2663 | -function language_attributes( $doctype = 'html' ) { |
|
2664 | - echo get_language_attributes( $doctype ); |
|
2663 | +function language_attributes($doctype = 'html') { |
|
2664 | + echo get_language_attributes($doctype); |
|
2665 | 2665 | } |
2666 | 2666 | |
2667 | 2667 | /** |
@@ -2739,23 +2739,23 @@ discard block |
||
2739 | 2739 | * } |
2740 | 2740 | * @return array|string|void String of page links or array of page links. |
2741 | 2741 | */ |
2742 | -function paginate_links( $args = '' ) { |
|
2742 | +function paginate_links($args = '') { |
|
2743 | 2743 | global $wp_query, $wp_rewrite; |
2744 | 2744 | |
2745 | 2745 | // Setting up default values based on the current URL. |
2746 | - $pagenum_link = html_entity_decode( get_pagenum_link() ); |
|
2747 | - $url_parts = explode( '?', $pagenum_link ); |
|
2746 | + $pagenum_link = html_entity_decode(get_pagenum_link()); |
|
2747 | + $url_parts = explode('?', $pagenum_link); |
|
2748 | 2748 | |
2749 | 2749 | // Get max pages and current page out of the current query, if available. |
2750 | - $total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1; |
|
2751 | - $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; |
|
2750 | + $total = isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1; |
|
2751 | + $current = get_query_var('paged') ? intval(get_query_var('paged')) : 1; |
|
2752 | 2752 | |
2753 | 2753 | // Append the format placeholder to the base URL. |
2754 | - $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
|
2754 | + $pagenum_link = trailingslashit($url_parts[0]).'%_%'; |
|
2755 | 2755 | |
2756 | 2756 | // URL base depends on permalink settings. |
2757 | - $format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; |
|
2758 | - $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%'; |
|
2757 | + $format = $wp_rewrite->using_index_permalinks() && ! strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; |
|
2758 | + $format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base.'/%#%', 'paged') : '?paged=%#%'; |
|
2759 | 2759 | |
2760 | 2760 | $defaults = array( |
2761 | 2761 | 'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below) |
@@ -2775,42 +2775,42 @@ discard block |
||
2775 | 2775 | 'after_page_number' => '' |
2776 | 2776 | ); |
2777 | 2777 | |
2778 | - $args = wp_parse_args( $args, $defaults ); |
|
2778 | + $args = wp_parse_args($args, $defaults); |
|
2779 | 2779 | |
2780 | - if ( ! is_array( $args['add_args'] ) ) { |
|
2780 | + if ( ! is_array($args['add_args'])) { |
|
2781 | 2781 | $args['add_args'] = array(); |
2782 | 2782 | } |
2783 | 2783 | |
2784 | 2784 | // Merge additional query vars found in the original URL into 'add_args' array. |
2785 | - if ( isset( $url_parts[1] ) ) { |
|
2785 | + if (isset($url_parts[1])) { |
|
2786 | 2786 | // Find the format argument. |
2787 | - $format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) ); |
|
2788 | - $format_query = isset( $format[1] ) ? $format[1] : ''; |
|
2789 | - wp_parse_str( $format_query, $format_args ); |
|
2787 | + $format = explode('?', str_replace('%_%', $args['format'], $args['base'])); |
|
2788 | + $format_query = isset($format[1]) ? $format[1] : ''; |
|
2789 | + wp_parse_str($format_query, $format_args); |
|
2790 | 2790 | |
2791 | 2791 | // Find the query args of the requested URL. |
2792 | - wp_parse_str( $url_parts[1], $url_query_args ); |
|
2792 | + wp_parse_str($url_parts[1], $url_query_args); |
|
2793 | 2793 | |
2794 | 2794 | // Remove the format argument from the array of query arguments, to avoid overwriting custom format. |
2795 | - foreach ( $format_args as $format_arg => $format_arg_value ) { |
|
2796 | - unset( $url_query_args[ $format_arg ] ); |
|
2795 | + foreach ($format_args as $format_arg => $format_arg_value) { |
|
2796 | + unset($url_query_args[$format_arg]); |
|
2797 | 2797 | } |
2798 | 2798 | |
2799 | - $args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) ); |
|
2799 | + $args['add_args'] = array_merge($args['add_args'], urlencode_deep($url_query_args)); |
|
2800 | 2800 | } |
2801 | 2801 | |
2802 | 2802 | // Who knows what else people pass in $args |
2803 | 2803 | $total = (int) $args['total']; |
2804 | - if ( $total < 2 ) { |
|
2804 | + if ($total < 2) { |
|
2805 | 2805 | return; |
2806 | 2806 | } |
2807 | 2807 | $current = (int) $args['current']; |
2808 | 2808 | $end_size = (int) $args['end_size']; // Out of bounds? Make it the default. |
2809 | - if ( $end_size < 1 ) { |
|
2809 | + if ($end_size < 1) { |
|
2810 | 2810 | $end_size = 1; |
2811 | 2811 | } |
2812 | 2812 | $mid_size = (int) $args['mid_size']; |
2813 | - if ( $mid_size < 0 ) { |
|
2813 | + if ($mid_size < 0) { |
|
2814 | 2814 | $mid_size = 2; |
2815 | 2815 | } |
2816 | 2816 | $add_args = $args['add_args']; |
@@ -2818,11 +2818,11 @@ discard block |
||
2818 | 2818 | $page_links = array(); |
2819 | 2819 | $dots = false; |
2820 | 2820 | |
2821 | - if ( $args['prev_next'] && $current && 1 < $current ) : |
|
2822 | - $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] ); |
|
2823 | - $link = str_replace( '%#%', $current - 1, $link ); |
|
2824 | - if ( $add_args ) |
|
2825 | - $link = add_query_arg( $add_args, $link ); |
|
2821 | + if ($args['prev_next'] && $current && 1 < $current) : |
|
2822 | + $link = str_replace('%_%', 2 == $current ? '' : $args['format'], $args['base']); |
|
2823 | + $link = str_replace('%#%', $current - 1, $link); |
|
2824 | + if ($add_args) |
|
2825 | + $link = add_query_arg($add_args, $link); |
|
2826 | 2826 | $link .= $args['add_fragment']; |
2827 | 2827 | |
2828 | 2828 | /** |
@@ -2832,40 +2832,40 @@ discard block |
||
2832 | 2832 | * |
2833 | 2833 | * @param string $link The paginated link URL. |
2834 | 2834 | */ |
2835 | - $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
|
2835 | + $page_links[] = '<a class="prev page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['prev_text'].'</a>'; |
|
2836 | 2836 | endif; |
2837 | - for ( $n = 1; $n <= $total; $n++ ) : |
|
2838 | - if ( $n == $current ) : |
|
2839 | - $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; |
|
2837 | + for ($n = 1; $n <= $total; $n++) : |
|
2838 | + if ($n == $current) : |
|
2839 | + $page_links[] = "<span class='page-numbers current'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</span>"; |
|
2840 | 2840 | $dots = true; |
2841 | 2841 | else : |
2842 | - if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
|
2843 | - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
|
2844 | - $link = str_replace( '%#%', $n, $link ); |
|
2845 | - if ( $add_args ) |
|
2846 | - $link = add_query_arg( $add_args, $link ); |
|
2842 | + if ($args['show_all'] || ($n <= $end_size || ($current && $n >= $current - $mid_size && $n <= $current + $mid_size) || $n > $total - $end_size)) : |
|
2843 | + $link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']); |
|
2844 | + $link = str_replace('%#%', $n, $link); |
|
2845 | + if ($add_args) |
|
2846 | + $link = add_query_arg($add_args, $link); |
|
2847 | 2847 | $link .= $args['add_fragment']; |
2848 | 2848 | |
2849 | 2849 | /** This filter is documented in wp-includes/general-template.php */ |
2850 | - $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>"; |
|
2850 | + $page_links[] = "<a class='page-numbers' href='".esc_url(apply_filters('paginate_links', $link))."'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</a>"; |
|
2851 | 2851 | $dots = true; |
2852 | - elseif ( $dots && ! $args['show_all'] ) : |
|
2853 | - $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; |
|
2852 | + elseif ($dots && ! $args['show_all']) : |
|
2853 | + $page_links[] = '<span class="page-numbers dots">'.__('…').'</span>'; |
|
2854 | 2854 | $dots = false; |
2855 | 2855 | endif; |
2856 | 2856 | endif; |
2857 | 2857 | endfor; |
2858 | - if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) : |
|
2859 | - $link = str_replace( '%_%', $args['format'], $args['base'] ); |
|
2860 | - $link = str_replace( '%#%', $current + 1, $link ); |
|
2861 | - if ( $add_args ) |
|
2862 | - $link = add_query_arg( $add_args, $link ); |
|
2858 | + if ($args['prev_next'] && $current && ($current < $total || -1 == $total)) : |
|
2859 | + $link = str_replace('%_%', $args['format'], $args['base']); |
|
2860 | + $link = str_replace('%#%', $current + 1, $link); |
|
2861 | + if ($add_args) |
|
2862 | + $link = add_query_arg($add_args, $link); |
|
2863 | 2863 | $link .= $args['add_fragment']; |
2864 | 2864 | |
2865 | 2865 | /** This filter is documented in wp-includes/general-template.php */ |
2866 | - $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; |
|
2866 | + $page_links[] = '<a class="next page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['next_text'].'</a>'; |
|
2867 | 2867 | endif; |
2868 | - switch ( $args['type'] ) { |
|
2868 | + switch ($args['type']) { |
|
2869 | 2869 | case 'array' : |
2870 | 2870 | return $page_links; |
2871 | 2871 | |
@@ -2903,10 +2903,10 @@ discard block |
||
2903 | 2903 | * @param array $colors Optional An array of CSS color definitions which are used to give the user a feel for the theme. |
2904 | 2904 | * @param array $icons Optional An array of CSS color definitions used to color any SVG icons |
2905 | 2905 | */ |
2906 | -function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { |
|
2906 | +function wp_admin_css_color($key, $name, $url, $colors = array(), $icons = array()) { |
|
2907 | 2907 | global $_wp_admin_css_colors; |
2908 | 2908 | |
2909 | - if ( !isset($_wp_admin_css_colors) ) |
|
2909 | + if ( ! isset($_wp_admin_css_colors)) |
|
2910 | 2910 | $_wp_admin_css_colors = array(); |
2911 | 2911 | |
2912 | 2912 | $_wp_admin_css_colors[$key] = (object) array( |
@@ -2928,56 +2928,56 @@ discard block |
||
2928 | 2928 | $suffix = is_rtl() ? '-rtl' : ''; |
2929 | 2929 | $suffix .= SCRIPT_DEBUG ? '' : '.min'; |
2930 | 2930 | |
2931 | - wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ), |
|
2931 | + wp_admin_css_color('fresh', _x('Default', 'admin color scheme'), |
|
2932 | 2932 | false, |
2933 | - array( '#222', '#333', '#0073aa', '#00a0d2' ), |
|
2934 | - array( 'base' => '#999', 'focus' => '#00a0d2', 'current' => '#fff' ) |
|
2933 | + array('#222', '#333', '#0073aa', '#00a0d2'), |
|
2934 | + array('base' => '#999', 'focus' => '#00a0d2', 'current' => '#fff') |
|
2935 | 2935 | ); |
2936 | 2936 | |
2937 | 2937 | // Other color schemes are not available when running out of src |
2938 | - if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) ) |
|
2938 | + if (false !== strpos($GLOBALS['wp_version'], '-src')) |
|
2939 | 2939 | return; |
2940 | 2940 | |
2941 | - wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), |
|
2942 | - admin_url( "css/colors/light/colors$suffix.css" ), |
|
2943 | - array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ), |
|
2944 | - array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' ) |
|
2941 | + wp_admin_css_color('light', _x('Light', 'admin color scheme'), |
|
2942 | + admin_url("css/colors/light/colors$suffix.css"), |
|
2943 | + array('#e5e5e5', '#999', '#d64e07', '#04a4cc'), |
|
2944 | + array('base' => '#999', 'focus' => '#ccc', 'current' => '#ccc') |
|
2945 | 2945 | ); |
2946 | 2946 | |
2947 | - wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ), |
|
2948 | - admin_url( "css/colors/blue/colors$suffix.css" ), |
|
2949 | - array( '#096484', '#4796b3', '#52accc', '#74B6CE' ), |
|
2950 | - array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' ) |
|
2947 | + wp_admin_css_color('blue', _x('Blue', 'admin color scheme'), |
|
2948 | + admin_url("css/colors/blue/colors$suffix.css"), |
|
2949 | + array('#096484', '#4796b3', '#52accc', '#74B6CE'), |
|
2950 | + array('base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff') |
|
2951 | 2951 | ); |
2952 | 2952 | |
2953 | - wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ), |
|
2954 | - admin_url( "css/colors/midnight/colors$suffix.css" ), |
|
2955 | - array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ), |
|
2956 | - array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' ) |
|
2953 | + wp_admin_css_color('midnight', _x('Midnight', 'admin color scheme'), |
|
2954 | + admin_url("css/colors/midnight/colors$suffix.css"), |
|
2955 | + array('#25282b', '#363b3f', '#69a8bb', '#e14d43'), |
|
2956 | + array('base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff') |
|
2957 | 2957 | ); |
2958 | 2958 | |
2959 | - wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ), |
|
2960 | - admin_url( "css/colors/sunrise/colors$suffix.css" ), |
|
2961 | - array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ), |
|
2962 | - array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' ) |
|
2959 | + wp_admin_css_color('sunrise', _x('Sunrise', 'admin color scheme'), |
|
2960 | + admin_url("css/colors/sunrise/colors$suffix.css"), |
|
2961 | + array('#b43c38', '#cf4944', '#dd823b', '#ccaf0b'), |
|
2962 | + array('base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff') |
|
2963 | 2963 | ); |
2964 | 2964 | |
2965 | - wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ), |
|
2966 | - admin_url( "css/colors/ectoplasm/colors$suffix.css" ), |
|
2967 | - array( '#413256', '#523f6d', '#a3b745', '#d46f15' ), |
|
2968 | - array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' ) |
|
2965 | + wp_admin_css_color('ectoplasm', _x('Ectoplasm', 'admin color scheme'), |
|
2966 | + admin_url("css/colors/ectoplasm/colors$suffix.css"), |
|
2967 | + array('#413256', '#523f6d', '#a3b745', '#d46f15'), |
|
2968 | + array('base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff') |
|
2969 | 2969 | ); |
2970 | 2970 | |
2971 | - wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ), |
|
2972 | - admin_url( "css/colors/ocean/colors$suffix.css" ), |
|
2973 | - array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ), |
|
2974 | - array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' ) |
|
2971 | + wp_admin_css_color('ocean', _x('Ocean', 'admin color scheme'), |
|
2972 | + admin_url("css/colors/ocean/colors$suffix.css"), |
|
2973 | + array('#627c83', '#738e96', '#9ebaa0', '#aa9d88'), |
|
2974 | + array('base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff') |
|
2975 | 2975 | ); |
2976 | 2976 | |
2977 | - wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ), |
|
2978 | - admin_url( "css/colors/coffee/colors$suffix.css" ), |
|
2979 | - array( '#46403c', '#59524c', '#c7a589', '#9ea476' ), |
|
2980 | - array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' ) |
|
2977 | + wp_admin_css_color('coffee', _x('Coffee', 'admin color scheme'), |
|
2978 | + admin_url("css/colors/coffee/colors$suffix.css"), |
|
2979 | + array('#46403c', '#59524c', '#c7a589', '#9ea476'), |
|
2980 | + array('base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff') |
|
2981 | 2981 | ); |
2982 | 2982 | |
2983 | 2983 | } |
@@ -2992,13 +2992,13 @@ discard block |
||
2992 | 2992 | * @param string $file file relative to wp-admin/ without its ".css" extension. |
2993 | 2993 | * @return string |
2994 | 2994 | */ |
2995 | -function wp_admin_css_uri( $file = 'wp-admin' ) { |
|
2996 | - if ( defined('WP_INSTALLING') ) { |
|
2995 | +function wp_admin_css_uri($file = 'wp-admin') { |
|
2996 | + if (defined('WP_INSTALLING')) { |
|
2997 | 2997 | $_file = "./$file.css"; |
2998 | 2998 | } else { |
2999 | 2999 | $_file = admin_url("$file.css"); |
3000 | 3000 | } |
3001 | - $_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file ); |
|
3001 | + $_file = add_query_arg('version', get_bloginfo('version'), $_file); |
|
3002 | 3002 | |
3003 | 3003 | /** |
3004 | 3004 | * Filter the URI of a WordPress admin CSS file. |
@@ -3008,7 +3008,7 @@ discard block |
||
3008 | 3008 | * @param string $_file Relative path to the file with query arguments attached. |
3009 | 3009 | * @param string $file Relative path to the file, minus its ".css" extension. |
3010 | 3010 | */ |
3011 | - return apply_filters( 'wp_admin_css_uri', $_file, $file ); |
|
3011 | + return apply_filters('wp_admin_css_uri', $_file, $file); |
|
3012 | 3012 | } |
3013 | 3013 | |
3014 | 3014 | /** |
@@ -3031,15 +3031,15 @@ discard block |
||
3031 | 3031 | * to wp-admin/. Defaults to 'wp-admin'. |
3032 | 3032 | * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. |
3033 | 3033 | */ |
3034 | -function wp_admin_css( $file = 'wp-admin', $force_echo = false ) { |
|
3034 | +function wp_admin_css($file = 'wp-admin', $force_echo = false) { |
|
3035 | 3035 | // For backward compatibility |
3036 | - $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; |
|
3036 | + $handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file; |
|
3037 | 3037 | |
3038 | - if ( wp_styles()->query( $handle ) ) { |
|
3039 | - if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately |
|
3040 | - wp_print_styles( $handle ); |
|
3038 | + if (wp_styles()->query($handle)) { |
|
3039 | + if ($force_echo || did_action('wp_print_styles')) // we already printed the style queue. Print this one immediately |
|
3040 | + wp_print_styles($handle); |
|
3041 | 3041 | else // Add to style queue |
3042 | - wp_enqueue_style( $handle ); |
|
3042 | + wp_enqueue_style($handle); |
|
3043 | 3043 | return; |
3044 | 3044 | } |
3045 | 3045 | |
@@ -3054,11 +3054,11 @@ discard block |
||
3054 | 3054 | * @param string $file Style handle name or filename (without ".css" extension) |
3055 | 3055 | * relative to wp-admin/. Defaults to 'wp-admin'. |
3056 | 3056 | */ |
3057 | - echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file ); |
|
3057 | + echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri($file))."' type='text/css' />\n", $file); |
|
3058 | 3058 | |
3059 | - if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
3059 | + if (function_exists('is_rtl') && is_rtl()) { |
|
3060 | 3060 | /** This filter is documented in wp-includes/general-template.php */ |
3061 | - echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" ); |
|
3061 | + echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri("$file-rtl"))."' type='text/css' />\n", "$file-rtl"); |
|
3062 | 3062 | } |
3063 | 3063 | } |
3064 | 3064 | |
@@ -3072,11 +3072,11 @@ discard block |
||
3072 | 3072 | * @since 2.5.0 |
3073 | 3073 | */ |
3074 | 3074 | function add_thickbox() { |
3075 | - wp_enqueue_script( 'thickbox' ); |
|
3076 | - wp_enqueue_style( 'thickbox' ); |
|
3075 | + wp_enqueue_script('thickbox'); |
|
3076 | + wp_enqueue_style('thickbox'); |
|
3077 | 3077 | |
3078 | - if ( is_network_admin() ) |
|
3079 | - add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); |
|
3078 | + if (is_network_admin()) |
|
3079 | + add_action('admin_head', '_thickbox_path_admin_subfolder'); |
|
3080 | 3080 | } |
3081 | 3081 | |
3082 | 3082 | /** |
@@ -3092,7 +3092,7 @@ discard block |
||
3092 | 3092 | * |
3093 | 3093 | * @param string $generator_type The XHTML generator. |
3094 | 3094 | */ |
3095 | - the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) ); |
|
3095 | + the_generator(apply_filters('wp_generator_type', 'xhtml')); |
|
3096 | 3096 | } |
3097 | 3097 | |
3098 | 3098 | /** |
@@ -3105,7 +3105,7 @@ discard block |
||
3105 | 3105 | * |
3106 | 3106 | * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export). |
3107 | 3107 | */ |
3108 | -function the_generator( $type ) { |
|
3108 | +function the_generator($type) { |
|
3109 | 3109 | /** |
3110 | 3110 | * Filter the output of the XHTML generator tag for display. |
3111 | 3111 | * |
@@ -3115,7 +3115,7 @@ discard block |
||
3115 | 3115 | * @param string $type The type of generator to output. Accepts 'html', |
3116 | 3116 | * 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'. |
3117 | 3117 | */ |
3118 | - echo apply_filters( 'the_generator', get_the_generator($type), $type ) . "\n"; |
|
3118 | + echo apply_filters('the_generator', get_the_generator($type), $type)."\n"; |
|
3119 | 3119 | } |
3120 | 3120 | |
3121 | 3121 | /** |
@@ -3130,14 +3130,14 @@ discard block |
||
3130 | 3130 | * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export). |
3131 | 3131 | * @return string|void The HTML content for the generator. |
3132 | 3132 | */ |
3133 | -function get_the_generator( $type = '' ) { |
|
3134 | - if ( empty( $type ) ) { |
|
3133 | +function get_the_generator($type = '') { |
|
3134 | + if (empty($type)) { |
|
3135 | 3135 | |
3136 | 3136 | $current_filter = current_filter(); |
3137 | - if ( empty( $current_filter ) ) |
|
3137 | + if (empty($current_filter)) |
|
3138 | 3138 | return; |
3139 | 3139 | |
3140 | - switch ( $current_filter ) { |
|
3140 | + switch ($current_filter) { |
|
3141 | 3141 | case 'rss2_head' : |
3142 | 3142 | case 'commentsrss2_head' : |
3143 | 3143 | $type = 'rss2'; |
@@ -3157,27 +3157,27 @@ discard block |
||
3157 | 3157 | } |
3158 | 3158 | } |
3159 | 3159 | |
3160 | - switch ( $type ) { |
|
3160 | + switch ($type) { |
|
3161 | 3161 | case 'html': |
3162 | - $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">'; |
|
3162 | + $gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'">'; |
|
3163 | 3163 | break; |
3164 | 3164 | case 'xhtml': |
3165 | - $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />'; |
|
3165 | + $gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'" />'; |
|
3166 | 3166 | break; |
3167 | 3167 | case 'atom': |
3168 | - $gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>'; |
|
3168 | + $gen = '<generator uri="http://wordpress.org/" version="'.get_bloginfo_rss('version').'">WordPress</generator>'; |
|
3169 | 3169 | break; |
3170 | 3170 | case 'rss2': |
3171 | - $gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>'; |
|
3171 | + $gen = '<generator>http://wordpress.org/?v='.get_bloginfo_rss('version').'</generator>'; |
|
3172 | 3172 | break; |
3173 | 3173 | case 'rdf': |
3174 | - $gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />'; |
|
3174 | + $gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v='.get_bloginfo_rss('version').'" />'; |
|
3175 | 3175 | break; |
3176 | 3176 | case 'comment': |
3177 | - $gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->'; |
|
3177 | + $gen = '<!-- generator="WordPress/'.get_bloginfo('version').'" -->'; |
|
3178 | 3178 | break; |
3179 | 3179 | case 'export': |
3180 | - $gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->'; |
|
3180 | + $gen = '<!-- generator="WordPress/'.get_bloginfo_rss('version').'" created="'.date('Y-m-d H:i').'" -->'; |
|
3181 | 3181 | break; |
3182 | 3182 | } |
3183 | 3183 | |
@@ -3192,7 +3192,7 @@ discard block |
||
3192 | 3192 | * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom', |
3193 | 3193 | * 'rss2', 'rdf', 'comment', 'export'. |
3194 | 3194 | */ |
3195 | - return apply_filters( "get_the_generator_{$type}", $gen, $type ); |
|
3195 | + return apply_filters("get_the_generator_{$type}", $gen, $type); |
|
3196 | 3196 | } |
3197 | 3197 | |
3198 | 3198 | /** |
@@ -3207,8 +3207,8 @@ discard block |
||
3207 | 3207 | * @param bool $echo Whether to echo or just return the string |
3208 | 3208 | * @return string html attribute or empty string |
3209 | 3209 | */ |
3210 | -function checked( $checked, $current = true, $echo = true ) { |
|
3211 | - return __checked_selected_helper( $checked, $current, $echo, 'checked' ); |
|
3210 | +function checked($checked, $current = true, $echo = true) { |
|
3211 | + return __checked_selected_helper($checked, $current, $echo, 'checked'); |
|
3212 | 3212 | } |
3213 | 3213 | |
3214 | 3214 | /** |
@@ -3223,8 +3223,8 @@ discard block |
||
3223 | 3223 | * @param bool $echo Whether to echo or just return the string |
3224 | 3224 | * @return string html attribute or empty string |
3225 | 3225 | */ |
3226 | -function selected( $selected, $current = true, $echo = true ) { |
|
3227 | - return __checked_selected_helper( $selected, $current, $echo, 'selected' ); |
|
3226 | +function selected($selected, $current = true, $echo = true) { |
|
3227 | + return __checked_selected_helper($selected, $current, $echo, 'selected'); |
|
3228 | 3228 | } |
3229 | 3229 | |
3230 | 3230 | /** |
@@ -3239,8 +3239,8 @@ discard block |
||
3239 | 3239 | * @param bool $echo Whether to echo or just return the string |
3240 | 3240 | * @return string html attribute or empty string |
3241 | 3241 | */ |
3242 | -function disabled( $disabled, $current = true, $echo = true ) { |
|
3243 | - return __checked_selected_helper( $disabled, $current, $echo, 'disabled' ); |
|
3242 | +function disabled($disabled, $current = true, $echo = true) { |
|
3243 | + return __checked_selected_helper($disabled, $current, $echo, 'disabled'); |
|
3244 | 3244 | } |
3245 | 3245 | |
3246 | 3246 | /** |
@@ -3257,13 +3257,13 @@ discard block |
||
3257 | 3257 | * @param string $type The type of checked|selected|disabled we are doing |
3258 | 3258 | * @return string html attribute or empty string |
3259 | 3259 | */ |
3260 | -function __checked_selected_helper( $helper, $current, $echo, $type ) { |
|
3261 | - if ( (string) $helper === (string) $current ) |
|
3260 | +function __checked_selected_helper($helper, $current, $echo, $type) { |
|
3261 | + if ((string) $helper === (string) $current) |
|
3262 | 3262 | $result = " $type='$type'"; |
3263 | 3263 | else |
3264 | 3264 | $result = ''; |
3265 | 3265 | |
3266 | - if ( $echo ) |
|
3266 | + if ($echo) |
|
3267 | 3267 | echo $result; |
3268 | 3268 | |
3269 | 3269 | return $result; |
@@ -3279,12 +3279,12 @@ discard block |
||
3279 | 3279 | * @param array $settings |
3280 | 3280 | * @return array $settings |
3281 | 3281 | */ |
3282 | -function wp_heartbeat_settings( $settings ) { |
|
3283 | - if ( ! is_admin() ) |
|
3284 | - $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); |
|
3282 | +function wp_heartbeat_settings($settings) { |
|
3283 | + if ( ! is_admin()) |
|
3284 | + $settings['ajaxurl'] = admin_url('admin-ajax.php', 'relative'); |
|
3285 | 3285 | |
3286 | - if ( is_user_logged_in() ) |
|
3287 | - $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); |
|
3286 | + if (is_user_logged_in()) |
|
3287 | + $settings['nonce'] = wp_create_nonce('heartbeat-nonce'); |
|
3288 | 3288 | |
3289 | 3289 | return $settings; |
3290 | 3290 | } |
@@ -36,15 +36,17 @@ discard block |
||
36 | 36 | |
37 | 37 | $templates = array(); |
38 | 38 | $name = (string) $name; |
39 | - if ( '' !== $name ) |
|
40 | - $templates[] = "header-{$name}.php"; |
|
39 | + if ( '' !== $name ) { |
|
40 | + $templates[] = "header-{$name}.php"; |
|
41 | + } |
|
41 | 42 | |
42 | 43 | $templates[] = 'header.php'; |
43 | 44 | |
44 | 45 | // Backward compat code will be removed in a future release |
45 | - if ('' == locate_template($templates, true)) |
|
46 | - load_template( ABSPATH . WPINC . '/theme-compat/header.php'); |
|
47 | -} |
|
46 | + if ('' == locate_template($templates, true)) { |
|
47 | + load_template( ABSPATH . WPINC . '/theme-compat/header.php'); |
|
48 | + } |
|
49 | + } |
|
48 | 50 | |
49 | 51 | /** |
50 | 52 | * Load footer template. |
@@ -76,15 +78,17 @@ discard block |
||
76 | 78 | |
77 | 79 | $templates = array(); |
78 | 80 | $name = (string) $name; |
79 | - if ( '' !== $name ) |
|
80 | - $templates[] = "footer-{$name}.php"; |
|
81 | + if ( '' !== $name ) { |
|
82 | + $templates[] = "footer-{$name}.php"; |
|
83 | + } |
|
81 | 84 | |
82 | 85 | $templates[] = 'footer.php'; |
83 | 86 | |
84 | 87 | // Backward compat code will be removed in a future release |
85 | - if ('' == locate_template($templates, true)) |
|
86 | - load_template( ABSPATH . WPINC . '/theme-compat/footer.php'); |
|
87 | -} |
|
88 | + if ('' == locate_template($templates, true)) { |
|
89 | + load_template( ABSPATH . WPINC . '/theme-compat/footer.php'); |
|
90 | + } |
|
91 | + } |
|
88 | 92 | |
89 | 93 | /** |
90 | 94 | * Load sidebar template. |
@@ -116,15 +120,17 @@ discard block |
||
116 | 120 | |
117 | 121 | $templates = array(); |
118 | 122 | $name = (string) $name; |
119 | - if ( '' !== $name ) |
|
120 | - $templates[] = "sidebar-{$name}.php"; |
|
123 | + if ( '' !== $name ) { |
|
124 | + $templates[] = "sidebar-{$name}.php"; |
|
125 | + } |
|
121 | 126 | |
122 | 127 | $templates[] = 'sidebar.php'; |
123 | 128 | |
124 | 129 | // Backward compat code will be removed in a future release |
125 | - if ('' == locate_template($templates, true)) |
|
126 | - load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php'); |
|
127 | -} |
|
130 | + if ('' == locate_template($templates, true)) { |
|
131 | + load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php'); |
|
132 | + } |
|
133 | + } |
|
128 | 134 | |
129 | 135 | /** |
130 | 136 | * Load a template part into a template |
@@ -163,8 +169,9 @@ discard block |
||
163 | 169 | |
164 | 170 | $templates = array(); |
165 | 171 | $name = (string) $name; |
166 | - if ( '' !== $name ) |
|
167 | - $templates[] = "{$slug}-{$name}.php"; |
|
172 | + if ( '' !== $name ) { |
|
173 | + $templates[] = "{$slug}-{$name}.php"; |
|
174 | + } |
|
168 | 175 | |
169 | 176 | $templates[] = "{$slug}.php"; |
170 | 177 | |
@@ -250,14 +257,16 @@ discard block |
||
250 | 257 | */ |
251 | 258 | $result = apply_filters( 'get_search_form', $form ); |
252 | 259 | |
253 | - if ( null === $result ) |
|
254 | - $result = $form; |
|
260 | + if ( null === $result ) { |
|
261 | + $result = $form; |
|
262 | + } |
|
255 | 263 | |
256 | - if ( $echo ) |
|
257 | - echo $result; |
|
258 | - else |
|
259 | - return $result; |
|
260 | -} |
|
264 | + if ( $echo ) { |
|
265 | + echo $result; |
|
266 | + } else { |
|
267 | + return $result; |
|
268 | + } |
|
269 | + } |
|
261 | 270 | |
262 | 271 | /** |
263 | 272 | * Display the Log In/Out link. |
@@ -272,10 +281,11 @@ discard block |
||
272 | 281 | * @return string|void String when retrieving. |
273 | 282 | */ |
274 | 283 | function wp_loginout($redirect = '', $echo = true) { |
275 | - if ( ! is_user_logged_in() ) |
|
276 | - $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; |
|
277 | - else |
|
278 | - $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>'; |
|
284 | + if ( ! is_user_logged_in() ) { |
|
285 | + $link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>'; |
|
286 | + } else { |
|
287 | + $link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>'; |
|
288 | + } |
|
279 | 289 | |
280 | 290 | if ( $echo ) { |
281 | 291 | /** |
@@ -334,11 +344,13 @@ discard block |
||
334 | 344 | function wp_login_url($redirect = '', $force_reauth = false) { |
335 | 345 | $login_url = site_url('wp-login.php', 'login'); |
336 | 346 | |
337 | - if ( !empty($redirect) ) |
|
338 | - $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); |
|
347 | + if ( !empty($redirect) ) { |
|
348 | + $login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url); |
|
349 | + } |
|
339 | 350 | |
340 | - if ( $force_reauth ) |
|
341 | - $login_url = add_query_arg('reauth', '1', $login_url); |
|
351 | + if ( $force_reauth ) { |
|
352 | + $login_url = add_query_arg('reauth', '1', $login_url); |
|
353 | + } |
|
342 | 354 | |
343 | 355 | /** |
344 | 356 | * Filter the login URL. |
@@ -466,11 +478,12 @@ discard block |
||
466 | 478 | ' . $login_form_bottom . ' |
467 | 479 | </form>'; |
468 | 480 | |
469 | - if ( $args['echo'] ) |
|
470 | - echo $form; |
|
471 | - else |
|
472 | - return $form; |
|
473 | -} |
|
481 | + if ( $args['echo'] ) { |
|
482 | + echo $form; |
|
483 | + } else { |
|
484 | + return $form; |
|
485 | + } |
|
486 | + } |
|
474 | 487 | |
475 | 488 | /** |
476 | 489 | * Returns the URL that allows the user to retrieve the lost password |
@@ -514,10 +527,11 @@ discard block |
||
514 | 527 | */ |
515 | 528 | function wp_register( $before = '<li>', $after = '</li>', $echo = true ) { |
516 | 529 | if ( ! is_user_logged_in() ) { |
517 | - if ( get_option('users_can_register') ) |
|
518 | - $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after; |
|
519 | - else |
|
520 | - $link = ''; |
|
530 | + if ( get_option('users_can_register') ) { |
|
531 | + $link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after; |
|
532 | + } else { |
|
533 | + $link = ''; |
|
534 | + } |
|
521 | 535 | } else { |
522 | 536 | $link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after; |
523 | 537 | } |
@@ -655,7 +669,9 @@ discard block |
||
655 | 669 | break; |
656 | 670 | case 'charset': |
657 | 671 | $output = get_option('blog_charset'); |
658 | - if ('' == $output) $output = 'UTF-8'; |
|
672 | + if ('' == $output) { |
|
673 | + $output = 'UTF-8'; |
|
674 | + } |
|
659 | 675 | break; |
660 | 676 | case 'html_type' : |
661 | 677 | $output = get_option('html_type'); |
@@ -691,8 +707,9 @@ discard block |
||
691 | 707 | $url = true; |
692 | 708 | if (strpos($show, 'url') === false && |
693 | 709 | strpos($show, 'directory') === false && |
694 | - strpos($show, 'home') === false) |
|
695 | - $url = false; |
|
710 | + strpos($show, 'home') === false) { |
|
711 | + $url = false; |
|
712 | + } |
|
696 | 713 | |
697 | 714 | if ( 'display' == $filter ) { |
698 | 715 | if ( $url ) { |
@@ -840,11 +857,13 @@ discard block |
||
840 | 857 | // If there's a post type archive |
841 | 858 | if ( is_post_type_archive() ) { |
842 | 859 | $post_type = get_query_var( 'post_type' ); |
843 | - if ( is_array( $post_type ) ) |
|
844 | - $post_type = reset( $post_type ); |
|
860 | + if ( is_array( $post_type ) ) { |
|
861 | + $post_type = reset( $post_type ); |
|
862 | + } |
|
845 | 863 | $post_type_object = get_post_type_object( $post_type ); |
846 | - if ( ! $post_type_object->has_archive ) |
|
847 | - $title = post_type_archive_title( '', false ); |
|
864 | + if ( ! $post_type_object->has_archive ) { |
|
865 | + $title = post_type_archive_title( '', false ); |
|
866 | + } |
|
848 | 867 | } |
849 | 868 | |
850 | 869 | // If there's a category or tag |
@@ -864,13 +883,15 @@ discard block |
||
864 | 883 | // If there's an author |
865 | 884 | if ( is_author() && ! is_post_type_archive() ) { |
866 | 885 | $author = get_queried_object(); |
867 | - if ( $author ) |
|
868 | - $title = $author->display_name; |
|
886 | + if ( $author ) { |
|
887 | + $title = $author->display_name; |
|
888 | + } |
|
869 | 889 | } |
870 | 890 | |
871 | 891 | // Post type archives with has_archive should override terms. |
872 | - if ( is_post_type_archive() && $post_type_object->has_archive ) |
|
873 | - $title = post_type_archive_title( '', false ); |
|
892 | + if ( is_post_type_archive() && $post_type_object->has_archive ) { |
|
893 | + $title = post_type_archive_title( '', false ); |
|
894 | + } |
|
874 | 895 | |
875 | 896 | // If there's a month |
876 | 897 | if ( is_archive() && !empty($m) ) { |
@@ -883,10 +904,12 @@ discard block |
||
883 | 904 | // If there's a year |
884 | 905 | if ( is_archive() && !empty($year) ) { |
885 | 906 | $title = $year; |
886 | - if ( !empty($monthnum) ) |
|
887 | - $title .= $t_sep . $wp_locale->get_month($monthnum); |
|
888 | - if ( !empty($day) ) |
|
889 | - $title .= $t_sep . zeroise($day, 2); |
|
907 | + if ( !empty($monthnum) ) { |
|
908 | + $title .= $t_sep . $wp_locale->get_month($monthnum); |
|
909 | + } |
|
910 | + if ( !empty($day) ) { |
|
911 | + $title .= $t_sep . zeroise($day, 2); |
|
912 | + } |
|
890 | 913 | } |
891 | 914 | |
892 | 915 | // If it's a search |
@@ -901,8 +924,9 @@ discard block |
||
901 | 924 | } |
902 | 925 | |
903 | 926 | $prefix = ''; |
904 | - if ( !empty($title) ) |
|
905 | - $prefix = " $sep "; |
|
927 | + if ( !empty($title) ) { |
|
928 | + $prefix = " $sep "; |
|
929 | + } |
|
906 | 930 | |
907 | 931 | /** |
908 | 932 | * Filter the parts of the page title. |
@@ -946,10 +970,11 @@ discard block |
||
946 | 970 | $title = apply_filters( 'wp_title', $title, $sep, $seplocation ); |
947 | 971 | |
948 | 972 | // Send it out |
949 | - if ( $display ) |
|
950 | - echo $title; |
|
951 | - else |
|
952 | - return $title; |
|
973 | + if ( $display ) { |
|
974 | + echo $title; |
|
975 | + } else { |
|
976 | + return $title; |
|
977 | + } |
|
953 | 978 | |
954 | 979 | } |
955 | 980 | |
@@ -972,8 +997,9 @@ discard block |
||
972 | 997 | function single_post_title( $prefix = '', $display = true ) { |
973 | 998 | $_post = get_queried_object(); |
974 | 999 | |
975 | - if ( !isset($_post->post_title) ) |
|
976 | - return; |
|
1000 | + if ( !isset($_post->post_title) ) { |
|
1001 | + return; |
|
1002 | + } |
|
977 | 1003 | |
978 | 1004 | /** |
979 | 1005 | * Filter the page title for a single post. |
@@ -984,11 +1010,12 @@ discard block |
||
984 | 1010 | * @param object $_post The current queried object as returned by get_queried_object(). |
985 | 1011 | */ |
986 | 1012 | $title = apply_filters( 'single_post_title', $_post->post_title, $_post ); |
987 | - if ( $display ) |
|
988 | - echo $prefix . $title; |
|
989 | - else |
|
990 | - return $prefix . $title; |
|
991 | -} |
|
1013 | + if ( $display ) { |
|
1014 | + echo $prefix . $title; |
|
1015 | + } else { |
|
1016 | + return $prefix . $title; |
|
1017 | + } |
|
1018 | + } |
|
992 | 1019 | |
993 | 1020 | /** |
994 | 1021 | * Display or retrieve title for a post type archive. |
@@ -1003,12 +1030,14 @@ discard block |
||
1003 | 1030 | * @return string|void Title when retrieving, null when displaying or failure. |
1004 | 1031 | */ |
1005 | 1032 | function post_type_archive_title( $prefix = '', $display = true ) { |
1006 | - if ( ! is_post_type_archive() ) |
|
1007 | - return; |
|
1033 | + if ( ! is_post_type_archive() ) { |
|
1034 | + return; |
|
1035 | + } |
|
1008 | 1036 | |
1009 | 1037 | $post_type = get_query_var( 'post_type' ); |
1010 | - if ( is_array( $post_type ) ) |
|
1011 | - $post_type = reset( $post_type ); |
|
1038 | + if ( is_array( $post_type ) ) { |
|
1039 | + $post_type = reset( $post_type ); |
|
1040 | + } |
|
1012 | 1041 | |
1013 | 1042 | $post_type_obj = get_post_type_object( $post_type ); |
1014 | 1043 | |
@@ -1022,11 +1051,12 @@ discard block |
||
1022 | 1051 | */ |
1023 | 1052 | $title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type ); |
1024 | 1053 | |
1025 | - if ( $display ) |
|
1026 | - echo $prefix . $title; |
|
1027 | - else |
|
1028 | - return $prefix . $title; |
|
1029 | -} |
|
1054 | + if ( $display ) { |
|
1055 | + echo $prefix . $title; |
|
1056 | + } else { |
|
1057 | + return $prefix . $title; |
|
1058 | + } |
|
1059 | + } |
|
1030 | 1060 | |
1031 | 1061 | /** |
1032 | 1062 | * Display or retrieve page title for category archive. |
@@ -1090,8 +1120,9 @@ discard block |
||
1090 | 1120 | function single_term_title( $prefix = '', $display = true ) { |
1091 | 1121 | $term = get_queried_object(); |
1092 | 1122 | |
1093 | - if ( !$term ) |
|
1094 | - return; |
|
1123 | + if ( !$term ) { |
|
1124 | + return; |
|
1125 | + } |
|
1095 | 1126 | |
1096 | 1127 | if ( is_category() ) { |
1097 | 1128 | /** |
@@ -1124,14 +1155,16 @@ discard block |
||
1124 | 1155 | return; |
1125 | 1156 | } |
1126 | 1157 | |
1127 | - if ( empty( $term_name ) ) |
|
1128 | - return; |
|
1158 | + if ( empty( $term_name ) ) { |
|
1159 | + return; |
|
1160 | + } |
|
1129 | 1161 | |
1130 | - if ( $display ) |
|
1131 | - echo $prefix . $term_name; |
|
1132 | - else |
|
1133 | - return $prefix . $term_name; |
|
1134 | -} |
|
1162 | + if ( $display ) { |
|
1163 | + echo $prefix . $term_name; |
|
1164 | + } else { |
|
1165 | + return $prefix . $term_name; |
|
1166 | + } |
|
1167 | + } |
|
1135 | 1168 | |
1136 | 1169 | /** |
1137 | 1170 | * Display or retrieve page title for post archive based on date. |
@@ -1168,13 +1201,15 @@ discard block |
||
1168 | 1201 | $my_month = $wp_locale->get_month(substr($m, 4, 2)); |
1169 | 1202 | } |
1170 | 1203 | |
1171 | - if ( empty($my_month) ) |
|
1172 | - return false; |
|
1204 | + if ( empty($my_month) ) { |
|
1205 | + return false; |
|
1206 | + } |
|
1173 | 1207 | |
1174 | 1208 | $result = $prefix . $my_month . $prefix . $my_year; |
1175 | 1209 | |
1176 | - if ( !$display ) |
|
1177 | - return $result; |
|
1210 | + if ( !$display ) { |
|
1211 | + return $result; |
|
1212 | + } |
|
1178 | 1213 | echo $result; |
1179 | 1214 | } |
1180 | 1215 | |
@@ -1332,14 +1367,16 @@ discard block |
||
1332 | 1367 | $text = wptexturize($text); |
1333 | 1368 | $url = esc_url($url); |
1334 | 1369 | |
1335 | - if ('link' == $format) |
|
1336 | - $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
|
1337 | - elseif ('option' == $format) |
|
1338 | - $link_html = "\t<option value='$url'>$before $text $after</option>\n"; |
|
1339 | - elseif ('html' == $format) |
|
1340 | - $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
|
1341 | - else // custom |
|
1370 | + if ('link' == $format) { |
|
1371 | + $link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n"; |
|
1372 | + } elseif ('option' == $format) { |
|
1373 | + $link_html = "\t<option value='$url'>$before $text $after</option>\n"; |
|
1374 | + } elseif ('html' == $format) { |
|
1375 | + $link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n"; |
|
1376 | + } else { |
|
1377 | + // custom |
|
1342 | 1378 | $link_html = "\t$before<a href='$url'>$text</a>$after\n"; |
1379 | + } |
|
1343 | 1380 | |
1344 | 1381 | /** |
1345 | 1382 | * Filter the archive link content. |
@@ -1626,8 +1663,9 @@ discard block |
||
1626 | 1663 | } |
1627 | 1664 | } |
1628 | 1665 | |
1629 | - if ( !is_array($cache) ) |
|
1630 | - $cache = array(); |
|
1666 | + if ( !is_array($cache) ) { |
|
1667 | + $cache = array(); |
|
1668 | + } |
|
1631 | 1669 | |
1632 | 1670 | // Quick check. If we have no posts at all, abort! |
1633 | 1671 | if ( !$posts ) { |
@@ -1639,8 +1677,9 @@ discard block |
||
1639 | 1677 | } |
1640 | 1678 | } |
1641 | 1679 | |
1642 | - if ( isset($_GET['w']) ) |
|
1643 | - $w = ''.intval($_GET['w']); |
|
1680 | + if ( isset($_GET['w']) ) { |
|
1681 | + $w = ''.intval($_GET['w']); |
|
1682 | + } |
|
1644 | 1683 | |
1645 | 1684 | // week_begins = 0 stands for Sunday |
1646 | 1685 | $week_begins = intval(get_option('start_of_week')); |
@@ -1656,10 +1695,11 @@ discard block |
||
1656 | 1695 | $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')"); |
1657 | 1696 | } elseif ( !empty($m) ) { |
1658 | 1697 | $thisyear = ''.intval(substr($m, 0, 4)); |
1659 | - if ( strlen($m) < 6 ) |
|
1660 | - $thismonth = '01'; |
|
1661 | - else |
|
1662 | - $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); |
|
1698 | + if ( strlen($m) < 6 ) { |
|
1699 | + $thismonth = '01'; |
|
1700 | + } else { |
|
1701 | + $thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2); |
|
1702 | + } |
|
1663 | 1703 | } else { |
1664 | 1704 | $thisyear = gmdate('Y', current_time('timestamp')); |
1665 | 1705 | $thismonth = gmdate('m', current_time('timestamp')); |
@@ -1742,10 +1782,11 @@ discard block |
||
1742 | 1782 | } |
1743 | 1783 | } |
1744 | 1784 | |
1745 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) |
|
1746 | - $ak_title_separator = "\n"; |
|
1747 | - else |
|
1748 | - $ak_title_separator = ', '; |
|
1785 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) { |
|
1786 | + $ak_title_separator = "\n"; |
|
1787 | + } else { |
|
1788 | + $ak_title_separator = ', '; |
|
1789 | + } |
|
1749 | 1790 | |
1750 | 1791 | $ak_titles_for_day = array(); |
1751 | 1792 | $ak_post_titles = $wpdb->get_results("SELECT ID, post_title, DAYOFMONTH(post_date) as dom " |
@@ -1760,44 +1801,54 @@ discard block |
||
1760 | 1801 | /** This filter is documented in wp-includes/post-template.php */ |
1761 | 1802 | $post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) ); |
1762 | 1803 | |
1763 | - if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) ) |
|
1764 | - $ak_titles_for_day['day_'.$ak_post_title->dom] = ''; |
|
1765 | - if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one |
|
1804 | + if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) ) { |
|
1805 | + $ak_titles_for_day['day_'.$ak_post_title->dom] = ''; |
|
1806 | + } |
|
1807 | + if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) { |
|
1808 | + // first one |
|
1766 | 1809 | $ak_titles_for_day["$ak_post_title->dom"] = $post_title; |
1767 | - else |
|
1768 | - $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title; |
|
1810 | + } else { |
|
1811 | + $ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title; |
|
1812 | + } |
|
1769 | 1813 | } |
1770 | 1814 | } |
1771 | 1815 | |
1772 | 1816 | // See how much we should pad in the beginning |
1773 | 1817 | $pad = calendar_week_mod(date('w', $unixmonth)-$week_begins); |
1774 | - if ( 0 != $pad ) |
|
1775 | - $calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad"> </td>'; |
|
1818 | + if ( 0 != $pad ) { |
|
1819 | + $calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad"> </td>'; |
|
1820 | + } |
|
1776 | 1821 | |
1777 | 1822 | $daysinmonth = intval(date('t', $unixmonth)); |
1778 | 1823 | for ( $day = 1; $day <= $daysinmonth; ++$day ) { |
1779 | - if ( isset($newrow) && $newrow ) |
|
1780 | - $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; |
|
1824 | + if ( isset($newrow) && $newrow ) { |
|
1825 | + $calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t"; |
|
1826 | + } |
|
1781 | 1827 | $newrow = false; |
1782 | 1828 | |
1783 | - if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) |
|
1784 | - $calendar_output .= '<td id="today">'; |
|
1785 | - else |
|
1786 | - $calendar_output .= '<td>'; |
|
1829 | + if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) ) { |
|
1830 | + $calendar_output .= '<td id="today">'; |
|
1831 | + } else { |
|
1832 | + $calendar_output .= '<td>'; |
|
1833 | + } |
|
1787 | 1834 | |
1788 | - if ( in_array($day, $daywithpost) ) // any posts today? |
|
1835 | + if ( in_array($day, $daywithpost) ) { |
|
1836 | + // any posts today? |
|
1789 | 1837 | $calendar_output .= '<a href="' . get_day_link( $thisyear, $thismonth, $day ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>"; |
1790 | - else |
|
1791 | - $calendar_output .= $day; |
|
1838 | + } else { |
|
1839 | + $calendar_output .= $day; |
|
1840 | + } |
|
1792 | 1841 | $calendar_output .= '</td>'; |
1793 | 1842 | |
1794 | - if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) ) |
|
1795 | - $newrow = true; |
|
1843 | + if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) ) { |
|
1844 | + $newrow = true; |
|
1845 | + } |
|
1796 | 1846 | } |
1797 | 1847 | |
1798 | 1848 | $pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins); |
1799 | - if ( $pad != 0 && $pad != 7 ) |
|
1800 | - $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'"> </td>'; |
|
1849 | + if ( $pad != 0 && $pad != 7 ) { |
|
1850 | + $calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'"> </td>'; |
|
1851 | + } |
|
1801 | 1852 | |
1802 | 1853 | $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>"; |
1803 | 1854 | |
@@ -1911,10 +1962,11 @@ discard block |
||
1911 | 1962 | */ |
1912 | 1963 | $the_date = apply_filters( 'the_date', $the_date, $d, $before, $after ); |
1913 | 1964 | |
1914 | - if ( $echo ) |
|
1915 | - echo $the_date; |
|
1916 | - else |
|
1917 | - return $the_date; |
|
1965 | + if ( $echo ) { |
|
1966 | + echo $the_date; |
|
1967 | + } else { |
|
1968 | + return $the_date; |
|
1969 | + } |
|
1918 | 1970 | } |
1919 | 1971 | } |
1920 | 1972 | |
@@ -1983,10 +2035,11 @@ discard block |
||
1983 | 2035 | */ |
1984 | 2036 | $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after ); |
1985 | 2037 | |
1986 | - if ( $echo ) |
|
1987 | - echo $the_modified_date; |
|
1988 | - else |
|
1989 | - return $the_modified_date; |
|
2038 | + if ( $echo ) { |
|
2039 | + echo $the_modified_date; |
|
2040 | + } else { |
|
2041 | + return $the_modified_date; |
|
2042 | + } |
|
1990 | 2043 | |
1991 | 2044 | } |
1992 | 2045 | |
@@ -1999,10 +2052,11 @@ discard block |
||
1999 | 2052 | * @return string |
2000 | 2053 | */ |
2001 | 2054 | function get_the_modified_date($d = '') { |
2002 | - if ( '' == $d ) |
|
2003 | - $the_time = get_post_modified_time(get_option('date_format'), null, null, true); |
|
2004 | - else |
|
2005 | - $the_time = get_post_modified_time($d, null, null, true); |
|
2055 | + if ( '' == $d ) { |
|
2056 | + $the_time = get_post_modified_time(get_option('date_format'), null, null, true); |
|
2057 | + } else { |
|
2058 | + $the_time = get_post_modified_time($d, null, null, true); |
|
2059 | + } |
|
2006 | 2060 | |
2007 | 2061 | /** |
2008 | 2062 | * Filter the date a post was last modified. |
@@ -2054,10 +2108,11 @@ discard block |
||
2054 | 2108 | return false; |
2055 | 2109 | } |
2056 | 2110 | |
2057 | - if ( '' == $d ) |
|
2058 | - $the_time = get_post_time(get_option('time_format'), false, $post, true); |
|
2059 | - else |
|
2060 | - $the_time = get_post_time($d, false, $post, true); |
|
2111 | + if ( '' == $d ) { |
|
2112 | + $the_time = get_post_time(get_option('time_format'), false, $post, true); |
|
2113 | + } else { |
|
2114 | + $the_time = get_post_time($d, false, $post, true); |
|
2115 | + } |
|
2061 | 2116 | |
2062 | 2117 | /** |
2063 | 2118 | * Filter the time a post was written. |
@@ -2092,10 +2147,11 @@ discard block |
||
2092 | 2147 | return false; |
2093 | 2148 | } |
2094 | 2149 | |
2095 | - if ( $gmt ) |
|
2096 | - $time = $post->post_date_gmt; |
|
2097 | - else |
|
2098 | - $time = $post->post_date; |
|
2150 | + if ( $gmt ) { |
|
2151 | + $time = $post->post_date_gmt; |
|
2152 | + } else { |
|
2153 | + $time = $post->post_date; |
|
2154 | + } |
|
2099 | 2155 | |
2100 | 2156 | $time = mysql2date($d, $time, $translate); |
2101 | 2157 | |
@@ -2142,10 +2198,11 @@ discard block |
||
2142 | 2198 | * @return string |
2143 | 2199 | */ |
2144 | 2200 | function get_the_modified_time($d = '') { |
2145 | - if ( '' == $d ) |
|
2146 | - $the_time = get_post_modified_time(get_option('time_format'), null, null, true); |
|
2147 | - else |
|
2148 | - $the_time = get_post_modified_time($d, null, null, true); |
|
2201 | + if ( '' == $d ) { |
|
2202 | + $the_time = get_post_modified_time(get_option('time_format'), null, null, true); |
|
2203 | + } else { |
|
2204 | + $the_time = get_post_modified_time($d, null, null, true); |
|
2205 | + } |
|
2149 | 2206 | |
2150 | 2207 | /** |
2151 | 2208 | * Filter the localized time a post was last modified. |
@@ -2179,10 +2236,11 @@ discard block |
||
2179 | 2236 | return false; |
2180 | 2237 | } |
2181 | 2238 | |
2182 | - if ( $gmt ) |
|
2183 | - $time = $post->post_modified_gmt; |
|
2184 | - else |
|
2185 | - $time = $post->post_modified; |
|
2239 | + if ( $gmt ) { |
|
2240 | + $time = $post->post_modified_gmt; |
|
2241 | + } else { |
|
2242 | + $time = $post->post_modified; |
|
2243 | + } |
|
2186 | 2244 | $time = mysql2date($d, $time, $translate); |
2187 | 2245 | |
2188 | 2246 | /** |
@@ -2292,8 +2350,9 @@ discard block |
||
2292 | 2350 | * @param array $args Optional arguments. |
2293 | 2351 | */ |
2294 | 2352 | function feed_links( $args = array() ) { |
2295 | - if ( !current_theme_supports('automatic-feed-links') ) |
|
2296 | - return; |
|
2353 | + if ( !current_theme_supports('automatic-feed-links') ) { |
|
2354 | + return; |
|
2355 | + } |
|
2297 | 2356 | |
2298 | 2357 | $defaults = array( |
2299 | 2358 | /* translators: Separator between blog name and feed type in feed links */ |
@@ -2347,8 +2406,9 @@ discard block |
||
2347 | 2406 | } |
2348 | 2407 | } elseif ( is_post_type_archive() ) { |
2349 | 2408 | $post_type = get_query_var( 'post_type' ); |
2350 | - if ( is_array( $post_type ) ) |
|
2351 | - $post_type = reset( $post_type ); |
|
2409 | + if ( is_array( $post_type ) ) { |
|
2410 | + $post_type = reset( $post_type ); |
|
2411 | + } |
|
2352 | 2412 | |
2353 | 2413 | $post_type_obj = get_post_type_object( $post_type ); |
2354 | 2414 | $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); |
@@ -2378,13 +2438,15 @@ discard block |
||
2378 | 2438 | } elseif ( is_post_type_archive() ) { |
2379 | 2439 | $title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) ); |
2380 | 2440 | $post_type_obj = get_queried_object(); |
2381 | - if ( $post_type_obj ) |
|
2382 | - $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
|
2441 | + if ( $post_type_obj ) { |
|
2442 | + $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
|
2443 | + } |
|
2383 | 2444 | } |
2384 | 2445 | |
2385 | - if ( isset($title) && isset($href) ) |
|
2386 | - echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
|
2387 | -} |
|
2446 | + if ( isset($title) && isset($href) ) { |
|
2447 | + echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n"; |
|
2448 | + } |
|
2449 | + } |
|
2388 | 2450 | |
2389 | 2451 | /** |
2390 | 2452 | * Display the link to the Really Simple Discovery service endpoint. |
@@ -2420,9 +2482,10 @@ discard block |
||
2420 | 2482 | */ |
2421 | 2483 | function noindex() { |
2422 | 2484 | // If the blog is not public, tell robots to go away. |
2423 | - if ( '0' == get_option('blog_public') ) |
|
2424 | - wp_no_robots(); |
|
2425 | -} |
|
2485 | + if ( '0' == get_option('blog_public') ) { |
|
2486 | + wp_no_robots(); |
|
2487 | + } |
|
2488 | + } |
|
2426 | 2489 | |
2427 | 2490 | /** |
2428 | 2491 | * Display a noindex meta tag. |
@@ -2559,8 +2622,9 @@ discard block |
||
2559 | 2622 | * @param array $settings See _WP_Editors::editor(). |
2560 | 2623 | */ |
2561 | 2624 | function wp_editor( $content, $editor_id, $settings = array() ) { |
2562 | - if ( ! class_exists( '_WP_Editors' ) ) |
|
2563 | - require( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
2625 | + if ( ! class_exists( '_WP_Editors' ) ) { |
|
2626 | + require( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
2627 | + } |
|
2564 | 2628 | |
2565 | 2629 | _WP_Editors::editor($content, $editor_id, $settings); |
2566 | 2630 | } |
@@ -2587,8 +2651,9 @@ discard block |
||
2587 | 2651 | */ |
2588 | 2652 | $query = apply_filters( 'get_search_query', get_query_var( 's' ) ); |
2589 | 2653 | |
2590 | - if ( $escaped ) |
|
2591 | - $query = esc_attr( $query ); |
|
2654 | + if ( $escaped ) { |
|
2655 | + $query = esc_attr( $query ); |
|
2656 | + } |
|
2592 | 2657 | return $query; |
2593 | 2658 | } |
2594 | 2659 | |
@@ -2624,15 +2689,18 @@ discard block |
||
2624 | 2689 | function get_language_attributes( $doctype = 'html' ) { |
2625 | 2690 | $attributes = array(); |
2626 | 2691 | |
2627 | - if ( function_exists( 'is_rtl' ) && is_rtl() ) |
|
2628 | - $attributes[] = 'dir="rtl"'; |
|
2692 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
2693 | + $attributes[] = 'dir="rtl"'; |
|
2694 | + } |
|
2629 | 2695 | |
2630 | 2696 | if ( $lang = get_bloginfo('language') ) { |
2631 | - if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) |
|
2632 | - $attributes[] = "lang=\"$lang\""; |
|
2697 | + if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) { |
|
2698 | + $attributes[] = "lang=\"$lang\""; |
|
2699 | + } |
|
2633 | 2700 | |
2634 | - if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) |
|
2635 | - $attributes[] = "xml:lang=\"$lang\""; |
|
2701 | + if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) { |
|
2702 | + $attributes[] = "xml:lang=\"$lang\""; |
|
2703 | + } |
|
2636 | 2704 | } |
2637 | 2705 | |
2638 | 2706 | $output = implode(' ', $attributes); |
@@ -2821,8 +2889,9 @@ discard block |
||
2821 | 2889 | if ( $args['prev_next'] && $current && 1 < $current ) : |
2822 | 2890 | $link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] ); |
2823 | 2891 | $link = str_replace( '%#%', $current - 1, $link ); |
2824 | - if ( $add_args ) |
|
2825 | - $link = add_query_arg( $add_args, $link ); |
|
2892 | + if ( $add_args ) { |
|
2893 | + $link = add_query_arg( $add_args, $link ); |
|
2894 | + } |
|
2826 | 2895 | $link .= $args['add_fragment']; |
2827 | 2896 | |
2828 | 2897 | /** |
@@ -2838,12 +2907,15 @@ discard block |
||
2838 | 2907 | if ( $n == $current ) : |
2839 | 2908 | $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; |
2840 | 2909 | $dots = true; |
2841 | - else : |
|
2910 | + else { |
|
2911 | + : |
|
2842 | 2912 | if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
2843 | 2913 | $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
2914 | + } |
|
2844 | 2915 | $link = str_replace( '%#%', $n, $link ); |
2845 | - if ( $add_args ) |
|
2846 | - $link = add_query_arg( $add_args, $link ); |
|
2916 | + if ( $add_args ) { |
|
2917 | + $link = add_query_arg( $add_args, $link ); |
|
2918 | + } |
|
2847 | 2919 | $link .= $args['add_fragment']; |
2848 | 2920 | |
2849 | 2921 | /** This filter is documented in wp-includes/general-template.php */ |
@@ -2858,8 +2930,9 @@ discard block |
||
2858 | 2930 | if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) : |
2859 | 2931 | $link = str_replace( '%_%', $args['format'], $args['base'] ); |
2860 | 2932 | $link = str_replace( '%#%', $current + 1, $link ); |
2861 | - if ( $add_args ) |
|
2862 | - $link = add_query_arg( $add_args, $link ); |
|
2933 | + if ( $add_args ) { |
|
2934 | + $link = add_query_arg( $add_args, $link ); |
|
2935 | + } |
|
2863 | 2936 | $link .= $args['add_fragment']; |
2864 | 2937 | |
2865 | 2938 | /** This filter is documented in wp-includes/general-template.php */ |
@@ -2906,8 +2979,9 @@ discard block |
||
2906 | 2979 | function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) { |
2907 | 2980 | global $_wp_admin_css_colors; |
2908 | 2981 | |
2909 | - if ( !isset($_wp_admin_css_colors) ) |
|
2910 | - $_wp_admin_css_colors = array(); |
|
2982 | + if ( !isset($_wp_admin_css_colors) ) { |
|
2983 | + $_wp_admin_css_colors = array(); |
|
2984 | + } |
|
2911 | 2985 | |
2912 | 2986 | $_wp_admin_css_colors[$key] = (object) array( |
2913 | 2987 | 'name' => $name, |
@@ -2935,8 +3009,9 @@ discard block |
||
2935 | 3009 | ); |
2936 | 3010 | |
2937 | 3011 | // Other color schemes are not available when running out of src |
2938 | - if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) ) |
|
2939 | - return; |
|
3012 | + if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) ) { |
|
3013 | + return; |
|
3014 | + } |
|
2940 | 3015 | |
2941 | 3016 | wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), |
2942 | 3017 | admin_url( "css/colors/light/colors$suffix.css" ), |
@@ -3036,10 +3111,13 @@ discard block |
||
3036 | 3111 | $handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file; |
3037 | 3112 | |
3038 | 3113 | if ( wp_styles()->query( $handle ) ) { |
3039 | - if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately |
|
3114 | + if ( $force_echo || did_action( 'wp_print_styles' ) ) { |
|
3115 | + // we already printed the style queue. Print this one immediately |
|
3040 | 3116 | wp_print_styles( $handle ); |
3041 | - else // Add to style queue |
|
3117 | + } else { |
|
3118 | + // Add to style queue |
|
3042 | 3119 | wp_enqueue_style( $handle ); |
3120 | + } |
|
3043 | 3121 | return; |
3044 | 3122 | } |
3045 | 3123 | |
@@ -3075,9 +3153,10 @@ discard block |
||
3075 | 3153 | wp_enqueue_script( 'thickbox' ); |
3076 | 3154 | wp_enqueue_style( 'thickbox' ); |
3077 | 3155 | |
3078 | - if ( is_network_admin() ) |
|
3079 | - add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); |
|
3080 | -} |
|
3156 | + if ( is_network_admin() ) { |
|
3157 | + add_action( 'admin_head', '_thickbox_path_admin_subfolder' ); |
|
3158 | + } |
|
3159 | + } |
|
3081 | 3160 | |
3082 | 3161 | /** |
3083 | 3162 | * Display the XHTML generator that is generated on the wp_head hook. |
@@ -3134,8 +3213,9 @@ discard block |
||
3134 | 3213 | if ( empty( $type ) ) { |
3135 | 3214 | |
3136 | 3215 | $current_filter = current_filter(); |
3137 | - if ( empty( $current_filter ) ) |
|
3138 | - return; |
|
3216 | + if ( empty( $current_filter ) ) { |
|
3217 | + return; |
|
3218 | + } |
|
3139 | 3219 | |
3140 | 3220 | switch ( $current_filter ) { |
3141 | 3221 | case 'rss2_head' : |
@@ -3258,13 +3338,15 @@ discard block |
||
3258 | 3338 | * @return string html attribute or empty string |
3259 | 3339 | */ |
3260 | 3340 | function __checked_selected_helper( $helper, $current, $echo, $type ) { |
3261 | - if ( (string) $helper === (string) $current ) |
|
3262 | - $result = " $type='$type'"; |
|
3263 | - else |
|
3264 | - $result = ''; |
|
3341 | + if ( (string) $helper === (string) $current ) { |
|
3342 | + $result = " $type='$type'"; |
|
3343 | + } else { |
|
3344 | + $result = ''; |
|
3345 | + } |
|
3265 | 3346 | |
3266 | - if ( $echo ) |
|
3267 | - echo $result; |
|
3347 | + if ( $echo ) { |
|
3348 | + echo $result; |
|
3349 | + } |
|
3268 | 3350 | |
3269 | 3351 | return $result; |
3270 | 3352 | } |
@@ -3280,11 +3362,13 @@ discard block |
||
3280 | 3362 | * @return array $settings |
3281 | 3363 | */ |
3282 | 3364 | function wp_heartbeat_settings( $settings ) { |
3283 | - if ( ! is_admin() ) |
|
3284 | - $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); |
|
3365 | + if ( ! is_admin() ) { |
|
3366 | + $settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' ); |
|
3367 | + } |
|
3285 | 3368 | |
3286 | - if ( is_user_logged_in() ) |
|
3287 | - $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); |
|
3369 | + if ( is_user_logged_in() ) { |
|
3370 | + $settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' ); |
|
3371 | + } |
|
3288 | 3372 | |
3289 | 3373 | return $settings; |
3290 | 3374 | } |
@@ -99,6 +99,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1367,11 +1367,11 @@ |
||
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); |
@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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)) { |
@@ -335,6 +335,10 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1588,8 +1588,8 @@ |
||
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 |
@@ -11,24 +11,24 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) : ''); |
@@ -350,8 +350,7 @@ |
||
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 | } |
@@ -1684,6 +1684,10 @@ |
||
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 |
@@ -19,12 +19,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']); |
@@ -390,6 +390,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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++) { |
@@ -52,25 +52,25 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1289,6 +1289,10 @@ discard block |
||
1289 | 1289 | return true; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | + /** |
|
1293 | + * @param string $type |
|
1294 | + * @param integer $line |
|
1295 | + */ |
|
1292 | 1296 | private function unhandledElement($type, $line, $element) { |
1293 | 1297 | // warn only about unknown and missed elements, not about unuseful |
1294 | 1298 | if (!in_array($element['id'], $this->unuseful_elements)) { |
@@ -1345,6 +1349,9 @@ discard block |
||
1345 | 1349 | return $simpletag_entry; |
1346 | 1350 | } |
1347 | 1351 | |
1352 | + /** |
|
1353 | + * @param integer $block_type |
|
1354 | + */ |
|
1348 | 1355 | private function HandleEMBLClusterBlock($element, $block_type, &$info) { |
1349 | 1356 | // http://www.matroska.org/technical/specs/index.html#block_structure |
1350 | 1357 | // http://www.matroska.org/technical/specs/index.html#simpleblock_structure |
@@ -15,196 +15,196 @@ discard block |
||
15 | 15 | ///////////////////////////////////////////////////////////////// |
16 | 16 | |
17 | 17 | |
18 | -define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | -define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | -define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | -define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | -define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | -define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | -define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | -define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | -define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | -define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | -define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | -define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | -define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | -define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | -define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | -define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | -define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | -define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | -define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | -define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | -define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | -define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | -define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | -define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | -define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | -define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | -define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | -define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | -define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | -define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | -define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | -define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | -define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | -define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | -define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | -define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | -define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | -define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | -define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | -define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | -define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | -define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | -define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | -define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | -define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | -define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | -define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | -define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | -define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | -define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | -define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | -define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | -define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | -define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | -define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | -define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | -define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | -define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | -define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | -define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | -define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | -define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | -define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | -define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | -define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | -define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | -define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | -define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | -define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | -define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | -define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | -define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | -define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | -define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | -define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | -define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | -define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | -define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | -define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | -define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | -define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | -define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | -define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | -define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | -define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | -define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | -define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | -define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | -define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | -define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | -define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | -define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | -define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | -define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | -define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | -define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | -define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | -define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | -define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | -define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | -define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | -define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | -define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | -define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | -define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | -define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | -define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | -define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | -define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | -define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | -define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | -define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | -define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | -define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | -define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | -define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | -define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | -define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | -define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | -define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | -define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | -define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | -define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | -define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | -define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | -define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | -define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | -define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | -define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | -define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | -define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | -define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | -define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | -define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | -define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | -define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | -define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | -define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | -define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | -define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | -define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | -define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | -define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | -define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | -define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | -define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | -define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | -define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | -define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | -define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | -define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | -define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | -define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | -define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | -define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | -define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | -define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | -define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | -define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | -define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | -define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | -define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | -define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | -define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | -define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | -define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | -define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | -define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | -define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | -define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | -define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | -define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | -define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | -define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | -define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | -define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | -define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | -define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | -define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | -define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | -define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | -define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | -define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | -define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | -define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | -define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | -define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | -define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | -define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | -define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
18 | +define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | +define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | +define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | +define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | +define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | +define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | +define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | +define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | +define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | +define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | +define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | +define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | +define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | +define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | +define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | +define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | +define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | +define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | +define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | +define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | +define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | +define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | +define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | +define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | +define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | +define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | +define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | +define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | +define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | +define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | +define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | +define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | +define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | +define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | +define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | +define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | +define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | +define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | +define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | +define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | +define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | +define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | +define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | +define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | +define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | +define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | +define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | +define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | +define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | +define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | +define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | +define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | +define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | +define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | +define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | +define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | +define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | +define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | +define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | +define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | +define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | +define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | +define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | +define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | +define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | +define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | +define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | +define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | +define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | +define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | +define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | +define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | +define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | +define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | +define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | +define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | +define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | +define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | +define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | +define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | +define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | +define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | +define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | +define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | +define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | +define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | +define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | +define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | +define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | +define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | +define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | +define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | +define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | +define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | +define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | +define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | +define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | +define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | +define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | +define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | +define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | +define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | +define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | +define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | +define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | +define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | +define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | +define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | +define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | +define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | +define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | +define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | +define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | +define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | +define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | +define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | +define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | +define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | +define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | +define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | +define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | +define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | +define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | +define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | +define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | +define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | +define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | +define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | +define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | +define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | +define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | +define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | +define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | +define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | +define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | +define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | +define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | +define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | +define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | +define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | +define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | +define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | +define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | +define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | +define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | +define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | +define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | +define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | +define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | +define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | +define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | +define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | +define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | +define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | +define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | +define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | +define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | +define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | +define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | +define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | +define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | +define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | +define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | +define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | +define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | +define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | +define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | +define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | +define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | +define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | +define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | +define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | +define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | +define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | +define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | +define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | +define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | +define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | +define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | +define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | +define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | +define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | +define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | +define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | +define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | +define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | +define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | +define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | +define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | +define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | class getid3_matroska extends getid3_handler |
217 | 217 | { |
218 | 218 | // public options |
219 | - public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
219 | + public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
220 | 220 | public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE] |
221 | 221 | |
222 | 222 | // private parser settings/placeholders |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); |
275 | 275 | |
276 | 276 | if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } |
277 | - if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | - if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | - if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
277 | + if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | + if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | + if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
280 | 280 | if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } |
281 | - if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
281 | + if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
282 | 282 | |
283 | 283 | switch ($trackarray['CodecID']) { |
284 | 284 | case 'V_MS/VFW/FOURCC': |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0); |
321 | 321 | $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1); |
322 | 322 | $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng'); |
323 | - if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
323 | + if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
324 | 324 | if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
325 | 325 | |
326 | 326 | switch ($trackarray['CodecID']) { |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | case 'A_FLAC': |
337 | 337 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, true); |
338 | 338 | |
339 | - if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
339 | + if ( ! isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
340 | 340 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set'); |
341 | 341 | break; |
342 | 342 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | else { |
362 | 362 | $getid3_audio->Analyze(); |
363 | 363 | } |
364 | - if (!empty($getid3_temp->info[$header_data_key])) { |
|
364 | + if ( ! empty($getid3_temp->info[$header_data_key])) { |
|
365 | 365 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key]; |
366 | 366 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
367 | 367 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // copy errors and warnings |
377 | - if (!empty($getid3_temp->info['error'])) { |
|
377 | + if ( ! empty($getid3_temp->info['error'])) { |
|
378 | 378 | foreach ($getid3_temp->info['error'] as $newerror) { |
379 | 379 | $this->warning($class.'() says: ['.$newerror.']'); |
380 | 380 | } |
381 | 381 | } |
382 | - if (!empty($getid3_temp->info['warning'])) { |
|
382 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
383 | 383 | foreach ($getid3_temp->info['warning'] as $newerror) { |
384 | 384 | $this->warning($class.'() says: ['.$newerror.']'); |
385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | break; |
397 | 397 | |
398 | 398 | case 'A_VORBIS': |
399 | - if (!isset($trackarray['CodecPrivate'])) { |
|
399 | + if ( ! isset($trackarray['CodecPrivate'])) { |
|
400 | 400 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set'); |
401 | 401 | break; |
402 | 402 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $getid3_ogg = new getid3_ogg($getid3_temp); |
417 | 417 | $oggpageinfo['page_seqno'] = 0; |
418 | 418 | $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo); |
419 | - if (!empty($getid3_temp->info['ogg'])) { |
|
419 | + if ( ! empty($getid3_temp->info['ogg'])) { |
|
420 | 420 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg']; |
421 | 421 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
422 | 422 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // copy errors and warnings |
429 | - if (!empty($getid3_temp->info['error'])) { |
|
429 | + if ( ! empty($getid3_temp->info['error'])) { |
|
430 | 430 | foreach ($getid3_temp->info['error'] as $newerror) { |
431 | 431 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
432 | 432 | } |
433 | 433 | } |
434 | - if (!empty($getid3_temp->info['warning'])) { |
|
434 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
435 | 435 | foreach ($getid3_temp->info['warning'] as $newerror) { |
436 | 436 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
440 | + if ( ! empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
441 | 441 | $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal']; |
442 | 442 | } |
443 | 443 | unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset); |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - if (!empty($info['video']['streams'])) { |
|
467 | + if ( ! empty($info['video']['streams'])) { |
|
468 | 468 | $info['video'] = self::getDefaultStreamInfo($info['video']['streams']); |
469 | 469 | } |
470 | - if (!empty($info['audio']['streams'])) { |
|
470 | + if ( ! empty($info['audio']['streams'])) { |
|
471 | 471 | $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']); |
472 | 472 | } |
473 | 473 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | // process attachments |
476 | 476 | if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) { |
477 | 477 | foreach ($info['matroska']['attachments'] as $i => $entry) { |
478 | - if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) { |
|
478 | + if (strpos($entry['FileMimeType'], 'image/') === 0 && ! empty($entry['FileData'])) { |
|
479 | 479 | $info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']); |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | 484 | // determine mime type |
485 | - if (!empty($info['video']['streams'])) { |
|
485 | + if ( ! empty($info['video']['streams'])) { |
|
486 | 486 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska'); |
487 | - } elseif (!empty($info['audio']['streams'])) { |
|
487 | + } elseif ( ! empty($info['audio']['streams'])) { |
|
488 | 488 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska'); |
489 | 489 | } elseif (isset($info['mime_type'])) { |
490 | 490 | unset($info['mime_type']); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $info['matroska']['segment'][0]['length'] = $top_element['length']; |
537 | 537 | |
538 | 538 | while ($this->getEBMLelement($element_data, $top_element['end'])) { |
539 | - if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
539 | + if ($element_data['id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
540 | 540 | $info['matroska']['segments'][] = $element_data; |
541 | 541 | } |
542 | 542 | switch ($element_data['id']) { |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | break; |
562 | 562 | |
563 | 563 | default: |
564 | - $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
564 | + $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
565 | 565 | } |
566 | 566 | |
567 | - if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
567 | + if ($seek_entry['target_id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
568 | 568 | $info['matroska']['seek'][] = $seek_entry; |
569 | 569 | } |
570 | 570 | break; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | break; |
641 | 641 | |
642 | 642 | case EBML_ID_FLAGINTERLACED: |
643 | - $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
643 | + $track_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
644 | 644 | break; |
645 | 645 | |
646 | 646 | case EBML_ID_GAMMAVALUE: |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | case EBML_ID_EDITIONFLAGHIDDEN: |
1015 | 1015 | case EBML_ID_EDITIONFLAGDEFAULT: |
1016 | 1016 | case EBML_ID_EDITIONFLAGORDERED: |
1017 | - $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1017 | + $editionentry_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1018 | 1018 | break; |
1019 | 1019 | |
1020 | 1020 | case EBML_ID_CHAPTERATOM: |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | case EBML_ID_CHAPTERFLAGENABLED: |
1032 | 1032 | case EBML_ID_CHAPTERFLAGHIDDEN: |
1033 | - $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1033 | + $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1034 | 1034 | break; |
1035 | 1035 | |
1036 | 1036 | case EBML_ID_CHAPTERUID: |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | $this->current_offset = $subelement['end']; |
1165 | 1165 | } |
1166 | - if (!self::$hide_clusters) { |
|
1166 | + if ( ! self::$hide_clusters) { |
|
1167 | 1167 | $info['matroska']['cluster'][] = $cluster_entry; |
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // check to see if all the data we need exists already, if so, break out of the loop |
1171 | - if (!self::$parse_whole_file) { |
|
1171 | + if ( ! self::$parse_whole_file) { |
|
1172 | 1172 | if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { |
1173 | 1173 | if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { |
1174 | 1174 | if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) { |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | |
1194 | - private function EnsureBufferHasEnoughData($min_data=1024) { |
|
1194 | + private function EnsureBufferHasEnoughData($min_data = 1024) { |
|
1195 | 1195 | if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) { |
1196 | 1196 | $read_bytes = max($min_data, $this->getid3->fread_buffer_size()); |
1197 | 1197 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | |
1218 | 1218 | // get length of integer |
1219 | 1219 | $first_byte_int = ord($this->EBMLbuffer[$actual_offset]); |
1220 | - if (0x80 & $first_byte_int) { |
|
1220 | + if (0x80 & $first_byte_int) { |
|
1221 | 1221 | $length = 1; |
1222 | 1222 | } elseif (0x40 & $first_byte_int) { |
1223 | 1223 | $length = 2; |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | return $int_value; |
1245 | 1245 | } |
1246 | 1246 | |
1247 | - private function readEBMLelementData($length, $check_buffer=false) { |
|
1248 | - if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) { |
|
1247 | + private function readEBMLelementData($length, $check_buffer = false) { |
|
1248 | + if ($check_buffer && ! $this->EnsureBufferHasEnoughData($length)) { |
|
1249 | 1249 | return false; |
1250 | 1250 | } |
1251 | 1251 | $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length); |
@@ -1253,12 +1253,12 @@ discard block |
||
1253 | 1253 | return $data; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - private function getEBMLelement(&$element, $parent_end, $get_data=false) { |
|
1256 | + private function getEBMLelement(&$element, $parent_end, $get_data = false) { |
|
1257 | 1257 | if ($this->current_offset >= $parent_end) { |
1258 | 1258 | return false; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - if (!$this->EnsureBufferHasEnoughData()) { |
|
1261 | + if ( ! $this->EnsureBufferHasEnoughData()) { |
|
1262 | 1262 | $this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information |
1263 | 1263 | return false; |
1264 | 1264 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | // get raw data |
1284 | 1284 | $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id'])); |
1285 | - if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) { |
|
1285 | + if (($get_data === true || (is_array($get_data) && ! in_array($element['id'], $get_data))) && ! $dont_parse) { |
|
1286 | 1286 | $element['data'] = $this->readEBMLelementData($element['length'], $element); |
1287 | 1287 | } |
1288 | 1288 | |
@@ -1291,23 +1291,23 @@ discard block |
||
1291 | 1291 | |
1292 | 1292 | private function unhandledElement($type, $line, $element) { |
1293 | 1293 | // warn only about unknown and missed elements, not about unuseful |
1294 | - if (!in_array($element['id'], $this->unuseful_elements)) { |
|
1294 | + if ( ! in_array($element['id'], $this->unuseful_elements)) { |
|
1295 | 1295 | $this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']); |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | // increase offset for unparsed elements |
1299 | - if (!isset($element['data'])) { |
|
1299 | + if ( ! isset($element['data'])) { |
|
1300 | 1300 | $this->current_offset = $element['end']; |
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | private function ExtractCommentsSimpleTag($SimpleTagArray) { |
1305 | - if (!empty($SimpleTagArray['SimpleTag'])) { |
|
1305 | + if ( ! empty($SimpleTagArray['SimpleTag'])) { |
|
1306 | 1306 | foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) { |
1307 | - if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) { |
|
1307 | + if ( ! empty($SimpleTagData['TagName']) && ! empty($SimpleTagData['TagString'])) { |
|
1308 | 1308 | $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString']; |
1309 | 1309 | } |
1310 | - if (!empty($SimpleTagData['SimpleTag'])) { |
|
1310 | + if ( ! empty($SimpleTagData['SimpleTag'])) { |
|
1311 | 1311 | $this->ExtractCommentsSimpleTag($SimpleTagData); |
1312 | 1312 | } |
1313 | 1313 | } |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | break; |
1335 | 1335 | |
1336 | 1336 | case EBML_ID_TAGDEFAULT: |
1337 | - $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']); |
|
1337 | + $simpletag_entry[$element['id_name']] = (bool) getid3_lib::BigEndian2Int($element['data']); |
|
1338 | 1338 | break; |
1339 | 1339 | |
1340 | 1340 | default: |
@@ -1355,14 +1355,14 @@ discard block |
||
1355 | 1355 | $block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
1356 | 1356 | |
1357 | 1357 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | - $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1358 | + $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1359 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | 1360 | } |
1361 | 1361 | else { |
1362 | 1362 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1363 | } |
1364 | - $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | - $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1364 | + $block_data['flags']['invisible'] = (bool) (($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | + $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1366 | 1366 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1367 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | 1368 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if ($block_data['flags']['lacing'] > 0) { |
1376 | 1376 | $block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8) |
1377 | 1377 | if ($block_data['flags']['lacing'] != 0x02) { |
1378 | - for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1378 | + for ($i = 1; $i < $block_data['lace_frames']; $i++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1379 | 1379 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1380 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | 1381 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | } |
1395 | 1395 | } |
1396 | 1396 | |
1397 | - if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1397 | + if ( ! isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1398 | 1398 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset; |
1399 | 1399 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset; |
1400 | 1400 | //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0; |
@@ -1460,13 +1460,13 @@ discard block |
||
1460 | 1460 | // http://www.matroska.org/technical/specs/tagging/index.html |
1461 | 1461 | static $TargetTypeValue = array(); |
1462 | 1462 | if (empty($TargetTypeValue)) { |
1463 | - $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | - $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | - $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | - $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | - $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | - $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | - $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1463 | + $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | + $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | + $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | + $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | + $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | + $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | + $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1470 | 1470 | } |
1471 | 1471 | return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type); |
1472 | 1472 | } |
@@ -1495,8 +1495,8 @@ discard block |
||
1495 | 1495 | $CodecIDlist['A_MPEG/L1'] = 'mp1'; |
1496 | 1496 | $CodecIDlist['A_MPEG/L2'] = 'mp2'; |
1497 | 1497 | $CodecIDlist['A_MPEG/L3'] = 'mp3'; |
1498 | - $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | - $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1498 | + $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | + $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1500 | 1500 | $CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music |
1501 | 1501 | $CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2 |
1502 | 1502 | $CodecIDlist['A_VORBIS'] = 'vorbis'; |
@@ -357,8 +357,7 @@ discard block |
||
357 | 357 | $getid3_audio = new $class($getid3_temp, __CLASS__); |
358 | 358 | if ($track_info['dataformat'] == 'flac') { |
359 | 359 | $getid3_audio->AnalyzeString($trackarray['CodecPrivate']); |
360 | - } |
|
361 | - else { |
|
360 | + } else { |
|
362 | 361 | $getid3_audio->Analyze(); |
363 | 362 | } |
364 | 363 | if (!empty($getid3_temp->info[$header_data_key])) { |
@@ -368,8 +367,7 @@ discard block |
||
368 | 367 | $track_info[$key] = $value; |
369 | 368 | } |
370 | 369 | } |
371 | - } |
|
372 | - else { |
|
370 | + } else { |
|
373 | 371 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']); |
374 | 372 | } |
375 | 373 | |
@@ -1357,16 +1355,14 @@ discard block |
||
1357 | 1355 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | 1356 | $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
1359 | 1357 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | - } |
|
1361 | - else { |
|
1358 | + } else { |
|
1362 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1360 | } |
1364 | 1361 | $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
1365 | 1362 | $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
1366 | 1363 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1364 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | - } |
|
1369 | - else { |
|
1365 | + } else { |
|
1370 | 1366 | //$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0); |
1371 | 1367 | } |
1372 | 1368 | $block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']); |
@@ -1378,8 +1374,7 @@ discard block |
||
1378 | 1374 | for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
1379 | 1375 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1376 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | - } |
|
1382 | - else { // Xiph lacing |
|
1377 | + } else { // Xiph lacing |
|
1383 | 1378 | $block_data['lace_frames_size'][$i] = 0; |
1384 | 1379 | do { |
1385 | 1380 | $size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
@@ -118,6 +118,10 @@ discard block |
||
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | |
121 | + /** |
|
122 | + * @param string $atomname |
|
123 | + * @param string $atom_data |
|
124 | + */ |
|
121 | 125 | public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
122 | 126 | // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm |
123 | 127 | |
@@ -1424,6 +1428,9 @@ discard block |
||
1424 | 1428 | return $atom_structure; |
1425 | 1429 | } |
1426 | 1430 | |
1431 | + /** |
|
1432 | + * @param integer $baseoffset |
|
1433 | + */ |
|
1427 | 1434 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
1428 | 1435 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
1429 | 1436 | $atom_structure = false; |
@@ -1452,6 +1459,9 @@ discard block |
||
1452 | 1459 | } |
1453 | 1460 | |
1454 | 1461 | |
1462 | + /** |
|
1463 | + * @param integer $offset |
|
1464 | + */ |
|
1455 | 1465 | public function quicktime_read_mp4_descr_length($data, &$offset) { |
1456 | 1466 | // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html |
1457 | 1467 | $num_bytes = 0; |
@@ -2230,6 +2240,9 @@ discard block |
||
2230 | 2240 | return true; |
2231 | 2241 | } |
2232 | 2242 | |
2243 | + /** |
|
2244 | + * @param string $nullterminatedstring |
|
2245 | + */ |
|
2233 | 2246 | public function NoNullString($nullterminatedstring) { |
2234 | 2247 | // remove the single null terminator on null terminated strings |
2235 | 2248 | if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { |
@@ -2238,6 +2251,9 @@ discard block |
||
2238 | 2251 | return $nullterminatedstring; |
2239 | 2252 | } |
2240 | 2253 | |
2254 | + /** |
|
2255 | + * @param string $pascalstring |
|
2256 | + */ |
|
2241 | 2257 | public function Pascal2String($pascalstring) { |
2242 | 2258 | // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string |
2243 | 2259 | return substr($pascalstring, 1); |
@@ -1402,9 +1402,9 @@ discard block |
||
1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
1404 | 1404 | |
1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | - $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1409 | 1409 | break; |
1410 | 1410 | |
@@ -1753,56 +1753,56 @@ discard block |
||
1753 | 1753 | static $QuicktimeIODSaudioProfileNameLookup = array(); |
1754 | 1754 | if (empty($QuicktimeIODSaudioProfileNameLookup)) { |
1755 | 1755 | $QuicktimeIODSaudioProfileNameLookup = array( |
1756 | - 0x00 => 'ISO Reserved (0x00)', |
|
1757 | - 0x01 => 'Main Audio Profile @ Level 1', |
|
1758 | - 0x02 => 'Main Audio Profile @ Level 2', |
|
1759 | - 0x03 => 'Main Audio Profile @ Level 3', |
|
1760 | - 0x04 => 'Main Audio Profile @ Level 4', |
|
1761 | - 0x05 => 'Scalable Audio Profile @ Level 1', |
|
1762 | - 0x06 => 'Scalable Audio Profile @ Level 2', |
|
1763 | - 0x07 => 'Scalable Audio Profile @ Level 3', |
|
1764 | - 0x08 => 'Scalable Audio Profile @ Level 4', |
|
1765 | - 0x09 => 'Speech Audio Profile @ Level 1', |
|
1766 | - 0x0A => 'Speech Audio Profile @ Level 2', |
|
1767 | - 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
1768 | - 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
1769 | - 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
1770 | - 0x0E => 'High Quality Audio Profile @ Level 1', |
|
1771 | - 0x0F => 'High Quality Audio Profile @ Level 2', |
|
1772 | - 0x10 => 'High Quality Audio Profile @ Level 3', |
|
1773 | - 0x11 => 'High Quality Audio Profile @ Level 4', |
|
1774 | - 0x12 => 'High Quality Audio Profile @ Level 5', |
|
1775 | - 0x13 => 'High Quality Audio Profile @ Level 6', |
|
1776 | - 0x14 => 'High Quality Audio Profile @ Level 7', |
|
1777 | - 0x15 => 'High Quality Audio Profile @ Level 8', |
|
1778 | - 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
1779 | - 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
1780 | - 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
1781 | - 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
1782 | - 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
1783 | - 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
1784 | - 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
1785 | - 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
1786 | - 0x1E => 'Natural Audio Profile @ Level 1', |
|
1787 | - 0x1F => 'Natural Audio Profile @ Level 2', |
|
1788 | - 0x20 => 'Natural Audio Profile @ Level 3', |
|
1789 | - 0x21 => 'Natural Audio Profile @ Level 4', |
|
1790 | - 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
1791 | - 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
1792 | - 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
1793 | - 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
1794 | - 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
1795 | - 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
1796 | - 0x28 => 'AAC Profile @ Level 1', |
|
1797 | - 0x29 => 'AAC Profile @ Level 2', |
|
1798 | - 0x2A => 'AAC Profile @ Level 4', |
|
1799 | - 0x2B => 'AAC Profile @ Level 5', |
|
1800 | - 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
1801 | - 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
1802 | - 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
1803 | - 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
1804 | - 0xFE => 'Not part of MPEG-4 audio profiles', |
|
1805 | - 0xFF => 'No audio capability required', |
|
1756 | + 0x00 => 'ISO Reserved (0x00)', |
|
1757 | + 0x01 => 'Main Audio Profile @ Level 1', |
|
1758 | + 0x02 => 'Main Audio Profile @ Level 2', |
|
1759 | + 0x03 => 'Main Audio Profile @ Level 3', |
|
1760 | + 0x04 => 'Main Audio Profile @ Level 4', |
|
1761 | + 0x05 => 'Scalable Audio Profile @ Level 1', |
|
1762 | + 0x06 => 'Scalable Audio Profile @ Level 2', |
|
1763 | + 0x07 => 'Scalable Audio Profile @ Level 3', |
|
1764 | + 0x08 => 'Scalable Audio Profile @ Level 4', |
|
1765 | + 0x09 => 'Speech Audio Profile @ Level 1', |
|
1766 | + 0x0A => 'Speech Audio Profile @ Level 2', |
|
1767 | + 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
1768 | + 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
1769 | + 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
1770 | + 0x0E => 'High Quality Audio Profile @ Level 1', |
|
1771 | + 0x0F => 'High Quality Audio Profile @ Level 2', |
|
1772 | + 0x10 => 'High Quality Audio Profile @ Level 3', |
|
1773 | + 0x11 => 'High Quality Audio Profile @ Level 4', |
|
1774 | + 0x12 => 'High Quality Audio Profile @ Level 5', |
|
1775 | + 0x13 => 'High Quality Audio Profile @ Level 6', |
|
1776 | + 0x14 => 'High Quality Audio Profile @ Level 7', |
|
1777 | + 0x15 => 'High Quality Audio Profile @ Level 8', |
|
1778 | + 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
1779 | + 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
1780 | + 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
1781 | + 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
1782 | + 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
1783 | + 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
1784 | + 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
1785 | + 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
1786 | + 0x1E => 'Natural Audio Profile @ Level 1', |
|
1787 | + 0x1F => 'Natural Audio Profile @ Level 2', |
|
1788 | + 0x20 => 'Natural Audio Profile @ Level 3', |
|
1789 | + 0x21 => 'Natural Audio Profile @ Level 4', |
|
1790 | + 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
1791 | + 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
1792 | + 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
1793 | + 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
1794 | + 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
1795 | + 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
1796 | + 0x28 => 'AAC Profile @ Level 1', |
|
1797 | + 0x29 => 'AAC Profile @ Level 2', |
|
1798 | + 0x2A => 'AAC Profile @ Level 4', |
|
1799 | + 0x2B => 'AAC Profile @ Level 5', |
|
1800 | + 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
1801 | + 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
1802 | + 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
1803 | + 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
1804 | + 0xFE => 'Not part of MPEG-4 audio profiles', |
|
1805 | + 0xFF => 'No audio capability required', |
|
1806 | 1806 | ); |
1807 | 1807 | } |
1808 | 1808 | return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $atomcounter = 0; |
38 | 38 | $atom_data_read_buffer_size = ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 2) : $this->getid3->option_fread_buffer_size * 1024); // allow [default: 32MB] if PHP configured with no memory_limit |
39 | 39 | while ($offset < $info['avdataend']) { |
40 | - if (!getid3_lib::intValueSupported($offset)) { |
|
40 | + if ( ! getid3_lib::intValueSupported($offset)) { |
|
41 | 41 | $info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'; |
42 | 42 | break; |
43 | 43 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | $atomcounter++; |
75 | 75 | } |
76 | 76 | |
77 | - if (!empty($info['avdataend_tmp'])) { |
|
77 | + if ( ! empty($info['avdataend_tmp'])) { |
|
78 | 78 | // this value is assigned to a temp value and then erased because |
79 | 79 | // otherwise any atoms beyond the 'mdat' atom would not get parsed |
80 | 80 | $info['avdataend'] = $info['avdataend_tmp']; |
81 | 81 | unset($info['avdataend_tmp']); |
82 | 82 | } |
83 | 83 | |
84 | - if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
84 | + if ( ! isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
85 | 85 | $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
86 | 86 | } |
87 | - if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) { |
|
87 | + if (isset($info['bitrate']) && ! isset($info['audio']['bitrate']) && ! isset($info['quicktime']['video'])) { |
|
88 | 88 | $info['audio']['bitrate'] = $info['bitrate']; |
89 | 89 | } |
90 | - if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) { |
|
90 | + if ( ! empty($info['playtime_seconds']) && ! isset($info['video']['frame_rate']) && ! empty($info['quicktime']['stts_framecount'])) { |
|
91 | 91 | foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) { |
92 | 92 | $samples_per_second = $samples_count / $info['playtime_seconds']; |
93 | 93 | if ($samples_per_second > 240) { |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | unset($info['video']['dataformat']); |
105 | 105 | } |
106 | 106 | |
107 | - if (!$this->ReturnAtomData) { |
|
107 | + if ( ! $this->ReturnAtomData) { |
|
108 | 108 | unset($info['quicktime']['moov']); |
109 | 109 | } |
110 | 110 | |
111 | - if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) { |
|
111 | + if (empty($info['audio']['dataformat']) && ! empty($info['quicktime']['audio'])) { |
|
112 | 112 | $info['audio']['dataformat'] = 'quicktime'; |
113 | 113 | } |
114 | - if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) { |
|
114 | + if (empty($info['video']['dataformat']) && ! empty($info['quicktime']['video'])) { |
|
115 | 115 | $info['video']['dataformat'] = 'quicktime'; |
116 | 116 | } |
117 | 117 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted |
153 | 153 | $allnumericnames = true; |
154 | 154 | foreach ($atom_structure['subatoms'] as $subatomarray) { |
155 | - if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
155 | + if ( ! is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
156 | 156 | $allnumericnames = false; |
157 | 157 | break; |
158 | 158 | } |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | // User data atom handler |
302 | 302 | $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
303 | 303 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
304 | - $atom_structure['data'] = substr($atom_data, 4); |
|
304 | + $atom_structure['data'] = substr($atom_data, 4); |
|
305 | 305 | |
306 | 306 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
307 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
307 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
308 | 308 | $info['comments']['language'][] = $atom_structure['language']; |
309 | 309 | } |
310 | 310 | } else { |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | // not sure what it means, but observed on iPhone4 data. |
315 | 315 | // Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data |
316 | 316 | while ($atomoffset < strlen($atom_data)) { |
317 | - $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
318 | - $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
319 | - $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
317 | + $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
318 | + $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
319 | + $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
320 | 320 | if ($boxsmallsize <= 1) { |
321 | 321 | $info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
322 | 322 | $atom_structure['data'] = null; |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | } else { |
338 | 338 | while ($atomoffset < strlen($atom_data)) { |
339 | 339 | $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4)); |
340 | - $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
341 | - $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
340 | + $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
341 | + $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
342 | 342 | if ($boxsize <= 1) { |
343 | 343 | $info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
344 | 344 | $atom_structure['data'] = null; |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'data': |
357 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
358 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
357 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
358 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
359 | 359 | switch ($atom_structure['flags_raw']) { |
360 | 360 | case 0: // data flag |
361 | 361 | case 21: // tmpo/cpil flag |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | case 'gnre': |
382 | 382 | $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); |
383 | - $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
383 | + $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
384 | 384 | break; |
385 | 385 | |
386 | 386 | case 'rtng': |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | case 'play': // auto-PLAY atom |
443 | - $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
443 | + $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
444 | 444 | |
445 | 445 | $info['quicktime']['autoplay'] = $atom_structure['autoplay']; |
446 | 446 | break; |
447 | 447 | |
448 | 448 | |
449 | 449 | case 'WLOC': // Window LOCation atom |
450 | - $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
451 | - $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
450 | + $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
451 | + $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
452 | 452 | break; |
453 | 453 | |
454 | 454 | |
@@ -488,27 +488,27 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | case 'rdrf': // Reference movie Data ReFerence atom |
491 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
492 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
491 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
492 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
493 | 493 | $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001); |
494 | 494 | |
495 | - $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
496 | - $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
495 | + $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
496 | + $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
497 | 497 | switch ($atom_structure['reference_type_name']) { |
498 | 498 | case 'url ': |
499 | - $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
499 | + $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
500 | 500 | break; |
501 | 501 | |
502 | 502 | case 'alis': |
503 | - $atom_structure['file_alias'] = substr($atom_data, 12); |
|
503 | + $atom_structure['file_alias'] = substr($atom_data, 12); |
|
504 | 504 | break; |
505 | 505 | |
506 | 506 | case 'rsrc': |
507 | - $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
507 | + $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
508 | 508 | break; |
509 | 509 | |
510 | 510 | default: |
511 | - $atom_structure['data'] = substr($atom_data, 12); |
|
511 | + $atom_structure['data'] = substr($atom_data, 12); |
|
512 | 512 | break; |
513 | 513 | } |
514 | 514 | break; |
@@ -520,28 +520,28 @@ discard block |
||
520 | 520 | |
521 | 521 | |
522 | 522 | case 'rmcs': // Reference Movie Cpu Speed atom |
523 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
524 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
525 | - $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
523 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
524 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
525 | + $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
526 | 526 | break; |
527 | 527 | |
528 | 528 | |
529 | 529 | case 'rmvc': // Reference Movie Version Check atom |
530 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
531 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
532 | - $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
533 | - $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
530 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
531 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
532 | + $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
533 | + $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
534 | 534 | $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
535 | 535 | $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
536 | 536 | break; |
537 | 537 | |
538 | 538 | |
539 | 539 | case 'rmcd': // Reference Movie Component check atom |
540 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
541 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
542 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
543 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
544 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
540 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
541 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
542 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
543 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
544 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
545 | 545 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
546 | 546 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
547 | 547 | $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4)); |
@@ -549,30 +549,30 @@ discard block |
||
549 | 549 | |
550 | 550 | |
551 | 551 | case 'rmdr': // Reference Movie Data Rate atom |
552 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
553 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
554 | - $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
552 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
553 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
554 | + $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
555 | 555 | |
556 | 556 | $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10; |
557 | 557 | break; |
558 | 558 | |
559 | 559 | |
560 | 560 | case 'rmla': // Reference Movie Language Atom |
561 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
562 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
563 | - $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
561 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
562 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
563 | + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
564 | 564 | |
565 | 565 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
566 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
566 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
567 | 567 | $info['comments']['language'][] = $atom_structure['language']; |
568 | 568 | } |
569 | 569 | break; |
570 | 570 | |
571 | 571 | |
572 | 572 | case 'rmla': // Reference Movie Language Atom |
573 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
574 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
575 | - $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
573 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
574 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
575 | + $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
576 | 576 | break; |
577 | 577 | |
578 | 578 | |
@@ -601,49 +601,49 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | case 'stsd': // Sample Table Sample Description atom |
604 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
605 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
606 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
604 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
605 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
606 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
607 | 607 | $stsdEntriesDataOffset = 8; |
608 | 608 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
609 | 609 | $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); |
610 | 610 | $stsdEntriesDataOffset += 4; |
611 | - $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
611 | + $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
612 | 612 | $stsdEntriesDataOffset += 4; |
613 | 613 | $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6)); |
614 | 614 | $stsdEntriesDataOffset += 6; |
615 | 615 | $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2)); |
616 | 616 | $stsdEntriesDataOffset += 2; |
617 | - $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
617 | + $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
618 | 618 | $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); |
619 | 619 | |
620 | - $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
621 | - $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
622 | - $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
620 | + $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
621 | + $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
622 | + $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
623 | 623 | |
624 | 624 | switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) { |
625 | 625 | |
626 | 626 | case "\x00\x00\x00\x00": |
627 | 627 | // audio tracks |
628 | - $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
629 | - $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
630 | - $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
631 | - $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
632 | - $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
628 | + $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
629 | + $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
630 | + $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
631 | + $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
632 | + $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
633 | 633 | |
634 | 634 | // video tracks |
635 | 635 | // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html |
636 | - $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
637 | - $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
638 | - $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
639 | - $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
640 | - $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
641 | - $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
642 | - $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
643 | - $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
644 | - $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
645 | - $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
646 | - $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
636 | + $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
637 | + $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
638 | + $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
639 | + $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
640 | + $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
641 | + $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
642 | + $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
643 | + $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
644 | + $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
645 | + $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
646 | + $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
647 | 647 | |
648 | 648 | switch ($atom_structure['sample_description_table'][$i]['data_format']) { |
649 | 649 | case '2vuY': |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; |
677 | 677 | // http://www.getid3.org/phpBB3/viewtopic.php?t=1550 |
678 | 678 | //if ((!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['width'])) && (empty($info['video']['resolution_x']) || empty($info['video']['resolution_y']) || (number_format($info['video']['resolution_x'], 6) != number_format(round($info['video']['resolution_x']), 6)) || (number_format($info['video']['resolution_y'], 6) != number_format(round($info['video']['resolution_y']), 6)))) { // ugly check for floating point numbers |
679 | -if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
679 | +if ( ! empty($atom_structure['sample_description_table'][$i]['width']) && ! empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
680 | 680 | // assume that values stored here are more important than values stored in [tkhd] atom |
681 | 681 | $info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width']; |
682 | 682 | $info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height']; |
@@ -720,18 +720,18 @@ discard block |
||
720 | 720 | |
721 | 721 | default: |
722 | 722 | // video atom |
723 | - $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
724 | - $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
725 | - $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
726 | - $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
727 | - $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
728 | - $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
729 | - $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
730 | - $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
731 | - $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
732 | - $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
733 | - $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
734 | - $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
723 | + $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
724 | + $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
725 | + $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
726 | + $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
727 | + $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
728 | + $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
729 | + $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
730 | + $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
731 | + $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
732 | + $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
733 | + $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
734 | + $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
735 | 735 | |
736 | 736 | $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); |
737 | 737 | $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']); |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | |
793 | 793 | |
794 | 794 | case 'stts': // Sample Table Time-to-Sample atom |
795 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
796 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
797 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
795 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
796 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
797 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
798 | 798 | $sttsEntriesDataOffset = 8; |
799 | 799 | //$FrameRateCalculatorArray = array(); |
800 | 800 | $frames_count = 0; |
@@ -845,9 +845,9 @@ discard block |
||
845 | 845 | |
846 | 846 | case 'stss': // Sample Table Sync Sample (key frames) atom |
847 | 847 | if ($ParseAllPossibleAtoms) { |
848 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
849 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
850 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
848 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
849 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
850 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
851 | 851 | $stssEntriesDataOffset = 8; |
852 | 852 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
853 | 853 | $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4)); |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | |
860 | 860 | case 'stsc': // Sample Table Sample-to-Chunk atom |
861 | 861 | if ($ParseAllPossibleAtoms) { |
862 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
863 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
864 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
862 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
863 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
864 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
865 | 865 | $stscEntriesDataOffset = 8; |
866 | 866 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
867 | 867 | $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); |
@@ -877,10 +877,10 @@ discard block |
||
877 | 877 | |
878 | 878 | case 'stsz': // Sample Table SiZe atom |
879 | 879 | if ($ParseAllPossibleAtoms) { |
880 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
881 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
882 | - $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
883 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
880 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
881 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
882 | + $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
883 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
884 | 884 | $stszEntriesDataOffset = 12; |
885 | 885 | if ($atom_structure['sample_size'] == 0) { |
886 | 886 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
@@ -894,9 +894,9 @@ discard block |
||
894 | 894 | |
895 | 895 | case 'stco': // Sample Table Chunk Offset atom |
896 | 896 | if ($ParseAllPossibleAtoms) { |
897 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
898 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
899 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
897 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
898 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
899 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
900 | 900 | $stcoEntriesDataOffset = 8; |
901 | 901 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
902 | 902 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4)); |
@@ -908,9 +908,9 @@ discard block |
||
908 | 908 | |
909 | 909 | case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files) |
910 | 910 | if ($ParseAllPossibleAtoms) { |
911 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
912 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
913 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
911 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
912 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
913 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
914 | 914 | $stcoEntriesDataOffset = 8; |
915 | 915 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
916 | 916 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8)); |
@@ -921,20 +921,20 @@ discard block |
||
921 | 921 | |
922 | 922 | |
923 | 923 | case 'dref': // Data REFerence atom |
924 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
925 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
926 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
924 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
925 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
926 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
927 | 927 | $drefDataOffset = 8; |
928 | 928 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
929 | 929 | $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); |
930 | 930 | $drefDataOffset += 4; |
931 | - $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
931 | + $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
932 | 932 | $drefDataOffset += 4; |
933 | - $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
933 | + $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
934 | 934 | $drefDataOffset += 1; |
935 | - $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
935 | + $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
936 | 936 | $drefDataOffset += 3; |
937 | - $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
937 | + $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
938 | 938 | $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); |
939 | 939 | |
940 | 940 | $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); |
@@ -943,11 +943,11 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | case 'gmin': // base Media INformation atom |
946 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
947 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
948 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
949 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
950 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
946 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
947 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
948 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
949 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
950 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
951 | 951 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
952 | 952 | $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2)); |
953 | 953 | $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
@@ -955,19 +955,19 @@ discard block |
||
955 | 955 | |
956 | 956 | |
957 | 957 | case 'smhd': // Sound Media information HeaDer atom |
958 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
959 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
960 | - $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
961 | - $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
958 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
959 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
960 | + $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
961 | + $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
962 | 962 | break; |
963 | 963 | |
964 | 964 | |
965 | 965 | case 'vmhd': // Video Media information HeaDer atom |
966 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
967 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
968 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
969 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
970 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
966 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
967 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
968 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
969 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
970 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
971 | 971 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
972 | 972 | |
973 | 973 | $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001); |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | |
976 | 976 | |
977 | 977 | case 'hdlr': // HanDLeR reference atom |
978 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
979 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
980 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
981 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
982 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
978 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
979 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
980 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
981 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
982 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
983 | 983 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
984 | 984 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
985 | - $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
985 | + $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
986 | 986 | |
987 | 987 | if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) { |
988 | 988 | $info['video']['dataformat'] = 'quicktimevr'; |
@@ -991,10 +991,10 @@ discard block |
||
991 | 991 | |
992 | 992 | |
993 | 993 | case 'mdhd': // MeDia HeaDer atom |
994 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
995 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
996 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
997 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
994 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
995 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
996 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
997 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
998 | 998 | $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
999 | 999 | $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
1000 | 1000 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2)); |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
1011 | 1011 | $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; |
1012 | 1012 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
1013 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
1013 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
1014 | 1014 | $info['comments']['language'][] = $atom_structure['language']; |
1015 | 1015 | } |
1016 | 1016 | break; |
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | case 'pnot': // Preview atom |
1020 | - $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
1021 | - $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
1022 | - $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
1020 | + $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
1021 | + $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
1022 | + $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
1023 | 1023 | $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01 |
1024 | 1024 | |
1025 | 1025 | $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); |
@@ -1027,16 +1027,16 @@ discard block |
||
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | case 'crgn': // Clipping ReGioN atom |
1030 | - $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
1031 | - $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
1032 | - $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
1030 | + $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
1031 | + $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
1032 | + $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
1033 | 1033 | break; |
1034 | 1034 | |
1035 | 1035 | |
1036 | 1036 | case 'load': // track LOAD settings atom |
1037 | - $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1038 | - $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1039 | - $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1037 | + $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1038 | + $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1039 | + $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1040 | 1040 | $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
1041 | 1041 | |
1042 | 1042 | $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020); |
@@ -1056,28 +1056,28 @@ discard block |
||
1056 | 1056 | |
1057 | 1057 | |
1058 | 1058 | case 'elst': // Edit LiST atom |
1059 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1060 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1061 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1062 | - for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) { |
|
1063 | - $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
1064 | - $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
1059 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1060 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1061 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1062 | + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
|
1063 | + $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
1064 | + $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
1065 | 1065 | $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4)); |
1066 | 1066 | } |
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | case 'kmat': // compressed MATte atom |
1071 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1072 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1073 | - $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
1071 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1072 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1073 | + $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
1074 | 1074 | break; |
1075 | 1075 | |
1076 | 1076 | |
1077 | 1077 | case 'ctab': // Color TABle atom |
1078 | - $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
1079 | - $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
1080 | - $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
1078 | + $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
1079 | + $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
1080 | + $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
1081 | 1081 | for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) { |
1082 | 1082 | $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2)); |
1083 | 1083 | $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2)); |
@@ -1088,31 +1088,31 @@ discard block |
||
1088 | 1088 | |
1089 | 1089 | |
1090 | 1090 | case 'mvhd': // MoVie HeaDer atom |
1091 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1092 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1093 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1094 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1095 | - $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1096 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1091 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1092 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1093 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1094 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1095 | + $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1096 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1097 | 1097 | $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4)); |
1098 | - $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
1099 | - $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
1098 | + $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
1099 | + $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
1100 | 1100 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4)); |
1101 | 1101 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
1102 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
1102 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
1103 | 1103 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4)); |
1104 | 1104 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
1105 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
1105 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
1106 | 1106 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4)); |
1107 | 1107 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
1108 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
1109 | - $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
1110 | - $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
1111 | - $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
1112 | - $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
1113 | - $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
1114 | - $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
1115 | - $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
1108 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
1109 | + $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
1110 | + $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
1111 | + $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
1112 | + $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
1113 | + $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
1114 | + $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
1115 | + $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
1116 | 1116 | |
1117 | 1117 | if ($atom_structure['time_scale'] == 0) { |
1118 | 1118 | $info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero'; |
@@ -1127,29 +1127,29 @@ discard block |
||
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | case 'tkhd': // TracK HeaDer atom |
1130 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1131 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1132 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1133 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1134 | - $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1135 | - $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1136 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
1137 | - $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
1138 | - $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
1139 | - $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
1140 | - $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
1141 | - $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
1130 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1131 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1132 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1133 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1134 | + $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1135 | + $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1136 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
1137 | + $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
1138 | + $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
1139 | + $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
1140 | + $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
1141 | + $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
1142 | 1142 | // http://developer.apple.com/library/mac/#documentation/QuickTime/RM/MovieBasics/MTEditing/K-Chapter/11MatrixFunctions.html |
1143 | 1143 | // http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-18737 |
1144 | 1144 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
1145 | 1145 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4)); |
1146 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
1146 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
1147 | 1147 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
1148 | 1148 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4)); |
1149 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
1149 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
1150 | 1150 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
1151 | 1151 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4)); |
1152 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
1152 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
1153 | 1153 | $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4)); |
1154 | 1154 | $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4)); |
1155 | 1155 | $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001); |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
1161 | 1161 | |
1162 | 1162 | if ($atom_structure['flags']['enabled'] == 1) { |
1163 | - if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) { |
|
1163 | + if ( ! isset($info['video']['resolution_x']) || ! isset($info['video']['resolution_y'])) { |
|
1164 | 1164 | $info['video']['resolution_x'] = $atom_structure['width']; |
1165 | 1165 | $info['video']['resolution_y'] = $atom_structure['height']; |
1166 | 1166 | } |
@@ -1181,34 +1181,34 @@ discard block |
||
1181 | 1181 | // http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h |
1182 | 1182 | // http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html |
1183 | 1183 | $offset = 0; |
1184 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1184 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1185 | 1185 | $offset += 1; |
1186 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
1186 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
1187 | 1187 | $offset += 3; |
1188 | - $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1188 | + $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1189 | 1189 | $offset += 1; |
1190 | 1190 | $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
1191 | 1191 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
1192 | - $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
1192 | + $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
1193 | 1193 | $offset += 2; |
1194 | - $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1194 | + $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1195 | 1195 | $offset += 1; |
1196 | - $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1196 | + $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1197 | 1197 | $offset += 1; |
1198 | - $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1198 | + $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1199 | 1199 | $offset += 1; |
1200 | - $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1200 | + $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1201 | 1201 | $offset += 1; |
1202 | - $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1202 | + $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1203 | 1203 | $offset += 1; |
1204 | 1204 | |
1205 | 1205 | $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields |
1206 | 1206 | for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) { |
1207 | - $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1207 | + $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1208 | 1208 | $offset += 1; |
1209 | 1209 | $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
1210 | 1210 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
1211 | - $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
1211 | + $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
1212 | 1212 | $offset += 4; |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1217,9 +1217,9 @@ discard block |
||
1217 | 1217 | break; |
1218 | 1218 | |
1219 | 1219 | case 'ftyp': // FileTYPe (?) atom (for MP4 it seems) |
1220 | - $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
1221 | - $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1222 | - $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
1220 | + $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
1221 | + $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1222 | + $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
1223 | 1223 | break; |
1224 | 1224 | |
1225 | 1225 | case 'mdat': // Media DATa atom |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field |
1243 | - while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
1243 | + while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
1244 | 1244 | && ($chapter_string_length < 1000) |
1245 | 1245 | && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) |
1246 | 1246 | && preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) { |
@@ -1250,9 +1250,9 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | |
1252 | 1252 | |
1253 | - if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
1253 | + if (($atomsize > 8) && ( ! isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
1254 | 1254 | |
1255 | - $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
1255 | + $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
1256 | 1256 | $OldAVDataEnd = $info['avdataend']; |
1257 | 1257 | $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size']; |
1258 | 1258 | |
@@ -1263,16 +1263,16 @@ discard block |
||
1263 | 1263 | $getid3_mp3 = new getid3_mp3($getid3_temp); |
1264 | 1264 | if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) { |
1265 | 1265 | $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); |
1266 | - if (!empty($getid3_temp->info['warning'])) { |
|
1266 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1267 | 1267 | foreach ($getid3_temp->info['warning'] as $value) { |
1268 | 1268 | $info['warning'][] = $value; |
1269 | 1269 | } |
1270 | 1270 | } |
1271 | - if (!empty($getid3_temp->info['mpeg'])) { |
|
1271 | + if ( ! empty($getid3_temp->info['mpeg'])) { |
|
1272 | 1272 | $info['mpeg'] = $getid3_temp->info['mpeg']; |
1273 | 1273 | if (isset($info['mpeg']['audio'])) { |
1274 | 1274 | $info['audio']['dataformat'] = 'mp3'; |
1275 | - $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); |
|
1275 | + $info['audio']['codec'] = ( ! empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : ( ! empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : ( ! empty($info['mpeg']['audio']['LAME']) ? 'LAME' : 'mp3'))); |
|
1276 | 1276 | $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; |
1277 | 1277 | $info['audio']['channels'] = $info['mpeg']['audio']['channels']; |
1278 | 1278 | $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | case 'nsav': // NoSAVe atom |
1309 | 1309 | // http://developer.apple.com/technotes/tn/tn2038.html |
1310 | - $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1310 | + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1311 | 1311 | break; |
1312 | 1312 | |
1313 | 1313 | case 'ctyp': // Controller TYPe atom (seen on QTVR) |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | break; |
1326 | 1326 | |
1327 | 1327 | case 'pano': // PANOrama track (seen on QTVR) |
1328 | - $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1328 | + $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1329 | 1329 | break; |
1330 | 1330 | |
1331 | 1331 | case 'hint': // HINT track |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | @list($all, $latitude, $longitude, $altitude) = $matches; |
1365 | 1365 | $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); |
1366 | 1366 | $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); |
1367 | - if (!empty($altitude)) { |
|
1367 | + if ( ! empty($altitude)) { |
|
1368 | 1368 | $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); |
1369 | 1369 | } |
1370 | 1370 | } else { |
@@ -1402,17 +1402,17 @@ discard block |
||
1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
1404 | 1404 | |
1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | 1407 | $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1409 | 1409 | break; |
1410 | 1410 | |
1411 | 1411 | case 'data': // metaDATA atom |
1412 | 1412 | // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data |
1413 | - $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
1413 | + $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
1414 | 1414 | $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); |
1415 | - $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
1415 | + $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
1416 | 1416 | break; |
1417 | 1417 | |
1418 | 1418 | default: |
@@ -1426,7 +1426,7 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
1428 | 1428 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
1429 | - $atom_structure = false; |
|
1429 | + $atom_structure = false; |
|
1430 | 1430 | $subatomoffset = 0; |
1431 | 1431 | $subatomcounter = 0; |
1432 | 1432 | if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) { |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | } |
1435 | 1435 | while ($subatomoffset < strlen($atom_data)) { |
1436 | 1436 | $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4)); |
1437 | - $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
1438 | - $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
1437 | + $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
1438 | + $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
1439 | 1439 | if ($subatomsize == 0) { |
1440 | 1440 | // Furthermore, for historical reasons the list of atoms is optionally |
1441 | 1441 | // terminated by a 32-bit integer set to 0. If you are writing a program |
@@ -1594,8 +1594,8 @@ discard block |
||
1594 | 1594 | */ |
1595 | 1595 | $iso_language_id = ''; |
1596 | 1596 | $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60); |
1597 | - $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
1598 | - $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
1597 | + $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
1598 | + $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
1599 | 1599 | $QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id); |
1600 | 1600 | } |
1601 | 1601 | return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); |
@@ -1975,9 +1975,9 @@ discard block |
||
1975 | 1975 | $parsed = array(); |
1976 | 1976 | while ($offset < $datalength) { |
1977 | 1977 | //echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>'; |
1978 | - $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
1979 | - $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1980 | - $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1978 | + $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
1979 | + $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1980 | + $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1981 | 1981 | switch ($data_size_type) { |
1982 | 1982 | case 0x0001: // 0x0001 = flag (size field *= 1-byte) |
1983 | 1983 | $data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1)); |
@@ -2050,23 +2050,23 @@ discard block |
||
2050 | 2050 | break; |
2051 | 2051 | case 0x02000023: // PictureControlData |
2052 | 2052 | $PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full'); |
2053 | - $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
2054 | - $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
2053 | + $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
2054 | + $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
2055 | 2055 | $data = array( |
2056 | - 'PictureControlVersion' => substr($data, 0, 4), |
|
2057 | - 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
2056 | + 'PictureControlVersion' => substr($data, 0, 4), |
|
2057 | + 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
2058 | 2058 | 'PictureControlBase' => rtrim(substr($data, 24, 20), "\x00"), |
2059 | 2059 | //'?' => substr($data, 44, 4), |
2060 | - 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
2061 | - 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
2062 | - 'Sharpness' => ord(substr($data, 50, 1)), |
|
2063 | - 'Contrast' => ord(substr($data, 51, 1)), |
|
2064 | - 'Brightness' => ord(substr($data, 52, 1)), |
|
2065 | - 'Saturation' => ord(substr($data, 53, 1)), |
|
2066 | - 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
2067 | - 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
2068 | - 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
2069 | - 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
2060 | + 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
2061 | + 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
2062 | + 'Sharpness' => ord(substr($data, 50, 1)), |
|
2063 | + 'Contrast' => ord(substr($data, 51, 1)), |
|
2064 | + 'Brightness' => ord(substr($data, 52, 1)), |
|
2065 | + 'Saturation' => ord(substr($data, 53, 1)), |
|
2066 | + 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
2067 | + 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
2068 | + 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
2069 | + 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
2070 | 2070 | ); |
2071 | 2071 | break; |
2072 | 2072 | case 0x02000024: // WorldTime |
@@ -2108,11 +2108,11 @@ discard block |
||
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | |
2111 | - public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { |
|
2111 | + public function CopyToAppropriateCommentsSection($keyname, $data, $boxname = '') { |
|
2112 | 2112 | static $handyatomtranslatorarray = array(); |
2113 | 2113 | if (empty($handyatomtranslatorarray)) { |
2114 | 2114 | $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; |
2115 | - $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
2115 | + $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
2116 | 2116 | $handyatomtranslatorarray["\xA9".'dir'] = 'director'; |
2117 | 2117 | $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; |
2118 | 2118 | $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; |
@@ -2132,8 +2132,8 @@ discard block |
||
2132 | 2132 | $handyatomtranslatorarray["\xA9".'wrt'] = 'writer'; |
2133 | 2133 | |
2134 | 2134 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt |
2135 | - $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
2136 | - $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
2135 | + $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
2136 | + $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
2137 | 2137 | $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; |
2138 | 2138 | $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; |
2139 | 2139 | $handyatomtranslatorarray["\xA9".'mak'] = 'make'; |
@@ -2143,39 +2143,39 @@ discard block |
||
2143 | 2143 | $handyatomtranslatorarray["\xA9".'aut'] = 'author'; |
2144 | 2144 | $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; |
2145 | 2145 | $handyatomtranslatorarray["\xA9".'trk'] = 'track'; |
2146 | - $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
2146 | + $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
2147 | 2147 | $handyatomtranslatorarray["\xA9".'com'] = 'comment'; |
2148 | - $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
2148 | + $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
2149 | 2149 | $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; |
2150 | 2150 | $handyatomtranslatorarray["\xA9".'url'] = 'url'; |
2151 | 2151 | $handyatomtranslatorarray["\xA9".'enc'] = 'encoder'; |
2152 | 2152 | |
2153 | 2153 | // http://atomicparsley.sourceforge.net/mpeg-4files.html |
2154 | - $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
2154 | + $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
2155 | 2155 | $handyatomtranslatorarray['aART'] = 'album_artist'; |
2156 | - $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
2157 | - $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
2158 | - $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
2159 | - $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
2160 | - $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
2161 | - $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
2162 | - $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
2163 | - $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
2164 | - $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
2165 | - $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
2166 | - $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
2167 | - $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
2168 | - $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
2169 | - $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
2170 | - $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
2171 | - $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
2172 | - $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
2173 | - $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
2174 | - $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
2175 | - $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
2176 | - $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
2177 | - $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
2178 | - $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
2156 | + $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
2157 | + $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
2158 | + $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
2159 | + $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
2160 | + $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
2161 | + $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
2162 | + $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
2163 | + $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
2164 | + $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
2165 | + $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
2166 | + $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
2167 | + $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
2168 | + $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
2169 | + $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
2170 | + $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
2171 | + $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
2172 | + $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
2173 | + $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
2174 | + $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
2175 | + $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
2176 | + $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
2177 | + $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
2178 | + $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
2179 | 2179 | $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 |
2180 | 2180 | |
2181 | 2181 | // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | } |
2212 | 2212 | if ($comment_key) { |
2213 | 2213 | if ($comment_key == 'picture') { |
2214 | - if (!is_array($data)) { |
|
2214 | + if ( ! is_array($data)) { |
|
2215 | 2215 | $image_mime = ''; |
2216 | 2216 | if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) { |
2217 | 2217 | $image_mime = 'image/png'; |
@@ -1320,6 +1320,9 @@ discard block |
||
1320 | 1320 | return true; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | + /** |
|
1324 | + * @param double $startoffset |
|
1325 | + */ |
|
1323 | 1326 | public function ParseRIFFAMV($startoffset, $maxoffset) { |
1324 | 1327 | // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size |
1325 | 1328 | |
@@ -1715,6 +1718,9 @@ discard block |
||
1715 | 1718 | return $RIFFchunk; |
1716 | 1719 | } |
1717 | 1720 | |
1721 | + /** |
|
1722 | + * @param string $RIFFdata |
|
1723 | + */ |
|
1718 | 1724 | public function ParseRIFFdata(&$RIFFdata) { |
1719 | 1725 | $info = &$this->getid3->info; |
1720 | 1726 | if ($RIFFdata) { |
@@ -1836,6 +1842,9 @@ discard block |
||
1836 | 1842 | return $WaveFormatEx; |
1837 | 1843 | } |
1838 | 1844 | |
1845 | + /** |
|
1846 | + * @param string $WavPackChunkData |
|
1847 | + */ |
|
1839 | 1848 | public function parseWavPackHeader($WavPackChunkData) { |
1840 | 1849 | // typedef struct { |
1841 | 1850 | // char ckID [4]; |
@@ -1916,6 +1925,9 @@ discard block |
||
1916 | 1925 | return $parsed; |
1917 | 1926 | } |
1918 | 1927 | |
1928 | + /** |
|
1929 | + * @param string $DIVXTAG |
|
1930 | + */ |
|
1919 | 1931 | public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
1920 | 1932 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
1921 | 1933 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
@@ -1990,6 +2002,9 @@ discard block |
||
1990 | 2002 | return $parsed; |
1991 | 2003 | } |
1992 | 2004 | |
2005 | + /** |
|
2006 | + * @param string $tagshortname |
|
2007 | + */ |
|
1993 | 2008 | public static function waveSNDMtagLookup($tagshortname) { |
1994 | 2009 | $begin = __LINE__; |
1995 | 2010 | |
@@ -2576,6 +2591,9 @@ discard block |
||
2576 | 2591 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2592 | } |
2578 | 2593 | |
2594 | + /** |
|
2595 | + * @param string $byteword |
|
2596 | + */ |
|
2579 | 2597 | private function EitherEndian2Int($byteword, $signed=false) { |
2580 | 2598 | if ($this->container == 'riff') { |
2581 | 2599 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | 'capturedfile' => 0x00010000, |
694 | 694 | 'copyrighted' => 0x00020010, |
695 | 695 | ); |
696 | - foreach ($flags as $flag => $value) { |
|
696 | + foreach ($flags as $flag => $value) { |
|
697 | 697 | $thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value); |
698 | 698 | } |
699 | 699 | |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | // http://en.wikipedia.org/wiki/CD-DA |
913 | 913 | case 'CDDA': |
914 | 914 | $info['fileformat'] = 'cda'; |
915 | - unset($info['mime_type']); |
|
915 | + unset($info['mime_type']); |
|
916 | 916 | |
917 | 917 | $thisfile_audio_dataformat = 'cda'; |
918 | 918 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | break; |
947 | 947 | |
948 | - // http://en.wikipedia.org/wiki/AIFF |
|
948 | + // http://en.wikipedia.org/wiki/AIFF |
|
949 | 949 | case 'AIFF': |
950 | 950 | case 'AIFC': |
951 | 951 | $info['fileformat'] = 'aiff'; |
@@ -2007,8 +2007,7 @@ discard block |
||
2007 | 2007 | ©cdt cdtitle |
2008 | 2008 | ©alb library |
2009 | 2009 | ©com composer |
2010 | - |
|
2011 | - */ |
|
2010 | + */ |
|
2012 | 2011 | |
2013 | 2012 | return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm'); |
2014 | 2013 | } |
@@ -2176,8 +2175,7 @@ discard block |
||
2176 | 2175 | 0x7A22 GSM-AMR (VBR, including SID) |
2177 | 2176 | 0xFFFE WAVE_FORMAT_EXTENSIBLE |
2178 | 2177 | 0xFFFF WAVE_FORMAT_DEVELOPMENT |
2179 | - |
|
2180 | - */ |
|
2178 | + */ |
|
2181 | 2179 | |
2182 | 2180 | return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); |
2183 | 2181 | } |
@@ -2570,8 +2568,7 @@ discard block |
||
2570 | 2568 | YVYU YVYU 4:2:2 Packed |
2571 | 2569 | ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) |
2572 | 2570 | ZPEG Metheus Video Zipper |
2573 | - |
|
2574 | - */ |
|
2571 | + */ |
|
2575 | 2572 | |
2576 | 2573 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2574 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if ($RIFFsubtype != 'AMV ') { |
80 | 80 | // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size |
81 | 81 | // Handled separately in ParseRIFFAMV() |
82 | - $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
82 | + $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
83 | 83 | } |
84 | 84 | if (($info['avdataend'] - $info['filesize']) == 1) { |
85 | 85 | // LiteWave appears to incorrectly *not* pad actual output file |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } |
112 | - $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
112 | + $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
113 | 113 | $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4)); |
114 | - $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
114 | + $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
115 | 115 | $chunkdata = array(); |
116 | 116 | $chunkdata['offset'] = $nextRIFFoffset + 8; |
117 | 117 | $chunkdata['size'] = $nextRIFFsize; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | switch ($nextRIFFheaderID) { |
121 | 121 | case 'RIFF': |
122 | 122 | $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset); |
123 | - if (!isset($thisfile_riff[$nextRIFFtype])) { |
|
123 | + if ( ! isset($thisfile_riff[$nextRIFFtype])) { |
|
124 | 124 | $thisfile_riff[$nextRIFFtype] = array(); |
125 | 125 | } |
126 | 126 | $thisfile_riff[$nextRIFFtype][] = $chunkdata; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); |
191 | 191 | $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; |
192 | - if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
192 | + if ( ! isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
193 | 193 | $info['error'][] = 'Corrupt RIFF file: bitrate_audio == zero'; |
194 | 194 | return false; |
195 | 195 | } |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; |
242 | 242 | |
243 | 243 | $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); |
244 | - $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
245 | - $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
244 | + $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
245 | + $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
246 | 246 | |
247 | 247 | $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); |
248 | 248 | $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; |
280 | 280 | // } |
281 | 281 | } |
282 | - if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
282 | + if ( ! empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
283 | 283 | $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); |
284 | 284 | } |
285 | 285 | |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | // shortcut |
288 | 288 | $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; |
289 | 289 | |
290 | - $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
291 | - $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
292 | - $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
293 | - $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
294 | - $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
295 | - $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
296 | - $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
297 | - $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
298 | - $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
290 | + $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
291 | + $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
292 | + $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
293 | + $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
294 | + $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
295 | + $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
296 | + $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
297 | + $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
298 | + $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
299 | 299 | if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) { |
300 | 300 | if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) { |
301 | - list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
301 | + list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
302 | 302 | list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time; |
303 | 303 | $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']); |
304 | 304 | } else { |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); |
320 | 320 | if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { |
321 | 321 | $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; |
322 | - $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
323 | - $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
322 | + $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
323 | + $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
324 | 324 | |
325 | 325 | $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); |
326 | 326 | } |
@@ -335,27 +335,27 @@ discard block |
||
335 | 335 | // shortcut |
336 | 336 | $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; |
337 | 337 | |
338 | - $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
339 | - $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
340 | - $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
341 | - $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
342 | - $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
343 | - $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
344 | - $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
345 | - $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
346 | - $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
347 | - $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
348 | - $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
349 | - $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
350 | - $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
351 | - $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
352 | - $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
353 | - $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
338 | + $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
339 | + $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
340 | + $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
341 | + $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
342 | + $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
343 | + $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
344 | + $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
345 | + $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
346 | + $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
347 | + $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
348 | + $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
349 | + $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
350 | + $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
351 | + $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
352 | + $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
353 | + $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
354 | 354 | for ($i = 0; $i < 8; $i++) { |
355 | - $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
355 | + $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
356 | 356 | $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); |
357 | 357 | } |
358 | - $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
358 | + $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
359 | 359 | $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); |
360 | 360 | |
361 | 361 | $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; |
@@ -375,13 +375,13 @@ discard block |
||
375 | 375 | $SNDM_thisTagOffset = 0; |
376 | 376 | $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4)); |
377 | 377 | $SNDM_thisTagOffset += 4; |
378 | - $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
378 | + $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
379 | 379 | $SNDM_thisTagOffset += 4; |
380 | 380 | $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
381 | 381 | $SNDM_thisTagOffset += 2; |
382 | 382 | $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
383 | 383 | $SNDM_thisTagOffset += 2; |
384 | - $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
384 | + $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
385 | 385 | $SNDM_thisTagOffset += $SNDM_thisTagDataSize; |
386 | 386 | |
387 | 387 | if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) { |
@@ -426,15 +426,15 @@ discard block |
||
426 | 426 | @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); |
427 | 427 | $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000); |
428 | 428 | } |
429 | - if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
429 | + if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && ! empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && ! empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
430 | 430 | $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0')); |
431 | 431 | $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']; |
432 | - $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
433 | - $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
434 | - $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
435 | - $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
436 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
437 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
432 | + $h = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
433 | + $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
434 | + $s = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
435 | + $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
436 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
437 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
438 | 438 | } |
439 | 439 | unset($parsedXML); |
440 | 440 | } |
@@ -442,23 +442,23 @@ discard block |
||
442 | 442 | |
443 | 443 | |
444 | 444 | |
445 | - if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
445 | + if ( ! isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
446 | 446 | $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; |
447 | 447 | $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); |
448 | 448 | } |
449 | 449 | |
450 | - if (!empty($info['wavpack'])) { |
|
450 | + if ( ! empty($info['wavpack'])) { |
|
451 | 451 | $thisfile_audio_dataformat = 'wavpack'; |
452 | 452 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
453 | 453 | $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version']; |
454 | 454 | |
455 | 455 | // Reset to the way it was - RIFF parsing will have messed this up |
456 | - $info['avdataend'] = $Original['avdataend']; |
|
456 | + $info['avdataend'] = $Original['avdataend']; |
|
457 | 457 | $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
458 | 458 | |
459 | 459 | $this->fseek($info['avdataoffset'] - 44); |
460 | 460 | $RIFFdata = $this->fread(44); |
461 | - $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
461 | + $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
462 | 462 | $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; |
463 | 463 | |
464 | 464 | if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { |
480 | 480 | switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { |
481 | 481 | case 0x0001: // PCM |
482 | - if (!empty($info['ac3'])) { |
|
482 | + if ( ! empty($info['ac3'])) { |
|
483 | 483 | // Dolby Digital WAV files masquerade as PCM-WAV, but they're not |
484 | 484 | $thisfile_audio['wformattag'] = 0x2000; |
485 | 485 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
488 | 488 | $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate']; |
489 | 489 | } |
490 | - if (!empty($info['dts'])) { |
|
490 | + if ( ! empty($info['dts'])) { |
|
491 | 491 | // Dolby DTS files masquerade as PCM-WAV, but they're not |
492 | 492 | $thisfile_audio['wformattag'] = 0x2001; |
493 | 493 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | break; |
499 | 499 | case 0x08AE: // ClearJump LiteWave |
500 | 500 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
501 | - $thisfile_audio_dataformat = 'litewave'; |
|
501 | + $thisfile_audio_dataformat = 'litewave'; |
|
502 | 502 | |
503 | 503 | //typedef struct tagSLwFormat { |
504 | 504 | // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | $riff_litewave['flags']['raw_source'] = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true; |
546 | 546 | $riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true; |
547 | - $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
547 | + $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
548 | 548 | |
549 | 549 | $thisfile_audio['lossless'] = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false); |
550 | 550 | $thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor']; |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | } |
556 | 556 | } |
557 | 557 | if ($info['avdataend'] > $info['filesize']) { |
558 | - switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
559 | - case 'wavpack': // WavPack |
|
560 | - case 'lpac': // LPAC |
|
561 | - case 'ofr': // OptimFROG |
|
562 | - case 'ofs': // OptimFROG DualStream |
|
558 | + switch ( ! empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
559 | + case 'wavpack' : // WavPack |
|
560 | + case 'lpac' : // LPAC |
|
561 | + case 'ofr' : // OptimFROG |
|
562 | + case 'ofs' : // OptimFROG DualStream |
|
563 | 563 | // lossless compressed audio formats that keep original RIFF headers - skip warning |
564 | 564 | break; |
565 | 565 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | break; |
590 | 590 | } |
591 | 591 | } |
592 | - if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
592 | + if ( ! empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
593 | 593 | if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) { |
594 | 594 | $info['avdataend']--; |
595 | 595 | $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) { |
599 | 599 | unset($thisfile_audio['bits_per_sample']); |
600 | - if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
600 | + if ( ! empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
601 | 601 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
602 | 602 | } |
603 | 603 | } |
@@ -638,11 +638,11 @@ discard block |
||
638 | 638 | foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { |
639 | 639 | $ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; |
640 | 640 | |
641 | - $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
642 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
643 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
644 | - $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
645 | - $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
641 | + $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
642 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
643 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
644 | + $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
645 | + $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
646 | 646 | $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($ahsisd, 12, 4)); |
647 | 647 | |
648 | 648 | //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']]; |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | $thisfile_riff_raw['avih'] = array(); |
659 | 659 | $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; |
660 | 660 | |
661 | - $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
661 | + $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
662 | 662 | if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { |
663 | 663 | $info['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'; |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | |
667 | 667 | $flags = array( |
668 | - 'dwMaxBytesPerSec', // max. transfer rate |
|
669 | - 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
670 | - 'dwFlags', // the ever-present flags |
|
671 | - 'dwTotalFrames', // # frames in file |
|
672 | - 'dwInitialFrames', // |
|
673 | - 'dwStreams', // |
|
674 | - 'dwSuggestedBufferSize', // |
|
675 | - 'dwWidth', // |
|
676 | - 'dwHeight', // |
|
677 | - 'dwScale', // |
|
678 | - 'dwRate', // |
|
679 | - 'dwStart', // |
|
680 | - 'dwLength', // |
|
668 | + 'dwMaxBytesPerSec', // max. transfer rate |
|
669 | + 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
670 | + 'dwFlags', // the ever-present flags |
|
671 | + 'dwTotalFrames', // # frames in file |
|
672 | + 'dwInitialFrames', // |
|
673 | + 'dwStreams', // |
|
674 | + 'dwSuggestedBufferSize', // |
|
675 | + 'dwWidth', // |
|
676 | + 'dwHeight', // |
|
677 | + 'dwScale', // |
|
678 | + 'dwRate', // |
|
679 | + 'dwStart', // |
|
680 | + 'dwLength', // |
|
681 | 681 | ); |
682 | 682 | $avih_offset = 4; |
683 | 683 | foreach ($flags as $flag) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { |
723 | 723 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { |
724 | 724 | $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; |
725 | - $strhfccType = substr($strhData, 0, 4); |
|
725 | + $strhfccType = substr($strhData, 0, 4); |
|
726 | 726 | |
727 | 727 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { |
728 | 728 | $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; |
@@ -806,9 +806,9 @@ discard block |
||
806 | 806 | $thisfile_riff_raw['strh'][$i] = array(); |
807 | 807 | $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; |
808 | 808 | |
809 | - $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
810 | - $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
811 | - $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
809 | + $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
810 | + $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
811 | + $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
812 | 812 | $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2)); |
813 | 813 | $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2)); |
814 | 814 | $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4)); |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']); |
825 | 825 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; |
826 | - if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
826 | + if ( ! $thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
827 | 827 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); |
828 | 828 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; |
829 | 829 | } |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | case 'HFYU': // Huffman Lossless Codec |
878 | 878 | case 'IRAW': // Intel YUV Uncompressed |
879 | 879 | case 'YUY2': // Uncompressed YUV 4:2:2 |
880 | - $thisfile_video['lossless'] = true; |
|
880 | + $thisfile_video['lossless'] = true; |
|
881 | 881 | //$thisfile_video['bits_per_sample'] = 24; |
882 | 882 | break; |
883 | 883 | |
884 | 884 | default: |
885 | - $thisfile_video['lossless'] = false; |
|
885 | + $thisfile_video['lossless'] = false; |
|
886 | 886 | //$thisfile_video['bits_per_sample'] = 24; |
887 | 887 | break; |
888 | 888 | } |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | $info['fileformat'] = 'cda'; |
915 | 915 | unset($info['mime_type']); |
916 | 916 | |
917 | - $thisfile_audio_dataformat = 'cda'; |
|
917 | + $thisfile_audio_dataformat = 'cda'; |
|
918 | 918 | |
919 | 919 | $info['avdataoffset'] = 44; |
920 | 920 | |
@@ -922,10 +922,10 @@ discard block |
||
922 | 922 | // shortcut |
923 | 923 | $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; |
924 | 924 | |
925 | - $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
926 | - $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
927 | - $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
928 | - $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
925 | + $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
926 | + $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
927 | + $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
928 | + $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
929 | 929 | $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); |
930 | 930 | $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); |
931 | 931 | $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); |
@@ -974,15 +974,15 @@ discard block |
||
974 | 974 | // shortcut |
975 | 975 | $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; |
976 | 976 | |
977 | - $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
978 | - $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
979 | - $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
980 | - $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
977 | + $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
978 | + $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
979 | + $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
980 | + $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
981 | 981 | |
982 | 982 | if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { |
983 | - $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
984 | - $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
985 | - $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
983 | + $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
984 | + $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
985 | + $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
986 | 986 | switch ($thisfile_riff_audio['codec_name']) { |
987 | 987 | case 'NONE': |
988 | 988 | $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; |
@@ -1014,11 +1014,11 @@ discard block |
||
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
1017 | + $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
1018 | 1018 | if ($thisfile_riff_audio['bits_per_sample'] > 0) { |
1019 | 1019 | $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; |
1020 | 1020 | } |
1021 | - $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
1021 | + $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
1022 | 1022 | if ($thisfile_audio['sample_rate'] == 0) { |
1023 | 1023 | $info['error'][] = 'Corrupted AIFF file: sample_rate == zero'; |
1024 | 1024 | return false; |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { |
1030 | 1030 | $offset = 0; |
1031 | - $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
1031 | + $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
1032 | 1032 | $offset += 2; |
1033 | 1033 | for ($i = 0; $i < $CommentCount; $i++) { |
1034 | 1034 | $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $offset += 2; |
1038 | 1038 | $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
1039 | 1039 | $offset += 2; |
1040 | - $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
1040 | + $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
1041 | 1041 | $offset += $CommentLength; |
1042 | 1042 | |
1043 | 1043 | $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']); |
@@ -1088,12 +1088,12 @@ discard block |
||
1088 | 1088 | // shortcut |
1089 | 1089 | $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; |
1090 | 1090 | |
1091 | - $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
1092 | - $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
1093 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
1094 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
1095 | - $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
1096 | - $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
1091 | + $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
1092 | + $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
1093 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
1094 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
1095 | + $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
1096 | + $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
1097 | 1097 | $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); |
1098 | 1098 | |
1099 | 1099 | $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; |
1147 | - if (!empty($thisfile_audio['bitrate'])) { |
|
1147 | + if ( ! empty($thisfile_audio['bitrate'])) { |
|
1148 | 1148 | $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8); |
1149 | 1149 | } |
1150 | 1150 | break; |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | $info['fileformat'] = 'vcd'; // Asume Video CD |
1154 | 1154 | $info['mime_type'] = 'video/mpeg'; |
1155 | 1155 | |
1156 | - if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
1156 | + if ( ! empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
1157 | 1157 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true); |
1158 | 1158 | |
1159 | 1159 | $getid3_temp = new getID3(); |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | $ID3v2_key_good = 'id3 '; |
1184 | 1184 | $ID3v2_keys_bad = array('ID3 ', 'tag '); |
1185 | 1185 | foreach ($ID3v2_keys_bad as $ID3v2_key_bad) { |
1186 | - if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
1186 | + if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && ! array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
1187 | 1187 | $thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]; |
1188 | 1188 | $info['warning'][] = 'mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"'; |
1189 | 1189 | } |
@@ -1214,11 +1214,11 @@ discard block |
||
1214 | 1214 | self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']); |
1215 | 1215 | } |
1216 | 1216 | |
1217 | - if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
1217 | + if (empty($thisfile_audio['encoder']) && ! empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
1218 | 1218 | $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version']; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - if (!isset($info['playtime_seconds'])) { |
|
1221 | + if ( ! isset($info['playtime_seconds'])) { |
|
1222 | 1222 | $info['playtime_seconds'] = 0; |
1223 | 1223 | } |
1224 | 1224 | if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { |
@@ -1231,19 +1231,19 @@ discard block |
||
1231 | 1231 | if ($info['playtime_seconds'] > 0) { |
1232 | 1232 | if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
1233 | 1233 | |
1234 | - if (!isset($info['bitrate'])) { |
|
1234 | + if ( ! isset($info['bitrate'])) { |
|
1235 | 1235 | $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1236 | 1236 | } |
1237 | 1237 | |
1238 | - } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { |
|
1238 | + } elseif (isset($thisfile_riff_audio) && ! isset($thisfile_riff_video)) { |
|
1239 | 1239 | |
1240 | - if (!isset($thisfile_audio['bitrate'])) { |
|
1240 | + if ( ! isset($thisfile_audio['bitrate'])) { |
|
1241 | 1241 | $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1242 | 1242 | } |
1243 | 1243 | |
1244 | - } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
1244 | + } elseif ( ! isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
1245 | 1245 | |
1246 | - if (!isset($thisfile_video['bitrate'])) { |
|
1246 | + if ( ! isset($thisfile_video['bitrate'])) { |
|
1247 | 1247 | $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1248 | 1248 | } |
1249 | 1249 | |
@@ -1274,10 +1274,10 @@ discard block |
||
1274 | 1274 | $thisfile_audio['channels'] = $info['mpeg']['audio']['channels']; |
1275 | 1275 | $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate']; |
1276 | 1276 | $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); |
1277 | - if (!empty($info['mpeg']['audio']['codec'])) { |
|
1277 | + if ( ! empty($info['mpeg']['audio']['codec'])) { |
|
1278 | 1278 | $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; |
1279 | 1279 | } |
1280 | - if (!empty($thisfile_audio['streams'])) { |
|
1280 | + if ( ! empty($thisfile_audio['streams'])) { |
|
1281 | 1281 | foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { |
1282 | 1282 | if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { |
1283 | 1283 | $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | |
1297 | - if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
1297 | + if ( ! empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
1298 | 1298 | switch ($thisfile_audio_dataformat) { |
1299 | 1299 | case 'ac3': |
1300 | 1300 | // ignore bits_per_sample |
@@ -1347,23 +1347,23 @@ discard block |
||
1347 | 1347 | $this->fseek($startoffset); |
1348 | 1348 | $maxoffset = min($maxoffset, $info['avdataend']); |
1349 | 1349 | $AMVheader = $this->fread(284); |
1350 | - if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
1351 | - throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
1350 | + if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
1351 | + throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
1352 | 1352 | } |
1353 | - if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
1354 | - throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
1353 | + if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
1354 | + throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
1355 | 1355 | } |
1356 | 1356 | $RIFFchunk = array(); |
1357 | - $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
1358 | - $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
1359 | - $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
1360 | - $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
1361 | - $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
1362 | - $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
1363 | - $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
1364 | - $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
1365 | - $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
1366 | - $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
1357 | + $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
1358 | + $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
1359 | + $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
1360 | + $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
1361 | + $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
1362 | + $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
1363 | + $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
1364 | + $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
1365 | + $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
1366 | + $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
1367 | 1367 | |
1368 | 1368 | $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame']; |
1369 | 1369 | $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x']; |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | |
1373 | 1373 | // the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded |
1374 | 1374 | |
1375 | - if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
1376 | - throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
1375 | + if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
1376 | + throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
1377 | 1377 | } |
1378 | 1378 | // followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144 |
1379 | - if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
1380 | - throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
1379 | + if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
1380 | + throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
1381 | 1381 | } |
1382 | 1382 | // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180 |
1383 | 1383 | |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"'); |
1386 | 1386 | } |
1387 | 1387 | // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256 |
1388 | - if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
1389 | - throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
1388 | + if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
1389 | + throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
1390 | 1390 | } |
1391 | 1391 | // followed by 20 bytes of a modified WAVEFORMATEX: |
1392 | 1392 | // typedef struct { |
@@ -1399,14 +1399,14 @@ discard block |
||
1399 | 1399 | // WORD cbSize; //(Fixme: this seems to be 0 in AMV files) |
1400 | 1400 | // WORD reserved; |
1401 | 1401 | // } WAVEFORMATEX; |
1402 | - $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
1403 | - $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
1404 | - $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
1405 | - $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
1406 | - $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
1407 | - $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
1408 | - $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
1409 | - $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
1402 | + $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
1403 | + $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
1404 | + $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
1405 | + $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
1406 | + $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
1407 | + $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
1408 | + $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
1409 | + $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
1410 | 1410 | |
1411 | 1411 | |
1412 | 1412 | $info['audio']['lossless'] = false; |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | while ($this->ftell() < $maxoffset) { |
1442 | 1442 | $chunknamesize = $this->fread(8); |
1443 | 1443 | //$chunkname = substr($chunknamesize, 0, 4); |
1444 | - $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult |
|
1445 | - $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
1444 | + $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult |
|
1445 | + $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
1446 | 1446 | //if (strlen(trim($chunkname, "\x00")) < 4) { |
1447 | 1447 | if (strlen($chunkname) < 4) { |
1448 | 1448 | $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.'); |
@@ -1464,11 +1464,11 @@ discard block |
||
1464 | 1464 | $RIFFchunk[$listname]['offset'] = $this->ftell() - 4; |
1465 | 1465 | $RIFFchunk[$listname]['size'] = $chunksize; |
1466 | 1466 | |
1467 | - if (!$FoundAllChunksWeNeed) { |
|
1467 | + if ( ! $FoundAllChunksWeNeed) { |
|
1468 | 1468 | $WhereWeWere = $this->ftell(); |
1469 | 1469 | $AudioChunkHeader = $this->fread(12); |
1470 | - $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
1471 | - $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
1470 | + $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
1471 | + $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
1472 | 1472 | $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); |
1473 | 1473 | |
1474 | 1474 | if ($AudioChunkStreamType == 'wb') { |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | if (empty($getid3_temp->info['error'])) { |
1508 | 1508 | $info['audio'] = $getid3_temp->info['audio']; |
1509 | 1509 | $info['ac3'] = $getid3_temp->info['ac3']; |
1510 | - if (!empty($getid3_temp->info['warning'])) { |
|
1510 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1511 | 1511 | foreach ($getid3_temp->info['warning'] as $key => $value) { |
1512 | 1512 | $info['warning'][] = $value; |
1513 | 1513 | } |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | |
1524 | 1524 | } else { |
1525 | 1525 | |
1526 | - if (!isset($RIFFchunk[$listname])) { |
|
1526 | + if ( ! isset($RIFFchunk[$listname])) { |
|
1527 | 1527 | $RIFFchunk[$listname] = array(); |
1528 | 1528 | } |
1529 | 1529 | $LISTchunkParent = $listname; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | if (empty($getid3_temp->info['error'])) { |
1600 | 1600 | $info['audio'] = $getid3_temp->info['audio']; |
1601 | 1601 | $info['ac3'] = $getid3_temp->info['ac3']; |
1602 | - if (!empty($getid3_temp->info['warning'])) { |
|
1602 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1603 | 1603 | foreach ($getid3_temp->info['warning'] as $newerror) { |
1604 | 1604 | $this->warning('getid3_ac3() says: ['.$newerror.']'); |
1605 | 1605 | } |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | $info['audio'] = $getid3_temp->info['audio']; |
1620 | 1620 | $info['dts'] = $getid3_temp->info['dts']; |
1621 | 1621 | $info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing |
1622 | - if (!empty($getid3_temp->info['warning'])) { |
|
1622 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1623 | 1623 | foreach ($getid3_temp->info['warning'] as $newerror) { |
1624 | 1624 | $this->warning('getid3_dts() says: ['.$newerror.']'); |
1625 | 1625 | } |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | // break; |
1681 | 1681 | |
1682 | 1682 | default: |
1683 | - if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
1683 | + if ( ! empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
1684 | 1684 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; |
1685 | 1685 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; |
1686 | 1686 | unset($RIFFchunk[$chunkname][$thisindex]['offset']); |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { |
1801 | 1801 | if (trim($commentdata['data']) != '') { |
1802 | 1802 | if (isset($CommentsTargetArray[$value])) { |
1803 | - $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
1803 | + $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
1804 | 1804 | } else { |
1805 | 1805 | $CommentsTargetArray[$value] = array(trim($commentdata['data'])); |
1806 | 1806 | } |
@@ -1816,14 +1816,14 @@ discard block |
||
1816 | 1816 | $WaveFormatEx['raw'] = array(); |
1817 | 1817 | $WaveFormatEx_raw = &$WaveFormatEx['raw']; |
1818 | 1818 | |
1819 | - $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
1820 | - $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
1821 | - $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
1822 | - $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
1819 | + $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
1820 | + $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
1821 | + $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
1822 | + $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
1823 | 1823 | $WaveFormatEx_raw['nBlockAlign'] = substr($WaveFormatExData, 12, 2); |
1824 | 1824 | $WaveFormatEx_raw['wBitsPerSample'] = substr($WaveFormatExData, 14, 2); |
1825 | 1825 | if (strlen($WaveFormatExData) > 16) { |
1826 | - $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
1826 | + $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
1827 | 1827 | } |
1828 | 1828 | $WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw); |
1829 | 1829 | |
@@ -1852,20 +1852,20 @@ discard block |
||
1852 | 1852 | $info['wavpack'] = array(); |
1853 | 1853 | $thisfile_wavpack = &$info['wavpack']; |
1854 | 1854 | |
1855 | - $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
1855 | + $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
1856 | 1856 | if ($thisfile_wavpack['version'] >= 2) { |
1857 | - $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
1857 | + $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
1858 | 1858 | } |
1859 | 1859 | if ($thisfile_wavpack['version'] >= 3) { |
1860 | - $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
1861 | - $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
1862 | - $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
1860 | + $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
1861 | + $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
1862 | + $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
1863 | 1863 | $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); |
1864 | 1864 | $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); |
1865 | - $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
1865 | + $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
1866 | 1866 | $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); |
1867 | 1867 | for ($i = 0; $i <= 2; $i++) { |
1868 | - $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
1868 | + $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | // shortcut |
@@ -1897,11 +1897,11 @@ discard block |
||
1897 | 1897 | return true; |
1898 | 1898 | } |
1899 | 1899 | |
1900 | - public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { |
|
1900 | + public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian = true) { |
|
1901 | 1901 | |
1902 | - $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
1903 | - $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
1904 | - $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
1902 | + $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
1903 | + $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
1904 | + $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
1905 | 1905 | $parsed['biPlanes'] = substr($BITMAPINFOHEADER, 12, 2); // number of color planes on the target device. In most cases this value must be set to 1 |
1906 | 1906 | $parsed['biBitCount'] = substr($BITMAPINFOHEADER, 14, 2); // Specifies the number of bits per pixels |
1907 | 1907 | $parsed['biSizeImage'] = substr($BITMAPINFOHEADER, 20, 4); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) |
@@ -1911,12 +1911,12 @@ discard block |
||
1911 | 1911 | $parsed['biClrImportant'] = substr($BITMAPINFOHEADER, 36, 4); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important |
1912 | 1912 | $parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed); |
1913 | 1913 | |
1914 | - $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
1914 | + $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
1915 | 1915 | |
1916 | 1916 | return $parsed; |
1917 | 1917 | } |
1918 | 1918 | |
1919 | - public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
|
1919 | + public static function ParseDIVXTAG($DIVXTAG, $raw = false) { |
|
1920 | 1920 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
1921 | 1921 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
1922 | 1922 | // 'Byte Layout: '1111111111111111 |
@@ -1929,7 +1929,7 @@ discard block |
||
1929 | 1929 | // '5 for Future Additions - 0 '333400000DIVXTAG |
1930 | 1930 | // '128 bytes total |
1931 | 1931 | |
1932 | - static $DIVXTAGgenre = array( |
|
1932 | + static $DIVXTAGgenre = array( |
|
1933 | 1933 | 0 => 'Action', |
1934 | 1934 | 1 => 'Action/Adventure', |
1935 | 1935 | 2 => 'Adventure', |
@@ -1962,22 +1962,22 @@ discard block |
||
1962 | 1962 | 5 => 'NC-17', |
1963 | 1963 | ); |
1964 | 1964 | |
1965 | - $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
1966 | - $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
1967 | - $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
1968 | - $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
1969 | - $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
1970 | - $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
1965 | + $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
1966 | + $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
1967 | + $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
1968 | + $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
1969 | + $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
1970 | + $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
1971 | 1971 | //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null |
1972 | 1972 | //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG" |
1973 | 1973 | |
1974 | - $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
1974 | + $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
1975 | 1975 | $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']); |
1976 | 1976 | |
1977 | - if (!$raw) { |
|
1977 | + if ( ! $raw) { |
|
1978 | 1978 | unset($parsed['genre_id'], $parsed['rating_id']); |
1979 | 1979 | foreach ($parsed as $key => $value) { |
1980 | - if (!$value === '') { |
|
1980 | + if ( ! $value === '') { |
|
1981 | 1981 | unset($parsed['key']); |
1982 | 1982 | } |
1983 | 1983 | } |
@@ -2576,7 +2576,7 @@ discard block |
||
2576 | 2576 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2577 | } |
2578 | 2578 | |
2579 | - private function EitherEndian2Int($byteword, $signed=false) { |
|
2579 | + private function EitherEndian2Int($byteword, $signed = false) { |
|
2580 | 2580 | if ($this->container == 'riff') { |
2581 | 2581 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
2582 | 2582 | } |
@@ -234,6 +234,9 @@ discard block |
||
234 | 234 | return true; |
235 | 235 | } |
236 | 236 | |
237 | + /** |
|
238 | + * @param integer $length |
|
239 | + */ |
|
237 | 240 | private function readHeaderBSI($length) { |
238 | 241 | $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length); |
239 | 242 | $this->BSIoffset += $length; |
@@ -323,6 +326,9 @@ discard block |
||
323 | 326 | return (isset($dolbySurroundModeLookup[$dsurmod]) ? $dolbySurroundModeLookup[$dsurmod] : false); |
324 | 327 | } |
325 | 328 | |
329 | + /** |
|
330 | + * @param boolean $lfeon |
|
331 | + */ |
|
326 | 332 | public static function channelsEnabledLookup($acmod, $lfeon) { |
327 | 333 | $lookup = array( |
328 | 334 | 'ch1'=>(bool) ($acmod == 0), |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | |
18 | 18 | class getid3_ac3 extends getid3_handler |
19 | 19 | { |
20 | - private $AC3header = array(); |
|
21 | - private $BSIoffset = 0; |
|
20 | + private $AC3header = array(); |
|
21 | + private $BSIoffset = 0; |
|
22 | 22 | |
23 | - const syncword = "\x0B\x77"; |
|
23 | + const syncword = "\x0B\x77"; |
|
24 | 24 | |
25 | 25 | public function Analyze() { |
26 | 26 | $info = &$this->getid3->info; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // If this standard is extended by the addition of additional elements or features, a value of bsid greater than 8 will be used. |
97 | 97 | // Decoders built to this version of the standard will not be able to decode versions with bsid greater than 8. |
98 | 98 | $this->error('Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 8'); |
99 | - unset($info['ac3']); |
|
99 | + unset($info['ac3']); |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $thisfile_ac3_raw['synchinfo']['synchword'] = self::syncword; |
62 | 62 | $offset = 2; |
63 | 63 | } else { |
64 | - if (!$this->isDependencyFor('matroska')) { |
|
64 | + if ( ! $this->isDependencyFor('matroska')) { |
|
65 | 65 | unset($info['fileformat'], $info['ac3']); |
66 | 66 | return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($this->AC3header['syncinfo'], 0, 2)).'"'); |
67 | 67 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $thisfile_ac3['service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']); |
107 | 107 | $ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']); |
108 | - foreach($ac3_coding_mode as $key => $value) { |
|
108 | + foreach ($ac3_coding_mode as $key => $value) { |
|
109 | 109 | $thisfile_ac3[$key] = $value; |
110 | 110 | } |
111 | 111 | switch ($thisfile_ac3_raw_bsi['acmod']) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $serviceTypeLookup[6][$i] = 'associated service: emergency (E)'; |
265 | 265 | } |
266 | 266 | |
267 | - $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; |
|
267 | + $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; |
|
268 | 268 | for ($i = 2; $i <= 7; $i++) { |
269 | 269 | $serviceTypeLookup[7][$i] = 'main audio service: karaoke'; |
270 | 270 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | |
275 | 275 | public static function audioCodingModeLookup($acmod) { |
276 | 276 | // array(channel configuration, # channels (not incl LFE), channel order) |
277 | - static $audioCodingModeLookup = array ( |
|
277 | + static $audioCodingModeLookup = array( |
|
278 | 278 | 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'), |
279 | 279 | 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'), |
280 | 280 | 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'), |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | switch ($acmod) { |
338 | 338 | case 4: |
339 | 339 | case 5: |
340 | - $lookup['surround_mono'] = true; |
|
340 | + $lookup['surround_mono'] = true; |
|
341 | 341 | break; |
342 | 342 | case 6: |
343 | 343 | case 7: |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | |
411 | 411 | public static function frameSizeLookup($frmsizecod, $fscod) { |
412 | 412 | $padding = (bool) ($frmsizecod % 2); |
413 | - $framesizeid = floor($frmsizecod / 2); |
|
413 | + $framesizeid = floor($frmsizecod / 2); |
|
414 | 414 | |
415 | 415 | static $frameSizeLookup = array(); |
416 | 416 | if (empty($frameSizeLookup)) { |
417 | - $frameSizeLookup = array ( |
|
417 | + $frameSizeLookup = array( |
|
418 | 418 | 0 => array(128, 138, 192), |
419 | 419 | 1 => array(40, 160, 174, 240), |
420 | 420 | 2 => array(48, 192, 208, 288), |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | public static function bitrateLookup($frmsizecod) { |
447 | - $framesizeid = floor($frmsizecod / 2); |
|
447 | + $framesizeid = floor($frmsizecod / 2); |
|
448 | 448 | |
449 | 449 | static $bitrateLookup = array( |
450 | 450 | 0 => 32000, |