| @@ -34,12 +34,8 @@ | ||
| 34 | 34 | \add_filter( 'option_activitypub_max_image_attachments', array( self::class, 'default_max_image_attachments' ) ); |
| 35 | 35 | \add_filter( 'option_activitypub_support_post_types', array( self::class, 'support_post_types_ensure_array' ) ); |
| 36 | 36 | \add_filter( 'option_activitypub_object_type', array( self::class, 'default_object_type' ) ); |
| 37 | 37 | |
| 38 | - \add_filter( 'option_activitypub_outbox_purge_days', array( self::class, 'sanitize_purge_days' ) ); | |
| 39 | - \add_filter( 'option_activitypub_inbox_purge_days', array( self::class, 'sanitize_purge_days' ) ); | |
| 40 | - \add_filter( 'option_activitypub_ap_post_purge_days', array( self::class, 'sanitize_purge_days' ) ); | |
| 41 | - | |
| 42 | 38 | \add_action( 'update_option_activitypub_relay_mode', array( self::class, 'relay_mode_changed' ), 10, 2 ); |
| 43 | 39 | } |
| 44 | 40 | |
| 45 | 41 | /** |
| @@ -229,14 +225,11 @@ | ||
| 229 | 225 | \register_setting( |
| 230 | 226 | 'activitypub_advanced', |
| 231 | 227 | 'activitypub_outbox_purge_days', |
| 232 | 228 | array( |
| 233 | - 'type' => 'integer', | |
| 234 | - 'description' => 'Number of days to keep items in the Outbox.', | |
| 235 | - 'default' => ACTIVITYPUB_OUTBOX_PURGE_DAYS, | |
| 236 | - 'sanitize_callback' => static function ( $value ) { | |
| 237 | - return \max( 1, \absint( $value ) ); | |
| 238 | - }, | |
| 229 | + 'type' => 'integer', | |
| 230 | + 'description' => 'Number of days to keep items in the Outbox.', | |
| 231 | + 'default' => 180, | |
| 239 | 232 | ) |
| 240 | 233 | ); |
| 241 | 234 | |
| 242 | 235 | \register_setting( |
| @@ -242,14 +235,11 @@ | ||
| 242 | 235 | \register_setting( |
| 243 | 236 | 'activitypub_advanced', |
| 244 | 237 | 'activitypub_inbox_purge_days', |
| 245 | 238 | array( |
| 246 | - 'type' => 'integer', | |
| 247 | - 'description' => 'Number of days to keep items in the Inbox.', | |
| 248 | - 'default' => ACTIVITYPUB_INBOX_PURGE_DAYS, | |
| 249 | - 'sanitize_callback' => static function ( $value ) { | |
| 250 | - return \max( 1, \absint( $value ) ); | |
| 251 | - }, | |
| 239 | + 'type' => 'integer', | |
| 240 | + 'description' => 'Number of days to keep items in the Inbox.', | |
| 241 | + 'default' => 180, | |
| 252 | 242 | ) |
| 253 | 243 | ); |
| 254 | 244 | |
| 255 | 245 | \register_setting( |
| @@ -255,14 +245,11 @@ | ||
| 255 | 245 | \register_setting( |
| 256 | 246 | 'activitypub_advanced', |
| 257 | 247 | 'activitypub_ap_post_purge_days', |
| 258 | 248 | array( |
| 259 | - 'type' => 'integer', | |
| 260 | - 'description' => 'Number of days to keep remote posts.', | |
| 261 | - 'default' => ACTIVITYPUB_AP_POST_PURGE_DAYS, | |
| 262 | - 'sanitize_callback' => static function ( $value ) { | |
| 263 | - return \max( 1, \absint( $value ) ); | |
| 264 | - }, | |
| 249 | + 'type' => 'integer', | |
| 250 | + 'description' => 'Number of days to keep remote posts.', | |
| 251 | + 'default' => 30, | |
| 265 | 252 | ) |
| 266 | 253 | ); |
| 267 | 254 | |
| 268 | 255 | \register_setting( |
| @@ -336,18 +323,8 @@ | ||
| 336 | 323 | ); |
| 337 | 324 | |
| 338 | 325 | \register_setting( |
| 339 | 326 | 'activitypub_advanced', |
| 340 | - 'activitypub_api', | |
| 341 | - array( | |
| 342 | - 'type' => 'boolean', | |
| 343 | - 'description' => 'Enable the ActivityPub API to allow third-party clients.', | |
| 344 | - 'default' => false, | |
| 345 | - ) | |
| 346 | - ); | |
| 347 | - | |
| 348 | - \register_setting( | |
| 349 | - 'activitypub_advanced', | |
| 350 | 327 | 'activitypub_object_type', |
| 351 | 328 | array( |
| 352 | 329 | 'type' => 'string', |
| 353 | 330 | 'description' => 'The Activity-Object-Type', |
| @@ -438,28 +415,8 @@ | ||
| 438 | 415 | ); |
| 439 | 416 | |
| 440 | 417 | \register_setting( |
| 441 | 418 | 'activitypub_blog', |
| 442 | - 'activitypub_mailer_annual_report', | |
| 443 | - array( | |
| 444 | - 'type' => 'integer', | |
| 445 | - 'description' => 'Send the annual Fediverse Year in Review email.', | |
| 446 | - 'default' => 1, | |
| 447 | - ) | |
| 448 | - ); | |
| 449 | - | |
| 450 | - \register_setting( | |
| 451 | - 'activitypub_blog', | |
| 452 | - 'activitypub_mailer_monthly_report', | |
| 453 | - array( | |
| 454 | - 'type' => 'integer', | |
| 455 | - 'description' => 'Send a monthly Fediverse stats report email.', | |
| 456 | - 'default' => 0, | |
| 457 | - ) | |
| 458 | - ); | |
| 459 | - | |
| 460 | - \register_setting( | |
| 461 | - 'activitypub_blog', | |
| 462 | 419 | 'activitypub_blog_user_also_known_as', |
| 463 | 420 | array( |
| 464 | 421 | 'type' => 'array', |
| 465 | 422 | 'description' => 'An array of URLs that the blog user is known by.', |
| @@ -670,36 +627,8 @@ | ||
| 670 | 627 | $value = ACTIVITYPUB_DEFAULT_OBJECT_TYPE; |
| 671 | 628 | } |
| 672 | 629 | |
| 673 | 630 | return $value; |
| 674 | - } | |
| 675 | - | |
| 676 | - /** | |
| 677 | - * Sanitize purge day values. | |
| 678 | - * | |
| 679 | - * Ensures the value is a non-negative integer. Returns the | |
| 680 | - * registered default when the stored value is empty or false | |
| 681 | - * (option not properly set), but allows 0 to disable purging. | |
| 682 | - * | |
| 683 | - * @since 8.1.0 | |
| 684 | - * | |
| 685 | - * @param mixed $value The stored option value. | |
| 686 | - * | |
| 687 | - * @return int The sanitized value. | |
| 688 | - */ | |
| 689 | - public static function sanitize_purge_days( $value ) { | |
| 690 | - if ( '' === $value || false === $value ) { | |
| 691 | - $filter = \current_filter(); | |
| 692 | - $defaults = array( | |
| 693 | - 'option_activitypub_outbox_purge_days' => ACTIVITYPUB_OUTBOX_PURGE_DAYS, | |
| 694 | - 'option_activitypub_inbox_purge_days' => ACTIVITYPUB_INBOX_PURGE_DAYS, | |
| 695 | - 'option_activitypub_ap_post_purge_days' => ACTIVITYPUB_AP_POST_PURGE_DAYS, | |
| 696 | - ); | |
| 697 | - | |
| 698 | - return $defaults[ $filter ] ?? ACTIVITYPUB_OUTBOX_PURGE_DAYS; | |
| 699 | - } | |
| 700 | - | |
| 701 | - return \max( 1, \absint( $value ) ); | |
| 702 | 631 | } |
| 703 | 632 | |
| 704 | 633 | /** |
| 705 | 634 | * Handle relay mode option changes. |