PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | includes/classes/Feature/SearchOrdering/SearchOrdering.php +24 -24 5.0.25.3.5 View file →
@@ -51,14 +51,10 @@
51 51 */
52 52 public function __construct() {
53 53 $this->slug = 'searchordering';
54 54
55 - $this->title = esc_html__( 'Custom Search Results', 'elasticpress' );
55 + $this->group = 'core-search';
56 56
57 - $this->summary = '<p>' . __( 'Selected posts will be inserted into search results in the specified position.', 'elasticpress' ) . '</p>';
58 -
59 - $this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#custom-search-results', 'elasticpress' );
60 -
61 57 $this->requires_install_reindex = false;
62 58
63 59 $this->requires_feature = 'search';
64 60
@@ -65,8 +61,22 @@
65 61 parent::__construct();
66 62 }
67 63
68 64 /**
65 + * Sets i18n strings.
66 + *
67 + * @return void
68 + * @since 5.2.0
69 + */
70 + public function set_i18n_strings(): void {
71 + $this->title = esc_html__( 'Custom Search Results', 'elasticpress' );
72 +
73 + $this->summary = '<p>' . __( 'Selected posts will be inserted into search results in the specified position.', 'elasticpress' ) . '</p>';
74 +
75 + $this->docs_url = __( 'https://www.elasticpress.io/resources/articles/configuring-elasticpress-via-the-plugin-dashboard/#custom-search-results', 'elasticpress' );
76 + }
77 +
78 + /**
69 79 * Setup Feature Functionality
70 80 */
71 81 public function setup() {
72 82 /** Features Class @var Features $features */
@@ -180,22 +190,13 @@
180 190 * Requires the search feature to be activated
181 191 *
182 192 * @return FeatureRequirementsStatus
183 193 */
184 - public function requirements_status() : FeatureRequirementsStatus {
185 - return new FeatureRequirementsStatus( 0 );
194 + public function requirements_status(): FeatureRequirementsStatus {
195 + return new FeatureRequirementsStatus( 0, null, $this );
186 196 }
187 197
188 198 /**
189 - * Output feature box long
190 - */
191 - public function output_feature_box_long() {
192 - ?>
193 - <p><?php esc_html_e( 'Selected posts will be inserted into search results in the specified position.', 'elasticpress' ); ?></p>
194 - <?php
195 - }
196 -
197 - /**
198 199 * Adds this taxonomy as one of the taxonomies to index
199 200 *
200 201 * @param array $taxonomies Current indexable taxonomies
201 202 *
@@ -214,9 +215,9 @@
214 215 add_submenu_page(
215 216 'elasticpress',
216 217 esc_html__( 'Custom Results', 'elasticpress' ),
217 218 esc_html__( 'Custom Results', 'elasticpress' ),
218 - Utils\get_capability(),
219 + Utils\get_capability( 'search-ordering' ),
219 220 'edit.php?post_type=' . self::POST_TYPE_NAME
220 221 );
221 222 }
222 223
@@ -293,15 +294,15 @@
293 294 'show_ui' => true,
294 295 'show_in_menu' => false,
295 296 'query_var' => true,
296 297 'rewrite' => array( 'slug' => 'ep-pointer' ),
297 - 'capabilities' => Utils\get_post_map_capabilities(),
298 + 'capabilities' => Utils\get_post_map_capabilities( 'search-ordering' ),
298 299 'has_archive' => false,
299 300 'hierarchical' => false,
300 301 'menu_position' => 100,
301 302 'supports' => [ 'title' ],
302 303 'register_meta_box_cb' => [ $this, 'register_meta_box' ],
303 - 'menu_icon' => 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNzMgNzEuMyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNzMgNzEuMzsiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ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Ny0wLjdsNi40LTYuNGMyLjEsMS4yLDQuNSwxLjksNy4xLDEuOWM4LDAsMTQuNS02LjUsMTQuNS0xNC41cy02LjUtMTQuNS0xNC41LTE0LjVTMjIsMjcuNiwyMiwzNS42YzAsMi44LDAuOCw1LjMsMi4xLDcuNWwtNi40LDYuNGMtMi45LTMuOS00LjYtOC43LTQuNi0xMy45YzAtMTIuOSwxMC41LTIzLjQsMjMuNC0yMy40czIzLjQsMTAuNSwyMy40LDIzLjRTNDkuNCw1OSwzNi41LDU5Yy0yLjEsMC00LjEtMC4zLTYtMC44bC0wLjYsMC42bC01LjIsNS40YzMuNiwxLjUsNy42LDIuMywxMS44LDIuM2MxNy4xLDAsMzAuOS0xMy45LDMwLjktMzAuOVM1My42LDQuNywzNi41LDQuN3oiIGZpbGw9IiNhN2FhYWQiLz48L3N2Zz4=',
304 305 );
305 306
306 307 register_post_type( self::POST_TYPE_NAME, $args );
307 308
@@ -491,8 +492,9 @@
491 492 if ( intval( $order_data['order'] ) <= $posts_per_page ) {
492 493 $final_order_data[] = [
493 494 'ID' => intval( $order_data['ID'] ),
494 495 'order' => intval( $order_data['order'] ),
496 + 'type' => ! empty( $order_data['type'] ) ? sanitize_text_field( $order_data['type'] ) : 'reordered',
495 497 ];
496 498 } else {
497 499 $previous_post_ids[ intval( $order_data['ID'] ) ] = true;
498 500 }
@@ -652,15 +654,14 @@
652 654
653 655 $to_inject = array();
654 656
655 657 foreach ( $posts as $key => &$post ) {
656 - if ( isset( $post->terms ) && isset( $post->terms[ self::TAXONOMY_NAME ] ) ) {
657 - foreach ( $post->terms[ self::TAXONOMY_NAME ] as $current_term ) {
658 + $terms = is_string( $post->terms ) ? json_decode( wp_specialchars_decode( $post->terms, ENT_QUOTES ), true ) : (array) $post->terms;
659 + if ( isset( $terms[ self::TAXONOMY_NAME ] ) ) {
660 + foreach ( $terms[ self::TAXONOMY_NAME ] as $current_term ) {
658 661 if ( strtolower( $current_term['name'] ) === $search_query ) {
659 662 $to_inject[ $current_term['term_order'] ] = $post;
660 -
661 663 unset( $posts[ $key ] );
662 -
663 664 break;
664 665 }
665 666 }
666 667 }
@@ -794,6 +795,5 @@
794 795 }
795 796
796 797 return $admin_title;
797 798 }
798 -
799 799 }