← All changes
|
vendor/codeinwp/themeisle-sdk/src/Modules/Featured_plugins.php
+4
-31
4.0.4
→
3.11.14
View file →
| @@ -174,9 +174,12 @@ | ||
| 174 | 174 | * @return array |
| 175 | 175 | */ |
| 176 | 176 | private function maybe_prepend_lms_plugin( $plugins, $args ) { |
| 177 | 177 | $search = isset( $args->search ) ? strtolower( $args->search ) : ''; |
| 178 | - if ( $this->matches_lms_search_keywords( $search ) ) { | |
| 178 | + if ( | |
| 179 | + strpos( $search, 'lms' ) !== false || | |
| 180 | + strpos( $search, 'learn' ) !== false | |
| 181 | + ) { | |
| 179 | 182 | $filter_slugs = apply_filters( 'themeisle_sdk_masteriyo_filter_slugs', [ 'learning-management-system' ] ); |
| 180 | 183 | $masteriyo = $this->get_plugins_filtered_from_author( $args, $filter_slugs, 'masteriyo' ); |
| 181 | 184 | |
| 182 | 185 | if ( ! empty( $masteriyo ) ) { |
| @@ -192,38 +195,8 @@ | ||
| 192 | 195 | $plugins = array_merge( $masteriyo, $plugins ); |
| 193 | 196 | } |
| 194 | 197 | } |
| 195 | 198 | return $plugins; |
| 196 | - } | |
| 197 | - | |
| 198 | - /** | |
| 199 | - * Check if a plugin search query matches LMS-related terms. | |
| 200 | - * | |
| 201 | - * @param string $search Search query. | |
| 202 | - * | |
| 203 | - * @return bool True if the search query matches LMS-related terms. | |
| 204 | - */ | |
| 205 | - private function matches_lms_search_keywords( $search ) { | |
| 206 | - $lms_keywords = array( | |
| 207 | - 'lms', | |
| 208 | - 'learn', | |
| 209 | - 'course', | |
| 210 | - 'courses', | |
| 211 | - 'learning', | |
| 212 | - 'academy', | |
| 213 | - 'training', | |
| 214 | - 'student', | |
| 215 | - 'students', | |
| 216 | - 'quiz', | |
| 217 | - ); | |
| 218 | - | |
| 219 | - foreach ( $lms_keywords as $keyword ) { | |
| 220 | - if ( preg_match( '/(^|[^a-z0-9])' . preg_quote( $keyword, '/' ) . '([^a-z0-9]|$)/', $search ) === 1 ) { | |
| 221 | - return true; | |
| 222 | - } | |
| 223 | - } | |
| 224 | - | |
| 225 | - return false; | |
| 226 | 199 | } |
| 227 | 200 | |
| 228 | 201 | /** |
| 229 | 202 | * Query plugins by author. |