wc_rest_urlencode_rfc3986

Encodes a value according to RFC 3986.

Description

(string|array) wc_rest_urlencode_rfc3986( (string|array) $value ); 

Supports multidimensional arrays.

Returns (string|array)

Encoded values.

Parameters (1)

0. $value (string|array)
The value to encode.

Usage

  1. if ( !function_exists( 'wc_rest_urlencode_rfc3986' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-rest-functions.php'; 
  3.  
  4. // The value to encode. 
  5. $value = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_rest_urlencode_rfc3986($value); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-rest-functions.php  
  1. function wc_rest_urlencode_rfc3986( $value ) { 
  2. if ( is_array( $value ) ) { 
  3. return array_map( 'wc_rest_urlencode_rfc3986', $value ); 
  4. } else { 
  5. // Percent symbols (%) must be double-encoded. 
  6. return str_replace( '%', '%25', rawurlencode( rawurldecode( $value ) ) );