| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.7 Free | |
| 4 | + * @version 2.1.4 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; |
| @@ -45,9 +45,9 @@ | ||
| 45 | 45 | */ |
| 46 | 46 | public function renderAll($boxes) |
| 47 | 47 | { |
| 48 | 48 | $html = ''; |
| 49 | - | |
| 49 | + | |
| 50 | 50 | if ($boxes instanceof \WP_Query) |
| 51 | 51 | { |
| 52 | 52 | if (!$boxes->have_posts()) |
| 53 | 53 | { |
| @@ -52,15 +52,9 @@ | ||
| 52 | 52 | if (!$boxes->have_posts()) |
| 53 | 53 | { |
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | - | |
| 57 | - // Backup global state | |
| 58 | - global $post, $authordata; | |
| 59 | - $originalPost = $post; | |
| 60 | - $originalAuthorData = $authordata; | |
| 61 | - | |
| 62 | - // Setup the post data for our custom query | |
| 56 | + | |
| 63 | 57 | while ($boxes->have_posts()) |
| 64 | 58 | { |
| 65 | 59 | $boxes->the_post(); |
| 66 | 60 | |
| @@ -66,24 +60,13 @@ | ||
| 66 | 60 | |
| 67 | 61 | global $post; |
| 68 | 62 | |
| 69 | 63 | $this->prepare($post); |
| 70 | - | |
| 71 | - // If the mode is embed, abort. | |
| 72 | - if ($post->params->get('mode') == 'embed') | |
| 73 | - { | |
| 74 | - continue; | |
| 75 | - } | |
| 76 | 64 | |
| 77 | 65 | $html .= $this->get_output($post); |
| 78 | 66 | } |
| 79 | - | |
| 80 | - // Reset post data | |
| 67 | + | |
| 81 | 68 | wp_reset_postdata(); |
| 82 | - | |
| 83 | - // Restore global state | |
| 84 | - $post = $originalPost; | |
| 85 | - $authordata = $originalAuthorData; | |
| 86 | 69 | } |
| 87 | 70 | else if (is_array($boxes)) |
| 88 | 71 | { |
| 89 | 72 | foreach ($boxes as $box) |
| @@ -88,14 +71,8 @@ | ||
| 88 | 71 | { |
| 89 | 72 | foreach ($boxes as $box) |
| 90 | 73 | { |
| 91 | 74 | $this->prepare($box); |
| 92 | - | |
| 93 | - // If the mode is embed, abort. | |
| 94 | - if ($box->params->get('mode') == 'embed') | |
| 95 | - { | |
| 96 | - continue; | |
| 97 | - } | |
| 98 | 75 | |
| 99 | 76 | $html .= $this->get_output($box); |
| 100 | 77 | } |
| 101 | 78 | } |
| @@ -111,9 +88,10 @@ | ||
| 111 | 88 | * @return void |
| 112 | 89 | */ |
| 113 | 90 | private function prepare(&$box) |
| 114 | 91 | { |
| 115 | - $meta = BoxHelper::getMeta($box->ID); | |
| 92 | + // get meta options for box | |
| 93 | + $meta = get_post_meta($box->ID, 'fpframework_meta_settings', true); | |
| 116 | 94 | $box->params = new Registry($meta); |
| 117 | 95 | } |
| 118 | 96 | |
| 119 | 97 | /** |
| @@ -124,9 +102,9 @@ | ||
| 124 | 102 | * @return string |
| 125 | 103 | */ |
| 126 | 104 | private function get_output($box) |
| 127 | 105 | { |
| 128 | - $logged_and_admin = (is_user_logged_in() && current_user_can('edit_fireboxes')); | |
| 106 | + $logged_and_admin = (is_user_logged_in() && current_user_can('manage_options')); | |
| 129 | 107 | |
| 130 | 108 | $testmode = $box->params->get('testmode', false); |
| 131 | 109 | |
| 132 | 110 | // if box is in test mode only logged-in admin users can see it. |