| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package FireBox |
| 4 |
* @version 1.0.0 Free |
| 5 |
* |
| 6 |
* @author FirePlugins <info@fireplugins.com> |
| 7 |
* @link https://www.fireplugins.com |
| 8 |
* @copyright Copyright © 2021 FirePlugins All Rights Reserved |
| 9 |
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 |
*/ |
| 11 |
|
| 12 |
if (!defined('ABSPATH')) |
| 13 |
{ |
| 14 |
exit; // Exit if accessed directly. |
| 15 |
} |
| 16 |
$box = $this->data->get('box', []); |
| 17 |
$box = new \FPFramework\Libs\Registry($box); |
| 18 |
$params = $this->data->get('params', []); |
| 19 |
$params = new \FPFramework\Libs\Registry($params); |
| 20 |
|
| 21 |
$custom_code = $box->get('params.data.customcode', ''); |
| 22 |
if (is_string($custom_code)) |
| 23 |
{ |
| 24 |
$custom_code = stripslashes($custom_code); |
| 25 |
$custom_code = html_entity_decode($custom_code); |
| 26 |
} |
| 27 |
|
| 28 |
$close_button = (int) $box->get('params.data.closebutton.show', ''); |
| 29 |
|
| 30 |
$rtl = (int) $box->get('params.data.rtl', 0); |
| 31 |
|
| 32 |
$css = is_string($box->get('params.data.customcss')) ? $box->get('params.data.customcss') : ''; |
| 33 |
|
| 34 |
// add responsive CSS |
| 35 |
if ($responsive_css = $box->get('params.data.responsive_css', [])) |
| 36 |
{ |
| 37 |
if (isset($responsive_css->tablet) && !empty($responsive_css->tablet)) |
| 38 |
{ |
| 39 |
$css .= ' |
| 40 |
@media only screen and (max-width: 768px) { |
| 41 |
.fb-' . esc_attr($box->get('ID')) . ' .fb-dialog { ' . esc_html($responsive_css->tablet) . ' } |
| 42 |
}'; |
| 43 |
} |
| 44 |
if (isset($responsive_css->mobile) && !empty($responsive_css->mobile)) |
| 45 |
{ |
| 46 |
$css .= ' |
| 47 |
@media only screen and (max-width: 468px) { |
| 48 |
.fb-' . esc_attr($box->get('ID')) . ' .fb-dialog { ' . esc_html($responsive_css->mobile) . ' } |
| 49 |
}'; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
// render box css at the bottom of the page |
| 54 |
if (!empty($css)) |
| 55 |
{ |
| 56 |
add_action( 'wp_footer', function() use ($css, $box) { |
| 57 |
echo '<style type="text/css" class="fb-' . esc_attr($box->get('ID')) . '-style fb-responsive-style">' . wp_strip_all_tags($css) . '</style>'; |
| 58 |
}, 100); |
| 59 |
} |
| 60 |
?> |
| 61 |
<div data-id="<?php echo esc_attr($box->get('ID')); ?>" |
| 62 |
class="fb-inst fb-hide <?php echo esc_attr(implode(' ', (array) $box->get('classes'))); ?>" |
| 63 |
data-options='<?php echo json_encode($box->get('settings')) ?>' |
| 64 |
data-type='<?php echo esc_attr($box->get('params.data.mode')); ?>' |
| 65 |
<?php if (!empty($box->get('styles_container'))) { ?>style="<?php echo esc_attr($box->get('styles_container')); ?>"<?php } ?> |
| 66 |
<?php if ($rtl == 1) { ?>dir="rtl"<?php } ?>> |
| 67 |
|
| 68 |
<?php if ($close_button == 2) { firebox()->renderer->public->render('closebutton', ['box' => $this->data->get('box', [])]); } ?> |
| 69 |
|
| 70 |
<div class="fb-dialog <?php echo esc_attr(implode(' ', (array) $box->get('dialog_classes', []))); ?>" style="<?php echo esc_attr($box->get('style')); ?>" role="dialog" tabindex="-1"> |
| 71 |
|
| 72 |
<?php if ($close_button == 1) { firebox()->renderer->public->render('closebutton', ['box' => $this->data->get('box', [])]); } ?> |
| 73 |
|
| 74 |
<div class="fb-container"> |
| 75 |
<div class="fb-content"> |
| 76 |
<?php |
| 77 |
echo $box->get('post_content'); |
| 78 |
?> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
<?php if (!empty($custom_code)): ?> |
| 82 |
<script type="text/javascript" class="fb-<?php echo esc_attr($box->get('ID')); ?>-custom-code"><?php echo $custom_code; ?></script> |
| 83 |
<?php endif; ?> |
| 84 |
</div> |
| 85 |
</div> |