← All changes
|
includes/Extensions/LearnPress/LearnPressInline.php
+12
-11
3.2.12
→
3.3.3
View file →
| @@ -84,22 +84,23 @@ | ||
| 84 | 84 | ]; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * @todo Something | |
| 88 | + * Keep this source's notifications out of the popup loop in | |
| 89 | + * FrontEnd::get_notifications_ids(). They render inline at the hooks | |
| 90 | + * chosen in `inline_location`, never as a floating popup. | |
| 89 | 91 | * |
| 90 | - * @param [type] $exclude | |
| 91 | - * @param [type] $settings | |
| 92 | - * @return void | |
| 92 | + * `inline_location` is not read here on purpose: it can be saved as '' | |
| 93 | + * (MCP or Quick Builder create without the field), and passing that to | |
| 94 | + * array_diff() is a TypeError on PHP 8 that white-screens every page. | |
| 95 | + * | |
| 96 | + * @param bool $exclude Whether an earlier callback already excluded it. | |
| 97 | + * @param array $settings Notification settings. | |
| 98 | + * @return bool | |
| 93 | 99 | */ |
| 94 | 100 | public function show_on_exclude( $exclude, $settings ) { |
| 95 | - if ( 'inline' === $settings['type'] && $settings['source'] === $this->id ) { | |
| 96 | - $edd_location = $settings['inline_location']; | |
| 97 | - $hooks = [ 'learn-press/list-courses/layout/item/section/bottom', 'learn-press/after-course-buttons' ]; | |
| 98 | - $diff = array_diff( $hooks, $edd_location ); | |
| 99 | - if ( count( $diff ) <= count( $hooks ) ) { | |
| 100 | - return true; | |
| 101 | - } | |
| 101 | + if ( isset( $settings['type'], $settings['source'] ) && 'inline' === $settings['type'] && $this->id === $settings['source'] ) { | |
| 102 | + return true; | |
| 102 | 103 | } |
| 103 | 104 | return $exclude; |
| 104 | 105 | } |
| 105 | 106 | |