| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.7 Free | |
| 4 | + * @version 3.1.14 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <[email protected]> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | 8 | * @copyright Copyright © 2026 FirePlugins All Rights Reserved |
| @@ -194,10 +194,15 @@ | ||
| 194 | 194 | |
| 195 | 195 | // Does the new meta value exist? |
| 196 | 196 | $valueExistsInNewMeta = isset($new_meta[$key]); |
| 197 | 197 | |
| 198 | - // Set new meta value from legacy meta value | |
| 199 | - if (!isset($new_meta[$key]) && isset($legacyValue)) | |
| 198 | + // Set new meta value from legacy meta value. Always assign (even when | |
| 199 | + // $legacyValue is null, i.e. no legacy counterpart exists) so the key | |
| 200 | + // exists throughout the transform stage below — direct array access on | |
| 201 | + // an existing-but-null key doesn't warn, whereas leaving the key entirely | |
| 202 | + // absent does. Null placeholders are stripped before the final defaults | |
| 203 | + // backfill so they don't clobber a field's documented default. | |
| 204 | + if (!isset($new_meta[$key])) | |
| 200 | 205 | { |
| 201 | 206 | $new_meta[$key] = $legacyValue; |
| 202 | 207 | } |
| 203 | 208 | |
| @@ -209,22 +214,31 @@ | ||
| 209 | 214 | } |
| 210 | 215 | } |
| 211 | 216 | } |
| 212 | 217 | |
| 213 | - // Set defaults if empty, i.e. we're creating a new blank campaign | |
| 214 | - if (empty($new_meta)) | |
| 215 | - { | |
| 216 | - $new_meta = $defaults; | |
| 217 | - } | |
| 218 | + // Drop null placeholders (keys with no legacy counterpart, kept in the array | |
| 219 | + // only so the transform stage above could access them without warnings), then | |
| 220 | + // backfill any key still missing — including every key, if there was no legacy | |
| 221 | + // meta at all, i.e. a brand new campaign — with its documented default, without | |
| 222 | + // clobbering keys that were actually migrated from legacy data. | |
| 223 | + $new_meta = array_filter($new_meta, function ($v) { return $v !== null; }); | |
| 224 | + $new_meta = array_merge($defaults, $new_meta); | |
| 218 | 225 | |
| 219 | 226 | $this->is_running = false; |
| 220 | 227 | |
| 221 | - return $single ? $new_meta : [$new_meta]; | |
| 228 | + // WP always expects filters on `get_post_metadata` to return the value | |
| 229 | + // wrapped in an array; it unwraps to $value[0] itself when $single is true. | |
| 230 | + return [$new_meta]; | |
| 222 | 231 | } |
| 223 | 232 | |
| 233 | + /** | |
| 234 | + * Returns null (not '') when no legacy counterpart exists, so the caller can tell | |
| 235 | + * "no legacy value" apart from "legacy value is an empty string" and fall back to | |
| 236 | + * the field's documented default instead of persisting an empty string. | |
| 237 | + */ | |
| 224 | 238 | private function getValueFromLegacyMeta($key, $value, $new_meta, $legacy_meta) |
| 225 | 239 | { |
| 226 | - $_value = ''; | |
| 240 | + $_value = null; | |
| 227 | 241 | |
| 228 | 242 | if (strpos($key, '.') !== false) |
| 229 | 243 | { |
| 230 | 244 | list($first_part, $second_part) = explode('.', $key, 2); |
| @@ -370,8 +384,19 @@ | ||
| 370 | 384 | 'bgimagefile' => '', |
| 371 | 385 | 'bgrepeat' => 'Repeat', |
| 372 | 386 | 'bgsize' => 'Auto', |
| 373 | 387 | 'bgposition' => 'Left Top', |
| 388 | + | |
| 389 | + // Advanced | |
| 390 | + 'customcode' => '', | |
| 391 | + 'customcss' => '', | |
| 392 | + 'testmode' => false, | |
| 393 | + 'preventpagescroll' => false, | |
| 394 | + 'stats' => true, | |
| 395 | + 'classsuffix' => '', | |
| 396 | + 'zindex' => 99999, | |
| 397 | + | |
| 398 | + | |
| 374 | 399 | |
| 375 | 400 | // Deprecated |
| 376 | 401 | 'fontsize' => [ |
| 377 | 402 | 'desktop' => '16px' |