Current File : /home/bdmcricketindia.in/public_html/wp-includes/class-wp-term.php
<?php
/**
 * Taxonomy API: WP_Term class
 *
 * @package WordPress
 * @subpackage Taxonomy
 * @since 4.4.0
 */

/**
 * Core class used to implement the WP_Term object.
 *
 * @since 4.4.0
 *
 * @property-read object $data Sanitized term data.
 */
#[AllowDynamicProperties]
final class WP_Term {

	/**
	 * Term ID.
	 *
	 * @since 4.4.0
	 * @var int
	 */
	public $term_id;

	/**
	 * The term's name.
	 *
	 * @since 4.4.0
	 * @var string
	 */
	public $name = '';

	/**
	 * The term's slug.
	 *
	 * @since 4.4.0
	 * @var string
	 */
	public $slug = '';

	/**
	 * The term's term_group.
	 *
	 * @since 4.4.0
	 * @var int
	 */
	public $term_group = '';

	/**
	 * Term Taxonomy ID.
	 *
	 * @since 4.4.0
	 * @var int
	 */
	public $term_taxonomy_id = 0;

	/**
	 * The term's taxonomy name.
	 *
	 * @since 4.4.0
	 * @var string
	 */
	public $taxonomy = '';

	/**
	 * The term's description.
	 *
	 * @since 4.4.0
	 * @var string
	 */
	public $description = '';

	/**
	 * ID of a term's parent term.
	 *
	 * @since 4.4.0
	 * @var int
	 */
	public $parent = 0;

	/**
	 * Cached object count for this term.
	 *
	 * @since 4.4.0
	 * @var int
	 */
	public $count = 0;

	/**
	 * Stores the term object's sanitization level.
	 *
	 * Does not correspond to a database field.
	 *
	 * @since 4.4.0
	 * @var string
	 */
	public $filter = 'raw';

	/**
	 * Retrieve WP_Term instance.
	 *
	 * @since 4.4.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param int    $term_id  Term ID.
	 * @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`. Only used for
	 *                         disambiguating potentially shared terms.
	 * @return WP_Term|WP_Error|false Term object, if found. WP_Error if `$term_id` is shared between taxonomies and
	 *                                there's insufficient data to distinguish which term is intended.
	 *                                False for other failures.
	 */
	public static function get_instance( $term_id, $taxonomy = null ) {
		global $wpdb;

		$term_id = (int) $term_id;
		if ( ! $term_id ) {
			return false;
		}

		$_term = wp_cache_get( $term_id, 'terms' );

		// If there isn't a cached version, hit the database.
		if ( ! $_term || ( $taxonomy && $taxonomy !== $_term->taxonomy ) ) {
			// Any term found in the cache is not a match, so don't use it.
			$_term = false;

			// Grab all matching terms, in case any are shared between taxonomies.
			$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id = %d", $term_id ) );
			if ( ! $terms ) {
				return false;
			}

			// If a taxonomy was specified, find a match.
			if ( $taxonomy ) {
				foreach ( $terms as $match ) {
					if ( $taxonomy === $match->taxonomy ) {
						$_term = $match;
						break;
					}
				}

				// If only one match was found, it's the one we want.
			} elseif ( 1 === count( $terms ) ) {
				$_term = reset( $terms );

				// Otherwise, the term must be shared between taxonomies.
			} else {
				// If the term is shared only with invalid taxonomies, return the one valid term.
				foreach ( $terms as $t ) {
					if ( ! taxonomy_exists( $t->taxonomy ) ) {
						continue;
					}

					// Only hit if we've already identified a term in a valid taxonomy.
					if ( $_term ) {
						return new WP_Error( 'ambiguous_term_id', __( 'Term ID is shared between multiple taxonomies' ), $term_id );
					}

					$_term = $t;
				}
			}

			if ( ! $_term ) {
				return false;
			}

			// Don't return terms from invalid taxonomies.
			if ( ! taxonomy_exists( $_term->taxonomy ) ) {
				return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
			}

			$_term = sanitize_term( $_term, $_term->taxonomy, 'raw' );

			// Don't cache terms that are shared between taxonomies.
			if ( 1 === count( $terms ) ) {
				wp_cache_add( $term_id, $_term, 'terms' );
			}
		}

		$term_obj = new WP_Term( $_term );
		$term_obj->filter( $term_obj->filter );

		return $term_obj;
	}

	/**
	 * Constructor.
	 *
	 * @since 4.4.0
	 *
	 * @param WP_Term|object $term Term object.
	 */
	public function __construct( $term ) {
		foreach ( get_object_vars( $term ) as $key => $value ) {
			$this->$key = $value;
		}
	}

	/**
	 * Sanitizes term fields, according to the filter type provided.
	 *
	 * @since 4.4.0
	 *
	 * @param string $filter Filter context. Accepts 'edit', 'db', 'display', 'attribute', 'js', 'rss', or 'raw'.
	 */
	public function filter( $filter ) {
		sanitize_term( $this, $this->taxonomy, $filter );
	}

	/**
	 * Converts an object to array.
	 *
	 * @since 4.4.0
	 *
	 * @return array Object as array.
	 */
	public function to_array() {
		return get_object_vars( $this );
	}

	/**
	 * Getter.
	 *
	 * @since 4.4.0
	 *
	 * @param string $key Property to get.
	 * @return mixed Property value.
	 */
	public function __get( $key ) {
		switch ( $key ) {
			case 'data':
				$data    = new stdClass();
				$columns = array( 'term_id', 'name', 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', 'parent', 'count' );
				foreach ( $columns as $column ) {
					$data->{$column} = isset( $this->{$column} ) ? $this->{$column} : null;
				}

				return sanitize_term( $data, $data->taxonomy, 'raw' );
		}
	}
}
blog

blog

1win официальный сайт букмекера — Обзор и зеркало для входа.5248

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Обзор и Зеркало для Входа Преимущества и Функции 1win Функции 1win: В мире ставок и азарта 1win является одним из самых популярных букмекеров, предлагающих широкий спектр услуг для игроков. Компания была основана в …

Read More »

Glory Casino Bangladesh Official Website.3211 (2)

Glory Casino Bangladesh Official Website ▶️ PLAY Содержимое About Glory Casino Features of the Official Website How to Register and Login at Glory Casino Bangladesh Games and Bonuses Glory Casino Bonuses Are you ready to experience the thrill of online gaming like never before? Look no further than the glory …

Read More »

Casino non AAMS in Italia come riconoscere quelli affidabili.645

Casino non AAMS in Italia – come riconoscere quelli affidabili ▶️ GIOCARE Содержимое Casino non AAMS in Italia: come evitare i trappi Consegni per giocatori online Identificare i casinò sicuri e trasparenti Come identificare i casinò non AAMS Controllare la licenza e le recensioni dei giocatori In Italia, il settore …

Read More »

Ishonchli onlayn kazinolar O‘zbekistonda.121

Ishonchli onlayn kazinolar O‘zbekistonda ▶️ O’YNANG Содержимое O‘zbekistonda onlayn kazinolarning qonuniy holati Qonuniy kazinolar Best online casino tanlash Onlayn kazinolarda o‘yinlar va ularning xususiyatlari O‘zbekistonda onlayn kazinolarda pul mablag‘lari va to‘lov tizimlari O‘zbekistonda onlayn kazino sohasi juda tez rivojlanib bormoqda. Ko‘plab best online casino saytlari o‘z xizmatlarini taklif qilmoqda, ammo …

Read More »

1win официальный сайт букмекера — Обзор и зеркало для входа.59

1win официальный сайт букмекера — Обзор и зеркало для входа ▶️ ИГРАТЬ Содержимое 1win Официальный Сайт Букмекера Преимущества Официального Сайта 1win Обзор и Зеркало для Входа Преимущества и Функции 1win В мире ставок и азарта 1вин является одним из самых популярных букмекеров, предлагающих широкий спектр услуг для игроков. В этой …

Read More »

Razor Shark KOSTENLOS spielen im Online-Casino – Free Demo.611

Razor Shark KOSTENLOS spielen im Online-Casino – Free Demo ▶️ SPIELEN Содержимое Das Spiel, das Sie kennen müssen Die Features des Spiels Wie funktioniert das Spiel? Das Gameplay in einigen Worten Wie können Sie Razor Shark kostenlos spielen? Das kostenlose Demo – Was Sie wissen müssen Das razor shark -Spiel …

Read More »

Casino Mostbet Azərbaycan.137

Casino Mostbet Azərbaycan ▶️ OYNA Содержимое Mostbet Casino-da Oyunlar və Slotlar Mostbet Azerbaijan-da Təqdim Olunan Oyunlar Mostbet Az-da Qazanc Əldə Etmək Mostbet-də Ödəniş və Çıxarış Üsulları Mostbet Azərbaycanın ən məşhur onlayn kazino saytlarından biridir. Mosbet Azerbaycan oyunsevərlərə geniş oyun seçimi, yüksək keyfiyyətli dizayn və əla xidmət təklif edir. Azerbaycanda kazino …

Read More »

Casino non AAMS in Italia come riconoscere quelli affidabili.565

Casino non AAMS in Italia – come riconoscere quelli affidabili ▶️ GIOCARE Содержимое La situazione attuale: i casino non AAMS in Italia Come riconoscere i casino non AAMS affidabili Il mondo dei casinò online è in costante evoluzione, e la scelta dei migliori siti non è più facile come un …

Read More »

Casino non AAMS in Italia come riconoscere quelli affidabili.928

Casino non AAMS in Italia – come riconoscere quelli affidabili ▶️ GIOCARE Содержимое La necessità di controllare la licenza Perché la licenza è importante I segni di un casino non AAMS In Italia, il settore dei giochi online è regolato dalla Agenzia delle Aziende Militari (AAMS), che emette licenze ai …

Read More »

Pocket Option Официальный сайт платформы для торговли – Бинарные Опционы.6179

Pocket Option – Официальный сайт платформы для торговли – Бинарные Опционы ▶️ ИГРАТЬ Содержимое Покет Опшн: Официальный сайт платформы для торговли – Бинарные Опционы Официальный сайт Покет Опшн: основные функции Описание платформы Pocket Option Преимущества и преобразования Pocket Option Преимущества для инвесторов В современном мире финансовых рынков, где каждый день …

Read More »