Tribe__Validate::slug()
validates & sanitizes fields as URL slugs
Source
File: src/Tribe/Validate.php
public function slug() {
$maybe_valid_value = esc_url_raw( $this->value );
// esc_url_raw does the work of validating chars, but returns the checked string with a
// prepended URL protocol; so let's use strpos to match the values.
if ( false !== strpos( $maybe_valid_value, $this->value ) ) {
$this->result->valid = true;
$this->value = sanitize_title( $this->value );
} else {
$this->result->valid = false;
$this->result->error = sprintf( esc_html__( '%s must be a valid slug (numbers, letters, dashes, and underscores).', 'tribe-common' ), $this->label );
}
}