|
21 | 21 | function get_context() {
|
22 | 22 | $context = Activity::JSON_LD_CONTEXT;
|
23 | 23 |
|
| 24 | + /** |
| 25 | + * Filters the ActivityPub JSON-LD context. |
| 26 | + * |
| 27 | + * This filter allows developers to modify or extend the JSON-LD context used |
| 28 | + * in ActivityPub responses. The context defines the vocabulary and terms used |
| 29 | + * in the ActivityPub JSON objects. |
| 30 | + * |
| 31 | + * @param array $context The default ActivityPub JSON-LD context array. |
| 32 | + */ |
24 | 33 | return \apply_filters( 'activitypub_json_context', $context );
|
25 | 34 | }
|
26 | 35 |
|
@@ -68,6 +77,16 @@ function get_webfinger_resource( $user_id ) {
|
68 | 77 | * @return array|WP_Error The Actor profile as array or WP_Error on failure.
|
69 | 78 | */
|
70 | 79 | function get_remote_metadata_by_actor( $actor, $cached = true ) {
|
| 80 | + /** |
| 81 | + * Filters the metadata before it is retrieved from a remote actor. |
| 82 | + * |
| 83 | + * Passing a non-false value will effectively short-circuit the remote request, |
| 84 | + * returning that value instead. |
| 85 | + * |
| 86 | + * @param mixed $pre The value to return instead of the remote metadata. |
| 87 | + * Default false to continue with the remote request. |
| 88 | + * @param string $actor The actor URL. |
| 89 | + */ |
71 | 90 | $pre = apply_filters( 'pre_get_remote_metadata_by_actor', false, $actor );
|
72 | 91 | if ( $pre ) {
|
73 | 92 | return $pre;
|
@@ -414,7 +433,7 @@ function is_post_disabled( $post ) {
|
414 | 433 | $disabled = true;
|
415 | 434 | }
|
416 | 435 |
|
417 |
| - /* |
| 436 | + /** |
418 | 437 | * Allow plugins to disable posts for ActivityPub.
|
419 | 438 | *
|
420 | 439 | * @param boolean $disabled True if the post is disabled, false otherwise.
|
@@ -1312,11 +1331,7 @@ function generate_post_summary( $post, $length = 500 ) {
|
1312 | 1331 | $content = \sanitize_post_field( 'post_excerpt', $post->post_excerpt, $post->ID );
|
1313 | 1332 |
|
1314 | 1333 | if ( $content ) {
|
1315 |
| - /** |
1316 |
| - * Filters the post excerpt. |
1317 |
| - * |
1318 |
| - * @param string $content The post excerpt. |
1319 |
| - */ |
| 1334 | + /** This filter is documented in wp-includes/post-template.php */ |
1320 | 1335 | return \apply_filters( 'the_excerpt', $content );
|
1321 | 1336 | }
|
1322 | 1337 |
|
@@ -1354,6 +1369,7 @@ function generate_post_summary( $post, $length = 500 ) {
|
1354 | 1369 |
|
1355 | 1370 | /*
|
1356 | 1371 | Removed until this is merged: https://github.com/mastodon/mastodon/pull/28629
|
| 1372 | + /** This filter is documented in wp-includes/post-template.php |
1357 | 1373 | return \apply_filters( 'the_excerpt', $content );
|
1358 | 1374 | */
|
1359 | 1375 | return $content;
|
@@ -1459,6 +1475,15 @@ function get_content_visibility( $post_id ) {
|
1459 | 1475 | $_visibility = $visibility;
|
1460 | 1476 | }
|
1461 | 1477 |
|
| 1478 | + /** |
| 1479 | + * Filters the visibility of a post. |
| 1480 | + * |
| 1481 | + * @param string $_visibility The visibility of the post. Possible values are: |
| 1482 | + * - 'public': Post is public and federated. |
| 1483 | + * - 'quiet_public': Post is public but not federated. |
| 1484 | + * - 'local': Post is only visible locally. |
| 1485 | + * @param \WP_Post $post The post object. |
| 1486 | + */ |
1462 | 1487 | return \apply_filters( 'activitypub_content_visibility', $_visibility, $post );
|
1463 | 1488 | }
|
1464 | 1489 |
|
@@ -1512,7 +1537,7 @@ function get_upload_baseurl() {
|
1512 | 1537 | /**
|
1513 | 1538 | * Filters the upload base URL.
|
1514 | 1539 | *
|
1515 |
| - * @param string \wp_get_upload_dir()['baseurl'] The upload base URL. |
| 1540 | + * @param string $upload_dir The upload base URL. Default \wp_get_upload_dir()['baseurl'] |
1516 | 1541 | */
|
1517 | 1542 | return apply_filters( 'activitypub_get_upload_baseurl', $upload_dir['baseurl'] );
|
1518 | 1543 | }
|
|
0 commit comments