Skip to content

Commit 45e2c08

Browse files
authored
Merge pull request #205 from pfefferle/julfixes
Julfixes
2 parents 2dc5840 + c1830c9 commit 45e2c08

10 files changed

+116
-103
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"phpunit/phpunit": "5.5.*",
2121
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
2222
"squizlabs/php_codesniffer": "^3.4",
23-
"phpcompatibility/php-compatibility": "^9.1",
23+
"phpcompatibility/php-compatibility": "^9.2",
2424
"wp-coding-standards/wpcs": "^2.0",
25-
"phpcompatibility/phpcompatibility-wp": "^2.0"
25+
"phpcompatibility/phpcompatibility-wp": "^2.0.0"
2626
},
2727
"scripts": {
2828
"test": [
@@ -32,7 +32,7 @@
3232
],
3333
"lint": "phpcs",
3434
"install-codestandards": [
35-
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
35+
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run"
3636
]
3737
}
3838
}

includes/class-webmention-admin.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public static function init() {
2323
add_filter( 'manage_edit-comments_columns', array( 'Webmention_Admin', 'comment_columns' ) );
2424
add_filter( 'manage_comments_custom_column', array( 'Webmention_Admin', 'manage_comments_custom_column' ), 10, 2 );
2525

26-
// Webmention whitelist
27-
add_filter( 'webmention_comment_data', array( 'Webmention_Admin', 'auto_approve' ), 13, 1 );
2826
add_filter( 'comment_row_actions', array( 'Webmention_Admin', 'comment_row_actions' ), 13, 2 );
2927
add_filter( 'comment_unapproved_to_approved', array( 'Webmention_Admin', 'transition_to_whitelist' ), 10 );
3028

includes/class-webmention-receiver.php

+2-12
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static function init() {
3333
add_filter( 'webmention_comment_data', array( 'Webmention_Receiver', 'default_title_filter' ), 21, 1 );
3434
add_filter( 'webmention_comment_data', array( 'Webmention_Receiver', 'default_content_filter' ), 22, 1 );
3535

36+
add_filter( 'webmention_comment_data', array( 'Webmention_Receiver', 'auto_approve', 13, 1 ) );
37+
3638
// Allow for avatars on webmention comment types
3739
if ( 0 !== (int) get_option( 'webmention_avatars', 1 ) ) {
3840
add_filter( 'get_avatar_comment_types', array( 'Webmention_Receiver', 'get_avatar_comment_types' ), 99 );
@@ -730,18 +732,6 @@ public static function default_content_filter( $commentdata ) {
730732
return $commentdata;
731733
}
732734

733-
/**
734-
* Marks the post as "no webmentions sent yet"
735-
*
736-
* @param int $post_id
737-
*/
738-
public static function publish_post_hook( $post_id ) {
739-
// check if pingbacks are enabled
740-
if ( get_option( 'default_pingback_flag' ) ) {
741-
add_post_meta( $post_id, '_mentionme', '1', true );
742-
}
743-
}
744-
745735
/**
746736
* Delete comment if source returns error 410 or 452
747737
*

includes/class-webmention-sender.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ public static function init() {
3535
* @param int $post_id
3636
*/
3737
public static function publish_hook( $post_id ) {
38-
// check if pingbacks are enabled
39-
if ( get_option( 'default_pingback_flag' ) ) {
40-
add_post_meta( $post_id, '_mentionme', '1', true );
41-
}
38+
add_post_meta( $post_id, '_mentionme', '1', true );
4239
}
4340

4441
/**

includes/functions.php

+17
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,20 @@ function wp_get_meta_tags( $source_content ) {
252252
return $meta_tags;
253253
}
254254
endif;
255+
256+
257+
/* Backward compatibility for function available in version 5.1 and above */
258+
if ( ! function_exists( 'is_avatar_comment_type' ) ) :
259+
function is_avatar_comment_type( $comment_type ) {
260+
/**
261+
* Filters the list of allowed comment types for retrieving avatars.
262+
*
263+
* @since 3.0.0
264+
*
265+
* @param array $types An array of content types. Default only contains 'comment'.
266+
*/
267+
$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
268+
269+
return in_array( $comment_type, (array) $allowed_comment_types, true );
270+
}
271+
endif;

0 commit comments

Comments
 (0)