本文整理汇总了PHP中WP_Dependencies::query方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Dependencies::query方法的具体用法?PHP WP_Dependencies::query怎么用?PHP WP_Dependencies::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Dependencies
的用法示例。
在下文中一共展示了WP_Dependencies::query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_broken_dependencies
protected function get_broken_dependencies(_WP_Dependency $item, WP_Dependencies $dependencies)
{
$broken = array();
foreach ($item->deps as $handle) {
if ($dep = $dependencies->query($handle)) {
$broken = array_merge($broken, $this->get_broken_dependencies($dep, $dependencies));
} else {
$broken[] = $item->handle;
}
}
return $broken;
}
示例2:
/**
* @ticket 21741
*/
function test_query_and_registered_enqueued()
{
$dep = new WP_Dependencies();
$this->assertTrue($dep->add('one', ''));
$this->assertInstanceOf('_WP_Dependency', $dep->query('one'));
$this->assertInstanceOf('_WP_Dependency', $dep->query('one', 'registered'));
$this->assertInstanceOf('_WP_Dependency', $dep->query('one', 'scripts'));
$this->assertFalse($dep->query('one', 'enqueued'));
$this->assertFalse($dep->query('one', 'queue'));
$dep->enqueue('one');
$this->assertTrue($dep->query('one', 'enqueued'));
$this->assertTrue($dep->query('one', 'queue'));
$dep->dequeue('one');
$this->assertFalse($dep->query('one', 'queue'));
$this->assertInstanceOf('_WP_Dependency', $dep->query('one'));
$dep->remove('one');
$this->assertFalse($dep->query('one'));
}
示例3: get_dependents
protected static function get_dependents(_WP_Dependency $script, WP_Dependencies $dependencies)
{
// @TODO move this into the collector
$dependents = array();
$handles = array_unique(array_merge($dependencies->queue, $dependencies->done));
foreach ($handles as $handle) {
if ($item = $dependencies->query($handle)) {
if (in_array($script->handle, $item->deps)) {
$dependents[] = $handle;
}
}
}
sort($dependents);
return $dependents;
}