Skip to content

Commit 2589963

Browse files
committed
0.2.1
1 parent 14adb84 commit 2589963

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugin.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*
66
* @package Plugin_API
77
* @author Shuaib Yusuf Shuaib
8-
* @version 0.2.0
8+
* @version 0.2.1
99
*/
1010

1111
// Ensure the plugin is installed properly
1212
if ( 'api' !== basename( __DIR__ ) ) return;
1313

1414
global $App;
1515
define( 'API_VERSION', 'v1' );
16-
define( 'API_PLUGIN_VERSION', '0.2.0' );
16+
define( 'API_PLUGIN_VERSION', '0.2.1' );
1717
$App->set_action( 'install', 'api_install' );
1818
$App->set_action( 'uninstall', 'api_uninstall' );
1919
$App->set_action( 'slug_taken', 'api_routes' );
@@ -616,9 +616,11 @@ function api_settings(): void {
616616
api_hide_fields(
617617
$data[ 'site' ],
618618
array(
619+
'admin',
619620
'username',
620621
'password',
621622
'api' => array(
623+
'read',
622624
'write'
623625
)
624626
)
@@ -924,9 +926,10 @@ function api_hide_fields( array $data, array $fields, bool $allow_auth = true ):
924926
$auth = api_input_string( 'auth' );
925927
$valid = hash_equals( $api[ 'write' ], $auth );
926928
if ( $allow_auth && $valid ) return $data;
929+
$fields = $App->get_filter( $fields, 'api_hide_fields' );
927930
foreach ( $fields as $index => $field ) {
928931
if ( is_array( $field ) ) {
929-
$data[ $index ] = api_hide_fields( $data[ $index ], $field );
932+
$data[ $index ] = api_hide_fields( $data[ $index ], $field, $allow_auth );
930933
} else {
931934
if ( isset( $data[ $field ] ) ) {
932935
$data[ $field ] = '<hidden>';

0 commit comments

Comments
 (0)