@@ -182,8 +182,6 @@ discard block |
||
| 182 | 182 | * Check user capabilities and theme supports, and then save |
| 183 | 183 | * the value of the field. |
| 184 | 184 | * |
| 185 | - * @param mixed $value The value to save. |
|
| 186 | - * @param int $item_id The Item ID. |
|
| 187 | 185 | * |
| 188 | 186 | * @return false|mixed False if cap check fails or value isn't set. |
| 189 | 187 | */ |
@@ -243,7 +241,6 @@ discard block |
||
| 243 | 241 | * Save the value of the field, using the related API. |
| 244 | 242 | * |
| 245 | 243 | * @param mixed $value The value to update. |
| 246 | - * @param int $item_id Item ID. |
|
| 247 | 244 | * |
| 248 | 245 | * @return mixed The result of saving the value. |
| 249 | 246 | */ |
@@ -383,7 +380,6 @@ discard block |
||
| 383 | 380 | /** |
| 384 | 381 | * Fetch the value of the field. |
| 385 | 382 | * |
| 386 | - * @param int $item_id (optional) The Item ID. |
|
| 387 | 383 | * |
| 388 | 384 | * @return mixed The value. |
| 389 | 385 | */ |
@@ -655,7 +651,7 @@ discard block |
||
| 655 | 651 | * |
| 656 | 652 | * @param $root |
| 657 | 653 | * @param $keys |
| 658 | - * @param mixed $default A default value which is used as a fallback. Default is null. |
|
| 654 | + * @param string $default A default value which is used as a fallback. Default is null. |
|
| 659 | 655 | * |
| 660 | 656 | * @return mixed The requested value or the default value. |
| 661 | 657 | */ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | $args = func_get_args(); |
| 125 | 125 | |
| 126 | - call_user_func_array( array( $this, 'init' ), $args ); |
|
| 126 | + call_user_func_array(array($this, 'init'), $args); |
|
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return WP_Fields_API_Field $field |
| 139 | 139 | */ |
| 140 | - public function init( $object_type, $id, $args = array() ) { |
|
| 140 | + public function init($object_type, $id, $args = array()) { |
|
| 141 | 141 | |
| 142 | 142 | $this->object_type = $object_type; |
| 143 | 143 | |
| 144 | - if ( is_array( $id ) ) { |
|
| 144 | + if (is_array($id)) { |
|
| 145 | 145 | $args = $id; |
| 146 | 146 | |
| 147 | 147 | $id = ''; |
@@ -149,31 +149,31 @@ discard block |
||
| 149 | 149 | $this->id = $id; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - $keys = array_keys( get_object_vars( $this ) ); |
|
| 152 | + $keys = array_keys(get_object_vars($this)); |
|
| 153 | 153 | |
| 154 | - foreach ( $keys as $key ) { |
|
| 155 | - if ( isset( $args[ $key ] ) ) { |
|
| 156 | - $this->$key = $args[ $key ]; |
|
| 154 | + foreach ($keys as $key) { |
|
| 155 | + if (isset($args[$key])) { |
|
| 156 | + $this->$key = $args[$key]; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Parse the ID for array keys. |
| 161 | - $this->id_data['keys'] = preg_split( '/\[/', str_replace( ']', '', $this->id ) ); |
|
| 162 | - $this->id_data['base'] = array_shift( $this->id_data['keys'] ); |
|
| 161 | + $this->id_data['keys'] = preg_split('/\[/', str_replace(']', '', $this->id)); |
|
| 162 | + $this->id_data['base'] = array_shift($this->id_data['keys']); |
|
| 163 | 163 | |
| 164 | 164 | // Rebuild the ID. |
| 165 | 165 | $this->id = $this->id_data['base']; |
| 166 | 166 | |
| 167 | - if ( ! empty( $this->id_data['keys'] ) ) { |
|
| 168 | - $this->id .= '[' . implode( '][', $this->id_data['keys'] ) . ']'; |
|
| 167 | + if ( ! empty($this->id_data['keys'])) { |
|
| 168 | + $this->id .= '['.implode('][', $this->id_data['keys']).']'; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ( $this->sanitize_callback ) { |
|
| 172 | - add_filter( "fields_sanitize_{$this->object_type}_{$this->object_name}_{$this->id}", $this->sanitize_callback, 10, 2 ); |
|
| 171 | + if ($this->sanitize_callback) { |
|
| 172 | + add_filter("fields_sanitize_{$this->object_type}_{$this->object_name}_{$this->id}", $this->sanitize_callback, 10, 2); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( $this->sanitize_js_callback ) { |
|
| 176 | - add_filter( "fields_sanitize_js_{$this->object_type}_{$this->object_name}_{$this->id}", $this->sanitize_js_callback, 10, 2 ); |
|
| 175 | + if ($this->sanitize_js_callback) { |
|
| 176 | + add_filter("fields_sanitize_js_{$this->object_type}_{$this->object_name}_{$this->id}", $this->sanitize_js_callback, 10, 2); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | } |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | $value = func_get_arg(0); |
| 193 | 193 | $item_id = func_get_arg(1); |
| 194 | 194 | |
| 195 | - if ( ! $this->check_capabilities() || false === $value ) { |
|
| 195 | + if ( ! $this->check_capabilities() || false === $value) { |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( is_callable( $this->pre_update_value_callback ) ) { |
|
| 200 | - $value = call_user_func( $this->pre_update_value_callback, $value, $item_id, $this ); |
|
| 199 | + if (is_callable($this->pre_update_value_callback)) { |
|
| 200 | + $value = call_user_func($this->pre_update_value_callback, $value, $item_id, $this); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @return string The value to save |
| 214 | 214 | */ |
| 215 | - $value = apply_filters( 'field_save_' . $this->object_type . '_' . $this->id_data[ 'base' ], $value, $item_id, $this ); |
|
| 215 | + $value = apply_filters('field_save_'.$this->object_type.'_'.$this->id_data['base'], $value, $item_id, $this); |
|
| 216 | 216 | |
| 217 | - return $this->update( $value, $item_id ); |
|
| 217 | + return $this->update($value, $item_id); |
|
| 218 | 218 | |
| 219 | 219 | } |
| 220 | 220 | |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @return mixed Null if an input isn't valid, otherwise the sanitized value. |
| 227 | 227 | */ |
| 228 | - public function sanitize( $value ) { |
|
| 228 | + public function sanitize($value) { |
|
| 229 | 229 | |
| 230 | - $value = wp_unslash( $value ); |
|
| 230 | + $value = wp_unslash($value); |
|
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Filter a Customize field value in un-slashed form. |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @param mixed $value Value of the field. |
| 236 | 236 | * @param WP_Fields_API_Field $this WP_Fields_API_Field instance. |
| 237 | 237 | */ |
| 238 | - return apply_filters( "fields_sanitize_{$this->object_type}_{$this->object_name}_{$this->id}", $value, $this ); |
|
| 238 | + return apply_filters("fields_sanitize_{$this->object_type}_{$this->object_name}_{$this->id}", $value, $this); |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
@@ -247,27 +247,27 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | * @return mixed The result of saving the value. |
| 249 | 249 | */ |
| 250 | - protected function update( $value ) { |
|
| 250 | + protected function update($value) { |
|
| 251 | 251 | |
| 252 | 252 | // @todo Support post / term / user / comment object field updates |
| 253 | 253 | |
| 254 | 254 | $item_id = func_get_arg(1); |
| 255 | 255 | |
| 256 | - switch ( $this->object_type ) { |
|
| 257 | - case is_callable( $this->update_value_callback ) : |
|
| 258 | - return call_user_func( $this->update_value_callback, $value, $item_id, $this ); |
|
| 256 | + switch ($this->object_type) { |
|
| 257 | + case is_callable($this->update_value_callback) : |
|
| 258 | + return call_user_func($this->update_value_callback, $value, $item_id, $this); |
|
| 259 | 259 | |
| 260 | 260 | case 'customizer' : |
| 261 | - return $this->_update_theme_mod( $value ); |
|
| 261 | + return $this->_update_theme_mod($value); |
|
| 262 | 262 | |
| 263 | 263 | case 'settings' : |
| 264 | - return $this->_update_option( $value ); |
|
| 264 | + return $this->_update_option($value); |
|
| 265 | 265 | |
| 266 | 266 | case 'post' : |
| 267 | 267 | case 'term' : |
| 268 | 268 | case 'user' : |
| 269 | 269 | case 'comment' : |
| 270 | - return $this->_update_meta( $this->object_type, $value, $item_id ); |
|
| 270 | + return $this->_update_meta($this->object_type, $value, $item_id); |
|
| 271 | 271 | |
| 272 | 272 | default : |
| 273 | 273 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * @param int $item_id Item ID. |
| 282 | 282 | * @param WP_Fields_API_Field $this WP_Fields_API_Field instance. |
| 283 | 283 | */ |
| 284 | - do_action( "fields_update_{$this->object_type}", $value, $item_id, $this ); |
|
| 284 | + do_action("fields_update_{$this->object_type}", $value, $item_id, $this); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | return null; |
@@ -295,22 +295,22 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @return null |
| 297 | 297 | */ |
| 298 | - protected function _update_theme_mod( $value ) { |
|
| 298 | + protected function _update_theme_mod($value) { |
|
| 299 | 299 | |
| 300 | - if ( is_null( $value ) ) { |
|
| 301 | - remove_theme_mod( $this->id_data['base'] ); |
|
| 300 | + if (is_null($value)) { |
|
| 301 | + remove_theme_mod($this->id_data['base']); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // Handle non-array theme mod. |
| 305 | - if ( empty( $this->id_data['keys'] ) ) { |
|
| 306 | - set_theme_mod( $this->id_data['base'], $value ); |
|
| 305 | + if (empty($this->id_data['keys'])) { |
|
| 306 | + set_theme_mod($this->id_data['base'], $value); |
|
| 307 | 307 | } else { |
| 308 | 308 | // Handle array-based theme mod. |
| 309 | - $mods = get_theme_mod( $this->id_data['base'] ); |
|
| 310 | - $mods = $this->multidimensional_replace( $mods, $this->id_data['keys'], $value ); |
|
| 309 | + $mods = get_theme_mod($this->id_data['base']); |
|
| 310 | + $mods = $this->multidimensional_replace($mods, $this->id_data['keys'], $value); |
|
| 311 | 311 | |
| 312 | - if ( isset( $mods ) ) { |
|
| 313 | - set_theme_mod( $this->id_data['base'], $mods ); |
|
| 312 | + if (isset($mods)) { |
|
| 313 | + set_theme_mod($this->id_data['base'], $mods); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | |
@@ -325,23 +325,23 @@ discard block |
||
| 325 | 325 | * |
| 326 | 326 | * @return bool|null The result of saving the value. |
| 327 | 327 | */ |
| 328 | - protected function _update_option( $value ) { |
|
| 328 | + protected function _update_option($value) { |
|
| 329 | 329 | |
| 330 | - if ( is_null( $value ) ) { |
|
| 331 | - delete_option( $this->id_data['base'] ); |
|
| 330 | + if (is_null($value)) { |
|
| 331 | + delete_option($this->id_data['base']); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // Handle non-array option. |
| 335 | - if ( empty( $this->id_data['keys'] ) ) { |
|
| 336 | - return update_option( $this->id_data['base'], $value ); |
|
| 335 | + if (empty($this->id_data['keys'])) { |
|
| 336 | + return update_option($this->id_data['base'], $value); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // Handle array-based options. |
| 340 | - $options = get_option( $this->id_data['base'] ); |
|
| 341 | - $options = $this->multidimensional_replace( $options, $this->id_data['keys'], $value ); |
|
| 340 | + $options = get_option($this->id_data['base']); |
|
| 341 | + $options = $this->multidimensional_replace($options, $this->id_data['keys'], $value); |
|
| 342 | 342 | |
| 343 | - if ( isset( $options ) ) { |
|
| 344 | - return update_option( $this->id_data['base'], $options ); |
|
| 343 | + if (isset($options)) { |
|
| 344 | + return update_option($this->id_data['base'], $options); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | return null; |
@@ -357,23 +357,23 @@ discard block |
||
| 357 | 357 | * |
| 358 | 358 | * @return bool|null The result of saving the value. |
| 359 | 359 | */ |
| 360 | - protected function _update_meta( $meta_type, $value, $item_id = 0 ) { |
|
| 360 | + protected function _update_meta($meta_type, $value, $item_id = 0) { |
|
| 361 | 361 | |
| 362 | - if ( is_null( $value ) ) { |
|
| 363 | - delete_metadata( $meta_type, $item_id, $this->id_data['base'] ); |
|
| 362 | + if (is_null($value)) { |
|
| 363 | + delete_metadata($meta_type, $item_id, $this->id_data['base']); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | // Handle non-array option. |
| 367 | - if ( empty( $this->id_data['keys'] ) ) { |
|
| 368 | - return update_metadata( $meta_type, $item_id, $this->id_data['base'], $value ); |
|
| 367 | + if (empty($this->id_data['keys'])) { |
|
| 368 | + return update_metadata($meta_type, $item_id, $this->id_data['base'], $value); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | // Handle array-based keys. |
| 372 | - $keys = get_metadata( $meta_type, 0, $this->id_data['base'] ); |
|
| 373 | - $keys = $this->multidimensional_replace( $keys, $this->id_data['keys'], $value ); |
|
| 372 | + $keys = get_metadata($meta_type, 0, $this->id_data['base']); |
|
| 373 | + $keys = $this->multidimensional_replace($keys, $this->id_data['keys'], $value); |
|
| 374 | 374 | |
| 375 | - if ( isset( $keys ) ) { |
|
| 376 | - return update_metadata( $meta_type, $item_id, $this->id_data['base'], $keys ); |
|
| 375 | + if (isset($keys)) { |
|
| 376 | + return update_metadata($meta_type, $item_id, $this->id_data['base'], $keys); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | return null; |
@@ -391,24 +391,24 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | $item_id = func_get_arg(0); |
| 393 | 393 | |
| 394 | - switch ( $this->object_type ) { |
|
| 395 | - case is_callable( $this->value_callback ) : |
|
| 396 | - $value = call_user_func( $this->value_callback, $item_id, $this ); |
|
| 397 | - $value = $this->multidimensional_get( $value, $this->id_data['keys'], $this->default ); |
|
| 394 | + switch ($this->object_type) { |
|
| 395 | + case is_callable($this->value_callback) : |
|
| 396 | + $value = call_user_func($this->value_callback, $item_id, $this); |
|
| 397 | + $value = $this->multidimensional_get($value, $this->id_data['keys'], $this->default); |
|
| 398 | 398 | |
| 399 | 399 | break; |
| 400 | 400 | case 'post' : |
| 401 | 401 | case 'term' : |
| 402 | 402 | case 'user' : |
| 403 | 403 | case 'comment' : |
| 404 | - $value = $this->get_object_value( $item_id ); |
|
| 405 | - $value = $this->multidimensional_get( $value, $this->id_data['keys'], $this->default ); |
|
| 404 | + $value = $this->get_object_value($item_id); |
|
| 405 | + $value = $this->multidimensional_get($value, $this->id_data['keys'], $this->default); |
|
| 406 | 406 | break; |
| 407 | 407 | |
| 408 | 408 | case 'customizer' : |
| 409 | 409 | case 'settings' : |
| 410 | 410 | $value = $this->get_option_value(); |
| 411 | - $value = $this->multidimensional_get( $value, $this->id_data['keys'], $this->default ); |
|
| 411 | + $value = $this->multidimensional_get($value, $this->id_data['keys'], $this->default); |
|
| 412 | 412 | break; |
| 413 | 413 | |
| 414 | 414 | default : |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * @param mixed $default The field default value. Default empty. |
| 425 | 425 | * @param int $item_id (optional) The Item ID. |
| 426 | 426 | */ |
| 427 | - $value = apply_filters( 'fields_value_' . $this->object_type . '_' . $this->object_name . '_' . $this->id_data['base'], $this->default, $item_id ); |
|
| 427 | + $value = apply_filters('fields_value_'.$this->object_type.'_'.$this->object_name.'_'.$this->id_data['base'], $this->default, $item_id); |
|
| 428 | 428 | break; |
| 429 | 429 | } |
| 430 | 430 | |
@@ -439,39 +439,39 @@ discard block |
||
| 439 | 439 | * |
| 440 | 440 | * @return mixed|null |
| 441 | 441 | */ |
| 442 | - public function get_object_value( $item_id ) { |
|
| 442 | + public function get_object_value($item_id) { |
|
| 443 | 443 | |
| 444 | 444 | $value = null; |
| 445 | 445 | $object = null; |
| 446 | 446 | |
| 447 | 447 | $field_key = $this->id_data['base']; |
| 448 | 448 | |
| 449 | - switch ( $this->object_type ) { |
|
| 449 | + switch ($this->object_type) { |
|
| 450 | 450 | case 'post' : |
| 451 | - $object = get_post( $item_id ); |
|
| 451 | + $object = get_post($item_id); |
|
| 452 | 452 | break; |
| 453 | 453 | |
| 454 | 454 | case 'term' : |
| 455 | - $object = get_term( $item_id ); |
|
| 455 | + $object = get_term($item_id); |
|
| 456 | 456 | break; |
| 457 | 457 | |
| 458 | 458 | case 'user' : |
| 459 | - $object = get_userdata( $item_id ); |
|
| 459 | + $object = get_userdata($item_id); |
|
| 460 | 460 | break; |
| 461 | 461 | |
| 462 | 462 | case 'comment' : |
| 463 | - $object = get_comment( $item_id ); |
|
| 463 | + $object = get_comment($item_id); |
|
| 464 | 464 | break; |
| 465 | 465 | } |
| 466 | 466 | |
| 467 | - if ( $object && ! is_wp_error( $object ) && isset( $object->{$field_key} ) ) { |
|
| 467 | + if ($object && ! is_wp_error($object) && isset($object->{$field_key} )) { |
|
| 468 | 468 | // Get value from object |
| 469 | 469 | $value = $object->{$field_key}; |
| 470 | 470 | } else { |
| 471 | 471 | // Get value from meta |
| 472 | - $value = get_metadata( $this->object_type, $item_id, $field_key ); |
|
| 472 | + $value = get_metadata($this->object_type, $item_id, $field_key); |
|
| 473 | 473 | |
| 474 | - if ( array() === $value ) { |
|
| 474 | + if (array() === $value) { |
|
| 475 | 475 | $value = $this->default; |
| 476 | 476 | } |
| 477 | 477 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $function = ''; |
| 491 | 491 | $value = null; |
| 492 | 492 | |
| 493 | - switch ( $this->object_type ) { |
|
| 493 | + switch ($this->object_type) { |
|
| 494 | 494 | case 'customizer' : |
| 495 | 495 | $function = 'get_theme_mod'; |
| 496 | 496 | break; |
@@ -500,14 +500,14 @@ discard block |
||
| 500 | 500 | break; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if ( is_callable( $function ) ) { |
|
| 503 | + if (is_callable($function)) { |
|
| 504 | 504 | // Handle non-array value |
| 505 | - if ( empty( $this->id_data['keys'] ) ) { |
|
| 506 | - return $function( $this->id_data['base'], $this->default ); |
|
| 505 | + if (empty($this->id_data['keys'])) { |
|
| 506 | + return $function($this->id_data['base'], $this->default); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | // Handle array-based value |
| 510 | - $value = $function( $this->id_data['base'] ); |
|
| 510 | + $value = $function($this->id_data['base']); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | return $value; |
@@ -531,10 +531,10 @@ discard block |
||
| 531 | 531 | * @param mixed $value The field value. |
| 532 | 532 | * @param WP_Fields_API_Field $this {@see WP_Fields_API_Field} instance. |
| 533 | 533 | */ |
| 534 | - $value = apply_filters( "fields_sanitize_js_{$this->object_type}_{$this->object_name}_{$this->id}", $value, $this ); |
|
| 534 | + $value = apply_filters("fields_sanitize_js_{$this->object_type}_{$this->object_name}_{$this->id}", $value, $this); |
|
| 535 | 535 | |
| 536 | - if ( is_string( $value ) ) { |
|
| 537 | - return html_entity_decode( $value, ENT_QUOTES, 'UTF-8' ); |
|
| 536 | + if (is_string($value)) { |
|
| 537 | + return html_entity_decode($value, ENT_QUOTES, 'UTF-8'); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | return $value; |
@@ -548,18 +548,18 @@ discard block |
||
| 548 | 548 | */ |
| 549 | 549 | public function check_capabilities() { |
| 550 | 550 | |
| 551 | - if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) { |
|
| 551 | + if ($this->capability && ! call_user_func_array('current_user_can', (array) $this->capability)) { |
|
| 552 | 552 | return false; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) { |
|
| 555 | + if ($this->theme_supports && ! call_user_func_array('current_theme_supports', (array) $this->theme_supports)) { |
|
| 556 | 556 | return false; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $access = true; |
| 560 | 560 | |
| 561 | - if ( is_callable( $this->capabilities_callback ) ) { |
|
| 562 | - $access = call_user_func( $this->capabilities_callback, $this ); |
|
| 561 | + if (is_callable($this->capabilities_callback)) { |
|
| 562 | + $access = call_user_func($this->capabilities_callback, $this); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | return $access; |
@@ -575,42 +575,42 @@ discard block |
||
| 575 | 575 | * |
| 576 | 576 | * @return null|array Keys are 'root', 'node', and 'key'. |
| 577 | 577 | */ |
| 578 | - final protected function multidimensional( &$root, $keys, $create = false ) { |
|
| 578 | + final protected function multidimensional(&$root, $keys, $create = false) { |
|
| 579 | 579 | |
| 580 | - if ( $create && empty( $root ) ) { |
|
| 580 | + if ($create && empty($root)) { |
|
| 581 | 581 | $root = array(); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - if ( ! isset( $root ) || empty( $keys ) ) { |
|
| 584 | + if ( ! isset($root) || empty($keys)) { |
|
| 585 | 585 | return null; |
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $last = array_pop( $keys ); |
|
| 588 | + $last = array_pop($keys); |
|
| 589 | 589 | $node = &$root; |
| 590 | 590 | |
| 591 | - foreach ( $keys as $key ) { |
|
| 592 | - if ( $create && ! isset( $node[ $key ] ) ) { |
|
| 593 | - $node[ $key ] = array(); |
|
| 591 | + foreach ($keys as $key) { |
|
| 592 | + if ($create && ! isset($node[$key])) { |
|
| 593 | + $node[$key] = array(); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - if ( ! is_array( $node ) || ! isset( $node[ $key ] ) ) { |
|
| 596 | + if ( ! is_array($node) || ! isset($node[$key])) { |
|
| 597 | 597 | return null; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - $node = &$node[ $key ]; |
|
| 600 | + $node = &$node[$key]; |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - if ( $create ) { |
|
| 604 | - if ( ! is_array( $node ) ) { |
|
| 603 | + if ($create) { |
|
| 604 | + if ( ! is_array($node)) { |
|
| 605 | 605 | // account for an array overriding a string or object value |
| 606 | 606 | $node = array(); |
| 607 | 607 | } |
| 608 | - if ( ! isset( $node[ $last ] ) ) { |
|
| 609 | - $node[ $last ] = array(); |
|
| 608 | + if ( ! isset($node[$last])) { |
|
| 609 | + $node[$last] = array(); |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - if ( ! isset( $node[ $last ] ) ) { |
|
| 613 | + if ( ! isset($node[$last])) { |
|
| 614 | 614 | return null; |
| 615 | 615 | } |
| 616 | 616 | |
@@ -631,19 +631,19 @@ discard block |
||
| 631 | 631 | * |
| 632 | 632 | * @return |
| 633 | 633 | */ |
| 634 | - final protected function multidimensional_replace( $root, $keys, $value ) { |
|
| 634 | + final protected function multidimensional_replace($root, $keys, $value) { |
|
| 635 | 635 | |
| 636 | - if ( ! isset( $value ) ) { |
|
| 636 | + if ( ! isset($value)) { |
|
| 637 | 637 | return $root; |
| 638 | - } elseif ( empty( $keys ) ) { |
|
| 638 | + } elseif (empty($keys)) { |
|
| 639 | 639 | // If there are no keys, we're replacing the root. |
| 640 | 640 | return $value; |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $result = $this->multidimensional( $root, $keys, true ); |
|
| 643 | + $result = $this->multidimensional($root, $keys, true); |
|
| 644 | 644 | |
| 645 | - if ( isset( $result ) ) { |
|
| 646 | - $result['node'][ $result['key'] ] = $value; |
|
| 645 | + if (isset($result)) { |
|
| 646 | + $result['node'][$result['key']] = $value; |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | return $root; |
@@ -659,18 +659,18 @@ discard block |
||
| 659 | 659 | * |
| 660 | 660 | * @return mixed The requested value or the default value. |
| 661 | 661 | */ |
| 662 | - final protected function multidimensional_get( $root, $keys, $default = null ) { |
|
| 662 | + final protected function multidimensional_get($root, $keys, $default = null) { |
|
| 663 | 663 | |
| 664 | 664 | // If there are no keys, test the root. |
| 665 | - if ( empty( $keys ) ) { |
|
| 666 | - if ( isset( $root ) ) { |
|
| 665 | + if (empty($keys)) { |
|
| 666 | + if (isset($root)) { |
|
| 667 | 667 | return $root; |
| 668 | 668 | } |
| 669 | 669 | } else { |
| 670 | - $result = $this->multidimensional( $root, $keys ); |
|
| 670 | + $result = $this->multidimensional($root, $keys); |
|
| 671 | 671 | |
| 672 | - if ( isset( $result ) ) { |
|
| 673 | - return $result['node'][ $result['key'] ]; |
|
| 672 | + if (isset($result)) { |
|
| 673 | + return $result['node'][$result['key']]; |
|
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
@@ -686,11 +686,11 @@ discard block |
||
| 686 | 686 | * |
| 687 | 687 | * @return bool True if value is set, false if not. |
| 688 | 688 | */ |
| 689 | - final protected function multidimensional_isset( $root, $keys ) { |
|
| 689 | + final protected function multidimensional_isset($root, $keys) { |
|
| 690 | 690 | |
| 691 | - $result = $this->multidimensional_get( $root, $keys ); |
|
| 691 | + $result = $this->multidimensional_get($root, $keys); |
|
| 692 | 692 | |
| 693 | - return isset( $result ); |
|
| 693 | + return isset($result); |
|
| 694 | 694 | |
| 695 | 695 | } |
| 696 | 696 | } |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | * |
| 713 | 713 | * @return mixed The result of saving the value. |
| 714 | 714 | */ |
| 715 | - public function update( $value ) { |
|
| 715 | + public function update($value) { |
|
| 716 | 716 | |
| 717 | 717 | return null; |
| 718 | 718 | |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | ?> |
| 15 | 15 | <label> |
| 16 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
| 17 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 16 | + <?php if ( ! empty($this->label)) : ?> |
|
| 17 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 18 | 18 | <?php endif; |
| 19 | - if ( ! empty( $this->description ) ) : ?> |
|
| 19 | + if ( ! empty($this->description)) : ?> |
|
| 20 | 20 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 21 | 21 | <?php endif; ?> |
| 22 | - <input type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> /> |
|
| 22 | + <input type="<?php echo esc_attr($this->type); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr($this->value()); ?>" <?php $this->link(); ?> /> |
|
| 23 | 23 | </label> |
| 24 | 24 | <?php |
| 25 | 25 | |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $checkbox_value = $this->checkbox_value(); |
| 54 | 54 | ?> |
| 55 | 55 | <label> |
| 56 | - <input type="checkbox" value="<?php echo esc_attr( $checkbox_value ); ?>" <?php $this->link(); checked( $checkbox_value, $this->value() ); ?> /> |
|
| 57 | - <?php echo esc_html( $this->label ); ?> |
|
| 58 | - <?php if ( ! empty( $this->description ) ) : ?> |
|
| 56 | + <input type="checkbox" value="<?php echo esc_attr($checkbox_value); ?>" <?php $this->link(); checked($checkbox_value, $this->value()); ?> /> |
|
| 57 | + <?php echo esc_html($this->label); ?> |
|
| 58 | + <?php if ( ! empty($this->description)) : ?> |
|
| 59 | 59 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 60 | 60 | <?php endif; ?> |
| 61 | 61 | </label> |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $value = $this->value(); |
| 74 | 74 | |
| 75 | - if ( isset( $this->checkbox_value ) ) { |
|
| 75 | + if (isset($this->checkbox_value)) { |
|
| 76 | 76 | $value = $this->checkbox_value; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -94,24 +94,24 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function render_content() { |
| 96 | 96 | |
| 97 | - if ( empty( $this->choices ) ) { |
|
| 97 | + if (empty($this->choices)) { |
|
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - $name = '_fields-checkbox-' . $this->id; |
|
| 101 | + $name = '_fields-checkbox-'.$this->id; |
|
| 102 | 102 | |
| 103 | - if ( ! empty( $this->label ) ) : ?> |
|
| 104 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 103 | + if ( ! empty($this->label)) : ?> |
|
| 104 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 105 | 105 | <?php endif; |
| 106 | - if ( ! empty( $this->description ) ) : ?> |
|
| 107 | - <span class="description fields-control-description"><?php echo $this->description ; ?></span> |
|
| 106 | + if ( ! empty($this->description)) : ?> |
|
| 107 | + <span class="description fields-control-description"><?php echo $this->description; ?></span> |
|
| 108 | 108 | <?php endif; |
| 109 | 109 | |
| 110 | - foreach ( $this->choices as $value => $label ) : |
|
| 110 | + foreach ($this->choices as $value => $label) : |
|
| 111 | 111 | ?> |
| 112 | 112 | <label> |
| 113 | - <input type="checkbox" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> /> |
|
| 114 | - <?php echo esc_html( $label ); ?><br/> |
|
| 113 | + <input type="checkbox" value="<?php echo esc_attr($value); ?>" name="<?php echo esc_attr($name); ?>" <?php $this->link(); checked($this->value(), $value); ?> /> |
|
| 114 | + <?php echo esc_html($label); ?><br/> |
|
| 115 | 115 | </label> |
| 116 | 116 | <?php |
| 117 | 117 | endforeach; |
@@ -132,24 +132,24 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function render_content() { |
| 134 | 134 | |
| 135 | - if ( empty( $this->choices ) ) { |
|
| 135 | + if (empty($this->choices)) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $name = '_fields-radio-' . $this->id; |
|
| 139 | + $name = '_fields-radio-'.$this->id; |
|
| 140 | 140 | |
| 141 | - if ( ! empty( $this->label ) ) : ?> |
|
| 142 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 141 | + if ( ! empty($this->label)) : ?> |
|
| 142 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 143 | 143 | <?php endif; |
| 144 | - if ( ! empty( $this->description ) ) : ?> |
|
| 145 | - <span class="description fields-control-description"><?php echo $this->description ; ?></span> |
|
| 144 | + if ( ! empty($this->description)) : ?> |
|
| 145 | + <span class="description fields-control-description"><?php echo $this->description; ?></span> |
|
| 146 | 146 | <?php endif; |
| 147 | 147 | |
| 148 | - foreach ( $this->choices as $value => $label ) : |
|
| 148 | + foreach ($this->choices as $value => $label) : |
|
| 149 | 149 | ?> |
| 150 | 150 | <label> |
| 151 | - <input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> /> |
|
| 152 | - <?php echo esc_html( $label ); ?><br/> |
|
| 151 | + <input type="radio" value="<?php echo esc_attr($value); ?>" name="<?php echo esc_attr($name); ?>" <?php $this->link(); checked($this->value(), $value); ?> /> |
|
| 152 | + <?php echo esc_html($label); ?><br/> |
|
| 153 | 153 | </label> |
| 154 | 154 | <?php |
| 155 | 155 | endforeach; |
@@ -170,22 +170,22 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function render_content() { |
| 172 | 172 | |
| 173 | - if ( empty( $this->choices ) ) { |
|
| 173 | + if (empty($this->choices)) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | ?> |
| 177 | 177 | <label> |
| 178 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
| 179 | - <span class="fields-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 178 | + <?php if ( ! empty($this->label)) : ?> |
|
| 179 | + <span class="fields-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 180 | 180 | <?php endif; |
| 181 | - if ( ! empty( $this->description ) ) : ?> |
|
| 181 | + if ( ! empty($this->description)) : ?> |
|
| 182 | 182 | <span class="description fields-control-description"><?php echo $this->description; ?></span> |
| 183 | 183 | <?php endif; ?> |
| 184 | 184 | |
| 185 | 185 | <select <?php $this->link(); ?>> |
| 186 | 186 | <?php |
| 187 | - foreach ( $this->choices as $value => $label ) |
|
| 188 | - echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
|
| 187 | + foreach ($this->choices as $value => $label) |
|
| 188 | + echo '<option value="'.esc_attr($value).'"'.selected($this->value(), $value, false).'>'.$label.'</option>'; |
|
| 189 | 189 | ?> |
| 190 | 190 | </select> |
| 191 | 191 | </label> |
@@ -210,12 +210,12 @@ discard block |
||
| 210 | 210 | public function choices() { |
| 211 | 211 | |
| 212 | 212 | $choices = array( |
| 213 | - '0' => __( '— Select —' ), |
|
| 213 | + '0' => __('— Select —'), |
|
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | 216 | $pages = get_pages(); |
| 217 | 217 | |
| 218 | - $choices = $this->get_page_choices_recurse( $choices, $pages ); |
|
| 218 | + $choices = $this->get_page_choices_recurse($choices, $pages); |
|
| 219 | 219 | |
| 220 | 220 | return $choices; |
| 221 | 221 | |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return array |
| 233 | 233 | */ |
| 234 | - public function get_page_choices_recurse( $choices, $pages, $depth = 0, $parent = 0 ) { |
|
| 234 | + public function get_page_choices_recurse($choices, $pages, $depth = 0, $parent = 0) { |
|
| 235 | 235 | |
| 236 | - $pad = str_repeat( ' ', $depth * 3 ); |
|
| 236 | + $pad = str_repeat(' ', $depth * 3); |
|
| 237 | 237 | |
| 238 | - foreach ( $pages as $page ) { |
|
| 239 | - if ( $parent == $page->post_parent ) { |
|
| 238 | + foreach ($pages as $page) { |
|
| 239 | + if ($parent == $page->post_parent) { |
|
| 240 | 240 | $title = $page->post_title; |
| 241 | 241 | |
| 242 | - if ( '' === $title ) { |
|
| 242 | + if ('' === $title) { |
|
| 243 | 243 | /* translators: %d: ID of a post */ |
| 244 | - $title = sprintf( __( '#%d (no title)' ), $page->ID ); |
|
| 244 | + $title = sprintf(__('#%d (no title)'), $page->ID); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | * @param string $title Page title. |
| 253 | 253 | * @param object $page Page data object. |
| 254 | 254 | */ |
| 255 | - $title = apply_filters( 'list_pages', $title, $page ); |
|
| 255 | + $title = apply_filters('list_pages', $title, $page); |
|
| 256 | 256 | |
| 257 | - $choices[ $page->ID ] = $pad . $title; |
|
| 257 | + $choices[$page->ID] = $pad.$title; |
|
| 258 | 258 | |
| 259 | - $choices = $this->get_page_choices_recurse( $choices, $pages, $depth + 1, $page->ID ); |
|
| 259 | + $choices = $this->get_page_choices_recurse($choices, $pages, $depth + 1, $page->ID); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
@@ -295,13 +295,13 @@ discard block |
||
| 295 | 295 | * @param string $id Control ID. |
| 296 | 296 | * @param array $args Optional. Arguments to override class property defaults. |
| 297 | 297 | */ |
| 298 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 298 | + public function __construct($manager, $id, $args = array()) { |
|
| 299 | 299 | |
| 300 | 300 | $this->statuses = array( |
| 301 | - '' => __( 'Default' ), |
|
| 301 | + '' => __('Default'), |
|
| 302 | 302 | ); |
| 303 | 303 | |
| 304 | - parent::__construct( $manager, $id, $args ); |
|
| 304 | + parent::__construct($manager, $id, $args); |
|
| 305 | 305 | |
| 306 | 306 | } |
| 307 | 307 | |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | * @since 3.4.0 |
| 312 | 312 | */ |
| 313 | 313 | public function enqueue() { |
| 314 | - wp_enqueue_script( 'wp-color-picker' ); |
|
| 315 | - wp_enqueue_style( 'wp-color-picker' ); |
|
| 314 | + wp_enqueue_script('wp-color-picker'); |
|
| 315 | + wp_enqueue_style('wp-color-picker'); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | <span class="description customize-control-description">{{{ data.description }}}</span> |
| 365 | 365 | <# } #> |
| 366 | 366 | <div class="customize-control-content"> |
| 367 | - <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} /> |
|
| 367 | + <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e('Hex Value'); ?>" {{ defaultValue }} /> |
|
| 368 | 368 | </div> |
| 369 | 369 | </label> |
| 370 | 370 | <?php |
@@ -416,17 +416,17 @@ discard block |
||
| 416 | 416 | * @param string $id Control ID. |
| 417 | 417 | * @param array $args Optional. Arguments to override class property defaults. |
| 418 | 418 | */ |
| 419 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 420 | - parent::__construct( $manager, $id, $args ); |
|
| 419 | + public function __construct($manager, $id, $args = array()) { |
|
| 420 | + parent::__construct($manager, $id, $args); |
|
| 421 | 421 | |
| 422 | 422 | $this->button_labels = array( |
| 423 | - 'select' => __( 'Select File' ), |
|
| 424 | - 'change' => __( 'Change File' ), |
|
| 425 | - 'default' => __( 'Default' ), |
|
| 426 | - 'remove' => __( 'Remove' ), |
|
| 427 | - 'placeholder' => __( 'No file selected' ), |
|
| 428 | - 'frame_title' => __( 'Select File' ), |
|
| 429 | - 'frame_button' => __( 'Choose File' ), |
|
| 423 | + 'select' => __('Select File'), |
|
| 424 | + 'change' => __('Change File'), |
|
| 425 | + 'default' => __('Default'), |
|
| 426 | + 'remove' => __('Remove'), |
|
| 427 | + 'placeholder' => __('No file selected'), |
|
| 428 | + 'frame_title' => __('Select File'), |
|
| 429 | + 'frame_button' => __('Choose File'), |
|
| 430 | 430 | ); |
| 431 | 431 | } |
| 432 | 432 | |
@@ -450,40 +450,40 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function to_json() { |
| 452 | 452 | parent::to_json(); |
| 453 | - $this->json['label'] = html_entity_decode( $this->label, ENT_QUOTES, get_bloginfo( 'charset' ) ); |
|
| 453 | + $this->json['label'] = html_entity_decode($this->label, ENT_QUOTES, get_bloginfo('charset')); |
|
| 454 | 454 | $this->json['mime_type'] = $this->mime_type; |
| 455 | 455 | $this->json['button_labels'] = $this->button_labels; |
| 456 | - $this->json['canUpload'] = current_user_can( 'upload_files' ); |
|
| 456 | + $this->json['canUpload'] = current_user_can('upload_files'); |
|
| 457 | 457 | |
| 458 | 458 | $value = $this->value(); |
| 459 | 459 | |
| 460 | - if ( is_object( $this->setting ) ) { |
|
| 461 | - if ( $this->setting->default ) { |
|
| 460 | + if (is_object($this->setting)) { |
|
| 461 | + if ($this->setting->default) { |
|
| 462 | 462 | // Fake an attachment model - needs all fields used by template. |
| 463 | 463 | // Note that the default value must be a URL, NOT an attachment ID. |
| 464 | - $type = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document'; |
|
| 464 | + $type = in_array(substr($this->setting->default, -3), array('jpg', 'png', 'gif', 'bmp')) ? 'image' : 'document'; |
|
| 465 | 465 | $default_attachment = array( |
| 466 | 466 | 'id' => 1, |
| 467 | 467 | 'url' => $this->setting->default, |
| 468 | 468 | 'type' => $type, |
| 469 | - 'icon' => wp_mime_type_icon( $type ), |
|
| 470 | - 'title' => basename( $this->setting->default ), |
|
| 469 | + 'icon' => wp_mime_type_icon($type), |
|
| 470 | + 'title' => basename($this->setting->default), |
|
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - if ( 'image' === $type ) { |
|
| 473 | + if ('image' === $type) { |
|
| 474 | 474 | $default_attachment['sizes'] = array( |
| 475 | - 'full' => array( 'url' => $this->setting->default ), |
|
| 475 | + 'full' => array('url' => $this->setting->default), |
|
| 476 | 476 | ); |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | $this->json['defaultAttachment'] = $default_attachment; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - if ( $value && $this->setting->default && $value === $this->setting->default ) { |
|
| 482 | + if ($value && $this->setting->default && $value === $this->setting->default) { |
|
| 483 | 483 | // Set the default as the attachment. |
| 484 | 484 | $this->json['attachment'] = $this->json['defaultAttachment']; |
| 485 | - } elseif ( $value ) { |
|
| 486 | - $this->json['attachment'] = wp_prepare_attachment_for_js( $value ); |
|
| 485 | + } elseif ($value) { |
|
| 486 | + $this->json['attachment'] = wp_prepare_attachment_for_js($value); |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | } |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | parent::to_json(); |
| 615 | 615 | |
| 616 | 616 | $value = $this->value(); |
| 617 | - if ( $value ) { |
|
| 617 | + if ($value) { |
|
| 618 | 618 | // Get the attachment model for the existing file. |
| 619 | - $attachment_id = attachment_url_to_postid( $value ); |
|
| 620 | - if ( $attachment_id ) { |
|
| 621 | - $this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id ); |
|
| 619 | + $attachment_id = attachment_url_to_postid($value); |
|
| 620 | + if ($attachment_id) { |
|
| 621 | + $this->json['attachment'] = wp_prepare_attachment_for_js($attachment_id); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | } |
@@ -645,17 +645,17 @@ discard block |
||
| 645 | 645 | * @param string $id Control ID. |
| 646 | 646 | * @param array $args Optional. Arguments to override class property defaults. |
| 647 | 647 | */ |
| 648 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 649 | - parent::__construct( $manager, $id, $args ); |
|
| 648 | + public function __construct($manager, $id, $args = array()) { |
|
| 649 | + parent::__construct($manager, $id, $args); |
|
| 650 | 650 | |
| 651 | 651 | $this->button_labels = array( |
| 652 | - 'select' => __( 'Select Image' ), |
|
| 653 | - 'change' => __( 'Change Image' ), |
|
| 654 | - 'remove' => __( 'Remove' ), |
|
| 655 | - 'default' => __( 'Default' ), |
|
| 656 | - 'placeholder' => __( 'No image selected' ), |
|
| 657 | - 'frame_title' => __( 'Select Image' ), |
|
| 658 | - 'frame_button' => __( 'Choose Image' ), |
|
| 652 | + 'select' => __('Select Image'), |
|
| 653 | + 'change' => __('Change Image'), |
|
| 654 | + 'remove' => __('Remove'), |
|
| 655 | + 'default' => __('Default'), |
|
| 656 | + 'placeholder' => __('No image selected'), |
|
| 657 | + 'frame_title' => __('Select Image'), |
|
| 658 | + 'frame_button' => __('Choose Image'), |
|
| 659 | 659 | ); |
| 660 | 660 | } |
| 661 | 661 | |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | * @param string $label |
| 674 | 674 | * @param mixed $callback |
| 675 | 675 | */ |
| 676 | - public function add_tab( $id, $label, $callback ) {} |
|
| 676 | + public function add_tab($id, $label, $callback) {} |
|
| 677 | 677 | |
| 678 | 678 | /** |
| 679 | 679 | * @since 3.4.0 |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * |
| 682 | 682 | * @param string $id |
| 683 | 683 | */ |
| 684 | - public function remove_tab( $id ) {} |
|
| 684 | + public function remove_tab($id) {} |
|
| 685 | 685 | |
| 686 | 686 | /** |
| 687 | 687 | * @since 3.4.0 |
@@ -690,5 +690,5 @@ discard block |
||
| 690 | 690 | * @param string $url |
| 691 | 691 | * @param string $thumbnail_url |
| 692 | 692 | */ |
| 693 | - public function print_tab_image( $url, $thumbnail_url = null ) {} |
|
| 693 | + public function print_tab_image($url, $thumbnail_url = null) {} |
|
| 694 | 694 | } |
| 695 | 695 | \ No newline at end of file |