403Webshell
Server IP : 217.113.158.245  /  Your IP : 216.73.217.83
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux bg-hoster 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.27
Disable Function : 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/platforma/wp-content/plugins/seo-by-rank-math/includes/traits/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/platforma/wp-content/plugins/seo-by-rank-math/includes/traits/class-cache.php
<?php
/**
 * The Cache Trait.
 *
 * @since      1.0.99
 * @package    RankMath
 * @subpackage RankMath\Traits
 * @author     Rank Math <support@rankmath.com>
 */

namespace RankMath\Traits;

defined( 'ABSPATH' ) || exit;

/**
 * Cache class.
 */
trait Cache {

	/**
	 * To generate hash of object.
	 *
	 * @param string|array|object $value Object for that hash need to generate.
	 *
	 * @return string Hash value of provided object.
	 */
	public function generate_hash( $value ) {

		if ( empty( $value ) ) {
			return '';
		}

		if ( is_object( $value ) ) {
			$value = (array) $value;
		}

		if ( is_array( $value ) ) {
			ksort( $value );
			$value = wp_json_encode( $value );
		}

		$value = apply_filters( 'rank_math/cache/generate_hash', trim( $value ) );
		$hash  = hash( 'sha256', $value );

		return $hash;
	}

	/**
	 * Sets a value in cache.
	 *
	 * The value is set whether or not this key already exists in Redis.
	 *
	 * @param string $key    The key under which to store the value.
	 * @param mixed  $data   The value to store.
	 * @param string $group  The group value appended to the $key.
	 * @param int    $expire The expiration time, defaults to 0.
	 *
	 * @return bool              Returns TRUE on success or FALSE on failure.
	 */
	public function set_cache( $key, $data, $group = '', $expire = 0 ) {
		if ( ! $this->is_enabled() ) {
			return false;
		}

		return wp_cache_set( $key, $data, $group, $expire );
	}

	/**
	 * Retrieve object from cache.
	 *
	 * Gets an object from cache based on $key and $group.
	 *
	 * @param string $key   The key under which to store the value.
	 * @param string $group The group value appended to the $key.
	 *
	 * @return bool|mixed Cached object value.
	 */
	public function get_cache( $key, $group ) {
		if ( ! $this->is_enabled() ) {
			return false;
		}

		return wp_cache_get( $key, $group );
	}

	/**
	 * Removes all cache items in a group, if the object cache implementation supports it.
	 *
	 * @param string $group Name of group to remove from cache.
	 *
	 * @return bool True if group was flushed, false otherwise.
	 */
	public function cache_flush_group( $group ) {
		if ( ! $this->is_enabled() ) {
			return false;
		}

		global $wp_object_cache;
		if ( ! isset( $wp_object_cache->cache[ $group ] ) ) {
			return;
		}

		$wp_object_cache->delete_multiple( array_keys( $wp_object_cache->cache[ $group ] ), $group );

		return true;
	}

	/**
	 * Check if cache is enabled.
	 */
	public function is_enabled() {
		if ( wp_using_ext_object_cache() === false ) {
			return false;
		}

		return apply_filters( 'rank_math/cache/enabled', true );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit