Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes/admin/settings/views
File: html-keys-edit.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Admin view: Edit API keys
[2] Fix | Delete
*
[3] Fix | Delete
* @package WooCommerce\Admin\Settings
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
defined( 'ABSPATH' ) || exit;
[7] Fix | Delete
?>
[8] Fix | Delete
[9] Fix | Delete
<div id="key-fields" class="settings-panel">
[10] Fix | Delete
<h2><?php esc_html_e( 'Key details', 'woocommerce' ); ?></h2>
[11] Fix | Delete
[12] Fix | Delete
<div class="inline notice">
[13] Fix | Delete
<ul class="advice">
[14] Fix | Delete
<li><?php esc_html_e( 'API keys open up access to potentially sensitive information. Only share them with organizations you trust.', 'woocommerce' ); ?></li>
[15] Fix | Delete
<li><?php esc_html_e( 'Stick to one key per client: this makes it easier to revoke access in the future for a single client, without causing disruption for others.', 'woocommerce' ); ?></li>
[16] Fix | Delete
</ul>
[17] Fix | Delete
</div>
[18] Fix | Delete
[19] Fix | Delete
<input type="hidden" id="key_id" value="<?php echo esc_attr( $key_id ); ?>" />
[20] Fix | Delete
[21] Fix | Delete
<table id="api-keys-options" class="form-table">
[22] Fix | Delete
<tbody>
[23] Fix | Delete
<tr valign="top">
[24] Fix | Delete
<th scope="row" class="titledesc">
[25] Fix | Delete
<label for="key_description">
[26] Fix | Delete
<?php esc_html_e( 'Description', 'woocommerce' ); ?>
[27] Fix | Delete
<?php echo wc_help_tip( __( 'Friendly name for identifying this key.', 'woocommerce' ) ); ?>
[28] Fix | Delete
</label>
[29] Fix | Delete
</th>
[30] Fix | Delete
<td class="forminp">
[31] Fix | Delete
<input maxlength="200" id="key_description" type="text" class="input-text regular-input" value="<?php echo esc_attr( $key_data['description'] ); ?>" />
[32] Fix | Delete
<p class="description">
[33] Fix | Delete
<?php esc_html_e( 'Add a meaningful description, including a note of the person, company or app you are sharing the key with.', 'woocommerce' ); ?>
[34] Fix | Delete
</p>
[35] Fix | Delete
</td>
[36] Fix | Delete
</tr>
[37] Fix | Delete
<tr valign="top">
[38] Fix | Delete
<th scope="row" class="titledesc">
[39] Fix | Delete
<label for="key_user">
[40] Fix | Delete
<?php esc_html_e( 'User', 'woocommerce' ); ?>
[41] Fix | Delete
<?php echo wc_help_tip( __( 'Owner of these keys.', 'woocommerce' ) ); ?>
[42] Fix | Delete
</label>
[43] Fix | Delete
</th>
[44] Fix | Delete
<td class="forminp">
[45] Fix | Delete
<?php
[46] Fix | Delete
$current_user_id = get_current_user_id();
[47] Fix | Delete
$user_id = ! empty( $key_data['user_id'] ) ? absint( $key_data['user_id'] ) : $current_user_id;
[48] Fix | Delete
$user = get_user_by( 'id', $user_id );
[49] Fix | Delete
$user_string = sprintf(
[50] Fix | Delete
/* translators: 1: user display name 2: user ID 3: user email */
[51] Fix | Delete
esc_html__( '%1$s (#%2$s &ndash; %3$s)', 'woocommerce' ),
[52] Fix | Delete
$user->display_name,
[53] Fix | Delete
absint( $user->ID ),
[54] Fix | Delete
$user->user_email
[55] Fix | Delete
);
[56] Fix | Delete
?>
[57] Fix | Delete
<select class="wc-customer-search" id="key_user" data-placeholder="<?php esc_attr_e( 'Search for a user&hellip;', 'woocommerce' ); ?>" data-allow_clear="true">
[58] Fix | Delete
<option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo htmlspecialchars( wp_kses_post( $user_string ) ); // htmlspecialchars to prevent XSS when rendered by selectWoo. ?></option>
[59] Fix | Delete
</select>
[60] Fix | Delete
</td>
[61] Fix | Delete
</tr>
[62] Fix | Delete
<tr valign="top">
[63] Fix | Delete
<th scope="row" class="titledesc">
[64] Fix | Delete
<label for="key_permissions">
[65] Fix | Delete
<?php esc_html_e( 'Permissions', 'woocommerce' ); ?>
[66] Fix | Delete
<?php echo wc_help_tip( __( 'Select the access type of these keys.', 'woocommerce' ) ); ?>
[67] Fix | Delete
</label>
[68] Fix | Delete
</th>
[69] Fix | Delete
<td class="forminp">
[70] Fix | Delete
<select id="key_permissions" class="wc-enhanced-select">
[71] Fix | Delete
<?php
[72] Fix | Delete
$permissions = array(
[73] Fix | Delete
'read' => __( 'Read', 'woocommerce' ),
[74] Fix | Delete
'write' => __( 'Write', 'woocommerce' ),
[75] Fix | Delete
'read_write' => __( 'Read/Write', 'woocommerce' ),
[76] Fix | Delete
);
[77] Fix | Delete
[78] Fix | Delete
foreach ( $permissions as $permission_id => $permission_name ) :
[79] Fix | Delete
?>
[80] Fix | Delete
<option value="<?php echo esc_attr( $permission_id ); ?>" <?php selected( $key_data['permissions'], $permission_id, true ); ?>><?php echo esc_html( $permission_name ); ?></option>
[81] Fix | Delete
<?php endforeach; ?>
[82] Fix | Delete
</select>
[83] Fix | Delete
<p class="conditional description" data-depends-on="#key_permissions" data-show-if-equals="write">
[84] Fix | Delete
<?php esc_html_e( 'Write-only keys do not prevent clients from seeing information about the entities they are updating.', 'woocommerce' ); ?>
[85] Fix | Delete
</p>
[86] Fix | Delete
</td>
[87] Fix | Delete
</tr>
[88] Fix | Delete
[89] Fix | Delete
<?php if ( 0 !== $key_id ) : ?>
[90] Fix | Delete
<tr valign="top">
[91] Fix | Delete
<th scope="row" class="titledesc">
[92] Fix | Delete
<?php esc_html_e( 'Consumer key ending in', 'woocommerce' ); ?>
[93] Fix | Delete
</th>
[94] Fix | Delete
<td class="forminp">
[95] Fix | Delete
<code>&hellip;<?php echo esc_html( $key_data['truncated_key'] ); ?></code>
[96] Fix | Delete
</td>
[97] Fix | Delete
</tr>
[98] Fix | Delete
<tr valign="top">
[99] Fix | Delete
<th scope="row" class="titledesc">
[100] Fix | Delete
<?php esc_html_e( 'Last access', 'woocommerce' ); ?>
[101] Fix | Delete
</th>
[102] Fix | Delete
<td class="forminp">
[103] Fix | Delete
<span>
[104] Fix | Delete
<?php
[105] Fix | Delete
if ( ! empty( $key_data['last_access'] ) ) {
[106] Fix | Delete
/* translators: 1: last access date 2: last access time */
[107] Fix | Delete
$date = sprintf( __( '%1$s at %2$s', 'woocommerce' ), date_i18n( wc_date_format(), strtotime( $key_data['last_access'] ) ), date_i18n( wc_time_format(), strtotime( $key_data['last_access'] ) ) );
[108] Fix | Delete
[109] Fix | Delete
echo esc_html( apply_filters( 'woocommerce_api_key_last_access_datetime', $date, $key_data['last_access'] ) );
[110] Fix | Delete
} else {
[111] Fix | Delete
esc_html_e( 'Unknown', 'woocommerce' );
[112] Fix | Delete
}
[113] Fix | Delete
?>
[114] Fix | Delete
</span>
[115] Fix | Delete
</td>
[116] Fix | Delete
</tr>
[117] Fix | Delete
<?php endif ?>
[118] Fix | Delete
</tbody>
[119] Fix | Delete
</table>
[120] Fix | Delete
[121] Fix | Delete
<?php do_action( 'woocommerce_admin_key_fields', $key_data ); ?>
[122] Fix | Delete
[123] Fix | Delete
<?php
[124] Fix | Delete
if ( 0 === intval( $key_id ) ) {
[125] Fix | Delete
submit_button( __( 'Generate API key', 'woocommerce' ), 'primary', 'update_api_key' );
[126] Fix | Delete
} else {
[127] Fix | Delete
?>
[128] Fix | Delete
<p class="submit">
[129] Fix | Delete
<?php submit_button( __( 'Save changes', 'woocommerce' ), 'primary', 'update_api_key', false ); ?>
[130] Fix | Delete
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key_id ), admin_url( 'admin.php?page=wc-settings&tab=advanced&section=keys' ) ), 'revoke' ) ); ?>"><?php esc_html_e( 'Revoke key', 'woocommerce' ); ?></a>
[131] Fix | Delete
</p>
[132] Fix | Delete
<?php
[133] Fix | Delete
}
[134] Fix | Delete
?>
[135] Fix | Delete
</div>
[136] Fix | Delete
[137] Fix | Delete
<script type="text/template" id="tmpl-api-keys-template">
[138] Fix | Delete
<p id="copy-error"></p>
[139] Fix | Delete
<table class="form-table">
[140] Fix | Delete
<tbody>
[141] Fix | Delete
<tr valign="top">
[142] Fix | Delete
<th scope="row" class="titledesc">
[143] Fix | Delete
<?php esc_html_e( 'Consumer key', 'woocommerce' ); ?>
[144] Fix | Delete
</th>
[145] Fix | Delete
<td class="forminp">
[146] Fix | Delete
<input id="key_consumer_key" type="text" value="{{ data.consumer_key }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-key" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
[147] Fix | Delete
</td>
[148] Fix | Delete
</tr>
[149] Fix | Delete
<tr valign="top">
[150] Fix | Delete
<th scope="row" class="titledesc">
[151] Fix | Delete
<?php esc_html_e( 'Consumer secret', 'woocommerce' ); ?>
[152] Fix | Delete
</th>
[153] Fix | Delete
<td class="forminp">
[154] Fix | Delete
<input id="key_consumer_secret" type="text" value="{{ data.consumer_secret }}" size="55" readonly="readonly"> <button type="button" class="button-secondary copy-secret" data-tip="<?php esc_attr_e( 'Copied!', 'woocommerce' ); ?>"><?php esc_html_e( 'Copy', 'woocommerce' ); ?></button>
[155] Fix | Delete
</td>
[156] Fix | Delete
</tr>
[157] Fix | Delete
<tr valign="top">
[158] Fix | Delete
<th scope="row" class="titledesc">
[159] Fix | Delete
<?php esc_html_e( 'QRCode', 'woocommerce' ); ?>
[160] Fix | Delete
</th>
[161] Fix | Delete
<td class="forminp">
[162] Fix | Delete
<div id="keys-qrcode"></div>
[163] Fix | Delete
</td>
[164] Fix | Delete
</tr>
[165] Fix | Delete
</tbody>
[166] Fix | Delete
</table>
[167] Fix | Delete
</script>
[168] Fix | Delete
[169] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function