WC_Meta_Box_Product_Images::decode_media_gallery_json
Decode the posted media gallery hidden field.
Method of the class: WC_Meta_Box_Product_Images{}
No Hooks.
Returns
array.
Usage
$result = WC_Meta_Box_Product_Images::decode_media_gallery_json( $media_gallery_json );
- $media_gallery_json(mixed) (required)
- JSON-encoded media gallery field value.
WC_Meta_Box_Product_Images::decode_media_gallery_json() WC Meta Box Product Images::decode media gallery json code WC 11.1.2
private static function decode_media_gallery_json( $media_gallery_json ) {
if ( ! is_string( $media_gallery_json ) || '' === $media_gallery_json ) {
return array();
}
$decoded = json_decode( $media_gallery_json, true );
if ( ! is_array( $decoded ) ) {
return array();
}
$decoded = wc_clean( $decoded );
return is_array( $decoded ) ? $decoded : array();
}