Skip to content

Commit

Permalink
Handle empty google fonts field better
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Friedman <[email protected]>
  • Loading branch information
iMattPro committed Nov 7, 2024
1 parent 2b3307a commit da571d0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions controller/acp_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,19 @@ protected function get_google_fonts()
protected function save_google_fonts()
{
$fonts = $this->request->variable('abbc3_google_fonts', '');
$fonts = explode("\n", $fonts);
$this->validate_google_fonts($fonts);
$this->config_text->set('abbc3_google_fonts', json_encode($fonts));
if (!empty($fonts))
{
$fonts = explode("\n", $fonts);
$fonts = array_filter($fonts, 'strlen'); // Remove empty strings

if (!empty($fonts))
{
$this->validate_google_fonts($fonts);
}
}

$fonts = (is_array($fonts) && !empty($fonts)) ? json_encode($fonts) : '';
$this->config_text->set('abbc3_google_fonts', $fonts);
}

/**
Expand Down

0 comments on commit da571d0

Please sign in to comment.