Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/wp-phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: WordPress Unit Testing
on:
push:
pull_request:
push:
branches:
- main
pull_request:
jobs:
phpunit:
runs-on: ubuntu-latest
Expand All @@ -23,8 +25,12 @@ jobs:
- wp-version: '6.5'
php-versions: '7.1'
steps:
- name: Install svn
run: |
sudo apt-get update
sudo apt-get install subversion
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
10 changes: 10 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ public static function register_settings() {
'default' => 1,
)
);
register_setting(
'webmention',
'webmention_avatar_store_enable',
array(
'type' => 'int',
'description' => esc_html__( 'Store Avatars Locally', 'webmention' ),
'show_in_rest' => true,
'default' => 0,
)
);
register_setting(
'webmention',
'webmention_separate_comment',
Expand Down
27 changes: 19 additions & 8 deletions templates/webmention-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
<td>
<fieldset>
<label for="webmention_disable_selfpings_same_url">
<input type="checkbox" name="webmention_disable_selfpings_same_url" id="webmention_disable_selfpings_same_url" value="1" <?php echo checked( true, get_option( 'webmention_disable_selfpings_same_url' ) ); ?> />
<input type="checkbox" name="webmention_disable_selfpings_same_url" id="webmention_disable_selfpings_same_url" value="1" <?php checked( true, get_option( 'webmention_disable_selfpings_same_url' ) ); ?> />
<?php esc_html_e( 'Disable self-pings on the same URL', 'webmention' ); ?>
<p class="description"><?php esc_html_e( '(for example "http://example.com/?p=123")', 'webmention' ); ?></p>
</label>

<br />

<label for="webmention_disable_selfpings_same_domain">
<input type="checkbox" name="webmention_disable_selfpings_same_domain" id="webmention_disable_selfpings_same_domain" value="1" <?php echo checked( true, get_option( 'webmention_disable_selfpings_same_domain' ) ); ?> />
<input type="checkbox" name="webmention_disable_selfpings_same_domain" id="webmention_disable_selfpings_same_domain" value="1" <?php checked( true, get_option( 'webmention_disable_selfpings_same_domain' ) ); ?> />
<?php esc_html_e( 'Disable self-pings on the same Domain', 'webmention' ); ?>
<p class="description"><?php esc_html_e( '(for example "example.com")', 'webmention' ); ?></p>
</label>

<br />

<label for="webmention_disable_media_mentions">
<input type="checkbox" name="webmention_disable_media_mentions" id="webmention_disable_media_mentions" value="1" <?php echo checked( true, get_option( 'webmention_disable_media_mentions' ) ); ?> />
<input type="checkbox" name="webmention_disable_media_mentions" id="webmention_disable_media_mentions" value="1" <?php checked( true, get_option( 'webmention_disable_media_mentions' ) ); ?> />
<?php esc_html_e( 'Disable sending Webmentions for media links (image, video, audio)', 'webmention' ); ?>
</label>
</fieldset>
Expand All @@ -57,7 +57,7 @@
<?php foreach ( $post_types as $post_type ) { ?>
<li>
<label for="webmention_support_post_types_<?php echo esc_attr( $post_type->name ); ?>">
<input type="checkbox" id="webmention_support_post_types_<?php echo esc_attr( $post_type->name ); ?>" name="webmention_support_post_types[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php echo checked( true, in_array( $post_type->name, $support_post_types, true ) ); ?> />
<input type="checkbox" id="webmention_support_post_types_<?php echo esc_attr( $post_type->name ); ?>" name="webmention_support_post_types[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php checked( true, in_array( $post_type->name, $support_post_types, true ) ); ?> />
<?php echo esc_html( $post_type->label ); ?>
</label>
</li>
Expand Down Expand Up @@ -110,7 +110,7 @@
<fieldset>
<p>
<label for="webmention_show_comment_form">
<input type="checkbox" name="webmention_show_comment_form" id="webmention_show_comment_form" value="1" <?php echo checked( true, get_option( 'webmention_show_comment_form' ) ); ?> />
<input type="checkbox" name="webmention_show_comment_form" id="webmention_show_comment_form" value="1" <?php checked( true, get_option( 'webmention_show_comment_form' ) ); ?> />
<?php esc_html_e( 'Show a Webmention form at the comment section, to allow anyone to notify you of a mention.', 'webmention' ); ?>
</label>
</p>
Expand All @@ -127,23 +127,34 @@
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Avatars', 'webmention' ); ?></th>
<th scope="row"><?php esc_html_e( 'Use Avatars', 'webmention' ); ?></th>
<td>
<fieldset>
<label for="webmention_avatars">
<input type="checkbox" name="webmention_avatars" id="webmention_avatars" value="1" <?php echo checked( true, get_option( 'webmention_avatars', 1 ) ); ?> />
<input type="checkbox" name="webmention_avatars" id="webmention_avatars" value="1" <?php checked( true, get_option( 'webmention_avatars', 1 ) ); ?> />
<?php esc_html_e( 'Show avatars on Webmentions if available.', 'webmention' ); ?>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Store Avatars', 'webmention' ); ?></th>
<td>
<fieldset>
<label for="webmention_avatar_store_enable">
<input type="checkbox" name="webmention_avatar_store_enable" id="webmention_avatar_store_enable" value="1" <?php checked( true, get_option( 'webmention_avatar_store_enable', 0 ) ); ?> />
<?php esc_html_e( 'Enable Local Caching of Avatars.', 'webmention' ); ?>
</label>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Display', 'webmention' ); ?></th>
<td>

<fieldset>
<label for="webmention_separate_comment">
<input type="checkbox" name="webmention_separate_comment" id="webmention_separate_comment" value="1" <?php echo checked( true, get_option( 'webmention_separate_comment', 1 ) ); ?> />
<input type="checkbox" name="webmention_separate_comment" id="webmention_separate_comment" value="1" <?php checked( true, get_option( 'webmention_separate_comment', 1 ) ); ?> />
<?php esc_html_e( 'Separate Webmention Types from Comments.', 'webmention' ); ?>
</label>
</fieldset>
Expand Down
4 changes: 1 addition & 3 deletions webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
defined( 'WEBMENTION_COMMENT_TYPE' ) || define( 'WEBMENTION_COMMENT_TYPE', 'webmention' );
defined( 'WEBMENTION_GRAVATAR_CACHE_TIME' ) || define( 'WEBMENTION_GRAVATAR_CACHE_TIME', WEEK_IN_SECONDS );


defined( 'WEBMENTION_LOCAL_AVATAR_STORE' ) || define( 'WEBMENTION_LOCAL_AVATAR_STORE', false );
defined( 'WEBMENTION_AVATAR_QUALITY' ) || define( 'WEBMENTION_AVATAR_QUALITY', null );
defined( 'WEBMENTION_AVATAR_SIZE' ) || define( 'WEBMENTION_AVATAR_SIZE', 256 );

Expand Down Expand Up @@ -121,7 +119,7 @@ function init() {
add_action( 'init', array( '\Webmention\Discovery', 'init' ) );

// load local avatar store.
if ( WEBMENTION_LOCAL_AVATAR_STORE ) {
if ( 1 === (int) get_option( 'webmention_avatar_store_enable', 0 ) ) {
require_once __DIR__ . '/includes/class-avatar-store.php';
add_action( 'init', array( '\Webmention\Avatar_Store', 'init' ) );
}
Expand Down