403Webshell
Server IP : 10.19.1.101  /  Your IP : 216.73.216.158
Web Server : Apache
System : Linux web1f13.kinghost.net 5.4.282-1.el8.elrepo.x86_64 #1 SMP Mon Aug 19 18:33:22 EDT 2024 x86_64
User : schererimoveisrs ( 170628)
PHP Version : 7.4.33
Disable Function : apache_child_terminate,c99_buff_prepare,c99_sess_put,dl,exec,leak,link,myshellexec,openlog,passthru,pclose,pcntl_exec,php_check_syntax,php_strip_whitespace,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,symlink,system,socket_listen,socket_create_listen,putenv
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/schererimoveisrs/www/wp-content/plugins/wp-crontrol/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/schererimoveisrs/www/wp-content/plugins/wp-crontrol/src/schedule.php
<?php
/**
 * Functions related to schedules.
 */

namespace Crontrol\Schedule;

use Crontrol\Exception\DuplicateScheduleException;
use Crontrol\Schedule\Schedule;

/**
 * Adds a new custom cron schedule.
 *
 * @throws DuplicateScheduleException If the schedule name already exists.
 *
 * @param string $name     The internal name of the schedule.
 * @param int    $interval The interval between executions of the new schedule.
 * @param string $display  The display name of the schedule.
 * @return void
 */
function add( $name, $interval, $display ) {
	$schedules = get();

	if ( array_key_exists( $name, $schedules ) ) {
		throw new DuplicateScheduleException(
			sprintf(
				/* translators: %s: The internal name of the schedule. */
				__( 'A schedule with the name "%s" already exists.', 'wp-crontrol' ),
				$name
			)
		);
	}

	/** @var array<string,int|string> */
	$old_scheds = get_option( 'crontrol_schedules', array() );

	$old_scheds[ $name ] = array(
		'interval' => $interval,
		'display'  => $display,
	);
	update_option( 'crontrol_schedules', $old_scheds );

	/**
	 * Fires after a new cron schedule is added.
	 *
	 * @param string $name     The internal name of the schedule.
	 * @param int    $interval The interval between executions of the new schedule.
	 * @param string $display  The display name of the schedule.
	 */
	do_action( 'crontrol/added_new_schedule', $name, $interval, $display );
}

/**
 * Deletes a custom cron schedule.
 *
 * @param string $name The internal name of the schedule to delete.
 * @return void
 */
function delete( $name ) {
	/** @var array<string,int|string> */
	$scheds = get_option( 'crontrol_schedules', array() );
	unset( $scheds[ $name ] );
	update_option( 'crontrol_schedules', $scheds );

	/**
	 * Fires after a cron schedule is deleted.
	 *
	 * @param string $name The internal name of the schedule.
	 */
	do_action( 'crontrol/deleted_schedule', $name );
}

/**
 * Gets a sorted (according to interval) list of the cron schedules
 *
 * @return array<string,Schedule> Array of Schedule objects keyed by schedule name.
 */
function get() {
	/**
	 * @phpstan-var array<string,array{
	 *   interval: int,
	 *   display?: string,
	 * }> $schedules
	 */
	$schedules = wp_get_schedules();
	uasort(
		$schedules,
		fn( array $a, array $b ) => $a['interval'] <=> $b['interval']
	);

	$result = [];
	foreach ( $schedules as $name => $schedule ) {
		$display = $schedule['display'] ?? $name;
		$result[ $name ] = Schedule::create( $name, $schedule['interval'], $display );
	}

	return $result;
}

/**
 * Displays a dropdown filled with the possible schedules, including non-repeating.
 *
 * @param ?string $current The currently selected schedule, or null for none.
 * @return void
 */
function dropdown( ?string $current = null ) {
	$schedules = get();
	?>
	<select class="postform" name="crontrol_schedule" id="crontrol_schedule" required>
	<option <?php selected( $current, '_oneoff' ); ?> value="_oneoff"><?php esc_html_e( 'Non-repeating', 'wp-crontrol' ); ?></option>
	<?php foreach ( $schedules as $schedule ) { ?>
		<option <?php selected( $current, $schedule->name ); ?> value="<?php echo esc_attr( $schedule->name ); ?>">
			<?php
			printf(
				'%s (%s)',
				esc_html( $schedule->display ),
				esc_html( $schedule->name )
			);
			?>
		</option>
	<?php } ?>
	</select>
	<?php
}

Youez - 2016 - github.com/yon3zu
LinuXploit