Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit f6d4b6c

Browse files
authored
Merge pull request #109 from dshanske/templates
Add Settings to Disable Facepile Code
2 parents 1049049 + 2599d22 commit f6d4b6c

File tree

4 files changed

+51
-10
lines changed

4 files changed

+51
-10
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
**Donate link:** http://14101978.de
44
**Tags:** webmention, pingback, trackback, linkback, microformats, comments, indieweb
55
**Requires at least:** 4.7.1
6-
**Tested up to:** 4.8
7-
**Stable tag:** 3.4.1
6+
**Requires PHP:** 5.3
7+
**Tested up to:** 4.8.2
8+
**Stable tag:** 3.5.0
89
**License:** MIT
910
**License URI:** http://opensource.org/licenses/MIT
1011

@@ -53,6 +54,12 @@ The Webmention and Pingback logos are made by [Aaron Parecki](http://aaronpareck
5354

5455
Project actively developed on Github at [pfefferle/wordpress-semantic-linkbacks](https://github.com/pfefferle/wordpress-semantic-linkbacks). Please file support issues there.
5556

57+
### 3,5.0 ###
58+
* Add Facepile code
59+
* Add setting to disable automatic facepile include
60+
* Add filter to allow themes to disable the setting and the feature if they facepile themselves
61+
* Add PHP requirement to readme file
62+
5663
### 3.4.1 ###
5764
* Abstract out linkback retrieval functions to allow for easier changes in future
5865
* Fix retrieval issue

includes/class-linkbacks-handler.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ public static function init() {
3333
add_filter( 'get_avatar_comment_types', array( 'Linkbacks_Handler', 'get_avatar_comment_types' ) );
3434
add_filter( 'comment_class', array( 'Linkbacks_Handler', 'comment_class' ), 10, 4 );
3535

36-
add_filter( 'wp_list_comments_args', array( 'Linkbacks_Handler', 'filter_comment_args' ) );
37-
add_action( 'comment_form_before', array( 'Linkbacks_Handler', 'show_mentions' ) );
36+
if ( 1 == get_option( 'semantic_linkbacks_facepiles' ) ) {
37+
add_filter( 'wp_list_comments_args', array( 'Linkbacks_Handler', 'filter_comment_args' ) );
38+
add_action( 'comment_form_before', array( 'Linkbacks_Handler', 'show_mentions' ) );
39+
}
3840

3941
// Register Meta Keys
4042
self::register_meta();
@@ -58,7 +60,10 @@ public static function filter_comment_args( $args ) {
5860
*
5961
*/
6062
public static function show_mentions() {
61-
load_template( plugin_dir_path( dirname( __FILE__ ) ) . 'templates/linkbacks.php' );
63+
// If this filter is set to false then hide the template and hide the option. This should be used by themes
64+
if ( apply_filters( 'semantic_linkbacks_facepile', true ) ) {
65+
load_template( plugin_dir_path( dirname( __FILE__ ) ) . 'templates/linkbacks.php' );
66+
}
6267
}
6368

6469
/**

readme.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ Contributors: pfefferle, dshanske
33
Donate link: http://14101978.de
44
Tags: webmention, pingback, trackback, linkback, microformats, comments, indieweb
55
Requires at least: 4.7.1
6-
Tested up to: 4.8
7-
Stable tag: 3.4.1
6+
Requires PHP: 5.3
7+
Tested up to: 4.8.2
8+
Stable tag: 3.5.0
89
License: MIT
910
License URI: http://opensource.org/licenses/MIT
1011

@@ -53,6 +54,12 @@ The Webmention and Pingback logos are made by [Aaron Parecki](http://aaronpareck
5354

5455
Project actively developed on Github at [pfefferle/wordpress-semantic-linkbacks](https://github.com/pfefferle/wordpress-semantic-linkbacks). Please file support issues there.
5556

57+
= 3,5.0 =
58+
* Add Facepile code
59+
* Add setting to disable automatic facepile include
60+
* Add filter to allow themes to disable the setting and the feature if they facepile themselves
61+
* Add PHP requirement to readme file
62+
5663
= 3.4.1 =
5764
* Abstract out linkback retrieval functions to allow for easier changes in future
5865
* Fix retrieval issue

semantic-linkbacks.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Semantic Linkbacks for WebMentions, Trackbacks and Pingbacks
66
* Author: Matthias Pfefferle
77
* Author URI: https://notiz.blog/
8-
* Version: 3.4.1
8+
* Version: 3.5.0
99
* License: MIT
1010
* License URI: http://opensource.org/licenses/MIT
1111
* Text Domain: semantic-linkbacks
@@ -30,7 +30,7 @@ function semantic_linkbacks_activation() {
3030
* @author Matthias Pfefferle
3131
*/
3232
class Semantic_Linkbacks_Plugin {
33-
public static $version = '3.4.1';
33+
public static $version = '3.5.0';
3434
/**
3535
* Initialize the plugin, registering WordPress hooks.
3636
*/
@@ -54,8 +54,22 @@ public static function init() {
5454

5555
remove_filter( 'webmention_comment_data', array( 'Webmention_Receiver', 'default_title_filter' ), 21 );
5656
remove_filter( 'webmention_comment_data', array( 'Webmention_Receiver', 'default_content_filter' ), 22 );
57-
5857
self::plugin_textdomain();
58+
59+
register_setting( 'discussion', 'semantic_linkbacks_facepiles', array(
60+
'type' => 'boolean',
61+
'description' => __( 'Automatically Create Facepiles', 'semantic-linkbacks' ),
62+
'show_in_rest' => true,
63+
'default' => 1,
64+
) );
65+
66+
// initialize admin settings
67+
add_action( 'admin_init', array( 'Semantic_Linkbacks_Plugin', 'admin_init' ) );
68+
69+
}
70+
71+
public static function admin_init() {
72+
add_settings_field( 'semantic_linkbacks_discussion_settings', __( 'Semantic Linkbacks Settings', 'webmention' ), array( 'Semantic_Linkbacks_Plugin', 'discussion_settings' ), 'discussion', 'default' );
5973
}
6074

6175
/**
@@ -66,6 +80,14 @@ public static function plugin_textdomain() {
6680
load_plugin_textdomain( 'semantic-linkbacks', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
6781
}
6882

83+
/**
84+
* Add Semantic Linkbacks options to the WordPress discussion settings page.
85+
*/
86+
public static function discussion_settings() {
87+
load_template( plugin_dir_path( __FILE__ ) . 'templates/semantic-linkbacks-discussion-settings.php' );
88+
}
89+
90+
6991
public static function style_load() {
7092
wp_enqueue_style( 'semantic-linkbacks-css', plugin_dir_url( __FILE__ ) . 'css/semantic-linkbacks.css', array(), self::$version );
7193
}

0 commit comments

Comments
 (0)