Server IP : 172.67.158.161 / Your IP : 18.218.19.160 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/khowordpress.com/wp-content/plugins/woocommerce/src/Blocks/Interactivity/ |
Upload File : |
<?php /** * Manages the initial state of the Interactivity API store in the server and * its serialization so it can be restored in the browser upon hydration. * * It's a private class, exposed by other functions, like `wc_initial_state`. * * @access private */ class WC_Interactivity_Initial_State { /** * Map of initial state by namespace. * * @var array */ private static $initial_state = array(); /** * Get state from a given namespace. * * @param string $namespace Namespace. * * @return array The requested state. */ public static function get_state( $namespace ) { return self::$initial_state[ $namespace ] ?? array(); } /** * Merge data into the state with the given namespace. * * @param string $namespace Namespace. * @param array $data State to merge. * * @return void */ public static function merge_state( $namespace, $data ) { self::$initial_state[ $namespace ] = array_replace_recursive( self::get_state( $namespace ), $data ); } /** * Reset the initial state. */ public static function reset() { self::$initial_state = array(); } /** * Render the initial state. */ public static function render() { if ( empty( self::$initial_state ) ) { return; } echo sprintf( '<script id="wc-interactivity-initial-state" type="application/json">%s</script>', wp_json_encode( self::$initial_state, JSON_HEX_TAG | JSON_HEX_AMP ) ); } }