blocks of its markup, in the page's * styles and scripts: once per form, wherever it shows; "selector" stands for the form's wrapper */ class FormCode { /** * The form's CSS and JavaScript tabs, and the #is', static function ( $m ) use ( &$styles ) { $styles[] = $m[1]; return ''; }, $html ); $hash = $form->hash(); if ( !$hash || isset( $done[ $hash ] ) ) { return; } $done[ $hash ] = true; $scope = '.remaily-' . $hash; $css = trim( implode( "\n", array_merge( $styles, [ (string) preg_replace( '/\bselector\b/', $scope, (string) ( $form->config()['settings']['css'] ?? '' ) ) ] ) ) ); $js = trim( (string) ( $form->config()['settings']['js'] ?? '' ) ); if ( '' !== $css ) { $handle = 'remaily-form-' . $hash; // Its own handle: printed in the footer when the page's
is already out wp_register_style( $handle, false, [], null ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion -- inline only wp_enqueue_style( $handle ); wp_add_inline_style( $handle, $css ); } if ( '' !== $js ) { // Once each copy of the form is ready: root is its wrapper, form the