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).
Method of the class: Register{}
No Hooks.
Return
Int
.
Usage
$Register = new Register(); $Register->count( $enabled ): int;
- $enabled(true|false)
- Controls whether enabled or disabled directory rules are counted.
Default: true
Register::count() Register::count code WC 9.7.1
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 ) ); }