| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.23 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 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 | namespace FireBox\Core; |
| @@ -24,10 +24,8 @@ | ||
| 24 | 24 | * @var array |
| 25 | 25 | */ |
| 26 | 26 | public $box_data; |
| 27 | 27 | |
| 28 | - protected $embed_html = ''; | |
| 29 | - | |
| 30 | 28 | /** |
| 31 | 29 | * Inits Previewer |
| 32 | 30 | * |
| 33 | 31 | * @return void |
| @@ -91,9 +89,9 @@ | ||
| 91 | 89 | { |
| 92 | 90 | return false; |
| 93 | 91 | } |
| 94 | 92 | |
| 95 | - if (!\current_user_can('read_firebox', $post_id)) | |
| 93 | + if (!\current_user_can('manage_options')) | |
| 96 | 94 | { |
| 97 | 95 | return false; |
| 98 | 96 | } |
| 99 | 97 | |
| @@ -111,14 +109,10 @@ | ||
| 111 | 109 | * @return void |
| 112 | 110 | */ |
| 113 | 111 | public function hooks() |
| 114 | 112 | { |
| 115 | - if ($this->box_data->params->get('mode') !== 'embed') | |
| 116 | - { | |
| 117 | - // Set to trigger on Page Load | |
| 118 | - $this->box_data->params->set('triggermethod', 'pageload'); | |
| 119 | - } | |
| 120 | - | |
| 113 | + // Set to trigger on Page Load | |
| 114 | + $this->box_data->params->set('triggermethod', 'pageload'); | |
| 121 | 115 | // Remove Impressions |
| 122 | 116 | $this->box_data->params->set('assign_impressions_param_type', 'always'); |
| 123 | 117 | // Remove Assignments |
| 124 | 118 | $this->box_data->params->remove('assignments'); |
| @@ -129,19 +123,11 @@ | ||
| 129 | 123 | // Disable Statistics to prevent impressions from being tracked into the database |
| 130 | 124 | $this->box_data->params->set('stats', 0); |
| 131 | 125 | |
| 132 | 126 | \FireBox\Core\Helpers\Actions::run(); |
| 127 | + | |
| 128 | + firebox()->box->setBox($this->box_data)->render(); | |
| 133 | 129 | |
| 134 | - if ($this->box_data->params->get('mode') !== 'embed') | |
| 135 | - { | |
| 136 | - firebox()->box->setBox($this->box_data)->render(); | |
| 137 | - } | |
| 138 | - else | |
| 139 | - { | |
| 140 | - global $post; | |
| 141 | - $this->embed_html = \FireBox\Core\Helpers\Embed::renderCampaign($post->ID, ['draft']); | |
| 142 | - } | |
| 143 | - | |
| 144 | 130 | \add_filter('the_title', [$this, 'the_title'], 100, 1); |
| 145 | 131 | |
| 146 | 132 | \add_filter('the_content', [$this, 'the_content'], 999); |
| 147 | 133 | |
| @@ -154,9 +140,9 @@ | ||
| 154 | 140 | { |
| 155 | 141 | return ''; |
| 156 | 142 | } |
| 157 | 143 | |
| 158 | - if (!current_user_can('read_firebox', $this->box_data->ID)) | |
| 144 | + if (!current_user_can('manage_options')) | |
| 159 | 145 | { |
| 160 | 146 | return ''; |
| 161 | 147 | } |
| 162 | 148 | |
| @@ -171,9 +157,9 @@ | ||
| 171 | 157 | ], |
| 172 | 158 | admin_url('post.php') |
| 173 | 159 | ) |
| 174 | 160 | ), |
| 175 | - 'text' => esc_html(firebox()->_('FB_EDIT_CAMPAIGN')), | |
| 161 | + 'text' => esc_html(firebox()->_('FB_EDIT_FIREBOX')), | |
| 176 | 162 | ]; |
| 177 | 163 | |
| 178 | 164 | $links[] = [ |
| 179 | 165 | 'url' => esc_url( |
| @@ -183,32 +169,29 @@ | ||
| 183 | 169 | ], |
| 184 | 170 | admin_url('edit.php') |
| 185 | 171 | ) |
| 186 | 172 | ), |
| 187 | - 'text' => esc_html(firebox()->_('FB_VIEW_CAMPAIGNS')), | |
| 173 | + 'text' => esc_html(firebox()->_('FB_VIEW_FIREBOX_ITEMS')), | |
| 188 | 174 | ]; |
| 189 | 175 | |
| 190 | 176 | $content = '<div style="padding: 15px; background: #ededed;">'; |
| 191 | 177 | $content .= '<p>'; |
| 192 | 178 | $content .= esc_html(firebox()->_('FB_FIREBOX_PREVIEW_DESC')); |
| 193 | - $content .= '<br>'; | |
| 194 | - foreach ($links as $key => $link) | |
| 195 | - { | |
| 196 | - $content .= '<a href="' . esc_url($link['url']) . '">' . esc_html($link['text']) . '</a>'; | |
| 197 | - $l = array_keys($links); | |
| 198 | - if (end($l) !== $key) | |
| 199 | - { | |
| 200 | - $content .= ' <span style="display:inline-block;margin:0 6px;opacity: 0.5">|</span> '; | |
| 179 | + if (!empty($links)) | |
| 180 | + { | |
| 181 | + $content .= '<br>'; | |
| 182 | + foreach ($links as $key => $link) | |
| 183 | + { | |
| 184 | + $content .= '<a href="' . esc_url($link['url']) . '">' . esc_html($link['text']) . '</a>'; | |
| 185 | + $l = array_keys($links); | |
| 186 | + if (end($l) !== $key) | |
| 187 | + { | |
| 188 | + $content .= ' <span style="display:inline-block;margin:0 6px;opacity: 0.5">|</span> '; | |
| 189 | + } | |
| 201 | 190 | } |
| 202 | 191 | } |
| 203 | 192 | $content .= '</p>'; |
| 204 | 193 | $content .= '</div>'; |
| 205 | - | |
| 206 | - // Add embed campaign to preview page | |
| 207 | - if ($this->box_data->params->get('mode') === 'embed') | |
| 208 | - { | |
| 209 | - $content .= '<div style="margin: 30px auto; display: flex; justify-content: center;">' . $this->embed_html . '</div>'; | |
| 210 | - } | |
| 211 | 194 | |
| 212 | 195 | return $content; |
| 213 | 196 | } |
| 214 | 197 | |