tag.
* - jetpack-logo__icon-circle: the circle of the Jetpack mark.
* - jetpack-logo__icon-triangle: two shapes that correspond to each triangle in the Jetpack mark.
* - jetpack-logo__icon-text: the Jetpack lettering.
*
* @var string
*/
const JETPACK_LOGO_SVG = '
';
/**
* Create and render a Jetpack logo.
*/
class Logo {
/**
* Return the Jetpack logo.
*
* @return string The Jetpack logo.
*/
public function render() {
return JETPACK_LOGO_SVG;
}
/**
* Return string containing the Jetpack logo.
*
* @since 1.1.4
* @since-jetpack 7.5.0
*
* @param bool $logotype Should we use the full logotype (logo + text). Default to false.
*
* @return string
*/
public function get_jp_emblem( $logotype = false ) {
$logo_text = $this->get_jp_logo_parts();
return sprintf(
'',
( true === $logotype ? '118' : '32' ),
( true === $logotype ? $logo_text['logo'] . $logo_text['text'] : $logo_text['logo'] )
);
}
/**
* Return string containing the Jetpack logo in a slightly larger format than get_jp_emblem().
*
* @since 1.1.4
* @param bool $logotype Should we use the full logotype (logo + text). Default to false.
* @return string
*/
public function get_jp_emblem_larger( $logotype = false ) {
$logo_text = $this->get_jp_logo_parts();
return sprintf(
'',
( true === $logotype ? '118' : '32' ),
( true === $logotype ? $logo_text['logo'] . $logo_text['text'] : $logo_text['logo'] )
);
}
/**
* Return array containing the Jetpack logo and text
*
* @since 1.6.0 - Added $color parameter.
*
* @param string $color The color of the logo.
*
* @return array
*/
private function get_jp_logo_parts( $color = '#069e08' ) {
return array(
'logo' => '',
'text' => '',
);
}
/**
* Return a base64 encoded SVG of the Jetpack logo.
* Can be used as a data URI to use the logo inline in CSS.
*
* @since 1.6.0
*
* @param string $color The color of the logo.
*
* @return string
*/
public function get_base64_logo( $color = '#ffffff' ) {
$logo_text = $this->get_jp_logo_parts( $color );
$base_logo = sprintf(
'',
$logo_text['logo']
);
$encoded_logo = base64_encode( $base_logo ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- The encoded version is used as data URI to use the logo in CSS.
return 'data:image/svg+xml;base64,' . $encoded_logo;
}
}