]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class.wp-dependencies.php
Wordpress 3.3-scripts
[autoinstalls/wordpress.git] / wp-includes / class.wp-dependencies.php
index de3630ad840c570c2e409fa4d72410381a2c4921..3907082ebe240a275113b3f5ba701c30ef5236ab 100644 (file)
@@ -25,13 +25,6 @@ class WP_Dependencies {
        var $groups = array();
        var $group = 0;
 
-       function WP_Dependencies() {
-               $args = func_get_args();
-               call_user_func_array( array(&$this, '__construct'), $args );
-       }
-
-       function __construct() {}
-
        /**
         * Do the dependencies
         *
@@ -46,7 +39,7 @@ class WP_Dependencies {
                $this->all_deps( $handles );
 
                foreach( $this->to_do as $key => $handle ) {
-                       if ( !in_array($handle, $this->done) && isset($this->registered[$handle]) ) {
+                       if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
 
                                if ( ! $this->registered[$handle]->src ) { // Defines a group.
                                        $this->done[] = $handle;
@@ -141,17 +134,39 @@ class WP_Dependencies {
        /**
         * Adds extra data
         *
-        * Adds data only if script has already been added
+        * Adds data only if script has already been added.
         *
         * @param string $handle Script name
-        * @param string $data_name Name of object in which to store extra data
-        * @param array $data Array of extra data
+        * @param string $key
+        * @param mixed $value
         * @return bool success
         */
-       function add_data( $handle, $data_name, $data ) {
-               if ( !isset($this->registered[$handle]) )
+       function add_data( $handle, $key, $value ) {
+               if ( !isset( $this->registered[$handle] ) )
+                       return false;
+
+               return $this->registered[$handle]->add_data( $key, $value );
+       }
+
+       /**
+        * Get extra data
+        *
+        * Gets data associated with a certain handle.
+        *
+        * @since WP 3.3
+        *
+        * @param string $handle Script name
+        * @param string $key
+        * @return mixed
+        */
+       function get_data( $handle, $key ) {
+               if ( !isset( $this->registered[$handle] ) )
+                       return false;
+
+               if ( !isset( $this->registered[$handle]->extra[$key] ) )
                        return false;
-               return $this->registered[$handle]->add_data( $data_name, $data );
+
+               return $this->registered[$handle]->extra[$key];
        }
 
        function remove( $handles ) {
@@ -228,7 +243,7 @@ class _WP_Dependency {
 
        var $extra = array();
 
-       function _WP_Dependency() {
+       function __construct() {
                @list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
                if ( !is_array($this->deps) )
                        $this->deps = array();