| 1 |
<?php |
| 2 |
/** |
| 3 |
* Icons file. |
| 4 |
* |
| 5 |
* @package Activitypub |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Activitypub; |
| 9 |
|
| 10 |
/** |
| 11 |
* Icons class. |
| 12 |
* |
| 13 |
* Registers the Fediverse and ActivityPub logos with the Icons API, |
| 14 |
* so they can be used in the block editor's Icon block. |
| 15 |
* |
| 16 |
* @since 9.3.0 |
| 17 |
*/ |
| 18 |
class Icons { |
| 19 |
/** |
| 20 |
* Initialize the class, registering WordPress hooks. |
| 21 |
*/ |
| 22 |
public static function init() { |
| 23 |
// The Icons API was introduced in WordPress 7.1. |
| 24 |
if ( ! \function_exists( 'wp_register_icon_collection' ) || ! \function_exists( 'wp_register_icon' ) ) { |
| 25 |
return; |
| 26 |
} |
| 27 |
|
| 28 |
\add_action( 'init', array( self::class, 'register_icons' ), 11 ); |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* Register the icon collection and icons. |
| 33 |
* |
| 34 |
* @since 9.3.0 |
| 35 |
*/ |
| 36 |
public static function register_icons() { |
| 37 |
\wp_register_icon_collection( |
| 38 |
'activitypub', |
| 39 |
array( |
| 40 |
'label' => \__( 'Fediverse', 'activitypub' ), |
| 41 |
'description' => \__( 'Logos of the Fediverse and the ActivityPub protocol.', 'activitypub' ), |
| 42 |
) |
| 43 |
); |
| 44 |
|
| 45 |
/* |
| 46 |
* The proposed Fediverse logo: five connected nodes forming a pentagram. |
| 47 |
* |
| 48 |
* @see https://commons.wikimedia.org/wiki/File:Fediverse_logo_proposal.svg |
| 49 |
* @license CC0-1.0 |
| 50 |
*/ |
| 51 |
\wp_register_icon( |
| 52 |
'activitypub/fediverse', |
| 53 |
array( |
| 54 |
'label' => \__( 'Fediverse', 'activitypub' ), |
| 55 |
'file_path' => ACTIVITYPUB_PLUGIN_DIR . 'assets/svg/fediverse.svg', |
| 56 |
) |
| 57 |
); |
| 58 |
|
| 59 |
/* |
| 60 |
* The Fediverse symbol: an asterism (⁂), several stars coming together. |
| 61 |
* |
| 62 |
* @see https://symbol.fediverse.info/en |
| 63 |
* @license CC0-1.0 |
| 64 |
*/ |
| 65 |
\wp_register_icon( |
| 66 |
'activitypub/fediverse-symbol', |
| 67 |
array( |
| 68 |
'label' => \__( 'Fediverse Symbol', 'activitypub' ), |
| 69 |
'file_path' => ACTIVITYPUB_PLUGIN_DIR . 'assets/svg/fediverse-symbol.svg', |
| 70 |
) |
| 71 |
); |
| 72 |
|
| 73 |
/* |
| 74 |
* The official logo of the ActivityPub protocol. |
| 75 |
* |
| 76 |
* @see https://activitypub.rocks/ |
| 77 |
* @license CC0-1.0 |
| 78 |
*/ |
| 79 |
\wp_register_icon( |
| 80 |
'activitypub/activitypub', |
| 81 |
array( |
| 82 |
'label' => \__( 'ActivityPub', 'activitypub' ), |
| 83 |
'file_path' => ACTIVITYPUB_PLUGIN_DIR . 'assets/svg/activitypub.svg', |
| 84 |
) |
| 85 |
); |
| 86 |
} |
| 87 |
} |
| 88 |
|