WP_Super_Cache_Rest_Update_Settings::save_time_settings()protectedWPSCache 1.0

Runs at the end and saves the time settings.

Метод класса: WP_Super_Cache_Rest_Update_Settings{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->save_time_settings( $parameters );
$parameters (обязательный)
-

Код WP_Super_Cache_Rest_Update_Settings::save_time_settings() WPSCache 1.12.4

protected function save_time_settings( $parameters ) {
	if ( ! isset( $_POST['_time_setting'] ) || true !== $_POST['_time_setting'] ) {
		return;
	}

	$_POST['action'] = 'expirytime';

	$all_time_settings = array(
		'cache_max_time',
		'cache_schedule_type',
		'cache_scheduled_time',
		'cache_schedule_interval',
		'cache_time_interval',
		'cache_gc_email_me'
	);

	foreach ( $all_time_settings as $time_setting ) {
		if ( false == isset( $_POST[ $time_setting ] ) || $GLOBALS[ $time_setting ] == $_POST[ $time_setting ] ) {
			$_POST[ $time_setting ] = $GLOBALS[ $time_setting ]; // fill in the potentially missing fields before updating GC settings.
		}
	}

	if ( isset( $parameters['cache_gc_email_me'] ) && $parameters['cache_gc_email_me'] == 0 ) {
		unset( $_POST['cache_gc_email_me'] );
	}
	$_POST[ 'wp_max_time' ] = $_POST[ 'cache_max_time' ];

	wp_cache_time_update();
}