Skip to content

Commit 21a469c

Browse files
authored
Merge branch 'main' into webmentionopen
2 parents 43ecf97 + 1491c6b commit 21a469c

File tree

6 files changed

+44
-18
lines changed

6 files changed

+44
-18
lines changed

.github/workflows/wp-phpunit.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: WordPress Unit Testing
22
on:
3-
push:
4-
pull_request:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
57
jobs:
68
phpunit:
79
runs-on: ubuntu-latest
@@ -23,8 +25,12 @@ jobs:
2325
- wp-version: '6.5'
2426
php-versions: '7.1'
2527
steps:
28+
- name: Install svn
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install subversion
2632
- name: Checkout
27-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
2834
- name: Setup PHP
2935
uses: shivammathur/setup-php@v2
3036
with:

includes/class-admin.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ public static function register_settings() {
417417
'default' => 1,
418418
)
419419
);
420+
register_setting(
421+
'webmention',
422+
'webmention_avatar_store_enable',
423+
array(
424+
'type' => 'int',
425+
'description' => esc_html__( 'Store Avatars Locally', 'webmention' ),
426+
'show_in_rest' => true,
427+
'default' => 0,
428+
)
429+
);
420430
register_setting(
421431
'webmention',
422432
'webmention_separate_comment',

templates/webmention-comment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><time datetime="<?php comment_time( 'c' ); ?>" class="dt-published dt-updated published updated">
6565
<?php
6666
/* translators: 1: date, 2: time */
67-
printf( esc_html__( '%1$s at %2$s', 'webmention' ), get_comment_date(), get_comment_time() ); ?>
67+
printf( esc_html__( '%1$s at %2$s', 'webmention' ), get_comment_date(), get_comment_time() );
68+
?>
6869
</time></a>
6970
<ul>
7071
<?php if ( $target ) { ?>

templates/webmention-comments.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
$mentions = get_comments(
33
array(
4-
'post_id' => get_the_ID(),
5-
'type__in' => get_webmention_comment_type_names(),
6-
'status' => 'approve',
4+
'post_id' => get_the_ID(),
5+
'type__in' => get_webmention_comment_type_names(),
6+
'status' => 'approve',
77
)
88
);
99

templates/webmention-settings.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@
1414
<td>
1515
<fieldset>
1616
<label for="webmention_disable_selfpings_same_url">
17-
<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' ) ); ?> />
17+
<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' ) ); ?> />
1818
<?php esc_html_e( 'Disable self-pings on the same URL', 'webmention' ); ?>
1919
<p class="description"><?php esc_html_e( '(for example "http://example.com/?p=123")', 'webmention' ); ?></p>
2020
</label>
2121

2222
<br />
2323

2424
<label for="webmention_disable_selfpings_same_domain">
25-
<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' ) ); ?> />
25+
<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' ) ); ?> />
2626
<?php esc_html_e( 'Disable self-pings on the same Domain', 'webmention' ); ?>
2727
<p class="description"><?php esc_html_e( '(for example "example.com")', 'webmention' ); ?></p>
2828
</label>
2929

3030
<br />
3131

3232
<label for="webmention_disable_media_mentions">
33-
<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' ) ); ?> />
33+
<input type="checkbox" name="webmention_disable_media_mentions" id="webmention_disable_media_mentions" value="1" <?php checked( true, get_option( 'webmention_disable_media_mentions' ) ); ?> />
3434
<?php esc_html_e( 'Disable sending Webmentions for media links (image, video, audio)', 'webmention' ); ?>
3535
</label>
3636
</fieldset>
@@ -57,7 +57,7 @@
5757
<?php foreach ( $post_types as $post_type ) { ?>
5858
<li>
5959
<label for="webmention_support_post_types_<?php echo esc_attr( $post_type->name ); ?>">
60-
<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 ) ); ?> />
60+
<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 ) ); ?> />
6161
<?php echo esc_html( $post_type->label ); ?>
6262
</label>
6363
</li>
@@ -110,7 +110,7 @@
110110
<fieldset>
111111
<p>
112112
<label for="webmention_show_comment_form">
113-
<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' ) ); ?> />
113+
<input type="checkbox" name="webmention_show_comment_form" id="webmention_show_comment_form" value="1" <?php checked( true, get_option( 'webmention_show_comment_form' ) ); ?> />
114114
<?php esc_html_e( 'Show a Webmention form at the comment section, to allow anyone to notify you of a mention.', 'webmention' ); ?>
115115
</label>
116116
</p>
@@ -127,23 +127,34 @@
127127
</td>
128128
</tr>
129129
<tr>
130-
<th scope="row"><?php esc_html_e( 'Avatars', 'webmention' ); ?></th>
130+
<th scope="row"><?php esc_html_e( 'Use Avatars', 'webmention' ); ?></th>
131131
<td>
132132
<fieldset>
133133
<label for="webmention_avatars">
134-
<input type="checkbox" name="webmention_avatars" id="webmention_avatars" value="1" <?php echo checked( true, get_option( 'webmention_avatars', 1 ) ); ?> />
134+
<input type="checkbox" name="webmention_avatars" id="webmention_avatars" value="1" <?php checked( true, get_option( 'webmention_avatars', 1 ) ); ?> />
135135
<?php esc_html_e( 'Show avatars on Webmentions if available.', 'webmention' ); ?>
136136
</label>
137137
</fieldset>
138138
</td>
139139
</tr>
140+
<tr>
141+
<th scope="row"><?php esc_html_e( 'Store Avatars', 'webmention' ); ?></th>
142+
<td>
143+
<fieldset>
144+
<label for="webmention_avatar_store_enable">
145+
<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 ) ); ?> />
146+
<?php esc_html_e( 'Enable Local Caching of Avatars.', 'webmention' ); ?>
147+
</label>
148+
</fieldset>
149+
</td>
150+
</tr>
140151
<tr>
141152
<th scope="row"><?php esc_html_e( 'Display', 'webmention' ); ?></th>
142153
<td>
143154

144155
<fieldset>
145156
<label for="webmention_separate_comment">
146-
<input type="checkbox" name="webmention_separate_comment" id="webmention_separate_comment" value="1" <?php echo checked( true, get_option( 'webmention_separate_comment', 1 ) ); ?> />
157+
<input type="checkbox" name="webmention_separate_comment" id="webmention_separate_comment" value="1" <?php checked( true, get_option( 'webmention_separate_comment', 1 ) ); ?> />
147158
<?php esc_html_e( 'Separate Webmention Types from Comments.', 'webmention' ); ?>
148159
</label>
149160
</fieldset>

webmention.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
defined( 'WEBMENTION_COMMENT_TYPE' ) || define( 'WEBMENTION_COMMENT_TYPE', 'webmention' );
2424
defined( 'WEBMENTION_GRAVATAR_CACHE_TIME' ) || define( 'WEBMENTION_GRAVATAR_CACHE_TIME', WEEK_IN_SECONDS );
2525

26-
27-
defined( 'WEBMENTION_LOCAL_AVATAR_STORE' ) || define( 'WEBMENTION_LOCAL_AVATAR_STORE', false );
2826
defined( 'WEBMENTION_AVATAR_QUALITY' ) || define( 'WEBMENTION_AVATAR_QUALITY', null );
2927
defined( 'WEBMENTION_AVATAR_SIZE' ) || define( 'WEBMENTION_AVATAR_SIZE', 256 );
3028

@@ -127,7 +125,7 @@ function init() {
127125
}
128126

129127
// load local avatar store.
130-
if ( WEBMENTION_LOCAL_AVATAR_STORE ) {
128+
if ( 1 === (int) get_option( 'webmention_avatar_store_enable', 0 ) ) {
131129
require_once __DIR__ . '/includes/class-avatar-store.php';
132130
add_action( 'init', array( '\Webmention\Avatar_Store', 'init' ) );
133131
}

0 commit comments

Comments
 (0)