@@ -15,4 +15,4 @@ |
||
15 | 15 | define('IS_PROFILE_PAGE', true); |
16 | 16 | |
17 | 17 | /** Load User Editing Page */ |
18 | -require_once( dirname( __FILE__ ) . '/user-edit.php' ); |
|
18 | +require_once(dirname(__FILE__).'/user-edit.php'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** Load WordPress Bootstrap */ |
38 | 38 | require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
39 | 39 | |
40 | -if ( ! function_exists('maybe_create_table') ) : |
|
40 | +if ( ! function_exists('maybe_create_table')) : |
|
41 | 41 | /** |
42 | 42 | * Create database table, if it doesn't already exist. |
43 | 43 | * |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function maybe_create_table($table_name, $create_ddl) { |
53 | 53 | global $wpdb; |
54 | - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
|
54 | + foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) { |
|
55 | 55 | if ($table == $table_name) { |
56 | 56 | return true; |
57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $wpdb->query($create_ddl); |
61 | 61 | |
62 | 62 | // We cannot directly tell that whether this succeeded! |
63 | - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
|
63 | + foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) { |
|
64 | 64 | if ($table == $table_name) { |
65 | 65 | return true; |
66 | 66 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | endif; |
71 | 71 | |
72 | -if ( ! function_exists('maybe_add_column') ) : |
|
72 | +if ( ! function_exists('maybe_add_column')) : |
|
73 | 73 | /** |
74 | 74 | * Add column to database table, if column doesn't already exist in table. |
75 | 75 | * |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function maybe_add_column($table_name, $column_name, $create_ddl) { |
86 | 86 | global $wpdb; |
87 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
87 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
88 | 88 | |
89 | 89 | if ($column == $column_name) { |
90 | 90 | return true; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $wpdb->query($create_ddl); |
96 | 96 | |
97 | 97 | // We cannot directly tell that whether this succeeded! |
98 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
98 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
99 | 99 | if ($column == $column_name) { |
100 | 100 | return true; |
101 | 101 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function maybe_drop_column($table_name, $column_name, $drop_ddl) { |
120 | 120 | global $wpdb; |
121 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
121 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
122 | 122 | if ($column == $column_name) { |
123 | 123 | |
124 | 124 | // Found it, so try to drop it. |
125 | 125 | $wpdb->query($drop_ddl); |
126 | 126 | |
127 | 127 | // We cannot directly tell that whether this succeeded! |
128 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
128 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
129 | 129 | if ($column == $column_name) { |
130 | 130 | return false; |
131 | 131 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $diffs = 0; |
171 | 171 | $results = $wpdb->get_results("DESC $table_name"); |
172 | 172 | |
173 | - foreach ($results as $row ) { |
|
173 | + foreach ($results as $row) { |
|
174 | 174 | |
175 | 175 | if ($row->Field == $col_name) { |
176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if (($is_null != null) && ($row->Null != $is_null)) { |
182 | 182 | ++$diffs; |
183 | 183 | } |
184 | - if (($key != null) && ($row->Key != $key)) { |
|
184 | + if (($key != null) && ($row->Key != $key)) { |
|
185 | 185 | ++$diffs; |
186 | 186 | } |
187 | 187 | if (($default != null) && ($row->Default != $default)) { |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_redirect( network_admin_url('users.php') ); |
|
12 | +wp_redirect(network_admin_url('users.php')); |
|
13 | 13 | exit; |
@@ -22,12 +22,13 @@ discard block |
||
22 | 22 | // On which page are we ? |
23 | 23 | if ( is_admin() ) { |
24 | 24 | // wp-admin pages are checked more carefully |
25 | - if ( is_network_admin() ) |
|
26 | - preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
27 | - elseif ( is_user_admin() ) |
|
28 | - preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
29 | - else |
|
30 | - preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
25 | + if ( is_network_admin() ) { |
|
26 | + preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
27 | + } elseif ( is_user_admin() ) { |
|
28 | + preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
29 | + } else { |
|
30 | + preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
|
31 | + } |
|
31 | 32 | $pagenow = $self_matches[1]; |
32 | 33 | $pagenow = trim($pagenow, '/'); |
33 | 34 | $pagenow = preg_replace('#\?.*?$#', '', $pagenow); |
@@ -36,15 +37,18 @@ discard block |
||
36 | 37 | } else { |
37 | 38 | preg_match('#(.*?)(/|$)#', $pagenow, $self_matches); |
38 | 39 | $pagenow = strtolower($self_matches[1]); |
39 | - if ( '.php' !== substr($pagenow, -4, 4) ) |
|
40 | - $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried) |
|
40 | + if ( '.php' !== substr($pagenow, -4, 4) ) { |
|
41 | + $pagenow .= '.php'; |
|
42 | + } |
|
43 | + // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried) |
|
41 | 44 | } |
42 | 45 | } else { |
43 | - if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) ) |
|
44 | - $pagenow = strtolower($self_matches[1]); |
|
45 | - else |
|
46 | - $pagenow = 'index.php'; |
|
47 | -} |
|
46 | + if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) ) { |
|
47 | + $pagenow = strtolower($self_matches[1]); |
|
48 | + } else { |
|
49 | + $pagenow = 'index.php'; |
|
50 | + } |
|
51 | + } |
|
48 | 52 | unset($self_matches); |
49 | 53 | |
50 | 54 | // Simple browser detection |
@@ -63,8 +67,9 @@ discard block |
||
63 | 67 | * |
64 | 68 | * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin(). |
65 | 69 | */ |
66 | - if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) ) |
|
67 | - header( 'X-UA-Compatible: chrome=1' ); |
|
70 | + if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) ) { |
|
71 | + header( 'X-UA-Compatible: chrome=1' ); |
|
72 | + } |
|
68 | 73 | $is_winIE = ! $is_chrome; |
69 | 74 | } else { |
70 | 75 | $is_chrome = true; |
@@ -84,8 +89,9 @@ discard block |
||
84 | 89 | } |
85 | 90 | } |
86 | 91 | |
87 | -if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false ) |
|
92 | +if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false ) { |
|
88 | 93 | $is_iphone = true; |
94 | +} |
|
89 | 95 | |
90 | 96 | $is_IE = ( $is_macIE || $is_winIE ); |
91 | 97 |
@@ -20,27 +20,27 @@ discard block |
||
20 | 20 | $is_apache, $is_IIS, $is_iis7, $is_nginx; |
21 | 21 | |
22 | 22 | // On which page are we ? |
23 | -if ( is_admin() ) { |
|
23 | +if (is_admin()) { |
|
24 | 24 | // wp-admin pages are checked more carefully |
25 | - if ( is_network_admin() ) |
|
25 | + if (is_network_admin()) |
|
26 | 26 | preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
27 | - elseif ( is_user_admin() ) |
|
27 | + elseif (is_user_admin()) |
|
28 | 28 | preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
29 | 29 | else |
30 | 30 | preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches); |
31 | 31 | $pagenow = $self_matches[1]; |
32 | 32 | $pagenow = trim($pagenow, '/'); |
33 | 33 | $pagenow = preg_replace('#\?.*?$#', '', $pagenow); |
34 | - if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) { |
|
34 | + if ('' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow) { |
|
35 | 35 | $pagenow = 'index.php'; |
36 | 36 | } else { |
37 | 37 | preg_match('#(.*?)(/|$)#', $pagenow, $self_matches); |
38 | 38 | $pagenow = strtolower($self_matches[1]); |
39 | - if ( '.php' !== substr($pagenow, -4, 4) ) |
|
39 | + if ('.php' !== substr($pagenow, -4, 4)) |
|
40 | 40 | $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried) |
41 | 41 | } |
42 | 42 | } else { |
43 | - if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) ) |
|
43 | + if (preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches)) |
|
44 | 44 | $pagenow = strtolower($self_matches[1]); |
45 | 45 | else |
46 | 46 | $pagenow = 'index.php'; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | // Simple browser detection |
51 | 51 | $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = $is_edge = false; |
52 | 52 | |
53 | -if ( isset($_SERVER['HTTP_USER_AGENT']) ) { |
|
54 | - if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) { |
|
53 | +if (isset($_SERVER['HTTP_USER_AGENT'])) { |
|
54 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { |
|
55 | 55 | $is_lynx = true; |
56 | - } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) { |
|
56 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Edge') !== false) { |
|
57 | 57 | $is_edge = true; |
58 | - } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) { |
|
59 | - if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) { |
|
58 | + } elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false) { |
|
59 | + if (stripos($_SERVER['HTTP_USER_AGENT'], 'chromeframe') !== false) { |
|
60 | 60 | $is_admin = is_admin(); |
61 | 61 | /** |
62 | 62 | * Filters whether Google Chrome Frame should be used, if available. |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin(). |
67 | 67 | */ |
68 | - if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) ) |
|
69 | - header( 'X-UA-Compatible: chrome=1' ); |
|
68 | + if ($is_chrome = apply_filters('use_google_chrome_frame', $is_admin)) |
|
69 | + header('X-UA-Compatible: chrome=1'); |
|
70 | 70 | $is_winIE = ! $is_chrome; |
71 | 71 | } else { |
72 | 72 | $is_chrome = true; |
73 | 73 | } |
74 | - } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) { |
|
74 | + } elseif (stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false) { |
|
75 | 75 | $is_safari = true; |
76 | - } elseif ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false ) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) { |
|
76 | + } elseif ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) { |
|
77 | 77 | $is_winIE = true; |
78 | - } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) { |
|
78 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) { |
|
79 | 79 | $is_macIE = true; |
80 | - } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) { |
|
80 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) { |
|
81 | 81 | $is_gecko = true; |
82 | - } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) { |
|
82 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) { |
|
83 | 83 | $is_opera = true; |
84 | - } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) { |
|
84 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) { |
|
85 | 85 | $is_NS4 = true; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false ) |
|
89 | +if ($is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false) |
|
90 | 90 | $is_iphone = true; |
91 | 91 | |
92 | -$is_IE = ( $is_macIE || $is_winIE ); |
|
92 | +$is_IE = ($is_macIE || $is_winIE); |
|
93 | 93 | |
94 | 94 | // Server detection |
95 | 95 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | * Whether the server software is IIS or something else |
110 | 110 | * @global bool $is_IIS |
111 | 111 | */ |
112 | -$is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); |
|
112 | +$is_IIS = ! $is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Whether the server software is IIS 7.X or greater |
116 | 116 | * @global bool $is_iis7 |
117 | 117 | */ |
118 | -$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7; |
|
118 | +$is_iis7 = $is_IIS && intval(substr($_SERVER['SERVER_SOFTWARE'], strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/') + 14)) >= 7; |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Test if the current browser runs on a mobile device (smart phone, tablet, etc.) |
@@ -125,15 +125,15 @@ discard block |
||
125 | 125 | * @return bool |
126 | 126 | */ |
127 | 127 | function wp_is_mobile() { |
128 | - if ( empty($_SERVER['HTTP_USER_AGENT']) ) { |
|
128 | + if (empty($_SERVER['HTTP_USER_AGENT'])) { |
|
129 | 129 | $is_mobile = false; |
130 | - } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) |
|
130 | + } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) |
|
131 | 131 | || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false |
132 | 132 | || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false |
133 | 133 | || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false |
134 | 134 | || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false |
135 | 135 | || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false |
136 | - || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) { |
|
136 | + || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false) { |
|
137 | 137 | $is_mobile = true; |
138 | 138 | } else { |
139 | 139 | $is_mobile = false; |
@@ -146,5 +146,5 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param bool $is_mobile Whether the request is from a mobile device or not. |
148 | 148 | */ |
149 | - return apply_filters( 'wp_is_mobile', $is_mobile ); |
|
149 | + return apply_filters('wp_is_mobile', $is_mobile); |
|
150 | 150 | } |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | function get_file($path) { |
12 | 12 | |
13 | - if ( function_exists('realpath') ) |
|
13 | + if (function_exists('realpath')) |
|
14 | 14 | $path = realpath($path); |
15 | 15 | |
16 | - if ( ! $path || ! @is_file($path) ) |
|
16 | + if ( ! $path || ! @is_file($path)) |
|
17 | 17 | return false; |
18 | 18 | |
19 | 19 | return @file_get_contents($path); |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | |
24 | 24 | header('Content-Type: application/javascript; charset=UTF-8'); |
25 | 25 | header('Vary: Accept-Encoding'); // Handle proxies |
26 | -header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT'); |
|
26 | +header('Expires: '.gmdate("D, d M Y H:i:s", time() + $expires_offset).' GMT'); |
|
27 | 27 | header("Cache-Control: public, max-age=$expires_offset"); |
28 | 28 | |
29 | -if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) |
|
30 | - && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) { |
|
29 | +if (isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING']) |
|
30 | + && false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ($file = get_file($basepath.'/wp-tinymce.js.gz'))) { |
|
31 | 31 | |
32 | 32 | header('Content-Encoding: gzip'); |
33 | 33 | echo $file; |
34 | 34 | } else { |
35 | 35 | // Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted). |
36 | - echo get_file( $basepath . '/tinymce.min.js' ); |
|
37 | - echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' ); |
|
36 | + echo get_file($basepath.'/tinymce.min.js'); |
|
37 | + echo get_file($basepath.'/plugins/compat3x/plugin.min.js'); |
|
38 | 38 | } |
39 | 39 | exit; |
@@ -10,11 +10,13 @@ |
||
10 | 10 | |
11 | 11 | function get_file($path) { |
12 | 12 | |
13 | - if ( function_exists('realpath') ) |
|
14 | - $path = realpath($path); |
|
13 | + if ( function_exists('realpath') ) { |
|
14 | + $path = realpath($path); |
|
15 | + } |
|
15 | 16 | |
16 | - if ( ! $path || ! @is_file($path) ) |
|
17 | - return false; |
|
17 | + if ( ! $path || ! @is_file($path) ) { |
|
18 | + return false; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | return @file_get_contents($path); |
20 | 22 | } |
@@ -53,13 +53,15 @@ discard block |
||
53 | 53 | * @param mixed $data Optional. Error data. |
54 | 54 | */ |
55 | 55 | public function __construct( $code = '', $message = '', $data = '' ) { |
56 | - if ( empty($code) ) |
|
57 | - return; |
|
56 | + if ( empty($code) ) { |
|
57 | + return; |
|
58 | + } |
|
58 | 59 | |
59 | 60 | $this->errors[$code][] = $message; |
60 | 61 | |
61 | - if ( ! empty($data) ) |
|
62 | - $this->error_data[$code] = $data; |
|
62 | + if ( ! empty($data) ) { |
|
63 | + $this->error_data[$code] = $data; |
|
64 | + } |
|
63 | 65 | } |
64 | 66 | |
65 | 67 | /** |
@@ -71,8 +73,9 @@ discard block |
||
71 | 73 | * @return array List of error codes, if available. |
72 | 74 | */ |
73 | 75 | public function get_error_codes() { |
74 | - if ( empty($this->errors) ) |
|
75 | - return array(); |
|
76 | + if ( empty($this->errors) ) { |
|
77 | + return array(); |
|
78 | + } |
|
76 | 79 | |
77 | 80 | return array_keys($this->errors); |
78 | 81 | } |
@@ -88,8 +91,9 @@ discard block |
||
88 | 91 | public function get_error_code() { |
89 | 92 | $codes = $this->get_error_codes(); |
90 | 93 | |
91 | - if ( empty($codes) ) |
|
92 | - return ''; |
|
94 | + if ( empty($codes) ) { |
|
95 | + return ''; |
|
96 | + } |
|
93 | 97 | |
94 | 98 | return $codes[0]; |
95 | 99 | } |
@@ -106,16 +110,18 @@ discard block |
||
106 | 110 | // Return all messages if no code specified. |
107 | 111 | if ( empty($code) ) { |
108 | 112 | $all_messages = array(); |
109 | - foreach ( (array) $this->errors as $code => $messages ) |
|
110 | - $all_messages = array_merge($all_messages, $messages); |
|
113 | + foreach ( (array) $this->errors as $code => $messages ) { |
|
114 | + $all_messages = array_merge($all_messages, $messages); |
|
115 | + } |
|
111 | 116 | |
112 | 117 | return $all_messages; |
113 | 118 | } |
114 | 119 | |
115 | - if ( isset($this->errors[$code]) ) |
|
116 | - return $this->errors[$code]; |
|
117 | - else |
|
118 | - return array(); |
|
120 | + if ( isset($this->errors[$code]) ) { |
|
121 | + return $this->errors[$code]; |
|
122 | + } else { |
|
123 | + return array(); |
|
124 | + } |
|
119 | 125 | } |
120 | 126 | |
121 | 127 | /** |
@@ -130,11 +136,13 @@ discard block |
||
130 | 136 | * @return string |
131 | 137 | */ |
132 | 138 | public function get_error_message($code = '') { |
133 | - if ( empty($code) ) |
|
134 | - $code = $this->get_error_code(); |
|
139 | + if ( empty($code) ) { |
|
140 | + $code = $this->get_error_code(); |
|
141 | + } |
|
135 | 142 | $messages = $this->get_error_messages($code); |
136 | - if ( empty($messages) ) |
|
137 | - return ''; |
|
143 | + if ( empty($messages) ) { |
|
144 | + return ''; |
|
145 | + } |
|
138 | 146 | return $messages[0]; |
139 | 147 | } |
140 | 148 | |
@@ -147,11 +155,13 @@ discard block |
||
147 | 155 | * @return mixed Error data, if it exists. |
148 | 156 | */ |
149 | 157 | public function get_error_data($code = '') { |
150 | - if ( empty($code) ) |
|
151 | - $code = $this->get_error_code(); |
|
158 | + if ( empty($code) ) { |
|
159 | + $code = $this->get_error_code(); |
|
160 | + } |
|
152 | 161 | |
153 | - if ( isset($this->error_data[$code]) ) |
|
154 | - return $this->error_data[$code]; |
|
162 | + if ( isset($this->error_data[$code]) ) { |
|
163 | + return $this->error_data[$code]; |
|
164 | + } |
|
155 | 165 | } |
156 | 166 | |
157 | 167 | /** |
@@ -166,8 +176,9 @@ discard block |
||
166 | 176 | */ |
167 | 177 | public function add($code, $message, $data = '') { |
168 | 178 | $this->errors[$code][] = $message; |
169 | - if ( ! empty($data) ) |
|
170 | - $this->error_data[$code] = $data; |
|
179 | + if ( ! empty($data) ) { |
|
180 | + $this->error_data[$code] = $data; |
|
181 | + } |
|
171 | 182 | } |
172 | 183 | |
173 | 184 | /** |
@@ -181,8 +192,9 @@ discard block |
||
181 | 192 | * @param string|int $code Error code. |
182 | 193 | */ |
183 | 194 | public function add_data($data, $code = '') { |
184 | - if ( empty($code) ) |
|
185 | - $code = $this->get_error_code(); |
|
195 | + if ( empty($code) ) { |
|
196 | + $code = $this->get_error_code(); |
|
197 | + } |
|
186 | 198 | |
187 | 199 | $this->error_data[$code] = $data; |
188 | 200 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @param string $message Error message |
53 | 53 | * @param mixed $data Optional. Error data. |
54 | 54 | */ |
55 | - public function __construct( $code = '', $message = '', $data = '' ) { |
|
56 | - if ( empty($code) ) |
|
55 | + public function __construct($code = '', $message = '', $data = '') { |
|
56 | + if (empty($code)) |
|
57 | 57 | return; |
58 | 58 | |
59 | 59 | $this->errors[$code][] = $message; |
60 | 60 | |
61 | - if ( ! empty($data) ) |
|
61 | + if ( ! empty($data)) |
|
62 | 62 | $this->error_data[$code] = $data; |
63 | 63 | } |
64 | 64 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return array List of error codes, if available. |
72 | 72 | */ |
73 | 73 | public function get_error_codes() { |
74 | - if ( empty($this->errors) ) |
|
74 | + if (empty($this->errors)) |
|
75 | 75 | return array(); |
76 | 76 | |
77 | 77 | return array_keys($this->errors); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function get_error_code() { |
89 | 89 | $codes = $this->get_error_codes(); |
90 | 90 | |
91 | - if ( empty($codes) ) |
|
91 | + if (empty($codes)) |
|
92 | 92 | return ''; |
93 | 93 | |
94 | 94 | return $codes[0]; |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function get_error_messages($code = '') { |
106 | 106 | // Return all messages if no code specified. |
107 | - if ( empty($code) ) { |
|
107 | + if (empty($code)) { |
|
108 | 108 | $all_messages = array(); |
109 | - foreach ( (array) $this->errors as $code => $messages ) |
|
109 | + foreach ((array) $this->errors as $code => $messages) |
|
110 | 110 | $all_messages = array_merge($all_messages, $messages); |
111 | 111 | |
112 | 112 | return $all_messages; |
113 | 113 | } |
114 | 114 | |
115 | - if ( isset($this->errors[$code]) ) |
|
115 | + if (isset($this->errors[$code])) |
|
116 | 116 | return $this->errors[$code]; |
117 | 117 | else |
118 | 118 | return array(); |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | * @return string |
131 | 131 | */ |
132 | 132 | public function get_error_message($code = '') { |
133 | - if ( empty($code) ) |
|
133 | + if (empty($code)) |
|
134 | 134 | $code = $this->get_error_code(); |
135 | 135 | $messages = $this->get_error_messages($code); |
136 | - if ( empty($messages) ) |
|
136 | + if (empty($messages)) |
|
137 | 137 | return ''; |
138 | 138 | return $messages[0]; |
139 | 139 | } |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @return mixed Error data, if it exists. |
148 | 148 | */ |
149 | 149 | public function get_error_data($code = '') { |
150 | - if ( empty($code) ) |
|
150 | + if (empty($code)) |
|
151 | 151 | $code = $this->get_error_code(); |
152 | 152 | |
153 | - if ( isset($this->error_data[$code]) ) |
|
153 | + if (isset($this->error_data[$code])) |
|
154 | 154 | return $this->error_data[$code]; |
155 | 155 | } |
156 | 156 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function add($code, $message, $data = '') { |
168 | 168 | $this->errors[$code][] = $message; |
169 | - if ( ! empty($data) ) |
|
169 | + if ( ! empty($data)) |
|
170 | 170 | $this->error_data[$code] = $data; |
171 | 171 | } |
172 | 172 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param string|int $code Error code. |
182 | 182 | */ |
183 | 183 | public function add_data($data, $code = '') { |
184 | - if ( empty($code) ) |
|
184 | + if (empty($code)) |
|
185 | 185 | $code = $this->get_error_code(); |
186 | 186 | |
187 | 187 | $this->error_data[$code] = $data; |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string|int $code Error code. |
199 | 199 | */ |
200 | - public function remove( $code ) { |
|
201 | - unset( $this->errors[ $code ] ); |
|
202 | - unset( $this->error_data[ $code ] ); |
|
200 | + public function remove($code) { |
|
201 | + unset($this->errors[$code]); |
|
202 | + unset($this->error_data[$code]); |
|
203 | 203 | } |
204 | 204 | } |
@@ -22,10 +22,11 @@ discard block |
||
22 | 22 | global $wpdb; |
23 | 23 | |
24 | 24 | if ( empty($bookmark) ) { |
25 | - if ( isset($GLOBALS['link']) ) |
|
26 | - $_bookmark = & $GLOBALS['link']; |
|
27 | - else |
|
28 | - $_bookmark = null; |
|
25 | + if ( isset($GLOBALS['link']) ) { |
|
26 | + $_bookmark = & $GLOBALS['link']; |
|
27 | + } else { |
|
28 | + $_bookmark = null; |
|
29 | + } |
|
29 | 30 | } elseif ( is_object($bookmark) ) { |
30 | 31 | wp_cache_add($bookmark->link_id, $bookmark, 'bookmark'); |
31 | 32 | $_bookmark = $bookmark; |
@@ -41,8 +42,9 @@ discard block |
||
41 | 42 | } |
42 | 43 | } |
43 | 44 | |
44 | - if ( ! $_bookmark ) |
|
45 | - return $_bookmark; |
|
45 | + if ( ! $_bookmark ) { |
|
46 | + return $_bookmark; |
|
47 | + } |
|
46 | 48 | |
47 | 49 | $_bookmark = sanitize_bookmark($_bookmark, $filter); |
48 | 50 | |
@@ -71,14 +73,17 @@ discard block |
||
71 | 73 | $bookmark = (int) $bookmark; |
72 | 74 | $bookmark = get_bookmark( $bookmark ); |
73 | 75 | |
74 | - if ( is_wp_error($bookmark) ) |
|
75 | - return $bookmark; |
|
76 | + if ( is_wp_error($bookmark) ) { |
|
77 | + return $bookmark; |
|
78 | + } |
|
76 | 79 | |
77 | - if ( !is_object($bookmark) ) |
|
78 | - return ''; |
|
80 | + if ( !is_object($bookmark) ) { |
|
81 | + return ''; |
|
82 | + } |
|
79 | 83 | |
80 | - if ( !isset($bookmark->$field) ) |
|
81 | - return ''; |
|
84 | + if ( !isset($bookmark->$field) ) { |
|
85 | + return ''; |
|
86 | + } |
|
82 | 87 | |
83 | 88 | return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context); |
84 | 89 | } |
@@ -317,11 +322,13 @@ discard block |
||
317 | 322 | |
318 | 323 | foreach ( $fields as $field ) { |
319 | 324 | if ( $do_object ) { |
320 | - if ( isset($bookmark->$field) ) |
|
321 | - $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context); |
|
325 | + if ( isset($bookmark->$field) ) { |
|
326 | + $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context); |
|
327 | + } |
|
322 | 328 | } else { |
323 | - if ( isset($bookmark[$field]) ) |
|
324 | - $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context); |
|
329 | + if ( isset($bookmark[$field]) ) { |
|
330 | + $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context); |
|
331 | + } |
|
325 | 332 | } |
326 | 333 | } |
327 | 334 | |
@@ -369,13 +376,15 @@ discard block |
||
369 | 376 | break; |
370 | 377 | case 'link_target' : // "enum" |
371 | 378 | $targets = array('_top', '_blank'); |
372 | - if ( ! in_array($value, $targets) ) |
|
373 | - $value = ''; |
|
379 | + if ( ! in_array($value, $targets) ) { |
|
380 | + $value = ''; |
|
381 | + } |
|
374 | 382 | break; |
375 | 383 | } |
376 | 384 | |
377 | - if ( 'raw' == $context ) |
|
378 | - return $value; |
|
385 | + if ( 'raw' == $context ) { |
|
386 | + return $value; |
|
387 | + } |
|
379 | 388 | |
380 | 389 | if ( 'edit' == $context ) { |
381 | 390 | /** This filter is documented in wp-includes/post.php */ |
@@ -22,36 +22,36 @@ discard block |
||
22 | 22 | function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') { |
23 | 23 | global $wpdb; |
24 | 24 | |
25 | - if ( empty($bookmark) ) { |
|
26 | - if ( isset($GLOBALS['link']) ) |
|
25 | + if (empty($bookmark)) { |
|
26 | + if (isset($GLOBALS['link'])) |
|
27 | 27 | $_bookmark = & $GLOBALS['link']; |
28 | 28 | else |
29 | 29 | $_bookmark = null; |
30 | - } elseif ( is_object($bookmark) ) { |
|
30 | + } elseif (is_object($bookmark)) { |
|
31 | 31 | wp_cache_add($bookmark->link_id, $bookmark, 'bookmark'); |
32 | 32 | $_bookmark = $bookmark; |
33 | 33 | } else { |
34 | - if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) { |
|
34 | + if (isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark)) { |
|
35 | 35 | $_bookmark = & $GLOBALS['link']; |
36 | - } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { |
|
36 | + } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark')) { |
|
37 | 37 | $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); |
38 | - if ( $_bookmark ) { |
|
39 | - $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); |
|
40 | - wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); |
|
38 | + if ($_bookmark) { |
|
39 | + $_bookmark->link_category = array_unique(wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids'))); |
|
40 | + wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark'); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | - if ( ! $_bookmark ) |
|
45 | + if ( ! $_bookmark) |
|
46 | 46 | return $_bookmark; |
47 | 47 | |
48 | 48 | $_bookmark = sanitize_bookmark($_bookmark, $filter); |
49 | 49 | |
50 | - if ( $output == OBJECT ) { |
|
50 | + if ($output == OBJECT) { |
|
51 | 51 | return $_bookmark; |
52 | - } elseif ( $output == ARRAY_A ) { |
|
52 | + } elseif ($output == ARRAY_A) { |
|
53 | 53 | return get_object_vars($_bookmark); |
54 | - } elseif ( $output == ARRAY_N ) { |
|
54 | + } elseif ($output == ARRAY_N) { |
|
55 | 55 | return array_values(get_object_vars($_bookmark)); |
56 | 56 | } else { |
57 | 57 | return $_bookmark; |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | * @param string $context Optional. The context of how the field will be used. |
69 | 69 | * @return string|WP_Error |
70 | 70 | */ |
71 | -function get_bookmark_field( $field, $bookmark, $context = 'display' ) { |
|
71 | +function get_bookmark_field($field, $bookmark, $context = 'display') { |
|
72 | 72 | $bookmark = (int) $bookmark; |
73 | - $bookmark = get_bookmark( $bookmark ); |
|
73 | + $bookmark = get_bookmark($bookmark); |
|
74 | 74 | |
75 | - if ( is_wp_error($bookmark) ) |
|
75 | + if (is_wp_error($bookmark)) |
|
76 | 76 | return $bookmark; |
77 | 77 | |
78 | - if ( !is_object($bookmark) ) |
|
78 | + if ( ! is_object($bookmark)) |
|
79 | 79 | return ''; |
80 | 80 | |
81 | - if ( !isset($bookmark->$field) ) |
|
81 | + if ( ! isset($bookmark->$field)) |
|
82 | 82 | return ''; |
83 | 83 | |
84 | 84 | return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * } |
116 | 116 | * @return array List of bookmark row objects. |
117 | 117 | */ |
118 | -function get_bookmarks( $args = '' ) { |
|
118 | +function get_bookmarks($args = '') { |
|
119 | 119 | global $wpdb; |
120 | 120 | |
121 | 121 | $defaults = array( |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | 'exclude' => '', 'search' => '' |
127 | 127 | ); |
128 | 128 | |
129 | - $r = wp_parse_args( $args, $defaults ); |
|
129 | + $r = wp_parse_args($args, $defaults); |
|
130 | 130 | |
131 | - $key = md5( serialize( $r ) ); |
|
131 | + $key = md5(serialize($r)); |
|
132 | 132 | $cache = false; |
133 | - if ( 'rand' !== $r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) { |
|
134 | - if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { |
|
135 | - $bookmarks = $cache[ $key ]; |
|
133 | + if ('rand' !== $r['orderby'] && $cache = wp_cache_get('get_bookmarks', 'bookmark')) { |
|
134 | + if (is_array($cache) && isset($cache[$key])) { |
|
135 | + $bookmarks = $cache[$key]; |
|
136 | 136 | /** |
137 | 137 | * Filters the returned list of bookmarks. |
138 | 138 | * |
@@ -148,98 +148,98 @@ discard block |
||
148 | 148 | * @param array $bookmarks List of the cached bookmarks. |
149 | 149 | * @param array $r An array of bookmark query arguments. |
150 | 150 | */ |
151 | - return apply_filters( 'get_bookmarks', $bookmarks, $r ); |
|
151 | + return apply_filters('get_bookmarks', $bookmarks, $r); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - if ( ! is_array( $cache ) ) { |
|
155 | + if ( ! is_array($cache)) { |
|
156 | 156 | $cache = array(); |
157 | 157 | } |
158 | 158 | |
159 | 159 | $inclusions = ''; |
160 | - if ( ! empty( $r['include'] ) ) { |
|
161 | - $r['exclude'] = ''; //ignore exclude, category, and category_name params if using include |
|
160 | + if ( ! empty($r['include'])) { |
|
161 | + $r['exclude'] = ''; //ignore exclude, category, and category_name params if using include |
|
162 | 162 | $r['category'] = ''; |
163 | 163 | $r['category_name'] = ''; |
164 | - $inclinks = preg_split( '/[\s,]+/', $r['include'] ); |
|
165 | - if ( count( $inclinks ) ) { |
|
166 | - foreach ( $inclinks as $inclink ) { |
|
167 | - if ( empty( $inclusions ) ) { |
|
168 | - $inclusions = ' AND ( link_id = ' . intval( $inclink ) . ' '; |
|
164 | + $inclinks = preg_split('/[\s,]+/', $r['include']); |
|
165 | + if (count($inclinks)) { |
|
166 | + foreach ($inclinks as $inclink) { |
|
167 | + if (empty($inclusions)) { |
|
168 | + $inclusions = ' AND ( link_id = '.intval($inclink).' '; |
|
169 | 169 | } else { |
170 | - $inclusions .= ' OR link_id = ' . intval( $inclink ) . ' '; |
|
170 | + $inclusions .= ' OR link_id = '.intval($inclink).' '; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
175 | - if (! empty( $inclusions ) ) { |
|
175 | + if ( ! empty($inclusions)) { |
|
176 | 176 | $inclusions .= ')'; |
177 | 177 | } |
178 | 178 | |
179 | 179 | $exclusions = ''; |
180 | - if ( ! empty( $r['exclude'] ) ) { |
|
181 | - $exlinks = preg_split( '/[\s,]+/', $r['exclude'] ); |
|
182 | - if ( count( $exlinks ) ) { |
|
183 | - foreach ( $exlinks as $exlink ) { |
|
184 | - if ( empty( $exclusions ) ) { |
|
185 | - $exclusions = ' AND ( link_id <> ' . intval( $exlink ) . ' '; |
|
180 | + if ( ! empty($r['exclude'])) { |
|
181 | + $exlinks = preg_split('/[\s,]+/', $r['exclude']); |
|
182 | + if (count($exlinks)) { |
|
183 | + foreach ($exlinks as $exlink) { |
|
184 | + if (empty($exclusions)) { |
|
185 | + $exclusions = ' AND ( link_id <> '.intval($exlink).' '; |
|
186 | 186 | } else { |
187 | - $exclusions .= ' AND link_id <> ' . intval( $exlink ) . ' '; |
|
187 | + $exclusions .= ' AND link_id <> '.intval($exlink).' '; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | - if ( ! empty( $exclusions ) ) { |
|
192 | + if ( ! empty($exclusions)) { |
|
193 | 193 | $exclusions .= ')'; |
194 | 194 | } |
195 | 195 | |
196 | - if ( ! empty( $r['category_name'] ) ) { |
|
197 | - if ( $r['category'] = get_term_by('name', $r['category_name'], 'link_category') ) { |
|
196 | + if ( ! empty($r['category_name'])) { |
|
197 | + if ($r['category'] = get_term_by('name', $r['category_name'], 'link_category')) { |
|
198 | 198 | $r['category'] = $r['category']->term_id; |
199 | 199 | } else { |
200 | - $cache[ $key ] = array(); |
|
201 | - wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); |
|
200 | + $cache[$key] = array(); |
|
201 | + wp_cache_set('get_bookmarks', $cache, 'bookmark'); |
|
202 | 202 | /** This filter is documented in wp-includes/bookmark.php */ |
203 | - return apply_filters( 'get_bookmarks', array(), $r ); |
|
203 | + return apply_filters('get_bookmarks', array(), $r); |
|
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | 207 | $search = ''; |
208 | - if ( ! empty( $r['search'] ) ) { |
|
209 | - $like = '%' . $wpdb->esc_like( $r['search'] ) . '%'; |
|
210 | - $search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like ); |
|
208 | + if ( ! empty($r['search'])) { |
|
209 | + $like = '%'.$wpdb->esc_like($r['search']).'%'; |
|
210 | + $search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $category_query = ''; |
214 | 214 | $join = ''; |
215 | - if ( ! empty( $r['category'] ) ) { |
|
216 | - $incategories = preg_split( '/[\s,]+/', $r['category'] ); |
|
217 | - if ( count($incategories) ) { |
|
218 | - foreach ( $incategories as $incat ) { |
|
219 | - if ( empty( $category_query ) ) { |
|
220 | - $category_query = ' AND ( tt.term_id = ' . intval( $incat ) . ' '; |
|
215 | + if ( ! empty($r['category'])) { |
|
216 | + $incategories = preg_split('/[\s,]+/', $r['category']); |
|
217 | + if (count($incategories)) { |
|
218 | + foreach ($incategories as $incat) { |
|
219 | + if (empty($category_query)) { |
|
220 | + $category_query = ' AND ( tt.term_id = '.intval($incat).' '; |
|
221 | 221 | } else { |
222 | - $category_query .= ' OR tt.term_id = ' . intval( $incat ) . ' '; |
|
222 | + $category_query .= ' OR tt.term_id = '.intval($incat).' '; |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
227 | - if ( ! empty( $category_query ) ) { |
|
227 | + if ( ! empty($category_query)) { |
|
228 | 228 | $category_query .= ") AND taxonomy = 'link_category'"; |
229 | 229 | $join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id"; |
230 | 230 | } |
231 | 231 | |
232 | - if ( $r['show_updated'] ) { |
|
232 | + if ($r['show_updated']) { |
|
233 | 233 | $recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated "; |
234 | 234 | } else { |
235 | 235 | $recently_updated_test = ''; |
236 | 236 | } |
237 | 237 | |
238 | - $get_updated = ( $r['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; |
|
238 | + $get_updated = ($r['show_updated']) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : ''; |
|
239 | 239 | |
240 | - $orderby = strtolower( $r['orderby'] ); |
|
240 | + $orderby = strtolower($r['orderby']); |
|
241 | 241 | $length = ''; |
242 | - switch ( $orderby ) { |
|
242 | + switch ($orderby) { |
|
243 | 243 | case 'length': |
244 | 244 | $length = ", CHAR_LENGTH(link_name) AS length"; |
245 | 245 | break; |
@@ -251,49 +251,49 @@ discard block |
||
251 | 251 | break; |
252 | 252 | default: |
253 | 253 | $orderparams = array(); |
254 | - $keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' ); |
|
255 | - foreach ( explode( ',', $orderby ) as $ordparam ) { |
|
256 | - $ordparam = trim( $ordparam ); |
|
254 | + $keys = array('link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description'); |
|
255 | + foreach (explode(',', $orderby) as $ordparam) { |
|
256 | + $ordparam = trim($ordparam); |
|
257 | 257 | |
258 | - if ( in_array( 'link_' . $ordparam, $keys ) ) { |
|
259 | - $orderparams[] = 'link_' . $ordparam; |
|
260 | - } elseif ( in_array( $ordparam, $keys ) ) { |
|
258 | + if (in_array('link_'.$ordparam, $keys)) { |
|
259 | + $orderparams[] = 'link_'.$ordparam; |
|
260 | + } elseif (in_array($ordparam, $keys)) { |
|
261 | 261 | $orderparams[] = $ordparam; |
262 | 262 | } |
263 | 263 | } |
264 | - $orderby = implode( ',', $orderparams ); |
|
264 | + $orderby = implode(',', $orderparams); |
|
265 | 265 | } |
266 | 266 | |
267 | - if ( empty( $orderby ) ) { |
|
267 | + if (empty($orderby)) { |
|
268 | 268 | $orderby = 'link_name'; |
269 | 269 | } |
270 | 270 | |
271 | - $order = strtoupper( $r['order'] ); |
|
272 | - if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) { |
|
271 | + $order = strtoupper($r['order']); |
|
272 | + if ('' !== $order && ! in_array($order, array('ASC', 'DESC'))) { |
|
273 | 273 | $order = 'ASC'; |
274 | 274 | } |
275 | 275 | |
276 | 276 | $visible = ''; |
277 | - if ( $r['hide_invisible'] ) { |
|
277 | + if ($r['hide_invisible']) { |
|
278 | 278 | $visible = "AND link_visible = 'Y'"; |
279 | 279 | } |
280 | 280 | |
281 | 281 | $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; |
282 | 282 | $query .= " $exclusions $inclusions $search"; |
283 | 283 | $query .= " ORDER BY $orderby $order"; |
284 | - if ( $r['limit'] != -1 ) { |
|
285 | - $query .= ' LIMIT ' . $r['limit']; |
|
284 | + if ($r['limit'] != -1) { |
|
285 | + $query .= ' LIMIT '.$r['limit']; |
|
286 | 286 | } |
287 | 287 | |
288 | - $results = $wpdb->get_results( $query ); |
|
288 | + $results = $wpdb->get_results($query); |
|
289 | 289 | |
290 | - if ( 'rand()' !== $orderby ) { |
|
291 | - $cache[ $key ] = $results; |
|
292 | - wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); |
|
290 | + if ('rand()' !== $orderby) { |
|
291 | + $cache[$key] = $results; |
|
292 | + wp_cache_set('get_bookmarks', $cache, 'bookmark'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** This filter is documented in wp-includes/bookmark.php */ |
296 | - return apply_filters( 'get_bookmarks', $results, $r ); |
|
296 | + return apply_filters('get_bookmarks', $results, $r); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | function sanitize_bookmark($bookmark, $context = 'display') { |
310 | 310 | $fields = array('link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category', |
311 | 311 | 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated', |
312 | - 'link_rel', 'link_notes', 'link_rss', ); |
|
312 | + 'link_rel', 'link_notes', 'link_rss',); |
|
313 | 313 | |
314 | - if ( is_object($bookmark) ) { |
|
314 | + if (is_object($bookmark)) { |
|
315 | 315 | $do_object = true; |
316 | 316 | $link_id = $bookmark->link_id; |
317 | 317 | } else { |
@@ -319,12 +319,12 @@ discard block |
||
319 | 319 | $link_id = $bookmark['link_id']; |
320 | 320 | } |
321 | 321 | |
322 | - foreach ( $fields as $field ) { |
|
323 | - if ( $do_object ) { |
|
324 | - if ( isset($bookmark->$field) ) |
|
322 | + foreach ($fields as $field) { |
|
323 | + if ($do_object) { |
|
324 | + if (isset($bookmark->$field)) |
|
325 | 325 | $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context); |
326 | 326 | } else { |
327 | - if ( isset($bookmark[$field]) ) |
|
327 | + if (isset($bookmark[$field])) |
|
328 | 328 | $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context); |
329 | 329 | } |
330 | 330 | } |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | * 'js', 'db', or 'display' |
357 | 357 | * @return mixed The filtered value. |
358 | 358 | */ |
359 | -function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { |
|
360 | - switch ( $field ) { |
|
359 | +function sanitize_bookmark_field($field, $value, $bookmark_id, $context) { |
|
360 | + switch ($field) { |
|
361 | 361 | case 'link_id' : // ints |
362 | 362 | case 'link_rating' : |
363 | 363 | $value = (int) $value; |
@@ -373,34 +373,34 @@ discard block |
||
373 | 373 | break; |
374 | 374 | case 'link_target' : // "enum" |
375 | 375 | $targets = array('_top', '_blank'); |
376 | - if ( ! in_array($value, $targets) ) |
|
376 | + if ( ! in_array($value, $targets)) |
|
377 | 377 | $value = ''; |
378 | 378 | break; |
379 | 379 | } |
380 | 380 | |
381 | - if ( 'raw' == $context ) |
|
381 | + if ('raw' == $context) |
|
382 | 382 | return $value; |
383 | 383 | |
384 | - if ( 'edit' == $context ) { |
|
384 | + if ('edit' == $context) { |
|
385 | 385 | /** This filter is documented in wp-includes/post.php */ |
386 | - $value = apply_filters( "edit_{$field}", $value, $bookmark_id ); |
|
386 | + $value = apply_filters("edit_{$field}", $value, $bookmark_id); |
|
387 | 387 | |
388 | - if ( 'link_notes' == $field ) { |
|
389 | - $value = esc_html( $value ); // textarea_escaped |
|
388 | + if ('link_notes' == $field) { |
|
389 | + $value = esc_html($value); // textarea_escaped |
|
390 | 390 | } else { |
391 | 391 | $value = esc_attr($value); |
392 | 392 | } |
393 | - } elseif ( 'db' == $context ) { |
|
393 | + } elseif ('db' == $context) { |
|
394 | 394 | /** This filter is documented in wp-includes/post.php */ |
395 | - $value = apply_filters( "pre_{$field}", $value ); |
|
395 | + $value = apply_filters("pre_{$field}", $value); |
|
396 | 396 | } else { |
397 | 397 | /** This filter is documented in wp-includes/post.php */ |
398 | - $value = apply_filters( "{$field}", $value, $bookmark_id, $context ); |
|
398 | + $value = apply_filters("{$field}", $value, $bookmark_id, $context); |
|
399 | 399 | |
400 | - if ( 'attribute' == $context ) { |
|
401 | - $value = esc_attr( $value ); |
|
402 | - } elseif ( 'js' == $context ) { |
|
403 | - $value = esc_js( $value ); |
|
400 | + if ('attribute' == $context) { |
|
401 | + $value = esc_attr($value); |
|
402 | + } elseif ('js' == $context) { |
|
403 | + $value = esc_js($value); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | * |
415 | 415 | * @param int $bookmark_id Bookmark ID. |
416 | 416 | */ |
417 | -function clean_bookmark_cache( $bookmark_id ) { |
|
418 | - wp_cache_delete( $bookmark_id, 'bookmark' ); |
|
419 | - wp_cache_delete( 'get_bookmarks', 'bookmark' ); |
|
420 | - clean_object_term_cache( $bookmark_id, 'link'); |
|
417 | +function clean_bookmark_cache($bookmark_id) { |
|
418 | + wp_cache_delete($bookmark_id, 'bookmark'); |
|
419 | + wp_cache_delete('get_bookmarks', 'bookmark'); |
|
420 | + clean_object_term_cache($bookmark_id, 'link'); |
|
421 | 421 | } |
@@ -358,24 +358,24 @@ |
||
358 | 358 | */ |
359 | 359 | function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { |
360 | 360 | switch ( $field ) { |
361 | - case 'link_id' : // ints |
|
362 | - case 'link_rating' : |
|
363 | - $value = (int) $value; |
|
364 | - break; |
|
365 | - case 'link_category' : // array( ints ) |
|
366 | - $value = array_map('absint', (array) $value); |
|
367 | - // We return here so that the categories aren't filtered. |
|
368 | - // The 'link_category' filter is for the name of a link category, not an array of a link's link categories |
|
369 | - return $value; |
|
370 | - |
|
371 | - case 'link_visible' : // bool stored as Y|N |
|
372 | - $value = preg_replace('/[^YNyn]/', '', $value); |
|
373 | - break; |
|
374 | - case 'link_target' : // "enum" |
|
375 | - $targets = array('_top', '_blank'); |
|
376 | - if ( ! in_array($value, $targets) ) |
|
377 | - $value = ''; |
|
378 | - break; |
|
361 | + case 'link_id' : // ints |
|
362 | + case 'link_rating' : |
|
363 | + $value = (int) $value; |
|
364 | + break; |
|
365 | + case 'link_category' : // array( ints ) |
|
366 | + $value = array_map('absint', (array) $value); |
|
367 | + // We return here so that the categories aren't filtered. |
|
368 | + // The 'link_category' filter is for the name of a link category, not an array of a link's link categories |
|
369 | + return $value; |
|
370 | + |
|
371 | + case 'link_visible' : // bool stored as Y|N |
|
372 | + $value = preg_replace('/[^YNyn]/', '', $value); |
|
373 | + break; |
|
374 | + case 'link_target' : // "enum" |
|
375 | + $targets = array('_top', '_blank'); |
|
376 | + if ( ! in_array($value, $targets) ) |
|
377 | + $value = ''; |
|
378 | + break; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | if ( 'raw' == $context ) |
@@ -35,7 +35,10 @@ |
||
35 | 35 | </style> |
36 | 36 | <?php } ?> |
37 | 37 | |
38 | -<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> |
|
38 | +<?php if ( is_singular() ) { |
|
39 | + wp_enqueue_script( 'comment-reply' ); |
|
40 | +} |
|
41 | +?> |
|
39 | 42 | |
40 | 43 | <?php wp_head(); ?> |
41 | 44 | </head> |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | */ |
9 | 9 | _deprecated_file( |
10 | 10 | /* translators: %s: template name */ |
11 | - sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ), |
|
11 | + sprintf(__('Theme without %s'), basename(__FILE__)), |
|
12 | 12 | '3.0.0', |
13 | 13 | null, |
14 | 14 | /* translators: %s: template name */ |
15 | - sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) ) |
|
15 | + sprintf(__('Please include a %s template in your theme.'), basename(__FILE__)) |
|
16 | 16 | ); |
17 | 17 | ?> |
18 | 18 | <!DOCTYPE html> |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" /> |
27 | 27 | <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> |
28 | 28 | |
29 | -<?php if ( file_exists( get_stylesheet_directory() . '/images/kubrickbgwide.jpg' ) ) { ?> |
|
29 | +<?php if (file_exists(get_stylesheet_directory().'/images/kubrickbgwide.jpg')) { ?> |
|
30 | 30 | <style type="text/css" media="screen"> |
31 | 31 | |
32 | 32 | <?php |
33 | 33 | // Checks to see whether it needs a sidebar |
34 | -if ( empty($withcomments) && !is_single() ) { |
|
34 | +if (empty($withcomments) && ! is_single()) { |
|
35 | 35 | ?> |
36 | 36 | #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; } |
37 | 37 | <?php } else { // No sidebar ?> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | </style> |
42 | 42 | <?php } ?> |
43 | 43 | |
44 | -<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> |
|
44 | +<?php if (is_singular()) wp_enqueue_script('comment-reply'); ?> |
|
45 | 45 | |
46 | 46 | <?php wp_head(); ?> |
47 | 47 | </head> |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | if (isset($info['flac']['STREAMINFO']['audio_signature'])) { |
168 | 168 | |
169 | 169 | if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { |
170 | - $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); |
|
170 | + $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); |
|
171 | 171 | } |
172 | 172 | else { |
173 | 173 | $info['md5_data_source'] = ''; |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | - * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment |
|
350 | - * External usage: audio.ogg |
|
351 | - */ |
|
349 | + * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment |
|
350 | + * External usage: audio.ogg |
|
351 | + */ |
|
352 | 352 | public function parsePICTURE() { |
353 | 353 | $info = &$this->getid3->info; |
354 | 354 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $BlockHeader = $this->fread(4); |
49 | 49 | $LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1)); |
50 | 50 | $LastBlockFlag = (bool) ($LBFBT & 0x80); |
51 | - $BlockType = ($LBFBT & 0x7F); |
|
51 | + $BlockType = ($LBFBT & 0x7F); |
|
52 | 52 | $BlockLength = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3)); |
53 | 53 | $BlockTypeText = self::metaBlockTypeLookup($BlockType); |
54 | 54 | |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | $BlockTypeText_raw['block_type_text'] = $BlockTypeText; |
71 | 71 | $BlockTypeText_raw['block_length'] = $BlockLength; |
72 | 72 | if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically |
73 | - $BlockTypeText_raw['block_data'] = $this->fread($BlockLength); |
|
73 | + $BlockTypeText_raw['block_data'] = $this->fread($BlockLength); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | switch ($BlockTypeText) { |
77 | 77 | case 'STREAMINFO': // 0x00 |
78 | - if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) { |
|
78 | + if ( ! $this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | break; |
@@ -85,31 +85,31 @@ discard block |
||
85 | 85 | break; |
86 | 86 | |
87 | 87 | case 'APPLICATION': // 0x02 |
88 | - if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) { |
|
88 | + if ( ! $this->parseAPPLICATION($BlockTypeText_raw['block_data'])) { |
|
89 | 89 | return false; |
90 | 90 | } |
91 | 91 | break; |
92 | 92 | |
93 | 93 | case 'SEEKTABLE': // 0x03 |
94 | - if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) { |
|
94 | + if ( ! $this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | break; |
98 | 98 | |
99 | 99 | case 'VORBIS_COMMENT': // 0x04 |
100 | - if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { |
|
100 | + if ( ! $this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | break; |
104 | 104 | |
105 | 105 | case 'CUESHEET': // 0x05 |
106 | - if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) { |
|
106 | + if ( ! $this->parseCUESHEET($BlockTypeText_raw['block_data'])) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | break; |
110 | 110 | |
111 | 111 | case 'PICTURE': // 0x06 |
112 | - if (!$this->parsePICTURE()) { |
|
112 | + if ( ! $this->parsePICTURE()) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | break; |
@@ -124,18 +124,18 @@ discard block |
||
124 | 124 | while ($LastBlockFlag === false); |
125 | 125 | |
126 | 126 | // handle tags |
127 | - if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) { |
|
127 | + if ( ! empty($info['flac']['VORBIS_COMMENT']['comments'])) { |
|
128 | 128 | $info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments']; |
129 | 129 | } |
130 | - if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) { |
|
130 | + if ( ! empty($info['flac']['VORBIS_COMMENT']['vendor'])) { |
|
131 | 131 | $info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']); |
132 | 132 | } |
133 | 133 | |
134 | 134 | // copy attachments to 'comments' array if nesesary |
135 | 135 | if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) { |
136 | 136 | foreach ($info['flac']['PICTURE'] as $entry) { |
137 | - if (!empty($entry['data'])) { |
|
138 | - if (!isset($info['flac']['comments']['picture'])) { |
|
137 | + if ( ! empty($entry['data'])) { |
|
138 | + if ( ! isset($info['flac']['comments']['picture'])) { |
|
139 | 139 | $info['flac']['comments']['picture'] = array(); |
140 | 140 | } |
141 | 141 | $comments_picture_data = array(); |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if (isset($info['flac']['STREAMINFO'])) { |
154 | - if (!$this->isDependencyFor('matroska')) { |
|
154 | + if ( ! $this->isDependencyFor('matroska')) { |
|
155 | 155 | $info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset']; |
156 | 156 | } |
157 | 157 | $info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8); |
158 | 158 | if ($info['flac']['uncompressed_audio_bytes'] == 0) { |
159 | 159 | return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero'); |
160 | 160 | } |
161 | - if (!empty($info['flac']['compressed_audio_bytes'])) { |
|
161 | + if ( ! empty($info['flac']['compressed_audio_bytes'])) { |
|
162 | 162 | $info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes']; |
163 | 163 | } |
164 | 164 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | for ($i = 0; $i < strlen($md5); $i++) { |
176 | 176 | $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); |
177 | 177 | } |
178 | - if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { |
|
178 | + if ( ! preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { |
|
179 | 179 | unset($info['md5_data_source']); |
180 | 180 | } |
181 | 181 | } |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | $streaminfo['max_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3)); |
207 | 207 | |
208 | 208 | $SRCSBSS = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8)); |
209 | - $streaminfo['sample_rate'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20)); |
|
210 | - $streaminfo['channels'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1; |
|
211 | - $streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1; |
|
209 | + $streaminfo['sample_rate'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20)); |
|
210 | + $streaminfo['channels'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1; |
|
211 | + $streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1; |
|
212 | 212 | $streaminfo['samples_stream'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36)); |
213 | 213 | |
214 | 214 | $streaminfo['audio_signature'] = substr($BlockData, 18, 16); |
215 | 215 | |
216 | - if (!empty($streaminfo['sample_rate'])) { |
|
216 | + if ( ! empty($streaminfo['sample_rate'])) { |
|
217 | 217 | |
218 | 218 | $info['audio']['bitrate_mode'] = 'vbr'; |
219 | 219 | $info['audio']['sample_rate'] = $streaminfo['sample_rate']; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $info['audio']['bits_per_sample'] = $streaminfo['bits_per_sample']; |
222 | 222 | $info['playtime_seconds'] = $streaminfo['samples_stream'] / $streaminfo['sample_rate']; |
223 | 223 | if ($info['playtime_seconds'] > 0) { |
224 | - if (!$this->isDependencyFor('matroska')) { |
|
224 | + if ( ! $this->isDependencyFor('matroska')) { |
|
225 | 225 | $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
226 | 226 | } |
227 | 227 | else { |
@@ -297,16 +297,16 @@ discard block |
||
297 | 297 | private function parseCUESHEET($BlockData) { |
298 | 298 | $info = &$this->getid3->info; |
299 | 299 | $offset = 0; |
300 | - $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0"); |
|
300 | + $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0"); |
|
301 | 301 | $offset += 128; |
302 | - $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); |
|
302 | + $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); |
|
303 | 303 | $offset += 8; |
304 | 304 | $info['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80); |
305 | 305 | $offset += 1; |
306 | 306 | |
307 | 307 | $offset += 258; // reserved |
308 | 308 | |
309 | - $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); |
|
309 | + $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); |
|
310 | 310 | $offset += 1; |
311 | 311 | |
312 | 312 | for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | $info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset; |
319 | 319 | |
320 | - $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($BlockData, $offset, 12); |
|
320 | + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($BlockData, $offset, 12); |
|
321 | 321 | $offset += 12; |
322 | 322 | |
323 | 323 | $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | $offset += 13; // reserved |
329 | 329 | |
330 | - $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); |
|
330 | + $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); |
|
331 | 331 | $offset += 1; |
332 | 332 | |
333 | 333 | for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) { |
@@ -396,35 +396,35 @@ discard block |
||
396 | 396 | public static function applicationIDLookup($applicationid) { |
397 | 397 | // http://flac.sourceforge.net/id.html |
398 | 398 | static $lookup = array( |
399 | - 0x41544348 => 'FlacFile', // "ATCH" |
|
400 | - 0x42534F4C => 'beSolo', // "BSOL" |
|
401 | - 0x42554753 => 'Bugs Player', // "BUGS" |
|
402 | - 0x43756573 => 'GoldWave cue points (specification)', // "Cues" |
|
403 | - 0x46696361 => 'CUE Splitter', // "Fica" |
|
404 | - 0x46746F6C => 'flac-tools', // "Ftol" |
|
405 | - 0x4D4F5442 => 'MOTB MetaCzar', // "MOTB" |
|
406 | - 0x4D505345 => 'MP3 Stream Editor', // "MPSE" |
|
407 | - 0x4D754D4C => 'MusicML: Music Metadata Language', // "MuML" |
|
408 | - 0x52494646 => 'Sound Devices RIFF chunk storage', // "RIFF" |
|
409 | - 0x5346464C => 'Sound Font FLAC', // "SFFL" |
|
410 | - 0x534F4E59 => 'Sony Creative Software', // "SONY" |
|
411 | - 0x5351455A => 'flacsqueeze', // "SQEZ" |
|
412 | - 0x54745776 => 'TwistedWave', // "TtWv" |
|
413 | - 0x55495453 => 'UITS Embedding tools', // "UITS" |
|
414 | - 0x61696666 => 'FLAC AIFF chunk storage', // "aiff" |
|
415 | - 0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', // "imag" |
|
416 | - 0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', // "peem" |
|
417 | - 0x71667374 => 'QFLAC Studio', // "qfst" |
|
418 | - 0x72696666 => 'FLAC RIFF chunk storage', // "riff" |
|
419 | - 0x74756E65 => 'TagTuner', // "tune" |
|
420 | - 0x78626174 => 'XBAT', // "xbat" |
|
421 | - 0x786D6364 => 'xmcd', // "xmcd" |
|
399 | + 0x41544348 => 'FlacFile', // "ATCH" |
|
400 | + 0x42534F4C => 'beSolo', // "BSOL" |
|
401 | + 0x42554753 => 'Bugs Player', // "BUGS" |
|
402 | + 0x43756573 => 'GoldWave cue points (specification)', // "Cues" |
|
403 | + 0x46696361 => 'CUE Splitter', // "Fica" |
|
404 | + 0x46746F6C => 'flac-tools', // "Ftol" |
|
405 | + 0x4D4F5442 => 'MOTB MetaCzar', // "MOTB" |
|
406 | + 0x4D505345 => 'MP3 Stream Editor', // "MPSE" |
|
407 | + 0x4D754D4C => 'MusicML: Music Metadata Language', // "MuML" |
|
408 | + 0x52494646 => 'Sound Devices RIFF chunk storage', // "RIFF" |
|
409 | + 0x5346464C => 'Sound Font FLAC', // "SFFL" |
|
410 | + 0x534F4E59 => 'Sony Creative Software', // "SONY" |
|
411 | + 0x5351455A => 'flacsqueeze', // "SQEZ" |
|
412 | + 0x54745776 => 'TwistedWave', // "TtWv" |
|
413 | + 0x55495453 => 'UITS Embedding tools', // "UITS" |
|
414 | + 0x61696666 => 'FLAC AIFF chunk storage', // "aiff" |
|
415 | + 0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', // "imag" |
|
416 | + 0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', // "peem" |
|
417 | + 0x71667374 => 'QFLAC Studio', // "qfst" |
|
418 | + 0x72696666 => 'FLAC RIFF chunk storage', // "riff" |
|
419 | + 0x74756E65 => 'TagTuner', // "tune" |
|
420 | + 0x78626174 => 'XBAT', // "xbat" |
|
421 | + 0x786D6364 => 'xmcd', // "xmcd" |
|
422 | 422 | ); |
423 | 423 | return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved'); |
424 | 424 | } |
425 | 425 | |
426 | 426 | public static function pictureTypeLookup($type_id) { |
427 | - static $lookup = array ( |
|
427 | + static $lookup = array( |
|
428 | 428 | 0 => 'Other', |
429 | 429 | 1 => '32x32 pixels \'file icon\' (PNG only)', |
430 | 430 | 2 => 'Other file icon', |
@@ -168,8 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { |
170 | 170 | $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); |
171 | - } |
|
172 | - else { |
|
171 | + } else { |
|
173 | 172 | $info['md5_data_source'] = ''; |
174 | 173 | $md5 = $info['flac']['STREAMINFO']['audio_signature']; |
175 | 174 | for ($i = 0; $i < strlen($md5); $i++) { |
@@ -223,8 +222,7 @@ discard block |
||
223 | 222 | if ($info['playtime_seconds'] > 0) { |
224 | 223 | if (!$this->isDependencyFor('matroska')) { |
225 | 224 | $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
226 | - } |
|
227 | - else { |
|
225 | + } else { |
|
228 | 226 | $this->warning('Cannot determine audio bitrate because total stream size is unknown'); |
229 | 227 | } |
230 | 228 | } |