|
5 | 5 | * |
6 | 6 | * @package Plugin_API |
7 | 7 | * @author Shuaib Yusuf Shuaib |
8 | | - * @version 0.2.0 |
| 8 | + * @version 0.2.1 |
9 | 9 | */ |
10 | 10 |
|
11 | 11 | // Ensure the plugin is installed properly |
12 | 12 | if ( 'api' !== basename( __DIR__ ) ) return; |
13 | 13 |
|
14 | 14 | global $App; |
15 | 15 | define( 'API_VERSION', 'v1' ); |
16 | | -define( 'API_PLUGIN_VERSION', '0.2.0' ); |
| 16 | +define( 'API_PLUGIN_VERSION', '0.2.1' ); |
17 | 17 | $App->set_action( 'install', 'api_install' ); |
18 | 18 | $App->set_action( 'uninstall', 'api_uninstall' ); |
19 | 19 | $App->set_action( 'slug_taken', 'api_routes' ); |
@@ -616,9 +616,11 @@ function api_settings(): void { |
616 | 616 | api_hide_fields( |
617 | 617 | $data[ 'site' ], |
618 | 618 | array( |
| 619 | + 'admin', |
619 | 620 | 'username', |
620 | 621 | 'password', |
621 | 622 | 'api' => array( |
| 623 | + 'read', |
622 | 624 | 'write' |
623 | 625 | ) |
624 | 626 | ) |
@@ -924,9 +926,10 @@ function api_hide_fields( array $data, array $fields, bool $allow_auth = true ): |
924 | 926 | $auth = api_input_string( 'auth' ); |
925 | 927 | $valid = hash_equals( $api[ 'write' ], $auth ); |
926 | 928 | if ( $allow_auth && $valid ) return $data; |
| 929 | + $fields = $App->get_filter( $fields, 'api_hide_fields' ); |
927 | 930 | foreach ( $fields as $index => $field ) { |
928 | 931 | if ( is_array( $field ) ) { |
929 | | - $data[ $index ] = api_hide_fields( $data[ $index ], $field ); |
| 932 | + $data[ $index ] = api_hide_fields( $data[ $index ], $field, $allow_auth ); |
930 | 933 | } else { |
931 | 934 | if ( isset( $data[ $field ] ) ) { |
932 | 935 | $data[ $field ] = '<hidden>'; |
|
0 commit comments