@@ -87,29 +87,30 @@ public function use_size_presets_by_default_set_default( $old_version, $new_vers
8787 * @since 3.16.0
8888 */
8989 public function migrate_global_typography_font_size ( $ old_version , $ new_version ) {
90- if ( ! empty ( $ old_version ) && version_compare ( $ old_version , "3.16.0 " , "< " )
91- && ! empty ( $ typography_option ) && isset ( $ typography_option [ 0 ] )
92- ) {
90+ if ( ! empty ( $ old_version ) && version_compare ( $ old_version , "3.16.0 " , "< " ) ) {
9391 $ typography_option = get_option ( 'stackable_global_typography ' );
94- $ typography = $ typography_option [ 0 ];
95- $ updated = false ;
9692
97- foreach ( $ typography as $ key => $ item ) {
98- if ( ! is_array ( $ item ) ) {
99- continue ;
100- }
93+ if ( ! empty ( $ typography_option ) && isset ( $ typography_option [ 0 ] ) && is_array ( $ typography_option [ 0 ] ) ) {
94+ $ typography = $ typography_option [ 0 ];
95+ $ updated = false ;
96+
97+ foreach ( $ typography as $ key => $ item ) {
98+ if ( ! is_array ( $ item ) ) {
99+ continue ;
100+ }
101101
102- foreach ( [ 'fontSize ' , 'tabletFontSize ' , 'mobileFontSize ' ] as $ size_key ) {
103- if ( isset ( $ item [ $ size_key ] ) && is_numeric ( $ item [ $ size_key ] ) ) {
104- $ typography [ $ key ][ $ size_key ] = strval ( $ item [ $ size_key ] );
105- $ updated = true ;
102+ foreach ( [ 'fontSize ' , 'tabletFontSize ' , 'mobileFontSize ' ] as $ size_key ) {
103+ if ( isset ( $ item [ $ size_key ] ) && is_numeric ( $ item [ $ size_key ] ) ) {
104+ $ typography [ $ key ][ $ size_key ] = strval ( $ item [ $ size_key ] );
105+ $ updated = true ;
106+ }
106107 }
107108 }
108- }
109109
110- if ( $ updated ) {
111- $ typography_option [ 0 ] = $ typography ;
112- update_option ( 'stackable_global_typography ' , $ typography_option );
110+ if ( $ updated ) {
111+ $ typography_option [ 0 ] = $ typography ;
112+ update_option ( 'stackable_global_typography ' , $ typography_option );
113+ }
113114 }
114115 }
115116 }
0 commit comments