mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 06:36:47 +01:00
0860bb2771
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs. See #41452. Built from https://develop.svn.wordpress.org/trunk@41162 git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
98 lines
1.5 KiB
PHP
98 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Dependencies API: _WP_Dependency class
|
|
*
|
|
* @since 4.7.0
|
|
*
|
|
* @package WordPress
|
|
* @subpackage Dependencies
|
|
*/
|
|
|
|
/**
|
|
* Class _WP_Dependency
|
|
*
|
|
* Helper class to register a handle and associated data.
|
|
*
|
|
* @access private
|
|
* @since 2.6.0
|
|
*/
|
|
class _WP_Dependency {
|
|
/**
|
|
* The handle name.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $handle;
|
|
|
|
/**
|
|
* The handle source.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $src;
|
|
|
|
/**
|
|
* An array of handle dependencies.
|
|
*
|
|
* @since 2.6.0
|
|
* @var array
|
|
*/
|
|
public $deps = array();
|
|
|
|
/**
|
|
* The handle version.
|
|
*
|
|
* Used for cache-busting.
|
|
*
|
|
* @since 2.6.0
|
|
* @var bool|string
|
|
*/
|
|
public $ver = false;
|
|
|
|
/**
|
|
* Additional arguments for the handle.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $args = null; // Custom property, such as $in_footer or $media.
|
|
|
|
/**
|
|
* Extra data to supply to the handle.
|
|
*
|
|
* @since 2.6.0
|
|
* @var array
|
|
*/
|
|
public $extra = array();
|
|
|
|
/**
|
|
* Setup dependencies.
|
|
*
|
|
* @since 2.6.0
|
|
*/
|
|
public function __construct() {
|
|
@list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
|
|
if ( ! is_array($this->deps) )
|
|
$this->deps = array();
|
|
}
|
|
|
|
/**
|
|
* Add handle data.
|
|
*
|
|
* @since 2.6.0
|
|
*
|
|
* @param string $name The data key to add.
|
|
* @param mixed $data The data value to add.
|
|
* @return bool False if not scalar, true otherwise.
|
|
*/
|
|
public function add_data( $name, $data ) {
|
|
if ( !is_scalar($name) )
|
|
return false;
|
|
$this->extra[$name] = $data;
|
|
return true;
|
|
}
|
|
|
|
}
|