Skip to content

Commit

Permalink
Remove filter and replace with hook instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
dshanske authored and snarfed committed Aug 25, 2018
1 parent 10092b2 commit ef76125
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions micropub.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function load_micropub_auth() {
if ( class_exists( 'IndieAuth_Plugin' ) ) {
return;
}
// Set this filter to false to disable built in authorization
if ( apply_filters( 'enable_micropub_auth', (0 === MICROPUB_LOCAL_AUTH ) ) ) {
// If this configuration option is set to 0 then load this file
if ( 0 === MICROPUB_LOCAL_AUTH ) {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-micropub-authorize.php';

}
Expand Down
15 changes: 7 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Supports the following [scope](https://indieweb.org/scope) parameters requested


### Filters and hooks
Adds seven filters:
Adds six filters:

`before_micropub( $input )`

Expand All @@ -49,11 +49,6 @@ Called to generate the list of `syndicate-to` targets to return in response to a

$resp defaults to null. If the return value is non-null, it should be an associative array that is encoded as JSON and will be returned in place of the normal micropub response.

`enable_micropub_auth( $boolean )`

If this filter returns true the authentication functions built into the plugin are enabled. By default, this is disabled if the IndieAuth Plugin is installed. By default it will return
true which loads the built-in IndieAuth client.

`indieauth_scopes( $scopes )`

This returns scopes from a plugin implementing IndieAuth or from the internal IndieAuth code. This filter is empty by default.
Expand Down Expand Up @@ -109,9 +104,13 @@ WordPress has a [whitelist of file extensions that it allows in uploads](https:/

For reasons of security it is recommended that you only use this plugin on sites that implement HTTPS.

Supports the full OAuth2/IndieAuth authentication and authorization flow. Defaults to IndieAuth.com. Custom auth and token endpoints can be used by overriding the `MICROPUB_AUTHENTICATION_ENDPOINT` and `MICROPUB_TOKEN_ENDPOINT` endpoints or by setting the options `indieauth_authorization_endpoint` and `indieauth_token_endpoint`.
Supports the full OAuth2/IndieAuth authentication and authorization flow. Defaults to IndieAuth.com. Custom auth and token endpoints can be used by overriding the `MICROPUB_AUTHENTICATION_ENDPOINT`
and `MICROPUB_TOKEN_ENDPOINT` endpoints or by setting the options `indieauth_authorization_endpoint` and `indieauth_token_endpoint`.

If you want to use your own site as an IndieAuth endpoint, you can activate the IndieAuth plugin which is recommended but not required. You can disable the authentication in favor of an alternative plugin.
This can be done by removing the loading of the auth flow or setting MICROPUB_LOCAL_AUTH to 1.

`remove_action( 'plugins_loaded', 'load_micropub_auth', 20 );`

If the token's `me` value matches a WordPress user's or author post URL, that user will be used. If there is only one site author that will be matched otherwise.

Expand Down Expand Up @@ -217,7 +216,7 @@ into markdown and saved to readme.md.
* Ensure compliance with Micropub spec
* Update composer dependencies and include PHPUnit as a development dependency
* Add nag notice for http domains and the option to diable with a setting
* `MICROPUB_LOCAL_AUTH` is now deprecated in favor of a filter and may be removed in a future version.
* Load auth later in init sequence to avoid conflict


### 1.4.3 (2018-05-27)
Expand Down
15 changes: 7 additions & 8 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Supports the following [scope](https://indieweb.org/scope) parameters requested
== WordPress details ==

= Filters and hooks =
Adds seven filters:
Adds six filters:

`before_micropub( $input )`

Expand All @@ -55,11 +55,6 @@ Called to generate the list of `syndicate-to` targets to return in response to a

$resp defaults to null. If the return value is non-null, it should be an associative array that is encoded as JSON and will be returned in place of the normal micropub response.

`enable_micropub_auth( $boolean )`

If this filter returns true the authentication functions built into the plugin are enabled. By default, this is disabled if the IndieAuth Plugin is installed. By default it will return
true which loads the built-in IndieAuth client.

`indieauth_scopes( $scopes )`

This returns scopes from a plugin implementing IndieAuth or from the internal IndieAuth code. This filter is empty by default.
Expand Down Expand Up @@ -113,9 +108,13 @@ WordPress has a [whitelist of file extensions that it allows in uploads](https:/

For reasons of security it is recommended that you only use this plugin on sites that implement HTTPS.

Supports the full OAuth2/IndieAuth authentication and authorization flow. Defaults to IndieAuth.com. Custom auth and token endpoints can be used by overriding the `MICROPUB_AUTHENTICATION_ENDPOINT` and `MICROPUB_TOKEN_ENDPOINT` endpoints or by setting the options `indieauth_authorization_endpoint` and `indieauth_token_endpoint`.
Supports the full OAuth2/IndieAuth authentication and authorization flow. Defaults to IndieAuth.com. Custom auth and token endpoints can be used by overriding the `MICROPUB_AUTHENTICATION_ENDPOINT`
and `MICROPUB_TOKEN_ENDPOINT` endpoints or by setting the options `indieauth_authorization_endpoint` and `indieauth_token_endpoint`.

If you want to use your own site as an IndieAuth endpoint, you can activate the IndieAuth plugin which is recommended but not required. You can disable the authentication in favor of an alternative plugin.
This can be done by removing the loading of the auth flow or setting MICROPUB_LOCAL_AUTH to 1.

`remove_action( 'plugins_loaded', 'load_micropub_auth', 20 );`

If the token's `me` value matches a WordPress user's or author post URL, that user will be used. If there is only one site author that will be matched otherwise.

Expand Down Expand Up @@ -212,7 +211,7 @@ into markdown and saved to readme.md.
* Ensure compliance with Micropub spec
* Update composer dependencies and include PHPUnit as a development dependency
* Add nag notice for http domains and the option to diable with a setting
* `MICROPUB_LOCAL_AUTH` is now deprecated in favor of a filter and may be removed in a future version.
* Load auth later in init sequence to avoid conflict

= 1.4.3 (2018-05-27) =
* Change scopes to filter
Expand Down

0 comments on commit ef76125

Please sign in to comment.