diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 6b5cc69..0fedf24 100755 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -12,9 +12,10 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - uses: actions/checkout@v3 + + # Composer Dependencies - name: Validate composer.json and composer.lock run: composer validate --strict - - name: Cache Composer packages id: composer-cache uses: actions/cache@v3 @@ -23,10 +24,10 @@ jobs: key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} - - name: Install dependencies run: composer install --prefer-dist --no-progress --no-dev + # Upload and Package Plugin - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable with: @@ -35,8 +36,7 @@ jobs: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SLUG: integrate-umami - - name: Package for Git Release uses: softprops/action-gh-release@v1 with: - files: ${{ steps.deploy.outputs.zip-path }}/integrate-umami.zip \ No newline at end of file + files: ${{ steps.deploy.outputs.zip-path }}/*.zip \ No newline at end of file diff --git a/css/integrate-umami.css b/css/integrate-umami.css index cde8b5c..6d82bfe 100755 --- a/css/integrate-umami.css +++ b/css/integrate-umami.css @@ -18,7 +18,7 @@ } .integrate-umami-collapsed .toggle-label::after { - display: block; content: "\2795"; + display: block; content: "\2BC6"; position: absolute; right: 10px; top: 3px; transition: all 0.4s; } @@ -29,7 +29,7 @@ } .integrate-umami-collapsed .toggle:checked ~ .toggle-label:after { - content: "\2796"; + content: "\2BC5"; } .integrate-umami-collapsed .toggle-label { diff --git a/inc/class-manager.php b/inc/class-manager.php index 54aa36b..e13db6a 100755 --- a/inc/class-manager.php +++ b/inc/class-manager.php @@ -16,12 +16,18 @@ class Manager { * * @since 0.1.0 * @change 0.2.0 - Add deactivation hook. + * @change 0.6.0 - Add filter for comment form submit button. */ public function __construct() { $options = Options::get_options(); if ( $options['enabled'] && isset( $options['script_url'] ) && isset( $options['website_id'] ) && ! is_admin() ) { if ( ! empty( $options['website_id'] ) && ! empty( $options['script_url'] ) ) { add_action( 'wp_footer', array( $this, 'render_script' ) ); + + if ( isset( $options['track_comments'] ) && $options['track_comments'] === 1 ) { + // Add filters to add event data attributes. + add_filter( 'comment_form_submit_button', array( $this, 'filter_comment_form_submit_button' ), 10, 2 ); + } } } @@ -37,6 +43,18 @@ public static function deactivate() { Options::delete_options(); } + /** + * Filter comment submit button to add data attribute. + * + * @param string $submit_button The submit button. + * @param array $args The arguments. + * + * @since 0.6.0 + */ + public function filter_comment_form_submit_button( string $submit_button, array $args ) { + return str_replace( ' - + - + 0, - 'script_url' => '', - 'host_url' => '', - 'website_id' => '', - 'use_host_url' => 0, - 'ignore_admins' => 1, - 'auto_track' => 1, - 'do_not_track' => 1, - 'cache' => 0, + 'enabled' => 0, + 'script_url' => '', + 'host_url' => '', + 'website_id' => '', + 'use_host_url' => 0, + 'ignore_admins' => 1, + 'auto_track' => 1, + 'do_not_track' => 1, + 'cache' => 0, + 'track_comments' => 0, ) ); } diff --git a/inc/class-settings.php b/inc/class-settings.php index c199b29..90052d8 100755 --- a/inc/class-settings.php +++ b/inc/class-settings.php @@ -47,7 +47,7 @@ public function plugin_actions( array $links ): array { ) ); - $settings_link = "" . __( 'Settings' ) . ''; + $settings_link = "" . __( 'Settings' ) . ''; $links[] = $settings_link; @@ -135,15 +135,16 @@ public function validate_options( array $data ): array { } return array( - 'enabled' => (int) ( $data['enabled'] ?? false ), - 'script_url' => esc_url_raw( $data['script_url'] ), - 'website_id' => sanitize_text_field( $data['website_id'] ), - 'host_url' => esc_url_raw( $data['host_url'] ), - 'use_host_url' => (int) ( $data['use_host_url'] ?? false ), - 'ignore_admins' => (int) ( $data['ignore_admins'] ?? false ), - 'auto_track' => (int) ( $data['auto_track'] ?? false ), - 'do_not_track' => (int) ( $data['do_not_track'] ?? false ), - 'cache' => (int) ( $data['cache'] ?? false ), + 'enabled' => (int) ( $data['enabled'] ?? false ), + 'script_url' => esc_url_raw( $data['script_url'] ), + 'website_id' => sanitize_text_field( $data['website_id'] ), + 'host_url' => esc_url_raw( $data['host_url'] ), + 'use_host_url' => (int) ( $data['use_host_url'] ?? false ), + 'ignore_admins' => (int) ( $data['ignore_admins'] ?? false ), + 'auto_track' => (int) ( $data['auto_track'] ?? false ), + 'do_not_track' => (int) ( $data['do_not_track'] ?? false ), + 'cache' => (int) ( $data['cache'] ?? false ), + 'track_comments' => (int) ( $data['track_comments'] ?? false ), ); } diff --git a/inc/templates/settings-page.php b/inc/templates/settings-page.php index cdd253f..1a17253 100755 --- a/inc/templates/settings-page.php +++ b/inc/templates/settings-page.php @@ -12,15 +12,15 @@ ?>
- + @@ -43,7 +43,7 @@ @@ -60,7 +60,7 @@ + + + + +
- @@ -32,7 +32,7 @@ -

-

-

- - @@ -115,8 +115,8 @@ -
+ + + +
- -