| @@ -8,10 +8,8 @@ | ||
| 8 | 8 | namespace Activitypub; |
| 9 | 9 | |
| 10 | 10 | use Activitypub\Collection\Followers; |
| 11 | 11 | use Activitypub\Collection\Following; |
| 12 | -use Activitypub\Collection\Remote_Posts; | |
| 13 | -use Activitypub\OAuth\Client; | |
| 14 | 12 | |
| 15 | 13 | /** |
| 16 | 14 | * ActivityPub Class. |
| 17 | 15 | * |
| @@ -42,9 +40,9 @@ | ||
| 42 | 40 | public static function activate( $network_wide ) { |
| 43 | 41 | self::flush_rewrite_rules(); |
| 44 | 42 | Scheduler::register_schedules(); |
| 45 | 43 | |
| 46 | - \add_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 5, 3 ); | |
| 44 | + \add_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 10, 3 ); | |
| 47 | 45 | Migration::update_comment_counts(); |
| 48 | 46 | |
| 49 | 47 | if ( \is_multisite() && $network_wide && ! \wp_is_large_network() ) { |
| 50 | 48 | $sites = \get_sites( array( 'fields' => 'ids' ) ); |
| @@ -64,9 +62,9 @@ | ||
| 64 | 62 | public static function deactivate( $network_wide ) { |
| 65 | 63 | self::flush_rewrite_rules(); |
| 66 | 64 | Scheduler::deregister_schedules(); |
| 67 | 65 | |
| 68 | - \remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 5 ); | |
| 66 | + \remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) ); | |
| 69 | 67 | Migration::update_comment_counts( 2000 ); |
| 70 | 68 | |
| 71 | 69 | if ( \is_multisite() && $network_wide && ! \wp_is_large_network() ) { |
| 72 | 70 | $sites = \get_sites( array( 'fields' => 'ids' ) ); |
| @@ -83,15 +81,11 @@ | ||
| 83 | 81 | */ |
| 84 | 82 | public static function uninstall() { |
| 85 | 83 | Scheduler::deregister_schedules(); |
| 86 | 84 | |
| 87 | - \remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ), 5 ); | |
| 85 | + \remove_filter( 'pre_wp_update_comment_count_now', array( Comment::class, 'pre_wp_update_comment_count_now' ) ); | |
| 88 | 86 | Migration::update_comment_counts( 2000 ); |
| 89 | 87 | |
| 90 | - Remote_Posts::delete_all(); | |
| 91 | - Tombstone::delete_all(); | |
| 92 | - Client::delete_all(); | |
| 93 | - | |
| 94 | 88 | Options::delete(); |
| 95 | 89 | } |
| 96 | 90 | |
| 97 | 91 | /** |
| @@ -130,9 +124,9 @@ | ||
| 130 | 124 | * |
| 131 | 125 | * @deprecated 7.5.0 Use {@see Router::add_rewrite_rules()}. |
| 132 | 126 | */ |
| 133 | 127 | public static function add_rewrite_rules() { |
| 134 | - \_deprecated_function( __FUNCTION__, '7.5.0', '\Activitypub\Router::add_rewrite_rules()' ); | |
| 128 | + _deprecated_function( __FUNCTION__, '7.5.0', '\Activitypub\Router::add_rewrite_rules()' ); | |
| 135 | 129 | |
| 136 | 130 | Router::add_rewrite_rules(); |
| 137 | 131 | } |
| 138 | 132 | |
| @@ -141,11 +135,11 @@ | ||
| 141 | 135 | */ |
| 142 | 136 | public static function theme_compat() { |
| 143 | 137 | // We assume that you want to use Post-Formats when enabling the setting. |
| 144 | 138 | if ( 'wordpress-post-format' === \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ) ) { |
| 145 | - if ( ! \get_theme_support( 'post-formats' ) ) { | |
| 139 | + if ( ! get_theme_support( 'post-formats' ) ) { | |
| 146 | 140 | // Add support for the Aside, Gallery Post Formats... |
| 147 | - \add_theme_support( | |
| 141 | + add_theme_support( | |
| 148 | 142 | 'post-formats', |
| 149 | 143 | array( |
| 150 | 144 | 'gallery', |
| 151 | 145 | 'status', |
| @@ -196,9 +190,8 @@ | ||
| 196 | 190 | 'description' => 'Hide Followers and Followings on Profile.', |
| 197 | 191 | 'single' => true, |
| 198 | 192 | 'default' => 0, |
| 199 | 193 | 'sanitize_callback' => 'absint', |
| 200 | - 'show_in_rest' => true, | |
| 201 | 194 | ) |
| 202 | 195 | ); |
| 203 | 196 | |
| 204 | 197 | \register_meta( |
| @@ -228,10 +221,10 @@ | ||
| 228 | 221 | 'type' => 'string', |
| 229 | 222 | 'description' => 'The user description.', |
| 230 | 223 | 'single' => true, |
| 231 | 224 | 'default' => '', |
| 232 | - 'sanitize_callback' => static function ( $value ) { | |
| 233 | - return \wp_kses( $value, 'user_description' ); | |
| 225 | + 'sanitize_callback' => function ( $value ) { | |
| 226 | + return wp_kses( $value, 'user_description' ); | |
| 234 | 227 | }, |
| 235 | 228 | ) |
| 236 | 229 | ); |
| 237 | 230 | |
| @@ -296,43 +289,8 @@ | ||
| 296 | 289 | \add_filter( 'get_user_option_activitypub_mailer_new_mention', array( self::class, 'user_options_default' ) ); |
| 297 | 290 | |
| 298 | 291 | \register_meta( |
| 299 | 292 | 'user', |
| 300 | - $blog_prefix . 'activitypub_mailer_new_reaction', | |
| 301 | - array( | |
| 302 | - 'type' => 'integer', | |
| 303 | - 'description' => 'Send a notification when someone likes, reposts, or quotes this user\'s post.', | |
| 304 | - 'single' => true, | |
| 305 | - 'sanitize_callback' => 'absint', | |
| 306 | - ) | |
| 307 | - ); | |
| 308 | - \add_filter( 'get_user_option_activitypub_mailer_new_reaction', array( self::class, 'user_options_default' ) ); | |
| 309 | - | |
| 310 | - \register_meta( | |
| 311 | - 'user', | |
| 312 | - $blog_prefix . 'activitypub_mailer_annual_report', | |
| 313 | - array( | |
| 314 | - 'type' => 'integer', | |
| 315 | - 'description' => 'Send the annual Fediverse Year in Review email.', | |
| 316 | - 'single' => true, | |
| 317 | - 'sanitize_callback' => 'absint', | |
| 318 | - ) | |
| 319 | - ); | |
| 320 | - \add_filter( 'get_user_option_activitypub_mailer_annual_report', array( self::class, 'user_options_default' ) ); | |
| 321 | - | |
| 322 | - \register_meta( | |
| 323 | - 'user', | |
| 324 | - $blog_prefix . 'activitypub_mailer_monthly_report', | |
| 325 | - array( | |
| 326 | - 'type' => 'integer', | |
| 327 | - 'description' => 'Send a monthly Fediverse stats report email.', | |
| 328 | - 'single' => true, | |
| 329 | - 'sanitize_callback' => 'absint', | |
| 330 | - ) | |
| 331 | - ); | |
| 332 | - | |
| 333 | - \register_meta( | |
| 334 | - 'user', | |
| 335 | 293 | 'activitypub_show_welcome_tab', |
| 336 | 294 | array( |
| 337 | 295 | 'type' => 'integer', |
| 338 | 296 | 'description' => 'Whether to show the welcome tab.', |
| @@ -374,9 +332,9 @@ | ||
| 374 | 332 | 'type' => 'array', |
| 375 | 333 | 'description' => 'User-specific blocked ActivityPub domains.', |
| 376 | 334 | 'single' => true, |
| 377 | 335 | 'default' => array(), |
| 378 | - 'sanitize_callback' => static function ( $value ) { | |
| 336 | + 'sanitize_callback' => function ( $value ) { | |
| 379 | 337 | return \array_unique( \array_map( array( Sanitize::class, 'host_list' ), $value ) ); |
| 380 | 338 | }, |
| 381 | 339 | ) |
| 382 | 340 | ); |
| @@ -388,9 +346,9 @@ | ||
| 388 | 346 | 'type' => 'array', |
| 389 | 347 | 'description' => 'User-specific blocked ActivityPub keywords.', |
| 390 | 348 | 'single' => true, |
| 391 | 349 | 'default' => array(), |
| 392 | - 'sanitize_callback' => static function ( $value ) { | |
| 350 | + 'sanitize_callback' => function ( $value ) { | |
| 393 | 351 | return \array_map( 'sanitize_text_field', $value ); |
| 394 | 352 | }, |
| 395 | 353 | ) |
| 396 | 354 | ); |