This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'transition_post_status', function ( $new_status, $old_status, $post ) { // phpcs:ignore PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket,PEAR.Functions.FunctionCallSignature.MultipleArguments | |
if ( 'publish' !== $new_status || 'publish' !== $old_status ) { | |
// Run only on when the post is public, or was public. | |
return; | |
} | |
// $hash = get_transient( "activitypub:sent:post:{$post->ID}" ); | |
$hash = get_post_meta( $post->ID, '_activitypub_sent_hash', true ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Always share asides, even if their checkbox is disabled. So if you had the | |
// plugin's "opt in" option enabled, this would share all asides, plus whatever | |
// posts (regardless of their format) have sharing enabled explicitly. | |
add_filter( 'share_on_mastodon_enabled', function ( $is_enabled, $post_id ) { | |
if ( 'aside' === get_post_format( $post_id ) ) { | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream php_fpm { | |
server unix:/run/php/php8.1-fpm.sock; | |
keepalive 10; | |
# Equal to PHP's `pm.max_requests` | |
keepalive_requests 500; | |
} | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prevent direct access. | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
add_filter( 'import_from_mastodon_post_content', function( $content, $status ) { | |
// The plugin, by default, leaves hyperlinks in. This removes them. | |
return wp_kses( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'robots_txt', function( $output, $public ) { | |
$output = str_replace( 'Sitemap:', "User-agent: GPTBot\nDisallow: /\n\nSitemap:", $output ); | |
return $output; | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Force re-approval of updated comments. | |
add_action( 'activitypub_handled_update', function( $activity, $second_param, $state, $reaction ) { | |
/** @todo: Send an email or something, because if you get quite a few of these, it's impossible to keep up. */ | |
if ( $reaction instanceof \WP_Comment ) { | |
wp_set_comment_status( $reaction, 'hold' ); | |
wp_notify_moderator( $reaction->comment_ID ); | |
} | |
}, 99, 4 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Modify likes' URLs, and add tagging. | |
*/ | |
add_action( 'register_post_type_args', function( $args, $post_type ) { | |
if ( 'indieblocks_like' === $post_type ){ | |
$args['rewrite']['slug'] = 'bookmarks'; // The new slug. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'http_request_host_is_external', '__return_true' ); |
NewerOlder