| 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 |
/** |
| 13 |
* @since 2.10.2 |
| 14 |
* |
| 15 |
* @param string $hook |
| 16 |
* |
| 17 |
* @return void |
| 18 |
*/ |
| 19 |
public function __invoke($hook) |
| 20 |
{ |
| 21 |
global $wp_filter; |
| 22 |
if (has_filter("give_$hook")) { |
| 23 |
$callbacks = FilterCallbackCollection::make( |
| 24 |
$wp_filter["give_$hook"]->callbacks |
| 25 |
) |
| 26 |
->flatten() |
| 27 |
->withoutPrefix('give_') |
| 28 |
->withoutPrefix('__give_'); |
| 29 |
|
| 30 |
if ($callbacks->count() > 1) { |
| 31 |
_give_deprecated_function( |
| 32 |
sprintf(__('The %s action', 'give'), "give_$hook"), |
| 33 |
'2.10', |
| 34 |
"give_fields_$hook" |
| 35 |
); |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|