/** * Print styles (internal use only) * * @ignore * * @global bool $compress_css */ function _print_styles() { global $compress_css; $hq_styles = hq_styles(); $zip = $compress_css ? 1 : 0; if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) { $zip = 'gzip'; } if (!empty($hq_styles->concat)) { $dir = $hq_styles->text_direction; $ver = $hq_styles->default_version; $href = $hq_styles->base_url . "/hq-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($hq_styles->concat, ', ') . '&ver=' . $ver; echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n"; if (!empty($hq_styles->print_code)) { echo "<style type='text/css'>\n"; echo $hq_styles->print_code; echo "\n</style>\n"; } } if (!empty($hq_styles->print_html)) { echo $hq_styles->print_html; } }
/** * Enqueues or directly prints a stylesheet link to the specified CSS file. * * "Intelligently" decides to enqueue or to print the CSS file. If the * 'hq_print_styles' action has *not* yet been called, the CSS file will be * enqueued. If the hq_print_styles action *has* been called, the CSS link will * be printed. Printing may be forced by passing true as the $force_echo * (second) parameter. * * For backward compatibility with HiveQueen 2.3 calling method: If the $file * (first) parameter does not correspond to a registered CSS file, we assume * $file is a file relative to hq-admin/ without its ".css" extension. A * stylesheet link to that generated URL is printed. * * @since 0.0.1 * * @param string $file Optional. Style handle name or file name (without ".css" extension) relative * to hq-admin/. Defaults to 'hq-admin'. * @param bool $force_echo Optional. Force the stylesheet link to be printed rather than enqueued. */ function hq_admin_css($file = 'hq-admin', $force_echo = false) { // For backward compatibility $handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file; if (hq_styles()->query($handle)) { if ($force_echo || did_action('hq_print_styles')) { // we already printed the style queue. Print this one immediately hq_print_styles($handle); } else { // Add to style queue hq_enqueue_style($handle); } return; } /** * Filter the stylesheet link to the specified CSS file. * * If the site is set to display right-to-left, the RTL stylesheet link * will be used instead. * * @since 0.0.1 * * @param string $file Style handle name or filename (without ".css" extension) * relative to hq-admin/. Defaults to 'hq-admin'. */ echo apply_filters('hq_admin_css', "<link rel='stylesheet' href='" . esc_url(hq_admin_css_uri($file)) . "' type='text/css' />\n", $file); if (function_exists('is_rtl') && is_rtl()) { /** This filter is documented in hq-includes/general-template.php */ echo apply_filters('hq_admin_css', "<link rel='stylesheet' href='" . esc_url(hq_admin_css_uri("{$file}-rtl")) . "' type='text/css' />\n", "{$file}-rtl"); } }