updated plugin ActivityPub version 8.3.0
This commit is contained in:
27
wp-content/plugins/activitypub/patterns/author-header.php
Normal file
27
wp-content/plugins/activitypub/patterns/author-header.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Author Header with Follow pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/author-header',
|
||||
array(
|
||||
'title' => _x( 'Author Header with Follow', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'author', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'header', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'follow', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Compact author header with follow button.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"inherit"} /-->
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
31
wp-content/plugins/activitypub/patterns/author-profile.php
Normal file
31
wp-content/plugins/activitypub/patterns/author-profile.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Author Profile with Follow pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/author-profile',
|
||||
array(
|
||||
'title' => _x( 'Author Profile with Follow', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'author', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'profile', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'follow', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Display author profile with follow button and extra fields.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"inherit","className":"is-style-profile"} /-->
|
||||
<!-- wp:spacer {"height":"24px"} -->
|
||||
<div style="height:24px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/extra-fields {"selectedUser":"inherit"} /-->
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
45
wp-content/plugins/activitypub/patterns/follow-page.php
Normal file
45
wp-content/plugins/activitypub/patterns/follow-page.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Fediverse Follow Page pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$selected_user = ! \Activitypub\is_user_type_disabled( 'blog' ) ? 'blog' : 'inherit';
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/follow-page',
|
||||
array(
|
||||
'title' => _x( 'Fediverse Follow Page', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'follow', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'page', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'followers', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Follow page layout with profile and followers list.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'postTypes' => array( 'page' ),
|
||||
'blockTypes' => array( 'core/post-content' ),
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:paragraph -->
|
||||
<p>' . esc_html_x( 'Follow this blog on Mastodon or the Fediverse and get new posts delivered straight to your feed.', 'Block pattern content', 'activitypub' ) . '</p>
|
||||
<!-- /wp:paragraph -->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"' . $selected_user . '","className":"is-style-profile"} /-->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/followers {"selectedUser":"' . $selected_user . '"} -->
|
||||
<div class="wp-block-activitypub-followers"><!-- wp:heading {"level":3} -->
|
||||
<h3 class="wp-block-heading">' . esc_html_x( 'Our Fediverse Followers', 'Block pattern content', 'activitypub' ) . '</h3>
|
||||
<!-- /wp:heading --></div>
|
||||
<!-- /wp:activitypub/followers -->
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
44
wp-content/plugins/activitypub/patterns/following-page.php
Normal file
44
wp-content/plugins/activitypub/patterns/following-page.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Fediverse Following Page pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$selected_user = ! \Activitypub\is_user_type_disabled( 'blog' ) ? 'blog' : 'inherit';
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/following-page',
|
||||
array(
|
||||
'title' => _x( 'Fediverse Following Page', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'following', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'page', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Following page layout with profile and following list.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'postTypes' => array( 'page' ),
|
||||
'blockTypes' => array( 'core/post-content' ),
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:paragraph -->
|
||||
<p>' . esc_html_x( 'These are the people and projects we follow on the Fediverse.', 'Block pattern content', 'activitypub' ) . '</p>
|
||||
<!-- /wp:paragraph -->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"' . $selected_user . '","className":"is-style-profile"} /-->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/following {"selectedUser":"' . $selected_user . '"} -->
|
||||
<div class="wp-block-activitypub-following"><!-- wp:heading {"level":3} -->
|
||||
<h3 class="wp-block-heading">' . esc_html_x( 'Following on the Fediverse', 'Block pattern content', 'activitypub' ) . '</h3>
|
||||
<!-- /wp:heading --></div>
|
||||
<!-- /wp:activitypub/following -->
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
59
wp-content/plugins/activitypub/patterns/profile-page.php
Normal file
59
wp-content/plugins/activitypub/patterns/profile-page.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Fediverse Profile Page pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$selected_user = ! \Activitypub\is_user_type_disabled( 'blog' ) ? 'blog' : 'inherit';
|
||||
|
||||
$following_block = '';
|
||||
if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) {
|
||||
$following_block = '
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/following {"selectedUser":"' . $selected_user . '"} -->
|
||||
<div class="wp-block-activitypub-following"><!-- wp:heading {"level":3} -->
|
||||
<h3 class="wp-block-heading">' . esc_html_x( 'Following', 'Block pattern content', 'activitypub' ) . '</h3>
|
||||
<!-- /wp:heading --></div>
|
||||
<!-- /wp:activitypub/following -->';
|
||||
}
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/profile-page',
|
||||
array(
|
||||
'title' => _x( 'Fediverse Profile Page', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'profile', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'page', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'extra fields', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'followers', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => '1' === \get_option( 'activitypub_following_ui', '0' )
|
||||
? _x( 'Full profile page with extra fields, followers, and following lists.', 'Block pattern description', 'activitypub' )
|
||||
: _x( 'Full profile page with extra fields and followers list.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'postTypes' => array( 'page' ),
|
||||
'blockTypes' => array( 'core/post-content' ),
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"' . $selected_user . '","className":"is-style-profile"} /-->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/extra-fields {"selectedUser":"' . $selected_user . '"} /-->
|
||||
<!-- wp:spacer {"height":"32px"} -->
|
||||
<div style="height:32px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/followers {"selectedUser":"' . $selected_user . '"} -->
|
||||
<div class="wp-block-activitypub-followers"><!-- wp:heading {"level":3} -->
|
||||
<h3 class="wp-block-heading">' . esc_html_x( 'Followers', 'Block pattern content', 'activitypub' ) . '</h3>
|
||||
<!-- /wp:heading --></div>
|
||||
<!-- /wp:activitypub/followers -->' . $following_block . '
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
40
wp-content/plugins/activitypub/patterns/social-sidebar.php
Normal file
40
wp-content/plugins/activitypub/patterns/social-sidebar.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Fediverse Sidebar pattern.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/social-sidebar',
|
||||
array(
|
||||
'title' => _x( 'Fediverse Sidebar', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'sidebar', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'widget', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'follow', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'followers', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Compact sidebar widget with follow button and followers list.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 400,
|
||||
'blockTypes' => array( 'core/template-part/sidebar' ),
|
||||
'content' => '<!-- wp:group {"layout":{"type":"constrained"}} -->
|
||||
<div class="wp-block-group">
|
||||
<!-- wp:heading {"level":3} -->
|
||||
<h3 class="wp-block-heading">' . esc_html_x( 'Follow on Fediverse', 'Block pattern content', 'activitypub' ) . '</h3>
|
||||
<!-- /wp:heading -->
|
||||
<!-- wp:activitypub/follow-me {"selectedUser":"inherit","className":"is-style-button"} /-->
|
||||
<!-- wp:spacer {"height":"16px"} -->
|
||||
<div style="height:16px" aria-hidden="true" class="wp-block-spacer"></div>
|
||||
<!-- /wp:spacer -->
|
||||
<!-- wp:activitypub/followers {"selectedUser":"inherit","per_page":5} -->
|
||||
<!-- wp:heading {"level":4} -->
|
||||
<h4 class="wp-block-heading">' . esc_html_x( 'Recent Followers', 'Block pattern content', 'activitypub' ) . '</h4>
|
||||
<!-- /wp:heading -->
|
||||
<!-- /wp:activitypub/followers -->
|
||||
</div>
|
||||
<!-- /wp:group -->',
|
||||
)
|
||||
);
|
||||
69
wp-content/plugins/activitypub/patterns/stats-post.php
Normal file
69
wp-content/plugins/activitypub/patterns/stats-post.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Fediverse Stats Post starter pattern.
|
||||
*
|
||||
* This pattern is only registered in December and January, giving users
|
||||
* a seasonal nudge to share their annual Fediverse stats.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
$selected_user = ! \Activitypub\is_user_type_disabled( 'blog' ) ? 'blog' : 'inherit';
|
||||
|
||||
/*
|
||||
* Skip if a post with the stats block was already published
|
||||
* during the current December–January window.
|
||||
*
|
||||
* The month is re-read here (already checked in class-blocks.php)
|
||||
* because we need to distinguish December from January to build
|
||||
* the correct date range.
|
||||
*/
|
||||
$month = (int) \gmdate( 'n' );
|
||||
$current_year = (int) \gmdate( 'Y' );
|
||||
$stats_year = 12 === $month ? $current_year : ( $current_year - 1 );
|
||||
$transient = 'activitypub_stats_pattern_' . $stats_year;
|
||||
$cached = \get_transient( $transient );
|
||||
|
||||
if ( 'hide' === $cached ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === $cached ) {
|
||||
$after = $stats_year . '-12-01';
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$has_stats_post = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT 1 FROM {$wpdb->posts} WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt >= %s AND post_content LIKE %s LIMIT 1",
|
||||
$after,
|
||||
'%<!-- wp:activitypub/stats%'
|
||||
)
|
||||
);
|
||||
|
||||
if ( $has_stats_post ) {
|
||||
\set_transient( $transient, 'hide', MONTH_IN_SECONDS );
|
||||
return;
|
||||
}
|
||||
|
||||
\set_transient( $transient, 'show', DAY_IN_SECONDS );
|
||||
}
|
||||
|
||||
\register_block_pattern(
|
||||
'activitypub/stats-post',
|
||||
array(
|
||||
'title' => _x( 'Fediverse Year in Review', 'Block pattern title', 'activitypub' ),
|
||||
'categories' => array( 'activitypub' ),
|
||||
'keywords' => array(
|
||||
_x( 'stats', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'fediverse', 'Block pattern keyword', 'activitypub' ),
|
||||
_x( 'year in review', 'Block pattern keyword', 'activitypub' ),
|
||||
),
|
||||
'description' => _x( 'Share your annual Fediverse stats as a post.', 'Block pattern description', 'activitypub' ),
|
||||
'viewportWidth' => 1200,
|
||||
'postTypes' => array( 'post' ),
|
||||
'blockTypes' => array( 'core/post-content' ),
|
||||
'content' => '<!-- wp:activitypub/stats {"selectedUser":"' . $selected_user . '","year":' . $stats_year . '} /-->',
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user