From 2643104160b9f20adb0467d84dbee6f388e46b20 Mon Sep 17 00:00:00 2001 From: nextgenthemes Date: Tue, 26 Jan 2021 16:01:13 +0100 Subject: [PATCH 1/6] Math --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac6a5ee..08630e1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The basics of it is to register a new admin notice. You really need 3 things for There is a handy helper function available for notice registration: `dnh_register_notice()` -This function takes 3 parameters: +This function takes 4 parameters: - `$id` *(string)*: the unique ID of the notice - `$type` *(string)*: the type of notice you want to display. Currently it can be `error` for an error notice or `updated` for a success/update notice @@ -43,7 +43,7 @@ dnh_register_notice( 'my_notice', 'updated', __( 'This is my notice' ) ); ## Advanced Parameters -The function takes an array of optional parameters allowing more control over the notices and how they're dismissed. Only 2 parameters are available so far but hopefully more will be coming soon. +The function takes an array of optional parameters allowing more control over the notices and how they're dismissed. Only 3 parameters are available so far but hopefully more will be coming soon. Hereafter is the list of available parameters to be passed in the `$args` array. Please note that the `$args` parameter is optional. From 38bf813b6627d4f50eb17ff992b7e404222c743a Mon Sep 17 00:00:00 2001 From: Julien Liabeuf Date: Wed, 17 Feb 2021 22:10:53 +0700 Subject: [PATCH 2/6] Add a PR template --- .github/PULL_REQUEST_TEMPLATE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..f9a6f60 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +## Purpose + +_Describe the problem or feature in addition to a link to the issues._ + +## Approach + +_How does this change address the problem?_ + +### Open Questions and Pre-Merge TODOs + +- [ ] Use github checklists. When solved, check the box and explain the answer. From 7bfe0b033c1181790b17fa464cf68b1c9000b3bf Mon Sep 17 00:00:00 2001 From: Julien Liabeuf Date: Wed, 17 Feb 2021 22:26:33 +0700 Subject: [PATCH 3/6] Add contributing guidelines --- CONTRIBUTING.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b542960 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,92 @@ +# Contributing + +When contributing to this repository, please first discuss the change you wish to make via issue, +email, or any other method with the owners of this repository before making a change. + +Please note we have a code of conduct, please follow it in all your interactions with the project. + +## Pull Request Process + +We Use [Gitflow](https://jeffkreeftmeijer.com/git-flow/) so all code changes happen through pull requests. We actively welcome your PRs: + +1. Fork the repo and create your branch from `develop`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. Issue that pull request! **Make sure to use a descriptive title for your PR.** + +## Code of Conduct + +### Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +### Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +### Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers 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, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +### Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +### Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +### Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ \ No newline at end of file From fafe3e754010bf616eeabab861265dcb5998e5a0 Mon Sep 17 00:00:00 2001 From: Julien Liabeuf Date: Wed, 17 Feb 2021 22:31:23 +0700 Subject: [PATCH 4/6] Add a request for the use of tags in PRs --- CONTRIBUTING.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b542960..4f272bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,9 @@ We Use [Gitflow](https://jeffkreeftmeijer.com/git-flow/) so all code changes hap 3. If you've changed APIs, update the documentation. 4. Ensure the test suite passes. 5. Make sure your code lints. -6. Issue that pull request! **Make sure to use a descriptive title for your PR.** +6. Issue that pull request! + - **Make sure to use a descriptive title for your PR.** + - Make use of the available labels to identify the type of PR that you're opening ## Code of Conduct From 916036a945fa7840c44a64a7f89e3595b6d00427 Mon Sep 17 00:00:00 2001 From: nextgenthemes Date: Wed, 17 Feb 2021 16:42:53 +0100 Subject: [PATCH 5/6] Wrap functions inside a declaration check --- includes/helper-functions.php | 122 ++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index c13c123..a44357a 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -27,85 +27,89 @@ * @return object Dismissible_Notices_Handler */ -if ( function_exists( 'DNH' ) ) { - return; -} - -function DNH() { - return Dismissible_Notices_Handler::instance(); -} - -/** - * Register a new notice - * - * @since 1.0 - * - * @param string $id Notice ID, used to identify it - * @param string $type Type of notice to display - * @param string $content Notice content - * @param array $args Additional parameters - * - * @return bool - */ -function dnh_register_notice( $id, $type, $content, $args = array() ) { - - if ( ! function_exists( 'DNH' ) ) { - return false; +if ( ! function_exists( 'DNH' ) ) { + function DNH() { + return Dismissible_Notices_Handler::instance(); } +} +if ( ! function_exists( 'dnh_register_notice' ) ) { /** - * Get the library running + * Register a new notice + * + * @since 1.0 + * + * @param string $id Notice ID, used to identify it + * @param string $type Type of notice to display + * @param string $content Notice content + * @param array $args Additional parameters + * + * @return bool */ - DNH(); + function dnh_register_notice( $id, $type, $content, $args = array() ) { - return DNH()->register_notice( $id, $type, $content, $args ); + if ( ! function_exists( 'DNH' ) ) { + return false; + } -} + /** + * Get the library running + */ + DNH(); -/** - * Restore a previously dismissed notice - * - * @since 1.0 - * - * @param string $id ID of the notice to restore - * - * @return bool - */ -function dnh_restore_notice( $id ) { + return DNH()->register_notice( $id, $type, $content, $args ); - if ( ! function_exists( 'DNH' ) ) { - return false; } +} +if ( ! function_exists( 'dnh_restore_notice' ) ) { /** - * Get the library running + * Restore a previously dismissed notice + * + * @since 1.0 + * + * @param string $id ID of the notice to restore + * + * @return bool */ - DNH(); + function dnh_restore_notice( $id ) { - return DNH()->restore_notice( $id ); + if ( ! function_exists( 'DNH' ) ) { + return false; + } -} + /** + * Get the library running + */ + DNH(); -/** - * Check if a notice has been dismissed - * - * @since 1.0 - * - * @param string $id ID of the notice to check - * - * @return bool - */ -function dnh_is_dismissed( $id ) { + return DNH()->restore_notice( $id ); - if ( ! function_exists( 'DNH' ) ) { - return false; } +} +if ( ! function_exists( 'dnh_is_dismissed' ) ) { /** - * Get the library running + * Check if a notice has been dismissed + * + * @since 1.0 + * + * @param string $id ID of the notice to check + * + * @return bool */ - DNH(); + function dnh_is_dismissed( $id ) { - return DNH()->is_dismissed( $id ); + if ( ! function_exists( 'DNH' ) ) { + return false; + } + /** + * Get the library running + */ + DNH(); + + return DNH()->is_dismissed( $id ); + + } } From 75be646f860abbf4fe348e7787d255723c96a76c Mon Sep 17 00:00:00 2001 From: Julien Liabeuf Date: Wed, 17 Feb 2021 22:45:16 +0700 Subject: [PATCH 6/6] Bump version number --- handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler.php b/handler.php index d6d3a88..c736db6 100644 --- a/handler.php +++ b/handler.php @@ -35,7 +35,7 @@ final class Dismissible_Notices_Handler { * @since 1.0 * @var string */ - public $version = '1.2.1'; + public $version = '1.2.2'; /** * Required version of PHP.