update 2024-01-27

This commit is contained in:
Robot 2024-01-27 09:08:12 +02:00
parent e208119c97
commit 0c664e2d5a
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
40 changed files with 807 additions and 2275 deletions

View File

@ -23,9 +23,6 @@ This repository contains an index (see below) of all the approved powers within
# Index of powers
- **Namespace**: [VDM\Joomla](#vdm-joomla)
- **trait Utilities** | [Details](src/79d765b3-7319-4988-9730-446c7f347020) | [Code](src/79d765b3-7319-4988-9730-446c7f347020/code.php) | [Settings](src/79d765b3-7319-4988-9730-446c7f347020/settings.json) | Super__79d765b3_7319_4988_9730_446c7f347020__Power
- **Namespace**: [VDM\Joomla\Abstraction](#vdm-joomla-abstraction)
- **abstract class ActiveRegistry** | [Details](src/43134867-5cb8-4280-9be8-309fd2fd135f) | [Code](src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php) | [Settings](src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json) | Super__43134867_5cb8_4280_9be8_309fd2fd135f__Power

View File

@ -32,7 +32,7 @@ end note
note left of StringHelper::shorten
Shorten a string
since: 3.0.9
since: 3.2.0
arguments:
$string

View File

@ -50,18 +50,18 @@ abstract class StringHelper
/**
* Shorten a string
*
* @input string The you would like to shorten
* @input string The sting that you would like to shorten
*
* @returns string on success
*
* @since 3.0.9
* @since 3.2.0
*/
public static function shorten($string, $length = 40, $addTip = true)
{
if (self::check($string))
{
$initial = strlen((string) $string);
$words = preg_split('/([\s\n\r]+)/', (string) $string, null, PREG_SPLIT_DELIM_CAPTURE);
$words = preg_split('/([\s\n\r]+)/', (string) $string, -1, PREG_SPLIT_DELIM_CAPTURE);
$words_count = count((array)$words);
$word_length = 0;

View File

@ -24,18 +24,18 @@
/**
* Shorten a string
*
* @input string The you would like to shorten
* @input string The sting that you would like to shorten
*
* @returns string on success
*
* @since 3.0.9
* @since 3.2.0
*/
public static function shorten($string, $length = 40, $addTip = true)
{
if (self::check($string))
{
$initial = strlen((string) $string);
$words = preg_split('/([\s\n\r]+)/', (string) $string, null, PREG_SPLIT_DELIM_CAPTURE);
$words = preg_split('/([\s\n\r]+)/', (string) $string, -1, PREG_SPLIT_DELIM_CAPTURE);
$words_count = count((array)$words);
$word_length = 0;

View File

@ -12,10 +12,11 @@
@startuml
abstract ActiveRegistry #Orange {
# array $active
# bool $addAsArray
+ isActive() : bool
+ allActive() : array
+ setActive(mixed $value, $keys) : void
+ addActive(mixed $value, bool $asArray, ...) : void
+ addActive(mixed $value, ?bool $asArray, ...) : void
+ getActive(mixed $default, $keys) : mixed
+ removeActive($keys) : void
+ existsActive($keys) : bool
@ -46,13 +47,15 @@ end note
note left of ActiveRegistry::addActive
Adds content into the registry. If a key exists,
it either appends or concatenates based on the value's type.
Default is $addAsArray = false (if null) in base class.
Override in child class allowed set class property $addAsArray = true.
since: 3.2.0
return: void
arguments:
mixed $value
bool $asArray
?bool $asArray
$keys
end note

View File

@ -32,6 +32,14 @@ abstract class ActiveRegistry implements Activeregistryinterface
**/
protected array $active = [];
/**
* Base switch to add values as string or array
*
* @var boolean
* @since 3.2.0
**/
protected bool $addAsArray = false;
/**
* Check if the registry has any content.
*
@ -95,21 +103,29 @@ abstract class ActiveRegistry implements Activeregistryinterface
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void
public function addActive($value, ?bool $asArray, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value.");
}
// null fallback to class value
if ($asArray === null)
{
$asArray = $this->addAsArray;
}
$array = &$this->active;
foreach ($keys as $key)

View File

@ -6,6 +6,14 @@
**/
protected array $active = [];
/**
* Base switch to add values as string or array
*
* @var boolean
* @since 3.2.0
**/
protected bool $addAsArray = false;
/**
* Check if the registry has any content.
*
@ -69,21 +77,29 @@
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void
public function addActive($value, ?bool $asArray, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value.");
}
// null fallback to class value
if ($asArray === null)
{
$asArray = $this->addAsArray;
}
$array = &$this->active;
foreach ($keys as $key)

View File

@ -15,6 +15,8 @@ abstract Helper #Orange {
+ {static} getOption(string $default = 'empty') : ?string
+ {static} getCode(?string $option = null, ?string $default = null) : ?string
+ {static} get(string $option = null, string $default = null) : ?string
+ {static} getNamespace(?string $option = null) : ?string
+ {static} getManifest(?string $option = null) : ?object
+ {static} methodExists(string $method, string $option = null) : bool
+ {static} _(string $method, array $arguments = [], ...) : mixed
}
@ -26,7 +28,7 @@ note right of Helper::getParams
return: Registry
end note
note right of Helper::getOption
note left of Helper::getOption
Gets the component option
since: 3.0.11
@ -40,13 +42,27 @@ note right of Helper::getCode
return: ?string
end note
note right of Helper::get
note left of Helper::get
Gets the component abstract helper class
since: 3.0.11
return: ?string
end note
note right of Helper::getNamespace
Gets the component namespace if set
since: 3.0.11
return: ?string
end note
note left of Helper::getManifest
Gets the component abstract helper class
since: 3.0.11
return: ?object
end note
note right of Helper::methodExists
Check if the helper class of this component has a method
@ -54,7 +70,7 @@ note right of Helper::methodExists
return: bool
end note
note right of Helper::_
note left of Helper::_
Check if the helper class of this component has a method, and call it with the arguments
since: 3.2.0

View File

@ -12,9 +12,11 @@
namespace VDM\Joomla\Utilities\Component;
use Joomla\Input\Input;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\String\NamespaceHelper;
/**
@ -27,10 +29,18 @@ abstract class Helper
/**
* The current option
*
* @var string
* @var string|null
* @since 3.0.11
*/
public static string $option;
public static ?string $option = null;
/**
* The component manifest list cache
*
* @var array
* @since 3.2.0
*/
public static array $manifest = [];
/**
* The component params list cache
@ -79,15 +89,27 @@ abstract class Helper
if (empty(self::$option))
{
// get the option from the url input
self::$option = (new Input)->getString('option', false);
self::$option = (new Input)->getString('option', null);
}
if (self::$option)
if (empty(self::$option))
{
return self::$option;
$app = Factory::getApplication();
// Check if the getInput method exists in the application object
if (method_exists($app, 'getInput'))
{
// get the option from the application
self::$option = $app->getInput()->getCmd('option', $default);
}
else
{
// Use the default value if getInput method does not exist
self::$option = $default;
}
}
return $default;
return self::$option;
}
/**
@ -129,20 +151,92 @@ abstract class Helper
{
// check that we have an option
// and get the code name from it
if (($code_name = self::getCode($option, false)) !== false)
if (($code_name = self::getCode($option, null)) !== null)
{
// we build the helper class name
$helper_name = '\\' . \ucfirst($code_name) . 'Helper';
// check if class exist
if (class_exists($helper_name))
{
return $helper_name;
}
// try loading namespace
if (($namespace = self::getNamespace($option)) !== null)
{
$name = \ucfirst($code_name) . 'Helper';
$namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin...
if (class_exists($namespace_helper))
{
return $namespace_helper;
}
}
}
return $default;
}
/**
* Gets the component namespace if set
*
* @param string|null $option The option for the component.
* @param string|null $default The default return value if none is found
*
* @return string|null A component namespace
*
* @since 3.0.11
*/
public static function getNamespace(?string $option = null): ?string
{
$manifest = self::getManifest($option);
return $manifest->namespace ?? null;
}
/**
* Gets the component abstract helper class
*
* @param string|null $option The option for the component.
* @param string|null $default The default return value if none is found
*
* @return object|null A component helper name
*
* @since 3.0.11
*/
public static function getManifest(?string $option = null): ?object
{
if ($option === null
&& ($option = self::getOption($option)) === null)
{
return null;
}
// get global manifest_cache values
if (!isset(self::$manifest[$option]))
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('manifest_cache'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where($db->quoteName('element') . ' LIKE ' . $db->quote($option));
$db->setQuery($query);
try {
$manifest = $db->loadResult();
self::$manifest[$option] = json_decode($manifest);
} catch (\Exception $e) {
// Handle the database error appropriately.
self::$manifest[$option] = null;
}
}
return self::$manifest[$option];
}
/**
* Check if the helper class of this component has a method
*
@ -156,7 +250,7 @@ abstract class Helper
public static function methodExists(string $method, string $option = null): bool
{
// get the helper class
return ($helper = self::get($option, false)) !== false &&
return ($helper = self::get($option, null)) !== null &&
method_exists($helper, $method);
}
@ -173,7 +267,7 @@ abstract class Helper
public static function _(string $method, array $arguments = [], ?string $option = null)
{
// get the helper class
if (($helper = self::get($option, false)) !== false &&
if (($helper = self::get($option, null)) !== null &&
method_exists($helper, $method))
{
// we know this is not ideal...

View File

@ -1,10 +1,18 @@
/**
* The current option
*
* @var string
* @var string|null
* @since 3.0.11
*/
public static string $option;
public static ?string $option = null;
/**
* The component manifest list cache
*
* @var array
* @since 3.2.0
*/
public static array $manifest = [];
/**
* The component params list cache
@ -53,15 +61,27 @@
if (empty(self::$option))
{
// get the option from the url input
self::$option = (new Input)->getString('option', false);
self::$option = (new Input)->getString('option', null);
}
if (self::$option)
if (empty(self::$option))
{
return self::$option;
$app = Factory::getApplication();
// Check if the getInput method exists in the application object
if (method_exists($app, 'getInput'))
{
// get the option from the application
self::$option = $app->getInput()->getCmd('option', $default);
}
else
{
// Use the default value if getInput method does not exist
self::$option = $default;
}
}
return $default;
return self::$option;
}
/**
@ -103,20 +123,92 @@
{
// check that we have an option
// and get the code name from it
if (($code_name = self::getCode($option, false)) !== false)
if (($code_name = self::getCode($option, null)) !== null)
{
// we build the helper class name
$helper_name = '\\' . \ucfirst($code_name) . 'Helper';
// check if class exist
if (class_exists($helper_name))
{
return $helper_name;
}
// try loading namespace
if (($namespace = self::getNamespace($option)) !== null)
{
$name = \ucfirst($code_name) . 'Helper';
$namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin...
if (class_exists($namespace_helper))
{
return $namespace_helper;
}
}
}
return $default;
}
/**
* Gets the component namespace if set
*
* @param string|null $option The option for the component.
* @param string|null $default The default return value if none is found
*
* @return string|null A component namespace
*
* @since 3.0.11
*/
public static function getNamespace(?string $option = null): ?string
{
$manifest = self::getManifest($option);
return $manifest->namespace ?? null;
}
/**
* Gets the component abstract helper class
*
* @param string|null $option The option for the component.
* @param string|null $default The default return value if none is found
*
* @return object|null A component helper name
*
* @since 3.0.11
*/
public static function getManifest(?string $option = null): ?object
{
if ($option === null
&& ($option = self::getOption($option)) === null)
{
return null;
}
// get global manifest_cache values
if (!isset(self::$manifest[$option]))
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('manifest_cache'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('type') . ' = ' . $db->quote('component'))
->where($db->quoteName('element') . ' LIKE ' . $db->quote($option));
$db->setQuery($query);
try {
$manifest = $db->loadResult();
self::$manifest[$option] = json_decode($manifest);
} catch (\Exception $e) {
// Handle the database error appropriately.
self::$manifest[$option] = null;
}
}
return self::$manifest[$option];
}
/**
* Check if the helper class of this component has a method
*
@ -130,7 +222,7 @@
public static function methodExists(string $method, string $option = null): bool
{
// get the helper class
return ($helper = self::get($option, false)) !== false &&
return ($helper = self::get($option, null)) !== null &&
method_exists($helper, $method);
}
@ -147,7 +239,7 @@
public static function _(string $method, array $arguments = [], ?string $option = null)
{
// get the helper class
if (($helper = self::get($option, false)) !== false &&
if (($helper = self::get($option, null)) !== null &&
method_exists($helper, $method))
{
// we know this is not ideal...

View File

@ -9,10 +9,15 @@
"power_version": "1.0.0",
"system_name": "Utilities Component Helper",
"type": "abstract class",
"use_selection": null,
"use_selection": {
"use_selection0": {
"use": "ce8cf834-6bac-44fb-941c-861f7e046cc0",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Utilities.Component.Helper",
"description": "Some component helper\r\n\r\n@since 3.0.11",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\Input\\Input;\r\nuse Joomla\\CMS\\Component\\ComponentHelper;\r\nuse Joomla\\Registry\\Registry;",
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Component\\ComponentHelper;\r\nuse Joomla\\Input\\Input;\r\nuse Joomla\\Registry\\Registry;",
"composer": ""
}

View File

@ -29,6 +29,8 @@ end note
note right of Registryinterface::add
Adds content into the registry. If a key exists,
it either appends or concatenates based on $asArray switch.
Default is $addAsArray = false (if null) in base class.
Override in child class allowed set class property $addAsArray = true.
since: 3.2.0
return: void
@ -36,7 +38,7 @@ it either appends or concatenates based on $asArray switch.
arguments:
string $path
mixed $value
bool $asArray = false
?bool $asArray = null
end note
note right of Registryinterface::get

View File

@ -35,15 +35,17 @@ interface Registryinterface
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void;
public function add(string $path, $value, ?bool $asArray = null): void;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.

View File

@ -14,15 +14,17 @@
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void;
public function add(string $path, $value, ?bool $asArray = null): void;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.

View File

@ -11,9 +11,9 @@
```uml
@startuml
abstract Database #Orange {
# \JDatabaseDriver $db
# $db
# string $table
+ __construct(?\JDatabaseDriver $db = null)
+ __construct()
# quote(mixed $value) : mixed
# getTable(string $table) : string
}

View File

@ -26,10 +26,9 @@ abstract class Database
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
*/
protected \JDatabaseDriver $db;
protected $db;
/**
* Core Component Table Name
@ -42,14 +41,12 @@ abstract class Database
/**
* Constructor
*
* @param \JDatabaseDriver|null $db The database driver
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?\JDatabaseDriver $db = null)
public function __construct()
{
$this->db = $db ?: JoomlaFactory::getDbo();
$this->db = JoomlaFactory::getDbo();
// set the component table
$this->table = '#__' . Helper::getCode();

View File

@ -1,10 +1,9 @@
/**
* Database object to query local DB
*
* @var \JDatabaseDriver
* @since 3.2.0
*/
protected \JDatabaseDriver $db;
protected $db;
/**
* Core Component Table Name
@ -17,14 +16,12 @@
/**
* Constructor
*
* @param \JDatabaseDriver|null $db The database driver
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?\JDatabaseDriver $db = null)
public function __construct()
{
$this->db = $db ?: JoomlaFactory::getDbo();
$this->db = JoomlaFactory::getDbo();
// set the component table
$this->table = '#__' . Helper::getCode();

View File

@ -1,388 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait Utilities (Details)
> namespace: **VDM\Joomla**
```uml
@startuml
class Utilities << (T,Orange) >> #Turquoise {
+ static $langTag
+ {static} checkString($string) : bool
+ {static} shorten($string, $length = 40, ...)
+ {static} safeString($string, $type = 'L', ...)
+ {static} safeClassFunctionName($name)
+ {static} safeFieldName($string, $allcap = false, ...)
+ {static} safeTypeName($string)
+ {static} safeNamespace($string)
+ {static} transliterate($string)
+ {static} htmlEscape($var, $charset = 'UTF-8', ...)
+ {static} replaceNumbers($string)
+ {static} numberToString($x)
+ {static} randomkey($size) : string
+ {static} checkJson($string) : bool
+ {static} jsonToString($value, $sperator = ", ...)
+ {static} checkArray($array, $removeEmptyString = false) : int
+ {static} mergeArrays($arrays)
+ {static} checkObject($object) : bool
+ {static} getVar(string $table, string $where = null, ...) : mix
+ {static} getVars(string $table, string $where = null, ...) : array
+ {static} getAllBetween(string $content, string $start, ...) : array
+ {static} getBetween(string $content, string $start, ...) : string
+ {static} bcmath(string $type, int $val1, ...) : float|int
+ {static} bcsum(array $array, int $scale = 4) : float|int
+ {static} createPluginClassName($group, $name) : string
+ {static} GUID(bool $trim = true) : string
+ {static} validGUID(string $guid, string $table = null, ...) : bool
+ {static} getGUID(string $guid, string $table, ...) : mix
# {static} validateGUID(string $guid) : bool
+ {static} zip(string $workingDIR, string $filepath) : bool
+ {static} getFileContents(string $path, string/bool $none = '') : string
+ {static} writeFile(string $path, string $data) : bool
+ {static} getAllFilePaths(string $folder, array $fileTypes = array('\.php') : void
+ {static} getFilePath(string $type = 'path', string $target = 'filepath', ...) : string
+ {static} urlExists(string $path) : bool
+ {static} setComponentOption(String|null $option = null)
}
note right of Utilities::checkString
Check if have a string with a length
since: 3.0.9
return: bool
end note
note left of Utilities::shorten
Shorten a string
since: 3.0.9
arguments:
$string
$length = 40
$addTip = true
end note
note right of Utilities::safeString
Making strings safe (various ways)
since: 3.0.9
arguments:
$string
$type = 'L'
$spacer = '_'
$replaceNumbers = true
$keepOnlyCharacters = true
end note
note left of Utilities::safeClassFunctionName
Making class or function name safe
since: 3.0.9
end note
note right of Utilities::safeFieldName
Making field names safe
since: 3.0.9
arguments:
$string
$allcap = false
$spacer = '_'
end note
note left of Utilities::safeTypeName
Making field type name safe
since: 3.0.9
end note
note right of Utilities::safeNamespace
Making namespace safe
since: 3.0.9
end note
note left of Utilities::transliterate
since: 3.0.9
end note
note right of Utilities::htmlEscape
since: 3.0.9
arguments:
$var
$charset = 'UTF-8'
$shorten = false
$length = 40
end note
note left of Utilities::replaceNumbers
since: 3.0.9
end note
note right of Utilities::numberToString
Convert an integer into an English word string
Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
since: 3.0.9
end note
note left of Utilities::randomkey
Random Key
since: 3.0.9
return: string
end note
note right of Utilities::checkJson
Check if you have a json string
since: 3.0.9
return: bool
end note
note left of Utilities::jsonToString
since: 3.0.9
arguments:
$value
$sperator = "
$table = null
$id = 'id'
$name = 'name'
end note
note right of Utilities::checkArray
Check if you have an array with a length
since: 3.0.9
return: int
end note
note left of Utilities::mergeArrays
Merge an array of array's
since: 3.0.9
end note
note right of Utilities::checkObject
Check if you have an object with a length
since: 3.0.9
return: bool
end note
note left of Utilities::getVar
Get a Variable
since: 3.0.9
return: mix
arguments:
string $table
string $where = null
string $whereString = 'user'
string $what = 'id'
string $operator = '='
string $main = null
end note
note right of Utilities::getVars
Get array of variables
since: 3.0.9
return: array
arguments:
string $table
string $where = null
string $whereString = 'user'
string $what = 'id'
string $operator = 'IN'
string $main = null
bool $unique = true
end note
note left of Utilities::getAllBetween
get all strings between two other strings
since: 3.0.9
return: array
arguments:
string $content
string $start
string $end
end note
note right of Utilities::getBetween
get a string between two other strings
since: 3.0.9
return: string
arguments:
string $content
string $start
string $end
string $default = ''
end note
note left of Utilities::bcmath
bc math wrapper (very basic not for accounting)
since: 3.0.9
return: float|int
arguments:
string $type
int $val1
int $val2
int $scale
end note
note right of Utilities::bcsum
Basic sum of an array with more precision
since: 3.0.9
return: float|int
end note
note left of Utilities::createPluginClassName
create plugin class name
since: 3.0.9
return: string
end note
note right of Utilities::GUID
Returns a GUIDv4 string
Thanks to Dave Pearson (and other)
https://www.php.net/manual/en/function.com-create-guid.php#119168
Uses the best cryptographically secure method
for all supported platforms with fallback to an older,
less secure version.
since: 3.0.9
return: string
end note
note left of Utilities::validGUID
Validate the Globally Unique Identifier ( and check if table already has this identifier)
since: 3.0.9
return: bool
arguments:
string $guid
string $table = null
int $id
string|null $component = null
end note
note right of Utilities::getGUID
get the ITEM of a GUID by table
since: 3.0.9
return: mix
arguments:
string $guid
string $table
string/array $what = 'a.id'
string|null $component = null
end note
note left of Utilities::validateGUID
Validate the Globally Unique Identifier
Thanks to Lewie
https://stackoverflow.com/a/1515456/1429677
return: bool
end note
note right of Utilities::zip
The zipper method
since: 3.0.9
return: bool
end note
note left of Utilities::getFileContents
get the content of a file
since: 3.0.9
return: string
end note
note right of Utilities::writeFile
Write a file to the server
since: 3.0.9
return: bool
end note
note left of Utilities::getAllFilePaths
get all the file paths in folder and sub folders
since: 3.0.9
return: void
end note
note right of Utilities::getFilePath
Get the file path or url
since: 3.0.9
return: string
arguments:
string $type = 'path'
string $target = 'filepath'
string $fileType = null
string $key = ''
string $default = ''
bool $createIfNotSet = true
end note
note left of Utilities::urlExists
Check if file exist
since: 3.0.9
return: bool
end note
note right of Utilities::setComponentOption
Set the component option
since: 3.0.11
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -1,669 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 3rd September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\MathHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\String\FieldHelper;
use VDM\Joomla\Utilities\String\TypeHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\String\PluginHelper;
use VDM\Joomla\Utilities\Component\Helper;
/**
* Basic shared utilities, a legacy implementation
*
* @since 3.0.9
*/
trait Utilities
{
/**
* The Main Active Language
*
* @var string
*
* @since 3.0.9
*/
public static $langTag;
/**
* Check if have a string with a length
*
* @input string $string The string to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::check($string);
*/
public static function checkString($string): bool
{
return StringHelper::check($string);
}
/**
* Shorten a string
*
* @input string $string That you would like to shorten
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::shorten($string, $length, $addTip);
*/
public static function shorten($string, $length = 40, $addTip = true)
{
return StringHelper::shorten($string, $length, $addTip);
}
/**
* Making strings safe (various ways)
*
* @input string $string That you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
*/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
// set the local component option
self::setComponentOption();
return StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
}
/**
* Making class or function name safe
*
* @input string The name you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ClassfunctionHelper::safe($name);
*/
public static function safeClassFunctionName($name)
{
return ClassfunctionHelper::safe($name);
}
/**
* Making field names safe
*
* @input string The you would like to make safe
* @input boolean The switch to return an ALL UPPER CASE string
* @input string The string to use in white space
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FieldHelper::safe($string, $allcap, $spacer);
*/
public static function safeFieldName($string, $allcap = false, $spacer = '_')
{
// set the local component option
self::setComponentOption();
return FieldHelper::safe($string, $allcap, $spacer);
}
/**
* Making field type name safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use TypeHelper::safe($string);
*/
public static function safeTypeName($string)
{
// set the local component option
self::setComponentOption();
return TypeHelper::safe($string);
}
/**
* Making namespace safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use NamespaceHelper::safe($string);
*/
public static function safeNamespace($string)
{
return NamespaceHelper::safe($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::transliterate($string);
*/
public static function transliterate($string)
{
// set the local component option
self::setComponentOption();
return StringHelper::transliterate($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::html($var, $charset, $shorten, $length);
*/
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
// set the local component option
self::setComponentOption();
return StringHelper::html($var, $charset, $shorten, $length);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::numbers($string);
*/
public static function replaceNumbers($string)
{
return StringHelper::numbers($string);
}
/**
* Convert an integer into an English word string
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
*
* @input int $x an int
*
* @returns string a string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::number($x);
*/
public static function numberToString($x)
{
return StringHelper::number($x);
}
/**
* Random Key
*
* @input int $size the length of the string
*
* @returns string a string of random characters
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::random($size);
*/
public static function randomkey($size): string
{
return StringHelper::random($size);
}
/**
* Check if you have a json string
*
* @input string $string The json string to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use JsonHelper::check($string);
*/
public static function checkJson($string): bool
{
return JsonHelper::check($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use JsonHelper::string($value, $sperator, $table, $id, $name);
*/
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
return JsonHelper::string($value, $sperator, $table, $id, $name);
}
/**
* Check if you have an array with a length
*
* @input mixed $array The array to check
* @input bool $removeEmptyString Should we remove empty values
*
* @returns int number of items in array on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ArrayHelper::check($array, $removeEmptyString);
*/
public static function checkArray($array, $removeEmptyString = false): int
{
return ArrayHelper::check($array, $removeEmptyString);
}
/**
* Merge an array of array's
*
* @input mixed $arrays The arrays you would like to merge
*
* @returns mixed array on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ArrayHelper::merge($arrays);
*/
public static function mergeArrays($arrays)
{
return ArrayHelper::merge($arrays);
}
/**
* Check if you have an object with a length
*
* @input object $object The object to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ObjectHelper::check($object);
*/
public static function checkObject($object): bool
{
return ObjectHelper::check($object);
}
/**
* Get a Variable
*
* @param string $table The table from which to get the variable
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
*
* @return mix string/int/float
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::var($table, $where, $whereString, $what, $operator, $main);
*/
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = null)
{
// set the local component option
self::setComponentOption();
return GetHelper::var($table, $where, $whereString, $what, $operator, $main);
}
/**
* Get array of variables
*
* @param string $table The table from which to get the variables
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
*
* @return array
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
*/
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = null, $unique = true)
{
// set the local component option
self::setComponentOption();
return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
}
/**
* get all strings between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return array On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end);
*/
public static function getAllBetween($content, $start, $end)
{
return GetHelper::allBetween($content, $start, $end);
}
/**
* get a string between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $default The default value if none found
*
* @return string On success / empty string on failure
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::between($content, $start, $end, $default);
*/
public static function getBetween($content, $start, $end, $default = '')
{
return GetHelper::between($content, $start, $end, $default);
}
/**
* bc math wrapper (very basic not for accounting)
*
* @param string $type The type bc math
* @param int $val1 The first value
* @param int $val2 The second value
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale);
*/
public static function bcmath($type, $val1, $val2, $scale = 0)
{
return MathHelper::bc($type, $val1, $val2, $scale);
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::sum($array, $scale);
*/
public static function bcsum($array, $scale = 4)
{
return MathHelper::sum($array, $scale);
}
/**
* create plugin class name
*
* @input string The group name
* @input string The name
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use PluginHelper::safe($name, $group);
*/
public static function createPluginClassName($group, $name)
{
return PluginHelper::safeClassName($name, $group);
}
/**
* Returns a GUIDv4 string
*
* Thanks to Dave Pearson (and other)
* https://www.php.net/manual/en/function.com-create-guid.php#119168
*
* Uses the best cryptographically secure method
* for all supported platforms with fallback to an older,
* less secure version.
*
* @param bool $trim
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::get($trim);
*/
public static function GUID($trim = true)
{
return GuidHelper::get($trim);
}
/**
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
*
* @param string $guid
* @param string $table
* @param int $id
* @param string|null $component
*
* @return bool
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
public static function validGUID($guid, $table = null, $id = 0, $component = null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::valid($guid, $table, $id, $component);
}
/**
* get the ITEM of a GUID by table
*
* @param string $guid
* @param string $table
* @param string/array $what
* @param string|null $component
*
* @return mix
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
public static function getGUID($guid, $table, $what = 'a.id', $component = null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::item($guid, $table, $what, $component);
}
/**
* Validate the Globally Unique Identifier
*
* Thanks to Lewie
* https://stackoverflow.com/a/1515456/1429677
*
* @param string $guid
*
* @return bool
*
* @deprecated 4.0 - Use GuidHelper::validate($guid);
*/
protected static function validateGUID($guid)
{
return GuidHelper::validate($guid);
}
/**
* The zipper method
*
* @param string $workingDIR The directory where the items must be zipped
* @param string $filepath The path to where the zip file must be placed
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath);
*/
public static function zip($workingDIR, &$filepath)
{
return FileHelper::zip($workingDIR, $filepath);
}
/**
* get the content of a file
*
* @param string $path The path to the file
* @param string/bool $none The return value if no content was found
*
* @return string On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getContent($path, $none);
*/
public static function getFileContents($path, $none = '')
{
return FileHelper::getContent($path, $none);
}
/**
* Write a file to the server
*
* @param string $path The path and file name where to safe the data
* @param string $data The data to safe
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::write($path, $data);
*/
public static function writeFile($path, $data)
{
return FileHelper::write($path, $data);
}
/**
* get all the file paths in folder and sub folders
*
* @param string $folder The local path to parse
* @param array $fileTypes The type of files to get
*
* @return void
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
*/
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{
return FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
}
/**
* Get the file path or url
*
* @param string $type The (url/path) type to return
* @param string $target The Params Target name (if set)
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
* @param string $key The key to adjust the filename (if not set ignored)
* @param string $default The default path if not set in Params (fallback path)
* @param bool $createIfNotSet The switch to create the folder if not found
*
* @return string On success the path or url is returned based on the type requested
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
*/
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
{
// set the local component option
self::setComponentOption();
return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
}
/**
* Check if file exist
*
* @param string $path The url/path to check
*
* @return bool If exist true
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::exists($path);
*/
public static function urlExists($path)
{
return FileHelper::exists($path);
}
/**
* Set the component option
*
* @param String|null $option The option for the component.
*
* @since 3.0.11
*/
public static function setComponentOption($option = null)
{
// set the local component option
if (empty($option))
{
if (empty(Helper::$option) && property_exists(__CLASS__, 'ComponentCodeName'))
{
Helper::$option = 'com_' . self::$ComponentCodeName;
}
}
else
{
Helper::$option = $option;
}
}
}

View File

@ -1,629 +0,0 @@
/**
* The Main Active Language
*
* @var string
*
* @since 3.0.9
*/
public static $langTag;
/**
* Check if have a string with a length
*
* @input string $string The string to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::check($string);
*/
public static function checkString($string): bool
{
return StringHelper::check($string);
}
/**
* Shorten a string
*
* @input string $string That you would like to shorten
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::shorten($string, $length, $addTip);
*/
public static function shorten($string, $length = 40, $addTip = true)
{
return StringHelper::shorten($string, $length, $addTip);
}
/**
* Making strings safe (various ways)
*
* @input string $string That you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
*/
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
{
// set the local component option
self::setComponentOption();
return StringHelper::safe($string, $type, $spacer, $replaceNumbers, $keepOnlyCharacters);
}
/**
* Making class or function name safe
*
* @input string The name you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ClassfunctionHelper::safe($name);
*/
public static function safeClassFunctionName($name)
{
return ClassfunctionHelper::safe($name);
}
/**
* Making field names safe
*
* @input string The you would like to make safe
* @input boolean The switch to return an ALL UPPER CASE string
* @input string The string to use in white space
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FieldHelper::safe($string, $allcap, $spacer);
*/
public static function safeFieldName($string, $allcap = false, $spacer = '_')
{
// set the local component option
self::setComponentOption();
return FieldHelper::safe($string, $allcap, $spacer);
}
/**
* Making field type name safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use TypeHelper::safe($string);
*/
public static function safeTypeName($string)
{
// set the local component option
self::setComponentOption();
return TypeHelper::safe($string);
}
/**
* Making namespace safe
*
* @input string The you would like to make safe
*
* @returns string on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use NamespaceHelper::safe($string);
*/
public static function safeNamespace($string)
{
return NamespaceHelper::safe($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::transliterate($string);
*/
public static function transliterate($string)
{
// set the local component option
self::setComponentOption();
return StringHelper::transliterate($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::html($var, $charset, $shorten, $length);
*/
public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40)
{
// set the local component option
self::setComponentOption();
return StringHelper::html($var, $charset, $shorten, $length);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::numbers($string);
*/
public static function replaceNumbers($string)
{
return StringHelper::numbers($string);
}
/**
* Convert an integer into an English word string
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
*
* @input int $x an int
*
* @returns string a string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::number($x);
*/
public static function numberToString($x)
{
return StringHelper::number($x);
}
/**
* Random Key
*
* @input int $size the length of the string
*
* @returns string a string of random characters
*
* @since 3.0.9
*
* @deprecated 4.0 - Use StringHelper::random($size);
*/
public static function randomkey($size): string
{
return StringHelper::random($size);
}
/**
* Check if you have a json string
*
* @input string $string The json string to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use JsonHelper::check($string);
*/
public static function checkJson($string): bool
{
return JsonHelper::check($string);
}
/**
* @since 3.0.9
*
* @deprecated 4.0 - Use JsonHelper::string($value, $sperator, $table, $id, $name);
*/
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
{
return JsonHelper::string($value, $sperator, $table, $id, $name);
}
/**
* Check if you have an array with a length
*
* @input mixed $array The array to check
* @input bool $removeEmptyString Should we remove empty values
*
* @returns int number of items in array on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ArrayHelper::check($array, $removeEmptyString);
*/
public static function checkArray($array, $removeEmptyString = false): int
{
return ArrayHelper::check($array, $removeEmptyString);
}
/**
* Merge an array of array's
*
* @input mixed $arrays The arrays you would like to merge
*
* @returns mixed array on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ArrayHelper::merge($arrays);
*/
public static function mergeArrays($arrays)
{
return ArrayHelper::merge($arrays);
}
/**
* Check if you have an object with a length
*
* @input object $object The object to check
*
* @returns bool true on success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use ObjectHelper::check($object);
*/
public static function checkObject($object): bool
{
return ObjectHelper::check($object);
}
/**
* Get a Variable
*
* @param string $table The table from which to get the variable
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
*
* @return mix string/int/float
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::var($table, $where, $whereString, $what, $operator, $main);
*/
public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = null)
{
// set the local component option
self::setComponentOption();
return GetHelper::var($table, $where, $whereString, $what, $operator, $main);
}
/**
* Get array of variables
*
* @param string $table The table from which to get the variables
* @param string $where The value where
* @param string $whereString The target/field string where/name
* @param string $what The return field
* @param string $operator The operator between $whereString/field and $where/value
* @param string $main The component in which the table is found
* @param bool $unique The switch to return a unique array
*
* @return array
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
*/
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = null, $unique = true)
{
// set the local component option
self::setComponentOption();
return GetHelper::vars($table, $where, $whereString, $what, $operator, $main, $unique);
}
/**
* get all strings between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
*
* @return array On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::allBetween($content, $start, $end);
*/
public static function getAllBetween($content, $start, $end)
{
return GetHelper::allBetween($content, $start, $end);
}
/**
* get a string between two other strings
*
* @param string $content The content to search
* @param string $start The starting value
* @param string $end The ending value
* @param string $default The default value if none found
*
* @return string On success / empty string on failure
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GetHelper::between($content, $start, $end, $default);
*/
public static function getBetween($content, $start, $end, $default = '')
{
return GetHelper::between($content, $start, $end, $default);
}
/**
* bc math wrapper (very basic not for accounting)
*
* @param string $type The type bc math
* @param int $val1 The first value
* @param int $val2 The second value
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::bc($type, $val1, $val2, $scale);
*/
public static function bcmath($type, $val1, $val2, $scale = 0)
{
return MathHelper::bc($type, $val1, $val2, $scale);
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float|int
*
* @since 3.0.9
*
* @deprecated 4.0 - Use MathHelper::sum($array, $scale);
*/
public static function bcsum($array, $scale = 4)
{
return MathHelper::sum($array, $scale);
}
/**
* create plugin class name
*
* @input string The group name
* @input string The name
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use PluginHelper::safe($name, $group);
*/
public static function createPluginClassName($group, $name)
{
return PluginHelper::safeClassName($name, $group);
}
/**
* Returns a GUIDv4 string
*
* Thanks to Dave Pearson (and other)
* https://www.php.net/manual/en/function.com-create-guid.php#119168
*
* Uses the best cryptographically secure method
* for all supported platforms with fallback to an older,
* less secure version.
*
* @param bool $trim
*
* @return string
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::get($trim);
*/
public static function GUID($trim = true)
{
return GuidHelper::get($trim);
}
/**
* Validate the Globally Unique Identifier ( and check if table already has this identifier)
*
* @param string $guid
* @param string $table
* @param int $id
* @param string|null $component
*
* @return bool
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
public static function validGUID($guid, $table = null, $id = 0, $component = null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::valid($guid, $table, $id, $component);
}
/**
* get the ITEM of a GUID by table
*
* @param string $guid
* @param string $table
* @param string/array $what
* @param string|null $component
*
* @return mix
*
* @since 3.0.9
*
* @deprecated 4.0 - Use GuidHelper::valid($guid, $table, $id, $component);
*/
public static function getGUID($guid, $table, $what = 'a.id', $component = null)
{
// set the local component option
self::setComponentOption();
return GuidHelper::item($guid, $table, $what, $component);
}
/**
* Validate the Globally Unique Identifier
*
* Thanks to Lewie
* https://stackoverflow.com/a/1515456/1429677
*
* @param string $guid
*
* @return bool
*
* @deprecated 4.0 - Use GuidHelper::validate($guid);
*/
protected static function validateGUID($guid)
{
return GuidHelper::validate($guid);
}
/**
* The zipper method
*
* @param string $workingDIR The directory where the items must be zipped
* @param string $filepath The path to where the zip file must be placed
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::zip($workingDIR, $filepath);
*/
public static function zip($workingDIR, &$filepath)
{
return FileHelper::zip($workingDIR, $filepath);
}
/**
* get the content of a file
*
* @param string $path The path to the file
* @param string/bool $none The return value if no content was found
*
* @return string On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getContent($path, $none);
*/
public static function getFileContents($path, $none = '')
{
return FileHelper::getContent($path, $none);
}
/**
* Write a file to the server
*
* @param string $path The path and file name where to safe the data
* @param string $data The data to safe
*
* @return bool true On success
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::write($path, $data);
*/
public static function writeFile($path, $data)
{
return FileHelper::write($path, $data);
}
/**
* get all the file paths in folder and sub folders
*
* @param string $folder The local path to parse
* @param array $fileTypes The type of files to get
*
* @return void
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
*/
public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
{
return FileHelper::getPaths($folder, $fileTypes , $recurse, $full);
}
/**
* Get the file path or url
*
* @param string $type The (url/path) type to return
* @param string $target The Params Target name (if set)
* @param string $fileType The kind of filename to generate (if not set no file name is generated)
* @param string $key The key to adjust the filename (if not set ignored)
* @param string $default The default path if not set in Params (fallback path)
* @param bool $createIfNotSet The switch to create the folder if not found
*
* @return string On success the path or url is returned based on the type requested
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
*/
public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
{
// set the local component option
self::setComponentOption();
return FileHelper::getPath($type, $target, $fileType, $key, $default, $createIfNotSet);
}
/**
* Check if file exist
*
* @param string $path The url/path to check
*
* @return bool If exist true
*
* @since 3.0.9
*
* @deprecated 4.0 - Use FileHelper::exists($path);
*/
public static function urlExists($path)
{
return FileHelper::exists($path);
}
/**
* Set the component option
*
* @param String|null $option The option for the component.
*
* @since 3.0.11
*/
public static function setComponentOption($option = null)
{
// set the local component option
if (empty($option))
{
if (empty(Helper::$option) && property_exists(__CLASS__, 'ComponentCodeName'))
{
Helper::$option = 'com_' . self::$ComponentCodeName;
}
}
else
{
Helper::$option = $option;
}
}

View File

@ -1,79 +0,0 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "79d765b3-7319-4988-9730-446c7f347020",
"implements": null,
"load_selection": {
"load_selection0": {
"load": "1198aecf-84c6-45d2-aea8-d531aa4afdfa"
}
},
"name": "Utilities",
"power_version": "1.0.0",
"system_name": "Utilities",
"type": "trait",
"use_selection": {
"use_selection0": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
},
"use_selection1": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
},
"use_selection2": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default"
},
"use_selection3": {
"use": "91004529-94a9-4590-b842-e7c6b624ecf5",
"as": "default"
},
"use_selection4": {
"use": "152c8793-8b75-4715-996a-257b9f65451c",
"as": "default"
},
"use_selection5": {
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
"as": "default"
},
"use_selection6": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
"as": "default"
},
"use_selection7": {
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
"as": "default"
},
"use_selection8": {
"use": "9ef0eb24-aae4-4f5a-99af-d724db44808f",
"as": "default"
},
"use_selection9": {
"use": "a8935cbe-7701-40dc-bfd5-675f2d600954",
"as": "default"
},
"use_selection10": {
"use": "30c5b4c2-f75f-4d15-869a-f8bfedd87358",
"as": "default"
},
"use_selection11": {
"use": "ce8cf834-6bac-44fb-941c-861f7e046cc0",
"as": "default"
},
"use_selection12": {
"use": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6",
"as": "default"
},
"use_selection13": {
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Utilities",
"description": "Basic shared utilities, a legacy implementation\r\n\r\n@since 3.0.9",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -32,6 +32,8 @@ end note
note right of Registry::add
Adds content into the registry. If a key exists,
it either appends or concatenates based on $asArray switch.
Default is $addAsArray = false (if null) in base class.
Override in child class allowed set class property $addAsArray = true.
since: 3.2.0
return: void
@ -39,7 +41,7 @@ it either appends or concatenates based on $asArray switch.
arguments:
string $path
mixed $value
bool $asArray = false
?bool $asArray = null
end note
note right of Registry::get

View File

@ -58,15 +58,17 @@ abstract class Registry extends ActiveRegistry implements Activeregistryinterfac
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void
public function add(string $path, $value, ?bool $asArray = null): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{

View File

@ -30,15 +30,17 @@
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void
public function add(string $path, $value, ?bool $asArray = null): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{

View File

@ -13,7 +13,7 @@
abstract GuidHelper #Orange {
+ {static} get(bool $trim = true) : string
+ {static} valid(string $guid, ?string $table = null, ...) : bool
+ {static} item(string $guid, string $table, ...) : mix
+ {static} item(string $guid, string $table, ...) : mixed
# {static} validate(string $guid) : bool
}
@ -46,7 +46,7 @@ note right of GuidHelper::item
get the item by guid in a table
since: 3.0.9
return: mix
return: mixed
arguments:
string $guid

View File

@ -138,7 +138,7 @@ abstract class GuidHelper
* @param string|array $what
* @param string|null $component
*
* @return mix
* @return mixed
*
* @since 3.0.9
*/

View File

@ -113,7 +113,7 @@
* @param string|array $what
* @param string|null $component
*
* @return mix
* @return mixed
*
* @since 3.0.9
*/

View File

@ -13,9 +13,9 @@
abstract FileHelper #Orange {
# static $curlError
+ {static} zip(string $workingDirectory, string $filepath) : bool
+ {static} getContent(string $path, string/bool $none = '') : string
+ {static} getContent(string $path, mixed $none = '') : string
+ {static} write(string $path, string $data) : bool
+ {static} getPaths(string $folder, array $fileTypes = array('\.php') : void
+ {static} getPaths(string $folder, array $fileTypes = array('\.php') : array|null
+ {static} getPath(string $type = 'path', string $target = 'filepath', ...) : string
+ {static} exists(string $path) : bool
}
@ -45,7 +45,7 @@ note right of FileHelper::getPaths
get all the file paths in folder and sub folders
since: 3.0.9
return: void
return: array|null
end note
note right of FileHelper::getPath

View File

@ -89,8 +89,8 @@ abstract class FileHelper
/**
* get the content of a file
*
* @param string $path The path to the file
* @param string/bool $none The return value if no content was found
* @param string $path The path to the file
* @param mixed $none The return value if no content was found
*
* @return string On success
*
@ -150,7 +150,7 @@ abstract class FileHelper
*
* @since 3.0.9
*/
public static function write($path, $data)
public static function write($path, $data): bool
{
$klaar = false;
if (StringHelper::check($data))
@ -179,11 +179,11 @@ abstract class FileHelper
* @param string $folder The local path to parse
* @param array $fileTypes The type of files to get
*
* @return void
* @return array|null
*
* @since 3.0.9
*/
public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array
{
if (Folder::exists($folder))
{
@ -219,7 +219,7 @@ abstract class FileHelper
// return array of files
return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files));
}
return false;
return null;
}
/**
@ -236,7 +236,7 @@ abstract class FileHelper
*
* @since 3.0.9
*/
public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true): string
{
// make sure to always have a string/path
if(!StringHelper::check($default))
@ -316,7 +316,7 @@ abstract class FileHelper
*
* @since 3.0.9
*/
public static function exists($path)
public static function exists($path): bool
{
$exists = false;
// if this is a local path

View File

@ -58,8 +58,8 @@
/**
* get the content of a file
*
* @param string $path The path to the file
* @param string/bool $none The return value if no content was found
* @param string $path The path to the file
* @param mixed $none The return value if no content was found
*
* @return string On success
*
@ -119,7 +119,7 @@
*
* @since 3.0.9
*/
public static function write($path, $data)
public static function write($path, $data): bool
{
$klaar = false;
if (StringHelper::check($data))
@ -148,11 +148,11 @@
* @param string $folder The local path to parse
* @param array $fileTypes The type of files to get
*
* @return void
* @return array|null
*
* @since 3.0.9
*/
public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true)
public static function getPaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'), $recurse = true, $full = true): ?array
{
if (Folder::exists($folder))
{
@ -188,7 +188,7 @@
// return array of files
return array_map( fn($file) => str_replace('./', '/', (string) $file), (array) ArrayHelper::merge($files));
}
return false;
return null;
}
/**
@ -205,7 +205,7 @@
*
* @since 3.0.9
*/
public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true)
public static function getPath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = '', $createIfNotSet = true): string
{
// make sure to always have a string/path
if(!StringHelper::check($default))
@ -285,7 +285,7 @@
*
* @since 3.0.9
*/
public static function exists($path)
public static function exists($path): bool
{
$exists = false;
// if this is a local path

View File

@ -14,7 +14,7 @@ interface Activeregistryinterface #Lavender {
+ isActive() : bool
+ allActive() : array
+ setActive(mixed $value, $keys) : void
+ addActive(mixed $value, bool $asArray, ...) : void
+ addActive(mixed $value, ?bool $asArray, ...) : void
+ getActive(mixed $default, $keys) : mixed
+ removeActive($keys) : void
+ existsActive($keys) : bool
@ -44,13 +44,15 @@ end note
note right of Activeregistryinterface::addActive
Adds content into the registry. If a key exists,
it either appends or concatenates based on the value's type.
Default is $addAsArray = false (if null) in base class.
Override in child class allowed set class property $addAsArray = true.
since: 3.2.0
return: void
arguments:
mixed $value
bool $asArray
?bool $asArray
$keys
end note

View File

@ -51,15 +51,17 @@ interface Activeregistryinterface
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void;
public function addActive($value, ?bool $asArray, string ...$keys): void;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.

View File

@ -30,15 +30,17 @@
* Adds content into the registry. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void;
public function addActive($value, ?bool $asArray, string ...$keys): void;
/**
* Retrieves a value (or sub-array) from the registry using multiple keys.

View File

@ -67,23 +67,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'css_admin' => [
'name' => 'css_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_ADMIN_LABEL',
'type' => 'editor',
'debug_linenr' => [
'name' => 'debug_linenr',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
'php_admin_event' => [
'name' => 'php_admin_event',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
'store' => NULL,
'tab_name' => 'Details',
],
'php_site_event' => [
'name' => 'php_site_event',
@ -94,33 +85,69 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
'crowdin_username' => [
'name' => 'crowdin_username',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_USERNAME_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
'component_version' => [
'name' => 'component_version',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL',
'type' => 'text',
'translation_tool' => [
'name' => 'translation_tool',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION_TOOL_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
'tab_name' => 'Dynamic Integration',
],
'php_postflight_install' => [
'name' => 'php_postflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_LABEL',
'buildcompsql' => [
'name' => 'buildcompsql',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL',
'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dynamic Build (beta)',
],
'add_sales_server' => [
'name' => 'add_sales_server',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SALES_SERVER_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'php_preflight_install' => [
'name' => 'php_preflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
'php_method_uninstall' => [
'name' => 'php_method_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
'css_admin' => [
'name' => 'css_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CSS_ADMIN_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
'mvc_versiondate' => [
'name' => 'mvc_versiondate',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'remove_line_breaks' => [
'name' => 'remove_line_breaks',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_REMOVE_LINE_BREAKS_LABEL',
@ -130,6 +157,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'add_placeholders' => [
'name' => 'add_placeholders',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'description' => [
'name' => 'description',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL',
@ -139,69 +175,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'sql_uninstall' => [
'name' => 'sql_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_LABEL',
'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'MySQL',
],
'debug_linenr' => [
'name' => 'debug_linenr',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DEBUG_LINENR_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'mvc_versiondate' => [
'name' => 'mvc_versiondate',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_MVC_VERSIONDATE_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'php_preflight_install' => [
'name' => 'php_preflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_PREFLIGHT_INSTALL_LABEL',
'php_postflight_install' => [
'name' => 'php_postflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_POSTFLIGHT_INSTALL_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
'backup_folder_path' => [
'name' => 'backup_folder_path',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'php_method_uninstall' => [
'name' => 'php_method_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_METHOD_UNINSTALL_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dash & Install',
],
'add_placeholders' => [
'name' => 'add_placeholders',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PLACEHOLDERS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'author' => [
'name' => 'author',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL',
@ -211,14 +193,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'add_sales_server' => [
'name' => 'add_sales_server',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SALES_SERVER_LABEL',
'type' => 'radio',
'sql_uninstall' => [
'name' => 'sql_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SQL_UNINSTALL_LABEL',
'type' => 'textarea',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dynamic Integration',
'store' => 'base64',
'tab_name' => 'MySQL',
],
'email' => [
'name' => 'email',
@ -229,15 +211,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'translation_tool' => [
'name' => 'translation_tool',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TRANSLATION_TOOL_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'website' => [
'name' => 'website',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_LABEL',
@ -247,14 +220,41 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'buildcompsql' => [
'name' => 'buildcompsql',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDCOMPSQL_LABEL',
'type' => 'textarea',
'backup_folder_path' => [
'name' => 'backup_folder_path',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_FOLDER_PATH_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'php_helper_both' => [
'name' => 'php_helper_both',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Dynamic Build (beta)',
'tab_name' => 'Libs & Helpers',
],
'crowdin_username' => [
'name' => 'crowdin_username',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_USERNAME_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
'php_admin_event' => [
'name' => 'php_admin_event',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_ADMIN_EVENT_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'tab_name' => 'Libs & Helpers',
],
'add_license' => [
'name' => 'add_license',
@ -265,6 +265,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'component_version' => [
'name' => 'component_version',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Details',
],
'php_helper_admin' => [
'name' => 'php_helper_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_ADMIN_LABEL',
@ -454,6 +463,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'publishing',
],
'add_php_helper_both' => [
'name' => 'add_php_helper_both',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'add_php_helper_admin' => [
'name' => 'add_php_helper_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_ADMIN_LABEL',
@ -490,6 +508,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'add_namespace_prefix' => [
'name' => 'add_namespace_prefix',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_NAMESPACE_PREFIX_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'add_javascript' => [
'name' => 'add_javascript',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT_LABEL',
@ -499,6 +526,33 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'namespace_prefix' => [
'name' => 'namespace_prefix',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAMESPACE_PREFIX_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'add_css_admin' => [
'name' => 'add_css_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_ADMIN_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'add_css_site' => [
'name' => 'add_css_site',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_SITE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'add_menu_prefix' => [
'name' => 'add_menu_prefix',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_MENU_PREFIX_LABEL',
@ -508,14 +562,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Settings',
],
'add_css_admin' => [
'name' => 'add_css_admin',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_ADMIN_LABEL',
'dashboard_type' => [
'name' => 'dashboard_type',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_TYPE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
'tab_name' => 'Dash & Install',
],
'menu_prefix' => [
'name' => 'menu_prefix',
@ -526,24 +580,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Settings',
],
'add_css_site' => [
'name' => 'add_css_site',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_SITE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'dashboard_type' => [
'name' => 'dashboard_type',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_TYPE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'dashboard' => [
'name' => 'dashboard',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DASHBOARD_LABEL',
@ -553,15 +589,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'toignore' => [
'name' => 'toignore',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TOIGNORE_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'add_php_preflight_install' => [
'name' => 'add_php_preflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_PREFLIGHT_INSTALL_LABEL',
@ -580,6 +607,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'toignore' => [
'name' => 'toignore',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_TOIGNORE_LABEL',
'type' => 'text',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'add_php_postflight_install' => [
'name' => 'add_php_postflight_install',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_INSTALL_LABEL',
@ -589,6 +625,24 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'add_php_postflight_update' => [
'name' => 'add_php_postflight_update',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_UPDATE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'add_php_method_uninstall' => [
'name' => 'add_php_method_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_METHOD_UNINSTALL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dash & Install',
],
'export_key' => [
'name' => 'export_key',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_LABEL',
@ -598,14 +652,14 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Settings',
],
'add_php_postflight_update' => [
'name' => 'add_php_postflight_update',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_POSTFLIGHT_UPDATE_LABEL',
'add_sql' => [
'name' => 'add_sql',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dash & Install',
'tab_name' => 'MySQL',
],
'joomla_source_link' => [
'name' => 'joomla_source_link',
@ -616,14 +670,14 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Settings',
],
'add_php_method_uninstall' => [
'name' => 'add_php_method_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_METHOD_UNINSTALL_LABEL',
'add_sql_uninstall' => [
'name' => 'add_sql_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_UNINSTALL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Dash & Install',
'tab_name' => 'MySQL',
],
'export_buy_link' => [
'name' => 'export_buy_link',
@ -634,24 +688,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Settings',
],
'add_sql' => [
'name' => 'add_sql',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'MySQL',
],
'add_sql_uninstall' => [
'name' => 'add_sql_uninstall',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_UNINSTALL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'MySQL',
],
'assets_table_fix' => [
'name' => 'assets_table_fix',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ASSETS_TABLE_FIX_LABEL',
@ -661,15 +697,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'MySQL',
],
'addcontributors' => [
'name' => 'addcontributors',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDCONTRIBUTORS_LABEL',
'type' => 'subform',
'title' => false,
'list' => 'joomla_components',
'store' => 'json',
'tab_name' => 'Settings',
],
'readme' => [
'name' => 'readme',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_README_LABEL',
@ -679,15 +706,6 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Readme',
],
'emptycontributors' => [
'name' => 'emptycontributors',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMPTYCONTRIBUTORS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'add_update_server' => [
'name' => 'add_update_server',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL',
@ -697,13 +715,13 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'number' => [
'name' => 'number',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NUMBER_LABEL',
'type' => 'number',
'addcontributors' => [
'name' => 'addcontributors',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDCONTRIBUTORS_LABEL',
'type' => 'subform',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'store' => 'json',
'tab_name' => 'Settings',
],
'update_server_target' => [
@ -715,6 +733,24 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'emptycontributors' => [
'name' => 'emptycontributors',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EMPTYCONTRIBUTORS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'number' => [
'name' => 'number',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NUMBER_LABEL',
'type' => 'number',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Settings',
],
'update_server' => [
'name' => 'update_server',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_UPDATE_SERVER_LABEL',
@ -751,24 +787,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Integration',
],
'creatuserhelper' => [
'name' => 'creatuserhelper',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATUSERHELPER_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'adduikit' => [
'name' => 'adduikit',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'crowdin_project_api_key' => [
'name' => 'crowdin_project_api_key',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CROWDIN_PROJECT_API_KEY_LABEL',
@ -778,10 +796,10 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
'addfootable' => [
'name' => 'addfootable',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDFOOTABLE_LABEL',
'type' => 'list',
'creatuserhelper' => [
'name' => 'creatuserhelper',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_CREATUSERHELPER_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@ -796,10 +814,10 @@ class Table extends BaseTable implements Tableinterface
'store' => 'basic_encryption',
'tab_name' => 'Dynamic Integration',
],
'add_email_helper' => [
'name' => 'add_email_helper',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL',
'type' => 'radio',
'adduikit' => [
'name' => 'adduikit',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@ -814,10 +832,10 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Dynamic Build (beta)',
],
'add_php_helper_both' => [
'name' => 'add_php_helper_both',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_PHP_HELPER_BOTH_LABEL',
'type' => 'radio',
'addfootable' => [
'name' => 'addfootable',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDFOOTABLE_LABEL',
'type' => 'list',
'title' => false,
'list' => 'joomla_components',
'store' => NULL,
@ -832,13 +850,13 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'publishing',
],
'php_helper_both' => [
'name' => 'php_helper_both',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_PHP_HELPER_BOTH_LABEL',
'type' => 'editor',
'add_email_helper' => [
'name' => 'add_email_helper',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'joomla_components',
'store' => 'base64',
'store' => NULL,
'tab_name' => 'Libs & Helpers',
],
'modified' => [
@ -3478,6 +3496,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Main',
],
'php_calculation' => [
'name' => 'php_calculation',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CALCULATION_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Abacus',
],
'php_router_parse' => [
'name' => 'php_router_parse',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_ROUTER_PARSE_LABEL',
@ -3487,51 +3514,24 @@ class Table extends BaseTable implements Tableinterface
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'php_before_getitems' => [
'name' => 'php_before_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEMS_LABEL',
'type' => 'editor',
'add_php_after_getitems' => [
'name' => 'add_php_after_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_AFTER_GETITEMS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'php_after_getitems' => [
'name' => 'php_after_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEMS_LABEL',
'type' => 'editor',
'add_php_router_parse' => [
'name' => 'add_php_router_parse',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_ROUTER_PARSE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'php_after_getitem' => [
'name' => 'php_after_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEM_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'php_getlistquery' => [
'name' => 'php_getlistquery',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'join_db_table' => [
'name' => 'join_db_table',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_DB_TABLE_LABEL',
'type' => 'subform',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'json',
'tab_name' => 'Joint',
],
'view_selection' => [
'name' => 'view_selection',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_SELECTION_LABEL',
@ -3541,6 +3541,33 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Main',
],
'add_php_before_getitems' => [
'name' => 'add_php_before_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEMS_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'add_php_before_getitem' => [
'name' => 'add_php_before_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEM_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'add_php_after_getitem' => [
'name' => 'add_php_after_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_AFTER_GETITEM_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'db_table_main' => [
'name' => 'db_table_main',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_DB_TABLE_MAIN_LABEL',
@ -3577,24 +3604,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Main',
],
'php_calculation' => [
'name' => 'php_calculation',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_CALCULATION_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Abacus',
],
'php_before_getitem' => [
'name' => 'php_before_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEM_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'view_table_main' => [
'name' => 'view_table_main',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_VIEW_TABLE_MAIN_LABEL',
@ -3604,51 +3613,6 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Main',
],
'select_all' => [
'name' => 'select_all',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_SELECT_ALL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'add_php_before_getitem' => [
'name' => 'add_php_before_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEM_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'getcustom' => [
'name' => 'getcustom',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GETCUSTOM_LABEL',
'type' => 'text',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'add_php_after_getitem' => [
'name' => 'add_php_after_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_AFTER_GETITEM_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'pagination' => [
'name' => 'pagination',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PAGINATION_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'add_php_getlistquery' => [
'name' => 'add_php_getlistquery',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_GETLISTQUERY_LABEL',
@ -3658,13 +3622,76 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Custom Script',
],
'add_php_before_getitems' => [
'name' => 'add_php_before_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_BEFORE_GETITEMS_LABEL',
'join_db_table' => [
'name' => 'join_db_table',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_JOIN_DB_TABLE_LABEL',
'type' => 'subform',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'json',
'tab_name' => 'Joint',
],
'select_all' => [
'name' => 'select_all',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_SELECT_ALL_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'php_before_getitem' => [
'name' => 'php_before_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEM_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'getcustom' => [
'name' => 'getcustom',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_GETCUSTOM_LABEL',
'type' => 'text',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'php_after_getitem' => [
'name' => 'php_after_getitem',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEM_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'pagination' => [
'name' => 'pagination',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PAGINATION_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Main',
],
'php_getlistquery' => [
'name' => 'php_getlistquery',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_GETLISTQUERY_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'php_before_getitems' => [
'name' => 'php_before_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_BEFORE_GETITEMS_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'filter' => [
@ -3676,13 +3703,13 @@ class Table extends BaseTable implements Tableinterface
'store' => 'json',
'tab_name' => 'Tweak',
],
'add_php_after_getitems' => [
'name' => 'add_php_after_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_AFTER_GETITEMS_LABEL',
'type' => 'radio',
'php_after_getitems' => [
'name' => 'php_after_getitems',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_PHP_AFTER_GETITEMS_LABEL',
'type' => 'editor',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'store' => 'base64',
'tab_name' => 'Custom Script',
],
'where' => [
@ -3694,15 +3721,6 @@ class Table extends BaseTable implements Tableinterface
'store' => 'json',
'tab_name' => 'Tweak',
],
'add_php_router_parse' => [
'name' => 'add_php_router_parse',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ADD_PHP_ROUTER_PARSE_LABEL',
'type' => 'radio',
'title' => false,
'list' => 'dynamic_gets',
'store' => NULL,
'tab_name' => 'Custom Script',
],
'order' => [
'name' => 'order',
'label' => 'COM_COMPONENTBUILDER_DYNAMIC_GET_ORDER_LABEL',
@ -3804,6 +3822,15 @@ class Table extends BaseTable implements Tableinterface
'store' => NULL,
'tab_name' => 'Details',
],
'joomla_version' => [
'name' => 'joomla_version',
'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_JOOMLA_VERSION_LABEL',
'type' => 'number',
'title' => false,
'list' => 'custom_codes',
'store' => NULL,
'tab_name' => 'Details',
],
'function_name' => [
'name' => 'function_name',
'label' => 'COM_COMPONENTBUILDER_CUSTOM_CODE_FUNCTION_NAME_LABEL',
@ -4830,7 +4857,7 @@ class Table extends BaseTable implements Tableinterface
'groups' => [
'name' => 'groups',
'label' => 'COM_COMPONENTBUILDER_HELP_DOCUMENT_GROUPS_LABEL',
'type' => 'usergroup',
'type' => 'usergrouplist',
'title' => false,
'list' => 'help_documents',
'store' => 'json',

View File

@ -12,6 +12,7 @@
@startuml
abstract NamespaceHelper #Orange {
+ {static} safe(string $string) : string
+ {static} safeSegment(string $string) : string
}
note right of NamespaceHelper::safe
@ -20,6 +21,13 @@ note right of NamespaceHelper::safe
since: 3.0.9
return: string
end note
note right of NamespaceHelper::safeSegment
Making one namespace segment safe
since: 3.0.9
return: string
end note
@enduml
```

View File

@ -38,30 +38,41 @@ abstract class NamespaceHelper
// Split the string into namespace segments
$segments = explode('\\', $string);
foreach ($segments as &$segment)
{
// Check if segment starts with a number
if (preg_match("/^\d/", $segment))
{
// Extract the starting number(s)
preg_match("/^\d+/", $segment, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$segment = str_replace($matches[0], $numberWord, $segment);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $segment = StringHelper::transliterate($segment);
// Make sure segment only contains valid characters
$segment = preg_replace("/[^A-Za-z0-9]/", '', $segment);
}
// make each segment safe
$segments = array_map([self::class, 'safeSegment'], $segments);
// Join the namespace segments back together
return implode('\\', $segments);
}
/**
* Making one namespace segment safe
*
* @param string $string The namespace segment string you would like to make safe
*
* @return string on success
* @since 3.0.9
*/
public static function safeSegment(string $string): string
{
// Check if segment starts with a number
if (preg_match("/^\d/", $string))
{
// Extract the starting number(s)
preg_match("/^\d+/", $string, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$string = str_replace($matches[0], $numberWord, $string);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $segment = StringHelper::transliterate($segment);
// Make sure segment only contains valid characters
return preg_replace("/[^A-Za-z0-9]/", '', $string);
}
}

View File

@ -14,28 +14,39 @@
// Split the string into namespace segments
$segments = explode('\\', $string);
foreach ($segments as &$segment)
{
// Check if segment starts with a number
if (preg_match("/^\d/", $segment))
{
// Extract the starting number(s)
preg_match("/^\d+/", $segment, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$segment = str_replace($matches[0], $numberWord, $segment);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $segment = StringHelper::transliterate($segment);
// Make sure segment only contains valid characters
$segment = preg_replace("/[^A-Za-z0-9]/", '', $segment);
}
// make each segment safe
$segments = array_map([self::class, 'safeSegment'], $segments);
// Join the namespace segments back together
return implode('\\', $segments);
}
/**
* Making one namespace segment safe
*
* @param string $string The namespace segment string you would like to make safe
*
* @return string on success
* @since 3.0.9
*/
public static function safeSegment(string $string): string
{
// Check if segment starts with a number
if (preg_match("/^\d/", $string))
{
// Extract the starting number(s)
preg_match("/^\d+/", $string, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$string = str_replace($matches[0], $numberWord, $string);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $segment = StringHelper::transliterate($segment);
// Make sure segment only contains valid characters
return preg_replace("/[^A-Za-z0-9]/", '', $string);
}

View File

@ -42,7 +42,7 @@ abstract class BaseConfig extends JoomlaRegistry
*
* @since 3.2.0
*/
public function __set(string $key, $value)
public function __set($key, $value)
{
$this->set($key, $value);
}
@ -50,12 +50,12 @@ abstract class BaseConfig extends JoomlaRegistry
/**
* getting any valid value
*
* @param string $key The value's key/path name
* @param string $key The value's key/path name
*
* @since 3.2.0
* @throws \InvalidArgumentException If $key is not a valid function name.
*/
public function __get(string $key)
public function __get($key)
{
// check if it has been set
if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')

View File

@ -17,7 +17,7 @@
*
* @since 3.2.0
*/
public function __set(string $key, $value)
public function __set($key, $value)
{
$this->set($key, $value);
}
@ -25,12 +25,12 @@
/**
* getting any valid value
*
* @param string $key The value's key/path name
* @param string $key The value's key/path name
*
* @since 3.2.0
* @throws \InvalidArgumentException If $key is not a valid function name.
*/
public function __get(string $key)
public function __get($key)
{
// check if it has been set
if (($value = $this->get($key, '__N0T_S3T_Y3T_')) !== '__N0T_S3T_Y3T_')

View File

@ -252,17 +252,6 @@
"spk": "Super__7179fde6_1e51_4b51_8545_7ca18f74a0f4__Power",
"guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4"
},
"79d765b3-7319-4988-9730-446c7f347020": {
"name": "Utilities",
"type": "trait",
"namespace": "VDM\\Joomla",
"code": "src\/79d765b3-7319-4988-9730-446c7f347020\/code.php",
"power": "src\/79d765b3-7319-4988-9730-446c7f347020\/code.power",
"settings": "src\/79d765b3-7319-4988-9730-446c7f347020\/settings.json",
"path": "src\/79d765b3-7319-4988-9730-446c7f347020",
"spk": "Super__79d765b3_7319_4988_9730_446c7f347020__Power",
"guid": "79d765b3-7319-4988-9730-446c7f347020"
},
"7d494d91-ab60-43cd-aecf-d50e07f7f30e": {
"name": "ToString",
"type": "trait",