updated plugin ActivityPub version 8.3.0
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/posts-and-replies",
|
||||
"apiVersion": 3,
|
||||
"version": "unreleased",
|
||||
"title": "Posts and Replies",
|
||||
"category": "widgets",
|
||||
"description": "Display a tab bar to filter between posts only and posts with replies on author archives.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "admin-post",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"posts",
|
||||
"replies",
|
||||
"tabs"
|
||||
],
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"editorScript": "file:./index.js",
|
||||
"style": [
|
||||
"file:./style-index.css"
|
||||
],
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'c8dfeeece9537c9d6183');
|
||||
@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e,t={5879(){const e=window.wp.blocks,t=window.wp.blockEditor,i=window.wp.components,s=window.wp.i18n,r=window.ReactJSXRuntime,o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"activitypub/posts-and-replies","apiVersion":3,"version":"unreleased","title":"Posts and Replies","category":"widgets","description":"Display a tab bar to filter between posts only and posts with replies on author archives.","textdomain":"activitypub","icon":"admin-post","keywords":["fediverse","activitypub","posts","replies","tabs"],"supports":{"html":false},"editorScript":"file:./index.js","style":["file:./style-index.css"],"render":"file:./render.php"}');(0,e.registerBlockType)(o,{edit:function(){const e=(0,t.useBlockProps)();return(0,r.jsx)("div",{...e,children:(0,r.jsx)(i.Placeholder,{icon:"admin-post",label:(0,s.__)("Posts and Replies","activitypub"),instructions:(0,s.__)('Displays a tab bar to filter between "Posts" (excluding replies) and "Posts & Replies" on author archives. Place above a Query Loop block with "Inherit query from template" enabled.',"activitypub")})})},save:()=>null})}},i={};function s(e){var r=i[e];if(void 0!==r)return r.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,s),o.exports}s.m=t,e=[],s.O=(t,i,r,o)=>{if(!i){var n=1/0;for(c=0;c<e.length;c++){for(var[i,r,o]=e[c],a=!0,p=0;p<i.length;p++)(!1&o||n>=o)&&Object.keys(s.O).every(e=>s.O[e](i[p]))?i.splice(p--,1):(a=!1,o<n&&(n=o));if(a){e.splice(c--,1);var l=r();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[i,r,o]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={642:0,6:0};s.O.j=t=>0===e[t];var t=(t,i)=>{var r,o,[n,a,p]=i,l=0;if(n.some(t=>0!==e[t])){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(p)var c=p(s)}for(t&&t(i);l<n.length;l++)o=n[l],s.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return s.O(c)},i=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var r=s.O(void 0,[6],()=>s(5879));r=s.O(r)})();
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/posts-and-replies` block.
|
||||
*
|
||||
* Renders a tab bar that controls query filtering via URL parameter.
|
||||
* Works with a sibling `core/query` block that inherits from the template.
|
||||
* The actual query filtering happens in {@see Blocks::filter_query_loop_vars()}.
|
||||
*
|
||||
* @since 8.1.0
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || \is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine active tab from URL parameter. Default to "Posts & Replies" so
|
||||
* the reply-exclusion filter only attaches on an explicit opt-in via
|
||||
* ?filter=posts (clicked from the tab bar below).
|
||||
*/
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$active_tab = isset( $_GET['filter'] ) ? \sanitize_key( \wp_unslash( $_GET['filter'] ) ) : 'posts-and-replies';
|
||||
if ( ! \in_array( $active_tab, array( 'posts', 'posts-and-replies' ), true ) ) {
|
||||
$active_tab = 'posts-and-replies';
|
||||
}
|
||||
|
||||
$current_url = \remove_query_arg( array( 'filter', 'paged' ) );
|
||||
$posts_url = \add_query_arg( 'filter', 'posts', $current_url );
|
||||
$all_url = \add_query_arg( 'filter', 'posts-and-replies', $current_url );
|
||||
|
||||
$wrapper_attributes = \get_block_wrapper_attributes();
|
||||
?>
|
||||
<nav <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput ?> aria-label="<?php \esc_attr_e( 'Post filtering', 'activitypub' ); ?>">
|
||||
<div class="ap-tabs">
|
||||
<a
|
||||
class="ap-tabs__tab <?php echo 'posts-and-replies' === $active_tab ? 'is-active' : ''; ?>"
|
||||
href="<?php echo \esc_url( $all_url ); ?>"
|
||||
<?php echo 'posts-and-replies' === $active_tab ? 'aria-current="page"' : ''; ?>
|
||||
>
|
||||
<?php \esc_html_e( 'Posts & Replies', 'activitypub' ); ?>
|
||||
</a>
|
||||
<a
|
||||
class="ap-tabs__tab <?php echo 'posts' === $active_tab ? 'is-active' : ''; ?>"
|
||||
href="<?php echo \esc_url( $posts_url ); ?>"
|
||||
<?php echo 'posts' === $active_tab ? 'aria-current="page"' : ''; ?>
|
||||
>
|
||||
<?php \esc_html_e( 'Posts', 'activitypub' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-posts-and-replies .ap-tabs{border-bottom:1px solid;display:flex;gap:0;margin-bottom:1.5em}.wp-block-activitypub-posts-and-replies .ap-tabs__tab{background:none;border:none;border-bottom:2px solid transparent;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;margin-bottom:-1px;opacity:.6;padding:.5em 1em;text-decoration:none;transition:opacity .2s,border-color .2s}.wp-block-activitypub-posts-and-replies .ap-tabs__tab:focus-visible,.wp-block-activitypub-posts-and-replies .ap-tabs__tab:hover{opacity:1}.wp-block-activitypub-posts-and-replies .ap-tabs__tab.is-active{border-bottom-color:currentcolor;opacity:1}
|
||||
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-posts-and-replies .ap-tabs{border-bottom:1px solid;display:flex;gap:0;margin-bottom:1.5em}.wp-block-activitypub-posts-and-replies .ap-tabs__tab{background:none;border:none;border-bottom:2px solid transparent;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;margin-bottom:-1px;opacity:.6;padding:.5em 1em;text-decoration:none;transition:opacity .2s,border-color .2s}.wp-block-activitypub-posts-and-replies .ap-tabs__tab:focus-visible,.wp-block-activitypub-posts-and-replies .ap-tabs__tab:hover{opacity:1}.wp-block-activitypub-posts-and-replies .ap-tabs__tab.is-active{border-bottom-color:currentcolor;opacity:1}
|
||||
Reference in New Issue
Block a user