ActionScheduler_ScheduleDeserializer::is_allowed_nested_class
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.
Method of the class: ActionScheduler_ScheduleDeserializer{}
No Hooks.
Returns
bool.
Usage
// private - for code of main (parent) class only $result = $this->is_allowed_nested_class( $class_name, $allowed_nested ): bool;
- $class_name(string) (required)
- Class name discovered nested in the blob.
- $allowed_nested(string[]) (required)
- The resolved nested allow-list to check against.
ActionScheduler_ScheduleDeserializer::is_allowed_nested_class() ActionScheduler ScheduleDeserializer::is allowed nested class code WC 11.2.1
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;
}