GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/parhudrw/anqa.it/wp-content/plugins/templately/includes/Builder/Conditions/Taxonomy.php
<?php

namespace Templately\Builder\Conditions;

class Taxonomy extends Condition {
	protected $taxonomy;

	public function __construct( $args = [] ) {
		$this->taxonomy = $args['instance'];

		parent::__construct( $args );
	}

	public function get_priority(): int {
		return 70;
	}

	public function get_type(): string {
		return 'archive';
	}

	public function get_label(): string {
		return ucwords( $this->taxonomy->label );
	}

	public function check( $args = [] ): bool {
		$taxonomy = $this->get_name();
		$id       = (int) $args['id'];

		if ( 'category' === $taxonomy ) {
			return is_category( $id );
		}

		if ( 'post_tag' === $taxonomy ) {
			return is_tag( $id );
		}

		return is_tax( $taxonomy, $id );
	}

	public function get_name(): string {
		return $this->taxonomy->name;
	}

	protected function register_controls() {
		$this->add_control( 'taxonomy', [
			'field'      => 'term_id',
			'query_type' => 'taxonomy',
			'options'    => [ '' => 'All' ],
			'query'      => [ 'taxonomy' => $this->get_name() ]
		] );
	}
}