| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
/** |
| 6 |
* Add Datafeedr API Plugins settings and configuration to the WordPress |
| 7 |
* Site Health Info section (WordPress Admin Area > Tools > Site Health). |
| 8 |
* |
| 9 |
* @return array |
| 10 |
*/ |
| 11 |
add_filter( 'debug_information', function ( $info ) { |
| 12 |
|
| 13 |
$options = get_option( 'dfrapi_configuration', [] ); |
| 14 |
|
| 15 |
$network_ids = dfrapi_get_selected_network_ids(); |
| 16 |
$network_cnt = dfrapi_selected_network_count(); |
| 17 |
$merchant_ids = dfrapi_get_selected_merchant_ids(); |
| 18 |
$merchant_cnt = dfrapi_selected_merchant_count(); |
| 19 |
|
| 20 |
$info['datafeedr-api-plugin'] = [ |
| 21 |
'label' => __( 'Datafeedr API Plugin', 'datafeedr-api' ), |
| 22 |
'description' => '', |
| 23 |
'fields' => [ |
| 24 |
'access_id' => [ |
| 25 |
'label' => __( 'Datafeedr Access ID', 'datafeedr-api' ), |
| 26 |
'value' => isset( $options['access_id'] ) && ! empty( $options['access_id'] ) ? '••••' . substr( $options['access_id'], - 4 ) : '—', |
| 27 |
'debug' => isset( $options['access_id'] ) && ! empty( $options['access_id'] ) ? '••••' . substr( $options['access_id'], - 4 ) : '—', |
| 28 |
], |
| 29 |
'secret_key' => [ |
| 30 |
'label' => __( 'Datafeedr Secret Key', 'datafeedr-api' ), |
| 31 |
'value' => isset( $options['secret_key'] ) && ! empty( $options['secret_key'] ) ? '••••' . substr( $options['secret_key'], - 4 ) : '—', |
| 32 |
'debug' => isset( $options['secret_key'] ) && ! empty( $options['secret_key'] ) ? '••••' . substr( $options['secret_key'], - 4 ) : '—', |
| 33 |
], |
| 34 |
'awin_access_token' => [ |
| 35 |
'label' => __( 'Awin API Token', 'datafeedr-api' ), |
| 36 |
'value' => isset( $options['awin_access_token'] ) && ! empty( $options['awin_access_token'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 37 |
'debug' => isset( $options['awin_access_token'] ) && ! empty( $options['awin_access_token'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 38 |
], |
| 39 |
'affiliate_gateway_sid' => [ |
| 40 |
'label' => __( 'The Affiliate Gateway SID', 'datafeedr-api' ), |
| 41 |
'value' => isset( $options['affiliate_gateway_sid'] ) && ! empty( $options['affiliate_gateway_sid'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 42 |
'debug' => isset( $options['affiliate_gateway_sid'] ) && ! empty( $options['affiliate_gateway_sid'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 43 |
], |
| 44 |
'belboon_aid' => [ |
| 45 |
'label' => __( 'Belboon Adspace ID', 'datafeedr-api' ), |
| 46 |
'value' => isset( $options['belboon_aid'] ) && ! empty( $options['belboon_aid'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 47 |
'debug' => isset( $options['belboon_aid'] ) && ! empty( $options['belboon_aid'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 48 |
], |
| 49 |
'amazon_access_key_id' => [ |
| 50 |
'label' => __( 'Amazon Access Key ID', 'datafeedr-api' ), |
| 51 |
'value' => isset( $options['amazon_access_key_id'] ) && ! empty( $options['amazon_access_key_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 52 |
'debug' => isset( $options['amazon_access_key_id'] ) && ! empty( $options['amazon_access_key_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 53 |
], |
| 54 |
'amazon_secret_access_key' => [ |
| 55 |
'label' => __( 'Amazon Secret Access Key', 'datafeedr-api' ), |
| 56 |
'value' => isset( $options['amazon_secret_access_key'] ) && ! empty( $options['amazon_secret_access_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 57 |
'debug' => isset( $options['amazon_secret_access_key'] ) && ! empty( $options['amazon_secret_access_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 58 |
], |
| 59 |
'amazon_tracking_id' => [ |
| 60 |
'label' => __( 'Amazon Tracking ID', 'datafeedr-api' ), |
| 61 |
'value' => isset( $options['amazon_tracking_id'] ) && ! empty( $options['amazon_tracking_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 62 |
'debug' => isset( $options['amazon_tracking_id'] ) && ! empty( $options['amazon_tracking_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 63 |
], |
| 64 |
'amazon_locale' => [ |
| 65 |
'label' => __( 'Amazon Locale', 'datafeedr-api' ), |
| 66 |
'value' => strtoupper( $options['amazon_locale'] ?? '—' ), |
| 67 |
'debug' => $options['amazon_locale'] ?? '—', |
| 68 |
], |
| 69 |
'ph_application_key' => [ |
| 70 |
'label' => __( 'Partnerize Application Key', 'datafeedr-api' ), |
| 71 |
'value' => isset( $options['ph_application_key'] ) && ! empty( $options['ph_application_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 72 |
'debug' => isset( $options['ph_application_key'] ) && ! empty( $options['ph_application_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 73 |
], |
| 74 |
'ph_user_api_key' => [ |
| 75 |
'label' => __( 'User API Key', 'datafeedr-api' ), |
| 76 |
'value' => isset( $options['ph_user_api_key'] ) && ! empty( $options['ph_user_api_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 77 |
'debug' => isset( $options['ph_user_api_key'] ) && ! empty( $options['ph_user_api_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 78 |
], |
| 79 |
'ph_publisher_id' => [ |
| 80 |
'label' => __( 'Publisher ID', 'datafeedr-api' ), |
| 81 |
'value' => isset( $options['ph_publisher_id'] ) && ! empty( $options['ph_publisher_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 82 |
'debug' => isset( $options['ph_publisher_id'] ) && ! empty( $options['ph_publisher_id'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 83 |
], |
| 84 |
'effiliation_key' => [ |
| 85 |
'label' => __( 'Effiliation Key', 'datafeedr-api' ), |
| 86 |
'value' => isset( $options['effiliation_key'] ) && ! empty( $options['effiliation_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 87 |
'debug' => isset( $options['effiliation_key'] ) && ! empty( $options['effiliation_key'] ) ? __( 'Yes', 'datafeedr-api' ) : '—', |
| 88 |
], |
| 89 |
'hs_beacon' => [ |
| 90 |
'label' => __( 'Support Link Enabled', 'datafeedr-api' ), |
| 91 |
'value' => ucfirst( $options['hs_beacon'] ?? 'on' ), |
| 92 |
'debug' => $options['hs_beacon'] ?? 'on', |
| 93 |
], |
| 94 |
'selected_networks' => [ |
| 95 |
'label' => __( 'Selected Networks', 'datafeedr-api' ), |
| 96 |
'value' => number_format_i18n( $network_cnt ), |
| 97 |
'debug' => $network_cnt, |
| 98 |
], |
| 99 |
'selected_network_ids' => [ |
| 100 |
'label' => __( 'Selected Network IDs', 'datafeedr-api' ), |
| 101 |
'value' => implode( ', ', $network_ids ), |
| 102 |
'debug' => implode( ',', $network_ids ), |
| 103 |
], |
| 104 |
'selected_merchants' => [ |
| 105 |
'label' => __( 'Selected Merchants', 'datafeedr-api' ), |
| 106 |
'value' => number_format_i18n( $merchant_cnt ), |
| 107 |
'debug' => $merchant_cnt, |
| 108 |
], |
| 109 |
'selected_merchant_ids' => [ |
| 110 |
'label' => __( 'Selected Merchants IDs', 'datafeedr-api' ), |
| 111 |
'value' => implode( ', ', $merchant_ids ), |
| 112 |
'debug' => implode( ',', $merchant_ids ), |
| 113 |
], |
| 114 |
] |
| 115 |
]; |
| 116 |
|
| 117 |
return $info; |
| 118 |
} ); |