diff --git a/.github/workflows/wp-phpunit.yml b/.github/workflows/wp-phpunit.yml index da84703..35e6717 100644 --- a/.github/workflows/wp-phpunit.yml +++ b/.github/workflows/wp-phpunit.yml @@ -1,7 +1,9 @@ name: WordPress Unit Testing on: - push: - pull_request: + push: + branches: + - main + pull_request: jobs: phpunit: runs-on: ubuntu-latest @@ -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: diff --git a/includes/class-admin.php b/includes/class-admin.php index e38cbad..c4601a1 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -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', diff --git a/templates/webmention-settings.php b/templates/webmention-settings.php index b7c7d07..3ccb783 100644 --- a/templates/webmention-settings.php +++ b/templates/webmention-settings.php @@ -14,7 +14,7 @@
@@ -22,7 +22,7 @@
@@ -30,7 +30,7 @@
@@ -57,7 +57,7 @@
  • @@ -110,7 +110,7 @@

    @@ -127,23 +127,34 @@ - +
    + + + +
    + +
    + +
    diff --git a/webmention.php b/webmention.php index a9e6083..f6fa26a 100755 --- a/webmention.php +++ b/webmention.php @@ -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 ); @@ -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' ) ); }