| @@ -1,8 +1,12 @@ | ||
| 1 | 1 | <div class="betterdocs-search-result-wrap"> |
| 2 | 2 | <ul class="docs-search-result"> |
| 3 | 3 | <?php |
| 4 | - if ( $search_results->have_posts() ) { | |
| 4 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical. | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 6 | + exit; | |
| 7 | +} | |
| 8 | +if ( $search_results->have_posts() ) { | |
| 5 | 9 | $input_not_found = ''; |
| 6 | 10 | while ( $search_results->have_posts() ) : |
| 7 | 11 | $search_results->the_post(); |
| 8 | 12 | preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', get_the_content(), $matches ); |
| @@ -37,8 +41,9 @@ | ||
| 37 | 41 | $permalink = get_permalink( $post_id ); |
| 38 | 42 | |
| 39 | 43 | // Handle WPML permalinks |
| 40 | 44 | if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) { |
| 45 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WPML public integration filter. | |
| 41 | 46 | $post_language = apply_filters( 'wpml_element_language_code', null, array( 'element_id' => $post_id, 'element_type' => 'post_docs' ) ); |
| 42 | 47 | |
| 43 | 48 | if ( $post_language ) { |
| 44 | 49 | global $sitepress; |