| 1 |
<?php |
| 2 |
/** |
| 3 |
* Theme Tools: Functions shared between several features. |
| 4 |
* |
| 5 |
* @package automattic/jetpack-classic-theme-helper |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! function_exists( 'jetpack_mastodon_get_instance_list' ) ) { |
| 9 |
|
| 10 |
/** |
| 11 |
* Build a list of Mastodon instance hosts. |
| 12 |
* That list can be extended via a filter. |
| 13 |
* |
| 14 |
* @since 0.4.3 in Classic Theme Helper (previously in Jetpack since 11.8) |
| 15 |
* |
| 16 |
* @return array |
| 17 |
*/ |
| 18 |
function jetpack_mastodon_get_instance_list() { |
| 19 |
$mastodon_instance_list = array( |
| 20 |
// Regex pattern to match any .tld for the mastodon host name. |
| 21 |
'#https?:\/\/(www\.)?mastodon\.(\w+)(\.\w+)?#', |
| 22 |
// Regex pattern to match any .tld for the mstdn host name. |
| 23 |
'#https?:\/\/(www\.)?mstdn\.(\w+)(\.\w+)?#', |
| 24 |
'counter.social', |
| 25 |
'fosstodon.org', |
| 26 |
'gc2.jp', |
| 27 |
'hachyderm.io', |
| 28 |
'infosec.exchange', |
| 29 |
'mas.to', |
| 30 |
'pawoo.net', |
| 31 |
); |
| 32 |
|
| 33 |
/** |
| 34 |
* Filter the list of Mastodon instances. |
| 35 |
* |
| 36 |
* @since 0.4.3 in Classic Theme Helper (previously in Jetpack since 11.8) |
| 37 |
* |
| 38 |
* @module widgets, theme-tools |
| 39 |
* |
| 40 |
* @param array $mastodon_instance_list Array of Mastodon instances. |
| 41 |
*/ |
| 42 |
return (array) apply_filters( 'jetpack_mastodon_instance_list', $mastodon_instance_list ); |
| 43 |
} |
| 44 |
} |
| 45 |
|