Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Admin_Chrome_Logo | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| render | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * The Jetpack logo mark shared by the admin chrome. |
| 4 | * |
| 5 | * @package automattic/jetpack |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Plugin; |
| 9 | |
| 10 | /** |
| 11 | * Renders the green Jetpack mark used by the admin masthead and footers. |
| 12 | * |
| 13 | * In `src/` rather than on `Jetpack_Admin_Page` for the reason `Footer_Links` documents. |
| 14 | */ |
| 15 | class Admin_Chrome_Logo { |
| 16 | |
| 17 | /** |
| 18 | * Render the green Jetpack mark. |
| 19 | * |
| 20 | * Pass a label only where the mark is the element's accessible name. Beside visible |
| 21 | * "Jetpack" text it is decorative, and a second announcement is noise. |
| 22 | * |
| 23 | * @since 16.3 |
| 24 | * |
| 25 | * @param int $height Pixel height. |
| 26 | * @param string $class Optional class attribute. |
| 27 | * @param string $label Optional accessible name. Empty renders the mark as decorative. |
| 28 | * @return string SVG markup. |
| 29 | */ |
| 30 | public static function render( $height, $class = '', $label = '' ) { |
| 31 | $attributes = ' height="' . (int) $height . '"'; |
| 32 | |
| 33 | if ( '' !== $class ) { |
| 34 | $attributes .= ' class="' . esc_attr( $class ) . '"'; |
| 35 | } |
| 36 | |
| 37 | $attributes .= '' !== $label |
| 38 | ? ' role="img" aria-label="' . esc_attr( $label ) . '"' |
| 39 | : ' aria-hidden="true"'; |
| 40 | |
| 41 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"' . $attributes . '><path fill="#069e08" d="M16,0C7.2,0,0,7.2,0,16s7.2,16,16,16s16-7.2,16-16S24.8,0,16,0z M15,19H7l8-16V19z M17,29V13h8L17,29z"></path></svg>'; |
| 42 | } |
| 43 | } |