__( 'Transients', 'wp-healthcheck' ), 'wphc-autoload' => __( 'Autoload Options', 'wp-healthcheck' ), 'wphc-wp-updates' => __( 'WordPress Automatic Background Updates', 'wp-healthcheck' ), 'wphc-support' => __( 'Support & Services', 'wp-healthcheck' ), ); foreach ( $metaboxes as $id => $title ) { $args = array( 'name' => 'admin/' . preg_replace( '/^wphc-/', '', $id ), ); add_meta_box( $id, $title, array( 'WP_Healthcheck_Admin', 'view' ), self::$hookname, 'normal', 'default', $args ); } } /** * Loads the admin notices. * * @since 1.0 */ public static function admin_notices() { if ( get_option( WP_Healthcheck::DISABLE_NOTICES_OPTION ) ) { return; } $screen = get_current_screen(); if ( ! preg_match( '/^(' . self::$hookname . '|dashboard)$/', $screen->id ) ) { return; } $notices = array( 'php', 'database', 'wordpress', 'web', 'ssl', 'https', 'plugins' ); $notices_transient = get_transient( WP_Healthcheck::HIDE_NOTICES_TRANSIENT ); foreach ( $notices as $notice ) { if ( ! isset( $notices_transient[ $notice ] ) ) { self::view( 'notices/' . $notice ); } } } /** * Loads the admin page view. * * @since 1.0 */ public static function admin_page() { self::view( 'admin/admin' ); } /** * Adds the help tab and hide the screen options one. * * @since 1.0 */ public static function admin_tabs() { include WPHC_PLUGIN_DIR . '/views/admin/help.php'; $tabs = array( array( 'id' => 'wphc-help-transients', 'title' => $transients_help['title'], 'content' => '
' . $transients_help['content'] . '
', ), array( 'id' => 'wphc-help-autoload', 'title' => $autoload_help['title'], 'content' => '' . $autoload_help['content'] . '
', ), ); foreach ( $tabs as $tab ) { get_current_screen()->add_help_tab( $tab ); } add_filter( 'screen_options_show_screen', '__return_false' ); } /** * Outputs the meta boxes. * * @since 1.0 */ public static function do_meta_boxes() { do_meta_boxes( self::$hookname, 'normal', null ); } /** * Includes a view. * * @since 1.0 * * @param string $name The name of the view to load. * @param string $metabox The metabox data. */ public static function view( $name, $metabox = null ) { if ( isset( $metabox['args']['name'] ) ) { $name = $metabox['args']['name']; } $file = WPHC_PLUGIN_DIR . '/views/' . $name . '.php'; if ( file_exists( $file ) ) { include $file; } } }