| @@ -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 | /** |
| @@ -184,26 +180,8 @@ | ||
| 184 | 180 | ); |
| 185 | 181 | |
| 186 | 182 | \register_setting( |
| 187 | 183 | 'activitypub', |
| 188 | - 'activitypub_default_quote_policy', | |
| 189 | - array( | |
| 190 | - 'type' => 'string', | |
| 191 | - 'description' => 'Default quote policy for new posts.', | |
| 192 | - 'default' => ACTIVITYPUB_INTERACTION_POLICY_ANYONE, | |
| 193 | - 'sanitize_callback' => static function ( $value ) { | |
| 194 | - $allowed = array( | |
| 195 | - ACTIVITYPUB_INTERACTION_POLICY_ANYONE, | |
| 196 | - ACTIVITYPUB_INTERACTION_POLICY_FOLLOWERS, | |
| 197 | - ACTIVITYPUB_INTERACTION_POLICY_ME, | |
| 198 | - ); | |
| 199 | - return \in_array( $value, $allowed, true ) ? $value : ACTIVITYPUB_INTERACTION_POLICY_ANYONE; | |
| 200 | - }, | |
| 201 | - ) | |
| 202 | - ); | |
| 203 | - | |
| 204 | - \register_setting( | |
| 205 | - 'activitypub', | |
| 206 | 184 | 'activitypub_relays', |
| 207 | 185 | array( |
| 208 | 186 | 'type' => 'array', |
| 209 | 187 | 'description' => 'Relays', |
| @@ -229,14 +207,11 @@ | ||
| 229 | 207 | \register_setting( |
| 230 | 208 | 'activitypub_advanced', |
| 231 | 209 | 'activitypub_outbox_purge_days', |
| 232 | 210 | 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 | - }, | |
| 211 | + 'type' => 'integer', | |
| 212 | + 'description' => 'Number of days to keep items in the Outbox.', | |
| 213 | + 'default' => 180, | |
| 239 | 214 | ) |
| 240 | 215 | ); |
| 241 | 216 | |
| 242 | 217 | \register_setting( |
| @@ -242,14 +217,11 @@ | ||
| 242 | 217 | \register_setting( |
| 243 | 218 | 'activitypub_advanced', |
| 244 | 219 | 'activitypub_inbox_purge_days', |
| 245 | 220 | 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 | - }, | |
| 221 | + 'type' => 'integer', | |
| 222 | + 'description' => 'Number of days to keep items in the Inbox.', | |
| 223 | + 'default' => 180, | |
| 252 | 224 | ) |
| 253 | 225 | ); |
| 254 | 226 | |
| 255 | 227 | \register_setting( |
| @@ -255,14 +227,11 @@ | ||
| 255 | 227 | \register_setting( |
| 256 | 228 | 'activitypub_advanced', |
| 257 | 229 | 'activitypub_ap_post_purge_days', |
| 258 | 230 | 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 | - }, | |
| 231 | + 'type' => 'integer', | |
| 232 | + 'description' => 'Number of days to keep remote posts.', | |
| 233 | + 'default' => 30, | |
| 265 | 234 | ) |
| 266 | 235 | ); |
| 267 | 236 | |
| 268 | 237 | \register_setting( |
| @@ -336,18 +305,8 @@ | ||
| 336 | 305 | ); |
| 337 | 306 | |
| 338 | 307 | \register_setting( |
| 339 | 308 | '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 | 309 | 'activitypub_object_type', |
| 351 | 310 | array( |
| 352 | 311 | 'type' => 'string', |
| 353 | 312 | 'description' => 'The Activity-Object-Type', |
| @@ -438,28 +397,8 @@ | ||
| 438 | 397 | ); |
| 439 | 398 | |
| 440 | 399 | \register_setting( |
| 441 | 400 | '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 | 401 | 'activitypub_blog_user_also_known_as', |
| 463 | 402 | array( |
| 464 | 403 | 'type' => 'array', |
| 465 | 404 | 'description' => 'An array of URLs that the blog user is known by.', |
| @@ -670,36 +609,8 @@ | ||
| 670 | 609 | $value = ACTIVITYPUB_DEFAULT_OBJECT_TYPE; |
| 671 | 610 | } |
| 672 | 611 | |
| 673 | 612 | 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 | 613 | } |
| 703 | 614 | |
| 704 | 615 | /** |
| 705 | 616 | * Handle relay mode option changes. |