fix local service

This commit is contained in:
Jean-Christian Denis 2021-08-28 00:49:26 +02:00
parent 96fb6c7d23
commit 2acf82b4e0
4 changed files with 11 additions and 4 deletions

View file

@ -25,7 +25,7 @@ class kUtRL
if (empty($list)) {
return [];
}
$service = [];
$services = [];
foreach($list as $k => $callback) {
try {
list($service_id,$service_class) = call_user_func($callback);

View file

@ -118,7 +118,7 @@ if (null === $kut) {
form::field('custom', 50, 32, '') . '</label></p>' .
'<p class="form-note">' . __('Only if you want a custom short link.') . '</p>';
if ($s_admin_service == 'local') {
if ($kut->admin_service == 'local') {
echo '<p class="form-note">' .
__('You can use "bob!!" if you want a semi-custom link, it starts with "bob" and "!!" will be replaced by an increment value.') .
'</p>';

View file

@ -57,6 +57,12 @@ class kutrlService
# Magic get for config values
public function __get($k)
{
return $this->get($k);
}
# get config value
public function get($k)
{
return isset($this->config[$k]) ? $this->config[$k] : null;
}
@ -103,7 +109,7 @@ class kutrlService
# Test if an url is long enoutgh
public function isLongerUrl($url)
{
return ((integer) $this->url_min_len >= $url);
return (strlen($url) >= (integer) $this->url_min_len);
}
# Test if an url protocol (eg: http://) is allowed

View file

@ -100,7 +100,8 @@ class localKutrlService extends kutrlService
public function testService()
{
if (!empty($this->allow_protocols))
$ap = $this->allow_protocols;
if (!empty($ap))
{
return true;
}