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