Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
88.89% |
16 / 18 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Main | |
88.89% |
16 / 18 |
|
0.00% |
0 / 1 |
6.05 | |
0.00% |
0 / 1 |
| init | |
88.89% |
16 / 18 |
|
0.00% |
0 / 1 |
6.05 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Main class for the Masterbar package. |
| 4 | * |
| 5 | * @package automattic/jetpack-masterbar |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Masterbar; |
| 9 | |
| 10 | use Automattic\Jetpack\Status\Host; |
| 11 | |
| 12 | /** |
| 13 | * Main class for the Masterbar package. |
| 14 | */ |
| 15 | class Main { |
| 16 | |
| 17 | const PACKAGE_VERSION = '0.27.26'; |
| 18 | |
| 19 | /** |
| 20 | * Initializer. |
| 21 | * Used to configure the Masterbar package. |
| 22 | * |
| 23 | * @return void |
| 24 | */ |
| 25 | public static function init() { |
| 26 | if ( did_action( 'jetpack_masterbar_init' ) ) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | new Admin_Color_Schemes(); |
| 31 | |
| 32 | remove_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option' ); |
| 33 | $is_wp_admin_interface = get_option( 'wpcom_admin_interface' ) === 'wp-admin'; |
| 34 | if ( function_exists( 'wpcom_admin_interface_pre_get_option' ) ) { |
| 35 | add_filter( 'pre_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_get_option', 10 ); |
| 36 | } |
| 37 | |
| 38 | // Show Additional CSS nudges on both Simple and Atomic, independently of the admin interface. |
| 39 | require_once __DIR__ . '/nudges/bootstrap.php'; |
| 40 | |
| 41 | if ( $is_wp_admin_interface ) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $host = new Host(); |
| 46 | |
| 47 | new Inline_Help(); |
| 48 | require_once __DIR__ . '/wp-posts-list/bootstrap.php'; |
| 49 | |
| 50 | if ( $host->is_woa_site() ) { |
| 51 | require_once __DIR__ . '/profile-edit/bootstrap.php'; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Whether to load the admin menu functionality. |
| 56 | * |
| 57 | * @use add_filter( 'jetpack_load_admin_menu_class', '__return_true' ); |
| 58 | * |
| 59 | * @param bool $load_admin_menu_class Load Jetpack's custom admin menu functionality. Default to false. |
| 60 | */ |
| 61 | if ( apply_filters( 'jetpack_load_admin_menu_class', false ) ) { |
| 62 | require_once __DIR__ . '/admin-menu/load.php'; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Fires after the Masterbar package is initialized. |
| 67 | * Used mainly to ensure the package is initialized once. |
| 68 | * |
| 69 | * @since 0.1.0 |
| 70 | */ |
| 71 | do_action( 'jetpack_masterbar_init' ); |
| 72 | } |
| 73 | } |