Make WordPress Core


Ignore:
Timestamp:
08/26/2016 06:05:29 PM (10 years ago)
Author:
wonderboymusic
Message:

Script Loader: move _WP_Dependency into its own file.

See #37827.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-dependencies.php

    r36994 r38375  
    212212         *                                 number is automatically added equal to current installed WordPress version.
    213213         *                                 If set to null, no version is added.
    214          * @param mixed            $args   Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer. 
     214         * @param mixed            $args   Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer.
    215215         * @return bool Whether the item has been registered. True on success, false on failure.
    216216         */
    … …  
    412412        }
    413413
    414 } // WP_Dependencies
    415 
    416 /**
    417  * Class _WP_Dependency
    418  *
    419  * Helper class to register a handle and associated data.
    420  *
    421  * @access private
    422  * @since 2.6.0
    423  */
    424 class _WP_Dependency {
    425         /**
    426          * The handle name.
    427          *
    428          * @access public
    429          * @since 2.6.0
    430          * @var null
    431          */
    432         public $handle;
    433 
    434         /**
    435          * The handle source.
    436          *
    437          * @access public
    438          * @since 2.6.0
    439          * @var null
    440          */
    441         public $src;
    442 
    443         /**
    444          * An array of handle dependencies.
    445          *
    446          * @access public
    447          * @since 2.6.0
    448          * @var array
    449          */
    450         public $deps = array();
    451 
    452         /**
    453          * The handle version.
    454          *
    455          * Used for cache-busting.
    456          *
    457          * @access public
    458          * @since 2.6.0
    459          * @var bool|string
    460          */
    461         public $ver = false;
    462 
    463         /**
    464          * Additional arguments for the handle.
    465          *
    466          * @access public
    467          * @since 2.6.0
    468          * @var null
    469          */
    470         public $args = null;  // Custom property, such as $in_footer or $media.
    471 
    472         /**
    473          * Extra data to supply to the handle.
    474          *
    475          * @access public
    476          * @since 2.6.0
    477          * @var array
    478          */
    479         public $extra = array();
    480 
    481         /**
    482          * Setup dependencies.
    483          *
    484          * @since 2.6.0
    485          */
    486         public function __construct() {
    487                 @list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
    488                 if ( ! is_array($this->deps) )
    489                         $this->deps = array();
    490         }
    491 
    492         /**
    493          * Add handle data.
    494          *
    495          * @access public
    496          * @since 2.6.0
    497          *
    498          * @param string $name The data key to add.
    499          * @param mixed  $data The data value to add.
    500          * @return bool False if not scalar, true otherwise.
    501          */
    502         public function add_data( $name, $data ) {
    503                 if ( !is_scalar($name) )
    504                         return false;
    505                 $this->extra[$name] = $data;
    506                 return true;
    507         }
    508 
    509 } // _WP_Dependencies
     414}
Note: See TracChangeset for help on using the changeset viewer.