value, a handful at most. * url string Where "Open" goes. * colour string The plugin's own colour, as #rrggbb. * * Implementations must not measure anything here. This filter runs on * an admin page load; a card that walks the disk or makes an HTTP * request turns somebody else's dashboard into a slow page, and they * will not know why. * * @param array $cards The cards so far. */ $cards = apply_filters( 'wpmgr_dashboard_cards', array() ); echo '
'; echo '

' . esc_html( apply_filters( 'wpmgr_menu_title', 'Manager' ) ) . '

'; if ( empty( $cards ) ) { echo '

Nothing to report.

'; return; } echo ''; echo '
'; $states = array( 'ok' => 'OK', 'warn' => 'Attention', 'fail' => 'Action needed', ); foreach ( $cards as $card ) { if ( empty( $card['title'] ) ) { continue; } $colour = isset( $card['colour'] ) && preg_match( '/^#[0-9a-f]{6}$/i', $card['colour'] ) ? $card['colour'] : '#50575e'; $status = isset( $card['status'] ) && isset( $states[ $card['status'] ] ) ? $card['status'] : 'ok'; echo '
'; printf( '

%s

%s
', esc_attr( $colour ), esc_html( $card['title'] ), esc_html( $states[ $status ] ) ); echo '
'; if ( ! empty( $card['headline'] ) ) { echo '

' . esc_html( $card['headline'] ) . '

'; } if ( ! empty( $card['lines'] ) && is_array( $card['lines'] ) ) { echo '
'; foreach ( $card['lines'] as $label => $value ) { echo '
' . esc_html( $label ) . '
' . esc_html( $value ) . '
'; } echo '
'; } echo '
'; if ( ! empty( $card['url'] ) ) { printf( '', esc_url( $card['url'] ), esc_html( isset( $card['action'] ) ? $card['action'] : 'Open' ) ); } echo '
'; } echo '
'; } }