Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories

Register::count()publicWC 1.0

Indicates the number of approved directories that are enabled (or disabled, if optional param $enabled is set to false).

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

Хуков нет.

Возвращает

int.

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

$Register = new Register();
$Register->count( $enabled ): int;
$enabled(true|false)
Controls whether enabled or disabled directory rules are counted.
По умолчанию: true

Код Register::count() WC 6.8.0

public function count( bool $enabled = true ): int {
	global $wpdb;
	$table = $this->get_table();

	return (int) $wpdb->get_var(
		$wpdb->prepare(
			// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
			"SELECT COUNT(*) FROM {$table} WHERE enabled = %d",
			$enabled ? 1 : 0
		)
	);
}