WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

ActionScheduler_ListTable::human_interval() private WC 1.0

Convert an interval of seconds into a two part human friendly string.

The WordPress human_time_diff() function only calculates the time difference to one degree, meaning even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step further to display two degrees of accuracy.

Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/

Это метод класса: ActionScheduler_ListTable{}

Хуков нет.

Возвращает

Строку. A human friendly string representation of the interval.

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

$result = ActionScheduler_ListTable::human_interval( $interval, $periods_to_include );
$interval(число) (обязательный)
A interval in seconds.
$periods_to_include(число)
Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included.
По умолчанию: 2

Код ActionScheduler_ListTable::human_interval() WC 4.5.2

woocommerce/packages/action-scheduler/classes/ActionScheduler_ListTable.php
<?php
private static function human_interval( $interval, $periods_to_include = 2 ) {

	if ( $interval <= 0 ) {
		return __( 'Now!', 'woocommerce' );
	}

	$output = '';

	for ( $time_period_index = 0, $periods_included = 0, $seconds_remaining = $interval; $time_period_index < count( self::$time_periods ) && $seconds_remaining > 0 && $periods_included < $periods_to_include; $time_period_index++ ) {

		$periods_in_interval = floor( $seconds_remaining / self::$time_periods[ $time_period_index ]['seconds'] );

		if ( $periods_in_interval > 0 ) {
			if ( ! empty( $output ) ) {
				$output .= ' ';
			}
			$output .= sprintf( _n( self::$time_periods[ $time_period_index ]['names'][0], self::$time_periods[ $time_period_index ]['names'][1], $periods_in_interval, 'woocommerce' ), $periods_in_interval );
			$seconds_remaining -= $periods_in_interval * self::$time_periods[ $time_period_index ]['seconds'];
			$periods_included++;
		}
	}

	return $output;
}