WC_Admin_API_Keys::page_output()public staticWC 1.0

Page output.

Method of the class: WC_Admin_API_Keys{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Admin_API_Keys::page_output();

WC_Admin_API_Keys::page_output() code WC 9.8.2

public static function page_output() {
	// Hide the save button.
	$GLOBALS['hide_save_button'] = true;

	if ( isset( $_GET['create-key'] ) || isset( $_GET['edit-key'] ) ) {
		$key_id   = isset( $_GET['edit-key'] ) ? absint( $_GET['edit-key'] ) : 0; // WPCS: input var okay, CSRF ok.
		$key_data = self::get_key_data( $key_id );
		$user_id  = (int) $key_data['user_id'];

		if ( $key_id && $user_id && ! current_user_can( 'edit_user', $user_id ) ) {
			if ( get_current_user_id() !== $user_id ) {
				wp_die( esc_html__( 'You do not have permission to edit this API Key', 'woocommerce' ) );
			}
		}

		include dirname( __FILE__ ) . '/settings/views/html-keys-edit.php';
	} else {
		self::table_list_output();
	}
}