ActionScheduler_ScheduleDeserializer::is_allowed_nested_class │ private │ WC 1.0

Decide whether a nested class (a property of the schedule) may be instantiated.

The only classes Action Scheduler itself ever nests inside a schedule are the bundled CronExpression family. Composite schedules that nest another schedule are also fine. The default list is filterable so extenders can vet their own supporting classes.

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

Хуков нет.

Возвращает

bool.

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

// private - только в коде основоного (родительского) класса
$result = $this->is_allowed_nested_class( $class_name, $allowed_nested ): bool;
$class_name(строка) (обязательный)
Class name discovered nested in the blob.
$allowed_nested(string[]) (обязательный)
The resolved nested allow-list to check against.

Код ActionScheduler_ScheduleDeserializer::is_allowed_nested_class() WC 11.2.2

private function is_allowed_nested_class( string $class_name, array $allowed_nested ): bool {
	if ( '' === $class_name ) {
		return false;
	}

	if ( in_array( $class_name, $allowed_nested, true ) ) {
		return true;
	}

	// A schedule nested inside another schedule (composite schedules) is safe by the same rule
	// as the top-level check.
	if ( class_exists( $class_name ) ) {
		$implements = class_implements( $class_name );
		if ( is_array( $implements ) && isset( $implements['ActionScheduler_Schedule'] ) ) {
			return true;
		}
	}

	return false;
}