Skip to content

Commit

Permalink
Merge branch 'trunk'
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevalk committed Jan 1, 2024
2 parents 4490e2b + fb4df11 commit d5b435c
Show file tree
Hide file tree
Showing 19 changed files with 365 additions and 53 deletions.
120 changes: 120 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
https://joost.blog/contact-me/ .

All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/),
version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
48 changes: 48 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contribution Guidelines

Before filing a bug report or a feature request, be sure to read the contribution guidelines.

## How to use GitHub
We use GitHub exclusively for well-documented bugs, feature requests and code contributions. Communication is always done in English.

To receive free support for this plugin, go to [the support formus](https://wordpress.org/support/plugin/yoast-comment-hacks/). Thanks for your understanding.

## Security issues
Please do not report security issues here. Instead, report them per our [security policy](https://github.com/jdevalk/comment-hacks/security/policy).

## I have found a bug
Before opening a new issue, please:
* update to the newest versions of WordPress, Yoast SEO and the PDF XML sitemap plugins.
* search for duplicate issues to prevent opening a duplicate issue. If there is already an open existing issue, please comment on that issue.
* follow our _New issue_ template when creating a new issue.
* add as much information as possible. For example: add screenshots, relevant links, step by step guides etc.

## I have a feature request
Before opening a new issue, please:
* search for duplicate issues to prevent opening a duplicate feature request. If there is already an open existing request, please leave a comment there.
* add as much information as possible. For example: give us a clear explanation of why you think the feature request is something we should consider for the plugin.

## I want to create a patch
Community made patches, localizations, bug reports and contributions are very welcome and help us tremendously.

When contributing please ensure you follow the guidelines below so that we can keep on top of things.

#### Submitting an issue you found
Make sure your problem does not exist as a ticket already by searching through [the existing issues](https://github.com/jdevalk/comment-hacks/issues/). If you cannot find anything which resembles your problem, please [create a new issue](https://github.com/jdevalk/comment-hacks/issues/new).

#### Fixing an issue

* Fork the repository on GitHub (make sure to use the `develop` branch).
* Make the changes to your forked repository.
* Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) and you properly document any new functions, actions and filters following the [documentation standards](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/).
* When committing, reference your issue and include a note about the fix.
* Push the changes to your fork and submit a pull request to the `develop` branch of the Accessibility Checker repository.

We will review your pull request and merge when everything is in order. We will help you to make sure the code complies with the standards described above.

#### 'Patch welcome' issues
Some issues are labeled 'patch-welcome'. This means we see the value in the particular enhancement being suggested but have decided for now not to prioritize it. If you however decide to write a patch for it, we'll gladly include it after some code review.

#### Additional Resources
* [General GitHub Documentation](https://help.github.com/)
* [GitHub Pull Request documentation](https://help.github.com/send-pull-requests/)
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug report
about: Create a report to help us improve
assignees:
- jdevalk

---

<!-- Please use this template when creating an issue.
- Please check the boxes after you've created your issue.
- Please use the latest version of the plugin.-->

* [ ] I've read and understood the [contribution guidelines](https://github.com/jdevalk/pdf-xml-sitemap/blob/main/.github/CONTRIBUTING.md).
* [ ] I've searched for any related issues and avoided creating a duplicate issue.

### Please give us a description of what happened

### To Reproduce
#### Step-by-step reproduction instructions
1.
2.
3.

#### Expected results
1.

#### Actual results
1.


### Screenshots, screen recording, code snippet
If possible, please provide a screenshot, a screen recording or a code snippet which demonstrates the bug.

### Technical info


#### Used versions
* Device you are using:
* Operating system:
* PHP version:
* WordPress version:
* WordPress Theme:
* Plugin version:
* Relevant plugins in case of a bug:
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
assignees:
- jdevalk

---

<!-- Before opening a new issue, please search for duplicate issues to prevent opening a duplicate feature request. If there is already an open existing request, please leave a comment there. -->

## Is your feature request related to a problem? Please describe.

## Describe the solution you'd like

## Why do you think this feature is something we should consider for this plugin?

## Additional context
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
21 changes: 21 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Reporting a Vulnerability

You can report any security bugs found in the source code of this plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/yoast-comment-hacks). The Patchstack team will assist you with verification, CVE assignment and take care of notifying the developers of this plugin.

## Responding to Vulnerability Reports

I take security bugs very seriously. I appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions. Patchstack will work with you and me to deal with the security issue as best as possible.

## Disclosing a Vulnerability

Once an issue is reported, I will use the following disclosure process:

- When a report is received, I confirm the issue and determine its severity together with Patchstack.
- If we know of specific third-party services or software that require mitigation before publication, those projects will be notified.
- An advisory is prepared (but not published) which details the problem and steps for mitigation.
- Patch releases are published and the advisory is published.
- Release notes and our readme.txt will include a `Security` section with a link to the advisory.

We credit reporters for identifying vulnerabilities, although we will keep your name confidential if you request it.
2 changes: 1 addition & 1 deletion .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# The ubuntu images come with Node, npm and yarn pre-installed.
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md

# This action also handles the caching of the Yarn dependencies.
# https://github.com/actions/setup-node
- name: Set up node and enable caching of dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '14'
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

# This action checks the `composer.lock` file against known security vulnerabilities in the dependencies.
# https://github.com/marketplace/actions/the-php-security-checker
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
20 changes: 13 additions & 7 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use WP_Comment;
use WP_Post;
use JoostBlog\WP\Comment\Inc\Hacks;
use Yoast_I18n_WordPressOrg_v3;
use JoostBlog\WP\Comment\Inc\Comment_Parent;

/**
* Admin handling class.
Expand Down Expand Up @@ -52,7 +52,7 @@ public function __construct() {

// Filter the comment notification recipients.
\add_action( 'add_meta_boxes', [ $this, 'register_meta_boxes' ] );
\add_action( 'save_post', [ $this, 'save_reroute_comment_emails' ] );
\add_action( 'pre_post_update', [ $this, 'save_reroute_comment_emails' ] );

\add_filter( 'comment_row_actions', [ $this, 'forward_to_support_action_link' ], 10, 2 );
\add_action( 'admin_head', [ $this, 'forward_comment' ] );
Expand Down Expand Up @@ -177,6 +177,7 @@ public function register_meta_boxes(): void {
* @param WP_Post $post Current post object.
*/
public function meta_box_callback( $post ): void {
echo '<input type="hidden" name="comment_notification_recipient_nonce" value="' . \esc_attr( \wp_create_nonce( 'comment_notification_recipient_nonce' ) ) . '" />';
echo '<label for="comment_notification_recipient">' . \esc_html__( 'Comment notification recipients:', 'yoast-comment-hacks' ) . '</label><br/>';

/**
Expand Down Expand Up @@ -224,7 +225,7 @@ public function meta_box_callback( $post ): void {
}

/**
* Register the text domain and the options array along with the validation function.
* Register the options array along with the validation function.
*/
public function init(): void {
// Register our option array.
Expand Down Expand Up @@ -269,13 +270,17 @@ public function enqueue(): void {

/**
* Saves the comment email recipients post meta.
*
* @param int $post_id The post ID.
*/
public function save_reroute_comment_emails(): void {
public function save_reroute_comment_emails( $post_id ): void {

$post_id = \filter_input( \INPUT_POST, 'ID', \FILTER_VALIDATE_INT );
$recipient_id = \filter_input( \INPUT_POST, 'comment_notification_recipient', \FILTER_VALIDATE_INT );
if ( ! isset( $_POST['comment_notification_recipient'] ) || ! \wp_verify_nonce( \filter_input( \INPUT_POST, 'comment_notification_recipient_nonce' ), 'comment_notification_recipient_nonce' ) ) {
return;
}

if ( $recipient_id && $post_id ) {
$recipient_id = (int) \sanitize_key( \wp_unslash( $_POST['comment_notification_recipient'] ) );
if ( $recipient_id > 0 ) {
\update_post_meta( $post_id, self::NOTIFICATION_RECIPIENT_KEY, $recipient_id );
}
}
Expand Down Expand Up @@ -303,6 +308,7 @@ public function options_validate( array $input ): array {
break;
case 'comment_policy':
case 'clean_emails':
case 'disable_email_all_commenters':
$input[ $key ] = $this->sanitize_bool( $value );
break;
case 'email_subject':
Expand Down
Loading

0 comments on commit d5b435c

Please sign in to comment.