|
| 1 | +From 206b1bce899935e7fb5f04d5186e7a8d0dbe4066 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Fabian Marz < [email protected]> |
| 3 | +Date: Thu, 29 Aug 2024 15:14:41 +0200 |
| 4 | +Subject: [PATCH] fix: PHP deprecation notices |
| 5 | + |
| 6 | +--- |
| 7 | + classes/helpers.php | 2 +- |
| 8 | + classes/main.php | 2 +- |
| 9 | + 2 files changed, 2 insertions(+), 2 deletions(-) |
| 10 | + |
| 11 | +diff --git a/classes/helpers.php b/classes/helpers.php |
| 12 | +index 5f7bcdfe3..89ac85399 100644 |
| 13 | +--- a/classes/helpers.php |
| 14 | ++++ b/classes/helpers.php |
| 15 | +@@ -35,7 +35,7 @@ class Helpers { |
| 16 | + $post_id = 'options'; |
| 17 | + } |
| 18 | + |
| 19 | +- return str_replace( sprintf( '_%s', pll_current_language( 'locale' ) ), '', $post_id ); |
| 20 | ++ return $post_id ? str_replace( sprintf( '_%s', pll_current_language( 'locale' ) ), '', $post_id ) : 0; |
| 21 | + } |
| 22 | + |
| 23 | + |
| 24 | +diff --git a/classes/main.php b/classes/main.php |
| 25 | +index b2638fbcc..549e36606 100644 |
| 26 | +--- a/classes/main.php |
| 27 | ++++ b/classes/main.php |
| 28 | +@@ -47,7 +47,7 @@ class Main { |
| 29 | + * |
| 30 | + */ |
| 31 | + public function get_default_reference( $reference, $field_name, $post_id ) { |
| 32 | +- if ( ! empty( $reference ) ) { |
| 33 | ++ if ( ! empty( $reference ) || !$post_id) { |
| 34 | + return $reference; |
| 35 | + } |
| 36 | + |
| 37 | +-- |
| 38 | +2.39.2 |
| 39 | + |
0 commit comments