Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories
Register::count
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() Register::count WC 10.3.4
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
)
);
}