mirror of
https://ghproxy.net/https://github.com/fairpm/fair-plugin.git
synced 2025-09-04 16:15:57 +08:00
Signed-off-by: Miles Davis <milesddavis@users.noreply.github.com> Co-authored-by: Miles Davis <milesddavis@users.noreply.github.com>
49 lines
1,021 B
PHP
49 lines
1,021 B
PHP
<?php
|
|
/**
|
|
* Configures FAIR hosted assets throughout WordPress.
|
|
*
|
|
* @package FAIR
|
|
*/
|
|
|
|
namespace FAIR\Assets;
|
|
|
|
const DEFAULT_EMOJI_BASE = 'https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.1.0/assets/';
|
|
|
|
/**
|
|
* Bootstrap.
|
|
*/
|
|
function bootstrap() {
|
|
add_filter( 'emoji_url', __NAMESPACE__ . '\\replace_emoji_url' );
|
|
add_filter( 'emoji_svg_url', __NAMESPACE__ . '\\replace_emoji_svg_url' );
|
|
}
|
|
|
|
/**
|
|
* Get the base URL for the emoji images.
|
|
*
|
|
* @return string The base URL for emoji images. Must be in Twemoji format.
|
|
*/
|
|
function get_emoji_base_url() : string {
|
|
if ( defined( 'FAIR_EMOJI_BASE_URL' ) ) {
|
|
return FAIR_EMOJI_BASE_URL;
|
|
}
|
|
|
|
return DEFAULT_EMOJI_BASE;
|
|
}
|
|
|
|
/**
|
|
* Configure the base URL for regular emoji images.
|
|
*
|
|
* @return string The base URL.
|
|
*/
|
|
function replace_emoji_url() {
|
|
return get_emoji_base_url() . '72x72/';
|
|
}
|
|
|
|
/**
|
|
* Configure the base URL for SVG emoji images.
|
|
*
|
|
* @return string The base URL.
|
|
*/
|
|
function replace_emoji_svg_url() {
|
|
return get_emoji_base_url() . 'svg/';
|
|
}
|