wp/wp-includes/customize/class-wp-customize-media-control.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-includes/customize/class-wp-customize-media-control.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/customize/class-wp-customize-media-control.php	Tue Dec 15 13:49:49 2020 +0100
@@ -45,9 +45,13 @@
 	 * @since 4.1.0
 	 * @since 4.2.0 Moved from WP_Customize_Upload_Control.
 	 *
+	 * @see WP_Customize_Control::__construct()
+	 *
 	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
 	 * @param string               $id      Control ID.
 	 * @param array                $args    Optional. Arguments to override class property defaults.
+	 *                                      See WP_Customize_Control::__construct() for information
+	 *                                      on accepted arguments. Default empty array.
 	 */
 	public function __construct( $manager, $id, $args = array() ) {
 		parent::__construct( $manager, $id, $args );
@@ -86,7 +90,9 @@
 			if ( $this->setting->default ) {
 				// Fake an attachment model - needs all fields used by template.
 				// Note that the default value must be a URL, NOT an attachment ID.
-				$type               = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document';
+				$ext  = substr( $this->setting->default, -3 );
+				$type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp' ), true ) ? 'image' : 'document';
+
 				$default_attachment = array(
 					'id'    => 1,
 					'url'   => $this->setting->default,
@@ -207,7 +213,7 @@
 	 *
 	 * @since 4.9.0
 	 *
-	 * @return array An associative array of default button labels.
+	 * @return string[] An associative array of default button labels keyed by the button name.
 	 */
 	public function get_default_button_labels() {
 		// Get just the mime type and strip the mime subtype if present.