403Webshell
Server IP : 104.21.28.229  /  Your IP : 216.73.216.142
Web Server : Apache/2
System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : mienphi ( 1014)
PHP Version : 8.2.14
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/mienphi/public_html/wp-content/plugins/thim-elementor-kit/inc/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mienphi/public_html/wp-content/plugins/thim-elementor-kit/inc/modules/class-cache.php
<?php

namespace Thim_EL_Kit\Modules;

use Thim_EL_Kit\SingletonTrait;

class Cache {

	use SingletonTrait;

	public $conditions = array();

	const OPTION_NAME = 'thim_ekits_option_conditions';

	const CONDITION_META_KEY = 'thim_ekits_conditions';

	public function __construct() {
		$this->refresh();
	}

	public function save() {
		return update_option(
			apply_filters( 'thim_ekit/cache/thim_ekits_option_conditions', self::OPTION_NAME ),
			$this->conditions
		);
	}

	public function refresh() {
		$this->conditions = get_option(
			apply_filters( 'thim_ekit/cache/thim_ekits_option_conditions', self::OPTION_NAME ),
			array()
		);
	}

	public function clear() {
		$this->conditions = array();
	}

	public function get( $type ) {
		return isset( $this->conditions[ $type ] ) ? $this->conditions[ $type ] : array();
	}

	public function add( $type, $conditions, $post_id ) {
		if ( $type ) {
			if ( ! isset( $this->conditions[ $type ] ) ) {
				$this->conditions[ $type ] = array();
			}
			$this->conditions[ $type ][ $post_id ] = $conditions;
		}

		return $this;
	}

	public function remove( $post_id ) {
		$post_id = absint( $post_id );

		foreach ( $this->conditions as $type => $templates ) {
			foreach ( $templates as $id => $template ) {
				if ( $post_id === $id ) {
					unset( $this->conditions[ $type ][ $id ] );
				}
			}
		}

		return $this;
	}

	public function regenerate() {
		$this->clear();

		$query = new \WP_Query(
			array(
				'posts_per_page' => - 1,
				'post_type'      => \Thim_EL_Kit\Custom_Post_Type::CPT,
				'fields'         => 'ids',
				'meta_key'       => self::CONDITION_META_KEY,
				// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
			)
		);

		foreach ( $query->posts as $post_id ) {
			$conditions = get_post_meta( $post_id, self::CONDITION_META_KEY, true );
			$type       = get_post_meta( $post_id, 'thim_elementor_type', true );

			$this->add( $type, $conditions, $post_id );
		}

		$this->save();

		return $this;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit