PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/model.php +7 -37 2.8.42.7.3 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Setups the language and translations model based on WordPress taxonomies
8 5 *
@@ -104,8 +101,15 @@
104 101 $languages[ $k ] = new PLL_Language( $v );
105 102 }
106 103 }
107 104
105 + // Custom flags
106 + if ( ! PLL_ADMIN ) {
107 + foreach ( $languages as $language ) {
108 + $language->set_custom_flag();
109 + }
110 + }
111 +
108 112 /**
109 113 * Filter the list of languages *after* it is stored in the persistent cache
110 114 * /!\ this filter is fired *before* the $polylang object is available
111 115 *
@@ -438,42 +442,8 @@
438 442
439 443 // PHPCS:ignore WordPress.DB.PreparedSQL.NotPrepared
440 444 return $wpdb->get_var( $select . $join . $where );
441 445 }
442 -
443 - /**
444 - * Checks if a term slug exists in a given language, taxonomy, hierarchy
445 - *
446 - * @since 1.9
447 - * @since 2.8 Moved from PLL_Share_Term_Slug::term_exists() to PLL_Model::term_exists_by_slug()
448 - *
449 - * @param string $slug The term slug to test.
450 - * @param string|object $language The language slug or object.
451 - * @param string $taxonomy Optional taxonomy name.
452 - * @param int $parent Optional parent term id.
453 - * @return null|int The term_id of the found term.
454 - */
455 - public function term_exists_by_slug( $slug, $language, $taxonomy = '', $parent = 0 ) {
456 - global $wpdb;
457 -
458 - $select = "SELECT t.term_id FROM {$wpdb->terms} AS t";
459 - $join = " INNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id";
460 - $join .= $this->term->join_clause();
461 - $where = $wpdb->prepare( ' WHERE t.slug = %s', $slug );
462 - $where .= $this->term->where_clause( $this->get_language( $language ) );
463 -
464 - if ( ! empty( $taxonomy ) ) {
465 - $where .= $wpdb->prepare( ' AND tt.taxonomy = %s', $taxonomy );
466 - }
467 -
468 - if ( $parent > 0 ) {
469 - $where .= $wpdb->prepare( ' AND tt.parent = %d', $parent );
470 - }
471 -
472 - // PHPCS:ignore WordPress.DB.PreparedSQL.NotPrepared
473 - return $wpdb->get_var( $select . $join . $where );
474 - }
475 -
476 446
477 447 /**
478 448 * Gets the number of posts per language in a date, author or post type archive.
479 449 *