Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
CRAP | n/a |
0 / 0 |
|
| jetpack_inspect_register_option | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| jetpack_inspect_option | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| jetpack_inspect_get_option | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| jetpack_inspect_update_option | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | use Automattic\Jetpack\Packages\Async_Option\Async_Option; |
| 4 | use Automattic\Jetpack\Packages\Async_Option\Async_Options; |
| 5 | use Automattic\Jetpack\Packages\Async_Option\Registry; |
| 6 | use Automattic\Jetpack_Inspect\Options\Monitor_Status; |
| 7 | use Automattic\Jetpack_Inspect\Options\Observer_Settings; |
| 8 | |
| 9 | /** |
| 10 | * Functions to make it easier to interface with Async Option: |
| 11 | */ |
| 12 | function jetpack_inspect_register_option( $name, $handler ) { |
| 13 | return Registry::get_instance( 'jetpack_inspect' ) |
| 14 | ->register( $name, $handler ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * @param $name |
| 19 | * |
| 20 | * @return Async_Option |
| 21 | */ |
| 22 | function jetpack_inspect_option( $name ) { |
| 23 | return Registry::get_instance( 'jetpack_inspect' )->get_option( $name ); |
| 24 | } |
| 25 | |
| 26 | function jetpack_inspect_get_option( $option ) { |
| 27 | return jetpack_inspect_option( $option )->get(); |
| 28 | } |
| 29 | |
| 30 | function jetpack_inspect_update_option( $option, $value ) { |
| 31 | return jetpack_inspect_option( $option )->set( $value ); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Ensure that Async Options are passed to the relevant scripts. |
| 36 | */ |
| 37 | add_action( |
| 38 | 'admin_init', |
| 39 | function () { |
| 40 | Async_Options::setup( 'jetpack_inspect', 'jetpack-inspect-main' ); |
| 41 | } |
| 42 | ); |
| 43 | |
| 44 | jetpack_inspect_register_option( 'monitor_status', new Monitor_Status() ); |
| 45 | jetpack_inspect_register_option( 'observer_incoming', new Observer_Settings() ); |
| 46 | jetpack_inspect_register_option( 'observer_outgoing', new Observer_Settings() ); |