PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-forms/build/styles.php +73 -0 16.2-beta → 16.3 View file →
@@ -1,0 +1,73 @@
1 +<?php
2 +/**
3 + * Style registration - Auto-generated by build process.
4 + * Do not edit this file manually.
5 + *
6 + * Note: These styles can be overridden by calling jetpack_forms_override_style()
7 + * in lib/client-assets.php for complex cases (multiple files, conditional deps, etc.)
8 + *
9 + * @package jetpack_forms
10 + */
11 +
12 +/**
13 + * Registers a style according to `wp_register_style`. Honors this request by
14 + * deregistering any style by the same handler before registration.
15 + *
16 + * @param WP_Styles $styles WP_Styles instance.
17 + * @param string $handle Name of the stylesheet. Should be unique.
18 + * @param string $src Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
19 + * @param array $deps Optional. An array of registered stylesheet handles this stylesheet depends on. Default empty array.
20 + * @param string|bool|null $ver Optional. String specifying stylesheet version number, if it has one, which is added to the URL
21 + * as a query string for cache busting purposes. If version is set to false, a version
22 + * number is automatically added equal to current installed WordPress version.
23 + * If set to null, no version is added.
24 + * @param string $media Optional. The media for which this stylesheet has been defined.
25 + * Default 'all'. Accepts media types like 'all', 'print' and 'screen', or media queries like
26 + * '(orientation: portrait)' and '(max-width: 640px)'.
27 + */
28 +function jetpack_forms_override_style( $styles, $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
29 + $style = $styles->query( $handle, 'registered' );
30 + if ( $style ) {
31 + $styles->remove( $handle );
32 + }
33 + $styles->add( $handle, $src, $deps, $ver, $media );
34 +}
35 +
36 +/**
37 + * Register all package styles (simple cases only).
38 + * Complex cases should be manually registered in lib/client-assets.php.
39 + *
40 + * @param WP_Styles $styles WP_Styles instance.
41 + */
42 +function jetpack_forms_register_package_styles( $styles ) {
43 + // Load build constants
44 + $build_constants = require __DIR__ . '/constants.php';
45 + $default_version = ! SCRIPT_DEBUG ? $build_constants['version'] : time();
46 + $suffix = '.min';
47 +
48 + $styles_dir = __DIR__ . '/styles';
49 + $styles_file = $styles_dir . '/registry.php';
50 +
51 + if ( ! file_exists( $styles_file ) ) {
52 + return;
53 + }
54 +
55 + $styles_data = require $styles_file;
56 + $plugin_dir = dirname( __FILE__ );
57 +
58 + foreach ( $styles_data as $style_data ) {
59 + jetpack_forms_override_style(
60 + $styles,
61 + $style_data['handle'],
62 + $build_constants['build_url'] . 'styles/' . $style_data['path'] . $suffix . '.css',
63 + $style_data['dependencies'],
64 + $default_version
65 + );
66 +
67 + // Enable RTL support (WordPress automatically loads -rtl.css variant)
68 + $styles->add_data( $style_data['handle'], 'rtl', 'replace' );
69 + $styles->add_data( $style_data['handle'], 'suffix', $suffix );
70 + }
71 +}
72 +
73 +add_action( 'wp_default_styles', 'jetpack_forms_register_package_styles' );