Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Register::set_mode()publicWC 1.0

Sets the mode. This effectively controls if approved directories are enforced or not.

May be one of: 'disabled', 'enabled', 'migrating'.

Method of the class: Register{}

No Hooks.

Return

true|false.

Usage

$Register = new Register();
$Register->set_mode( $mode ): bool;
$mode(string) (required)
One of the values contained within self::MODES.

Register::set_mode() code WC 8.6.1

public function set_mode( string $mode ): bool {
	if ( ! in_array( $mode, self::MODES, true ) ) {
		return false;
	}

	update_option( $this->mode_option, $mode );
	return get_option( $this->mode_option ) === $mode;
}