| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 1.0.2 Free | |
| 4 | + * @version 3.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2026 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\FB\Actions; |
| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | * @param string $function |
| 25 | 25 | * |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | - protected function delayFunction($delay = 0, $function) | |
| 28 | + protected function delayFunction($delay = 0, $function = '') | |
| 29 | 29 | { |
| 30 | 30 | if ($delay == 0) |
| 31 | 31 | { |
| 32 | 32 | return $function; |
| @@ -41,8 +41,13 @@ | ||
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | 43 | private function _OpenBox() |
| 44 | 44 | { |
| 45 | + if (!isset($this->item['box'])) | |
| 46 | + { | |
| 47 | + return; | |
| 48 | + } | |
| 49 | + | |
| 45 | 50 | return $this->delayFunction($this->item['delay'], 'FireBox.getInstance(' . $this->item['box'] . ').open();'); |
| 46 | 51 | } |
| 47 | 52 | |
| 48 | 53 | /** |
| @@ -51,8 +56,13 @@ | ||
| 51 | 56 | * @return string |
| 52 | 57 | */ |
| 53 | 58 | private function _CloseBox() |
| 54 | 59 | { |
| 60 | + if (!isset($this->item['box'])) | |
| 61 | + { | |
| 62 | + return; | |
| 63 | + } | |
| 64 | + | |
| 55 | 65 | return $this->delayFunction($this->item['delay'], 'FireBox.getInstance(' . $this->item['box'] . ').close();'); |
| 56 | 66 | } |
| 57 | 67 | |
| 58 | 68 | /** |
| @@ -71,8 +81,13 @@ | ||
| 71 | 81 | * @return string |
| 72 | 82 | */ |
| 73 | 83 | private function _DestroyBox() |
| 74 | 84 | { |
| 85 | + if (!isset($this->item['box'])) | |
| 86 | + { | |
| 87 | + return; | |
| 88 | + } | |
| 89 | + | |
| 75 | 90 | return 'FireBox.getInstance(' . esc_attr($this->item['box']) . ').destroy();'; |
| 76 | 91 | } |
| 77 | 92 | |
| 78 | 93 | /** |
| @@ -98,12 +113,21 @@ | ||
| 98 | 113 | |
| 99 | 114 | /** |
| 100 | 115 | * The script for the "Run Javascript" action. It executes the custom Javascript code specified by the administrator. |
| 101 | 116 | * |
| 117 | + * The code is campaign-authored and emitted verbatim, so it runs only when the | |
| 118 | + * campaign's author holds unfiltered_html — the same gate as the Custom | |
| 119 | + * JavaScript setting. | |
| 120 | + * | |
| 102 | 121 | * @return string |
| 103 | 122 | */ |
| 104 | 123 | private function _Custom() |
| 105 | 124 | { |
| 125 | + if (!\FireBox\Core\Helpers\CustomCode::isAllowedForCampaign($this->box_id)) | |
| 126 | + { | |
| 127 | + return; | |
| 128 | + } | |
| 129 | + | |
| 106 | 130 | return $this->item['customcode']; |
| 107 | 131 | } |
| 108 | 132 | |
| 109 | 133 | /** |