deprecated-hook-row.php
122 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @var \AC\Deprecated\Hook $hook */ |
| 6 | $hook = $this->hook; |
| 7 | $callbacks = $hook->get_callbacks(); |
| 8 | $count = count($callbacks); |
| 9 | |
| 10 | ?> |
| 11 | |
| 12 | <tr> |
| 13 | <td class="acu-p-1 acu-px-3 acu-py-3 acu-align-top" colspan="1"> |
| 14 | <code class="acu-text-[12px]"><?= $hook->get_name() ?></code> |
| 15 | </td> |
| 16 | |
| 17 | <td class="acu-p-1 acu-px-3 acu-py-3 acu-align-top acu-leading-5" style="width:100%" colspan="1"> |
| 18 | <?php |
| 19 | if ($hook->has_replacement()) : ?> |
| 20 | <?php |
| 21 | $translation = $this->type === 'action' |
| 22 | ? |
| 23 | __( |
| 24 | 'The action %s is replaced by %s since %s.', |
| 25 | 'codepress-admin-columns' |
| 26 | ) |
| 27 | : |
| 28 | __( |
| 29 | 'The filter %s is replaced by %s since %s.', |
| 30 | 'codepress-admin-columns' |
| 31 | ); |
| 32 | |
| 33 | printf( |
| 34 | $translation, |
| 35 | '<code class="acu-text-[12px]">' . $hook->get_name() . '</code>', |
| 36 | '<code class="acu-text-[12px]">' . $hook->get_replacement() . '</code>', |
| 37 | '<strong>' . $hook->get_version() . '</strong>' |
| 38 | ); |
| 39 | |
| 40 | else: |
| 41 | |
| 42 | echo $this->type === 'action' |
| 43 | ? sprintf( |
| 44 | __( |
| 45 | 'The action %s has been removed since %s.', |
| 46 | 'codepress-admin-columns' |
| 47 | ), |
| 48 | '<code class="acu-text-[12px]">' . $hook->get_name() . '</code>', |
| 49 | '<strong>' . $hook->get_version() . '</strong>' |
| 50 | ) |
| 51 | : sprintf( |
| 52 | __( |
| 53 | 'The filter %s has been removed since %s.', |
| 54 | 'codepress-admin-columns' |
| 55 | ), |
| 56 | '<code class="acu-text-[12px]">' . $hook->get_name() . '</code>', |
| 57 | '<strong>' . $hook->get_version() . '</strong>' |
| 58 | ); |
| 59 | |
| 60 | endif; ?> |
| 61 | |
| 62 | <?php |
| 63 | if ($count > 0) : ?> |
| 64 | <div class="acu-bg-[#F1F5F9] acu-p-3 acu-rounded-lg acu-mt-2"> |
| 65 | <?php |
| 66 | |
| 67 | $count_string = sprintf( |
| 68 | _n( |
| 69 | '%d usage', |
| 70 | '%d usages', |
| 71 | $count, |
| 72 | 'codepress-admin-columns' |
| 73 | ), |
| 74 | $count |
| 75 | ); |
| 76 | |
| 77 | if (1 === $count) { |
| 78 | printf( |
| 79 | _x( |
| 80 | 'This deprecated hook has %s on this site with this callback:', |
| 81 | 'callback usages', |
| 82 | 'codepress-admin-columns' |
| 83 | ), |
| 84 | '<strong>' . $count_string . '</strong>', |
| 85 | ); ?> |
| 86 | <br/> |
| 87 | <code class="acu-bg-[transparent] acu-text-[12px]"><?= $callbacks[0] ?></code> |
| 88 | <?php |
| 89 | } else { |
| 90 | printf( |
| 91 | _x( |
| 92 | 'This deprecated hook has %s on this site with these callbacks:', |
| 93 | 'callback usages', |
| 94 | 'codepress-admin-columns' |
| 95 | ), |
| 96 | '<strong>' . $count_string . '</strong>' |
| 97 | ); |
| 98 | ?> |
| 99 | <br/> |
| 100 | <code class="acu-bg-[transparent] acu-text-[12px]"> |
| 101 | <?= implode( |
| 102 | '</code><br/><code class="acu-bg-[transparent] acu-text-[12px]">', |
| 103 | $callbacks |
| 104 | ); ?> |
| 105 | </code> |
| 106 | <?php |
| 107 | } |
| 108 | ?> |
| 109 | </div> |
| 110 | <?php |
| 111 | endif; ?> |
| 112 | |
| 113 | </td> |
| 114 | <td class="acu-p-1 acu-px-3 acu-py-3 acu-text-nowrap acu-align-top" colspan="1"> |
| 115 | <?= sprintf( |
| 116 | '<a href="%s" target="_blank">%s »</a>', |
| 117 | $this->documentation_url, |
| 118 | __('View documentation', 'codepress-admin-columns') |
| 119 | ) |
| 120 | ?> |
| 121 | </td> |
| 122 | </tr> |