PluginProbe
ActivityPub / trunk
ActivityPub vtrunk
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
activitypub / includes / class-icons.php

class-icons.php in ActivityPub trunk, at includes/class-icons.php

88 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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