← All changes
|
includes/fields/class-charitable-field-sorter.php
+5
-3
1.7.0.7
→
1.8.13
View file →
| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * A class that is responsible for taking a set of fields and sorting them by priority. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Classes/Charitable_Field_Sorter |
| 6 | 6 | * @author David Bisset |
| 7 | - * @copyright Copyright (c) 2022, WP Charitable LLC | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.6.0 |
| 10 | 10 | * @version 1.6.27 |
| 11 | 11 | */ |
| @@ -104,13 +104,15 @@ | ||
| 104 | 104 | if ( $after && $before ) { |
| 105 | 105 | return ( $after->{$this->property}['priority'] + $before->{$this->property}['priority'] ) / 2; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ( $after ) { | |
| 108 | + $property = $this->property; // Store the property name in a variable. | |
| 109 | + | |
| 110 | + if ( $after && isset( $after->$property['priority'] ) && ! empty( $after->$property['priority'] ) ) { | |
| 109 | 111 | return $after->{$this->property}['priority'] + 0.5; |
| 110 | 112 | } |
| 111 | 113 | |
| 112 | - if ( $before ) { | |
| 114 | + if ( $before && isset( $before->$property['priority'] ) && ! empty( $before->$property['priority'] ) ) { | |
| 113 | 115 | return $before->{$this->property}['priority'] - 0.5; |
| 114 | 116 | } |
| 115 | 117 | |
| 116 | 118 | /* Neither show_after or show_before was set, so return the default if one was set. */ |