HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/gopalak/public_html/wp-content/plugins/totalcontest-lite/src/Admin/Ajax/Options.php
<?php

namespace TotalContest\Admin\Ajax;

use TotalContest\Contracts\Migrations\Contest\Migrator;
use TotalContestVendors\TotalCore\Contracts\Http\Request;

/**
 * Class Options
 * @package TotalContest\Admin\Ajax
 */
class Options {
	/**
	 * @var Request
	 */
	protected $request;
	/**
	 * @var Migrator[] $migrators
	 */
	protected $migrators;

	/**
	 * Options constructor.
	 *
	 * @param Request    $request
	 * @param Migrator[] $migrators
	 */
	public function __construct( Request $request, $migrators ) {
		$this->request   = $request;
		$this->migrators = $migrators;
	}

	/**
	 * Save options.
	 */
	public function saveOptions() {
		$options = json_decode( $this->request->post( 'options', '{}' ), true );
		if ( ! empty( $options ) ):
			TotalContest( 'options' )->setOptions( $options, true );
			wp_schedule_single_event( time(), 'totalcontest/actions/urls/flush' );
		endif;
		wp_send_json_success( esc_html__( 'Saved.', 'totalcontest' ) );
	}

	/**
	 * Purge.
	 */
	public function purge() {
		$type = $this->request->request( 'type', 'cache' );
		if ( $type === 'cache' ):
			TotalContest( 'utils.purge.cache' );
			TotalContest( 'utils.purge.store' );
		endif;
		wp_send_json_success( esc_html__( 'Purged.', 'totalcontest' ) );
	}


	/**
	 * Migrate contests AJAX endpoint.
	 * @action-callback wp_ajax_totalcontest_options_migrate_contests
	 */
	public function migrateContests() {
		
	}
}