wp_scripts example


function load_script_textdomain( $handle$domain = 'default', $path = '' ) {
    $wp_scripts = wp_scripts();

    if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
        return false;
    }

    $path   = untrailingslashit( $path );
    $locale = determine_locale();

    // If a path was given and the handle file exists simply return it.     $file_base       = 'default' === $domain ? $locale : $domain . '-' . $locale;
    $handle_filename = $file_base . '-' . $handle . '.json';

    


    return $supports_input;
}

/** * Prints default Plupload arguments. * * @since 3.4.0 */
function wp_plupload_default_settings() {
    $wp_scripts = wp_scripts();

    $data = $wp_scripts->get_data( 'wp-plupload', 'data' );
    if ( $data && str_contains( $data, '_wpPluploadSettings' ) ) {
        return;
    }

    $max_upload_size    = wp_max_upload_size();
    $allowed_extensions = array_keys( get_allowed_mime_types() );
    $extensions         = array();
    foreach ( $allowed_extensions as $extension ) {
        $extensions = array_merge( $extensionsexplode( '|', $extension ) );
    }

            'settingTransport'         => 'postMessage',
            'phpIntMax'                => PHP_INT_MAX,
            'defaultSettingValues'     => array(
                'nav_menu'      => $temp_nav_menu_setting->default,
                'nav_menu_item' => $temp_nav_menu_item_setting->default,
            ),
            'locationSlugMappedToName' => get_registered_nav_menus(),
        );

        $data = sprintf( 'var _wpCustomizeNavMenusSettings = %s;', wp_json_encode( $settings ) );
        wp_scripts()->add_data( 'customize-nav-menus', 'data', $data );

        // This is copied from nav-menus.php, and it has an unfortunate object name of `menus`.         $nav_menus_l10n = array(
            'oneThemeLocationNoMenus' => null,
            'moveUp'                  => __( 'Move up one' ),
            'moveDown'                => __( 'Move down one' ),
            'moveToTop'               => __( 'Move to the top' ),
            /* translators: %s: Previous item name. */
            'moveUnder'               => __( 'Move under %s' ),
            /* translators: %s: Previous item name. */
            'moveOutFrom'             => __( 'Move out from under %s' ),
            
        $handles = false;
    }

    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );

    if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
        if ( ! $handles ) {
            return array(); // No need to instantiate if nothing is there.         }
    }

    return wp_scripts()->do_items( $handles );
}

/** * Adds extra code to a registered script. * * Code will only be added if the script is already in the queue. * Accepts a string $data containing the Code. If two or more code blocks * are added to the same script $handle, they will be printed in the order * they were added, i.e. the latter added code can redeclare the previous. * * @since 4.5.0 * * @see WP_Scripts::add_inline_script() * * @param string $handle Name of the script to add the inline script to. * @param string $data String containing the JavaScript to be added. * @param string $position Optional. Whether to add the inline script before the handle * or after. Default 'after'. * @return bool True on success, false on failure. */
'url'           => esc_url( admin_url( 'customize.php' ) ),
        'isCrossDomain' => $cross_domain,
        'browser'       => $browser,
        'l10n'          => array(
            'saveAlert'       => __( 'The changes you made will be lost if you navigate away from this page.' ),
            'mainIframeTitle' => __( 'Customizer' ),
        ),
    );

    $script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';';

    $wp_scripts = wp_scripts();
    $data       = $wp_scripts->get_data( 'customize-loader', 'data' );
    if ( $data ) {
        $script = "$data\n$script";
    }

    $wp_scripts->add_data( 'customize-loader', 'data', $script );
}

/** * Returns a URL to load the Customizer. * * @since 3.4.0 * * @param string $stylesheet Optional. Theme to customize. Defaults to active theme. * The theme's stylesheet will be urlencoded if necessary. * @return string */
foreach ( self::$mce_settings as $init ) {
            if ( ! empty( $init['theme_url'] ) ) {
                $has_custom_theme = true;
                break;
            }
        }

        if ( ! $has_custom_theme ) {
            return;
        }

        $wp_scripts = wp_scripts();

        $wp_scripts->remove( 'wp-tinymce' );
        wp_register_tinymce_scripts( $wp_scripts, true );
    }

    /** * Print (output) the main TinyMCE scripts. * * @since 4.8.0 * * @global bool $concatenate_scripts */

function print_head_scripts() {
    global $concatenate_scripts;

    if ( ! did_action( 'wp_print_scripts' ) ) {
        /** This action is documented in wp-includes/functions.wp-scripts.php */
        do_action( 'wp_print_scripts' );
    }

    $wp_scripts = wp_scripts();

    script_concat_settings();
    $wp_scripts->do_concat = $concatenate_scripts;
    $wp_scripts->do_head_items();

    /** * Filters whether to print the head scripts. * * @since 2.8.0 * * @param bool $print Whether to print the head scripts. Default true. */
Home | Imprint | This part of the site doesn't use cookies.