| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.2 Free | |
| 4 | + * @version 2.0.10 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 © 2023 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core; |
| @@ -15,11 +15,10 @@ | ||
| 15 | 15 | { |
| 16 | 16 | exit; // Exit if accessed directly. |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -use \FPFramework\Libs\Registry; | |
| 20 | - | |
| 21 | -class Previewer { | |
| 19 | +class Previewer | |
| 20 | +{ | |
| 22 | 21 | /** |
| 23 | 22 | * FireBox data. |
| 24 | 23 | * |
| 25 | 24 | * @var array |
| @@ -85,11 +84,11 @@ | ||
| 85 | 84 | { |
| 86 | 85 | return false; |
| 87 | 86 | } |
| 88 | 87 | |
| 89 | - $box_id = \absint($_GET['p']); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 88 | + $box_id = \absint($_GET['p']); | |
| 90 | 89 | |
| 91 | - if (!$this->box_data = firebox()->boxes->getBox()->get($box_id, null)) | |
| 90 | + if (!$this->box_data = firebox()->box->get($box_id)) | |
| 92 | 91 | { |
| 93 | 92 | return false; |
| 94 | 93 | } |
| 95 | 94 | |
| @@ -102,10 +101,25 @@ | ||
| 102 | 101 | * @return void |
| 103 | 102 | */ |
| 104 | 103 | public function hooks() |
| 105 | 104 | { |
| 106 | - firebox()->boxes->getBox()->render($this->box_data); | |
| 105 | + // Set to trigger on Page Load | |
| 106 | + $this->box_data->params->set('triggermethod', 'pageload'); | |
| 107 | + // Remove Impressions | |
| 108 | + $this->box_data->params->set('assign_impressions_param_type', 'always'); | |
| 109 | + // Remove Assignments | |
| 110 | + $this->box_data->params->remove('assignments'); | |
| 111 | + // Remove Rules | |
| 112 | + $this->box_data->params->remove('rules'); | |
| 113 | + // Enable Test Mode to prevent cookies | |
| 114 | + $this->box_data->params->set('testmode', true); | |
| 115 | + // Disable Statistics to prevent impressions from being tracked into the database | |
| 116 | + $this->box_data->params->set('stats', 0); | |
| 117 | + | |
| 118 | + \FireBox\Core\Helpers\Actions::run(); | |
| 107 | 119 | |
| 120 | + firebox()->box->setBox($this->box_data)->render(); | |
| 121 | + | |
| 108 | 122 | \add_filter('the_title', [$this, 'the_title'], 100, 1); |
| 109 | 123 | |
| 110 | 124 | \add_filter('the_content', [$this, 'the_content'], 999); |
| 111 | 125 | |
| @@ -122,9 +136,9 @@ | ||
| 122 | 136 | if (!current_user_can('manage_options')) |
| 123 | 137 | { |
| 124 | 138 | return ''; |
| 125 | 139 | } |
| 126 | - | |
| 140 | + | |
| 127 | 141 | $links = []; |
| 128 | 142 | |
| 129 | 143 | $links[] = [ |
| 130 | 144 | 'url' => esc_url( |
| @@ -158,9 +172,9 @@ | ||
| 158 | 172 | { |
| 159 | 173 | $content .= '<br>'; |
| 160 | 174 | foreach ($links as $key => $link) |
| 161 | 175 | { |
| 162 | - $content .= '<a href="' . $link['url'] . '">' . $link['text'] . '</a>'; | |
| 176 | + $content .= '<a href="' . esc_url($link['url']) . '">' . esc_html($link['text']) . '</a>'; | |
| 163 | 177 | $l = array_keys($links); |
| 164 | 178 | if (end($l) !== $key) |
| 165 | 179 | { |
| 166 | 180 | $content .= ' <span style="display:inline-block;margin:0 6px;opacity: 0.5">|</span> '; |