WP_Styles example


function _wp_get_iframed_editor_assets() {
    global $wp_styles$wp_scripts$pagenow;

    // Keep track of the styles and scripts instance to restore later.     $current_wp_styles  = $wp_styles;
    $current_wp_scripts = $wp_scripts;

    // Create new instances to collect the assets.     $wp_styles  = new WP_Styles();
    $wp_scripts = new WP_Scripts();

    /* * Register all currently registered styles and scripts. The actions that * follow enqueue assets, but don't necessarily register them. */
    $wp_styles->registered  = $current_wp_styles->registered;
    $wp_scripts->registered = $current_wp_scripts->registered;

    /* * We generally do not need reset styles for the iframed editor. * However, if it's a classic theme, margins will be added to every block, * which is reset specifically for list items, so classic themes rely on * these reset styles. */

function wp_styles() {
    global $wp_styles;

    if ( ! ( $wp_styles instanceof WP_Styles ) ) {
        $wp_styles = new WP_Styles();
    }

    return $wp_styles;
}

/** * Displays 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 WP_Styles $wp_styles The WP_Styles object for printing styles. * * @since 2.6.0 * * @param string|bool|array $handles Styles to be printed. Default 'false'. * @return string[] On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array. */
$load = array_unique( explode( ',', $load ) );

if ( empty( $load ) ) {
    header( "$protocol 400 Bad Request" );
    exit;
}

$rtl            = ( isset( $_GET['dir'] ) && 'rtl' === $_GET['dir'] );
$expires_offset = 31536000; // 1 year. $out            = '';

$wp_styles = new WP_Styles();
wp_default_styles( $wp_styles );

if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
    header( "$protocol 304 Not Modified" );
    exit;
}

foreach ( $load as $handle ) {
    if ( ! array_key_exists( $handle$wp_styles->registered ) ) {
        continue;
    }

    
Home | Imprint | This part of the site doesn't use cookies.