Skip to content

Commit

Permalink
Fixed warning for key 'iloveimg_field_text_family'
Browse files Browse the repository at this point in the history
  • Loading branch information
teamcrombie committed Oct 8, 2024
1 parent 04712fd commit 9924758
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ilove-img-watermark.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,15 @@ function ilove_img_wm_activate() {
'iloveimg_options_watermark',
wp_json_encode(
array(
'iloveimg_field_type' => 'text',
'iloveimg_field_text' => 'Sample',
'iloveimg_field_scale' => 33,
'iloveimg_field_opacity' => 1,
'iloveimg_field_rotation' => 0,
'iloveimg_field_position' => 1,
'iloveimg_field_sizes' => $iloveimg_thumbnails,
'iloveimg_field_backup' => 'on',
'iloveimg_field_type' => 'text',
'iloveimg_field_text_family' => 'Arial',
'iloveimg_field_text' => 'Sample',
'iloveimg_field_scale' => 33,
'iloveimg_field_opacity' => 1,
'iloveimg_field_rotation' => 0,
'iloveimg_field_position' => 1,
'iloveimg_field_sizes' => $iloveimg_thumbnails,
'iloveimg_field_backup' => 'on',
)
)
);
Expand All @@ -127,6 +128,13 @@ function ilove_img_wm_activate() {
if ( is_serialized( $old_data ) ) {
$old_data_serialize = unserialize( get_option( 'iloveimg_options_watermark' ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize
update_option( 'iloveimg_options_watermark', wp_json_encode( $old_data_serialize ) );
} else {
$iloveimg_options_watermark = json_decode( $old_data, true );

if ( ! array_key_exists( 'iloveimg_field_text_family', $iloveimg_options_watermark ) ) {
$iloveimg_options_watermark['iloveimg_field_text_family'] = 'Arial';
update_option( 'iloveimg_options_watermark', wp_json_encode( $iloveimg_options_watermark ) );
}
}
}
}
Expand Down

0 comments on commit 9924758

Please sign in to comment.