Skip to content

Commit

Permalink
move default types to object property
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Feb 23, 2025
1 parent d0692e4 commit b075cf3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions includes/class-webmention.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class Webmention {
*/
const TEXT_DOMAIN = 'webmention';

/**
* Default post types.
*
* @var array
*/
private $default_post_types = array( 'post', 'page' );

/**
* Get the instance of the class.
*
Expand Down Expand Up @@ -55,6 +62,7 @@ public function init() {

$this->register_hooks();
$this->register_admin_hooks();

$this->add_post_type_support();

// Load language files.
Expand Down Expand Up @@ -127,7 +135,7 @@ public function register_admin_hooks() {
*/
public function add_post_type_support() {
// Add support for Webmentions to custom post types.
$post_types = get_option( 'webmention_support_post_types', array( 'post', 'page' ) ) ? get_option( 'webmention_support_post_types', array( 'post', 'page' ) ) : array();
$post_types = get_option( 'webmention_support_post_types', $this->default_post_types ) ? get_option( 'webmention_support_post_types', $this->default_post_types ) : array();

foreach ( $post_types as $post_type ) {
add_post_type_support( $post_type, 'webmentions' );
Expand All @@ -137,7 +145,7 @@ public function add_post_type_support() {
/**
* Register constants.
*/
private function register_constants() {
public function register_constants() {
\defined( 'WEBMENTION_ALWAYS_SHOW_HEADERS' ) || \define( 'WEBMENTION_ALWAYS_SHOW_HEADERS', 0 );
\defined( 'WEBMENTION_COMMENT_APPROVE' ) || \define( 'WEBMENTION_COMMENT_APPROVE', 0 );
\defined( 'WEBMENTION_COMMENT_TYPE' ) || \define( 'WEBMENTION_COMMENT_TYPE', 'webmention' );
Expand Down

0 comments on commit b075cf3

Please sign in to comment.