+/**
+ * Initialize $wp_scripts if it has not been set.
+ *
+ * @global WP_Scripts $wp_scripts
+ *
+ * @since 4.2.0
+ *
+ * @return WP_Scripts WP_Scripts instance.
+ */
+function wp_scripts() {
+ global $wp_scripts;
+ if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
+ $wp_scripts = new WP_Scripts();
+ }
+ return $wp_scripts;
+}
+
+/**
+ * Helper function to output a _doing_it_wrong message when applicable.
+ *
+ * @ignore
+ * @since 4.2.0
+ *
+ * @param string $function Function name.
+ */
+function _wp_scripts_maybe_doing_it_wrong( $function ) {
+ if ( did_action( 'init' ) ) {
+ return;
+ }
+
+ _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>wp_enqueue_scripts</code>',
+ '<code>admin_enqueue_scripts</code>',
+ '<code>login_enqueue_scripts</code>'
+ ), '3.3' );
+}
+