settings->get(); $langs = array_map( 'strval', array_keys( $settings->other_languages() ) ); $types = $settings->post_types(); $urls = array_map( array( $this->urls, 'lang_home' ), $langs ); if ( $langs && $types ) { $tin = implode( ',', array_fill( 0, count( $types ), '%s' ) ); $lin = implode( ',', array_fill( 0, count( $langs ), '%s' ) ); // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare -- $tin and $lin hold placeholders. $ids = $this->db->get_col( $this->db->prepare( "SELECT p.ID FROM %i p INNER JOIN %i t ON t.object_type = 'post' AND t.object_id = p.ID WHERE p.post_status = 'publish' AND p.post_type IN ({$tin}) AND t.lang IN ({$lin}) ORDER BY p.post_type = 'page' DESC, p.menu_order ASC, p.post_date DESC LIMIT %d", array_merge( array( $this->db->posts, $this->schema->translations() ), $types, $langs, array( $max ) ) ) ); // phpcs:enable foreach ( $ids as $id ) { $urls[] = (string) get_permalink( (int) $id ); } } return array_values( array_unique( array_filter( $urls ) ) ); } }