DeprecateOldTemplateHook.php
4 years ago
HookCommandInterface.php
5 years ago
SetupFieldConfirmation.php
4 years ago
SetupFieldEmailTag.php
4 years ago
SetupFieldPersistance.php
4 years ago
SetupFieldReceipt.php
4 years ago
SetupFieldValidation.php
4 years ago
SetupNewTemplateHook.php
4 years ago
DeprecateOldTemplateHook.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Form\LegacyConsumer\Commands; |
| 4 | |
| 5 | use Give\Form\LegacyConsumer\FilterCallbackCollection; |
| 6 | |
| 7 | /** |
| 8 | * @since 2.10.2 |
| 9 | */ |
| 10 | class DeprecateOldTemplateHook implements HookCommandInterface { |
| 11 | /** |
| 12 | * @since 2.10.2 |
| 13 | * |
| 14 | * @param string $hook |
| 15 | * |
| 16 | * @return void |
| 17 | */ |
| 18 | public function __invoke( $hook ) { |
| 19 | global $wp_filter; |
| 20 | if ( has_filter( "give_$hook" ) ) { |
| 21 | $callbacks = FilterCallbackCollection::make( |
| 22 | $wp_filter[ "give_$hook" ]->callbacks |
| 23 | ) |
| 24 | ->flatten() |
| 25 | ->withoutPrefix( 'give_' ) |
| 26 | ->withoutPrefix( '__give_' ); |
| 27 | |
| 28 | if ( $callbacks->count() > 1 ) { |
| 29 | _give_deprecated_function( sprintf( __( 'The %s action', 'give' ), "give_$hook" ), '2.10', "give_fields_$hook" ); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 |