update 2023-07-27 10:22:24
This commit is contained in:
parent
a89438dc3b
commit
0565e907db
@ -20,9 +20,11 @@ class Linker << (F,LightGreen) >> #Green {
|
||||
+ share() : bool
|
||||
+ get() : ?string
|
||||
+ active(bool $setup = true) : ?string
|
||||
+ activeDetails(bool $setup = true) : ?array
|
||||
+ valid(string $linker) : bool
|
||||
+ trigger(string $linker) : bool
|
||||
+ set(string $linker) : bool
|
||||
+ setName(string $name) : ?array
|
||||
+ access(string $linker, string $pass, ...) : ?array
|
||||
- hasAccess(string $linker, string $pass) : bool
|
||||
- getPassGuid(string $linker, string $pass) : ?string
|
||||
@ -64,27 +66,41 @@ note left of Linker::active
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Linker::valid
|
||||
note right of Linker::activeDetails
|
||||
Get active Linker details
|
||||
|
||||
since: 2.0.1
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note left of Linker::valid
|
||||
Check if a Linker is valid active linker
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Linker::trigger
|
||||
note right of Linker::trigger
|
||||
The Share His Word Trigger
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Linker::set
|
||||
note left of Linker::set
|
||||
Set Active Linker
|
||||
|
||||
since: 2.0.1
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Linker::setName
|
||||
Set a linker name
|
||||
|
||||
since: 2.0.1
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note left of Linker::access
|
||||
Set Access
|
||||
|
||||
|
@ -149,6 +149,33 @@ final class Linker
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active Linker details
|
||||
*
|
||||
* @param bool $setup The setup switch
|
||||
*
|
||||
* @return array|null Linker details
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function activeDetails(bool $setup = true): ?array
|
||||
{
|
||||
if (($linker = $this->active($setup)) !== null)
|
||||
{
|
||||
// check if this is a valid linker (already set)
|
||||
if (($name = $this->load->value(
|
||||
['guid' => $linker, 'published' => 1],
|
||||
'name', 'linker'
|
||||
)) !== null)
|
||||
{
|
||||
return ['guid' => $linker, 'name' => $name, 'share' => $this->share()];
|
||||
}
|
||||
|
||||
return ['guid' => $linker, 'name' => null, 'share' => $this->share()];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Linker is valid active linker
|
||||
*
|
||||
@ -211,6 +238,40 @@ final class Linker
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a linker name
|
||||
*
|
||||
* @param string $name The linker name
|
||||
*
|
||||
* @return array|null Array on success
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function setName(string $name): ?array
|
||||
{
|
||||
// make sure the linker has access
|
||||
if (($linker = $this->get()) === null)
|
||||
{
|
||||
return [
|
||||
'error' => Text::_("COM_GETBIBLE_WITHOUT_SELECTING_THE_CORRECT_FAVOURITE_VERSE_YOU_CANT_PERFORM_THE_INITIAL_ACTION"),
|
||||
'access_required' => true
|
||||
];
|
||||
}
|
||||
|
||||
// get details of the linker
|
||||
if (!$this->update->value($name, 'name', $linker, 'guid', 'linker'))
|
||||
{
|
||||
return [
|
||||
'error' => Text::_('COM_GETBIBLE_THE_NAME_COULD_NOT_BE_UPDATED')
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'guid' => $linker,
|
||||
'name' => $name,
|
||||
'success' => Text::_('COM_GETBIBLE_THE_NAME_HAS_BEEN_UPDATED')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access
|
||||
*
|
||||
|
@ -119,6 +119,33 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active Linker details
|
||||
*
|
||||
* @param bool $setup The setup switch
|
||||
*
|
||||
* @return array|null Linker details
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function activeDetails(bool $setup = true): ?array
|
||||
{
|
||||
if (($linker = $this->active($setup)) !== null)
|
||||
{
|
||||
// check if this is a valid linker (already set)
|
||||
if (($name = $this->load->value(
|
||||
['guid' => $linker, 'published' => 1],
|
||||
'name', 'linker'
|
||||
)) !== null)
|
||||
{
|
||||
return ['guid' => $linker, 'name' => $name, 'share' => $this->share()];
|
||||
}
|
||||
|
||||
return ['guid' => $linker, 'name' => null, 'share' => $this->share()];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a Linker is valid active linker
|
||||
*
|
||||
@ -181,6 +208,40 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a linker name
|
||||
*
|
||||
* @param string $name The linker name
|
||||
*
|
||||
* @return array|null Array on success
|
||||
* @since 2.0.1
|
||||
**/
|
||||
public function setName(string $name): ?array
|
||||
{
|
||||
// make sure the linker has access
|
||||
if (($linker = $this->get()) === null)
|
||||
{
|
||||
return [
|
||||
'error' => Text::_("Without selecting the correct favourite verse, you can't perform the initial action."),
|
||||
'access_required' => true
|
||||
];
|
||||
}
|
||||
|
||||
// get details of the linker
|
||||
if (!$this->update->value($name, 'name', $linker, 'guid', 'linker'))
|
||||
{
|
||||
return [
|
||||
'error' => Text::_('The name could not be updated.')
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'guid' => $linker,
|
||||
'name' => $name,
|
||||
'success' => Text::_('The name has been updated.')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Access
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user