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; }
function all_deps($handles, $recursion = false) { $r = parent::all_deps($handles, $recursion); if (!$recursion) { $this->to_do = apply_filters('print_scripts_array', $this->to_do); } return $r; }
/** * @param mixed $handles * @param bool $recursion * @param mixed $group * @return bool */ public function all_deps($handles, $recursion = false, $group = false) { $r = parent::all_deps($handles, $recursion); if (!$recursion) { /** * Filter the array of enqueued styles before processing for output. * * @since 2.6.0 * * @param array $to_do The list of enqueued styles about to be processed. */ $this->to_do = apply_filters('print_styles_array', $this->to_do); } return $r; }
public function all_deps($handles, $recursion = false, $group = false) { $r = parent::all_deps($handles, $recursion); if (!$recursion) { /** * Filter the list of script dependencies left to print. * * @since 2.3.0 * * @param array $to_do An array of script dependencies. */ $this->to_do = apply_filters('print_scripts_array', $this->to_do); } return $r; }
/** * @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')); }
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; }