Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
CRAP | n/a |
0 / 0 |
|
| wpcom_simple_odyssey_stats_load_dashboard_widget | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Load the Odyssey stats feature on WordPress.com Simple Site. |
| 4 | * See https://github.com/Automattic/jetpack/tree/trunk/projects/packages/stats-admin |
| 5 | * |
| 6 | * @package automattic/jetpack-mu-wpcom |
| 7 | */ |
| 8 | |
| 9 | use Automattic\Jetpack\Stats_Admin\Dashboard as OdysseyStats; |
| 10 | OdysseyStats::init(); |
| 11 | |
| 12 | // Only register when the loader path is available at include time, matching the |
| 13 | // original gate so the widget is not loaded on installs where it was not before. |
| 14 | if ( defined( 'JETPACK_PLUGIN_LOADER_PATH' ) ) { |
| 15 | add_action( 'wp_dashboard_setup', 'wpcom_simple_odyssey_stats_load_dashboard_widget' ); |
| 16 | } |
| 17 | |
| 18 | if ( ! function_exists( 'wpcom_simple_odyssey_stats_load_dashboard_widget' ) ) { |
| 19 | /** |
| 20 | * Load the Odyssey stats widget when the WordPress dashboard is assembled. |
| 21 | * |
| 22 | * Loaded lazily so the widget class is not required on requests that never build |
| 23 | * the dashboard, and named so the callback can be unregistered. `init()` is a |
| 24 | * static, idempotent entry point, so no instance is needed. |
| 25 | * |
| 26 | * @return void |
| 27 | */ |
| 28 | function wpcom_simple_odyssey_stats_load_dashboard_widget() { |
| 29 | if ( ! defined( 'JETPACK_PLUGIN_LOADER_PATH' ) ) { |
| 30 | return; |
| 31 | } |
| 32 | require_once JETPACK_PLUGIN_LOADER_PATH . '/class-jetpack-stats-dashboard-widget.php'; |
| 33 | Jetpack_Stats_Dashboard_Widget::init(); |
| 34 | } |
| 35 | } |