SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > content-control > classes > > Services


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control/classes//Services

NameTypeSizeLast ModifiedActions
Globals.php File 3519 bytes June 21 2024 13:00:36.
Restrictions.php File 11140 bytes June 21 2024 13:00:36.
UpgradeStream.php File 4611 bytes September 21 2023 14:13:04.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/content-control/classes//Services/Globals.php

<?php
/**
 * Globals service.
 *
 * @copyright (c) 2021, Code Atlantic LLC.
 * @package ContentControl
 */

namespace ContentControl\Services;

defined( 'ABSPATH' ) || exit;

/**
 * Globals service.
 */
class Globals {

	/**
	 * Context.
	 *
	 * @var string|null
	 */
	public $current_query_context = null;

	/**
	 * Current query.
	 *
	 * @var \WP_Query|\WP_Term_Query|null
	 */
	public $current_query = null;

	/**
	 * Current post query.
	 *
	 * @var \WP_Query|null
	 */
	public $current_post_query = null;

	/**
	 * Current term query.
	 *
	 * @var \WP_Term_Query|null
	 */
	public $current_term_query = null;

	/**
	 * Current term.
	 *
	 * @var \WP_Term|null
	 */
	public $term = null;

	/**
	 * Overloaded posts stack.
	 *
	 * @var \WP_Post[]|null $overloaded_posts
	 */
	public $overloaded_posts = null;

	/**
	 * Overloaded terms stack.
	 *
	 * @var \WP_Term[]|null $overloaded_terms
	 */
	public $overloaded_terms = null;

	/**
	 * Last term.
	 *
	 * @var \WP_Term[]|null
	 */
	public $last_term = null;

	/**
	 * Current rule.
	 *
	 * @var \ContentControl\Models\RuleEngine\Rule|null
	 */
	public $current_rule = null;

	/**
	 * Current intent.
	 *
	 * @var null|array{
	 *      type: string,
	 *      name: string,
	 *      id: int,
	 *      index: bool,
	 *      search: string|false,
	 * }
	 */
	public $rest_intent = null;

	/**
	 * Constructor.
	 */
	public function __construct() {
	}

	/**
	 * Get context items by key.
	 *
	 * @param string $key Context key.
	 * @param mixed  $default_value Default value.
	 *
	 * @return mixed
	 */
	public function get( $key, $default_value = null ) {
		return property_exists( $this, $key ) ? $this->$key : $default_value;
	}

	/**
	 * Set context items by key.
	 *
	 * @param string $key Context key.
	 * @param mixed  $value Context value.
	 *
	 * @return void
	 */
	public function set( $key, $value ) {
		if ( property_exists( $this, $key ) ) {
			$this->$key = $value;
		}
	}

	/**
	 * Reset context items by key.
	 *
	 * @param string $key Context key.
	 *
	 * @return void
	 */
	public function reset( $key ) {
		if ( property_exists( $this, $key ) ) {
			$this->$key = null;
		}
	}

	/**
	 * Reset all context items.
	 *
	 * @return void
	 */
	public function reset_all() {
		$this->reset( 'current_query_context' );
		$this->reset( 'current_query' );
		$this->reset( 'current_post_query' );
		$this->reset( 'current_term_query' );
		$this->reset( 'current_rule' );
		$this->reset( 'term' );
		$this->reset( 'overloaded_posts' );
		$this->reset( 'overloaded_terms' );
		$this->reset( 'last_term' );
		$this->reset( 'rest_intent' );
	}

	/**
	 * Push to stack.
	 *
	 * @param string $key Context key.
	 * @param mixed  $value Context value.
	 *
	 * @return void
	 */
	public function push_to_stack( $key, $value ) {
		if ( property_exists( $this, $key ) ) {
			$values = $this->get( $key, [] );

			$values[] = $value;

			$this->set( $key, $values );
		}
	}

	/**
	 * Pop from stack.
	 *
	 * @param string $key Context key.
	 *
	 * @return mixed
	 */
	public function pop_from_stack( $key ) {
		if ( property_exists( $this, $key ) ) {
			$values = $this->get( $key, [] );

			if ( empty( $values ) ) {
				return null;
			}

			$value = array_pop( $values );

			$this->set( $key, $values );

			return $value;
		}

		return null;
	}

	/**
	 * Check if stack is empty.
	 *
	 * @param string $key Context key.
	 *
	 * @return bool
	 */
	public function is_empty( $key ) {
		$value = $this->get( $key );

		return ! isset( $value ) || empty( $value );
	}
}

SILENT KILLER Tool