fix local service

This commit is contained in:
Jean-Christian Paul 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)) { if (empty($list)) {
return []; return [];
} }
$service = []; $services = [];
foreach($list as $k => $callback) { foreach($list as $k => $callback) {
try { try {
list($service_id,$service_class) = call_user_func($callback); 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>' . form::field('custom', 50, 32, '') . '</label></p>' .
'<p class="form-note">' . __('Only if you want a custom short link.') . '</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">' . 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.') . __('You can use "bob!!" if you want a semi-custom link, it starts with "bob" and "!!" will be replaced by an increment value.') .
'</p>'; '</p>';

View File

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

View File

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