Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 23
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Powered by Jetpack block render.
4 *
5 * Renders the Jetpack attribution colophon. The block has no plan gate
6 * here — paid-plan authors who want the colophon gone delete the block
7 * from the panel. Free-plan attribution is enforced by the search-results
8 * container's auto-inject (see `search-results/render.php`), which renders
9 * this block server-side when it's missing from `$content`.
10 *
11 * @package automattic/jetpack-search
12 */
13
14namespace Automattic\Jetpack\Search;
15
16if ( ! defined( 'ABSPATH' ) ) {
17    exit( 0 );
18}
19
20$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'jetpack-search-powered-by' ) );
21
22// WP locales use underscores (en_US, de_DE, pt_BR), not hyphens — split on `_`.
23$locale_prefix = '';
24if ( function_exists( 'determine_locale' ) ) {
25    $parts         = explode( '_', determine_locale(), 2 );
26    $locale_prefix = strtolower( (string) $parts[0] );
27}
28$url = ( '' !== $locale_prefix && 'en' !== $locale_prefix )
29    ? sprintf( 'https://%s.jetpack.com/upgrade/search?utm_source=poweredby', $locale_prefix )
30    : 'https://jetpack.com/upgrade/search/?utm_source=poweredby';
31?>
32<div <?php echo wp_kses_data( $wrapper_attributes ); ?>>
33    <a
34        class="jetpack-search-powered-by__link"
35        href="<?php echo esc_url( $url ); ?>"
36        rel="external noopener noreferrer nofollow"
37        target="_blank"
38    >
39        <span class="jetpack-search-powered-by__logo" aria-hidden="true">
40            <?php // Brand mark — `fill` stays Jetpack Green regardless of the block's color supports. ?>
41            <svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
42                <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" />
43                <polygon fill="#FFFFFF" points="15,19 7,19 15,3 " />
44                <polygon fill="#FFFFFF" points="17,29 17,13 25,13 " />
45            </svg>
46        </span>
47        <span class="jetpack-search-powered-by__text">
48            <?php esc_html_e( 'Search powered by Jetpack', 'jetpack-search-pkg' ); ?>
49        </span>
50    </a>
51</div>