| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.0 Free | |
| 4 | + * @version 2.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2024 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | if (!defined('ABSPATH')) |
| @@ -14,56 +14,19 @@ | ||
| 14 | 14 | exit; // Exit if accessed directly. |
| 15 | 15 | } |
| 16 | 16 | $box = $this->data->get('box', []); |
| 17 | 17 | $box = new \FPFramework\Libs\Registry($box); |
| 18 | -$params = $this->data->get('params', []); | |
| 19 | -$params = new \FPFramework\Libs\Registry($params); | |
| 20 | 18 | |
| 21 | 19 | $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 | 20 | |
| 28 | 21 | $close_button = (int) $box->get('params.data.closebutton.show', ''); |
| 29 | 22 | |
| 30 | 23 | $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 | 24 | ?> |
| 61 | 25 | <div data-id="<?php echo esc_attr($box->get('ID')); ?>" |
| 62 | 26 | class="fb-inst fb-hide <?php echo esc_attr(implode(' ', (array) $box->get('classes'))); ?>" |
| 63 | - data-options='<?php echo json_encode($box->get('settings')) ?>' | |
| 27 | + data-options='<?php echo wp_json_encode($box->get('settings'), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP); ?>' | |
| 64 | 28 | 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 | 29 | <?php if ($rtl == 1) { ?>dir="rtl"<?php } ?>> |
| 67 | 30 | |
| 68 | 31 | <?php if ($close_button == 2) { firebox()->renderer->public->render('closebutton', ['box' => $this->data->get('box', [])]); } ?> |
| 69 | 32 | |
| @@ -72,14 +35,17 @@ | ||
| 72 | 35 | <?php if ($close_button == 1) { firebox()->renderer->public->render('closebutton', ['box' => $this->data->get('box', [])]); } ?> |
| 73 | 36 | |
| 74 | 37 | <div class="fb-container"> |
| 75 | 38 | <div class="fb-content"> |
| 76 | - <?php | |
| 77 | - echo $box->get('post_content'); | |
| 78 | - ?> | |
| 39 | + <?php echo $box->get('post_content'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 79 | 40 | </div> |
| 80 | 41 | </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; ?> | |
| 42 | + <?php | |
| 43 | + if (is_string($custom_code) && !empty($custom_code)) | |
| 44 | + { | |
| 45 | + $custom_code = html_entity_decode(stripslashes($custom_code)); | |
| 46 | + wp_add_inline_script('firebox', $custom_code); | |
| 47 | + } | |
| 48 | + ?> | |
| 84 | 49 | </div> |
| 85 | -</div> | |
| 50 | +</div> | |
| 51 | +<?php | |