2020-08-18 16:31:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @copyright 2020 Podlibre
|
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Validation;
|
|
|
|
|
|
|
|
class Rules
|
|
|
|
{
|
2020-10-08 16:38:30 +00:00
|
|
|
/**
|
|
|
|
* Checks a URL to ensure it's formed correctly.
|
|
|
|
*/
|
|
|
|
public function validate_url(string $str = null): bool
|
|
|
|
{
|
2021-05-12 14:00:25 +00:00
|
|
|
if ($str === null) {
|
2020-10-08 16:38:30 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return filter_var($str, FILTER_VALIDATE_URL) !== false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2020-08-18 16:31:28 +00:00
|
|
|
}
|