add recommended plugins

This commit is contained in:
Matthias Pfefferle 2022-12-02 18:23:56 +01:00
parent 19117323f9
commit 603199c9e8
7 changed files with 226 additions and 61 deletions

View file

@ -22,6 +22,9 @@ function init() {
\defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|^)#(\w*[A-Za-z_]+\w*)' );
\defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '<strong><a><p><ul><ol><li><code><blockquote><pre><img>' );
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<p><strong>%title%</strong></p>\n\n%content%\n\n<p>%hashtags%</p>\n\n<p>%shortlink%</p>" );
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
\define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
require_once \dirname( __FILE__ ) . '/includes/table/followers-list.php';
require_once \dirname( __FILE__ ) . '/includes/class-signature.php';

View file

@ -0,0 +1,140 @@
.activitypub-settings-header {
text-align: center;
margin: 0 0 1rem;
background: #fff;
border-bottom: 1px solid #dcdcde;
}
.activitypub-settings-title-section {
display: flex;
align-items: center;
justify-content: center;
clear: both;
padding-top: 8px;
}
.settings_page_activitypub #wpcontent,
.settings_page_activitypub-settings #wpcontent {
padding-left: 0;
}
.activitypub-settings-tabs-wrapper {
display: -ms-inline-grid;
-ms-grid-columns: 1fr 1fr;
vertical-align: top;
display: inline-grid;
grid-template-columns: 1fr 1fr;
}
.activitypub-settings-tab.active {
box-shadow: inset 0 -3px #3582c4;
font-weight: 600;
}
.activitypub-settings-tab {
display: block;
text-decoration: none;
color: inherit;
padding: .5rem 1rem 1rem;
margin: 0 1rem;
transition: box-shadow .5s ease-in-out;
}
.wp-header-end {
visibility: hidden;
margin: -2px 0 0;
}
summary {
cursor: pointer;
text-decoration: underline;
color: #2271b1;
}
.activitypub-settings-accordion {
border: 1px solid #c3c4c7;
}
.activitypub-settings-accordion-heading {
margin: 0;
border-top: 1px solid #c3c4c7;
font-size: inherit;
line-height: inherit;
font-weight: 600;
color: inherit;
}
.activitypub-settings-accordion-heading:first-child {
border-top: none;
}
.activitypub-settings-accordion-panel {
margin: 0;
padding: 1em 1.5em;
background: #fff;
}
.activitypub-settings-accordion-trigger {
background: #fff;
border: 0;
color: #2c3338;
cursor: pointer;
display: flex;
font-weight: 400;
margin: 0;
padding: 1em 3.5em 1em 1.5em;
min-height: 46px;
position: relative;
text-align: left;
width: 100%;
align-items: center;
justify-content: space-between;
-webkit-user-select: auto;
user-select: auto;
}
.activitypub-settings-accordion-trigger {
color: #2c3338;
cursor: pointer;
font-weight: 400;
text-align: left;
}
.activitypub-settings-accordion-trigger .title {
pointer-events: none;
font-weight: 600;
flex-grow: 1;
}
.activitypub-settings-accordion-trigger .icon, .activitypub-settings-accordion-viewed .icon {
border: solid #50575e;
border-top-width: medium;
border-right-width: medium;
border-bottom-width: medium;
border-left-width: medium;
border-width: 0 2px 2px 0;
height: .5rem;
pointer-events: none;
position: absolute;
right: 1.5em;
top: 50%;
transform: translateY(-70%) rotate(45deg);
width: .5rem;
}
.activitypub-settings-accordion-trigger[aria-expanded="true"] .icon {
transform: translateY(-30%) rotate(-135deg);
}
.activitypub-settings-accordion-trigger:active, .activitypub-settings-accordion-trigger:hover {
background: #f6f7f7;
}
.activitypub-settings-accordion-trigger:focus {
color: #1d2327;
border: none;
box-shadow: none;
outline-offset: -1px;
outline: 2px solid #2271b1;
background-color: #f6f7f7;
}

View file

@ -1,52 +0,0 @@
.activitypub-settings-header {
text-align: center;
margin: 0 0 1rem;
background: #fff;
border-bottom: 1px solid #dcdcde;
}
.activitypub-settings-title-section {
display: flex;
align-items: center;
justify-content: center;
clear: both;
padding-top: 8px;
}
.settings_page_activitypub #wpcontent,
.settings_page_activitypub-settings #wpcontent {
padding-left: 0;
}
.activitypub-settings-tabs-wrapper {
display: -ms-inline-grid;
-ms-grid-columns: 1fr 1fr;
vertical-align: top;
display: inline-grid;
grid-template-columns: 1fr 1fr;
}
.activitypub-settings-tab.active {
box-shadow: inset 0 -3px #3582c4;
font-weight: 600;
}
.activitypub-settings-tab {
display: block;
text-decoration: none;
color: inherit;
padding: .5rem 1rem 1rem;
margin: 0 1rem;
transition: box-shadow .5s ease-in-out;
}
.wp-header-end {
visibility: hidden;
margin: -2px 0 0;
}
summary {
cursor: pointer;
text-decoration: underline;
color: #2271b1;
}

View file

@ -0,0 +1,14 @@
jQuery( function( $ ) {
// Accordion handling in various areas.
$( '.activitypub-settings-accordion' ).on( 'click', '.activitypub-settings-accordion-trigger', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
if ( isExpanded ) {
$( this ).attr( 'aria-expanded', 'false' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
} else {
$( this ).attr( 'aria-expanded', 'true' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
}
} );
} );

View file

@ -14,7 +14,7 @@ class Admin {
\add_action( 'admin_menu', array( '\Activitypub\Admin', 'admin_menu' ) );
\add_action( 'admin_init', array( '\Activitypub\Admin', 'register_settings' ) );
\add_action( 'show_user_profile', array( '\Activitypub\Admin', 'add_fediverse_profile' ) );
\add_action( 'admin_enqueue_scripts', array( '\Activitypub\Admin', 'admin_style' ) );
\add_action( 'admin_enqueue_scripts', array( '\Activitypub\Admin', 'enqueue_scripts' ) );
}
/**
@ -154,9 +154,10 @@ class Admin {
\Activitypub\get_identifier_settings( $user->ID );
}
public static function admin_style( $hook_suffix ) {
public static function enqueue_scripts( $hook_suffix ) {
if ( false !== strpos( $hook_suffix, 'activitypub' ) ) {
wp_enqueue_style( 'admin-styles', plugin_dir_url( __FILE__ ) . '../assets/css/admin.css', array(), '1.0.0' );
wp_enqueue_style( 'activitypub-admin-styles', plugins_url( 'assets/css/activitypub-admin.css', ACTIVITYPUB_PLUGIN_FILE ), array(), '1.0.0' );
wp_enqueue_script( 'activitypub-admin-styles', plugins_url( 'assets/js/activitypub-admin.js', ACTIVITYPUB_PLUGIN_FILE ), array( 'jquery' ), '1.0.0', false );
}
}
}

View file

@ -17,13 +17,16 @@ class Debug {
}
public static function log_remote_post_responses( $response, $url, $body, $user_id ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r
\error_log( "Request to: {$url} with response: " . \print_r( $response, true ) );
}
public static function write_log( $log ) {
if ( \is_array( $log ) || \is_object( $log ) ) {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r
\error_log( \print_r( $log, true ) );
} else {
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
\error_log( $log );
}
}

View file

@ -3,7 +3,7 @@
<div class="privacy-settings-body hide-if-no-js">
<h2><?php \esc_html_e( 'Welcome', 'activitypub' ); ?></h2>
<p><?php \_e( 'ActivityPub turns your blog into a federated social network. This means you can share and talk to everyone using the ActivityPub protocol, including users of Friendica, Pleroma and Mastodon.', 'activitypub' ); ?></p>
<p><?php \esc_html_e( 'ActivityPub turns your blog into a federated social network. This means you can share and talk to everyone using the ActivityPub protocol, including users of Friendica, Pleroma and Mastodon.', 'activitypub' ); ?></p>
<p>
<?php
\printf(
@ -11,13 +11,69 @@
'People can follow you by using the username <code>%s</code> or the URL <code>%s</code>. Users who can not access this settings page will find their username on the <a href="%s">Edit Profile</a> page.',
'activitypub'
),
\Activitypub\get_webfinger_resource( wp_get_current_user()->ID ),
\get_author_posts_url( wp_get_current_user()->ID ),
\admin_url( 'profile.php#activitypub' )
\esc_attr( \Activitypub\get_webfinger_resource( wp_get_current_user()->ID ) ),
\esc_url_raw( \get_author_posts_url( wp_get_current_user()->ID ) ),
\esc_url_raw( \admin_url( 'profile.php#activitypub' ) )
);
?>
</p>
<p><?php \printf( __( 'If you have problems using this plugin, please check the <a href="%s">Site Health</a> to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ), admin_url( '/wp-admin/site-health.php' ) ); ?></p>
<p>
<?php
\printf(
\__( 'If you have problems using this plugin, please check the <a href="%s">Site Health</a> to ensure that your site is compatible and/or use the "Help" tab (in the top right of the settings pages).', 'activitypub' ),
\esc_url_raw( admin_url( '/wp-admin/site-health.php' ) )
);
?>
</p>
<hr />
<p><?php \_e( 'To follow people on Mastodon or similar platforms using your own WordPress, you can use the <a href="https://wordpress.org/plugins/friends">Friends Plugin for WordPress</a> which uses this plugin to receive posts and display them on your own WordPress.', 'activitypub' ); ?></p>
<h3><?php \esc_html_e( 'Recommendet Plugins', 'activitypub' ); ?></h3>
<p><?php \esc_html_e( 'ActivityPub works as is and there is no need for you to install additional plugins, nevertheless there are some that extends the functionality of ActivityPub.', 'activitypub' ); ?></p>
<div class="activitypub-settings-accordion">
<h4 class="activitypub-settings-accordion-heading">
<button aria-expanded="true" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-friends-plugin" type="button">
<span class="title"><?php \esc_html_e( 'Friends Plugin', 'activitypub' ); ?></span>
<span class="icon"></span>
</button>
</h4>
<div id="activitypub-settings-accordion-block-friends-plugin" class="activitypub-settings-accordion-panel">
<p><?php \esc_html_e( 'To follow people on Mastodon or similar platforms using your own WordPress, you can use the Friends Plugin for WordPress which uses this plugin to receive posts and display them on your own WordPress, thus making your own WordPress a Fediverse instance of its own.', 'activitypub' ); ?></p>
<p><a href="https://wordpress.org/plugins/friends"><?php \esc_html_e( 'Install Friends Plugin for WordPress', 'activitypub' ); ?></a></p>
</div>
<h4 class="activitypub-settings-accordion-heading">
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-hum-plugin" type="button">
<span class="title"><?php \esc_html_e( 'Hum Plugin', 'activitypub' ); ?></span>
<span class="icon"></span>
</button>
</h4>
<div id="activitypub-settings-accordion-block-activitypub-hum-plugin" class="activitypub-settings-accordion-panel" hidden="hidden">
<p><?php \esc_html_e( 'Hum is a personal URL shortener for WordPress, designed to provide short URLs to your personal content, both hosted on WordPress and elsewhere.', 'activitypub' ); ?></p>
<p><a href="https://wordpress.org/plugins/hum"><?php \esc_html_e( 'Install Hum Plugin for WordPress', 'activitypub' ); ?></a></p>
</div>
<h4 class="activitypub-settings-accordion-heading">
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-webfinger-plugin" type="button">
<span class="title"><?php \esc_html_e( 'WebFinger Plugin', 'activitypub' ); ?></span>
<span class="icon"></span>
</button>
</h4>
<div id="activitypub-settings-accordion-block-activitypub-webfinger-plugin" class="activitypub-settings-accordion-panel" hidden="hidden">
<p><?php \esc_html_e( 'WebFinger is a protocol that allows for discovery of information about people and things identified by a URI. Information about a person might be discovered via an "acct:" URI, for example, which is a URI that looks like an email address.', 'activitypub' ); ?></p>
<p><?php \esc_html_e( 'The ActivityPub plugin comes with basic WebFinger support, if you need more configuration options and compatibility with other Fediverse/IndieWeb plugins, please install the WebFinger plugin.', 'activitypub' ); ?></p>
<p><a href="https://wordpress.org/plugins/webfinger"><?php \esc_html_e( 'Install WebFinger Plugin for WordPress', 'activitypub' ); ?></a></p>
</div>
<h4 class="activitypub-settings-accordion-heading">
<button aria-expanded="false" class="activitypub-settings-accordion-trigger" aria-controls="activitypub-settings-accordion-block-activitypub-nodeinfo-plugin" type="button">
<span class="title"><?php \esc_html_e( 'NodeInfo Plugin', 'activitypub' ); ?></span>
<span class="icon"></span>
</button>
</h4>
<div id="activitypub-settings-accordion-block-activitypub-nodeinfo-plugin" class="activitypub-settings-accordion-panel" hidden="hidden">
<p><?php \esc_html_e( 'NodeInfo is an effort to create a standardized way of exposing metadata about a server running one of the distributed social networks. The two key goals are being able to get better insights into the user base of distributed social networking and the ability to build tools that allow users to choose the best fitting software and server for their needs.', 'activitypub' ); ?></p>
<p><?php \esc_html_e( 'The ActivityPub plugin comes with a simple NodeInfo endpoint, if you need more configuration options and compatibility with other Fediverse plugins, please install the NodeInfo plugin.', 'activitypub' ); ?></p>
<p><a href="https://wordpress.org/plugins/nodeinfo"><?php \esc_html_e( 'Install NodeInfo Plugin for WordPress', 'activitypub' ); ?></a></p>
</div>
</div>
</div>