| @@ -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 <[email protected]> |
| 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\FB; |
| @@ -32,26 +32,8 @@ | ||
| 32 | 32 | { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - // Session-dependent conditions (Pageviews, Time on Site) are stamped and evaluated | |
| 37 | - // in the browser, so the stamper must run on every page — not just pages where a | |
| 38 | - // campaign renders — for the pageview counter and session start to stay accurate. | |
| 39 | - // | |
| 40 | - // On pages where a campaign does render, the full runtime already contains the | |
| 41 | - // stamper, so only the standalone ~1 KB script is needed elsewhere. The priority | |
| 42 | - // runs late, after the per-box enqueues added from Box::render(). | |
| 43 | - if (BoxHelper::sessionConditionsInUse($boxes)) | |
| 44 | - { | |
| 45 | - add_action('wp_enqueue_scripts', function() | |
| 46 | - { | |
| 47 | - if (!wp_script_is('firebox-main', 'enqueued')) | |
| 48 | - { | |
| 49 | - wp_enqueue_script('firebox-session-stamp'); | |
| 50 | - } | |
| 51 | - }, 100); | |
| 52 | - } | |
| 53 | - | |
| 54 | 36 | return $this->renderAll($boxes); |
| 55 | 37 | } |
| 56 | 38 | |
| 57 | 39 | /** |
| @@ -63,9 +45,9 @@ | ||
| 63 | 45 | */ |
| 64 | 46 | public function renderAll($boxes) |
| 65 | 47 | { |
| 66 | 48 | $html = ''; |
| 67 | - | |
| 49 | + | |
| 68 | 50 | if ($boxes instanceof \WP_Query) |
| 69 | 51 | { |
| 70 | 52 | if (!$boxes->have_posts()) |
| 71 | 53 | { |
| @@ -70,15 +52,9 @@ | ||
| 70 | 52 | if (!$boxes->have_posts()) |
| 71 | 53 | { |
| 72 | 54 | return; |
| 73 | 55 | } |
| 74 | - | |
| 75 | - // Backup global state | |
| 76 | - global $post, $authordata; | |
| 77 | - $originalPost = $post; | |
| 78 | - $originalAuthorData = $authordata; | |
| 79 | - | |
| 80 | - // Setup the post data for our custom query | |
| 56 | + | |
| 81 | 57 | while ($boxes->have_posts()) |
| 82 | 58 | { |
| 83 | 59 | $boxes->the_post(); |
| 84 | 60 | |
| @@ -84,9 +60,9 @@ | ||
| 84 | 60 | |
| 85 | 61 | global $post; |
| 86 | 62 | |
| 87 | 63 | $this->prepare($post); |
| 88 | - | |
| 64 | + | |
| 89 | 65 | // If the mode is embed, abort. |
| 90 | 66 | if ($post->params->get('mode') == 'embed') |
| 91 | 67 | { |
| 92 | 68 | continue; |
| @@ -93,15 +69,10 @@ | ||
| 93 | 69 | } |
| 94 | 70 | |
| 95 | 71 | $html .= $this->get_output($post); |
| 96 | 72 | } |
| 97 | - | |
| 98 | - // Reset post data | |
| 73 | + | |
| 99 | 74 | wp_reset_postdata(); |
| 100 | - | |
| 101 | - // Restore global state | |
| 102 | - $post = $originalPost; | |
| 103 | - $authordata = $originalAuthorData; | |
| 104 | 75 | } |
| 105 | 76 | else if (is_array($boxes)) |
| 106 | 77 | { |
| 107 | 78 | foreach ($boxes as $box) |
| @@ -129,9 +100,10 @@ | ||
| 129 | 100 | * @return void |
| 130 | 101 | */ |
| 131 | 102 | private function prepare(&$box) |
| 132 | 103 | { |
| 133 | - $meta = BoxHelper::getMeta($box->ID); | |
| 104 | + // get meta options for box | |
| 105 | + $meta = get_post_meta($box->ID, 'fpframework_meta_settings', true); | |
| 134 | 106 | $box->params = new Registry($meta); |
| 135 | 107 | } |
| 136 | 108 | |
| 137 | 109 | /** |
| @@ -142,9 +114,9 @@ | ||
| 142 | 114 | * @return string |
| 143 | 115 | */ |
| 144 | 116 | private function get_output($box) |
| 145 | 117 | { |
| 146 | - $logged_and_admin = (is_user_logged_in() && current_user_can('edit_fireboxes')); | |
| 118 | + $logged_and_admin = (is_user_logged_in() && current_user_can('manage_options')); | |
| 147 | 119 | |
| 148 | 120 | $testmode = $box->params->get('testmode', false); |
| 149 | 121 | |
| 150 | 122 | // if box is in test mode only logged-in admin users can see it. |