| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.11 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2022 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,9 +84,9 @@ | ||
| 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 | 90 | if (!$this->box_data = firebox()->box->get($box_id)) |
| 92 | 91 | { |
| 93 | 92 | return false; |
| @@ -102,17 +101,25 @@ | ||
| 102 | 101 | * @return void |
| 103 | 102 | */ |
| 104 | 103 | public function hooks() |
| 105 | 104 | { |
| 106 | - // Remove assignments | |
| 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 | |
| 107 | 110 | $this->box_data->params->remove('assignments'); |
| 111 | + // Remove Rules | |
| 112 | + $this->box_data->params->remove('rules'); | |
| 108 | 113 | // Enable Test Mode to prevent cookies |
| 109 | 114 | $this->box_data->params->set('testmode', true); |
| 110 | 115 | // Disable Statistics to prevent impressions from being tracked into the database |
| 111 | 116 | $this->box_data->params->set('stats', 0); |
| 112 | 117 | |
| 113 | - firebox()->box->render($this->box_data); | |
| 118 | + \FireBox\Core\Helpers\Actions::run(); | |
| 114 | 119 | |
| 120 | + firebox()->box->setBox($this->box_data)->render(); | |
| 121 | + | |
| 115 | 122 | \add_filter('the_title', [$this, 'the_title'], 100, 1); |
| 116 | 123 | |
| 117 | 124 | \add_filter('the_content', [$this, 'the_content'], 999); |
| 118 | 125 | |
| @@ -129,9 +136,9 @@ | ||
| 129 | 136 | if (!current_user_can('manage_options')) |
| 130 | 137 | { |
| 131 | 138 | return ''; |
| 132 | 139 | } |
| 133 | - | |
| 140 | + | |
| 134 | 141 | $links = []; |
| 135 | 142 | |
| 136 | 143 | $links[] = [ |
| 137 | 144 | 'url' => esc_url( |