-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
419 additions
and
815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# How to Contribute | ||
|
||
Thank you for taking the time to contribute to our project. We're thrilled to share our work with you and hope you'll enjoy sharing your work with us! Here's a bunch of useful information for you to start. | ||
|
||
## Gitflow | ||
|
||
We use [Gitflow](https://danielkummer.github.io/git-flow-cheatsheet/) on each of our projects. According to the basic assumptions of this workflow, here are the steps that you need to take when developing a new feature: | ||
|
||
1. Create a new branch from `develop` | ||
2. Work on this branch until your feature is finished | ||
3. Rebase your branch onto current `develop` | ||
4. Create a Pull Request and wait for the Code Review | ||
5. Iterate with all needed changes and fixes | ||
6. Enjoy your branch being merged once accepted | ||
|
||
### Branch names | ||
|
||
Typically, branches are named after the developed feature, i.e. `feature/Name-of-the-Feature` and so we do. | ||
|
||
## Conventional Commits | ||
|
||
We're following the rule of [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). | ||
|
||
A well-formed git commit description line should always be able to complete the following sentence: | ||
> When applied, this commit should *\<your description line here\>* | ||
## Pull Requests | ||
|
||
When you're done with developing your feature, you should create a [Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) and wait for your code to be reviewed. Once all the changes and fixes will be applied, the PR will be merged into the develop branch. | ||
|
||
### PR size | ||
|
||
Create PRs as small as they can possibly be. Create as much of them as you need. This makes them easier to review and less likely to cause serious merge conflicts. | ||
|
||
## Changelog | ||
|
||
We appreciate it if you keep the changelog for every change. | ||
|
||
Changelog usually lives in `readme.txt` files when it comes to a plugin, or it is in `CHANGELOG.md`. New sections (unreleased changes) can be marked as `8.0.12`. It will be changed to the next version number when a new version is released. | ||
|
||
*** | ||
|
||
And that's it for the basic information you need. Thanks! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* CheckRestApi class | ||
* | ||
* @package notification | ||
*/ | ||
|
||
namespace BracketSpace\Notification\Admin; | ||
|
||
use BracketSpace\Notification\Dependencies\Micropackage\DocHooks\HookTrait; | ||
|
||
/** | ||
* CheckRestApi class | ||
*/ | ||
class CheckRestApi { | ||
|
||
/** | ||
* Method sends request to API, based on response checks whether REST API works correctly | ||
* | ||
* @since 8.0.12 | ||
* @action admin_notices | ||
* @return void | ||
*/ | ||
public function test_rest_api() { | ||
$response = wp_remote_get( get_rest_url( null, 'notification/v1/check/' ) ); | ||
$message = json_decode( wp_remote_retrieve_body( $response ), true ); | ||
|
||
$is_available = false; | ||
$is_edit = false; | ||
|
||
if ( array_key_exists( 'data', $message ) ) { | ||
$is_available = 'RestApi' === $message['data']; | ||
} | ||
|
||
$current_screen = get_current_screen(); | ||
|
||
if ( $current_screen instanceof \WP_Screen ) { | ||
$is_edit = 'post' === $current_screen->base && 'notification' === $current_screen->post_type; | ||
} | ||
|
||
if ( ! $is_available && $is_edit ) { | ||
$class = 'notice notice-error'; | ||
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), 'The Notification plugin requires enabled REST API endpoint: notification/v1/. Please ensure your WP REST API works correctly.' ); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.