HEX
Server: nginx/1.24.0
System: Linux VM-8-5-opencloudos 6.6.47-12.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 24 16:15:42 CST 2024 x86_64
User: www (1000)
PHP: 8.0.26
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/aiwellbore.com/wp-content/plugins/seo-by-rank-math/includes/class-term.php
<?php
/**
 * The Term Class
 *
 * @since      0.9.0
 * @package    RankMath
 * @subpackage RankMath\Core
 * @author     Rank Math <support@rankmath.com>
 */

namespace RankMath;

use WP_Term;

defined( 'ABSPATH' ) || exit;

/**
 * Term class.
 */
class Term extends Metadata {

	/**
	 * Type of object metadata is for
	 *
	 * @var string
	 */
	protected $meta_type = 'term';

	/**
	 * Retrieve Term instance.
	 *
	 * @param mixed  $term     Term to get either (string) term name, (int) term ID or (object) term.
	 * @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`. Only used for
	 *                         disambiguating potentially shared terms.
	 * @return Term|false Term object, false otherwise.
	 */
	public static function get( $term = 0, $taxonomy = null ) {
		$term = self::get_term_id( $term, $taxonomy );
		if ( empty( $term ) ) {
			return null;
		}

		if ( isset( self::$objects[ $term ] ) && 'term' === self::$objects[ $term ]->meta_type ) {
			return self::$objects[ $term ];
		}

		$_term                  = new self( WP_Term::get_instance( $term, $taxonomy ) );
		$_term->object_id       = $term;
		self::$objects[ $term ] = $_term;

		return $_term;
	}

	/**
	 * Get term ID.
	 *
	 * @param mixed  $term     Term to get either (string) term name, (int) term ID or (object) term.
	 * @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`. Only used for
	 *                         disambiguating potentially shared terms.
	 */
	private static function get_term_id( $term = 0, $taxonomy = null ) {
		if ( is_string( $term ) ) {
			$term = get_term_by( 'slug', $term, $taxonomy );
		} elseif ( is_int( $term ) && 0 === absint( $term ) ) {
			$term = $GLOBALS['wp_query']->get_queried_object();
		}

		if ( is_object( $term ) && isset( $term->term_id ) ) {
			return $term->term_id;
		}

		return false;
	}

	/**
	 * Get term meta value.
	 *
	 * @param string $key      Meta key.
	 * @param mixed  $term     Term name, term ID, or term object.
	 * @param string $taxonomy Optional. Limit matched terms to those matching `$taxonomy`. Only used for
	 *                         disambiguating potentially shared terms.
	 * @param string $default Default value to use when metadata does not exists.
	 * @return mixed
	 */
	public static function get_meta( $key, $term = 0, $taxonomy = null, $default = '' ) {
		$term = self::get( $term, $taxonomy );

		if ( is_null( $term ) || ! $term->is_found() ) {
			return $default;
		}

		return $term->get_metadata( $key, $default );
	}

	/**
	 * Check if the current query is for multiple terms (e.g. /term-1,term-2/).
	 *
	 * @return bool
	 */
	public static function is_multiple_terms_query() {
		global $wp_query;

		if ( ! is_tax() && ! is_tag() && ! is_category() ) {
			return false;
		}

		$term          = get_queried_object();
		$queried_terms = $wp_query->tax_query->queried_terms;

		if ( empty( $queried_terms[ $term->taxonomy ]['terms'] ) ) {
			return false;
		}

		return count( $queried_terms[ $term->taxonomy ]['terms'] ) > 1;
	}
}