GC_Dependencies::query()

最后更新于:2021-11-27 14:29:26

GC_Dependencies::query( string$handle, string$list=’registered’)

Query list for an item.

参数

$handle

(string) (Required) Name of the item. Should be unique.

$list

(string) (Optional) Property name of list array.

Default value: ‘registered’

响应

(bool|_GC_Dependency) Found, or object Item data.

源文件

文件: gc-includes/class.gc-dependencies.php

	public function query( $handle, $list = 'registered' ) {
		switch ( $list ) {
			case 'registered':
			case 'scripts': // Back compat.
				if ( isset( $this->registered[ $handle ] ) ) {
					return $this->registered[ $handle ];
				}
				return false;

			case 'enqueued':
			case 'queue':
				if ( in_array( $handle, $this->queue, true ) ) {
					return true;
				}
				return $this->recurse_deps( $this->queue, $handle );

			case 'to_do':
			case 'to_print': // Back compat.
				return in_array( $handle, $this->to_do, true );

			case 'done':
			case 'printed': // Back compat.
				return in_array( $handle, $this->done, true );
		}
		return false;
	}