← All changes
|
includes/wp-admin/class-advanced-settings-fields.php
+43
-163
8.2.1
→
5.7.0
View file →
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Advanced Settings Fields file. |
| 4 | 4 | * |
| 5 | - * @package Activitypub | |
| 5 | + * @package ActivityPub | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -namespace Activitypub\WP_Admin; | |
| 8 | +namespace ActivityPub\WP_Admin; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Advanced Settings Fields class. |
| 12 | 12 | */ |
| @@ -29,8 +29,17 @@ | ||
| 29 | 29 | array( self::class, 'render_advanced_settings_section' ), |
| 30 | 30 | 'activitypub_advanced_settings' |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | + \add_settings_field( | |
| 34 | + 'activitypub_outbox_purge_days', | |
| 35 | + \__( 'Outbox Retention Period', 'activitypub' ), | |
| 36 | + array( self::class, 'render_outbox_purge_days_field' ), | |
| 37 | + 'activitypub_advanced_settings', | |
| 38 | + 'activitypub_advanced_settings', | |
| 39 | + array( 'label_for' => 'activitypub_outbox_purge_days' ) | |
| 40 | + ); | |
| 41 | + | |
| 33 | 42 | if ( ! defined( 'ACTIVITYPUB_SEND_VARY_HEADER' ) ) { |
| 34 | 43 | \add_settings_field( |
| 35 | 44 | 'activitypub_vary_header', |
| 36 | 45 | \__( 'Vary Header', 'activitypub' ), |
| @@ -40,17 +49,8 @@ | ||
| 40 | 49 | array( 'label_for' => 'activitypub_vary_header' ) |
| 41 | 50 | ); |
| 42 | 51 | } |
| 43 | 52 | |
| 44 | - \add_settings_field( | |
| 45 | - 'activitypub_content_negotiation', | |
| 46 | - \__( 'Content Negotiation', 'activitypub' ), | |
| 47 | - array( self::class, 'render_content_negotiation_field' ), | |
| 48 | - 'activitypub_advanced_settings', | |
| 49 | - 'activitypub_advanced_settings', | |
| 50 | - array( 'label_for' => 'activitypub_content_negotiation' ) | |
| 51 | - ); | |
| 52 | - | |
| 53 | 53 | if ( ! defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) ) { |
| 54 | 54 | \add_settings_field( |
| 55 | 55 | 'activitypub_authorized_fetch', |
| 56 | 56 | \__( 'Authorized Fetch', 'activitypub' ), |
| @@ -60,54 +60,18 @@ | ||
| 60 | 60 | array( 'label_for' => 'activitypub_authorized_fetch' ) |
| 61 | 61 | ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - \add_settings_field( | |
| 65 | - 'activitypub_rfc9421_signature', | |
| 66 | - \__( 'Modern Signature Format', 'activitypub' ), | |
| 67 | - array( self::class, 'render_rfc9421_signature_field' ), | |
| 68 | - 'activitypub_advanced_settings', | |
| 69 | - 'activitypub_advanced_settings', | |
| 70 | - array( 'label_for' => 'activitypub_rfc9421_signature' ) | |
| 71 | - ); | |
| 72 | - | |
| 73 | - \add_settings_field( | |
| 74 | - 'activitypub_following_ui', | |
| 75 | - \__( 'Following User Interface', 'activitypub' ), | |
| 76 | - array( self::class, 'render_following_ui_field' ), | |
| 77 | - 'activitypub_advanced_settings', | |
| 78 | - 'activitypub_advanced_settings', | |
| 79 | - array( 'label_for' => 'activitypub_following_ui' ) | |
| 80 | - ); | |
| 81 | - | |
| 82 | - if ( \version_compare( \get_bloginfo( 'version' ), '6.9-alpha', '>=' ) ) { | |
| 64 | + if ( ! defined( 'ACTIVITYPUB_SHARED_INBOX_FEATURE' ) ) { | |
| 83 | 65 | \add_settings_field( |
| 84 | - 'activitypub_reader_ui', | |
| 85 | - \__( 'Reader', 'activitypub' ), | |
| 86 | - array( self::class, 'render_reader_field' ), | |
| 66 | + 'activitypub_shared_inbox', | |
| 67 | + \__( 'Shared Inbox (beta)', 'activitypub' ), | |
| 68 | + array( self::class, 'render_shared_inbox_field' ), | |
| 87 | 69 | 'activitypub_advanced_settings', |
| 88 | 70 | 'activitypub_advanced_settings', |
| 89 | - array( 'label_for' => 'activitypub_reader_ui' ) | |
| 71 | + array( 'label_for' => 'activitypub_shared_inbox' ) | |
| 90 | 72 | ); |
| 91 | 73 | } |
| 92 | - | |
| 93 | - \add_settings_field( | |
| 94 | - 'activitypub_api', | |
| 95 | - \__( 'ActivityPub API', 'activitypub' ), | |
| 96 | - array( self::class, 'render_api_field' ), | |
| 97 | - 'activitypub_advanced_settings', | |
| 98 | - 'activitypub_advanced_settings', | |
| 99 | - array( 'label_for' => 'activitypub_api' ) | |
| 100 | - ); | |
| 101 | - | |
| 102 | - \add_settings_field( | |
| 103 | - 'activitypub_object_type', | |
| 104 | - \__( 'Activity-Object-Type', 'activitypub' ), | |
| 105 | - array( self::class, 'render_object_type_field' ), | |
| 106 | - 'activitypub_advanced_settings', | |
| 107 | - 'activitypub_advanced_settings', | |
| 108 | - array( 'label_for' => 'activitypub_object_type' ) | |
| 109 | - ); | |
| 110 | 74 | } |
| 111 | 75 | |
| 112 | 76 | /** |
| 113 | 77 | * Render Advanced Settings Section. |
| @@ -128,12 +92,32 @@ | ||
| 128 | 92 | <?php |
| 129 | 93 | } |
| 130 | 94 | |
| 131 | 95 | /** |
| 96 | + * Render outbox purge days field. | |
| 97 | + */ | |
| 98 | + public static function render_outbox_purge_days_field() { | |
| 99 | + $value = \get_option( 'activitypub_outbox_purge_days', 180 ); | |
| 100 | + echo '<input type="number" id="activitypub_outbox_purge_days" name="activitypub_outbox_purge_days" value="' . esc_attr( $value ) . '" class="small-text" min="0" max="365" />'; | |
| 101 | + echo '<p class="description">' . \wp_kses( | |
| 102 | + sprintf( | |
| 103 | + // translators: 1: Definition of Outbox; 2: Default value (180). | |
| 104 | + \__( 'Maximum number of days to keep items in the <abbr title="%1$s">Outbox</abbr>. A lower value might be better for sites with lots of activity to maintain site performance. Default: <code>%2$s</code>', 'activitypub' ), | |
| 105 | + \esc_attr__( 'A virtual location on a user’s profile where all the activities (posts, likes, replies) they publish are stored, acting as a feed that other users can access to see their publicly shared content', 'activitypub' ), | |
| 106 | + \esc_html( 180 ) | |
| 107 | + ), | |
| 108 | + array( | |
| 109 | + 'abbr' => array( 'title' => array() ), | |
| 110 | + 'code' => array(), | |
| 111 | + ) | |
| 112 | + ) . '</p>'; | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 132 | 116 | * Render vary header field. |
| 133 | 117 | */ |
| 134 | 118 | public static function render_vary_header_field() { |
| 135 | - $value = \get_option( 'activitypub_vary_header', '1' ); | |
| 119 | + $value = \get_option( 'activitypub_vary_header', '0' ); | |
| 136 | 120 | ?> |
| 137 | 121 | <p> |
| 138 | 122 | <label> |
| 139 | 123 | <input type="checkbox" id="activitypub_vary_header" name="activitypub_vary_header" value="1" <?php checked( '1', $value ); ?> /> |
| @@ -146,26 +130,8 @@ | ||
| 146 | 130 | <?php |
| 147 | 131 | } |
| 148 | 132 | |
| 149 | 133 | /** |
| 150 | - * Render content negotiation field. | |
| 151 | - */ | |
| 152 | - public static function render_content_negotiation_field() { | |
| 153 | - $value = \get_option( 'activitypub_content_negotiation', '1' ); | |
| 154 | - ?> | |
| 155 | - <p> | |
| 156 | - <label> | |
| 157 | - <input type="checkbox" id="activitypub_content_negotiation" name="activitypub_content_negotiation" value="1" <?php checked( '1', $value ); ?> /> | |
| 158 | - <?php \esc_html_e( 'Enable content negotiation for browsers and Fediverse services.', 'activitypub' ); ?> | |
| 159 | - </label> | |
| 160 | - </p> | |
| 161 | - <p class="description"> | |
| 162 | - <?php \esc_html_e( 'Content negotiation ensures your site displays regular web pages to browsers and machine-readable data to Fediverse services. Disable this if your site shows raw technical data to visitors or if ActivityPub connections have issues.', 'activitypub' ); ?> | |
| 163 | - </p> | |
| 164 | - <?php | |
| 165 | - } | |
| 166 | - | |
| 167 | - /** | |
| 168 | 134 | * Render use Authorized Fetch field. |
| 169 | 135 | */ |
| 170 | 136 | public static function render_authorized_fetch_field() { |
| 171 | 137 | $value = \get_option( 'activitypub_authorized_fetch', '0' ); |
| @@ -185,107 +151,21 @@ | ||
| 185 | 151 | <?php |
| 186 | 152 | } |
| 187 | 153 | |
| 188 | 154 | /** |
| 189 | - * Render RFC-9421 signature field. | |
| 155 | + * Render shared inbox field. | |
| 190 | 156 | */ |
| 191 | - public static function render_rfc9421_signature_field() { | |
| 192 | - $value = \get_option( 'activitypub_rfc9421_signature', '0' ); | |
| 157 | + public static function render_shared_inbox_field() { | |
| 158 | + $value = \get_option( 'activitypub_shared_inbox', '0' ); | |
| 193 | 159 | ?> |
| 194 | 160 | <p> |
| 195 | 161 | <label> |
| 196 | - <input type="checkbox" id="activitypub_rfc9421_signature" name="activitypub_rfc9421_signature" value="1" <?php checked( '1', $value ); ?> /> | |
| 197 | - <?php \esc_html_e( 'Use modern signature format for Fediverse communications.', 'activitypub' ); ?> | |
| 162 | + <input type="checkbox" id="activitypub_shared_inbox" name="activitypub_shared_inbox" value="1" <?php checked( '1', $value ); ?> /> | |
| 163 | + <?php \esc_html_e( 'Use a shared inbox for incoming messages.', 'activitypub' ); ?> | |
| 198 | 164 | </label> |
| 199 | 165 | </p> |
| 200 | 166 | <p class="description"> |
| 201 | - <?php \esc_html_e( 'Enables a newer standard (RFC-9421) for verifying your site’s identity when communicating with other Fediverse platforms. This alternative signature format may cause compatibility issues with platforms that do not support it. Keep disabled if you experience connection problems with certain Fediverse servers.', 'activitypub' ); ?> | |
| 202 | - </p> | |
| 203 | - <?php | |
| 204 | - } | |
| 205 | - | |
| 206 | - /** | |
| 207 | - * Render show following UI field. | |
| 208 | - */ | |
| 209 | - public static function render_following_ui_field() { | |
| 210 | - $value = \get_option( 'activitypub_following_ui', '0' ); | |
| 211 | - ?> | |
| 212 | - <p> | |
| 213 | - <label> | |
| 214 | - <input type="checkbox" id="activitypub_following_ui" name="activitypub_following_ui" value="1" <?php checked( '1', $value ); ?> /> | |
| 215 | - Display the "Following" interface in the admin menus and settings. | |
| 216 | - </label> | |
| 217 | - </p> | |
| 218 | - <p class="description"> | |
| 219 | - Activates the Following feature, letting you follow other ActivityPub accounts directly from your WordPress site. Adds a "Following" menu and tab to manage followed accounts. | |
| 220 | - </p> | |
| 221 | - <p class="description"> | |
| 222 | - ⚠ A reader interface is not available yet. Please follow accounts sparingly—you won't be able to see their posts or shares. This feature is intended for testing the follow functionality. Once fully implemented, it will be enabled by default. | |
| 223 | - </p> | |
| 224 | - <?php | |
| 225 | - } | |
| 226 | - | |
| 227 | - /** | |
| 228 | - * Render reader field. | |
| 229 | - */ | |
| 230 | - public static function render_reader_field() { | |
| 231 | - $value = \get_option( 'activitypub_reader_ui', '0' ); | |
| 232 | - ?> | |
| 233 | - <p> | |
| 234 | - <label> | |
| 235 | - <input type="checkbox" id="activitypub_reader_ui" name="activitypub_reader_ui" value="1" <?php checked( '1', $value ); ?> /> | |
| 236 | - Enable the Reader to view posts from accounts you follow. | |
| 237 | - </label> | |
| 238 | - </p> | |
| 239 | - <p class="description"> | |
| 240 | - Adds a "Social Web" interface where you can read posts and shares from accounts you follow. Also enables the Following feature. Look for it in Dashboard > Social Web. | |
| 241 | - </p> | |
| 242 | - <p class="description"> | |
| 243 | - ⚠ This feature is experimental and may change significantly in future updates. | |
| 244 | - </p> | |
| 245 | - <?php | |
| 246 | - } | |
| 247 | - | |
| 248 | - /** | |
| 249 | - * Render ActivityPub API field. | |
| 250 | - */ | |
| 251 | - public static function render_api_field() { | |
| 252 | - $value = \get_option( 'activitypub_api', '0' ); | |
| 253 | - ?> | |
| 254 | - <p> | |
| 255 | - <label> | |
| 256 | - <input type="checkbox" id="activitypub_api" name="activitypub_api" value="1" <?php \checked( '1', $value ); ?> /> | |
| 257 | - <?php \esc_html_e( 'Enable the ActivityPub API to connect third-party clients.', 'activitypub' ); ?> | |
| 258 | - </label> | |
| 259 | - </p> | |
| 260 | - <p class="description"> | |
| 261 | - <?php \esc_html_e( 'Enables OAuth 2.0 authentication so third-party ActivityPub clients (like Mastodon apps) can post, follow, and interact on your behalf. You can manage connected apps from your profile page.', 'activitypub' ); ?> | |
| 262 | - </p> | |
| 263 | - <p class="description"> | |
| 264 | - <?php | |
| 265 | - echo \wp_kses( | |
| 266 | - \__( '⚠ This feature is experimental and may change significantly in future updates.', 'activitypub' ), | |
| 267 | - 'data' | |
| 268 | - ); | |
| 269 | - ?> | |
| 270 | - </p> | |
| 271 | - <?php | |
| 272 | - } | |
| 273 | - | |
| 274 | - /** | |
| 275 | - * Render object type field. | |
| 276 | - */ | |
| 277 | - public static function render_object_type_field() { | |
| 278 | - $value = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); | |
| 279 | - ?> | |
| 280 | - <p> | |
| 281 | - <label> | |
| 282 | - <input type="checkbox" name="activitypub_object_type" value="note" <?php \checked( 'note', $value ); ?> /> | |
| 283 | - <?php \esc_html_e( 'Use Template Tags instead of letting the plugin choose the best possible format for you.', 'activitypub' ); ?> | |
| 284 | - </label> | |
| 285 | - </p> | |
| 286 | - <p class="description"> | |
| 287 | - <?php \esc_html_e( 'This is mainly for backwards compatibility. It is not recommended to use the Template Tags, because it might not be supported in future versions.', 'activitypub' ); ?> | |
| 167 | + <?php \esc_html_e( 'Allows your site to handle incoming ActivityPub messages more efficiently, especially helpful for busy or multi-user sites. This feature is still in beta and may encounter issues.', 'activitypub' ); ?> | |
| 288 | 168 | </p> |
| 289 | 169 | <?php |
| 290 | 170 | } |
| 291 | 171 | } |