@@ -95,7 +95,7 @@ public static function secure_interaction_data( $interaction_data ) {
9595 $ action_value = $ action ['value ' ];
9696
9797 if ( $ action_config ->verify_integrity ) {
98- $ signature = hash_hmac ( 'sha256 ' , json_encode ( $ action_value ), interact_salt () );
98+ $ signature = hash_hmac ( 'sha256 ' , wp_json_encode ( $ action_value ), interact_salt () );
9999
100100 // Add the signature to the data.
101101 $ interaction_data ['timelines ' ][ $ timeline_index ]['actions ' ][ $ action_index ]['signature ' ] = $ signature ;
@@ -141,7 +141,7 @@ public static function trash( $interaction_key ) {
141141 */
142142 public function set_data ( $ interaction_data ) {
143143 $ this ->interaction_data = $ interaction_data ;
144- $ this ->post ->post_content = json_encode ( $ interaction_data );
144+ $ this ->post ->post_content = wp_json_encode ( $ interaction_data );
145145 $ this ->post ->post_name = $ interaction_data ['key ' ];
146146 $ this ->post ->post_title = $ interaction_data ['title ' ];
147147 }
@@ -214,7 +214,7 @@ public function get_secure_timeline_actions() {
214214
215215 if ( ! empty ( $ action_config ) && $ action_config ->verify_integrity ) {
216216 $ action_value = $ action ['value ' ];
217- $ signature = hash_hmac ( 'sha256 ' , json_encode ( $ action_value ), interact_salt () );
217+ $ signature = hash_hmac ( 'sha256 ' , wp_json_encode ( $ action_value ), interact_salt () );
218218
219219 // If the signature is not valid, remove the action from the timeline.
220220 if ( ! hash_equals ( $ signature , $ action ['signature ' ] ) ) {
0 commit comments