* @link https://www.fireplugins.com * @copyright Copyright © 2022 FirePlugins All Rights Reserved * @license GNU GPLv3 or later */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly. } $box = $this->data->get('box'); $btnSource = is_string($this->data->get('box.params.data.closebutton.source', 'icon')) ? $this->data->get('box.params.data.closebutton.source', 'icon') : 'icon'; $color = is_string($this->data->get('box.params.data.closebutton.color', null)) ? $this->data->get('box.params.data.closebutton.color', null) : null; $size = is_string($this->data->get('box.params.data.closebutton.size', null)) || is_int($this->data->get('box.params.data.closebutton.size', null)) ? (int) $this->data->get('box.params.data.closebutton.size', null) : null; $cbStyles = ''; $styles = ''; if ($btnSource == 'icon') { $cbStyles = implode(';', array_filter(array( $color ? 'color:' . $color : null, $size ? 'font-size:' . $size . 'px' : null ))); } // Delay the display of the close button using CSS animation $delay = (float) $this->data->get('box.params.data.closebutton.delay', 0); if ($delay > 0) { $styles .= ' .fb-' . $box->ID . ' .fb-close { visibility: hidden; } .fb-' . $box->ID . '.fb-visible .fb-close { animation: ' . $delay . 's ebFadeIn; animation-fill-mode: forwards; } '; } // Add the hover color if ($hoverColor = $this->data->get('box.params.data.closebutton.hover', null)) { $styles .= ' .fb-' . esc_attr($box->ID) . ' .fb-close:hover { color: ' . esc_attr($hoverColor) . ' !important; } '; } if (!empty($styles)) { add_action( 'wp_footer', function() use ($styles) { echo ''; }, 100); } ?>