| @@ -7,9 +7,8 @@ | ||
| 7 | 7 | |
| 8 | 8 | namespace Activitypub\Collection; |
| 9 | 9 | |
| 10 | 10 | use Activitypub\Link; |
| 11 | -use Activitypub\Sanitize; | |
| 12 | 11 | |
| 13 | 12 | use function Activitypub\site_supports_blocks; |
| 14 | 13 | |
| 15 | 14 | /** |
| @@ -40,15 +39,15 @@ | ||
| 40 | 39 | $args['author'] = $user_id; |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | 42 | // Limit to 20 fields to prevent response size issues. |
| 44 | - if ( ! \is_admin() ) { | |
| 43 | + if ( ! is_admin() ) { | |
| 45 | 44 | /** |
| 46 | 45 | * Filters the number of extra fields to retrieve for an ActivityPub actor. |
| 47 | 46 | * |
| 48 | 47 | * @param int $limit The number of extra fields to retrieve. Default 20. |
| 49 | 48 | */ |
| 50 | - $args['posts_per_page'] = \apply_filters( 'activitypub_actor_extra_fields_limit', 20 ); | |
| 49 | + $args['posts_per_page'] = apply_filters( 'activitypub_actor_extra_fields_limit', 20 ); | |
| 51 | 50 | $args['nopaging'] = false; |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | $query = new \WP_Query( $args ); |
| @@ -62,9 +61,9 @@ | ||
| 62 | 61 | * |
| 63 | 62 | * @param \WP_Post[] $fields Array of WP_Post objects representing the extra fields. |
| 64 | 63 | * @param int $user_id The ID of the user whose fields are being retrieved. |
| 65 | 64 | */ |
| 66 | - return \apply_filters( 'activitypub_get_actor_extra_fields', $fields, $user_id ); | |
| 65 | + return apply_filters( 'activitypub_get_actor_extra_fields', $fields, $user_id ); | |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | /** |
| 70 | 69 | * Get formatted content for an extra field. |
| @@ -81,11 +80,12 @@ | ||
| 81 | 80 | } |
| 82 | 81 | $content = \wptexturize( $content ); |
| 83 | 82 | $content = \wp_filter_content_tags( $content ); |
| 84 | 83 | |
| 84 | + // Replace script and style elements. | |
| 85 | + $content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content ); | |
| 85 | 86 | $content = \strip_shortcodes( $content ); |
| 86 | - $content = Sanitize::clean_html( $content ); | |
| 87 | - $content = Sanitize::strip_whitespace( $content ); | |
| 87 | + $content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) ); | |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Filters the content of an extra field. |
| 91 | 91 | * |
| @@ -131,9 +131,9 @@ | ||
| 131 | 131 | if ( 'A' === $tags->get_tag() ) { |
| 132 | 132 | $attachment = array( |
| 133 | 133 | 'type' => 'Link', |
| 134 | 134 | 'name' => $title, |
| 135 | - 'href' => \esc_url_raw( $tags->get_attribute( 'href' ) ), | |
| 135 | + 'href' => \esc_url( $tags->get_attribute( 'href' ) ), | |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | 138 | $rel = $tags->get_attribute( 'rel' ); |
| 139 | 139 | |
| @@ -256,10 +256,10 @@ | ||
| 256 | 256 | 'menu_order' => $menu_order, |
| 257 | 257 | ); |
| 258 | 258 | |
| 259 | 259 | $menu_order += 10; |
| 260 | - $extra_field_id = \wp_insert_post( $extra_field ); | |
| 261 | - $extra_fields[] = \get_post( $extra_field_id ); | |
| 260 | + $extra_field_id = wp_insert_post( $extra_field ); | |
| 261 | + $extra_fields[] = get_post( $extra_field_id ); | |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | $is_blog |
| 265 | 265 | ? \update_option( 'activitypub_default_extra_fields', true ) |