function do_item($handle, $group = false) { if (!parent::do_item($handle)) { return false; } if (0 === $group && $this->groups[$handle] > 0) { $this->in_footer[] = $handle; return false; } if (false === $group && in_array($handle, $this->in_footer, true)) { $this->in_footer = array_diff($this->in_footer, (array) $handle); } if (null === $this->registered[$handle]->ver) { $ver = ''; } else { $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; } if (isset($this->args[$handle])) { $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; } $src = $this->registered[$handle]->src; if ($this->do_concat) { /** * Filter the script loader source. * * @since 2.2.0 * * @param string $src Script loader source path. * @param string $handle Script handle. */ $srce = apply_filters('script_loader_src', $src, $handle); if ($this->in_default_dir($srce)) { $this->print_code .= $this->print_extra_script($handle, false); $this->concat .= "{$handle},"; $this->concat_version .= "{$handle}{$ver}"; return true; } else { $this->ext_handles .= "{$handle},"; $this->ext_version .= "{$handle}{$ver}"; } } $this->print_extra_script($handle); if (!preg_match('|^(https?:)?//|', $src) && !($this->content_url && 0 === strpos($src, $this->content_url))) { $src = $this->base_url . $src; } if (!empty($ver)) { $src = add_query_arg('ver', $ver, $src); } /** This filter is documented in class.asc-scripts.php */ $src = esc_url(apply_filters('script_loader_src', $src, $handle)); if (!$src) { return true; } if ($this->do_concat) { $this->print_html .= "<script type='text/javascript' src='{$src}'></script>\n"; } else { echo "<script type='text/javascript' src='{$src}'></script>\n"; } return true; }
function do_item($handle) { if (!parent::do_item($handle)) { return false; } $obj = $this->registered[$handle]; if (null === $obj->ver) { $ver = ''; } else { $ver = $obj->ver ? $obj->ver : $this->default_version; } if (isset($this->args[$handle])) { $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; } if ($this->do_concat) { if ($this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt'])) { $this->concat .= "{$handle},"; $this->concat_version .= "{$handle}{$ver}"; $this->print_code .= $this->print_inline_style($handle, false); return true; } } if (isset($obj->args)) { $media = esc_attr($obj->args); } else { $media = 'all'; } $href = $this->_css_href($obj->src, $ver, $handle); if (empty($href)) { // Turns out there is nothing to print. return true; } $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; $title = isset($obj->extra['title']) ? "title='" . esc_attr($obj->extra['title']) . "'" : ''; /** * Filter the HTML link tag of an enqueued style. * * @since 2.6.0 * * @param string The link tag for the enqueued style. * @param string $handle The style's registered handle. */ $tag = apply_filters('style_loader_tag', "<link rel='{$rel}' id='{$handle}-css' {$title} href='{$href}' type='text/css' media='{$media}' />\n", $handle); if ('rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl']) { if (is_bool($obj->extra['rtl']) || 'replace' === $obj->extra['rtl']) { $suffix = isset($obj->extra['suffix']) ? $obj->extra['suffix'] : ''; $rtl_href = str_replace("{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href($obj->src, $ver, "{$handle}-rtl")); } else { $rtl_href = $this->_css_href($obj->extra['rtl'], $ver, "{$handle}-rtl"); } /** * Filter the right-to-left (RTL) HTML link tag of an enqueued style. * * @since 2.6.0 * * @param string $rtl_style The right to left link tag for the enqueued style. * @param string $handle The style's registered handle. */ $rtl_tag = apply_filters('style_loader_tag', "<link rel='{$rel}' id='{$handle}-rtl-css' {$title} href='{$rtl_href}' type='text/css' media='{$media}' />\n", $handle); if ($obj->extra['rtl'] === 'replace') { $tag = $rtl_tag; } else { $tag .= $rtl_tag; } } if (isset($obj->extra['conditional']) && $obj->extra['conditional']) { $tag = "<!--[if {$obj->extra['conditional']}]>\n" . $tag . "<![endif]-->\n"; } if ($this->do_concat) { $this->print_html .= $tag; if ($inline_style = $this->print_inline_style($handle, false)) { $this->print_html .= sprintf("<style type='text/css'>\n%s\n</style>\n", $inline_style); } } else { echo $tag; $this->print_inline_style($handle); } return true; }