@@ -43,7 +43,7 @@ public function translate_value( $meta_value ) {
43
43
foreach ( $ meta_value ['widgets ' ] as $ key => $ widget ) {
44
44
if ( isset ( $ widget ['frames ' ] ) ) {
45
45
foreach ( $ widget ['frames ' ] as $ _key => $ frame ) {
46
- if ( isset ( $ frame [ ' content ' ] ) && is_string ( $ frame ['content ' ] ) && json_decode ( $ frame ['content ' ] ) ) {
46
+ if ( ! empty ( $ frame ['content ' ] ) && isJSON ( $ frame ['content ' ] ) ) {
47
47
$ frame ['content ' ] = json_decode ( $ frame ['content ' ], true );
48
48
if ( is_array ( $ frame ['content ' ] ) && isset ( $ frame ['content ' ]['widgets ' ] ) ) {
49
49
$ meta_value ['widgets ' ][ $ key ]['frames ' ][ $ _key ]['content ' ] = $ this ->translate_value ( $ frame ['content ' ] );
@@ -68,7 +68,7 @@ public function transform_value( $meta_value ) {
68
68
foreach ( $ meta_value ['widgets ' ] as $ key => $ widget ) {
69
69
if ( isset ( $ widget ['frames ' ] ) ) {
70
70
foreach ( $ widget ['frames ' ] as $ _key => $ frame ) {
71
- if ( isset ( $ frame ['content ' ] ) && json_decode ( $ frame ['content ' ] ) ) {
71
+ if ( ! empty ( $ frame ['content ' ] ) && isJSON ( $ frame ['content ' ] ) ) {
72
72
$ frame ['content ' ] = json_decode ( $ frame ['content ' ], true );
73
73
if ( is_array ( $ frame ['content ' ] ) && isset ( $ frame ['content ' ]['widgets ' ] ) ) {
74
74
$ meta_value ['widgets ' ][ $ key ]['frames ' ][ $ _key ]['content ' ] = $ this ->transform_value ( $ frame ['content ' ] );
@@ -98,9 +98,9 @@ public function filter_old_value( $old_value, $meta_value ) {
98
98
foreach ( $ old_value ['widgets ' ] as $ _widget ) {
99
99
if ( $ widget ['panels_info ' ]['widget_id ' ] === $ _widget ['panels_info ' ]['widget_id ' ] ) {
100
100
$ new_old_value ['widgets ' ][ $ key ] = $ _widget ;
101
- if ( isset ( $ widget ['frames ' ] ) ) {
101
+ if ( ! empty ( $ widget ['frames ' ] ) ) {
102
102
foreach ( $ widget ['frames ' ] as $ _key => $ frame ) {
103
- if ( is_array ( $ frame ['content ' ] ) && isset ( $ frame ['content ' ], $ frame [ ' content ' ] ['widgets ' ] ) ) {
103
+ if ( is_array ( $ frame ['content ' ] ) && isset ( $ frame ['content ' ]['widgets ' ] ) ) {
104
104
foreach ( $ _widget ['frames ' ] as $ _frame ) {
105
105
$ _frame ['content ' ] = json_decode ( $ _frame ['content ' ], true );
106
106
$ new_old_value ['widgets ' ][ $ key ]['frames ' ][ $ _key ]['content ' ] = $ this ->filter_old_value ( $ _frame ['content ' ], $ frame ['content ' ] );
@@ -151,7 +151,7 @@ public function add_recursive_config( $config, $meta_value ) {
151
151
foreach ( $ meta_value ['widgets ' ] as $ widget ) {
152
152
if ( isset ( $ widget ['frames ' ] ) ) {
153
153
foreach ( $ widget ['frames ' ] as $ frame ) {
154
- if ( isset ( $ frame [ ' content ' ] ) && is_string ( $ frame ['content ' ] ) && json_decode ( $ frame ['content ' ] ) ) {
154
+ if ( ! empty ( $ frame ['content ' ] ) && isJSON ( $ frame ['content ' ] ) ) {
155
155
$ frame ['content ' ] = json_decode ( $ frame ['content ' ], true );
156
156
if ( isset ( $ frame ['content ' ]['widgets ' ] ) ) {
157
157
$ config ['widgets ' ]['wpm_each ' ]['frames ' ]['wpm_each ' ]['content ' ] = $ this ->add_recursive_config ( $ config , $ frame ['content ' ] );
0 commit comments