Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
|
100.00% |
4 / 4 |
CRAP | n/a |
0 / 0 |
||
| wpcom_forms_has_blog_sticker | n/a |
0 / 0 |
n/a |
0 / 0 |
5 | |||||
| wpcom_is_central_forms_management_enabled | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| wpcom_maybe_disable_central_forms_management | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| wpcom_contact_form_set_editor_feature_flags | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php |
| 2 | /** |
| 3 | * WordPress.com Contact Form feature flags. |
| 4 | * |
| 5 | * Central Forms Management is enabled for every WordPress.com site, so nothing here |
| 6 | * gates it any more. The `disable-central-forms-management` sticker is retired: it |
| 7 | * was a rollback valve for the CFM rollout, and there is no longer anything to roll |
| 8 | * back to. Every function below is kept and deprecated, so existing callers do not |
| 9 | * fatal; none of them is wired to anything. |
| 10 | * |
| 11 | * With no filter on `jetpack_block_editor_feature_flags` from here, the |
| 12 | * `central-form-management` flag falls through to the Forms package default, which |
| 13 | * is true — see Automattic\Jetpack\Extensions\Contact_Form\Contact_Form_Block::register_central_form_management_default() |
| 14 | * in `packages/forms`, which this package does not depend on. |
| 15 | * |
| 16 | * @package automattic/jetpack-mu-wpcom |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * Check if a site has a given blog sticker. |
| 21 | * |
| 22 | * Uses the appropriate sticker API depending on whether the site is |
| 23 | * Simple (has_blog_sticker) or Atomic (wpcomsh_is_site_sticker_active). |
| 24 | * |
| 25 | * Served the retired gating, and has no callers left. |
| 26 | * |
| 27 | * @deprecated $$next-version$$ The gating it served is retired. |
| 28 | * |
| 29 | * @param string $sticker The sticker name to check. |
| 30 | * @param int $blog_id The blog ID to check. |
| 31 | * @return bool |
| 32 | */ |
| 33 | function wpcom_forms_has_blog_sticker( $sticker, $blog_id ) { |
| 34 | _deprecated_function( __FUNCTION__, 'jetpack-mu-wpcom-$$next-version$$' ); |
| 35 | |
| 36 | if ( defined( 'IS_ATOMIC' ) && IS_ATOMIC && function_exists( 'wpcomsh_is_site_sticker_active' ) ) { |
| 37 | return (bool) wpcomsh_is_site_sticker_active( $sticker ); |
| 38 | } elseif ( function_exists( 'has_blog_sticker' ) ) { |
| 39 | return (bool) has_blog_sticker( $sticker, $blog_id ); |
| 40 | } |
| 41 | |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Check if Central Forms Management is enabled for a given blog. |
| 47 | * |
| 48 | * @deprecated $$next-version$$ Central Forms Management is enabled for every site. |
| 49 | * |
| 50 | * @param int|null $blog_id Blog ID. Unused. |
| 51 | * @return bool Always true. |
| 52 | */ |
| 53 | function wpcom_is_central_forms_management_enabled( $blog_id = null ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Signature kept for existing callers. |
| 54 | _deprecated_function( __FUNCTION__, 'jetpack-mu-wpcom-$$next-version$$' ); |
| 55 | |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * No-op kept so existing callers do not fatal. |
| 61 | * |
| 62 | * @deprecated $$next-version$$ Nothing disables Central Forms Management any more. |
| 63 | */ |
| 64 | function wpcom_maybe_disable_central_forms_management() { |
| 65 | _deprecated_function( __FUNCTION__, 'jetpack-mu-wpcom-$$next-version$$' ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Pass-through kept so existing callers do not fatal. |
| 70 | * |
| 71 | * Previously set the `central-form-management` block editor feature flag. No longer |
| 72 | * hooked: the Forms package already defaults the flag to true, so filtering here only |
| 73 | * ever restated the default. |
| 74 | * |
| 75 | * @deprecated $$next-version$$ The Forms package supplies the default. |
| 76 | * |
| 77 | * @param array $flags Existing feature flags. |
| 78 | * @return array Flags, unchanged. |
| 79 | */ |
| 80 | function wpcom_contact_form_set_editor_feature_flags( $flags ) { |
| 81 | _deprecated_function( __FUNCTION__, 'jetpack-mu-wpcom-$$next-version$$' ); |
| 82 | |
| 83 | return $flags; |
| 84 | } |