anguage score filter. */ public function determine_inclusive_language_filters( $inclusive_language_filter ) { $rank = new WPSEO_Rank( $inclusive_language_filter ); return $this->create_inclusive_language_score_filter( $rank->get_starting_score(), $rank->get_end_score() ); } /** * Creates an inclusive language score filter. * * @param number $low The lower boundary of the score. * @param number $high The higher boundary of the score. * * @return array The inclusive language score filter. */ protected function create_inclusive_language_score_filter( $low, $high ) { return [ [ 'key' => WPSEO_Meta::$meta_prefix . 'inclusive_language_score', 'value' => [ $low, $high ], 'type' => 'numeric', 'compare' => 'BETWEEN', ], ]; } /** * Adds the inclusive language filter to the list of active filters -- if it has been used for filtering. * * @param array $active_filters The currently active filters. * @return array The active filters, including the inclusive language filter -- if it has been used for filtering. */ public function add_inclusive_language_filter( $active_filters ) { $inclusive_language_filter = $this->get_current_inclusive_language_filter(); if ( \is_string( $inclusive_language_filter ) && $inclusive_language_filter !== '' ) { $active_filters = \array_merge( $active_filters, $this->determine_inclusive_language_filters( $inclusive_language_filter ) ); } return $active_filters; } /** * Adds the inclusive language score field to the order by part of the query -- if it has been selected during filtering. * * @param array $order_by The current order by statement. * @param string $order_by_column The column to use for ordering. * @return array The order by. */ public function add_inclusive_language_order_by( $order_by, $order_by_column = '' ) { if ( $order_by === [] && $order_by_column === Inclusive_Language_Column_Integration::INCLUSIVE_LANGUAGE_COLUMN_NAME ) { return [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: Only used when user requests sorting. 'meta_key' => WPSEO_Meta::$meta_prefix . 'inclusive_language_score', 'orderby' => 'meta_value_num', ]; } return $order_by; } } Groupes | Amandine TRAVERS | L'Odyssée de la Terre

S'informer et comprendre notre planète

Plus

    Groupes du membre

    Médias

    Groupes

    Logo du groupe Contributeurs
    Contributeurs
    Groupe privé

    Publications récentes

    Vous ne pouvez pas copier ce contenu ! Tous droits réservés. Merci de respecter le travail de nos rédacteurs et de nos partenaires.