wp/wp-includes/class-wp-dependency.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 21 48c4eec2b7e6
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    19 class _WP_Dependency {
    19 class _WP_Dependency {
    20 	/**
    20 	/**
    21 	 * The handle name.
    21 	 * The handle name.
    22 	 *
    22 	 *
    23 	 * @since 2.6.0
    23 	 * @since 2.6.0
    24 	 * @var null
    24 	 * @var string
    25 	 */
    25 	 */
    26 	public $handle;
    26 	public $handle;
    27 
    27 
    28 	/**
    28 	/**
    29 	 * The handle source.
    29 	 * The handle source.
    30 	 *
    30 	 *
    31 	 * @since 2.6.0
    31 	 * @since 2.6.0
    32 	 * @var null
    32 	 * @var string
    33 	 */
    33 	 */
    34 	public $src;
    34 	public $src;
    35 
    35 
    36 	/**
    36 	/**
    37 	 * An array of handle dependencies.
    37 	 * An array of handle dependencies.
    38 	 *
    38 	 *
    39 	 * @since 2.6.0
    39 	 * @since 2.6.0
    40 	 * @var array
    40 	 * @var string[]
    41 	 */
    41 	 */
    42 	public $deps = array();
    42 	public $deps = array();
    43 
    43 
    44 	/**
    44 	/**
    45 	 * The handle version.
    45 	 * The handle version.
    53 
    53 
    54 	/**
    54 	/**
    55 	 * Additional arguments for the handle.
    55 	 * Additional arguments for the handle.
    56 	 *
    56 	 *
    57 	 * @since 2.6.0
    57 	 * @since 2.6.0
    58 	 * @var null
    58 	 * @var array
    59 	 */
    59 	 */
    60 	public $args = null;  // Custom property, such as $in_footer or $media.
    60 	public $args = null;  // Custom property, such as $in_footer or $media.
    61 
    61 
    62 	/**
    62 	/**
    63 	 * Extra data to supply to the handle.
    63 	 * Extra data to supply to the handle.
    85 
    85 
    86 	/**
    86 	/**
    87 	 * Setup dependencies.
    87 	 * Setup dependencies.
    88 	 *
    88 	 *
    89 	 * @since 2.6.0
    89 	 * @since 2.6.0
       
    90 	 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it
       
    91 	 *              to the function signature.
       
    92 	 *
       
    93 	 * @param mixed ...$args Dependency information.
    90 	 */
    94 	 */
    91 	public function __construct() {
    95 	public function __construct( ...$args ) {
    92 		@list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
    96 		list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = $args;
    93 		if ( ! is_array( $this->deps ) ) {
    97 		if ( ! is_array( $this->deps ) ) {
    94 			$this->deps = array();
    98 			$this->deps = array();
    95 		}
    99 		}
    96 	}
   100 	}
    97 
   101 
   117 	 *
   121 	 *
   118 	 * @since 5.0.0
   122 	 * @since 5.0.0
   119 	 *
   123 	 *
   120 	 * @param string $domain The translation textdomain.
   124 	 * @param string $domain The translation textdomain.
   121 	 * @param string $path   Optional. The full file path to the directory containing translation files.
   125 	 * @param string $path   Optional. The full file path to the directory containing translation files.
   122 	 *
       
   123 	 * @return bool False if $domain is not a string, true otherwise.
   126 	 * @return bool False if $domain is not a string, true otherwise.
   124 	 */
   127 	 */
   125 	public function set_translations( $domain, $path = null ) {
   128 	public function set_translations( $domain, $path = null ) {
   126 		if ( ! is_string( $domain ) ) {
   129 		if ( ! is_string( $domain ) ) {
   127 			return false;
   130 			return false;