/**
 * Display styles that are in the $handles queue.
 *
 * Passing an empty array to $handles prints the queue,
 * passing an array with one string prints that style,
 * and passing an array of strings prints those styles.
 *
 * @global ASC_Styles $asc_styles The ASC_Styles object for printing styles.
 *
 * @since 2.6.0
 *
 * @param array|bool $handles Styles to be printed. Default 'false'.
 * @return array On success, a processed array of ASC_Dependencies items; otherwise, an empty array.
 */
function asc_print_styles($handles = false)
{
    if ('' === $handles) {
        // for asc_head
        $handles = false;
    }
    /**
     * Fires before styles in the $handles queue are printed.
     *
     * @since 2.6.0
     */
    if (!$handles) {
        do_action('asc_print_styles');
    }
    global $asc_styles;
    if (!is_a($asc_styles, 'ASC_Styles')) {
        if (!did_action('init')) {
            _doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>asc_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>'), '3.3');
        }
        if (!$handles) {
            return array();
        } else {
            $asc_styles = new ASC_Styles();
        }
    }
    return $asc_styles->do_items($handles);
}
Ejemplo n.º 2
0
/**
 * Prints the styles queue in the HTML head on admin pages.
 *
 * @since 2.8.0
 */
function print_admin_styles()
{
    global $asc_styles, $concatenate_scripts, $compress_css;
    if (!is_a($asc_styles, 'ASC_Styles')) {
        $asc_styles = new ASC_Styles();
    }
    script_concat_settings();
    $asc_styles->do_concat = $concatenate_scripts;
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    $asc_styles->do_items(false);
    /**
     * Filter whether to print the admin styles.
     *
     * @since 2.8.0
     *
     * @param bool $print Whether to print the admin styles. Default true.
     */
    if (apply_filters('print_admin_styles', true)) {
        _print_styles();
    }
    $asc_styles->reset();
    return $asc_styles->done;
}