Automattic\WooCommerce\Internal\ProductDownloads\ApprovedDirectories
Register::get_by_id
Returns the path identified by $id, or false if it does not exist.
Метод класса: Register{}
Хуков нет.
Возвращает
StoredUrl|false.
Использование
$Register = new Register(); $Register->get_by_id( $id );
- $id(int) (обязательный)
- The ID of the rule we are looking for.
Код Register::get_by_id() Register::get by id WC 10.9.4
public function get_by_id( int $id ) {
global $wpdb;
$table = $this->get_table();
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$table} WHERE url_id = %d", array( $id ) ) );
if ( ! $result ) {
return false;
}
return new StoredUrl( $result->url_id, $result->url, $result->enabled );
}